@progress/kendo-editor-common 1.8.2-dev.202204011418 → 1.9.0-dev.202204081457
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/js/kendo-editor-common.js +2 -2
- package/dist/cdn/main.js +1 -1
- package/dist/es/config/constants.js +4 -0
- package/dist/es/config/schema.js +9 -5
- package/dist/es/main.js +1 -0
- package/dist/es/plugins/image-resize.js +4 -3
- package/dist/es/plugins/table-resize/column-resize.js +294 -0
- package/dist/es/plugins/table-resize/index.js +8 -0
- package/dist/es/plugins/table-resize/row-resize.js +244 -0
- package/dist/es/plugins/table-resize/table-resize.js +281 -0
- package/dist/es/plugins/table-resize/table-view.js +87 -0
- package/dist/es/plugins/table-resize/utils.js +53 -0
- package/dist/es2015/config/constants.js +4 -0
- package/dist/es2015/config/schema.js +11 -8
- package/dist/es2015/main.js +1 -0
- package/dist/es2015/plugins/image-resize.js +4 -3
- package/dist/es2015/plugins/table-resize/column-resize.js +290 -0
- package/dist/es2015/plugins/table-resize/index.js +8 -0
- package/dist/es2015/plugins/table-resize/row-resize.js +240 -0
- package/dist/es2015/plugins/table-resize/table-resize.js +277 -0
- package/dist/es2015/plugins/table-resize/table-view.js +84 -0
- package/dist/es2015/plugins/table-resize/utils.js +51 -0
- package/dist/npm/config/constants.d.ts +4 -0
- package/dist/npm/config/constants.js +4 -0
- package/dist/npm/config/schema.d.ts +1 -0
- package/dist/npm/config/schema.js +8 -4
- package/dist/npm/main.d.ts +1 -0
- package/dist/npm/main.js +2 -0
- package/dist/npm/plugins/image-resize.js +4 -3
- package/dist/npm/plugins/table-resize/column-resize.d.ts +2 -0
- package/dist/npm/plugins/table-resize/column-resize.js +297 -0
- package/dist/npm/plugins/table-resize/index.d.ts +1 -0
- package/dist/npm/plugins/table-resize/index.js +10 -0
- package/dist/npm/plugins/table-resize/row-resize.d.ts +2 -0
- package/dist/npm/plugins/table-resize/row-resize.js +247 -0
- package/dist/npm/plugins/table-resize/table-resize.d.ts +6 -0
- package/dist/npm/plugins/table-resize/table-resize.js +283 -0
- package/dist/npm/plugins/table-resize/table-view.d.ts +17 -0
- package/dist/npm/plugins/table-resize/table-view.js +89 -0
- package/dist/npm/plugins/table-resize/utils.d.ts +12 -0
- package/dist/npm/plugins/table-resize/utils.js +59 -0
- package/dist/systemjs/kendo-editor-common.js +1 -1
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.KendoEditorCommon=e():t.KendoEditorCommon=e()}(window,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=23)}([function(t,e,n){"use strict";function r(t){this.content=t}n.r(e),n.d(e,"ContentMatch",(function(){return _})),n.d(e,"DOMParser",(function(){return tt})),n.d(e,"DOMSerializer",(function(){return pt})),n.d(e,"Fragment",(function(){return i})),n.d(e,"Mark",(function(){return u})),n.d(e,"MarkType",(function(){return Y})),n.d(e,"Node",(function(){return A})),n.d(e,"NodeRange",(function(){return O})),n.d(e,"NodeType",(function(){return J})),n.d(e,"ReplaceError",(function(){return p})),n.d(e,"ResolvedPos",(function(){return S})),n.d(e,"Schema",(function(){return Q})),n.d(e,"Slice",(function(){return f})),r.prototype={constructor:r,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return-1==e?void 0:this.content[e+1]},update:function(t,e,n){var o=n&&n!=t?this.remove(n):this,i=o.find(t),s=o.content.slice();return-1==i?s.push(n||t,e):(s[i+1]=e,n&&(s[i]=n)),new r(s)},remove:function(t){var e=this.find(t);if(-1==e)return this;var n=this.content.slice();return n.splice(e,2),new r(n)},addToStart:function(t,e){return new r([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new r(n)},addBefore:function(t,e,n){var o=this.remove(e),i=o.content.slice(),s=o.find(t);return i.splice(-1==s?i.length:s,0,e,n),new r(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return(t=r.from(t)).size?new r(t.content.concat(this.subtract(t).content)):this},append:function(t){return(t=r.from(t)).size?new r(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=r.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},get size(){return this.content.length>>1}},r.from=function(t){if(t instanceof r)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new r(e)};var o=r;var i=function(t,e){if(this.content=t,this.size=e||0,null==e)for(var n=0;n<t.length;n++)this.size+=t[n].nodeSize},s={firstChild:{configurable:!0},lastChild:{configurable:!0},childCount:{configurable:!0}};i.prototype.nodesBetween=function(t,e,n,r,o){void 0===r&&(r=0);for(var i=0,s=0;s<e;i++){var a=this.content[i],c=s+a.nodeSize;if(c>t&&!1!==n(a,r+s,o,i)&&a.content.size){var l=s+1;a.nodesBetween(Math.max(0,t-l),Math.min(a.content.size,e-l),n,r+l)}s=c}},i.prototype.descendants=function(t){this.nodesBetween(0,this.size,t)},i.prototype.textBetween=function(t,e,n,r){var o="",i=!0;return this.nodesBetween(t,e,(function(s,a){s.isText?(o+=s.text.slice(Math.max(t,a)-a,e-a),i=!n):s.isLeaf&&r?(o+="function"==typeof r?r(s):r,i=!n):!i&&s.isBlock&&(o+=n,i=!0)}),0),o},i.prototype.append=function(t){if(!t.size)return this;if(!this.size)return t;var e=this.lastChild,n=t.firstChild,r=this.content.slice(),o=0;for(e.isText&&e.sameMarkup(n)&&(r[r.length-1]=e.withText(e.text+n.text),o=1);o<t.content.length;o++)r.push(t.content[o]);return new i(r,this.size+t.size)},i.prototype.cut=function(t,e){if(null==e&&(e=this.size),0==t&&e==this.size)return this;var n=[],r=0;if(e>t)for(var o=0,s=0;s<e;o++){var a=this.content[o],c=s+a.nodeSize;c>t&&((s<t||c>e)&&(a=a.isText?a.cut(Math.max(0,t-s),Math.min(a.text.length,e-s)):a.cut(Math.max(0,t-s-1),Math.min(a.content.size,e-s-1))),n.push(a),r+=a.nodeSize),s=c}return new i(n,r)},i.prototype.cutByIndex=function(t,e){return t==e?i.empty:0==t&&e==this.content.length?this:new i(this.content.slice(t,e))},i.prototype.replaceChild=function(t,e){var n=this.content[t];if(n==e)return this;var r=this.content.slice(),o=this.size+e.nodeSize-n.nodeSize;return r[t]=e,new i(r,o)},i.prototype.addToStart=function(t){return new i([t].concat(this.content),this.size+t.nodeSize)},i.prototype.addToEnd=function(t){return new i(this.content.concat(t),this.size+t.nodeSize)},i.prototype.eq=function(t){if(this.content.length!=t.content.length)return!1;for(var e=0;e<this.content.length;e++)if(!this.content[e].eq(t.content[e]))return!1;return!0},s.firstChild.get=function(){return this.content.length?this.content[0]:null},s.lastChild.get=function(){return this.content.length?this.content[this.content.length-1]:null},s.childCount.get=function(){return this.content.length},i.prototype.child=function(t){var e=this.content[t];if(!e)throw new RangeError("Index "+t+" out of range for "+this);return e},i.prototype.maybeChild=function(t){return this.content[t]},i.prototype.forEach=function(t){for(var e=0,n=0;e<this.content.length;e++){var r=this.content[e];t(r,n,e),n+=r.nodeSize}},i.prototype.findDiffStart=function(t,e){return void 0===e&&(e=0),function t(e,n,r){for(var o=0;;o++){if(o==e.childCount||o==n.childCount)return e.childCount==n.childCount?null:r;var i=e.child(o),s=n.child(o);if(i!=s){if(!i.sameMarkup(s))return r;if(i.isText&&i.text!=s.text){for(var a=0;i.text[a]==s.text[a];a++)r++;return r}if(i.content.size||s.content.size){var c=t(i.content,s.content,r+1);if(null!=c)return c}r+=i.nodeSize}else r+=i.nodeSize}}(this,t,e)},i.prototype.findDiffEnd=function(t,e,n){return void 0===e&&(e=this.size),void 0===n&&(n=t.size),function t(e,n,r,o){for(var i=e.childCount,s=n.childCount;;){if(0==i||0==s)return i==s?null:{a:r,b:o};var a=e.child(--i),c=n.child(--s),l=a.nodeSize;if(a!=c){if(!a.sameMarkup(c))return{a:r,b:o};if(a.isText&&a.text!=c.text){for(var u=0,p=Math.min(a.text.length,c.text.length);u<p&&a.text[a.text.length-u-1]==c.text[c.text.length-u-1];)u++,r--,o--;return{a:r,b:o}}if(a.content.size||c.content.size){var f=t(a.content,c.content,r-1,o-1);if(f)return f}r-=l,o-=l}else r-=l,o-=l}}(this,t,e,n)},i.prototype.findIndex=function(t,e){if(void 0===e&&(e=-1),0==t)return c(0,t);if(t==this.size)return c(this.content.length,t);if(t>this.size||t<0)throw new RangeError("Position "+t+" outside of fragment ("+this+")");for(var n=0,r=0;;n++){var o=r+this.child(n).nodeSize;if(o>=t)return o==t||e>0?c(n+1,o):c(n,r);r=o}},i.prototype.toString=function(){return"<"+this.toStringInner()+">"},i.prototype.toStringInner=function(){return this.content.join(", ")},i.prototype.toJSON=function(){return this.content.length?this.content.map((function(t){return t.toJSON()})):null},i.fromJSON=function(t,e){if(!e)return i.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return new i(e.map(t.nodeFromJSON))},i.fromArray=function(t){if(!t.length)return i.empty;for(var e,n=0,r=0;r<t.length;r++){var o=t[r];n+=o.nodeSize,r&&o.isText&&t[r-1].sameMarkup(o)?(e||(e=t.slice(0,r)),e[e.length-1]=o.withText(e[e.length-1].text+o.text)):e&&e.push(o)}return new i(e||t,n)},i.from=function(t){if(!t)return i.empty;if(t instanceof i)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new i([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))},Object.defineProperties(i.prototype,s);var a={index:0,offset:0};function c(t,e){return a.index=t,a.offset=e,a}function l(t,e){if(t===e)return!0;if(!t||"object"!=typeof t||!e||"object"!=typeof e)return!1;var n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(var r=0;r<t.length;r++)if(!l(t[r],e[r]))return!1}else{for(var o in t)if(!(o in e)||!l(t[o],e[o]))return!1;for(var i in e)if(!(i in t))return!1}return!0}i.empty=new i([],0);var u=function(t,e){this.type=t,this.attrs=e};function p(t){var e=Error.call(this,t);return e.__proto__=p.prototype,e}u.prototype.addToSet=function(t){for(var e,n=!1,r=0;r<t.length;r++){var o=t[r];if(this.eq(o))return t;if(this.type.excludes(o.type))e||(e=t.slice(0,r));else{if(o.type.excludes(this.type))return t;!n&&o.type.rank>this.type.rank&&(e||(e=t.slice(0,r)),e.push(this),n=!0),e&&e.push(o)}}return e||(e=t.slice()),n||e.push(this),e},u.prototype.removeFromSet=function(t){for(var e=0;e<t.length;e++)if(this.eq(t[e]))return t.slice(0,e).concat(t.slice(e+1));return t},u.prototype.isInSet=function(t){for(var e=0;e<t.length;e++)if(this.eq(t[e]))return!0;return!1},u.prototype.eq=function(t){return this==t||this.type==t.type&&l(this.attrs,t.attrs)},u.prototype.toJSON=function(){var t={type:this.type.name};for(var e in this.attrs){t.attrs=this.attrs;break}return t},u.fromJSON=function(t,e){if(!e)throw new RangeError("Invalid input for Mark.fromJSON");var n=t.marks[e.type];if(!n)throw new RangeError("There is no mark type "+e.type+" in this schema");return n.create(e.attrs)},u.sameSet=function(t,e){if(t==e)return!0;if(t.length!=e.length)return!1;for(var n=0;n<t.length;n++)if(!t[n].eq(e[n]))return!1;return!0},u.setFrom=function(t){if(!t||0==t.length)return u.none;if(t instanceof u)return[t];var e=t.slice();return e.sort((function(t,e){return t.type.rank-e.type.rank})),e},u.none=[],p.prototype=Object.create(Error.prototype),p.prototype.constructor=p,p.prototype.name="ReplaceError";var f=function(t,e,n){this.content=t,this.openStart=e,this.openEnd=n},d={size:{configurable:!0}};function h(t,e,n){if(n.openStart>t.depth)throw new p("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new p("Inconsistent open depths");return function t(e,n,r,o){var s=e.index(o),a=e.node(o);if(s==n.index(o)&&o<e.depth-r.openStart){var c=t(e,n,r,o+1);return a.copy(a.content.replaceChild(s,c))}if(r.content.size){if(r.openStart||r.openEnd||e.depth!=o||n.depth!=o){var l=function(t,e){for(var n=e.depth-t.openStart,r=e.node(n).copy(t.content),o=n-1;o>=0;o--)r=e.node(o).copy(i.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}(r,e),u=l.start,p=l.end;return w(a,function t(e,n,r,o,s){var a=e.depth>s&&v(e,n,s+1),c=o.depth>s&&v(r,o,s+1),l=[];y(null,e,s,l),a&&c&&n.index(s)==r.index(s)?(m(a,c),g(w(a,t(e,n,r,o,s+1)),l)):(a&&g(w(a,b(e,n,s+1)),l),y(n,r,s,l),c&&g(w(c,b(r,o,s+1)),l));return y(o,null,s,l),new i(l)}(e,u,p,n,o))}var f=e.parent,d=f.content;return w(f,d.cut(0,e.parentOffset).append(r.content).append(d.cut(n.parentOffset)))}return w(a,b(e,n,o))}(t,e,n,0)}function m(t,e){if(!e.type.compatibleContent(t.type))throw new p("Cannot join "+e.type.name+" onto "+t.type.name)}function v(t,e,n){var r=t.node(n);return m(r,e.node(n)),r}function g(t,e){var n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function y(t,e,n,r){var o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(g(t.nodeAfter,r),i++));for(var a=i;a<s;a++)g(o.child(a),r);e&&e.depth==n&&e.textOffset&&g(e.nodeBefore,r)}function w(t,e){if(!t.type.validContent(e))throw new p("Invalid content for node "+t.type.name);return t.copy(e)}function b(t,e,n){var r=[];(y(null,t,n,r),t.depth>n)&&g(w(v(t,e,n+1),b(t,e,n+1)),r);return y(e,null,n,r),new i(r)}d.size.get=function(){return this.content.size-this.openStart-this.openEnd},f.prototype.insertAt=function(t,e){var n=function t(e,n,r,o){var i=e.findIndex(n),s=i.index,a=i.offset,c=e.maybeChild(s);if(a==n||c.isText)return o&&!o.canReplace(s,s,r)?null:e.cut(0,n).append(r).append(e.cut(n));var l=t(c.content,n-a-1,r);return l&&e.replaceChild(s,c.copy(l))}(this.content,t+this.openStart,e,null);return n&&new f(n,this.openStart,this.openEnd)},f.prototype.removeBetween=function(t,e){return new f(function t(e,n,r){var o=e.findIndex(n),i=o.index,s=o.offset,a=e.maybeChild(i),c=e.findIndex(r),l=c.index,u=c.offset;if(s==n||a.isText){if(u!=r&&!e.child(l).isText)throw new RangeError("Removing non-flat range");return e.cut(0,n).append(e.cut(r))}if(i!=l)throw new RangeError("Removing non-flat range");return e.replaceChild(i,a.copy(t(a.content,n-s-1,r-s-1)))}(this.content,t+this.openStart,e+this.openStart),this.openStart,this.openEnd)},f.prototype.eq=function(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd},f.prototype.toString=function(){return this.content+"("+this.openStart+","+this.openEnd+")"},f.prototype.toJSON=function(){if(!this.content.size)return null;var t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t},f.fromJSON=function(t,e){if(!e)return f.empty;var n=e.openStart||0,r=e.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw new RangeError("Invalid input for Slice.fromJSON");return new f(i.fromJSON(t,e.content),n,r)},f.maxOpen=function(t,e){void 0===e&&(e=!0);for(var n=0,r=0,o=t.firstChild;o&&!o.isLeaf&&(e||!o.type.spec.isolating);o=o.firstChild)n++;for(var i=t.lastChild;i&&!i.isLeaf&&(e||!i.type.spec.isolating);i=i.lastChild)r++;return new f(t,n,r)},Object.defineProperties(f.prototype,d),f.empty=new f(i.empty,0,0);var S=function(t,e,n){this.pos=t,this.path=e,this.depth=e.length/3-1,this.parentOffset=n},k={parent:{configurable:!0},doc:{configurable:!0},textOffset:{configurable:!0},nodeAfter:{configurable:!0},nodeBefore:{configurable:!0}};S.prototype.resolveDepth=function(t){return null==t?this.depth:t<0?this.depth+t:t},k.parent.get=function(){return this.node(this.depth)},k.doc.get=function(){return this.node(0)},S.prototype.node=function(t){return this.path[3*this.resolveDepth(t)]},S.prototype.index=function(t){return this.path[3*this.resolveDepth(t)+1]},S.prototype.indexAfter=function(t){return t=this.resolveDepth(t),this.index(t)+(t!=this.depth||this.textOffset?1:0)},S.prototype.start=function(t){return 0==(t=this.resolveDepth(t))?0:this.path[3*t-1]+1},S.prototype.end=function(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size},S.prototype.before=function(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]},S.prototype.after=function(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]+this.path[3*t].nodeSize},k.textOffset.get=function(){return this.pos-this.path[this.path.length-1]},k.nodeAfter.get=function(){var t=this.parent,e=this.index(this.depth);if(e==t.childCount)return null;var n=this.pos-this.path[this.path.length-1],r=t.child(e);return n?t.child(e).cut(n):r},k.nodeBefore.get=function(){var t=this.index(this.depth),e=this.pos-this.path[this.path.length-1];return e?this.parent.child(t).cut(0,e):0==t?null:this.parent.child(t-1)},S.prototype.posAtIndex=function(t,e){e=this.resolveDepth(e);for(var n=this.path[3*e],r=0==e?0:this.path[3*e-1]+1,o=0;o<t;o++)r+=n.child(o).nodeSize;return r},S.prototype.marks=function(){var t=this.parent,e=this.index();if(0==t.content.size)return u.none;if(this.textOffset)return t.child(e).marks;var n=t.maybeChild(e-1),r=t.maybeChild(e);if(!n){var o=n;n=r,r=o}for(var i=n.marks,s=0;s<i.length;s++)!1!==i[s].type.spec.inclusive||r&&i[s].isInSet(r.marks)||(i=i[s--].removeFromSet(i));return i},S.prototype.marksAcross=function(t){var e=this.parent.maybeChild(this.index());if(!e||!e.isInline)return null;for(var n=e.marks,r=t.parent.maybeChild(t.index()),o=0;o<n.length;o++)!1!==n[o].type.spec.inclusive||r&&n[o].isInSet(r.marks)||(n=n[o--].removeFromSet(n));return n},S.prototype.sharedDepth=function(t){for(var e=this.depth;e>0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0},S.prototype.blockRange=function(t,e){if(void 0===t&&(t=this),t.pos<this.pos)return t.blockRange(this);for(var n=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);n>=0;n--)if(t.pos<=this.end(n)&&(!e||e(this.node(n))))return new O(this,t,n)},S.prototype.sameParent=function(t){return this.pos-this.parentOffset==t.pos-t.parentOffset},S.prototype.max=function(t){return t.pos>this.pos?t:this},S.prototype.min=function(t){return t.pos<this.pos?t:this},S.prototype.toString=function(){for(var t="",e=1;e<=this.depth;e++)t+=(t?"/":"")+this.node(e).type.name+"_"+this.index(e-1);return t+":"+this.parentOffset},S.resolve=function(t,e){if(!(e>=0&&e<=t.content.size))throw new RangeError("Position "+e+" out of range");for(var n=[],r=0,o=e,i=t;;){var s=i.content.findIndex(o),a=s.index,c=s.offset,l=o-c;if(n.push(i,a,r+c),!l)break;if((i=i.child(a)).isText)break;o=l-1,r+=c+1}return new S(e,n,o)},S.resolveCached=function(t,e){for(var n=0;n<x.length;n++){var r=x[n];if(r.pos==e&&r.doc==t)return r}var o=x[C]=S.resolve(t,e);return C=(C+1)%M,o},Object.defineProperties(S.prototype,k);var x=[],C=0,M=12,O=function(t,e,n){this.$from=t,this.$to=e,this.depth=n},T={start:{configurable:!0},end:{configurable:!0},parent:{configurable:!0},startIndex:{configurable:!0},endIndex:{configurable:!0}};T.start.get=function(){return this.$from.before(this.depth+1)},T.end.get=function(){return this.$to.after(this.depth+1)},T.parent.get=function(){return this.$from.node(this.depth)},T.startIndex.get=function(){return this.$from.index(this.depth)},T.endIndex.get=function(){return this.$to.indexAfter(this.depth)},Object.defineProperties(O.prototype,T);var N=Object.create(null),A=function(t,e,n,r){this.type=t,this.attrs=e,this.content=n||i.empty,this.marks=r||u.none},D={nodeSize:{configurable:!0},childCount:{configurable:!0},textContent:{configurable:!0},firstChild:{configurable:!0},lastChild:{configurable:!0},isBlock:{configurable:!0},isTextblock:{configurable:!0},inlineContent:{configurable:!0},isInline:{configurable:!0},isText:{configurable:!0},isLeaf:{configurable:!0},isAtom:{configurable:!0}};D.nodeSize.get=function(){return this.isLeaf?1:2+this.content.size},D.childCount.get=function(){return this.content.childCount},A.prototype.child=function(t){return this.content.child(t)},A.prototype.maybeChild=function(t){return this.content.maybeChild(t)},A.prototype.forEach=function(t){this.content.forEach(t)},A.prototype.nodesBetween=function(t,e,n,r){void 0===r&&(r=0),this.content.nodesBetween(t,e,n,r,this)},A.prototype.descendants=function(t){this.nodesBetween(0,this.content.size,t)},D.textContent.get=function(){return this.textBetween(0,this.content.size,"")},A.prototype.textBetween=function(t,e,n,r){return this.content.textBetween(t,e,n,r)},D.firstChild.get=function(){return this.content.firstChild},D.lastChild.get=function(){return this.content.lastChild},A.prototype.eq=function(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)},A.prototype.sameMarkup=function(t){return this.hasMarkup(t.type,t.attrs,t.marks)},A.prototype.hasMarkup=function(t,e,n){return this.type==t&&l(this.attrs,e||t.defaultAttrs||N)&&u.sameSet(this.marks,n||u.none)},A.prototype.copy=function(t){return void 0===t&&(t=null),t==this.content?this:new this.constructor(this.type,this.attrs,t,this.marks)},A.prototype.mark=function(t){return t==this.marks?this:new this.constructor(this.type,this.attrs,this.content,t)},A.prototype.cut=function(t,e){return 0==t&&e==this.content.size?this:this.copy(this.content.cut(t,e))},A.prototype.slice=function(t,e,n){if(void 0===e&&(e=this.content.size),void 0===n&&(n=!1),t==e)return f.empty;var r=this.resolve(t),o=this.resolve(e),i=n?0:r.sharedDepth(e),s=r.start(i),a=r.node(i).content.cut(r.pos-s,o.pos-s);return new f(a,r.depth-i,o.depth-i)},A.prototype.replace=function(t,e,n){return h(this.resolve(t),this.resolve(e),n)},A.prototype.nodeAt=function(t){for(var e=this;;){var n=e.content.findIndex(t),r=n.index,o=n.offset;if(!(e=e.maybeChild(r)))return null;if(o==t||e.isText)return e;t-=o+1}},A.prototype.childAfter=function(t){var e=this.content.findIndex(t),n=e.index,r=e.offset;return{node:this.content.maybeChild(n),index:n,offset:r}},A.prototype.childBefore=function(t){if(0==t)return{node:null,index:0,offset:0};var e=this.content.findIndex(t),n=e.index,r=e.offset;if(r<t)return{node:this.content.child(n),index:n,offset:r};var o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}},A.prototype.resolve=function(t){return S.resolveCached(this,t)},A.prototype.resolveNoCache=function(t){return S.resolve(this,t)},A.prototype.rangeHasMark=function(t,e,n){var r=!1;return e>t&&this.nodesBetween(t,e,(function(t){return n.isInSet(t.marks)&&(r=!0),!r})),r},D.isBlock.get=function(){return this.type.isBlock},D.isTextblock.get=function(){return this.type.isTextblock},D.inlineContent.get=function(){return this.type.inlineContent},D.isInline.get=function(){return this.type.isInline},D.isText.get=function(){return this.type.isText},D.isLeaf.get=function(){return this.type.isLeaf},D.isAtom.get=function(){return this.type.isAtom},A.prototype.toString=function(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);var t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),R(this.marks,t)},A.prototype.contentMatchAt=function(t){var e=this.type.contentMatch.matchFragment(this.content,0,t);if(!e)throw new Error("Called contentMatchAt on a node with invalid content");return e},A.prototype.canReplace=function(t,e,n,r,o){void 0===n&&(n=i.empty),void 0===r&&(r=0),void 0===o&&(o=n.childCount);var s=this.contentMatchAt(t).matchFragment(n,r,o),a=s&&s.matchFragment(this.content,e);if(!a||!a.validEnd)return!1;for(var c=r;c<o;c++)if(!this.type.allowsMarks(n.child(c).marks))return!1;return!0},A.prototype.canReplaceWith=function(t,e,n,r){if(r&&!this.type.allowsMarks(r))return!1;var o=this.contentMatchAt(t).matchType(n),i=o&&o.matchFragment(this.content,e);return!!i&&i.validEnd},A.prototype.canAppend=function(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)},A.prototype.check=function(){if(!this.type.validContent(this.content))throw new RangeError("Invalid content for node "+this.type.name+": "+this.content.toString().slice(0,50));for(var t=u.none,e=0;e<this.marks.length;e++)t=this.marks[e].addToSet(t);if(!u.sameSet(t,this.marks))throw new RangeError("Invalid collection of marks for node "+this.type.name+": "+this.marks.map((function(t){return t.type.name})));this.content.forEach((function(t){return t.check()}))},A.prototype.toJSON=function(){var t={type:this.type.name};for(var e in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map((function(t){return t.toJSON()}))),t},A.fromJSON=function(t,e){if(!e)throw new RangeError("Invalid input for Node.fromJSON");var n=null;if(e.marks){if(!Array.isArray(e.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=e.marks.map(t.markFromJSON)}if("text"==e.type){if("string"!=typeof e.text)throw new RangeError("Invalid text node in JSON");return t.text(e.text,n)}var r=i.fromJSON(t,e.content);return t.nodeType(e.type).create(e.attrs,r,n)},Object.defineProperties(A.prototype,D);var E=function(t){function e(e,n,r,o){if(t.call(this,e,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={textContent:{configurable:!0},nodeSize:{configurable:!0}};return e.prototype.toString=function(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):R(this.marks,JSON.stringify(this.text))},n.textContent.get=function(){return this.text},e.prototype.textBetween=function(t,e){return this.text.slice(t,e)},n.nodeSize.get=function(){return this.text.length},e.prototype.mark=function(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)},e.prototype.withText=function(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)},e.prototype.cut=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.text.length),0==t&&e==this.text.length?this:this.withText(this.text.slice(t,e))},e.prototype.eq=function(t){return this.sameMarkup(t)&&this.text==t.text},e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.text=this.text,e},Object.defineProperties(e.prototype,n),e}(A);function R(t,e){for(var n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}var _=function(t){this.validEnd=t,this.next=[],this.wrapCache=[]},I={inlineContent:{configurable:!0},defaultType:{configurable:!0},edgeCount:{configurable:!0}};_.parse=function(t,e){var n=new z(t,e);if(null==n.next)return _.empty;var r=$(n);n.next&&n.err("Unexpected trailing text");var o=function(t){var e=Object.create(null);return function n(r){var o=[];r.forEach((function(e){t[e].forEach((function(e){var n=e.term,r=e.to;if(n){var i=o.indexOf(n),s=i>-1&&o[i+1];W(t,r).forEach((function(t){s||o.push(n,s=[]),-1==s.indexOf(t)&&s.push(t)}))}}))}));for(var i=e[r.join(",")]=new _(r.indexOf(t.length-1)>-1),s=0;s<o.length;s+=2){var a=o[s+1].sort(j);i.next.push(o[s],e[a.join(",")]||n(a))}return i}(W(t,0))}(function(t){var e=[[]];return o(function t(e,i){if("choice"==e.type)return e.exprs.reduce((function(e,n){return e.concat(t(n,i))}),[]);if("seq"==e.type)for(var s=0;;s++){var a=t(e.exprs[s],i);if(s==e.exprs.length-1)return a;o(a,i=n())}else{if("star"==e.type){var c=n();return r(i,c),o(t(e.expr,c),c),[r(c)]}if("plus"==e.type){var l=n();return o(t(e.expr,i),l),o(t(e.expr,l),l),[r(l)]}if("opt"==e.type)return[r(i)].concat(t(e.expr,i));if("range"==e.type){for(var u=i,p=0;p<e.min;p++){var f=n();o(t(e.expr,u),f),u=f}if(-1==e.max)o(t(e.expr,u),u);else for(var d=e.min;d<e.max;d++){var h=n();r(u,h),o(t(e.expr,u),h),u=h}return[r(u)]}if("name"==e.type)return[r(i,null,e.value)]}}(t,0),n()),e;function n(){return e.push([])-1}function r(t,n,r){var o={term:r,to:n};return e[t].push(o),o}function o(t,e){t.forEach((function(t){return t.to=e}))}}(r));return function(t,e){for(var n=0,r=[t];n<r.length;n++){for(var o=r[n],i=!o.validEnd,s=[],a=0;a<o.next.length;a+=2){var c=o.next[a],l=o.next[a+1];s.push(c.name),!i||c.isText||c.hasRequiredAttrs()||(i=!1),-1==r.indexOf(l)&&r.push(l)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(o,n),o},_.prototype.matchType=function(t){for(var e=0;e<this.next.length;e+=2)if(this.next[e]==t)return this.next[e+1];return null},_.prototype.matchFragment=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=t.childCount);for(var r=this,o=e;r&&o<n;o++)r=r.matchType(t.child(o).type);return r},I.inlineContent.get=function(){var t=this.next[0];return!!t&&t.isInline},I.defaultType.get=function(){for(var t=0;t<this.next.length;t+=2){var e=this.next[t];if(!e.isText&&!e.hasRequiredAttrs())return e}},_.prototype.compatible=function(t){for(var e=0;e<this.next.length;e+=2)for(var n=0;n<t.next.length;n+=2)if(this.next[e]==t.next[n])return!0;return!1},_.prototype.fillBefore=function(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=0);var r=[this];return function o(s,a){var c=s.matchFragment(t,n);if(c&&(!e||c.validEnd))return i.from(a.map((function(t){return t.createAndFill()})));for(var l=0;l<s.next.length;l+=2){var u=s.next[l],p=s.next[l+1];if(!u.isText&&!u.hasRequiredAttrs()&&-1==r.indexOf(p)){r.push(p);var f=o(p,a.concat(u));if(f)return f}}}(this,[])},_.prototype.findWrapping=function(t){for(var e=0;e<this.wrapCache.length;e+=2)if(this.wrapCache[e]==t)return this.wrapCache[e+1];var n=this.computeWrapping(t);return this.wrapCache.push(t,n),n},_.prototype.computeWrapping=function(t){for(var e=Object.create(null),n=[{match:this,type:null,via:null}];n.length;){var r=n.shift(),o=r.match;if(o.matchType(t)){for(var i=[],s=r;s.type;s=s.via)i.push(s.type);return i.reverse()}for(var a=0;a<o.next.length;a+=2){var c=o.next[a];c.isLeaf||c.hasRequiredAttrs()||c.name in e||r.type&&!o.next[a+1].validEnd||(n.push({match:c.contentMatch,type:c,via:r}),e[c.name]=!0)}}},I.edgeCount.get=function(){return this.next.length>>1},_.prototype.edge=function(t){var e=t<<1;if(e>=this.next.length)throw new RangeError("There's no "+t+"th edge in this content match");return{type:this.next[e],next:this.next[e+1]}},_.prototype.toString=function(){var t=[];return function e(n){t.push(n);for(var r=1;r<n.next.length;r+=2)-1==t.indexOf(n.next[r])&&e(n.next[r])}(this),t.map((function(e,n){for(var r=n+(e.validEnd?"*":" ")+" ",o=0;o<e.next.length;o+=2)r+=(o?", ":"")+e.next[o].name+"->"+t.indexOf(e.next[o+1]);return r})).join("\n")},Object.defineProperties(_.prototype,I),_.empty=new _(!0);var z=function(t,e){this.string=t,this.nodeTypes=e,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()},P={next:{configurable:!0}};function $(t){var e=[];do{e.push(F(t))}while(t.eat("|"));return 1==e.length?e[0]:{type:"choice",exprs:e}}function F(t){var e=[];do{e.push(B(t))}while(t.next&&")"!=t.next&&"|"!=t.next);return 1==e.length?e[0]:{type:"seq",exprs:e}}function B(t){for(var e=function(t){if(t.eat("(")){var e=$(t);return t.eat(")")||t.err("Missing closing paren"),e}if(!/\W/.test(t.next)){var n=function(t,e){var n=t.nodeTypes,r=n[e];if(r)return[r];var o=[];for(var i in n){var s=n[i];s.groups.indexOf(e)>-1&&o.push(s)}0==o.length&&t.err("No node type or group '"+e+"' found");return o}(t,t.next).map((function(e){return null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e}}));return t.pos++,1==n.length?n[0]:{type:"choice",exprs:n}}t.err("Unexpected token '"+t.next+"'")}(t);;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else{if(!t.eat("{"))break;e=V(t,e)}return e}function L(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");var e=Number(t.next);return t.pos++,e}function V(t,e){var n=L(t),r=n;return t.eat(",")&&(r="}"!=t.next?L(t):-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function j(t,e){return e-t}function W(t,e){var n=[];return function e(r){var o=t[r];if(1==o.length&&!o[0].term)return e(o[0].to);n.push(r);for(var i=0;i<o.length;i++){var s=o[i],a=s.term,c=s.to;a||-1!=n.indexOf(c)||e(c)}}(e),n.sort(j)}function K(t){var e=Object.create(null);for(var n in t){var r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function q(t,e){var n=Object.create(null);for(var r in t){var o=e&&e[r];if(void 0===o){var i=t[r];if(!i.hasDefault)throw new RangeError("No value supplied for attribute "+r);o=i.default}n[r]=o}return n}function H(t){var e=Object.create(null);if(t)for(var n in t)e[n]=new G(t[n]);return e}P.next.get=function(){return this.tokens[this.pos]},z.prototype.eat=function(t){return this.next==t&&(this.pos++||!0)},z.prototype.err=function(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")},Object.defineProperties(z.prototype,P);var J=function(t,e,n){this.name=t,this.schema=e,this.spec=n,this.groups=n.group?n.group.split(" "):[],this.attrs=H(n.attrs),this.defaultAttrs=K(this.attrs),this.contentMatch=null,this.markSet=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==t),this.isText="text"==t},U={isInline:{configurable:!0},isTextblock:{configurable:!0},isLeaf:{configurable:!0},isAtom:{configurable:!0},whitespace:{configurable:!0}};U.isInline.get=function(){return!this.isBlock},U.isTextblock.get=function(){return this.isBlock&&this.inlineContent},U.isLeaf.get=function(){return this.contentMatch==_.empty},U.isAtom.get=function(){return this.isLeaf||this.spec.atom},U.whitespace.get=function(){return this.spec.whitespace||(this.spec.code?"pre":"normal")},J.prototype.hasRequiredAttrs=function(){for(var t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1},J.prototype.compatibleContent=function(t){return this==t||this.contentMatch.compatible(t.contentMatch)},J.prototype.computeAttrs=function(t){return!t&&this.defaultAttrs?this.defaultAttrs:q(this.attrs,t)},J.prototype.create=function(t,e,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new A(this,this.computeAttrs(t),i.from(e),u.setFrom(n))},J.prototype.createChecked=function(t,e,n){if(e=i.from(e),!this.validContent(e))throw new RangeError("Invalid content for node "+this.name);return new A(this,this.computeAttrs(t),e,u.setFrom(n))},J.prototype.createAndFill=function(t,e,n){if(t=this.computeAttrs(t),(e=i.from(e)).size){var r=this.contentMatch.fillBefore(e);if(!r)return null;e=r.append(e)}var o=this.contentMatch.matchFragment(e).fillBefore(i.empty,!0);return o?new A(this,t,e.append(o),u.setFrom(n)):null},J.prototype.validContent=function(t){var e=this.contentMatch.matchFragment(t);if(!e||!e.validEnd)return!1;for(var n=0;n<t.childCount;n++)if(!this.allowsMarks(t.child(n).marks))return!1;return!0},J.prototype.allowsMarkType=function(t){return null==this.markSet||this.markSet.indexOf(t)>-1},J.prototype.allowsMarks=function(t){if(null==this.markSet)return!0;for(var e=0;e<t.length;e++)if(!this.allowsMarkType(t[e].type))return!1;return!0},J.prototype.allowedMarks=function(t){if(null==this.markSet)return t;for(var e,n=0;n<t.length;n++)this.allowsMarkType(t[n].type)?e&&e.push(t[n]):e||(e=t.slice(0,n));return e?e.length?e:u.empty:t},J.compile=function(t,e){var n=Object.create(null);t.forEach((function(t,r){return n[t]=new J(t,e,r)}));var r=e.spec.topNode||"doc";if(!n[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(var o in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n},Object.defineProperties(J.prototype,U);var G=function(t){this.hasDefault=Object.prototype.hasOwnProperty.call(t,"default"),this.default=t.default},X={isRequired:{configurable:!0}};X.isRequired.get=function(){return!this.hasDefault},Object.defineProperties(G.prototype,X);var Y=function(t,e,n,r){this.name=t,this.schema=n,this.spec=r,this.attrs=H(r.attrs),this.rank=e,this.excluded=null;var o=K(this.attrs);this.instance=o&&new u(this,o)};Y.prototype.create=function(t){return!t&&this.instance?this.instance:new u(this,q(this.attrs,t))},Y.compile=function(t,e){var n=Object.create(null),r=0;return t.forEach((function(t,o){return n[t]=new Y(t,r++,e,o)})),n},Y.prototype.removeFromSet=function(t){for(var e=0;e<t.length;e++)t[e].type==this&&(t=t.slice(0,e).concat(t.slice(e+1)),e--);return t},Y.prototype.isInSet=function(t){for(var e=0;e<t.length;e++)if(t[e].type==this)return t[e]},Y.prototype.excludes=function(t){return this.excluded.indexOf(t)>-1};var Q=function(t){for(var e in this.spec={},t)this.spec[e]=t[e];this.spec.nodes=o.from(t.nodes),this.spec.marks=o.from(t.marks),this.nodes=J.compile(this.spec.nodes,this),this.marks=Y.compile(this.spec.marks,this);var n=Object.create(null);for(var r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");var i=this.nodes[r],s=i.spec.content||"",a=i.spec.marks;i.contentMatch=n[s]||(n[s]=_.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.markSet="_"==a?null:a?Z(this,a.split(" ")):""!=a&&i.inlineContent?null:[]}for(var c in this.marks){var l=this.marks[c],u=l.spec.excludes;l.excluded=null==u?[l]:""==u?[]:Z(this,u.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached=Object.create(null),this.cached.wrappings=Object.create(null)};function Z(t,e){for(var n=[],r=0;r<e.length;r++){var o=e[r],i=t.marks[o],s=i;if(i)n.push(i);else for(var a in t.marks){var c=t.marks[a];("_"==o||c.spec.group&&c.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=c)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}Q.prototype.node=function(t,e,n,r){if("string"==typeof t)t=this.nodeType(t);else{if(!(t instanceof J))throw new RangeError("Invalid node type: "+t);if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}return t.createChecked(e,n,r)},Q.prototype.text=function(t,e){var n=this.nodes.text;return new E(n,n.defaultAttrs,t,u.setFrom(e))},Q.prototype.mark=function(t,e){return"string"==typeof t&&(t=this.marks[t]),t.create(e)},Q.prototype.nodeFromJSON=function(t){return A.fromJSON(this,t)},Q.prototype.markFromJSON=function(t){return u.fromJSON(this,t)},Q.prototype.nodeType=function(t){var e=this.nodes[t];if(!e)throw new RangeError("Unknown node type: "+t);return e};var tt=function(t,e){var n=this;this.schema=t,this.rules=e,this.tags=[],this.styles=[],e.forEach((function(t){t.tag?n.tags.push(t):t.style&&n.styles.push(t)})),this.normalizeLists=!this.tags.some((function(e){if(!/^(ul|ol)\b/.test(e.tag)||!e.node)return!1;var n=t.nodes[e.node];return n.contentMatch.matchType(n)}))};tt.prototype.parse=function(t,e){void 0===e&&(e={});var n=new st(this,e,!1);return n.addAll(t,null,e.from,e.to),n.finish()},tt.prototype.parseSlice=function(t,e){void 0===e&&(e={});var n=new st(this,e,!0);return n.addAll(t,null,e.from,e.to),f.maxOpen(n.finish())},tt.prototype.matchTag=function(t,e,n){for(var r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){var o=this.tags[r];if(ct(t,o.tag)&&(void 0===o.namespace||t.namespaceURI==o.namespace)&&(!o.context||e.matchesContext(o.context))){if(o.getAttrs){var i=o.getAttrs(t);if(!1===i)continue;o.attrs=i}return o}}},tt.prototype.matchStyle=function(t,e,n,r){for(var o=r?this.styles.indexOf(r)+1:0;o<this.styles.length;o++){var i=this.styles[o];if(!(0!=i.style.indexOf(t)||i.context&&!n.matchesContext(i.context)||i.style.length>t.length&&(61!=i.style.charCodeAt(t.length)||i.style.slice(t.length+1)!=e))){if(i.getAttrs){var s=i.getAttrs(e);if(!1===s)continue;i.attrs=s}return i}}},tt.schemaRules=function(t){var e=[];function n(t){for(var n=null==t.priority?50:t.priority,r=0;r<e.length;r++){var o=e[r];if((null==o.priority?50:o.priority)<n)break}e.splice(r,0,t)}var r=function(e){var r=t.marks[e].spec.parseDOM;r&&r.forEach((function(t){n(t=lt(t)),t.mark=e}))};for(var o in t.marks)r(o);var i;for(var s in t.nodes)i=void 0,(i=t.nodes[s].spec.parseDOM)&&i.forEach((function(t){n(t=lt(t)),t.node=s}));return e},tt.fromSchema=function(t){return t.cached.domParser||(t.cached.domParser=new tt(t,tt.schemaRules(t)))};var et={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},nt={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},rt={ol:!0,ul:!0};function ot(t,e,n){return null!=e?(e?1:0)|("full"===e?2:0):t&&"pre"==t.whitespace?3:-5&n}var it=function(t,e,n,r,o,i,s){this.type=t,this.attrs=e,this.solid=o,this.match=i||(4&s?null:t.contentMatch),this.options=s,this.content=[],this.marks=n,this.activeMarks=u.none,this.pendingMarks=r,this.stashMarks=[]};it.prototype.findWrapping=function(t){if(!this.match){if(!this.type)return[];var e=this.type.contentMatch.fillBefore(i.from(t));if(!e){var n,r=this.type.contentMatch;return(n=r.findWrapping(t.type))?(this.match=r,n):null}this.match=this.type.contentMatch.matchFragment(e)}return this.match.findWrapping(t.type)},it.prototype.finish=function(t){if(!(1&this.options)){var e,n=this.content[this.content.length-1];n&&n.isText&&(e=/[ \t\r\n\u000c]+$/.exec(n.text))&&(n.text.length==e[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-e[0].length)))}var r=i.from(this.content);return!t&&this.match&&(r=r.append(this.match.fillBefore(i.empty,!0))),this.type?this.type.create(this.attrs,r,this.marks):r},it.prototype.popFromStashMark=function(t){for(var e=this.stashMarks.length-1;e>=0;e--)if(t.eq(this.stashMarks[e]))return this.stashMarks.splice(e,1)[0]},it.prototype.applyPending=function(t){for(var e=0,n=this.pendingMarks;e<n.length;e++){var r=n[e];(this.type?this.type.allowsMarkType(r.type):ut(r.type,t))&&!r.isInSet(this.activeMarks)&&(this.activeMarks=r.addToSet(this.activeMarks),this.pendingMarks=r.removeFromSet(this.pendingMarks))}},it.prototype.inlineContext=function(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!et.hasOwnProperty(t.parentNode.nodeName.toLowerCase())};var st=function(t,e,n){this.parser=t,this.options=e,this.isOpen=n;var r,o=e.topNode,i=ot(null,e.preserveWhitespace,0)|(n?4:0);r=o?new it(o.type,o.attrs,u.none,u.none,!0,e.topMatch||o.type.contentMatch,i):new it(n?null:t.schema.topNodeType,null,u.none,u.none,!0,null,i),this.nodes=[r],this.open=0,this.find=e.findPositions,this.needsBlock=!1},at={top:{configurable:!0},currentPos:{configurable:!0}};function ct(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function lt(t){var e={};for(var n in t)e[n]=t[n];return e}function ut(t,e){var n=e.schema.nodes,r=function(r){var o=n[r];if(o.allowsMarkType(t)){var i=[],s=function(t){i.push(t);for(var n=0;n<t.edgeCount;n++){var r=t.edge(n),o=r.type,a=r.next;if(o==e)return!0;if(i.indexOf(a)<0&&s(a))return!0}};return s(o.contentMatch)?{v:!0}:void 0}};for(var o in n){var i=r(o);if(i)return i.v}}at.top.get=function(){return this.nodes[this.open]},st.prototype.addDOM=function(t){if(3==t.nodeType)this.addTextNode(t);else if(1==t.nodeType){var e=t.getAttribute("style"),n=e?this.readStyles(function(t){var e,n=/\s*([\w-]+)\s*:\s*([^;]+)/g,r=[];for(;e=n.exec(t);)r.push(e[1],e[2].trim());return r}(e)):null,r=this.top;if(null!=n)for(var o=0;o<n.length;o++)this.addPendingMark(n[o]);if(this.addElement(t),null!=n)for(var i=0;i<n.length;i++)this.removePendingMark(n[i],r)}},st.prototype.addTextNode=function(t){var e=t.nodeValue,n=this.top;if(2&n.options||n.inlineContext(t)||/[^ \t\r\n\u000c]/.test(e)){if(1&n.options)e=2&n.options?e.replace(/\r\n?/g,"\n"):e.replace(/\r?\n|\r/g," ");else if(e=e.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(e)&&this.open==this.nodes.length-1){var r=n.content[n.content.length-1],o=t.previousSibling;(!r||o&&"BR"==o.nodeName||r.isText&&/[ \t\r\n\u000c]$/.test(r.text))&&(e=e.slice(1))}e&&this.insertNode(this.parser.schema.text(e)),this.findInText(t)}else this.findInside(t)},st.prototype.addElement=function(t,e){var n,r=t.nodeName.toLowerCase();rt.hasOwnProperty(r)&&this.parser.normalizeLists&&function(t){for(var e=t.firstChild,n=null;e;e=e.nextSibling){var r=1==e.nodeType?e.nodeName.toLowerCase():null;r&&rt.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):"li"==r?n=e:r&&(n=null)}}(t);var o=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(n=this.parser.matchTag(t,this,e));if(o?o.ignore:nt.hasOwnProperty(r))this.findInside(t),this.ignoreFallback(t);else if(!o||o.skip||o.closeParent){o&&o.closeParent?this.open=Math.max(0,this.open-1):o&&o.skip.nodeType&&(t=o.skip);var i,s=this.top,a=this.needsBlock;if(et.hasOwnProperty(r))i=!0,s.type||(this.needsBlock=!0);else if(!t.firstChild)return void this.leafFallback(t);this.addAll(t),i&&this.sync(s),this.needsBlock=a}else this.addElementByRule(t,o,!1===o.consuming?n:null)},st.prototype.leafFallback=function(t){"BR"==t.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode("\n"))},st.prototype.ignoreFallback=function(t){"BR"!=t.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"))},st.prototype.readStyles=function(t){var e=u.none;t:for(var n=0;n<t.length;n+=2)for(var r=null;;){var o=this.parser.matchStyle(t[n],t[n+1],this,r);if(!o)continue t;if(o.ignore)return null;if(e=this.parser.schema.marks[o.mark].create(o.attrs).addToSet(e),!1!==o.consuming)break;r=o}return e},st.prototype.addElementByRule=function(t,e,n){var r,o,i,s=this;e.node?(o=this.parser.schema.nodes[e.node]).isLeaf?this.insertNode(o.create(e.attrs))||this.leafFallback(t):r=this.enter(o,e.attrs,e.preserveWhitespace):(i=this.parser.schema.marks[e.mark].create(e.attrs),this.addPendingMark(i));var a=this.top;if(o&&o.isLeaf)this.findInside(t);else if(n)this.addElement(t,n);else if(e.getContent)this.findInside(t),e.getContent(t,this.parser.schema).forEach((function(t){return s.insertNode(t)}));else{var c=e.contentElement;"string"==typeof c?c=t.querySelector(c):"function"==typeof c&&(c=c(t)),c||(c=t),this.findAround(t,c,!0),this.addAll(c,r)}r&&(this.sync(a),this.open--),i&&this.removePendingMark(i,a)},st.prototype.addAll=function(t,e,n,r){for(var o=n||0,i=n?t.childNodes[n]:t.firstChild,s=null==r?null:t.childNodes[r];i!=s;i=i.nextSibling,++o)this.findAtPoint(t,o),this.addDOM(i),e&&et.hasOwnProperty(i.nodeName.toLowerCase())&&this.sync(e);this.findAtPoint(t,o)},st.prototype.findPlace=function(t){for(var e,n,r=this.open;r>=0;r--){var o=this.nodes[r],i=o.findWrapping(t);if(i&&(!e||e.length>i.length)&&(e=i,n=o,!i.length))break;if(o.solid)break}if(!e)return!1;this.sync(n);for(var s=0;s<e.length;s++)this.enterInner(e[s],null,!1);return!0},st.prototype.insertNode=function(t){if(t.isInline&&this.needsBlock&&!this.top.type){var e=this.textblockFromContext();e&&this.enterInner(e)}if(this.findPlace(t)){this.closeExtra();var n=this.top;n.applyPending(t.type),n.match&&(n.match=n.match.matchType(t.type));for(var r=n.activeMarks,o=0;o<t.marks.length;o++)n.type&&!n.type.allowsMarkType(t.marks[o].type)||(r=t.marks[o].addToSet(r));return n.content.push(t.mark(r)),!0}return!1},st.prototype.enter=function(t,e,n){var r=this.findPlace(t.create(e));return r&&this.enterInner(t,e,!0,n),r},st.prototype.enterInner=function(t,e,n,r){this.closeExtra();var o=this.top;o.applyPending(t),o.match=o.match&&o.match.matchType(t,e);var i=ot(t,r,o.options);4&o.options&&0==o.content.length&&(i|=4),this.nodes.push(new it(t,e,o.activeMarks,o.pendingMarks,n,null,i)),this.open++},st.prototype.closeExtra=function(t){var e=this.nodes.length-1;if(e>this.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));this.nodes.length=this.open+1}},st.prototype.finish=function(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)},st.prototype.sync=function(t){for(var e=this.open;e>=0;e--)if(this.nodes[e]==t)return void(this.open=e)},at.currentPos.get=function(){this.closeExtra();for(var t=0,e=this.open;e>=0;e--){for(var n=this.nodes[e].content,r=n.length-1;r>=0;r--)t+=n[r].nodeSize;e&&t++}return t},st.prototype.findAtPoint=function(t,e){if(this.find)for(var n=0;n<this.find.length;n++)this.find[n].node==t&&this.find[n].offset==e&&(this.find[n].pos=this.currentPos)},st.prototype.findInside=function(t){if(this.find)for(var e=0;e<this.find.length;e++)null==this.find[e].pos&&1==t.nodeType&&t.contains(this.find[e].node)&&(this.find[e].pos=this.currentPos)},st.prototype.findAround=function(t,e,n){if(t!=e&&this.find)for(var r=0;r<this.find.length;r++){if(null==this.find[r].pos&&1==t.nodeType&&t.contains(this.find[r].node))e.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}},st.prototype.findInText=function(t){if(this.find)for(var e=0;e<this.find.length;e++)this.find[e].node==t&&(this.find[e].pos=this.currentPos-(t.nodeValue.length-this.find[e].offset))},st.prototype.matchesContext=function(t){var e=this;if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);var n=t.split("/"),r=this.options.context,o=!(this.isOpen||r&&r.parent.type!=this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=function(t,a){for(;t>=0;t--){var c=n[t];if(""==c){if(t==n.length-1||0==t)continue;for(;a>=i;a--)if(s(t-1,a))return!0;return!1}var l=a>0||0==a&&o?e.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!l||l.name!=c&&-1==l.groups.indexOf(c))return!1;a--}return!0};return s(n.length-1,this.open)},st.prototype.textblockFromContext=function(){var t=this.options.context;if(t)for(var e=t.depth;e>=0;e--){var n=t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(var r in this.parser.schema.nodes){var o=this.parser.schema.nodes[r];if(o.isTextblock&&o.defaultAttrs)return o}},st.prototype.addPendingMark=function(t){var e=function(t,e){for(var n=0;n<e.length;n++)if(t.eq(e[n]))return e[n]}(t,this.top.pendingMarks);e&&this.top.stashMarks.push(e),this.top.pendingMarks=t.addToSet(this.top.pendingMarks)},st.prototype.removePendingMark=function(t,e){for(var n=this.open;n>=0;n--){var r=this.nodes[n];if(r.pendingMarks.lastIndexOf(t)>-1)r.pendingMarks=t.removeFromSet(r.pendingMarks);else{r.activeMarks=t.removeFromSet(r.activeMarks);var o=r.popFromStashMark(t);o&&r.type&&r.type.allowsMarkType(o.type)&&(r.activeMarks=o.addToSet(r.activeMarks))}if(r==e)break}},Object.defineProperties(st.prototype,at);var pt=function(t,e){this.nodes=t||{},this.marks=e||{}};function ft(t){var e={};for(var n in t){var r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function dt(t){return t.document||window.document}pt.prototype.serializeFragment=function(t,e,n){var r=this;void 0===e&&(e={}),n||(n=dt(e).createDocumentFragment());var o=n,i=null;return t.forEach((function(t){if(i||t.marks.length){i||(i=[]);for(var n=0,s=0;n<i.length&&s<t.marks.length;){var a=t.marks[s];if(r.marks[a.type.name]){if(!a.eq(i[n])||!1===a.type.spec.spanning)break;n+=2,s++}else s++}for(;n<i.length;)o=i.pop(),i.pop();for(;s<t.marks.length;){var c=t.marks[s++],l=r.serializeMark(c,t.isInline,e);l&&(i.push(c,o),o.appendChild(l.dom),o=l.contentDOM||l.dom)}}o.appendChild(r.serializeNodeInner(t,e))})),n},pt.prototype.serializeNodeInner=function(t,e){void 0===e&&(e={});var n=pt.renderSpec(dt(e),this.nodes[t.type.name](t)),r=n.dom,o=n.contentDOM;if(o){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");e.onContent?e.onContent(t,o,e):this.serializeFragment(t.content,e,o)}return r},pt.prototype.serializeNode=function(t,e){void 0===e&&(e={});for(var n=this.serializeNodeInner(t,e),r=t.marks.length-1;r>=0;r--){var o=this.serializeMark(t.marks[r],t.isInline,e);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n},pt.prototype.serializeMark=function(t,e,n){void 0===n&&(n={});var r=this.marks[t.type.name];return r&&pt.renderSpec(dt(n),r(t,e))},pt.renderSpec=function(t,e,n){if(void 0===n&&(n=null),"string"==typeof e)return{dom:t.createTextNode(e)};if(null!=e.nodeType)return{dom:e};if(e.dom&&null!=e.dom.nodeType)return e;var r=e[0],o=r.indexOf(" ");o>0&&(n=r.slice(0,o),r=r.slice(o+1));var i=null,s=n?t.createElementNS(n,r):t.createElement(r),a=e[1],c=1;if(a&&"object"==typeof a&&null==a.nodeType&&!Array.isArray(a))for(var l in c=2,a)if(null!=a[l]){var u=l.indexOf(" ");u>0?s.setAttributeNS(l.slice(0,u),l.slice(u+1),a[l]):s.setAttribute(l,a[l])}for(var p=c;p<e.length;p++){var f=e[p];if(0===f){if(p<e.length-1||p>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:s,contentDOM:s}}var d=pt.renderSpec(t,f,n),h=d.dom,m=d.contentDOM;if(s.appendChild(h),m){if(i)throw new RangeError("Multiple content holes");i=m}}return{dom:s,contentDOM:i}},pt.fromSchema=function(t){return t.cached.domSerializer||(t.cached.domSerializer=new pt(this.nodesFromSchema(t),this.marksFromSchema(t)))},pt.nodesFromSchema=function(t){var e=ft(t.nodes);return e.text||(e.text=function(t){return t.text}),e},pt.marksFromSchema=function(t){return ft(t.marks)}},function(t,e,n){"use strict";n.r(e),n.d(e,"AllSelection",(function(){return d})),n.d(e,"EditorState",(function(){return k})),n.d(e,"NodeSelection",(function(){return p})),n.d(e,"Plugin",(function(){return M})),n.d(e,"PluginKey",(function(){return N})),n.d(e,"Selection",(function(){return s})),n.d(e,"SelectionRange",(function(){return c})),n.d(e,"TextSelection",(function(){return l})),n.d(e,"Transaction",(function(){return g}));var r=n(0),o=n(2),i=Object.create(null),s=function(t,e,n){this.ranges=n||[new c(t.min(e),t.max(e))],this.$anchor=t,this.$head=e},a={anchor:{configurable:!0},head:{configurable:!0},from:{configurable:!0},to:{configurable:!0},$from:{configurable:!0},$to:{configurable:!0},empty:{configurable:!0}};a.anchor.get=function(){return this.$anchor.pos},a.head.get=function(){return this.$head.pos},a.from.get=function(){return this.$from.pos},a.to.get=function(){return this.$to.pos},a.$from.get=function(){return this.ranges[0].$from},a.$to.get=function(){return this.ranges[0].$to},a.empty.get=function(){for(var t=this.ranges,e=0;e<t.length;e++)if(t[e].$from.pos!=t[e].$to.pos)return!1;return!0},s.prototype.content=function(){return this.$from.node(0).slice(this.from,this.to,!0)},s.prototype.replace=function(t,e){void 0===e&&(e=r.Slice.empty);for(var n=e.content.lastChild,o=null,i=0;i<e.openEnd;i++)o=n,n=n.lastChild;for(var s=t.steps.length,a=this.ranges,c=0;c<a.length;c++){var l=a[c],u=l.$from,p=l.$to,f=t.mapping.slice(s);t.replaceRange(f.map(u.pos),f.map(p.pos),c?r.Slice.empty:e),0==c&&v(t,s,(n?n.isInline:o&&o.isTextblock)?-1:1)}},s.prototype.replaceWith=function(t,e){for(var n=t.steps.length,r=this.ranges,o=0;o<r.length;o++){var i=r[o],s=i.$from,a=i.$to,c=t.mapping.slice(n),l=c.map(s.pos),u=c.map(a.pos);o?t.deleteRange(l,u):(t.replaceRangeWith(l,u,e),v(t,n,e.isInline?-1:1))}},s.findFrom=function(t,e,n){var r=t.parent.inlineContent?new l(t):m(t.node(0),t.parent,t.pos,t.index(),e,n);if(r)return r;for(var o=t.depth-1;o>=0;o--){var i=e<0?m(t.node(0),t.node(o),t.before(o+1),t.index(o),e,n):m(t.node(0),t.node(o),t.after(o+1),t.index(o)+1,e,n);if(i)return i}},s.near=function(t,e){return void 0===e&&(e=1),this.findFrom(t,e)||this.findFrom(t,-e)||new d(t.node(0))},s.atStart=function(t){return m(t,t,0,0,1)||new d(t)},s.atEnd=function(t){return m(t,t,t.content.size,t.childCount,-1)||new d(t)},s.fromJSON=function(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");var n=i[e.type];if(!n)throw new RangeError("No selection type "+e.type+" defined");return n.fromJSON(t,e)},s.jsonID=function(t,e){if(t in i)throw new RangeError("Duplicate use of selection JSON ID "+t);return i[t]=e,e.prototype.jsonID=t,e},s.prototype.getBookmark=function(){return l.between(this.$anchor,this.$head).getBookmark()},Object.defineProperties(s.prototype,a),s.prototype.visible=!0;var c=function(t,e){this.$from=t,this.$to=e},l=function(t){function e(e,n){void 0===n&&(n=e),t.call(this,e,n)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={$cursor:{configurable:!0}};return n.$cursor.get=function(){return this.$anchor.pos==this.$head.pos?this.$head:null},e.prototype.map=function(n,r){var o=n.resolve(r.map(this.head));if(!o.parent.inlineContent)return t.near(o);var i=n.resolve(r.map(this.anchor));return new e(i.parent.inlineContent?i:o,o)},e.prototype.replace=function(e,n){if(void 0===n&&(n=r.Slice.empty),t.prototype.replace.call(this,e,n),n==r.Slice.empty){var o=this.$from.marksAcross(this.$to);o&&e.ensureMarks(o)}},e.prototype.eq=function(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head},e.prototype.getBookmark=function(){return new u(this.anchor,this.head)},e.prototype.toJSON=function(){return{type:"text",anchor:this.anchor,head:this.head}},e.fromJSON=function(t,n){if("number"!=typeof n.anchor||"number"!=typeof n.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new e(t.resolve(n.anchor),t.resolve(n.head))},e.create=function(t,e,n){void 0===n&&(n=e);var r=t.resolve(e);return new this(r,n==e?r:t.resolve(n))},e.between=function(n,r,o){var i=n.pos-r.pos;if(o&&!i||(o=i>=0?1:-1),!r.parent.inlineContent){var s=t.findFrom(r,o,!0)||t.findFrom(r,-o,!0);if(!s)return t.near(r,o);r=s.$head}return n.parent.inlineContent||(0==i||(n=(t.findFrom(n,-o,!0)||t.findFrom(n,o,!0)).$anchor).pos<r.pos!=i<0)&&(n=r),new e(n,r)},Object.defineProperties(e.prototype,n),e}(s);s.jsonID("text",l);var u=function(t,e){this.anchor=t,this.head=e};u.prototype.map=function(t){return new u(t.map(this.anchor),t.map(this.head))},u.prototype.resolve=function(t){return l.between(t.resolve(this.anchor),t.resolve(this.head))};var p=function(t){function e(e){var n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);t.call(this,e,r),this.node=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.map=function(n,r){var o=r.mapResult(this.anchor),i=o.deleted,s=o.pos,a=n.resolve(s);return i?t.near(a):new e(a)},e.prototype.content=function(){return new r.Slice(r.Fragment.from(this.node),0,0)},e.prototype.eq=function(t){return t instanceof e&&t.anchor==this.anchor},e.prototype.toJSON=function(){return{type:"node",anchor:this.anchor}},e.prototype.getBookmark=function(){return new f(this.anchor)},e.fromJSON=function(t,n){if("number"!=typeof n.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new e(t.resolve(n.anchor))},e.create=function(t,e){return new this(t.resolve(e))},e.isSelectable=function(t){return!t.isText&&!1!==t.type.spec.selectable},e}(s);p.prototype.visible=!1,s.jsonID("node",p);var f=function(t){this.anchor=t};f.prototype.map=function(t){var e=t.mapResult(this.anchor),n=e.deleted,r=e.pos;return n?new u(r,r):new f(r)},f.prototype.resolve=function(t){var e=t.resolve(this.anchor),n=e.nodeAfter;return n&&p.isSelectable(n)?new p(e):s.near(e)};var d=function(t){function e(e){t.call(this,e.resolve(0),e.resolve(e.content.size))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.replace=function(e,n){if(void 0===n&&(n=r.Slice.empty),n==r.Slice.empty){e.delete(0,e.doc.content.size);var o=t.atStart(e.doc);o.eq(e.selection)||e.setSelection(o)}else t.prototype.replace.call(this,e,n)},e.prototype.toJSON=function(){return{type:"all"}},e.fromJSON=function(t){return new e(t)},e.prototype.map=function(t){return new e(t)},e.prototype.eq=function(t){return t instanceof e},e.prototype.getBookmark=function(){return h},e}(s);s.jsonID("all",d);var h={map:function(){return this},resolve:function(t){return new d(t)}};function m(t,e,n,r,o,i){if(e.inlineContent)return l.create(t,n);for(var s=r-(o>0?0:1);o>0?s<e.childCount:s>=0;s+=o){var a=e.child(s);if(a.isAtom){if(!i&&p.isSelectable(a))return p.create(t,n-(o<0?a.nodeSize:0))}else{var c=m(t,a,n+o,o<0?a.childCount:0,o,i);if(c)return c}n+=a.nodeSize*o}}function v(t,e,n){var r=t.steps.length-1;if(!(r<e)){var i,a=t.steps[r];if(a instanceof o.ReplaceStep||a instanceof o.ReplaceAroundStep)t.mapping.maps[r].forEach((function(t,e,n,r){null==i&&(i=r)})),t.setSelection(s.near(t.doc.resolve(i),n))}}var g=function(t){function e(e){t.call(this,e.doc),this.time=Date.now(),this.curSelection=e.selection,this.curSelectionFor=0,this.storedMarks=e.storedMarks,this.updated=0,this.meta=Object.create(null)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={selection:{configurable:!0},selectionSet:{configurable:!0},storedMarksSet:{configurable:!0},isGeneric:{configurable:!0},scrolledIntoView:{configurable:!0}};return n.selection.get=function(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection},e.prototype.setSelection=function(t){if(t.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=t,this.curSelectionFor=this.steps.length,this.updated=-3&(1|this.updated),this.storedMarks=null,this},n.selectionSet.get=function(){return(1&this.updated)>0},e.prototype.setStoredMarks=function(t){return this.storedMarks=t,this.updated|=2,this},e.prototype.ensureMarks=function(t){return r.Mark.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this},e.prototype.addStoredMark=function(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))},e.prototype.removeStoredMark=function(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))},n.storedMarksSet.get=function(){return(2&this.updated)>0},e.prototype.addStep=function(e,n){t.prototype.addStep.call(this,e,n),this.updated=-3&this.updated,this.storedMarks=null},e.prototype.setTime=function(t){return this.time=t,this},e.prototype.replaceSelection=function(t){return this.selection.replace(this,t),this},e.prototype.replaceSelectionWith=function(t,e){var n=this.selection;return!1!==e&&(t=t.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||r.Mark.none))),n.replaceWith(this,t),this},e.prototype.deleteSelection=function(){return this.selection.replace(this),this},e.prototype.insertText=function(t,e,n){void 0===n&&(n=e);var r=this.doc.type.schema;if(null==e)return t?this.replaceSelectionWith(r.text(t),!0):this.deleteSelection();if(!t)return this.deleteRange(e,n);var o=this.storedMarks;if(!o){var i=this.doc.resolve(e);o=n==e?i.marks():i.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(e,n,r.text(t,o)),this.selection.empty||this.setSelection(s.near(this.selection.$to)),this},e.prototype.setMeta=function(t,e){return this.meta["string"==typeof t?t:t.key]=e,this},e.prototype.getMeta=function(t){return this.meta["string"==typeof t?t:t.key]},n.isGeneric.get=function(){for(var t in this.meta)return!1;return!0},e.prototype.scrollIntoView=function(){return this.updated|=4,this},n.scrolledIntoView.get=function(){return(4&this.updated)>0},Object.defineProperties(e.prototype,n),e}(o.Transform);function y(t,e){return e&&t?t.bind(e):t}var w=function(t,e,n){this.name=t,this.init=y(e.init,n),this.apply=y(e.apply,n)},b=[new w("doc",{init:function(t){return t.doc||t.schema.topNodeType.createAndFill()},apply:function(t){return t.doc}}),new w("selection",{init:function(t,e){return t.selection||s.atStart(e.doc)},apply:function(t){return t.selection}}),new w("storedMarks",{init:function(t){return t.storedMarks||null},apply:function(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new w("scrollToSelection",{init:function(){return 0},apply:function(t,e){return t.scrolledIntoView?e+1:e}})],S=function(t,e){var n=this;this.schema=t,this.fields=b.concat(),this.plugins=[],this.pluginsByKey=Object.create(null),e&&e.forEach((function(t){if(n.pluginsByKey[t.key])throw new RangeError("Adding different instances of a keyed plugin ("+t.key+")");n.plugins.push(t),n.pluginsByKey[t.key]=t,t.spec.state&&n.fields.push(new w(t.key,t.spec.state,t))}))},k=function(t){this.config=t},x={schema:{configurable:!0},plugins:{configurable:!0},tr:{configurable:!0}};x.schema.get=function(){return this.config.schema},x.plugins.get=function(){return this.config.plugins},k.prototype.apply=function(t){return this.applyTransaction(t).state},k.prototype.filterTransaction=function(t,e){void 0===e&&(e=-1);for(var n=0;n<this.config.plugins.length;n++)if(n!=e){var r=this.config.plugins[n];if(r.spec.filterTransaction&&!r.spec.filterTransaction.call(r,t,this))return!1}return!0},k.prototype.applyTransaction=function(t){if(!this.filterTransaction(t))return{state:this,transactions:[]};for(var e=[t],n=this.applyInner(t),r=null;;){for(var o=!1,i=0;i<this.config.plugins.length;i++){var s=this.config.plugins[i];if(s.spec.appendTransaction){var a=r?r[i].n:0,c=r?r[i].state:this,l=a<e.length&&s.spec.appendTransaction.call(s,a?e.slice(a):e,c,n);if(l&&n.filterTransaction(l,i)){if(l.setMeta("appendedTransaction",t),!r){r=[];for(var u=0;u<this.config.plugins.length;u++)r.push(u<i?{state:n,n:e.length}:{state:this,n:0})}e.push(l),n=n.applyInner(l),o=!0}r&&(r[i]={state:n,n:e.length})}}if(!o)return{state:n,transactions:e}}},k.prototype.applyInner=function(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");for(var e=new k(this.config),n=this.config.fields,r=0;r<n.length;r++){var o=n[r];e[o.name]=o.apply(t,this[o.name],this,e)}for(var i=0;i<C.length;i++)C[i](this,t,e);return e},x.tr.get=function(){return new g(this)},k.create=function(t){for(var e=new S(t.doc?t.doc.type.schema:t.schema,t.plugins),n=new k(e),r=0;r<e.fields.length;r++)n[e.fields[r].name]=e.fields[r].init(t,n);return n},k.prototype.reconfigure=function(t){for(var e=new S(this.schema,t.plugins),n=e.fields,r=new k(e),o=0;o<n.length;o++){var i=n[o].name;r[i]=this.hasOwnProperty(i)?this[i]:n[o].init(t,r)}return r},k.prototype.toJSON=function(t){var e={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(e.storedMarks=this.storedMarks.map((function(t){return t.toJSON()}))),t&&"object"==typeof t)for(var n in t){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");var r=t[n],o=r.spec.state;o&&o.toJSON&&(e[n]=o.toJSON.call(r,this[r.key]))}return e},k.fromJSON=function(t,e,n){if(!e)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");var o=new S(t.schema,t.plugins),i=new k(o);return o.fields.forEach((function(o){if("doc"==o.name)i.doc=r.Node.fromJSON(t.schema,e.doc);else if("selection"==o.name)i.selection=s.fromJSON(i.doc,e.selection);else if("storedMarks"==o.name)e.storedMarks&&(i.storedMarks=e.storedMarks.map(t.schema.markFromJSON));else{if(n)for(var a in n){var c=n[a],l=c.spec.state;if(c.key==o.name&&l&&l.fromJSON&&Object.prototype.hasOwnProperty.call(e,a))return void(i[o.name]=l.fromJSON.call(c,t,e[a],i))}i[o.name]=o.init(t,i)}})),i},k.addApplyListener=function(t){C.push(t)},k.removeApplyListener=function(t){var e=C.indexOf(t);e>-1&&C.splice(e,1)},Object.defineProperties(k.prototype,x);var C=[];var M=function(t){this.props={},t.props&&function t(e,n,r){for(var o in e){var i=e[o];i instanceof Function?i=i.bind(n):"handleDOMEvents"==o&&(i=t(i,n,{})),r[o]=i}return r}(t.props,this,this.props),this.spec=t,this.key=t.key?t.key.key:T("plugin")};M.prototype.getState=function(t){return t[this.key]};var O=Object.create(null);function T(t){return t in O?t+"$"+ ++O[t]:(O[t]=0,t+"$")}var N=function(t){void 0===t&&(t="key"),this.key=T(t)};N.prototype.get=function(t){return t.config.pluginsByKey[this.key]},N.prototype.getState=function(t){return t[this.key]}},function(t,e,n){"use strict";n.r(e),n.d(e,"AddMarkStep",(function(){return D})),n.d(e,"MapResult",(function(){return s})),n.d(e,"Mapping",(function(){return c})),n.d(e,"RemoveMarkStep",(function(){return E})),n.d(e,"ReplaceAroundStep",(function(){return g})),n.d(e,"ReplaceStep",(function(){return v})),n.d(e,"Step",(function(){return h})),n.d(e,"StepMap",(function(){return a})),n.d(e,"StepResult",(function(){return m})),n.d(e,"Transform",(function(){return u})),n.d(e,"TransformError",(function(){return l})),n.d(e,"canJoin",(function(){return C})),n.d(e,"canSplit",(function(){return x})),n.d(e,"dropPoint",(function(){return N})),n.d(e,"findWrapping",(function(){return S})),n.d(e,"insertPoint",(function(){return T})),n.d(e,"joinPoint",(function(){return O})),n.d(e,"liftTarget",(function(){return b})),n.d(e,"replaceStep",(function(){return R}));var r=n(0),o=Math.pow(2,16);function i(t){return 65535&t}var s=function(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=null),this.pos=t,this.deleted=e,this.recover=n},a=function t(e,n){if(void 0===n&&(n=!1),!e.length&&t.empty)return t.empty;this.ranges=e,this.inverted=n};a.prototype.recover=function(t){var e=0,n=i(t);if(!this.inverted)for(var r=0;r<n;r++)e+=this.ranges[3*r+2]-this.ranges[3*r+1];return this.ranges[3*n]+e+function(t){return(t-(65535&t))/o}(t)},a.prototype.mapResult=function(t,e){return void 0===e&&(e=1),this._map(t,e,!1)},a.prototype.map=function(t,e){return void 0===e&&(e=1),this._map(t,e,!0)},a.prototype._map=function(t,e,n){for(var r=0,i=this.inverted?2:1,a=this.inverted?1:2,c=0;c<this.ranges.length;c+=3){var l=this.ranges[c]-(this.inverted?r:0);if(l>t)break;var u=this.ranges[c+i],p=this.ranges[c+a],f=l+u;if(t<=f){var d=l+r+((u?t==l?-1:t==f?1:e:e)<0?0:p);if(n)return d;var h=t==(e<0?l:f)?null:c/3+(t-l)*o;return new s(d,e<0?t!=l:t!=f,h)}r+=p-u}return n?t+r:new s(t+r)},a.prototype.touches=function(t,e){for(var n=0,r=i(e),o=this.inverted?2:1,s=this.inverted?1:2,a=0;a<this.ranges.length;a+=3){var c=this.ranges[a]-(this.inverted?n:0);if(c>t)break;var l=this.ranges[a+o];if(t<=c+l&&a==3*r)return!0;n+=this.ranges[a+s]-l}return!1},a.prototype.forEach=function(t){for(var e=this.inverted?2:1,n=this.inverted?1:2,r=0,o=0;r<this.ranges.length;r+=3){var i=this.ranges[r],s=i-(this.inverted?o:0),a=i+(this.inverted?0:o),c=this.ranges[r+e],l=this.ranges[r+n];t(s,s+c,a,a+l),o+=l-c}},a.prototype.invert=function(){return new a(this.ranges,!this.inverted)},a.prototype.toString=function(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)},a.offset=function(t){return 0==t?a.empty:new a(t<0?[0,-t,0]:[0,0,t])},a.empty=new a([]);var c=function(t,e,n,r){this.maps=t||[],this.from=n||0,this.to=null==r?this.maps.length:r,this.mirror=e};function l(t){var e=Error.call(this,t);return e.__proto__=l.prototype,e}c.prototype.slice=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.maps.length),new c(this.maps,this.mirror,t,e)},c.prototype.copy=function(){return new c(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)},c.prototype.appendMap=function(t,e){this.to=this.maps.push(t),null!=e&&this.setMirror(this.maps.length-1,e)},c.prototype.appendMapping=function(t){for(var e=0,n=this.maps.length;e<t.maps.length;e++){var r=t.getMirror(e);this.appendMap(t.maps[e],null!=r&&r<e?n+r:null)}},c.prototype.getMirror=function(t){if(this.mirror)for(var e=0;e<this.mirror.length;e++)if(this.mirror[e]==t)return this.mirror[e+(e%2?-1:1)]},c.prototype.setMirror=function(t,e){this.mirror||(this.mirror=[]),this.mirror.push(t,e)},c.prototype.appendMappingInverted=function(t){for(var e=t.maps.length-1,n=this.maps.length+t.maps.length;e>=0;e--){var r=t.getMirror(e);this.appendMap(t.maps[e].invert(),null!=r&&r>e?n-r-1:null)}},c.prototype.invert=function(){var t=new c;return t.appendMappingInverted(this),t},c.prototype.map=function(t,e){if(void 0===e&&(e=1),this.mirror)return this._map(t,e,!0);for(var n=this.from;n<this.to;n++)t=this.maps[n].map(t,e);return t},c.prototype.mapResult=function(t,e){return void 0===e&&(e=1),this._map(t,e,!1)},c.prototype._map=function(t,e,n){for(var r=!1,o=this.from;o<this.to;o++){var i=this.maps[o].mapResult(t,e);if(null!=i.recover){var a=this.getMirror(o);if(null!=a&&a>o&&a<this.to){o=a,t=this.maps[a].recover(i.recover);continue}}i.deleted&&(r=!0),t=i.pos}return n?t:new s(t,r)},l.prototype=Object.create(Error.prototype),l.prototype.constructor=l,l.prototype.name="TransformError";var u=function(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new c},p={before:{configurable:!0},docChanged:{configurable:!0}};function f(){throw new Error("Override me")}p.before.get=function(){return this.docs.length?this.docs[0]:this.doc},u.prototype.step=function(t){var e=this.maybeStep(t);if(e.failed)throw new l(e.failed);return this},u.prototype.maybeStep=function(t){var e=t.apply(this.doc);return e.failed||this.addStep(t,e.doc),e},p.docChanged.get=function(){return this.steps.length>0},u.prototype.addStep=function(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e},Object.defineProperties(u.prototype,p);var d=Object.create(null),h=function(){};h.prototype.apply=function(t){return f()},h.prototype.getMap=function(){return a.empty},h.prototype.invert=function(t){return f()},h.prototype.map=function(t){return f()},h.prototype.merge=function(t){return null},h.prototype.toJSON=function(){return f()},h.fromJSON=function(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");var n=d[e.stepType];if(!n)throw new RangeError("No step type "+e.stepType+" defined");return n.fromJSON(t,e)},h.jsonID=function(t,e){if(t in d)throw new RangeError("Duplicate use of step JSON ID "+t);return d[t]=e,e.prototype.jsonID=t,e};var m=function(t,e){this.doc=t,this.failed=e};m.ok=function(t){return new m(t,null)},m.fail=function(t){return new m(null,t)},m.fromReplace=function(t,e,n,o){try{return m.ok(t.replace(e,n,o))}catch(t){if(t instanceof r.ReplaceError)return m.fail(t.message);throw t}};var v=function(t){function e(e,n,r,o){t.call(this),this.from=e,this.to=n,this.slice=r,this.structure=!!o}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){return this.structure&&y(t,this.from,this.to)?m.fail("Structure replace would overwrite content"):m.fromReplace(t,this.from,this.to,this.slice)},e.prototype.getMap=function(){return new a([this.from,this.to-this.from,this.slice.size])},e.prototype.invert=function(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted?null:new e(n.pos,Math.max(n.pos,r.pos),this.slice)},e.prototype.merge=function(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size!=t.from||this.slice.openEnd||t.slice.openStart){if(t.to!=this.from||this.slice.openStart||t.slice.openEnd)return null;var n=this.slice.size+t.slice.size==0?r.Slice.empty:new r.Slice(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}var o=this.slice.size+t.slice.size==0?r.Slice.empty:new r.Slice(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),o,this.structure)},e.prototype.toJSON=function(){var t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new e(n.from,n.to,r.Slice.fromJSON(t,n.slice),!!n.structure)},e}(h);h.jsonID("replace",v);var g=function(t){function e(e,n,r,o,i,s,a){t.call(this),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=!!a}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){if(this.structure&&(y(t,this.from,this.gapFrom)||y(t,this.gapTo,this.to)))return m.fail("Structure gap-replace would overwrite content");var e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return m.fail("Gap is not a flat range");var n=this.slice.insertAt(this.insert,e.content);return n?m.fromReplace(t,this.from,this.to,n):m.fail("Content does not fit in gap")},e.prototype.getMap=function(){return new a([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])},e.prototype.invert=function(t){var n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),o=t.map(this.gapFrom,-1),i=t.map(this.gapTo,1);return n.deleted&&r.deleted||o<n.pos||i>r.pos?null:new e(n.pos,r.pos,o,i,this.slice,this.insert,this.structure)},e.prototype.toJSON=function(){var t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to||"number"!=typeof n.gapFrom||"number"!=typeof n.gapTo||"number"!=typeof n.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new e(n.from,n.to,n.gapFrom,n.gapTo,r.Slice.fromJSON(t,n.slice),n.insert,!!n.structure)},e}(h);function y(t,e,n){for(var r=t.resolve(e),o=n-e,i=r.depth;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0)for(var s=r.node(i).maybeChild(r.indexAfter(i));o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}return!1}function w(t,e,n){return(0==e||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function b(t){for(var e=t.parent.content.cutByIndex(t.startIndex,t.endIndex),n=t.depth;;--n){var r=t.$from.node(n),o=t.$from.index(n),i=t.$to.indexAfter(n);if(n<t.depth&&r.canReplace(o,i,e))return n;if(0==n||r.type.spec.isolating||!w(r,o,i))break}}function S(t,e,n,r){void 0===r&&(r=t);var o=function(t,e){var n=t.parent,r=t.startIndex,o=t.endIndex,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;var s=i.length?i[0]:e;return n.canReplaceWith(r,o,s)?i:null}(t,e),i=o&&function(t,e){var n=t.parent,r=t.startIndex,o=t.endIndex,i=n.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;for(var a=(s.length?s[s.length-1]:e).contentMatch,c=r;a&&c<o;c++)a=a.matchType(n.child(c).type);if(!a||!a.validEnd)return null;return s}(r,e);return i?o.map(k).concat({type:e,attrs:n}).concat(i.map(k)):null}function k(t){return{type:t,attrs:null}}function x(t,e,n,r){void 0===n&&(n=1);var o=t.resolve(e),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(var a=o.depth-1,c=n-2;a>i;a--,c--){var l=o.node(a),u=o.index(a);if(l.type.spec.isolating)return!1;var p=l.content.cutByIndex(u,l.childCount),f=r&&r[c]||l;if(f!=l&&(p=p.replaceChild(0,f.type.create(f.attrs))),!l.canReplace(u+1,l.childCount)||!f.type.validContent(p))return!1}var d=o.indexAfter(i),h=r&&r[0];return o.node(i).canReplaceWith(d,d,h?h.type:o.node(i+1).type)}function C(t,e){var n=t.resolve(e),r=n.index();return M(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function M(t,e){return t&&e&&!t.isLeaf&&t.canAppend(e)}function O(t,e,n){void 0===n&&(n=-1);for(var r=t.resolve(e),o=r.depth;;o--){var i=void 0,s=void 0,a=r.index(o);if(o==r.depth?(i=r.nodeBefore,s=r.nodeAfter):n>0?(i=r.node(o+1),a++,s=r.node(o).maybeChild(a)):(i=r.node(o).maybeChild(a-1),s=r.node(o+1)),i&&!i.isTextblock&&M(i,s)&&r.node(o).canReplace(a,a+1))return e;if(0==o)break;e=n<0?r.before(o):r.after(o)}}function T(t,e,n){var r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(0==r.parentOffset)for(var o=r.depth-1;o>=0;o--){var i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(var s=r.depth-1;s>=0;s--){var a=r.indexAfter(s);if(r.node(s).canReplaceWith(a,a,n))return r.after(s+1);if(a<r.node(s).childCount)return null}}function N(t,e,n){var r=t.resolve(e);if(!n.content.size)return e;for(var o=n.content,i=0;i<n.openStart;i++)o=o.firstChild.content;for(var s=1;s<=(0==n.openStart&&n.size?2:1);s++)for(var a=r.depth;a>=0;a--){var c=a==r.depth?0:r.pos<=(r.start(a+1)+r.end(a+1))/2?-1:1,l=r.index(a)+(c>0?1:0),u=r.node(a),p=!1;if(1==s)p=u.canReplace(l,l,o);else{var f=u.contentMatchAt(l).findWrapping(o.firstChild.type);p=f&&u.canReplaceWith(l,l,f[0])}if(p)return 0==c?r.pos:c<0?r.before(a+1):r.after(a+1)}return null}function A(t,e,n){for(var o=[],i=0;i<t.childCount;i++){var s=t.child(i);s.content.size&&(s=s.copy(A(s.content,e,s))),s.isInline&&(s=e(s,n,i)),o.push(s)}return r.Fragment.fromArray(o)}h.jsonID("replaceAround",g),u.prototype.lift=function(t,e){for(var n=t.$from,o=t.$to,i=t.depth,s=n.before(i+1),a=o.after(i+1),c=s,l=a,u=r.Fragment.empty,p=0,f=i,d=!1;f>e;f--)d||n.index(f)>0?(d=!0,u=r.Fragment.from(n.node(f).copy(u)),p++):c--;for(var h=r.Fragment.empty,m=0,v=i,y=!1;v>e;v--)y||o.after(v+1)<o.end(v)?(y=!0,h=r.Fragment.from(o.node(v).copy(h)),m++):l++;return this.step(new g(c,l,s,a,new r.Slice(u.append(h),p,m),u.size-p,!0))},u.prototype.wrap=function(t,e){for(var n=r.Fragment.empty,o=e.length-1;o>=0;o--){if(n.size){var i=e[o].type.contentMatch.matchFragment(n);if(!i||!i.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=r.Fragment.from(e[o].type.create(e[o].attrs,n))}var s=t.start,a=t.end;return this.step(new g(s,a,s,a,new r.Slice(n,0,0),e.length,!0))},u.prototype.setBlockType=function(t,e,n,o){var i=this;if(void 0===e&&(e=t),!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");var s=this.steps.length;return this.doc.nodesBetween(t,e,(function(t,e){if(t.isTextblock&&!t.hasMarkup(n,o)&&function(t,e,n){var r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}(i.doc,i.mapping.slice(s).map(e),n)){i.clearIncompatible(i.mapping.slice(s).map(e,1),n);var a=i.mapping.slice(s),c=a.map(e,1),l=a.map(e+t.nodeSize,1);return i.step(new g(c,l,c+1,l-1,new r.Slice(r.Fragment.from(n.create(o,null,t.marks)),0,0),1,!0)),!1}})),this},u.prototype.setNodeMarkup=function(t,e,n,o){var i=this.doc.nodeAt(t);if(!i)throw new RangeError("No node at given position");e||(e=i.type);var s=e.create(n,null,o||i.marks);if(i.isLeaf)return this.replaceWith(t,t+i.nodeSize,s);if(!e.validContent(i.content))throw new RangeError("Invalid content for node type "+e.name);return this.step(new g(t,t+i.nodeSize,t+1,t+i.nodeSize-1,new r.Slice(r.Fragment.from(s),0,0),1,!0))},u.prototype.split=function(t,e,n){void 0===e&&(e=1);for(var o=this.doc.resolve(t),i=r.Fragment.empty,s=r.Fragment.empty,a=o.depth,c=o.depth-e,l=e-1;a>c;a--,l--){i=r.Fragment.from(o.node(a).copy(i));var u=n&&n[l];s=r.Fragment.from(u?u.type.create(u.attrs,s):o.node(a).copy(s))}return this.step(new v(t,t,new r.Slice(i.append(s),e,e),!0))},u.prototype.join=function(t,e){void 0===e&&(e=1);var n=new v(t-e,t+e,r.Slice.empty,!0);return this.step(n)};var D=function(t){function e(e,n,r){t.call(this),this.from=e,this.to=n,this.mark=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){var e=this,n=t.slice(this.from,this.to),o=t.resolve(this.from),i=o.node(o.sharedDepth(this.to)),s=new r.Slice(A(n.content,(function(t,n){return t.isAtom&&n.type.allowsMarkType(e.mark.type)?t.mark(e.mark.addToSet(t.marks)):t}),i),n.openStart,n.openEnd);return m.fromReplace(t,this.from,this.to,s)},e.prototype.invert=function(){return new E(this.from,this.to,this.mark)},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)},e.prototype.merge=function(t){if(t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from)return new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark)},e.prototype.toJSON=function(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new e(n.from,n.to,t.markFromJSON(n.mark))},e}(h);h.jsonID("addMark",D);var E=function(t){function e(e,n,r){t.call(this),this.from=e,this.to=n,this.mark=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){var e=this,n=t.slice(this.from,this.to),o=new r.Slice(A(n.content,(function(t){return t.mark(e.mark.removeFromSet(t.marks))})),n.openStart,n.openEnd);return m.fromReplace(t,this.from,this.to,o)},e.prototype.invert=function(){return new D(this.from,this.to,this.mark)},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)},e.prototype.merge=function(t){if(t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from)return new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark)},e.prototype.toJSON=function(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new e(n.from,n.to,t.markFromJSON(n.mark))},e}(h);function R(t,e,n,o){if(void 0===n&&(n=e),void 0===o&&(o=r.Slice.empty),e==n&&!o.size)return null;var i=t.resolve(e),s=t.resolve(n);return _(i,s,o)?new v(e,n,o):new I(i,s,o).fit()}function _(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}h.jsonID("removeMark",E),u.prototype.addMark=function(t,e,n){var r=this,o=[],i=[],s=null,a=null;return this.doc.nodesBetween(t,e,(function(r,c,l){if(r.isInline){var u=r.marks;if(!n.isInSet(u)&&l.type.allowsMarkType(n.type)){for(var p=Math.max(c,t),f=Math.min(c+r.nodeSize,e),d=n.addToSet(u),h=0;h<u.length;h++)u[h].isInSet(d)||(s&&s.to==p&&s.mark.eq(u[h])?s.to=f:o.push(s=new E(p,f,u[h])));a&&a.to==p?a.to=f:i.push(a=new D(p,f,n))}}})),o.forEach((function(t){return r.step(t)})),i.forEach((function(t){return r.step(t)})),this},u.prototype.removeMark=function(t,e,n){var o=this;void 0===n&&(n=null);var i=[],s=0;return this.doc.nodesBetween(t,e,(function(o,a){if(o.isInline){s++;var c=null;if(n instanceof r.MarkType)for(var l,u=o.marks;l=n.isInSet(u);)(c||(c=[])).push(l),u=l.removeFromSet(u);else n?n.isInSet(o.marks)&&(c=[n]):c=o.marks;if(c&&c.length)for(var p=Math.min(a+o.nodeSize,e),f=0;f<c.length;f++){for(var d=c[f],h=void 0,m=0;m<i.length;m++){var v=i[m];v.step==s-1&&d.eq(i[m].style)&&(h=v)}h?(h.to=p,h.step=s):i.push({style:d,from:Math.max(a,t),to:p,step:s})}}})),i.forEach((function(t){return o.step(new E(t.from,t.to,t.style))})),this},u.prototype.clearIncompatible=function(t,e,n){void 0===n&&(n=e.contentMatch);for(var o=this.doc.nodeAt(t),i=[],s=t+1,a=0;a<o.childCount;a++){var c=o.child(a),l=s+c.nodeSize,u=n.matchType(c.type,c.attrs);if(u){n=u;for(var p=0;p<c.marks.length;p++)e.allowsMarkType(c.marks[p].type)||this.step(new E(s,l,c.marks[p]))}else i.push(new v(s,l,r.Slice.empty));s=l}if(!n.validEnd){var f=n.fillBefore(r.Fragment.empty,!0);this.replace(s,s,new r.Slice(f,0,0))}for(var d=i.length-1;d>=0;d--)this.step(i[d]);return this},u.prototype.replace=function(t,e,n){void 0===e&&(e=t),void 0===n&&(n=r.Slice.empty);var o=R(this.doc,t,e,n);return o&&this.step(o),this},u.prototype.replaceWith=function(t,e,n){return this.replace(t,e,new r.Slice(r.Fragment.from(n),0,0))},u.prototype.delete=function(t,e){return this.replace(t,e,r.Slice.empty)},u.prototype.insert=function(t,e){return this.replaceWith(t,t,e)};var I=function(t,e,n){this.$to=e,this.$from=t,this.unplaced=n,this.frontier=[];for(var o=0;o<=t.depth;o++){var i=t.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(t.indexAfter(o))})}this.placed=r.Fragment.empty;for(var s=t.depth;s>0;s--)this.placed=r.Fragment.from(t.node(s).copy(this.placed))},z={depth:{configurable:!0}};function P(t,e,n){return 0==e?t.cutByIndex(n):t.replaceChild(0,t.firstChild.copy(P(t.firstChild.content,e-1,n)))}function $(t,e,n){return 0==e?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy($(t.lastChild.content,e-1,n)))}function F(t,e){for(var n=0;n<e;n++)t=t.firstChild.content;return t}function B(t,e,n){if(e<=0)return t;var o=t.content;return e>1&&(o=o.replaceChild(0,B(o.firstChild,e-1,1==o.childCount?n-1:0))),e>0&&(o=t.type.contentMatch.fillBefore(o).append(o),n<=0&&(o=o.append(t.type.contentMatch.matchFragment(o).fillBefore(r.Fragment.empty,!0)))),t.copy(o)}function L(t,e,n,r,o){var i=t.node(e),s=o?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;var a=r.fillBefore(i.content,!0,s);return a&&!function(t,e,n){for(var r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}(n,i.content,s)?a:null}function V(t){return t.spec.defining||t.spec.definingForContent}function j(t,e,n,o,i){if(e<n){var s=t.firstChild;t=t.replaceChild(0,s.copy(j(s.content,e+1,n,o,s)))}if(e>o){var a=i.contentMatchAt(0),c=a.fillBefore(t).append(t);t=c.append(a.matchFragment(c).fillBefore(r.Fragment.empty,!0))}return t}function W(t,e){for(var n=[],r=Math.min(t.depth,e.depth);r>=0;r--){var o=t.start(r);if(o<t.pos-(t.depth-r)||e.end(r)>e.pos+(e.depth-r)||t.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;(o==e.start(r)||r==t.depth&&r==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&r&&e.start(r-1)==o-1)&&n.push(r)}return n}z.depth.get=function(){return this.frontier.length-1},I.prototype.fit=function(){for(;this.unplaced.size;){var t=this.findFittable();t?this.placeNodes(t):this.openMore()||this.dropNode()}var e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,o=this.$from,i=this.close(e<0?this.$to:o.doc.resolve(e));if(!i)return null;for(var s=this.placed,a=o.depth,c=i.depth;a&&c&&1==s.childCount;)s=s.firstChild.content,a--,c--;var l=new r.Slice(s,a,c);return e>-1?new g(o.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||o.pos!=this.$to.pos?new v(o.pos,i.pos,l):void 0},I.prototype.findFittable=function(){for(var t=1;t<=2;t++)for(var e=this.unplaced.openStart;e>=0;e--)for(var n=void 0,o=(e?(n=F(this.unplaced.content,e-1).firstChild).content:this.unplaced.content).firstChild,i=this.depth;i>=0;i--){var s=this.frontier[i],a=s.type,c=s.match,l=void 0,u=void 0;if(1==t&&(o?c.matchType(o.type)||(u=c.fillBefore(r.Fragment.from(o),!1)):a.compatibleContent(n.type)))return{sliceDepth:e,frontierDepth:i,parent:n,inject:u};if(2==t&&o&&(l=c.findWrapping(o.type)))return{sliceDepth:e,frontierDepth:i,parent:n,wrap:l};if(n&&c.matchType(n.type))break}},I.prototype.openMore=function(){var t=this.unplaced,e=t.content,n=t.openStart,o=t.openEnd,i=F(e,n);return!(!i.childCount||i.firstChild.isLeaf)&&(this.unplaced=new r.Slice(e,n+1,Math.max(o,i.size+n>=e.size-o?n+1:0)),!0)},I.prototype.dropNode=function(){var t=this.unplaced,e=t.content,n=t.openStart,o=t.openEnd,i=F(e,n);if(i.childCount<=1&&n>0){var s=e.size-n<=n+i.size;this.unplaced=new r.Slice(P(e,n-1,1),n-1,s?n-1:o)}else this.unplaced=new r.Slice(P(e,n,1),n,o)},I.prototype.placeNodes=function(t){for(var e=t.sliceDepth,n=t.frontierDepth,o=t.parent,i=t.inject,s=t.wrap;this.depth>n;)this.closeFrontierNode();if(s)for(var a=0;a<s.length;a++)this.openFrontierNode(s[a]);var c=this.unplaced,l=o?o.content:c.content,u=c.openStart-e,p=0,f=[],d=this.frontier[n],h=d.match,m=d.type;if(i){for(var v=0;v<i.childCount;v++)f.push(i.child(v));h=h.matchFragment(i)}for(var g=l.size+e-(c.content.size-c.openEnd);p<l.childCount;){var y=l.child(p),w=h.matchType(y.type);if(!w)break;(++p>1||0==u||y.content.size)&&(h=w,f.push(B(y.mark(m.allowedMarks(y.marks)),1==p?u:0,p==l.childCount?g:-1)))}var b=p==l.childCount;b||(g=-1),this.placed=$(this.placed,n,r.Fragment.from(f)),this.frontier[n].match=h,b&&g<0&&o&&o.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(var S=0,k=l;S<g;S++){var x=k.lastChild;this.frontier.push({type:x.type,match:x.contentMatchAt(x.childCount)}),k=x.content}this.unplaced=b?0==e?r.Slice.empty:new r.Slice(P(c.content,e-1,1),e-1,g<0?c.openEnd:e-1):new r.Slice(P(c.content,e,p),c.openStart,c.openEnd)},I.prototype.mustMoveInline=function(){if(!this.$to.parent.isTextblock||this.$to.end()==this.$to.pos)return-1;var t,e=this.frontier[this.depth];if(!e.type.isTextblock||!L(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;for(var n=this.$to.depth,r=this.$to.after(n);n>1&&r==this.$to.end(--n);)++r;return r},I.prototype.findCloseLevel=function(t){t:for(var e=Math.min(this.depth,t.depth);e>=0;e--){var n=this.frontier[e],r=n.match,o=n.type,i=e<t.depth&&t.end(e+1)==t.pos+(t.depth-(e+1)),s=L(t,e,o,r,i);if(s){for(var a=e-1;a>=0;a--){var c=this.frontier[a],l=c.match,u=L(t,a,c.type,l,!0);if(!u||u.childCount)continue t}return{depth:e,fit:s,move:i?t.doc.resolve(t.after(e+1)):t}}}},I.prototype.close=function(t){var e=this.findCloseLevel(t);if(!e)return null;for(;this.depth>e.depth;)this.closeFrontierNode();e.fit.childCount&&(this.placed=$(this.placed,e.depth,e.fit)),t=e.move;for(var n=e.depth+1;n<=t.depth;n++){var r=t.node(n),o=r.type.contentMatch.fillBefore(r.content,!0,t.index(n));this.openFrontierNode(r.type,r.attrs,o)}return t},I.prototype.openFrontierNode=function(t,e,n){var o=this.frontier[this.depth];o.match=o.match.matchType(t),this.placed=$(this.placed,this.depth,r.Fragment.from(t.create(e,n))),this.frontier.push({type:t,match:t.contentMatch})},I.prototype.closeFrontierNode=function(){var t=this.frontier.pop().match.fillBefore(r.Fragment.empty,!0);t.childCount&&(this.placed=$(this.placed,this.frontier.length,t))},Object.defineProperties(I.prototype,z),u.prototype.replaceRange=function(t,e,n){if(!n.size)return this.deleteRange(t,e);var o=this.doc.resolve(t),i=this.doc.resolve(e);if(_(o,i,n))return this.step(new v(t,e,n));var s=W(o,this.doc.resolve(e));0==s[s.length-1]&&s.pop();var a=-(o.depth+1);s.unshift(a);for(var c=o.depth,l=o.pos-1;c>0;c--,l--){var u=o.node(c).type.spec;if(u.defining||u.definingAsContext||u.isolating)break;s.indexOf(c)>-1?a=c:o.before(c)==l&&s.splice(1,0,-c)}for(var p=s.indexOf(a),f=[],d=n.openStart,h=n.content,m=0;;m++){var g=h.firstChild;if(f.push(g),m==n.openStart)break;h=g.content}for(var y=d-1;y>=0;y--){var w=f[y].type,b=V(w);if(b&&o.node(p).type!=w)d=y;else if(b||!w.isTextblock)break}for(var S=n.openStart;S>=0;S--){var k=(S+d+1)%(n.openStart+1),x=f[k];if(x)for(var C=0;C<s.length;C++){var M=s[(C+p)%s.length],O=!0;M<0&&(O=!1,M=-M);var T=o.node(M-1),N=o.index(M-1);if(T.canReplaceWith(N,N,x.type,x.marks))return this.replace(o.before(M),O?i.after(M):e,new r.Slice(j(n.content,0,n.openStart,k),k,n.openEnd))}}for(var A=this.steps.length,D=s.length-1;D>=0&&(this.replace(t,e,n),!(this.steps.length>A));D--){var E=s[D];E<0||(t=o.before(E),e=i.after(E))}return this},u.prototype.replaceRangeWith=function(t,e,n){if(!n.isInline&&t==e&&this.doc.resolve(t).parent.content.size){var o=T(this.doc,t,n.type);null!=o&&(t=e=o)}return this.replaceRange(t,e,new r.Slice(r.Fragment.from(n),0,0))},u.prototype.deleteRange=function(t,e){for(var n=this.doc.resolve(t),r=this.doc.resolve(e),o=W(n,r),i=0;i<o.length;i++){var s=o[i],a=i==o.length-1;if(a&&0==s||n.node(s).type.contentMatch.validEnd)return this.delete(n.start(s),r.end(s));if(s>0&&(a||n.node(s-1).canReplace(n.index(s-1),r.indexAfter(s-1))))return this.delete(n.before(s),r.after(s))}for(var c=1;c<=n.depth&&c<=r.depth;c++)if(t-n.start(c)==n.depth-c&&e>n.end(c)&&r.end(c)-e!=r.depth-c)return this.delete(n.before(c),e);return this.delete(t,e)}},function(t,e,n){"use strict";n.r(e),n.d(e,"Decoration",(function(){return Ne})),n.d(e,"DecorationSet",(function(){return Re})),n.d(e,"EditorView",(function(){return We})),n.d(e,"__endComposition",(function(){return ye})),n.d(e,"__parseFromClipboard",(function(){return Vt})),n.d(e,"__serializeForClipboard",(function(){return Lt}));var r=n(1),o=n(0),i=n(2),s={};if("undefined"!=typeof navigator&&"undefined"!=typeof document){var a=/Edge\/(\d+)/.exec(navigator.userAgent),c=/MSIE \d/.test(navigator.userAgent),l=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),u=s.ie=!!(c||l||a);s.ie_version=c?document.documentMode||6:l?+l[1]:a?+a[1]:null,s.gecko=!u&&/gecko\/(\d+)/i.test(navigator.userAgent),s.gecko_version=s.gecko&&+(/Firefox\/(\d+)/.exec(navigator.userAgent)||[0,0])[1];var p=!u&&/Chrome\/(\d+)/.exec(navigator.userAgent);s.chrome=!!p,s.chrome_version=p&&+p[1],s.safari=!u&&/Apple Computer/.test(navigator.vendor),s.ios=s.safari&&(/Mobile\/\w+/.test(navigator.userAgent)||navigator.maxTouchPoints>2),s.mac=s.ios||/Mac/.test(navigator.platform),s.android=/Android \d/.test(navigator.userAgent),s.webkit="webkitFontSmoothing"in document.documentElement.style,s.webkit_version=s.webkit&&+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]}var f=function(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e},d=function(t){var e=t.assignedSlot||t.parentNode;return e&&11==e.nodeType?e.host:e},h=null,m=function(t,e,n){var r=h||(h=document.createRange());return r.setEnd(t,null==n?t.nodeValue.length:n),r.setStart(t,e||0),r},v=function(t,e,n,r){return n&&(y(t,e,n,r,-1)||y(t,e,n,r,1))},g=/^(img|br|input|textarea|hr)$/i;function y(t,e,n,r,o){for(;;){if(t==n&&e==r)return!0;if(e==(o<0?0:w(t))){var i=t.parentNode;if(!i||1!=i.nodeType||b(t)||g.test(t.nodeName)||"false"==t.contentEditable)return!1;e=f(t)+(o<0?0:1),t=i}else{if(1!=t.nodeType)return!1;if("false"==(t=t.childNodes[e+(o<0?-1:0)]).contentEditable)return!1;e=o<0?w(t):0}}}function w(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function b(t){for(var e,n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}var S=function(t){var e=t.isCollapsed;return e&&s.chrome&&t.rangeCount&&!t.getRangeAt(0).collapsed&&(e=!1),e};function k(t,e){var n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function x(t){return{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function C(t,e){return"number"==typeof t?t:t[e]}function M(t){var e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function O(t,e,n){for(var r=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument,s=n||t.dom;s;s=d(s))if(1==s.nodeType){var a=s==i.body||1!=s.nodeType,c=a?x(i):M(s),l=0,u=0;if(e.top<c.top+C(r,"top")?u=-(c.top-e.top+C(o,"top")):e.bottom>c.bottom-C(r,"bottom")&&(u=e.bottom-c.bottom+C(o,"bottom")),e.left<c.left+C(r,"left")?l=-(c.left-e.left+C(o,"left")):e.right>c.right-C(r,"right")&&(l=e.right-c.right+C(o,"right")),l||u)if(a)i.defaultView.scrollBy(l,u);else{var p=s.scrollLeft,f=s.scrollTop;u&&(s.scrollTop+=u),l&&(s.scrollLeft+=l);var h=s.scrollLeft-p,m=s.scrollTop-f;e={left:e.left-h,top:e.top-m,right:e.right-h,bottom:e.bottom-m}}if(a)break}}function T(t){for(var e=[],n=t.ownerDocument;t&&(e.push({dom:t,top:t.scrollTop,left:t.scrollLeft}),t!=n);t=d(t));return e}function N(t,e){for(var n=0;n<t.length;n++){var r=t[n],o=r.dom,i=r.top,s=r.left;o.scrollTop!=i+e&&(o.scrollTop=i+e),o.scrollLeft!=s&&(o.scrollLeft=s)}}var A=null;function D(t,e){for(var n,r,o=2e8,i=0,s=e.top,a=e.top,c=t.firstChild,l=0;c;c=c.nextSibling,l++){var u=void 0;if(1==c.nodeType)u=c.getClientRects();else{if(3!=c.nodeType)continue;u=m(c).getClientRects()}for(var p=0;p<u.length;p++){var f=u[p];if(f.top<=s&&f.bottom>=a){s=Math.max(f.bottom,s),a=Math.min(f.top,a);var d=f.left>e.left?f.left-e.left:f.right<e.left?e.left-f.right:0;if(d<o){n=c,o=d,r=d&&3==n.nodeType?{left:f.right<e.left?f.right:f.left,top:e.top}:e,1==c.nodeType&&d&&(i=l+(e.left>=(f.left+f.right)/2?1:0));continue}}!n&&(e.left>=f.right&&e.top>=f.top||e.left>=f.left&&e.top>=f.bottom)&&(i=l+1)}}return n&&3==n.nodeType?function(t,e){for(var n=t.nodeValue.length,r=document.createRange(),o=0;o<n;o++){r.setEnd(t,o+1),r.setStart(t,o);var i=_(r,1);if(i.top!=i.bottom&&E(e,i))return{node:t,offset:o+(e.left>=(i.left+i.right)/2?1:0)}}return{node:t,offset:0}}(n,r):!n||o&&1==n.nodeType?{node:t,offset:i}:D(n,r)}function E(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function R(t,e){var n,r,o,i,a=t.dom.ownerDocument;if(a.caretPositionFromPoint)try{var c=a.caretPositionFromPoint(e.left,e.top);c&&(o=(n=c).offsetNode,i=n.offset)}catch(t){}if(!o&&a.caretRangeFromPoint){var l=a.caretRangeFromPoint(e.left,e.top);l&&(o=(r=l).startContainer,i=r.startOffset)}var u,p=(t.root.elementFromPoint?t.root:a).elementFromPoint(e.left,e.top+1);if(!p||!t.dom.contains(1!=p.nodeType?p.parentNode:p)){var f=t.dom.getBoundingClientRect();if(!E(e,f))return null;if(!(p=function t(e,n,r){var o=e.childNodes.length;if(o&&r.top<r.bottom)for(var i=Math.max(0,Math.min(o-1,Math.floor(o*(n.top-r.top)/(r.bottom-r.top))-2)),s=i;;){var a=e.childNodes[s];if(1==a.nodeType)for(var c=a.getClientRects(),l=0;l<c.length;l++){var u=c[l];if(E(n,u))return t(a,n,u)}if((s=(s+1)%o)==i)break}return e}(t.dom,e,f)))return null}if(s.safari)for(var h=p;o&&h;h=d(h))h.draggable&&(o=i=null);if(p=function(t,e){var n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}(p,e),o){if(s.gecko&&1==o.nodeType&&(i=Math.min(i,o.childNodes.length))<o.childNodes.length){var m,v=o.childNodes[i];"IMG"==v.nodeName&&(m=v.getBoundingClientRect()).right<=e.left&&m.bottom>e.top&&i++}o==t.dom&&i==o.childNodes.length-1&&1==o.lastChild.nodeType&&e.top>o.lastChild.getBoundingClientRect().bottom?u=t.state.doc.content.size:0!=i&&1==o.nodeType&&"BR"==o.childNodes[i-1].nodeName||(u=function(t,e,n,r){for(var o=-1,i=e;i!=t.dom;){var s=t.docView.nearestDesc(i,!0);if(!s)return null;if(s.node.isBlock&&s.parent){var a=s.dom.getBoundingClientRect();if(a.left>r.left||a.top>r.top)o=s.posBefore;else{if(!(a.right<r.left||a.bottom<r.top))break;o=s.posAfter}}i=s.dom.parentNode}return o>-1?o:t.docView.posFromDOM(e,n)}(t,o,i,e))}null==u&&(u=function(t,e,n){var r=D(e,n),o=r.node,i=r.offset,s=-1;if(1==o.nodeType&&!o.firstChild){var a=o.getBoundingClientRect();s=a.left!=a.right&&n.left>(a.left+a.right)/2?1:-1}return t.docView.posFromDOM(o,i,s)}(t,p,e));var g=t.docView.nearestDesc(p,!0);return{pos:u,inside:g?g.posAtStart-g.border:-1}}function _(t,e){var n=t.getClientRects();return n.length?n[e<0?0:n.length-1]:t.getBoundingClientRect()}var I=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function z(t,e,n){var r=t.docView.domFromPos(e,n<0?-1:1),o=r.node,i=r.offset,a=s.webkit||s.gecko;if(3==o.nodeType){if(!a||!I.test(o.nodeValue)&&(n<0?i:i!=o.nodeValue.length)){var c=i,l=i,u=n<0?1:-1;return n<0&&!i?(l++,u=-1):n>=0&&i==o.nodeValue.length?(c--,u=1):n<0?c--:l++,P(_(m(o,c,l),u),u<0)}var p=_(m(o,i,i),n);if(s.gecko&&i&&/\s/.test(o.nodeValue[i-1])&&i<o.nodeValue.length){var f=_(m(o,i-1,i-1),-1);if(f.top==p.top){var d=_(m(o,i,i+1),-1);if(d.top!=p.top)return P(d,d.left<f.left)}}return p}if(!t.state.doc.resolve(e).parent.inlineContent){if(i&&(n<0||i==w(o))){var h=o.childNodes[i-1];if(1==h.nodeType)return $(h.getBoundingClientRect(),!1)}if(i<w(o)){var v=o.childNodes[i];if(1==v.nodeType)return $(v.getBoundingClientRect(),!0)}return $(o.getBoundingClientRect(),n>=0)}if(i&&(n<0||i==w(o))){var g=o.childNodes[i-1],y=3==g.nodeType?m(g,w(g)-(a?0:1)):1!=g.nodeType||"BR"==g.nodeName&&g.nextSibling?null:g;if(y)return P(_(y,1),!1)}if(i<w(o)){for(var b=o.childNodes[i];b.pmViewDesc&&b.pmViewDesc.ignoreForCoords;)b=b.nextSibling;var S=b?3==b.nodeType?m(b,0,a?0:1):1==b.nodeType?b:null:null;if(S)return P(_(S,-1),!0)}return P(_(3==o.nodeType?m(o):o,-n),n>=0)}function P(t,e){if(0==t.width)return t;var n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function $(t,e){if(0==t.height)return t;var n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function F(t,e,n){var r=t.state,o=t.root.activeElement;r!=e&&t.updateState(e),o!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),o!=t.dom&&o&&o.focus()}}var B=/[\u0590-\u08ac]/;var L=null,V=null,j=!1;function W(t,e,n){return L==e&&V==n?j:(L=e,V=n,j="up"==n||"down"==n?function(t,e,n){var r=e.selection,o="up"==n?r.$from:r.$to;return F(t,e,(function(){for(var e=t.docView.domFromPos(o.pos,"up"==n?-1:1).node;;){var r=t.docView.nearestDesc(e,!0);if(!r)break;if(r.node.isBlock){e=r.dom;break}e=r.dom.parentNode}for(var i=z(t,o.pos,1),s=e.firstChild;s;s=s.nextSibling){var a=void 0;if(1==s.nodeType)a=s.getClientRects();else{if(3!=s.nodeType)continue;a=m(s,0,s.nodeValue.length).getClientRects()}for(var c=0;c<a.length;c++){var l=a[c];if(l.bottom>l.top+1&&("up"==n?i.top-l.top>2*(l.bottom-i.top):l.bottom-i.bottom>2*(i.bottom-l.top)))return!1}}return!0}))}(t,e,n):function(t,e,n){var r=e.selection.$head;if(!r.parent.isTextblock)return!1;var o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=t.root.getSelection();return B.test(r.parent.textContent)&&a.modify?F(t,e,(function(){var e=a.getRangeAt(0),o=a.focusNode,i=a.focusOffset,s=a.caretBidiLevel;a.modify("move",n,"character");var c=!(r.depth?t.docView.domAfterPos(r.before()):t.dom).contains(1==a.focusNode.nodeType?a.focusNode:a.focusNode.parentNode)||o==a.focusNode&&i==a.focusOffset;return a.removeAllRanges(),a.addRange(e),null!=s&&(a.caretBidiLevel=s),c})):"left"==n||"backward"==n?i:s}(t,e,n))}var K=function(t,e,n,r){this.parent=t,this.children=e,this.dom=n,n.pmViewDesc=this,this.contentDOM=r,this.dirty=0},q={size:{configurable:!0},border:{configurable:!0},posBefore:{configurable:!0},posAtStart:{configurable:!0},posAfter:{configurable:!0},posAtEnd:{configurable:!0},contentLost:{configurable:!0},domAtom:{configurable:!0},ignoreForCoords:{configurable:!0}};K.prototype.matchesWidget=function(){return!1},K.prototype.matchesMark=function(){return!1},K.prototype.matchesNode=function(){return!1},K.prototype.matchesHack=function(t){return!1},K.prototype.parseRule=function(){return null},K.prototype.stopEvent=function(){return!1},q.size.get=function(){for(var t=0,e=0;e<this.children.length;e++)t+=this.children[e].size;return t},q.border.get=function(){return 0},K.prototype.destroy=function(){this.parent=null,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=null);for(var t=0;t<this.children.length;t++)this.children[t].destroy()},K.prototype.posBeforeChild=function(t){for(var e=0,n=this.posAtStart;e<this.children.length;e++){var r=this.children[e];if(r==t)return n;n+=r.size}},q.posBefore.get=function(){return this.parent.posBeforeChild(this)},q.posAtStart.get=function(){return this.parent?this.parent.posBeforeChild(this)+this.border:0},q.posAfter.get=function(){return this.posBefore+this.size},q.posAtEnd.get=function(){return this.posAtStart+this.size-2*this.border},K.prototype.localPosFromDOM=function(t,e,n){if(this.contentDOM&&this.contentDOM.contains(1==t.nodeType?t:t.parentNode)){if(n<0){var r,o;if(t==this.contentDOM)r=t.childNodes[e-1];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;r=t.previousSibling}for(;r&&(!(o=r.pmViewDesc)||o.parent!=this);)r=r.previousSibling;return r?this.posBeforeChild(o)+o.size:this.posAtStart}var i,s;if(t==this.contentDOM)i=t.childNodes[e];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;i=t.nextSibling}for(;i&&(!(s=i.pmViewDesc)||s.parent!=this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}var a;if(t==this.dom&&this.contentDOM)a=e>f(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))a=2&t.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==e)for(var c=t;;c=c.parentNode){if(c==this.dom){a=!1;break}if(c.parentNode.firstChild!=c)break}if(null==a&&e==t.childNodes.length)for(var l=t;;l=l.parentNode){if(l==this.dom){a=!0;break}if(l.parentNode.lastChild!=l)break}}return(null==a?n>0:a)?this.posAtEnd:this.posAtStart},K.prototype.nearestDesc=function(t,e){for(var n=!0,r=t;r;r=r.parentNode){var o=this.getDesc(r);if(o&&(!e||o.node)){if(!n||!o.nodeDOM||(1==o.nodeDOM.nodeType?o.nodeDOM.contains(1==t.nodeType?t:t.parentNode):o.nodeDOM==t))return o;n=!1}}},K.prototype.getDesc=function(t){for(var e=t.pmViewDesc,n=e;n;n=n.parent)if(n==this)return e},K.prototype.posFromDOM=function(t,e,n){for(var r=t;r;r=r.parentNode){var o=this.getDesc(r);if(o)return o.localPosFromDOM(t,e,n)}return-1},K.prototype.descAt=function(t){for(var e=0,n=0;e<this.children.length;e++){var r=this.children[e],o=n+r.size;if(n==t&&o!=n){for(;!r.border&&r.children.length;)r=r.children[0];return r}if(t<o)return r.descAt(t-n-r.border);n=o}},K.prototype.domFromPos=function(t,e){if(!this.contentDOM)return{node:this.dom,offset:0};for(var n=0,r=0,o=0;n<this.children.length;n++){var i=this.children[n],s=o+i.size;if(s>t||i instanceof Z){r=t-o;break}o=s}if(r)return this.children[n].domFromPos(r-this.children[n].border,e);for(var a=void 0;n&&!(a=this.children[n-1]).size&&a instanceof J&&a.widget.type.side>=0;n--);if(e<=0){for(var c,l=!0;(c=n?this.children[n-1]:null)&&c.dom.parentNode!=this.contentDOM;n--,l=!1);return c&&e&&l&&!c.border&&!c.domAtom?c.domFromPos(c.size,e):{node:this.contentDOM,offset:c?f(c.dom)+1:0}}for(var u,p=!0;(u=n<this.children.length?this.children[n]:null)&&u.dom.parentNode!=this.contentDOM;n++,p=!1);return u&&p&&!u.border&&!u.domAtom?u.domFromPos(0,e):{node:this.contentDOM,offset:u?f(u.dom):this.contentDOM.childNodes.length}},K.prototype.parseRange=function(t,e,n){if(void 0===n&&(n=0),0==this.children.length)return{node:this.contentDOM,from:t,to:e,fromOffset:0,toOffset:this.contentDOM.childNodes.length};for(var r=-1,o=-1,i=n,s=0;;s++){var a=this.children[s],c=i+a.size;if(-1==r&&t<=c){var l=i+a.border;if(t>=l&&e<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(t,e,l);t=i;for(var u=s;u>0;u--){var p=this.children[u-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){r=f(p.dom)+1;break}t-=p.size}-1==r&&(r=0)}if(r>-1&&(c>e||s==this.children.length-1)){e=c;for(var d=s+1;d<this.children.length;d++){var h=this.children[d];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(-1)){o=f(h.dom);break}e+=h.size}-1==o&&(o=this.contentDOM.childNodes.length);break}i=c}return{node:this.contentDOM,from:t,to:e,fromOffset:r,toOffset:o}},K.prototype.emptyChildAt=function(t){if(this.border||!this.contentDOM||!this.children.length)return!1;var e=this.children[t<0?0:this.children.length-1];return 0==e.size||e.emptyChildAt(t)},K.prototype.domAfterPos=function(t){var e=this.domFromPos(t,0),n=e.node,r=e.offset;if(1!=n.nodeType||r==n.childNodes.length)throw new RangeError("No node after pos "+t);return n.childNodes[r]},K.prototype.setSelection=function(t,e,n,r){for(var o=Math.min(t,e),i=Math.max(t,e),a=0,c=0;a<this.children.length;a++){var l=this.children[a],u=c+l.size;if(o>c&&i<u)return l.setSelection(t-c-l.border,e-c-l.border,n,r);c=u}var p=this.domFromPos(t,t?-1:1),d=e==t?p:this.domFromPos(e,e?-1:1),h=n.getSelection(),m=!1;if((s.gecko||s.safari)&&t==e){var g=p.node,y=p.offset;if(3==g.nodeType){if((m=y&&"\n"==g.nodeValue[y-1])&&y==g.nodeValue.length)for(var w=g,b=void 0;w;w=w.parentNode){if(b=w.nextSibling){"BR"==b.nodeName&&(p=d={node:b.parentNode,offset:f(b)+1});break}var S=w.pmViewDesc;if(S&&S.node&&S.node.isBlock)break}}else{var k=g.childNodes[y-1];m=k&&("BR"==k.nodeName||"false"==k.contentEditable)}}if(s.gecko&&h.focusNode&&h.focusNode!=d.node&&1==h.focusNode.nodeType){var x=h.focusNode.childNodes[h.focusOffset];x&&"false"==x.contentEditable&&(r=!0)}if(r||m&&s.safari||!v(p.node,p.offset,h.anchorNode,h.anchorOffset)||!v(d.node,d.offset,h.focusNode,h.focusOffset)){var C=!1;if((h.extend||t==e)&&!m){h.collapse(p.node,p.offset);try{t!=e&&h.extend(d.node,d.offset),C=!0}catch(t){if(!(t instanceof DOMException))throw t}}if(!C){if(t>e){var M=p;p=d,d=M}var O=document.createRange();O.setEnd(d.node,d.offset),O.setStart(p.node,p.offset),h.removeAllRanges(),h.addRange(O)}}},K.prototype.ignoreMutation=function(t){return!this.contentDOM&&"selection"!=t.type},q.contentLost.get=function(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)},K.prototype.markDirty=function(t,e){for(var n=0,r=0;r<this.children.length;r++){var o=this.children[r],i=n+o.size;if(n==i?t<=i&&e>=n:t<i&&e>n){var s=n+o.border,a=i-o.border;if(t>=s&&e<=a)return this.dirty=t==n||e==i?2:1,void(t!=s||e!=a||!o.contentLost&&o.dom.parentNode==this.contentDOM?o.markDirty(t-s,e-s):o.dirty=3);o.dirty=o.dom!=o.contentDOM||o.dom.parentNode!=this.contentDOM||o.children.length?3:2}n=i}this.dirty=2},K.prototype.markParentsDirty=function(){for(var t=1,e=this.parent;e;e=e.parent,t++){var n=1==t?2:1;e.dirty<n&&(e.dirty=n)}},q.domAtom.get=function(){return!1},q.ignoreForCoords.get=function(){return!1},Object.defineProperties(K.prototype,q);var H=[],J=function(t){function e(e,n,r,o){var i,s=n.type.toDOM;if("function"==typeof s&&(s=s(r,(function(){return i?i.parent?i.parent.posBeforeChild(i):void 0:o}))),!n.type.spec.raw){if(1!=s.nodeType){var a=document.createElement("span");a.appendChild(s),s=a}s.contentEditable=!1,s.classList.add("ProseMirror-widget")}t.call(this,e,H,s,null),this.widget=n,i=this}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={domAtom:{configurable:!0}};return e.prototype.matchesWidget=function(t){return 0==this.dirty&&t.type.eq(this.widget.type)},e.prototype.parseRule=function(){return{ignore:!0}},e.prototype.stopEvent=function(t){var e=this.widget.spec.stopEvent;return!!e&&e(t)},e.prototype.ignoreMutation=function(t){return"selection"!=t.type||this.widget.spec.ignoreSelection},e.prototype.destroy=function(){this.widget.type.destroy(this.dom),t.prototype.destroy.call(this)},n.domAtom.get=function(){return!0},Object.defineProperties(e.prototype,n),e}(K),U=function(t){function e(e,n,r,o){t.call(this,e,H,n,null),this.textDOM=r,this.text=o}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={size:{configurable:!0}};return n.size.get=function(){return this.text.length},e.prototype.localPosFromDOM=function(t,e){return t!=this.textDOM?this.posAtStart+(e?this.size:0):this.posAtStart+e},e.prototype.domFromPos=function(t){return{node:this.textDOM,offset:t}},e.prototype.ignoreMutation=function(t){return"characterData"===t.type&&t.target.nodeValue==t.oldValue},Object.defineProperties(e.prototype,n),e}(K),G=function(t){function e(e,n,r,o){t.call(this,e,[],r,o),this.mark=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.create=function(t,n,r,i){var s=i.nodeViews[n.type.name],a=s&&s(n,i,r);return a&&a.dom||(a=o.DOMSerializer.renderSpec(document,n.type.spec.toDOM(n,r))),new e(t,n,a.dom,a.contentDOM||a.dom)},e.prototype.parseRule=function(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}},e.prototype.matchesMark=function(t){return 3!=this.dirty&&this.mark.eq(t)},e.prototype.markDirty=function(e,n){if(t.prototype.markDirty.call(this,e,n),0!=this.dirty){for(var r=this.parent;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=0}},e.prototype.slice=function(t,n,r){var o=e.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;n<s&&(i=pt(i,n,s,r)),t>0&&(i=pt(i,0,t,r));for(var a=0;a<i.length;a++)i[a].parent=o;return o.children=i,o},e}(K),X=function(t){function e(e,n,r,o,i,s,a,c,l){t.call(this,e,n.isLeaf?H:[],i,s),this.nodeDOM=a,this.node=n,this.outerDeco=r,this.innerDeco=o,s&&this.updateChildren(c,l)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={size:{configurable:!0},border:{configurable:!0},domAtom:{configurable:!0}};return e.create=function(t,n,r,i,s,a){var c,l,u=s.nodeViews[n.type.name],p=u&&u(n,s,(function(){return l?l.parent?l.parent.posBeforeChild(l):void 0:a}),r,i),f=p&&p.dom,d=p&&p.contentDOM;if(n.isText)if(f){if(3!=f.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else f=document.createTextNode(n.text);else f||(f=(c=o.DOMSerializer.renderSpec(document,n.type.spec.toDOM(n))).dom,d=c.contentDOM);d||n.isText||"BR"==f.nodeName||(f.hasAttribute("contenteditable")||(f.contentEditable=!1),n.type.spec.draggable&&(f.draggable=!0));var h=f;return f=st(f,r,n),p?l=new tt(t,n,r,i,f,d,h,p,s,a+1):n.isText?new Q(t,n,r,i,f,h,s):new e(t,n,r,i,f,d,h,s,a+1)},e.prototype.parseRule=function(){var t=this;if(this.node.type.spec.reparseInView)return null;var e={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(var n=this.children.length-1;n>=0;n--){var r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=function(){return o.Fragment.empty})}else e.contentElement=this.contentDOM;else e.getContent=function(){return t.node.content};return e},e.prototype.matchesNode=function(t,e,n){return 0==this.dirty&&t.eq(this.node)&&at(e,this.outerDeco)&&n.eq(this.innerDeco)},n.size.get=function(){return this.node.nodeSize},n.border.get=function(){return this.node.isLeaf?0:1},e.prototype.updateChildren=function(t,e){var n=this,r=this.node.inlineContent,i=e,a=t.composing&&this.localCompositionInfo(t,e),c=a&&a.pos>-1?a:null,l=a&&a.pos<0,u=new lt(this,c&&c.node);!function(t,e,n,r){var o=e.locals(t),i=0;if(0==o.length){for(var s=0;s<t.childCount;s++){var a=t.child(s);r(a,o,e.forChild(i,a),s),i+=a.nodeSize}return}for(var c=0,l=[],u=null,p=0;;){if(c<o.length&&o[c].to==i){for(var f=o[c++],d=void 0;c<o.length&&o[c].to==i;)(d||(d=[f])).push(o[c++]);if(d){d.sort(ut);for(var h=0;h<d.length;h++)n(d[h],p,!!u)}else n(f,p,!!u)}var m=void 0,v=void 0;if(u)v=-1,m=u,u=null;else{if(!(p<t.childCount))break;v=p,m=t.child(p++)}for(var g=0;g<l.length;g++)l[g].to<=i&&l.splice(g--,1);for(;c<o.length&&o[c].from<=i&&o[c].to>i;)l.push(o[c++]);var y=i+m.nodeSize;if(m.isText){var w=y;c<o.length&&o[c].from<w&&(w=o[c].from);for(var b=0;b<l.length;b++)l[b].to<w&&(w=l[b].to);w<y&&(u=m.cut(w-i),m=m.cut(0,w-i),y=w,v=-1)}var S=l.length?m.isInline&&!m.isLeaf?l.filter((function(t){return!t.inline})):l.slice():H;r(m,S,e.forChild(i,m),v),i=y}}(this.node,this.innerDeco,(function(e,s,a){e.spec.marks?u.syncToMarks(e.spec.marks,r,t):e.type.side>=0&&!a&&u.syncToMarks(s==n.node.childCount?o.Mark.none:n.node.child(s).marks,r,t),u.placeWidget(e,t,i)}),(function(e,n,o,s){var c;u.syncToMarks(e.marks,r,t),u.findNodeMatch(e,n,o,s)||l&&t.state.selection.from>i&&t.state.selection.to<i+e.nodeSize&&(c=u.findIndexWithChild(a.node))>-1&&u.updateNodeAt(e,n,o,c,t)||u.updateNextNode(e,n,o,t,s)||u.addNode(e,n,o,t,i),i+=e.nodeSize})),u.syncToMarks(H,r,t),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||2==this.dirty)&&(c&&this.protectLocalComposition(t,c),function t(e,n,r){for(var o=e.firstChild,i=!1,s=0;s<n.length;s++){var a=n[s],c=a.dom;if(c.parentNode==e){for(;c!=o;)o=ct(o),i=!0;o=o.nextSibling}else i=!0,e.insertBefore(c,o);if(a instanceof G){var l=o?o.previousSibling:e.lastChild;t(a.contentDOM,a.children,r),o=l?l.nextSibling:e.firstChild}}for(;o;)o=ct(o),i=!0;i&&r.trackWrites==e&&(r.trackWrites=null)}(this.contentDOM,this.children,t),s.ios&&function(t){if("UL"==t.nodeName||"OL"==t.nodeName){var e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}(this.dom))},e.prototype.localCompositionInfo=function(t,e){var n=t.state.selection,o=n.from,i=n.to;if(!(!(t.state.selection instanceof r.TextSelection)||o<e||i>e+this.node.content.size)){var s=t.root.getSelection(),a=function(t,e){for(;;){if(3==t.nodeType)return t;if(1==t.nodeType&&e>0){if(t.childNodes.length>e&&3==t.childNodes[e].nodeType)return t.childNodes[e];t=t.childNodes[e-1],e=w(t)}else{if(!(1==t.nodeType&&e<t.childNodes.length))return null;t=t.childNodes[e],e=0}}}(s.focusNode,s.focusOffset);if(a&&this.dom.contains(a.parentNode)){if(this.node.inlineContent){var c=a.nodeValue,l=function(t,e,n,r){for(var o=0,i=0;o<t.childCount&&i<=r;){var s=t.child(o++),a=i;if(i+=s.nodeSize,s.isText){for(var c=s.text;o<t.childCount;){var l=t.child(o++);if(i+=l.nodeSize,!l.isText)break;c+=l.text}if(i>=n){var u=a<r?c.lastIndexOf(e,r-a-1):-1;if(u>=0&&u+e.length+a>=n)return a+u;if(n==r&&c.length>=r+e.length-a&&c.slice(r-a,r-a+e.length)==e)return r}}}return-1}(this.node.content,c,o-e,i-e);return l<0?null:{node:a,pos:l,text:c}}return{node:a,pos:-1}}}},e.prototype.protectLocalComposition=function(t,e){var n=e.node,r=e.pos,o=e.text;if(!this.getDesc(n)){for(var i=n;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=null)}var s=new U(this,i,n,o);t.compositionNodes.push(s),this.children=pt(this.children,r,r+o.length,t,s)}},e.prototype.update=function(t,e,n,r){return!(3==this.dirty||!t.sameMarkup(this.node))&&(this.updateInner(t,e,n,r),!0)},e.prototype.updateInner=function(t,e,n,r){this.updateOuterDeco(e),this.node=t,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0},e.prototype.updateOuterDeco=function(t){if(!at(t,this.outerDeco)){var e=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=ot(this.dom,this.nodeDOM,rt(this.outerDeco,this.node,e),rt(t,this.node,e)),this.dom!=n&&(n.pmViewDesc=null,this.dom.pmViewDesc=this),this.outerDeco=t}},e.prototype.selectNode=function(){this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)},e.prototype.deselectNode=function(){this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable")},n.domAtom.get=function(){return this.node.isAtom},Object.defineProperties(e.prototype,n),e}(K);function Y(t,e,n,r,o){return st(r,e,t),new X(null,t,e,n,r,r,r,o,0)}var Q=function(t){function e(e,n,r,o,i,s,a){t.call(this,e,n,r,o,i,null,s,a)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={domAtom:{configurable:!0}};return e.prototype.parseRule=function(){for(var t=this.nodeDOM.parentNode;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}},e.prototype.update=function(t,e,n,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!t.sameMarkup(this.node))&&(this.updateOuterDeco(e),0==this.dirty&&t.text==this.node.text||t.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=t.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=t,this.dirty=0,!0)},e.prototype.inParent=function(){for(var t=this.parent.contentDOM,e=this.nodeDOM;e;e=e.parentNode)if(e==t)return!0;return!1},e.prototype.domFromPos=function(t){return{node:this.nodeDOM,offset:t}},e.prototype.localPosFromDOM=function(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):t.prototype.localPosFromDOM.call(this,e,n,r)},e.prototype.ignoreMutation=function(t){return"characterData"!=t.type&&"selection"!=t.type},e.prototype.slice=function(t,n,r){var o=this.node.cut(t,n),i=document.createTextNode(o.text);return new e(this.parent,o,this.outerDeco,this.innerDeco,i,i,r)},e.prototype.markDirty=function(e,n){t.prototype.markDirty.call(this,e,n),this.dom==this.nodeDOM||0!=e&&n!=this.nodeDOM.nodeValue.length||(this.dirty=3)},n.domAtom.get=function(){return!1},Object.defineProperties(e.prototype,n),e}(X),Z=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={domAtom:{configurable:!0},ignoreForCoords:{configurable:!0}};return e.prototype.parseRule=function(){return{ignore:!0}},e.prototype.matchesHack=function(t){return 0==this.dirty&&this.dom.nodeName==t},n.domAtom.get=function(){return!0},n.ignoreForCoords.get=function(){return"IMG"==this.dom.nodeName},Object.defineProperties(e.prototype,n),e}(K),tt=function(t){function e(e,n,r,o,i,s,a,c,l,u){t.call(this,e,n,r,o,i,s,a,l,u),this.spec=c}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.update=function(e,n,r,o){if(3==this.dirty)return!1;if(this.spec.update){var i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,o),i}return!(!this.contentDOM&&!e.isLeaf)&&t.prototype.update.call(this,e,n,r,o)},e.prototype.selectNode=function(){this.spec.selectNode?this.spec.selectNode():t.prototype.selectNode.call(this)},e.prototype.deselectNode=function(){this.spec.deselectNode?this.spec.deselectNode():t.prototype.deselectNode.call(this)},e.prototype.setSelection=function(e,n,r,o){this.spec.setSelection?this.spec.setSelection(e,n,r):t.prototype.setSelection.call(this,e,n,r,o)},e.prototype.destroy=function(){this.spec.destroy&&this.spec.destroy(),t.prototype.destroy.call(this)},e.prototype.stopEvent=function(t){return!!this.spec.stopEvent&&this.spec.stopEvent(t)},e.prototype.ignoreMutation=function(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):t.prototype.ignoreMutation.call(this,e)},e}(X);function et(t){t&&(this.nodeName=t)}et.prototype=Object.create(null);var nt=[new et];function rt(t,e,n){if(0==t.length)return nt;for(var r=n?nt[0]:new et,o=[r],i=0;i<t.length;i++){var s=t[i].type.attrs;if(s)for(var a in s.nodeName&&o.push(r=new et(s.nodeName)),s){var c=s[a];null!=c&&(n&&1==o.length&&o.push(r=new et(e.isInline?"span":"div")),"class"==a?r.class=(r.class?r.class+" ":"")+c:"style"==a?r.style=(r.style?r.style+";":"")+c:"nodeName"!=a&&(r[a]=c))}}return o}function ot(t,e,n,r){if(n==nt&&r==nt)return e;for(var o=e,i=0;i<r.length;i++){var s=r[i],a=n[i];if(i){var c=void 0;a&&a.nodeName==s.nodeName&&o!=t&&(c=o.parentNode)&&c.tagName.toLowerCase()==s.nodeName||((c=document.createElement(s.nodeName)).pmIsDeco=!0,c.appendChild(o),a=nt[0]),o=c}it(o,a||nt[0],s)}return o}function it(t,e,n){for(var r in e)"class"==r||"style"==r||"nodeName"==r||r in n||t.removeAttribute(r);for(var o in n)"class"!=o&&"style"!=o&&"nodeName"!=o&&n[o]!=e[o]&&t.setAttribute(o,n[o]);if(e.class!=n.class){for(var i=e.class?e.class.split(" ").filter(Boolean):H,s=n.class?n.class.split(" ").filter(Boolean):H,a=0;a<i.length;a++)-1==s.indexOf(i[a])&&t.classList.remove(i[a]);for(var c=0;c<s.length;c++)-1==i.indexOf(s[c])&&t.classList.add(s[c]);0==t.classList.length&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style)for(var l,u=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;l=u.exec(e.style);)t.style.removeProperty(l[1]);n.style&&(t.style.cssText+=n.style)}}function st(t,e,n){return ot(t,t,nt,rt(e,n,1!=t.nodeType))}function at(t,e){if(t.length!=e.length)return!1;for(var n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function ct(t){var e=t.nextSibling;return t.parentNode.removeChild(t),e}var lt=function(t,e){this.top=t,this.lock=e,this.index=0,this.stack=[],this.changed=!1,this.preMatch=function(t,e){var n=e,r=n.children.length,o=t.childCount,i=new Map,s=[];t:for(;o>0;){for(var a=void 0;;)if(r){var c=n.children[r-1];if(!(c instanceof G)){a=c,r--;break}n=c,r=c.children.length}else{if(n==e)break t;r=n.parent.children.indexOf(n),n=n.parent}var l=a.node;if(l){if(l!=t.child(o-1))break;--o,i.set(a,o),s.push(a)}}return{index:o,matched:i,matches:s.reverse()}}(t.node.content,t)};function ut(t,e){return t.type.side-e.type.side}function pt(t,e,n,r,o){for(var i=[],s=0,a=0;s<t.length;s++){var c=t[s],l=a,u=a+=c.size;l>=n||u<=e?i.push(c):(l<e&&i.push(c.slice(0,e-l,r)),o&&(i.push(o),o=null),u>n&&i.push(c.slice(n-l,c.size,r)))}return i}function ft(t,e){var n=t.root.getSelection(),o=t.state.doc;if(!n.focusNode)return null;var i=t.docView.nearestDesc(n.focusNode),s=i&&0==i.size,a=t.docView.posFromDOM(n.focusNode,n.focusOffset);if(a<0)return null;var c,l,u=o.resolve(a);if(S(n)){for(c=u;i&&!i.node;)i=i.parent;if(i&&i.node.isAtom&&r.NodeSelection.isSelectable(i.node)&&i.parent&&(!i.node.isInline||!function(t,e,n){for(var r=0==e,o=e==w(t);r||o;){if(t==n)return!0;var i=f(t);if(!(t=t.parentNode))return!1;r=r&&0==i,o=o&&i==w(t)}}(n.focusNode,n.focusOffset,i.dom))){var p=i.posBefore;l=new r.NodeSelection(a==p?u:o.resolve(p))}}else{var d=t.docView.posFromDOM(n.anchorNode,n.anchorOffset);if(d<0)return null;c=o.resolve(d)}l||(l=St(t,c,u,"pointer"==e||t.state.selection.head<u.pos&&!s?1:-1));return l}function dt(t){return t.editable?t.hasFocus():kt(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function ht(t,e){var n=t.state.selection;if(wt(t,n),dt(t)){if(!e&&t.mouseDown&&t.mouseDown.allowDefault&&s.chrome){var o=t.root.getSelection(),i=t.domObserver.currentSelection;if(o.anchorNode&&v(o.anchorNode,o.anchorOffset,i.anchorNode,i.anchorOffset))return t.mouseDown.delayedSelectionSync=!0,void t.domObserver.setCurSelection()}if(t.domObserver.disconnectSelection(),t.cursorWrapper)!function(t){var e=t.root.getSelection(),n=document.createRange(),r=t.cursorWrapper.dom,o="IMG"==r.nodeName;o?n.setEnd(r.parentNode,f(r)+1):n.setEnd(r,0);n.collapse(!1),e.removeAllRanges(),e.addRange(n),!o&&!t.state.selection.visible&&s.ie&&s.ie_version<=11&&(r.disabled=!0,r.disabled=!1)}(t);else{var a,c,l=n.anchor,u=n.head;!mt||n instanceof r.TextSelection||(n.$from.parent.inlineContent||(a=vt(t,n.from)),n.empty||n.$from.parent.inlineContent||(c=vt(t,n.to))),t.docView.setSelection(l,u,t.root,e),mt&&(a&&yt(a),c&&yt(c)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(t){var e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.hideSelectionGuard);var n=t.root.getSelection(),r=n.anchorNode,o=n.anchorOffset;e.addEventListener("selectionchange",t.hideSelectionGuard=function(){n.anchorNode==r&&n.anchorOffset==o||(e.removeEventListener("selectionchange",t.hideSelectionGuard),setTimeout((function(){dt(t)&&!t.state.selection.visible||t.dom.classList.remove("ProseMirror-hideselection")}),20))})}(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}lt.prototype.destroyBetween=function(t,e){if(t!=e){for(var n=t;n<e;n++)this.top.children[n].destroy();this.top.children.splice(t,e-t),this.changed=!0}},lt.prototype.destroyRest=function(){this.destroyBetween(this.index,this.top.children.length)},lt.prototype.syncToMarks=function(t,e,n){for(var r=0,o=this.stack.length>>1,i=Math.min(o,t.length);r<i&&(r==o-1?this.top:this.stack[r+1<<1]).matchesMark(t[r])&&!1!==t[r].type.spec.spanning;)r++;for(;r<o;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<t.length;){this.stack.push(this.top,this.index+1);for(var s=-1,a=this.index;a<Math.min(this.index+3,this.top.children.length);a++)if(this.top.children[a].matchesMark(t[o])){s=a;break}if(s>-1)s>this.index&&(this.changed=!0,this.destroyBetween(this.index,s)),this.top=this.top.children[this.index];else{var c=G.create(this.top,t[o],e,n);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,o++}},lt.prototype.findNodeMatch=function(t,e,n,r){var o,i=-1;if(r>=this.preMatch.index&&(o=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&o.matchesNode(t,e,n))i=this.top.children.indexOf(o,this.index);else for(var s=this.index,a=Math.min(this.top.children.length,s+5);s<a;s++){var c=this.top.children[s];if(c.matchesNode(t,e,n)&&!this.preMatch.matched.has(c)){i=s;break}}return!(i<0)&&(this.destroyBetween(this.index,i),this.index++,!0)},lt.prototype.updateNodeAt=function(t,e,n,r,o){return!!this.top.children[r].update(t,e,n,o)&&(this.destroyBetween(this.index,r),this.index=r+1,!0)},lt.prototype.findIndexWithChild=function(t){for(;;){var e=t.parentNode;if(!e)return-1;if(e==this.top.contentDOM){var n=t.pmViewDesc;if(n)for(var r=this.index;r<this.top.children.length;r++)if(this.top.children[r]==n)return r;return-1}t=e}},lt.prototype.updateNextNode=function(t,e,n,r,o){for(var i=this.index;i<this.top.children.length;i++){var s=this.top.children[i];if(s instanceof X){var a=this.preMatch.matched.get(s);if(null!=a&&a!=o)return!1;var c=s.dom;if(!(this.lock&&(c==this.lock||1==c.nodeType&&c.contains(this.lock.parentNode))&&!(t.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==t.text&&3!=s.dirty&&at(e,s.outerDeco)))&&s.update(t,e,n,r))return this.destroyBetween(this.index,i),s.dom!=c&&(this.changed=!0),this.index++,!0;break}}return!1},lt.prototype.addNode=function(t,e,n,r,o){this.top.children.splice(this.index++,0,X.create(this.top,t,e,n,r,o)),this.changed=!0},lt.prototype.placeWidget=function(t,e,n){var r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(t)||t!=r.widget&&r.widget.type.toDOM.parentNode){var o=new J(this.top,t,e,n);this.top.children.splice(this.index++,0,o),this.changed=!0}else this.index++},lt.prototype.addTextblockHacks=function(){for(var t=this.top.children[this.index-1];t instanceof G;)t=t.children[t.children.length-1];t&&t instanceof Q&&!/\n$/.test(t.node.text)||((s.safari||s.chrome)&&t&&"false"==t.dom.contentEditable&&this.addHackNode("IMG"),this.addHackNode("BR"))},lt.prototype.addHackNode=function(t){if(this.index<this.top.children.length&&this.top.children[this.index].matchesHack(t))this.index++;else{var e=document.createElement(t);"IMG"==t&&(e.className="ProseMirror-separator",e.alt=""),"BR"==t&&(e.className="ProseMirror-trailingBreak"),this.top.children.splice(this.index++,0,new Z(this.top,H,e,null)),this.changed=!0}};var mt=s.safari||s.chrome&&s.chrome_version<63;function vt(t,e){var n=t.docView.domFromPos(e,0),r=n.node,o=n.offset,i=o<r.childNodes.length?r.childNodes[o]:null,a=o?r.childNodes[o-1]:null;if(s.safari&&i&&"false"==i.contentEditable)return gt(i);if(!(i&&"false"!=i.contentEditable||a&&"false"!=a.contentEditable)){if(i)return gt(i);if(a)return gt(a)}}function gt(t){return t.contentEditable="true",s.safari&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function yt(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function wt(t,e){if(e instanceof r.NodeSelection){var n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(bt(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else bt(t)}function bt(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=null)}function St(t,e,n,o){return t.someProp("createSelectionBetween",(function(r){return r(t,e,n)}))||r.TextSelection.between(e,n,o)}function kt(t){var e=t.root.getSelection();if(!e.anchorNode)return!1;try{return t.dom.contains(3==e.anchorNode.nodeType?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(3==e.focusNode.nodeType?e.focusNode.parentNode:e.focusNode))}catch(t){return!1}}function xt(t,e){var n=t.selection,o=n.$anchor,i=n.$head,s=e>0?o.max(i):o.min(i),a=s.parent.inlineContent?s.depth?t.doc.resolve(e>0?s.after():s.before()):null:s;return a&&r.Selection.findFrom(a,e)}function Ct(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Mt(t,e,n){var o=t.state.selection;if(!(o instanceof r.TextSelection)){if(o instanceof r.NodeSelection&&o.node.isInline)return Ct(t,new r.TextSelection(e>0?o.$to:o.$from));var i=xt(t.state,e);return!!i&&Ct(t,i)}if(!o.empty||n.indexOf("s")>-1)return!1;if(t.endOfTextblock(e>0?"right":"left")){var a=xt(t.state,e);return!!(a&&a instanceof r.NodeSelection)&&Ct(t,a)}if(!(s.mac&&n.indexOf("m")>-1)){var c,l=o.$head,u=l.textOffset?null:e<0?l.nodeBefore:l.nodeAfter;if(!u||u.isText)return!1;var p=e<0?l.pos-u.nodeSize:l.pos;return!!(u.isAtom||(c=t.docView.descAt(p))&&!c.contentDOM)&&(r.NodeSelection.isSelectable(u)?Ct(t,new r.NodeSelection(e<0?t.state.doc.resolve(l.pos-u.nodeSize):l)):!!s.webkit&&Ct(t,new r.TextSelection(t.state.doc.resolve(e<0?p:p+u.nodeSize))))}}function Ot(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function Tt(t){var e=t.pmViewDesc;return e&&0==e.size&&(t.nextSibling||"BR"!=t.nodeName)}function Nt(t){var e=t.root.getSelection(),n=e.focusNode,r=e.focusOffset;if(n){var o,i,a=!1;for(s.gecko&&1==n.nodeType&&r<Ot(n)&&Tt(n.childNodes[r])&&(a=!0);;)if(r>0){if(1!=n.nodeType)break;var c=n.childNodes[r-1];if(Tt(c))o=n,i=--r;else{if(3!=c.nodeType)break;r=(n=c).nodeValue.length}}else{if(Dt(n))break;for(var l=n.previousSibling;l&&Tt(l);)o=n.parentNode,i=f(l),l=l.previousSibling;if(l)r=Ot(n=l);else{if((n=n.parentNode)==t.dom)break;r=0}}a?Et(t,e,n,r):o&&Et(t,e,o,i)}}function At(t){var e=t.root.getSelection(),n=e.focusNode,r=e.focusOffset;if(n){for(var o,i,s=Ot(n);;)if(r<s){if(1!=n.nodeType)break;if(!Tt(n.childNodes[r]))break;o=n,i=++r}else{if(Dt(n))break;for(var a=n.nextSibling;a&&Tt(a);)o=a.parentNode,i=f(a)+1,a=a.nextSibling;if(a)r=0,s=Ot(n=a);else{if((n=n.parentNode)==t.dom)break;r=s=0}}o&&Et(t,e,o,i)}}function Dt(t){var e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function Et(t,e,n,r){if(S(e)){var o=document.createRange();o.setEnd(n,r),o.setStart(n,r),e.removeAllRanges(),e.addRange(o)}else e.extend&&e.extend(n,r);t.domObserver.setCurSelection();var i=t.state;setTimeout((function(){t.state==i&&ht(t)}),50)}function Rt(t,e,n){var o=t.state.selection;if(o instanceof r.TextSelection&&!o.empty||n.indexOf("s")>-1)return!1;if(s.mac&&n.indexOf("m")>-1)return!1;var i=o.$from,a=o.$to;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){var c=xt(t.state,e);if(c&&c instanceof r.NodeSelection)return Ct(t,c)}if(!i.parent.inlineContent){var l=e<0?i:a,u=o instanceof r.AllSelection?r.Selection.near(l,e):r.Selection.findFrom(l,e);return!!u&&Ct(t,u)}return!1}function _t(t,e){if(!(t.state.selection instanceof r.TextSelection))return!0;var n=t.state.selection,o=n.$head,i=n.$anchor,s=n.empty;if(!o.sameParent(i))return!0;if(!s)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;var a=!o.textOffset&&(e<0?o.nodeBefore:o.nodeAfter);if(a&&!a.isText){var c=t.state.tr;return e<0?c.delete(o.pos-a.nodeSize,o.pos):c.delete(o.pos,o.pos+a.nodeSize),t.dispatch(c),!0}return!1}function It(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function zt(t,e){var n=e.keyCode,r=function(t){var e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}(e);return 8==n||s.mac&&72==n&&"c"==r?_t(t,-1)||Nt(t):46==n||s.mac&&68==n&&"c"==r?_t(t,1)||At(t):13==n||27==n||(37==n?Mt(t,-1,r)||Nt(t):39==n?Mt(t,1,r)||At(t):38==n?Rt(t,-1,r)||Nt(t):40==n?function(t){if(s.safari&&!(t.state.selection.$head.parentOffset>0)){var e=t.root.getSelection(),n=e.focusNode,r=e.focusOffset;if(n&&1==n.nodeType&&0==r&&n.firstChild&&"false"==n.firstChild.contentEditable){var o=n.firstChild;It(t,o,!0),setTimeout((function(){return It(t,o,!1)}),20)}}}(t)||Rt(t,1,r)||At(t):r==(s.mac?"m":"c")&&(66==n||73==n||89==n||90==n))}function Pt(t){var e=t.pmViewDesc;if(e)return e.parseRule();if("BR"==t.nodeName&&t.parentNode){if(s.safari&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){var n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}if(t.parentNode.lastChild==t||s.safari&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if("IMG"==t.nodeName&&t.getAttribute("mark-placeholder"))return{ignore:!0}}function $t(t,e,n,i,a){if(e<0){var c=t.lastSelectionTime>Date.now()-50?t.lastSelectionOrigin:null,l=ft(t,c);if(l&&!t.state.selection.eq(l)){var u=t.state.tr.setSelection(l);"pointer"==c?u.setMeta("pointer",!0):"key"==c&&u.scrollIntoView(),t.dispatch(u)}}else{var p=t.state.doc.resolve(e),f=p.sharedDepth(n);e=p.before(f+1),n=t.state.doc.resolve(n).after(f+1);var d=t.state.selection,h=function(t,e,n){var r=t.docView.parseRange(e,n),i=r.node,a=r.fromOffset,c=r.toOffset,l=r.from,u=r.to,p=t.root.getSelection(),f=null,d=p.anchorNode;if(d&&t.dom.contains(1==d.nodeType?d:d.parentNode)&&(f=[{node:d,offset:p.anchorOffset}],S(p)||f.push({node:p.focusNode,offset:p.focusOffset})),s.chrome&&8===t.lastKeyCode)for(var h=c;h>a;h--){var m=i.childNodes[h-1],v=m.pmViewDesc;if("BR"==m.nodeName&&!v){c=h;break}if(!v||v.size)break}var g=t.state.doc,y=t.someProp("domParser")||o.DOMParser.fromSchema(t.state.schema),w=g.resolve(l),b=null,k=y.parse(i,{topNode:w.parent,topMatch:w.parent.contentMatchAt(w.index()),topOpen:!0,from:a,to:c,preserveWhitespace:"pre"!=w.parent.type.whitespace||"full",editableContent:!0,findPositions:f,ruleFromNode:Pt,context:w});if(f&&null!=f[0].pos){var x=f[0].pos,C=f[1]&&f[1].pos;null==C&&(C=x),b={anchor:x+l,head:C+l}}return{doc:k,sel:b,from:l,to:u}}(t,e,n);if(s.chrome&&t.cursorWrapper&&h.sel&&h.sel.anchor==t.cursorWrapper.deco.from){var m=t.cursorWrapper.deco.type.toDOM.nextSibling,v=m&&m.nodeValue?m.nodeValue.length:1;h.sel={anchor:h.sel.anchor+v,head:h.sel.anchor+v}}var g,y,w=t.state.doc,b=w.slice(h.from,h.to);8===t.lastKeyCode&&Date.now()-100<t.lastKeyCodeTime?(g=t.state.selection.to,y="end"):(g=t.state.selection.from,y="start"),t.lastKeyCode=null;var x=function(t,e,n,r,o){var i=t.findDiffStart(e,n);if(null==i)return null;var s=t.findDiffEnd(e,n+t.size,n+e.size),a=s.a,c=s.b;if("end"==o){var l=Math.max(0,i-Math.min(a,c));r-=a+l-i}if(a<i&&t.size<e.size){c=(i-=r<=i&&r>=a?i-r:0)+(c-a),a=i}else if(c<i){a=(i-=r<=i&&r>=c?i-r:0)+(a-c),c=i}return{start:i,endA:a,endB:c}}(b.content,h.doc.content,h.from,g,y);if(!x){if(!(i&&d instanceof r.TextSelection&&!d.empty&&d.$head.sameParent(d.$anchor))||t.composing||h.sel&&h.sel.anchor!=h.sel.head){if((s.ios&&t.lastIOSEnter>Date.now()-225||s.android)&&a.some((function(t){return"DIV"==t.nodeName||"P"==t.nodeName}))&&t.someProp("handleKeyDown",(function(e){return e(t,k(13,"Enter"))})))return void(t.lastIOSEnter=0);if(h.sel){var C=Ft(t,t.state.doc,h.sel);C&&!C.eq(t.state.selection)&&t.dispatch(t.state.tr.setSelection(C))}return}x={start:d.from,endA:d.to,endB:d.to}}t.domChangeCount++,t.state.selection.from<t.state.selection.to&&x.start==x.endB&&t.state.selection instanceof r.TextSelection&&(x.start>t.state.selection.from&&x.start<=t.state.selection.from+2&&t.state.selection.from>=h.from?x.start=t.state.selection.from:x.endA<t.state.selection.to&&x.endA>=t.state.selection.to-2&&t.state.selection.to<=h.to&&(x.endB+=t.state.selection.to-x.endA,x.endA=t.state.selection.to)),s.ie&&s.ie_version<=11&&x.endB==x.start+1&&x.endA==x.start&&x.start>h.from&&" "==h.doc.textBetween(x.start-h.from-1,x.start-h.from+1)&&(x.start--,x.endA--,x.endB--);var M,O=h.doc.resolveNoCache(x.start-h.from),T=h.doc.resolveNoCache(x.endB-h.from),N=O.sameParent(T)&&O.parent.inlineContent;if((s.ios&&t.lastIOSEnter>Date.now()-225&&(!N||a.some((function(t){return"DIV"==t.nodeName||"P"==t.nodeName})))||!N&&O.pos<h.doc.content.size&&(M=r.Selection.findFrom(h.doc.resolve(O.pos+1),1,!0))&&M.head==T.pos)&&t.someProp("handleKeyDown",(function(e){return e(t,k(13,"Enter"))})))t.lastIOSEnter=0;else if(t.state.selection.anchor>x.start&&function(t,e,n,r,o){if(!r.parent.isTextblock||n-e<=o.pos-r.pos||Bt(r,!0,!1)<o.pos)return!1;var i=t.resolve(e);if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;var s=t.resolve(Bt(i,!0,!0));if(!s.parent.isTextblock||s.pos>n||Bt(s,!0,!1)<n)return!1;return r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(w,x.start,x.endA,O,T)&&t.someProp("handleKeyDown",(function(e){return e(t,k(8,"Backspace"))})))s.android&&s.chrome&&t.domObserver.suppressSelectionUpdates();else{s.chrome&&s.android&&x.toB==x.from&&(t.lastAndroidDelete=Date.now()),s.android&&!N&&O.start()!=T.start()&&0==T.parentOffset&&O.depth==T.depth&&h.sel&&h.sel.anchor==h.sel.head&&h.sel.head==x.endA&&(x.endB-=2,T=h.doc.resolveNoCache(x.endB-h.from),setTimeout((function(){t.someProp("handleKeyDown",(function(e){return e(t,k(13,"Enter"))}))}),20));var A,D,E,R,_=x.start,I=x.endA;if(N)if(O.pos==T.pos)s.ie&&s.ie_version<=11&&0==O.parentOffset&&(t.domObserver.suppressSelectionUpdates(),setTimeout((function(){return ht(t)}),20)),A=t.state.tr.delete(_,I),D=w.resolve(x.start).marksAcross(w.resolve(x.endA));else if(x.endA==x.endB&&(R=w.resolve(x.start))&&(E=function(t,e){for(var n,r,i,s=t.firstChild.marks,a=e.firstChild.marks,c=s,l=a,u=0;u<a.length;u++)c=a[u].removeFromSet(c);for(var p=0;p<s.length;p++)l=s[p].removeFromSet(l);if(1==c.length&&0==l.length)r=c[0],n="add",i=function(t){return t.mark(r.addToSet(t.marks))};else{if(0!=c.length||1!=l.length)return null;r=l[0],n="remove",i=function(t){return t.mark(r.removeFromSet(t.marks))}}for(var f=[],d=0;d<e.childCount;d++)f.push(i(e.child(d)));if(o.Fragment.from(f).eq(t))return{mark:r,type:n}}(O.parent.content.cut(O.parentOffset,T.parentOffset),R.parent.content.cut(R.parentOffset,x.endA-R.start()))))A=t.state.tr,"add"==E.type?A.addMark(_,I,E.mark):A.removeMark(_,I,E.mark);else if(O.parent.child(O.index()).isText&&O.index()==T.index()-(T.textOffset?0:1)){var z=O.parent.textBetween(O.parentOffset,T.parentOffset);if(t.someProp("handleTextInput",(function(e){return e(t,_,I,z)})))return;A=t.state.tr.insertText(z,_,I)}if(A||(A=t.state.tr.replace(_,I,h.doc.slice(x.start-h.from,x.endB-h.from))),h.sel){var P=Ft(t,A.doc,h.sel);P&&!(s.chrome&&s.android&&t.composing&&P.empty&&(x.start!=x.endB||t.lastAndroidDelete<Date.now()-100)&&(P.head==_||P.head==A.mapping.map(I)-1)||s.ie&&P.empty&&P.head==_)&&A.setSelection(P)}D&&A.ensureMarks(D),t.dispatch(A.scrollIntoView())}}}function Ft(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:St(t,e.resolve(n.anchor),e.resolve(n.head))}function Bt(t,e,n){for(var r=t.depth,o=e?t.end():t.pos;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,o++,e=!1;if(n)for(var i=t.node(r).maybeChild(t.indexAfter(r));i&&!i.isLeaf;)i=i.firstChild,o++;return o}function Lt(t,e){for(var n=[],r=e.content,i=e.openStart,s=e.openEnd;i>1&&s>1&&1==r.childCount&&1==r.firstChild.childCount;){i--,s--;var a=r.firstChild;n.push(a.type.name,a.attrs!=a.type.defaultAttrs?a.attrs:null),r=a.content}var c=t.someProp("clipboardSerializer")||o.DOMSerializer.fromSchema(t.state.schema),l=Ut(),u=l.createElement("div");u.appendChild(c.serializeFragment(r,{document:l}));for(var p,f=u.firstChild;f&&1==f.nodeType&&(p=Ht[f.nodeName.toLowerCase()]);){for(var d=p.length-1;d>=0;d--){for(var h=l.createElement(p[d]);u.firstChild;)h.appendChild(u.firstChild);u.appendChild(h),"tbody"!=p[d]&&(i++,s++)}f=u.firstChild}return f&&1==f.nodeType&&f.setAttribute("data-pm-slice",i+" "+s+" "+JSON.stringify(n)),{dom:u,text:t.someProp("clipboardTextSerializer",(function(t){return t(e)}))||e.content.textBetween(0,e.content.size,"\n\n")}}function Vt(t,e,n,r,i){var a,c,l=i.parent.type.spec.code;if(!n&&!e)return null;var u=e&&(r||l||!n);if(u){if(t.someProp("transformPastedText",(function(t){e=t(e,l||r)})),l)return e?new o.Slice(o.Fragment.from(t.state.schema.text(e.replace(/\r\n?/g,"\n"))),0,0):o.Slice.empty;var p=t.someProp("clipboardTextParser",(function(t){return t(e,i,r)}));if(p)c=p;else{var f=i.marks(),d=t.state.schema,h=o.DOMSerializer.fromSchema(d);a=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach((function(t){var e=a.appendChild(document.createElement("p"));t&&e.appendChild(h.serializeNode(d.text(t,f)))}))}}else t.someProp("transformPastedHTML",(function(t){n=t(n)})),a=function(t){var e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));var n,r=Ut().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(t);(n=o&&Ht[o[1].toLowerCase()])&&(t=n.map((function(t){return"<"+t+">"})).join("")+t+n.map((function(t){return"</"+t+">"})).reverse().join(""));if(r.innerHTML=t,n)for(var i=0;i<n.length;i++)r=r.querySelector(n[i])||r;return r}(n),s.webkit&&function(t){for(var e=t.querySelectorAll(s.chrome?"span:not([class]):not([style])":"span.Apple-converted-space"),n=0;n<e.length;n++){var r=e[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}(a);var m=a&&a.querySelector("[data-pm-slice]"),v=m&&/^(\d+) (\d+) (.*)/.exec(m.getAttribute("data-pm-slice"));if(!c){var g=t.someProp("clipboardParser")||t.someProp("domParser")||o.DOMParser.fromSchema(t.state.schema);c=g.parseSlice(a,{preserveWhitespace:!(!u&&!v),context:i,ruleFromNode:function(t){if("BR"==t.nodeName&&!t.nextSibling&&t.parentNode&&!jt.test(t.parentNode.nodeName))return{ignore:!0}}})}if(v)c=function(t,e){if(!t.size)return t;var n,r=t.content.firstChild.type.schema;try{n=JSON.parse(e)}catch(e){return t}for(var i=t.content,s=t.openStart,a=t.openEnd,c=n.length-2;c>=0;c-=2){var l=r.nodes[n[c]];if(!l||l.hasRequiredAttrs())break;i=o.Fragment.from(l.create(n[c+1],i)),s++,a++}return new o.Slice(i,s,a)}(qt(c,+v[1],+v[2]),v[3]);else if((c=o.Slice.maxOpen(function(t,e){if(t.childCount<2)return t;for(var n=function(n){var r=e.node(n).contentMatchAt(e.index(n)),i=void 0,s=[];if(t.forEach((function(t){if(s){var e,n=r.findWrapping(t.type);if(!n)return s=null;if(e=s.length&&i.length&&function t(e,n,r,i,s){if(s<e.length&&s<n.length&&e[s]==n[s]){var a=t(e,n,r,i.lastChild,s+1);if(a)return i.copy(i.content.replaceChild(i.childCount-1,a));if(i.contentMatchAt(i.childCount).matchType(s==e.length-1?r.type:e[s+1]))return i.copy(i.content.append(o.Fragment.from(Wt(r,e,s+1))))}}(n,i,t,s[s.length-1],0))s[s.length-1]=e;else{s.length&&(s[s.length-1]=function t(e,n){if(0==n)return e;var r=e.content.replaceChild(e.childCount-1,t(e.lastChild,n-1)),i=e.contentMatchAt(e.childCount).fillBefore(o.Fragment.empty,!0);return e.copy(r.append(i))}(s[s.length-1],i.length));var a=Wt(t,n);s.push(a),r=r.matchType(a.type,a.attrs),i=n}}})),s)return{v:o.Fragment.from(s)}},r=e.depth;r>=0;r--){var i=n(r);if(i)return i.v}return t}(c.content,i),!0)).openStart||c.openEnd){for(var y=0,w=0,b=c.content.firstChild;y<c.openStart&&!b.type.spec.isolating;y++,b=b.firstChild);for(var S=c.content.lastChild;w<c.openEnd&&!S.type.spec.isolating;w++,S=S.lastChild);c=qt(c,y,w)}return t.someProp("transformPasted",(function(t){c=t(c)})),c}var jt=/^(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 Wt(t,e,n){void 0===n&&(n=0);for(var r=e.length-1;r>=n;r--)t=e[r].create(null,o.Fragment.from(t));return t}function Kt(t,e,n,r,i,s){var a=e<0?t.firstChild:t.lastChild,c=a.content;return i<r-1&&(c=Kt(c,e,n,r,i+1,s)),i>=n&&(c=e<0?a.contentMatchAt(0).fillBefore(c,t.childCount>1||s<=i).append(c):c.append(a.contentMatchAt(a.childCount).fillBefore(o.Fragment.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,a.copy(c))}function qt(t,e,n){return e<t.openStart&&(t=new o.Slice(Kt(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new o.Slice(Kt(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}var Ht={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},Jt=null;function Ut(){return Jt||(Jt=document.implementation.createHTMLDocument("title"))}var Gt={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Xt=s.ie&&s.ie_version<=11,Yt=function(){this.anchorNode=this.anchorOffset=this.focusNode=this.focusOffset=null};Yt.prototype.set=function(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset},Yt.prototype.eq=function(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset};var Qt=function(t,e){var n=this;this.view=t,this.handleDOMChange=e,this.queue=[],this.flushingSoon=-1,this.observer=window.MutationObserver&&new window.MutationObserver((function(t){for(var e=0;e<t.length;e++)n.queue.push(t[e]);s.ie&&s.ie_version<=11&&t.some((function(t){return"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length}))?n.flushSoon():n.flush()})),this.currentSelection=new Yt,Xt&&(this.onCharData=function(t){n.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),n.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.suppressingSelectionUpdates=!1};Qt.prototype.flushSoon=function(){var t=this;this.flushingSoon<0&&(this.flushingSoon=window.setTimeout((function(){t.flushingSoon=-1,t.flush()}),20))},Qt.prototype.forceFlush=function(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())},Qt.prototype.start=function(){this.observer&&this.observer.observe(this.view.dom,Gt),Xt&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()},Qt.prototype.stop=function(){var t=this;if(this.observer){var e=this.observer.takeRecords();if(e.length){for(var n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout((function(){return t.flush()}),20)}this.observer.disconnect()}Xt&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()},Qt.prototype.connectSelection=function(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)},Qt.prototype.disconnectSelection=function(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)},Qt.prototype.suppressSelectionUpdates=function(){var t=this;this.suppressingSelectionUpdates=!0,setTimeout((function(){return t.suppressingSelectionUpdates=!1}),50)},Qt.prototype.onSelectionChange=function(){if((!(t=this.view).editable||t.root.activeElement==t.dom)&&kt(t)){var t;if(this.suppressingSelectionUpdates)return ht(this.view);if(s.ie&&s.ie_version<=11&&!this.view.state.selection.empty){var e=this.view.root.getSelection();if(e.focusNode&&v(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}},Qt.prototype.setCurSelection=function(){this.currentSelection.set(this.view.root.getSelection())},Qt.prototype.ignoreSelectionChange=function(t){if(0==t.rangeCount)return!0;var e=t.getRangeAt(0).commonAncestorContainer,n=this.view.docView.nearestDesc(e);return n&&n.ignoreMutation({type:"selection",target:3==e.nodeType?e.parentNode:e})?(this.setCurSelection(),!0):void 0},Qt.prototype.flush=function(){if(this.view.docView&&!(this.flushingSoon>-1)){var t=this.observer?this.observer.takeRecords():[];this.queue.length&&(t=this.queue.concat(t),this.queue.length=0);var e=this.view.root.getSelection(),n=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(e)&&kt(this.view)&&!this.ignoreSelectionChange(e),r=-1,o=-1,i=!1,a=[];if(this.view.editable)for(var c=0;c<t.length;c++){var l=this.registerMutation(t[c],a);l&&(r=r<0?l.from:Math.min(l.from,r),o=o<0?l.to:Math.max(l.to,o),l.typeOver&&(i=!0))}if(s.gecko&&a.length>1){var u=a.filter((function(t){return"BR"==t.nodeName}));if(2==u.length){var p=u[0],f=u[1];p.parentNode&&p.parentNode.parentNode==f.parentNode?f.remove():p.remove()}}(r>-1||n)&&(r>-1&&(this.view.docView.markDirty(r,o),function(t){if(Zt)return;Zt=!0,"normal"==getComputedStyle(t.dom).whiteSpace&&console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package.")}(this.view)),this.handleDOMChange(r,o,i,a),this.view.docView&&this.view.docView.dirty?this.view.updateState(this.view.state):this.currentSelection.eq(e)||ht(this.view),this.currentSelection.set(e))}},Qt.prototype.registerMutation=function(t,e){if(e.indexOf(t.target)>-1)return null;var n=this.view.docView.nearestDesc(t.target);if("attributes"==t.type&&(n==this.view.docView||"contenteditable"==t.attributeName||"style"==t.attributeName&&!t.oldValue&&!t.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(t))return null;if("childList"==t.type){for(var r=0;r<t.addedNodes.length;r++)e.push(t.addedNodes[r]);if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(t.target))return{from:n.posBefore,to:n.posAfter};var o=t.previousSibling,i=t.nextSibling;if(s.ie&&s.ie_version<=11&&t.addedNodes.length)for(var a=0;a<t.addedNodes.length;a++){var c=t.addedNodes[a],l=c.previousSibling,u=c.nextSibling;(!l||Array.prototype.indexOf.call(t.addedNodes,l)<0)&&(o=l),(!u||Array.prototype.indexOf.call(t.addedNodes,u)<0)&&(i=u)}var p=o&&o.parentNode==t.target?f(o)+1:0,d=n.localPosFromDOM(t.target,p,-1),h=i&&i.parentNode==t.target?f(i):t.target.childNodes.length;return{from:d,to:n.localPosFromDOM(t.target,h,1)}}return"attributes"==t.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:{from:n.posAtStart,to:n.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}};var Zt=!1;var te={},ee={};function ne(t,e){t.lastSelectionOrigin=e,t.lastSelectionTime=Date.now()}function re(t){t.someProp("handleDOMEvents",(function(e){for(var n in e)t.eventHandlers[n]||t.dom.addEventListener(n,t.eventHandlers[n]=function(e){return oe(t,e)})}))}function oe(t,e){return t.someProp("handleDOMEvents",(function(n){var r=n[e.type];return!!r&&(r(t,e)||e.defaultPrevented)}))}function ie(t){return{left:t.clientX,top:t.clientY}}function se(t,e,n,r,o){if(-1==r)return!1;for(var i=t.state.doc.resolve(r),s=function(r){if(t.someProp(e,(function(e){return r>i.depth?e(t,n,i.nodeAfter,i.before(r),o,!0):e(t,n,i.node(r),i.before(r),o,!1)})))return{v:!0}},a=i.depth+1;a>0;a--){var c=s(a);if(c)return c.v}return!1}function ae(t,e,n){t.focused||t.focus();var r=t.state.tr.setSelection(e);"pointer"==n&&r.setMeta("pointer",!0),t.dispatch(r)}function ce(t,e,n,o,i){return se(t,"handleClickOn",e,n,o)||t.someProp("handleClick",(function(n){return n(t,e,o)}))||(i?function(t,e){if(-1==e)return!1;var n,o,i=t.state.selection;i instanceof r.NodeSelection&&(n=i.node);for(var s=t.state.doc.resolve(e),a=s.depth+1;a>0;a--){var c=a>s.depth?s.nodeAfter:s.node(a);if(r.NodeSelection.isSelectable(c)){o=n&&i.$from.depth>0&&a>=i.$from.depth&&s.before(i.$from.depth+1)==i.$from.pos?s.before(i.$from.depth):s.before(a);break}}return null!=o&&(ae(t,r.NodeSelection.create(t.state.doc,o),"pointer"),!0)}(t,n):function(t,e){if(-1==e)return!1;var n=t.state.doc.resolve(e),o=n.nodeAfter;return!!(o&&o.isAtom&&r.NodeSelection.isSelectable(o))&&(ae(t,new r.NodeSelection(n),"pointer"),!0)}(t,n))}function le(t,e,n,r){return se(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",(function(n){return n(t,e,r)}))}function ue(t,e,n,o){return se(t,"handleTripleClickOn",e,n,o)||t.someProp("handleTripleClick",(function(n){return n(t,e,o)}))||function(t,e,n){if(0!=n.button)return!1;var o=t.state.doc;if(-1==e)return!!o.inlineContent&&(ae(t,r.TextSelection.create(o,0,o.content.size),"pointer"),!0);for(var i=o.resolve(e),s=i.depth+1;s>0;s--){var a=s>i.depth?i.nodeAfter:i.node(s),c=i.before(s);if(a.inlineContent)ae(t,r.TextSelection.create(o,c+1,c+1+a.content.size),"pointer");else{if(!r.NodeSelection.isSelectable(a))continue;ae(t,r.NodeSelection.create(o,c),"pointer")}return!0}}(t,n,o)}function pe(t){return ye(t)}ee.keydown=function(t,e){if(t.shiftKey=16==e.keyCode||e.shiftKey,!he(t,e)&&(t.lastKeyCode=e.keyCode,t.lastKeyCodeTime=Date.now(),!s.android||!s.chrome||13!=e.keyCode))if(229!=e.keyCode&&t.domObserver.forceFlush(),!s.ios||13!=e.keyCode||e.ctrlKey||e.altKey||e.metaKey)t.someProp("handleKeyDown",(function(n){return n(t,e)}))||zt(t,e)?e.preventDefault():ne(t,"key");else{var n=Date.now();t.lastIOSEnter=n,t.lastIOSEnterFallbackTimeout=setTimeout((function(){t.lastIOSEnter==n&&(t.someProp("handleKeyDown",(function(e){return e(t,k(13,"Enter"))})),t.lastIOSEnter=0)}),200)}},ee.keyup=function(t,e){16==e.keyCode&&(t.shiftKey=!1)},ee.keypress=function(t,e){if(!(he(t,e)||!e.charCode||e.ctrlKey&&!e.altKey||s.mac&&e.metaKey))if(t.someProp("handleKeyPress",(function(n){return n(t,e)})))e.preventDefault();else{var n=t.state.selection;if(!(n instanceof r.TextSelection&&n.$from.sameParent(n.$to))){var o=String.fromCharCode(e.charCode);t.someProp("handleTextInput",(function(e){return e(t,n.$from.pos,n.$to.pos,o)}))||t.dispatch(t.state.tr.insertText(o).scrollIntoView()),e.preventDefault()}}};var fe=s.mac?"metaKey":"ctrlKey";te.mousedown=function(t,e){t.shiftKey=e.shiftKey;var n=pe(t),r=Date.now(),o="singleClick";r-t.lastClick.time<500&&function(t,e){var n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}(e,t.lastClick)&&!e[fe]&&("singleClick"==t.lastClick.type?o="doubleClick":"doubleClick"==t.lastClick.type&&(o="tripleClick")),t.lastClick={time:r,x:e.clientX,y:e.clientY,type:o};var i=t.posAtCoords(ie(e));i&&("singleClick"==o?(t.mouseDown&&t.mouseDown.done(),t.mouseDown=new de(t,i,e,n)):("doubleClick"==o?le:ue)(t,i.pos,i.inside,e)?e.preventDefault():ne(t,"pointer"))};var de=function(t,e,n,o){var i,a,c=this;if(this.view=t,this.startDoc=t.state.doc,this.pos=e,this.event=n,this.flushed=o,this.selectNode=n[fe],this.allowDefault=n.shiftKey,this.delayedSelectionSync=!1,e.inside>-1)i=t.state.doc.nodeAt(e.inside),a=e.inside;else{var l=t.state.doc.resolve(e.pos);i=l.parent,a=l.depth?l.before():0}this.mightDrag=null;var u=o?null:n.target,p=u?t.docView.nearestDesc(u,!0):null;this.target=p?p.dom:null;var f=t.state.selection;(0==n.button&&i.type.spec.draggable&&!1!==i.type.spec.selectable||f instanceof r.NodeSelection&&f.from<=a&&f.to>a)&&(this.mightDrag={node:i,pos:a,addAttr:this.target&&!this.target.draggable,setUneditable:this.target&&s.gecko&&!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((function(){c.view.mouseDown==c&&c.target.setAttribute("contentEditable","false")}),20),this.view.domObserver.start()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),ne(t,"pointer")};function he(t,e){return!!t.composing||!!(s.safari&&Math.abs(e.timeStamp-t.compositionEndedAt)<500)&&(t.compositionEndedAt=-2e8,!0)}de.prototype.done=function(){var t=this;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((function(){return ht(t.view)})),this.view.mouseDown=null},de.prototype.up=function(t){if(this.done(),this.view.dom.contains(3==t.target.nodeType?t.target.parentNode:t.target)){var e=this.pos;this.view.state.doc!=this.startDoc&&(e=this.view.posAtCoords(ie(t))),this.allowDefault||!e?ne(this.view,"pointer"):ce(this.view,e.pos,e.inside,t,this.selectNode)?t.preventDefault():0==t.button&&(this.flushed||s.safari&&this.mightDrag&&!this.mightDrag.node.isAtom||s.chrome&&!(this.view.state.selection instanceof r.TextSelection)&&Math.min(Math.abs(e.pos-this.view.state.selection.from),Math.abs(e.pos-this.view.state.selection.to))<=2)?(ae(this.view,r.Selection.near(this.view.state.doc.resolve(e.pos)),"pointer"),t.preventDefault()):ne(this.view,"pointer")}},de.prototype.move=function(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0),ne(this.view,"pointer"),0==t.buttons&&this.done()},te.touchdown=function(t){pe(t),ne(t,"pointer")},te.contextmenu=function(t){return pe(t)};var me=s.android?5e3:-1;function ve(t,e){clearTimeout(t.composingTimeout),e>-1&&(t.composingTimeout=setTimeout((function(){return ye(t)}),e))}function ge(t){var e;for(t.composing&&(t.composing=!1,t.compositionEndedAt=((e=document.createEvent("Event")).initEvent("event",!0,!0),e.timeStamp));t.compositionNodes.length>0;)t.compositionNodes.pop().markParentsDirty()}function ye(t,e){if(!(s.android&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),ge(t),e||t.docView&&t.docView.dirty){var n=ft(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):t.updateState(t.state),!0}return!1}}ee.compositionstart=ee.compositionupdate=function(t){if(!t.composing){t.domObserver.flush();var e=t.state,n=e.selection.$from;if(e.selection.empty&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some((function(t){return!1===t.type.spec.inclusive}))))t.markCursor=t.state.storedMarks||n.marks(),ye(t,!0),t.markCursor=null;else if(ye(t),s.gecko&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length)for(var r=t.root.getSelection(),o=r.focusNode,i=r.focusOffset;o&&1==o.nodeType&&0!=i;){var a=i<0?o.lastChild:o.childNodes[i-1];if(!a)break;if(3==a.nodeType){r.collapse(a,a.nodeValue.length);break}o=a,i=-1}t.composing=!0}ve(t,me)},ee.compositionend=function(t,e){t.composing&&(t.composing=!1,t.compositionEndedAt=e.timeStamp,ve(t,20))};var we=s.ie&&s.ie_version<15||s.ios&&s.webkit_version<604;function be(t,e,n,r){var i=Vt(t,e,n,t.shiftKey,t.state.selection.$from);if(t.someProp("handlePaste",(function(e){return e(t,r,i||o.Slice.empty)})))return!0;if(!i)return!1;var s=function(t){return 0==t.openStart&&0==t.openEnd&&1==t.content.childCount?t.content.firstChild:null}(i),a=s?t.state.tr.replaceSelectionWith(s,t.shiftKey):t.state.tr.replaceSelection(i);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}te.copy=ee.cut=function(t,e){var n=t.state.selection,r="cut"==e.type;if(!n.empty){var o=we?null:e.clipboardData,i=Lt(t,n.content()),s=i.dom,a=i.text;o?(e.preventDefault(),o.clearData(),o.setData("text/html",s.innerHTML),o.setData("text/plain",a)):function(t,e){if(t.dom.parentNode){var n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";var r=getSelection(),o=document.createRange();o.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout((function(){n.parentNode&&n.parentNode.removeChild(n),t.focus()}),50)}}(t,s),r&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))}},ee.paste=function(t,e){if(!t.composing||s.android){var n=we?null:e.clipboardData;n&&be(t,n.getData("text/plain"),n.getData("text/html"),e)?e.preventDefault():function(t,e){if(t.dom.parentNode){var n=t.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus(),setTimeout((function(){t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?be(t,r.value,null,e):be(t,r.textContent,r.innerHTML,e)}),50)}}(t,e)}};var Se=function(t,e){this.slice=t,this.move=e},ke=s.mac?"altKey":"ctrlKey";for(var xe in te.dragstart=function(t,e){var n=t.mouseDown;if(n&&n.done(),e.dataTransfer){var o=t.state.selection,i=o.empty?null:t.posAtCoords(ie(e));if(i&&i.pos>=o.from&&i.pos<=(o instanceof r.NodeSelection?o.to-1:o.to));else if(n&&n.mightDrag)t.dispatch(t.state.tr.setSelection(r.NodeSelection.create(t.state.doc,n.mightDrag.pos)));else if(e.target&&1==e.target.nodeType){var s=t.docView.nearestDesc(e.target,!0);s&&s.node.type.spec.draggable&&s!=t.docView&&t.dispatch(t.state.tr.setSelection(r.NodeSelection.create(t.state.doc,s.posBefore)))}var a=t.state.selection.content(),c=Lt(t,a),l=c.dom,u=c.text;e.dataTransfer.clearData(),e.dataTransfer.setData(we?"Text":"text/html",l.innerHTML),e.dataTransfer.effectAllowed="copyMove",we||e.dataTransfer.setData("text/plain",u),t.dragging=new Se(a,!e[ke])}},te.dragend=function(t){var e=t.dragging;window.setTimeout((function(){t.dragging==e&&(t.dragging=null)}),50)},ee.dragover=ee.dragenter=function(t,e){return e.preventDefault()},ee.drop=function(t,e){var n=t.dragging;if(t.dragging=null,e.dataTransfer){var s=t.posAtCoords(ie(e));if(s){var a=t.state.doc.resolve(s.pos);if(a){var c=n&&n.slice;c?t.someProp("transformPasted",(function(t){c=t(c)})):c=Vt(t,e.dataTransfer.getData(we?"Text":"text/plain"),we?null:e.dataTransfer.getData("text/html"),!1,a);var l=n&&!e[ke];if(t.someProp("handleDrop",(function(n){return n(t,e,c||o.Slice.empty,l)})))e.preventDefault();else if(c){e.preventDefault();var u=c?Object(i.dropPoint)(t.state.doc,a.pos,c):a.pos;null==u&&(u=a.pos);var p=t.state.tr;l&&p.deleteSelection();var f=p.mapping.map(u),d=0==c.openStart&&0==c.openEnd&&1==c.content.childCount,h=p.doc;if(d?p.replaceRangeWith(f,f,c.content.firstChild):p.replaceRange(f,f,c),!p.doc.eq(h)){var m=p.doc.resolve(f);if(d&&r.NodeSelection.isSelectable(c.content.firstChild)&&m.nodeAfter&&m.nodeAfter.sameMarkup(c.content.firstChild))p.setSelection(new r.NodeSelection(m));else{var v=p.mapping.map(u);p.mapping.maps[p.mapping.maps.length-1].forEach((function(t,e,n,r){return v=r})),p.setSelection(St(t,m,p.doc.resolve(v)))}t.focus(),t.dispatch(p.setMeta("uiEvent","drop"))}}}}}},te.focus=function(t){t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout((function(){t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.root.getSelection())&&ht(t)}),20))},te.blur=function(t,e){t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),e.relatedTarget&&t.dom.contains(e.relatedTarget)&&t.domObserver.currentSelection.set({}),t.focused=!1)},te.beforeinput=function(t,e){if(s.chrome&&s.android&&"deleteContentBackward"==e.inputType){t.domObserver.flushSoon();var n=t.domChangeCount;setTimeout((function(){if(t.domChangeCount==n&&(t.dom.blur(),t.focus(),!t.someProp("handleKeyDown",(function(e){return e(t,k(8,"Backspace"))})))){var e=t.state.selection.$cursor;e&&e.pos>0&&t.dispatch(t.state.tr.delete(e.pos-1,e.pos).scrollIntoView())}}),50)}},ee)te[xe]=ee[xe];function Ce(t,e){if(t==e)return!0;for(var n in t)if(t[n]!==e[n])return!1;for(var r in e)if(!(r in t))return!1;return!0}var Me=function(t,e){this.spec=e||Ee,this.side=this.spec.side||0,this.toDOM=t};Me.prototype.map=function(t,e,n,r){var o=t.mapResult(e.from+r,this.side<0?-1:1),i=o.pos;return o.deleted?null:new Ne(i-n,i-n,this)},Me.prototype.valid=function(){return!0},Me.prototype.eq=function(t){return this==t||t instanceof Me&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&Ce(this.spec,t.spec))},Me.prototype.destroy=function(t){this.spec.destroy&&this.spec.destroy(t)};var Oe=function(t,e){this.spec=e||Ee,this.attrs=t};Oe.prototype.map=function(t,e,n,r){var o=t.map(e.from+r,this.spec.inclusiveStart?-1:1)-n,i=t.map(e.to+r,this.spec.inclusiveEnd?1:-1)-n;return o>=i?null:new Ne(o,i,this)},Oe.prototype.valid=function(t,e){return e.from<e.to},Oe.prototype.eq=function(t){return this==t||t instanceof Oe&&Ce(this.attrs,t.attrs)&&Ce(this.spec,t.spec)},Oe.is=function(t){return t.type instanceof Oe};var Te=function(t,e){this.spec=e||Ee,this.attrs=t};Te.prototype.map=function(t,e,n,r){var o=t.mapResult(e.from+r,1);if(o.deleted)return null;var i=t.mapResult(e.to+r,-1);return i.deleted||i.pos<=o.pos?null:new Ne(o.pos-n,i.pos-n,this)},Te.prototype.valid=function(t,e){var n,r=t.content.findIndex(e.from),o=r.index,i=r.offset;return i==e.from&&!(n=t.child(o)).isText&&i+n.nodeSize==e.to},Te.prototype.eq=function(t){return this==t||t instanceof Te&&Ce(this.attrs,t.attrs)&&Ce(this.spec,t.spec)};var Ne=function(t,e,n){this.from=t,this.to=e,this.type=n},Ae={spec:{configurable:!0},inline:{configurable:!0}};Ne.prototype.copy=function(t,e){return new Ne(t,e,this.type)},Ne.prototype.eq=function(t,e){return void 0===e&&(e=0),this.type.eq(t.type)&&this.from+e==t.from&&this.to+e==t.to},Ne.prototype.map=function(t,e,n){return this.type.map(t,this,e,n)},Ne.widget=function(t,e,n){return new Ne(t,t,new Me(e,n))},Ne.inline=function(t,e,n,r){return new Ne(t,e,new Oe(n,r))},Ne.node=function(t,e,n,r){return new Ne(t,e,new Te(n,r))},Ae.spec.get=function(){return this.type.spec},Ae.inline.get=function(){return this.type instanceof Oe},Object.defineProperties(Ne.prototype,Ae);var De=[],Ee={},Re=function(t,e){this.local=t&&t.length?t:De,this.children=e&&e.length?e:De};Re.create=function(t,e){return e.length?Fe(e,t,0,Ee):_e},Re.prototype.find=function(t,e,n){var r=[];return this.findInner(null==t?0:t,null==e?1e9:e,r,0,n),r},Re.prototype.findInner=function(t,e,n,r,o){for(var i=0;i<this.local.length;i++){var s=this.local[i];s.from<=e&&s.to>=t&&(!o||o(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(var a=0;a<this.children.length;a+=3)if(this.children[a]<e&&this.children[a+1]>t){var c=this.children[a]+1;this.children[a+2].findInner(t-c,e-c,n,r+c,o)}},Re.prototype.map=function(t,e,n){return this==_e||0==t.maps.length?this:this.mapInner(t,e,0,0,n||Ee)},Re.prototype.mapInner=function(t,e,n,r,o){for(var i,s=0;s<this.local.length;s++){var a=this.local[s].map(t,n,r);a&&a.type.valid(e,a)?(i||(i=[])).push(a):o.onRemove&&o.onRemove(this.local[s].spec)}return this.children.length?function(t,e,n,r,o,i,s){for(var a=t.slice(),c=function(t,e,n,r){for(var s=0;s<a.length;s+=3){var c=a[s+1],l=void 0;if(!(c<0||t>c+i)){var u=a[s]+i;e>=u?a[s+1]=t<=u?-2:-1:n>=o&&(l=r-n-(e-t))&&(a[s]+=l,a[s+1]+=l)}}},l=0;l<n.maps.length;l++)n.maps[l].forEach(c);for(var u=!1,p=0;p<a.length;p+=3)if(a[p+1]<0){if(-2==a[p+1]){u=!0,a[p+1]=-1;continue}var f=n.map(t[p]+i),d=f-o;if(d<0||d>=r.content.size){u=!0;continue}var h=n.map(t[p+1]+i,-1)-o,m=r.content.findIndex(d),v=m.index,g=m.offset,y=r.maybeChild(v);if(y&&g==d&&g+y.nodeSize==h){var w=a[p+2].mapInner(n,y,f+1,t[p]+i+1,s);w!=_e?(a[p]=d,a[p+1]=h,a[p+2]=w):(a[p+1]=-2,u=!0)}else u=!0}if(u){var b=Fe(function(t,e,n,r,o,i,s){function a(t,e){for(var i=0;i<t.local.length;i++){var c=t.local[i].map(r,o,e);c?n.push(c):s.onRemove&&s.onRemove(t.local[i].spec)}for(var l=0;l<t.children.length;l+=3)a(t.children[l+2],t.children[l]+e+1)}for(var c=0;c<t.length;c+=3)-1==t[c+1]&&a(t[c+2],e[c]+i+1);return n}(a,t,e||[],n,o,i,s),r,0,s);e=b.local;for(var S=0;S<a.length;S+=3)a[S+1]<0&&(a.splice(S,3),S-=3);for(var k=0,x=0;k<b.children.length;k+=3){for(var C=b.children[k];x<a.length&&a[x]<C;)x+=3;a.splice(x,0,b.children[k],b.children[k+1],b.children[k+2])}}return new Re(e&&e.sort(Be),a)}(this.children,i,t,e,n,r,o):i?new Re(i.sort(Be)):_e},Re.prototype.add=function(t,e){return e.length?this==_e?Re.create(t,e):this.addInner(t,e,0):this},Re.prototype.addInner=function(t,e,n){var r,o=this,i=0;t.forEach((function(t,s){var a,c=s+n;if(a=Pe(e,t,c)){for(r||(r=o.children.slice());i<r.length&&r[i]<s;)i+=3;r[i]==s?r[i+2]=r[i+2].addInner(t,a,c+1):r.splice(i,0,s,s+t.nodeSize,Fe(a,t,c+1,Ee)),i+=3}}));for(var s=ze(i?$e(e):e,-n),a=0;a<s.length;a++)s[a].type.valid(t,s[a])||s.splice(a--,1);return new Re(s.length?this.local.concat(s).sort(Be):this.local,r||this.children)},Re.prototype.remove=function(t){return 0==t.length||this==_e?this:this.removeInner(t,0)},Re.prototype.removeInner=function(t,e){for(var n=this.children,r=this.local,o=0;o<n.length;o+=3){for(var i=void 0,s=n[o]+e,a=n[o+1]+e,c=0,l=void 0;c<t.length;c++)(l=t[c])&&l.from>s&&l.to<a&&(t[c]=null,(i||(i=[])).push(l));if(i){n==this.children&&(n=this.children.slice());var u=n[o+2].removeInner(i,s+1);u!=_e?n[o+2]=u:(n.splice(o,3),o-=3)}}if(r.length)for(var p=0,f=void 0;p<t.length;p++)if(f=t[p])for(var d=0;d<r.length;d++)r[d].eq(f,e)&&(r==this.local&&(r=this.local.slice()),r.splice(d--,1));return n==this.children&&r==this.local?this:r.length||n.length?new Re(r,n):_e},Re.prototype.forChild=function(t,e){if(this==_e)return this;if(e.isLeaf)return Re.empty;for(var n,r,o=0;o<this.children.length;o+=3)if(this.children[o]>=t){this.children[o]==t&&(n=this.children[o+2]);break}for(var i=t+1,s=i+e.content.size,a=0;a<this.local.length;a++){var c=this.local[a];if(c.from<s&&c.to>i&&c.type instanceof Oe){var l=Math.max(i,c.from)-i,u=Math.min(s,c.to)-i;l<u&&(r||(r=[])).push(c.copy(l,u))}}if(r){var p=new Re(r.sort(Be));return n?new Ie([p,n]):p}return n||_e},Re.prototype.eq=function(t){if(this==t)return!0;if(!(t instanceof Re)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(var e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(var n=0;n<this.children.length;n+=3)if(this.children[n]!=t.children[n]||this.children[n+1]!=t.children[n+1]||!this.children[n+2].eq(t.children[n+2]))return!1;return!0},Re.prototype.locals=function(t){return Le(this.localsInner(t))},Re.prototype.localsInner=function(t){if(this==_e)return De;if(t.inlineContent||!this.local.some(Oe.is))return this.local;for(var e=[],n=0;n<this.local.length;n++)this.local[n].type instanceof Oe||e.push(this.local[n]);return e};var _e=new Re;Re.empty=_e,Re.removeOverlap=Le;var Ie=function(t){this.members=t};function ze(t,e){if(!e||!t.length)return t;for(var n=[],r=0;r<t.length;r++){var o=t[r];n.push(new Ne(o.from+e,o.to+e,o.type))}return n}function Pe(t,e,n){if(e.isLeaf)return null;for(var r=n+e.nodeSize,o=null,i=0,s=void 0;i<t.length;i++)(s=t[i])&&s.from>n&&s.to<r&&((o||(o=[])).push(s),t[i]=null);return o}function $e(t){for(var e=[],n=0;n<t.length;n++)null!=t[n]&&e.push(t[n]);return e}function Fe(t,e,n,r){var o=[],i=!1;e.forEach((function(e,s){var a=Pe(t,e,s+n);if(a){i=!0;var c=Fe(a,e,n+s+1,r);c!=_e&&o.push(s,s+e.nodeSize,c)}}));for(var s=ze(i?$e(t):t,-n).sort(Be),a=0;a<s.length;a++)s[a].type.valid(e,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||o.length?new Re(s,o):_e}function Be(t,e){return t.from-e.from||t.to-e.to}function Le(t){for(var e=t,n=0;n<e.length-1;n++){var r=e[n];if(r.from!=r.to)for(var o=n+1;o<e.length;o++){var i=e[o];if(i.from!=r.from){i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),Ve(e,o,r.copy(i.from,r.to)));break}i.to!=r.to&&(e==t&&(e=t.slice()),e[o]=i.copy(i.from,r.to),Ve(e,o+1,i.copy(r.to,i.to)))}}return e}function Ve(t,e,n){for(;e<t.length&&Be(n,t[e])>0;)e++;t.splice(e,0,n)}function je(t){var e=[];return t.someProp("decorations",(function(n){var r=n(t.state);r&&r!=_e&&e.push(r)})),t.cursorWrapper&&e.push(Re.create(t.state.doc,[t.cursorWrapper.deco])),Ie.from(e)}Ie.prototype.map=function(t,e){var n=this.members.map((function(n){return n.map(t,e,Ee)}));return Ie.from(n)},Ie.prototype.forChild=function(t,e){if(e.isLeaf)return Re.empty;for(var n=[],r=0;r<this.members.length;r++){var o=this.members[r].forChild(t,e);o!=_e&&(o instanceof Ie?n=n.concat(o.members):n.push(o))}return Ie.from(n)},Ie.prototype.eq=function(t){if(!(t instanceof Ie)||t.members.length!=this.members.length)return!1;for(var e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0},Ie.prototype.locals=function(t){for(var e,n=!0,r=0;r<this.members.length;r++){var o=this.members[r].localsInner(t);if(o.length)if(e){n&&(e=e.slice(),n=!1);for(var i=0;i<o.length;i++)e.push(o[i])}else e=o}return e?Le(n?e:e.sort(Be)):De},Ie.from=function(t){switch(t.length){case 0:return _e;case 1:return t[0];default:return new Ie(t)}};var We=function(t,e){this._props=e,this.state=e.state,this.directPlugins=e.plugins||[],this.directPlugins.forEach(Ge),this.dispatch=this.dispatch.bind(this),this._root=null,this.focused=!1,this.trackWrites=null,this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):t.apply?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=Je(this),this.markCursor=null,this.cursorWrapper=null,He(this),this.nodeViews=Ue(this),this.docView=Y(this.state.doc,qe(this),je(this),this.dom,this),this.lastSelectedViewDesc=null,this.dragging=null,function(t){t.shiftKey=!1,t.mouseDown=null,t.lastKeyCode=null,t.lastKeyCodeTime=0,t.lastClick={time:0,x:0,y:0,type:""},t.lastSelectionOrigin=null,t.lastSelectionTime=0,t.lastIOSEnter=0,t.lastIOSEnterFallbackTimeout=null,t.lastAndroidDelete=0,t.composing=!1,t.composingTimeout=null,t.compositionNodes=[],t.compositionEndedAt=-2e8,t.domObserver=new Qt(t,(function(e,n,r,o){return $t(t,e,n,r,o)})),t.domObserver.start(),t.domChangeCount=0,t.eventHandlers=Object.create(null);var e=function(e){var n=te[e];t.dom.addEventListener(e,t.eventHandlers[e]=function(e){!function(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(var n=e.target;n!=t.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}(t,e)||oe(t,e)||!t.editable&&e.type in ee||n(t,e)})};for(var n in te)e(n);s.safari&&t.dom.addEventListener("input",(function(){return null})),re(t)}(this),this.prevDirectPlugins=[],this.pluginViews=[],this.updatePluginViews()},Ke={props:{configurable:!0},root:{configurable:!0},isDestroyed:{configurable:!0}};function qe(t){var e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),e.translate="no",t.someProp("attributes",(function(n){if("function"==typeof n&&(n=n(t.state)),n)for(var r in n)"class"==r&&(e.class+=" "+n[r]),"style"==r?e.style=(e.style?e.style+";":"")+n[r]:e[r]||"contenteditable"==r||"nodeName"==r||(e[r]=String(n[r]))})),[Ne.node(0,t.state.doc.content.size,e)]}function He(t){if(t.markCursor){var e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Ne.widget(t.state.selection.head,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Je(t){return!t.someProp("editable",(function(e){return!1===e(t.state)}))}function Ue(t){var e={};return t.someProp("nodeViews",(function(t){for(var n in t)Object.prototype.hasOwnProperty.call(e,n)||(e[n]=t[n])})),e}function Ge(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}Ke.props.get=function(){if(this._props.state!=this.state){var t=this._props;for(var e in this._props={},t)this._props[e]=t[e];this._props.state=this.state}return this._props},We.prototype.update=function(t){t.handleDOMEvents!=this._props.handleDOMEvents&&re(this),this._props=t,t.plugins&&(t.plugins.forEach(Ge),this.directPlugins=t.plugins),this.updateStateInner(t.state,!0)},We.prototype.setProps=function(t){var e={};for(var n in this._props)e[n]=this._props[n];for(var r in e.state=this.state,t)e[r]=t[r];this.update(e)},We.prototype.updateState=function(t){this.updateStateInner(t,this.state.plugins!=t.plugins)},We.prototype.updateStateInner=function(t,e){var n=this,o=this.state,i=!1,a=!1;if(t.storedMarks&&this.composing&&(ge(this),a=!0),this.state=t,e){var c=Ue(this);(function(t,e){var n=0,r=0;for(var o in t){if(t[o]!=e[o])return!0;n++}for(var i in e)r++;return n!=r})(c,this.nodeViews)&&(this.nodeViews=c,i=!0),re(this)}this.editable=Je(this),He(this);var l=je(this),u=qe(this),p=e?"reset":t.scrollToSelection>o.scrollToSelection?"to selection":"preserve",f=i||!this.docView.matchesNode(t.doc,u,l);!f&&t.selection.eq(o.selection)||(a=!0);var d,h,m,g,y,w,b,S,k,x,C,M="preserve"==p&&a&&null==this.dom.style.overflowAnchor&&function(t){for(var e,n,r=t.dom.getBoundingClientRect(),o=Math.max(0,r.top),i=(r.left+r.right)/2,s=o+1;s<Math.min(innerHeight,r.bottom);s+=5){var a=t.root.elementFromPoint(i,s);if(a!=t.dom&&t.dom.contains(a)){var c=a.getBoundingClientRect();if(c.top>=o-20){e=a,n=c.top;break}}}return{refDOM:e,refTop:n,stack:T(t.dom)}}(this);if(a){this.domObserver.stop();var A=f&&(s.ie||s.chrome)&&!this.composing&&!o.selection.empty&&!t.selection.empty&&(g=o.selection,y=t.selection,w=Math.min(g.$anchor.sharedDepth(g.head),y.$anchor.sharedDepth(y.head)),g.$anchor.start(w)!=y.$anchor.start(w));if(f){var D=s.chrome?this.trackWrites=this.root.getSelection().focusNode:null;!i&&this.docView.update(t.doc,u,l,this)||(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=Y(t.doc,u,l,this.dom,this)),D&&!this.trackWrites&&(A=!0)}A||!(this.mouseDown&&this.domObserver.currentSelection.eq(this.root.getSelection())&&(d=this,h=d.docView.domFromPos(d.state.selection.anchor,0),m=d.root.getSelection(),v(h.node,h.offset,m.anchorNode,m.anchorOffset)))?ht(this,A):(wt(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}if(this.updatePluginViews(o),"reset"==p)this.dom.scrollTop=0;else if("to selection"==p){var E=this.root.getSelection().focusNode;this.someProp("handleScrollToSelection",(function(t){return t(n)}))||(t.selection instanceof r.NodeSelection?O(this,this.docView.domAfterPos(t.selection.from).getBoundingClientRect(),E):O(this,this.coordsAtPos(t.selection.head,1),E))}else M&&(S=(b=M).refDOM,k=b.refTop,x=b.stack,C=S?S.getBoundingClientRect().top:0,N(x,0==C?0:C-k))},We.prototype.destroyPluginViews=function(){for(var t;t=this.pluginViews.pop();)t.destroy&&t.destroy()},We.prototype.updatePluginViews=function(t){if(t&&t.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(var e=0;e<this.pluginViews.length;e++){var n=this.pluginViews[e];n.update&&n.update(this,t)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(var r=0;r<this.directPlugins.length;r++){var o=this.directPlugins[r];o.spec.view&&this.pluginViews.push(o.spec.view(this))}for(var i=0;i<this.state.plugins.length;i++){var s=this.state.plugins[i];s.spec.view&&this.pluginViews.push(s.spec.view(this))}}},We.prototype.someProp=function(t,e){var n,r=this._props&&this._props[t];if(null!=r&&(n=e?e(r):r))return n;for(var o=0;o<this.directPlugins.length;o++){var i=this.directPlugins[o].props[t];if(null!=i&&(n=e?e(i):i))return n}var s=this.state.plugins;if(s)for(var a=0;a<s.length;a++){var c=s[a].props[t];if(null!=c&&(n=e?e(c):c))return n}},We.prototype.hasFocus=function(){return this.root.activeElement==this.dom},We.prototype.focus=function(){this.domObserver.stop(),this.editable&&function(t){if(t.setActive)return t.setActive();if(A)return t.focus(A);var e=T(t);t.focus(null==A?{get preventScroll(){return A={preventScroll:!0},!0}}:void 0),A||(A=!1,N(e,0))}(this.dom),ht(this),this.domObserver.start()},Ke.root.get=function(){var t=this._root;if(null==t)for(var e=this.dom.parentNode;e;e=e.parentNode)if(9==e.nodeType||11==e.nodeType&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=function(){return document.getSelection()}),this._root=e;return t||document},We.prototype.posAtCoords=function(t){return R(this,t)},We.prototype.coordsAtPos=function(t,e){return void 0===e&&(e=1),z(this,t,e)},We.prototype.domAtPos=function(t,e){return void 0===e&&(e=0),this.docView.domFromPos(t,e)},We.prototype.nodeDOM=function(t){var e=this.docView.descAt(t);return e?e.nodeDOM:null},We.prototype.posAtDOM=function(t,e,n){void 0===n&&(n=-1);var r=this.docView.posFromDOM(t,e,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r},We.prototype.endOfTextblock=function(t,e){return W(this,e||this.state,t)},We.prototype.destroy=function(){this.docView&&(!function(t){for(var e in t.domObserver.stop(),t.eventHandlers)t.dom.removeEventListener(e,t.eventHandlers[e]);clearTimeout(t.composingTimeout),clearTimeout(t.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],je(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)},Ke.isDestroyed.get=function(){return null==this.docView},We.prototype.dispatchEvent=function(t){return function(t,e){oe(t,e)||!te[e.type]||!t.editable&&e.type in ee||te[e.type](t,e)}(this,t)},We.prototype.dispatch=function(t){var e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))},Object.defineProperties(We.prototype,Ke)},function(t,e,n){"use strict";n.r(e),n.d(e,"__extends",(function(){return o})),n.d(e,"__assign",(function(){return i})),n.d(e,"__rest",(function(){return s})),n.d(e,"__decorate",(function(){return a})),n.d(e,"__param",(function(){return c})),n.d(e,"__metadata",(function(){return l})),n.d(e,"__awaiter",(function(){return u})),n.d(e,"__generator",(function(){return p})),n.d(e,"__createBinding",(function(){return f})),n.d(e,"__exportStar",(function(){return d})),n.d(e,"__values",(function(){return h})),n.d(e,"__read",(function(){return m})),n.d(e,"__spread",(function(){return v})),n.d(e,"__spreadArrays",(function(){return g})),n.d(e,"__await",(function(){return y})),n.d(e,"__asyncGenerator",(function(){return w})),n.d(e,"__asyncDelegator",(function(){return b})),n.d(e,"__asyncValues",(function(){return S})),n.d(e,"__makeTemplateObject",(function(){return k})),n.d(e,"__importStar",(function(){return x})),n.d(e,"__importDefault",(function(){return C})),n.d(e,"__classPrivateFieldGet",(function(){return M})),n.d(e,"__classPrivateFieldSet",(function(){return O}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.KendoEditorCommon=t():e.KendoEditorCommon=t()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=25)}([function(e,t,n){"use strict";function r(e){this.content=e}n.r(t),n.d(t,"ContentMatch",(function(){return _})),n.d(t,"DOMParser",(function(){return ee})),n.d(t,"DOMSerializer",(function(){return de})),n.d(t,"Fragment",(function(){return i})),n.d(t,"Mark",(function(){return u})),n.d(t,"MarkType",(function(){return G})),n.d(t,"Node",(function(){return N})),n.d(t,"NodeRange",(function(){return O})),n.d(t,"NodeType",(function(){return J})),n.d(t,"ReplaceError",(function(){return d})),n.d(t,"ResolvedPos",(function(){return S})),n.d(t,"Schema",(function(){return Q})),n.d(t,"Slice",(function(){return p})),r.prototype={constructor:r,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return-1==t?void 0:this.content[t+1]},update:function(e,t,n){var o=n&&n!=e?this.remove(n):this,i=o.find(e),s=o.content.slice();return-1==i?s.push(n||e,t):(s[i+1]=t,n&&(s[i]=n)),new r(s)},remove:function(e){var t=this.find(e);if(-1==t)return this;var n=this.content.slice();return n.splice(t,2),new r(n)},addToStart:function(e,t){return new r([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new r(n)},addBefore:function(e,t,n){var o=this.remove(t),i=o.content.slice(),s=o.find(e);return i.splice(-1==s?i.length:s,0,t,n),new r(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return(e=r.from(e)).size?new r(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=r.from(e)).size?new r(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=r.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},get size(){return this.content.length>>1}},r.from=function(e){if(e instanceof r)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new r(t)};var o=r;var i=function(e,t){if(this.content=e,this.size=t||0,null==t)for(var n=0;n<e.length;n++)this.size+=e[n].nodeSize},s={firstChild:{configurable:!0},lastChild:{configurable:!0},childCount:{configurable:!0}};i.prototype.nodesBetween=function(e,t,n,r,o){void 0===r&&(r=0);for(var i=0,s=0;s<t;i++){var a=this.content[i],l=s+a.nodeSize;if(l>e&&!1!==n(a,r+s,o,i)&&a.content.size){var c=s+1;a.nodesBetween(Math.max(0,e-c),Math.min(a.content.size,t-c),n,r+c)}s=l}},i.prototype.descendants=function(e){this.nodesBetween(0,this.size,e)},i.prototype.textBetween=function(e,t,n,r){var o="",i=!0;return this.nodesBetween(e,t,(function(s,a){s.isText?(o+=s.text.slice(Math.max(e,a)-a,t-a),i=!n):s.isLeaf&&r?(o+="function"==typeof r?r(s):r,i=!n):!i&&s.isBlock&&(o+=n,i=!0)}),0),o},i.prototype.append=function(e){if(!e.size)return this;if(!this.size)return e;var t=this.lastChild,n=e.firstChild,r=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(n)&&(r[r.length-1]=t.withText(t.text+n.text),o=1);o<e.content.length;o++)r.push(e.content[o]);return new i(r,this.size+e.size)},i.prototype.cut=function(e,t){if(null==t&&(t=this.size),0==e&&t==this.size)return this;var n=[],r=0;if(t>e)for(var o=0,s=0;s<t;o++){var a=this.content[o],l=s+a.nodeSize;l>e&&((s<e||l>t)&&(a=a.isText?a.cut(Math.max(0,e-s),Math.min(a.text.length,t-s)):a.cut(Math.max(0,e-s-1),Math.min(a.content.size,t-s-1))),n.push(a),r+=a.nodeSize),s=l}return new i(n,r)},i.prototype.cutByIndex=function(e,t){return e==t?i.empty:0==e&&t==this.content.length?this:new i(this.content.slice(e,t))},i.prototype.replaceChild=function(e,t){var n=this.content[e];if(n==t)return this;var r=this.content.slice(),o=this.size+t.nodeSize-n.nodeSize;return r[e]=t,new i(r,o)},i.prototype.addToStart=function(e){return new i([e].concat(this.content),this.size+e.nodeSize)},i.prototype.addToEnd=function(e){return new i(this.content.concat(e),this.size+e.nodeSize)},i.prototype.eq=function(e){if(this.content.length!=e.content.length)return!1;for(var t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0},s.firstChild.get=function(){return this.content.length?this.content[0]:null},s.lastChild.get=function(){return this.content.length?this.content[this.content.length-1]:null},s.childCount.get=function(){return this.content.length},i.prototype.child=function(e){var t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t},i.prototype.maybeChild=function(e){return this.content[e]},i.prototype.forEach=function(e){for(var t=0,n=0;t<this.content.length;t++){var r=this.content[t];e(r,n,t),n+=r.nodeSize}},i.prototype.findDiffStart=function(e,t){return void 0===t&&(t=0),function e(t,n,r){for(var o=0;;o++){if(o==t.childCount||o==n.childCount)return t.childCount==n.childCount?null:r;var i=t.child(o),s=n.child(o);if(i!=s){if(!i.sameMarkup(s))return r;if(i.isText&&i.text!=s.text){for(var a=0;i.text[a]==s.text[a];a++)r++;return r}if(i.content.size||s.content.size){var l=e(i.content,s.content,r+1);if(null!=l)return l}r+=i.nodeSize}else r+=i.nodeSize}}(this,e,t)},i.prototype.findDiffEnd=function(e,t,n){return void 0===t&&(t=this.size),void 0===n&&(n=e.size),function e(t,n,r,o){for(var i=t.childCount,s=n.childCount;;){if(0==i||0==s)return i==s?null:{a:r,b:o};var a=t.child(--i),l=n.child(--s),c=a.nodeSize;if(a!=l){if(!a.sameMarkup(l))return{a:r,b:o};if(a.isText&&a.text!=l.text){for(var u=0,d=Math.min(a.text.length,l.text.length);u<d&&a.text[a.text.length-u-1]==l.text[l.text.length-u-1];)u++,r--,o--;return{a:r,b:o}}if(a.content.size||l.content.size){var p=e(a.content,l.content,r-1,o-1);if(p)return p}r-=c,o-=c}else r-=c,o-=c}}(this,e,t,n)},i.prototype.findIndex=function(e,t){if(void 0===t&&(t=-1),0==e)return l(0,e);if(e==this.size)return l(this.content.length,e);if(e>this.size||e<0)throw new RangeError("Position "+e+" outside of fragment ("+this+")");for(var n=0,r=0;;n++){var o=r+this.child(n).nodeSize;if(o>=e)return o==e||t>0?l(n+1,o):l(n,r);r=o}},i.prototype.toString=function(){return"<"+this.toStringInner()+">"},i.prototype.toStringInner=function(){return this.content.join(", ")},i.prototype.toJSON=function(){return this.content.length?this.content.map((function(e){return e.toJSON()})):null},i.fromJSON=function(e,t){if(!t)return i.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new i(t.map(e.nodeFromJSON))},i.fromArray=function(e){if(!e.length)return i.empty;for(var t,n=0,r=0;r<e.length;r++){var o=e[r];n+=o.nodeSize,r&&o.isText&&e[r-1].sameMarkup(o)?(t||(t=e.slice(0,r)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new i(t||e,n)},i.from=function(e){if(!e)return i.empty;if(e instanceof i)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new i([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))},Object.defineProperties(i.prototype,s);var a={index:0,offset:0};function l(e,t){return a.index=e,a.offset=t,a}function c(e,t){if(e===t)return!0;if(!e||"object"!=typeof e||!t||"object"!=typeof t)return!1;var n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(var r=0;r<e.length;r++)if(!c(e[r],t[r]))return!1}else{for(var o in e)if(!(o in t)||!c(e[o],t[o]))return!1;for(var i in t)if(!(i in e))return!1}return!0}i.empty=new i([],0);var u=function(e,t){this.type=e,this.attrs=t};function d(e){var t=Error.call(this,e);return t.__proto__=d.prototype,t}u.prototype.addToSet=function(e){for(var t,n=!1,r=0;r<e.length;r++){var o=e[r];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,r));else{if(o.type.excludes(this.type))return e;!n&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(o)}}return t||(t=e.slice()),n||t.push(this),t},u.prototype.removeFromSet=function(e){for(var t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e},u.prototype.isInSet=function(e){for(var t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1},u.prototype.eq=function(e){return this==e||this.type==e.type&&c(this.attrs,e.attrs)},u.prototype.toJSON=function(){var e={type:this.type.name};for(var t in this.attrs){e.attrs=this.attrs;break}return e},u.fromJSON=function(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");var n=e.marks[t.type];if(!n)throw new RangeError("There is no mark type "+t.type+" in this schema");return n.create(t.attrs)},u.sameSet=function(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0},u.setFrom=function(e){if(!e||0==e.length)return u.none;if(e instanceof u)return[e];var t=e.slice();return t.sort((function(e,t){return e.type.rank-t.type.rank})),t},u.none=[],d.prototype=Object.create(Error.prototype),d.prototype.constructor=d,d.prototype.name="ReplaceError";var p=function(e,t,n){this.content=e,this.openStart=t,this.openEnd=n},f={size:{configurable:!0}};function h(e,t,n){if(n.openStart>e.depth)throw new d("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new d("Inconsistent open depths");return function e(t,n,r,o){var s=t.index(o),a=t.node(o);if(s==n.index(o)&&o<t.depth-r.openStart){var l=e(t,n,r,o+1);return a.copy(a.content.replaceChild(s,l))}if(r.content.size){if(r.openStart||r.openEnd||t.depth!=o||n.depth!=o){var c=function(e,t){for(var n=t.depth-e.openStart,r=t.node(n).copy(e.content),o=n-1;o>=0;o--)r=t.node(o).copy(i.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(r,t),u=c.start,d=c.end;return w(a,function e(t,n,r,o,s){var a=t.depth>s&&v(t,n,s+1),l=o.depth>s&&v(r,o,s+1),c=[];y(null,t,s,c),a&&l&&n.index(s)==r.index(s)?(m(a,l),g(w(a,e(t,n,r,o,s+1)),c)):(a&&g(w(a,b(t,n,s+1)),c),y(n,r,s,c),l&&g(w(l,b(r,o,s+1)),c));return y(o,null,s,c),new i(c)}(t,u,d,n,o))}var p=t.parent,f=p.content;return w(p,f.cut(0,t.parentOffset).append(r.content).append(f.cut(n.parentOffset)))}return w(a,b(t,n,o))}(e,t,n,0)}function m(e,t){if(!t.type.compatibleContent(e.type))throw new d("Cannot join "+t.type.name+" onto "+e.type.name)}function v(e,t,n){var r=e.node(n);return m(r,t.node(n)),r}function g(e,t){var n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function y(e,t,n,r){var o=(t||e).node(n),i=0,s=t?t.index(n):o.childCount;e&&(i=e.index(n),e.depth>n?i++:e.textOffset&&(g(e.nodeAfter,r),i++));for(var a=i;a<s;a++)g(o.child(a),r);t&&t.depth==n&&t.textOffset&&g(t.nodeBefore,r)}function w(e,t){if(!e.type.validContent(t))throw new d("Invalid content for node "+e.type.name);return e.copy(t)}function b(e,t,n){var r=[];(y(null,e,n,r),e.depth>n)&&g(w(v(e,t,n+1),b(e,t,n+1)),r);return y(t,null,n,r),new i(r)}f.size.get=function(){return this.content.size-this.openStart-this.openEnd},p.prototype.insertAt=function(e,t){var n=function e(t,n,r,o){var i=t.findIndex(n),s=i.index,a=i.offset,l=t.maybeChild(s);if(a==n||l.isText)return o&&!o.canReplace(s,s,r)?null:t.cut(0,n).append(r).append(t.cut(n));var c=e(l.content,n-a-1,r);return c&&t.replaceChild(s,l.copy(c))}(this.content,e+this.openStart,t,null);return n&&new p(n,this.openStart,this.openEnd)},p.prototype.removeBetween=function(e,t){return new p(function e(t,n,r){var o=t.findIndex(n),i=o.index,s=o.offset,a=t.maybeChild(i),l=t.findIndex(r),c=l.index,u=l.offset;if(s==n||a.isText){if(u!=r&&!t.child(c).isText)throw new RangeError("Removing non-flat range");return t.cut(0,n).append(t.cut(r))}if(i!=c)throw new RangeError("Removing non-flat range");return t.replaceChild(i,a.copy(e(a.content,n-s-1,r-s-1)))}(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)},p.prototype.eq=function(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd},p.prototype.toString=function(){return this.content+"("+this.openStart+","+this.openEnd+")"},p.prototype.toJSON=function(){if(!this.content.size)return null;var e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e},p.fromJSON=function(e,t){if(!t)return p.empty;var n=t.openStart||0,r=t.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw new RangeError("Invalid input for Slice.fromJSON");return new p(i.fromJSON(e,t.content),n,r)},p.maxOpen=function(e,t){void 0===t&&(t=!0);for(var n=0,r=0,o=e.firstChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.firstChild)n++;for(var i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)r++;return new p(e,n,r)},Object.defineProperties(p.prototype,f),p.empty=new p(i.empty,0,0);var S=function(e,t,n){this.pos=e,this.path=t,this.depth=t.length/3-1,this.parentOffset=n},k={parent:{configurable:!0},doc:{configurable:!0},textOffset:{configurable:!0},nodeAfter:{configurable:!0},nodeBefore:{configurable:!0}};S.prototype.resolveDepth=function(e){return null==e?this.depth:e<0?this.depth+e:e},k.parent.get=function(){return this.node(this.depth)},k.doc.get=function(){return this.node(0)},S.prototype.node=function(e){return this.path[3*this.resolveDepth(e)]},S.prototype.index=function(e){return this.path[3*this.resolveDepth(e)+1]},S.prototype.indexAfter=function(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)},S.prototype.start=function(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1},S.prototype.end=function(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size},S.prototype.before=function(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]},S.prototype.after=function(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize},k.textOffset.get=function(){return this.pos-this.path[this.path.length-1]},k.nodeAfter.get=function(){var e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;var n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r},k.nodeBefore.get=function(){var e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)},S.prototype.posAtIndex=function(e,t){t=this.resolveDepth(t);for(var n=this.path[3*t],r=0==t?0:this.path[3*t-1]+1,o=0;o<e;o++)r+=n.child(o).nodeSize;return r},S.prototype.marks=function(){var e=this.parent,t=this.index();if(0==e.content.size)return u.none;if(this.textOffset)return e.child(t).marks;var n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){var o=n;n=r,r=o}for(var i=n.marks,s=0;s<i.length;s++)!1!==i[s].type.spec.inclusive||r&&i[s].isInSet(r.marks)||(i=i[s--].removeFromSet(i));return i},S.prototype.marksAcross=function(e){var t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;for(var n=t.marks,r=e.parent.maybeChild(e.index()),o=0;o<n.length;o++)!1!==n[o].type.spec.inclusive||r&&n[o].isInSet(r.marks)||(n=n[o--].removeFromSet(n));return n},S.prototype.sharedDepth=function(e){for(var t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0},S.prototype.blockRange=function(e,t){if(void 0===e&&(e=this),e.pos<this.pos)return e.blockRange(this);for(var n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new O(this,e,n)},S.prototype.sameParent=function(e){return this.pos-this.parentOffset==e.pos-e.parentOffset},S.prototype.max=function(e){return e.pos>this.pos?e:this},S.prototype.min=function(e){return e.pos<this.pos?e:this},S.prototype.toString=function(){for(var e="",t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset},S.resolve=function(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");for(var n=[],r=0,o=t,i=e;;){var s=i.content.findIndex(o),a=s.index,l=s.offset,c=o-l;if(n.push(i,a,r+l),!c)break;if((i=i.child(a)).isText)break;o=c-1,r+=l+1}return new S(t,n,o)},S.resolveCached=function(e,t){for(var n=0;n<x.length;n++){var r=x[n];if(r.pos==t&&r.doc==e)return r}var o=x[C]=S.resolve(e,t);return C=(C+1)%M,o},Object.defineProperties(S.prototype,k);var x=[],C=0,M=12,O=function(e,t,n){this.$from=e,this.$to=t,this.depth=n},T={start:{configurable:!0},end:{configurable:!0},parent:{configurable:!0},startIndex:{configurable:!0},endIndex:{configurable:!0}};T.start.get=function(){return this.$from.before(this.depth+1)},T.end.get=function(){return this.$to.after(this.depth+1)},T.parent.get=function(){return this.$from.node(this.depth)},T.startIndex.get=function(){return this.$from.index(this.depth)},T.endIndex.get=function(){return this.$to.indexAfter(this.depth)},Object.defineProperties(O.prototype,T);var A=Object.create(null),N=function(e,t,n,r){this.type=e,this.attrs=t,this.content=n||i.empty,this.marks=r||u.none},D={nodeSize:{configurable:!0},childCount:{configurable:!0},textContent:{configurable:!0},firstChild:{configurable:!0},lastChild:{configurable:!0},isBlock:{configurable:!0},isTextblock:{configurable:!0},inlineContent:{configurable:!0},isInline:{configurable:!0},isText:{configurable:!0},isLeaf:{configurable:!0},isAtom:{configurable:!0}};D.nodeSize.get=function(){return this.isLeaf?1:2+this.content.size},D.childCount.get=function(){return this.content.childCount},N.prototype.child=function(e){return this.content.child(e)},N.prototype.maybeChild=function(e){return this.content.maybeChild(e)},N.prototype.forEach=function(e){this.content.forEach(e)},N.prototype.nodesBetween=function(e,t,n,r){void 0===r&&(r=0),this.content.nodesBetween(e,t,n,r,this)},N.prototype.descendants=function(e){this.nodesBetween(0,this.content.size,e)},D.textContent.get=function(){return this.textBetween(0,this.content.size,"")},N.prototype.textBetween=function(e,t,n,r){return this.content.textBetween(e,t,n,r)},D.firstChild.get=function(){return this.content.firstChild},D.lastChild.get=function(){return this.content.lastChild},N.prototype.eq=function(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)},N.prototype.sameMarkup=function(e){return this.hasMarkup(e.type,e.attrs,e.marks)},N.prototype.hasMarkup=function(e,t,n){return this.type==e&&c(this.attrs,t||e.defaultAttrs||A)&&u.sameSet(this.marks,n||u.none)},N.prototype.copy=function(e){return void 0===e&&(e=null),e==this.content?this:new this.constructor(this.type,this.attrs,e,this.marks)},N.prototype.mark=function(e){return e==this.marks?this:new this.constructor(this.type,this.attrs,this.content,e)},N.prototype.cut=function(e,t){return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))},N.prototype.slice=function(e,t,n){if(void 0===t&&(t=this.content.size),void 0===n&&(n=!1),e==t)return p.empty;var r=this.resolve(e),o=this.resolve(t),i=n?0:r.sharedDepth(t),s=r.start(i),a=r.node(i).content.cut(r.pos-s,o.pos-s);return new p(a,r.depth-i,o.depth-i)},N.prototype.replace=function(e,t,n){return h(this.resolve(e),this.resolve(t),n)},N.prototype.nodeAt=function(e){for(var t=this;;){var n=t.content.findIndex(e),r=n.index,o=n.offset;if(!(t=t.maybeChild(r)))return null;if(o==e||t.isText)return t;e-=o+1}},N.prototype.childAfter=function(e){var t=this.content.findIndex(e),n=t.index,r=t.offset;return{node:this.content.maybeChild(n),index:n,offset:r}},N.prototype.childBefore=function(e){if(0==e)return{node:null,index:0,offset:0};var t=this.content.findIndex(e),n=t.index,r=t.offset;if(r<e)return{node:this.content.child(n),index:n,offset:r};var o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}},N.prototype.resolve=function(e){return S.resolveCached(this,e)},N.prototype.resolveNoCache=function(e){return S.resolve(this,e)},N.prototype.rangeHasMark=function(e,t,n){var r=!1;return t>e&&this.nodesBetween(e,t,(function(e){return n.isInSet(e.marks)&&(r=!0),!r})),r},D.isBlock.get=function(){return this.type.isBlock},D.isTextblock.get=function(){return this.type.isTextblock},D.inlineContent.get=function(){return this.type.inlineContent},D.isInline.get=function(){return this.type.isInline},D.isText.get=function(){return this.type.isText},D.isLeaf.get=function(){return this.type.isLeaf},D.isAtom.get=function(){return this.type.isAtom},N.prototype.toString=function(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);var e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),E(this.marks,e)},N.prototype.contentMatchAt=function(e){var t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t},N.prototype.canReplace=function(e,t,n,r,o){void 0===n&&(n=i.empty),void 0===r&&(r=0),void 0===o&&(o=n.childCount);var s=this.contentMatchAt(e).matchFragment(n,r,o),a=s&&s.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(var l=r;l<o;l++)if(!this.type.allowsMarks(n.child(l).marks))return!1;return!0},N.prototype.canReplaceWith=function(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;var o=this.contentMatchAt(e).matchType(n),i=o&&o.matchFragment(this.content,t);return!!i&&i.validEnd},N.prototype.canAppend=function(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)},N.prototype.check=function(){if(!this.type.validContent(this.content))throw new RangeError("Invalid content for node "+this.type.name+": "+this.content.toString().slice(0,50));for(var e=u.none,t=0;t<this.marks.length;t++)e=this.marks[t].addToSet(e);if(!u.sameSet(e,this.marks))throw new RangeError("Invalid collection of marks for node "+this.type.name+": "+this.marks.map((function(e){return e.type.name})));this.content.forEach((function(e){return e.check()}))},N.prototype.toJSON=function(){var e={type:this.type.name};for(var t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map((function(e){return e.toJSON()}))),e},N.fromJSON=function(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");var n=null;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}var r=i.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,r,n)},Object.defineProperties(N.prototype,D);var R=function(e){function t(t,n,r,o){if(e.call(this,t,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={textContent:{configurable:!0},nodeSize:{configurable:!0}};return t.prototype.toString=function(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):E(this.marks,JSON.stringify(this.text))},n.textContent.get=function(){return this.text},t.prototype.textBetween=function(e,t){return this.text.slice(e,t)},n.nodeSize.get=function(){return this.text.length},t.prototype.mark=function(e){return e==this.marks?this:new t(this.type,this.attrs,this.text,e)},t.prototype.withText=function(e){return e==this.text?this:new t(this.type,this.attrs,e,this.marks)},t.prototype.cut=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.text.length),0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))},t.prototype.eq=function(e){return this.sameMarkup(e)&&this.text==e.text},t.prototype.toJSON=function(){var t=e.prototype.toJSON.call(this);return t.text=this.text,t},Object.defineProperties(t.prototype,n),t}(N);function E(e,t){for(var n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}var _=function(e){this.validEnd=e,this.next=[],this.wrapCache=[]},z={inlineContent:{configurable:!0},defaultType:{configurable:!0},edgeCount:{configurable:!0}};_.parse=function(e,t){var n=new I(e,t);if(null==n.next)return _.empty;var r=$(n);n.next&&n.err("Unexpected trailing text");var o=function(e){var t=Object.create(null);return function n(r){var o=[];r.forEach((function(t){e[t].forEach((function(t){var n=t.term,r=t.to;if(n){var i=o.indexOf(n),s=i>-1&&o[i+1];H(e,r).forEach((function(e){s||o.push(n,s=[]),-1==s.indexOf(e)&&s.push(e)}))}}))}));for(var i=t[r.join(",")]=new _(r.indexOf(e.length-1)>-1),s=0;s<o.length;s+=2){var a=o[s+1].sort(j);i.next.push(o[s],t[a.join(",")]||n(a))}return i}(H(e,0))}(function(e){var t=[[]];return o(function e(t,i){if("choice"==t.type)return t.exprs.reduce((function(t,n){return t.concat(e(n,i))}),[]);if("seq"==t.type)for(var s=0;;s++){var a=e(t.exprs[s],i);if(s==t.exprs.length-1)return a;o(a,i=n())}else{if("star"==t.type){var l=n();return r(i,l),o(e(t.expr,l),l),[r(l)]}if("plus"==t.type){var c=n();return o(e(t.expr,i),c),o(e(t.expr,c),c),[r(c)]}if("opt"==t.type)return[r(i)].concat(e(t.expr,i));if("range"==t.type){for(var u=i,d=0;d<t.min;d++){var p=n();o(e(t.expr,u),p),u=p}if(-1==t.max)o(e(t.expr,u),u);else for(var f=t.min;f<t.max;f++){var h=n();r(u,h),o(e(t.expr,u),h),u=h}return[r(u)]}if("name"==t.type)return[r(i,null,t.value)]}}(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){var o={term:r,to:n};return t[e].push(o),o}function o(e,t){e.forEach((function(e){return e.to=t}))}}(r));return function(e,t){for(var n=0,r=[e];n<r.length;n++){for(var o=r[n],i=!o.validEnd,s=[],a=0;a<o.next.length;a+=2){var l=o.next[a],c=o.next[a+1];s.push(l.name),!i||l.isText||l.hasRequiredAttrs()||(i=!1),-1==r.indexOf(c)&&r.push(c)}i&&t.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(o,n),o},_.prototype.matchType=function(e){for(var t=0;t<this.next.length;t+=2)if(this.next[t]==e)return this.next[t+1];return null},_.prototype.matchFragment=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=e.childCount);for(var r=this,o=t;r&&o<n;o++)r=r.matchType(e.child(o).type);return r},z.inlineContent.get=function(){var e=this.next[0];return!!e&&e.isInline},z.defaultType.get=function(){for(var e=0;e<this.next.length;e+=2){var t=this.next[e];if(!t.isText&&!t.hasRequiredAttrs())return t}},_.prototype.compatible=function(e){for(var t=0;t<this.next.length;t+=2)for(var n=0;n<e.next.length;n+=2)if(this.next[t]==e.next[n])return!0;return!1},_.prototype.fillBefore=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=0);var r=[this];return function o(s,a){var l=s.matchFragment(e,n);if(l&&(!t||l.validEnd))return i.from(a.map((function(e){return e.createAndFill()})));for(var c=0;c<s.next.length;c+=2){var u=s.next[c],d=s.next[c+1];if(!u.isText&&!u.hasRequiredAttrs()&&-1==r.indexOf(d)){r.push(d);var p=o(d,a.concat(u));if(p)return p}}}(this,[])},_.prototype.findWrapping=function(e){for(var t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];var n=this.computeWrapping(e);return this.wrapCache.push(e,n),n},_.prototype.computeWrapping=function(e){for(var t=Object.create(null),n=[{match:this,type:null,via:null}];n.length;){var r=n.shift(),o=r.match;if(o.matchType(e)){for(var i=[],s=r;s.type;s=s.via)i.push(s.type);return i.reverse()}for(var a=0;a<o.next.length;a+=2){var l=o.next[a];l.isLeaf||l.hasRequiredAttrs()||l.name in t||r.type&&!o.next[a+1].validEnd||(n.push({match:l.contentMatch,type:l,via:r}),t[l.name]=!0)}}},z.edgeCount.get=function(){return this.next.length>>1},_.prototype.edge=function(e){var t=e<<1;if(t>=this.next.length)throw new RangeError("There's no "+e+"th edge in this content match");return{type:this.next[t],next:this.next[t+1]}},_.prototype.toString=function(){var e=[];return function t(n){e.push(n);for(var r=1;r<n.next.length;r+=2)-1==e.indexOf(n.next[r])&&t(n.next[r])}(this),e.map((function(t,n){for(var r=n+(t.validEnd?"*":" ")+" ",o=0;o<t.next.length;o+=2)r+=(o?", ":"")+t.next[o].name+"->"+e.indexOf(t.next[o+1]);return r})).join("\n")},Object.defineProperties(_.prototype,z),_.empty=new _(!0);var I=function(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()},P={next:{configurable:!0}};function $(e){var t=[];do{t.push(F(e))}while(e.eat("|"));return 1==t.length?t[0]:{type:"choice",exprs:t}}function F(e){var t=[];do{t.push(B(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==t.length?t[0]:{type:"seq",exprs:t}}function B(e){for(var t=function(e){if(e.eat("(")){var t=$(e);return e.eat(")")||e.err("Missing closing paren"),t}if(!/\W/.test(e.next)){var n=function(e,t){var n=e.nodeTypes,r=n[t];if(r)return[r];var o=[];for(var i in n){var s=n[i];s.groups.indexOf(t)>-1&&o.push(s)}0==o.length&&e.err("No node type or group '"+t+"' found");return o}(e,e.next).map((function(t){return null==e.inline?e.inline=t.isInline:e.inline!=t.isInline&&e.err("Mixing inline and block content"),{type:"name",value:t}}));return e.pos++,1==n.length?n[0]:{type:"choice",exprs:n}}e.err("Unexpected token '"+e.next+"'")}(e);;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else{if(!e.eat("{"))break;t=V(e,t)}return t}function L(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");var t=Number(e.next);return e.pos++,t}function V(e,t){var n=L(e),r=n;return e.eat(",")&&(r="}"!=e.next?L(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function j(e,t){return t-e}function H(e,t){var n=[];return function t(r){var o=e[r];if(1==o.length&&!o[0].term)return t(o[0].to);n.push(r);for(var i=0;i<o.length;i++){var s=o[i],a=s.term,l=s.to;a||-1!=n.indexOf(l)||t(l)}}(t),n.sort(j)}function W(e){var t=Object.create(null);for(var n in e){var r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function K(e,t){var n=Object.create(null);for(var r in e){var o=t&&t[r];if(void 0===o){var i=e[r];if(!i.hasDefault)throw new RangeError("No value supplied for attribute "+r);o=i.default}n[r]=o}return n}function q(e){var t=Object.create(null);if(e)for(var n in e)t[n]=new U(e[n]);return t}P.next.get=function(){return this.tokens[this.pos]},I.prototype.eat=function(e){return this.next==e&&(this.pos++||!0)},I.prototype.err=function(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")},Object.defineProperties(I.prototype,P);var J=function(e,t,n){this.name=e,this.schema=t,this.spec=n,this.groups=n.group?n.group.split(" "):[],this.attrs=q(n.attrs),this.defaultAttrs=W(this.attrs),this.contentMatch=null,this.markSet=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==e),this.isText="text"==e},X={isInline:{configurable:!0},isTextblock:{configurable:!0},isLeaf:{configurable:!0},isAtom:{configurable:!0},whitespace:{configurable:!0}};X.isInline.get=function(){return!this.isBlock},X.isTextblock.get=function(){return this.isBlock&&this.inlineContent},X.isLeaf.get=function(){return this.contentMatch==_.empty},X.isAtom.get=function(){return this.isLeaf||this.spec.atom},X.whitespace.get=function(){return this.spec.whitespace||(this.spec.code?"pre":"normal")},J.prototype.hasRequiredAttrs=function(){for(var e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1},J.prototype.compatibleContent=function(e){return this==e||this.contentMatch.compatible(e.contentMatch)},J.prototype.computeAttrs=function(e){return!e&&this.defaultAttrs?this.defaultAttrs:K(this.attrs,e)},J.prototype.create=function(e,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new N(this,this.computeAttrs(e),i.from(t),u.setFrom(n))},J.prototype.createChecked=function(e,t,n){if(t=i.from(t),!this.validContent(t))throw new RangeError("Invalid content for node "+this.name);return new N(this,this.computeAttrs(e),t,u.setFrom(n))},J.prototype.createAndFill=function(e,t,n){if(e=this.computeAttrs(e),(t=i.from(t)).size){var r=this.contentMatch.fillBefore(t);if(!r)return null;t=r.append(t)}var o=this.contentMatch.matchFragment(t).fillBefore(i.empty,!0);return o?new N(this,e,t.append(o),u.setFrom(n)):null},J.prototype.validContent=function(e){var t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(var n=0;n<e.childCount;n++)if(!this.allowsMarks(e.child(n).marks))return!1;return!0},J.prototype.allowsMarkType=function(e){return null==this.markSet||this.markSet.indexOf(e)>-1},J.prototype.allowsMarks=function(e){if(null==this.markSet)return!0;for(var t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0},J.prototype.allowedMarks=function(e){if(null==this.markSet)return e;for(var t,n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:u.empty:e},J.compile=function(e,t){var n=Object.create(null);e.forEach((function(e,r){return n[e]=new J(e,t,r)}));var r=t.spec.topNode||"doc";if(!n[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(var o in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n},Object.defineProperties(J.prototype,X);var U=function(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default},Y={isRequired:{configurable:!0}};Y.isRequired.get=function(){return!this.hasDefault},Object.defineProperties(U.prototype,Y);var G=function(e,t,n,r){this.name=e,this.schema=n,this.spec=r,this.attrs=q(r.attrs),this.rank=t,this.excluded=null;var o=W(this.attrs);this.instance=o&&new u(this,o)};G.prototype.create=function(e){return!e&&this.instance?this.instance:new u(this,K(this.attrs,e))},G.compile=function(e,t){var n=Object.create(null),r=0;return e.forEach((function(e,o){return n[e]=new G(e,r++,t,o)})),n},G.prototype.removeFromSet=function(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e},G.prototype.isInSet=function(e){for(var t=0;t<e.length;t++)if(e[t].type==this)return e[t]},G.prototype.excludes=function(e){return this.excluded.indexOf(e)>-1};var Q=function(e){for(var t in this.spec={},e)this.spec[t]=e[t];this.spec.nodes=o.from(e.nodes),this.spec.marks=o.from(e.marks),this.nodes=J.compile(this.spec.nodes,this),this.marks=G.compile(this.spec.marks,this);var n=Object.create(null);for(var r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");var i=this.nodes[r],s=i.spec.content||"",a=i.spec.marks;i.contentMatch=n[s]||(n[s]=_.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.markSet="_"==a?null:a?Z(this,a.split(" ")):""!=a&&i.inlineContent?null:[]}for(var l in this.marks){var c=this.marks[l],u=c.spec.excludes;c.excluded=null==u?[c]:""==u?[]:Z(this,u.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached=Object.create(null),this.cached.wrappings=Object.create(null)};function Z(e,t){for(var n=[],r=0;r<t.length;r++){var o=t[r],i=e.marks[o],s=i;if(i)n.push(i);else for(var a in e.marks){var l=e.marks[a];("_"==o||l.spec.group&&l.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}Q.prototype.node=function(e,t,n,r){if("string"==typeof e)e=this.nodeType(e);else{if(!(e instanceof J))throw new RangeError("Invalid node type: "+e);if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}return e.createChecked(t,n,r)},Q.prototype.text=function(e,t){var n=this.nodes.text;return new R(n,n.defaultAttrs,e,u.setFrom(t))},Q.prototype.mark=function(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)},Q.prototype.nodeFromJSON=function(e){return N.fromJSON(this,e)},Q.prototype.markFromJSON=function(e){return u.fromJSON(this,e)},Q.prototype.nodeType=function(e){var t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t};var ee=function(e,t){var n=this;this.schema=e,this.rules=t,this.tags=[],this.styles=[],t.forEach((function(e){e.tag?n.tags.push(e):e.style&&n.styles.push(e)})),this.normalizeLists=!this.tags.some((function(t){if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;var n=e.nodes[t.node];return n.contentMatch.matchType(n)}))};ee.prototype.parse=function(e,t){void 0===t&&(t={});var n=new se(this,t,!1);return n.addAll(e,null,t.from,t.to),n.finish()},ee.prototype.parseSlice=function(e,t){void 0===t&&(t={});var n=new se(this,t,!0);return n.addAll(e,null,t.from,t.to),p.maxOpen(n.finish())},ee.prototype.matchTag=function(e,t,n){for(var r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){var o=this.tags[r];if(le(e,o.tag)&&(void 0===o.namespace||e.namespaceURI==o.namespace)&&(!o.context||t.matchesContext(o.context))){if(o.getAttrs){var i=o.getAttrs(e);if(!1===i)continue;o.attrs=i}return o}}},ee.prototype.matchStyle=function(e,t,n,r){for(var o=r?this.styles.indexOf(r)+1:0;o<this.styles.length;o++){var i=this.styles[o];if(!(0!=i.style.indexOf(e)||i.context&&!n.matchesContext(i.context)||i.style.length>e.length&&(61!=i.style.charCodeAt(e.length)||i.style.slice(e.length+1)!=t))){if(i.getAttrs){var s=i.getAttrs(t);if(!1===s)continue;i.attrs=s}return i}}},ee.schemaRules=function(e){var t=[];function n(e){for(var n=null==e.priority?50:e.priority,r=0;r<t.length;r++){var o=t[r];if((null==o.priority?50:o.priority)<n)break}t.splice(r,0,e)}var r=function(t){var r=e.marks[t].spec.parseDOM;r&&r.forEach((function(e){n(e=ce(e)),e.mark=t}))};for(var o in e.marks)r(o);var i;for(var s in e.nodes)i=void 0,(i=e.nodes[s].spec.parseDOM)&&i.forEach((function(e){n(e=ce(e)),e.node=s}));return t},ee.fromSchema=function(e){return e.cached.domParser||(e.cached.domParser=new ee(e,ee.schemaRules(e)))};var te={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},ne={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},re={ol:!0,ul:!0};function oe(e,t,n){return null!=t?(t?1:0)|("full"===t?2:0):e&&"pre"==e.whitespace?3:-5&n}var ie=function(e,t,n,r,o,i,s){this.type=e,this.attrs=t,this.solid=o,this.match=i||(4&s?null:e.contentMatch),this.options=s,this.content=[],this.marks=n,this.activeMarks=u.none,this.pendingMarks=r,this.stashMarks=[]};ie.prototype.findWrapping=function(e){if(!this.match){if(!this.type)return[];var t=this.type.contentMatch.fillBefore(i.from(e));if(!t){var n,r=this.type.contentMatch;return(n=r.findWrapping(e.type))?(this.match=r,n):null}this.match=this.type.contentMatch.matchFragment(t)}return this.match.findWrapping(e.type)},ie.prototype.finish=function(e){if(!(1&this.options)){var t,n=this.content[this.content.length-1];n&&n.isText&&(t=/[ \t\r\n\u000c]+$/.exec(n.text))&&(n.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length)))}var r=i.from(this.content);return!e&&this.match&&(r=r.append(this.match.fillBefore(i.empty,!0))),this.type?this.type.create(this.attrs,r,this.marks):r},ie.prototype.popFromStashMark=function(e){for(var t=this.stashMarks.length-1;t>=0;t--)if(e.eq(this.stashMarks[t]))return this.stashMarks.splice(t,1)[0]},ie.prototype.applyPending=function(e){for(var t=0,n=this.pendingMarks;t<n.length;t++){var r=n[t];(this.type?this.type.allowsMarkType(r.type):ue(r.type,e))&&!r.isInSet(this.activeMarks)&&(this.activeMarks=r.addToSet(this.activeMarks),this.pendingMarks=r.removeFromSet(this.pendingMarks))}},ie.prototype.inlineContext=function(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!te.hasOwnProperty(e.parentNode.nodeName.toLowerCase())};var se=function(e,t,n){this.parser=e,this.options=t,this.isOpen=n;var r,o=t.topNode,i=oe(null,t.preserveWhitespace,0)|(n?4:0);r=o?new ie(o.type,o.attrs,u.none,u.none,!0,t.topMatch||o.type.contentMatch,i):new ie(n?null:e.schema.topNodeType,null,u.none,u.none,!0,null,i),this.nodes=[r],this.open=0,this.find=t.findPositions,this.needsBlock=!1},ae={top:{configurable:!0},currentPos:{configurable:!0}};function le(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function ce(e){var t={};for(var n in e)t[n]=e[n];return t}function ue(e,t){var n=t.schema.nodes,r=function(r){var o=n[r];if(o.allowsMarkType(e)){var i=[],s=function(e){i.push(e);for(var n=0;n<e.edgeCount;n++){var r=e.edge(n),o=r.type,a=r.next;if(o==t)return!0;if(i.indexOf(a)<0&&s(a))return!0}};return s(o.contentMatch)?{v:!0}:void 0}};for(var o in n){var i=r(o);if(i)return i.v}}ae.top.get=function(){return this.nodes[this.open]},se.prototype.addDOM=function(e){if(3==e.nodeType)this.addTextNode(e);else if(1==e.nodeType){var t=e.getAttribute("style"),n=t?this.readStyles(function(e){var t,n=/\s*([\w-]+)\s*:\s*([^;]+)/g,r=[];for(;t=n.exec(e);)r.push(t[1],t[2].trim());return r}(t)):null,r=this.top;if(null!=n)for(var o=0;o<n.length;o++)this.addPendingMark(n[o]);if(this.addElement(e),null!=n)for(var i=0;i<n.length;i++)this.removePendingMark(n[i],r)}},se.prototype.addTextNode=function(e){var t=e.nodeValue,n=this.top;if(2&n.options||n.inlineContext(e)||/[^ \t\r\n\u000c]/.test(t)){if(1&n.options)t=2&n.options?t.replace(/\r\n?/g,"\n"):t.replace(/\r?\n|\r/g," ");else if(t=t.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(t)&&this.open==this.nodes.length-1){var r=n.content[n.content.length-1],o=e.previousSibling;(!r||o&&"BR"==o.nodeName||r.isText&&/[ \t\r\n\u000c]$/.test(r.text))&&(t=t.slice(1))}t&&this.insertNode(this.parser.schema.text(t)),this.findInText(e)}else this.findInside(e)},se.prototype.addElement=function(e,t){var n,r=e.nodeName.toLowerCase();re.hasOwnProperty(r)&&this.parser.normalizeLists&&function(e){for(var t=e.firstChild,n=null;t;t=t.nextSibling){var r=1==t.nodeType?t.nodeName.toLowerCase():null;r&&re.hasOwnProperty(r)&&n?(n.appendChild(t),t=n):"li"==r?n=t:r&&(n=null)}}(e);var o=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(n=this.parser.matchTag(e,this,t));if(o?o.ignore:ne.hasOwnProperty(r))this.findInside(e),this.ignoreFallback(e);else if(!o||o.skip||o.closeParent){o&&o.closeParent?this.open=Math.max(0,this.open-1):o&&o.skip.nodeType&&(e=o.skip);var i,s=this.top,a=this.needsBlock;if(te.hasOwnProperty(r))i=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild)return void this.leafFallback(e);this.addAll(e),i&&this.sync(s),this.needsBlock=a}else this.addElementByRule(e,o,!1===o.consuming?n:null)},se.prototype.leafFallback=function(e){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"))},se.prototype.ignoreFallback=function(e){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"))},se.prototype.readStyles=function(e){var t=u.none;e:for(var n=0;n<e.length;n+=2)for(var r=null;;){var o=this.parser.matchStyle(e[n],e[n+1],this,r);if(!o)continue e;if(o.ignore)return null;if(t=this.parser.schema.marks[o.mark].create(o.attrs).addToSet(t),!1!==o.consuming)break;r=o}return t},se.prototype.addElementByRule=function(e,t,n){var r,o,i,s=this;t.node?(o=this.parser.schema.nodes[t.node]).isLeaf?this.insertNode(o.create(t.attrs))||this.leafFallback(e):r=this.enter(o,t.attrs,t.preserveWhitespace):(i=this.parser.schema.marks[t.mark].create(t.attrs),this.addPendingMark(i));var a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(n)this.addElement(e,n);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach((function(e){return s.insertNode(e)}));else{var l=t.contentElement;"string"==typeof l?l=e.querySelector(l):"function"==typeof l&&(l=l(e)),l||(l=e),this.findAround(e,l,!0),this.addAll(l,r)}r&&(this.sync(a),this.open--),i&&this.removePendingMark(i,a)},se.prototype.addAll=function(e,t,n,r){for(var o=n||0,i=n?e.childNodes[n]:e.firstChild,s=null==r?null:e.childNodes[r];i!=s;i=i.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(i),t&&te.hasOwnProperty(i.nodeName.toLowerCase())&&this.sync(t);this.findAtPoint(e,o)},se.prototype.findPlace=function(e){for(var t,n,r=this.open;r>=0;r--){var o=this.nodes[r],i=o.findWrapping(e);if(i&&(!t||t.length>i.length)&&(t=i,n=o,!i.length))break;if(o.solid)break}if(!t)return!1;this.sync(n);for(var s=0;s<t.length;s++)this.enterInner(t[s],null,!1);return!0},se.prototype.insertNode=function(e){if(e.isInline&&this.needsBlock&&!this.top.type){var t=this.textblockFromContext();t&&this.enterInner(t)}if(this.findPlace(e)){this.closeExtra();var n=this.top;n.applyPending(e.type),n.match&&(n.match=n.match.matchType(e.type));for(var r=n.activeMarks,o=0;o<e.marks.length;o++)n.type&&!n.type.allowsMarkType(e.marks[o].type)||(r=e.marks[o].addToSet(r));return n.content.push(e.mark(r)),!0}return!1},se.prototype.enter=function(e,t,n){var r=this.findPlace(e.create(t));return r&&this.enterInner(e,t,!0,n),r},se.prototype.enterInner=function(e,t,n,r){this.closeExtra();var o=this.top;o.applyPending(e),o.match=o.match&&o.match.matchType(e,t);var i=oe(e,r,o.options);4&o.options&&0==o.content.length&&(i|=4),this.nodes.push(new ie(e,t,o.activeMarks,o.pendingMarks,n,null,i)),this.open++},se.prototype.closeExtra=function(e){var t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}},se.prototype.finish=function(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)},se.prototype.sync=function(e){for(var t=this.open;t>=0;t--)if(this.nodes[t]==e)return void(this.open=t)},ae.currentPos.get=function(){this.closeExtra();for(var e=0,t=this.open;t>=0;t--){for(var n=this.nodes[t].content,r=n.length-1;r>=0;r--)e+=n[r].nodeSize;t&&e++}return e},se.prototype.findAtPoint=function(e,t){if(this.find)for(var n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)},se.prototype.findInside=function(e){if(this.find)for(var t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)},se.prototype.findAround=function(e,t,n){if(e!=t&&this.find)for(var r=0;r<this.find.length;r++){if(null==this.find[r].pos&&1==e.nodeType&&e.contains(this.find[r].node))t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}},se.prototype.findInText=function(e){if(this.find)for(var t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))},se.prototype.matchesContext=function(e){var t=this;if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);var n=e.split("/"),r=this.options.context,o=!(this.isOpen||r&&r.parent.type!=this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=function(e,a){for(;e>=0;e--){var l=n[e];if(""==l){if(e==n.length-1||0==e)continue;for(;a>=i;a--)if(s(e-1,a))return!0;return!1}var c=a>0||0==a&&o?t.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!c||c.name!=l&&-1==c.groups.indexOf(l))return!1;a--}return!0};return s(n.length-1,this.open)},se.prototype.textblockFromContext=function(){var e=this.options.context;if(e)for(var t=e.depth;t>=0;t--){var n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(var r in this.parser.schema.nodes){var o=this.parser.schema.nodes[r];if(o.isTextblock&&o.defaultAttrs)return o}},se.prototype.addPendingMark=function(e){var t=function(e,t){for(var n=0;n<t.length;n++)if(e.eq(t[n]))return t[n]}(e,this.top.pendingMarks);t&&this.top.stashMarks.push(t),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)},se.prototype.removePendingMark=function(e,t){for(var n=this.open;n>=0;n--){var r=this.nodes[n];if(r.pendingMarks.lastIndexOf(e)>-1)r.pendingMarks=e.removeFromSet(r.pendingMarks);else{r.activeMarks=e.removeFromSet(r.activeMarks);var o=r.popFromStashMark(e);o&&r.type&&r.type.allowsMarkType(o.type)&&(r.activeMarks=o.addToSet(r.activeMarks))}if(r==t)break}},Object.defineProperties(se.prototype,ae);var de=function(e,t){this.nodes=e||{},this.marks=t||{}};function pe(e){var t={};for(var n in e){var r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function fe(e){return e.document||window.document}de.prototype.serializeFragment=function(e,t,n){var r=this;void 0===t&&(t={}),n||(n=fe(t).createDocumentFragment());var o=n,i=null;return e.forEach((function(e){if(i||e.marks.length){i||(i=[]);for(var n=0,s=0;n<i.length&&s<e.marks.length;){var a=e.marks[s];if(r.marks[a.type.name]){if(!a.eq(i[n])||!1===a.type.spec.spanning)break;n+=2,s++}else s++}for(;n<i.length;)o=i.pop(),i.pop();for(;s<e.marks.length;){var l=e.marks[s++],c=r.serializeMark(l,e.isInline,t);c&&(i.push(l,o),o.appendChild(c.dom),o=c.contentDOM||c.dom)}}o.appendChild(r.serializeNodeInner(e,t))})),n},de.prototype.serializeNodeInner=function(e,t){void 0===t&&(t={});var n=de.renderSpec(fe(t),this.nodes[e.type.name](e)),r=n.dom,o=n.contentDOM;if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");t.onContent?t.onContent(e,o,t):this.serializeFragment(e.content,t,o)}return r},de.prototype.serializeNode=function(e,t){void 0===t&&(t={});for(var n=this.serializeNodeInner(e,t),r=e.marks.length-1;r>=0;r--){var o=this.serializeMark(e.marks[r],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n},de.prototype.serializeMark=function(e,t,n){void 0===n&&(n={});var r=this.marks[e.type.name];return r&&de.renderSpec(fe(n),r(e,t))},de.renderSpec=function(e,t,n){if(void 0===n&&(n=null),"string"==typeof t)return{dom:e.createTextNode(t)};if(null!=t.nodeType)return{dom:t};if(t.dom&&null!=t.dom.nodeType)return t;var r=t[0],o=r.indexOf(" ");o>0&&(n=r.slice(0,o),r=r.slice(o+1));var i=null,s=n?e.createElementNS(n,r):e.createElement(r),a=t[1],l=1;if(a&&"object"==typeof a&&null==a.nodeType&&!Array.isArray(a))for(var c in l=2,a)if(null!=a[c]){var u=c.indexOf(" ");u>0?s.setAttributeNS(c.slice(0,u),c.slice(u+1),a[c]):s.setAttribute(c,a[c])}for(var d=l;d<t.length;d++){var p=t[d];if(0===p){if(d<t.length-1||d>l)throw new RangeError("Content hole must be the only child of its parent node");return{dom:s,contentDOM:s}}var f=de.renderSpec(e,p,n),h=f.dom,m=f.contentDOM;if(s.appendChild(h),m){if(i)throw new RangeError("Multiple content holes");i=m}}return{dom:s,contentDOM:i}},de.fromSchema=function(e){return e.cached.domSerializer||(e.cached.domSerializer=new de(this.nodesFromSchema(e),this.marksFromSchema(e)))},de.nodesFromSchema=function(e){var t=pe(e.nodes);return t.text||(t.text=function(e){return e.text}),t},de.marksFromSchema=function(e){return pe(e.marks)}},function(e,t,n){"use strict";n.r(t),n.d(t,"AllSelection",(function(){return f})),n.d(t,"EditorState",(function(){return k})),n.d(t,"NodeSelection",(function(){return d})),n.d(t,"Plugin",(function(){return M})),n.d(t,"PluginKey",(function(){return A})),n.d(t,"Selection",(function(){return s})),n.d(t,"SelectionRange",(function(){return l})),n.d(t,"TextSelection",(function(){return c})),n.d(t,"Transaction",(function(){return g}));var r=n(0),o=n(2),i=Object.create(null),s=function(e,t,n){this.ranges=n||[new l(e.min(t),e.max(t))],this.$anchor=e,this.$head=t},a={anchor:{configurable:!0},head:{configurable:!0},from:{configurable:!0},to:{configurable:!0},$from:{configurable:!0},$to:{configurable:!0},empty:{configurable:!0}};a.anchor.get=function(){return this.$anchor.pos},a.head.get=function(){return this.$head.pos},a.from.get=function(){return this.$from.pos},a.to.get=function(){return this.$to.pos},a.$from.get=function(){return this.ranges[0].$from},a.$to.get=function(){return this.ranges[0].$to},a.empty.get=function(){for(var e=this.ranges,t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0},s.prototype.content=function(){return this.$from.node(0).slice(this.from,this.to,!0)},s.prototype.replace=function(e,t){void 0===t&&(t=r.Slice.empty);for(var n=t.content.lastChild,o=null,i=0;i<t.openEnd;i++)o=n,n=n.lastChild;for(var s=e.steps.length,a=this.ranges,l=0;l<a.length;l++){var c=a[l],u=c.$from,d=c.$to,p=e.mapping.slice(s);e.replaceRange(p.map(u.pos),p.map(d.pos),l?r.Slice.empty:t),0==l&&v(e,s,(n?n.isInline:o&&o.isTextblock)?-1:1)}},s.prototype.replaceWith=function(e,t){for(var n=e.steps.length,r=this.ranges,o=0;o<r.length;o++){var i=r[o],s=i.$from,a=i.$to,l=e.mapping.slice(n),c=l.map(s.pos),u=l.map(a.pos);o?e.deleteRange(c,u):(e.replaceRangeWith(c,u,t),v(e,n,t.isInline?-1:1))}},s.findFrom=function(e,t,n){var r=e.parent.inlineContent?new c(e):m(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(var o=e.depth-1;o>=0;o--){var i=t<0?m(e.node(0),e.node(o),e.before(o+1),e.index(o),t,n):m(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,t,n);if(i)return i}},s.near=function(e,t){return void 0===t&&(t=1),this.findFrom(e,t)||this.findFrom(e,-t)||new f(e.node(0))},s.atStart=function(e){return m(e,e,0,0,1)||new f(e)},s.atEnd=function(e){return m(e,e,e.content.size,e.childCount,-1)||new f(e)},s.fromJSON=function(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");var n=i[t.type];if(!n)throw new RangeError("No selection type "+t.type+" defined");return n.fromJSON(e,t)},s.jsonID=function(e,t){if(e in i)throw new RangeError("Duplicate use of selection JSON ID "+e);return i[e]=t,t.prototype.jsonID=e,t},s.prototype.getBookmark=function(){return c.between(this.$anchor,this.$head).getBookmark()},Object.defineProperties(s.prototype,a),s.prototype.visible=!0;var l=function(e,t){this.$from=e,this.$to=t},c=function(e){function t(t,n){void 0===n&&(n=t),e.call(this,t,n)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={$cursor:{configurable:!0}};return n.$cursor.get=function(){return this.$anchor.pos==this.$head.pos?this.$head:null},t.prototype.map=function(n,r){var o=n.resolve(r.map(this.head));if(!o.parent.inlineContent)return e.near(o);var i=n.resolve(r.map(this.anchor));return new t(i.parent.inlineContent?i:o,o)},t.prototype.replace=function(t,n){if(void 0===n&&(n=r.Slice.empty),e.prototype.replace.call(this,t,n),n==r.Slice.empty){var o=this.$from.marksAcross(this.$to);o&&t.ensureMarks(o)}},t.prototype.eq=function(e){return e instanceof t&&e.anchor==this.anchor&&e.head==this.head},t.prototype.getBookmark=function(){return new u(this.anchor,this.head)},t.prototype.toJSON=function(){return{type:"text",anchor:this.anchor,head:this.head}},t.fromJSON=function(e,n){if("number"!=typeof n.anchor||"number"!=typeof n.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new t(e.resolve(n.anchor),e.resolve(n.head))},t.create=function(e,t,n){void 0===n&&(n=t);var r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))},t.between=function(n,r,o){var i=n.pos-r.pos;if(o&&!i||(o=i>=0?1:-1),!r.parent.inlineContent){var s=e.findFrom(r,o,!0)||e.findFrom(r,-o,!0);if(!s)return e.near(r,o);r=s.$head}return n.parent.inlineContent||(0==i||(n=(e.findFrom(n,-o,!0)||e.findFrom(n,o,!0)).$anchor).pos<r.pos!=i<0)&&(n=r),new t(n,r)},Object.defineProperties(t.prototype,n),t}(s);s.jsonID("text",c);var u=function(e,t){this.anchor=e,this.head=t};u.prototype.map=function(e){return new u(e.map(this.anchor),e.map(this.head))},u.prototype.resolve=function(e){return c.between(e.resolve(this.anchor),e.resolve(this.head))};var d=function(e){function t(t){var n=t.nodeAfter,r=t.node(0).resolve(t.pos+n.nodeSize);e.call(this,t,r),this.node=n}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.map=function(n,r){var o=r.mapResult(this.anchor),i=o.deleted,s=o.pos,a=n.resolve(s);return i?e.near(a):new t(a)},t.prototype.content=function(){return new r.Slice(r.Fragment.from(this.node),0,0)},t.prototype.eq=function(e){return e instanceof t&&e.anchor==this.anchor},t.prototype.toJSON=function(){return{type:"node",anchor:this.anchor}},t.prototype.getBookmark=function(){return new p(this.anchor)},t.fromJSON=function(e,n){if("number"!=typeof n.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new t(e.resolve(n.anchor))},t.create=function(e,t){return new this(e.resolve(t))},t.isSelectable=function(e){return!e.isText&&!1!==e.type.spec.selectable},t}(s);d.prototype.visible=!1,s.jsonID("node",d);var p=function(e){this.anchor=e};p.prototype.map=function(e){var t=e.mapResult(this.anchor),n=t.deleted,r=t.pos;return n?new u(r,r):new p(r)},p.prototype.resolve=function(e){var t=e.resolve(this.anchor),n=t.nodeAfter;return n&&d.isSelectable(n)?new d(t):s.near(t)};var f=function(e){function t(t){e.call(this,t.resolve(0),t.resolve(t.content.size))}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.replace=function(t,n){if(void 0===n&&(n=r.Slice.empty),n==r.Slice.empty){t.delete(0,t.doc.content.size);var o=e.atStart(t.doc);o.eq(t.selection)||t.setSelection(o)}else e.prototype.replace.call(this,t,n)},t.prototype.toJSON=function(){return{type:"all"}},t.fromJSON=function(e){return new t(e)},t.prototype.map=function(e){return new t(e)},t.prototype.eq=function(e){return e instanceof t},t.prototype.getBookmark=function(){return h},t}(s);s.jsonID("all",f);var h={map:function(){return this},resolve:function(e){return new f(e)}};function m(e,t,n,r,o,i){if(t.inlineContent)return c.create(e,n);for(var s=r-(o>0?0:1);o>0?s<t.childCount:s>=0;s+=o){var a=t.child(s);if(a.isAtom){if(!i&&d.isSelectable(a))return d.create(e,n-(o<0?a.nodeSize:0))}else{var l=m(e,a,n+o,o<0?a.childCount:0,o,i);if(l)return l}n+=a.nodeSize*o}}function v(e,t,n){var r=e.steps.length-1;if(!(r<t)){var i,a=e.steps[r];if(a instanceof o.ReplaceStep||a instanceof o.ReplaceAroundStep)e.mapping.maps[r].forEach((function(e,t,n,r){null==i&&(i=r)})),e.setSelection(s.near(e.doc.resolve(i),n))}}var g=function(e){function t(t){e.call(this,t.doc),this.time=Date.now(),this.curSelection=t.selection,this.curSelectionFor=0,this.storedMarks=t.storedMarks,this.updated=0,this.meta=Object.create(null)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={selection:{configurable:!0},selectionSet:{configurable:!0},storedMarksSet:{configurable:!0},isGeneric:{configurable:!0},scrolledIntoView:{configurable:!0}};return n.selection.get=function(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection},t.prototype.setSelection=function(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=-3&(1|this.updated),this.storedMarks=null,this},n.selectionSet.get=function(){return(1&this.updated)>0},t.prototype.setStoredMarks=function(e){return this.storedMarks=e,this.updated|=2,this},t.prototype.ensureMarks=function(e){return r.Mark.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this},t.prototype.addStoredMark=function(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))},t.prototype.removeStoredMark=function(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))},n.storedMarksSet.get=function(){return(2&this.updated)>0},t.prototype.addStep=function(t,n){e.prototype.addStep.call(this,t,n),this.updated=-3&this.updated,this.storedMarks=null},t.prototype.setTime=function(e){return this.time=e,this},t.prototype.replaceSelection=function(e){return this.selection.replace(this,e),this},t.prototype.replaceSelectionWith=function(e,t){var n=this.selection;return!1!==t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||r.Mark.none))),n.replaceWith(this,e),this},t.prototype.deleteSelection=function(){return this.selection.replace(this),this},t.prototype.insertText=function(e,t,n){void 0===n&&(n=t);var r=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();if(!e)return this.deleteRange(t,n);var o=this.storedMarks;if(!o){var i=this.doc.resolve(t);o=n==t?i.marks():i.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,o)),this.selection.empty||this.setSelection(s.near(this.selection.$to)),this},t.prototype.setMeta=function(e,t){return this.meta["string"==typeof e?e:e.key]=t,this},t.prototype.getMeta=function(e){return this.meta["string"==typeof e?e:e.key]},n.isGeneric.get=function(){for(var e in this.meta)return!1;return!0},t.prototype.scrollIntoView=function(){return this.updated|=4,this},n.scrolledIntoView.get=function(){return(4&this.updated)>0},Object.defineProperties(t.prototype,n),t}(o.Transform);function y(e,t){return t&&e?e.bind(t):e}var w=function(e,t,n){this.name=e,this.init=y(t.init,n),this.apply=y(t.apply,n)},b=[new w("doc",{init:function(e){return e.doc||e.schema.topNodeType.createAndFill()},apply:function(e){return e.doc}}),new w("selection",{init:function(e,t){return e.selection||s.atStart(t.doc)},apply:function(e){return e.selection}}),new w("storedMarks",{init:function(e){return e.storedMarks||null},apply:function(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new w("scrollToSelection",{init:function(){return 0},apply:function(e,t){return e.scrolledIntoView?t+1:t}})],S=function(e,t){var n=this;this.schema=e,this.fields=b.concat(),this.plugins=[],this.pluginsByKey=Object.create(null),t&&t.forEach((function(e){if(n.pluginsByKey[e.key])throw new RangeError("Adding different instances of a keyed plugin ("+e.key+")");n.plugins.push(e),n.pluginsByKey[e.key]=e,e.spec.state&&n.fields.push(new w(e.key,e.spec.state,e))}))},k=function(e){this.config=e},x={schema:{configurable:!0},plugins:{configurable:!0},tr:{configurable:!0}};x.schema.get=function(){return this.config.schema},x.plugins.get=function(){return this.config.plugins},k.prototype.apply=function(e){return this.applyTransaction(e).state},k.prototype.filterTransaction=function(e,t){void 0===t&&(t=-1);for(var n=0;n<this.config.plugins.length;n++)if(n!=t){var r=this.config.plugins[n];if(r.spec.filterTransaction&&!r.spec.filterTransaction.call(r,e,this))return!1}return!0},k.prototype.applyTransaction=function(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};for(var t=[e],n=this.applyInner(e),r=null;;){for(var o=!1,i=0;i<this.config.plugins.length;i++){var s=this.config.plugins[i];if(s.spec.appendTransaction){var a=r?r[i].n:0,l=r?r[i].state:this,c=a<t.length&&s.spec.appendTransaction.call(s,a?t.slice(a):t,l,n);if(c&&n.filterTransaction(c,i)){if(c.setMeta("appendedTransaction",e),!r){r=[];for(var u=0;u<this.config.plugins.length;u++)r.push(u<i?{state:n,n:t.length}:{state:this,n:0})}t.push(c),n=n.applyInner(c),o=!0}r&&(r[i]={state:n,n:t.length})}}if(!o)return{state:n,transactions:t}}},k.prototype.applyInner=function(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");for(var t=new k(this.config),n=this.config.fields,r=0;r<n.length;r++){var o=n[r];t[o.name]=o.apply(e,this[o.name],this,t)}for(var i=0;i<C.length;i++)C[i](this,e,t);return t},x.tr.get=function(){return new g(this)},k.create=function(e){for(var t=new S(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new k(t),r=0;r<t.fields.length;r++)n[t.fields[r].name]=t.fields[r].init(e,n);return n},k.prototype.reconfigure=function(e){for(var t=new S(this.schema,e.plugins),n=t.fields,r=new k(t),o=0;o<n.length;o++){var i=n[o].name;r[i]=this.hasOwnProperty(i)?this[i]:n[o].init(e,r)}return r},k.prototype.toJSON=function(e){var t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map((function(e){return e.toJSON()}))),e&&"object"==typeof e)for(var n in e){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");var r=e[n],o=r.spec.state;o&&o.toJSON&&(t[n]=o.toJSON.call(r,this[r.key]))}return t},k.fromJSON=function(e,t,n){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");var o=new S(e.schema,e.plugins),i=new k(o);return o.fields.forEach((function(o){if("doc"==o.name)i.doc=r.Node.fromJSON(e.schema,t.doc);else if("selection"==o.name)i.selection=s.fromJSON(i.doc,t.selection);else if("storedMarks"==o.name)t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(var a in n){var l=n[a],c=l.spec.state;if(l.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,a))return void(i[o.name]=c.fromJSON.call(l,e,t[a],i))}i[o.name]=o.init(e,i)}})),i},k.addApplyListener=function(e){C.push(e)},k.removeApplyListener=function(e){var t=C.indexOf(e);t>-1&&C.splice(t,1)},Object.defineProperties(k.prototype,x);var C=[];var M=function(e){this.props={},e.props&&function e(t,n,r){for(var o in t){var i=t[o];i instanceof Function?i=i.bind(n):"handleDOMEvents"==o&&(i=e(i,n,{})),r[o]=i}return r}(e.props,this,this.props),this.spec=e,this.key=e.key?e.key.key:T("plugin")};M.prototype.getState=function(e){return e[this.key]};var O=Object.create(null);function T(e){return e in O?e+"$"+ ++O[e]:(O[e]=0,e+"$")}var A=function(e){void 0===e&&(e="key"),this.key=T(e)};A.prototype.get=function(e){return e.config.pluginsByKey[this.key]},A.prototype.getState=function(e){return e[this.key]}},function(e,t,n){"use strict";n.r(t),n.d(t,"AddMarkStep",(function(){return D})),n.d(t,"MapResult",(function(){return s})),n.d(t,"Mapping",(function(){return l})),n.d(t,"RemoveMarkStep",(function(){return R})),n.d(t,"ReplaceAroundStep",(function(){return g})),n.d(t,"ReplaceStep",(function(){return v})),n.d(t,"Step",(function(){return h})),n.d(t,"StepMap",(function(){return a})),n.d(t,"StepResult",(function(){return m})),n.d(t,"Transform",(function(){return u})),n.d(t,"TransformError",(function(){return c})),n.d(t,"canJoin",(function(){return C})),n.d(t,"canSplit",(function(){return x})),n.d(t,"dropPoint",(function(){return A})),n.d(t,"findWrapping",(function(){return S})),n.d(t,"insertPoint",(function(){return T})),n.d(t,"joinPoint",(function(){return O})),n.d(t,"liftTarget",(function(){return b})),n.d(t,"replaceStep",(function(){return E}));var r=n(0),o=Math.pow(2,16);function i(e){return 65535&e}var s=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=null),this.pos=e,this.deleted=t,this.recover=n},a=function e(t,n){if(void 0===n&&(n=!1),!t.length&&e.empty)return e.empty;this.ranges=t,this.inverted=n};a.prototype.recover=function(e){var t=0,n=i(e);if(!this.inverted)for(var r=0;r<n;r++)t+=this.ranges[3*r+2]-this.ranges[3*r+1];return this.ranges[3*n]+t+function(e){return(e-(65535&e))/o}(e)},a.prototype.mapResult=function(e,t){return void 0===t&&(t=1),this._map(e,t,!1)},a.prototype.map=function(e,t){return void 0===t&&(t=1),this._map(e,t,!0)},a.prototype._map=function(e,t,n){for(var r=0,i=this.inverted?2:1,a=this.inverted?1:2,l=0;l<this.ranges.length;l+=3){var c=this.ranges[l]-(this.inverted?r:0);if(c>e)break;var u=this.ranges[l+i],d=this.ranges[l+a],p=c+u;if(e<=p){var f=c+r+((u?e==c?-1:e==p?1:t:t)<0?0:d);if(n)return f;var h=e==(t<0?c:p)?null:l/3+(e-c)*o;return new s(f,t<0?e!=c:e!=p,h)}r+=d-u}return n?e+r:new s(e+r)},a.prototype.touches=function(e,t){for(var n=0,r=i(t),o=this.inverted?2:1,s=this.inverted?1:2,a=0;a<this.ranges.length;a+=3){var l=this.ranges[a]-(this.inverted?n:0);if(l>e)break;var c=this.ranges[a+o];if(e<=l+c&&a==3*r)return!0;n+=this.ranges[a+s]-c}return!1},a.prototype.forEach=function(e){for(var t=this.inverted?2:1,n=this.inverted?1:2,r=0,o=0;r<this.ranges.length;r+=3){var i=this.ranges[r],s=i-(this.inverted?o:0),a=i+(this.inverted?0:o),l=this.ranges[r+t],c=this.ranges[r+n];e(s,s+l,a,a+c),o+=c-l}},a.prototype.invert=function(){return new a(this.ranges,!this.inverted)},a.prototype.toString=function(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)},a.offset=function(e){return 0==e?a.empty:new a(e<0?[0,-e,0]:[0,0,e])},a.empty=new a([]);var l=function(e,t,n,r){this.maps=e||[],this.from=n||0,this.to=null==r?this.maps.length:r,this.mirror=t};function c(e){var t=Error.call(this,e);return t.__proto__=c.prototype,t}l.prototype.slice=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.maps.length),new l(this.maps,this.mirror,e,t)},l.prototype.copy=function(){return new l(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)},l.prototype.appendMap=function(e,t){this.to=this.maps.push(e),null!=t&&this.setMirror(this.maps.length-1,t)},l.prototype.appendMapping=function(e){for(var t=0,n=this.maps.length;t<e.maps.length;t++){var r=e.getMirror(t);this.appendMap(e.maps[t],null!=r&&r<t?n+r:null)}},l.prototype.getMirror=function(e){if(this.mirror)for(var t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]},l.prototype.setMirror=function(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)},l.prototype.appendMappingInverted=function(e){for(var t=e.maps.length-1,n=this.maps.length+e.maps.length;t>=0;t--){var r=e.getMirror(t);this.appendMap(e.maps[t].invert(),null!=r&&r>t?n-r-1:null)}},l.prototype.invert=function(){var e=new l;return e.appendMappingInverted(this),e},l.prototype.map=function(e,t){if(void 0===t&&(t=1),this.mirror)return this._map(e,t,!0);for(var n=this.from;n<this.to;n++)e=this.maps[n].map(e,t);return e},l.prototype.mapResult=function(e,t){return void 0===t&&(t=1),this._map(e,t,!1)},l.prototype._map=function(e,t,n){for(var r=!1,o=this.from;o<this.to;o++){var i=this.maps[o].mapResult(e,t);if(null!=i.recover){var a=this.getMirror(o);if(null!=a&&a>o&&a<this.to){o=a,e=this.maps[a].recover(i.recover);continue}}i.deleted&&(r=!0),e=i.pos}return n?e:new s(e,r)},c.prototype=Object.create(Error.prototype),c.prototype.constructor=c,c.prototype.name="TransformError";var u=function(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new l},d={before:{configurable:!0},docChanged:{configurable:!0}};function p(){throw new Error("Override me")}d.before.get=function(){return this.docs.length?this.docs[0]:this.doc},u.prototype.step=function(e){var t=this.maybeStep(e);if(t.failed)throw new c(t.failed);return this},u.prototype.maybeStep=function(e){var t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t},d.docChanged.get=function(){return this.steps.length>0},u.prototype.addStep=function(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t},Object.defineProperties(u.prototype,d);var f=Object.create(null),h=function(){};h.prototype.apply=function(e){return p()},h.prototype.getMap=function(){return a.empty},h.prototype.invert=function(e){return p()},h.prototype.map=function(e){return p()},h.prototype.merge=function(e){return null},h.prototype.toJSON=function(){return p()},h.fromJSON=function(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");var n=f[t.stepType];if(!n)throw new RangeError("No step type "+t.stepType+" defined");return n.fromJSON(e,t)},h.jsonID=function(e,t){if(e in f)throw new RangeError("Duplicate use of step JSON ID "+e);return f[e]=t,t.prototype.jsonID=e,t};var m=function(e,t){this.doc=e,this.failed=t};m.ok=function(e){return new m(e,null)},m.fail=function(e){return new m(null,e)},m.fromReplace=function(e,t,n,o){try{return m.ok(e.replace(t,n,o))}catch(e){if(e instanceof r.ReplaceError)return m.fail(e.message);throw e}};var v=function(e){function t(t,n,r,o){e.call(this),this.from=t,this.to=n,this.slice=r,this.structure=!!o}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.apply=function(e){return this.structure&&y(e,this.from,this.to)?m.fail("Structure replace would overwrite content"):m.fromReplace(e,this.from,this.to,this.slice)},t.prototype.getMap=function(){return new a([this.from,this.to-this.from,this.slice.size])},t.prototype.invert=function(e){return new t(this.from,this.from+this.slice.size,e.slice(this.from,this.to))},t.prototype.map=function(e){var n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted?null:new t(n.pos,Math.max(n.pos,r.pos),this.slice)},t.prototype.merge=function(e){if(!(e instanceof t)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart){if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;var n=this.slice.size+e.slice.size==0?r.Slice.empty:new r.Slice(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new t(e.from,this.to,n,this.structure)}var o=this.slice.size+e.slice.size==0?r.Slice.empty:new r.Slice(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new t(this.from,this.to+(e.to-e.from),o,this.structure)},t.prototype.toJSON=function(){var e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e},t.fromJSON=function(e,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new t(n.from,n.to,r.Slice.fromJSON(e,n.slice),!!n.structure)},t}(h);h.jsonID("replace",v);var g=function(e){function t(t,n,r,o,i,s,a){e.call(this),this.from=t,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=!!a}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.apply=function(e){if(this.structure&&(y(e,this.from,this.gapFrom)||y(e,this.gapTo,this.to)))return m.fail("Structure gap-replace would overwrite content");var t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return m.fail("Gap is not a flat range");var n=this.slice.insertAt(this.insert,t.content);return n?m.fromReplace(e,this.from,this.to,n):m.fail("Content does not fit in gap")},t.prototype.getMap=function(){return new a([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])},t.prototype.invert=function(e){var n=this.gapTo-this.gapFrom;return new t(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)},t.prototype.map=function(e){var n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),o=e.map(this.gapFrom,-1),i=e.map(this.gapTo,1);return n.deleted&&r.deleted||o<n.pos||i>r.pos?null:new t(n.pos,r.pos,o,i,this.slice,this.insert,this.structure)},t.prototype.toJSON=function(){var e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e},t.fromJSON=function(e,n){if("number"!=typeof n.from||"number"!=typeof n.to||"number"!=typeof n.gapFrom||"number"!=typeof n.gapTo||"number"!=typeof n.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new t(n.from,n.to,n.gapFrom,n.gapTo,r.Slice.fromJSON(e,n.slice),n.insert,!!n.structure)},t}(h);function y(e,t,n){for(var r=e.resolve(t),o=n-t,i=r.depth;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0)for(var s=r.node(i).maybeChild(r.indexAfter(i));o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}return!1}function w(e,t,n){return(0==t||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function b(e){for(var t=e.parent.content.cutByIndex(e.startIndex,e.endIndex),n=e.depth;;--n){var r=e.$from.node(n),o=e.$from.index(n),i=e.$to.indexAfter(n);if(n<e.depth&&r.canReplace(o,i,t))return n;if(0==n||r.type.spec.isolating||!w(r,o,i))break}}function S(e,t,n,r){void 0===r&&(r=e);var o=function(e,t){var n=e.parent,r=e.startIndex,o=e.endIndex,i=n.contentMatchAt(r).findWrapping(t);if(!i)return null;var s=i.length?i[0]:t;return n.canReplaceWith(r,o,s)?i:null}(e,t),i=o&&function(e,t){var n=e.parent,r=e.startIndex,o=e.endIndex,i=n.child(r),s=t.contentMatch.findWrapping(i.type);if(!s)return null;for(var a=(s.length?s[s.length-1]:t).contentMatch,l=r;a&&l<o;l++)a=a.matchType(n.child(l).type);if(!a||!a.validEnd)return null;return s}(r,t);return i?o.map(k).concat({type:t,attrs:n}).concat(i.map(k)):null}function k(e){return{type:e,attrs:null}}function x(e,t,n,r){void 0===n&&(n=1);var o=e.resolve(t),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(var a=o.depth-1,l=n-2;a>i;a--,l--){var c=o.node(a),u=o.index(a);if(c.type.spec.isolating)return!1;var d=c.content.cutByIndex(u,c.childCount),p=r&&r[l]||c;if(p!=c&&(d=d.replaceChild(0,p.type.create(p.attrs))),!c.canReplace(u+1,c.childCount)||!p.type.validContent(d))return!1}var f=o.indexAfter(i),h=r&&r[0];return o.node(i).canReplaceWith(f,f,h?h.type:o.node(i+1).type)}function C(e,t){var n=e.resolve(t),r=n.index();return M(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function M(e,t){return e&&t&&!e.isLeaf&&e.canAppend(t)}function O(e,t,n){void 0===n&&(n=-1);for(var r=e.resolve(t),o=r.depth;;o--){var i=void 0,s=void 0,a=r.index(o);if(o==r.depth?(i=r.nodeBefore,s=r.nodeAfter):n>0?(i=r.node(o+1),a++,s=r.node(o).maybeChild(a)):(i=r.node(o).maybeChild(a-1),s=r.node(o+1)),i&&!i.isTextblock&&M(i,s)&&r.node(o).canReplace(a,a+1))return t;if(0==o)break;t=n<0?r.before(o):r.after(o)}}function T(e,t,n){var r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(var o=r.depth-1;o>=0;o--){var i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(var s=r.depth-1;s>=0;s--){var a=r.indexAfter(s);if(r.node(s).canReplaceWith(a,a,n))return r.after(s+1);if(a<r.node(s).childCount)return null}}function A(e,t,n){var r=e.resolve(t);if(!n.content.size)return t;for(var o=n.content,i=0;i<n.openStart;i++)o=o.firstChild.content;for(var s=1;s<=(0==n.openStart&&n.size?2:1);s++)for(var a=r.depth;a>=0;a--){var l=a==r.depth?0:r.pos<=(r.start(a+1)+r.end(a+1))/2?-1:1,c=r.index(a)+(l>0?1:0),u=r.node(a),d=!1;if(1==s)d=u.canReplace(c,c,o);else{var p=u.contentMatchAt(c).findWrapping(o.firstChild.type);d=p&&u.canReplaceWith(c,c,p[0])}if(d)return 0==l?r.pos:l<0?r.before(a+1):r.after(a+1)}return null}function N(e,t,n){for(var o=[],i=0;i<e.childCount;i++){var s=e.child(i);s.content.size&&(s=s.copy(N(s.content,t,s))),s.isInline&&(s=t(s,n,i)),o.push(s)}return r.Fragment.fromArray(o)}h.jsonID("replaceAround",g),u.prototype.lift=function(e,t){for(var n=e.$from,o=e.$to,i=e.depth,s=n.before(i+1),a=o.after(i+1),l=s,c=a,u=r.Fragment.empty,d=0,p=i,f=!1;p>t;p--)f||n.index(p)>0?(f=!0,u=r.Fragment.from(n.node(p).copy(u)),d++):l--;for(var h=r.Fragment.empty,m=0,v=i,y=!1;v>t;v--)y||o.after(v+1)<o.end(v)?(y=!0,h=r.Fragment.from(o.node(v).copy(h)),m++):c++;return this.step(new g(l,c,s,a,new r.Slice(u.append(h),d,m),u.size-d,!0))},u.prototype.wrap=function(e,t){for(var n=r.Fragment.empty,o=t.length-1;o>=0;o--){if(n.size){var i=t[o].type.contentMatch.matchFragment(n);if(!i||!i.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=r.Fragment.from(t[o].type.create(t[o].attrs,n))}var s=e.start,a=e.end;return this.step(new g(s,a,s,a,new r.Slice(n,0,0),t.length,!0))},u.prototype.setBlockType=function(e,t,n,o){var i=this;if(void 0===t&&(t=e),!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");var s=this.steps.length;return this.doc.nodesBetween(e,t,(function(e,t){if(e.isTextblock&&!e.hasMarkup(n,o)&&function(e,t,n){var r=e.resolve(t),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}(i.doc,i.mapping.slice(s).map(t),n)){i.clearIncompatible(i.mapping.slice(s).map(t,1),n);var a=i.mapping.slice(s),l=a.map(t,1),c=a.map(t+e.nodeSize,1);return i.step(new g(l,c,l+1,c-1,new r.Slice(r.Fragment.from(n.create(o,null,e.marks)),0,0),1,!0)),!1}})),this},u.prototype.setNodeMarkup=function(e,t,n,o){var i=this.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");t||(t=i.type);var s=t.create(n,null,o||i.marks);if(i.isLeaf)return this.replaceWith(e,e+i.nodeSize,s);if(!t.validContent(i.content))throw new RangeError("Invalid content for node type "+t.name);return this.step(new g(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new r.Slice(r.Fragment.from(s),0,0),1,!0))},u.prototype.split=function(e,t,n){void 0===t&&(t=1);for(var o=this.doc.resolve(e),i=r.Fragment.empty,s=r.Fragment.empty,a=o.depth,l=o.depth-t,c=t-1;a>l;a--,c--){i=r.Fragment.from(o.node(a).copy(i));var u=n&&n[c];s=r.Fragment.from(u?u.type.create(u.attrs,s):o.node(a).copy(s))}return this.step(new v(e,e,new r.Slice(i.append(s),t,t),!0))},u.prototype.join=function(e,t){void 0===t&&(t=1);var n=new v(e-t,e+t,r.Slice.empty,!0);return this.step(n)};var D=function(e){function t(t,n,r){e.call(this),this.from=t,this.to=n,this.mark=r}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.apply=function(e){var t=this,n=e.slice(this.from,this.to),o=e.resolve(this.from),i=o.node(o.sharedDepth(this.to)),s=new r.Slice(N(n.content,(function(e,n){return e.isAtom&&n.type.allowsMarkType(t.mark.type)?e.mark(t.mark.addToSet(e.marks)):e}),i),n.openStart,n.openEnd);return m.fromReplace(e,this.from,this.to,s)},t.prototype.invert=function(){return new R(this.from,this.to,this.mark)},t.prototype.map=function(e){var n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new t(n.pos,r.pos,this.mark)},t.prototype.merge=function(e){if(e instanceof t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from)return new t(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark)},t.prototype.toJSON=function(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},t.fromJSON=function(e,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new t(n.from,n.to,e.markFromJSON(n.mark))},t}(h);h.jsonID("addMark",D);var R=function(e){function t(t,n,r){e.call(this),this.from=t,this.to=n,this.mark=r}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.apply=function(e){var t=this,n=e.slice(this.from,this.to),o=new r.Slice(N(n.content,(function(e){return e.mark(t.mark.removeFromSet(e.marks))})),n.openStart,n.openEnd);return m.fromReplace(e,this.from,this.to,o)},t.prototype.invert=function(){return new D(this.from,this.to,this.mark)},t.prototype.map=function(e){var n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new t(n.pos,r.pos,this.mark)},t.prototype.merge=function(e){if(e instanceof t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from)return new t(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark)},t.prototype.toJSON=function(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},t.fromJSON=function(e,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new t(n.from,n.to,e.markFromJSON(n.mark))},t}(h);function E(e,t,n,o){if(void 0===n&&(n=t),void 0===o&&(o=r.Slice.empty),t==n&&!o.size)return null;var i=e.resolve(t),s=e.resolve(n);return _(i,s,o)?new v(t,n,o):new z(i,s,o).fit()}function _(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}h.jsonID("removeMark",R),u.prototype.addMark=function(e,t,n){var r=this,o=[],i=[],s=null,a=null;return this.doc.nodesBetween(e,t,(function(r,l,c){if(r.isInline){var u=r.marks;if(!n.isInSet(u)&&c.type.allowsMarkType(n.type)){for(var d=Math.max(l,e),p=Math.min(l+r.nodeSize,t),f=n.addToSet(u),h=0;h<u.length;h++)u[h].isInSet(f)||(s&&s.to==d&&s.mark.eq(u[h])?s.to=p:o.push(s=new R(d,p,u[h])));a&&a.to==d?a.to=p:i.push(a=new D(d,p,n))}}})),o.forEach((function(e){return r.step(e)})),i.forEach((function(e){return r.step(e)})),this},u.prototype.removeMark=function(e,t,n){var o=this;void 0===n&&(n=null);var i=[],s=0;return this.doc.nodesBetween(e,t,(function(o,a){if(o.isInline){s++;var l=null;if(n instanceof r.MarkType)for(var c,u=o.marks;c=n.isInSet(u);)(l||(l=[])).push(c),u=c.removeFromSet(u);else n?n.isInSet(o.marks)&&(l=[n]):l=o.marks;if(l&&l.length)for(var d=Math.min(a+o.nodeSize,t),p=0;p<l.length;p++){for(var f=l[p],h=void 0,m=0;m<i.length;m++){var v=i[m];v.step==s-1&&f.eq(i[m].style)&&(h=v)}h?(h.to=d,h.step=s):i.push({style:f,from:Math.max(a,e),to:d,step:s})}}})),i.forEach((function(e){return o.step(new R(e.from,e.to,e.style))})),this},u.prototype.clearIncompatible=function(e,t,n){void 0===n&&(n=t.contentMatch);for(var o=this.doc.nodeAt(e),i=[],s=e+1,a=0;a<o.childCount;a++){var l=o.child(a),c=s+l.nodeSize,u=n.matchType(l.type,l.attrs);if(u){n=u;for(var d=0;d<l.marks.length;d++)t.allowsMarkType(l.marks[d].type)||this.step(new R(s,c,l.marks[d]))}else i.push(new v(s,c,r.Slice.empty));s=c}if(!n.validEnd){var p=n.fillBefore(r.Fragment.empty,!0);this.replace(s,s,new r.Slice(p,0,0))}for(var f=i.length-1;f>=0;f--)this.step(i[f]);return this},u.prototype.replace=function(e,t,n){void 0===t&&(t=e),void 0===n&&(n=r.Slice.empty);var o=E(this.doc,e,t,n);return o&&this.step(o),this},u.prototype.replaceWith=function(e,t,n){return this.replace(e,t,new r.Slice(r.Fragment.from(n),0,0))},u.prototype.delete=function(e,t){return this.replace(e,t,r.Slice.empty)},u.prototype.insert=function(e,t){return this.replaceWith(e,e,t)};var z=function(e,t,n){this.$to=t,this.$from=e,this.unplaced=n,this.frontier=[];for(var o=0;o<=e.depth;o++){var i=e.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(o))})}this.placed=r.Fragment.empty;for(var s=e.depth;s>0;s--)this.placed=r.Fragment.from(e.node(s).copy(this.placed))},I={depth:{configurable:!0}};function P(e,t,n){return 0==t?e.cutByIndex(n):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 F(e,t){for(var n=0;n<t;n++)e=e.firstChild.content;return e}function B(e,t,n){if(t<=0)return e;var o=e.content;return t>1&&(o=o.replaceChild(0,B(o.firstChild,t-1,1==o.childCount?n-1:0))),t>0&&(o=e.type.contentMatch.fillBefore(o).append(o),n<=0&&(o=o.append(e.type.contentMatch.matchFragment(o).fillBefore(r.Fragment.empty,!0)))),e.copy(o)}function L(e,t,n,r,o){var i=e.node(t),s=o?e.indexAfter(t):e.index(t);if(s==i.childCount&&!n.compatibleContent(i.type))return null;var a=r.fillBefore(i.content,!0,s);return a&&!function(e,t,n){for(var r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,i.content,s)?a:null}function V(e){return e.spec.defining||e.spec.definingForContent}function j(e,t,n,o,i){if(t<n){var s=e.firstChild;e=e.replaceChild(0,s.copy(j(s.content,t+1,n,o,s)))}if(t>o){var a=i.contentMatchAt(0),l=a.fillBefore(e).append(e);e=l.append(a.matchFragment(l).fillBefore(r.Fragment.empty,!0))}return e}function H(e,t){for(var n=[],r=Math.min(e.depth,t.depth);r>=0;r--){var o=e.start(r);if(o<e.pos-(e.depth-r)||t.end(r)>t.pos+(t.depth-r)||e.node(r).type.spec.isolating||t.node(r).type.spec.isolating)break;(o==t.start(r)||r==e.depth&&r==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&r&&t.start(r-1)==o-1)&&n.push(r)}return n}I.depth.get=function(){return this.frontier.length-1},z.prototype.fit=function(){for(;this.unplaced.size;){var e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}var t=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,o=this.$from,i=this.close(t<0?this.$to:o.doc.resolve(t));if(!i)return null;for(var s=this.placed,a=o.depth,l=i.depth;a&&l&&1==s.childCount;)s=s.firstChild.content,a--,l--;var c=new r.Slice(s,a,l);return t>-1?new g(o.pos,t,this.$to.pos,this.$to.end(),c,n):c.size||o.pos!=this.$to.pos?new v(o.pos,i.pos,c):void 0},z.prototype.findFittable=function(){for(var e=1;e<=2;e++)for(var t=this.unplaced.openStart;t>=0;t--)for(var n=void 0,o=(t?(n=F(this.unplaced.content,t-1).firstChild).content:this.unplaced.content).firstChild,i=this.depth;i>=0;i--){var s=this.frontier[i],a=s.type,l=s.match,c=void 0,u=void 0;if(1==e&&(o?l.matchType(o.type)||(u=l.fillBefore(r.Fragment.from(o),!1)):a.compatibleContent(n.type)))return{sliceDepth:t,frontierDepth:i,parent:n,inject:u};if(2==e&&o&&(c=l.findWrapping(o.type)))return{sliceDepth:t,frontierDepth:i,parent:n,wrap:c};if(n&&l.matchType(n.type))break}},z.prototype.openMore=function(){var e=this.unplaced,t=e.content,n=e.openStart,o=e.openEnd,i=F(t,n);return!(!i.childCount||i.firstChild.isLeaf)&&(this.unplaced=new r.Slice(t,n+1,Math.max(o,i.size+n>=t.size-o?n+1:0)),!0)},z.prototype.dropNode=function(){var e=this.unplaced,t=e.content,n=e.openStart,o=e.openEnd,i=F(t,n);if(i.childCount<=1&&n>0){var s=t.size-n<=n+i.size;this.unplaced=new r.Slice(P(t,n-1,1),n-1,s?n-1:o)}else this.unplaced=new r.Slice(P(t,n,1),n,o)},z.prototype.placeNodes=function(e){for(var t=e.sliceDepth,n=e.frontierDepth,o=e.parent,i=e.inject,s=e.wrap;this.depth>n;)this.closeFrontierNode();if(s)for(var a=0;a<s.length;a++)this.openFrontierNode(s[a]);var l=this.unplaced,c=o?o.content:l.content,u=l.openStart-t,d=0,p=[],f=this.frontier[n],h=f.match,m=f.type;if(i){for(var v=0;v<i.childCount;v++)p.push(i.child(v));h=h.matchFragment(i)}for(var g=c.size+t-(l.content.size-l.openEnd);d<c.childCount;){var y=c.child(d),w=h.matchType(y.type);if(!w)break;(++d>1||0==u||y.content.size)&&(h=w,p.push(B(y.mark(m.allowedMarks(y.marks)),1==d?u:0,d==c.childCount?g:-1)))}var b=d==c.childCount;b||(g=-1),this.placed=$(this.placed,n,r.Fragment.from(p)),this.frontier[n].match=h,b&&g<0&&o&&o.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(var S=0,k=c;S<g;S++){var x=k.lastChild;this.frontier.push({type:x.type,match:x.contentMatchAt(x.childCount)}),k=x.content}this.unplaced=b?0==t?r.Slice.empty:new r.Slice(P(l.content,t-1,1),t-1,g<0?l.openEnd:t-1):new r.Slice(P(l.content,t,d),l.openStart,l.openEnd)},z.prototype.mustMoveInline=function(){if(!this.$to.parent.isTextblock)return-1;var e,t=this.frontier[this.depth];if(!t.type.isTextblock||!L(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;for(var n=this.$to.depth,r=this.$to.after(n);n>1&&r==this.$to.end(--n);)++r;return r},z.prototype.findCloseLevel=function(e){e:for(var t=Math.min(this.depth,e.depth);t>=0;t--){var n=this.frontier[t],r=n.match,o=n.type,i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=L(e,t,o,r,i);if(s){for(var a=t-1;a>=0;a--){var l=this.frontier[a],c=l.match,u=L(e,a,l.type,c,!0);if(!u||u.childCount)continue e}return{depth:t,fit:s,move:i?e.doc.resolve(e.after(t+1)):e}}}},z.prototype.close=function(e){var 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(var n=t.depth+1;n<=e.depth;n++){var r=e.node(n),o=r.type.contentMatch.fillBefore(r.content,!0,e.index(n));this.openFrontierNode(r.type,r.attrs,o)}return e},z.prototype.openFrontierNode=function(e,t,n){var o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=$(this.placed,this.depth,r.Fragment.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})},z.prototype.closeFrontierNode=function(){var e=this.frontier.pop().match.fillBefore(r.Fragment.empty,!0);e.childCount&&(this.placed=$(this.placed,this.frontier.length,e))},Object.defineProperties(z.prototype,I),u.prototype.replaceRange=function(e,t,n){if(!n.size)return this.deleteRange(e,t);var o=this.doc.resolve(e),i=this.doc.resolve(t);if(_(o,i,n))return this.step(new v(e,t,n));var s=H(o,this.doc.resolve(t));0==s[s.length-1]&&s.pop();var a=-(o.depth+1);s.unshift(a);for(var l=o.depth,c=o.pos-1;l>0;l--,c--){var u=o.node(l).type.spec;if(u.defining||u.definingAsContext||u.isolating)break;s.indexOf(l)>-1?a=l:o.before(l)==c&&s.splice(1,0,-l)}for(var d=s.indexOf(a),p=[],f=n.openStart,h=n.content,m=0;;m++){var g=h.firstChild;if(p.push(g),m==n.openStart)break;h=g.content}for(var y=f-1;y>=0;y--){var w=p[y].type,b=V(w);if(b&&o.node(d).type!=w)f=y;else if(b||!w.isTextblock)break}for(var S=n.openStart;S>=0;S--){var k=(S+f+1)%(n.openStart+1),x=p[k];if(x)for(var C=0;C<s.length;C++){var M=s[(C+d)%s.length],O=!0;M<0&&(O=!1,M=-M);var T=o.node(M-1),A=o.index(M-1);if(T.canReplaceWith(A,A,x.type,x.marks))return this.replace(o.before(M),O?i.after(M):t,new r.Slice(j(n.content,0,n.openStart,k),k,n.openEnd))}}for(var N=this.steps.length,D=s.length-1;D>=0&&(this.replace(e,t,n),!(this.steps.length>N));D--){var R=s[D];R<0||(e=o.before(R),t=i.after(R))}return this},u.prototype.replaceRangeWith=function(e,t,n){if(!n.isInline&&e==t&&this.doc.resolve(e).parent.content.size){var o=T(this.doc,e,n.type);null!=o&&(e=t=o)}return this.replaceRange(e,t,new r.Slice(r.Fragment.from(n),0,0))},u.prototype.deleteRange=function(e,t){for(var n=this.doc.resolve(e),r=this.doc.resolve(t),o=H(n,r),i=0;i<o.length;i++){var s=o[i],a=i==o.length-1;if(a&&0==s||n.node(s).type.contentMatch.validEnd)return this.delete(n.start(s),r.end(s));if(s>0&&(a||n.node(s-1).canReplace(n.index(s-1),r.indexAfter(s-1))))return this.delete(n.before(s),r.after(s))}for(var l=1;l<=n.depth&&l<=r.depth;l++)if(e-n.start(l)==n.depth-l&&t>n.end(l)&&r.end(l)-t!=r.depth-l)return this.delete(n.before(l),t);return this.delete(e,t)}},function(e,t,n){"use strict";n.r(t),n.d(t,"Decoration",(function(){return At})),n.d(t,"DecorationSet",(function(){return Et})),n.d(t,"EditorView",(function(){return Ht})),n.d(t,"__endComposition",(function(){return yt})),n.d(t,"__parseFromClipboard",(function(){return Ve})),n.d(t,"__serializeForClipboard",(function(){return Le}));var r=n(1),o=n(0),i=n(2),s={};if("undefined"!=typeof navigator&&"undefined"!=typeof document){var a=/Edge\/(\d+)/.exec(navigator.userAgent),l=/MSIE \d/.test(navigator.userAgent),c=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),u=s.ie=!!(l||c||a);s.ie_version=l?document.documentMode||6:c?+c[1]:a?+a[1]:null,s.gecko=!u&&/gecko\/(\d+)/i.test(navigator.userAgent),s.gecko_version=s.gecko&&+(/Firefox\/(\d+)/.exec(navigator.userAgent)||[0,0])[1];var d=!u&&/Chrome\/(\d+)/.exec(navigator.userAgent);s.chrome=!!d,s.chrome_version=d&&+d[1],s.safari=!u&&/Apple Computer/.test(navigator.vendor),s.ios=s.safari&&(/Mobile\/\w+/.test(navigator.userAgent)||navigator.maxTouchPoints>2),s.mac=s.ios||/Mac/.test(navigator.platform),s.android=/Android \d/.test(navigator.userAgent),s.webkit="webkitFontSmoothing"in document.documentElement.style,s.webkit_version=s.webkit&&+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]}var p=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},f=function(e){var t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t},h=null,m=function(e,t,n){var r=h||(h=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},v=function(e,t,n,r){return n&&(y(e,t,n,r,-1)||y(e,t,n,r,1))},g=/^(img|br|input|textarea|hr)$/i;function y(e,t,n,r,o){for(;;){if(e==n&&t==r)return!0;if(t==(o<0?0:w(e))){var i=e.parentNode;if(!i||1!=i.nodeType||b(e)||g.test(e.nodeName)||"false"==e.contentEditable)return!1;t=p(e)+(o<0?0:1),e=i}else{if(1!=e.nodeType)return!1;if("false"==(e=e.childNodes[t+(o<0?-1:0)]).contentEditable)return!1;t=o<0?w(e):0}}}function w(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function b(e){for(var t,n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}var S=function(e){var t=e.isCollapsed;return t&&s.chrome&&e.rangeCount&&!e.getRangeAt(0).collapsed&&(t=!1),t};function k(e,t){var n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}function x(e){return{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function C(e,t){return"number"==typeof e?e:e[t]}function M(e){var t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function O(e,t,n){for(var r=e.someProp("scrollThreshold")||0,o=e.someProp("scrollMargin")||5,i=e.dom.ownerDocument,s=n||e.dom;s;s=f(s))if(1==s.nodeType){var a=s==i.body||1!=s.nodeType,l=a?x(i):M(s),c=0,u=0;if(t.top<l.top+C(r,"top")?u=-(l.top-t.top+C(o,"top")):t.bottom>l.bottom-C(r,"bottom")&&(u=t.bottom-l.bottom+C(o,"bottom")),t.left<l.left+C(r,"left")?c=-(l.left-t.left+C(o,"left")):t.right>l.right-C(r,"right")&&(c=t.right-l.right+C(o,"right")),c||u)if(a)i.defaultView.scrollBy(c,u);else{var d=s.scrollLeft,p=s.scrollTop;u&&(s.scrollTop+=u),c&&(s.scrollLeft+=c);var h=s.scrollLeft-d,m=s.scrollTop-p;t={left:t.left-h,top:t.top-m,right:t.right-h,bottom:t.bottom-m}}if(a)break}}function T(e){for(var t=[],n=e.ownerDocument;e&&(t.push({dom:e,top:e.scrollTop,left:e.scrollLeft}),e!=n);e=f(e));return t}function A(e,t){for(var n=0;n<e.length;n++){var r=e[n],o=r.dom,i=r.top,s=r.left;o.scrollTop!=i+t&&(o.scrollTop=i+t),o.scrollLeft!=s&&(o.scrollLeft=s)}}var N=null;function D(e,t){for(var n,r,o=2e8,i=0,s=t.top,a=t.top,l=e.firstChild,c=0;l;l=l.nextSibling,c++){var u=void 0;if(1==l.nodeType)u=l.getClientRects();else{if(3!=l.nodeType)continue;u=m(l).getClientRects()}for(var d=0;d<u.length;d++){var p=u[d];if(p.top<=s&&p.bottom>=a){s=Math.max(p.bottom,s),a=Math.min(p.top,a);var f=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(f<o){n=l,o=f,r=f&&3==n.nodeType?{left:p.right<t.left?p.right:p.left,top:t.top}:t,1==l.nodeType&&f&&(i=c+(t.left>=(p.left+p.right)/2?1:0));continue}}!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(i=c+1)}}return n&&3==n.nodeType?function(e,t){for(var n=e.nodeValue.length,r=document.createRange(),o=0;o<n;o++){r.setEnd(e,o+1),r.setStart(e,o);var i=_(r,1);if(i.top!=i.bottom&&R(t,i))return{node:e,offset:o+(t.left>=(i.left+i.right)/2?1:0)}}return{node:e,offset:0}}(n,r):!n||o&&1==n.nodeType?{node:e,offset:i}:D(n,r)}function R(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function E(e,t){var n,r,o,i,a=e.dom.ownerDocument;if(a.caretPositionFromPoint)try{var l=a.caretPositionFromPoint(t.left,t.top);l&&(o=(n=l).offsetNode,i=n.offset)}catch(e){}if(!o&&a.caretRangeFromPoint){var c=a.caretRangeFromPoint(t.left,t.top);c&&(o=(r=c).startContainer,i=r.startOffset)}var u,d=(e.root.elementFromPoint?e.root:a).elementFromPoint(t.left,t.top+1);if(!d||!e.dom.contains(1!=d.nodeType?d.parentNode:d)){var p=e.dom.getBoundingClientRect();if(!R(t,p))return null;if(!(d=function e(t,n,r){var o=t.childNodes.length;if(o&&r.top<r.bottom)for(var i=Math.max(0,Math.min(o-1,Math.floor(o*(n.top-r.top)/(r.bottom-r.top))-2)),s=i;;){var a=t.childNodes[s];if(1==a.nodeType)for(var l=a.getClientRects(),c=0;c<l.length;c++){var u=l[c];if(R(n,u))return e(a,n,u)}if((s=(s+1)%o)==i)break}return t}(e.dom,t,p)))return null}if(s.safari)for(var h=d;o&&h;h=f(h))h.draggable&&(o=i=null);if(d=function(e,t){var n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}(d,t),o){if(s.gecko&&1==o.nodeType&&(i=Math.min(i,o.childNodes.length))<o.childNodes.length){var m,v=o.childNodes[i];"IMG"==v.nodeName&&(m=v.getBoundingClientRect()).right<=t.left&&m.bottom>t.top&&i++}o==e.dom&&i==o.childNodes.length-1&&1==o.lastChild.nodeType&&t.top>o.lastChild.getBoundingClientRect().bottom?u=e.state.doc.content.size:0!=i&&1==o.nodeType&&"BR"==o.childNodes[i-1].nodeName||(u=function(e,t,n,r){for(var o=-1,i=t;i!=e.dom;){var s=e.docView.nearestDesc(i,!0);if(!s)return null;if(s.node.isBlock&&s.parent){var a=s.dom.getBoundingClientRect();if(a.left>r.left||a.top>r.top)o=s.posBefore;else{if(!(a.right<r.left||a.bottom<r.top))break;o=s.posAfter}}i=s.dom.parentNode}return o>-1?o:e.docView.posFromDOM(t,n)}(e,o,i,t))}null==u&&(u=function(e,t,n){var r=D(t,n),o=r.node,i=r.offset,s=-1;if(1==o.nodeType&&!o.firstChild){var a=o.getBoundingClientRect();s=a.left!=a.right&&n.left>(a.left+a.right)/2?1:-1}return e.docView.posFromDOM(o,i,s)}(e,d,t));var g=e.docView.nearestDesc(d,!0);return{pos:u,inside:g?g.posAtStart-g.border:-1}}function _(e,t){var n=e.getClientRects();return n.length?n[t<0?0:n.length-1]:e.getBoundingClientRect()}var z=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function I(e,t,n){var r=e.docView.domFromPos(t,n<0?-1:1),o=r.node,i=r.offset,a=s.webkit||s.gecko;if(3==o.nodeType){if(!a||!z.test(o.nodeValue)&&(n<0?i:i!=o.nodeValue.length)){var l=i,c=i,u=n<0?1:-1;return n<0&&!i?(c++,u=-1):n>=0&&i==o.nodeValue.length?(l--,u=1):n<0?l--:c++,P(_(m(o,l,c),u),u<0)}var d=_(m(o,i,i),n);if(s.gecko&&i&&/\s/.test(o.nodeValue[i-1])&&i<o.nodeValue.length){var p=_(m(o,i-1,i-1),-1);if(p.top==d.top){var f=_(m(o,i,i+1),-1);if(f.top!=d.top)return P(f,f.left<p.left)}}return d}if(!e.state.doc.resolve(t).parent.inlineContent){if(i&&(n<0||i==w(o))){var h=o.childNodes[i-1];if(1==h.nodeType)return $(h.getBoundingClientRect(),!1)}if(i<w(o)){var v=o.childNodes[i];if(1==v.nodeType)return $(v.getBoundingClientRect(),!0)}return $(o.getBoundingClientRect(),n>=0)}if(i&&(n<0||i==w(o))){var g=o.childNodes[i-1],y=3==g.nodeType?m(g,w(g)-(a?0:1)):1!=g.nodeType||"BR"==g.nodeName&&g.nextSibling?null:g;if(y)return P(_(y,1),!1)}if(i<w(o)){for(var b=o.childNodes[i];b.pmViewDesc&&b.pmViewDesc.ignoreForCoords;)b=b.nextSibling;var S=b?3==b.nodeType?m(b,0,a?0:1):1==b.nodeType?b:null:null;if(S)return P(_(S,-1),!0)}return P(_(3==o.nodeType?m(o):o,-n),n>=0)}function P(e,t){if(0==e.width)return e;var n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function $(e,t){if(0==e.height)return e;var n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function F(e,t,n){var r=e.state,o=e.root.activeElement;r!=t&&e.updateState(t),o!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),o!=e.dom&&o&&o.focus()}}var B=/[\u0590-\u08ac]/;var L=null,V=null,j=!1;function H(e,t,n){return L==t&&V==n?j:(L=t,V=n,j="up"==n||"down"==n?function(e,t,n){var r=t.selection,o="up"==n?r.$from:r.$to;return F(e,t,(function(){for(var t=e.docView.domFromPos(o.pos,"up"==n?-1:1).node;;){var r=e.docView.nearestDesc(t,!0);if(!r)break;if(r.node.isBlock){t=r.dom;break}t=r.dom.parentNode}for(var i=I(e,o.pos,1),s=t.firstChild;s;s=s.nextSibling){var a=void 0;if(1==s.nodeType)a=s.getClientRects();else{if(3!=s.nodeType)continue;a=m(s,0,s.nodeValue.length).getClientRects()}for(var l=0;l<a.length;l++){var c=a[l];if(c.bottom>c.top+1&&("up"==n?i.top-c.top>2*(c.bottom-i.top):c.bottom-i.bottom>2*(i.bottom-c.top)))return!1}}return!0}))}(e,t,n):function(e,t,n){var r=t.selection.$head;if(!r.parent.isTextblock)return!1;var o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=e.root.getSelection();return B.test(r.parent.textContent)&&a.modify?F(e,t,(function(){var t=a.getRangeAt(0),o=a.focusNode,i=a.focusOffset,s=a.caretBidiLevel;a.modify("move",n,"character");var l=!(r.depth?e.docView.domAfterPos(r.before()):e.dom).contains(1==a.focusNode.nodeType?a.focusNode:a.focusNode.parentNode)||o==a.focusNode&&i==a.focusOffset;return a.removeAllRanges(),a.addRange(t),null!=s&&(a.caretBidiLevel=s),l})):"left"==n||"backward"==n?i:s}(e,t,n))}var W=function(e,t,n,r){this.parent=e,this.children=t,this.dom=n,n.pmViewDesc=this,this.contentDOM=r,this.dirty=0},K={size:{configurable:!0},border:{configurable:!0},posBefore:{configurable:!0},posAtStart:{configurable:!0},posAfter:{configurable:!0},posAtEnd:{configurable:!0},contentLost:{configurable:!0},domAtom:{configurable:!0},ignoreForCoords:{configurable:!0}};W.prototype.matchesWidget=function(){return!1},W.prototype.matchesMark=function(){return!1},W.prototype.matchesNode=function(){return!1},W.prototype.matchesHack=function(e){return!1},W.prototype.parseRule=function(){return null},W.prototype.stopEvent=function(){return!1},K.size.get=function(){for(var e=0,t=0;t<this.children.length;t++)e+=this.children[t].size;return e},K.border.get=function(){return 0},W.prototype.destroy=function(){this.parent=null,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=null);for(var e=0;e<this.children.length;e++)this.children[e].destroy()},W.prototype.posBeforeChild=function(e){for(var t=0,n=this.posAtStart;t<this.children.length;t++){var r=this.children[t];if(r==e)return n;n+=r.size}},K.posBefore.get=function(){return this.parent.posBeforeChild(this)},K.posAtStart.get=function(){return this.parent?this.parent.posBeforeChild(this)+this.border:0},K.posAfter.get=function(){return this.posBefore+this.size},K.posAtEnd.get=function(){return this.posAtStart+this.size-2*this.border},W.prototype.localPosFromDOM=function(e,t,n){if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(n<0){var r,o;if(e==this.contentDOM)r=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;r=e.previousSibling}for(;r&&(!(o=r.pmViewDesc)||o.parent!=this);)r=r.previousSibling;return r?this.posBeforeChild(o)+o.size:this.posAtStart}var i,s;if(e==this.contentDOM)i=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&(!(s=i.pmViewDesc)||s.parent!=this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}var a;if(e==this.dom&&this.contentDOM)a=t>p(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))a=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(var l=e;;l=l.parentNode){if(l==this.dom){a=!1;break}if(l.parentNode.firstChild!=l)break}if(null==a&&t==e.childNodes.length)for(var c=e;;c=c.parentNode){if(c==this.dom){a=!0;break}if(c.parentNode.lastChild!=c)break}}return(null==a?n>0:a)?this.posAtEnd:this.posAtStart},W.prototype.nearestDesc=function(e,t){for(var n=!0,r=e;r;r=r.parentNode){var o=this.getDesc(r);if(o&&(!t||o.node)){if(!n||!o.nodeDOM||(1==o.nodeDOM.nodeType?o.nodeDOM.contains(1==e.nodeType?e:e.parentNode):o.nodeDOM==e))return o;n=!1}}},W.prototype.getDesc=function(e){for(var t=e.pmViewDesc,n=t;n;n=n.parent)if(n==this)return t},W.prototype.posFromDOM=function(e,t,n){for(var r=e;r;r=r.parentNode){var o=this.getDesc(r);if(o)return o.localPosFromDOM(e,t,n)}return-1},W.prototype.descAt=function(e){for(var t=0,n=0;t<this.children.length;t++){var r=this.children[t],o=n+r.size;if(n==e&&o!=n){for(;!r.border&&r.children.length;)r=r.children[0];return r}if(e<o)return r.descAt(e-n-r.border);n=o}},W.prototype.domFromPos=function(e,t){if(!this.contentDOM)return{node:this.dom,offset:0};for(var n=0,r=0,o=0;n<this.children.length;n++){var i=this.children[n],s=o+i.size;if(s>e||i instanceof Z){r=e-o;break}o=s}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(var a=void 0;n&&!(a=this.children[n-1]).size&&a instanceof J&&a.widget.type.side>=0;n--);if(t<=0){for(var l,c=!0;(l=n?this.children[n-1]:null)&&l.dom.parentNode!=this.contentDOM;n--,c=!1);return l&&t&&c&&!l.border&&!l.domAtom?l.domFromPos(l.size,t):{node:this.contentDOM,offset:l?p(l.dom)+1:0}}for(var u,d=!0;(u=n<this.children.length?this.children[n]:null)&&u.dom.parentNode!=this.contentDOM;n++,d=!1);return u&&d&&!u.border&&!u.domAtom?u.domFromPos(0,t):{node:this.contentDOM,offset:u?p(u.dom):this.contentDOM.childNodes.length}},W.prototype.parseRange=function(e,t,n){if(void 0===n&&(n=0),0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};for(var r=-1,o=-1,i=n,s=0;;s++){var a=this.children[s],l=i+a.size;if(-1==r&&e<=l){var c=i+a.border;if(e>=c&&t<=l-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,c);e=i;for(var u=s;u>0;u--){var d=this.children[u-1];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(1)){r=p(d.dom)+1;break}e-=d.size}-1==r&&(r=0)}if(r>-1&&(l>t||s==this.children.length-1)){t=l;for(var f=s+1;f<this.children.length;f++){var h=this.children[f];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(-1)){o=p(h.dom);break}t+=h.size}-1==o&&(o=this.contentDOM.childNodes.length);break}i=l}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:o}},W.prototype.emptyChildAt=function(e){if(this.border||!this.contentDOM||!this.children.length)return!1;var t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)},W.prototype.domAfterPos=function(e){var t=this.domFromPos(e,0),n=t.node,r=t.offset;if(1!=n.nodeType||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]},W.prototype.setSelection=function(e,t,n,r){for(var o=Math.min(e,t),i=Math.max(e,t),a=0,l=0;a<this.children.length;a++){var c=this.children[a],u=l+c.size;if(o>l&&i<u)return c.setSelection(e-l-c.border,t-l-c.border,n,r);l=u}var d=this.domFromPos(e,e?-1:1),f=t==e?d:this.domFromPos(t,t?-1:1),h=n.getSelection(),m=!1;if((s.gecko||s.safari)&&e==t){var g=d.node,y=d.offset;if(3==g.nodeType){if((m=y&&"\n"==g.nodeValue[y-1])&&y==g.nodeValue.length)for(var w=g,b=void 0;w;w=w.parentNode){if(b=w.nextSibling){"BR"==b.nodeName&&(d=f={node:b.parentNode,offset:p(b)+1});break}var S=w.pmViewDesc;if(S&&S.node&&S.node.isBlock)break}}else{var k=g.childNodes[y-1];m=k&&("BR"==k.nodeName||"false"==k.contentEditable)}}if(s.gecko&&h.focusNode&&h.focusNode!=f.node&&1==h.focusNode.nodeType){var x=h.focusNode.childNodes[h.focusOffset];x&&"false"==x.contentEditable&&(r=!0)}if(r||m&&s.safari||!v(d.node,d.offset,h.anchorNode,h.anchorOffset)||!v(f.node,f.offset,h.focusNode,h.focusOffset)){var C=!1;if((h.extend||e==t)&&!m){h.collapse(d.node,d.offset);try{e!=t&&h.extend(f.node,f.offset),C=!0}catch(e){if(!(e instanceof DOMException))throw e}}if(!C){if(e>t){var M=d;d=f,f=M}var O=document.createRange();O.setEnd(f.node,f.offset),O.setStart(d.node,d.offset),h.removeAllRanges(),h.addRange(O)}}},W.prototype.ignoreMutation=function(e){return!this.contentDOM&&"selection"!=e.type},K.contentLost.get=function(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)},W.prototype.markDirty=function(e,t){for(var n=0,r=0;r<this.children.length;r++){var o=this.children[r],i=n+o.size;if(n==i?e<=i&&t>=n:e<i&&t>n){var s=n+o.border,a=i-o.border;if(e>=s&&t<=a)return this.dirty=e==n||t==i?2:1,void(e!=s||t!=a||!o.contentLost&&o.dom.parentNode==this.contentDOM?o.markDirty(e-s,t-s):o.dirty=3);o.dirty=o.dom!=o.contentDOM||o.dom.parentNode!=this.contentDOM||o.children.length?3:2}n=i}this.dirty=2},W.prototype.markParentsDirty=function(){for(var e=1,t=this.parent;t;t=t.parent,e++){var n=1==e?2:1;t.dirty<n&&(t.dirty=n)}},K.domAtom.get=function(){return!1},K.ignoreForCoords.get=function(){return!1},Object.defineProperties(W.prototype,K);var q=[],J=function(e){function t(t,n,r,o){var i,s=n.type.toDOM;if("function"==typeof s&&(s=s(r,(function(){return i?i.parent?i.parent.posBeforeChild(i):void 0:o}))),!n.type.spec.raw){if(1!=s.nodeType){var a=document.createElement("span");a.appendChild(s),s=a}s.contentEditable=!1,s.classList.add("ProseMirror-widget")}e.call(this,t,q,s,null),this.widget=n,i=this}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={domAtom:{configurable:!0}};return t.prototype.matchesWidget=function(e){return 0==this.dirty&&e.type.eq(this.widget.type)},t.prototype.parseRule=function(){return{ignore:!0}},t.prototype.stopEvent=function(e){var t=this.widget.spec.stopEvent;return!!t&&t(e)},t.prototype.ignoreMutation=function(e){return"selection"!=e.type||this.widget.spec.ignoreSelection},t.prototype.destroy=function(){this.widget.type.destroy(this.dom),e.prototype.destroy.call(this)},n.domAtom.get=function(){return!0},Object.defineProperties(t.prototype,n),t}(W),X=function(e){function t(t,n,r,o){e.call(this,t,q,n,null),this.textDOM=r,this.text=o}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={size:{configurable:!0}};return n.size.get=function(){return this.text.length},t.prototype.localPosFromDOM=function(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t},t.prototype.domFromPos=function(e){return{node:this.textDOM,offset:e}},t.prototype.ignoreMutation=function(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue},Object.defineProperties(t.prototype,n),t}(W),U=function(e){function t(t,n,r,o){e.call(this,t,[],r,o),this.mark=n}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.create=function(e,n,r,i){var s=i.nodeViews[n.type.name],a=s&&s(n,i,r);return a&&a.dom||(a=o.DOMSerializer.renderSpec(document,n.type.spec.toDOM(n,r))),new t(e,n,a.dom,a.contentDOM||a.dom)},t.prototype.parseRule=function(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}},t.prototype.matchesMark=function(e){return 3!=this.dirty&&this.mark.eq(e)},t.prototype.markDirty=function(t,n){if(e.prototype.markDirty.call(this,t,n),0!=this.dirty){for(var r=this.parent;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=0}},t.prototype.slice=function(e,n,r){var o=t.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;n<s&&(i=de(i,n,s,r)),e>0&&(i=de(i,0,e,r));for(var a=0;a<i.length;a++)i[a].parent=o;return o.children=i,o},t}(W),Y=function(e){function t(t,n,r,o,i,s,a,l,c){e.call(this,t,n.isLeaf?q:[],i,s),this.nodeDOM=a,this.node=n,this.outerDeco=r,this.innerDeco=o,s&&this.updateChildren(l,c)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={size:{configurable:!0},border:{configurable:!0},domAtom:{configurable:!0}};return t.create=function(e,n,r,i,s,a){var l,c,u=s.nodeViews[n.type.name],d=u&&u(n,s,(function(){return c?c.parent?c.parent.posBeforeChild(c):void 0:a}),r,i),p=d&&d.dom,f=d&&d.contentDOM;if(n.isText)if(p){if(3!=p.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else p=document.createTextNode(n.text);else p||(p=(l=o.DOMSerializer.renderSpec(document,n.type.spec.toDOM(n))).dom,f=l.contentDOM);f||n.isText||"BR"==p.nodeName||(p.hasAttribute("contenteditable")||(p.contentEditable=!1),n.type.spec.draggable&&(p.draggable=!0));var h=p;return p=se(p,r,n),d?c=new ee(e,n,r,i,p,f,h,d,s,a+1):n.isText?new Q(e,n,r,i,p,h,s):new t(e,n,r,i,p,f,h,s,a+1)},t.prototype.parseRule=function(){var e=this;if(this.node.type.spec.reparseInView)return null;var t={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(t.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(var n=this.children.length-1;n>=0;n--){var r=this.children[n];if(this.dom.contains(r.dom.parentNode)){t.contentElement=r.dom.parentNode;break}}t.contentElement||(t.getContent=function(){return o.Fragment.empty})}else t.contentElement=this.contentDOM;else t.getContent=function(){return e.node.content};return t},t.prototype.matchesNode=function(e,t,n){return 0==this.dirty&&e.eq(this.node)&&ae(t,this.outerDeco)&&n.eq(this.innerDeco)},n.size.get=function(){return this.node.nodeSize},n.border.get=function(){return this.node.isLeaf?0:1},t.prototype.updateChildren=function(e,t){var n=this,r=this.node.inlineContent,i=t,a=e.composing&&this.localCompositionInfo(e,t),l=a&&a.pos>-1?a:null,c=a&&a.pos<0,u=new ce(this,l&&l.node);!function(e,t,n,r){var o=t.locals(e),i=0;if(0==o.length){for(var s=0;s<e.childCount;s++){var a=e.child(s);r(a,o,t.forChild(i,a),s),i+=a.nodeSize}return}for(var l=0,c=[],u=null,d=0;;){if(l<o.length&&o[l].to==i){for(var p=o[l++],f=void 0;l<o.length&&o[l].to==i;)(f||(f=[p])).push(o[l++]);if(f){f.sort(ue);for(var h=0;h<f.length;h++)n(f[h],d,!!u)}else n(p,d,!!u)}var m=void 0,v=void 0;if(u)v=-1,m=u,u=null;else{if(!(d<e.childCount))break;v=d,m=e.child(d++)}for(var g=0;g<c.length;g++)c[g].to<=i&&c.splice(g--,1);for(;l<o.length&&o[l].from<=i&&o[l].to>i;)c.push(o[l++]);var y=i+m.nodeSize;if(m.isText){var w=y;l<o.length&&o[l].from<w&&(w=o[l].from);for(var b=0;b<c.length;b++)c[b].to<w&&(w=c[b].to);w<y&&(u=m.cut(w-i),m=m.cut(0,w-i),y=w,v=-1)}var S=c.length?m.isInline&&!m.isLeaf?c.filter((function(e){return!e.inline})):c.slice():q;r(m,S,t.forChild(i,m),v),i=y}}(this.node,this.innerDeco,(function(t,s,a){t.spec.marks?u.syncToMarks(t.spec.marks,r,e):t.type.side>=0&&!a&&u.syncToMarks(s==n.node.childCount?o.Mark.none:n.node.child(s).marks,r,e),u.placeWidget(t,e,i)}),(function(t,n,o,s){var l;u.syncToMarks(t.marks,r,e),u.findNodeMatch(t,n,o,s)||c&&e.state.selection.from>i&&e.state.selection.to<i+t.nodeSize&&(l=u.findIndexWithChild(a.node))>-1&&u.updateNodeAt(t,n,o,l,e)||u.updateNextNode(t,n,o,e,s)||u.addNode(t,n,o,e,i),i+=t.nodeSize})),u.syncToMarks(q,r,e),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||2==this.dirty)&&(l&&this.protectLocalComposition(e,l),function e(t,n,r){for(var o=t.firstChild,i=!1,s=0;s<n.length;s++){var a=n[s],l=a.dom;if(l.parentNode==t){for(;l!=o;)o=le(o),i=!0;o=o.nextSibling}else i=!0,t.insertBefore(l,o);if(a instanceof U){var c=o?o.previousSibling:t.lastChild;e(a.contentDOM,a.children,r),o=c?c.nextSibling:t.firstChild}}for(;o;)o=le(o),i=!0;i&&r.trackWrites==t&&(r.trackWrites=null)}(this.contentDOM,this.children,e),s.ios&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){var t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))},t.prototype.localCompositionInfo=function(e,t){var n=e.state.selection,o=n.from,i=n.to;if(!(!(e.state.selection instanceof r.TextSelection)||o<t||i>t+this.node.content.size)){var s=e.root.getSelection(),a=function(e,t){for(;;){if(3==e.nodeType)return e;if(1==e.nodeType&&t>0){if(e.childNodes.length>t&&3==e.childNodes[t].nodeType)return e.childNodes[t];e=e.childNodes[t-1],t=w(e)}else{if(!(1==e.nodeType&&t<e.childNodes.length))return null;e=e.childNodes[t],t=0}}}(s.focusNode,s.focusOffset);if(a&&this.dom.contains(a.parentNode)){if(this.node.inlineContent){var l=a.nodeValue,c=function(e,t,n,r){for(var o=0,i=0;o<e.childCount&&i<=r;){var s=e.child(o++),a=i;if(i+=s.nodeSize,s.isText){for(var l=s.text;o<e.childCount;){var c=e.child(o++);if(i+=c.nodeSize,!c.isText)break;l+=c.text}if(i>=n){var u=a<r?l.lastIndexOf(t,r-a-1):-1;if(u>=0&&u+t.length+a>=n)return a+u;if(n==r&&l.length>=r+t.length-a&&l.slice(r-a,r-a+t.length)==t)return r}}}return-1}(this.node.content,l,o-t,i-t);return c<0?null:{node:a,pos:c,text:l}}return{node:a,pos:-1}}}},t.prototype.protectLocalComposition=function(e,t){var n=t.node,r=t.pos,o=t.text;if(!this.getDesc(n)){for(var i=n;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=null)}var s=new X(this,i,n,o);e.compositionNodes.push(s),this.children=de(this.children,r,r+o.length,e,s)}},t.prototype.update=function(e,t,n,r){return!(3==this.dirty||!e.sameMarkup(this.node))&&(this.updateInner(e,t,n,r),!0)},t.prototype.updateInner=function(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0},t.prototype.updateOuterDeco=function(e){if(!ae(e,this.outerDeco)){var t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=oe(this.dom,this.nodeDOM,re(this.outerDeco,this.node,t),re(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=null,this.dom.pmViewDesc=this),this.outerDeco=e}},t.prototype.selectNode=function(){this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)},t.prototype.deselectNode=function(){this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable")},n.domAtom.get=function(){return this.node.isAtom},Object.defineProperties(t.prototype,n),t}(W);function G(e,t,n,r,o){return se(r,t,e),new Y(null,e,t,n,r,r,r,o,0)}var Q=function(e){function t(t,n,r,o,i,s,a){e.call(this,t,n,r,o,i,null,s,a)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={domAtom:{configurable:!0}};return t.prototype.parseRule=function(){for(var e=this.nodeDOM.parentNode;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}},t.prototype.update=function(e,t,n,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!e.sameMarkup(this.node))&&(this.updateOuterDeco(t),0==this.dirty&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=0,!0)},t.prototype.inParent=function(){for(var e=this.parent.contentDOM,t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1},t.prototype.domFromPos=function(e){return{node:this.nodeDOM,offset:e}},t.prototype.localPosFromDOM=function(t,n,r){return t==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):e.prototype.localPosFromDOM.call(this,t,n,r)},t.prototype.ignoreMutation=function(e){return"characterData"!=e.type&&"selection"!=e.type},t.prototype.slice=function(e,n,r){var o=this.node.cut(e,n),i=document.createTextNode(o.text);return new t(this.parent,o,this.outerDeco,this.innerDeco,i,i,r)},t.prototype.markDirty=function(t,n){e.prototype.markDirty.call(this,t,n),this.dom==this.nodeDOM||0!=t&&n!=this.nodeDOM.nodeValue.length||(this.dirty=3)},n.domAtom.get=function(){return!1},Object.defineProperties(t.prototype,n),t}(Y),Z=function(e){function t(){e.apply(this,arguments)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={domAtom:{configurable:!0},ignoreForCoords:{configurable:!0}};return t.prototype.parseRule=function(){return{ignore:!0}},t.prototype.matchesHack=function(e){return 0==this.dirty&&this.dom.nodeName==e},n.domAtom.get=function(){return!0},n.ignoreForCoords.get=function(){return"IMG"==this.dom.nodeName},Object.defineProperties(t.prototype,n),t}(W),ee=function(e){function t(t,n,r,o,i,s,a,l,c,u){e.call(this,t,n,r,o,i,s,a,c,u),this.spec=l}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.update=function(t,n,r,o){if(3==this.dirty)return!1;if(this.spec.update){var i=this.spec.update(t,n,r);return i&&this.updateInner(t,n,r,o),i}return!(!this.contentDOM&&!t.isLeaf)&&e.prototype.update.call(this,t,n,r,o)},t.prototype.selectNode=function(){this.spec.selectNode?this.spec.selectNode():e.prototype.selectNode.call(this)},t.prototype.deselectNode=function(){this.spec.deselectNode?this.spec.deselectNode():e.prototype.deselectNode.call(this)},t.prototype.setSelection=function(t,n,r,o){this.spec.setSelection?this.spec.setSelection(t,n,r):e.prototype.setSelection.call(this,t,n,r,o)},t.prototype.destroy=function(){this.spec.destroy&&this.spec.destroy(),e.prototype.destroy.call(this)},t.prototype.stopEvent=function(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)},t.prototype.ignoreMutation=function(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):e.prototype.ignoreMutation.call(this,t)},t}(Y);function te(e){e&&(this.nodeName=e)}te.prototype=Object.create(null);var ne=[new te];function re(e,t,n){if(0==e.length)return ne;for(var r=n?ne[0]:new te,o=[r],i=0;i<e.length;i++){var s=e[i].type.attrs;if(s)for(var a in s.nodeName&&o.push(r=new te(s.nodeName)),s){var l=s[a];null!=l&&(n&&1==o.length&&o.push(r=new te(t.isInline?"span":"div")),"class"==a?r.class=(r.class?r.class+" ":"")+l:"style"==a?r.style=(r.style?r.style+";":"")+l:"nodeName"!=a&&(r[a]=l))}}return o}function oe(e,t,n,r){if(n==ne&&r==ne)return t;for(var o=t,i=0;i<r.length;i++){var s=r[i],a=n[i];if(i){var l=void 0;a&&a.nodeName==s.nodeName&&o!=e&&(l=o.parentNode)&&l.tagName.toLowerCase()==s.nodeName||((l=document.createElement(s.nodeName)).pmIsDeco=!0,l.appendChild(o),a=ne[0]),o=l}ie(o,a||ne[0],s)}return o}function ie(e,t,n){for(var r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(var o in n)"class"!=o&&"style"!=o&&"nodeName"!=o&&n[o]!=t[o]&&e.setAttribute(o,n[o]);if(t.class!=n.class){for(var i=t.class?t.class.split(" ").filter(Boolean):q,s=n.class?n.class.split(" ").filter(Boolean):q,a=0;a<i.length;a++)-1==s.indexOf(i[a])&&e.classList.remove(i[a]);for(var l=0;l<s.length;l++)-1==i.indexOf(s[l])&&e.classList.add(s[l]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style)for(var c,u=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;c=u.exec(t.style);)e.style.removeProperty(c[1]);n.style&&(e.style.cssText+=n.style)}}function se(e,t,n){return oe(e,e,ne,re(t,n,1!=e.nodeType))}function ae(e,t){if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function le(e){var t=e.nextSibling;return e.parentNode.removeChild(e),t}var ce=function(e,t){this.top=e,this.lock=t,this.index=0,this.stack=[],this.changed=!1,this.preMatch=function(e,t){var n=t,r=n.children.length,o=e.childCount,i=new Map,s=[];e:for(;o>0;){for(var a=void 0;;)if(r){var l=n.children[r-1];if(!(l instanceof U)){a=l,r--;break}n=l,r=l.children.length}else{if(n==t)break e;r=n.parent.children.indexOf(n),n=n.parent}var c=a.node;if(c){if(c!=e.child(o-1))break;--o,i.set(a,o),s.push(a)}}return{index:o,matched:i,matches:s.reverse()}}(e.node.content,e)};function ue(e,t){return e.type.side-t.type.side}function de(e,t,n,r,o){for(var i=[],s=0,a=0;s<e.length;s++){var l=e[s],c=a,u=a+=l.size;c>=n||u<=t?i.push(l):(c<t&&i.push(l.slice(0,t-c,r)),o&&(i.push(o),o=null),u>n&&i.push(l.slice(n-c,l.size,r)))}return i}function pe(e,t){var n=e.root.getSelection(),o=e.state.doc;if(!n.focusNode)return null;var i=e.docView.nearestDesc(n.focusNode),s=i&&0==i.size,a=e.docView.posFromDOM(n.focusNode,n.focusOffset);if(a<0)return null;var l,c,u=o.resolve(a);if(S(n)){for(l=u;i&&!i.node;)i=i.parent;if(i&&i.node.isAtom&&r.NodeSelection.isSelectable(i.node)&&i.parent&&(!i.node.isInline||!function(e,t,n){for(var r=0==t,o=t==w(e);r||o;){if(e==n)return!0;var i=p(e);if(!(e=e.parentNode))return!1;r=r&&0==i,o=o&&i==w(e)}}(n.focusNode,n.focusOffset,i.dom))){var d=i.posBefore;c=new r.NodeSelection(a==d?u:o.resolve(d))}}else{var f=e.docView.posFromDOM(n.anchorNode,n.anchorOffset);if(f<0)return null;l=o.resolve(f)}c||(c=Se(e,l,u,"pointer"==t||e.state.selection.head<u.pos&&!s?1:-1));return c}function fe(e){return e.editable?e.hasFocus():ke(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function he(e,t){var n=e.state.selection;if(we(e,n),fe(e)){if(!t&&e.mouseDown&&e.mouseDown.allowDefault&&s.chrome){var o=e.root.getSelection(),i=e.domObserver.currentSelection;if(o.anchorNode&&v(o.anchorNode,o.anchorOffset,i.anchorNode,i.anchorOffset))return e.mouseDown.delayedSelectionSync=!0,void e.domObserver.setCurSelection()}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){var t=e.root.getSelection(),n=document.createRange(),r=e.cursorWrapper.dom,o="IMG"==r.nodeName;o?n.setEnd(r.parentNode,p(r)+1):n.setEnd(r,0);n.collapse(!1),t.removeAllRanges(),t.addRange(n),!o&&!e.state.selection.visible&&s.ie&&s.ie_version<=11&&(r.disabled=!0,r.disabled=!1)}(e);else{var a,l,c=n.anchor,u=n.head;!me||n instanceof r.TextSelection||(n.$from.parent.inlineContent||(a=ve(e,n.from)),n.empty||n.$from.parent.inlineContent||(l=ve(e,n.to))),e.docView.setSelection(c,u,e.root,t),me&&(a&&ye(a),l&&ye(l)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){var t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.hideSelectionGuard);var n=e.root.getSelection(),r=n.anchorNode,o=n.anchorOffset;t.addEventListener("selectionchange",e.hideSelectionGuard=function(){n.anchorNode==r&&n.anchorOffset==o||(t.removeEventListener("selectionchange",e.hideSelectionGuard),setTimeout((function(){fe(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")}),20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}ce.prototype.destroyBetween=function(e,t){if(e!=t){for(var n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}},ce.prototype.destroyRest=function(){this.destroyBetween(this.index,this.top.children.length)},ce.prototype.syncToMarks=function(e,t,n){for(var r=0,o=this.stack.length>>1,i=Math.min(o,e.length);r<i&&(r==o-1?this.top:this.stack[r+1<<1]).matchesMark(e[r])&&!1!==e[r].type.spec.spanning;)r++;for(;r<o;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);for(var s=-1,a=this.index;a<Math.min(this.index+3,this.top.children.length);a++)if(this.top.children[a].matchesMark(e[o])){s=a;break}if(s>-1)s>this.index&&(this.changed=!0,this.destroyBetween(this.index,s)),this.top=this.top.children[this.index];else{var l=U.create(this.top,e[o],t,n);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,o++}},ce.prototype.findNodeMatch=function(e,t,n,r){var o,i=-1;if(r>=this.preMatch.index&&(o=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,n))i=this.top.children.indexOf(o,this.index);else for(var s=this.index,a=Math.min(this.top.children.length,s+5);s<a;s++){var l=this.top.children[s];if(l.matchesNode(e,t,n)&&!this.preMatch.matched.has(l)){i=s;break}}return!(i<0)&&(this.destroyBetween(this.index,i),this.index++,!0)},ce.prototype.updateNodeAt=function(e,t,n,r,o){return!!this.top.children[r].update(e,t,n,o)&&(this.destroyBetween(this.index,r),this.index=r+1,!0)},ce.prototype.findIndexWithChild=function(e){for(;;){var t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){var n=e.pmViewDesc;if(n)for(var r=this.index;r<this.top.children.length;r++)if(this.top.children[r]==n)return r;return-1}e=t}},ce.prototype.updateNextNode=function(e,t,n,r,o){for(var i=this.index;i<this.top.children.length;i++){var s=this.top.children[i];if(s instanceof Y){var a=this.preMatch.matched.get(s);if(null!=a&&a!=o)return!1;var l=s.dom;if(!(this.lock&&(l==this.lock||1==l.nodeType&&l.contains(this.lock.parentNode))&&!(e.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==e.text&&3!=s.dirty&&ae(t,s.outerDeco)))&&s.update(e,t,n,r))return this.destroyBetween(this.index,i),s.dom!=l&&(this.changed=!0),this.index++,!0;break}}return!1},ce.prototype.addNode=function(e,t,n,r,o){this.top.children.splice(this.index++,0,Y.create(this.top,e,t,n,r,o)),this.changed=!0},ce.prototype.placeWidget=function(e,t,n){var r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(e)||e!=r.widget&&r.widget.type.toDOM.parentNode){var o=new J(this.top,e,t,n);this.top.children.splice(this.index++,0,o),this.changed=!0}else this.index++},ce.prototype.addTextblockHacks=function(){for(var e=this.top.children[this.index-1];e instanceof U;)e=e.children[e.children.length-1];e&&e instanceof Q&&!/\n$/.test(e.node.text)||((s.safari||s.chrome)&&e&&"false"==e.dom.contentEditable&&this.addHackNode("IMG"),this.addHackNode("BR"))},ce.prototype.addHackNode=function(e){if(this.index<this.top.children.length&&this.top.children[this.index].matchesHack(e))this.index++;else{var t=document.createElement(e);"IMG"==e&&(t.className="ProseMirror-separator",t.alt=""),"BR"==e&&(t.className="ProseMirror-trailingBreak"),this.top.children.splice(this.index++,0,new Z(this.top,q,t,null)),this.changed=!0}};var me=s.safari||s.chrome&&s.chrome_version<63;function ve(e,t){var n=e.docView.domFromPos(t,0),r=n.node,o=n.offset,i=o<r.childNodes.length?r.childNodes[o]:null,a=o?r.childNodes[o-1]:null;if(s.safari&&i&&"false"==i.contentEditable)return ge(i);if(!(i&&"false"!=i.contentEditable||a&&"false"!=a.contentEditable)){if(i)return ge(i);if(a)return ge(a)}}function ge(e){return e.contentEditable="true",s.safari&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function ye(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function we(e,t){if(t instanceof r.NodeSelection){var n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(be(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else be(e)}function be(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=null)}function Se(e,t,n,o){return e.someProp("createSelectionBetween",(function(r){return r(e,t,n)}))||r.TextSelection.between(t,n,o)}function ke(e){var t=e.root.getSelection();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function xe(e,t){var n=e.selection,o=n.$anchor,i=n.$head,s=t>0?o.max(i):o.min(i),a=s.parent.inlineContent?s.depth?e.doc.resolve(t>0?s.after():s.before()):null:s;return a&&r.Selection.findFrom(a,t)}function Ce(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function Me(e,t,n){var o=e.state.selection;if(!(o instanceof r.TextSelection)){if(o instanceof r.NodeSelection&&o.node.isInline)return Ce(e,new r.TextSelection(t>0?o.$to:o.$from));var i=xe(e.state,t);return!!i&&Ce(e,i)}if(!o.empty||n.indexOf("s")>-1)return!1;if(e.endOfTextblock(t>0?"right":"left")){var a=xe(e.state,t);return!!(a&&a instanceof r.NodeSelection)&&Ce(e,a)}if(!(s.mac&&n.indexOf("m")>-1)){var l,c=o.$head,u=c.textOffset?null:t<0?c.nodeBefore:c.nodeAfter;if(!u||u.isText)return!1;var d=t<0?c.pos-u.nodeSize:c.pos;return!!(u.isAtom||(l=e.docView.descAt(d))&&!l.contentDOM)&&(r.NodeSelection.isSelectable(u)?Ce(e,new r.NodeSelection(t<0?e.state.doc.resolve(c.pos-u.nodeSize):c)):!!s.webkit&&Ce(e,new r.TextSelection(e.state.doc.resolve(t<0?d:d+u.nodeSize))))}}function Oe(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Te(e){var t=e.pmViewDesc;return t&&0==t.size&&(e.nextSibling||"BR"!=e.nodeName)}function Ae(e){var t=e.root.getSelection(),n=t.focusNode,r=t.focusOffset;if(n){var o,i,a=!1;for(s.gecko&&1==n.nodeType&&r<Oe(n)&&Te(n.childNodes[r])&&(a=!0);;)if(r>0){if(1!=n.nodeType)break;var l=n.childNodes[r-1];if(Te(l))o=n,i=--r;else{if(3!=l.nodeType)break;r=(n=l).nodeValue.length}}else{if(De(n))break;for(var c=n.previousSibling;c&&Te(c);)o=n.parentNode,i=p(c),c=c.previousSibling;if(c)r=Oe(n=c);else{if((n=n.parentNode)==e.dom)break;r=0}}a?Re(e,t,n,r):o&&Re(e,t,o,i)}}function Ne(e){var t=e.root.getSelection(),n=t.focusNode,r=t.focusOffset;if(n){for(var o,i,s=Oe(n);;)if(r<s){if(1!=n.nodeType)break;if(!Te(n.childNodes[r]))break;o=n,i=++r}else{if(De(n))break;for(var a=n.nextSibling;a&&Te(a);)o=a.parentNode,i=p(a)+1,a=a.nextSibling;if(a)r=0,s=Oe(n=a);else{if((n=n.parentNode)==e.dom)break;r=s=0}}o&&Re(e,t,o,i)}}function De(e){var t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function Re(e,t,n,r){if(S(t)){var o=document.createRange();o.setEnd(n,r),o.setStart(n,r),t.removeAllRanges(),t.addRange(o)}else t.extend&&t.extend(n,r);e.domObserver.setCurSelection();var i=e.state;setTimeout((function(){e.state==i&&he(e)}),50)}function Ee(e,t,n){var o=e.state.selection;if(o instanceof r.TextSelection&&!o.empty||n.indexOf("s")>-1)return!1;if(s.mac&&n.indexOf("m")>-1)return!1;var i=o.$from,a=o.$to;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){var l=xe(e.state,t);if(l&&l instanceof r.NodeSelection)return Ce(e,l)}if(!i.parent.inlineContent){var c=t<0?i:a,u=o instanceof r.AllSelection?r.Selection.near(c,t):r.Selection.findFrom(c,t);return!!u&&Ce(e,u)}return!1}function _e(e,t){if(!(e.state.selection instanceof r.TextSelection))return!0;var n=e.state.selection,o=n.$head,i=n.$anchor,s=n.empty;if(!o.sameParent(i))return!0;if(!s)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;var a=!o.textOffset&&(t<0?o.nodeBefore:o.nodeAfter);if(a&&!a.isText){var l=e.state.tr;return t<0?l.delete(o.pos-a.nodeSize,o.pos):l.delete(o.pos,o.pos+a.nodeSize),e.dispatch(l),!0}return!1}function ze(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function Ie(e,t){var n=t.keyCode,r=function(e){var t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}(t);return 8==n||s.mac&&72==n&&"c"==r?_e(e,-1)||Ae(e):46==n||s.mac&&68==n&&"c"==r?_e(e,1)||Ne(e):13==n||27==n||(37==n?Me(e,-1,r)||Ae(e):39==n?Me(e,1,r)||Ne(e):38==n?Ee(e,-1,r)||Ae(e):40==n?function(e){if(s.safari&&!(e.state.selection.$head.parentOffset>0)){var t=e.root.getSelection(),n=t.focusNode,r=t.focusOffset;if(n&&1==n.nodeType&&0==r&&n.firstChild&&"false"==n.firstChild.contentEditable){var o=n.firstChild;ze(e,o,!0),setTimeout((function(){return ze(e,o,!1)}),20)}}}(e)||Ee(e,1,r)||Ne(e):r==(s.mac?"m":"c")&&(66==n||73==n||89==n||90==n))}function Pe(e){var t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(s.safari&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){var n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}if(e.parentNode.lastChild==e||s.safari&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0}}function $e(e,t,n,i,a){if(t<0){var l=e.lastSelectionTime>Date.now()-50?e.lastSelectionOrigin:null,c=pe(e,l);if(c&&!e.state.selection.eq(c)){var u=e.state.tr.setSelection(c);"pointer"==l?u.setMeta("pointer",!0):"key"==l&&u.scrollIntoView(),e.dispatch(u)}}else{var d=e.state.doc.resolve(t),p=d.sharedDepth(n);t=d.before(p+1),n=e.state.doc.resolve(n).after(p+1);var f=e.state.selection,h=function(e,t,n){var r=e.docView.parseRange(t,n),i=r.node,a=r.fromOffset,l=r.toOffset,c=r.from,u=r.to,d=e.root.getSelection(),p=null,f=d.anchorNode;if(f&&e.dom.contains(1==f.nodeType?f:f.parentNode)&&(p=[{node:f,offset:d.anchorOffset}],S(d)||p.push({node:d.focusNode,offset:d.focusOffset})),s.chrome&&8===e.lastKeyCode)for(var h=l;h>a;h--){var m=i.childNodes[h-1],v=m.pmViewDesc;if("BR"==m.nodeName&&!v){l=h;break}if(!v||v.size)break}var g=e.state.doc,y=e.someProp("domParser")||o.DOMParser.fromSchema(e.state.schema),w=g.resolve(c),b=null,k=y.parse(i,{topNode:w.parent,topMatch:w.parent.contentMatchAt(w.index()),topOpen:!0,from:a,to:l,preserveWhitespace:"pre"!=w.parent.type.whitespace||"full",editableContent:!0,findPositions:p,ruleFromNode:Pe,context:w});if(p&&null!=p[0].pos){var x=p[0].pos,C=p[1]&&p[1].pos;null==C&&(C=x),b={anchor:x+c,head:C+c}}return{doc:k,sel:b,from:c,to:u}}(e,t,n);if(s.chrome&&e.cursorWrapper&&h.sel&&h.sel.anchor==e.cursorWrapper.deco.from){var m=e.cursorWrapper.deco.type.toDOM.nextSibling,v=m&&m.nodeValue?m.nodeValue.length:1;h.sel={anchor:h.sel.anchor+v,head:h.sel.anchor+v}}var g,y,w=e.state.doc,b=w.slice(h.from,h.to);8===e.lastKeyCode&&Date.now()-100<e.lastKeyCodeTime?(g=e.state.selection.to,y="end"):(g=e.state.selection.from,y="start"),e.lastKeyCode=null;var x=function(e,t,n,r,o){var i=e.findDiffStart(t,n);if(null==i)return null;var s=e.findDiffEnd(t,n+e.size,n+t.size),a=s.a,l=s.b;if("end"==o){var c=Math.max(0,i-Math.min(a,l));r-=a+c-i}if(a<i&&e.size<t.size){l=(i-=r<=i&&r>=a?i-r:0)+(l-a),a=i}else if(l<i){a=(i-=r<=i&&r>=l?i-r:0)+(a-l),l=i}return{start:i,endA:a,endB:l}}(b.content,h.doc.content,h.from,g,y);if((s.ios&&e.lastIOSEnter>Date.now()-225||s.android)&&a.some((function(e){return"DIV"==e.nodeName||"P"==e.nodeName}))&&(!x||x.endA>=x.endB)&&e.someProp("handleKeyDown",(function(t){return t(e,k(13,"Enter"))})))e.lastIOSEnter=0;else{if(!x){if(!(i&&f instanceof r.TextSelection&&!f.empty&&f.$head.sameParent(f.$anchor))||e.composing||h.sel&&h.sel.anchor!=h.sel.head){if(h.sel){var C=Fe(e,e.state.doc,h.sel);C&&!C.eq(e.state.selection)&&e.dispatch(e.state.tr.setSelection(C))}return}x={start:f.from,endA:f.to,endB:f.to}}e.domChangeCount++,e.state.selection.from<e.state.selection.to&&x.start==x.endB&&e.state.selection instanceof r.TextSelection&&(x.start>e.state.selection.from&&x.start<=e.state.selection.from+2&&e.state.selection.from>=h.from?x.start=e.state.selection.from:x.endA<e.state.selection.to&&x.endA>=e.state.selection.to-2&&e.state.selection.to<=h.to&&(x.endB+=e.state.selection.to-x.endA,x.endA=e.state.selection.to)),s.ie&&s.ie_version<=11&&x.endB==x.start+1&&x.endA==x.start&&x.start>h.from&&" "==h.doc.textBetween(x.start-h.from-1,x.start-h.from+1)&&(x.start--,x.endA--,x.endB--);var M,O=h.doc.resolveNoCache(x.start-h.from),T=h.doc.resolveNoCache(x.endB-h.from),A=O.sameParent(T)&&O.parent.inlineContent;if((s.ios&&e.lastIOSEnter>Date.now()-225&&(!A||a.some((function(e){return"DIV"==e.nodeName||"P"==e.nodeName})))||!A&&O.pos<h.doc.content.size&&(M=r.Selection.findFrom(h.doc.resolve(O.pos+1),1,!0))&&M.head==T.pos)&&e.someProp("handleKeyDown",(function(t){return t(e,k(13,"Enter"))})))e.lastIOSEnter=0;else if(e.state.selection.anchor>x.start&&function(e,t,n,r,o){if(!r.parent.isTextblock||n-t<=o.pos-r.pos||Be(r,!0,!1)<o.pos)return!1;var i=e.resolve(t);if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;var s=e.resolve(Be(i,!0,!0));if(!s.parent.isTextblock||s.pos>n||Be(s,!0,!1)<n)return!1;return r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(w,x.start,x.endA,O,T)&&e.someProp("handleKeyDown",(function(t){return t(e,k(8,"Backspace"))})))s.android&&s.chrome&&e.domObserver.suppressSelectionUpdates();else{s.chrome&&s.android&&x.toB==x.from&&(e.lastAndroidDelete=Date.now()),s.android&&!A&&O.start()!=T.start()&&0==T.parentOffset&&O.depth==T.depth&&h.sel&&h.sel.anchor==h.sel.head&&h.sel.head==x.endA&&(x.endB-=2,T=h.doc.resolveNoCache(x.endB-h.from),setTimeout((function(){e.someProp("handleKeyDown",(function(t){return t(e,k(13,"Enter"))}))}),20));var N,D,R,E,_=x.start,z=x.endA;if(A)if(O.pos==T.pos)s.ie&&s.ie_version<=11&&0==O.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout((function(){return he(e)}),20)),N=e.state.tr.delete(_,z),D=w.resolve(x.start).marksAcross(w.resolve(x.endA));else if(x.endA==x.endB&&(E=w.resolve(x.start))&&(R=function(e,t){for(var n,r,i,s=e.firstChild.marks,a=t.firstChild.marks,l=s,c=a,u=0;u<a.length;u++)l=a[u].removeFromSet(l);for(var d=0;d<s.length;d++)c=s[d].removeFromSet(c);if(1==l.length&&0==c.length)r=l[0],n="add",i=function(e){return e.mark(r.addToSet(e.marks))};else{if(0!=l.length||1!=c.length)return null;r=c[0],n="remove",i=function(e){return e.mark(r.removeFromSet(e.marks))}}for(var p=[],f=0;f<t.childCount;f++)p.push(i(t.child(f)));if(o.Fragment.from(p).eq(e))return{mark:r,type:n}}(O.parent.content.cut(O.parentOffset,T.parentOffset),E.parent.content.cut(E.parentOffset,x.endA-E.start()))))N=e.state.tr,"add"==R.type?N.addMark(_,z,R.mark):N.removeMark(_,z,R.mark);else if(O.parent.child(O.index()).isText&&O.index()==T.index()-(T.textOffset?0:1)){var I=O.parent.textBetween(O.parentOffset,T.parentOffset);if(e.someProp("handleTextInput",(function(t){return t(e,_,z,I)})))return;N=e.state.tr.insertText(I,_,z)}if(N||(N=e.state.tr.replace(_,z,h.doc.slice(x.start-h.from,x.endB-h.from))),h.sel){var P=Fe(e,N.doc,h.sel);P&&!(s.chrome&&s.android&&e.composing&&P.empty&&(x.start!=x.endB||e.lastAndroidDelete<Date.now()-100)&&(P.head==_||P.head==N.mapping.map(z)-1)||s.ie&&P.empty&&P.head==_)&&N.setSelection(P)}D&&N.ensureMarks(D),e.dispatch(N.scrollIntoView())}}}}function Fe(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:Se(e,t.resolve(n.anchor),t.resolve(n.head))}function Be(e,t,n){for(var r=e.depth,o=t?e.end():e.pos;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,o++,t=!1;if(n)for(var i=e.node(r).maybeChild(e.indexAfter(r));i&&!i.isLeaf;)i=i.firstChild,o++;return o}function Le(e,t){for(var n=[],r=t.content,i=t.openStart,s=t.openEnd;i>1&&s>1&&1==r.childCount&&1==r.firstChild.childCount;){i--,s--;var a=r.firstChild;n.push(a.type.name,a.attrs!=a.type.defaultAttrs?a.attrs:null),r=a.content}var l=e.someProp("clipboardSerializer")||o.DOMSerializer.fromSchema(e.state.schema),c=Xe(),u=c.createElement("div");u.appendChild(l.serializeFragment(r,{document:c}));for(var d,p=u.firstChild;p&&1==p.nodeType&&(d=qe[p.nodeName.toLowerCase()]);){for(var f=d.length-1;f>=0;f--){for(var h=c.createElement(d[f]);u.firstChild;)h.appendChild(u.firstChild);u.appendChild(h),"tbody"!=d[f]&&(i++,s++)}p=u.firstChild}return p&&1==p.nodeType&&p.setAttribute("data-pm-slice",i+" "+s+" "+JSON.stringify(n)),{dom:u,text:e.someProp("clipboardTextSerializer",(function(e){return e(t)}))||t.content.textBetween(0,t.content.size,"\n\n")}}function Ve(e,t,n,r,i){var a,l,c=i.parent.type.spec.code;if(!n&&!t)return null;var u=t&&(r||c||!n);if(u){if(e.someProp("transformPastedText",(function(e){t=e(t,c||r)})),c)return t?new o.Slice(o.Fragment.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0):o.Slice.empty;var d=e.someProp("clipboardTextParser",(function(e){return e(t,i,r)}));if(d)l=d;else{var p=i.marks(),f=e.state.schema,h=o.DOMSerializer.fromSchema(f);a=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach((function(e){var t=a.appendChild(document.createElement("p"));e&&t.appendChild(h.serializeNode(f.text(e,p)))}))}}else e.someProp("transformPastedHTML",(function(e){n=e(n)})),a=function(e){var t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));var n,r=Xe().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(e);(n=o&&qe[o[1].toLowerCase()])&&(e=n.map((function(e){return"<"+e+">"})).join("")+e+n.map((function(e){return"</"+e+">"})).reverse().join(""));if(r.innerHTML=e,n)for(var i=0;i<n.length;i++)r=r.querySelector(n[i])||r;return r}(n),s.webkit&&function(e){for(var t=e.querySelectorAll(s.chrome?"span:not([class]):not([style])":"span.Apple-converted-space"),n=0;n<t.length;n++){var r=t[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}(a);var m=a&&a.querySelector("[data-pm-slice]"),v=m&&/^(\d+) (\d+) (.*)/.exec(m.getAttribute("data-pm-slice"));if(!l){var g=e.someProp("clipboardParser")||e.someProp("domParser")||o.DOMParser.fromSchema(e.state.schema);l=g.parseSlice(a,{preserveWhitespace:!(!u&&!v),context:i,ruleFromNode:function(e){if("BR"==e.nodeName&&!e.nextSibling&&e.parentNode&&!je.test(e.parentNode.nodeName))return{ignore:!0}}})}if(v)l=function(e,t){if(!e.size)return e;var n,r=e.content.firstChild.type.schema;try{n=JSON.parse(t)}catch(t){return e}for(var i=e.content,s=e.openStart,a=e.openEnd,l=n.length-2;l>=0;l-=2){var c=r.nodes[n[l]];if(!c||c.hasRequiredAttrs())break;i=o.Fragment.from(c.create(n[l+1],i)),s++,a++}return new o.Slice(i,s,a)}(Ke(l,+v[1],+v[2]),v[3]);else if((l=o.Slice.maxOpen(function(e,t){if(e.childCount<2)return e;for(var n=function(n){var r=t.node(n).contentMatchAt(t.index(n)),i=void 0,s=[];if(e.forEach((function(e){if(s){var t,n=r.findWrapping(e.type);if(!n)return s=null;if(t=s.length&&i.length&&function e(t,n,r,i,s){if(s<t.length&&s<n.length&&t[s]==n[s]){var a=e(t,n,r,i.lastChild,s+1);if(a)return i.copy(i.content.replaceChild(i.childCount-1,a));if(i.contentMatchAt(i.childCount).matchType(s==t.length-1?r.type:t[s+1]))return i.copy(i.content.append(o.Fragment.from(He(r,t,s+1))))}}(n,i,e,s[s.length-1],0))s[s.length-1]=t;else{s.length&&(s[s.length-1]=function e(t,n){if(0==n)return t;var r=t.content.replaceChild(t.childCount-1,e(t.lastChild,n-1)),i=t.contentMatchAt(t.childCount).fillBefore(o.Fragment.empty,!0);return t.copy(r.append(i))}(s[s.length-1],i.length));var a=He(e,n);s.push(a),r=r.matchType(a.type,a.attrs),i=n}}})),s)return{v:o.Fragment.from(s)}},r=t.depth;r>=0;r--){var i=n(r);if(i)return i.v}return e}(l.content,i),!0)).openStart||l.openEnd){for(var y=0,w=0,b=l.content.firstChild;y<l.openStart&&!b.type.spec.isolating;y++,b=b.firstChild);for(var S=l.content.lastChild;w<l.openEnd&&!S.type.spec.isolating;w++,S=S.lastChild);l=Ke(l,y,w)}return e.someProp("transformPasted",(function(e){l=e(l)})),l}var je=/^(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 He(e,t,n){void 0===n&&(n=0);for(var r=t.length-1;r>=n;r--)e=t[r].create(null,o.Fragment.from(e));return e}function We(e,t,n,r,i,s){var a=t<0?e.firstChild:e.lastChild,l=a.content;return i<r-1&&(l=We(l,t,n,r,i+1,s)),i>=n&&(l=t<0?a.contentMatchAt(0).fillBefore(l,e.childCount>1||s<=i).append(l):l.append(a.contentMatchAt(a.childCount).fillBefore(o.Fragment.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,a.copy(l))}function Ke(e,t,n){return t<e.openStart&&(e=new o.Slice(We(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new o.Slice(We(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}var qe={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},Je=null;function Xe(){return Je||(Je=document.implementation.createHTMLDocument("title"))}var Ue={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Ye=s.ie&&s.ie_version<=11,Ge=function(){this.anchorNode=this.anchorOffset=this.focusNode=this.focusOffset=null};Ge.prototype.set=function(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset},Ge.prototype.eq=function(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset};var Qe=function(e,t){var n=this;this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=window.MutationObserver&&new window.MutationObserver((function(e){for(var t=0;t<e.length;t++)n.queue.push(e[t]);s.ie&&s.ie_version<=11&&e.some((function(e){return"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length}))?n.flushSoon():n.flush()})),this.currentSelection=new Ge,Ye&&(this.onCharData=function(e){n.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),n.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.suppressingSelectionUpdates=!1};Qe.prototype.flushSoon=function(){var e=this;this.flushingSoon<0&&(this.flushingSoon=window.setTimeout((function(){e.flushingSoon=-1,e.flush()}),20))},Qe.prototype.forceFlush=function(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())},Qe.prototype.start=function(){this.observer&&this.observer.observe(this.view.dom,Ue),Ye&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()},Qe.prototype.stop=function(){var e=this;if(this.observer){var t=this.observer.takeRecords();if(t.length){for(var n=0;n<t.length;n++)this.queue.push(t[n]);window.setTimeout((function(){return e.flush()}),20)}this.observer.disconnect()}Ye&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()},Qe.prototype.connectSelection=function(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)},Qe.prototype.disconnectSelection=function(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)},Qe.prototype.suppressSelectionUpdates=function(){var e=this;this.suppressingSelectionUpdates=!0,setTimeout((function(){return e.suppressingSelectionUpdates=!1}),50)},Qe.prototype.onSelectionChange=function(){if((!(e=this.view).editable||e.root.activeElement==e.dom)&&ke(e)){var e;if(this.suppressingSelectionUpdates)return he(this.view);if(s.ie&&s.ie_version<=11&&!this.view.state.selection.empty){var t=this.view.root.getSelection();if(t.focusNode&&v(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}},Qe.prototype.setCurSelection=function(){this.currentSelection.set(this.view.root.getSelection())},Qe.prototype.ignoreSelectionChange=function(e){if(0==e.rangeCount)return!0;var t=e.getRangeAt(0).commonAncestorContainer,n=this.view.docView.nearestDesc(t);return n&&n.ignoreMutation({type:"selection",target:3==t.nodeType?t.parentNode:t})?(this.setCurSelection(),!0):void 0},Qe.prototype.flush=function(){if(this.view.docView&&!(this.flushingSoon>-1)){var e=this.observer?this.observer.takeRecords():[];this.queue.length&&(e=this.queue.concat(e),this.queue.length=0);var t=this.view.root.getSelection(),n=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(t)&&ke(this.view)&&!this.ignoreSelectionChange(t),r=-1,o=-1,i=!1,a=[];if(this.view.editable)for(var l=0;l<e.length;l++){var c=this.registerMutation(e[l],a);c&&(r=r<0?c.from:Math.min(c.from,r),o=o<0?c.to:Math.max(c.to,o),c.typeOver&&(i=!0))}if(s.gecko&&a.length>1){var u=a.filter((function(e){return"BR"==e.nodeName}));if(2==u.length){var d=u[0],p=u[1];d.parentNode&&d.parentNode.parentNode==p.parentNode?p.remove():d.remove()}}(r>-1||n)&&(r>-1&&(this.view.docView.markDirty(r,o),function(e){if(Ze)return;Ze=!0,"normal"==getComputedStyle(e.dom).whiteSpace&&console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package.")}(this.view)),this.handleDOMChange(r,o,i,a),this.view.docView&&this.view.docView.dirty?this.view.updateState(this.view.state):this.currentSelection.eq(t)||he(this.view),this.currentSelection.set(t))}},Qe.prototype.registerMutation=function(e,t){if(t.indexOf(e.target)>-1)return null;var n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(var r=0;r<e.addedNodes.length;r++)t.push(e.addedNodes[r]);if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};var o=e.previousSibling,i=e.nextSibling;if(s.ie&&s.ie_version<=11&&e.addedNodes.length)for(var a=0;a<e.addedNodes.length;a++){var l=e.addedNodes[a],c=l.previousSibling,u=l.nextSibling;(!c||Array.prototype.indexOf.call(e.addedNodes,c)<0)&&(o=c),(!u||Array.prototype.indexOf.call(e.addedNodes,u)<0)&&(i=u)}var d=o&&o.parentNode==e.target?p(o)+1:0,f=n.localPosFromDOM(e.target,d,-1),h=i&&i.parentNode==e.target?p(i):e.target.childNodes.length;return{from:f,to:n.localPosFromDOM(e.target,h,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}};var Ze=!1;var et={},tt={};function nt(e,t){e.lastSelectionOrigin=t,e.lastSelectionTime=Date.now()}function rt(e){e.someProp("handleDOMEvents",(function(t){for(var n in t)e.eventHandlers[n]||e.dom.addEventListener(n,e.eventHandlers[n]=function(t){return ot(e,t)})}))}function ot(e,t){return e.someProp("handleDOMEvents",(function(n){var r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)}))}function it(e){return{left:e.clientX,top:e.clientY}}function st(e,t,n,r,o){if(-1==r)return!1;for(var i=e.state.doc.resolve(r),s=function(r){if(e.someProp(t,(function(t){return r>i.depth?t(e,n,i.nodeAfter,i.before(r),o,!0):t(e,n,i.node(r),i.before(r),o,!1)})))return{v:!0}},a=i.depth+1;a>0;a--){var l=s(a);if(l)return l.v}return!1}function at(e,t,n){e.focused||e.focus();var r=e.state.tr.setSelection(t);"pointer"==n&&r.setMeta("pointer",!0),e.dispatch(r)}function lt(e,t,n,o,i){return st(e,"handleClickOn",t,n,o)||e.someProp("handleClick",(function(n){return n(e,t,o)}))||(i?function(e,t){if(-1==t)return!1;var n,o,i=e.state.selection;i instanceof r.NodeSelection&&(n=i.node);for(var s=e.state.doc.resolve(t),a=s.depth+1;a>0;a--){var l=a>s.depth?s.nodeAfter:s.node(a);if(r.NodeSelection.isSelectable(l)){o=n&&i.$from.depth>0&&a>=i.$from.depth&&s.before(i.$from.depth+1)==i.$from.pos?s.before(i.$from.depth):s.before(a);break}}return null!=o&&(at(e,r.NodeSelection.create(e.state.doc,o),"pointer"),!0)}(e,n):function(e,t){if(-1==t)return!1;var n=e.state.doc.resolve(t),o=n.nodeAfter;return!!(o&&o.isAtom&&r.NodeSelection.isSelectable(o))&&(at(e,new r.NodeSelection(n),"pointer"),!0)}(e,n))}function ct(e,t,n,r){return st(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",(function(n){return n(e,t,r)}))}function ut(e,t,n,o){return st(e,"handleTripleClickOn",t,n,o)||e.someProp("handleTripleClick",(function(n){return n(e,t,o)}))||function(e,t,n){if(0!=n.button)return!1;var o=e.state.doc;if(-1==t)return!!o.inlineContent&&(at(e,r.TextSelection.create(o,0,o.content.size),"pointer"),!0);for(var i=o.resolve(t),s=i.depth+1;s>0;s--){var a=s>i.depth?i.nodeAfter:i.node(s),l=i.before(s);if(a.inlineContent)at(e,r.TextSelection.create(o,l+1,l+1+a.content.size),"pointer");else{if(!r.NodeSelection.isSelectable(a))continue;at(e,r.NodeSelection.create(o,l),"pointer")}return!0}}(e,n,o)}function dt(e){return yt(e)}tt.keydown=function(e,t){if(e.shiftKey=16==t.keyCode||t.shiftKey,!ht(e,t)&&(e.lastKeyCode=t.keyCode,e.lastKeyCodeTime=Date.now(),!s.android||!s.chrome||13!=t.keyCode))if(229!=t.keyCode&&e.domObserver.forceFlush(),!s.ios||13!=t.keyCode||t.ctrlKey||t.altKey||t.metaKey)e.someProp("handleKeyDown",(function(n){return n(e,t)}))||Ie(e,t)?t.preventDefault():nt(e,"key");else{var n=Date.now();e.lastIOSEnter=n,e.lastIOSEnterFallbackTimeout=setTimeout((function(){e.lastIOSEnter==n&&(e.someProp("handleKeyDown",(function(t){return t(e,k(13,"Enter"))})),e.lastIOSEnter=0)}),200)}},tt.keyup=function(e,t){16==t.keyCode&&(e.shiftKey=!1)},tt.keypress=function(e,t){if(!(ht(e,t)||!t.charCode||t.ctrlKey&&!t.altKey||s.mac&&t.metaKey))if(e.someProp("handleKeyPress",(function(n){return n(e,t)})))t.preventDefault();else{var n=e.state.selection;if(!(n instanceof r.TextSelection&&n.$from.sameParent(n.$to))){var o=String.fromCharCode(t.charCode);e.someProp("handleTextInput",(function(t){return t(e,n.$from.pos,n.$to.pos,o)}))||e.dispatch(e.state.tr.insertText(o).scrollIntoView()),t.preventDefault()}}};var pt=s.mac?"metaKey":"ctrlKey";et.mousedown=function(e,t){e.shiftKey=t.shiftKey;var n=dt(e),r=Date.now(),o="singleClick";r-e.lastClick.time<500&&function(e,t){var n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}(t,e.lastClick)&&!t[pt]&&("singleClick"==e.lastClick.type?o="doubleClick":"doubleClick"==e.lastClick.type&&(o="tripleClick")),e.lastClick={time:r,x:t.clientX,y:t.clientY,type:o};var i=e.posAtCoords(it(t));i&&("singleClick"==o?(e.mouseDown&&e.mouseDown.done(),e.mouseDown=new ft(e,i,t,n)):("doubleClick"==o?ct:ut)(e,i.pos,i.inside,t)?t.preventDefault():nt(e,"pointer"))};var ft=function(e,t,n,o){var i,a,l=this;if(this.view=e,this.startDoc=e.state.doc,this.pos=t,this.event=n,this.flushed=o,this.selectNode=n[pt],this.allowDefault=n.shiftKey,this.delayedSelectionSync=!1,t.inside>-1)i=e.state.doc.nodeAt(t.inside),a=t.inside;else{var c=e.state.doc.resolve(t.pos);i=c.parent,a=c.depth?c.before():0}this.mightDrag=null;var u=o?null:n.target,d=u?e.docView.nearestDesc(u,!0):null;this.target=d?d.dom:null;var p=e.state.selection;(0==n.button&&i.type.spec.draggable&&!1!==i.type.spec.selectable||p instanceof r.NodeSelection&&p.from<=a&&p.to>a)&&(this.mightDrag={node:i,pos:a,addAttr:this.target&&!this.target.draggable,setUneditable:this.target&&s.gecko&&!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((function(){l.view.mouseDown==l&&l.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)),nt(e,"pointer")};function ht(e,t){return!!e.composing||!!(s.safari&&Math.abs(t.timeStamp-e.compositionEndedAt)<500)&&(e.compositionEndedAt=-2e8,!0)}ft.prototype.done=function(){var e=this;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((function(){return he(e.view)})),this.view.mouseDown=null},ft.prototype.up=function(e){if(this.done(),this.view.dom.contains(3==e.target.nodeType?e.target.parentNode:e.target)){var t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(it(e))),this.allowDefault||!t?nt(this.view,"pointer"):lt(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||s.safari&&this.mightDrag&&!this.mightDrag.node.isAtom||s.chrome&&!(this.view.state.selection instanceof r.TextSelection)&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(at(this.view,r.Selection.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):nt(this.view,"pointer")}},ft.prototype.move=function(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0),nt(this.view,"pointer"),0==e.buttons&&this.done()},et.touchdown=function(e){dt(e),nt(e,"pointer")},et.contextmenu=function(e){return dt(e)};var mt=s.android?5e3:-1;function vt(e,t){clearTimeout(e.composingTimeout),t>-1&&(e.composingTimeout=setTimeout((function(){return yt(e)}),t))}function gt(e){var t;for(e.composing&&(e.composing=!1,e.compositionEndedAt=((t=document.createEvent("Event")).initEvent("event",!0,!0),t.timeStamp));e.compositionNodes.length>0;)e.compositionNodes.pop().markParentsDirty()}function yt(e,t){if(!(s.android&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),gt(e),t||e.docView&&e.docView.dirty){var n=pe(e);return n&&!n.eq(e.state.selection)?e.dispatch(e.state.tr.setSelection(n)):e.updateState(e.state),!0}return!1}}tt.compositionstart=tt.compositionupdate=function(e){if(!e.composing){e.domObserver.flush();var t=e.state,n=t.selection.$from;if(t.selection.empty&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some((function(e){return!1===e.type.spec.inclusive}))))e.markCursor=e.state.storedMarks||n.marks(),yt(e,!0),e.markCursor=null;else if(yt(e),s.gecko&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length)for(var r=e.root.getSelection(),o=r.focusNode,i=r.focusOffset;o&&1==o.nodeType&&0!=i;){var a=i<0?o.lastChild:o.childNodes[i-1];if(!a)break;if(3==a.nodeType){r.collapse(a,a.nodeValue.length);break}o=a,i=-1}e.composing=!0}vt(e,mt)},tt.compositionend=function(e,t){e.composing&&(e.composing=!1,e.compositionEndedAt=t.timeStamp,vt(e,20))};var wt=s.ie&&s.ie_version<15||s.ios&&s.webkit_version<604;function bt(e,t,n,r){var i=Ve(e,t,n,e.shiftKey,e.state.selection.$from);if(e.someProp("handlePaste",(function(t){return t(e,r,i||o.Slice.empty)})))return!0;if(!i)return!1;var s=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(i),a=s?e.state.tr.replaceSelectionWith(s,e.shiftKey):e.state.tr.replaceSelection(i);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}et.copy=tt.cut=function(e,t){var n=e.state.selection,r="cut"==t.type;if(!n.empty){var o=wt?null:t.clipboardData,i=Le(e,n.content()),s=i.dom,a=i.text;o?(t.preventDefault(),o.clearData(),o.setData("text/html",s.innerHTML),o.setData("text/plain",a)):function(e,t){if(e.dom.parentNode){var n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";var r=getSelection(),o=document.createRange();o.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout((function(){n.parentNode&&n.parentNode.removeChild(n),e.focus()}),50)}}(e,s),r&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))}},tt.paste=function(e,t){if(!e.composing||s.android){var n=wt?null:t.clipboardData;n&&bt(e,n.getData("text/plain"),n.getData("text/html"),t)?t.preventDefault():function(e,t){if(e.dom.parentNode){var n=e.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus(),setTimeout((function(){e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?bt(e,r.value,null,t):bt(e,r.textContent,r.innerHTML,t)}),50)}}(e,t)}};var St=function(e,t){this.slice=e,this.move=t},kt=s.mac?"altKey":"ctrlKey";for(var xt in et.dragstart=function(e,t){var n=e.mouseDown;if(n&&n.done(),t.dataTransfer){var o=e.state.selection,i=o.empty?null:e.posAtCoords(it(t));if(i&&i.pos>=o.from&&i.pos<=(o instanceof r.NodeSelection?o.to-1:o.to));else if(n&&n.mightDrag)e.dispatch(e.state.tr.setSelection(r.NodeSelection.create(e.state.doc,n.mightDrag.pos)));else if(t.target&&1==t.target.nodeType){var s=e.docView.nearestDesc(t.target,!0);s&&s.node.type.spec.draggable&&s!=e.docView&&e.dispatch(e.state.tr.setSelection(r.NodeSelection.create(e.state.doc,s.posBefore)))}var a=e.state.selection.content(),l=Le(e,a),c=l.dom,u=l.text;t.dataTransfer.clearData(),t.dataTransfer.setData(wt?"Text":"text/html",c.innerHTML),t.dataTransfer.effectAllowed="copyMove",wt||t.dataTransfer.setData("text/plain",u),e.dragging=new St(a,!t[kt])}},et.dragend=function(e){var t=e.dragging;window.setTimeout((function(){e.dragging==t&&(e.dragging=null)}),50)},tt.dragover=tt.dragenter=function(e,t){return t.preventDefault()},tt.drop=function(e,t){var n=e.dragging;if(e.dragging=null,t.dataTransfer){var s=e.posAtCoords(it(t));if(s){var a=e.state.doc.resolve(s.pos);if(a){var l=n&&n.slice;l?e.someProp("transformPasted",(function(e){l=e(l)})):l=Ve(e,t.dataTransfer.getData(wt?"Text":"text/plain"),wt?null:t.dataTransfer.getData("text/html"),!1,a);var c=n&&!t[kt];if(e.someProp("handleDrop",(function(n){return n(e,t,l||o.Slice.empty,c)})))t.preventDefault();else if(l){t.preventDefault();var u=l?Object(i.dropPoint)(e.state.doc,a.pos,l):a.pos;null==u&&(u=a.pos);var d=e.state.tr;c&&d.deleteSelection();var p=d.mapping.map(u),f=0==l.openStart&&0==l.openEnd&&1==l.content.childCount,h=d.doc;if(f?d.replaceRangeWith(p,p,l.content.firstChild):d.replaceRange(p,p,l),!d.doc.eq(h)){var m=d.doc.resolve(p);if(f&&r.NodeSelection.isSelectable(l.content.firstChild)&&m.nodeAfter&&m.nodeAfter.sameMarkup(l.content.firstChild))d.setSelection(new r.NodeSelection(m));else{var v=d.mapping.map(u);d.mapping.maps[d.mapping.maps.length-1].forEach((function(e,t,n,r){return v=r})),d.setSelection(Se(e,m,d.doc.resolve(v)))}e.focus(),e.dispatch(d.setMeta("uiEvent","drop"))}}}}}},et.focus=function(e){e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout((function(){e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.root.getSelection())&&he(e)}),20))},et.blur=function(e,t){e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),t.relatedTarget&&e.dom.contains(t.relatedTarget)&&e.domObserver.currentSelection.set({}),e.focused=!1)},et.beforeinput=function(e,t){if(s.chrome&&s.android&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();var n=e.domChangeCount;setTimeout((function(){if(e.domChangeCount==n&&(e.dom.blur(),e.focus(),!e.someProp("handleKeyDown",(function(t){return t(e,k(8,"Backspace"))})))){var t=e.state.selection.$cursor;t&&t.pos>0&&e.dispatch(e.state.tr.delete(t.pos-1,t.pos).scrollIntoView())}}),50)}},tt)et[xt]=tt[xt];function Ct(e,t){if(e==t)return!0;for(var n in e)if(e[n]!==t[n])return!1;for(var r in t)if(!(r in e))return!1;return!0}var Mt=function(e,t){this.spec=t||Rt,this.side=this.spec.side||0,this.toDOM=e};Mt.prototype.map=function(e,t,n,r){var o=e.mapResult(t.from+r,this.side<0?-1:1),i=o.pos;return o.deleted?null:new At(i-n,i-n,this)},Mt.prototype.valid=function(){return!0},Mt.prototype.eq=function(e){return this==e||e instanceof Mt&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ct(this.spec,e.spec))},Mt.prototype.destroy=function(e){this.spec.destroy&&this.spec.destroy(e)};var Ot=function(e,t){this.spec=t||Rt,this.attrs=e};Ot.prototype.map=function(e,t,n,r){var o=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,i=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return o>=i?null:new At(o,i,this)},Ot.prototype.valid=function(e,t){return t.from<t.to},Ot.prototype.eq=function(e){return this==e||e instanceof Ot&&Ct(this.attrs,e.attrs)&&Ct(this.spec,e.spec)},Ot.is=function(e){return e.type instanceof Ot};var Tt=function(e,t){this.spec=t||Rt,this.attrs=e};Tt.prototype.map=function(e,t,n,r){var o=e.mapResult(t.from+r,1);if(o.deleted)return null;var i=e.mapResult(t.to+r,-1);return i.deleted||i.pos<=o.pos?null:new At(o.pos-n,i.pos-n,this)},Tt.prototype.valid=function(e,t){var n,r=e.content.findIndex(t.from),o=r.index,i=r.offset;return i==t.from&&!(n=e.child(o)).isText&&i+n.nodeSize==t.to},Tt.prototype.eq=function(e){return this==e||e instanceof Tt&&Ct(this.attrs,e.attrs)&&Ct(this.spec,e.spec)};var At=function(e,t,n){this.from=e,this.to=t,this.type=n},Nt={spec:{configurable:!0},inline:{configurable:!0}};At.prototype.copy=function(e,t){return new At(e,t,this.type)},At.prototype.eq=function(e,t){return void 0===t&&(t=0),this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to},At.prototype.map=function(e,t,n){return this.type.map(e,this,t,n)},At.widget=function(e,t,n){return new At(e,e,new Mt(t,n))},At.inline=function(e,t,n,r){return new At(e,t,new Ot(n,r))},At.node=function(e,t,n,r){return new At(e,t,new Tt(n,r))},Nt.spec.get=function(){return this.type.spec},Nt.inline.get=function(){return this.type instanceof Ot},Object.defineProperties(At.prototype,Nt);var Dt=[],Rt={},Et=function(e,t){this.local=e&&e.length?e:Dt,this.children=t&&t.length?t:Dt};Et.create=function(e,t){return t.length?Ft(t,e,0,Rt):_t},Et.prototype.find=function(e,t,n){var r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r},Et.prototype.findInner=function(e,t,n,r,o){for(var i=0;i<this.local.length;i++){var s=this.local[i];s.from<=t&&s.to>=e&&(!o||o(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(var a=0;a<this.children.length;a+=3)if(this.children[a]<t&&this.children[a+1]>e){var l=this.children[a]+1;this.children[a+2].findInner(e-l,t-l,n,r+l,o)}},Et.prototype.map=function(e,t,n){return this==_t||0==e.maps.length?this:this.mapInner(e,t,0,0,n||Rt)},Et.prototype.mapInner=function(e,t,n,r,o){for(var i,s=0;s<this.local.length;s++){var a=this.local[s].map(e,n,r);a&&a.type.valid(t,a)?(i||(i=[])).push(a):o.onRemove&&o.onRemove(this.local[s].spec)}return this.children.length?function(e,t,n,r,o,i,s){for(var a=e.slice(),l=function(e,t,n,r){for(var s=0;s<a.length;s+=3){var l=a[s+1],c=void 0;if(!(l<0||e>l+i)){var u=a[s]+i;t>=u?a[s+1]=e<=u?-2:-1:n>=o&&(c=r-n-(t-e))&&(a[s]+=c,a[s+1]+=c)}}},c=0;c<n.maps.length;c++)n.maps[c].forEach(l);for(var u=!1,d=0;d<a.length;d+=3)if(a[d+1]<0){if(-2==a[d+1]){u=!0,a[d+1]=-1;continue}var p=n.map(e[d]+i),f=p-o;if(f<0||f>=r.content.size){u=!0;continue}var h=n.map(e[d+1]+i,-1)-o,m=r.content.findIndex(f),v=m.index,g=m.offset,y=r.maybeChild(v);if(y&&g==f&&g+y.nodeSize==h){var w=a[d+2].mapInner(n,y,p+1,e[d]+i+1,s);w!=_t?(a[d]=f,a[d+1]=h,a[d+2]=w):(a[d+1]=-2,u=!0)}else u=!0}if(u){var b=Ft(function(e,t,n,r,o,i,s){function a(e,t){for(var i=0;i<e.local.length;i++){var l=e.local[i].map(r,o,t);l?n.push(l):s.onRemove&&s.onRemove(e.local[i].spec)}for(var c=0;c<e.children.length;c+=3)a(e.children[c+2],e.children[c]+t+1)}for(var l=0;l<e.length;l+=3)-1==e[l+1]&&a(e[l+2],t[l]+i+1);return n}(a,e,t||[],n,o,i,s),r,0,s);t=b.local;for(var S=0;S<a.length;S+=3)a[S+1]<0&&(a.splice(S,3),S-=3);for(var k=0,x=0;k<b.children.length;k+=3){for(var C=b.children[k];x<a.length&&a[x]<C;)x+=3;a.splice(x,0,b.children[k],b.children[k+1],b.children[k+2])}}return new Et(t&&t.sort(Bt),a)}(this.children,i,e,t,n,r,o):i?new Et(i.sort(Bt)):_t},Et.prototype.add=function(e,t){return t.length?this==_t?Et.create(e,t):this.addInner(e,t,0):this},Et.prototype.addInner=function(e,t,n){var r,o=this,i=0;e.forEach((function(e,s){var a,l=s+n;if(a=Pt(t,e,l)){for(r||(r=o.children.slice());i<r.length&&r[i]<s;)i+=3;r[i]==s?r[i+2]=r[i+2].addInner(e,a,l+1):r.splice(i,0,s,s+e.nodeSize,Ft(a,e,l+1,Rt)),i+=3}}));for(var s=It(i?$t(t):t,-n),a=0;a<s.length;a++)s[a].type.valid(e,s[a])||s.splice(a--,1);return new Et(s.length?this.local.concat(s).sort(Bt):this.local,r||this.children)},Et.prototype.remove=function(e){return 0==e.length||this==_t?this:this.removeInner(e,0)},Et.prototype.removeInner=function(e,t){for(var n=this.children,r=this.local,o=0;o<n.length;o+=3){for(var i=void 0,s=n[o]+t,a=n[o+1]+t,l=0,c=void 0;l<e.length;l++)(c=e[l])&&c.from>s&&c.to<a&&(e[l]=null,(i||(i=[])).push(c));if(i){n==this.children&&(n=this.children.slice());var u=n[o+2].removeInner(i,s+1);u!=_t?n[o+2]=u:(n.splice(o,3),o-=3)}}if(r.length)for(var d=0,p=void 0;d<e.length;d++)if(p=e[d])for(var f=0;f<r.length;f++)r[f].eq(p,t)&&(r==this.local&&(r=this.local.slice()),r.splice(f--,1));return n==this.children&&r==this.local?this:r.length||n.length?new Et(r,n):_t},Et.prototype.forChild=function(e,t){if(this==_t)return this;if(t.isLeaf)return Et.empty;for(var n,r,o=0;o<this.children.length;o+=3)if(this.children[o]>=e){this.children[o]==e&&(n=this.children[o+2]);break}for(var i=e+1,s=i+t.content.size,a=0;a<this.local.length;a++){var l=this.local[a];if(l.from<s&&l.to>i&&l.type instanceof Ot){var c=Math.max(i,l.from)-i,u=Math.min(s,l.to)-i;c<u&&(r||(r=[])).push(l.copy(c,u))}}if(r){var d=new Et(r.sort(Bt));return n?new zt([d,n]):d}return n||_t},Et.prototype.eq=function(e){if(this==e)return!0;if(!(e instanceof Et)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(var t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(var n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0},Et.prototype.locals=function(e){return Lt(this.localsInner(e))},Et.prototype.localsInner=function(e){if(this==_t)return Dt;if(e.inlineContent||!this.local.some(Ot.is))return this.local;for(var t=[],n=0;n<this.local.length;n++)this.local[n].type instanceof Ot||t.push(this.local[n]);return t};var _t=new Et;Et.empty=_t,Et.removeOverlap=Lt;var zt=function(e){this.members=e};function It(e,t){if(!t||!e.length)return e;for(var n=[],r=0;r<e.length;r++){var o=e[r];n.push(new At(o.from+t,o.to+t,o.type))}return n}function Pt(e,t,n){if(t.isLeaf)return null;for(var r=n+t.nodeSize,o=null,i=0,s=void 0;i<e.length;i++)(s=e[i])&&s.from>n&&s.to<r&&((o||(o=[])).push(s),e[i]=null);return o}function $t(e){for(var t=[],n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function Ft(e,t,n,r){var o=[],i=!1;t.forEach((function(t,s){var a=Pt(e,t,s+n);if(a){i=!0;var l=Ft(a,t,n+s+1,r);l!=_t&&o.push(s,s+t.nodeSize,l)}}));for(var s=It(i?$t(e):e,-n).sort(Bt),a=0;a<s.length;a++)s[a].type.valid(t,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||o.length?new Et(s,o):_t}function Bt(e,t){return e.from-t.from||e.to-t.to}function Lt(e){for(var t=e,n=0;n<t.length-1;n++){var r=t[n];if(r.from!=r.to)for(var o=n+1;o<t.length;o++){var i=t[o];if(i.from!=r.from){i.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,i.from),Vt(t,o,r.copy(i.from,r.to)));break}i.to!=r.to&&(t==e&&(t=e.slice()),t[o]=i.copy(i.from,r.to),Vt(t,o+1,i.copy(r.to,i.to)))}}return t}function Vt(e,t,n){for(;t<e.length&&Bt(n,e[t])>0;)t++;e.splice(t,0,n)}function jt(e){var t=[];return e.someProp("decorations",(function(n){var r=n(e.state);r&&r!=_t&&t.push(r)})),e.cursorWrapper&&t.push(Et.create(e.state.doc,[e.cursorWrapper.deco])),zt.from(t)}zt.prototype.map=function(e,t){var n=this.members.map((function(n){return n.map(e,t,Rt)}));return zt.from(n)},zt.prototype.forChild=function(e,t){if(t.isLeaf)return Et.empty;for(var n=[],r=0;r<this.members.length;r++){var o=this.members[r].forChild(e,t);o!=_t&&(o instanceof zt?n=n.concat(o.members):n.push(o))}return zt.from(n)},zt.prototype.eq=function(e){if(!(e instanceof zt)||e.members.length!=this.members.length)return!1;for(var t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0},zt.prototype.locals=function(e){for(var t,n=!0,r=0;r<this.members.length;r++){var o=this.members[r].localsInner(e);if(o.length)if(t){n&&(t=t.slice(),n=!1);for(var i=0;i<o.length;i++)t.push(o[i])}else t=o}return t?Lt(n?t:t.sort(Bt)):Dt},zt.from=function(e){switch(e.length){case 0:return _t;case 1:return e[0];default:return new zt(e)}};var Ht=function(e,t){this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Ut),this.dispatch=this.dispatch.bind(this),this._root=null,this.focused=!1,this.trackWrites=null,this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):e.apply?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Jt(this),this.markCursor=null,this.cursorWrapper=null,qt(this),this.nodeViews=Xt(this),this.docView=G(this.state.doc,Kt(this),jt(this),this.dom,this),this.lastSelectedViewDesc=null,this.dragging=null,function(e){e.shiftKey=!1,e.mouseDown=null,e.lastKeyCode=null,e.lastKeyCodeTime=0,e.lastClick={time:0,x:0,y:0,type:""},e.lastSelectionOrigin=null,e.lastSelectionTime=0,e.lastIOSEnter=0,e.lastIOSEnterFallbackTimeout=null,e.lastAndroidDelete=0,e.composing=!1,e.composingTimeout=null,e.compositionNodes=[],e.compositionEndedAt=-2e8,e.domObserver=new Qe(e,(function(t,n,r,o){return $e(e,t,n,r,o)})),e.domObserver.start(),e.domChangeCount=0,e.eventHandlers=Object.create(null);var t=function(t){var n=et[t];e.dom.addEventListener(t,e.eventHandlers[t]=function(t){!function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(var n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}(e,t)||ot(e,t)||!e.editable&&t.type in tt||n(e,t)})};for(var n in et)t(n);s.safari&&e.dom.addEventListener("input",(function(){return null})),rt(e)}(this),this.prevDirectPlugins=[],this.pluginViews=[],this.updatePluginViews()},Wt={props:{configurable:!0},root:{configurable:!0},isDestroyed:{configurable:!0}};function Kt(e){var t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),t.translate="no",e.someProp("attributes",(function(n){if("function"==typeof n&&(n=n(e.state)),n)for(var r in n)"class"==r&&(t.class+=" "+n[r]),"style"==r?t.style=(t.style?t.style+";":"")+n[r]:t[r]||"contenteditable"==r||"nodeName"==r||(t[r]=String(n[r]))})),[At.node(0,e.state.doc.content.size,t)]}function qt(e){if(e.markCursor){var t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:At.widget(e.state.selection.head,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function Jt(e){return!e.someProp("editable",(function(t){return!1===t(e.state)}))}function Xt(e){var t={};return e.someProp("nodeViews",(function(e){for(var n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])})),t}function Ut(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}Wt.props.get=function(){if(this._props.state!=this.state){var e=this._props;for(var t in this._props={},e)this._props[t]=e[t];this._props.state=this.state}return this._props},Ht.prototype.update=function(e){e.handleDOMEvents!=this._props.handleDOMEvents&&rt(this),this._props=e,e.plugins&&(e.plugins.forEach(Ut),this.directPlugins=e.plugins),this.updateStateInner(e.state,!0)},Ht.prototype.setProps=function(e){var t={};for(var n in this._props)t[n]=this._props[n];for(var r in t.state=this.state,e)t[r]=e[r];this.update(t)},Ht.prototype.updateState=function(e){this.updateStateInner(e,this.state.plugins!=e.plugins)},Ht.prototype.updateStateInner=function(e,t){var n=this,o=this.state,i=!1,a=!1;if(e.storedMarks&&this.composing&&(gt(this),a=!0),this.state=e,t){var l=Xt(this);(function(e,t){var n=0,r=0;for(var o in e){if(e[o]!=t[o])return!0;n++}for(var i in t)r++;return n!=r})(l,this.nodeViews)&&(this.nodeViews=l,i=!0),rt(this)}this.editable=Jt(this),qt(this);var c=jt(this),u=Kt(this),d=t?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",p=i||!this.docView.matchesNode(e.doc,u,c);!p&&e.selection.eq(o.selection)||(a=!0);var f,h,m,g,y,w,b,S,k,x,C,M="preserve"==d&&a&&null==this.dom.style.overflowAnchor&&function(e){for(var t,n,r=e.dom.getBoundingClientRect(),o=Math.max(0,r.top),i=(r.left+r.right)/2,s=o+1;s<Math.min(innerHeight,r.bottom);s+=5){var a=e.root.elementFromPoint(i,s);if(a!=e.dom&&e.dom.contains(a)){var l=a.getBoundingClientRect();if(l.top>=o-20){t=a,n=l.top;break}}}return{refDOM:t,refTop:n,stack:T(e.dom)}}(this);if(a){this.domObserver.stop();var N=p&&(s.ie||s.chrome)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&(g=o.selection,y=e.selection,w=Math.min(g.$anchor.sharedDepth(g.head),y.$anchor.sharedDepth(y.head)),g.$anchor.start(w)!=y.$anchor.start(w));if(p){var D=s.chrome?this.trackWrites=this.root.getSelection().focusNode:null;!i&&this.docView.update(e.doc,u,c,this)||(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=G(e.doc,u,c,this.dom,this)),D&&!this.trackWrites&&(N=!0)}N||!(this.mouseDown&&this.domObserver.currentSelection.eq(this.root.getSelection())&&(f=this,h=f.docView.domFromPos(f.state.selection.anchor,0),m=f.root.getSelection(),v(h.node,h.offset,m.anchorNode,m.anchorOffset)))?he(this,N):(we(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}if(this.updatePluginViews(o),"reset"==d)this.dom.scrollTop=0;else if("to selection"==d){var R=this.root.getSelection().focusNode;this.someProp("handleScrollToSelection",(function(e){return e(n)}))||(e.selection instanceof r.NodeSelection?O(this,this.docView.domAfterPos(e.selection.from).getBoundingClientRect(),R):O(this,this.coordsAtPos(e.selection.head,1),R))}else M&&(S=(b=M).refDOM,k=b.refTop,x=b.stack,C=S?S.getBoundingClientRect().top:0,A(x,0==C?0:C-k))},Ht.prototype.destroyPluginViews=function(){for(var e;e=this.pluginViews.pop();)e.destroy&&e.destroy()},Ht.prototype.updatePluginViews=function(e){if(e&&e.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(var t=0;t<this.pluginViews.length;t++){var n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(var r=0;r<this.directPlugins.length;r++){var o=this.directPlugins[r];o.spec.view&&this.pluginViews.push(o.spec.view(this))}for(var i=0;i<this.state.plugins.length;i++){var s=this.state.plugins[i];s.spec.view&&this.pluginViews.push(s.spec.view(this))}}},Ht.prototype.someProp=function(e,t){var n,r=this._props&&this._props[e];if(null!=r&&(n=t?t(r):r))return n;for(var o=0;o<this.directPlugins.length;o++){var i=this.directPlugins[o].props[e];if(null!=i&&(n=t?t(i):i))return n}var s=this.state.plugins;if(s)for(var a=0;a<s.length;a++){var l=s[a].props[e];if(null!=l&&(n=t?t(l):l))return n}},Ht.prototype.hasFocus=function(){return this.root.activeElement==this.dom},Ht.prototype.focus=function(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(N)return e.focus(N);var t=T(e);e.focus(null==N?{get preventScroll(){return N={preventScroll:!0},!0}}:void 0),N||(N=!1,A(t,0))}(this.dom),he(this),this.domObserver.start()},Wt.root.get=function(){var e=this._root;if(null==e)for(var t=this.dom.parentNode;t;t=t.parentNode)if(9==t.nodeType||11==t.nodeType&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=function(){return document.getSelection()}),this._root=t;return e||document},Ht.prototype.posAtCoords=function(e){return E(this,e)},Ht.prototype.coordsAtPos=function(e,t){return void 0===t&&(t=1),I(this,e,t)},Ht.prototype.domAtPos=function(e,t){return void 0===t&&(t=0),this.docView.domFromPos(e,t)},Ht.prototype.nodeDOM=function(e){var t=this.docView.descAt(e);return t?t.nodeDOM:null},Ht.prototype.posAtDOM=function(e,t,n){void 0===n&&(n=-1);var r=this.docView.posFromDOM(e,t,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r},Ht.prototype.endOfTextblock=function(e,t){return H(this,t||this.state,e)},Ht.prototype.destroy=function(){this.docView&&(!function(e){for(var t in e.domObserver.stop(),e.eventHandlers)e.dom.removeEventListener(t,e.eventHandlers[t]);clearTimeout(e.composingTimeout),clearTimeout(e.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],jt(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)},Wt.isDestroyed.get=function(){return null==this.docView},Ht.prototype.dispatchEvent=function(e){return function(e,t){ot(e,t)||!et[t.type]||!e.editable&&t.type in tt||et[t.type](e,t)}(this,e)},Ht.prototype.dispatch=function(e){var t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))},Object.defineProperties(Ht.prototype,Wt)},function(e,t,n){"use strict";n.r(t),n.d(t,"__extends",(function(){return o})),n.d(t,"__assign",(function(){return i})),n.d(t,"__rest",(function(){return s})),n.d(t,"__decorate",(function(){return a})),n.d(t,"__param",(function(){return l})),n.d(t,"__metadata",(function(){return c})),n.d(t,"__awaiter",(function(){return u})),n.d(t,"__generator",(function(){return d})),n.d(t,"__createBinding",(function(){return p})),n.d(t,"__exportStar",(function(){return f})),n.d(t,"__values",(function(){return h})),n.d(t,"__read",(function(){return m})),n.d(t,"__spread",(function(){return v})),n.d(t,"__spreadArrays",(function(){return g})),n.d(t,"__await",(function(){return y})),n.d(t,"__asyncGenerator",(function(){return w})),n.d(t,"__asyncDelegator",(function(){return b})),n.d(t,"__asyncValues",(function(){return S})),n.d(t,"__makeTemplateObject",(function(){return k})),n.d(t,"__importStar",(function(){return x})),n.d(t,"__importDefault",(function(){return C})),n.d(t,"__classPrivateFieldGet",(function(){return M})),n.d(t,"__classPrivateFieldSet",(function(){return O}));
|
|
2
2
|
/*! *****************************************************************************
|
|
3
3
|
Copyright (c) Microsoft Corporation.
|
|
4
4
|
|
|
@@ -13,4 +13,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
13
13
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
14
|
PERFORMANCE OF THIS SOFTWARE.
|
|
15
15
|
***************************************************************************** */
|
|
16
|
-
var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function o(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var i=function(){return(i=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function s(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n}function a(t,e,n,r){var o,i=arguments.length,s=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,n,s):o(e,n))||s);return i>3&&s&&Object.defineProperty(e,n,s),s}function c(t,e){return function(n,r){e(n,r,t)}}function l(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function u(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{c(r.next(t))}catch(t){i(t)}}function a(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))}function p(t,e){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function f(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}function d(t,e){for(var n in t)"default"===n||e.hasOwnProperty(n)||(e[n]=t[n])}function h(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function m(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s}function v(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(m(arguments[e]));return t}function g(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),o=0;for(e=0;e<n;e++)for(var i=arguments[e],s=0,a=i.length;s<a;s++,o++)r[o]=i[s];return r}function y(t){return this instanceof y?(this.v=t,this):new y(t)}function w(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,o=n.apply(t,e||[]),i=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(t){o[t]&&(r[t]=function(e){return new Promise((function(n,r){i.push([t,e,n,r])>1||a(t,e)}))})}function a(t,e){try{(n=o[t](e)).value instanceof y?Promise.resolve(n.value.v).then(c,l):u(i[0][2],n)}catch(t){u(i[0][3],t)}var n}function c(t){a("next",t)}function l(t){a("throw",t)}function u(t,e){t(e),i.shift(),i.length&&a(i[0][0],i[0][1])}}function b(t){var e,n;return e={},r("next"),r("throw",(function(t){throw t})),r("return"),e[Symbol.iterator]=function(){return this},e;function r(r,o){e[r]=t[r]?function(e){return(n=!n)?{value:y(t[r](e)),done:"return"===r}:o?o(e):e}:o}}function S(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=h(t),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(n){e[n]=t[n]&&function(e){return new Promise((function(r,o){(function(t,e,n,r){Promise.resolve(r).then((function(e){t({value:e,done:n})}),e)})(r,o,(e=t[n](e)).done,e.value)}))}}}function k(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function x(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function C(t){return t&&t.__esModule?t:{default:t}}function M(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function O(t,e,n){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,n),n}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(10);e.changeStylesString=function(t,e){var n=e.style,r=e.value,o=e.newValue;if(!t)return{changed:!1,style:null};var i=t.split(/\s*;\s*/).filter((function(t){return Boolean(t)})),s=i.filter((function(t){var e=t.split(/\s*:\s*/);return!(e[0].toLowerCase()===n&&r.test(e[1]))}));return o&&s.push(n+": "+o),{style:s.join("; ")+(s.length?";":""),changed:Boolean(o)||s.length!==i.length}},e.canInsert=function(t,e){for(var n=t.selection.$from,r=n.depth;r>=0;r--){var o=n.index(r);if(n.node(r).canReplaceWith(o,o,e))return!0}return!1};var s=function(t){return t instanceof r.Node?t.type.name:t.name};e.findNthParentNodeOfType=function(t,e){return void 0===e&&(e=1),function(n){return function(t,e){return void 0===e&&(e=1),function(n){for(var r=n.$from,o=r.depth;o>0;o--){var i=r.node(o);if(t(i)&&0===(e-=1))return{depth:o,node:i}}}}((function(e){return s(e)===s(t)}),e)(n)}},e.insertNode=function(t,e){return function(n,r){var o=n.tr.replaceSelectionWith(t);e&&o.scrollIntoView(),r(o)}},e.hasSameMarkup=function(t,e,n,o){var s=r.Fragment.from(i.parseContent(t,n,o)),a=r.Fragment.from(i.parseContent(e,n,o));return s.eq(a)},e.getSelectionText=function(t){var e=t.selection;if(e instanceof o.TextSelection||e instanceof o.AllSelection){var n=e.content().content;return n.textBetween(0,n.size)}return""},e.getNodeFromSelection=function(t){if(t.selection instanceof o.NodeSelection)return t.selection.node},e.selectedLineTextOnly=function(t){var n="",r=!1,o=t.selection,i=t.doc,s=o.$from,a=o.$to,c=o.from,l=o.to;return s.sameParent(a)&&(i.nodesBetween(c,l,(function(t){r=r||t.isLeaf&&!t.isText})),r||(n=e.getSelectionText(t))),n},e.indentHtml=function(t){return t.replace(/<\/(p|li|ul|ol|h[1-6]|table|tr|td|th)>/gi,"</$1>\n").replace(/<(ul|ol)([^>]*)><li/gi,"<$1$2>\n<li").replace(/<br \/>/gi,"<br />\n").replace(/\n$/,"")},e.shallowEqual=function(t,e){var n=Object.keys(t),r=Object.keys(e);return n.length===r.length&&n.every((function(n){return t[n]===e[n]}))};var a={before:/[^ !,?.\[\]{}()]+$/i,after:/^[^ !,?.\[\]{}()]+/i};e.expandSelection=function(t,e,n){if(!n.applyToWord||!t.selection.empty)return{state:t,dispatch:e};var r=!0===n.applyToWord?a:n.applyToWord,i=null,s=t.tr,c=t.selection,l=c.$head.nodeBefore,u=c.$head.nodeAfter;if(l&&"text"===l.type.name&&l.text&&u&&"text"===u.type.name&&u.text){var p=[];c.$head.parent.descendants((function(t,e){return p.push({node:t,pos:e}),!1}));for(var f=c.$head.parentOffset,d=p.findIndex((function(t){var e=t.node,n=t.pos;return n<=f&&n+e.nodeSize>=f})),h=p[d].node.text,m=!1,v=d-1;v>=0;v--){var g=p[v];!m&&g&&"text"===g.node.type.name?h=g.node.text+h:(m=!0,f-=g.node.nodeSize)}for(v=d+1;v<p.length;v++){if(!(g=p[v])||"text"!==g.node.type.name)break;h+=g.node.text}var y=h.substring(0,f),w=h.substring(f),b=r.before.exec(y),S=r.after.exec(w);if(b&&S){var k=b[0].length,x=S[0].length,C=i=c.from;s.setSelection(o.TextSelection.create(t.doc,C-k,C+x));return{state:{tr:s,selection:s.selection,doc:s.doc,storedMarks:null,schema:s.doc.type.schema},dispatch:function(t){t.setSelection(o.TextSelection.create(t.doc,i)),e(t)}}}}return{state:t,dispatch:e}},e.expandToWordWrap=function(t,n){return function(r,o,i){var s=e.expandSelection(r,o,n),a=s.state,c=s.dispatch;return t(n)(a,c)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(2),o=n(0);e.markApplies=function(t,e,n){for(var r=function(r){var o=e[r],i=o.$from,s=o.$to,a=0===i.depth&&t.type.allowsMarkType(n);if(t.nodesBetween(i.pos,s.pos,(function(t){if(a)return!1;a=t.inlineContent&&t.type.allowsMarkType(n)})),a)return{v:!0}},o=0;o<e.length;o++){var i=r(o);if(i)return i.v}return!1},e.toggleMark=function(t,n,r){return function(o,i){var s=o.selection,a=s.empty,c=s.$cursor,l=s.ranges;if(a&&!c||!e.markApplies(o.doc,l,t))return!1;if(i)if(c)t.isInSet(o.storedMarks||c.marks())?i(r.removeStoredMark(t)):i(r.addStoredMark(t.create(n)));else{for(var u=!1,p=0;!u&&p<l.length;p++){var f=l[p],d=f.$from,h=f.$to;u=o.doc.rangeHasMark(d.pos,h.pos,t)}for(p=0;p<l.length;p++){var m=l[p];d=m.$from,h=m.$to;u?r.removeMark(d.pos,h.pos,t):r.addMark(d.pos,h.pos,t.create(n))}i(r.scrollIntoView())}return!0}},e.removeMark=function(t,e,n,i){void 0===i&&(i=null);var s=[],a=0;return t.doc.nodesBetween(e,n,(function(t,r){if(t.isInline){a++;var c=null;if(i instanceof o.MarkType){var l=i.isInSet(t.marks);l&&(c=[l])}else i?i.isInSet(t.marks)&&(c=[i]):c=t.marks;if(c&&c.length)for(var u=Math.min(r+t.nodeSize,n),p=0;p<c.length;p++){for(var f=c[p],d=void 0,h=0;h<s.length;h++){var m=s[h];m.step===a-1&&f.eq(m.style)&&(d=m)}d?(d.to=u,d.step=a):s.push({style:f,from:Math.max(r,e),to:u,step:a})}}})),s.forEach((function(e){return t.step(new r.RemoveMarkStep(e.from,e.to,e.style))})),t},e.removeMarks=function(t,n,r,o){var i=n.selection,s=i.$cursor,a=i.ranges;if(o=o||n.tr,s)t.forEach((function(t){t.isInSet(n.storedMarks||s.marks())&&r(o.removeStoredMark(t))}));else{for(var c=function(n){var r=a[n],i=r.$from,s=r.$to;t.forEach((function(t){e.removeMark(o,i.pos,s.pos,t)}))},l=0;l<a.length;l++)c(l);r(o.scrollIntoView())}return!0};e.removeAllMarks=function(t){var n=(void 0===t?{}:t).except,r=void 0===n?[]:n;return function(t,n){var o,i=t.tr;e.cleanMarks(i,{except:(o=r,o instanceof Array?o:[o])}),i.docChanged&&n(i)}},e.cleanMarks=function(t,e){var n=e.except,r=t.doc,o=t.selection,i=r.type.schema,s=o.empty,a=o.ranges,c=(n||[]).map((function(t){return t.name}));if(!s){var l=Object.keys(i.marks).map((function(t){return i.marks[t]})).filter((function(t){return-1===c.indexOf(t.name)}));a.forEach((function(e){var n=e.$from,r=e.$to;l.forEach((function(e){return t.removeMark(n.pos,r.pos,e)}))}))}},e.hasMark=function(t,n){var r,o=t.schema.marks,i=(n.altMarks||[]).filter((function(t){return o[t]})),s=n.altStyle,a=t.selection,c=a.from,l=a.$from,u=a.to,p=a.empty,f=o[n.mark],d=t.doc,h=!1;return p?(r=t.storedMarks||l.marks(),h=f&&f.isInSet(r)||i.some((function(t){return o[t].isInSet(r)}))):h=f&&d.rangeHasMark(c,u,f)||i.some((function(t){return d.rangeHasMark(c,u,o[t])})),!h&&s&&o.style?e.selectionMarks(t,o.style).some((function(t){return null!==e.styleValue(t,s)})):Boolean(h)},e.styleValue=function(t,e){for(var n=(t&&t.attrs.style||"").split(/\s*;\s*/).filter((function(t){return Boolean(t)})),r=0;r<n.length;r++){var o=n[r].split(/\s*:\s*/);if(o[0].toLowerCase()===e.name&&e.value.test(o[1]))return o[1]}return null},e.selectionMarks=function(t,e){var n=t.selection,r=n.from,o=n.$from,i=n.to,s=n.empty,a=[];return s?a.push(e.isInSet(t.storedMarks||o.marks())):t.doc.nodesBetween(r,i,(function(t){t.isInline&&a.push(e.isInSet(t.marks))})),a},e.getMark=function(t,n){var r=e.selectionMarks(t,n),o=r.filter((function(t){return Boolean(t)}));return r.length===o.length?r[0]:void 0},e.getActiveMarks=function(t,n){var r=e.selectionMarks(t,n),o=r.filter((function(t){return Boolean(t)}));return{hasNodesWithoutMarks:r.length!==o.length,marks:o}}},function(t,e,n){"use strict";n.r(e),n.d(e,"keydownHandler",(function(){return y})),n.d(e,"keymap",(function(){return g}));for(var r={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:"'",229:"q"},o={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"',229:"Q"},i="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),s="undefined"!=typeof navigator&&/Apple Computer/.test(navigator.vendor),a="undefined"!=typeof navigator&&/Gecko\/\d+/.test(navigator.userAgent),c="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),l="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),u=i&&(c||+i[1]<57)||a&&c,p=0;p<10;p++)r[48+p]=r[96+p]=String(p);for(p=1;p<=24;p++)r[p+111]="F"+p;for(p=65;p<=90;p++)r[p]=String.fromCharCode(p+32),o[p]=String.fromCharCode(p);for(var f in r)o.hasOwnProperty(f)||(o[f]=r[f]);var d=n(1),h="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform);function m(t){var e,n,r,o,i=t.split(/-(?!$)/),s=i[i.length-1];"Space"==s&&(s=" ");for(var a=0;a<i.length-1;a++){var c=i[a];if(/^(cmd|meta|m)$/i.test(c))o=!0;else if(/^a(lt)?$/i.test(c))e=!0;else if(/^(c|ctrl|control)$/i.test(c))n=!0;else if(/^s(hift)?$/i.test(c))r=!0;else{if(!/^mod$/i.test(c))throw new Error("Unrecognized modifier name: "+c);h?o=!0:n=!0}}return e&&(s="Alt-"+s),n&&(s="Ctrl-"+s),o&&(s="Meta-"+s),r&&(s="Shift-"+s),s}function v(t,e,n){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),!1!==n&&e.shiftKey&&(t="Shift-"+t),t}function g(t){return new d.Plugin({props:{handleKeyDown:y(t)}})}function y(t){var e=function(t){var e=Object.create(null);for(var n in t)e[m(n)]=t[n];return e}(t);return function(t,n){var i,a=function(t){var e=!(u&&(t.ctrlKey||t.altKey||t.metaKey)||(s||l)&&t.shiftKey&&t.key&&1==t.key.length)&&t.key||(t.shiftKey?o:r)[t.keyCode]||t.key||"Unidentified";return"Esc"==e&&(e="Escape"),"Del"==e&&(e="Delete"),"Left"==e&&(e="ArrowLeft"),"Up"==e&&(e="ArrowUp"),"Right"==e&&(e="ArrowRight"),"Down"==e&&(e="ArrowDown"),e}(n),c=1==a.length&&" "!=a,p=e[v(a,n,!c)];if(p&&p(t.state,t.dispatch,t))return!0;if(c&&(n.shiftKey||n.altKey||n.metaKey||a.charCodeAt(0)>127)&&(i=r[n.keyCode])&&i!=a){var f=e[v(i,n,!0)];if(f&&f(t.state,t.dispatch,t))return!0}else if(c&&n.shiftKey){var d=e[v(a,n,!0)];if(d&&d(t.state,t.dispatch,t))return!0}return!1}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(4),o=n(5),i=n(2),s=n(0),a=n(1);e.changeTextBlock=function(t,e,n,r){if(!n.isTextblock)return!1;t.selection.ranges.forEach((function(o){var a=t.steps.length,c=o.$from.pos,l=o.$to.pos;t.doc.nodesBetween(c,l,(function(o,c){if(o.eq(e)&&o.isTextblock&&!o.hasMarkup(n,r)&&function(t,e,n){var r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}(t.doc,t.mapping.slice(a).map(c),n)){t.clearIncompatible(t.mapping.slice(a).map(c,1),n);var l=t.mapping.slice(a),u=l.map(c,1),p=l.map(c+o.nodeSize,1),f=new s.Slice(s.Fragment.from(n.create(r,null,o.marks)),0,0);return t.step(new i.ReplaceAroundStep(u,p,u+1,p-1,f,1,!0)),!1}}))}))},e.blockNodes=function(t,e){void 0===e&&(e={blocksInSelection:!1});var n=t.doc,r=t.selection,o=r.$from,i=r.ranges,s=e.blocksInSelection,c=[],l=r instanceof a.NodeSelection?r.node:void 0;return l?l.isBlock?(c.push(l),l.nodesBetween(0,l.content.size,(function(t){t.isBlock&&c.push(t)}))):!s&&o.parent&&o.parent.isBlock&&c.push(o.parent):i.forEach((function(t){var e=t.$from.pos,r=t.$to.pos;n.nodesBetween(e,r,(function(t,n,o,i){t.isBlock&&(!s||n>=e&&n+t.content.size+2<=r)&&c.push(t)}))})),c},e.formatBlockElements=function(t,n){return function(o,i){var s=e.blockNodes(o),a=o.schema.nodes,c=o.tr;c.setMeta("commandName",n),c.setMeta("args",{value:t}),s.forEach((function(n){if(n.type.isTextblock)if("p"===t){var o=n.attrs,i=o.level,s=r.__rest(o,["level"]);e.changeTextBlock(c,n,a.paragraph,s)}else if(/^h[1-6]$/i.test(t)){i=parseInt(t.substr(1),10);e.changeTextBlock(c,n,a.heading,r.__assign({},n.attrs,{level:i}))}else if("blockquote"===t){var l=n.attrs;i=l.level,s=r.__rest(l,["level"]);e.changeTextBlock(c,n,a.blockquote,s)}}));var l=c.docChanged;return l&&i(c.scrollIntoView()),l}},e.cleanTextBlockFormatting=function(t,n){void 0===n&&(n={blocksInSelection:!0});var o=t.doc,i=t.selection,s=n.blocksInSelection,a=n.blockNodeType;e.blockNodes({doc:o,selection:i},{blocksInSelection:s}).filter((function(t){return t.isTextblock})).forEach((function(n){var o=n.attrs||{},i=o.style,s=void 0===i?"":i,c=o.class,l=void 0===c?"":c,u=r.__rest(o,["style","class"]),p=a||n.type;(s||l||p!==n.type)&&e.changeTextBlock(t,n,p,u)}))},e.getBlockFormats=function(t){var n=e.blockNodes(t),r=t.schema.nodes,o=[];return n.forEach((function(t){t.type===r.paragraph?o.push("p"):t.type===r.heading?o.push("h"+t.attrs.level):t.type===r.blockquote&&r.blockquote.isTextblock&&o.push("blockquote")})),o},e.addStyles=function(t,e){var n,r,i=t.attrs.style;i&&e.forEach((function(t){r={style:t.name,value:/^.+$/,newValue:t.value},n=o.changeStylesString(i,r),i=n.changed?n.style:i}));return i=i||e.reduce((function(t,e){return(t&&e.value?t+" ":"")+e.value?e.name+": "+e.value+";":""}),""),Object.assign({},t.attrs,{style:i||null})},e.hasNode=function(t,e){var n=t.selection,r=n.from,o=n.to,i=!1;return t.doc.nodesBetween(r,o,(function(t){return!(i=i||t.type===e)})),i},e.parentBlockFormat=function(t){var n=e.getBlockFormats(t);return 1===new Set(n).size?n[0]:null},e.activeNode=function(t){return{tag:e.parentBlockFormat(t)||""}}},function(t,e,n){"use strict";n.r(e),n.d(e,"autoJoin",(function(){return _})),n.d(e,"baseKeymap",(function(){return L})),n.d(e,"chainCommands",(function(){return I})),n.d(e,"createParagraphNear",(function(){return b})),n.d(e,"deleteSelection",(function(){return s})),n.d(e,"exitCode",(function(){return w})),n.d(e,"joinBackward",(function(){return a})),n.d(e,"joinDown",(function(){return m})),n.d(e,"joinForward",(function(){return p})),n.d(e,"joinUp",(function(){return h})),n.d(e,"lift",(function(){return v})),n.d(e,"liftEmptyBlock",(function(){return S})),n.d(e,"macBaseKeymap",(function(){return F})),n.d(e,"newlineInCode",(function(){return g})),n.d(e,"pcBaseKeymap",(function(){return $})),n.d(e,"selectAll",(function(){return M})),n.d(e,"selectNodeBackward",(function(){return l})),n.d(e,"selectNodeForward",(function(){return f})),n.d(e,"selectParentNode",(function(){return C})),n.d(e,"selectTextblockEnd",(function(){return A})),n.d(e,"selectTextblockStart",(function(){return N})),n.d(e,"setBlockType",(function(){return E})),n.d(e,"splitBlock",(function(){return k})),n.d(e,"splitBlockKeepMarks",(function(){return x})),n.d(e,"toggleMark",(function(){return R})),n.d(e,"wrapIn",(function(){return D}));var r=n(2),o=n(0),i=n(1);function s(t,e){return!t.selection.empty&&(e&&e(t.tr.deleteSelection().scrollIntoView()),!0)}function a(t,e,n){var s=t.selection.$cursor;if(!s||(n?!n.endOfTextblock("backward",t):s.parentOffset>0))return!1;var a=u(s);if(!a){var l=s.blockRange(),p=l&&Object(r.liftTarget)(l);return null!=p&&(e&&e(t.tr.lift(l,p).scrollIntoView()),!0)}var f=a.nodeBefore;if(!f.type.spec.isolating&&O(t,a,e))return!0;if(0==s.parent.content.size&&(c(f,"end")||i.NodeSelection.isSelectable(f))){var d=Object(r.replaceStep)(t.doc,s.before(),s.after(),o.Slice.empty);if(d.slice.size<d.to-d.from){if(e){var h=t.tr.step(d);h.setSelection(c(f,"end")?i.Selection.findFrom(h.doc.resolve(h.mapping.map(a.pos,-1)),-1):i.NodeSelection.create(h.doc,a.pos-f.nodeSize)),e(h.scrollIntoView())}return!0}}return!(!f.isAtom||a.depth!=s.depth-1)&&(e&&e(t.tr.delete(a.pos-f.nodeSize,a.pos).scrollIntoView()),!0)}function c(t,e,n){for(;t;t="start"==e?t.firstChild:t.lastChild){if(t.isTextblock)return!0;if(n&&1!=t.childCount)return!1}return!1}function l(t,e,n){var r=t.selection,o=r.$head,s=o;if(!r.empty)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):o.parentOffset>0)return!1;s=u(o)}var a=s&&s.nodeBefore;return!(!a||!i.NodeSelection.isSelectable(a))&&(e&&e(t.tr.setSelection(i.NodeSelection.create(t.doc,s.pos-a.nodeSize)).scrollIntoView()),!0)}function u(t){if(!t.parent.type.spec.isolating)for(var e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function p(t,e,n){var s=t.selection.$cursor;if(!s||(n?!n.endOfTextblock("forward",t):s.parentOffset<s.parent.content.size))return!1;var a=d(s);if(!a)return!1;var l=a.nodeAfter;if(O(t,a,e))return!0;if(0==s.parent.content.size&&(c(l,"start")||i.NodeSelection.isSelectable(l))){var u=Object(r.replaceStep)(t.doc,s.before(),s.after(),o.Slice.empty);if(u.slice.size<u.to-u.from){if(e){var p=t.tr.step(u);p.setSelection(c(l,"start")?i.Selection.findFrom(p.doc.resolve(p.mapping.map(a.pos)),1):i.NodeSelection.create(p.doc,p.mapping.map(a.pos))),e(p.scrollIntoView())}return!0}}return!(!l.isAtom||a.depth!=s.depth-1)&&(e&&e(t.tr.delete(a.pos,a.pos+l.nodeSize).scrollIntoView()),!0)}function f(t,e,n){var r=t.selection,o=r.$head,s=o;if(!r.empty)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):o.parentOffset<o.parent.content.size)return!1;s=d(o)}var a=s&&s.nodeAfter;return!(!a||!i.NodeSelection.isSelectable(a))&&(e&&e(t.tr.setSelection(i.NodeSelection.create(t.doc,s.pos)).scrollIntoView()),!0)}function d(t){if(!t.parent.type.spec.isolating)for(var e=t.depth-1;e>=0;e--){var n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}function h(t,e){var n,o=t.selection,s=o instanceof i.NodeSelection;if(s){if(o.node.isTextblock||!Object(r.canJoin)(t.doc,o.from))return!1;n=o.from}else if(null==(n=Object(r.joinPoint)(t.doc,o.from,-1)))return!1;if(e){var a=t.tr.join(n);s&&a.setSelection(i.NodeSelection.create(a.doc,n-t.doc.resolve(n).nodeBefore.nodeSize)),e(a.scrollIntoView())}return!0}function m(t,e){var n,o=t.selection;if(o instanceof i.NodeSelection){if(o.node.isTextblock||!Object(r.canJoin)(t.doc,o.to))return!1;n=o.to}else if(null==(n=Object(r.joinPoint)(t.doc,o.to,1)))return!1;return e&&e(t.tr.join(n).scrollIntoView()),!0}function v(t,e){var n=t.selection,o=n.$from,i=n.$to,s=o.blockRange(i),a=s&&Object(r.liftTarget)(s);return null!=a&&(e&&e(t.tr.lift(s,a).scrollIntoView()),!0)}function g(t,e){var n=t.selection,r=n.$head,o=n.$anchor;return!(!r.parent.type.spec.code||!r.sameParent(o))&&(e&&e(t.tr.insertText("\n").scrollIntoView()),!0)}function y(t){for(var e=0;e<t.edgeCount;e++){var n=t.edge(e).type;if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function w(t,e){var n=t.selection,r=n.$head,o=n.$anchor;if(!r.parent.type.spec.code||!r.sameParent(o))return!1;var s=r.node(-1),a=r.indexAfter(-1),c=y(s.contentMatchAt(a));if(!s.canReplaceWith(a,a,c))return!1;if(e){var l=r.after(),u=t.tr.replaceWith(l,l,c.createAndFill());u.setSelection(i.Selection.near(u.doc.resolve(l),1)),e(u.scrollIntoView())}return!0}function b(t,e){var n=t.selection,r=n.$from,o=n.$to;if(n instanceof i.AllSelection||r.parent.inlineContent||o.parent.inlineContent)return!1;var s=y(o.parent.contentMatchAt(o.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){var a=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,c=t.tr.insert(a,s.createAndFill());c.setSelection(i.TextSelection.create(c.doc,a+1)),e(c.scrollIntoView())}return!0}function S(t,e){var n=t.selection.$cursor;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){var o=n.before();if(Object(r.canSplit)(t.doc,o))return e&&e(t.tr.split(o).scrollIntoView()),!0}var i=n.blockRange(),s=i&&Object(r.liftTarget)(i);return null!=s&&(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)}function k(t,e){var n=t.selection,o=n.$from,s=n.$to;if(t.selection instanceof i.NodeSelection&&t.selection.node.isBlock)return!(!o.parentOffset||!Object(r.canSplit)(t.doc,o.pos))&&(e&&e(t.tr.split(o.pos).scrollIntoView()),!0);if(!o.parent.isBlock)return!1;if(e){var a=s.parentOffset==s.parent.content.size,c=t.tr;(t.selection instanceof i.TextSelection||t.selection instanceof i.AllSelection)&&c.deleteSelection();var l=0==o.depth?null:y(o.node(-1).contentMatchAt(o.indexAfter(-1))),u=a&&l?[{type:l}]:null,p=Object(r.canSplit)(c.doc,c.mapping.map(o.pos),1,u);if(u||p||!Object(r.canSplit)(c.doc,c.mapping.map(o.pos),1,l&&[{type:l}])||(u=[{type:l}],p=!0),p&&(c.split(c.mapping.map(o.pos),1,u),!a&&!o.parentOffset&&o.parent.type!=l)){var f=c.mapping.map(o.before()),d=c.doc.resolve(f);o.node(-1).canReplaceWith(d.index(),d.index()+1,l)&&c.setNodeMarkup(c.mapping.map(o.before()),l)}e(c.scrollIntoView())}return!0}function x(t,e){return k(t,e&&function(n){var r=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();r&&n.ensureMarks(r),e(n)})}function C(t,e){var n,r=t.selection,o=r.$from,s=r.to,a=o.sharedDepth(s);return 0!=a&&(n=o.before(a),e&&e(t.tr.setSelection(i.NodeSelection.create(t.doc,n))),!0)}function M(t,e){return e&&e(t.tr.setSelection(new i.AllSelection(t.doc))),!0}function O(t,e,n){var s,a,l=e.nodeBefore,u=e.nodeAfter;if(l.type.spec.isolating||u.type.spec.isolating)return!1;if(function(t,e,n){var o=e.nodeBefore,i=e.nodeAfter,s=e.index();return!!(o&&i&&o.type.compatibleContent(i.type))&&(!o.content.size&&e.parent.canReplace(s-1,s)?(n&&n(t.tr.delete(e.pos-o.nodeSize,e.pos).scrollIntoView()),!0):!(!e.parent.canReplace(s,s+1)||!i.isTextblock&&!Object(r.canJoin)(t.doc,e.pos))&&(n&&n(t.tr.clearIncompatible(e.pos,o.type,o.contentMatchAt(o.childCount)).join(e.pos).scrollIntoView()),!0))}(t,e,n))return!0;var p=e.parent.canReplace(e.index(),e.index()+1);if(p&&(s=(a=l.contentMatchAt(l.childCount)).findWrapping(u.type))&&a.matchType(s[0]||u.type).validEnd){if(n){for(var f=e.pos+u.nodeSize,d=o.Fragment.empty,h=s.length-1;h>=0;h--)d=o.Fragment.from(s[h].create(null,d));d=o.Fragment.from(l.copy(d));var m=t.tr.step(new r.ReplaceAroundStep(e.pos-1,f,e.pos,f,new o.Slice(d,1,0),s.length,!0)),v=f+2*s.length;Object(r.canJoin)(m.doc,v)&&m.join(v),n(m.scrollIntoView())}return!0}var g=i.Selection.findFrom(e,1),y=g&&g.$from.blockRange(g.$to),w=y&&Object(r.liftTarget)(y);if(null!=w&&w>=e.depth)return n&&n(t.tr.lift(y,w).scrollIntoView()),!0;if(p&&c(u,"start",!0)&&c(l,"end")){for(var b=l,S=[];S.push(b),!b.isTextblock;)b=b.lastChild;for(var k=u,x=1;!k.isTextblock;k=k.firstChild)x++;if(b.canReplace(b.childCount,b.childCount,k.content)){if(n){for(var C=o.Fragment.empty,M=S.length-1;M>=0;M--)C=o.Fragment.from(S[M].copy(C));n(t.tr.step(new r.ReplaceAroundStep(e.pos-S.length,e.pos+u.nodeSize,e.pos+x,e.pos+u.nodeSize-x,new o.Slice(C,S.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function T(t){return function(e,n){for(var r=e.selection,o=t<0?r.$from:r.$to,s=o.depth;o.node(s).isInline;){if(!s)return!1;s--}return!!o.node(s).isTextblock&&(n&&n(e.tr.setSelection(i.TextSelection.create(e.doc,t<0?o.start(s):o.end(s)))),!0)}}var N=T(-1),A=T(1);function D(t,e){return function(n,o){var i=n.selection,s=i.$from,a=i.$to,c=s.blockRange(a),l=c&&Object(r.findWrapping)(c,t,e);return!!l&&(o&&o(n.tr.wrap(c,l).scrollIntoView()),!0)}}function E(t,e){return function(n,r){var o=n.selection,i=o.from,s=o.to,a=!1;return n.doc.nodesBetween(i,s,(function(r,o){if(a)return!1;if(r.isTextblock&&!r.hasMarkup(t,e))if(r.type==t)a=!0;else{var i=n.doc.resolve(o),s=i.index();a=i.parent.canReplaceWith(s,s+1,t)}})),!!a&&(r&&r(n.tr.setBlockType(i,s,t,e).scrollIntoView()),!0)}}function R(t,e){return function(n,r){var o=n.selection,i=o.empty,s=o.$cursor,a=o.ranges;if(i&&!s||!function(t,e,n){for(var r=function(r){var o=e[r],i=o.$from,s=o.$to,a=0==i.depth&&t.type.allowsMarkType(n);if(t.nodesBetween(i.pos,s.pos,(function(t){if(a)return!1;a=t.inlineContent&&t.type.allowsMarkType(n)})),a)return{v:!0}},o=0;o<e.length;o++){var i=r(o);if(i)return i.v}return!1}(n.doc,a,t))return!1;if(r)if(s)t.isInSet(n.storedMarks||s.marks())?r(n.tr.removeStoredMark(t)):r(n.tr.addStoredMark(t.create(e)));else{for(var c=!1,l=n.tr,u=0;!c&&u<a.length;u++){var p=a[u],f=p.$from,d=p.$to;c=n.doc.rangeHasMark(f.pos,d.pos,t)}for(var h=0;h<a.length;h++){var m=a[h],v=m.$from,g=m.$to;if(c)l.removeMark(v.pos,g.pos,t);else{var y=v.pos,w=g.pos,b=v.nodeAfter,S=g.nodeBefore,k=b&&b.isText?/^\s*/.exec(b.text)[0].length:0,x=S&&S.isText?/\s*$/.exec(S.text)[0].length:0;y+k<w&&(y+=k,w-=x),l.addMark(y,w,t.create(e))}}r(l.scrollIntoView())}return!0}}function _(t,e){if(Array.isArray(e)){var n=e;e=function(t){return n.indexOf(t.type.name)>-1}}return function(n,o,i){return t(n,o&&function(t,e){return function(n){if(!n.isGeneric)return t(n);for(var o=[],i=0;i<n.mapping.maps.length;i++){for(var s=n.mapping.maps[i],a=0;a<o.length;a++)o[a]=s.map(o[a]);s.forEach((function(t,e,n,r){return o.push(n,r)}))}for(var c=[],l=0;l<o.length;l+=2)for(var u=o[l],p=o[l+1],f=n.doc.resolve(u),d=f.sharedDepth(p),h=f.node(d),m=f.indexAfter(d),v=f.after(d+1);v<=p;++m){var g=h.maybeChild(m);if(!g)break;if(m&&-1==c.indexOf(v)){var y=h.child(m-1);y.type==g.type&&e(y,g)&&c.push(v)}v+=g.nodeSize}c.sort((function(t,e){return t-e}));for(var w=c.length-1;w>=0;w--)Object(r.canJoin)(n.doc,c[w])&&n.join(c[w]);t(n)}}(o,e),i)}}function I(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return function(e,n,r){for(var o=0;o<t.length;o++)if(t[o](e,n,r))return!0;return!1}}var z=I(s,a,l),P=I(s,p,f),$={Enter:I(g,b,S,k),"Mod-Enter":w,Backspace:z,"Mod-Backspace":z,"Shift-Backspace":z,Delete:P,"Mod-Delete":P,"Mod-a":M},F={"Ctrl-h":$.Backspace,"Alt-Backspace":$["Mod-Backspace"],"Ctrl-d":$.Delete,"Ctrl-Alt-Backspace":$["Mod-Delete"],"Alt-Delete":$["Mod-Delete"],"Alt-d":$["Mod-Delete"],"Ctrl-a":N,"Ctrl-e":A};for(var B in $)F[B]=$[B];var L=("undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&"darwin"==os.platform())?F:$},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(11),s=["div","ol","ul","li","table","tbody","thead","tfoot","td","th","p","tr","col","colgroup","article","main","nav","header","footer","aside","section"],a=function(t,e){var n=(t.ownerDocument||document).createElement(e);Array.from(t.rows).filter((function(t){return t.getAttribute(i.rowTypeAttr)===e})).forEach((function(t){t.removeAttribute(i.rowTypeAttr),n.appendChild(t)})),n.children.length&&t.appendChild(n)},c=function(t,e){var n=e.toUpperCase();t.filter((function(t){return t.nodeName===n})).forEach((function(t){Array.from(t.children).forEach((function(n){n.setAttribute(i.rowTypeAttr,e),t.parentNode&&t.parentNode.insertBefore(n,t)})),t.remove()}))};e.trimWhitespace=function(t,e){void 0===e&&(e=s);var n=e.join("|");return t.replace(new RegExp("\\s*(<(?:"+n+")(?:\\s[^>]*?)?>)","g"),"$1").replace(new RegExp("(<\\/(?:"+n+")(?:\\s[^>]*?)?>)\\s*","g"),"$1")},e.htmlToFragment=function(t){var e,n=document.createElement("template");if("content"in n)n.innerHTML=t,e=n.content;else{var r=(new DOMParser).parseFromString(t,"text/html");e=document.createDocumentFragment();for(var o=r.body;o&&o.firstChild;)e.appendChild(o.firstChild)}return e},e.pmDocToFragment=function(t){var e=r.DOMSerializer.fromSchema(t.type.schema).serializeFragment(t.content);return function(t){Array.from(t.querySelectorAll("table")).forEach((function(t){a(t,"thead"),a(t,"tbody"),a(t,"tfoot");var e=Array.from(t.children).find((function(t){return 0===t.children.length}));e&&e.remove()}))}(e),e},e.domToPmDoc=function(t,e,n){return r.DOMParser.fromSchema(e).parse(t,n)},e.parseContent=function(t,n,r){var o,s=e.htmlToFragment(t);return o=s,Array.from(o.querySelectorAll("table")).forEach((function(t){var e=Array.from(t.children);e.some((function(t){return"THEAD"===t.nodeName||"TFOOT"===t.nodeName}))&&(c(e,"thead"),c(e,"tbody"),c(e,"tfoot"));var n=e.find((function(t){return"COLGROUP"===t.nodeName}));n&&(t.setAttribute(i.colgroupAttr,n.outerHTML),n.remove())})),e.domToPmDoc(s,n,r)},e.getHtml=function(t){var n=e.pmDocToFragment(t.doc),r=document.createElement("div");return r.appendChild(n),r.innerHTML},e.setHtml=function(t,n,r){return void 0===n&&(n="setHTML"),void 0===r&&(r={preserveWhitespace:"full"}),function(i,s){return s(i.tr.setSelection(new o.AllSelection(i.doc)).replaceSelectionWith(e.parseContent(t,i.schema,r)).setMeta("commandName",n))}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.rowTypeAttr="k-parent-node",e.colgroupAttr="k-colgroup-data"},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(4),o=n(2),i=n(5),s=n(6),a=function(t,e){var n=t.find((function(t){return"style"===t.type.name})),r=n&&n.attrs.style;return i.changeStylesString(r,e)},c=function(t,e,n,i,s){var c=s.create({style:i.style}),l=[],u=[],p=null,f=null;return t.doc.nodesBetween(e,n,(function(t,d,h){if(t.isInline){var m=t.marks;if(!c.isInSet(m)&&h.type.allowsMarkType(c.type)){var v=Math.max(d,e),g=Math.min(d+t.nodeSize,n),y=a(m,i);if(y.changed||i.newValue){for(var w=y.changed?{style:y.style||null}:{style:[i.style]+": "+i.newValue+";"},b=s.isInSet(m)?m.find((function(t){return"style"===t.type.name})):null,S=b?r.__assign({},b.attrs,w):w,k=s.create(S),x=k.addToSet(m),C=0;C<m.length;C++)m[C].isInSet(x)||(p&&p.to===v&&p.mark.eq(m[C])?p.to=g:(p=new o.RemoveMarkStep(v,g,m[C]),l.push(p)));var M=f&&f.to===v,O=M&&k.attrs.style===f.mark.attrs.style;M&&O?f.to=g:Object.keys(S).some((function(t){return null!==S[t]}))&&(f=new o.AddMarkStep(v,g,k),u.push(f))}}}})),l.forEach((function(e){return t.step(e)})),u.forEach((function(e){return t.step(e)})),l.length+u.length>0};e.getInlineStyles=function(t,e){var n=t.schema.marks.style;return(n?s.selectionMarks(t,n):[]).map((function(t){return s.styleValue(t,e)})).filter((function(t){return null!==t}))};var l=function(t,e){return function(n,o,l){var u=n.selection,p=u.empty,f=u.$cursor,d=u.ranges;if(p&&!f||!s.markApplies(n.doc,d,t))return!1;var h=!1;if(o){var m=l||n.tr;if(f){var v=n.storedMarks||f.marks();if(t.isInSet(v)){var g=a(v,e),y=v.find((function(t){return"style"===t.type.name})),w=r.__assign({},y?y.attrs:{},{style:g.style||null});if(i.shallowEqual(y.attrs,w))return!1;o(m.removeStoredMark(t)),Object.keys(w).some((function(t){return null!==w[t]}))&&o(m.addStoredMark(t.create(w))),h=!0}}else{for(var b=0;b<d.length;b++){var S=d[b],k=S.$from,x=S.$to;h=c(m,k.pos,x.pos,e,t)}h&&(m.scrollIntoView(),o(m))}}return h}};e.toggleInlineFormat=function(t,e,n){return function(r,o){var i=r.schema.marks,a=t.altStyle,c=t.altMarks,u=void 0===c?[]:c,p=t.mark,f=e||r.tr,d=!1,h=!1,m=function(){return h=!0};a&&i.style&&(d=l(i.style,{style:a.name,value:a.value})(r,m,f));var v=[p].concat(u).filter((function(t){return i[t]})).map((function(t){return s.hasMark(r,{mark:t})&&i[t]})).filter((function(t){return t}));return v.length?s.removeMarks(v,r,m,f):d||s.toggleMark(i[p],n,f)(r,m),h&&o(f),h}},e.applyInlineStyle=function(t,e){return function(n,o){var a=n.schema.marks.style,c={style:t.style,value:/^.+$/,newValue:t.value},u=n.tr;e&&u.setMeta("commandName",e),u.setMeta("args",t);var p=n.selection,f=p.empty,d=p.$cursor,h=p.ranges;if(f&&!d||!a||!s.markApplies(n.doc,h,a))return!1;if(d){var m=n.storedMarks||d.marks(),v=a.isInSet(m)?m.find((function(t){return"style"===t.type.name})):null,g={style:null};if(v&&v.attrs.style){var y=i.changeStylesString(v.attrs.style,c);y.changed&&y.style&&(g.style=y.style)}else c.newValue&&(g.style=[c.style]+": "+c.newValue+";");var w=v?r.__assign({},v.attrs,g):g;return Object.keys(w).some((function(t){return null!==w[t]}))?o(u.addStoredMark(a.create(w))):o(u.removeStoredMark(a)),!0}return l(a,c)(n,o,u)}}},function(t,e,n){"use strict";n.r(e),n.d(e,"addListNodes",(function(){return f})),n.d(e,"bulletList",(function(){return l})),n.d(e,"liftListItem",(function(){return m})),n.d(e,"listItem",(function(){return u})),n.d(e,"orderedList",(function(){return c})),n.d(e,"sinkListItem",(function(){return v})),n.d(e,"splitListItem",(function(){return h})),n.d(e,"wrapInList",(function(){return d}));var r=n(2),o=n(0),i=["ol",0],s=["ul",0],a=["li",0],c={attrs:{order:{default:1}},parseDOM:[{tag:"ol",getAttrs:function(t){return{order:t.hasAttribute("start")?+t.getAttribute("start"):1}}}],toDOM:function(t){return 1==t.attrs.order?i:["ol",{start:t.attrs.order},0]}},l={parseDOM:[{tag:"ul"}],toDOM:function(){return s}},u={parseDOM:[{tag:"li"}],toDOM:function(){return a},defining:!0};function p(t,e){var n={};for(var r in t)n[r]=t[r];for(var o in e)n[o]=e[o];return n}function f(t,e,n){return t.append({ordered_list:p(c,{content:"list_item+",group:n}),bullet_list:p(l,{content:"list_item+",group:n}),list_item:p(u,{content:e})})}function d(t,e){return function(n,i){var s=n.selection,a=s.$from,c=s.$to,l=a.blockRange(c),u=!1,p=l;if(!l)return!1;if(l.depth>=2&&a.node(l.depth-1).type.compatibleContent(t)&&0==l.startIndex){if(0==a.index(l.depth-1))return!1;var f=n.doc.resolve(l.start-2);p=new o.NodeRange(f,f,l.depth),l.endIndex<l.parent.childCount&&(l=new o.NodeRange(a,n.doc.resolve(c.end(l.depth)),l.depth)),u=!0}var d=Object(r.findWrapping)(p,t,e,l);return!!d&&(i&&i(function(t,e,n,i,s){for(var a=o.Fragment.empty,c=n.length-1;c>=0;c--)a=o.Fragment.from(n[c].type.create(n[c].attrs,a));t.step(new r.ReplaceAroundStep(e.start-(i?2:0),e.end,e.start,e.end,new o.Slice(a,0,0),n.length,!0));for(var l=0,u=0;u<n.length;u++)n[u].type==s&&(l=u+1);for(var p=n.length-l,f=e.start+n.length-(i?2:0),d=e.parent,h=e.startIndex,m=e.endIndex,v=!0;h<m;h++,v=!1)!v&&Object(r.canSplit)(t.doc,f,p)&&(t.split(f,p),f+=2*p),f+=d.child(h).nodeSize;return t}(n.tr,l,d,u,t).scrollIntoView()),!0)}}function h(t){return function(e,n){var i=e.selection,s=i.$from,a=i.$to,c=i.node;if(c&&c.isBlock||s.depth<2||!s.sameParent(a))return!1;var l=s.node(-1);if(l.type!=t)return!1;if(0==s.parent.content.size&&s.node(-1).childCount==s.indexAfter(-1)){if(2==s.depth||s.node(-3).type!=t||s.index(-2)!=s.node(-2).childCount-1)return!1;if(n){for(var u=o.Fragment.empty,p=s.index(-1)?1:s.index(-2)?2:3,f=s.depth-p;f>=s.depth-3;f--)u=o.Fragment.from(s.node(f).copy(u));var d=s.indexAfter(-1)<s.node(-2).childCount?1:s.indexAfter(-2)<s.node(-3).childCount?2:3;u=u.append(o.Fragment.from(t.createAndFill()));var h=s.before(s.depth-(p-1)),m=e.tr.replace(h,s.after(-d),new o.Slice(u,4-p,0)),v=-1;m.doc.nodesBetween(h,m.doc.content.size,(function(t,e){if(v>-1)return!1;t.isTextblock&&0==t.content.size&&(v=e+1)})),v>-1&&m.setSelection(e.selection.constructor.near(m.doc.resolve(v))),n(m.scrollIntoView())}return!0}var g=a.pos==s.end()?l.contentMatchAt(0).defaultType:null,y=e.tr.delete(s.pos,a.pos),w=g&&[null,{type:g}];return!!Object(r.canSplit)(y.doc,s.pos,2,w)&&(n&&n(y.split(s.pos,2,w).scrollIntoView()),!0)}}function m(t){return function(e,n){var i=e.selection,s=i.$from,a=i.$to,c=s.blockRange(a,(function(e){return e.childCount&&e.firstChild.type==t}));return!!c&&(!n||(s.node(c.depth-1).type==t?function(t,e,n,i){var s=t.tr,a=i.end,c=i.$to.end(i.depth);a<c&&(s.step(new r.ReplaceAroundStep(a-1,c,a,c,new o.Slice(o.Fragment.from(n.create(null,i.parent.copy())),1,0),1,!0)),i=new o.NodeRange(s.doc.resolve(i.$from.pos),s.doc.resolve(c),i.depth));return e(s.lift(i,Object(r.liftTarget)(i)).scrollIntoView()),!0}(e,n,t,c):function(t,e,n){for(var i=t.tr,s=n.parent,a=n.end,c=n.endIndex-1,l=n.startIndex;c>l;c--)a-=s.child(c).nodeSize,i.delete(a-1,a+1);var u=i.doc.resolve(n.start),p=u.nodeAfter;if(i.mapping.map(n.end)!=n.start+u.nodeAfter.nodeSize)return!1;var f=0==n.startIndex,d=n.endIndex==s.childCount,h=u.node(-1),m=u.index(-1);if(!h.canReplace(m+(f?0:1),m+1,p.content.append(d?o.Fragment.empty:o.Fragment.from(s))))return!1;var v=u.pos,g=v+p.nodeSize;return i.step(new r.ReplaceAroundStep(v-(f?1:0),g+(d?1:0),v+1,g-1,new o.Slice((f?o.Fragment.empty:o.Fragment.from(s.copy(o.Fragment.empty))).append(d?o.Fragment.empty:o.Fragment.from(s.copy(o.Fragment.empty))),f?0:1,d?0:1),f?0:1)),e(i.scrollIntoView()),!0}(e,n,c)))}}function v(t){return function(e,n){var i=e.selection,s=i.$from,a=i.$to,c=s.blockRange(a,(function(e){return e.childCount&&e.firstChild.type==t}));if(!c)return!1;var l=c.startIndex;if(0==l)return!1;var u=c.parent,p=u.child(l-1);if(p.type!=t)return!1;if(n){var f=p.lastChild&&p.lastChild.type==u.type,d=o.Fragment.from(f?t.create():null),h=new o.Slice(o.Fragment.from(t.create(null,o.Fragment.from(u.type.create(null,d)))),f?3:1,0),m=c.start,v=c.end;n(e.tr.step(new r.ReplaceAroundStep(m-(f?3:1),v,m,v,h,1,!0)).scrollIntoView())}return!0}}},function(t,e,n){"use strict";n.r(e),n.d(e,"CellSelection",(function(){return I})),n.d(e,"TableMap",(function(){return h})),n.d(e,"TableView",(function(){return Ot})),n.d(e,"__clipCells",(function(){return B})),n.d(e,"__insertCells",(function(){return j})),n.d(e,"__pastedCells",(function(){return $})),n.d(e,"addColSpan",(function(){return R})),n.d(e,"addColumn",(function(){return rt})),n.d(e,"addColumnAfter",(function(){return it})),n.d(e,"addColumnBefore",(function(){return ot})),n.d(e,"addRow",(function(){return lt})),n.d(e,"addRowAfter",(function(){return pt})),n.d(e,"addRowBefore",(function(){return ut})),n.d(e,"cellAround",(function(){return S})),n.d(e,"colCount",(function(){return N})),n.d(e,"columnIsHeader",(function(){return _})),n.d(e,"columnResizing",(function(){return At})),n.d(e,"columnResizingPluginKey",(function(){return Nt})),n.d(e,"deleteColumn",(function(){return at})),n.d(e,"deleteRow",(function(){return dt})),n.d(e,"deleteTable",(function(){return Mt})),n.d(e,"findCell",(function(){return T})),n.d(e,"fixTables",(function(){return et})),n.d(e,"fixTablesKey",(function(){return tt})),n.d(e,"goToNextCell",(function(){return Ct})),n.d(e,"handlePaste",(function(){return G})),n.d(e,"inSameTable",(function(){return O})),n.d(e,"isInTable",(function(){return k})),n.d(e,"mergeCells",(function(){return mt})),n.d(e,"moveCellForward",(function(){return M})),n.d(e,"nextCell",(function(){return A})),n.d(e,"pointsAtCell",(function(){return C})),n.d(e,"removeColSpan",(function(){return E})),n.d(e,"removeColumn",(function(){return st})),n.d(e,"removeRow",(function(){return ft})),n.d(e,"rowIsHeader",(function(){return ct})),n.d(e,"selectedRect",(function(){return nt})),n.d(e,"selectionCell",(function(){return x})),n.d(e,"setAttr",(function(){return D})),n.d(e,"setCellAttr",(function(){return yt})),n.d(e,"splitCell",(function(){return vt})),n.d(e,"splitCellWithType",(function(){return gt})),n.d(e,"tableEditing",(function(){return zt})),n.d(e,"tableEditingKey",(function(){return b})),n.d(e,"tableNodeTypes",(function(){return w})),n.d(e,"tableNodes",(function(){return y})),n.d(e,"toggleHeader",(function(){return bt})),n.d(e,"toggleHeaderCell",(function(){return xt})),n.d(e,"toggleHeaderColumn",(function(){return kt})),n.d(e,"toggleHeaderRow",(function(){return St})),n.d(e,"updateColumnsOnResize",(function(){return Tt}));var r,o,i=n(1),s=n(0),a=n(7),c=n(3),l=n(2);if("undefined"!=typeof WeakMap){var u=new WeakMap;r=function(t){return u.get(t)},o=function(t,e){return u.set(t,e),e}}else{var p=[],f=0;r=function(t){for(var e=0;e<p.length;e+=2)if(p[e]==t)return p[e+1]},o=function(t,e){return 10==f&&(f=0),p[f++]=t,p[f++]=e}}var d=function(t,e,n,r){this.left=t,this.top=e,this.right=n,this.bottom=r},h=function(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r};function m(t){if(t.colwidth)return t.colwidth.slice();for(var e=[],n=0;n<t.colspan;n++)e.push(0);return e}function v(t,e){var n=t.getAttribute("data-colwidth"),r=n&&/^\d+(,\d+)*$/.test(n)?n.split(",").map((function(t){return Number(t)})):null,o=Number(t.getAttribute("colspan")||1),i={colspan:o,rowspan:Number(t.getAttribute("rowspan")||1),colwidth:r&&r.length==o?r:null};for(var s in e){var a=e[s].getFromDOM,c=a&&a(t);null!=c&&(i[s]=c)}return i}function g(t,e){var n={};for(var r in 1!=t.attrs.colspan&&(n.colspan=t.attrs.colspan),1!=t.attrs.rowspan&&(n.rowspan=t.attrs.rowspan),t.attrs.colwidth&&(n["data-colwidth"]=t.attrs.colwidth.join(",")),e){var o=e[r].setDOMAttr;o&&o(t.attrs[r],n)}return n}function y(t){var e=t.cellAttributes||{},n={colspan:{default:1},rowspan:{default:1},colwidth:{default:null}};for(var r in e)n[r]={default:e[r].default};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:t.tableGroup,parseDOM:[{tag:"table"}],toDOM:function(){return["table",["tbody",0]]}},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM:function(){return["tr",0]}},table_cell:{content:t.cellContent,attrs:n,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:function(t){return v(t,e)}}],toDOM:function(t){return["td",g(t,e),0]}},table_header:{content:t.cellContent,attrs:n,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:function(t){return v(t,e)}}],toDOM:function(t){return["th",g(t,e),0]}}}}function w(t){var e=t.cached.tableNodeTypes;if(!e)for(var n in e=t.cached.tableNodeTypes={},t.nodes){var r=t.nodes[n],o=r.spec.tableRole;o&&(e[o]=r)}return e}h.prototype.findCell=function(t){for(var e=0;e<this.map.length;e++){var n=this.map[e];if(n==t){for(var r=e%this.width,o=e/this.width|0,i=r+1,s=o+1,a=1;i<this.width&&this.map[e+a]==n;a++)i++;for(var c=1;s<this.height&&this.map[e+this.width*c]==n;c++)s++;return new d(r,o,i,s)}}throw new RangeError("No cell with offset "+t+" found")},h.prototype.colCount=function(t){for(var e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError("No cell with offset "+t+" found")},h.prototype.nextCell=function(t,e,n){var r=this.findCell(t),o=r.left,i=r.right,s=r.top,a=r.bottom;return"horiz"==e?(n<0?0==o:i==this.width)?null:this.map[s*this.width+(n<0?o-1:i)]:(n<0?0==s:a==this.height)?null:this.map[o+this.width*(n<0?s-1:a)]},h.prototype.rectBetween=function(t,e){var n=this.findCell(t),r=n.left,o=n.right,i=n.top,s=n.bottom,a=this.findCell(e),c=a.left,l=a.right,u=a.top,p=a.bottom;return new d(Math.min(r,c),Math.min(i,u),Math.max(o,l),Math.max(s,p))},h.prototype.cellsInRect=function(t){for(var e=[],n={},r=t.top;r<t.bottom;r++)for(var o=t.left;o<t.right;o++){var i=r*this.width+o,s=this.map[i];n[s]||(n[s]=!0,o==t.left&&o&&this.map[i-1]==s||r==t.top&&r&&this.map[i-this.width]==s||e.push(s))}return e},h.prototype.positionAt=function(t,e,n){for(var r=0,o=0;;r++){var i=o+n.child(r).nodeSize;if(r==t){for(var s=e+t*this.width,a=(t+1)*this.width;s<a&&this.map[s]<o;)s++;return s==a?i-1:this.map[s]}o=i}},h.get=function(t){return r(t)||o(t,function(t){if("table"!=t.type.spec.tableRole)throw new RangeError("Not a table node: "+t.type.name);for(var e=function(t){for(var e=-1,n=!1,r=0;r<t.childCount;r++){var o=t.child(r),i=0;if(n)for(var s=0;s<r;s++)for(var a=t.child(s),c=0;c<a.childCount;c++){var l=a.child(c);s+l.attrs.rowspan>r&&(i+=l.attrs.colspan)}for(var u=0;u<o.childCount;u++){var p=o.child(u);i+=p.attrs.colspan,p.attrs.rowspan>1&&(n=!0)}-1==e?e=i:e!=i&&(e=Math.max(e,i))}return e}(t),n=t.childCount,r=[],o=0,i=null,s=[],a=0,c=e*n;a<c;a++)r[a]=0;for(var l=0,u=0;l<n;l++){var p=t.child(l);u++;for(var f=0;;f++){for(;o<r.length&&0!=r[o];)o++;if(f==p.childCount)break;for(var d=p.child(f),v=d.attrs,g=v.colspan,y=v.rowspan,w=v.colwidth,b=0;b<y;b++){if(b+l>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:u,n:y-b});break}for(var S=o+b*e,k=0;k<g;k++){0==r[S+k]?r[S+k]=u:(i||(i=[])).push({type:"collision",row:l,pos:u,n:g-k});var x=w&&w[k];if(x){var C=(S+k)%e*2,M=s[C];null==M||M!=x&&1==s[C+1]?(s[C]=x,s[C+1]=1):M==x&&s[C+1]++}}}o+=g,u+=d.nodeSize}for(var O=(l+1)*e,T=0;o<O;)0==r[o++]&&T++;T&&(i||(i=[])).push({type:"missing",row:l,n:T}),u++}for(var N=new h(e,n,r,i),A=!1,D=0;!A&&D<s.length;D+=2)null!=s[D]&&s[D+1]<n&&(A=!0);A&&function(t,e,n){t.problems||(t.problems=[]);for(var r=0,o={};r<t.map.length;r++){var i=t.map[r];if(!o[i]){o[i]=!0;for(var s=n.nodeAt(i),a=null,c=0;c<s.attrs.colspan;c++){var l=(r+c)%t.width,u=e[2*l];null==u||s.attrs.colwidth&&s.attrs.colwidth[c]==u||((a||(a=m(s.attrs)))[c]=u)}a&&t.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:a})}}}(N,s,t);return N}(t))};var b=new i.PluginKey("selectingCells");function S(t){for(var e=t.depth-1;e>0;e--)if("row"==t.node(e).type.spec.tableRole)return t.node(0).resolve(t.before(e+1));return null}function k(t){for(var e=t.selection.$head,n=e.depth;n>0;n--)if("row"==e.node(n).type.spec.tableRole)return!0;return!1}function x(t){var e=t.selection;return e.$anchorCell?e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell:e.node&&"cell"==e.node.type.spec.tableRole?e.$anchor:S(e.$head)||function(t){for(var e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){var r=e.type.spec.tableRole;if("cell"==r||"header_cell"==r)return t.doc.resolve(n)}for(var o=t.nodeBefore,i=t.pos;o;o=o.lastChild,i--){var s=o.type.spec.tableRole;if("cell"==s||"header_cell"==s)return t.doc.resolve(i-o.nodeSize)}}(e.$head)}function C(t){return"row"==t.parent.type.spec.tableRole&&t.nodeAfter}function M(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function O(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function T(t){return h.get(t.node(-1)).findCell(t.pos-t.start(-1))}function N(t){return h.get(t.node(-1)).colCount(t.pos-t.start(-1))}function A(t,e,n){var r=t.start(-1),o=h.get(t.node(-1)).nextCell(t.pos-r,e,n);return null==o?null:t.node(0).resolve(r+o)}function D(t,e,n){var r={};for(var o in t)r[o]=t[o];return r[e]=n,r}function E(t,e,n){void 0===n&&(n=1);var r=D(t,"colspan",t.colspan-n);return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some((function(t){return t>0}))||(r.colwidth=null)),r}function R(t,e,n){void 0===n&&(n=1);var r=D(t,"colspan",t.colspan+n);if(r.colwidth){r.colwidth=r.colwidth.slice();for(var o=0;o<n;o++)r.colwidth.splice(e,0,0)}return r}function _(t,e,n){for(var r=w(e.type.schema).header_cell,o=0;o<t.height;o++)if(e.nodeAt(t.map[n+o*t.width]).type!=r)return!1;return!0}var I=function(t){function e(e,n){void 0===n&&(n=e);var r=e.node(-1),o=h.get(r),s=e.start(-1),a=o.rectBetween(e.pos-s,n.pos-s),c=e.node(0),l=o.cellsInRect(a).filter((function(t){return t!=n.pos-s}));l.unshift(n.pos-s);var u=l.map((function(t){var e=r.nodeAt(t),n=t+s+1;return new i.SelectionRange(c.resolve(n),c.resolve(n+e.content.size))}));t.call(this,u[0].$from,u[0].$to,u),this.$anchorCell=e,this.$headCell=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.map=function(t,n){var r=t.resolve(n.map(this.$anchorCell.pos)),o=t.resolve(n.map(this.$headCell.pos));if(C(r)&&C(o)&&O(r,o)){var s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?e.rowSelection(r,o):s&&this.isColSelection()?e.colSelection(r,o):new e(r,o)}return i.TextSelection.between(r,o)},e.prototype.content=function(){for(var t=this.$anchorCell.node(-1),e=h.get(t),n=this.$anchorCell.start(-1),r=e.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),o={},i=[],a=r.top;a<r.bottom;a++){for(var c=[],l=a*e.width+r.left,u=r.left;u<r.right;u++,l++){var p=e.map[l];if(!o[p]){o[p]=!0;var f=e.findCell(p),d=t.nodeAt(p),m=r.left-f.left,v=f.right-r.right;if(m>0||v>0){var g=d.attrs;m>0&&(g=E(g,0,m)),v>0&&(g=E(g,g.colspan-v,v)),d=f.left<r.left?d.type.createAndFill(g):d.type.create(g,d.content)}if(f.top<r.top||f.bottom>r.bottom){var y=D(d.attrs,"rowspan",Math.min(f.bottom,r.bottom)-Math.max(f.top,r.top));d=f.top<r.top?d.type.createAndFill(y):d.type.create(y,d.content)}c.push(d)}}i.push(t.child(a).copy(s.Fragment.from(c)))}var w=this.isColSelection()&&this.isRowSelection()?t:i;return new s.Slice(s.Fragment.from(w),1,1)},e.prototype.replace=function(e,n){void 0===n&&(n=s.Slice.empty);for(var r=e.steps.length,o=this.ranges,i=0;i<o.length;i++){var a=o[i],c=a.$from,l=a.$to,u=e.mapping.slice(r);e.replace(u.map(c.pos),u.map(l.pos),i?s.Slice.empty:n)}var p=t.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);p&&e.setSelection(p)},e.prototype.replaceWith=function(t,e){this.replace(t,new s.Slice(s.Fragment.from(e),0,0))},e.prototype.forEachCell=function(t){for(var e=this.$anchorCell.node(-1),n=h.get(e),r=this.$anchorCell.start(-1),o=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r)),i=0;i<o.length;i++)t(e.nodeAt(o[i]),r+o[i])},e.prototype.isColSelection=function(){var t=this.$anchorCell.index(-1),e=this.$headCell.index(-1);if(Math.min(t,e)>0)return!1;var n=t+this.$anchorCell.nodeAfter.attrs.rowspan,r=e+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount},e.colSelection=function(t,n){void 0===n&&(n=t);var r=h.get(t.node(-1)),o=t.start(-1),i=r.findCell(t.pos-o),s=r.findCell(n.pos-o),a=t.node(0);return i.top<=s.top?(i.top>0&&(t=a.resolve(o+r.map[i.left])),s.bottom<r.height&&(n=a.resolve(o+r.map[r.width*(r.height-1)+s.right-1]))):(s.top>0&&(n=a.resolve(o+r.map[s.left])),i.bottom<r.height&&(t=a.resolve(o+r.map[r.width*(r.height-1)+i.right-1]))),new e(t,n)},e.prototype.isRowSelection=function(){var t=h.get(this.$anchorCell.node(-1)),e=this.$anchorCell.start(-1),n=t.colCount(this.$anchorCell.pos-e),r=t.colCount(this.$headCell.pos-e);if(Math.min(n,r)>0)return!1;var o=n+this.$anchorCell.nodeAfter.attrs.colspan,i=r+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,i)==t.width},e.prototype.eq=function(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos},e.rowSelection=function(t,n){void 0===n&&(n=t);var r=h.get(t.node(-1)),o=t.start(-1),i=r.findCell(t.pos-o),s=r.findCell(n.pos-o),a=t.node(0);return i.left<=s.left?(i.left>0&&(t=a.resolve(o+r.map[i.top*r.width])),s.right<r.width&&(n=a.resolve(o+r.map[r.width*(s.top+1)-1]))):(s.left>0&&(n=a.resolve(o+r.map[s.top*r.width])),i.right<r.width&&(t=a.resolve(o+r.map[r.width*(i.top+1)-1]))),new e(t,n)},e.prototype.toJSON=function(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}},e.fromJSON=function(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))},e.create=function(t,n,r){return void 0===r&&(r=n),new e(t.resolve(n),t.resolve(r))},e.prototype.getBookmark=function(){return new z(this.$anchorCell.pos,this.$headCell.pos)},e}(i.Selection);I.prototype.visible=!1,i.Selection.jsonID("cell",I);var z=function(t,e){this.anchor=t,this.head=e};function P(t){if(!(t.selection instanceof I))return null;var e=[];return t.selection.forEachCell((function(t,n){e.push(c.Decoration.node(n,n+t.nodeSize,{class:"selectedCell"}))})),c.DecorationSet.create(t.doc,e)}function $(t){if(!t.size)return null;for(var e=t.content,n=t.openStart,r=t.openEnd;1==e.childCount&&(n>0&&r>0||"table"==e.firstChild.type.spec.tableRole);)n--,r--,e=e.firstChild.content;var o=e.firstChild,i=o.type.spec.tableRole,a=o.type.schema,c=[];if("row"==i)for(var l=0;l<e.childCount;l++){var u=e.child(l).content,p=l?0:Math.max(0,n-1),f=l<e.childCount-1?0:Math.max(0,r-1);(p||f)&&(u=F(w(a).row,new s.Slice(u,p,f)).content),c.push(u)}else{if("cell"!=i&&"header_cell"!=i)return null;c.push(n||r?F(w(a).row,new s.Slice(e,n,r)).content:e)}return function(t,e){for(var n=[],r=0;r<e.length;r++)for(var o=e[r],i=o.childCount-1;i>=0;i--)for(var a=o.child(i).attrs,c=a.rowspan,l=a.colspan,u=r;u<r+c;u++)n[u]=(n[u]||0)+l;for(var p=0,f=0;f<n.length;f++)p=Math.max(p,n[f]);for(var d=0;d<n.length;d++)if(d>=e.length&&e.push(s.Fragment.empty),n[d]<p){for(var h=w(t).cell.createAndFill(),m=[],v=n[d];v<p;v++)m.push(h);e[d]=e[d].append(s.Fragment.from(m))}return{height:e.length,width:p,rows:e}}(a,c)}function F(t,e){var n=t.createAndFill();return new l.Transform(n).replace(0,n.content.size,e).doc}function B(t,e,n){var r=t.width,o=t.height,i=t.rows;if(r!=e){for(var a=[],c=[],l=0;l<i.length;l++){for(var u=i[l],p=[],f=a[l]||0,d=0;f<e;d++){var h=u.child(d%u.childCount);f+h.attrs.colspan>e&&(h=h.type.create(E(h.attrs,h.attrs.colspan,f+h.attrs.colspan-e),h.content)),p.push(h),f+=h.attrs.colspan;for(var m=1;m<h.attrs.rowspan;m++)a[l+m]=(a[l+m]||0)+h.attrs.colspan}c.push(s.Fragment.from(p))}i=c,r=e}if(o!=n){for(var v=[],g=0,y=0;g<n;g++,y++){for(var w=[],b=i[y%o],S=0;S<b.childCount;S++){var k=b.child(S);g+k.attrs.rowspan>n&&(k=k.type.create(D(k.attrs,"rowspan",Math.max(1,n-k.attrs.rowspan)),k.content)),w.push(k)}v.push(s.Fragment.from(w))}i=v,o=n}return{width:r,height:o,rows:i}}function L(t,e,n,r,o,i,s,a){if(0==s||s==e.height)return!1;for(var c=!1,l=o;l<i;l++){var u=s*e.width+l,p=e.map[u];if(e.map[u-e.width]==p){c=!0;var f=n.nodeAt(p),d=e.findCell(p),h=d.top,m=d.left;t.setNodeMarkup(t.mapping.slice(a).map(p+r),null,D(f.attrs,"rowspan",s-h)),t.insert(t.mapping.slice(a).map(e.positionAt(s,m,n)),f.type.createAndFill(D(f.attrs,"rowspan",h+f.attrs.rowspan-s))),l+=f.attrs.colspan-1}}return c}function V(t,e,n,r,o,i,s,a){if(0==s||s==e.width)return!1;for(var c=!1,l=o;l<i;l++){var u=l*e.width+s,p=e.map[u];if(e.map[u-1]==p){c=!0;var f=n.nodeAt(p),d=e.colCount(p),h=t.mapping.slice(a).map(p+r);t.setNodeMarkup(h,null,E(f.attrs,s-d,f.attrs.colspan-(s-d))),t.insert(h+f.nodeSize,f.type.createAndFill(E(f.attrs,0,s-d))),l+=f.attrs.rowspan-1}}return c}function j(t,e,n,r,o){var i=n?t.doc.nodeAt(n-1):t.doc,a=h.get(i),c=r.top,l=r.left,u=l+o.width,p=c+o.height,f=t.tr,d=0;function m(){i=n?f.doc.nodeAt(n-1):f.doc,a=h.get(i),d=f.mapping.maps.length}(function(t,e,n,r,o,i,a){var c,l,u=w(t.doc.type.schema);if(o>e.width)for(var p=0,f=0;p<e.height;p++){var d=n.child(p);f+=d.nodeSize;var h=[],m=void 0;m=null==d.lastChild||d.lastChild.type==u.cell?c||(c=u.cell.createAndFill()):l||(l=u.header_cell.createAndFill());for(var v=e.width;v<o;v++)h.push(m);t.insert(t.mapping.slice(a).map(f-1+r),h)}if(i>e.height){for(var g=[],y=0,b=(e.height-1)*e.width;y<Math.max(e.width,o);y++){var S=!(y>=e.width)&&n.nodeAt(e.map[b+y]).type==u.header_cell;g.push(S?l||(l=u.header_cell.createAndFill()):c||(c=u.cell.createAndFill()))}for(var k=u.row.create(null,s.Fragment.from(g)),x=[],C=e.height;C<i;C++)x.push(k);t.insert(t.mapping.slice(a).map(r+n.nodeSize-2),x)}return!(!c&&!l)})(f,a,i,n,u,p,d)&&m(),L(f,a,i,n,l,u,c,d)&&m(),L(f,a,i,n,l,u,p,d)&&m(),V(f,a,i,n,c,p,l,d)&&m(),V(f,a,i,n,c,p,u,d)&&m();for(var v=c;v<p;v++){var g=a.positionAt(v,l,i),y=a.positionAt(v,u,i);f.replace(f.mapping.slice(d).map(g+n),f.mapping.slice(d).map(y+n),new s.Slice(o.rows[v-c],0,0))}m(),f.setSelection(new I(f.doc.resolve(n+a.positionAt(c,l,i)),f.doc.resolve(n+a.positionAt(p-1,u-1,i)))),e(f)}z.prototype.map=function(t){return new z(t.map(this.anchor),t.map(this.head))},z.prototype.resolve=function(t){var e=t.resolve(this.anchor),n=t.resolve(this.head);return"row"==e.parent.type.spec.tableRole&&"row"==n.parent.type.spec.tableRole&&e.index()<e.parent.childCount&&n.index()<n.parent.childCount&&O(e,n)?new I(e,n):i.Selection.near(n,1)};var W=Object(a.keydownHandler)({ArrowLeft:q("horiz",-1),ArrowRight:q("horiz",1),ArrowUp:q("vert",-1),ArrowDown:q("vert",1),"Shift-ArrowLeft":H("horiz",-1),"Shift-ArrowRight":H("horiz",1),"Shift-ArrowUp":H("vert",-1),"Shift-ArrowDown":H("vert",1),Backspace:J,"Mod-Backspace":J,Delete:J,"Mod-Delete":J});function K(t,e,n){return!n.eq(t.selection)&&(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function q(t,e){return function(n,r,o){var s=n.selection;if(s instanceof I)return K(n,r,i.Selection.near(s.$headCell,e));if("horiz"!=t&&!s.empty)return!1;var a=Y(o,t,e);if(null==a)return!1;if("horiz"==t)return K(n,r,i.Selection.near(n.doc.resolve(s.head+e),e));var c,l=n.doc.resolve(a),u=A(l,t,e);return c=u?i.Selection.near(u,1):e<0?i.Selection.near(n.doc.resolve(l.before(-1)),-1):i.Selection.near(n.doc.resolve(l.after(-1)),1),K(n,r,c)}}function H(t,e){return function(n,r,o){var i=n.selection;if(!(i instanceof I)){var s=Y(o,t,e);if(null==s)return!1;i=new I(n.doc.resolve(s))}var a=A(i.$headCell,t,e);return!!a&&K(n,r,new I(i.$anchorCell,a))}}function J(t,e){var n=t.selection;if(!(n instanceof I))return!1;if(e){var r=t.tr,o=w(t.schema).cell.createAndFill().content;n.forEachCell((function(t,e){t.content.eq(o)||r.replace(r.mapping.map(e+1),r.mapping.map(e+t.nodeSize-1),new s.Slice(o,0,0))})),r.docChanged&&e(r)}return!0}function U(t,e){var n=S(t.state.doc.resolve(e));return!!n&&(t.dispatch(t.state.tr.setSelection(new I(n))),!0)}function G(t,e,n){if(!k(t.state))return!1;var r=$(n),o=t.state.selection;if(o instanceof I){r||(r={width:1,height:1,rows:[s.Fragment.from(F(w(t.state.schema).cell,n))]});var i=o.$anchorCell.node(-1),a=o.$anchorCell.start(-1),c=h.get(i).rectBetween(o.$anchorCell.pos-a,o.$headCell.pos-a);return r=B(r,c.right-c.left,c.bottom-c.top),j(t.state,t.dispatch,a,c,r),!0}if(r){var l=x(t.state),u=l.start(-1);return j(t.state,t.dispatch,u,h.get(l.node(-1)).findCell(l.pos-u),r),!0}return!1}function X(t,e){if(!e.ctrlKey&&!e.metaKey){var n,r=Q(t,e.target);if(e.shiftKey&&t.state.selection instanceof I)o(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&null!=(n=S(t.state.selection.$anchor))&&Z(t,e).pos!=n.pos)o(n,e),e.preventDefault();else if(!r)return;t.root.addEventListener("mouseup",i),t.root.addEventListener("dragstart",i),t.root.addEventListener("mousemove",s)}function o(e,n){var r=Z(t,n),o=null==b.getState(t.state);if(!r||!O(e,r)){if(!o)return;r=e}var i=new I(e,r);if(o||!t.state.selection.eq(i)){var s=t.state.tr.setSelection(i);o&&s.setMeta(b,e.pos),t.dispatch(s)}}function i(){t.root.removeEventListener("mouseup",i),t.root.removeEventListener("dragstart",i),t.root.removeEventListener("mousemove",s),null!=b.getState(t.state)&&t.dispatch(t.state.tr.setMeta(b,-1))}function s(n){var s,a=b.getState(t.state);if(null!=a)s=t.state.doc.resolve(a);else if(Q(t,n.target)!=r&&!(s=Z(t,e)))return i();s&&o(s,n)}}function Y(t,e,n){if(!(t.state.selection instanceof i.TextSelection))return null;for(var r=t.state.selection.$head,o=r.depth-1;o>=0;o--){var s=r.node(o);if((n<0?r.index(o):r.indexAfter(o))!=(n<0?0:s.childCount))return null;if("cell"==s.type.spec.tableRole||"header_cell"==s.type.spec.tableRole){var a=r.before(o),c="vert"==e?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(c)?a:null}}return null}function Q(t,e){for(;e&&e!=t.dom;e=e.parentNode)if("TD"==e.nodeName||"TH"==e.nodeName)return e}function Z(t,e){var n=t.posAtCoords({left:e.clientX,top:e.clientY});return n&&n?S(t.state.doc.resolve(n.pos)):null}var tt=new i.PluginKey("fix-tables");function et(t,e){var n,r=function(e,r){"table"==e.type.spec.tableRole&&(n=function(t,e,n,r){var o=h.get(e);if(!o.problems)return r;r||(r=t.tr);for(var i,s,a=[],c=0;c<o.height;c++)a.push(0);for(var l=0;l<o.problems.length;l++){var u=o.problems[l];if("collision"==u.type){for(var p=e.nodeAt(u.pos),f=0;f<p.attrs.rowspan;f++)a[u.row+f]+=u.n;r.setNodeMarkup(r.mapping.map(n+1+u.pos),null,E(p.attrs,p.attrs.colspan-u.n,u.n))}else if("missing"==u.type)a[u.row]+=u.n;else if("overlong_rowspan"==u.type){var d=e.nodeAt(u.pos);r.setNodeMarkup(r.mapping.map(n+1+u.pos),null,D(d.attrs,"rowspan",d.attrs.rowspan-u.n))}else if("colwidth mismatch"==u.type){var m=e.nodeAt(u.pos);r.setNodeMarkup(r.mapping.map(n+1+u.pos),null,D(m.attrs,"colwidth",u.colwidth))}}for(var v=0;v<a.length;v++)a[v]&&(null==i&&(i=v),s=v);for(var g=0,y=n+1;g<o.height;g++){var b=e.child(g),S=y+b.nodeSize,k=a[g];if(k>0){var x="cell";b.firstChild&&(x=b.firstChild.type.spec.tableRole);for(var C=[],M=0;M<k;M++)C.push(w(t.schema)[x].createAndFill());var O=0!=g&&i!=g-1||s!=g?S-1:y+1;r.insert(r.mapping.map(O),C)}y=S}return r.setMeta(tt,{fixTables:!0})}(t,e,r,n))};return e?e.doc!=t.doc&&function t(e,n,r,o){var i=e.childCount,s=n.childCount;t:for(var a=0,c=0;a<s;a++){for(var l=n.child(a),u=c,p=Math.min(i,a+3);u<p;u++)if(e.child(u)==l){c=u+1,r+=l.nodeSize;continue t}o(l,r),c<i&&e.child(c).sameMarkup(l)?t(e.child(c),l,r+1,o):l.nodesBetween(0,l.content.size,o,r+1),r+=l.nodeSize}}(e.doc,t.doc,0,r):t.doc.descendants(r),n}function nt(t){var e,n=t.selection,r=x(t),o=r.node(-1),i=r.start(-1),s=h.get(o);return(e=n instanceof I?s.rectBetween(n.$anchorCell.pos-i,n.$headCell.pos-i):s.findCell(r.pos-i)).tableStart=i,e.map=s,e.table=o,e}function rt(t,e,n){var r=e.map,o=e.tableStart,i=e.table,s=n>0?-1:0;_(r,i,n+s)&&(s=0==n||n==r.width?null:0);for(var a=0;a<r.height;a++){var c=a*r.width+n;if(n>0&&n<r.width&&r.map[c-1]==r.map[c]){var l=r.map[c],u=i.nodeAt(l);t.setNodeMarkup(t.mapping.map(o+l),null,R(u.attrs,n-r.colCount(l))),a+=u.attrs.rowspan-1}else{var p=null==s?w(i.type.schema).cell:i.nodeAt(r.map[c+s]).type,f=r.positionAt(a,n,i);t.insert(t.mapping.map(o+f),p.createAndFill())}}return t}function ot(t,e){if(!k(t))return!1;if(e){var n=nt(t);e(rt(t.tr,n,n.left))}return!0}function it(t,e){if(!k(t))return!1;if(e){var n=nt(t);e(rt(t.tr,n,n.right))}return!0}function st(t,e,n){for(var r=e.map,o=e.table,i=e.tableStart,s=t.mapping.maps.length,a=0;a<r.height;){var c=a*r.width+n,l=r.map[c],u=o.nodeAt(l);if(n>0&&r.map[c-1]==l||n<r.width-1&&r.map[c+1]==l)t.setNodeMarkup(t.mapping.slice(s).map(i+l),null,E(u.attrs,n-r.colCount(l)));else{var p=t.mapping.slice(s).map(i+l);t.delete(p,p+u.nodeSize)}a+=u.attrs.rowspan}}function at(t,e){if(!k(t))return!1;if(e){var n=nt(t),r=t.tr;if(0==n.left&&n.right==n.map.width)return!1;for(var o=n.right-1;st(r,n,o),o!=n.left;o--)n.table=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc,n.map=h.get(n.table);e(r)}return!0}function ct(t,e,n){for(var r=w(e.type.schema).header_cell,o=0;o<t.width;o++)if(e.nodeAt(t.map[o+n*t.width]).type!=r)return!1;return!0}function lt(t,e,n){for(var r=e.map,o=e.tableStart,i=e.table,s=o,a=0;a<n;a++)s+=i.child(a).nodeSize;var c=[],l=n>0?-1:0;ct(r,i,n+l)&&(l=0==n||n==r.height?null:0);for(var u=0,p=r.width*n;u<r.width;u++,p++)if(n>0&&n<r.height&&r.map[p]==r.map[p-r.width]){var f=r.map[p],d=i.nodeAt(f).attrs;t.setNodeMarkup(o+f,null,D(d,"rowspan",d.rowspan+1)),u+=d.colspan-1}else{var h=null==l?w(i.type.schema).cell:i.nodeAt(r.map[p+l*r.width]).type;c.push(h.createAndFill())}return t.insert(s,w(i.type.schema).row.create(null,c)),t}function ut(t,e){if(!k(t))return!1;if(e){var n=nt(t);e(lt(t.tr,n,n.top))}return!0}function pt(t,e){if(!k(t))return!1;if(e){var n=nt(t);e(lt(t.tr,n,n.bottom))}return!0}function ft(t,e,n){for(var r=e.map,o=e.table,i=e.tableStart,s=0,a=0;a<n;a++)s+=o.child(a).nodeSize;var c=s+o.child(n).nodeSize,l=t.mapping.maps.length;t.delete(s+i,c+i);for(var u=0,p=n*r.width;u<r.width;u++,p++){var f=r.map[p];if(n>0&&f==r.map[p-r.width]){var d=o.nodeAt(f).attrs;t.setNodeMarkup(t.mapping.slice(l).map(f+i),null,D(d,"rowspan",d.rowspan-1)),u+=d.colspan-1}else if(n<r.width&&f==r.map[p+r.width]){var h=o.nodeAt(f),m=h.type.create(D(h.attrs,"rowspan",h.attrs.rowspan-1),h.content),v=r.positionAt(n+1,u,o);t.insert(t.mapping.slice(l).map(i+v),m),u+=h.attrs.colspan-1}}}function dt(t,e){if(!k(t))return!1;if(e){var n=nt(t),r=t.tr;if(0==n.top&&n.bottom==n.map.height)return!1;for(var o=n.bottom-1;ft(r,n,o),o!=n.top;o--)n.table=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc,n.map=h.get(n.table);e(r)}return!0}function ht(t){var e=t.content;return 1==e.childCount&&e.firstChild.isTextblock&&0==e.firstChild.childCount}function mt(t,e){var n=t.selection;if(!(n instanceof I)||n.$anchorCell.pos==n.$headCell.pos)return!1;var r=nt(t),o=r.map;if(function(t,e){for(var n=t.width,r=t.height,o=t.map,i=e.top*n+e.left,s=i,a=(e.bottom-1)*n+e.left,c=i+(e.right-e.left-1),l=e.top;l<e.bottom;l++){if(e.left>0&&o[s]==o[s-1]||e.right<n&&o[c]==o[c+1])return!0;s+=n,c+=n}for(var u=e.left;u<e.right;u++){if(e.top>0&&o[i]==o[i-n]||e.bottom<r&&o[a]==o[a+n])return!0;i++,a++}return!1}(o,r))return!1;if(e){for(var i,a,c=t.tr,l={},u=s.Fragment.empty,p=r.top;p<r.bottom;p++)for(var f=r.left;f<r.right;f++){var d=o.map[p*o.width+f],h=r.table.nodeAt(d);if(!l[d])if(l[d]=!0,null==i)i=d,a=h;else{ht(h)||(u=u.append(h.content));var m=c.mapping.map(d+r.tableStart);c.delete(m,m+h.nodeSize)}}if(c.setNodeMarkup(i+r.tableStart,null,D(R(a.attrs,a.attrs.colspan,r.right-r.left-a.attrs.colspan),"rowspan",r.bottom-r.top)),u.size){var v=i+1+a.content.size,g=ht(a)?i+1:v;c.replaceWith(g+r.tableStart,v+r.tableStart,u)}c.setSelection(new I(c.doc.resolve(i+r.tableStart))),e(c)}return!0}function vt(t,e){var n=w(t.schema);return gt((function(t){var e=t.node;return n[e.type.spec.tableRole]}))(t,e)}function gt(t){return function(e,n){var r,o,i=e.selection;if(i instanceof I){if(i.$anchorCell.pos!=i.$headCell.pos)return!1;r=i.$anchorCell.nodeAfter,o=i.$anchorCell.pos}else{if(!(r=function(t){for(var e=t.depth;e>0;e--){var n=t.node(e).type.spec.tableRole;if("cell"===n||"header_cell"===n)return t.node(e)}return null}(i.$from)))return!1;o=S(i.$from).pos}if(1==r.attrs.colspan&&1==r.attrs.rowspan)return!1;if(n){var s=r.attrs,a=[],c=s.colwidth;s.rowspan>1&&(s=D(s,"rowspan",1)),s.colspan>1&&(s=D(s,"colspan",1));for(var l,u=nt(e),p=e.tr,f=0;f<u.right-u.left;f++)a.push(c?D(s,"colwidth",c&&c[f]?[c[f]]:null):s);for(var d=u.top;d<u.bottom;d++){var h=u.map.positionAt(d,u.left,u.table);d==u.top&&(h+=r.nodeSize);for(var m=u.left,v=0;m<u.right;m++,v++)m==u.left&&d==u.top||p.insert(l=p.mapping.map(h+u.tableStart,1),t({node:r,row:d,col:m}).createAndFill(a[v]))}p.setNodeMarkup(o,t({node:r,row:u.top,col:u.left}),a[0]),i instanceof I&&p.setSelection(new I(p.doc.resolve(i.$anchorCell.pos),l&&p.doc.resolve(l))),n(p)}return!0}}function yt(t,e){return function(n,r){if(!k(n))return!1;var o=x(n);if(o.nodeAfter.attrs[t]===e)return!1;if(r){var i=n.tr;n.selection instanceof I?n.selection.forEachCell((function(n,r){n.attrs[t]!==e&&i.setNodeMarkup(r,null,D(n.attrs,t,e))})):i.setNodeMarkup(o.pos,null,D(o.nodeAfter.attrs,t,e)),r(i)}return!0}}function wt(t,e,n){for(var r=e.map.cellsInRect({left:0,top:0,right:"row"==t?e.map.width:1,bottom:"column"==t?e.map.height:1}),o=0;o<r.length;o++){var i=e.table.nodeAt(r[o]);if(i&&i.type!==n.header_cell)return!1}return!0}function bt(t,e){return(e=e||{useDeprecatedLogic:!1}).useDeprecatedLogic?function(t){return function(e,n){if(!k(e))return!1;if(n){for(var r=w(e.schema),o=nt(e),i=e.tr,s=o.map.cellsInRect("column"==t?new d(o.left,0,o.right,o.map.height):"row"==t?new d(0,o.top,o.map.width,o.bottom):o),a=s.map((function(t){return o.table.nodeAt(t)})),c=0;c<s.length;c++)a[c].type==r.header_cell&&i.setNodeMarkup(o.tableStart+s[c],r.cell,a[c].attrs);if(0==i.steps.length)for(var l=0;l<s.length;l++)i.setNodeMarkup(o.tableStart+s[l],r.header_cell,a[l].attrs);n(i)}return!0}}(t):function(e,n){if(!k(e))return!1;if(n){var r=w(e.schema),o=nt(e),i=e.tr,s=wt("row",o,r),a=wt("column",o,r),c=("column"===t?s:"row"===t&&a)?1:0,l="column"==t?new d(0,c,1,o.map.height):"row"==t?new d(c,0,o.map.width,1):o,u="column"==t?a?r.cell:r.header_cell:"row"==t?s?r.cell:r.header_cell:r.cell;o.map.cellsInRect(l).forEach((function(t){var e=t+o.tableStart,n=i.doc.nodeAt(e);n&&i.setNodeMarkup(e,u,n.attrs)})),n(i)}return!0}}var St=bt("row",{useDeprecatedLogic:!0}),kt=bt("column",{useDeprecatedLogic:!0}),xt=bt("cell",{useDeprecatedLogic:!0});function Ct(t){return function(e,n){if(!k(e))return!1;var r=function(t,e){if(e<0){var n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(var r=t.index(-1)-1,o=t.before();r>=0;r--){var i=t.node(-1).child(r);if(i.childCount)return o-1-i.lastChild.nodeSize;o-=i.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;for(var s=t.node(-1),a=t.indexAfter(-1),c=t.after();a<s.childCount;a++){var l=s.child(a);if(l.childCount)return c+1;c+=l.nodeSize}}}(x(e),t);if(null!=r){if(n){var o=e.doc.resolve(r);n(e.tr.setSelection(i.TextSelection.between(o,M(o))).scrollIntoView())}return!0}}}function Mt(t,e){for(var n=t.selection.$anchor,r=n.depth;r>0;r--){if("table"==n.node(r).type.spec.tableRole)return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0}return!1}var Ot=function(t,e){this.node=t,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Tt(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))};function Tt(t,e,n,r,o,i){for(var s=0,a=!0,c=e.firstChild,l=t.firstChild,u=0,p=0;u<l.childCount;u++)for(var f=l.child(u).attrs,d=f.colspan,h=f.colwidth,m=0;m<d;m++,p++){var v=o==p?i:h&&h[m],g=v?v+"px":"";s+=v||r,v||(a=!1),c?(c.style.width!=g&&(c.style.width=g),c=c.nextSibling):e.appendChild(document.createElement("col")).style.width=g}for(;c;){var y=c.nextSibling;c.parentNode.removeChild(c),c=y}a?(n.style.width=s+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=s+"px")}Ot.prototype.update=function(t){return t.type==this.node.type&&(this.node=t,Tt(t,this.colgroup,this.table,this.cellMinWidth),!0)},Ot.prototype.ignoreMutation=function(t){return"attributes"==t.type&&(t.target==this.table||this.colgroup.contains(t.target))};var Nt=new i.PluginKey("tableColumnResizing");function At(t){void 0===t&&(t={});var e=t.handleWidth;void 0===e&&(e=5);var n=t.cellMinWidth;void 0===n&&(n=25);var r=t.View;void 0===r&&(r=Ot);var o=t.lastColumnResizable;return void 0===o&&(o=!0),new i.Plugin({key:Nt,state:{init:function(t,e){return this.spec.props.nodeViews[w(e.schema).table.name]=function(t,e){return new r(t,n,e)},new Dt(-1,!1)},apply:function(t,e){return e.apply(t)}},props:{attributes:function(t){return Nt.getState(t).activeHandle>-1?{class:"resize-cursor"}:null},handleDOMEvents:{mousemove:function(t,n){!function(t,e,n,r,o){var i=Nt.getState(t.state);if(!i.dragging){var s=function(t){for(;t&&"TD"!=t.nodeName&&"TH"!=t.nodeName;)t=t.classList.contains("ProseMirror")?null:t.parentNode;return t}(e.target),a=-1;if(s){var c=s.getBoundingClientRect(),l=c.left,u=c.right;e.clientX-l<=n?a=Et(t,e,"left"):u-e.clientX<=n&&(a=Et(t,e,"right"))}if(a!=i.activeHandle){if(!o&&-1!==a){var p=t.state.doc.resolve(a),f=p.node(-1),d=h.get(f),m=p.start(-1);if(d.colCount(p.pos-m)+p.nodeAfter.attrs.colspan-1==d.width-1)return}_t(t,a)}}}(t,n,e,0,o)},mouseleave:function(t){!function(t){var e=Nt.getState(t.state);e.activeHandle>-1&&!e.dragging&&_t(t,-1)}(t)},mousedown:function(t,e){!function(t,e,n){var r=Nt.getState(t.state);if(-1==r.activeHandle||r.dragging)return!1;var o=t.state.doc.nodeAt(r.activeHandle),i=function(t,e,n){var r=n.colspan,o=n.colwidth,i=o&&o[o.length-1];if(i)return i;var s=t.domAtPos(e),a=s.node.childNodes[s.offset].offsetWidth,c=r;if(o)for(var l=0;l<r;l++)o[l]&&(a-=o[l],c--);return a/c}(t,r.activeHandle,o.attrs);function s(e){window.removeEventListener("mouseup",s),window.removeEventListener("mousemove",a);var r=Nt.getState(t.state);r.dragging&&(!function(t,e,n){for(var r=t.state.doc.resolve(e),o=r.node(-1),i=h.get(o),s=r.start(-1),a=i.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,c=t.state.tr,l=0;l<i.height;l++){var u=l*i.width+a;if(!l||i.map[u]!=i.map[u-i.width]){var p=i.map[u],f=o.nodeAt(p).attrs,d=1==f.colspan?0:a-i.colCount(p);if(!f.colwidth||f.colwidth[d]!=n){var m=f.colwidth?f.colwidth.slice():It(f.colspan);m[d]=n,c.setNodeMarkup(s+p,null,D(f,"colwidth",m))}}}c.docChanged&&t.dispatch(c)}(t,r.activeHandle,Rt(r.dragging,e,n)),t.dispatch(t.state.tr.setMeta(Nt,{setDragging:null})))}function a(e){if(!e.which)return s(e);var r=Nt.getState(t.state),o=Rt(r.dragging,e,n);!function(t,e,n,r){var o=t.state.doc.resolve(e),i=o.node(-1),s=o.start(-1),a=h.get(i).colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1,c=t.domAtPos(o.start(-1)).node;for(;"TABLE"!=c.nodeName;)c=c.parentNode;Tt(i,c.firstChild,c,r,a,n)}(t,r.activeHandle,o,n)}t.dispatch(t.state.tr.setMeta(Nt,{setDragging:{startX:e.clientX,startWidth:i}})),window.addEventListener("mouseup",s),window.addEventListener("mousemove",a),e.preventDefault()}(t,e,n)}},decorations:function(t){var e=Nt.getState(t);if(e.activeHandle>-1)return function(t,e){for(var n=[],r=t.doc.resolve(e),o=r.node(-1),i=h.get(o),s=r.start(-1),a=i.colCount(r.pos-s)+r.nodeAfter.attrs.colspan,l=0;l<i.height;l++){var u=a+l*i.width-1;if(!(a!=i.width&&i.map[u]==i.map[u+1]||0!=l&&i.map[u-1]==i.map[u-1-i.width])){var p=i.map[u],f=s+p+o.nodeAt(p).nodeSize-1,d=document.createElement("div");d.className="column-resize-handle",n.push(c.Decoration.widget(f,d))}}return c.DecorationSet.create(t.doc,n)}(t,e.activeHandle)},nodeViews:{}}})}var Dt=function(t,e){this.activeHandle=t,this.dragging=e};function Et(t,e,n){var r=t.posAtCoords({left:e.clientX,top:e.clientY});if(!r)return-1;var o=r.pos,i=S(t.state.doc.resolve(o));if(!i)return-1;if("right"==n)return i.pos;var s=h.get(i.node(-1)),a=i.start(-1),c=s.map.indexOf(i.pos-a);return c%s.width==0?-1:a+s.map[c-1]}function Rt(t,e,n){var r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function _t(t,e){t.dispatch(t.state.tr.setMeta(Nt,{setHandle:e}))}function It(t){for(var e=[],n=0;n<t;n++)e.push(0);return e}function zt(t){void 0===t&&(t={});var e=t.allowTableNodeSelection;return void 0===e&&(e=!1),new i.Plugin({key:b,state:{init:function(){return null},apply:function(t,e){var n=t.getMeta(b);if(null!=n)return-1==n?null:n;if(null==e||!t.docChanged)return e;var r=t.mapping.mapResult(e),o=r.deleted,i=r.pos;return o?null:i}},props:{decorations:P,handleDOMEvents:{mousedown:X},createSelectionBetween:function(t){if(null!=b.getState(t.state))return t.state.selection},handleTripleClick:U,handleKeyDown:W,handlePaste:G},appendTransaction:function(t,n,r){return function(t,e,n){var r,o,s=(e||t).selection,a=(e||t).doc;if(s instanceof i.NodeSelection&&(o=s.node.type.spec.tableRole)){if("cell"==o||"header_cell"==o)r=I.create(a,s.from);else if("row"==o){var c=a.resolve(s.from+1);r=I.rowSelection(c,c)}else if(!n){var l=h.get(s.node),u=s.from+1,p=u+l.map[l.width*l.height-1];r=I.create(a,u+1,p)}}else s instanceof i.TextSelection&&function(t){var e=t.$from,n=t.$to;if(e.pos==n.pos||e.pos<e.pos-6)return!1;for(var r=e.pos,o=n.pos,i=e.depth;i>=0&&!(e.after(i+1)<e.end(i));i--,r++);for(var s=n.depth;s>=0&&!(n.before(s+1)>n.start(s));s--,o--);return r==o&&/row|table/.test(e.node(i).type.spec.tableRole)}(s)?r=i.TextSelection.create(a,s.from):s instanceof i.TextSelection&&function(t){for(var e,n,r=t.$from,o=t.$to,i=r.depth;i>0;i--){var s=r.node(i);if("cell"===s.type.spec.tableRole||"header_cell"===s.type.spec.tableRole){e=s;break}}for(var a=o.depth;a>0;a--){var c=o.node(a);if("cell"===c.type.spec.tableRole||"header_cell"===c.type.spec.tableRole){n=c;break}}return e!==n&&0===o.parentOffset}(s)&&(r=i.TextSelection.create(a,s.$from.start(),s.$from.end()));return r&&(e||(e=t.tr)).setSelection(r),e}(r,et(r,n),e)}})}Dt.prototype.apply=function(t){var e=this,n=t.getMeta(Nt);if(n&&null!=n.setHandle)return new Dt(n.setHandle,null);if(n&&void 0!==n.setDragging)return new Dt(e.activeHandle,n.setDragging);if(e.activeHandle>-1&&t.docChanged){var r=t.mapping.map(e.activeHandle,-1);C(t.doc.resolve(r))||(r=null),e=new Dt(r,e.dragging)}return e}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(4),o=n(16);e.indentRules={nodes:[{node:"paragraph",style:"margin-left",rtlStyle:"margin-right",step:30,unit:"px"},{node:"heading",style:"margin-left",rtlStyle:"margin-right",step:30,unit:"px"}],listsTypes:r.__assign({},o.listsTypes)},e.outdentRules={nodes:[{node:"paragraph",style:"margin-left",rtlStyle:"margin-right",step:-30,unit:"px"},{node:"heading",style:"margin-left",rtlStyle:"margin-right",step:-30,unit:"px"}],listsTypes:r.__assign({},o.listsTypes)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(4);e.listsTypes={orderedList:"ordered_list",bulletList:"bullet_list",listItem:"list_item"},e.orderedList={listType:e.listsTypes.orderedList,types:r.__assign({},e.listsTypes)},e.bulletList={listType:e.listsTypes.bulletList,types:r.__assign({},e.listsTypes)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(9);e.blockquote=function(t,e){return r.wrapIn(t.schema.nodes.blockquote)(t,e)},e.liftBlockquote=function(t,e){var n=t.selection,r=n.$from,o=n.$to,i=t.schema.nodes.blockquote,s=t.doc,a=-1,c=r.blockRange(o);c&&s.nodesBetween(c.start,c.end,(function(t,e,n,r){t.type===i&&(a=e)}));var l=-1!==a;return e&&l&&e(t.tr.lift(c,s.resolve(a).depth)),l}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(4),o=n(0),i=n(1),s=n(2),a=n(9),c=n(13),l=n(16),u=function(t,e,n){for(var r=e.depth,o=t.nodes[n.bulletList],i=t.nodes[n.orderedList],s=t.nodes[n.listItem],a=e.depth;a>0;a--){var c=e.node(a);if(c.type!==o&&c.type!==i||(r=a),c.type!==o&&c.type!==i&&c.type!==s)break}return r-1};function p(t){return function(e,n,r){if(!r)return!1;var o=(e=r.state).schema.nodes[t.listType],i=e.selection,s=i.$from,l=i.$to,u=s.node(-2),p=s.node(-3),f=function(t,e,n,r){return 0===function(t,e,n){var r=Array(),o=function(t,e){var n=["blockquote","bulletList","orderedList"];if(1===e.depth)return e;var r=e.node(e.depth),o=e;for(;e.depth>=1;)e=t.resolve(e.before(e.depth)),(r=e.node(e.depth))&&-1!==n.indexOf(r.type.name)&&(o=e);return o}(t,e).depth,i=t.resolve(e.start(o));for(;i.pos<=n.start(n.depth);){var s=Math.min(i.depth,o),a=i.node(s);if(a&&r.push(a),0===s)break;var c=t.resolve(i.after(s));if(c.start(s)>=t.nodeSize-2)break;c.depth!==i.depth&&(c=t.resolve(c.pos+2)),i=c.depth?t.resolve(c.start(c.depth)):t.resolve(c.end(c.depth))}return r}(t,e,n).filter((function(t){return t.type!==r})).length}(e.doc,s,l,o);return(u&&u.type===o||p&&p.type===o)&&f?d(t)(e,n):(f||(d(t)(e,n),e=r.state),function(t,e){void 0===e&&(e={});return a.autoJoin(c.wrapInList(t,e),(function(e,n){return e.type===n.type&&e.type===t}))}(o,t.listAttrs)(e,n))}}function f(t,e,n,r){var i=r||t.schema.nodes.listItem,a=e.$from,c=e.$to,l=a.blockRange(c,(function(t){return t.childCount&&t.firstChild.type===i}));if(!l||l.depth<2||a.node(l.depth-1).type!==i)return n;var u=l.end,p=c.end(l.depth);return u<p&&(n.step(new s.ReplaceAroundStep(u-1,p,u,p,new o.Slice(o.Fragment.from(i.create(void 0,l.parent.copy())),1,0),1,!0)),l=new o.NodeRange(n.doc.resolve(a.pos),n.doc.resolve(p),l.depth)),n.lift(l,s.liftTarget(l)).scrollIntoView()}function d(t){return function(e,n){var r=e.tr,o=e.selection,a=o.$from,c=o.$to;return r.doc.nodesBetween(a.pos,c.pos,(function(n,o){if(n.isTextblock||"blockquote"===n.type.name||"div"===n.type.name){var a=new i.NodeSelection(r.doc.resolve(r.mapping.map(o))),c=a.$from.blockRange(a.$to);if(!c||a.$from.parent.type!==e.schema.nodes[t.listItem])return!1;var l=c&&s.liftTarget(c);if(null==l)return!1;r.lift(c,l)}})),n&&n(r),!0}}var h=/list\-style\-type:\s?([\w-]+)/;e.listStyle=function(t){var e=t.style||"",n=h.exec(e);return n&&n[1]||""},e.toggleList=function(t,n,r,o,s){var a=o.listType,c=o.listAttrs,l=void 0===c?{style:null}:c,d=t.selection,h=d.$from.node(d.$from.depth-2),m=d.$to.node(d.$to.depth-2);if(h&&h.type.name===a&&e.listStyle(h.attrs)===e.listStyle(l)&&m&&m.type.name===a&&e.listStyle(m.attrs)===e.listStyle(l)){var v=r.state.schema.nodes,g={bulletList:v[o.bulletList],orderedList:v[o.orderedList],listItem:v[o.listItem]},y=function(t,e){for(var n,r=e.bulletList,o=e.orderedList,i=e.listItem,s=t.depth-1;s>0;s--){var a=t.node(s);if(a.type!==r&&a.type!==o||(n=s),a.type!==r&&a.type!==o&&a.type!==i)break}return n}(d.$to,g),w=function(t,e,n,r,o,s){s||(s=t.schema.nodes.listItem);var a=!1;return o.doc.nodesBetween(e,n,(function(n,c){if(!a&&n.type===s&&c>e){a=!0;for(var l=r+3;l>r+2;){var u=o.doc.resolve(o.mapping.map(c));l=u.depth;var p=o.doc.resolve(o.mapping.map(c+n.textContent.length)),d=new i.TextSelection(u,p);o=f(t,d,o,s)}}})),o}(t,d.$to.pos,d.$to.end(y),y,r.state.tr,g.listItem);return(w=function(t,e,n){var r=t.selection,o=r.from,i=r.to,s=t.schema.nodes,a=s.paragraph,c=s.heading,l=[];e.doc.nodesBetween(o,i,(function(t,e){t.type!==a&&t.type!==c||l.push({node:t,pos:e})}));for(var p=l.length-1;p>=0;p--){var f=l[p],d=e.doc.resolve(e.mapping.map(f.pos));if(d.depth>0){var h=void 0;h=f.node.textContent&&f.node.textContent.length>0?e.doc.resolve(e.mapping.map(f.pos+f.node.textContent.length)):e.doc.resolve(e.mapping.map(f.pos+1));var m=d.blockRange(h);m&&e.lift(m,u(t.schema,d,n))}}return e}(t,w,o)).setMeta("commandName",s),n(w),!0}return p(o)(t,n,r)},e.toggleUnorderedList=function(t,n,o){return e.toggleList(t,n,o,r.__assign({listType:l.bulletList.listType},l.bulletList.types))},e.toggleOrderedList=function(t,n,o){return e.toggleList(t,n,o,r.__assign({listType:l.orderedList.listType},l.orderedList.types))},e.splitListItemKeepMarks=function(t){return function(e,n){return c.splitListItem(t)(e,(function(t){var r=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();r&&t.ensureMarks(r),n(t)}))}}},function(t,e,n){"use strict";n.r(e),n.d(e,"InputRule",(function(){return i})),n.d(e,"closeDoubleQuote",(function(){return f})),n.d(e,"closeSingleQuote",(function(){return h})),n.d(e,"ellipsis",(function(){return u})),n.d(e,"emDash",(function(){return l})),n.d(e,"inputRules",(function(){return s})),n.d(e,"openDoubleQuote",(function(){return p})),n.d(e,"openSingleQuote",(function(){return d})),n.d(e,"smartQuotes",(function(){return m})),n.d(e,"textblockTypeInputRule",(function(){return g})),n.d(e,"undoInputRule",(function(){return c})),n.d(e,"wrappingInputRule",(function(){return v}));var r=n(1),o=n(2),i=function(t,e){var n;this.match=t,this.handler="string"==typeof e?(n=e,function(t,e,r,o){var i=n;if(e[1]){var s=e[0].lastIndexOf(e[1]);i+=e[0].slice(s+e[1].length);var a=(r+=s)-o;a>0&&(i=e[0].slice(s-a,s)+i,r=o)}return t.tr.insertText(i,r,o)}):e};function s(t){var e=t.rules,n=new r.Plugin({state:{init:function(){return null},apply:function(t,e){var n=t.getMeta(this);return n||(t.selectionSet||t.docChanged?null:e)}},props:{handleTextInput:function(t,r,o,i){return a(t,r,o,i,e,n)},handleDOMEvents:{compositionend:function(t){setTimeout((function(){var r=t.state.selection.$cursor;r&&a(t,r.pos,r.pos,"",e,n)}))}}},isInputRules:!0});return n}function a(t,e,n,r,o,i){if(t.composing)return!1;var s=t.state,a=s.doc.resolve(e);if(a.parent.type.spec.code)return!1;for(var c=a.parent.textBetween(Math.max(0,a.parentOffset-500),a.parentOffset,null,"")+r,l=0;l<o.length;l++){var u=o[l].match.exec(c),p=u&&o[l].handler(s,u,e-(u[0].length-r.length),n);if(p)return t.dispatch(p.setMeta(i,{transform:p,from:e,to:n,text:r})),!0}return!1}function c(t,e){for(var n=t.plugins,r=0;r<n.length;r++){var o=n[r],i=void 0;if(o.spec.isInputRules&&(i=o.getState(t))){if(e){for(var s=t.tr,a=i.transform,c=a.steps.length-1;c>=0;c--)s.step(a.steps[c].invert(a.docs[c]));if(i.text){var l=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,t.schema.text(i.text,l))}else s.delete(i.from,i.to);e(s)}return!0}}return!1}var l=new i(/--$/,"—"),u=new i(/\.\.\.$/,"…"),p=new i(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“"),f=new i(/"$/,"”"),d=new i(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘"),h=new i(/'$/,"’"),m=[p,f,d,h];function v(t,e,n,r){return new i(t,(function(t,i,s,a){var c=n instanceof Function?n(i):n,l=t.tr.delete(s,a),u=l.doc.resolve(s).blockRange(),p=u&&Object(o.findWrapping)(u,e,c);if(!p)return null;l.wrap(u,p);var f=l.doc.resolve(s-1).nodeBefore;return f&&f.type==e&&Object(o.canJoin)(l.doc,s-1)&&(!r||r(i,f))&&l.join(s-1),l}))}function g(t,e,n){return new i(t,(function(t,r,o,i){var s=t.doc.resolve(o),a=n instanceof Function?n(r):n;return s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),e)?t.tr.delete(o,i).setBlockType(o,o,e,a):null}))}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.bold={mark:"strong",altMarks:["b"],altStyle:{name:"font-weight",value:/^(bold(er)?|[5-9]\d{2,})$/}},e.italic={mark:"em",altMarks:["i"],altStyle:{name:"font-style",value:/^italic$/i}},e.underline={mark:"u",altStyle:{name:"text-decoration",value:/^underline$/i}},e.strikethrough={mark:"del",altStyle:{name:"text-decoration",value:/^line-through$/i}},e.subscript={mark:"sub"},e.superscript={mark:"sup"},e.link={mark:"link"},e.unlink={mark:"link"}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=/style=['"]?[^'"]*?mso-list:\s*[a-zA-Z]+(\d+)\s[a-zA-Z]+(\d+)\s(\w+)/gi,o=function(t){return/^MsoListParagraph/.test(t.className)},i=function(t){var e=t.innerHTML;return e=(e=e.replace(/<!--(.|\s)*?-->/gi,"")).replace(/<\/?[^>]+?\/?>/gm,"")},s=function(t,e){var n=document.createElement(t);return n.style.listStyleType=e,n},a=function(t){var e=null;return/^\d/.test(t)||(e=(/^[a-z]/.test(t)?"lower-":"upper-")+(/^[ivxlcdm]/i.test(t)?"roman":"alpha")),e},c=function(t,e){var n=[];Array.from(t).forEach((function(t){if(t.nodeType===Node.ELEMENT_NODE){var r=t;r.getAttribute("datalist")?(n.push(t),e.add(n)):o(r)&&n.length?n.push(t):(n=[],"DIV"===r.nodeName?c(r.children,e):"TABLE"===r.nodeName&&Array.from(r.querySelectorAll("td,th")).forEach((function(t){c(t.children,e)})))}}))},l=function(t){var e,n=t.innerHTML,r=function(t){return t.replace(/^(?: |[\u00a0\n\r\s])+/,"")};return n=n.replace(/<\/?\w+[^>]*>/g,"").replace(/ /g," "),/^[\u2022\u00b7\u00a7\u00d8oØüvn][\u00a0 ]+/.test(n)?{tag:"ul",style:(e=r(i(t)),/^[\u2022\u00b7\u00FC\u00D8\u002dv-]/.test(e)?null:/^o/.test(e)?"circle":"square")}:/^\s*\w+[\.\)][\u00a0 ]{2,}/.test(n)?{tag:"ol",style:a(r(i(t)))}:void 0},u=function(t){var e,n=t.nodeName.toLowerCase();t.firstChild&&t.firstChild.nodeType===Node.COMMENT_NODE&&t.removeChild(t.firstChild),1===t.childNodes.length?e=t.firstChild.nodeType===Node.TEXT_NODE?i(t):t.firstChild.innerHTML.replace(/^\w+[\.\)]( )+ /,""):(t.removeChild(t.firstChild),3===t.firstChild.nodeType&&/^[ivxlcdm]+\.$/i.test(t.firstChild.nodeValue)&&t.removeChild(t.firstChild),/^( |\s)+$/i.test(t.firstChild.innerHTML)&&t.removeChild(t.firstChild),e="p"!==n?"<"+n+">"+t.innerHTML+"</"+n+">":t.innerHTML),t.parentNode.removeChild(t);var r=document.createElement("li");return r.innerHTML=e,r};e.convertMsLists=function(t){var e=document.createElement("div");e.innerHTML=function(t){return t=t.replace(r,(function(t,e,n){return'datalist="'+e+'" datalevel="'+n+'" '+t}))}(t);var n=new Set;return c(e.children,n),n.forEach((function(t){return function(t){var e,n,r,i,a,c,p,f,d,h,m,v,g,y=-1,w={};for(f=0;f<t.length;f++){var b=(g={datalist:(d=t[f]).getAttribute("datalist"),datalevel:d.getAttribute("datalevel")}).datalist,S=l(d);if(h=S&&S.tag){if(m=g.datalevel||parseFloat(d.style.marginLeft||0),g.datalevel||d.style.marginLeft){var k=h+b;w[m]||(w[m]={}),(!n||n<0)&&(n=m,r=b,i=(p=t.filter((function(t){return t.getAttribute("datalist")===String(r)})))[p.length-1],c=s(h,S&&S.style),d.parentNode.insertBefore(c,d),y=m,w[m][k]=c),a=i===d,v=w[m][k],(m>y||!v)&&(v=s(h,S&&S.style),w[m][k]=v,e.appendChild(v)),e=u(d),v.appendChild(e),a?n=y=-1:y=m}}else!e||a&&!o(d)||(d.style.marginLeft&&(d.style.marginLeft=""),d.style.marginLeft&&(d.style.margin=""),e.appendChild(d))}}(t)})),e.innerHTML}},function(t,e,n){"use strict";n.r(e),n.d(e,"HistoryState",(function(){return p})),n.d(e,"closeHistory",(function(){return w})),n.d(e,"history",(function(){return k})),n.d(e,"redo",(function(){return C})),n.d(e,"redoDepth",(function(){return O})),n.d(e,"undo",(function(){return x})),n.d(e,"undoDepth",(function(){return M}));var r=function(){};r.prototype.append=function(t){return t.length?(t=r.from(t),!this.length&&t||t.length<200&&this.leafAppend(t)||this.length<200&&t.leafPrepend(this)||this.appendInner(t)):this},r.prototype.prepend=function(t){return t.length?r.from(t).append(this):this},r.prototype.appendInner=function(t){return new i(this,t)},r.prototype.slice=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.length),t>=e?r.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))},r.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)},r.prototype.forEach=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length),e<=n?this.forEachInner(t,e,n,0):this.forEachInvertedInner(t,e,n,0)},r.prototype.map=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length);var r=[];return this.forEach((function(e,n){return r.push(t(e,n))}),e,n),r},r.from=function(t){return t instanceof r?t:t&&t.length?new o(t):r.empty};var o=function(t){function e(e){t.call(this),this.values=e}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(t,n){return 0==t&&n==this.length?this:new e(this.values.slice(t,n))},e.prototype.getInner=function(t){return this.values[t]},e.prototype.forEachInner=function(t,e,n,r){for(var o=e;o<n;o++)if(!1===t(this.values[o],r+o))return!1},e.prototype.forEachInvertedInner=function(t,e,n,r){for(var o=e-1;o>=n;o--)if(!1===t(this.values[o],r+o))return!1},e.prototype.leafAppend=function(t){if(this.length+t.length<=200)return new e(this.values.concat(t.flatten()))},e.prototype.leafPrepend=function(t){if(this.length+t.length<=200)return new e(t.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(r);r.empty=new o([]);var i=function(t){function e(e,n){t.call(this),this.left=e,this.right=n,this.length=e.length+n.length,this.depth=Math.max(e.depth,n.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(t){return t<this.left.length?this.left.get(t):this.right.get(t-this.left.length)},e.prototype.forEachInner=function(t,e,n,r){var o=this.left.length;return!(e<o&&!1===this.left.forEachInner(t,e,Math.min(n,o),r))&&(!(n>o&&!1===this.right.forEachInner(t,Math.max(e-o,0),Math.min(this.length,n)-o,r+o))&&void 0)},e.prototype.forEachInvertedInner=function(t,e,n,r){var o=this.left.length;return!(e>o&&!1===this.right.forEachInvertedInner(t,e-o,Math.max(n,o)-o,r+o))&&(!(n<o&&!1===this.left.forEachInvertedInner(t,Math.min(e,o),n,r))&&void 0)},e.prototype.sliceInner=function(t,e){if(0==t&&e==this.length)return this;var n=this.left.length;return e<=n?this.left.slice(t,e):t>=n?this.right.slice(t-n,e-n):this.left.slice(t,n).append(this.right.slice(0,e-n))},e.prototype.leafAppend=function(t){var n=this.right.leafAppend(t);if(n)return new e(this.left,n)},e.prototype.leafPrepend=function(t){var n=this.left.leafPrepend(t);if(n)return new e(n,this.right)},e.prototype.appendInner=function(t){return this.left.depth>=Math.max(this.right.depth,t.depth)+1?new e(this.left,new e(this.right,t)):new e(this,t)},e}(r),s=r,a=n(2),c=n(1),l=function(t,e){this.items=t,this.eventCount=e};l.prototype.popEvent=function(t,e){var n=this;if(0==this.eventCount)return null;for(var r,o,i=this.items.length;;i--){if(this.items.get(i-1).selection){--i;break}}e&&(r=this.remapping(i,this.items.length),o=r.maps.length);var s,a,c=t.tr,p=[],f=[];return this.items.forEach((function(t,e){if(!t.step)return r||(r=n.remapping(i,e+1),o=r.maps.length),o--,void f.push(t);if(r){f.push(new u(t.map));var d,h=t.step.map(r.slice(o));h&&c.maybeStep(h).doc&&(d=c.mapping.maps[c.mapping.maps.length-1],p.push(new u(d,null,null,p.length+f.length))),o--,d&&r.appendMap(d,o)}else c.maybeStep(t.step);return t.selection?(s=r?t.selection.map(r.slice(o)):t.selection,a=new l(n.items.slice(0,i).append(f.reverse().concat(p)),n.eventCount-1),!1):void 0}),this.items.length,0),{remaining:a,transform:c,selection:s}},l.prototype.addTransform=function(t,e,n,r){for(var o=[],i=this.eventCount,s=this.items,a=!r&&s.length?s.get(s.length-1):null,c=0;c<t.steps.length;c++){var p,d=t.steps[c].invert(t.docs[c]),h=new u(t.mapping.maps[c],d,e);(p=a&&a.merge(h))&&(h=p,c?o.pop():s=s.slice(0,s.length-1)),o.push(h),e&&(i++,e=null),r||(a=h)}var m,v,g,y=i-n.depth;return y>f&&(v=y,(m=s).forEach((function(t,e){if(t.selection&&0==v--)return g=e,!1})),s=m.slice(g),i-=y),new l(s.append(o),i)},l.prototype.remapping=function(t,e){var n=new a.Mapping;return this.items.forEach((function(e,r){var o=null!=e.mirrorOffset&&r-e.mirrorOffset>=t?n.maps.length-e.mirrorOffset:null;n.appendMap(e.map,o)}),t,e),n},l.prototype.addMaps=function(t){return 0==this.eventCount?this:new l(this.items.append(t.map((function(t){return new u(t)}))),this.eventCount)},l.prototype.rebased=function(t,e){if(!this.eventCount)return this;var n=[],r=Math.max(0,this.items.length-e),o=t.mapping,i=t.steps.length,s=this.eventCount;this.items.forEach((function(t){t.selection&&s--}),r);var a=e;this.items.forEach((function(e){var r=o.getMirror(--a);if(null!=r){i=Math.min(i,r);var c=o.maps[r];if(e.step){var l=t.steps[r].invert(t.docs[r]),p=e.selection&&e.selection.map(o.slice(a+1,r));p&&s++,n.push(new u(c,l,p))}else n.push(new u(c))}}),r);for(var c=[],p=e;p<i;p++)c.push(new u(o.maps[p]));var f=this.items.slice(0,r).append(c).append(n),d=new l(f,s);return d.emptyItemCount()>500&&(d=d.compress(this.items.length-n.length)),d},l.prototype.emptyItemCount=function(){var t=0;return this.items.forEach((function(e){e.step||t++})),t},l.prototype.compress=function(t){void 0===t&&(t=this.items.length);var e=this.remapping(0,t),n=e.maps.length,r=[],o=0;return this.items.forEach((function(i,s){if(s>=t)r.push(i),i.selection&&o++;else if(i.step){var a=i.step.map(e.slice(n)),c=a&&a.getMap();if(n--,c&&e.appendMap(c,n),a){var l=i.selection&&i.selection.map(e.slice(n));l&&o++;var p,f=new u(c.invert(),a,l),d=r.length-1;(p=r.length&&r[d].merge(f))?r[d]=p:r.push(f)}}else i.map&&n--}),this.items.length,0),new l(s.from(r.reverse()),o)},l.empty=new l(s.empty,0);var u=function(t,e,n,r){this.map=t,this.step=e,this.selection=n,this.mirrorOffset=r};u.prototype.merge=function(t){if(this.step&&t.step&&!t.selection){var e=t.step.merge(this.step);if(e)return new u(e.getMap().invert(),e,this.selection)}};var p=function(t,e,n,r){this.done=t,this.undone=e,this.prevRanges=n,this.prevTime=r},f=20;function d(t){var e=[];return t.forEach((function(t,n,r,o){return e.push(r,o)})),e}function h(t,e){if(!t)return null;for(var n=[],r=0;r<t.length;r+=2){var o=e.map(t[r],1),i=e.map(t[r+1],-1);o<=i&&n.push(o,i)}return n}function m(t,e,n,r){var o=y(e),i=b.get(e).spec.config,s=(r?t.undone:t.done).popEvent(e,o);if(s){var a=s.selection.resolve(s.transform.doc),c=(r?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,o),l=new p(r?c:s.remaining,r?s.remaining:c,null,0);n(s.transform.setSelection(a).setMeta(b,{redo:r,historyState:l}).scrollIntoView())}}var v=!1,g=null;function y(t){var e=t.plugins;if(g!=e){v=!1,g=e;for(var n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){v=!0;break}}return v}function w(t){return t.setMeta(S,!0)}var b=new c.PluginKey("history"),S=new c.PluginKey("closeHistory");function k(t){return t={depth:t&&t.depth||100,newGroupDelay:t&&t.newGroupDelay||500},new c.Plugin({key:b,state:{init:function(){return new p(l.empty,l.empty,null,0)},apply:function(e,n,r){return function(t,e,n,r){var o,i=n.getMeta(b);if(i)return i.historyState;n.getMeta(S)&&(t=new p(t.done,t.undone,null,0));var s=n.getMeta("appendedTransaction");if(0==n.steps.length)return t;if(s&&s.getMeta(b))return s.getMeta(b).redo?new p(t.done.addTransform(n,null,r,y(e)),t.undone,d(n.mapping.maps[n.steps.length-1]),t.prevTime):new p(t.done,t.undone.addTransform(n,null,r,y(e)),null,t.prevTime);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))return(o=n.getMeta("rebased"))?new p(t.done.rebased(n,o),t.undone.rebased(n,o),h(t.prevRanges,n.mapping),t.prevTime):new p(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),h(t.prevRanges,n.mapping),t.prevTime);var a=0==t.prevTime||!s&&(t.prevTime<(n.time||0)-r.newGroupDelay||!function(t,e){if(!e)return!1;if(!t.docChanged)return!0;var n=!1;return t.mapping.maps[0].forEach((function(t,r){for(var o=0;o<e.length;o+=2)t<=e[o+1]&&r>=e[o]&&(n=!0)})),n}(n,t.prevRanges)),c=s?h(t.prevRanges,n.mapping):d(n.mapping.maps[n.steps.length-1]);return new p(t.done.addTransform(n,a?e.selection.getBookmark():null,r,y(e)),l.empty,c,n.time)}(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput:function(t,e){var n="historyUndo"==e.inputType?x(t.state,t.dispatch):"historyRedo"==e.inputType&&C(t.state,t.dispatch);return n&&e.preventDefault(),n}}}})}function x(t,e){var n=b.getState(t);return!(!n||0==n.done.eventCount)&&(e&&m(n,t,e,!1),!0)}function C(t,e){var n=b.getState(t);return!(!n||0==n.undone.eventCount)&&(e&&m(n,t,e,!0),!0)}function M(t){var e=b.getState(t);return e?e.done.eventCount:0}function O(t){var e=b.getState(t);return e?e.undone.eventCount:0}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(4),o=n(10);e.getHtml=o.getHtml,e.setHtml=o.setHtml,e.parseContent=o.parseContent,e.trimWhitespace=o.trimWhitespace,e.htmlToFragment=o.htmlToFragment,e.domToPmDoc=o.domToPmDoc,e.pmDocToFragment=o.pmDocToFragment;var i=n(12);e.applyInlineStyle=i.applyInlineStyle,e.getInlineStyles=i.getInlineStyles,e.toggleInlineFormat=i.toggleInlineFormat;var s=n(24);e.applyLink=s.applyLink,e.removeLink=s.removeLink;var a=n(25);e.insertText=a.insertText;var c=n(26);e.insertImage=c.insertImage;var l=n(27);e.alignBlocks=l.alignBlocks,e.isAligned=l.isAligned;var u=n(28);e.cleanFormatting=u.cleanFormatting;var p=n(8);e.hasNode=p.hasNode,e.activeNode=p.activeNode,e.formatBlockElements=p.formatBlockElements,e.getBlockFormats=p.getBlockFormats,e.parentBlockFormat=p.parentBlockFormat,e.changeTextBlock=p.changeTextBlock,e.blockNodes=p.blockNodes,e.cleanTextBlockFormatting=p.cleanTextBlockFormatting;var f=n(6);e.hasMark=f.hasMark,e.getMark=f.getMark,e.getActiveMarks=f.getActiveMarks,e.removeAllMarks=f.removeAllMarks,e.cleanMarks=f.cleanMarks,e.selectionMarks=f.selectionMarks;var d=n(29);e.indent=d.indent,e.canIndentAsListItem=d.canIndentAsListItem,e.outdent=d.outdent,e.canOutdentAsListItem=d.canOutdentAsListItem,e.isIndented=d.isIndented,e.canBeIndented=d.canBeIndented,e.indentBlocks=d.indentBlocks;var h=n(18);e.toggleOrderedList=h.toggleOrderedList,e.toggleUnorderedList=h.toggleUnorderedList,e.toggleList=h.toggleList,e.listStyle=h.listStyle;var m=n(17);e.blockquote=m.blockquote,e.liftBlockquote=m.liftBlockquote;var v=n(5);e.hasSameMarkup=v.hasSameMarkup,e.getSelectionText=v.getSelectionText,e.getNodeFromSelection=v.getNodeFromSelection,e.selectedLineTextOnly=v.selectedLineTextOnly,e.expandSelection=v.expandSelection,e.expandToWordWrap=v.expandToWordWrap,e.canInsert=v.canInsert,e.insertNode=v.insertNode,e.indentHtml=v.indentHtml;var g=n(30);e.alignLeftRules=g.alignLeftRules,e.alignCenterRules=g.alignCenterRules,e.alignRightRules=g.alignRightRules,e.alignJustifyRules=g.alignJustifyRules,e.alignRemoveRules=g.alignRemoveRules;var y=n(15);e.indentRules=y.indentRules,e.outdentRules=y.outdentRules;var w=n(31);e.nodes=w.nodes,e.marks=w.marks;var b=n(32);e.buildKeymap=b.buildKeymap,e.buildListKeymap=b.buildListKeymap;var S=n(20);e.bold=S.bold,e.italic=S.italic,e.underline=S.underline,e.strikethrough=S.strikethrough,e.subscript=S.subscript,e.superscript=S.superscript,e.link=S.link;var k=n(33);e.sanitize=k.sanitize,e.removeComments=k.removeComments,e.removeTag=k.removeTag,e.pasteCleanup=k.pasteCleanup,e.sanitizeClassAttr=k.sanitizeClassAttr,e.sanitizeStyleAttr=k.sanitizeStyleAttr,e.removeAttribute=k.removeAttribute,e.replaceImageSourcesFromRtf=k.replaceImageSourcesFromRtf;var x=n(21);e.convertMsLists=x.convertMsLists;var C=n(34);e.find=C.find,e.findAt=C.findAt,e.findAll=C.findAll,e.replace=C.replace,e.replaceAll=C.replaceAll;var M=n(35);e.placeholder=M.placeholder;var O=n(36);e.spacesFix=O.spacesFix;var T=n(37);e.textHighlight=T.textHighlight,e.textHighlightKey=T.textHighlightKey;var N=n(38);e.imageResizing=N.imageResizing,e.imageResizeKey=N.imageResizeKey;var A=n(39);e.caretColor=A.caretColor,e.caretColorKey=A.caretColorKey,r.__exportStar(n(9),e),r.__exportStar(n(40),e),r.__exportStar(n(41),e),r.__exportStar(n(22),e),r.__exportStar(n(19),e),r.__exportStar(n(7),e),r.__exportStar(n(0),e),r.__exportStar(n(13),e),r.__exportStar(n(1),e);var D=n(14);e.TableMap=D.TableMap,e.tableEditing=D.tableEditing,e.tableEditingKey=D.tableEditingKey,e.tableNodeTypes=D.tableNodeTypes,e.tableNodes=D.tableNodes,e.fixTables=D.fixTables,e.fixTablesKey=D.fixTablesKey,e.isInTable=D.isInTable,e.deleteTable=D.deleteTable,e.inSameTable=D.inSameTable,e.CellSelection=D.CellSelection,e.selectedRect=D.selectedRect,e.selectionCell=D.selectionCell,e.setCellAttr=D.setCellAttr,e.goToNextCell=D.goToNextCell,e.toggleHeader=D.toggleHeader,e.toggleHeaderCell=D.toggleHeaderCell,e.toggleHeaderColumn=D.toggleHeaderColumn,e.toggleHeaderRow=D.toggleHeaderRow,e.splitCell=D.splitCell,e.splitCellWithType=D.splitCellWithType,e.mergeCells=D.mergeCells,e.deleteColumn=D.deleteColumn,e.deleteRow=D.deleteRow,e.rowIsHeader=D.rowIsHeader,e.addRow=D.addRow,e.addColSpan=D.addColSpan,e.addColumn=D.addColumn,e.addColumnAfter=D.addColumnAfter,e.addColumnBefore=D.addColumnBefore,e.colCount=D.colCount,e.columnIsHeader=D.columnIsHeader,e.columnResizing=D.columnResizing,e.columnResizingPluginKey=D.columnResizingPluginKey,e.updateColumnsOnResize=D.updateColumnsOnResize,e.cellAround=D.cellAround,e.findCell=D.findCell,e.removeColSpan=D.removeColSpan,e.moveCellForward=D.moveCellForward,e.nextCell=D.nextCell,r.__exportStar(n(2),e),r.__exportStar(n(3),e);var E=n(42);e.createTable=E.createTable,e.addRowAfter=E.addRowAfter,e.addRowBefore=E.addRowBefore,e.pmAddRowAfter=E.pmAddRowAfter,e.pmAddRowBefore=E.pmAddRowBefore},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(12),o=n(6),i=n(1);e.removeLink=function(t,e){return function(n,i){var s=n.selection.$cursor;if(s){var a=s.parent,c=s.index(),l=n.schema.marks[t.mark],u=a.child(c).marks.find((function(t){return t.type===l})),p=a.childCount,f=s.pos-s.textOffset,d=a.child(c).nodeSize,h=void 0,m=void 0;for(h=c-1;h>=0&&u.isInSet(a.child(h).marks);)d+=m=a.child(h).nodeSize,f-=m,h-=1;for(h=c+1;h<p&&u.isInSet(a.child(h).marks);)d+=a.child(h).nodeSize,h+=1;i(o.removeMark(e||n.tr,f,f+d,u))}else r.toggleInlineFormat(t,e)(n,i)}};e.applyLink=function(t,n){var s=t.mark,a=t.attrs;return void 0===n&&(n="link"),function(t,c){var l=t.schema.marks,u=t.tr;n&&(u.setMeta("commandName",n),u.setMeta("args",a));var p=!1,f=function(){return p=!0};if(function(t,e){var n=o.selectionMarks(t,e);return 1===n.length&&n[0]?n[0]:null}(t,l[s]))!function(t,e){return function(n,r){var o=n.selection,i=o.$cursor,s=o.from,a=o.to,c=n.schema.marks[t.mark];if(i){var l=i.parent,u=i.index(),p=l.child(u).marks.find((function(t){return t.type===c})),f=l.childCount,d=i.pos-i.textOffset,h=l.child(u).nodeSize,m=void 0,v=void 0;for(m=u-1;m>=0&&p.isInSet(l.child(m).marks);)h+=v=l.child(m).nodeSize,d-=v,m-=1;for(m=u+1;m<f&&p.isInSet(l.child(m).marks);)h+=l.child(m).nodeSize,m+=1;e.removeMark(d,d+h,c),e.addMark(d,d+h,c.create(t.attrs)),r(e)}else e.doc.nodesBetween(s,a,(function(n,o){n.isInline&&c.isInSet(n.marks)&&(e.removeMark(o,o+n.nodeSize,c),e.addMark(o,o+n.nodeSize,c.create(t.attrs)),r(e))}))}}({mark:s,attrs:a},u)(t,f);else{var d=t;o.hasMark(t,{mark:s})&&(e.removeLink({mark:s,attrs:a},u)(t,f),d=i.EditorState.create({doc:u.doc,selection:u.selection})),p?o.toggleMark(l[s],a,u)(d,f):r.toggleInlineFormat({mark:s},u,a)(d,f)}return p&&c(u),p}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.insertText=function(t){return function(e,n){n(e.tr.insertText(t.text,t.from,t.to))}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(5);e.insertImage=function(t){return function(e,n){var o=e.schema.nodes.image,i=o.createAndFill(t);r.insertNode(i)(e,(function(e){return n(e.setMeta("commandName","insertImage").setMeta("args",t))}))}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(8);e.alignBlocks=function(t,e){return function(n,o){var i=r.blockNodes(n),s=n.tr;s.setMeta("commandName",e),i.forEach((function(e){if(e.type.isTextblock){var n={},o=t.find((function(t){return t.node===e.type.name}));o&&(n=r.addStyles(e,o.style)),r.changeTextBlock(s,e,e.type,n)}}));var a=s.docChanged;return a&&o(s.scrollIntoView()),a}},e.isAligned=function(t,e){var n=r.blockNodes(t),o=!1;return n.forEach((function(t){if(!o&&t.type.isTextblock&&t.attrs.style){var n=e.find((function(e){return e.node===t.type.name}));n&&(o=n.style.every((function(e){return!!e.value&&new RegExp(e.name+":\\s?"+e.value,"i").test(t.attrs.style)})))}})),o}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(8),o=n(6);e.cleanFormatting=function(t){return void 0===t&&(t={blocksInSelection:!0}),function(e,n){var i=e.tr,s=t.blocksInSelection,a=t.blockNodeType,c=(t.exceptMarks||[e.schema.marks.link]).filter(Boolean);o.cleanMarks(i,{except:c}),r.cleanTextBlockFormatting(i,{blocksInSelection:s,blockNodeType:a});var l=i.docChanged;return l&&n&&n(i),l}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(13),o=n(15),i=n(8),s=n(5),a=n(17);e.indentBlocks=function(t,e,n){return function(r,o){var s=i.blockNodes(r),a=r.tr;a.setMeta("commandName",e),s.forEach((function(e){if(e.type.isTextblock){var r=void 0,o=t.find((function(t){return t.node===e.type.name}));if(o){var s="rtl"===n?o.rtlStyle:o.style,c={name:s,value:o.step>0?""+o.step+o.unit:""};if(e.attrs.style){var l=new RegExp(s+":\\s?(\\d+)"+o.unit,"i"),u=e.attrs.style.match(l);if(u){var p=parseFloat(u[1])+o.step;p=p<=0?"":p,c.value=""+p+(p?o.unit:"")}}r=i.addStyles(e,[c])}r&&i.changeTextBlock(a,e,e.type,r)}}));var c=a.docChanged;return c&&o(a.scrollIntoView()),c}},e.isIndented=function(t,e,n){var r=i.blockNodes(t),o=!1;return r.forEach((function(t){if(!o&&t.type.isTextblock&&t.attrs.style){var r=e.find((function(e){return e.node===t.type.name}));if(r){var i="rtl"===n?r.rtlStyle:r.style,s=new RegExp(i+":\\s?\\d+"+r.unit,"i");o=s.test(t.attrs.style)}}})),o},e.canIndentAsListItem=function(t,e){return r.sinkListItem(e)(t)},e.canOutdentAsListItem=function(t,e){var n=t.schema.nodes[e.listsTypes.listItem],o=t.schema.nodes[e.listsTypes.orderedList],i=t.schema.nodes[e.listsTypes.bulletList],a=!!s.findNthParentNodeOfType(o,2)(t.selection),c=!!s.findNthParentNodeOfType(i,2)(t.selection);return(a||c)&&r.liftListItem(n)(t)},e.canBeIndented=function(t,n){var r=t.schema.nodes,s=r[o.indentRules.listsTypes.listItem];return(e.isIndented(t,n.nodes)||o.indentRules.nodes.some((function(e){return r[e.node]&&i.hasNode(t,r[e.node])})))&&!i.hasNode(t,s)},e.indent=function(t,n){var i=t.schema.nodes[o.indentRules.listsTypes.listItem],s=e.canBeIndented(t,o.indentRules);e.canIndentAsListItem(t,i)?r.sinkListItem(i)(t,n):s&&e.indentBlocks(o.indentRules.nodes)(t,n)},e.outdent=function(t,n){var s=t.schema.nodes,c=s[o.outdentRules.listsTypes.listItem],l=e.canBeIndented(t,o.outdentRules);i.hasNode(t,s.blockquote)?a.liftBlockquote(t,n):e.canOutdentAsListItem(t,o.outdentRules)?r.liftListItem(c)(t,n):l&&e.indentBlocks(o.outdentRules.nodes)(t,n)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(t,e){return{name:t,value:e}};e.alignLeftRules=[{node:"paragraph",style:[r("text-align","left")]},{node:"heading",style:[r("text-align","left")]}],e.alignRightRules=[{node:"paragraph",style:[r("text-align","right")]},{node:"heading",style:[r("text-align","right")]}],e.alignCenterRules=[{node:"paragraph",style:[r("text-align","center")]},{node:"heading",style:[r("text-align","center")]}],e.alignJustifyRules=[{node:"paragraph",style:[r("text-align","justify")]},{node:"heading",style:[r("text-align","justify")]}],e.alignRemoveRules=[{node:"paragraph",style:[r("text-align","")]},{node:"heading",style:[r("text-align","")]}]},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(4),o=n(0),i=n(14),s=n(10),a=n(11),c=["blockquote",0],l=["hr"],u=["pre",["code",0]],p=["ol",0],f=["ul",0],d=["li",0],h=function(t){for(var e,n={},r=t.attributes,o=0;o<r.length;o++)n[(e=r[o]).name]=e.value;return n},m=function(t){var e={};return t.forEach((function(t){e[t]={default:null}})),e},v=function(){return m(["style","class","id"])},g=function(t,e){for(var n in t)if(n&&null!==t[n]&&n!==e)return!0;return!1},y=function(t,e){var n={};for(var r in t)r&&null!==t[r]&&r!==e&&(n[r]=t[r]);return n},w=function(t){var e;return(e={})[t]={name:t,inclusive:!0,parseDOM:[{tag:t}],toDOM:function(){return[t,0]}},e},b=r.__assign({link:{attrs:r.__assign({},v(),{href:{default:null},target:{default:null},title:{default:null}}),inclusive:!1,parseDOM:[{tag:"a",getAttrs:h}],toDOM:function(t){return["a",y(t.attrs),0]}}},w("strong"),w("b"),w("em"),w("i"),w("u"),w("del"),w("sub"),w("sup"),w("code"),{style:{attrs:r.__assign({},v()),parseDOM:[{tag:"span",getAttrs:h}],toDOM:function(t){return g(t.attrs)?["span",y(t.attrs),0]:["span",0]}}});e.marks=b;var S=function(t){var e;return(e={})[t]={default:null,getFromDOM:function(e){return e.getAttribute(t)},setDOMAttr:function(e,n){n[t]=e}},e},k=r.__assign({},S("style"),S("class"),S("id"),S("headers")),x={doc:{content:"colgroup*"},col:{attrs:m(["id","class","style","span"]),parseDOM:[{getAttrs:h,tag:"col"}],toDOM:function(t){return["col",t.attrs]}},colgroup:{attrs:m(["id","class","style","span"]),content:"col*",parseDOM:[{getAttrs:h,tag:"colgroup"}],toDOM:function(t){return["colgroup",t.attrs,0]}},text:{inline:!0,group:"inline"}},C=new o.Schema({nodes:x,marks:{}}),M=i.tableNodes({tableGroup:"block",cellContent:"block+",cellAttributes:k});M.table_row.attrs=r.__assign({},M.table_row.attrs,m([a.rowTypeAttr,"style","class","id"])),M.table_row.toDOM=function(t){return["tr",y(t.attrs),0]},M.table_row.parseDOM=[{tag:"tr",getAttrs:h}],M.table.attrs=r.__assign({},M.table.attrs,m(["style","class","id",a.colgroupAttr])),M.table.toDOM=function(t){var e=g(t.attrs)?y(t.attrs,a.colgroupAttr):{},n=null;if(t.attrs[a.colgroupAttr]&&!function(t){for(var e=!1,n=t.child(0),r=0;r<n.childCount;r++){if(n.child(r).attrs.colwidth){e=!0;break}}return e}(t)){var r=s.domToPmDoc(s.htmlToFragment(t.attrs[a.colgroupAttr]),C,{preserveWhitespace:!1}),o=s.pmDocToFragment(r).firstChild;if(o){var i=Array.from(o.children).map((function(t){return["col",h(t)]}));n=["colgroup",h(o)].concat(i)}}return n?["table",e,n,["tbody",0]]:["table",e,["tbody",0]]},M.table.parseDOM=[{tag:"table",getAttrs:function(t){var e=h(t),n=Array.from(t.childNodes).find((function(t){return"COLGROUP"===t.nodeName}));return n&&(e[a.colgroupAttr]=n.outerHTML),e}}];var O=r.__assign({doc:{content:"block+"},paragraph:{content:"inline*",group:"block",attrs:r.__assign({},v()),parseDOM:[{tag:"p",getAttrs:h}],toDOM:function(t){return g(t.attrs)?["p",y(t.attrs),0]:["p",0]}},div:{content:"block*",group:"block",attrs:r.__assign({},v()),parseDOM:[{tag:"div",getAttrs:h}],toDOM:function(t){return g(t.attrs)?["div",y(t.attrs),0]:["div",0]}},blockquote:{attrs:r.__assign({},v()),content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote",getAttrs:h}],toDOM:function(t){return g(t.attrs)?["blockquote",y(t.attrs),0]:c}},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM:function(){return l}},heading:{attrs:r.__assign({},v(),{level:{default:1}}),content:"inline*",group:"block",defining:!0,parseDOM:[{tag:"h1",getAttrs:function(t){return r.__assign({},h(t),{level:1})}},{tag:"h2",getAttrs:function(t){return r.__assign({},h(t),{level:2})}},{tag:"h3",getAttrs:function(t){return r.__assign({},h(t),{level:3})}},{tag:"h4",getAttrs:function(t){return r.__assign({},h(t),{level:4})}},{tag:"h5",getAttrs:function(t){return r.__assign({},h(t),{level:5})}},{tag:"h6",getAttrs:function(t){return r.__assign({},h(t),{level:6})}}],toDOM:function(t){return g(t.attrs,"level")?["h"+t.attrs.level,y(t.attrs,"level"),0]:["h"+t.attrs.level,0]}},code_block:{content:"text*",marks:"",group:"block",code:!0,defining:!0,parseDOM:[{tag:"pre",preserveWhitespace:"full"}],toDOM:function(){return u}},text:{inline:!0,group:"inline"},image:{inline:!0,attrs:r.__assign({src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}},v()),group:"inline",draggable:!0,parseDOM:[{tag:"img",getAttrs:h}],toDOM:function(t){return g(t.attrs)?["img",y(t.attrs)]:["img"]}},hard_break:{inline:!0,attrs:r.__assign({},v()),group:"inline",selectable:!1,parseDOM:[{tag:"br",getAttrs:h}],toDOM:function(t){return g(t.attrs)?["br",y(t.attrs)]:["br"]}},ordered_list:{content:"list_item+",group:"block",attrs:r.__assign({},v(),{type:{default:null},order:{default:1}}),parseDOM:[{tag:"ol",getAttrs:function(t){return r.__assign({},h(t),{order:t.hasAttribute("start")?parseInt(t.getAttribute("start")||"1",10):1})}}],toDOM:function(t){return 1===t.attrs.order?g(t.attrs,"order")?["ol",y(t.attrs,"order"),0]:p:["ol",r.__assign({},y(t.attrs,"order"),{start:t.attrs.order}),0]}},bullet_list:{content:"list_item+",group:"block",attrs:r.__assign({},v()),parseDOM:[{tag:"ul",getAttrs:h}],toDOM:function(t){return g(t.attrs)?["ul",y(t.attrs),0]:f}},list_item:{content:"(paragraph | heading) block*",attrs:r.__assign({},v()),parseDOM:[{tag:"li",getAttrs:h}],toDOM:function(t){return g(t.attrs)?["li",y(t.attrs),0]:d},defining:!0}},M);e.nodes=O},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(4),o=n(9),i=n(22),s=n(19),a=n(18),c=n(20),l=n(12),u=n(5),p="undefined"!=typeof navigator&&/Mac/.test(navigator.platform);e.buildKeymap=function(t,e){var n={},a=e&&e.applyToWord||!1;if(n["Mod-z"]=i.undo,n["Shift-Mod-z"]=i.redo,n.Backspace=o.chainCommands(s.undoInputRule,o.deleteSelection,o.joinBackward,o.selectNodeBackward),n.Enter=o.chainCommands(o.newlineInCode,o.createParagraphNear,o.liftEmptyBlock,o.splitBlockKeepMarks),p||(n["Mod-y"]=i.redo),t.marks.strong&&(n["Mod-b"]=u.expandToWordWrap(l.toggleInlineFormat,r.__assign({},c.bold,{applyToWord:a}))),t.marks.em&&(n["Mod-i"]=u.expandToWordWrap(l.toggleInlineFormat,r.__assign({},c.italic,{applyToWord:a}))),t.marks.u&&(n["Mod-u"]=u.expandToWordWrap(l.toggleInlineFormat,r.__assign({},c.underline,{applyToWord:a}))),t.nodes.hard_break){var f=t.nodes.hard_break,d=o.chainCommands(o.exitCode,(function(t,e){return e(t.tr.replaceSelectionWith(f.create()).scrollIntoView()),!0}));n["Shift-Enter"]=d}return n},e.buildListKeymap=function(t){var e={};return t.nodes.list_item&&(e.Enter=a.splitListItemKeepMarks(t.nodes.list_item)),e}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(21);e.sanitize=function(t){return t=(t=(t=(t=(t=(t=(t=(t=(t=(t=t.replace(/^[\s\S]+?<!--StartFragment-->\s*([\s\S]*?)\s*<!--EndFragment-->[\s\S]+$/,"$1")).replace(/<\/?[ovw]:[^>]*?>/gi,"")).replace(/<\\?\??xml[^>]*>/gi,"")).replace(/<(?:link|meta) [^>]+?>/gi,"")).replace(/<style[^>]*?>\s*<\/style>/gi,"")).replace(/<\/?st1:.*?>/gi,"")).replace(/<a name="[a-zA-Z0-9_]+">/gim,"")).replace(/v:shapes?="[^"]+"/gi,"")).replace(/<!\[if !supportLists\]>/gi,"")).replace(/<!\[endif\]>/gi,"")},e.removeComments=function(t){return t.replace(/<!--[\s\S]+?-->/g,"")},e.removeTag=function(t,e){return t.replace(new RegExp("<\\/?("+e+")(?:\\s[^>]*?)?>","gi"),"")},e.removeAttribute=function(t){t.ownerElement&&t.ownerElement.removeAttribute(t.name)},e.sanitizeClassAttr=function(t){/^Mso/.test(t.value)&&e.removeAttribute(t)};var o=/\s*;\s*/,i=/\s*:\s*/;e.sanitizeStyleAttr=function(t){var n,r,s=t.value.split(o).filter((function(t){return Boolean(t)})),a=t.ownerElement.style,c="";s.forEach((function(t){var e;e=t.split(i),n=e[0],r=e[1],void 0!==a[n]&&(c+=n+": "+r+"; ")})),(c=c.trim())?t.value=c:e.removeAttribute(t)};function s(t){for(var e=t.length,n=new Array(e/2),r=0;r<e;r+=2)n[r]=String.fromCharCode(parseInt(t.substring(r,r+2),16));return btoa(n.join(""))}e.pasteCleanup=function(t,n){var o=t;if(n.convertMsLists&&(o=r.convertMsLists(o)),n.stripTags&&(o=e.removeTag(o,n.stripTags)),n.attributes){var i=document.createElement("div");i.innerHTML=o,Array.from(i.querySelectorAll("*")).forEach((function(t){return function(t,e){if(t.nodeType===Node.ELEMENT_NODE){for(var n=t.attributes.length-1;n>=0;n--){var r=t.attributes[n];e[r.name]?e[r.name](r):e["*"]&&e["*"](r)}"SPAN"===t.nodeName&&0===t.attributes.length&&function(t){var e=t.parentNode;if(e){for(;t.firstChild;)e.insertBefore(t.firstChild,t);e.removeChild(t)}}(t)}}(t,n.attributes)})),o=i.innerHTML}return o};var a=/<img\s[^>]*?src=(?:'|")file:\/[^'"]+(?:'|")[^>]*>/gi,c=/{\\pict[\s\S]+?\\bliptag-?\d+(\\blipupi-?\d+)?({\\\*\\blipuid\s?[\da-fA-F]+)?[\s}]*?/,l=new RegExp("(?:("+c.source+"))([\\da-fA-F\\s]+)\\}","g"),u=/[^\da-fA-F]/g,p=/file:\/[^'"]+\.(jpg|png|gif)/i,f=/\\(png|jpeg)blip\\/;e.replaceImageSourcesFromRtf=function(t,e){var n=t.match(a);if(!n||-1===e.types.indexOf("text/rtf"))return t;var r=e.getData("text/rtf"),o=[],i=r.match(l);if(!r||!i)return t;for(var d=0,h=i;d<h.length;d++){var m=h[d],v=f.exec(m);if(v){var g=m.replace(c,"").replace(u,"");o.push("data:image/"+v[1]+";base64,"+s(g))}}return n.length!==o.length?t:t.replace(a,(function(t){var e=o.shift()||"";return t.replace(p,e)}))}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(4),o=n(1);e.findAt=function(t,e,n,r,i){var c,l,u,p,f,d,h=[],m=[],v=e.matchCase,g=e.matchWord,y=e.useRegExp,w=e.text;if(y&&(/^\\$/.test(w)||/[^\\]\\$/.test(w))&&(w=w.substring(0,w.length-1)),!w)return h;var b=v?"g":"gi",S=y?new RegExp(w,b):a(w,b);return t.nodesBetween(n,r,(function(e,a,v){if(i(h))return!1;e.inlineContent&&a+e.content.size>=n&&(m.length=0,e.nodesBetween(0,e.content.size,(function(e,v,y,w){if(i(h))return!1;var b=1+a+v;if(e.isText&&b+e.nodeSize>=n){if(f=e.text||"",d=y.childCount-1>=w+1&&y.child(w+1),m.push(n<=b?{text:f,start:b}:{text:f.slice(n-b),start:n}),d&&d.isText)return;for(l=m.map((function(t){return t.text})).join(""),c=S.exec(l);null!==c&&(u=m[0].start+c.index,p=u+c[0].length,n<=u&&r>=p&&s(c,g)&&h.push(o.TextSelection.create(t,u,p)),!i(h));)c=S.exec(l)}else m.length=0})))})),h},e.find=function(t,n){var o=n.backward,i=n.matchCyclic,s=r.__rest(n,["backward","matchCyclic"]),a=o?function(){return!1}:function(t){return t.length>0},c=t.doc,l=t.selection,u=[];return o?!(u=e.findAt(c,s,0,l.from,a)).length&&i&&(u=e.findAt(c,s,l.from,c.content.size,a)):!(u=e.findAt(c,s,l.to,c.content.size,a)).length&&i&&(u=e.findAt(c,s,0,l.to,a)),u.length?u[u.length-1]:null},e.findAll=function(t,n){return e.findAt(t,n,0,t.content.size,(function(){return!1}))},e.replace=function(t,e,n){var r=t.from,i=t.to;return n.insertText(e,r,i).setSelection(o.TextSelection.create(n.doc,r,r+e.length)),n},e.replaceAll=function(t,n,r){var o=e.findAll(t.doc,r);if(0===o.length)return null;for(var i=t.tr,s=o.length-1;s>=0;s--)i.insertText(n,o[s].from,o[s].to);return i};var i=/^[\s0-9~`!@#$%\^&*\(\)_\-=+\\|\[\]{};:'"\?/.,<>]?$/,s=function(t,e){if(e){if(!0===e){var n=t.input,r=n.charAt(t.index-1),o=n.charAt(t.index+t[0].length);return i.test(r)&&i.test(o)}return e(t)}return!0},a=function(t,e){var n=t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d").replace(/\s/g,"\\s");return new RegExp(n,e)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(1),o=n(3);e.placeholder=function(t){var e={class:"k-placeholder","data-placeholder":t};return new r.Plugin({key:new r.PluginKey("placeholder"),props:{decorations:function(t){var n=t.doc,r=n.content.firstChild;if(!(0===n.childCount||1===n.childCount&&r.inlineContent&&0===r.childCount))return o.DecorationSet.empty;var i=[];return n.descendants((function(t,n){i.push(o.Decoration.node(n,n+t.nodeSize,e))})),o.DecorationSet.create(n,i)}}})}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(1),o=n(3),i=/\s+/g,s=/text-align/;e.spacesFix=function(){return new r.Plugin({key:new r.PluginKey("spaces-fix"),props:{decorations:function(t){var e,n,r,a,c=[],l=t.doc;return l.nodesBetween(0,l.content.size,(function(t,l,u){if(t.type.isText&&function(t){return s.test(t&&t.attrs&&t.attrs.style||"")}(u))for(n=i.exec(t.text||"");null!==n;){if(e=l+n.index,r=n[0].length,n.index+r<n.input.length)for(a=0;a<=r-1;a+=2)c.push(o.Decoration.inline(e+a,e+a+1,{style:"white-space: normal"}));n=i.exec(t.text||"")}})),o.DecorationSet.create(l,c)}}})}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(1),o=n(3);e.textHighlightKey=new r.PluginKey("highlight"),e.textHighlight=function(t){return void 0===t&&(t=e.textHighlightKey),new r.Plugin({key:t,state:{init:function(){return null},apply:function(t){return t.getMeta(this.spec.key)}},props:{decorations:function(t){var e=(this.spec.key.getState(t)||[]).map((function(t){return o.Decoration.inline(t.from,t.to,t.attrs)}));return o.DecorationSet.create(t.doc,e)}}})}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(4),o=n(1),i=n(3),s=n(5);e.imageResizeKey=new o.PluginKey("image-resize");var a={southeast:{x:1,y:1},east:{x:1,y:0},south:{x:0,y:1},north:{x:0,y:-1},west:{x:-1,y:0},southwest:{x:-1,y:1},northwest:{x:-1,y:-1},northeast:{x:1,y:-1}},c=Object.keys(a),l=function(t,e,n){t.style[e]=n+"px"},u=/[^\-]width:|[^\-]height:/,p=/^.+$/,f=function(){function t(t,e,n,r){this.activeHandle=t,this.dragging=e,this.rect=n,this.nodePosition=r}return t.prototype.apply=function(n){var r=n.getMeta(e.imageResizeKey);return r?new t(r.activeHandle,r.setDragging,r.rect,r.nodePosition):this},t}(),d=function(t,n,i){var c=n.target.getAttribute("data-direction");if(!c)return!1;var f=e.imageResizeKey.getState(t.state);n.preventDefault();var d=t.state.tr;function h(n){!function(t,n,r){var o=e.imageResizeKey.getState(t.state),i=o.rect,s=o.dragging,c=o.nodePosition,u=o.activeHandle;if(s&&i){var p=t.nodeDOM(c),f=a[u],d=(n.clientX-s.startX)*f.x,h=(n.clientY-s.startY)*f.y,m=f.x?d+p.width:i.width,v=f.y?h+p.height:i.height;if(r.lockRatio&&f.x&&f.y){var g=Math.min(m/p.width,v/p.height),y=p.width*g,w=p.height*g;s.startX=n.clientX-(m-y)*f.x,s.startY=n.clientY-(v-w)*f.y,m=y,v=w}else s.startX=f.x?n.clientX:s.startX,s.startY=f.y?n.clientY:s.startY;l(p,"width",m),l(p,"height",v),i.top=p.offsetTop,i.left=p.offsetLeft,i.width=p.offsetWidth,i.height=p.offsetHeight;var b=p.nextElementSibling;b.style.width=i.width+"px",b.style.height=i.height+"px",b.style.top=i.top+"px",b.style.left=i.left+"px"}}(t,n,i)}return d.setMeta(e.imageResizeKey,{setDragging:{startX:n.clientX,startY:n.clientY},activeHandle:c,rect:f.rect,nodePosition:f.nodePosition}),d.setMeta("addToHistory",!1),t.dispatch(d),n.view.addEventListener("mouseup",(function n(i){i.view.removeEventListener("mouseup",n),i.view.removeEventListener("mousemove",h),function(t){var n=e.imageResizeKey.getState(t.state),i=n.rect,a=n.dragging,c=n.nodePosition;if(a&&i){var l=t.state.selection;if(l instanceof o.NodeSelection){var f=l.node.attrs,d=i.width,h=i.height,m=void 0;if(u.test(f.style||"")){var v=s.changeStylesString(f.style,{style:"width",value:p,newValue:d+"px"}),g=s.changeStylesString(v.style||"",{style:"height",value:p,newValue:h+"px"}).style;m=r.__assign({},f,{style:g})}else m=r.__assign({},f,{width:d,height:h});var y=l.node.type.createAndFill(m);if(y){var w=t.state.tr;w.replaceWith(c,c+1,y),w.setSelection(o.NodeSelection.create(w.doc,c)),w.setMeta("commandName","image-resize"),w.setMeta("args",m),w.setMeta(e.imageResizeKey,{setDragging:null,activeHandle:null,rect:i,nodePosition:c}),t.dispatch(w)}}}}(t)})),n.view.addEventListener("mousemove",h),!0};e.imageResizing=function(t){return void 0===t&&(t={node:"image",lockRatio:!0}),new o.Plugin({key:e.imageResizeKey,view:function(n){return{resize:function(){e.imageResizeKey.getState(n.state).rect&&n.dispatch(n.state.tr.setMeta("resize",!0))},get window(){return n.dom.ownerDocument&&n.dom.ownerDocument.defaultView},attachResize:function(){var t=this.window;t&&(t.removeEventListener("resize",this.resize),t.addEventListener("resize",this.resize))},removeResize:function(){var t=this.window;t&&t.removeEventListener("resize",this.resize)},update:function(n,r){var i=n.state,s=i.selection,a=i.schema.nodes[t.node],c=e.imageResizeKey.getState(i),l=c.rect;if(s instanceof o.NodeSelection&&a===s.node.type){var u=n.nodeDOM(s.from),p={top:u.offsetTop,left:u.offsetLeft,width:u.offsetWidth,height:u.offsetHeight};if(!r.selection.eq(s)||l&&(l.width!==p.width||l.height!==p.height||l.top!==p.top||l.left!==p.left)){var f=i.tr;f.setMeta(e.imageResizeKey,{rect:p,nodePosition:s.from}),n.dispatch(f),this.attachResize()}}else l&&(c.rect=null,c.nodePosition=-1)},destroy:function(){this.removeResize()}}},state:{init:function(){return new f("",null,null,-1)},apply:function(t,e){return e.apply(t)}},props:{handleDOMEvents:{mousedown:function(e,n){return d(e,n,t)}},decorations:function(n){var r=n.selection,s=n.schema.nodes[t.node],a=e.imageResizeKey.getState(n).rect;if(a&&r instanceof o.NodeSelection&&s===r.node.type){var l=document.createElement("div");l.className="k-editor-resize-handles-wrapper",l.style.width=a.width+"px",l.style.height=a.height+"px",l.style.top=a.top+"px",l.style.left=a.left+"px";for(var u=0;u<c.length;u++){var p=document.createElement("div");p.className="k-editor-resize-handle "+c[u],p.setAttribute("data-direction",c[u]),l.appendChild(p)}return i.DecorationSet.create(n.doc,[i.Decoration.widget(n.selection.from+1,l)])}return i.DecorationSet.empty}}})}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(1),o=n(3),i=n(6);e.caretColorKey=new r.PluginKey("caret-color"),e.caretColor=function(){return new r.Plugin({key:e.caretColorKey,props:{decorations:function(t){var e=t.doc,n=t.selection,r=t.storedMarks;if(!n.empty||!r)return o.DecorationSet.empty;var s=i.styleValue((r||[]).find((function(t){return"style"===t.type.name})),{name:"color",value:/^.+$/});if(!s)return o.DecorationSet.empty;var a=n.$anchor.parent,c=[];return e.descendants((function(t,e){t.eq(a)&&c.push(o.Decoration.node(e,e+t.nodeSize,{style:"caret-color: "+s}))})),o.DecorationSet.create(e,c)}}})}},function(t,e,n){"use strict";n.r(e),n.d(e,"dropCursor",(function(){return i}));var r=n(1),o=n(2);function i(t){return void 0===t&&(t={}),new r.Plugin({view:function(e){return new s(e,t)}})}var s=function(t,e){var n=this;this.editorView=t,this.width=e.width||1,this.color=e.color||"black",this.class=e.class,this.cursorPos=null,this.element=null,this.timeout=null,this.handlers=["dragover","dragend","drop","dragleave"].map((function(e){var r=function(t){return n[e](t)};return t.dom.addEventListener(e,r),{name:e,handler:r}}))};s.prototype.destroy=function(){var t=this;this.handlers.forEach((function(e){var n=e.name,r=e.handler;return t.editorView.dom.removeEventListener(n,r)}))},s.prototype.update=function(t,e){null!=this.cursorPos&&e.doc!=t.state.doc&&(this.cursorPos>t.state.doc.content.size?this.setCursor(null):this.updateOverlay())},s.prototype.setCursor=function(t){t!=this.cursorPos&&(this.cursorPos=t,null==t?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())},s.prototype.updateOverlay=function(){var t,e=this.editorView.state.doc.resolve(this.cursorPos);if(!e.parent.inlineContent){var n=e.nodeBefore,r=e.nodeAfter;if(n||r){var o=this.editorView.nodeDOM(this.cursorPos-(n?n.nodeSize:0)).getBoundingClientRect(),i=n?o.bottom:o.top;n&&r&&(i=(i+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),t={left:o.left,right:o.right,top:i-this.width/2,bottom:i+this.width/2}}}if(!t){var s=this.editorView.coordsAtPos(this.cursorPos);t={left:s.left-this.width/2,right:s.left+this.width/2,top:s.top,bottom:s.bottom}}var a,c,l=this.editorView.dom.offsetParent;if(this.element||(this.element=l.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),!l||l==document.body&&"static"==getComputedStyle(l).position)a=-pageXOffset,c=-pageYOffset;else{var u=l.getBoundingClientRect();a=u.left-l.scrollLeft,c=u.top-l.scrollTop}this.element.style.left=t.left-a+"px",this.element.style.top=t.top-c+"px",this.element.style.width=t.right-t.left+"px",this.element.style.height=t.bottom-t.top+"px"},s.prototype.scheduleRemoval=function(t){var e=this;clearTimeout(this.timeout),this.timeout=setTimeout((function(){return e.setCursor(null)}),t)},s.prototype.dragover=function(t){if(this.editorView.editable){var e=this.editorView.posAtCoords({left:t.clientX,top:t.clientY}),n=e&&e.inside>=0&&this.editorView.state.doc.nodeAt(e.inside),r=n&&n.type.spec.disableDropCursor,i="function"==typeof r?r(this.editorView,e):r;if(e&&!i){var s=e.pos;if(this.editorView.dragging&&this.editorView.dragging.slice&&null==(s=Object(o.dropPoint)(this.editorView.state.doc,s,this.editorView.dragging.slice)))return this.setCursor(null);this.setCursor(s),this.scheduleRemoval(5e3)}}},s.prototype.dragend=function(){this.scheduleRemoval(20)},s.prototype.drop=function(){this.scheduleRemoval(20)},s.prototype.dragleave=function(t){t.target!=this.editorView.dom&&this.editorView.dom.contains(t.relatedTarget)||this.setCursor(null)}},function(t,e,n){"use strict";n.r(e),n.d(e,"GapCursor",(function(){return a})),n.d(e,"gapCursor",(function(){return l}));var r=n(7),o=n(1),i=n(0),s=n(3),a=function(t){function e(e){t.call(this,e,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.map=function(n,r){var o=n.resolve(r.map(this.head));return e.valid(o)?new e(o):t.near(o)},e.prototype.content=function(){return i.Slice.empty},e.prototype.eq=function(t){return t instanceof e&&t.head==this.head},e.prototype.toJSON=function(){return{type:"gapcursor",pos:this.head}},e.fromJSON=function(t,n){if("number"!=typeof n.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new e(t.resolve(n.pos))},e.prototype.getBookmark=function(){return new c(this.anchor)},e.valid=function(t){var e=t.parent;if(e.isTextblock||!function(t){for(var e=t.depth;e>=0;e--){var n=t.index(e),r=t.node(e);if(0!=n)for(var o=r.child(n-1);;o=o.lastChild){if(0==o.childCount&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(t)||!function(t){for(var e=t.depth;e>=0;e--){var n=t.indexAfter(e),r=t.node(e);if(n!=r.childCount)for(var o=r.child(n);;o=o.firstChild){if(0==o.childCount&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(t))return!1;var n=e.type.spec.allowGapCursor;if(null!=n)return n;var r=e.contentMatchAt(t.index()).defaultType;return r&&r.isTextblock},e.findFrom=function(t,n,r){t:for(;;){if(!r&&e.valid(t))return t;for(var i=t.pos,s=null,a=t.depth;;a--){var c=t.node(a);if(n>0?t.indexAfter(a)<c.childCount:t.index(a)>0){s=c.child(n>0?t.indexAfter(a):t.index(a)-1);break}if(0==a)return null;i+=n;var l=t.doc.resolve(i);if(e.valid(l))return l}for(;;){var u=n>0?s.firstChild:s.lastChild;if(!u){if(s.isAtom&&!s.isText&&!o.NodeSelection.isSelectable(s)){t=t.doc.resolve(i+s.nodeSize*n),r=!1;continue t}break}s=u,i+=n;var p=t.doc.resolve(i);if(e.valid(p))return p}return null}},e}(o.Selection);a.prototype.visible=!1,o.Selection.jsonID("gapcursor",a);var c=function(t){this.pos=t};c.prototype.map=function(t){return new c(t.map(this.pos))},c.prototype.resolve=function(t){var e=t.resolve(this.pos);return a.valid(e)?new a(e):o.Selection.near(e)};var l=function(){return new o.Plugin({props:{decorations:h,createSelectionBetween:function(t,e,n){if(e.pos==n.pos&&a.valid(n))return new a(n)},handleClick:f,handleKeyDown:u,handleDOMEvents:{beforeinput:d}}})},u=Object(r.keydownHandler)({ArrowLeft:p("horiz",-1),ArrowRight:p("horiz",1),ArrowUp:p("vert",-1),ArrowDown:p("vert",1)});function p(t,e){var n="vert"==t?e>0?"down":"up":e>0?"right":"left";return function(t,r,i){var s=t.selection,c=e>0?s.$to:s.$from,l=s.empty;if(s instanceof o.TextSelection){if(!i.endOfTextblock(n)||0==c.depth)return!1;l=!1,c=t.doc.resolve(e>0?c.after():c.before())}var u=a.findFrom(c,e,l);return!!u&&(r&&r(t.tr.setSelection(new a(u))),!0)}}function f(t,e,n){if(!t.editable)return!1;var r=t.state.doc.resolve(e);if(!a.valid(r))return!1;var i=t.posAtCoords({left:n.clientX,top:n.clientY}).inside;return!(i>-1&&o.NodeSelection.isSelectable(t.state.doc.nodeAt(i)))&&(t.dispatch(t.state.tr.setSelection(new a(r))),!0)}function d(t,e){if("insertCompositionText"!=e.inputType||!(t.state.selection instanceof a))return!1;var n=t.state.selection.$from,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;for(var s=i.Fragment.empty,c=r.length-1;c>=0;c--)s=i.Fragment.from(r[c].createAndFill(null,s));var l=t.state.tr.replace(n.pos,n.pos,new i.Slice(s,0,0));return l.setSelection(o.TextSelection.near(l.doc.resolve(n.pos+1))),t.dispatch(l),!1}function h(t){if(!(t.selection instanceof a))return null;var e=document.createElement("div");return e.className="ProseMirror-gapcursor",s.DecorationSet.create(t.doc,[s.Decoration.widget(t.selection.head,e,{key:"gapcursor"})])}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(14);e.pmAddRowAfter=r.addRowAfter,e.pmAddRowBefore=r.addRowBefore;var o=n(11);e.createTable=function(t,e,n){for(var r,o=t.table,i=t.table_row,s=t.table_cell,a=[],c=0;c<e+1;c++){r=[];for(var l=0;l<n+1;l++)r.push(s.createAndFill());a.push(i.createAndFill(void 0,r))}return o.createAndFill(void 0,a)};var i=function(t,e){for(var n=t.$head,r=n.depth;r>0;r--){var o=n.node(r);if(o.type.name===e)return{pos:n.before(r),node:o}}return null};e.addRowBefore=function(t,e){var n=e&&function(t){var n,r=i(t.selection,"table_row"),s=i(t.selection,"table");if(r&&s&&r.node.attrs[o.rowTypeAttr]){for(var a=0,c=0;c<s.node.nodeSize;c++)if(s.node.child(c).eq(r.node)){a=c;break}var l=s.node.child(a-1),u=r.pos-l.nodeSize;t.setNodeMarkup(u,void 0,((n={})[o.rowTypeAttr]=r.node.attrs[o.rowTypeAttr],n))}return e(t)};return r.addRowBefore(t,n)},e.addRowAfter=function(t,e){var n=e&&function(t){var n,r=i(t.selection,"table_row");if(r&&r.node.attrs[o.rowTypeAttr]){var s=r.pos+r.node.nodeSize;t.setNodeMarkup(s,void 0,((n={})[o.rowTypeAttr]=r.node.attrs[o.rowTypeAttr],n))}return e(t)};return r.addRowAfter(t,n)}}])}));
|
|
16
|
+
var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function o(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var i=function(){return(i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function s(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}function a(e,t,n,r){var o,i=arguments.length,s=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s}function l(e,t){return function(n,r){t(n,r,e)}}function c(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function u(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{l(r.next(e))}catch(e){i(e)}}function a(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((r=r.apply(e,t||[])).next())}))}function d(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function p(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}function f(e,t){for(var n in e)"default"===n||t.hasOwnProperty(n)||(t[n]=e[n])}function h(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function m(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s}function v(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(m(arguments[t]));return e}function g(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),o=0;for(t=0;t<n;t++)for(var i=arguments[t],s=0,a=i.length;s<a;s++,o++)r[o]=i[s];return r}function y(e){return this instanceof y?(this.v=e,this):new y(e)}function w(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,o=n.apply(e,t||[]),i=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(e){o[e]&&(r[e]=function(t){return new Promise((function(n,r){i.push([e,t,n,r])>1||a(e,t)}))})}function a(e,t){try{(n=o[e](t)).value instanceof y?Promise.resolve(n.value.v).then(l,c):u(i[0][2],n)}catch(e){u(i[0][3],e)}var n}function l(e){a("next",e)}function c(e){a("throw",e)}function u(e,t){e(t),i.shift(),i.length&&a(i[0][0],i[0][1])}}function b(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,o){t[r]=e[r]?function(t){return(n=!n)?{value:y(e[r](t)),done:"return"===r}:o?o(t):t}:o}}function S(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=h(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,o){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,o,(t=e[n](t)).done,t.value)}))}}}function k(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function x(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function C(e){return e&&e.__esModule?e:{default:e}}function M(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function O(e,t,n){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,n),n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(12);t.changeStylesString=function(e,t){var n=t.style,r=t.value,o=t.newValue;if(!e)return{changed:!1,style:null};var i=e.split(/\s*;\s*/).filter((function(e){return Boolean(e)})),s=i.filter((function(e){var t=e.split(/\s*:\s*/);return!(t[0].toLowerCase()===n&&r.test(t[1]))}));return o&&s.push(n+": "+o),{style:s.join("; ")+(s.length?";":""),changed:Boolean(o)||s.length!==i.length}},t.canInsert=function(e,t){for(var n=e.selection.$from,r=n.depth;r>=0;r--){var o=n.index(r);if(n.node(r).canReplaceWith(o,o,t))return!0}return!1};var s=function(e){return e instanceof r.Node?e.type.name:e.name};t.findNthParentNodeOfType=function(e,t){return void 0===t&&(t=1),function(n){return function(e,t){return void 0===t&&(t=1),function(n){for(var r=n.$from,o=r.depth;o>0;o--){var i=r.node(o);if(e(i)&&0===(t-=1))return{depth:o,node:i}}}}((function(t){return s(t)===s(e)}),t)(n)}},t.insertNode=function(e,t){return function(n,r){var o=n.tr.replaceSelectionWith(e);t&&o.scrollIntoView(),r(o)}},t.hasSameMarkup=function(e,t,n,o){var s=r.Fragment.from(i.parseContent(e,n,o)),a=r.Fragment.from(i.parseContent(t,n,o));return s.eq(a)},t.getSelectionText=function(e){var t=e.selection;if(t instanceof o.TextSelection||t instanceof o.AllSelection){var n=t.content().content;return n.textBetween(0,n.size)}return""},t.getNodeFromSelection=function(e){if(e.selection instanceof o.NodeSelection)return e.selection.node},t.selectedLineTextOnly=function(e){var n="",r=!1,o=e.selection,i=e.doc,s=o.$from,a=o.$to,l=o.from,c=o.to;return s.sameParent(a)&&(i.nodesBetween(l,c,(function(e){r=r||e.isLeaf&&!e.isText})),r||(n=t.getSelectionText(e))),n},t.indentHtml=function(e){return e.replace(/<\/(p|li|ul|ol|h[1-6]|table|tr|td|th)>/gi,"</$1>\n").replace(/<(ul|ol)([^>]*)><li/gi,"<$1$2>\n<li").replace(/<br \/>/gi,"<br />\n").replace(/\n$/,"")},t.shallowEqual=function(e,t){var n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every((function(n){return e[n]===t[n]}))};var a={before:/[^ !,?.\[\]{}()]+$/i,after:/^[^ !,?.\[\]{}()]+/i};t.expandSelection=function(e,t,n){if(!n.applyToWord||!e.selection.empty)return{state:e,dispatch:t};var r=!0===n.applyToWord?a:n.applyToWord,i=null,s=e.tr,l=e.selection,c=l.$head.nodeBefore,u=l.$head.nodeAfter;if(c&&"text"===c.type.name&&c.text&&u&&"text"===u.type.name&&u.text){var d=[];l.$head.parent.descendants((function(e,t){return d.push({node:e,pos:t}),!1}));for(var p=l.$head.parentOffset,f=d.findIndex((function(e){var t=e.node,n=e.pos;return n<=p&&n+t.nodeSize>=p})),h=d[f].node.text,m=!1,v=f-1;v>=0;v--){var g=d[v];!m&&g&&"text"===g.node.type.name?h=g.node.text+h:(m=!0,p-=g.node.nodeSize)}for(v=f+1;v<d.length;v++){if(!(g=d[v])||"text"!==g.node.type.name)break;h+=g.node.text}var y=h.substring(0,p),w=h.substring(p),b=r.before.exec(y),S=r.after.exec(w);if(b&&S){var k=b[0].length,x=S[0].length,C=i=l.from;s.setSelection(o.TextSelection.create(e.doc,C-k,C+x));return{state:{tr:s,selection:s.selection,doc:s.doc,storedMarks:null,schema:s.doc.type.schema},dispatch:function(e){e.setSelection(o.TextSelection.create(e.doc,i)),t(e)}}}}return{state:e,dispatch:t}},t.expandToWordWrap=function(e,n){return function(r,o,i){var s=t.expandSelection(r,o,n),a=s.state,l=s.dispatch;return e(n)(a,l)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.rowTypeAttr="k-parent-node",t.colgroupAttr="k-colgroup-data",t.resizableAttr="resizable-node",t.resizableWrap="k-editor-resize-wrap-element",t.resizeHandle="k-editor-resize-handle",t.dataDirection="data-direction"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(0);t.markApplies=function(e,t,n){for(var r=function(r){var o=t[r],i=o.$from,s=o.$to,a=0===i.depth&&e.type.allowsMarkType(n);if(e.nodesBetween(i.pos,s.pos,(function(e){if(a)return!1;a=e.inlineContent&&e.type.allowsMarkType(n)})),a)return{v:!0}},o=0;o<t.length;o++){var i=r(o);if(i)return i.v}return!1},t.toggleMark=function(e,n,r){return function(o,i){var s=o.selection,a=s.empty,l=s.$cursor,c=s.ranges;if(a&&!l||!t.markApplies(o.doc,c,e))return!1;if(i)if(l)e.isInSet(o.storedMarks||l.marks())?i(r.removeStoredMark(e)):i(r.addStoredMark(e.create(n)));else{for(var u=!1,d=0;!u&&d<c.length;d++){var p=c[d],f=p.$from,h=p.$to;u=o.doc.rangeHasMark(f.pos,h.pos,e)}for(d=0;d<c.length;d++){var m=c[d];f=m.$from,h=m.$to;u?r.removeMark(f.pos,h.pos,e):r.addMark(f.pos,h.pos,e.create(n))}i(r.scrollIntoView())}return!0}},t.removeMark=function(e,t,n,i){void 0===i&&(i=null);var s=[],a=0;return e.doc.nodesBetween(t,n,(function(e,r){if(e.isInline){a++;var l=null;if(i instanceof o.MarkType){var c=i.isInSet(e.marks);c&&(l=[c])}else i?i.isInSet(e.marks)&&(l=[i]):l=e.marks;if(l&&l.length)for(var u=Math.min(r+e.nodeSize,n),d=0;d<l.length;d++){for(var p=l[d],f=void 0,h=0;h<s.length;h++){var m=s[h];m.step===a-1&&p.eq(m.style)&&(f=m)}f?(f.to=u,f.step=a):s.push({style:p,from:Math.max(r,t),to:u,step:a})}}})),s.forEach((function(t){return e.step(new r.RemoveMarkStep(t.from,t.to,t.style))})),e},t.removeMarks=function(e,n,r,o){var i=n.selection,s=i.$cursor,a=i.ranges;if(o=o||n.tr,s)e.forEach((function(e){e.isInSet(n.storedMarks||s.marks())&&r(o.removeStoredMark(e))}));else{for(var l=function(n){var r=a[n],i=r.$from,s=r.$to;e.forEach((function(e){t.removeMark(o,i.pos,s.pos,e)}))},c=0;c<a.length;c++)l(c);r(o.scrollIntoView())}return!0};t.removeAllMarks=function(e){var n=(void 0===e?{}:e).except,r=void 0===n?[]:n;return function(e,n){var o,i=e.tr;t.cleanMarks(i,{except:(o=r,o instanceof Array?o:[o])}),i.docChanged&&n(i)}},t.cleanMarks=function(e,t){var n=t.except,r=e.doc,o=e.selection,i=r.type.schema,s=o.empty,a=o.ranges,l=(n||[]).map((function(e){return e.name}));if(!s){var c=Object.keys(i.marks).map((function(e){return i.marks[e]})).filter((function(e){return-1===l.indexOf(e.name)}));a.forEach((function(t){var n=t.$from,r=t.$to;c.forEach((function(t){return e.removeMark(n.pos,r.pos,t)}))}))}},t.hasMark=function(e,n){var r,o=e.schema.marks,i=(n.altMarks||[]).filter((function(e){return o[e]})),s=n.altStyle,a=e.selection,l=a.from,c=a.$from,u=a.to,d=a.empty,p=o[n.mark],f=e.doc,h=!1;return d?(r=e.storedMarks||c.marks(),h=p&&p.isInSet(r)||i.some((function(e){return o[e].isInSet(r)}))):h=p&&f.rangeHasMark(l,u,p)||i.some((function(e){return f.rangeHasMark(l,u,o[e])})),!h&&s&&o.style?t.selectionMarks(e,o.style).some((function(e){return null!==t.styleValue(e,s)})):Boolean(h)},t.styleValue=function(e,t){for(var n=(e&&e.attrs.style||"").split(/\s*;\s*/).filter((function(e){return Boolean(e)})),r=0;r<n.length;r++){var o=n[r].split(/\s*:\s*/);if(o[0].toLowerCase()===t.name&&t.value.test(o[1]))return o[1]}return null},t.selectionMarks=function(e,t){var n=e.selection,r=n.from,o=n.$from,i=n.to,s=n.empty,a=[];return s?a.push(t.isInSet(e.storedMarks||o.marks())):e.doc.nodesBetween(r,i,(function(e){e.isInline&&a.push(t.isInSet(e.marks))})),a},t.getMark=function(e,n){var r=t.selectionMarks(e,n),o=r.filter((function(e){return Boolean(e)}));return r.length===o.length?r[0]:void 0},t.getActiveMarks=function(e,n){var r=t.selectionMarks(e,n),o=r.filter((function(e){return Boolean(e)}));return{hasNodesWithoutMarks:r.length!==o.length,marks:o}}},function(e,t,n){"use strict";n.r(t),n.d(t,"CellSelection",(function(){return z})),n.d(t,"TableMap",(function(){return h})),n.d(t,"TableView",(function(){return Oe})),n.d(t,"__clipCells",(function(){return B})),n.d(t,"__insertCells",(function(){return j})),n.d(t,"__pastedCells",(function(){return $})),n.d(t,"addColSpan",(function(){return E})),n.d(t,"addColumn",(function(){return re})),n.d(t,"addColumnAfter",(function(){return ie})),n.d(t,"addColumnBefore",(function(){return oe})),n.d(t,"addRow",(function(){return ce})),n.d(t,"addRowAfter",(function(){return de})),n.d(t,"addRowBefore",(function(){return ue})),n.d(t,"cellAround",(function(){return S})),n.d(t,"colCount",(function(){return A})),n.d(t,"columnIsHeader",(function(){return _})),n.d(t,"columnResizing",(function(){return Ne})),n.d(t,"columnResizingPluginKey",(function(){return Ae})),n.d(t,"deleteColumn",(function(){return ae})),n.d(t,"deleteRow",(function(){return fe})),n.d(t,"deleteTable",(function(){return Me})),n.d(t,"findCell",(function(){return T})),n.d(t,"fixTables",(function(){return te})),n.d(t,"fixTablesKey",(function(){return ee})),n.d(t,"goToNextCell",(function(){return Ce})),n.d(t,"handlePaste",(function(){return U})),n.d(t,"inSameTable",(function(){return O})),n.d(t,"isInTable",(function(){return k})),n.d(t,"mergeCells",(function(){return me})),n.d(t,"moveCellForward",(function(){return M})),n.d(t,"nextCell",(function(){return N})),n.d(t,"pointsAtCell",(function(){return C})),n.d(t,"removeColSpan",(function(){return R})),n.d(t,"removeColumn",(function(){return se})),n.d(t,"removeRow",(function(){return pe})),n.d(t,"rowIsHeader",(function(){return le})),n.d(t,"selectedRect",(function(){return ne})),n.d(t,"selectionCell",(function(){return x})),n.d(t,"setAttr",(function(){return D})),n.d(t,"setCellAttr",(function(){return ye})),n.d(t,"splitCell",(function(){return ve})),n.d(t,"splitCellWithType",(function(){return ge})),n.d(t,"tableEditing",(function(){return Ie})),n.d(t,"tableEditingKey",(function(){return b})),n.d(t,"tableNodeTypes",(function(){return w})),n.d(t,"tableNodes",(function(){return y})),n.d(t,"toggleHeader",(function(){return be})),n.d(t,"toggleHeaderCell",(function(){return xe})),n.d(t,"toggleHeaderColumn",(function(){return ke})),n.d(t,"toggleHeaderRow",(function(){return Se})),n.d(t,"updateColumnsOnResize",(function(){return Te}));var r,o,i=n(1),s=n(0),a=n(9),l=n(3),c=n(2);if("undefined"!=typeof WeakMap){var u=new WeakMap;r=function(e){return u.get(e)},o=function(e,t){return u.set(e,t),t}}else{var d=[],p=0;r=function(e){for(var t=0;t<d.length;t+=2)if(d[t]==e)return d[t+1]},o=function(e,t){return 10==p&&(p=0),d[p++]=e,d[p++]=t}}var f=function(e,t,n,r){this.left=e,this.top=t,this.right=n,this.bottom=r},h=function(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r};function m(e){if(e.colwidth)return e.colwidth.slice();for(var t=[],n=0;n<e.colspan;n++)t.push(0);return t}function v(e,t){var n=e.getAttribute("data-colwidth"),r=n&&/^\d+(,\d+)*$/.test(n)?n.split(",").map((function(e){return Number(e)})):null,o=Number(e.getAttribute("colspan")||1),i={colspan:o,rowspan:Number(e.getAttribute("rowspan")||1),colwidth:r&&r.length==o?r:null};for(var s in t){var a=t[s].getFromDOM,l=a&&a(e);null!=l&&(i[s]=l)}return i}function g(e,t){var n={};for(var r in 1!=e.attrs.colspan&&(n.colspan=e.attrs.colspan),1!=e.attrs.rowspan&&(n.rowspan=e.attrs.rowspan),e.attrs.colwidth&&(n["data-colwidth"]=e.attrs.colwidth.join(",")),t){var o=t[r].setDOMAttr;o&&o(e.attrs[r],n)}return n}function y(e){var t=e.cellAttributes||{},n={colspan:{default:1},rowspan:{default:1},colwidth:{default:null}};for(var r in t)n[r]={default:t[r].default};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:e.tableGroup,parseDOM:[{tag:"table"}],toDOM:function(){return["table",["tbody",0]]}},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM:function(){return["tr",0]}},table_cell:{content:e.cellContent,attrs:n,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:function(e){return v(e,t)}}],toDOM:function(e){return["td",g(e,t),0]}},table_header:{content:e.cellContent,attrs:n,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:function(e){return v(e,t)}}],toDOM:function(e){return["th",g(e,t),0]}}}}function w(e){var t=e.cached.tableNodeTypes;if(!t)for(var n in t=e.cached.tableNodeTypes={},e.nodes){var r=e.nodes[n],o=r.spec.tableRole;o&&(t[o]=r)}return t}h.prototype.findCell=function(e){for(var t=0;t<this.map.length;t++){var n=this.map[t];if(n==e){for(var r=t%this.width,o=t/this.width|0,i=r+1,s=o+1,a=1;i<this.width&&this.map[t+a]==n;a++)i++;for(var l=1;s<this.height&&this.map[t+this.width*l]==n;l++)s++;return new f(r,o,i,s)}}throw new RangeError("No cell with offset "+e+" found")},h.prototype.colCount=function(e){for(var t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw new RangeError("No cell with offset "+e+" found")},h.prototype.nextCell=function(e,t,n){var r=this.findCell(e),o=r.left,i=r.right,s=r.top,a=r.bottom;return"horiz"==t?(n<0?0==o:i==this.width)?null:this.map[s*this.width+(n<0?o-1:i)]:(n<0?0==s:a==this.height)?null:this.map[o+this.width*(n<0?s-1:a)]},h.prototype.rectBetween=function(e,t){var n=this.findCell(e),r=n.left,o=n.right,i=n.top,s=n.bottom,a=this.findCell(t),l=a.left,c=a.right,u=a.top,d=a.bottom;return new f(Math.min(r,l),Math.min(i,u),Math.max(o,c),Math.max(s,d))},h.prototype.cellsInRect=function(e){for(var t=[],n={},r=e.top;r<e.bottom;r++)for(var o=e.left;o<e.right;o++){var i=r*this.width+o,s=this.map[i];n[s]||(n[s]=!0,o==e.left&&o&&this.map[i-1]==s||r==e.top&&r&&this.map[i-this.width]==s||t.push(s))}return t},h.prototype.positionAt=function(e,t,n){for(var r=0,o=0;;r++){var i=o+n.child(r).nodeSize;if(r==e){for(var s=t+e*this.width,a=(e+1)*this.width;s<a&&this.map[s]<o;)s++;return s==a?i-1:this.map[s]}o=i}},h.get=function(e){return r(e)||o(e,function(e){if("table"!=e.type.spec.tableRole)throw new RangeError("Not a table node: "+e.type.name);for(var t=function(e){for(var t=-1,n=!1,r=0;r<e.childCount;r++){var o=e.child(r),i=0;if(n)for(var s=0;s<r;s++)for(var a=e.child(s),l=0;l<a.childCount;l++){var c=a.child(l);s+c.attrs.rowspan>r&&(i+=c.attrs.colspan)}for(var u=0;u<o.childCount;u++){var d=o.child(u);i+=d.attrs.colspan,d.attrs.rowspan>1&&(n=!0)}-1==t?t=i:t!=i&&(t=Math.max(t,i))}return t}(e),n=e.childCount,r=[],o=0,i=null,s=[],a=0,l=t*n;a<l;a++)r[a]=0;for(var c=0,u=0;c<n;c++){var d=e.child(c);u++;for(var p=0;;p++){for(;o<r.length&&0!=r[o];)o++;if(p==d.childCount)break;for(var f=d.child(p),v=f.attrs,g=v.colspan,y=v.rowspan,w=v.colwidth,b=0;b<y;b++){if(b+c>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:u,n:y-b});break}for(var S=o+b*t,k=0;k<g;k++){0==r[S+k]?r[S+k]=u:(i||(i=[])).push({type:"collision",row:c,pos:u,n:g-k});var x=w&&w[k];if(x){var C=(S+k)%t*2,M=s[C];null==M||M!=x&&1==s[C+1]?(s[C]=x,s[C+1]=1):M==x&&s[C+1]++}}}o+=g,u+=f.nodeSize}for(var O=(c+1)*t,T=0;o<O;)0==r[o++]&&T++;T&&(i||(i=[])).push({type:"missing",row:c,n:T}),u++}for(var A=new h(t,n,r,i),N=!1,D=0;!N&&D<s.length;D+=2)null!=s[D]&&s[D+1]<n&&(N=!0);N&&function(e,t,n){e.problems||(e.problems=[]);for(var r=0,o={};r<e.map.length;r++){var i=e.map[r];if(!o[i]){o[i]=!0;for(var s=n.nodeAt(i),a=null,l=0;l<s.attrs.colspan;l++){var c=(r+l)%e.width,u=t[2*c];null==u||s.attrs.colwidth&&s.attrs.colwidth[l]==u||((a||(a=m(s.attrs)))[l]=u)}a&&e.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:a})}}}(A,s,e);return A}(e))};var b=new i.PluginKey("selectingCells");function S(e){for(var t=e.depth-1;t>0;t--)if("row"==e.node(t).type.spec.tableRole)return e.node(0).resolve(e.before(t+1));return null}function k(e){for(var t=e.selection.$head,n=t.depth;n>0;n--)if("row"==t.node(n).type.spec.tableRole)return!0;return!1}function x(e){var t=e.selection;return t.$anchorCell?t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell:t.node&&"cell"==t.node.type.spec.tableRole?t.$anchor:S(t.$head)||function(e){for(var t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){var r=t.type.spec.tableRole;if("cell"==r||"header_cell"==r)return e.doc.resolve(n)}for(var o=e.nodeBefore,i=e.pos;o;o=o.lastChild,i--){var s=o.type.spec.tableRole;if("cell"==s||"header_cell"==s)return e.doc.resolve(i-o.nodeSize)}}(t.$head)}function C(e){return"row"==e.parent.type.spec.tableRole&&e.nodeAfter}function M(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function O(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function T(e){return h.get(e.node(-1)).findCell(e.pos-e.start(-1))}function A(e){return h.get(e.node(-1)).colCount(e.pos-e.start(-1))}function N(e,t,n){var r=e.start(-1),o=h.get(e.node(-1)).nextCell(e.pos-r,t,n);return null==o?null:e.node(0).resolve(r+o)}function D(e,t,n){var r={};for(var o in e)r[o]=e[o];return r[t]=n,r}function R(e,t,n){void 0===n&&(n=1);var r=D(e,"colspan",e.colspan-n);return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some((function(e){return e>0}))||(r.colwidth=null)),r}function E(e,t,n){void 0===n&&(n=1);var r=D(e,"colspan",e.colspan+n);if(r.colwidth){r.colwidth=r.colwidth.slice();for(var o=0;o<n;o++)r.colwidth.splice(t,0,0)}return r}function _(e,t,n){for(var r=w(t.type.schema).header_cell,o=0;o<e.height;o++)if(t.nodeAt(e.map[n+o*e.width]).type!=r)return!1;return!0}var z=function(e){function t(t,n){void 0===n&&(n=t);var r=t.node(-1),o=h.get(r),s=t.start(-1),a=o.rectBetween(t.pos-s,n.pos-s),l=t.node(0),c=o.cellsInRect(a).filter((function(e){return e!=n.pos-s}));c.unshift(n.pos-s);var u=c.map((function(e){var t=r.nodeAt(e),n=e+s+1;return new i.SelectionRange(l.resolve(n),l.resolve(n+t.content.size))}));e.call(this,u[0].$from,u[0].$to,u),this.$anchorCell=t,this.$headCell=n}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.map=function(e,n){var r=e.resolve(n.map(this.$anchorCell.pos)),o=e.resolve(n.map(this.$headCell.pos));if(C(r)&&C(o)&&O(r,o)){var s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?t.rowSelection(r,o):s&&this.isColSelection()?t.colSelection(r,o):new t(r,o)}return i.TextSelection.between(r,o)},t.prototype.content=function(){for(var e=this.$anchorCell.node(-1),t=h.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),o={},i=[],a=r.top;a<r.bottom;a++){for(var l=[],c=a*t.width+r.left,u=r.left;u<r.right;u++,c++){var d=t.map[c];if(!o[d]){o[d]=!0;var p=t.findCell(d),f=e.nodeAt(d),m=r.left-p.left,v=p.right-r.right;if(m>0||v>0){var g=f.attrs;m>0&&(g=R(g,0,m)),v>0&&(g=R(g,g.colspan-v,v)),f=p.left<r.left?f.type.createAndFill(g):f.type.create(g,f.content)}if(p.top<r.top||p.bottom>r.bottom){var y=D(f.attrs,"rowspan",Math.min(p.bottom,r.bottom)-Math.max(p.top,r.top));f=p.top<r.top?f.type.createAndFill(y):f.type.create(y,f.content)}l.push(f)}}i.push(e.child(a).copy(s.Fragment.from(l)))}var w=this.isColSelection()&&this.isRowSelection()?e:i;return new s.Slice(s.Fragment.from(w),1,1)},t.prototype.replace=function(t,n){void 0===n&&(n=s.Slice.empty);for(var r=t.steps.length,o=this.ranges,i=0;i<o.length;i++){var a=o[i],l=a.$from,c=a.$to,u=t.mapping.slice(r);t.replace(u.map(l.pos),u.map(c.pos),i?s.Slice.empty:n)}var d=e.findFrom(t.doc.resolve(t.mapping.slice(r).map(this.to)),-1);d&&t.setSelection(d)},t.prototype.replaceWith=function(e,t){this.replace(e,new s.Slice(s.Fragment.from(t),0,0))},t.prototype.forEachCell=function(e){for(var t=this.$anchorCell.node(-1),n=h.get(t),r=this.$anchorCell.start(-1),o=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r)),i=0;i<o.length;i++)e(t.nodeAt(o[i]),r+o[i])},t.prototype.isColSelection=function(){var e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;var n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount},t.colSelection=function(e,n){void 0===n&&(n=e);var r=h.get(e.node(-1)),o=e.start(-1),i=r.findCell(e.pos-o),s=r.findCell(n.pos-o),a=e.node(0);return i.top<=s.top?(i.top>0&&(e=a.resolve(o+r.map[i.left])),s.bottom<r.height&&(n=a.resolve(o+r.map[r.width*(r.height-1)+s.right-1]))):(s.top>0&&(n=a.resolve(o+r.map[s.left])),i.bottom<r.height&&(e=a.resolve(o+r.map[r.width*(r.height-1)+i.right-1]))),new t(e,n)},t.prototype.isRowSelection=function(){var e=h.get(this.$anchorCell.node(-1)),t=this.$anchorCell.start(-1),n=e.colCount(this.$anchorCell.pos-t),r=e.colCount(this.$headCell.pos-t);if(Math.min(n,r)>0)return!1;var o=n+this.$anchorCell.nodeAfter.attrs.colspan,i=r+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,i)==e.width},t.prototype.eq=function(e){return e instanceof t&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos},t.rowSelection=function(e,n){void 0===n&&(n=e);var r=h.get(e.node(-1)),o=e.start(-1),i=r.findCell(e.pos-o),s=r.findCell(n.pos-o),a=e.node(0);return i.left<=s.left?(i.left>0&&(e=a.resolve(o+r.map[i.top*r.width])),s.right<r.width&&(n=a.resolve(o+r.map[r.width*(s.top+1)-1]))):(s.left>0&&(n=a.resolve(o+r.map[s.top*r.width])),i.right<r.width&&(e=a.resolve(o+r.map[r.width*(i.top+1)-1]))),new t(e,n)},t.prototype.toJSON=function(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}},t.fromJSON=function(e,n){return new t(e.resolve(n.anchor),e.resolve(n.head))},t.create=function(e,n,r){return void 0===r&&(r=n),new t(e.resolve(n),e.resolve(r))},t.prototype.getBookmark=function(){return new I(this.$anchorCell.pos,this.$headCell.pos)},t}(i.Selection);z.prototype.visible=!1,i.Selection.jsonID("cell",z);var I=function(e,t){this.anchor=e,this.head=t};function P(e){if(!(e.selection instanceof z))return null;var t=[];return e.selection.forEachCell((function(e,n){t.push(l.Decoration.node(n,n+e.nodeSize,{class:"selectedCell"}))})),l.DecorationSet.create(e.doc,t)}function $(e){if(!e.size)return null;for(var t=e.content,n=e.openStart,r=e.openEnd;1==t.childCount&&(n>0&&r>0||"table"==t.firstChild.type.spec.tableRole);)n--,r--,t=t.firstChild.content;var o=t.firstChild,i=o.type.spec.tableRole,a=o.type.schema,l=[];if("row"==i)for(var c=0;c<t.childCount;c++){var u=t.child(c).content,d=c?0:Math.max(0,n-1),p=c<t.childCount-1?0:Math.max(0,r-1);(d||p)&&(u=F(w(a).row,new s.Slice(u,d,p)).content),l.push(u)}else{if("cell"!=i&&"header_cell"!=i)return null;l.push(n||r?F(w(a).row,new s.Slice(t,n,r)).content:t)}return function(e,t){for(var n=[],r=0;r<t.length;r++)for(var o=t[r],i=o.childCount-1;i>=0;i--)for(var a=o.child(i).attrs,l=a.rowspan,c=a.colspan,u=r;u<r+l;u++)n[u]=(n[u]||0)+c;for(var d=0,p=0;p<n.length;p++)d=Math.max(d,n[p]);for(var f=0;f<n.length;f++)if(f>=t.length&&t.push(s.Fragment.empty),n[f]<d){for(var h=w(e).cell.createAndFill(),m=[],v=n[f];v<d;v++)m.push(h);t[f]=t[f].append(s.Fragment.from(m))}return{height:t.length,width:d,rows:t}}(a,l)}function F(e,t){var n=e.createAndFill();return new c.Transform(n).replace(0,n.content.size,t).doc}function B(e,t,n){var r=e.width,o=e.height,i=e.rows;if(r!=t){for(var a=[],l=[],c=0;c<i.length;c++){for(var u=i[c],d=[],p=a[c]||0,f=0;p<t;f++){var h=u.child(f%u.childCount);p+h.attrs.colspan>t&&(h=h.type.create(R(h.attrs,h.attrs.colspan,p+h.attrs.colspan-t),h.content)),d.push(h),p+=h.attrs.colspan;for(var m=1;m<h.attrs.rowspan;m++)a[c+m]=(a[c+m]||0)+h.attrs.colspan}l.push(s.Fragment.from(d))}i=l,r=t}if(o!=n){for(var v=[],g=0,y=0;g<n;g++,y++){for(var w=[],b=i[y%o],S=0;S<b.childCount;S++){var k=b.child(S);g+k.attrs.rowspan>n&&(k=k.type.create(D(k.attrs,"rowspan",Math.max(1,n-k.attrs.rowspan)),k.content)),w.push(k)}v.push(s.Fragment.from(w))}i=v,o=n}return{width:r,height:o,rows:i}}function L(e,t,n,r,o,i,s,a){if(0==s||s==t.height)return!1;for(var l=!1,c=o;c<i;c++){var u=s*t.width+c,d=t.map[u];if(t.map[u-t.width]==d){l=!0;var p=n.nodeAt(d),f=t.findCell(d),h=f.top,m=f.left;e.setNodeMarkup(e.mapping.slice(a).map(d+r),null,D(p.attrs,"rowspan",s-h)),e.insert(e.mapping.slice(a).map(t.positionAt(s,m,n)),p.type.createAndFill(D(p.attrs,"rowspan",h+p.attrs.rowspan-s))),c+=p.attrs.colspan-1}}return l}function V(e,t,n,r,o,i,s,a){if(0==s||s==t.width)return!1;for(var l=!1,c=o;c<i;c++){var u=c*t.width+s,d=t.map[u];if(t.map[u-1]==d){l=!0;var p=n.nodeAt(d),f=t.colCount(d),h=e.mapping.slice(a).map(d+r);e.setNodeMarkup(h,null,R(p.attrs,s-f,p.attrs.colspan-(s-f))),e.insert(h+p.nodeSize,p.type.createAndFill(R(p.attrs,0,s-f))),c+=p.attrs.rowspan-1}}return l}function j(e,t,n,r,o){var i=n?e.doc.nodeAt(n-1):e.doc,a=h.get(i),l=r.top,c=r.left,u=c+o.width,d=l+o.height,p=e.tr,f=0;function m(){i=n?p.doc.nodeAt(n-1):p.doc,a=h.get(i),f=p.mapping.maps.length}(function(e,t,n,r,o,i,a){var l,c,u=w(e.doc.type.schema);if(o>t.width)for(var d=0,p=0;d<t.height;d++){var f=n.child(d);p+=f.nodeSize;var h=[],m=void 0;m=null==f.lastChild||f.lastChild.type==u.cell?l||(l=u.cell.createAndFill()):c||(c=u.header_cell.createAndFill());for(var v=t.width;v<o;v++)h.push(m);e.insert(e.mapping.slice(a).map(p-1+r),h)}if(i>t.height){for(var g=[],y=0,b=(t.height-1)*t.width;y<Math.max(t.width,o);y++){var S=!(y>=t.width)&&n.nodeAt(t.map[b+y]).type==u.header_cell;g.push(S?c||(c=u.header_cell.createAndFill()):l||(l=u.cell.createAndFill()))}for(var k=u.row.create(null,s.Fragment.from(g)),x=[],C=t.height;C<i;C++)x.push(k);e.insert(e.mapping.slice(a).map(r+n.nodeSize-2),x)}return!(!l&&!c)})(p,a,i,n,u,d,f)&&m(),L(p,a,i,n,c,u,l,f)&&m(),L(p,a,i,n,c,u,d,f)&&m(),V(p,a,i,n,l,d,c,f)&&m(),V(p,a,i,n,l,d,u,f)&&m();for(var v=l;v<d;v++){var g=a.positionAt(v,c,i),y=a.positionAt(v,u,i);p.replace(p.mapping.slice(f).map(g+n),p.mapping.slice(f).map(y+n),new s.Slice(o.rows[v-l],0,0))}m(),p.setSelection(new z(p.doc.resolve(n+a.positionAt(l,c,i)),p.doc.resolve(n+a.positionAt(d-1,u-1,i)))),t(p)}I.prototype.map=function(e){return new I(e.map(this.anchor),e.map(this.head))},I.prototype.resolve=function(e){var t=e.resolve(this.anchor),n=e.resolve(this.head);return"row"==t.parent.type.spec.tableRole&&"row"==n.parent.type.spec.tableRole&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&O(t,n)?new z(t,n):i.Selection.near(n,1)};var H=Object(a.keydownHandler)({ArrowLeft:K("horiz",-1),ArrowRight:K("horiz",1),ArrowUp:K("vert",-1),ArrowDown:K("vert",1),"Shift-ArrowLeft":q("horiz",-1),"Shift-ArrowRight":q("horiz",1),"Shift-ArrowUp":q("vert",-1),"Shift-ArrowDown":q("vert",1),Backspace:J,"Mod-Backspace":J,Delete:J,"Mod-Delete":J});function W(e,t,n){return!n.eq(e.selection)&&(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function K(e,t){return function(n,r,o){var s=n.selection;if(s instanceof z)return W(n,r,i.Selection.near(s.$headCell,t));if("horiz"!=e&&!s.empty)return!1;var a=G(o,e,t);if(null==a)return!1;if("horiz"==e)return W(n,r,i.Selection.near(n.doc.resolve(s.head+t),t));var l,c=n.doc.resolve(a),u=N(c,e,t);return l=u?i.Selection.near(u,1):t<0?i.Selection.near(n.doc.resolve(c.before(-1)),-1):i.Selection.near(n.doc.resolve(c.after(-1)),1),W(n,r,l)}}function q(e,t){return function(n,r,o){var i=n.selection;if(!(i instanceof z)){var s=G(o,e,t);if(null==s)return!1;i=new z(n.doc.resolve(s))}var a=N(i.$headCell,e,t);return!!a&&W(n,r,new z(i.$anchorCell,a))}}function J(e,t){var n=e.selection;if(!(n instanceof z))return!1;if(t){var r=e.tr,o=w(e.schema).cell.createAndFill().content;n.forEachCell((function(e,t){e.content.eq(o)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new s.Slice(o,0,0))})),r.docChanged&&t(r)}return!0}function X(e,t){var n=S(e.state.doc.resolve(t));return!!n&&(e.dispatch(e.state.tr.setSelection(new z(n))),!0)}function U(e,t,n){if(!k(e.state))return!1;var r=$(n),o=e.state.selection;if(o instanceof z){r||(r={width:1,height:1,rows:[s.Fragment.from(F(w(e.state.schema).cell,n))]});var i=o.$anchorCell.node(-1),a=o.$anchorCell.start(-1),l=h.get(i).rectBetween(o.$anchorCell.pos-a,o.$headCell.pos-a);return r=B(r,l.right-l.left,l.bottom-l.top),j(e.state,e.dispatch,a,l,r),!0}if(r){var c=x(e.state),u=c.start(-1);return j(e.state,e.dispatch,u,h.get(c.node(-1)).findCell(c.pos-u),r),!0}return!1}function Y(e,t){if(!t.ctrlKey&&!t.metaKey){var n,r=Q(e,t.target);if(t.shiftKey&&e.state.selection instanceof z)o(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&r&&null!=(n=S(e.state.selection.$anchor))&&Z(e,t).pos!=n.pos)o(n,t),t.preventDefault();else if(!r)return;e.root.addEventListener("mouseup",i),e.root.addEventListener("dragstart",i),e.root.addEventListener("mousemove",s)}function o(t,n){var r=Z(e,n),o=null==b.getState(e.state);if(!r||!O(t,r)){if(!o)return;r=t}var i=new z(t,r);if(o||!e.state.selection.eq(i)){var s=e.state.tr.setSelection(i);o&&s.setMeta(b,t.pos),e.dispatch(s)}}function i(){e.root.removeEventListener("mouseup",i),e.root.removeEventListener("dragstart",i),e.root.removeEventListener("mousemove",s),null!=b.getState(e.state)&&e.dispatch(e.state.tr.setMeta(b,-1))}function s(n){var s,a=b.getState(e.state);if(null!=a)s=e.state.doc.resolve(a);else if(Q(e,n.target)!=r&&!(s=Z(e,t)))return i();s&&o(s,n)}}function G(e,t,n){if(!(e.state.selection instanceof i.TextSelection))return null;for(var r=e.state.selection.$head,o=r.depth-1;o>=0;o--){var s=r.node(o);if((n<0?r.index(o):r.indexAfter(o))!=(n<0?0:s.childCount))return null;if("cell"==s.type.spec.tableRole||"header_cell"==s.type.spec.tableRole){var a=r.before(o),l="vert"==t?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(l)?a:null}}return null}function Q(e,t){for(;t&&t!=e.dom;t=t.parentNode)if("TD"==t.nodeName||"TH"==t.nodeName)return t}function Z(e,t){var n=e.posAtCoords({left:t.clientX,top:t.clientY});return n&&n?S(e.state.doc.resolve(n.pos)):null}var ee=new i.PluginKey("fix-tables");function te(e,t){var n,r=function(t,r){"table"==t.type.spec.tableRole&&(n=function(e,t,n,r){var o=h.get(t);if(!o.problems)return r;r||(r=e.tr);for(var i,s,a=[],l=0;l<o.height;l++)a.push(0);for(var c=0;c<o.problems.length;c++){var u=o.problems[c];if("collision"==u.type){for(var d=t.nodeAt(u.pos),p=0;p<d.attrs.rowspan;p++)a[u.row+p]+=u.n;r.setNodeMarkup(r.mapping.map(n+1+u.pos),null,R(d.attrs,d.attrs.colspan-u.n,u.n))}else if("missing"==u.type)a[u.row]+=u.n;else if("overlong_rowspan"==u.type){var f=t.nodeAt(u.pos);r.setNodeMarkup(r.mapping.map(n+1+u.pos),null,D(f.attrs,"rowspan",f.attrs.rowspan-u.n))}else if("colwidth mismatch"==u.type){var m=t.nodeAt(u.pos);r.setNodeMarkup(r.mapping.map(n+1+u.pos),null,D(m.attrs,"colwidth",u.colwidth))}}for(var v=0;v<a.length;v++)a[v]&&(null==i&&(i=v),s=v);for(var g=0,y=n+1;g<o.height;g++){var b=t.child(g),S=y+b.nodeSize,k=a[g];if(k>0){var x="cell";b.firstChild&&(x=b.firstChild.type.spec.tableRole);for(var C=[],M=0;M<k;M++)C.push(w(e.schema)[x].createAndFill());var O=0!=g&&i!=g-1||s!=g?S-1:y+1;r.insert(r.mapping.map(O),C)}y=S}return r.setMeta(ee,{fixTables:!0})}(e,t,r,n))};return t?t.doc!=e.doc&&function e(t,n,r,o){var i=t.childCount,s=n.childCount;e:for(var a=0,l=0;a<s;a++){for(var c=n.child(a),u=l,d=Math.min(i,a+3);u<d;u++)if(t.child(u)==c){l=u+1,r+=c.nodeSize;continue e}o(c,r),l<i&&t.child(l).sameMarkup(c)?e(t.child(l),c,r+1,o):c.nodesBetween(0,c.content.size,o,r+1),r+=c.nodeSize}}(t.doc,e.doc,0,r):e.doc.descendants(r),n}function ne(e){var t,n=e.selection,r=x(e),o=r.node(-1),i=r.start(-1),s=h.get(o);return(t=n instanceof z?s.rectBetween(n.$anchorCell.pos-i,n.$headCell.pos-i):s.findCell(r.pos-i)).tableStart=i,t.map=s,t.table=o,t}function re(e,t,n){var r=t.map,o=t.tableStart,i=t.table,s=n>0?-1:0;_(r,i,n+s)&&(s=0==n||n==r.width?null:0);for(var a=0;a<r.height;a++){var l=a*r.width+n;if(n>0&&n<r.width&&r.map[l-1]==r.map[l]){var c=r.map[l],u=i.nodeAt(c);e.setNodeMarkup(e.mapping.map(o+c),null,E(u.attrs,n-r.colCount(c))),a+=u.attrs.rowspan-1}else{var d=null==s?w(i.type.schema).cell:i.nodeAt(r.map[l+s]).type,p=r.positionAt(a,n,i);e.insert(e.mapping.map(o+p),d.createAndFill())}}return e}function oe(e,t){if(!k(e))return!1;if(t){var n=ne(e);t(re(e.tr,n,n.left))}return!0}function ie(e,t){if(!k(e))return!1;if(t){var n=ne(e);t(re(e.tr,n,n.right))}return!0}function se(e,t,n){for(var r=t.map,o=t.table,i=t.tableStart,s=e.mapping.maps.length,a=0;a<r.height;){var l=a*r.width+n,c=r.map[l],u=o.nodeAt(c);if(n>0&&r.map[l-1]==c||n<r.width-1&&r.map[l+1]==c)e.setNodeMarkup(e.mapping.slice(s).map(i+c),null,R(u.attrs,n-r.colCount(c)));else{var d=e.mapping.slice(s).map(i+c);e.delete(d,d+u.nodeSize)}a+=u.attrs.rowspan}}function ae(e,t){if(!k(e))return!1;if(t){var n=ne(e),r=e.tr;if(0==n.left&&n.right==n.map.width)return!1;for(var o=n.right-1;se(r,n,o),o!=n.left;o--)n.table=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc,n.map=h.get(n.table);t(r)}return!0}function le(e,t,n){for(var r=w(t.type.schema).header_cell,o=0;o<e.width;o++)if(t.nodeAt(e.map[o+n*e.width]).type!=r)return!1;return!0}function ce(e,t,n){for(var r=t.map,o=t.tableStart,i=t.table,s=o,a=0;a<n;a++)s+=i.child(a).nodeSize;var l=[],c=n>0?-1:0;le(r,i,n+c)&&(c=0==n||n==r.height?null:0);for(var u=0,d=r.width*n;u<r.width;u++,d++)if(n>0&&n<r.height&&r.map[d]==r.map[d-r.width]){var p=r.map[d],f=i.nodeAt(p).attrs;e.setNodeMarkup(o+p,null,D(f,"rowspan",f.rowspan+1)),u+=f.colspan-1}else{var h=null==c?w(i.type.schema).cell:i.nodeAt(r.map[d+c*r.width]).type;l.push(h.createAndFill())}return e.insert(s,w(i.type.schema).row.create(null,l)),e}function ue(e,t){if(!k(e))return!1;if(t){var n=ne(e);t(ce(e.tr,n,n.top))}return!0}function de(e,t){if(!k(e))return!1;if(t){var n=ne(e);t(ce(e.tr,n,n.bottom))}return!0}function pe(e,t,n){for(var r=t.map,o=t.table,i=t.tableStart,s=0,a=0;a<n;a++)s+=o.child(a).nodeSize;var l=s+o.child(n).nodeSize,c=e.mapping.maps.length;e.delete(s+i,l+i);for(var u=0,d=n*r.width;u<r.width;u++,d++){var p=r.map[d];if(n>0&&p==r.map[d-r.width]){var f=o.nodeAt(p).attrs;e.setNodeMarkup(e.mapping.slice(c).map(p+i),null,D(f,"rowspan",f.rowspan-1)),u+=f.colspan-1}else if(n<r.width&&p==r.map[d+r.width]){var h=o.nodeAt(p),m=h.type.create(D(h.attrs,"rowspan",h.attrs.rowspan-1),h.content),v=r.positionAt(n+1,u,o);e.insert(e.mapping.slice(c).map(i+v),m),u+=h.attrs.colspan-1}}}function fe(e,t){if(!k(e))return!1;if(t){var n=ne(e),r=e.tr;if(0==n.top&&n.bottom==n.map.height)return!1;for(var o=n.bottom-1;pe(r,n,o),o!=n.top;o--)n.table=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc,n.map=h.get(n.table);t(r)}return!0}function he(e){var t=e.content;return 1==t.childCount&&t.firstChild.isTextblock&&0==t.firstChild.childCount}function me(e,t){var n=e.selection;if(!(n instanceof z)||n.$anchorCell.pos==n.$headCell.pos)return!1;var r=ne(e),o=r.map;if(function(e,t){for(var n=e.width,r=e.height,o=e.map,i=t.top*n+t.left,s=i,a=(t.bottom-1)*n+t.left,l=i+(t.right-t.left-1),c=t.top;c<t.bottom;c++){if(t.left>0&&o[s]==o[s-1]||t.right<n&&o[l]==o[l+1])return!0;s+=n,l+=n}for(var u=t.left;u<t.right;u++){if(t.top>0&&o[i]==o[i-n]||t.bottom<r&&o[a]==o[a+n])return!0;i++,a++}return!1}(o,r))return!1;if(t){for(var i,a,l=e.tr,c={},u=s.Fragment.empty,d=r.top;d<r.bottom;d++)for(var p=r.left;p<r.right;p++){var f=o.map[d*o.width+p],h=r.table.nodeAt(f);if(!c[f])if(c[f]=!0,null==i)i=f,a=h;else{he(h)||(u=u.append(h.content));var m=l.mapping.map(f+r.tableStart);l.delete(m,m+h.nodeSize)}}if(l.setNodeMarkup(i+r.tableStart,null,D(E(a.attrs,a.attrs.colspan,r.right-r.left-a.attrs.colspan),"rowspan",r.bottom-r.top)),u.size){var v=i+1+a.content.size,g=he(a)?i+1:v;l.replaceWith(g+r.tableStart,v+r.tableStart,u)}l.setSelection(new z(l.doc.resolve(i+r.tableStart))),t(l)}return!0}function ve(e,t){var n=w(e.schema);return ge((function(e){var t=e.node;return n[t.type.spec.tableRole]}))(e,t)}function ge(e){return function(t,n){var r,o,i=t.selection;if(i instanceof z){if(i.$anchorCell.pos!=i.$headCell.pos)return!1;r=i.$anchorCell.nodeAfter,o=i.$anchorCell.pos}else{if(!(r=function(e){for(var t=e.depth;t>0;t--){var n=e.node(t).type.spec.tableRole;if("cell"===n||"header_cell"===n)return e.node(t)}return null}(i.$from)))return!1;o=S(i.$from).pos}if(1==r.attrs.colspan&&1==r.attrs.rowspan)return!1;if(n){var s=r.attrs,a=[],l=s.colwidth;s.rowspan>1&&(s=D(s,"rowspan",1)),s.colspan>1&&(s=D(s,"colspan",1));for(var c,u=ne(t),d=t.tr,p=0;p<u.right-u.left;p++)a.push(l?D(s,"colwidth",l&&l[p]?[l[p]]:null):s);for(var f=u.top;f<u.bottom;f++){var h=u.map.positionAt(f,u.left,u.table);f==u.top&&(h+=r.nodeSize);for(var m=u.left,v=0;m<u.right;m++,v++)m==u.left&&f==u.top||d.insert(c=d.mapping.map(h+u.tableStart,1),e({node:r,row:f,col:m}).createAndFill(a[v]))}d.setNodeMarkup(o,e({node:r,row:u.top,col:u.left}),a[0]),i instanceof z&&d.setSelection(new z(d.doc.resolve(i.$anchorCell.pos),c&&d.doc.resolve(c))),n(d)}return!0}}function ye(e,t){return function(n,r){if(!k(n))return!1;var o=x(n);if(o.nodeAfter.attrs[e]===t)return!1;if(r){var i=n.tr;n.selection instanceof z?n.selection.forEachCell((function(n,r){n.attrs[e]!==t&&i.setNodeMarkup(r,null,D(n.attrs,e,t))})):i.setNodeMarkup(o.pos,null,D(o.nodeAfter.attrs,e,t)),r(i)}return!0}}function we(e,t,n){for(var r=t.map.cellsInRect({left:0,top:0,right:"row"==e?t.map.width:1,bottom:"column"==e?t.map.height:1}),o=0;o<r.length;o++){var i=t.table.nodeAt(r[o]);if(i&&i.type!==n.header_cell)return!1}return!0}function be(e,t){return(t=t||{useDeprecatedLogic:!1}).useDeprecatedLogic?function(e){return function(t,n){if(!k(t))return!1;if(n){for(var r=w(t.schema),o=ne(t),i=t.tr,s=o.map.cellsInRect("column"==e?new f(o.left,0,o.right,o.map.height):"row"==e?new f(0,o.top,o.map.width,o.bottom):o),a=s.map((function(e){return o.table.nodeAt(e)})),l=0;l<s.length;l++)a[l].type==r.header_cell&&i.setNodeMarkup(o.tableStart+s[l],r.cell,a[l].attrs);if(0==i.steps.length)for(var c=0;c<s.length;c++)i.setNodeMarkup(o.tableStart+s[c],r.header_cell,a[c].attrs);n(i)}return!0}}(e):function(t,n){if(!k(t))return!1;if(n){var r=w(t.schema),o=ne(t),i=t.tr,s=we("row",o,r),a=we("column",o,r),l=("column"===e?s:"row"===e&&a)?1:0,c="column"==e?new f(0,l,1,o.map.height):"row"==e?new f(l,0,o.map.width,1):o,u="column"==e?a?r.cell:r.header_cell:"row"==e?s?r.cell:r.header_cell:r.cell;o.map.cellsInRect(c).forEach((function(e){var t=e+o.tableStart,n=i.doc.nodeAt(t);n&&i.setNodeMarkup(t,u,n.attrs)})),n(i)}return!0}}var Se=be("row",{useDeprecatedLogic:!0}),ke=be("column",{useDeprecatedLogic:!0}),xe=be("cell",{useDeprecatedLogic:!0});function Ce(e){return function(t,n){if(!k(t))return!1;var r=function(e,t){if(t<0){var n=e.nodeBefore;if(n)return e.pos-n.nodeSize;for(var r=e.index(-1)-1,o=e.before();r>=0;r--){var i=e.node(-1).child(r);if(i.childCount)return o-1-i.lastChild.nodeSize;o-=i.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;for(var s=e.node(-1),a=e.indexAfter(-1),l=e.after();a<s.childCount;a++){var c=s.child(a);if(c.childCount)return l+1;l+=c.nodeSize}}}(x(t),e);if(null!=r){if(n){var o=t.doc.resolve(r);n(t.tr.setSelection(i.TextSelection.between(o,M(o))).scrollIntoView())}return!0}}}function Me(e,t){for(var n=e.selection.$anchor,r=n.depth;r>0;r--){if("table"==n.node(r).type.spec.tableRole)return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0}return!1}var Oe=function(e,t){this.node=e,this.cellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Te(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))};function Te(e,t,n,r,o,i){for(var s=0,a=!0,l=t.firstChild,c=e.firstChild,u=0,d=0;u<c.childCount;u++)for(var p=c.child(u).attrs,f=p.colspan,h=p.colwidth,m=0;m<f;m++,d++){var v=o==d?i:h&&h[m],g=v?v+"px":"";s+=v||r,v||(a=!1),l?(l.style.width!=g&&(l.style.width=g),l=l.nextSibling):t.appendChild(document.createElement("col")).style.width=g}for(;l;){var y=l.nextSibling;l.parentNode.removeChild(l),l=y}a?(n.style.width=s+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=s+"px")}Oe.prototype.update=function(e){return e.type==this.node.type&&(this.node=e,Te(e,this.colgroup,this.table,this.cellMinWidth),!0)},Oe.prototype.ignoreMutation=function(e){return"attributes"==e.type&&(e.target==this.table||this.colgroup.contains(e.target))};var Ae=new i.PluginKey("tableColumnResizing");function Ne(e){void 0===e&&(e={});var t=e.handleWidth;void 0===t&&(t=5);var n=e.cellMinWidth;void 0===n&&(n=25);var r=e.View;void 0===r&&(r=Oe);var o=e.lastColumnResizable;return void 0===o&&(o=!0),new i.Plugin({key:Ae,state:{init:function(e,t){return this.spec.props.nodeViews[w(t.schema).table.name]=function(e,t){return new r(e,n,t)},new De(-1,!1)},apply:function(e,t){return t.apply(e)}},props:{attributes:function(e){return Ae.getState(e).activeHandle>-1?{class:"resize-cursor"}:null},handleDOMEvents:{mousemove:function(e,n){!function(e,t,n,r,o){var i=Ae.getState(e.state);if(!i.dragging){var s=function(e){for(;e&&"TD"!=e.nodeName&&"TH"!=e.nodeName;)e=e.classList.contains("ProseMirror")?null:e.parentNode;return e}(t.target),a=-1;if(s){var l=s.getBoundingClientRect(),c=l.left,u=l.right;t.clientX-c<=n?a=Re(e,t,"left"):u-t.clientX<=n&&(a=Re(e,t,"right"))}if(a!=i.activeHandle){if(!o&&-1!==a){var d=e.state.doc.resolve(a),p=d.node(-1),f=h.get(p),m=d.start(-1);if(f.colCount(d.pos-m)+d.nodeAfter.attrs.colspan-1==f.width-1)return}_e(e,a)}}}(e,n,t,0,o)},mouseleave:function(e){!function(e){var t=Ae.getState(e.state);t.activeHandle>-1&&!t.dragging&&_e(e,-1)}(e)},mousedown:function(e,t){!function(e,t,n){var r=Ae.getState(e.state);if(-1==r.activeHandle||r.dragging)return!1;var o=e.state.doc.nodeAt(r.activeHandle),i=function(e,t,n){var r=n.colspan,o=n.colwidth,i=o&&o[o.length-1];if(i)return i;var s=e.domAtPos(t),a=s.node.childNodes[s.offset].offsetWidth,l=r;if(o)for(var c=0;c<r;c++)o[c]&&(a-=o[c],l--);return a/l}(e,r.activeHandle,o.attrs);function s(t){window.removeEventListener("mouseup",s),window.removeEventListener("mousemove",a);var r=Ae.getState(e.state);r.dragging&&(!function(e,t,n){for(var r=e.state.doc.resolve(t),o=r.node(-1),i=h.get(o),s=r.start(-1),a=i.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,l=e.state.tr,c=0;c<i.height;c++){var u=c*i.width+a;if(!c||i.map[u]!=i.map[u-i.width]){var d=i.map[u],p=o.nodeAt(d).attrs,f=1==p.colspan?0:a-i.colCount(d);if(!p.colwidth||p.colwidth[f]!=n){var m=p.colwidth?p.colwidth.slice():ze(p.colspan);m[f]=n,l.setNodeMarkup(s+d,null,D(p,"colwidth",m))}}}l.docChanged&&e.dispatch(l)}(e,r.activeHandle,Ee(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(Ae,{setDragging:null})))}function a(t){if(!t.which)return s(t);var r=Ae.getState(e.state),o=Ee(r.dragging,t,n);!function(e,t,n,r){var o=e.state.doc.resolve(t),i=o.node(-1),s=o.start(-1),a=h.get(i).colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1,l=e.domAtPos(o.start(-1)).node;for(;"TABLE"!=l.nodeName;)l=l.parentNode;Te(i,l.firstChild,l,r,a,n)}(e,r.activeHandle,o,n)}e.dispatch(e.state.tr.setMeta(Ae,{setDragging:{startX:t.clientX,startWidth:i}})),window.addEventListener("mouseup",s),window.addEventListener("mousemove",a),t.preventDefault()}(e,t,n)}},decorations:function(e){var t=Ae.getState(e);if(t.activeHandle>-1)return function(e,t){for(var n=[],r=e.doc.resolve(t),o=r.node(-1),i=h.get(o),s=r.start(-1),a=i.colCount(r.pos-s)+r.nodeAfter.attrs.colspan,c=0;c<i.height;c++){var u=a+c*i.width-1;if(!(a!=i.width&&i.map[u]==i.map[u+1]||0!=c&&i.map[u-1]==i.map[u-1-i.width])){var d=i.map[u],p=s+d+o.nodeAt(d).nodeSize-1,f=document.createElement("div");f.className="column-resize-handle",n.push(l.Decoration.widget(p,f))}}return l.DecorationSet.create(e.doc,n)}(e,t.activeHandle)},nodeViews:{}}})}var De=function(e,t){this.activeHandle=e,this.dragging=t};function Re(e,t,n){var r=e.posAtCoords({left:t.clientX,top:t.clientY});if(!r)return-1;var o=r.pos,i=S(e.state.doc.resolve(o));if(!i)return-1;if("right"==n)return i.pos;var s=h.get(i.node(-1)),a=i.start(-1),l=s.map.indexOf(i.pos-a);return l%s.width==0?-1:a+s.map[l-1]}function Ee(e,t,n){var r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function _e(e,t){e.dispatch(e.state.tr.setMeta(Ae,{setHandle:t}))}function ze(e){for(var t=[],n=0;n<e;n++)t.push(0);return t}function Ie(e){void 0===e&&(e={});var t=e.allowTableNodeSelection;return void 0===t&&(t=!1),new i.Plugin({key:b,state:{init:function(){return null},apply:function(e,t){var n=e.getMeta(b);if(null!=n)return-1==n?null:n;if(null==t||!e.docChanged)return t;var r=e.mapping.mapResult(t),o=r.deleted,i=r.pos;return o?null:i}},props:{decorations:P,handleDOMEvents:{mousedown:Y},createSelectionBetween:function(e){if(null!=b.getState(e.state))return e.state.selection},handleTripleClick:X,handleKeyDown:H,handlePaste:U},appendTransaction:function(e,n,r){return function(e,t,n){var r,o,s=(t||e).selection,a=(t||e).doc;if(s instanceof i.NodeSelection&&(o=s.node.type.spec.tableRole)){if("cell"==o||"header_cell"==o)r=z.create(a,s.from);else if("row"==o){var l=a.resolve(s.from+1);r=z.rowSelection(l,l)}else if(!n){var c=h.get(s.node),u=s.from+1,d=u+c.map[c.width*c.height-1];r=z.create(a,u+1,d)}}else s instanceof i.TextSelection&&function(e){var t=e.$from,n=e.$to;if(t.pos==n.pos||t.pos<t.pos-6)return!1;for(var r=t.pos,o=n.pos,i=t.depth;i>=0&&!(t.after(i+1)<t.end(i));i--,r++);for(var s=n.depth;s>=0&&!(n.before(s+1)>n.start(s));s--,o--);return r==o&&/row|table/.test(t.node(i).type.spec.tableRole)}(s)?r=i.TextSelection.create(a,s.from):s instanceof i.TextSelection&&function(e){for(var t,n,r=e.$from,o=e.$to,i=r.depth;i>0;i--){var s=r.node(i);if("cell"===s.type.spec.tableRole||"header_cell"===s.type.spec.tableRole){t=s;break}}for(var a=o.depth;a>0;a--){var l=o.node(a);if("cell"===l.type.spec.tableRole||"header_cell"===l.type.spec.tableRole){n=l;break}}return t!==n&&0===o.parentOffset}(s)&&(r=i.TextSelection.create(a,s.$from.start(),s.$from.end()));return r&&(t||(t=e.tr)).setSelection(r),t}(r,te(r,n),t)}})}De.prototype.apply=function(e){var t=this,n=e.getMeta(Ae);if(n&&null!=n.setHandle)return new De(n.setHandle,null);if(n&&void 0!==n.setDragging)return new De(t.activeHandle,n.setDragging);if(t.activeHandle>-1&&e.docChanged){var r=e.mapping.map(t.activeHandle,-1);C(e.doc.resolve(r))||(r=null),t=new De(r,t.dragging)}return t}},function(e,t,n){"use strict";n.r(t),n.d(t,"keydownHandler",(function(){return y})),n.d(t,"keymap",(function(){return g}));for(var r={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:"'",229:"q"},o={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"',229:"Q"},i="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),s="undefined"!=typeof navigator&&/Apple Computer/.test(navigator.vendor),a="undefined"!=typeof navigator&&/Gecko\/\d+/.test(navigator.userAgent),l="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),c="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),u=i&&(l||+i[1]<57)||a&&l,d=0;d<10;d++)r[48+d]=r[96+d]=String(d);for(d=1;d<=24;d++)r[d+111]="F"+d;for(d=65;d<=90;d++)r[d]=String.fromCharCode(d+32),o[d]=String.fromCharCode(d);for(var p in r)o.hasOwnProperty(p)||(o[p]=r[p]);var f=n(1),h="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform);function m(e){var t,n,r,o,i=e.split(/-(?!$)/),s=i[i.length-1];"Space"==s&&(s=" ");for(var a=0;a<i.length-1;a++){var l=i[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))t=!0;else if(/^(c|ctrl|control)$/i.test(l))n=!0;else if(/^s(hift)?$/i.test(l))r=!0;else{if(!/^mod$/i.test(l))throw new Error("Unrecognized modifier name: "+l);h?o=!0:n=!0}}return t&&(s="Alt-"+s),n&&(s="Ctrl-"+s),o&&(s="Meta-"+s),r&&(s="Shift-"+s),s}function v(e,t,n){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),!1!==n&&t.shiftKey&&(e="Shift-"+e),e}function g(e){return new f.Plugin({props:{handleKeyDown:y(e)}})}function y(e){var t=function(e){var t=Object.create(null);for(var n in e)t[m(n)]=e[n];return t}(e);return function(e,n){var i,a=function(e){var t=!(u&&(e.ctrlKey||e.altKey||e.metaKey)||(s||c)&&e.shiftKey&&e.key&&1==e.key.length)&&e.key||(e.shiftKey?o:r)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}(n),l=1==a.length&&" "!=a,d=t[v(a,n,!l)];if(d&&d(e.state,e.dispatch,e))return!0;if(l&&(n.shiftKey||n.altKey||n.metaKey||a.charCodeAt(0)>127)&&(i=r[n.keyCode])&&i!=a){var p=t[v(i,n,!0)];if(p&&p(e.state,e.dispatch,e))return!0}else if(l&&n.shiftKey){var f=t[v(a,n,!0)];if(f&&f(e.state,e.dispatch,e))return!0}return!1}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4),o=n(5),i=n(2),s=n(0),a=n(1);t.changeTextBlock=function(e,t,n,r){if(!n.isTextblock)return!1;e.selection.ranges.forEach((function(o){var a=e.steps.length,l=o.$from.pos,c=o.$to.pos;e.doc.nodesBetween(l,c,(function(o,l){if(o.eq(t)&&o.isTextblock&&!o.hasMarkup(n,r)&&function(e,t,n){var r=e.resolve(t),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}(e.doc,e.mapping.slice(a).map(l),n)){e.clearIncompatible(e.mapping.slice(a).map(l,1),n);var c=e.mapping.slice(a),u=c.map(l,1),d=c.map(l+o.nodeSize,1),p=new s.Slice(s.Fragment.from(n.create(r,null,o.marks)),0,0);return e.step(new i.ReplaceAroundStep(u,d,u+1,d-1,p,1,!0)),!1}}))}))},t.blockNodes=function(e,t){void 0===t&&(t={blocksInSelection:!1});var n=e.doc,r=e.selection,o=r.$from,i=r.ranges,s=t.blocksInSelection,l=[],c=r instanceof a.NodeSelection?r.node:void 0;return c?c.isBlock?(l.push(c),c.nodesBetween(0,c.content.size,(function(e){e.isBlock&&l.push(e)}))):!s&&o.parent&&o.parent.isBlock&&l.push(o.parent):i.forEach((function(e){var t=e.$from.pos,r=e.$to.pos;n.nodesBetween(t,r,(function(e,n,o,i){e.isBlock&&(!s||n>=t&&n+e.content.size+2<=r)&&l.push(e)}))})),l},t.formatBlockElements=function(e,n){return function(o,i){var s=t.blockNodes(o),a=o.schema.nodes,l=o.tr;l.setMeta("commandName",n),l.setMeta("args",{value:e}),s.forEach((function(n){if(n.type.isTextblock)if("p"===e){var o=n.attrs,i=o.level,s=r.__rest(o,["level"]);t.changeTextBlock(l,n,a.paragraph,s)}else if(/^h[1-6]$/i.test(e)){i=parseInt(e.substr(1),10);t.changeTextBlock(l,n,a.heading,r.__assign({},n.attrs,{level:i}))}else if("blockquote"===e){var c=n.attrs;i=c.level,s=r.__rest(c,["level"]);t.changeTextBlock(l,n,a.blockquote,s)}}));var c=l.docChanged;return c&&i(l.scrollIntoView()),c}},t.cleanTextBlockFormatting=function(e,n){void 0===n&&(n={blocksInSelection:!0});var o=e.doc,i=e.selection,s=n.blocksInSelection,a=n.blockNodeType;t.blockNodes({doc:o,selection:i},{blocksInSelection:s}).filter((function(e){return e.isTextblock})).forEach((function(n){var o=n.attrs||{},i=o.style,s=void 0===i?"":i,l=o.class,c=void 0===l?"":l,u=r.__rest(o,["style","class"]),d=a||n.type;(s||c||d!==n.type)&&t.changeTextBlock(e,n,d,u)}))},t.getBlockFormats=function(e){var n=t.blockNodes(e),r=e.schema.nodes,o=[];return n.forEach((function(e){e.type===r.paragraph?o.push("p"):e.type===r.heading?o.push("h"+e.attrs.level):e.type===r.blockquote&&r.blockquote.isTextblock&&o.push("blockquote")})),o},t.addStyles=function(e,t){var n,r,i=e.attrs.style;i&&t.forEach((function(e){r={style:e.name,value:/^.+$/,newValue:e.value},n=o.changeStylesString(i,r),i=n.changed?n.style:i}));return i=i||t.reduce((function(e,t){return(e&&t.value?e+" ":"")+t.value?t.name+": "+t.value+";":""}),""),Object.assign({},e.attrs,{style:i||null})},t.hasNode=function(e,t){var n=e.selection,r=n.from,o=n.to,i=!1;return e.doc.nodesBetween(r,o,(function(e){return!(i=i||e.type===t)})),i},t.parentBlockFormat=function(e){var n=t.getBlockFormats(e);return 1===new Set(n).size?n[0]:null},t.activeNode=function(e){return{tag:t.parentBlockFormat(e)||""}}},function(e,t,n){"use strict";n.r(t),n.d(t,"autoJoin",(function(){return _})),n.d(t,"baseKeymap",(function(){return L})),n.d(t,"chainCommands",(function(){return z})),n.d(t,"createParagraphNear",(function(){return b})),n.d(t,"deleteSelection",(function(){return s})),n.d(t,"exitCode",(function(){return w})),n.d(t,"joinBackward",(function(){return a})),n.d(t,"joinDown",(function(){return m})),n.d(t,"joinForward",(function(){return d})),n.d(t,"joinUp",(function(){return h})),n.d(t,"lift",(function(){return v})),n.d(t,"liftEmptyBlock",(function(){return S})),n.d(t,"macBaseKeymap",(function(){return F})),n.d(t,"newlineInCode",(function(){return g})),n.d(t,"pcBaseKeymap",(function(){return $})),n.d(t,"selectAll",(function(){return M})),n.d(t,"selectNodeBackward",(function(){return c})),n.d(t,"selectNodeForward",(function(){return p})),n.d(t,"selectParentNode",(function(){return C})),n.d(t,"selectTextblockEnd",(function(){return N})),n.d(t,"selectTextblockStart",(function(){return A})),n.d(t,"setBlockType",(function(){return R})),n.d(t,"splitBlock",(function(){return k})),n.d(t,"splitBlockKeepMarks",(function(){return x})),n.d(t,"toggleMark",(function(){return E})),n.d(t,"wrapIn",(function(){return D}));var r=n(2),o=n(0),i=n(1);function s(e,t){return!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0)}function a(e,t,n){var s=e.selection.$cursor;if(!s||(n?!n.endOfTextblock("backward",e):s.parentOffset>0))return!1;var a=u(s);if(!a){var c=s.blockRange(),d=c&&Object(r.liftTarget)(c);return null!=d&&(t&&t(e.tr.lift(c,d).scrollIntoView()),!0)}var p=a.nodeBefore;if(!p.type.spec.isolating&&O(e,a,t))return!0;if(0==s.parent.content.size&&(l(p,"end")||i.NodeSelection.isSelectable(p))){var f=Object(r.replaceStep)(e.doc,s.before(),s.after(),o.Slice.empty);if(f.slice.size<f.to-f.from){if(t){var h=e.tr.step(f);h.setSelection(l(p,"end")?i.Selection.findFrom(h.doc.resolve(h.mapping.map(a.pos,-1)),-1):i.NodeSelection.create(h.doc,a.pos-p.nodeSize)),t(h.scrollIntoView())}return!0}}return!(!p.isAtom||a.depth!=s.depth-1)&&(t&&t(e.tr.delete(a.pos-p.nodeSize,a.pos).scrollIntoView()),!0)}function l(e,t,n){for(;e;e="start"==t?e.firstChild:e.lastChild){if(e.isTextblock)return!0;if(n&&1!=e.childCount)return!1}return!1}function c(e,t,n){var r=e.selection,o=r.$head,s=o;if(!r.empty)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):o.parentOffset>0)return!1;s=u(o)}var a=s&&s.nodeBefore;return!(!a||!i.NodeSelection.isSelectable(a))&&(t&&t(e.tr.setSelection(i.NodeSelection.create(e.doc,s.pos-a.nodeSize)).scrollIntoView()),!0)}function u(e){if(!e.parent.type.spec.isolating)for(var t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function d(e,t,n){var s=e.selection.$cursor;if(!s||(n?!n.endOfTextblock("forward",e):s.parentOffset<s.parent.content.size))return!1;var a=f(s);if(!a)return!1;var c=a.nodeAfter;if(O(e,a,t))return!0;if(0==s.parent.content.size&&(l(c,"start")||i.NodeSelection.isSelectable(c))){var u=Object(r.replaceStep)(e.doc,s.before(),s.after(),o.Slice.empty);if(u.slice.size<u.to-u.from){if(t){var d=e.tr.step(u);d.setSelection(l(c,"start")?i.Selection.findFrom(d.doc.resolve(d.mapping.map(a.pos)),1):i.NodeSelection.create(d.doc,d.mapping.map(a.pos))),t(d.scrollIntoView())}return!0}}return!(!c.isAtom||a.depth!=s.depth-1)&&(t&&t(e.tr.delete(a.pos,a.pos+c.nodeSize).scrollIntoView()),!0)}function p(e,t,n){var r=e.selection,o=r.$head,s=o;if(!r.empty)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):o.parentOffset<o.parent.content.size)return!1;s=f(o)}var a=s&&s.nodeAfter;return!(!a||!i.NodeSelection.isSelectable(a))&&(t&&t(e.tr.setSelection(i.NodeSelection.create(e.doc,s.pos)).scrollIntoView()),!0)}function f(e){if(!e.parent.type.spec.isolating)for(var t=e.depth-1;t>=0;t--){var n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}function h(e,t){var n,o=e.selection,s=o instanceof i.NodeSelection;if(s){if(o.node.isTextblock||!Object(r.canJoin)(e.doc,o.from))return!1;n=o.from}else if(null==(n=Object(r.joinPoint)(e.doc,o.from,-1)))return!1;if(t){var a=e.tr.join(n);s&&a.setSelection(i.NodeSelection.create(a.doc,n-e.doc.resolve(n).nodeBefore.nodeSize)),t(a.scrollIntoView())}return!0}function m(e,t){var n,o=e.selection;if(o instanceof i.NodeSelection){if(o.node.isTextblock||!Object(r.canJoin)(e.doc,o.to))return!1;n=o.to}else if(null==(n=Object(r.joinPoint)(e.doc,o.to,1)))return!1;return t&&t(e.tr.join(n).scrollIntoView()),!0}function v(e,t){var n=e.selection,o=n.$from,i=n.$to,s=o.blockRange(i),a=s&&Object(r.liftTarget)(s);return null!=a&&(t&&t(e.tr.lift(s,a).scrollIntoView()),!0)}function g(e,t){var n=e.selection,r=n.$head,o=n.$anchor;return!(!r.parent.type.spec.code||!r.sameParent(o))&&(t&&t(e.tr.insertText("\n").scrollIntoView()),!0)}function y(e){for(var t=0;t<e.edgeCount;t++){var n=e.edge(t).type;if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function w(e,t){var n=e.selection,r=n.$head,o=n.$anchor;if(!r.parent.type.spec.code||!r.sameParent(o))return!1;var s=r.node(-1),a=r.indexAfter(-1),l=y(s.contentMatchAt(a));if(!s.canReplaceWith(a,a,l))return!1;if(t){var c=r.after(),u=e.tr.replaceWith(c,c,l.createAndFill());u.setSelection(i.Selection.near(u.doc.resolve(c),1)),t(u.scrollIntoView())}return!0}function b(e,t){var n=e.selection,r=n.$from,o=n.$to;if(n instanceof i.AllSelection||r.parent.inlineContent||o.parent.inlineContent)return!1;var s=y(o.parent.contentMatchAt(o.indexAfter()));if(!s||!s.isTextblock)return!1;if(t){var a=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,l=e.tr.insert(a,s.createAndFill());l.setSelection(i.TextSelection.create(l.doc,a+1)),t(l.scrollIntoView())}return!0}function S(e,t){var n=e.selection.$cursor;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){var o=n.before();if(Object(r.canSplit)(e.doc,o))return t&&t(e.tr.split(o).scrollIntoView()),!0}var i=n.blockRange(),s=i&&Object(r.liftTarget)(i);return null!=s&&(t&&t(e.tr.lift(i,s).scrollIntoView()),!0)}function k(e,t){var n=e.selection,o=n.$from,s=n.$to;if(e.selection instanceof i.NodeSelection&&e.selection.node.isBlock)return!(!o.parentOffset||!Object(r.canSplit)(e.doc,o.pos))&&(t&&t(e.tr.split(o.pos).scrollIntoView()),!0);if(!o.parent.isBlock)return!1;if(t){var a=s.parentOffset==s.parent.content.size,l=e.tr;(e.selection instanceof i.TextSelection||e.selection instanceof i.AllSelection)&&l.deleteSelection();var c=0==o.depth?null:y(o.node(-1).contentMatchAt(o.indexAfter(-1))),u=a&&c?[{type:c}]:null,d=Object(r.canSplit)(l.doc,l.mapping.map(o.pos),1,u);if(u||d||!Object(r.canSplit)(l.doc,l.mapping.map(o.pos),1,c&&[{type:c}])||(u=[{type:c}],d=!0),d&&(l.split(l.mapping.map(o.pos),1,u),!a&&!o.parentOffset&&o.parent.type!=c)){var p=l.mapping.map(o.before()),f=l.doc.resolve(p);o.node(-1).canReplaceWith(f.index(),f.index()+1,c)&&l.setNodeMarkup(l.mapping.map(o.before()),c)}t(l.scrollIntoView())}return!0}function x(e,t){return k(e,t&&function(n){var r=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();r&&n.ensureMarks(r),t(n)})}function C(e,t){var n,r=e.selection,o=r.$from,s=r.to,a=o.sharedDepth(s);return 0!=a&&(n=o.before(a),t&&t(e.tr.setSelection(i.NodeSelection.create(e.doc,n))),!0)}function M(e,t){return t&&t(e.tr.setSelection(new i.AllSelection(e.doc))),!0}function O(e,t,n){var s,a,c=t.nodeBefore,u=t.nodeAfter;if(c.type.spec.isolating||u.type.spec.isolating)return!1;if(function(e,t,n){var o=t.nodeBefore,i=t.nodeAfter,s=t.index();return!!(o&&i&&o.type.compatibleContent(i.type))&&(!o.content.size&&t.parent.canReplace(s-1,s)?(n&&n(e.tr.delete(t.pos-o.nodeSize,t.pos).scrollIntoView()),!0):!(!t.parent.canReplace(s,s+1)||!i.isTextblock&&!Object(r.canJoin)(e.doc,t.pos))&&(n&&n(e.tr.clearIncompatible(t.pos,o.type,o.contentMatchAt(o.childCount)).join(t.pos).scrollIntoView()),!0))}(e,t,n))return!0;var d=t.parent.canReplace(t.index(),t.index()+1);if(d&&(s=(a=c.contentMatchAt(c.childCount)).findWrapping(u.type))&&a.matchType(s[0]||u.type).validEnd){if(n){for(var p=t.pos+u.nodeSize,f=o.Fragment.empty,h=s.length-1;h>=0;h--)f=o.Fragment.from(s[h].create(null,f));f=o.Fragment.from(c.copy(f));var m=e.tr.step(new r.ReplaceAroundStep(t.pos-1,p,t.pos,p,new o.Slice(f,1,0),s.length,!0)),v=p+2*s.length;Object(r.canJoin)(m.doc,v)&&m.join(v),n(m.scrollIntoView())}return!0}var g=i.Selection.findFrom(t,1),y=g&&g.$from.blockRange(g.$to),w=y&&Object(r.liftTarget)(y);if(null!=w&&w>=t.depth)return n&&n(e.tr.lift(y,w).scrollIntoView()),!0;if(d&&l(u,"start",!0)&&l(c,"end")){for(var b=c,S=[];S.push(b),!b.isTextblock;)b=b.lastChild;for(var k=u,x=1;!k.isTextblock;k=k.firstChild)x++;if(b.canReplace(b.childCount,b.childCount,k.content)){if(n){for(var C=o.Fragment.empty,M=S.length-1;M>=0;M--)C=o.Fragment.from(S[M].copy(C));n(e.tr.step(new r.ReplaceAroundStep(t.pos-S.length,t.pos+u.nodeSize,t.pos+x,t.pos+u.nodeSize-x,new o.Slice(C,S.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function T(e){return function(t,n){for(var r=t.selection,o=e<0?r.$from:r.$to,s=o.depth;o.node(s).isInline;){if(!s)return!1;s--}return!!o.node(s).isTextblock&&(n&&n(t.tr.setSelection(i.TextSelection.create(t.doc,e<0?o.start(s):o.end(s)))),!0)}}var A=T(-1),N=T(1);function D(e,t){return function(n,o){var i=n.selection,s=i.$from,a=i.$to,l=s.blockRange(a),c=l&&Object(r.findWrapping)(l,e,t);return!!c&&(o&&o(n.tr.wrap(l,c).scrollIntoView()),!0)}}function R(e,t){return function(n,r){var o=n.selection,i=o.from,s=o.to,a=!1;return n.doc.nodesBetween(i,s,(function(r,o){if(a)return!1;if(r.isTextblock&&!r.hasMarkup(e,t))if(r.type==e)a=!0;else{var i=n.doc.resolve(o),s=i.index();a=i.parent.canReplaceWith(s,s+1,e)}})),!!a&&(r&&r(n.tr.setBlockType(i,s,e,t).scrollIntoView()),!0)}}function E(e,t){return function(n,r){var o=n.selection,i=o.empty,s=o.$cursor,a=o.ranges;if(i&&!s||!function(e,t,n){for(var r=function(r){var o=t[r],i=o.$from,s=o.$to,a=0==i.depth&&e.type.allowsMarkType(n);if(e.nodesBetween(i.pos,s.pos,(function(e){if(a)return!1;a=e.inlineContent&&e.type.allowsMarkType(n)})),a)return{v:!0}},o=0;o<t.length;o++){var i=r(o);if(i)return i.v}return!1}(n.doc,a,e))return!1;if(r)if(s)e.isInSet(n.storedMarks||s.marks())?r(n.tr.removeStoredMark(e)):r(n.tr.addStoredMark(e.create(t)));else{for(var l=!1,c=n.tr,u=0;!l&&u<a.length;u++){var d=a[u],p=d.$from,f=d.$to;l=n.doc.rangeHasMark(p.pos,f.pos,e)}for(var h=0;h<a.length;h++){var m=a[h],v=m.$from,g=m.$to;if(l)c.removeMark(v.pos,g.pos,e);else{var y=v.pos,w=g.pos,b=v.nodeAfter,S=g.nodeBefore,k=b&&b.isText?/^\s*/.exec(b.text)[0].length:0,x=S&&S.isText?/\s*$/.exec(S.text)[0].length:0;y+k<w&&(y+=k,w-=x),c.addMark(y,w,e.create(t))}}r(c.scrollIntoView())}return!0}}function _(e,t){if(Array.isArray(t)){var n=t;t=function(e){return n.indexOf(e.type.name)>-1}}return function(n,o,i){return e(n,o&&function(e,t){return function(n){if(!n.isGeneric)return e(n);for(var o=[],i=0;i<n.mapping.maps.length;i++){for(var s=n.mapping.maps[i],a=0;a<o.length;a++)o[a]=s.map(o[a]);s.forEach((function(e,t,n,r){return o.push(n,r)}))}for(var l=[],c=0;c<o.length;c+=2)for(var u=o[c],d=o[c+1],p=n.doc.resolve(u),f=p.sharedDepth(d),h=p.node(f),m=p.indexAfter(f),v=p.after(f+1);v<=d;++m){var g=h.maybeChild(m);if(!g)break;if(m&&-1==l.indexOf(v)){var y=h.child(m-1);y.type==g.type&&t(y,g)&&l.push(v)}v+=g.nodeSize}l.sort((function(e,t){return e-t}));for(var w=l.length-1;w>=0;w--)Object(r.canJoin)(n.doc,l[w])&&n.join(l[w]);e(n)}}(o,t),i)}}function z(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return function(t,n,r){for(var o=0;o<e.length;o++)if(e[o](t,n,r))return!0;return!1}}var I=z(s,a,c),P=z(s,d,p),$={Enter:z(g,b,S,k),"Mod-Enter":w,Backspace:I,"Mod-Backspace":I,"Shift-Backspace":I,Delete:P,"Mod-Delete":P,"Mod-a":M},F={"Ctrl-h":$.Backspace,"Alt-Backspace":$["Mod-Backspace"],"Ctrl-d":$.Delete,"Ctrl-Alt-Backspace":$["Mod-Delete"],"Alt-Delete":$["Mod-Delete"],"Alt-d":$["Mod-Delete"],"Ctrl-a":A,"Ctrl-e":N};for(var B in $)F[B]=$[B];var L=("undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&"darwin"==os.platform())?F:$},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(6),s=["div","ol","ul","li","table","tbody","thead","tfoot","td","th","p","tr","col","colgroup","article","main","nav","header","footer","aside","section"],a=function(e,t){var n=(e.ownerDocument||document).createElement(t);Array.from(e.rows).filter((function(e){return e.getAttribute(i.rowTypeAttr)===t})).forEach((function(e){e.removeAttribute(i.rowTypeAttr),n.appendChild(e)})),n.children.length&&e.appendChild(n)},l=function(e,t){var n=t.toUpperCase();e.filter((function(e){return e.nodeName===n})).forEach((function(e){Array.from(e.children).forEach((function(n){n.setAttribute(i.rowTypeAttr,t),e.parentNode&&e.parentNode.insertBefore(n,e)})),e.remove()}))};t.trimWhitespace=function(e,t){void 0===t&&(t=s);var n=t.join("|");return e.replace(new RegExp("\\s*(<(?:"+n+")(?:\\s[^>]*?)?>)","g"),"$1").replace(new RegExp("(<\\/(?:"+n+")(?:\\s[^>]*?)?>)\\s*","g"),"$1")},t.htmlToFragment=function(e){var t,n=document.createElement("template");if("content"in n)n.innerHTML=e,t=n.content;else{var r=(new DOMParser).parseFromString(e,"text/html");t=document.createDocumentFragment();for(var o=r.body;o&&o.firstChild;)t.appendChild(o.firstChild)}return t},t.pmDocToFragment=function(e){var t=r.DOMSerializer.fromSchema(e.type.schema).serializeFragment(e.content);return function(e){Array.from(e.querySelectorAll("table")).forEach((function(e){a(e,"thead"),a(e,"tbody"),a(e,"tfoot");var t=Array.from(e.children).find((function(e){return 0===e.children.length}));t&&t.remove()}))}(t),t},t.domToPmDoc=function(e,t,n){return r.DOMParser.fromSchema(t).parse(e,n)},t.parseContent=function(e,n,r){var o,s=t.htmlToFragment(e);return o=s,Array.from(o.querySelectorAll("table")).forEach((function(e){var t=Array.from(e.children);t.some((function(e){return"THEAD"===e.nodeName||"TFOOT"===e.nodeName}))&&(l(t,"thead"),l(t,"tbody"),l(t,"tfoot"));var n=t.find((function(e){return"COLGROUP"===e.nodeName}));n&&(e.setAttribute(i.colgroupAttr,n.outerHTML),n.remove())})),t.domToPmDoc(s,n,r)},t.getHtml=function(e){var n=t.pmDocToFragment(e.doc),r=document.createElement("div");return r.appendChild(n),r.innerHTML},t.setHtml=function(e,n,r){return void 0===n&&(n="setHTML"),void 0===r&&(r={preserveWhitespace:"full"}),function(i,s){return s(i.tr.setSelection(new o.AllSelection(i.doc)).replaceSelectionWith(t.parseContent(e,i.schema,r)).setMeta("commandName",n))}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4),o=n(2),i=n(5),s=n(7),a=function(e,t){var n=e.find((function(e){return"style"===e.type.name})),r=n&&n.attrs.style;return i.changeStylesString(r,t)},l=function(e,t,n,i,s){var l=s.create({style:i.style}),c=[],u=[],d=null,p=null;return e.doc.nodesBetween(t,n,(function(e,f,h){if(e.isInline){var m=e.marks;if(!l.isInSet(m)&&h.type.allowsMarkType(l.type)){var v=Math.max(f,t),g=Math.min(f+e.nodeSize,n),y=a(m,i);if(y.changed||i.newValue){for(var w=y.changed?{style:y.style||null}:{style:[i.style]+": "+i.newValue+";"},b=s.isInSet(m)?m.find((function(e){return"style"===e.type.name})):null,S=b?r.__assign({},b.attrs,w):w,k=s.create(S),x=k.addToSet(m),C=0;C<m.length;C++)m[C].isInSet(x)||(d&&d.to===v&&d.mark.eq(m[C])?d.to=g:(d=new o.RemoveMarkStep(v,g,m[C]),c.push(d)));var M=p&&p.to===v,O=M&&k.attrs.style===p.mark.attrs.style;M&&O?p.to=g:Object.keys(S).some((function(e){return null!==S[e]}))&&(p=new o.AddMarkStep(v,g,k),u.push(p))}}}})),c.forEach((function(t){return e.step(t)})),u.forEach((function(t){return e.step(t)})),c.length+u.length>0};t.getInlineStyles=function(e,t){var n=e.schema.marks.style;return(n?s.selectionMarks(e,n):[]).map((function(e){return s.styleValue(e,t)})).filter((function(e){return null!==e}))};var c=function(e,t){return function(n,o,c){var u=n.selection,d=u.empty,p=u.$cursor,f=u.ranges;if(d&&!p||!s.markApplies(n.doc,f,e))return!1;var h=!1;if(o){var m=c||n.tr;if(p){var v=n.storedMarks||p.marks();if(e.isInSet(v)){var g=a(v,t),y=v.find((function(e){return"style"===e.type.name})),w=r.__assign({},y?y.attrs:{},{style:g.style||null});if(i.shallowEqual(y.attrs,w))return!1;o(m.removeStoredMark(e)),Object.keys(w).some((function(e){return null!==w[e]}))&&o(m.addStoredMark(e.create(w))),h=!0}}else{for(var b=0;b<f.length;b++){var S=f[b],k=S.$from,x=S.$to;h=l(m,k.pos,x.pos,t,e)}h&&(m.scrollIntoView(),o(m))}}return h}};t.toggleInlineFormat=function(e,t,n){return function(r,o){var i=r.schema.marks,a=e.altStyle,l=e.altMarks,u=void 0===l?[]:l,d=e.mark,p=t||r.tr,f=!1,h=!1,m=function(){return h=!0};a&&i.style&&(f=c(i.style,{style:a.name,value:a.value})(r,m,p));var v=[d].concat(u).filter((function(e){return i[e]})).map((function(e){return s.hasMark(r,{mark:e})&&i[e]})).filter((function(e){return e}));return v.length?s.removeMarks(v,r,m,p):f||s.toggleMark(i[d],n,p)(r,m),h&&o(p),h}},t.applyInlineStyle=function(e,t){return function(n,o){var a=n.schema.marks.style,l={style:e.style,value:/^.+$/,newValue:e.value},u=n.tr;t&&u.setMeta("commandName",t),u.setMeta("args",e);var d=n.selection,p=d.empty,f=d.$cursor,h=d.ranges;if(p&&!f||!a||!s.markApplies(n.doc,h,a))return!1;if(f){var m=n.storedMarks||f.marks(),v=a.isInSet(m)?m.find((function(e){return"style"===e.type.name})):null,g={style:null};if(v&&v.attrs.style){var y=i.changeStylesString(v.attrs.style,l);y.changed&&y.style&&(g.style=y.style)}else l.newValue&&(g.style=[l.style]+": "+l.newValue+";");var w=v?r.__assign({},v.attrs,g):g;return Object.keys(w).some((function(e){return null!==w[e]}))?o(u.addStoredMark(a.create(w))):o(u.removeStoredMark(a)),!0}return c(a,l)(n,o,u)}}},function(e,t,n){"use strict";n.r(t),n.d(t,"addListNodes",(function(){return p})),n.d(t,"bulletList",(function(){return c})),n.d(t,"liftListItem",(function(){return m})),n.d(t,"listItem",(function(){return u})),n.d(t,"orderedList",(function(){return l})),n.d(t,"sinkListItem",(function(){return v})),n.d(t,"splitListItem",(function(){return h})),n.d(t,"wrapInList",(function(){return f}));var r=n(2),o=n(0),i=["ol",0],s=["ul",0],a=["li",0],l={attrs:{order:{default:1}},parseDOM:[{tag:"ol",getAttrs:function(e){return{order:e.hasAttribute("start")?+e.getAttribute("start"):1}}}],toDOM:function(e){return 1==e.attrs.order?i:["ol",{start:e.attrs.order},0]}},c={parseDOM:[{tag:"ul"}],toDOM:function(){return s}},u={parseDOM:[{tag:"li"}],toDOM:function(){return a},defining:!0};function d(e,t){var n={};for(var r in e)n[r]=e[r];for(var o in t)n[o]=t[o];return n}function p(e,t,n){return e.append({ordered_list:d(l,{content:"list_item+",group:n}),bullet_list:d(c,{content:"list_item+",group:n}),list_item:d(u,{content:t})})}function f(e,t){return function(n,i){var s=n.selection,a=s.$from,l=s.$to,c=a.blockRange(l),u=!1,d=c;if(!c)return!1;if(c.depth>=2&&a.node(c.depth-1).type.compatibleContent(e)&&0==c.startIndex){if(0==a.index(c.depth-1))return!1;var p=n.doc.resolve(c.start-2);d=new o.NodeRange(p,p,c.depth),c.endIndex<c.parent.childCount&&(c=new o.NodeRange(a,n.doc.resolve(l.end(c.depth)),c.depth)),u=!0}var f=Object(r.findWrapping)(d,e,t,c);return!!f&&(i&&i(function(e,t,n,i,s){for(var a=o.Fragment.empty,l=n.length-1;l>=0;l--)a=o.Fragment.from(n[l].type.create(n[l].attrs,a));e.step(new r.ReplaceAroundStep(t.start-(i?2:0),t.end,t.start,t.end,new o.Slice(a,0,0),n.length,!0));for(var c=0,u=0;u<n.length;u++)n[u].type==s&&(c=u+1);for(var d=n.length-c,p=t.start+n.length-(i?2:0),f=t.parent,h=t.startIndex,m=t.endIndex,v=!0;h<m;h++,v=!1)!v&&Object(r.canSplit)(e.doc,p,d)&&(e.split(p,d),p+=2*d),p+=f.child(h).nodeSize;return e}(n.tr,c,f,u,e).scrollIntoView()),!0)}}function h(e){return function(t,n){var i=t.selection,s=i.$from,a=i.$to,l=i.node;if(l&&l.isBlock||s.depth<2||!s.sameParent(a))return!1;var c=s.node(-1);if(c.type!=e)return!1;if(0==s.parent.content.size&&s.node(-1).childCount==s.indexAfter(-1)){if(2==s.depth||s.node(-3).type!=e||s.index(-2)!=s.node(-2).childCount-1)return!1;if(n){for(var u=o.Fragment.empty,d=s.index(-1)?1:s.index(-2)?2:3,p=s.depth-d;p>=s.depth-3;p--)u=o.Fragment.from(s.node(p).copy(u));var f=s.indexAfter(-1)<s.node(-2).childCount?1:s.indexAfter(-2)<s.node(-3).childCount?2:3;u=u.append(o.Fragment.from(e.createAndFill()));var h=s.before(s.depth-(d-1)),m=t.tr.replace(h,s.after(-f),new o.Slice(u,4-d,0)),v=-1;m.doc.nodesBetween(h,m.doc.content.size,(function(e,t){if(v>-1)return!1;e.isTextblock&&0==e.content.size&&(v=t+1)})),v>-1&&m.setSelection(t.selection.constructor.near(m.doc.resolve(v))),n(m.scrollIntoView())}return!0}var g=a.pos==s.end()?c.contentMatchAt(0).defaultType:null,y=t.tr.delete(s.pos,a.pos),w=g&&[null,{type:g}];return!!Object(r.canSplit)(y.doc,s.pos,2,w)&&(n&&n(y.split(s.pos,2,w).scrollIntoView()),!0)}}function m(e){return function(t,n){var i=t.selection,s=i.$from,a=i.$to,l=s.blockRange(a,(function(t){return t.childCount&&t.firstChild.type==e}));return!!l&&(!n||(s.node(l.depth-1).type==e?function(e,t,n,i){var s=e.tr,a=i.end,l=i.$to.end(i.depth);a<l&&(s.step(new r.ReplaceAroundStep(a-1,l,a,l,new o.Slice(o.Fragment.from(n.create(null,i.parent.copy())),1,0),1,!0)),i=new o.NodeRange(s.doc.resolve(i.$from.pos),s.doc.resolve(l),i.depth));return t(s.lift(i,Object(r.liftTarget)(i)).scrollIntoView()),!0}(t,n,e,l):function(e,t,n){for(var i=e.tr,s=n.parent,a=n.end,l=n.endIndex-1,c=n.startIndex;l>c;l--)a-=s.child(l).nodeSize,i.delete(a-1,a+1);var u=i.doc.resolve(n.start),d=u.nodeAfter;if(i.mapping.map(n.end)!=n.start+u.nodeAfter.nodeSize)return!1;var p=0==n.startIndex,f=n.endIndex==s.childCount,h=u.node(-1),m=u.index(-1);if(!h.canReplace(m+(p?0:1),m+1,d.content.append(f?o.Fragment.empty:o.Fragment.from(s))))return!1;var v=u.pos,g=v+d.nodeSize;return i.step(new r.ReplaceAroundStep(v-(p?1:0),g+(f?1:0),v+1,g-1,new o.Slice((p?o.Fragment.empty:o.Fragment.from(s.copy(o.Fragment.empty))).append(f?o.Fragment.empty:o.Fragment.from(s.copy(o.Fragment.empty))),p?0:1,f?0:1),p?0:1)),t(i.scrollIntoView()),!0}(t,n,l)))}}function v(e){return function(t,n){var i=t.selection,s=i.$from,a=i.$to,l=s.blockRange(a,(function(t){return t.childCount&&t.firstChild.type==e}));if(!l)return!1;var c=l.startIndex;if(0==c)return!1;var u=l.parent,d=u.child(c-1);if(d.type!=e)return!1;if(n){var p=d.lastChild&&d.lastChild.type==u.type,f=o.Fragment.from(p?e.create():null),h=new o.Slice(o.Fragment.from(e.create(null,o.Fragment.from(u.type.create(null,f)))),p?3:1,0),m=l.start,v=l.end;n(t.tr.step(new r.ReplaceAroundStep(m-(p?3:1),v,m,v,h,1,!0)).scrollIntoView())}return!0}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4),o=n(1),i=n(5);t.reAnyValue=/^.+$/,t.parseStyle=function(e){return(e||"").split(/\s*;\s*/).filter(Boolean).map((function(e){var t,n=e.split(/\s*:\s*/);return(t={})[n[0]]=n[1],t})).reduce((function(e,t){return r.__assign({},e,t)}),{})},t.setNodeStyle=function(e,n,o){var s;if(new RegExp("[^-]?"+n+":").test(e.style||"")){var a=i.changeStylesString(e.style||"",{style:n,value:t.reAnyValue,newValue:o}).style;s=r.__assign({},e,{style:a})}else s=e.style?r.__assign({},e,{style:e.style.replace(/;$/,"")+"; "+n+": "+o+";"}):r.__assign({},e,{style:n+": "+o+";"});return s},t.tableResizeKey=new o.PluginKey("table-resize"),t.tableColumnResizing=new o.PluginKey("table-column-resizing"),t.tableRowResizing=new o.PluginKey("table-row-resizing"),t.otherResizing=function(e,n){var r=!1;return r=(r=(r=r||e!==t.tableResizeKey&&Boolean(t.tableResizeKey.get(n))&&t.tableResizeKey.getState(n).dragging)||e!==t.tableColumnResizing&&Boolean(t.tableColumnResizing.get(n))&&t.tableColumnResizing.getState(n).dragging)||e!==t.tableRowResizing&&Boolean(t.tableRowResizing.get(n))&&t.tableRowResizing.getState(n).dragging},t.otherResizeHandle=function(e,n){var r=!1;return r=(r=r||e!==t.tableColumnResizing&&t.tableColumnResizing.get(n)&&t.tableColumnResizing.getState(n).activeHandle>-1)||e!==t.tableRowResizing&&t.tableRowResizing.get(n)&&t.tableRowResizing.getState(n).activeHandle>-1},t.getTable=function(e){return e&&e.firstChild&&"TABLE"===e.firstChild.nodeName?e.firstChild:e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4),o=n(17);t.indentRules={nodes:[{node:"paragraph",style:"margin-left",rtlStyle:"margin-right",step:30,unit:"px"},{node:"heading",style:"margin-left",rtlStyle:"margin-right",step:30,unit:"px"}],listsTypes:r.__assign({},o.listsTypes)},t.outdentRules={nodes:[{node:"paragraph",style:"margin-left",rtlStyle:"margin-right",step:-30,unit:"px"},{node:"heading",style:"margin-left",rtlStyle:"margin-right",step:-30,unit:"px"}],listsTypes:r.__assign({},o.listsTypes)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4);t.listsTypes={orderedList:"ordered_list",bulletList:"bullet_list",listItem:"list_item"},t.orderedList={listType:t.listsTypes.orderedList,types:r.__assign({},t.listsTypes)},t.bulletList={listType:t.listsTypes.bulletList,types:r.__assign({},t.listsTypes)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(11);t.blockquote=function(e,t){return r.wrapIn(e.schema.nodes.blockquote)(e,t)},t.liftBlockquote=function(e,t){var n=e.selection,r=n.$from,o=n.$to,i=e.schema.nodes.blockquote,s=e.doc,a=-1,l=r.blockRange(o);l&&s.nodesBetween(l.start,l.end,(function(e,t,n,r){e.type===i&&(a=t)}));var c=-1!==a;return t&&c&&t(e.tr.lift(l,s.resolve(a).depth)),c}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4),o=n(0),i=n(1),s=n(2),a=n(11),l=n(14),c=n(17),u=function(e,t,n){for(var r=t.depth,o=e.nodes[n.bulletList],i=e.nodes[n.orderedList],s=e.nodes[n.listItem],a=t.depth;a>0;a--){var l=t.node(a);if(l.type!==o&&l.type!==i||(r=a),l.type!==o&&l.type!==i&&l.type!==s)break}return r-1};function d(e){return function(t,n,r){if(!r)return!1;var o=(t=r.state).schema.nodes[e.listType],i=t.selection,s=i.$from,c=i.$to,u=s.node(-2),d=s.node(-3),p=function(e,t,n,r){return 0===function(e,t,n){var r=Array(),o=function(e,t){var n=["blockquote","bulletList","orderedList"];if(1===t.depth)return t;var r=t.node(t.depth),o=t;for(;t.depth>=1;)t=e.resolve(t.before(t.depth)),(r=t.node(t.depth))&&-1!==n.indexOf(r.type.name)&&(o=t);return o}(e,t).depth,i=e.resolve(t.start(o));for(;i.pos<=n.start(n.depth);){var s=Math.min(i.depth,o),a=i.node(s);if(a&&r.push(a),0===s)break;var l=e.resolve(i.after(s));if(l.start(s)>=e.nodeSize-2)break;l.depth!==i.depth&&(l=e.resolve(l.pos+2)),i=l.depth?e.resolve(l.start(l.depth)):e.resolve(l.end(l.depth))}return r}(e,t,n).filter((function(e){return e.type!==r})).length}(t.doc,s,c,o);return(u&&u.type===o||d&&d.type===o)&&p?f(e)(t,n):(p||(f(e)(t,n),t=r.state),function(e,t){void 0===t&&(t={});return a.autoJoin(l.wrapInList(e,t),(function(t,n){return t.type===n.type&&t.type===e}))}(o,e.listAttrs)(t,n))}}function p(e,t,n,r){var i=r||e.schema.nodes.listItem,a=t.$from,l=t.$to,c=a.blockRange(l,(function(e){return e.childCount&&e.firstChild.type===i}));if(!c||c.depth<2||a.node(c.depth-1).type!==i)return n;var u=c.end,d=l.end(c.depth);return u<d&&(n.step(new s.ReplaceAroundStep(u-1,d,u,d,new o.Slice(o.Fragment.from(i.create(void 0,c.parent.copy())),1,0),1,!0)),c=new o.NodeRange(n.doc.resolve(a.pos),n.doc.resolve(d),c.depth)),n.lift(c,s.liftTarget(c)).scrollIntoView()}function f(e){return function(t,n){var r=t.tr,o=t.selection,a=o.$from,l=o.$to;return r.doc.nodesBetween(a.pos,l.pos,(function(n,o){if(n.isTextblock||"blockquote"===n.type.name||"div"===n.type.name){var a=new i.NodeSelection(r.doc.resolve(r.mapping.map(o))),l=a.$from.blockRange(a.$to);if(!l||a.$from.parent.type!==t.schema.nodes[e.listItem])return!1;var c=l&&s.liftTarget(l);if(null==c)return!1;r.lift(l,c)}})),n&&n(r),!0}}var h=/list\-style\-type:\s?([\w-]+)/;t.listStyle=function(e){var t=e.style||"",n=h.exec(t);return n&&n[1]||""},t.toggleList=function(e,n,r,o,s){var a=o.listType,l=o.listAttrs,c=void 0===l?{style:null}:l,f=e.selection,h=f.$from.node(f.$from.depth-2),m=f.$to.node(f.$to.depth-2);if(h&&h.type.name===a&&t.listStyle(h.attrs)===t.listStyle(c)&&m&&m.type.name===a&&t.listStyle(m.attrs)===t.listStyle(c)){var v=r.state.schema.nodes,g={bulletList:v[o.bulletList],orderedList:v[o.orderedList],listItem:v[o.listItem]},y=function(e,t){for(var n,r=t.bulletList,o=t.orderedList,i=t.listItem,s=e.depth-1;s>0;s--){var a=e.node(s);if(a.type!==r&&a.type!==o||(n=s),a.type!==r&&a.type!==o&&a.type!==i)break}return n}(f.$to,g),w=function(e,t,n,r,o,s){s||(s=e.schema.nodes.listItem);var a=!1;return o.doc.nodesBetween(t,n,(function(n,l){if(!a&&n.type===s&&l>t){a=!0;for(var c=r+3;c>r+2;){var u=o.doc.resolve(o.mapping.map(l));c=u.depth;var d=o.doc.resolve(o.mapping.map(l+n.textContent.length)),f=new i.TextSelection(u,d);o=p(e,f,o,s)}}})),o}(e,f.$to.pos,f.$to.end(y),y,r.state.tr,g.listItem);return(w=function(e,t,n){var r=e.selection,o=r.from,i=r.to,s=e.schema.nodes,a=s.paragraph,l=s.heading,c=[];t.doc.nodesBetween(o,i,(function(e,t){e.type!==a&&e.type!==l||c.push({node:e,pos:t})}));for(var d=c.length-1;d>=0;d--){var p=c[d],f=t.doc.resolve(t.mapping.map(p.pos));if(f.depth>0){var h=void 0;h=p.node.textContent&&p.node.textContent.length>0?t.doc.resolve(t.mapping.map(p.pos+p.node.textContent.length)):t.doc.resolve(t.mapping.map(p.pos+1));var m=f.blockRange(h);m&&t.lift(m,u(e.schema,f,n))}}return t}(e,w,o)).setMeta("commandName",s),n(w),!0}return d(o)(e,n,r)},t.toggleUnorderedList=function(e,n,o){return t.toggleList(e,n,o,r.__assign({listType:c.bulletList.listType},c.bulletList.types))},t.toggleOrderedList=function(e,n,o){return t.toggleList(e,n,o,r.__assign({listType:c.orderedList.listType},c.orderedList.types))},t.splitListItemKeepMarks=function(e){return function(t,n){return l.splitListItem(e)(t,(function(e){var r=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();r&&e.ensureMarks(r),n(e)}))}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4),o=n(0),i=n(8),s=n(12),a=n(6),l=["blockquote",0],c=["hr"],u=["pre",["code",0]],d=["ol",0],p=["ul",0],f=["li",0],h=function(e){for(var t,n={},r=e.attributes,o=0;o<r.length;o++)n[(t=r[o]).name]=t.value;return n},m=function(e){var t={};return e.forEach((function(e){t[e]={default:null}})),t},v=function(){return m(["style","class","id"])},g=function(e,t){for(var n in e)if(n&&null!==e[n]&&n!==t)return!0;return!1},y=function(e,t){var n={};for(var r in e)r&&null!==e[r]&&r!==t&&(n[r]=e[r]);return n},w=function(e){var t;return(t={})[e]={name:e,inclusive:!0,parseDOM:[{tag:e}],toDOM:function(){return[e,0]}},t},b=r.__assign({link:{attrs:r.__assign({},v(),{href:{default:null},target:{default:null},title:{default:null}}),inclusive:!1,parseDOM:[{tag:"a",getAttrs:h}],toDOM:function(e){return["a",y(e.attrs),0]}}},w("strong"),w("b"),w("em"),w("i"),w("u"),w("del"),w("sub"),w("sup"),w("code"),{style:{attrs:r.__assign({},v()),parseDOM:[{tag:"span",getAttrs:h}],toDOM:function(e){return g(e.attrs)?["span",y(e.attrs),0]:["span",0]}}});t.marks=b;var S=function(e){var t;return(t={})[e]={default:null,getFromDOM:function(t){return t.getAttribute(e)},setDOMAttr:function(t,n){n[e]=t}},t},k=r.__assign({},S("style"),S("class"),S("id"),S("headers")),x={doc:{content:"colgroup*"},col:{attrs:m(["id","class","style","span"]),parseDOM:[{getAttrs:h,tag:"col"}],toDOM:function(e){return["col",e.attrs]}},colgroup:{attrs:m(["id","class","style","span"]),content:"col*",parseDOM:[{getAttrs:h,tag:"colgroup"}],toDOM:function(e){return["colgroup",e.attrs,0]}},text:{inline:!0,group:"inline"}},C=new o.Schema({nodes:x,marks:{}});t.parseStrColgroup=function(e){var t=s.domToPmDoc(s.htmlToFragment(e),C,{preserveWhitespace:!1});return s.pmDocToFragment(t).firstChild};var M=i.tableNodes({tableGroup:"block",cellContent:"block+",cellAttributes:k});M.table_row.attrs=r.__assign({},M.table_row.attrs,m([a.rowTypeAttr,"style","class","id"])),M.table_row.toDOM=function(e){return["tr",y(e.attrs),0]},M.table_row.parseDOM=[{tag:"tr",getAttrs:h}],M.table.attrs=r.__assign({},M.table.attrs,m(["style","class","id",a.colgroupAttr,a.resizableAttr])),M.table.toDOM=function(e){var n=g(e.attrs)?y(e.attrs,a.colgroupAttr):{},r=null;if(e.attrs[a.colgroupAttr]&&!function(e){for(var t=!1,n=e.child(0),r=0;r<n.childCount;r++){if(n.child(r).attrs.colwidth){t=!0;break}}return t}(e)){var o=t.parseStrColgroup(e.attrs[a.colgroupAttr]);if(o){var i=Array.from(o.children).map((function(e){return["col",h(e)]}));r=["colgroup",h(o)].concat(i)}}return r?["table",n,r,["tbody",0]]:["table",n,["tbody",0]]},M.table.parseDOM=[{tag:"table",getAttrs:function(e){var t=h(e),n=Array.from(e.childNodes).find((function(e){return"COLGROUP"===e.nodeName}));return n&&(t[a.colgroupAttr]=n.outerHTML),t}}];var O=r.__assign({doc:{content:"block+"},paragraph:{content:"inline*",group:"block",attrs:r.__assign({},v()),parseDOM:[{tag:"p",getAttrs:h}],toDOM:function(e){return g(e.attrs)?["p",y(e.attrs),0]:["p",0]}},div:{content:"block*",group:"block",attrs:r.__assign({},v()),parseDOM:[{tag:"div",getAttrs:h}],toDOM:function(e){return g(e.attrs)?["div",y(e.attrs),0]:["div",0]}},blockquote:{attrs:r.__assign({},v()),content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote",getAttrs:h}],toDOM:function(e){return g(e.attrs)?["blockquote",y(e.attrs),0]:l}},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM:function(){return c}},heading:{attrs:r.__assign({},v(),{level:{default:1}}),content:"inline*",group:"block",defining:!0,parseDOM:[{tag:"h1",getAttrs:function(e){return r.__assign({},h(e),{level:1})}},{tag:"h2",getAttrs:function(e){return r.__assign({},h(e),{level:2})}},{tag:"h3",getAttrs:function(e){return r.__assign({},h(e),{level:3})}},{tag:"h4",getAttrs:function(e){return r.__assign({},h(e),{level:4})}},{tag:"h5",getAttrs:function(e){return r.__assign({},h(e),{level:5})}},{tag:"h6",getAttrs:function(e){return r.__assign({},h(e),{level:6})}}],toDOM:function(e){return g(e.attrs,"level")?["h"+e.attrs.level,y(e.attrs,"level"),0]:["h"+e.attrs.level,0]}},code_block:{content:"text*",marks:"",group:"block",code:!0,defining:!0,parseDOM:[{tag:"pre",preserveWhitespace:"full"}],toDOM:function(){return u}},text:{inline:!0,group:"inline"},image:{inline:!0,attrs:r.__assign({src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}},v()),group:"inline",draggable:!0,parseDOM:[{tag:"img",getAttrs:h}],toDOM:function(e){return g(e.attrs)?["img",y(e.attrs)]:["img"]}},hard_break:{inline:!0,attrs:r.__assign({},v()),group:"inline",selectable:!1,parseDOM:[{tag:"br",getAttrs:h}],toDOM:function(e){return g(e.attrs)?["br",y(e.attrs)]:["br"]}},ordered_list:{content:"list_item+",group:"block",attrs:r.__assign({},v(),{type:{default:null},order:{default:1}}),parseDOM:[{tag:"ol",getAttrs:function(e){return r.__assign({},h(e),{order:e.hasAttribute("start")?parseInt(e.getAttribute("start")||"1",10):1})}}],toDOM:function(e){return 1===e.attrs.order?g(e.attrs,"order")?["ol",y(e.attrs,"order"),0]:d:["ol",r.__assign({},y(e.attrs,"order"),{start:e.attrs.order}),0]}},bullet_list:{content:"list_item+",group:"block",attrs:r.__assign({},v()),parseDOM:[{tag:"ul",getAttrs:h}],toDOM:function(e){return g(e.attrs)?["ul",y(e.attrs),0]:p}},list_item:{content:"(paragraph | heading) block*",attrs:r.__assign({},v()),parseDOM:[{tag:"li",getAttrs:h}],toDOM:function(e){return g(e.attrs)?["li",y(e.attrs),0]:f},defining:!0}},M);t.nodes=O},function(e,t,n){"use strict";n.r(t),n.d(t,"InputRule",(function(){return i})),n.d(t,"closeDoubleQuote",(function(){return p})),n.d(t,"closeSingleQuote",(function(){return h})),n.d(t,"ellipsis",(function(){return u})),n.d(t,"emDash",(function(){return c})),n.d(t,"inputRules",(function(){return s})),n.d(t,"openDoubleQuote",(function(){return d})),n.d(t,"openSingleQuote",(function(){return f})),n.d(t,"smartQuotes",(function(){return m})),n.d(t,"textblockTypeInputRule",(function(){return g})),n.d(t,"undoInputRule",(function(){return l})),n.d(t,"wrappingInputRule",(function(){return v}));var r=n(1),o=n(2),i=function(e,t){var n;this.match=e,this.handler="string"==typeof t?(n=t,function(e,t,r,o){var i=n;if(t[1]){var s=t[0].lastIndexOf(t[1]);i+=t[0].slice(s+t[1].length);var a=(r+=s)-o;a>0&&(i=t[0].slice(s-a,s)+i,r=o)}return e.tr.insertText(i,r,o)}):t};function s(e){var t=e.rules,n=new r.Plugin({state:{init:function(){return null},apply:function(e,t){var n=e.getMeta(this);return n||(e.selectionSet||e.docChanged?null:t)}},props:{handleTextInput:function(e,r,o,i){return a(e,r,o,i,t,n)},handleDOMEvents:{compositionend:function(e){setTimeout((function(){var r=e.state.selection.$cursor;r&&a(e,r.pos,r.pos,"",t,n)}))}}},isInputRules:!0});return n}function a(e,t,n,r,o,i){if(e.composing)return!1;var s=e.state,a=s.doc.resolve(t);if(a.parent.type.spec.code)return!1;for(var l=a.parent.textBetween(Math.max(0,a.parentOffset-500),a.parentOffset,null,"")+r,c=0;c<o.length;c++){var u=o[c].match.exec(l),d=u&&o[c].handler(s,u,t-(u[0].length-r.length),n);if(d)return e.dispatch(d.setMeta(i,{transform:d,from:t,to:n,text:r})),!0}return!1}function l(e,t){for(var n=e.plugins,r=0;r<n.length;r++){var o=n[r],i=void 0;if(o.spec.isInputRules&&(i=o.getState(e))){if(t){for(var s=e.tr,a=i.transform,l=a.steps.length-1;l>=0;l--)s.step(a.steps[l].invert(a.docs[l]));if(i.text){var c=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,e.schema.text(i.text,c))}else s.delete(i.from,i.to);t(s)}return!0}}return!1}var c=new i(/--$/,"—"),u=new i(/\.\.\.$/,"…"),d=new i(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“"),p=new i(/"$/,"”"),f=new i(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘"),h=new i(/'$/,"’"),m=[d,p,f,h];function v(e,t,n,r){return new i(e,(function(e,i,s,a){var l=n instanceof Function?n(i):n,c=e.tr.delete(s,a),u=c.doc.resolve(s).blockRange(),d=u&&Object(o.findWrapping)(u,t,l);if(!d)return null;c.wrap(u,d);var p=c.doc.resolve(s-1).nodeBefore;return p&&p.type==t&&Object(o.canJoin)(c.doc,s-1)&&(!r||r(i,p))&&c.join(s-1),c}))}function g(e,t,n){return new i(e,(function(e,r,o,i){var s=e.doc.resolve(o),a=n instanceof Function?n(r):n;return s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),t)?e.tr.delete(o,i).setBlockType(o,o,t,a):null}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bold={mark:"strong",altMarks:["b"],altStyle:{name:"font-weight",value:/^(bold(er)?|[5-9]\d{2,})$/}},t.italic={mark:"em",altMarks:["i"],altStyle:{name:"font-style",value:/^italic$/i}},t.underline={mark:"u",altStyle:{name:"text-decoration",value:/^underline$/i}},t.strikethrough={mark:"del",altStyle:{name:"text-decoration",value:/^line-through$/i}},t.subscript={mark:"sub"},t.superscript={mark:"sup"},t.link={mark:"link"},t.unlink={mark:"link"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=/style=['"]?[^'"]*?mso-list:\s*[a-zA-Z]+(\d+)\s[a-zA-Z]+(\d+)\s(\w+)/gi,o=function(e){return/^MsoListParagraph/.test(e.className)},i=function(e){var t=e.innerHTML;return t=(t=t.replace(/<!--(.|\s)*?-->/gi,"")).replace(/<\/?[^>]+?\/?>/gm,"")},s=function(e,t){var n=document.createElement(e);return n.style.listStyleType=t,n},a=function(e){var t=null;return/^\d/.test(e)||(t=(/^[a-z]/.test(e)?"lower-":"upper-")+(/^[ivxlcdm]/i.test(e)?"roman":"alpha")),t},l=function(e,t){var n=[];Array.from(e).forEach((function(e){if(e.nodeType===Node.ELEMENT_NODE){var r=e;r.getAttribute("datalist")?(n.push(e),t.add(n)):o(r)&&n.length?n.push(e):(n=[],"DIV"===r.nodeName?l(r.children,t):"TABLE"===r.nodeName&&Array.from(r.querySelectorAll("td,th")).forEach((function(e){l(e.children,t)})))}}))},c=function(e){var t,n=e.innerHTML,r=function(e){return e.replace(/^(?: |[\u00a0\n\r\s])+/,"")};return n=n.replace(/<\/?\w+[^>]*>/g,"").replace(/ /g," "),/^[\u2022\u00b7\u00a7\u00d8oØüvn][\u00a0 ]+/.test(n)?{tag:"ul",style:(t=r(i(e)),/^[\u2022\u00b7\u00FC\u00D8\u002dv-]/.test(t)?null:/^o/.test(t)?"circle":"square")}:/^\s*\w+[\.\)][\u00a0 ]{2,}/.test(n)?{tag:"ol",style:a(r(i(e)))}:void 0},u=function(e){var t,n=e.nodeName.toLowerCase();e.firstChild&&e.firstChild.nodeType===Node.COMMENT_NODE&&e.removeChild(e.firstChild),1===e.childNodes.length?t=e.firstChild.nodeType===Node.TEXT_NODE?i(e):e.firstChild.innerHTML.replace(/^\w+[\.\)]( )+ /,""):(e.removeChild(e.firstChild),3===e.firstChild.nodeType&&/^[ivxlcdm]+\.$/i.test(e.firstChild.nodeValue)&&e.removeChild(e.firstChild),/^( |\s)+$/i.test(e.firstChild.innerHTML)&&e.removeChild(e.firstChild),t="p"!==n?"<"+n+">"+e.innerHTML+"</"+n+">":e.innerHTML),e.parentNode.removeChild(e);var r=document.createElement("li");return r.innerHTML=t,r};t.convertMsLists=function(e){var t=document.createElement("div");t.innerHTML=function(e){return e=e.replace(r,(function(e,t,n){return'datalist="'+t+'" datalevel="'+n+'" '+e}))}(e);var n=new Set;return l(t.children,n),n.forEach((function(e){return function(e){var t,n,r,i,a,l,d,p,f,h,m,v,g,y=-1,w={};for(p=0;p<e.length;p++){var b=(g={datalist:(f=e[p]).getAttribute("datalist"),datalevel:f.getAttribute("datalevel")}).datalist,S=c(f);if(h=S&&S.tag){if(m=g.datalevel||parseFloat(f.style.marginLeft||0),g.datalevel||f.style.marginLeft){var k=h+b;w[m]||(w[m]={}),(!n||n<0)&&(n=m,r=b,i=(d=e.filter((function(e){return e.getAttribute("datalist")===String(r)})))[d.length-1],l=s(h,S&&S.style),f.parentNode.insertBefore(l,f),y=m,w[m][k]=l),a=i===f,v=w[m][k],(m>y||!v)&&(v=s(h,S&&S.style),w[m][k]=v,t.appendChild(v)),t=u(f),v.appendChild(t),a?n=y=-1:y=m}}else!t||a&&!o(f)||(f.style.marginLeft&&(f.style.marginLeft=""),f.style.marginLeft&&(f.style.margin=""),t.appendChild(f))}}(e)})),t.innerHTML}},function(e,t,n){"use strict";n.r(t),n.d(t,"HistoryState",(function(){return d})),n.d(t,"closeHistory",(function(){return w})),n.d(t,"history",(function(){return k})),n.d(t,"redo",(function(){return C})),n.d(t,"redoDepth",(function(){return O})),n.d(t,"undo",(function(){return x})),n.d(t,"undoDepth",(function(){return M}));var r=function(){};r.prototype.append=function(e){return e.length?(e=r.from(e),!this.length&&e||e.length<200&&this.leafAppend(e)||this.length<200&&e.leafPrepend(this)||this.appendInner(e)):this},r.prototype.prepend=function(e){return e.length?r.from(e).append(this):this},r.prototype.appendInner=function(e){return new i(this,e)},r.prototype.slice=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t?r.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},r.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},r.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},r.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var r=[];return this.forEach((function(t,n){return r.push(e(t,n))}),t,n),r},r.from=function(e){return e instanceof r?e:e&&e.length?new o(e):r.empty};var o=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return 0==e&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var o=t;o<n;o++)if(!1===e(this.values[o],r+o))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var o=t-1;o>=n;o--)if(!1===e(this.values[o],r+o))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=200)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=200)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(r);r.empty=new o([]);var i=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var o=this.left.length;return!(t<o&&!1===this.left.forEachInner(e,t,Math.min(n,o),r))&&(!(n>o&&!1===this.right.forEachInner(e,Math.max(t-o,0),Math.min(this.length,n)-o,r+o))&&void 0)},t.prototype.forEachInvertedInner=function(e,t,n,r){var o=this.left.length;return!(t>o&&!1===this.right.forEachInvertedInner(e,t-o,Math.max(n,o)-o,r+o))&&(!(n<o&&!1===this.left.forEachInvertedInner(e,Math.min(t,o),n,r))&&void 0)},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(r),s=r,a=n(2),l=n(1),c=function(e,t){this.items=e,this.eventCount=t};c.prototype.popEvent=function(e,t){var n=this;if(0==this.eventCount)return null;for(var r,o,i=this.items.length;;i--){if(this.items.get(i-1).selection){--i;break}}t&&(r=this.remapping(i,this.items.length),o=r.maps.length);var s,a,l=e.tr,d=[],p=[];return this.items.forEach((function(e,t){if(!e.step)return r||(r=n.remapping(i,t+1),o=r.maps.length),o--,void p.push(e);if(r){p.push(new u(e.map));var f,h=e.step.map(r.slice(o));h&&l.maybeStep(h).doc&&(f=l.mapping.maps[l.mapping.maps.length-1],d.push(new u(f,null,null,d.length+p.length))),o--,f&&r.appendMap(f,o)}else l.maybeStep(e.step);return e.selection?(s=r?e.selection.map(r.slice(o)):e.selection,a=new c(n.items.slice(0,i).append(p.reverse().concat(d)),n.eventCount-1),!1):void 0}),this.items.length,0),{remaining:a,transform:l,selection:s}},c.prototype.addTransform=function(e,t,n,r){for(var o=[],i=this.eventCount,s=this.items,a=!r&&s.length?s.get(s.length-1):null,l=0;l<e.steps.length;l++){var d,f=e.steps[l].invert(e.docs[l]),h=new u(e.mapping.maps[l],f,t);(d=a&&a.merge(h))&&(h=d,l?o.pop():s=s.slice(0,s.length-1)),o.push(h),t&&(i++,t=null),r||(a=h)}var m,v,g,y=i-n.depth;return y>p&&(v=y,(m=s).forEach((function(e,t){if(e.selection&&0==v--)return g=t,!1})),s=m.slice(g),i-=y),new c(s.append(o),i)},c.prototype.remapping=function(e,t){var n=new a.Mapping;return this.items.forEach((function(t,r){var o=null!=t.mirrorOffset&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:null;n.appendMap(t.map,o)}),e,t),n},c.prototype.addMaps=function(e){return 0==this.eventCount?this:new c(this.items.append(e.map((function(e){return new u(e)}))),this.eventCount)},c.prototype.rebased=function(e,t){if(!this.eventCount)return this;var n=[],r=Math.max(0,this.items.length-t),o=e.mapping,i=e.steps.length,s=this.eventCount;this.items.forEach((function(e){e.selection&&s--}),r);var a=t;this.items.forEach((function(t){var r=o.getMirror(--a);if(null!=r){i=Math.min(i,r);var l=o.maps[r];if(t.step){var c=e.steps[r].invert(e.docs[r]),d=t.selection&&t.selection.map(o.slice(a+1,r));d&&s++,n.push(new u(l,c,d))}else n.push(new u(l))}}),r);for(var l=[],d=t;d<i;d++)l.push(new u(o.maps[d]));var p=this.items.slice(0,r).append(l).append(n),f=new c(p,s);return f.emptyItemCount()>500&&(f=f.compress(this.items.length-n.length)),f},c.prototype.emptyItemCount=function(){var e=0;return this.items.forEach((function(t){t.step||e++})),e},c.prototype.compress=function(e){void 0===e&&(e=this.items.length);var t=this.remapping(0,e),n=t.maps.length,r=[],o=0;return this.items.forEach((function(i,s){if(s>=e)r.push(i),i.selection&&o++;else if(i.step){var a=i.step.map(t.slice(n)),l=a&&a.getMap();if(n--,l&&t.appendMap(l,n),a){var c=i.selection&&i.selection.map(t.slice(n));c&&o++;var d,p=new u(l.invert(),a,c),f=r.length-1;(d=r.length&&r[f].merge(p))?r[f]=d:r.push(p)}}else i.map&&n--}),this.items.length,0),new c(s.from(r.reverse()),o)},c.empty=new c(s.empty,0);var u=function(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r};u.prototype.merge=function(e){if(this.step&&e.step&&!e.selection){var t=e.step.merge(this.step);if(t)return new u(t.getMap().invert(),t,this.selection)}};var d=function(e,t,n,r){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r},p=20;function f(e){var t=[];return e.forEach((function(e,n,r,o){return t.push(r,o)})),t}function h(e,t){if(!e)return null;for(var n=[],r=0;r<e.length;r+=2){var o=t.map(e[r],1),i=t.map(e[r+1],-1);o<=i&&n.push(o,i)}return n}function m(e,t,n,r){var o=y(t),i=b.get(t).spec.config,s=(r?e.undone:e.done).popEvent(t,o);if(s){var a=s.selection.resolve(s.transform.doc),l=(r?e.done:e.undone).addTransform(s.transform,t.selection.getBookmark(),i,o),c=new d(r?l:s.remaining,r?s.remaining:l,null,0);n(s.transform.setSelection(a).setMeta(b,{redo:r,historyState:c}).scrollIntoView())}}var v=!1,g=null;function y(e){var t=e.plugins;if(g!=t){v=!1,g=t;for(var n=0;n<t.length;n++)if(t[n].spec.historyPreserveItems){v=!0;break}}return v}function w(e){return e.setMeta(S,!0)}var b=new l.PluginKey("history"),S=new l.PluginKey("closeHistory");function k(e){return e={depth:e&&e.depth||100,newGroupDelay:e&&e.newGroupDelay||500},new l.Plugin({key:b,state:{init:function(){return new d(c.empty,c.empty,null,0)},apply:function(t,n,r){return function(e,t,n,r){var o,i=n.getMeta(b);if(i)return i.historyState;n.getMeta(S)&&(e=new d(e.done,e.undone,null,0));var s=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(s&&s.getMeta(b))return s.getMeta(b).redo?new d(e.done.addTransform(n,null,r,y(t)),e.undone,f(n.mapping.maps[n.steps.length-1]),e.prevTime):new d(e.done,e.undone.addTransform(n,null,r,y(t)),null,e.prevTime);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))return(o=n.getMeta("rebased"))?new d(e.done.rebased(n,o),e.undone.rebased(n,o),h(e.prevRanges,n.mapping),e.prevTime):new d(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),h(e.prevRanges,n.mapping),e.prevTime);var a=0==e.prevTime||!s&&(e.prevTime<(n.time||0)-r.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;var n=!1;return e.mapping.maps[0].forEach((function(e,r){for(var o=0;o<t.length;o+=2)e<=t[o+1]&&r>=t[o]&&(n=!0)})),n}(n,e.prevRanges)),l=s?h(e.prevRanges,n.mapping):f(n.mapping.maps[n.steps.length-1]);return new d(e.done.addTransform(n,a?t.selection.getBookmark():null,r,y(t)),c.empty,l,n.time)}(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput:function(e,t){var n="historyUndo"==t.inputType?x(e.state,e.dispatch):"historyRedo"==t.inputType&&C(e.state,e.dispatch);return n&&t.preventDefault(),n}}}})}function x(e,t){var n=b.getState(e);return!(!n||0==n.done.eventCount)&&(t&&m(n,e,t,!1),!0)}function C(e,t){var n=b.getState(e);return!(!n||0==n.undone.eventCount)&&(t&&m(n,e,t,!0),!0)}function M(e){var t=b.getState(e);return t?t.done.eventCount:0}function O(e){var t=b.getState(e);return t?t.undone.eventCount:0}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4),o=n(12);t.getHtml=o.getHtml,t.setHtml=o.setHtml,t.parseContent=o.parseContent,t.trimWhitespace=o.trimWhitespace,t.htmlToFragment=o.htmlToFragment,t.domToPmDoc=o.domToPmDoc,t.pmDocToFragment=o.pmDocToFragment;var i=n(13);t.applyInlineStyle=i.applyInlineStyle,t.getInlineStyles=i.getInlineStyles,t.toggleInlineFormat=i.toggleInlineFormat;var s=n(26);t.applyLink=s.applyLink,t.removeLink=s.removeLink;var a=n(27);t.insertText=a.insertText;var l=n(28);t.insertImage=l.insertImage;var c=n(29);t.alignBlocks=c.alignBlocks,t.isAligned=c.isAligned;var u=n(30);t.cleanFormatting=u.cleanFormatting;var d=n(10);t.hasNode=d.hasNode,t.activeNode=d.activeNode,t.formatBlockElements=d.formatBlockElements,t.getBlockFormats=d.getBlockFormats,t.parentBlockFormat=d.parentBlockFormat,t.changeTextBlock=d.changeTextBlock,t.blockNodes=d.blockNodes,t.cleanTextBlockFormatting=d.cleanTextBlockFormatting;var p=n(7);t.hasMark=p.hasMark,t.getMark=p.getMark,t.getActiveMarks=p.getActiveMarks,t.removeAllMarks=p.removeAllMarks,t.cleanMarks=p.cleanMarks,t.selectionMarks=p.selectionMarks;var f=n(31);t.indent=f.indent,t.canIndentAsListItem=f.canIndentAsListItem,t.outdent=f.outdent,t.canOutdentAsListItem=f.canOutdentAsListItem,t.isIndented=f.isIndented,t.canBeIndented=f.canBeIndented,t.indentBlocks=f.indentBlocks;var h=n(19);t.toggleOrderedList=h.toggleOrderedList,t.toggleUnorderedList=h.toggleUnorderedList,t.toggleList=h.toggleList,t.listStyle=h.listStyle;var m=n(18);t.blockquote=m.blockquote,t.liftBlockquote=m.liftBlockquote;var v=n(5);t.hasSameMarkup=v.hasSameMarkup,t.getSelectionText=v.getSelectionText,t.getNodeFromSelection=v.getNodeFromSelection,t.selectedLineTextOnly=v.selectedLineTextOnly,t.expandSelection=v.expandSelection,t.expandToWordWrap=v.expandToWordWrap,t.canInsert=v.canInsert,t.insertNode=v.insertNode,t.indentHtml=v.indentHtml;var g=n(32);t.alignLeftRules=g.alignLeftRules,t.alignCenterRules=g.alignCenterRules,t.alignRightRules=g.alignRightRules,t.alignJustifyRules=g.alignJustifyRules,t.alignRemoveRules=g.alignRemoveRules;var y=n(16);t.indentRules=y.indentRules,t.outdentRules=y.outdentRules;var w=n(20);t.nodes=w.nodes,t.marks=w.marks;var b=n(33);t.buildKeymap=b.buildKeymap,t.buildListKeymap=b.buildListKeymap;var S=n(22);t.bold=S.bold,t.italic=S.italic,t.underline=S.underline,t.strikethrough=S.strikethrough,t.subscript=S.subscript,t.superscript=S.superscript,t.link=S.link;var k=n(34);t.sanitize=k.sanitize,t.removeComments=k.removeComments,t.removeTag=k.removeTag,t.pasteCleanup=k.pasteCleanup,t.sanitizeClassAttr=k.sanitizeClassAttr,t.sanitizeStyleAttr=k.sanitizeStyleAttr,t.removeAttribute=k.removeAttribute,t.replaceImageSourcesFromRtf=k.replaceImageSourcesFromRtf;var x=n(23);t.convertMsLists=x.convertMsLists;var C=n(35);t.find=C.find,t.findAt=C.findAt,t.findAll=C.findAll,t.replace=C.replace,t.replaceAll=C.replaceAll;var M=n(36);t.placeholder=M.placeholder;var O=n(37);t.spacesFix=O.spacesFix;var T=n(38);t.textHighlight=T.textHighlight,t.textHighlightKey=T.textHighlightKey;var A=n(39);t.imageResizing=A.imageResizing,t.imageResizeKey=A.imageResizeKey;var N=n(40);t.caretColor=N.caretColor,t.caretColorKey=N.caretColorKey;var D=n(41);t.tableResizing=D.tableResizing,r.__exportStar(n(11),t),r.__exportStar(n(46),t),r.__exportStar(n(47),t),r.__exportStar(n(24),t),r.__exportStar(n(21),t),r.__exportStar(n(9),t),r.__exportStar(n(0),t),r.__exportStar(n(14),t),r.__exportStar(n(1),t);var R=n(8);t.TableMap=R.TableMap,t.tableEditing=R.tableEditing,t.tableEditingKey=R.tableEditingKey,t.tableNodeTypes=R.tableNodeTypes,t.tableNodes=R.tableNodes,t.fixTables=R.fixTables,t.fixTablesKey=R.fixTablesKey,t.isInTable=R.isInTable,t.deleteTable=R.deleteTable,t.inSameTable=R.inSameTable,t.CellSelection=R.CellSelection,t.selectedRect=R.selectedRect,t.selectionCell=R.selectionCell,t.setCellAttr=R.setCellAttr,t.goToNextCell=R.goToNextCell,t.toggleHeader=R.toggleHeader,t.toggleHeaderCell=R.toggleHeaderCell,t.toggleHeaderColumn=R.toggleHeaderColumn,t.toggleHeaderRow=R.toggleHeaderRow,t.splitCell=R.splitCell,t.splitCellWithType=R.splitCellWithType,t.mergeCells=R.mergeCells,t.deleteColumn=R.deleteColumn,t.deleteRow=R.deleteRow,t.rowIsHeader=R.rowIsHeader,t.addRow=R.addRow,t.addColSpan=R.addColSpan,t.addColumn=R.addColumn,t.addColumnAfter=R.addColumnAfter,t.addColumnBefore=R.addColumnBefore,t.colCount=R.colCount,t.columnIsHeader=R.columnIsHeader,t.columnResizing=R.columnResizing,t.columnResizingPluginKey=R.columnResizingPluginKey,t.updateColumnsOnResize=R.updateColumnsOnResize,t.cellAround=R.cellAround,t.findCell=R.findCell,t.removeColSpan=R.removeColSpan,t.moveCellForward=R.moveCellForward,t.nextCell=R.nextCell,r.__exportStar(n(2),t),r.__exportStar(n(3),t);var E=n(48);t.createTable=E.createTable,t.addRowAfter=E.addRowAfter,t.addRowBefore=E.addRowBefore,t.pmAddRowAfter=E.pmAddRowAfter,t.pmAddRowBefore=E.pmAddRowBefore},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(13),o=n(7),i=n(1);t.removeLink=function(e,t){return function(n,i){var s=n.selection.$cursor;if(s){var a=s.parent,l=s.index(),c=n.schema.marks[e.mark],u=a.child(l).marks.find((function(e){return e.type===c})),d=a.childCount,p=s.pos-s.textOffset,f=a.child(l).nodeSize,h=void 0,m=void 0;for(h=l-1;h>=0&&u.isInSet(a.child(h).marks);)f+=m=a.child(h).nodeSize,p-=m,h-=1;for(h=l+1;h<d&&u.isInSet(a.child(h).marks);)f+=a.child(h).nodeSize,h+=1;i(o.removeMark(t||n.tr,p,p+f,u))}else r.toggleInlineFormat(e,t)(n,i)}};t.applyLink=function(e,n){var s=e.mark,a=e.attrs;return void 0===n&&(n="link"),function(e,l){var c=e.schema.marks,u=e.tr;n&&(u.setMeta("commandName",n),u.setMeta("args",a));var d=!1,p=function(){return d=!0};if(function(e,t){var n=o.selectionMarks(e,t);return 1===n.length&&n[0]?n[0]:null}(e,c[s]))!function(e,t){return function(n,r){var o=n.selection,i=o.$cursor,s=o.from,a=o.to,l=n.schema.marks[e.mark];if(i){var c=i.parent,u=i.index(),d=c.child(u).marks.find((function(e){return e.type===l})),p=c.childCount,f=i.pos-i.textOffset,h=c.child(u).nodeSize,m=void 0,v=void 0;for(m=u-1;m>=0&&d.isInSet(c.child(m).marks);)h+=v=c.child(m).nodeSize,f-=v,m-=1;for(m=u+1;m<p&&d.isInSet(c.child(m).marks);)h+=c.child(m).nodeSize,m+=1;t.removeMark(f,f+h,l),t.addMark(f,f+h,l.create(e.attrs)),r(t)}else t.doc.nodesBetween(s,a,(function(n,o){n.isInline&&l.isInSet(n.marks)&&(t.removeMark(o,o+n.nodeSize,l),t.addMark(o,o+n.nodeSize,l.create(e.attrs)),r(t))}))}}({mark:s,attrs:a},u)(e,p);else{var f=e;o.hasMark(e,{mark:s})&&(t.removeLink({mark:s,attrs:a},u)(e,p),f=i.EditorState.create({doc:u.doc,selection:u.selection})),d?o.toggleMark(c[s],a,u)(f,p):r.toggleInlineFormat({mark:s},u,a)(f,p)}return d&&l(u),d}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.insertText=function(e){return function(t,n){n(t.tr.insertText(e.text,e.from,e.to))}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(5);t.insertImage=function(e){return function(t,n){var o=t.schema.nodes.image,i=o.createAndFill(e);r.insertNode(i)(t,(function(t){return n(t.setMeta("commandName","insertImage").setMeta("args",e))}))}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(10);t.alignBlocks=function(e,t){return function(n,o){var i=r.blockNodes(n),s=n.tr;s.setMeta("commandName",t),i.forEach((function(t){if(t.type.isTextblock){var n={},o=e.find((function(e){return e.node===t.type.name}));o&&(n=r.addStyles(t,o.style)),r.changeTextBlock(s,t,t.type,n)}}));var a=s.docChanged;return a&&o(s.scrollIntoView()),a}},t.isAligned=function(e,t){var n=r.blockNodes(e),o=!1;return n.forEach((function(e){if(!o&&e.type.isTextblock&&e.attrs.style){var n=t.find((function(t){return t.node===e.type.name}));n&&(o=n.style.every((function(t){return!!t.value&&new RegExp(t.name+":\\s?"+t.value,"i").test(e.attrs.style)})))}})),o}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(10),o=n(7);t.cleanFormatting=function(e){return void 0===e&&(e={blocksInSelection:!0}),function(t,n){var i=t.tr,s=e.blocksInSelection,a=e.blockNodeType,l=(e.exceptMarks||[t.schema.marks.link]).filter(Boolean);o.cleanMarks(i,{except:l}),r.cleanTextBlockFormatting(i,{blocksInSelection:s,blockNodeType:a});var c=i.docChanged;return c&&n&&n(i),c}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(14),o=n(16),i=n(10),s=n(5),a=n(18);t.indentBlocks=function(e,t,n){return function(r,o){var s=i.blockNodes(r),a=r.tr;a.setMeta("commandName",t),s.forEach((function(t){if(t.type.isTextblock){var r=void 0,o=e.find((function(e){return e.node===t.type.name}));if(o){var s="rtl"===n?o.rtlStyle:o.style,l={name:s,value:o.step>0?""+o.step+o.unit:""};if(t.attrs.style){var c=new RegExp(s+":\\s?(\\d+)"+o.unit,"i"),u=t.attrs.style.match(c);if(u){var d=parseFloat(u[1])+o.step;d=d<=0?"":d,l.value=""+d+(d?o.unit:"")}}r=i.addStyles(t,[l])}r&&i.changeTextBlock(a,t,t.type,r)}}));var l=a.docChanged;return l&&o(a.scrollIntoView()),l}},t.isIndented=function(e,t,n){var r=i.blockNodes(e),o=!1;return r.forEach((function(e){if(!o&&e.type.isTextblock&&e.attrs.style){var r=t.find((function(t){return t.node===e.type.name}));if(r){var i="rtl"===n?r.rtlStyle:r.style,s=new RegExp(i+":\\s?\\d+"+r.unit,"i");o=s.test(e.attrs.style)}}})),o},t.canIndentAsListItem=function(e,t){return r.sinkListItem(t)(e)},t.canOutdentAsListItem=function(e,t){var n=e.schema.nodes[t.listsTypes.listItem],o=e.schema.nodes[t.listsTypes.orderedList],i=e.schema.nodes[t.listsTypes.bulletList],a=!!s.findNthParentNodeOfType(o,2)(e.selection),l=!!s.findNthParentNodeOfType(i,2)(e.selection);return(a||l)&&r.liftListItem(n)(e)},t.canBeIndented=function(e,n){var r=e.schema.nodes,s=r[o.indentRules.listsTypes.listItem];return(t.isIndented(e,n.nodes)||o.indentRules.nodes.some((function(t){return r[t.node]&&i.hasNode(e,r[t.node])})))&&!i.hasNode(e,s)},t.indent=function(e,n){var i=e.schema.nodes[o.indentRules.listsTypes.listItem],s=t.canBeIndented(e,o.indentRules);t.canIndentAsListItem(e,i)?r.sinkListItem(i)(e,n):s&&t.indentBlocks(o.indentRules.nodes)(e,n)},t.outdent=function(e,n){var s=e.schema.nodes,l=s[o.outdentRules.listsTypes.listItem],c=t.canBeIndented(e,o.outdentRules);i.hasNode(e,s.blockquote)?a.liftBlockquote(e,n):t.canOutdentAsListItem(e,o.outdentRules)?r.liftListItem(l)(e,n):c&&t.indentBlocks(o.outdentRules.nodes)(e,n)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t){return{name:e,value:t}};t.alignLeftRules=[{node:"paragraph",style:[r("text-align","left")]},{node:"heading",style:[r("text-align","left")]}],t.alignRightRules=[{node:"paragraph",style:[r("text-align","right")]},{node:"heading",style:[r("text-align","right")]}],t.alignCenterRules=[{node:"paragraph",style:[r("text-align","center")]},{node:"heading",style:[r("text-align","center")]}],t.alignJustifyRules=[{node:"paragraph",style:[r("text-align","justify")]},{node:"heading",style:[r("text-align","justify")]}],t.alignRemoveRules=[{node:"paragraph",style:[r("text-align","")]},{node:"heading",style:[r("text-align","")]}]},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4),o=n(11),i=n(24),s=n(21),a=n(19),l=n(22),c=n(13),u=n(5),d="undefined"!=typeof navigator&&/Mac/.test(navigator.platform);t.buildKeymap=function(e,t){var n={},a=t&&t.applyToWord||!1;if(n["Mod-z"]=i.undo,n["Shift-Mod-z"]=i.redo,n.Backspace=o.chainCommands(s.undoInputRule,o.deleteSelection,o.joinBackward,o.selectNodeBackward),n.Enter=o.chainCommands(o.newlineInCode,o.createParagraphNear,o.liftEmptyBlock,o.splitBlockKeepMarks),d||(n["Mod-y"]=i.redo),e.marks.strong&&(n["Mod-b"]=u.expandToWordWrap(c.toggleInlineFormat,r.__assign({},l.bold,{applyToWord:a}))),e.marks.em&&(n["Mod-i"]=u.expandToWordWrap(c.toggleInlineFormat,r.__assign({},l.italic,{applyToWord:a}))),e.marks.u&&(n["Mod-u"]=u.expandToWordWrap(c.toggleInlineFormat,r.__assign({},l.underline,{applyToWord:a}))),e.nodes.hard_break){var p=e.nodes.hard_break,f=o.chainCommands(o.exitCode,(function(e,t){return t(e.tr.replaceSelectionWith(p.create()).scrollIntoView()),!0}));n["Shift-Enter"]=f}return n},t.buildListKeymap=function(e){var t={};return e.nodes.list_item&&(t.Enter=a.splitListItemKeepMarks(e.nodes.list_item)),t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(23);t.sanitize=function(e){return e=(e=(e=(e=(e=(e=(e=(e=(e=(e=e.replace(/^[\s\S]+?<!--StartFragment-->\s*([\s\S]*?)\s*<!--EndFragment-->[\s\S]+$/,"$1")).replace(/<\/?[ovw]:[^>]*?>/gi,"")).replace(/<\\?\??xml[^>]*>/gi,"")).replace(/<(?:link|meta) [^>]+?>/gi,"")).replace(/<style[^>]*?>\s*<\/style>/gi,"")).replace(/<\/?st1:.*?>/gi,"")).replace(/<a name="[a-zA-Z0-9_]+">/gim,"")).replace(/v:shapes?="[^"]+"/gi,"")).replace(/<!\[if !supportLists\]>/gi,"")).replace(/<!\[endif\]>/gi,"")},t.removeComments=function(e){return e.replace(/<!--[\s\S]+?-->/g,"")},t.removeTag=function(e,t){return e.replace(new RegExp("<\\/?("+t+")(?:\\s[^>]*?)?>","gi"),"")},t.removeAttribute=function(e){e.ownerElement&&e.ownerElement.removeAttribute(e.name)},t.sanitizeClassAttr=function(e){/^Mso/.test(e.value)&&t.removeAttribute(e)};var o=/\s*;\s*/,i=/\s*:\s*/;t.sanitizeStyleAttr=function(e){var n,r,s=e.value.split(o).filter((function(e){return Boolean(e)})),a=e.ownerElement.style,l="";s.forEach((function(e){var t;t=e.split(i),n=t[0],r=t[1],void 0!==a[n]&&(l+=n+": "+r+"; ")})),(l=l.trim())?e.value=l:t.removeAttribute(e)};function s(e){for(var t=e.length,n=new Array(t/2),r=0;r<t;r+=2)n[r]=String.fromCharCode(parseInt(e.substring(r,r+2),16));return btoa(n.join(""))}t.pasteCleanup=function(e,n){var o=e;if(n.convertMsLists&&(o=r.convertMsLists(o)),n.stripTags&&(o=t.removeTag(o,n.stripTags)),n.attributes){var i=document.createElement("div");i.innerHTML=o,Array.from(i.querySelectorAll("*")).forEach((function(e){return function(e,t){if(e.nodeType===Node.ELEMENT_NODE){for(var n=e.attributes.length-1;n>=0;n--){var r=e.attributes[n];t[r.name]?t[r.name](r):t["*"]&&t["*"](r)}"SPAN"===e.nodeName&&0===e.attributes.length&&function(e){var t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}}(e)}}(e,n.attributes)})),o=i.innerHTML}return o};var a=/<img\s[^>]*?src=(?:'|")file:\/[^'"]+(?:'|")[^>]*>/gi,l=/{\\pict[\s\S]+?\\bliptag-?\d+(\\blipupi-?\d+)?({\\\*\\blipuid\s?[\da-fA-F]+)?[\s}]*?/,c=new RegExp("(?:("+l.source+"))([\\da-fA-F\\s]+)\\}","g"),u=/[^\da-fA-F]/g,d=/file:\/[^'"]+\.(jpg|png|gif)/i,p=/\\(png|jpeg)blip\\/;t.replaceImageSourcesFromRtf=function(e,t){var n=e.match(a);if(!n||-1===t.types.indexOf("text/rtf"))return e;var r=t.getData("text/rtf"),o=[],i=r.match(c);if(!r||!i)return e;for(var f=0,h=i;f<h.length;f++){var m=h[f],v=p.exec(m);if(v){var g=m.replace(l,"").replace(u,"");o.push("data:image/"+v[1]+";base64,"+s(g))}}return n.length!==o.length?e:e.replace(a,(function(e){var t=o.shift()||"";return e.replace(d,t)}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4),o=n(1);t.findAt=function(e,t,n,r,i){var l,c,u,d,p,f,h=[],m=[],v=t.matchCase,g=t.matchWord,y=t.useRegExp,w=t.text;if(y&&(/^\\$/.test(w)||/[^\\]\\$/.test(w))&&(w=w.substring(0,w.length-1)),!w)return h;var b=v?"g":"gi",S=y?new RegExp(w,b):a(w,b);return e.nodesBetween(n,r,(function(t,a,v){if(i(h))return!1;t.inlineContent&&a+t.content.size>=n&&(m.length=0,t.nodesBetween(0,t.content.size,(function(t,v,y,w){if(i(h))return!1;var b=1+a+v;if(t.isText&&b+t.nodeSize>=n){if(p=t.text||"",f=y.childCount-1>=w+1&&y.child(w+1),m.push(n<=b?{text:p,start:b}:{text:p.slice(n-b),start:n}),f&&f.isText)return;for(c=m.map((function(e){return e.text})).join(""),l=S.exec(c);null!==l&&(u=m[0].start+l.index,d=u+l[0].length,n<=u&&r>=d&&s(l,g)&&h.push(o.TextSelection.create(e,u,d)),!i(h));)l=S.exec(c)}else m.length=0})))})),h},t.find=function(e,n){var o=n.backward,i=n.matchCyclic,s=r.__rest(n,["backward","matchCyclic"]),a=o?function(){return!1}:function(e){return e.length>0},l=e.doc,c=e.selection,u=[];return o?!(u=t.findAt(l,s,0,c.from,a)).length&&i&&(u=t.findAt(l,s,c.from,l.content.size,a)):!(u=t.findAt(l,s,c.to,l.content.size,a)).length&&i&&(u=t.findAt(l,s,0,c.to,a)),u.length?u[u.length-1]:null},t.findAll=function(e,n){return t.findAt(e,n,0,e.content.size,(function(){return!1}))},t.replace=function(e,t,n){var r=e.from,i=e.to;return n.insertText(t,r,i).setSelection(o.TextSelection.create(n.doc,r,r+t.length)),n},t.replaceAll=function(e,n,r){var o=t.findAll(e.doc,r);if(0===o.length)return null;for(var i=e.tr,s=o.length-1;s>=0;s--)i.insertText(n,o[s].from,o[s].to);return i};var i=/^[\s0-9~`!@#$%\^&*\(\)_\-=+\\|\[\]{};:'"\?/.,<>]?$/,s=function(e,t){if(t){if(!0===t){var n=e.input,r=n.charAt(e.index-1),o=n.charAt(e.index+e[0].length);return i.test(r)&&i.test(o)}return t(e)}return!0},a=function(e,t){var n=e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d").replace(/\s/g,"\\s");return new RegExp(n,t)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(3);t.placeholder=function(e){var t={class:"k-placeholder","data-placeholder":e};return new r.Plugin({key:new r.PluginKey("placeholder"),props:{decorations:function(e){var n=e.doc,r=n.content.firstChild;if(!(0===n.childCount||1===n.childCount&&r.inlineContent&&0===r.childCount))return o.DecorationSet.empty;var i=[];return n.descendants((function(e,n){i.push(o.Decoration.node(n,n+e.nodeSize,t))})),o.DecorationSet.create(n,i)}}})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(3),i=/\s+/g,s=/text-align/;t.spacesFix=function(){return new r.Plugin({key:new r.PluginKey("spaces-fix"),props:{decorations:function(e){var t,n,r,a,l=[],c=e.doc;return c.nodesBetween(0,c.content.size,(function(e,c,u){if(e.type.isText&&function(e){return s.test(e&&e.attrs&&e.attrs.style||"")}(u))for(n=i.exec(e.text||"");null!==n;){if(t=c+n.index,r=n[0].length,n.index+r<n.input.length)for(a=0;a<=r-1;a+=2)l.push(o.Decoration.inline(t+a,t+a+1,{style:"white-space: normal"}));n=i.exec(e.text||"")}})),o.DecorationSet.create(c,l)}}})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(3);t.textHighlightKey=new r.PluginKey("highlight"),t.textHighlight=function(e){return void 0===e&&(e=t.textHighlightKey),new r.Plugin({key:e,state:{init:function(){return null},apply:function(e){return e.getMeta(this.spec.key)}},props:{decorations:function(e){var t=(this.spec.key.getState(e)||[]).map((function(e){return o.Decoration.inline(e.from,e.to,e.attrs)}));return o.DecorationSet.create(e.doc,t)}}})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4),o=n(1),i=n(3),s=n(6),a=n(5);t.imageResizeKey=new o.PluginKey("image-resize");var l={southeast:{x:1,y:1},east:{x:1,y:0},south:{x:0,y:1},north:{x:0,y:-1},west:{x:-1,y:0},southwest:{x:-1,y:1},northwest:{x:-1,y:-1},northeast:{x:1,y:-1}},c=Object.keys(l),u=function(e,t,n){e.style[t]=n+"px"},d=/[^\-]width:|[^\-]height:/,p=/^.+$/,f=function(){function e(e,t,n,r){this.activeHandle=e,this.dragging=t,this.rect=n,this.nodePosition=r}return e.prototype.apply=function(n){var r=n.getMeta(t.imageResizeKey);return r?new e(r.activeHandle,r.setDragging,r.rect,r.nodePosition):this},e}(),h=function(e,n,i){var c=n.target.getAttribute(s.dataDirection);if(!c)return!1;var f=t.imageResizeKey.getState(e.state);n.preventDefault();var h=e.state.tr;function m(n){!function(e,n,r){var o=t.imageResizeKey.getState(e.state),i=o.rect,s=o.dragging,a=o.nodePosition,c=o.activeHandle;if(s&&i){var d=e.nodeDOM(a),p=l[c],f=(n.clientX-s.startX)*p.x,h=(n.clientY-s.startY)*p.y,m=p.x?f+d.width:i.width,v=p.y?h+d.height:i.height;if(r.lockRatio&&p.x&&p.y){var g=Math.min(m/d.width,v/d.height),y=d.width*g,w=d.height*g;s.startX=n.clientX-(m-y)*p.x,s.startY=n.clientY-(v-w)*p.y,m=y,v=w}else s.startX=p.x?n.clientX:s.startX,s.startY=p.y?n.clientY:s.startY;u(d,"width",m),u(d,"height",v),i.top=d.offsetTop,i.left=d.offsetLeft,i.width=d.offsetWidth,i.height=d.offsetHeight;var b=d.nextElementSibling;b.style.width=i.width+"px",b.style.height=i.height+"px",b.style.top=i.top+"px",b.style.left=i.left+"px"}}(e,n,i)}return h.setMeta(t.imageResizeKey,{setDragging:{startX:n.clientX,startY:n.clientY},activeHandle:c,rect:f.rect,nodePosition:f.nodePosition}),h.setMeta("addToHistory",!1),e.dispatch(h),n.view.addEventListener("mouseup",(function n(i){i.view.removeEventListener("mouseup",n),i.view.removeEventListener("mousemove",m),function(e){var n=t.imageResizeKey.getState(e.state),i=n.rect,s=n.dragging,l=n.nodePosition;if(s&&i){var c=e.state.selection;if(c instanceof o.NodeSelection){var u=c.node.attrs,f=i.width,h=i.height,m=void 0;if(d.test(u.style||"")){var v=a.changeStylesString(u.style,{style:"width",value:p,newValue:f+"px"}),g=a.changeStylesString(v.style||"",{style:"height",value:p,newValue:h+"px"}).style;m=r.__assign({},u,{style:g})}else m=r.__assign({},u,{width:f,height:h});var y=c.node.type.createAndFill(m);if(y){var w=e.state.tr;w.replaceWith(l,l+1,y),w.setSelection(o.NodeSelection.create(w.doc,l)),w.setMeta("commandName","image-resize"),w.setMeta("args",m),w.setMeta(t.imageResizeKey,{setDragging:null,activeHandle:null,rect:i,nodePosition:l}),e.dispatch(w)}}}}(e)})),n.view.addEventListener("mousemove",m),!0};t.imageResizing=function(e){return void 0===e&&(e={node:"image",lockRatio:!0}),new o.Plugin({key:t.imageResizeKey,view:function(n){return{resize:function(){t.imageResizeKey.getState(n.state).rect&&n.dispatch(n.state.tr.setMeta("resize",!0))},get window(){return n.dom.ownerDocument&&n.dom.ownerDocument.defaultView},attachResize:function(){var e=this.window;e&&(e.removeEventListener("resize",this.resize),e.addEventListener("resize",this.resize))},removeResize:function(){var e=this.window;e&&e.removeEventListener("resize",this.resize)},update:function(n,r){var i=n.state,s=i.selection,a=i.schema.nodes[e.node],l=t.imageResizeKey.getState(i),c=l.rect;if(s instanceof o.NodeSelection&&a===s.node.type){var u=n.nodeDOM(s.from),d={top:u.offsetTop,left:u.offsetLeft,width:u.offsetWidth,height:u.offsetHeight};if(!r.selection.eq(s)||c&&(c.width!==d.width||c.height!==d.height||c.top!==d.top||c.left!==d.left)){var p=i.tr;p.setMeta(t.imageResizeKey,{rect:d,nodePosition:s.from}),n.dispatch(p),this.attachResize()}}else c&&(l.rect=null,l.nodePosition=-1)},destroy:function(){this.removeResize()}}},state:{init:function(){return new f("",null,null,-1)},apply:function(e,t){return t.apply(e)}},props:{handleDOMEvents:{mousedown:function(t,n){return h(t,n,e)}},decorations:function(n){var r=n.selection,a=n.schema.nodes[e.node],l=t.imageResizeKey.getState(n).rect;if(l&&r instanceof o.NodeSelection&&a===r.node.type){var u=document.createElement("div");u.className="k-editor-resize-handles-wrapper",u.style.width=l.width+"px",u.style.height=l.height+"px",u.style.top=l.top+"px",u.style.left=l.left+"px";for(var d=0;d<c.length;d++){var p=document.createElement("div");p.className=s.resizeHandle+" "+c[d],p.setAttribute(s.dataDirection,c[d]),u.appendChild(p)}return i.DecorationSet.create(n.doc,[i.Decoration.widget(n.selection.from+1,u)])}return i.DecorationSet.empty}}})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(3),i=n(7);t.caretColorKey=new r.PluginKey("caret-color"),t.caretColor=function(){return new r.Plugin({key:t.caretColorKey,props:{decorations:function(e){var t=e.doc,n=e.selection,r=e.storedMarks;if(!n.empty||!r)return o.DecorationSet.empty;var s=i.styleValue((r||[]).find((function(e){return"style"===e.type.name})),{name:"color",value:/^.+$/});if(!s)return o.DecorationSet.empty;var a=n.$anchor.parent,l=[];return t.descendants((function(e,t){e.eq(a)&&l.push(o.Decoration.node(t,t+e.nodeSize,{style:"caret-color: "+s}))})),o.DecorationSet.create(t,l)}}})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(42),o=n(44),i=n(45);t.tableResizing=function(){return[o.tableResizing(),r.columnResizing(),i.rowResizing()]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4),o=n(1),i=n(8),s=n(3),a=n(6),l=n(43),c=n(15);t.columnResizing=function(){var e=l.TableView;return new o.Plugin({key:c.tableColumnResizing,state:{init:function(t,n){return this.spec.props.nodeViews[i.tableNodeTypes(n.schema).table.name]=function(t,n){return new e(t,n)},new u(-1,null)},apply:function(e,t){return t.apply(e)}},props:{attributes:function(e){return c.otherResizeHandle(c.tableColumnResizing,e)?null:c.tableColumnResizing.getState(e).activeHandle>-1?{class:"resize-cursor"}:null},handleDOMEvents:{mousemove:function(e,t){return c.otherResizing(c.tableColumnResizing,e.state)||function(e,t,n,r,o){var s=c.tableColumnResizing.getState(e.state);if(!s.dragging){var a=function(e){for(;e&&"TD"!==e.nodeName&&"TH"!==e.nodeName;)e=e.classList.contains("ProseMirror")?null:e.parentNode;return e}(t.target),l=-1;if(a){var u=a.getBoundingClientRect(),p=u.left,h=u.right;t.clientX-p<=n?l=d(e,t,"left"):h-t.clientX<=n&&(l=d(e,t,"right"))}if(l!==s.activeHandle){if(!o&&-1!==l){var m=e.state.doc.resolve(l),v=m.node(-1),g=i.TableMap.get(v),y=m.start(-1);if(g.colCount(m.pos-y)+m.nodeAfter.attrs.colspan-1===g.width-1)return}f(e,l)}}}(e,t,5,0,!0),!1},mouseleave:function(e){return function(e){var t=c.tableColumnResizing.getState(e.state);t.activeHandle>-1&&!t.dragging&&f(e,-1)}(e),!1},mousedown:function(e,t){return function(e,t,n){var o,s=c.tableColumnResizing.getState(e.state);if(-1===s.activeHandle||s.dragging)return!1;for(var l=e.state.doc.resolve(s.activeHandle),u=l.parent,d=l.index(),f=0,h=0;h<=d;h++)f+=u.child(h).attrs.colspan;var m,v,g=l.node(l.depth-1),y=e.domAtPos(s.activeHandle),w=y.node.childNodes[y.offset].closest("table");if(g.attrs[a.colgroupAttr]){var b=w.firstChild;(m=b.children[f-1]).style.width||(m.style.width=m.offsetWidth+"px")}else{var S=0;for(h=0;h<u.childCount;h++)S+=u.child(h).attrs.colspan;b=document.createElement("colgroup");var k=new Array(S);for(h=0;h<S;h++)k[h]=document.createElement("col"),b.appendChild(k[h]);w.insertBefore(b,w.firstChild),(m=k[d]).style.width=m.offsetWidth+"px",v=r.__assign({},g.attrs,((o={})[a.colgroupAttr]="<colgroup>"+k.reduce((function(e,t){return e+t.outerHTML}),"")+"</colgroup>",o))}var x=parseFloat(m.style.width),C=e.state.tr.setMeta(c.tableColumnResizing,{setDragging:{startX:t.clientX,startWidth:x}});if(!w.style.width){var M=Array.from(m.parentNode.children).map((function(e){return e.style.width}));if(M.every(Boolean)){var O=M.reduce((function(e,t){return e+parseFloat(t)}),0);v=c.setNodeStyle(g.attrs,"width",O+"px")}}if(v){var T=l.posAtIndex(0,l.depth-1)-1;C.setNodeMarkup(T,null,v)}function A(t){t.view.removeEventListener("mouseup",A),t.view.removeEventListener("mousemove",N);var o=c.tableColumnResizing.getState(e.state);o.dragging&&(!function(e,t,n){var o,i=e.state.doc.resolve(t),s=i.node(-1),l=i.start(-1),u=e.state.tr,d=i.posAtIndex(0,i.depth-1)-1,p=e.nodeDOM(l).closest("table"),f=s.attrs;if(s&&f[a.colgroupAttr]){var h=p.firstChild;f=r.__assign({},f,((o={})[a.colgroupAttr]=h.outerHTML,o))}var m=p.style.width;p&&m&&c.parseStyle(f.style).width!==m&&(f=c.setNodeStyle(f,"width",m),u.setNodeMarkup(d,null,f));u.docChanged&&e.dispatch(u)}(e,o.activeHandle,p(o.dragging,t,n)),e.dispatch(e.state.tr.setMeta(c.tableColumnResizing,{setDragging:null})))}function N(t){if(!t.which)return A(t);var r=c.tableColumnResizing.getState(e.state),o=p(r.dragging,t,n);!function(e,t,n,r){var o=e.state.doc.resolve(t),s=o.node(-1),a=o.start(-1),l=i.TableMap.get(s).colCount(o.pos-a)+o.nodeAfter.attrs.colspan-1,c=e.domAtPos(o.start(-1)).node;"TABLE"!==c.nodeName&&(c=c.closest("table"));var u=c,d=u.firstChild,p=Array.from(d.children);if(p[l].style.width=n+"px",u.style.width){var f=p.map((function(e){return e.style.width}));if(f.every(Boolean)){var h=f.reduce((function(e,t){return e+parseFloat(t)}),0);u.style.width=h+"px"}}}(e,r.activeHandle,o)}return e.dispatch(C),t.view.addEventListener("mouseup",A),t.view.addEventListener("mousemove",N),t.preventDefault(),!0}(e,t,25)}},decorations:function(e){if(c.otherResizing(c.tableColumnResizing,e))return s.DecorationSet.empty;var t=c.tableColumnResizing.getState(e);return t.activeHandle>-1?function(e,t){for(var n=[],r=e.doc.resolve(t),o=r.node(-1),a=i.TableMap.get(o),l=r.start(-1),c=a.colCount(r.pos-l)+r.nodeAfter.attrs.colspan,u=0;u<a.height;u++){var d=c+u*a.width-1;if(!(c!==a.width&&a.map[d]===a.map[d+1]||0!==u&&a.map[d-1]===a.map[d-1-a.width])){var p=a.map[d],f=l+p+o.nodeAt(p).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",n.push(s.Decoration.widget(f,h))}}return s.DecorationSet.create(e.doc,n)}(e,t.activeHandle):void 0},nodeViews:{}}})};var u=function(){function e(e,t){this.activeHandle=e,this.dragging=t}return e.prototype.apply=function(t){var n,r=this,o=t.getMeta(c.tableColumnResizing);if(o&&null!=o.setHandle)return new e(o.setHandle,null);if(o&&void 0!==o.setDragging)return new e(r.activeHandle,o.setDragging);if(r.activeHandle>-1&&t.docChanged){var i=t.mapping.map(r.activeHandle,-1);"row"===(n=t.doc.resolve(i)).parent.type.spec.tableRole&&n.nodeAfter||(i=null),r=new e(i,r.dragging)}return r},e}();function d(e,t,n){var r=e.posAtCoords({left:t.clientX,top:t.clientY});if(!r)return-1;var o=r.pos,s=function(e){for(var t=e.depth-1;t>0;t--)if("row"===e.node(t).type.spec.tableRole)return e.node(0).resolve(e.before(t+1));return null}(e.state.doc.resolve(o));if(!s)return-1;if("right"===n)return s.pos;var a=i.TableMap.get(s.node(-1)),l=s.start(-1),c=a.map.indexOf(s.pos-l);return c%a.width==0?-1:l+a.map[c-1]}function p(e,t,n){var r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function f(e,t){e.dispatch(e.state.tr.setMeta(c.tableColumnResizing,{setHandle:t}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(6),o=n(20),i=["northwest","north","northeast","southwest","south","southeast","west","east"],s=function(){function e(e,t){this.node=e,this.view=t,this.dom=document.createElement("div"),this.dom.className=r.resizableWrap,this.table=this.dom.appendChild(document.createElement("table")),e.attrs[r.colgroupAttr]&&this.renderColgroup(e.attrs[r.colgroupAttr]);var n=this.table.appendChild(document.createElement("tbody"));this.setAttributes(this.table,e.attrs),this.resizeHandles=i.map((function(e){var t=document.createElement("span");return t.className=r.resizeHandle+" "+e,t.setAttribute(r.dataDirection,e),t})),this.contentDOM=n}return e.prototype.update=function(e){var t=this;if(e.type!==this.node.type)return!1;var n=this.node;return this.node=e,e.attrs[r.resizableAttr]?this.resizeHandles.forEach((function(e){t.dom.appendChild(e)})):Array.from(this.dom.children).filter((function(e){return e.classList.contains(r.resizeHandle)})).forEach((function(e){return e.remove()})),this.setAttributes(this.table,e.attrs),n.attrs[r.colgroupAttr]!==e.attrs[r.colgroupAttr]&&this.renderColgroup(e.attrs[r.colgroupAttr]),!0},e.prototype.ignoreMutation=function(e){return"attributes"===e.type&&(e.target===this.table||e.target.firstChild===this.table||this.colgroup&&this.colgroup.contains(e.target))},e.prototype.destroy=function(){this.node=null,this.view=null,this.table=null,this.colgroup=null,this.resizeHandles=null},e.prototype.renderColgroup=function(e){this.table&&this.table.firstChild&&"COLGROUP"===this.table.firstChild.nodeName&&this.table.removeChild(this.table.firstChild),e&&(this.colgroup=o.parseStrColgroup(e),this.table.insertBefore(this.colgroup,this.table.firstChild))},e.prototype.setAttributes=function(e,t){var n=[r.colgroupAttr,r.resizableAttr];for(var o in t)if(o&&-1===n.indexOf(o)){var i=e.getAttribute(o),s=t[o];s&&s!==i?e.setAttribute(o,s):s||e.removeAttribute(o)}},e}();t.TableView=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4),o=n(1),i=n(6),s=n(15);var a={southeast:{x:1,y:1},east:{x:1,y:0},south:{x:0,y:1},north:{x:0,y:-1},west:{x:-1,y:0},southwest:{x:-1,y:1},northwest:{x:-1,y:-1},northeast:{x:1,y:-1}},l={southeast:!0,southwest:!0,northwest:!0,northeast:!0},c=r.__assign({east:!0,west:!0},l),u=r.__assign({south:!0,north:!0},l),d=function(e,t,n){e.style[t]=n+"px"},p=function(){function e(e,t,n){this.activeHandle=e,this.dragging=t,this.nodePosition=n}return e.prototype.apply=function(t){var n=t.getMeta(s.tableResizeKey);return n?new e(n.activeHandle,n.setDragging,n.nodePosition):this},e}(),f=function(e){var t=Array.from(e.firstChild.children).map((function(e){return e.offsetWidth}));return{width:t.reduce((function(e,t){return e+t}),0),height:e.offsetHeight,colsWidth:t,offsetWidth:e.offsetWidth}},h=function(e){var t=s.tableResizeKey.getState(e.state),n=t.dragging,o=t.nodePosition,a=t.activeHandle;if(n){var l=e.state.doc.nodeAt(o),d=s.getTable(e.nodeDOM(o)),p=f(d);if(l){var h=p.offsetWidth+"px",m=p.height+"px",v=e.state.tr,g=l.attrs,y=s.parseStyle(g.style);c[a]&&d.style.width&&y.width!==h&&(g=s.setNodeStyle(g,"width",h)),u[a]&&d.style.height&&y.height!==m&&(g=s.setNodeStyle(g,"height",m)),function(e,t,n,o){var a=e.state.doc.nodeAt(n),l=s.getTable(e.nodeDOM(n)),c=Array.from(l.rows);a.forEach((function(e,r,o){var i=s.parseStyle(e.attrs.style).height;i&&!/px$/.test(i)&&t.setNodeMarkup(n+r+1,null,s.setNodeStyle(e.attrs,"height",c[o].offsetHeight+"px"))}));var u=l.firstChild,d=Array.from(u&&u.children||[]),p=!1;d.forEach((function(e,t){e.style.width&&!/px$/.test(e.style.width)&&(e.style.width=d[t].offsetWidth+"px",p=!0)}));var f=r.__assign({},o);p&&(f[i.colgroupAttr]=u.outerHTML)}(e,v,o,g),v.setNodeMarkup(o,null,g),v.setMeta("commandName","node-resize"),v.setMeta("args",g),v.setMeta(s.tableResizeKey,{setDragging:null,activeHandle:null,nodePosition:o}),e.dispatch(v)}}},m=function(e,t,n){var r=t.target.getAttribute(i.dataDirection);if(!r)return!1;var o=s.tableResizeKey.getState(e.state);t.preventDefault();var l=e.state.tr;l.setMeta(s.tableResizeKey,{setDragging:{startX:t.clientX,startY:t.clientY},activeHandle:r,nodePosition:o.nodePosition}),l.setMeta("addToHistory",!1),function(e,t,n){var r=e.state.doc.nodeAt(n),o=s.getTable(e.nodeDOM(n)),a=f(o),l=a.width,c=a.height,u=a.colsWidth,d=o.firstChild,p=Array.from(d&&d.children||[]),h=!1;p.forEach((function(e,t){e.style.width&&!/%$/.test(e.style.width)&&(e.style.width=100*u[t]/l+"%",h=!0)}));var m=Array.from(o.rows),v=!1;r.forEach((function(e,r,o){var i=s.parseStyle(e.attrs.style).height;i&&!/%$/.test(i)&&(t.setNodeMarkup(n+r+1,null,s.setNodeStyle(e.attrs,"height",100*m[o].offsetHeight/c+"%")),v=!0)}));var g=r.attrs;s.parseStyle(g.style).width!==l+"px"&&(g=s.setNodeStyle(g,"width",l+"px")),h&&(g[i.colgroupAttr]=d.outerHTML),v&&(g=s.setNodeStyle(g,"height",c+"px")),(h||v)&&t.setNodeMarkup(n,null,g)}(e,l,o.nodePosition),e.dispatch(l);var p=t.view||window;function m(t){!function(e,t,n){var r=s.tableResizeKey.getState(e.state),o=r.dragging,i=r.nodePosition,l=r.activeHandle;if(!(i<0)&&o){var p=s.getTable(e.nodeDOM(i)),f=p.getBoundingClientRect(),h=a[l],m=(t.clientX-o.startX)*h.x,v=(t.clientY-o.startY)*h.y,g=p.offsetWidth,y=p.offsetHeight,w=h.x?m+g:f.width,b=h.y?v+y:f.height;if(n.lockRatio&&h.x&&h.y){var S=Math.min(w/g,b/y),k=g*S,x=y*S;o.startX=t.clientX-(w-k)*h.x,o.startY=t.clientY-(b-x)*h.y,w=k,b=x}else o.startX=h.x?t.clientX:o.startX,o.startY=h.y?t.clientY:o.startY;c[l]&&d(p,"width",w),u[l]&&d(p,"height",b)}}(e,t,n)}return p.addEventListener("mouseup",(function t(n){p.removeEventListener("mouseup",t),p.removeEventListener("mousemove",m),h(e)})),p.addEventListener("mousemove",m),!0};t.tableResizing=function(e){return void 0===e&&(e={node:"table",lockRatio:!1}),new o.Plugin({key:s.tableResizeKey,view:function(t){return{selectedNode:function(e,t){var n=e.selection;if(n instanceof o.NodeSelection&&t===n.node.type&&n instanceof o.NodeSelection)return{node:n.node,pos:n.from};var r=function(e,t){for(var n=e.depth;n>0;n--){var r=e.node(n);if(t(r))return r}return null}(n.$from,(function(e){return e.type===t}));if(r){var i=new Array(n.$from.depth+1).fill(0).findIndex((function(e,t){return"table"===n.$from.node(t).type.spec.tableRole}));return{node:r,pos:n.$from.start(i)-1}}return null},update:function(t,n){var o,a,l,c,u=t.state,d=u.schema.nodes[e.node],p=this.selectedNode(u,d),f=this.selectedNode(n,d);if((p||!f||n.doc.eq(t.state.doc))&&(p||f)){var h=u.tr;p&&f&&p.pos!==f.pos?(h.setMeta(s.tableResizeKey,{nodePosition:p.pos}),h.setNodeMarkup(f.pos,d,r.__assign({},f.node.attrs,((o={})[i.resizableAttr]=!1,o))),h.setNodeMarkup(p.pos,d,r.__assign({},p.node.attrs,((a={})[i.resizableAttr]=!0,a))),t.dispatch(h)):p&&!f?(h.setMeta(s.tableResizeKey,{nodePosition:p.pos}),t.dispatch(h.setNodeMarkup(p.pos,d,r.__assign({},p.node.attrs,((l={})[i.resizableAttr]=!0,l))))):!p&&f&&(h.setMeta(s.tableResizeKey,{nodePosition:-1}),t.dispatch(h.setNodeMarkup(f.pos,d,r.__assign({},f.node.attrs,((c={})[i.resizableAttr]=!1,c)))))}}}},state:{init:function(){return new p("",null,-1)},apply:function(e,t){return t.apply(e)}},props:{handleDOMEvents:{mousedown:function(t,n){return m(t,n,e)}}}})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(8),i=n(3),s=n(15),a=function(){function e(){}return e.prototype.ignoreMutation=function(e){return"attributes"===e.type&&"style"===e.attributeName&&"TR"===e.target.nodeName},e}();t.rowResizing=function(){return new r.Plugin({key:s.tableRowResizing,state:{init:function(e,t){return this.spec.props.nodeViews[o.tableNodeTypes(t.schema).row.name]=function(e,t){return new a},new l(-1,null)},apply:function(e,t){return t.apply(e)}},props:{attributes:function(e){return s.otherResizeHandle(s.tableRowResizing,e)?null:s.tableRowResizing.getState(e).activeHandle>-1?{class:"resize-cursor-vertical"}:null},handleDOMEvents:{mousemove:function(e,t){return s.otherResizing(s.tableRowResizing,e.state)||function(e,t,n,r,o){var i=s.tableRowResizing.getState(e.state);if(!i.dragging){var a=function(e){for(;e&&"TD"!==e.nodeName&&"TH"!==e.nodeName;)e=e.classList.contains("ProseMirror")?null:e.parentNode;return e}(t.target),l=-1;if(a){var u=a.parentNode.getBoundingClientRect();t.clientY-u.top<=n?l=c(e,t,"up"):u.bottom-t.clientY<=n&&(l=c(e,t,"down"))}l!==i.activeHandle&&d(e,l)}}(e,t,5),!1},mouseleave:function(e){return function(e){var t=s.tableRowResizing.getState(e.state);t.activeHandle>-1&&!t.dragging&&d(e,-1)}(e),!1},mousedown:function(e,t){return function(e,t,n){var r=s.tableRowResizing.getState(e.state);if(-1===r.activeHandle||r.dragging)return!1;var o=e.state.doc,i=o.resolve(r.activeHandle),a=o.nodeAt(r.activeHandle),l=i.parent,c=s.parseStyle(a.attrs.style).height,d=s.parseStyle(l.attrs.style).height,p=c?parseFloat(c):0;if(!c){var f=e.nodeDOM(r.activeHandle);p=f.offsetHeight}function h(t){t.view.removeEventListener("mouseup",h),t.view.removeEventListener("mousemove",m);var r=s.tableRowResizing.getState(e.state);if(r.dragging){var o=e.state.tr.setMeta(s.tableRowResizing,{setDragging:null});!function(e,t,n,r){var o=e.state.doc,i=o.nodeAt(n);t.setNodeMarkup(n,null,s.setNodeStyle(i.attrs,"height",r+"px"));var a=e.nodeDOM(n),l=a&&a.closest("table"),c=l&&l.style.height;if(c){var u=o.resolve(n),d=u.start(u.depth)-1;t.setNodeMarkup(d,null,s.setNodeStyle(u.parent.attrs,"height",c))}}(e,o,r.activeHandle,u(r.dragging,t,n)),e.dispatch(o)}}function m(t){if(!t.which)return h(t);var r=s.tableRowResizing.getState(e.state),o=u(r.dragging,t,n),i=t.clientY-r.dragging.startY;!function(e,t,n,r,o,i){var s=e.nodeDOM(t);if(s){s.style.height=Math.max(n,r)+"px";var a=s.closest("table"),l=parseFloat(i)+o+"px",c=a&&a.style.height;c&&c!==l&&(a.style.height=parseFloat(i)+o+"px")}}(e,r.activeHandle,o,n,i,d)}return e.dispatch(e.state.tr.setMeta(s.tableRowResizing,{setDragging:{startY:t.clientY,startHeight:{rowHeight:p,tableHeight:d}}})),t.view.addEventListener("mouseup",h),t.view.addEventListener("mousemove",m),t.preventDefault(),!0}(e,t,25)}},decorations:function(e){if(s.otherResizing(s.tableRowResizing,e))return i.DecorationSet.empty;var t=s.tableRowResizing.getState(e);return t.activeHandle>-1?function(e,t){var n=[];if("number"!=typeof t)return;for(var r=e.doc.resolve(t),s=r.parent,a=o.TableMap.get(s),l=r.index(r.depth),c=r.start(r.depth),u=0;u<a.width;u++){var d=u+l*a.width,p=a.map[d],f=c+p+s.nodeAt(p).nodeSize-1,h=document.createElement("div");h.className="row-resize-handle",n.push(i.Decoration.widget(f,h))}return i.DecorationSet.create(e.doc,n)}(e,t.activeHandle):void 0},nodeViews:{}}})};var l=function(){function e(e,t){this.activeHandle=e,this.dragging=t}return e.prototype.apply=function(t){var n,r=this,o=t.getMeta(s.tableRowResizing);if(o&&null!=o.setHandle)return new e(o.setHandle,null);if(o&&void 0!==o.setDragging)return new e(r.activeHandle,o.setDragging);if(r.activeHandle>-1){var i=t.mapping.map(r.activeHandle,-1);"row"===(n=t.doc.resolve(i)).parent.type.spec.tableRole&&n.nodeAfter||(i=null),r=new e(i,r.dragging)}return r},e}();function c(e,t,n){var r=e.posAtCoords({left:t.clientX,top:t.clientY});if(!r)return-1;var o=r.pos,i=e.state.doc.resolve(o),s=new Array(i.depth+1).fill(0).findIndex((function(e,t){return"row"===i.node(t).type.spec.tableRole}));if(-1===s)return-1;var a=s-1,l=i.index(a);return(l+="up"===n?-1:0)<0?-1:i.posAtIndex(l,a)}function u(e,t,n){var r=t.clientY-e.startY;return Math.max(n,e.startHeight.rowHeight+r)}function d(e,t){e.dispatch(e.state.tr.setMeta(s.tableRowResizing,{setHandle:t}))}},function(e,t,n){"use strict";n.r(t),n.d(t,"dropCursor",(function(){return i}));var r=n(1),o=n(2);function i(e){return void 0===e&&(e={}),new r.Plugin({view:function(t){return new s(t,e)}})}var s=function(e,t){var n=this;this.editorView=e,this.width=t.width||1,this.color=t.color||"black",this.class=t.class,this.cursorPos=null,this.element=null,this.timeout=null,this.handlers=["dragover","dragend","drop","dragleave"].map((function(t){var r=function(e){return n[t](e)};return e.dom.addEventListener(t,r),{name:t,handler:r}}))};s.prototype.destroy=function(){var e=this;this.handlers.forEach((function(t){var n=t.name,r=t.handler;return e.editorView.dom.removeEventListener(n,r)}))},s.prototype.update=function(e,t){null!=this.cursorPos&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())},s.prototype.setCursor=function(e){e!=this.cursorPos&&(this.cursorPos=e,null==e?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())},s.prototype.updateOverlay=function(){var e,t=this.editorView.state.doc.resolve(this.cursorPos);if(!t.parent.inlineContent){var n=t.nodeBefore,r=t.nodeAfter;if(n||r){var o=this.editorView.nodeDOM(this.cursorPos-(n?n.nodeSize:0)).getBoundingClientRect(),i=n?o.bottom:o.top;n&&r&&(i=(i+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),e={left:o.left,right:o.right,top:i-this.width/2,bottom:i+this.width/2}}}if(!e){var s=this.editorView.coordsAtPos(this.cursorPos);e={left:s.left-this.width/2,right:s.left+this.width/2,top:s.top,bottom:s.bottom}}var a,l,c=this.editorView.dom.offsetParent;if(this.element||(this.element=c.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),!c||c==document.body&&"static"==getComputedStyle(c).position)a=-pageXOffset,l=-pageYOffset;else{var u=c.getBoundingClientRect();a=u.left-c.scrollLeft,l=u.top-c.scrollTop}this.element.style.left=e.left-a+"px",this.element.style.top=e.top-l+"px",this.element.style.width=e.right-e.left+"px",this.element.style.height=e.bottom-e.top+"px"},s.prototype.scheduleRemoval=function(e){var t=this;clearTimeout(this.timeout),this.timeout=setTimeout((function(){return t.setCursor(null)}),e)},s.prototype.dragover=function(e){if(this.editorView.editable){var 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):r;if(t&&!i){var s=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice&&null==(s=Object(o.dropPoint)(this.editorView.state.doc,s,this.editorView.dragging.slice)))return this.setCursor(null);this.setCursor(s),this.scheduleRemoval(5e3)}}},s.prototype.dragend=function(){this.scheduleRemoval(20)},s.prototype.drop=function(){this.scheduleRemoval(20)},s.prototype.dragleave=function(e){e.target!=this.editorView.dom&&this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}},function(e,t,n){"use strict";n.r(t),n.d(t,"GapCursor",(function(){return a})),n.d(t,"gapCursor",(function(){return c}));var r=n(9),o=n(1),i=n(0),s=n(3),a=function(e){function t(t){e.call(this,t,t)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.map=function(n,r){var o=n.resolve(r.map(this.head));return t.valid(o)?new t(o):e.near(o)},t.prototype.content=function(){return i.Slice.empty},t.prototype.eq=function(e){return e instanceof t&&e.head==this.head},t.prototype.toJSON=function(){return{type:"gapcursor",pos:this.head}},t.fromJSON=function(e,n){if("number"!=typeof n.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new t(e.resolve(n.pos))},t.prototype.getBookmark=function(){return new l(this.anchor)},t.valid=function(e){var t=e.parent;if(t.isTextblock||!function(e){for(var t=e.depth;t>=0;t--){var n=e.index(t),r=e.node(t);if(0!=n)for(var o=r.child(n-1);;o=o.lastChild){if(0==o.childCount&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(e)||!function(e){for(var t=e.depth;t>=0;t--){var n=e.indexAfter(t),r=e.node(t);if(n!=r.childCount)for(var o=r.child(n);;o=o.firstChild){if(0==o.childCount&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(e))return!1;var n=t.type.spec.allowGapCursor;if(null!=n)return n;var r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock},t.findFrom=function(e,n,r){e:for(;;){if(!r&&t.valid(e))return e;for(var i=e.pos,s=null,a=e.depth;;a--){var l=e.node(a);if(n>0?e.indexAfter(a)<l.childCount:e.index(a)>0){s=l.child(n>0?e.indexAfter(a):e.index(a)-1);break}if(0==a)return null;i+=n;var c=e.doc.resolve(i);if(t.valid(c))return c}for(;;){var u=n>0?s.firstChild:s.lastChild;if(!u){if(s.isAtom&&!s.isText&&!o.NodeSelection.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*n),r=!1;continue e}break}s=u,i+=n;var d=e.doc.resolve(i);if(t.valid(d))return d}return null}},t}(o.Selection);a.prototype.visible=!1,o.Selection.jsonID("gapcursor",a);var l=function(e){this.pos=e};l.prototype.map=function(e){return new l(e.map(this.pos))},l.prototype.resolve=function(e){var t=e.resolve(this.pos);return a.valid(t)?new a(t):o.Selection.near(t)};var c=function(){return new o.Plugin({props:{decorations:h,createSelectionBetween:function(e,t,n){if(t.pos==n.pos&&a.valid(n))return new a(n)},handleClick:p,handleKeyDown:u,handleDOMEvents:{beforeinput:f}}})},u=Object(r.keydownHandler)({ArrowLeft:d("horiz",-1),ArrowRight:d("horiz",1),ArrowUp:d("vert",-1),ArrowDown:d("vert",1)});function d(e,t){var n="vert"==e?t>0?"down":"up":t>0?"right":"left";return function(e,r,i){var s=e.selection,l=t>0?s.$to:s.$from,c=s.empty;if(s instanceof o.TextSelection){if(!i.endOfTextblock(n)||0==l.depth)return!1;c=!1,l=e.doc.resolve(t>0?l.after():l.before())}var u=a.findFrom(l,t,c);return!!u&&(r&&r(e.tr.setSelection(new a(u))),!0)}}function p(e,t,n){if(!e.editable)return!1;var r=e.state.doc.resolve(t);if(!a.valid(r))return!1;var i=e.posAtCoords({left:n.clientX,top:n.clientY}).inside;return!(i>-1&&o.NodeSelection.isSelectable(e.state.doc.nodeAt(i)))&&(e.dispatch(e.state.tr.setSelection(new a(r))),!0)}function f(e,t){if("insertCompositionText"!=t.inputType||!(e.state.selection instanceof a))return!1;var n=e.state.selection.$from,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;for(var s=i.Fragment.empty,l=r.length-1;l>=0;l--)s=i.Fragment.from(r[l].createAndFill(null,s));var c=e.state.tr.replace(n.pos,n.pos,new i.Slice(s,0,0));return c.setSelection(o.TextSelection.near(c.doc.resolve(n.pos+1))),e.dispatch(c),!1}function h(e){if(!(e.selection instanceof a))return null;var t=document.createElement("div");return t.className="ProseMirror-gapcursor",s.DecorationSet.create(e.doc,[s.Decoration.widget(e.selection.head,t,{key:"gapcursor"})])}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(8);t.pmAddRowAfter=r.addRowAfter,t.pmAddRowBefore=r.addRowBefore;var o=n(6);t.createTable=function(e,t,n){for(var r,o=e.table,i=e.table_row,s=e.table_cell,a=[],l=0;l<t+1;l++){r=[];for(var c=0;c<n+1;c++)r.push(s.createAndFill());a.push(i.createAndFill(void 0,r))}return o.createAndFill(void 0,a)};var i=function(e,t){for(var n=e.$head,r=n.depth;r>0;r--){var o=n.node(r);if(o.type.name===t)return{pos:n.before(r),node:o}}return null};t.addRowBefore=function(e,t){var n=t&&function(e){var n,r=i(e.selection,"table_row"),s=i(e.selection,"table");if(r&&s&&r.node.attrs[o.rowTypeAttr]){for(var a=0,l=0;l<s.node.nodeSize;l++)if(s.node.child(l).eq(r.node)){a=l;break}var c=s.node.child(a-1),u=r.pos-c.nodeSize;e.setNodeMarkup(u,void 0,((n={})[o.rowTypeAttr]=r.node.attrs[o.rowTypeAttr],n))}return t(e)};return r.addRowBefore(e,n)},t.addRowAfter=function(e,t){var n=t&&function(e){var n,r=i(e.selection,"table_row");if(r&&r.node.attrs[o.rowTypeAttr]){var s=r.pos+r.node.nodeSize;e.setNodeMarkup(s,void 0,((n={})[o.rowTypeAttr]=r.node.attrs[o.rowTypeAttr],n))}return t(e)};return r.addRowAfter(e,n)}}])}));
|