@progress/kendo-editor-common 1.8.2-dev.202203141106 → 1.8.2-dev.202203171113
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.
|
@@ -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];$.Home=N,$.End=A;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(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)}}])}));
|