text: /*!
   * tui-editor
   * @version 1.0.1
   * @author NHN Ent. FE Development Lab <dl_javascript@nhnent.com> (https://nhnent.github.io/tui.editor/)
   * @license MIT
   */
  !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("jquery"),require("tui-code-snippet"),require("codemirror"),require("markdown-it"),require("toMark"),require("highlight.js"),require("squire-rte")):"function"==typeof define&&define.amd?define(["jquery","tui-code-snippet","codemirror","markdown-it","toMark","highlight.js","squire-rte"],t):"object"==typeof exports?exports.Editor=t(require("jquery"),require("tui-code-snippet"),require("codemirror"),require("markdown-it"),require("toMark"),require("highlight.js"),require("squire-rte")):(e.tui=e.tui||{},e.tui.Editor=t(e.$,e.tui&&e.tui.util,e.CodeMirror,e.markdownit,e.toMark,e.hljs,e.Squire))}("undefined"!=typeof self?self:this,function(e,t,n,i,a,o,r){return function(e){function t(i){if(n[i])return n[i].exports;var a=n[i]={i:i,l:!1,exports:{}};return e[i].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,i){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="dist/",t(t.s=38)}([function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),l=i(r),s=n(1),u=i(s),c=n(17),d=i(c),f=/Mac/.test(navigator.platform),h=f?1:0,g=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};a(this,e),this._command=new u.default.Map,this._mdCommand=new u.default.Map,this._wwCommand=new u.default.Map,this._options=l.default.extend({useCommandShortcut:!0},n),this.base=t,this.keyMapCommand={},this._initEvent()}return o(e,[{key:"_addCommandBefore",value:function(e){var t={command:e};return this.base.eventManager.emit("addCommandBefore",t),t.command||e}},{key:"addCommand",value:function(t){for(var n=arguments.length,i=Array(n>1?n-1:0),a=1;a<n;a++)i[a-1]=arguments[a];i.length&&(t=e.command.apply(e,[t].concat(i))),t=this._addCommandBefore(t);var o=t.getName(),r=void 0;return t.isMDType()?r=this._mdCommand:t.isWWType()?r=this._wwCommand:t.isGlobalType()&&(r=this._command),r.set(o,t),t.keyMap&&(this.keyMapCommand[t.keyMap[h]]=o),t}},{key:"_initEvent",value:function(){var e=this;this.base.eventManager.listen("command",function(){e.exec.apply(e,arguments)}),this.base.eventManager.listen("keyMap",function(t){if(e._options.useCommandShortcut){var n=e.keyMapCommand[t.keyMap];n&&(t.data.preventDefault(),e.exec(n))}})}},{key:"exec",value:function(e){var t=void 0,n=void 0,i=this.base;if(t=this._command.get(e),t||(this.base.isMarkdownMode()?(t=this._mdCommand.get(e),i=this.base.mdEditor):(t=this._wwCommand.get(e),i=this.base.wwEditor)),t){for(var a,o=arguments.length,r=Array(o>1?o-1:0),l=1;l<o;l++)r[l-1]=arguments[l];r.unshift(i),n=(a=t).exec.apply(a,r)}return n}}]),e}();g.command=function(e,t){var n=d.default.factory(e,t.name,t.keyMap);return u.default.extend(n,t),n},t.default=g},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),o=i(a),r=n(1),l=i(r),s=/\u200B/g,u=function(e){return e&&e.nodeType===Node.TEXT_NODE},c=function(e){return e&&e.nodeType===Node.ELEMENT_NODE},d=function(e){return c(e)?e.tagName:"TEXT"},f=function(e){var t=void 0;return c(e)?t=e.textContent.replace(s,"").length:u(e)&&(t=e.nodeValue.replace(s,"").length),t},h=function(e){var t=void 0;return c(e)?t=e.childNodes.length:u(e)&&(t=e.nodeValue.replace(s,"").length),t},g=function(e){var t=e.parentNode.childNodes,n=void 0,i=void 0,a=void 0;for(n=0,i=t.length;n<i;n+=1)if(t[n]===e){a=n;break}return a},v=function(e,t){var n=void 0;return u(e)?n=e:e.childNodes.length&&t>=0&&(n=e.childNodes[t]),n},p=function(e,t,n){for(var i=e+"Sibling",a=void 0,o=void 0;t&&!t[i]&&(a=d(t.parentNode))!==n&&"BODY"!==a;)t=t.parentNode;return t[i]&&(o=t[i]),o},m=function(e,t,n){return t>0?v(e,t-1):p("previous",e,n)},y=function(e,t){for(var n=void 0;e.parentNode&&!t(e.parentNode);)e=e.parentNode;return t(e.parentNode)&&(n=e),n},_=function(e,t){return l.default.isString(t)?y(e,function(e){return t===d(e)}):y(e,function(e){return t===e})},b=function(e,t,n){var i=e+"Sibling",a=void 0;return t=_(t,n),t&&t[i]&&(a=t[i]),a},k=function(e,t){return b("previous",e,t)},w=function(e,t){return b("next",e,t)},C=function(e){return _(e,"BODY")},E=function(e){for(e=e.previousSibling||e.parentNode;!u(e)&&"BODY"!==d(e);)if(e.previousSibling)for(e=e.previousSibling;e.lastChild;)e=e.lastChild;else e=e.parentNode;return"BODY"===d(e)&&(e=null),e},M=function(e,t,n){var i=[],a="",o=0,r=void 0;if(!t.length)return i;for(var s=t.shift(),u=document.createTreeWalker(e,4,null,!1);u.nextNode();){for(a=u.currentNode.nodeValue||"",n&&(a=n(a)),r=o+a.length;r>=s;){if(i.push({container:u.currentNode,offsetInContainer:s-o,offset:s}),!t.length)return i;s=t.shift()}o=r}do{i.push({container:u.currentNode,offsetInContainer:a.length,offset:s}),s=t.shift()}while(!l.default.isUndefined(s));return i},T=function(e){var t={};t.tagName=e.nodeName,e.id&&(t.id=e.id);var n=e.className.trim();return n&&(t.className=n),t},S=function(e,t){for(var n=[];e&&e!==t;)c(e)&&n.unshift(T(e)),e=e.parentNode;return n},O=function(e,t){var n=!0;return l.default.isUndefined(t)||"next"!==t&&"previous"!==t?null:("previous"===t&&(n=!1),n?e.nextElementSibling:e.previousElementSibling)},L=function(e,t,n){var i=!0,a=null,r=void 0,s=void 0,u=void 0,c=void 0,f=void 0,h=void 0;return l.default.isUndefined(t)||"next"!==t&&"previous"!==t?null:("previous"===t&&(i=!1),e?(r=(0,o.default)(e),i?(u=r.parent().next(),c=r.parents("thead"),f=c[0]&&c.next(),h=f&&"TBODY"===d(f[0]),s=0):(u=r.parent().prev(),c=r.parents("tbody"),f=c[0]&&c.prev(),h=f&&"THEAD"===d(f[0]),s=e.parentNode.childNodes.length-1),!l.default.isUndefined(n)&&n||(s=g(e)),u[0]?a=u.children("td,th")[s]:c[0]&&h&&(a=f.find("td,th")[s]),a):null)};t.default={getNodeName:d,isTextNode:u,isElemNode:c,getTextLength:f,getOffsetLength:h,getPrevOffsetNodeUntil:m,getNodeOffsetOfParent:g,getChildNodeByOffset:v,getTopPrevNodeUnder:k,getTopNextNodeUnder:w,getParentUntil:_,getTopBlockNode:C,getPrevTextNode:E,findOffsetNode:M,getPath:S,getNodeInfo:T,getTableCellByDirection:O,getSiblingRowCellByDirection:L}},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0}),t.I18n=void 0;var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(1),r=function(e){return e&&e.__esModule?e:{default:e}}(o),l=void 0,s="en_US",u=function(){function e(){i(this,e),this._code=s,this._langs=new r.default.Map}return a(e,[{key:"setCode",value:function(e){this._code=e}},{key:"setLanguage",value:function(e,t){var n=this;e=[].concat(e),e.forEach(function(e){if(n._langs.has(e)){var i=n._langs.get(e);n._langs.set(e,r.default.extend(i,t))}else n._langs.set(e,t)})}},{key:"get",value:function(e,t){t||(t=this._code);var n=this._langs.get(t);n||(n=this._langs.get(s));var i=n[e];if(!i)throw new Error('There is no text key "'+e+'" in '+t);return i}}],[{key:"getSharedInstance",value:function(){return l||(l=new e),l}}]),e}();t.I18n=u,t.default=new u},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=n(0),u=i(s),c=n(1),d=i(c),f=n(8),h=i(f),g="tui-popup-",v='<div class="'+g+'header">\n        <span class="'+g+'title"></span>\n        <div class="'+g+'header-buttons">\n            <button type="button" class="'+g+'close-button"></button>\n        </div>\n    </div>\n    <div class="'+g+'body"></div>',p='<div class="'+g+'wrapper">\n        <div class="'+g+'header">\n            <span class="'+g+'title"></span>\n            <div class="'+g+'header-buttons">\n                <button type="button" class="'+g+'close-button"></button>\n            </div>\n        </div>\n        <div class="'+g+'body"></div>\n    </div>',m=function(e){function t(e){a(this,t),e=d.default.extend({header:!0,$target:(0,u.default)("body"),textContent:""},e);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,{tagName:"div",className:e.modal?g+"modal-background":g+"wrapper",rootElement:e.$el}));return n._initInstance(e),n._initDOM(e),n._initDOMEvent(e),n._initEditorEvent(e),n}return r(t,e),l(t,[{key:"_initInstance",value:function(e){this._$target=e.$target,e.$el&&(this.$el=e.$el,this._isExternalHtmlUse=!0),e.content?this.$content=(0,u.default)(e.content):this.$content=e.textContent,this.options=e}},{key:"_initDOM",value:function(){this._initLayout(),this._isExternalHtmlUse||(d.default.isExisty(this.options.title)&&this.setTitle(this.options.title),this.setContent(this.$content));var e=this.options.headerButtons;if(e){this.$el.find("."+g+"close-button").remove();var t=this.$el.find("."+g+"header-buttons");t.empty(),t.append((0,u.default)(e))}this.options.css&&this.$el.css(this.options.css)}},{key:"_initDOMEvent",value:function(){var e=this,t=this.options,n=t.openerCssQuery,i=t.closerCssQuery;n&&(0,u.default)(n).on("click."+this._id,function(){return e.show()}),i&&(0,u.default)(i).on("click."+this._id,function(){return e.hide()}),this.on("click ."+g+"close-button",function(){return e.hide()})}},{key:"_initEditorEvent",value:function(){}},{key:"_initLayout",value:function(){var e=this.options;if(this._isExternalHtmlUse)this.hide(),this._$target.append(this.$el);else{var t=e.modal?p:v;this.$el.html(t),this.$el.addClass(e.className),this.hide(),this._$target.append(this.$el),this.$body=this.$el.find("."+g+"body"),e.header||this.$el.find("."+g+"header").remove()}}},{key:"setContent",value:function(e){this.$body.empty(),this.$body.append(e)}},{key:"setTitle",value:function(e){var t=this.$el.find("."+g+"title");t.empty(),t.append(e)}},{key:"getTitleElement",value:function(){return this.$el.find("."+g+"title").get(0)}},{key:"hide",value:function(){this.$el.css("display","none"),this._isShow=!1,this.trigger("hidden",this)}},{key:"show",value:function(){this.$el.css("display","block"),this._isShow=!0,this.trigger("shown",this)}},{key:"isShow",value:function(){return this._isShow}},{key:"remove",value:function(){var e=this.options,t=e.openerCssQuery,n=e.closerCssQuery;this.trigger("remove",this),this.off(),t&&(0,u.default)(t).off("."+this._id),n&&(0,u.default)(n).off("."+this._id),this.$el.remove()}},{key:"setFitToWindow",value:function(e){this.$el.toggleClass("fit-window",e)}},{key:"isFitToWindow",value:function(){return this.$el.hasClass("fit-window")}},{key:"toggleFitToWindow",value:function(){var e=!this.isFitToWindow();return this.setFitToWindow(e),e}}]),t}(h.default);t.default=m},function(e,t){e.exports=n},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){return e.replace(t?/&/g:/&(?!#?\w+;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}Object.defineProperty(t,"__esModule",{value:!0}),t.CodeBlockManager=void 0;var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(28),l=function(e){return e&&e.__esModule?e:{default:e}}(r),s=function(){function e(){i(this,e),this._replacers={}}return o(e,[{key:"setReplacer",value:function(e,t){this._replacers[e]=t}},{key:"getReplacer",value:function(e){return this._replacers[e]}},{key:"createCodeBlockHtml",value:function(e,t){var n=this.getReplacer(e);return n?n(t,e):l.default.getLanguage(e)?l.default.highlight(e,t).value:a(t,!1)}}],[{key:"getHighlightJSLanguages",value:function(){return l.default.listLanguages()}}]),e}();t.CodeBlockManager=s,t.default=new s},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(){return d+=1}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=n(0),s=i(l),u=n(1),c=i(u),d=-1,f=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,e),t=c.default.extend({tagName:"div"},t),this.tagName=t.tagName,this.className=t.className,this._id=o(),this.$el=null,this._setRootElement(t.rootElement)}return r(e,[{key:"on",value:function(e,t){var n=this;c.default.isObject(e)?c.default.forEach(e,function(e,t){n._addEvent(t,e)}):this._addEvent(e,t)}},{key:"_addEvent",value:function(e,t){var n=this._parseEventType(e),i=n.event,a=n.selector;a?this.$el.on(i,a,t):this.$el.on(i,t)}},{key:"off",value:function(e,t){if(e){var n=this._parseEventType(e),i=n.event,a=n.selector;a?this.$el.off(i,a,t):this.$el.off(i,t)}else this.$el.off()}},{key:"_parseEventType",value:function(e){var t=e.split(" ");return{event:t.shift(),selector:t.join(" ")}}},{key:"_setRootElement",value:function(e){var t=this.tagName,n=this.className;e||(n=n||"uic"+this._id,e=(0,s.default)("<"+t+' class="'+n+'"/>')),this.$el=e}},{key:"trigger",value:function(){var e;(e=this.$el).trigger.apply(e,arguments)}},{key:"_getEventNameWithNamespace",value:function(e){var t=e.split(" ");return t[0]+=".uicEvent"+this._id,t.join(" ")}},{key:"remove",value:function(){this.$el.remove()}},{key:"destroy",value:function(){var e=this;this.remove(),c.default.forEachOwnProperties(this,function(t,n){e[n]=null})}}]),e}();t.default=f},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=function e(t,n,i){null===t&&(t=Function.prototype);var a=Object.getOwnPropertyDescriptor(t,n);if(void 0===a){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in a)return a.value;var r=a.get;if(void 0!==r)return r.call(i)},s=n(10),u=function(e){return e&&e.__esModule?e:{default:e}}(s),c=function(e){function t(e,n,o,r){i(this,t);var l=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,o,r));return l._initEvent(),l}return o(t,e),r(t,[{key:"_initEvent",value:function(){var e=this,t="";this.eventManager.listen("contentChangedFromMarkdown",function(n){t=n.getValue(),e.isVisible()&&e.lazyRunner.run("refresh",t.replace(/<br>\n/g,"<br>"))}),this.eventManager.listen("previewNeedsRefresh",function(n){e.refresh(n||t)}),this.$el.on("scroll",function(t){e.eventManager.emit("scroll",{source:"preview",data:t})})}},{key:"render",value:function(e){l(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"render",this).call(this,e),this.eventManager.emit("previewRenderAfter",this)}}]),t}(u.default);t.default=c},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),l=i(r),s=n(16),u=i(s),c=function(){function e(t,n,i,o){a(this,e),this.eventManager=n,this.convertor=i,this.$el=t,this.isViewer=!!o,this._initContentSection(),this.lazyRunner=new u.default,this.lazyRunner.registerLazyRunFunction("refresh",this.refresh,800,this)}return o(e,[{key:"_initContentSection",value:function(){this._$previewContent=(0,l.default)('<div class="tui-editor-contents" />'),this.$el.append(this._$previewContent)}},{key:"refresh",value:function(e){this.render(this.convertor.toHTMLWithCodeHightlight(e))}},{key:"getHTML",value:function(){return this._$previewContent.html()}},{key:"setHTML",value:function(e){this._$previewContent.html(e)}},{key:"render",value:function(e){var t=this._$previewContent;e=this.eventManager.emit("previewBeforeHook",e)||e,t.empty(),t.html(e)}},{key:"setHeight",value:function(e){this.$el.get(0).style.height=e+"px"}},{key:"setMinHeight",value:function(e){this.$el.get(0).style.minHeight=e+"px"}},{key:"isVisible",value:function(){return"none"!==this.$el.css("display")}}]),e}();t.default=c},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){var n=(0,u.default)("<div />");return e=e.replace(/<!--[\s\S]*?-->/g,""),n.append(e),o(n),r(n),l(n,t)}function o(e){e.find("script, iframe, textarea, form, button, select, meta, style, link, title").remove()}function r(e){e.find("*").each(function(e,t){var n=t.attributes,i=d.default.toArray(n).filter(function(e){var t=e.name.match(f),n=e.name.match(h);return!t&&!n});d.default.forEachArray(i,function(e){n.getNamedItem(e.name)&&n.removeNamedItem(e.name)})})}function l(e,t){var n=void 0;if(t)n=e[0].innerHTML;else{for(var i=document.createDocumentFragment(),a=d.default.toArray(e[0].childNodes),o=a.length,r=0;r<o;r+=1)i.appendChild(a[r]);n=i}return n}Object.defineProperty(t,"__esModule",{value:!0});var s=n(0),u=i(s),c=n(1),d=i(c),f=new RegExp("^(abbr|align|alt|axis|bgcolor|border|cellpadding|cellspacing|class|clear|color|cols|compact|coords|dir|face|headers|height|hreflang|hspace|ismap|lang|language|nohref|nowrap|rel|rev|rows|rules|scope|scrolling|shape|size|span|start|summary|tabindex|target|title|type|valign|value|vspace|width|checked|mathvariant|encoding|id|name|background|cite|href|longdesc|src|usemap|xlink:href|data-+|checked|style)","g"),h=new RegExp("^(accent-height|accumulate|additive|alphabetic|arabic-form|ascent|baseProfile|bbox|begin|by|calcMode|cap-height|class|color|color-rendering|content|cx|cy|d|dx|dy|descent|display|dur|end|fill|fill-rule|font-family|font-size|font-stretch|font-style|font-variant|font-weight|from|fx|fy|g1|g2|glyph-name|gradientUnits|hanging|height|horiz-adv-x|horiz-origin-x|ideographic|k|keyPoints|keySplines|keyTimes|lang|marker-end|marker-mid|marker-start|markerHeight|markerUnits|markerWidth|mathematical|max|min|offset|opacity|orient|origin|overline-position|overline-thickness|panose-1|path|pathLength|points|preserveAspectRatio|r|refX|refY|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|rotate|rx|ry|slope|stemh|stemv|stop-color|stop-opacity|strikethrough-position|strikethrough-thickness|stroke|stroke-dasharray|stroke-dashoffset|stroke-linecap|stroke-linejoin|stroke-miterlimit|stroke-opacity|stroke-width|systemLanguage|target|text-anchor|to|transform|type|u1|u2|underline-position|underline-thickness|unicode|unicode-range|units-per-em|values|version|viewBox|visibility|width|widths|x|x-height|x1|x2|xlink:actuate|xlink:arcrole|xlink:role|xlink:show|xlink:title|xlink:type|xml:base|xml:lang|xml:space|xmlns|xmlns:xlink|y|y1|y2|zoomAndPan)","g");t.default=a},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(1),r=function(e){return e&&e.__esModule?e:{default:e}}(o),l=["previewBeforeHook","previewRenderAfter","previewNeedsRefresh","addImageBlobHook","setMarkdownAfter","contentChangedFromWysiwyg","changeFromWysiwyg","contentChangedFromMarkdown","changeFromMarkdown","change","changeModeToWysiwyg","changeModeToMarkdown","changeModeBefore","changeMode","changePreviewStyle","openPopupAddLink","openPopupAddImage","openPopupAddTable","openPopupTableUtils","openHeadingSelect","openPopupCodeBlockLanguages","openPopupCodeBlockEditor","closePopupCodeBlockLanguages","closePopupCodeBlockEditor","closeAllPopup","command","addCommandBefore","htmlUpdate","markdownUpdate","renderedHtmlUpdated","removeEditor","convertorAfterMarkdownToHtmlConverted","convertorBeforeHtmlToMarkdownConverted","convertorAfterHtmlToMarkdownConverted","stateChange","wysiwygSetValueAfter","wysiwygSetValueBefore","wysiwygGetValueBefore","wysiwygProcessHTMLText","wysiwygRangeChangeAfter","wysiwygKeyEvent","scroll","click","mousedown","mouseover","mouseout","mouseup","contextmenu","keydown","keyup","keyMap","load","focus","blur","paste","pasteBefore","willPaste","copy","copyBefore","copyAfter","cut","cutAfter","drop","show","hide"],s=function(){function e(){i(this,e),this.events=new r.default.Map,this.TYPE=new r.default.Enum(l)}return a(e,[{key:"listen",value:function(e,t){var n=this._getTypeInfo(e),i=this.events.get(n.type)||[];if(!this._hasEventType(n.type))throw new Error("There is no event type "+n.type);n.namespace&&(t.namespace=n.namespace),i.push(t),this.events.set(n.type,i)}},{key:"emit",value:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var i=t.shift(),a=this._getTypeInfo(i),o=this.events.get(a.type),l=void 0;return o&&r.default.forEach(o,function(e){var n=e.apply(void 0,t);r.default.isUndefined(n)||(l=l||[],l.push(n))}),l}},{key:"emitReduce",value:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var i=t.shift(),a=this.events.get(i);return a&&r.default.forEach(a,function(e){var n=e.apply(void 0,t);r.default.isFalsy(n)||(t[0]=n)}),t[0]}},{key:"_getTypeInfo",value:function(e){var t=e.split(".");return{type:t[0],namespace:t[1]}}},{key:"_hasEventType",value:function(e){return!r.default.isUndefined(this.TYPE[this._getTypeInfo(e).type])}},{key:"addEventType",value:function(e){if(this._hasEventType(e))throw new Error("There is already have event type "+e);this.TYPE.set(e)}},{key:"removeEventHandler",value:function(e,t){var n=this,i=this._getTypeInfo(e),a=i.type,o=i.namespace;a&&t?this._removeEventHandlerWithHandler(a,t):a&&!o?this.events.delete(a):!a&&o?this.events.forEach(function(e,t){n._removeEventHandlerWithTypeInfo(t,o)}):a&&o&&this._removeEventHandlerWithTypeInfo(a,o)}},{key:"_removeEventHandlerWithHandler",value:function(e,t){var n=this.events.get(e)||[],i=n.indexOf(t);i>=0&&n.splice(i,1)}},{key:"_removeEventHandlerWithTypeInfo",value:function(e,t){var n=[],i=this.events.get(e);i&&(i.map(function(e){e.namespace!==t&&n.push(e)}),this.events.set(e,n))}}]),e}();t.default=s},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(1),r=function(e){return e&&e.__esModule?e:{default:e}}(o),l=function(){function e(){i(this,e),this.exts=new r.default.Map}return a(e,[{key:"defineExtension",value:function(e,t){this.exts.set(e,t)}},{key:"applyExtension",value:function(e,t){var n=this;t&&t.forEach(function(t){var i=r.default.isObject(t),a=i?t.name:t;if(n.exts.has(a)){var o=n.exts.get(a);i?o(e,t):o(e)}})}}]),e}();t.default=new l},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),l=i(r),s=n(1),u=i(s),c=n(19),d=i(c),f=n(20),h=i(f),g=n(11),v=i(g),p=n(21),m=i(p),y=n(22),_=i(y),b=n(23),k=i(b),w=n(24),C=i(w),E=n(25),M=i(E),T=n(26),S=i(T),O=n(27),L=i(O),B=n(7),N=i(B),x=new d.default({html:!0,breaks:!0,quotes:"“”‘’",langPrefix:"lang-",highlight:function(e,t){return N.default.createCodeBlockHtml(t,e)}}),P=new d.default({html:!0,breaks:!0,quotes:"“”‘’",langPrefix:"lang-"});x.block.ruler.at("code",k.default),x.block.ruler.at("table",M.default,{alt:["paragraph","reference"]}),x.block.ruler.at("blockquote",C.default,{alt:["paragraph","reference","blockquote","list"]}),x.block.ruler.at("html_block",S.default,{alt:["paragraph","reference","blockquote"]}),x.inline.ruler.at("backticks",L.default),x.use(m.default),x.use(_.default),P.block.ruler.at("code",k.default),P.block.ruler.at("table",M.default,{alt:["paragraph","reference"]}),P.block.ruler.at("blockquote",C.default,{alt:["paragraph","reference","blockquote","list"]}),P.block.ruler.at("html_block",S.default,{alt:["paragraph","reference","blockquote"]}),P.inline.ruler.at("backticks",L.default),P.use(m.default),P.use(_.default);var A=function(){function e(t){a(this,e),this.eventManager=t}return o(e,[{key:"_markdownToHtmlWithCodeHighlight",value:function(e){e=e.replace(/<br>/gi,"<br data-tomark-pass>");for(var t=/(<img[^>]*)(onerror\s*=\s*[\"']?[^\"']*[\"']?)(.*)/i;t.exec(e);)e=e.replace(t,"$1$3");var n=x.render(e);return n=this._removeBrToMarkPassAttributeInCode(n)}},{key:"_markdownToHtml",value:function(e){e=e.replace(/<br>/gi,"<br data-tomark-pass>");for(var t=/(<img[^>]*)(onerror\s*=\s*[\"']?[^\"']*[\"']?)(.*)/i;t.exec(e);)e=e.replace(t,"$1$3");var n=P.render(e);return n=this._removeBrToMarkPassAttributeInCode(n)}},{key:"_removeBrToMarkPassAttributeInCode",value:function(e){var t=(0,l.default)("<div />");return t.html(e),t.find("code, pre").each(function(e,t){var n=(0,l.default)(t);n.html(n.html().replace(/&lt;br data-tomark-pass&gt;/,"&lt;br&gt;"))}),e=t.html()}},{key:"toHTMLWithCodeHightlight",value:function(e){var t=this._markdownToHtmlWithCodeHighlight(e);return t=this.eventManager.emitReduce("convertorAfterMarkdownToHtmlConverted",t)}},{key:"toHTML",value:function(e){var t=this._markdownToHtml(e);return t=this.eventManager.emitReduce("convertorAfterMarkdownToHtmlConverted",t)}},{key:"initHtmlSanitizer",value:function(){this.eventManager.listen("convertorAfterMarkdownToHtmlConverted",function(e){return(0,v.default)(e,!0)})}},{key:"toMarkdown",value:function(e,t){var n=[];e=this.eventManager.emitReduce("convertorBeforeHtmlToMarkdownConverted",e);var i=(0,h.default)(this._appendAttributeForBrIfNeed(e),t);return i=this.eventManager.emitReduce("convertorAfterHtmlToMarkdownConverted",i),u.default.forEach(i.split("\n"),function(e,t){var i=/^\|[^|]*\|/gi;/`[^`]*<br>[^`]*`/gi.test(e)||i.test(e)||(e=e.replace(/<br>/gi,"<br>\n")),n[t]=e}),n.join("\n")}},{key:"_appendAttributeForBrIfNeed",value:function(e){var t=/<br>/gi,n=/<br \/><br \/>/gi,i=/<br data-tomark-pass \/><br \/>(.)/gi,a=/([^>]|<\/b>|<\/i>|<\/s>|<img [^>]*>)/,o=/<br data-tomark-pass \/><br data-tomark-pass \/>/,r=new RegExp(a.source+o.source,"g");e=e.replace(t,"<br />"),e=e.replace(n,"<br data-tomark-pass /><br data-tomark-pass />");var s=document.createElement("div"),u=(0,l.default)(s);return u.html(e),u.find("pre br,code br").each(function(e,t){t.hasAttribute("data-tomark-pass")&&t.removeAttribute("data-tomark-pass")}),e=u.html().replace(/<br data-tomark-pass="">/gi,"<br data-tomark-pass />"),e=e.replace(t,"<br />"),e=e.replace(i,"<br data-tomark-pass /><br data-tomark-pass />$1"),e=e.replace(r,"$1<br /><br />")}}],[{key:"getMarkdownitHighlightRenderer",value:function(){return x}}]),e}();t.default=A},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=["","","","CANCEL","","","HELP","","BACK_SPACE","TAB","","","CLEAR","ENTER","ENTER_SPECIAL","","","","","PAUSE","CAPS_LOCK","KANA","EISU","JUNJA","FINAL","HANJA","","ESCAPE","CONVERT","NONCONVERT","ACCEPT","MODECHANGE","SPACE","PAGE_UP","PAGE_DOWN","END","HOME","LEFT","UP","RIGHT","DOWN","SELECT","PRINT","EXECUTE","PRINTSCREEN","INSERT","DELETE","","0","1","2","3","4","5","6","7","8","9",":",";","<","=",">","?","AT","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","","","CONTEXT_MENU","","SLEEP","NUMPAD0","NUMPAD1","NUMPAD2","NUMPAD3","NUMPAD4","NUMPAD5","NUMPAD6","NUMPAD7","NUMPAD8","NUMPAD9","MULTIPLY","ADD","SEPARATOR","SUBTRACT","DECIMAL","DIVIDE","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","F13","F14","F15","F16","F17","F18","F19","F20","F21","F22","F23","F24","","","","","","","","","NUM_LOCK","SCROLL_LOCK","WIN_OEM_FJ_JISHO","WIN_OEM_FJ_MASSHOU","WIN_OEM_FJ_TOUROKU","WIN_OEM_FJ_LOYA","WIN_OEM_FJ_ROYA","","","","","","","","","","@","!",'"',"#","$","%","&","_","(",")","*","+","|","-","{","}","~","","","","","VOLUME_MUTE","VOLUME_DOWN","VOLUME_UP","","",";","=",",","-",".","/","`","","","","","","","","","","","","","","","","","","","","","","","","","","","[","\\","]","'","","META","ALTGR","","WIN_ICO_HELP","WIN_ICO_00","","WIN_ICO_CLEAR","","","WIN_OEM_RESET","WIN_OEM_JUMP","WIN_OEM_PA1","WIN_OEM_PA2","WIN_OEM_PA3","WIN_OEM_WSCTRL","WIN_OEM_CUSEL","WIN_OEM_ATTN","WIN_OEM_FINISH","WIN_OEM_COPY","WIN_OEM_AUTO","WIN_OEM_ENLW","WIN_OEM_BACKTAB","ATTN","CRSEL","EXSEL","EREOF","PLAY","ZOOM","","PA1","WIN_OEM_CLEAR",""],r=void 0,l=function(){function e(t){i(this,e),this._setSplitter(t)}return a(e,[{key:"_setSplitter",value:function(e){var t=e?e.splitter:"+";this._splitter=t}},{key:"convert",value:function(e){var t=[];e.shiftKey&&t.push("SHIFT"),e.ctrlKey&&t.push("CTRL"),e.metaKey&&t.push("META"),e.altKey&&t.push("ALT");var n=this._getKeyCodeChar(e.keyCode);return n&&t.push(n),t.join(this._splitter)}},{key:"_getKeyCodeChar",value:function(e){return o[e]}}],[{key:"getSharedInstance",value:function(){return r||(r=new e),r}},{key:"keyCode",value:function(e){return o.indexOf(e)}}]),e}();t.default=l},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(1),r=function(e){return e&&e.__esModule?e:{default:e}}(o),l=function(){function e(){i(this,e),this.globalTOID=null,this.lazyRunFunctions={}}return a(e,[{key:"run",value:function(e,t,n,i){var a=void 0;return r.default.isString(e)?a=this._runRegisteredRun(e,t,n,i):(a=this._runSingleRun(e,t,n,i,this.globalTOID),this.globalTOID=a),a}},{key:"registerLazyRunFunction",value:function(e,t,n,i){i=i||this,this.lazyRunFunctions[e]={fn:t,delay:n,context:i,TOID:null}}},{key:"_runSingleRun",value:function(e,t,n,i,a){return this._clearTOIDIfNeed(a),a=setTimeout(function(){e.call(n,t)},i)}},{key:"_runRegisteredRun",value:function(e,t,n,i){var a=this.lazyRunFunctions[e],o=a.fn,r=a.TOID;return i=i||a.delay,n=n||a.context,r=this._runSingleRun(o,t,n,i,r),a.TOID=r,r}},{key:"_clearTOIDIfNeed",value:function(e){e&&clearTimeout(e)}}]),e}();t.default=l},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(1),r=function(e){return e&&e.__esModule?e:{default:e}}(o),l=function(){function e(t,n,a){i(this,e),this.name=t,this.type=n,a&&this.setKeyMap(a)}return a(e,[{key:"getName",value:function(){return this.name}},{key:"getType",value:function(){return this.type}},{key:"isMDType",value:function(){return this.type===e.TYPE.MD}},{key:"isWWType",value:function(){return this.type===e.TYPE.WW}},{key:"isGlobalType",value:function(){return this.type===e.TYPE.GB}},{key:"setKeyMap",value:function(e,t){this.keyMap=[e,t]}}]),e}();l.factory=function(e,t){var n=void 0;"markdown"===e?n=l.TYPE.MD:"wysiwyg"===e?n=l.TYPE.WW:"global"===e&&(n=l.TYPE.GB);var i=new l(t.name,n);return r.default.extend(i,t),i},l.TYPE={MD:0,WW:1,GB:2},t.default=l},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e){for(var t=atob(e.split(",")[1]),n=e.split(",")[0].split(":")[1].split(";")[0],i=new ArrayBuffer(t.length),a=new Uint8Array(i),o=0;o<t.length;o+=1)a[o]=t.charCodeAt(o);return new Blob([i],{type:n})}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(1),l=function(e){return e&&e.__esModule?e:{default:e}}(r),s=/^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})(\/([^\s]*))?$/g,u=function(){function e(t){i(this,e),this.eventManager=t,this._lastState=null,this._initEvent(),this._initDefaultImageImporter()}return o(e,[{key:"_initEvent",value:function(){var e=this;this.eventManager.listen("stateChange",function(t){e._lastState=t}),this.eventManager.listen("drop",function(t){var n=t.data.dataTransfer&&t.data.dataTransfer.files;e._processBlobItems(n,t.data)}),this.eventManager.listen("willPaste",function(t){var n=t.data.fragment,i=n.querySelectorAll("*");if(1===i.length&&"IMG"===i[0].tagName&&/^data:image/.test(i[0].src)){t.data.preventDefault();var o=a(i[0].src);e._emitAddImageBlobHook(o,"paste")}}),this.eventManager.listen("paste",function(t){e._processClipboard(t.data)}),this.eventManager.listen("pasteBefore",function(t){e._decodeURL(t)})}},{key:"_initDefaultImageImporter",value:function(){this.eventManager.listen("addImageBlobHook",function(e,t){var n=new FileReader;n.onload=function(e){t(e.target.result)},n.readAsDataURL(e)})}},{key:"_emitAddImageBlobHook",value:function(e,t){var n=this;this.eventManager.emit("addImageBlobHook",e,function(t,i){n.eventManager.emit("command","AddImage",{imageUrl:t,altText:i||e.name||"image"})},t)}},{key:"_decodeURL",value:function(t){var n=e.decodeURIGraceful,i=e.encodeMarkdownCharacters;if("markdown"===t.source&&t.data.text){var a=t.data.text,o=a[0];1===a.length&&o.match(s)&&(o=n(o),o=i(o),t.data.update(null,null,[o]))}else if("wysiwyg"===t.source){var r=t.$clipboardContainer.get(0),l=r.childNodes[0],u=l.innerText;1===r.childNodes.length&&"A"===l.tagName&&u.match(s)&&(l.innerText=n(u),l.href=i(l.href))}}},{key:"_processClipboard",value:function(e){var t=e.clipboardData||window.clipboardData,n=t&&t.items,i=t.types;n&&i&&1===i.length&&-1!==l.default.inArray("Files",[].slice.call(i))&&this._processBlobItems(n,e)}},{key:"_processBlobItems",value:function(e,t){var n=this;e&&l.default.forEachArray(e,function(e){if(-1!==e.type.indexOf("image")){t.preventDefault(),t.codemirrorIgnore=!0;var i=e.name?e:e.getAsFile();return n._emitAddImageBlobHook(i,t.type),!1}return!0})}},{key:"_isInBlockFormat",value:function(){var e=this._lastState;return e&&(e.codeBlock||e.list||e.task||e.code)}}],[{key:"decodeURIGraceful",value:function(e){var t=e.split(" "),n=[],i=void 0;return l.default.forEachArray(t,function(e){try{i=decodeURIComponent(e),i=i.replace(/ /g,"%20")}catch(t){i=e}return n.push(i)}),n.join(" ")}},{key:"encodeMarkdownCharacters",value:function(e){return e.replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\[/g,"%5B").replace(/\]/g,"%5D").replace(/</g,"%3C").replace(/>/g,"%3E")}},{key:"escapeMarkdownCharacters",value:function(e){return e.replace(/\(/g,"\\(").replace(/\)/g,"\\)").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/</g,"\\<").replace(/>/g,"\\>")}}]),e}();t.default=u},function(e,t){e.exports=i},function(e,t){e.exports=a},function(e,t,n){"use strict";function i(e){e.content=e.content.slice(4),e.children[0].content=e.children[0].content.slice(4)}function a(e){var t=!1;return 0!==e.content.indexOf("[x]")&&0!==e.content.indexOf("[X]")||(t=!0),t}function o(e,t,n){var i=e.attrIndex(t),a=[t,n];i<0?e.attrPush(a):e.attrs[i]=a}function r(e,t){return"inline"===e[t].type&&"paragraph_open"===e[t-1].type&&"list_item_open"===e[t-2].type&&(0===e[t].content.indexOf("[ ]")||0===e[t].content.indexOf("[x]")||0===e[t].content.indexOf("[X]"))}var l=function(e){e.core.ruler.after("inline","tui-task-list",function(e){var t,n,l=e.tokens;for(n=2;n<l.length;n+=1)r(l,n)&&(t=a(l[n])?"task-list-item checked":"task-list-item",i(l[n]),o(l[n-2],"class",t),o(l[n-2],"data-te-task",""))})};e.exports=l},function(e,t,n){"use strict";function i(e,t,n){var i=e.attrIndex(t),a=[t,n];i<0?e.attrPush(a):e.attrs[i]=a}function a(e){return!0===e.block&&"code"===e.tag&&"fence"===e.type}function o(e,t){return e.replace(t?/&/g:/&(?!#?\w+;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var r=function(e){e.core.ruler.after("block","tui-code-block",function(e){var t,n,r=e.tokens;for(n=0;n<r.length;n+=1)t=r[n],a(t)&&t.info&&i(t,"data-language",o(t.info.replace(" ",""),!0))})};e.exports=r},function(e,t,n){"use strict";e.exports=function(e,t,n){var i,a,o,r=/ {0,3}(?:-|\*|\d\.) /,l=e.src.split("\n"),s=l[t],u=0;if(s.match(r)||e.sCount[t]-e.blkIndent<4)return!1;for(a=i=t+1;i<n;)if(e.isEmpty(i)){if(++u>=2&&"list"===e.parentType)break;i++}else{if(u=0,!(e.sCount[i]-e.blkIndent>=4))break;i++,a=i}return e.line=a,o=e.push("code_block","code",0),o.content=e.getLines(t,a,4+e.blkIndent,!0),o.map=[t,e.line],!0}},function(e,t,n){"use strict";function i(e){switch(e){case 9:case 32:return!0}return!1}e.exports=function(e,t,n,a){var o,r,l,s,u,c,d,f,h,g,v,p,m,y,_,b,k,w,C,E,M=e.lineMax,T=e.bMarks[t]+e.tShift[t],S=e.eMarks[t],O=/(?:-|\*|\d+\.) {1,4}(?:> {0,3})[^>]*$/,L=e.src.split("\n"),B=L[t];if(e.sCount[t]-e.blkIndent>=4)return!1;if(62!==e.src.charCodeAt(T++))return!1;if(B.match(O))return!1;if(a)return!0;for(s=h=e.sCount[t]+T-(e.bMarks[t]+e.tShift[t]),32===e.src.charCodeAt(T)?(T++,s++,h++,o=!1,b=!0):9===e.src.charCodeAt(T)?(b=!0,(e.bsCount[t]+h)%4==3?(T++,s++,h++,o=!1):o=!0):b=!1,g=[e.bMarks[t]],e.bMarks[t]=T;T<S&&(r=e.src.charCodeAt(T),i(r));)9===r?h+=4-(h+e.bsCount[t]+(o?1:0))%4:h++,T++;for(v=[e.bsCount[t]],e.bsCount[t]=e.sCount[t]+1+(b?1:0),c=T>=S,y=[e.sCount[t]],e.sCount[t]=h-s,_=[e.tShift[t]],e.tShift[t]=T-e.bMarks[t],w=e.md.block.ruler.getRules("blockquote"),m=e.parentType,e.parentType="blockquote",E=!1,f=t+1;f<n&&(e.sCount[f]<e.blkIndent&&(E=!0),T=e.bMarks[f]+e.tShift[f],S=e.eMarks[f],!(T>=S));f++)if(62!==e.src.charCodeAt(T++)||E){if(c)break;for(k=!1,l=0,u=w.length;l<u;l++)if(w[l](e,f,n,!0)){k=!0;break}if(k){e.lineMax=f,0!==e.blkIndent&&(g.push(e.bMarks[f]),v.push(e.bsCount[f]),_.push(e.tShift[f]),y.push(e.sCount[f]),e.sCount[f]-=e.blkIndent);break}g.push(e.bMarks[f]),v.push(e.bsCount[f]),_.push(e.tShift[f]),y.push(e.sCount[f]),e.sCount[f]=-1}else{for(s=h=e.sCount[f]+T-(e.bMarks[f]+e.tShift[f]),32===e.src.charCodeAt(T)?(T++,s++,h++,o=!1,b=!0):9===e.src.charCodeAt(T)?(b=!0,(e.bsCount[f]+h)%4==3?(T++,s++,h++,o=!1):o=!0):b=!1,g.push(e.bMarks[f]),e.bMarks[f]=T;T<S&&(r=e.src.charCodeAt(T),i(r));)9===r?h+=4-(h+e.bsCount[f]+(o?1:0))%4:h++,T++;c=T>=S,v.push(e.bsCount[f]),e.bsCount[f]=e.sCount[f]+1+(b?1:0),y.push(e.sCount[f]),e.sCount[f]=h-s,_.push(e.tShift[f]),e.tShift[f]=T-e.bMarks[f]}for(p=e.blkIndent,e.blkIndent=0,C=e.push("blockquote_open","blockquote",1),C.markup=">",C.map=d=[t,0],e.md.block.tokenize(e,t,f),C=e.push("blockquote_close","blockquote",-1),C.markup=">",e.lineMax=M,e.parentType=m,d[1]=e.line,l=0;l<_.length;l++)e.bMarks[l+t]=g[l],e.tShift[l+t]=_[l],e.sCount[l+t]=y[l],e.bsCount[l+t]=v[l];return e.blkIndent=p,!0}},function(e,t,n){"use strict";function i(e,t){var n=e.bMarks[t]+e.blkIndent,i=e.eMarks[t];return e.src.substr(n,i-n)}function a(e){var t,n=[],i=0,a=e.length,o=0,r=0,l=!1,s=0;for(t=e.charCodeAt(i);i<a;)96===t&&o%2==0?(l=!l,s=i):124!==t||o%2!=0||l?92===t?o+=1:o=0:(n.push(e.substring(r,i)),r=i+1),i+=1,i===a&&l&&(l=!1,i=s+1),t=e.charCodeAt(i);return n.push(e.substring(r)),n}e.exports=function(e,t,n,o){var r,l,s,u,c,d,f,h,g,v,p,m,y;if(t+2>n)return!1;if(c=t+1,e.sCount[c]<e.blkIndent)return!1;if((s=e.bMarks[c]+e.tShift[c])>=e.eMarks[c])return!1;if(124!==(r=e.src.charCodeAt(s))&&45!==r&&58!==r)return!1;if(l=i(e,t+1),!/^[-:| ]+$/.test(l))return!1;for(d=l.split("|"),g=[],u=0;u<d.length;u+=1){if(!(p=d[u].trim())){if(0===u||u===d.length-1)continue;return!1}if(!/^:?-+:?$/.test(p))return!1;58===p.charCodeAt(p.length-1)?g.push(58===p.charCodeAt(0)?"center":"right"):58===p.charCodeAt(0)?g.push("left"):g.push("")}if(v=g.length,l=i(e,t).trim(),-1===l.indexOf("|"))return!1;if(d=a(l.replace(/^\||\|$/g,"")),(f=d.length)>v)return!1;if(f<v){for(u=0;u<v-f;u+=1)d.push("");f=d.length}if(o)return!0;for(h=e.push("table_open","table",1),h.map=m=[t,0],h=e.push("thead_open","thead",1),h.map=[t,t+1],h=e.push("tr_open","tr",1),h.map=[t,t+1],u=0;u<f;u+=1)h=e.push("th_open","th",1),h.map=[t,t+1],g[u]&&(h.attrs=[["align",g[u]]]),h=e.push("inline","",0),h.content=d[u].trim(),h.map=[t,t+1],h.children=[],h=e.push("th_close","th",-1);for(h=e.push("tr_close","tr",-1),h=e.push("thead_close","thead",-1),h=e.push("tbody_open","tbody",1),h.map=y=[t+2,0],c=t+2;c<n&&!(e.sCount[c]<e.blkIndent)&&(l=i(e,c),-1!==l.indexOf("|"));c+=1){for(d=a(l.replace(/^\||\|\s*$/g,"")),h=e.push("tr_open","tr",1),u=0;u<f;u+=1)h=e.push("td_open","td",1),g[u]&&(h.attrs=[["align",g[u]]]),h=e.push("inline","",0),h.content=d[u]?d[u].trim():"",h.children=[],h=e.push("td_close","td",-1);h=e.push("tr_close","tr",-1)}return h=e.push("tbody_close","tbody",-1),h=e.push("table_close","table",-1),m[1]=y[1]=c,e.line=c,!0}},function(e,t,n){"use strict";var i=["area","base","br","col","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],a=[[/^<(script|pre|style)(?=(\s|>|$))/i,/<\/(script|pre|style)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[new RegExp("^<("+i.join("|")+")","i"),/^\/?>$/,!0],[new RegExp("^</?(address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|pre|section|source|title|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?=(\\s|/?>|$))","i"),/^$/,!0],[/^(?:<[A-Za-z][A-Za-z0-9\-]*(?:\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\s*=\s*(?:[^"'=<>`\x00-\x20]+|'[^']*'|"[^"]*"))?)*\s*\/?>|<\/[A-Za-z][A-Za-z0-9\-]*\s*>)\s*$/,/^$/,!1]];e.exports=function(e,t,n,i){var o,r,l,s,u=e.bMarks[t]+e.tShift[t],c=e.eMarks[t];if(!e.md.options.html)return!1;if(60!==e.src.charCodeAt(u))return!1;for(s=e.src.slice(u,c),o=0;o<a.length;o++)if(a[o][0].test(s)){if(5===o)return!1;break}if(o===a.length)return!1;if(i)return a[o][2];if(r=t+1,!a[o][1].test(s))for(;r<n&&!(e.sCount[r]<e.blkIndent);r++)if(u=e.bMarks[r]+e.tShift[r],c=e.eMarks[r],s=e.src.slice(u,c),a[o][1].test(s)){0!==s.length&&r++;break}return e.line=r,l=e.push("html_block","",0),l.map=[t,r],l.content=e.getLines(t,r,e.blkIndent,!0),!0}},function(e,t,n){"use strict";e.exports=function(e,t){var n,i,a,o,r,l,s=e.pos;if(96!==e.src.charCodeAt(s))return!1;for(n=s,s++,i=e.posMax;s<i&&96===e.src.charCodeAt(s);)s++;for(a=e.src.slice(n,s),o=r=s;-1!==(o=e.src.indexOf("`",r));){for(r=o+1;r<i&&96===e.src.charCodeAt(r);)r++;if(r-o===a.length)return t||(l=e.push("code_inline","code",0),l.markup=a,l.content=e.src.slice(s,o).replace(/[ \n]+/g," ").trim(),l.attrSet("data-backticks",l.markup.length)),e.pos=r,!0}return t||(e.pending+=a),e.pos+=a.length,!0}},function(e,t){e.exports=o},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),l=i(r),s=n(1),u=i(s),c=n(9),d=i(c),f=n(12),h=i(f),g=n(2),v=i(g),p=n(13),m=i(p),y=n(14),_=i(y),b=n(3),k=i(b),w=n(7),C=i(w),E=function(){function e(t){var n=this;a(this,e),this.options=t,this.eventManager=new h.default,this.commandManager=new v.default(this),this.convertor=new _.default(this.eventManager),this.toMarkOptions=null,this.options.hooks&&u.default.forEach(this.options.hooks,function(e,t){n.addHook(t,e)}),this.options.events&&u.default.forEach(this.options.events,function(e,t){n.on(t,e)}),this.preview=new d.default((0,l.default)(this.options.el),this.eventManager,this.convertor,!0),this.preview.$el.on("mousedown",l.default.proxy(this._toggleTask,this)),m.default.applyExtension(this,this.options.exts),this.setValue(this.options.initialValue),this.eventManager.emit("load",this)}return o(e,[{key:"_toggleTask",value:function(e){var t=e.offsetX<18&&e.offsetY>18;e.target.hasAttribute("data-te-task")&&!t&&((0,l.default)(e.target).toggleClass("checked"),this.eventManager.emit("change",{source:"viewer",data:e}))}},{key:"setMarkdown",value:function(e){this.markdownValue=e=e||"",this.preview.refresh(this.markdownValue),this.eventManager.emit("setMarkdownAfter",this.markdownValue)}},{key:"setValue",value:function(e){this.setMarkdown(e)}},{key:"on",value:function(e,t){this.eventManager.listen(e,t)}},{key:"off",value:function(e){this.eventManager.removeEventHandler(e)}},{key:"remove",value:function(){this.eventManager.emit("removeEditor"),this.preview.$el.off("mousedown",l.default.proxy(this._toggleTask,this)),this.options=null,this.eventManager=null,this.commandManager=null,this.convertor=null,this.preview=null}},{key:"addHook",value:function(e,t){this.eventManager.removeEventHandler(e),this.eventManager.listen(e,t)}},{key:"isViewer",value:function(){return!0}},{key:"isMarkdownMode",value:function(){return!1}},{key:"isWysiwygMode",value:function(){return!1}}],[{key:"defineExtension",value:function(e,t){m.default.defineExtension(e,t)}}]),e}();E.isViewer=!0,E.domUtils=k.default,E.codeBlockManager=C.default,E.markdownitHighlight=_.default.getMarkdownitHighlightRenderer(),E.i18n=null,E.Button=null,E.WwCodeBlockManager=null,E.WwTableManager=null,E.WwTableSelectionManager=null,e.exports=E},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=n(8),u=i(s),c=n(31),d=i(c),f=function(e){function t(e){a(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,{tagName:"button",className:e.className+" tui-toolbar-icons",rootElement:e.$el}));return n._setOptions(e),n._render(),n.on("click",n._onClick.bind(n)),e.tooltip&&(n.on("mouseover",n._onOver.bind(n)),n.on("mouseout",n._onOut.bind(n))),n}return r(t,e),l(t,[{key:"_setOptions",value:function(e){this._command=e.command,this._event=e.event,this._text=e.text,this._tooltip=e.tooltip,this._style=e.style,this._state=e.state}},{key:"_render",value:function(){this.$el.text(this._text),this.$el.attr("type","button"),this._style&&this.$el.attr("style",this._style)}},{key:"_onClick",value:function(){this._command?this.trigger("command",this._command):this._event&&this.trigger("event",this._event),this.trigger("clicked")}},{key:"_onOver",value:function(){d.default.show(this.$el,this._tooltip)}},{key:"_onOut",value:function(){d.default.hide()}}]),t}(u.default);t.default=f},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),r=function(e){return e&&e.__esModule?e:{default:e}}(o),l='<div class="tui-tooltip"><div class="arrow"></div><span class="text"></span></span></div>',s=function(){function e(){i(this,e),this.$el=(0,r.default)(l),this.$el.appendTo("body"),this.hide()}return a(e,[{key:"show",value:function(e,t){this.$el.css({top:e.offset().top+e.height()+13,left:e.offset().left+3}).find(".text").html(t).end().show()}},{key:"hide",value:function(){this.$el.hide()}},{key:"remove",value:function(){this.$el.remove()}}]),e}();t.default=new s},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),l=i(r),s=n(6),u=i(s);n(41),n(42),n(43),n(44),n(45),n(46);var c=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};a(this,e),this.editorContainerEl=t,this.cm=null,this._init(n)}return o(e,[{key:"_init",value:function(e){var t=document.createElement("textarea");this.editorContainerEl.appendChild(t),e=l.default.extend(!0,{lineWrapping:!0,theme:"default",extraKeys:{"Shift-Tab":"indentLess","Alt-Up":"replaceLineTextToUpper","Alt-Down":"replaceLineTextToLower"},indentUnit:4},e),this.cm=u.default.fromTextArea(t,e)}},{key:"getCurrentRange",value:function(){var e=this.cm.getCursor("from"),t=this.cm.getCursor("to");return{from:e,to:t,collapsed:e.line===t.line&&e.ch===t.ch}}},{key:"focus",value:function(){this.cm.focus()}},{key:"blur",value:function(){this.cm.getInputField().blur()}},{key:"remove",value:function(){this.cm.toTextArea()}},{key:"setValue",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.cm.setValue(e),t&&this.moveCursorToEnd(),this.cm.refresh()}},{key:"getValue",value:function(){return this.cm.getValue("\n")}},{key:"getEditor",value:function(){return this.cm}},{key:"reset",value:function(){this.setValue("")}},{key:"getCaretPosition",value:function(){return this.cm.cursorCoords()}},{key:"addWidget",value:function(e,t,n,i){i&&(e.ch+=i),this.cm.addWidget(e.end,t,!0,n)}},{key:"replaceSelection",value:function(e,t){t&&this.cm.setSelection(t.from,t.to),this.cm.replaceSelection(e),this.focus()}},{key:"replaceRelativeOffset",value:function(e,t,n){var i=this.cm.getCursor(),a={from:{line:i.line,ch:i.ch+t},to:{line:i.line,ch:i.ch+t+n}};this.replaceSelection(e,a)}},{key:"setHeight",value:function(e){this.getWrapperElement().style.height=e+"px"}},{key:"setMinHeight",value:function(e){this.getWrapperElement().style.minHeight=e+"px"}},{key:"getWrapperElement",value:function(){return this.cm.getWrapperElement()}},{key:"getCursor",value:function(e){return this.cm.getCursor(e)}},{key:"moveCursorToEnd",value:function(){var e=this.getEditor().getDoc(),t=e.lastLine();e.setCursor(t,e.getLine(t).length)}},{key:"moveCursorToStart",value:function(){var e=this.getEditor().getDoc(),t=e.firstLine();e.setCursor(t,0)}},{key:"scrollTop",value:function(e){return e&&this.cm.scrollTo(0,e),this.cm.getScrollInfo().top}},{key:"getRange",value:function(){var e=this.cm.getCursor("from"),t=this.cm.getCursor("to");return{start:{line:e.line,ch:e.ch},end:{line:t.line,ch:t.ch}}}},{key:"on",value:function(e,t){this.cm.on(e,t)}},{key:"off",value:function(e,t){this.cm.off(e,t)}}]),e}();t.default=c},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=function(){function e(t){i(this,e),this._managers={},this._editor=t}return a(e,[{key:"addManager",value:function(e,t){t||(t=e,e=null);var n=new t(this._editor);this._managers[e||n.name]=n}},{key:"getManager",value:function(e){return this._managers[e]}},{key:"removeManager",value:function(e){var t=this.getManager(e);t&&(t.destroy&&t.destroy(),delete this._managers[e])}}]),e}();t.default=o},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n="<"+t+"><br /></"+t+">",i="",a=0;a<e;a+=1)i+=n;return i}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=n(0),s=i(l),u=n(1),c=i(u),d=n(3),f=i(d),h=c.default.browser.msie&&10===c.default.browser.version,g=c.default.browser.msie&&(10===c.default.browser.version||11===c.default.browser.version),v=c.default.browser.msie?"":"<br>",p=function(){function e(t){a(this,e),this.wwe=t,this.eventManager=t.eventManager,this.name="table",this._lastCellNode=null,this._init()}return r(e,[{key:"_init",value:function(){this._initKeyHandler(),this._initEvent(),this.tableID=0}},{key:"_initEvent",value:function(){var e=this;this.eventManager.listen("wysiwygRangeChangeAfter.table",function(){var t=e.wwe.getEditor().getSelection(),n=e.isInTable(t);if(e._unwrapBlockInTable(),e._completeTableIfNeed(),!n){e.wwe.componentManager.getManager("tableSelection").removeClassAttrbuteFromAllCellsIfNeed()}e._insertDefaultBlockBetweenTable()}),this.eventManager.listen("wysiwygSetValueAfter.table",function(){e._unwrapBlockInTable(),e._insertDefaultBlockBetweenTable()}),this.eventManager.listen("wysiwygProcessHTMLText.table",function(e){return e.replace(/<br \/>(<\/td>|<\/th>)/g,"$1")}),this.eventManager.listen("cut.table",function(){var t=e.wwe.componentManager.getManager("tableSelection"),n=t.getSelectedCells();n.length&&n.get().forEach(function(e){return(0,s.default)(e).html(v)}),t.removeClassAttrbuteFromAllCellsIfNeed()}),this.eventManager.listen("copyBefore.table",function(t){var n=t.$clipboardContainer;return e.updateTableHtmlOfClipboardIfNeed(n)}),this.onBindedPaste=this._onPaste.bind(this),this.wwe.getEditor().addEventListener("paste",this.onBindedPaste)}},{key:"updateTableHtmlOfClipboardIfNeed",value:function(e){var t=this,n=this.wwe.componentManager.getManager("tableSelection");if(n.getSelectedCells().length){n.createRangeBySelectedCells();var i=this.wwe.getEditor().getSelection().cloneContents();(0,s.default)(i).children().each(function(e,n){var i=(0,s.default)(n);t.isTableOrSubTableElement(n.nodeName)&&("TABLE"===n.nodeName&&0===i.find("thead").length&&0===i.find("tbody").length?i.remove():n.previousSibling&&"TABLE"===n.previousSibling.nodeName?n.previousSibling.appendChild(n):(t._completeIncompleteTable(n),"TABLE"!==n.nodeName&&"THEAD"!==n.nodeName&&(0,s.default)(n).closest("table").find("thead").remove()))}),e.append(i),e.find(".te-cell-selected").removeClass("te-cell-selected")}}},{key:"pasteClipboardData",value:function(e){this.wwe.componentManager.getManager("tableSelection").getSelectedCells().length||(this._expandTableIfNeed(e),this._pasteDataIntoTable(e))}},{key:"_onPaste",value:function(e){var t=this.wwe.getEditor().getSelection(),n=!f.default.isTextNode(t.commonAncestorContainer);this.isInTable(t)&&!t.collapsed&&n&&e.preventDefault()}},{key:"_initKeyHandler",value:function(){var e=this;this.keyEventHandlers={DEFAULT:function(t,n,i){var a=e.isInTable(n);a&&!e._isSingleModifierKey(i)?(e._recordUndoStateIfNeed(n),e._removeBRIfNeed(n),e._removeContentsAndChangeSelectionIfNeed(n,i,t)):!a&&e._lastCellNode&&e._recordUndoStateAndResetCellNode(n),a&&!e._isModifierKeyPushed(t)&&e.wwe.getEditor().modifyDocument(function(){e.wwe.componentManager.getManager("tableSelection").removeClassAttrbuteFromAllCellsIfNeed()})},ENTER:function(t,n){var i=void 0;return e._isAfterTable(n)?(t.preventDefault(),n.setStart(n.startContainer,n.startOffset-1),e.wwe.breakToNewDefaultBlock(n),i=!1):e._isBeforeTable(n)?(t.preventDefault(),e.wwe.breakToNewDefaultBlock(n,"before"),i=!1):e.isInTable(n)&&(e._appendBrIfTdOrThNotHaveAsLastChild(n),i=!1),i},BACK_SPACE:function(t,n,i){return e._handleBackspaceAndDeleteKeyEvent(t,n,i)},DELETE:function(t,n,i){return e._handleBackspaceAndDeleteKeyEvent(t,n,i)},TAB:function(){return e._moveCursorTo("next","cell")},"SHIFT+TAB":function(t){return e._moveCursorTo("previous","cell",t)},UP:function(t){return e._moveCursorTo("previous","row",t)},DOWN:function(t){return e._moveCursorTo("next","row",t)}},c.default.forEach(this.keyEventHandlers,function(t,n){return e.wwe.addKeyEventHandler(n,t)})}},{key:"isInTable",value:function(e){var t=void 0,n=void 0;return e.collapsed?(t=e.startContainer,n=!!(0,s.default)(t).closest("[contenteditable=true] table").length):(t=e.commonAncestorContainer,n=!!(0,s.default)(t).closest("[contenteditable=true] table").length||!!(0,s.default)(e.cloneContents()).find("table").length),n}},{key:"_isBeforeTable",value:function(e){return"TABLE"===f.default.getNodeName(f.default.getChildNodeByOffset(e.startContainer,e.startOffset))}},{key:"_isAfterTable",value:function(e){var t=f.default.getPrevOffsetNodeUntil(e.startContainer,e.startOffset);return"TABLE"===f.default.getNodeName(t)&&e.commonAncestorContainer===this.wwe.get$Body()[0]}},{key:"_handleBackspaceAndDeleteKeyEvent",value:function(e,t,n){var i="BACK_SPACE"===n,a=this.wwe.componentManager.getManager("tableSelection"),o=a.getSelectedCells(),r=!0;if(t.collapsed){if(this.isInTable(t))i?this._tableHandlerOnBackspace(t,e):this._tableHandlerOnDelete(t,e),this._insertBRIfNeed(t),this._removeContentsAndChangeSelectionIfNeed(t,n,e),r=!1;else if(!i&&this._isBeforeTable(t)||i&&this._isAfterTable(t)){e.preventDefault();var l=i?t.startOffset-1:t.startOffset;this._removeTable(t,f.default.getChildNodeByOffset(t.startContainer,l)),r=!1}}else if(this.isInTable(t)&&o.length>0){var s=this._removeContentsAndChangeSelectionIfNeed(t,n,e);s&&(e.preventDefault(),r=!1)}return r}},{key:"_tableHandlerOnBackspace",value:function(e,t){var n=f.default.getPrevOffsetNodeUntil(e.startContainer,e.startOffset,"TR"),i=f.default.getNodeName(n);n&&"TD"!==i&&"TH"!==i?"BR"===i&&1!==n.parentNode.childNodes.length&&(t.preventDefault(),(0,s.default)(n).remove()):t.preventDefault()}},{key:"isNonTextDeleting",value:function(e){var t=e.startContainer,n=t.nextSibling,i=f.default.getNodeName(n),a=f.default.getNodeName(t),o=a===i&&"TEXT"!==a,r=(!n||"BR"===i&&n.parentNode.lastChild===n)&&f.default.isTextNode(t)&&e.startOffset===t.nodeValue.length,l=!r&&(0,s.default)(t).parents("tr").children().last()[0]===t&&("TD"===a||"TH"===a);return o||r||l}},{key:"_tableHandlerOnDelete",value:function(e,t){this.isNonTextDeleting(e)&&(t.preventDefault(),e.startContainer.normalize())}},{key:"_appendBrIfTdOrThNotHaveAsLastChild",value:function(e){var t=f.default.getNodeName(e.startContainer),n=void 0;if("TD"===t||"TH"===t)n=e.startContainer;else{var i=(0,s.default)(e.startContainer).parentsUntil("tr");n=i[i.length-1]}"BR"===f.default.getNodeName(n.lastChild)||"DIV"===f.default.getNodeName(n.lastChild)||g||(0,s.default)(n).append((0,s.default)("<br />")[0])}},{key:"_unwrapBlockInTable",value:function(){this.wwe.get$Body().find("td div,th div,tr>br,td>br,th>br").each(function(e,t){if("BR"===f.default.getNodeName(t)){var n=f.default.getNodeName(t.parentNode),i=/TD|TH/.test(n),a=0===t.parentNode.textContent.length,o=t.parentNode.lastChild===t;("TR"===n||i&&!a&&o)&&(0,s.default)(t).remove()}else(0,s.default)(t).children().unwrap()})}},{key:"_insertDefaultBlockBetweenTable",value:function(){this.wwe.get$Body().find("table").each(function(e,t){t.nextElementSibling&&"TABLE"===t.nextElementSibling.nodeName&&(0,s.default)("<div><br /></div>").insertAfter(t)})}},{key:"_removeTable",value:function(e,t){"TABLE"===t.tagName&&(this.wwe.getEditor().saveUndoState(e),this.wwe.saveSelection(e),(0,s.default)(t).remove(),this.wwe.restoreSavedSelection())}},{key:"_recordUndoStateIfNeed",value:function(e){var t=f.default.getParentUntil(e.startContainer,"TR");e.collapsed&&t&&this._lastCellNode!==t&&(this.wwe.getEditor().saveUndoState(e),this._lastCellNode=t)}},{key:"_recordUndoStateAndResetCellNode",value:function(e){this.wwe.getEditor().saveUndoState(e),this.resetLastCellNode()}},{key:"_pasteDataIntoTable",value:function(e){var t=this.wwe.getEditor().getSelection(),n=t.startContainer,i=n.parentNode,a=this._getTableDataFromTable(e),o="TD"===i.tagName||"TH"===i.tagName,r="TD"===n.tagName||"TH"===n.tagName,l=3===n.nodeType,u=h?"":"<br />",c=void 0,d=void 0,g=void 0,v=void 0;for(c=l&&o?i:r?n:(0,s.default)(n).find("th,td").get(0),d=c;a.length;){for(g=a.shift();d&&g.length;)v=g.shift(),v.length?d.textContent=v:d.innerHTML=u,d=f.default.getTableCellByDirection(d,"next");d=f.default.getSiblingRowCellByDirection(c,"next",!1),c=d}}},{key:"_getTableDataFromTable",value:function(e){var t=(0,s.default)(e),n=[];return t.find("tr").each(function(e,t){var i=[];(0,s.default)(t).children().each(function(e,t){i.push(t.textContent)}),i.length&&n.push(i)}),n}},{key:"_removeTableContents",value:function(e){this.wwe.getEditor().saveUndoState(),e.each(function(e,t){var n=h?"":"<br />";(0,s.default)(t).html(n)})}},{key:"wrapDanglingTableCellsIntoTrIfNeed",value:function(e){var t=e.children("td,th"),n=void 0;if(t.length){var i=(0,s.default)("<tr></tr>");t.each(function(e,t){i.append(t)}),n=i.get(0)}return n}},{key:"wrapTrsIntoTbodyIfNeed",value:function(e){var t=e.children("tr"),n=t.find("th"),i=void 0;if(n.length&&n.each(function(e,t){var n=(0,s.default)(t),i=(0,s.default)("<td></td>");i.html(n.html()),i.insertBefore(t),n.detach()}),t.length){var a=(0,s.default)("<tbody></tbody>");t.each(function(e,t){a.append(t)}),i=a.get(0)}return i}},{key:"wrapTheadAndTbodyIntoTableIfNeed",value:function(e){var t=e.children("thead"),n=e.children("tbody"),i=(0,s.default)("<table></table>"),a=void 0;return!n.length&&t.length?(i.append(t[0]),i.append("<tbody><tr></tr></tbody>"),a=i.get(0)):n.length&&!t.length?(i.append("<thead><tr></tr></thead>"),i.append(n[0]),a=i.get(0)):n.length&&t.length&&(i.append(t[0]),i.append(n[0]),a=i.get(0)),a}},{key:"isTableOrSubTableElement",value:function(e){return"TABLE"===e||"TBODY"===e||"THEAD"===e||"TR"===e||"TD"===e}},{key:"_stuffTableCellsIntoIncompleteRow",value:function(e,t){e.each(function(e,n){for(var i=(0,s.default)(n),a=i.find("th,td"),r=f.default.getNodeName(i.parent()[0]),l="THEAD"===r?"th":"td",u=a.length;u<t;u+=1)i.append((0,s.default)(o(1,l))[0])})}},{key:"prepareToTableCellStuffing",value:function(e){var t=e.eq(0).find("th,td").length,n=!1;return e.each(function(e,i){var a=(0,s.default)(i).find("th,td").length;t!==a&&(n=!0,t<a&&(t=a))}),{maximumCellLength:t,needTableCellStuffingAid:n}}},{key:"_addTbodyOrTheadIfNeed",value:function(e){var t=!e.find("thead").length,n=!e.find("tbody").length,i=void 0;t?(i=(0,s.default)("<thead><tr></tr></thead>").get(0),e.prepend(i)):n&&(i=(0,s.default)("<tbody><tr></tr></tbody>").get(0),e.append(i))}},{key:"tableCellAppendAidForTableElement",value:function(e){var t=(0,s.default)(e);this._addTbodyOrTheadIfNeed(t),this._addTrIntoContainerIfNeed(t);var n=t.find("tr"),i=this.prepareToTableCellStuffing(n),a=i.maximumCellLength;i.needTableCellStuffingAid&&this._stuffTableCellsIntoIncompleteRow(n,a)}},{key:"_generateTheadAndTbodyFromTbody",value:function(e){var t=(0,s.default)("<tr></tr>"),n=(0,s.default)("<thead></thead>");return t.append(o((0,s.default)(e).find("tr").eq(0).find("td").length,"th")),n.append(t),{thead:n[0],tbody:e}}},{key:"_generateTheadAndTbodyFromThead",value:function(e){var t=(0,s.default)("<tr></tr>"),n=(0,s.default)("<tbody></tbody>");return t.append(o((0,s.default)(e).find("th").length,"td")),n.append(t),{thead:e,tbody:n[0]}}},{key:"_generateTheadAndTbodyFromTr",value:function(e){var t=(0,s.default)(e),n=(0,s.default)("<thead></thead>"),i=(0,s.default)("<tbody></tbody>"),a=void 0,r=void 0;return"TH"===t.children()[0].tagName?(a=e,r=(0,s.default)("<tr>"+o(t.find("th").length,"td")+"</tr>").get(0)):(a=(0,s.default)("<tr>"+o(t.find("td").length,"th")+"</tr>").get(0),r=e),n.append(a),i.append(r),{thead:n[0],tbody:i[0]}}},{key:"_completeIncompleteTable",value:function(e,t){var n=e.tagName,i=void 0,a=void 0;t=!!c.default.isUndefined(t)||t,"TABLE"===n?i=e:(i=(0,s.default)("<table></table>"),i.insertAfter(e),"TBODY"===n?a=this._generateTheadAndTbodyFromTbody(e):"THEAD"===n?a=this._generateTheadAndTbodyFromThead(e):"TR"===n&&(a=this._generateTheadAndTbodyFromTr(e)),t&&i.append(a.thead),i.append(a.tbody)),this.tableCellAppendAidForTableElement(i)}},{key:"_completeTableIfNeed",value:function(){var e=this;this.wwe.getEditor().get$Body().children().each(function(t,n){var i=(0,s.default)(n);e.isTableOrSubTableElement(n.nodeName)&&("TABLE"===n.nodeName&&0===i.find("thead").length&&0===i.find("tbody").length&&i.remove(),e._completeIncompleteTable(n))})}},{key:"resetLastCellNode",value:function(){this._lastCellNode=null}},{key:"setLastCellNode",value:function(e){this._lastCellNode=e}},{key:"_isSingleModifierKey",value:function(e){return"META"===e||"SHIFT"===e||"ALT"===e||"CONTROL"===e}},{key:"_isModifierKeyPushed",value:function(e){return e.metaKey||e.ctrlKey||e.altKey||e.shiftKey}},{key:"_addTrIntoContainerIfNeed",value:function(e){e.children().each(function(e,t){0===(0,s.default)(t).find("tr").length&&(0,s.default)(t).append((0,s.default)("<tr></tr>")[0])})}},{key:"_expandTableIfNeed",value:function(e){var t=this.wwe.getEditor().getSelection().cloneRange(),n=(0,s.default)(t.startContainer).parents("table"),i=this._getColumnAndRowDifference(e,t);i.column<0&&this._appendCellForAllRow(n,i.column),i.row<0&&this._appendRow(n,i.row)}},{key:"_getColumnAndRowDifference",value:function(e,t){var n=this._getTableDataFromTable(e),i=n.length,a=n[0].length,o=(0,s.default)(t.startContainer).closest("th,td"),r=o.parent(),l=f.default.getNodeOffsetOfParent(o[0]),u=f.default.getNodeOffsetOfParent(o[0].parentNode),c=r.parents("table"),d=c.find("tr").eq(0).children().length,h=c.find("tr").length;return r.parents("tbody").length&&(u+=1),{row:h-(u+i),column:d-(l+a)}}},{key:"_appendCellForAllRow",value:function(e,t){var n=h?"":"<br />";e.find("tr").each(function(e,i){for(var a=void 0,o=t;o<0;o+=1)a=0===e?"th":"td",(0,s.default)(i).append((0,s.default)("<"+a+">"+n+"</"+a+">")[0])})}},{key:"_appendRow",value:function(e,t){var n=e.find("tr").last().clone(),i=h?"":"<br />";for(n.find("td").html(i);t<0;t+=1)e.find("tbody").append(n.clone()[0])}},{key:"_getSiblingTextNodeByDirection",value:function(e,t){var n=e.previousSibling&&"BR"===e.previousSibling.nodeName&&e.previousSibling.previousSibling&&3===e.previousSibling.previousSibling.nodeType,i=e.nextSibling&&"BR"===e.nextSibling.nodeName&&e.nextSibling.nextSibling&&3===e.nextSibling.nextSibling.nodeType,a=void 0;return t&&i?a=e.nextSibling.nextSibling:!t&&n&&(a=e.previousSibling.previousSibling),a}},{key:"_changeSelectionToTargetCell",value:function(e,t,n,i){var a=t.startContainer,o="next"===n,r="row"===i,l=void 0,u=void 0;if(r){if(f.default.isTextNode(a)&&(l=this._getSiblingTextNodeByDirection(a,o)))return u=l.length<t.startOffset?l.length:t.startOffset,t.setStart(l,u),void t.collapse(!0);l=f.default.getSiblingRowCellByDirection(e,n,!1)}else(l=f.default.getTableCellByDirection(e,n))||(l=f.default.getSiblingRowCellByDirection(e,n,!0));l?(t.setStart(l,0),t.collapse(!0)):(l=(0,s.default)(e).parents("table").get(0),o?t.setStart(l.nextElementSibling,0):l.previousElementSibling&&"TABLE"!==l.previousElementSibling.nodeName?t.setStart(l.previousElementSibling,1):t.setStartBefore(l),t.collapse(!0))}},{key:"_moveCursorTo",value:function(e,t,n){var i=this.wwe.getEditor(),a=i.getSelection().cloneRange(),o=(0,s.default)(a.startContainer).closest("td,th").get(0),r=void 0;return a.collapsed&&this.isInTable(a)&&o&&("previous"!==e&&"row"!==t||c.default.isUndefined(n)||n.preventDefault(),this._changeSelectionToTargetCell(o,a,e,t),i.setSelection(a),r=!1),r}},{key:"_removeContentsAndChangeSelectionIfNeed",value:function(e,t,n){var i=t.length<=1,a="BACK_SPACE"===t||"DELETE"===t,o=this.wwe.componentManager.getManager("tableSelection").getSelectedCells(),r=o.first().get(0),l=!1;return(i||a)&&!this._isModifierKeyPushed(n)&&o.length&&(a&&this._recordUndoStateIfNeed(e),this._removeTableContents(o),this._lastCellNode=r,e.setStart(r,0),e.collapse(!0),this.wwe.getEditor().setSelection(e),l=!0),l}},{key:"getTableIDClassName",value:function(){var e="te-content-table-"+this.tableID;return this.tableID+=1,e}},{key:"_removeBRIfNeed",value:function(e){var t=f.default.isTextNode(e.startContainer),n=t?e.startContainer.parentNode:e.startContainer;/td|th/i.test(f.default.getNodeName(n))&&e.collapsed&&1===n.textContent.length&&(0,s.default)(n).find("br").remove()}},{key:"_insertBRIfNeed",value:function(e){var t=f.default.isTextNode(e.startContainer),n=t?e.startContainer.parentNode:e.startContainer,i=f.default.getNodeName(n),a=(0,s.default)(n);!/td|th/i.test(i)||!e.collapsed||n.textContent.length||a.children().length||g||(n.normalize(),a.append("<br>"))}},{key:"destroy",value:function(){var e=this;this.eventManager.removeEventHandler("wysiwygRangeChangeAfter.table"),this.eventManager.removeEventHandler("wysiwygSetValueAfter.table"),this.eventManager.removeEventHandler("wysiwygProcessHTMLText.table"),this.eventManager.removeEventHandler("cut.table"),this.eventManager.removeEventHandler("copyBefore.table"),this.wwe.getEditor().removeEventListener("paste",this.onBindedPaste),c.default.forEach(this.keyEventHandlers,function(t,n){return e.wwe.removeKeyEventHandler(n,t)})}}]),e}();t.default=p},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),l=i(r),s=n(1),u=i(s),c=n(3),d=i(c),f=function(){function e(t){a(this,e),this.wwe=t,this.eventManager=t.eventManager,this.name="tableSelection",this._init()}return o(e,[{key:"_init",value:function(){this._initEvent(),u.default.browser.firefox&&(document.execCommand("enableObjectResizing",!1,"false"),document.execCommand("enableInlineTableEditing",!1,"false"))}},{key:"_initEvent",value:function(){var e=this,t=void 0,n=void 0,i=void 0;this._tableSelectionTimer=null,this._removeSelectionTimer=null,this._isSelectionStarted=!1;var a=function(a){n=(0,l.default)(a.data.target).closest("[contenteditable=true] td,th").get(0);var o=e.wwe.getEditor().getSelection(),r=(0,l.default)(n).parents("[contenteditable=true] table").get(0),s=t===n,c=e._isTextSelect(o,s)&&!(0,l.default)(t).hasClass("te-cell-selected");e._isSelectionStarted&&r&&!c&&(window.getSelection().removeAllRanges(),u.default.browser.firefox&&!e._removeSelectionTimer&&(e._removeSelectionTimer=setInterval(function(){window.getSelection().removeAllRanges()},10)),e.highlightTableCellsBy(t,n),i=n)},o=function(){e._isSelectionStarted&&(e._isSelectionStarted=!1,e.eventManager.removeEventHandler("mouseover.tableSelection"),e.eventManager.removeEventHandler("mouseup.tableSelection"))},r=function(a){n=(0,l.default)(a.data.target).closest("[contenteditable=true] td,th").get(0);var r=e.wwe.getEditor().getSelection(),s=t===n,c=e._isTextSelect(r,s)&&!(0,l.default)(t).hasClass("te-cell-selected");e._clearTableSelectionTimerIfNeed(),e._isSelectionStarted&&(c?e.removeClassAttrbuteFromAllCellsIfNeed():(e.wwe.componentManager.getManager("table").resetLastCellNode(),n=n||i,r=e.wwe.getEditor().getSelection(),r.setStart(n,0),u.default.browser.msie?r.setEnd(n,1):(r.setEnd(n,0),r.collapse(!1)),e.wwe.getEditor().setSelection(r)),e.onDragEnd&&e.onDragEnd()),o()},s=function(i){t=(0,l.default)(i.data.target).closest("[contenteditable=true] td,th").get(0);var s=(0,l.default)(t).hasClass("te-cell-selected");n=null,!s||s&&2!==i.data.button?(e.removeClassAttrbuteFromAllCellsIfNeed(),e.setTableSelectionTimerIfNeed(t),e.eventManager.listen("mouseover.tableSelection",a),e.eventManager.listen("mouseup.tableSelection",r),e.onDragStart&&t&&e.onDragStart(t)):2===i.data.button&&o()};this.eventManager.listen("mousedown.tableSelection",s),this.eventManager.listen("copyBefore.tableSelection",o),this.eventManager.listen("pasteBefore.tableSelection",o)}},{key:"_isTextSelect",value:function(e,t){return/TD|TH|TEXT/i.test(e.commonAncestorContainer.nodeName)&&t}},{key:"setTableSelectionTimerIfNeed",value:function(e){(0,l.default)(e).parents("[contenteditable=true] table").length&&(this._isSelectionStarted=!0)}},{key:"_clearTableSelectionTimerIfNeed",value:function(){clearTimeout(this._tableSelectionTimer),u.default.browser.firefox&&this._removeSelectionTimer&&(clearTimeout(this._removeSelectionTimer),this._removeSelectionTimer=null)}},{key:"_reArrangeSelectionIfneed",value:function(e,t){var n=(0,l.default)(e).parents("[contenteditable=true] table").length,i=(0,l.default)(t).parents("[contenteditable=true] table").length,a=i&&!n,o=!i&&n;return a?e=(0,l.default)(t).parents("[contenteditable=true] table").find("th").first().get(0):o&&(t=(0,l.default)(e).parents("[contenteditable=true] table").find("td").last().get(0)),{startContainer:e,endContainer:t}}},{key:"_applySelectionDirection",value:function(e,t){var n=d.default.getNodeOffsetOfParent,i=e.startContainer,a=e.endContainer,o=n((0,l.default)(i).closest("[contenteditable=true] tr")[0])-n((0,l.default)(a).closest("[contenteditable=true] tr")[0]),r=n(i)-n(a),s=0===o,u=o<0,c=r>0;return s?c?(t.setStart(a,0),t.setEnd(i,1)):(t.setStart(i,0),t.setEnd(a,1)):u?(t.setStart(i,0),t.setEnd(a,1)):(t.setStart(a,0),t.setEnd(i,1)),t}},{key:"getSelectionRangeFromTable",value:function(e,t){var n=d.default.getNodeOffsetOfParent,i=n(e.parentNode),a=n(t.parentNode),o=n(e),r=n(t),s=d.default.getParentUntil(e,"TABLE"),u=d.default.getParentUntil(t,"TABLE"),c="TBODY"===d.default.getNodeName(s)&&"THEAD"===d.default.getNodeName(u),f=s!==u,h=!!(0,l.default)(e).parents("tbody").length&&!!(0,l.default)(t).parents("tbody").length,g={row:i,cell:o},v={row:a,cell:r},p=void 0,m=void 0;return c?g.row+=1:f?v.row+=1:h&&(g.row+=1,v.row+=1),i>a||i===a&&o>r?(p=v,m=g):(p=g,m=v),{from:p,to:m}}},{key:"highlightTableCellsBy",value:function(e,t){var n=(0,l.default)(e).parents("[contenteditable=true] table").find("tr"),i=this.getSelectionRangeFromTable(e,t),a=i.from.row,o=i.from.cell,r=i.to.row,s=i.to.cell;n.each(function(e,t){(0,l.default)(t).find("td,th").each(function(t,n){var i=(0,l.default)(n),u=e===a,c=e===r;u&&t<o||c&&t>s||e<a||e>r?i.removeClass("te-cell-selected"):i.addClass("te-cell-selected")})})}},{key:"removeClassAttrbuteFromAllCellsIfNeed",value:function(){this.wwe.get$Body().find("td.te-cell-selected,th.te-cell-selected").each(function(e,t){var n=(0,l.default)(t);n.removeClass("te-cell-selected"),n.attr("class").length||n.removeAttr("class")})}},{key:"getSelectedCells",value:function(){return this.wwe.get$Body().find(".te-cell-selected")}},{key:"createRangeBySelectedCells",value:function(){var e=this.wwe.getEditor(),t=e.getSelection().cloneRange(),n=this.getSelectedCells(),i=this.wwe.componentManager.getManager("table"),a=n.first().get(0),o=n.last().get(0);n.length&&i.isInTable(t)&&(t.setStart(a,0),t.setEnd(o,o.childNodes.length),e.setSelection(t))}},{key:"styleToSelectedCells",value:function(e){this.createRangeBySelectedCells(),e(this.wwe.getEditor())}},{key:"destroy",value:function(){this.eventManager.removeEventHandler("mousedown.tableSelection"),this.eventManager.removeEventHandler("mouseover.tableSelection"),this.eventManager.removeEventHandler("mouseup.tableSelection"),this.eventManager.removeEventHandler("copyBefore.tableSelection"),this.eventManager.removeEventHandler("pasteBefore.tableSelection")}}]),e}();t.default=f},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e){return e.replace(/[<>&]/g,function(e){return h[e]||e})}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=n(0),s=i(l),u=n(1),c=i(u),d=n(3),f=i(d),h={"&":"&amp;","<":"&lt;",">":"&gt;"},g=/\u200B/g,v=function(){function e(t){a(this,e),this.wwe=t,this.eventManager=t.eventManager,this.name="codeblock",this._init()}return r(e,[{key:"_init",value:function(){this._initKeyHandler(),this._initEvent()}},{key:"_initKeyHandler",value:function(){this.wwe.addKeyEventHandler("BACK_SPACE",this._removeCodeblockIfNeed.bind(this))}},{key:"_initEvent",value:function(){var e=this;this.eventManager.listen("wysiwygSetValueAfter",function(){e.splitCodeblockToEachLine()}),this.eventManager.listen("wysiwygProcessHTMLText",function(t){return e._mergeCodeblockEachlinesFromHTMLText(t)})}},{key:"prepareToPasteOnCodeblock",value:function(e){var t=this.wwe.getEditor().getSelection().cloneRange(),n=this.wwe.getEditor().getDocument().createDocumentFragment();return 1===e.length&&this._isCodeBlock(e[0])?n.appendChild(this._copyCodeblockTypeFromRangeCodeblock(e.shift(),t)):n.appendChild(this._copyCodeblockTypeFromRangeCodeblock(this.convertToCodeblock(e),t)),n}},{key:"convertToCodeblock",value:function(e){for(var t=(0,s.default)("<pre />"),n=this,i=e.shift();c.default.isTruthy(i);)t.append(n._makeCodeBlockLineHtml(c.default.isString(i)?i:i.textContent)),i=e.shift();return t.attr("data-te-codeblock",""),t[0]}},{key:"_copyCodeblockTypeFromRangeCodeblock",value:function(e,t){var n=f.default.getParentUntil(t.commonAncestorContainer,this.wwe.get$Body()[0]);if("PRE"===f.default.getNodeName(n)){var i=(0,s.default)(n).prop("attributes");c.default.forEach(i,function(t){(0,s.default)(e).attr(t.name,t.value)})}return e}},{key:"_mergeCodeblockEachlinesFromHTMLText",value:function(e){return e=e.replace(/<pre( .*?)?>(.*?)<\/pre>/g,function(e,t,n){return n=n.replace(/<br \/>/g,"\n"),n=n.replace(/<div ?(.*?)>/g,""),n=n.replace(/\n$/,""),"<pre><code"+(t||"")+">"+n+"</code></pre>"})}},{key:"splitCodeblockToEachLine",value:function(e){var t=this;e||(e=this.wwe.get$Body()),(0,s.default)(e).find("pre").each(function(e,n){var i=(0,s.default)(n),a=i.find("code").attr("data-language"),o=void 0;i.children().length>1&&(o=[],i.children().each(function(e,t){"DIV"!==t.nodeName&&"P"!==t.nodeName||(0,s.default)(t).find("br").length||(0,s.default)(t).append("<br>")})),i.find("br").replaceWith("\n"),o=i.text().replace(/\s+$/,"").split(/\n/g),a&&(i.attr("data-language",a),i.addClass("lang-"+a)),i.empty(),c.default.forEach(o,function(e){i.append(t._makeCodeBlockLineHtml(e))}),i.attr("data-te-codeblock","")})}},{key:"_makeCodeBlockLineHtml",value:function(e){return"<div>"+(e=e?o(e):"<br>")+"</div>"}},{key:"_removeCodeblockIfNeed",value:function(e,t){var n=this;if(!this.isInCodeBlock(t))return!0;var i=(0,s.default)(t.startContainer).closest("pre"),a=(0,s.default)(i).find("div").eq(0),o=a.text().replace(g,"");return 0!==t.startOffset&&0!==o.length||!((0,s.default)(i).find("div").length<=1)||(this.wwe.getEditor().modifyBlocks(function(){var e=n.wwe.getEditor().getDocument().createDocumentFragment(),t=void 0;return t=0===o.length?"<br>":a.html().replace(g,""),(0,s.default)(e).append((0,s.default)("<div>"+t+"</div>")),e}),!1)}},{key:"isInCodeBlock",value:function(e){var t=void 0;return t=e.collapsed?e.startContainer:e.commonAncestorContainer,this._isCodeBlock(t)}},{key:"_isCodeBlock",value:function(e){return!!(0,s.default)(e).closest("pre").length}}]),e}();t.default=v},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=n(0),u=i(s),c=n(8),d=i(c),f=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,{tagName:"div",className:"te-tab"}));return n.sections=e.sections,n._$activeButton=null,n._render(e),n._initEvent(e),n}return r(t,e),l(t,[{key:"_initEvent",value:function(e){var t=e.onItemClick;t&&this.on("itemClick",t),this.on("click button",this._onTabButton.bind(this))}},{key:"_render",value:function(e){for(var t=e.items,n=e.initName,i=[],a=0,o=t.length;a<o;a+=1)i.push('<button type="button" data-index="'+a+'">'+t[a]+"</button>");this.$el.html(i.join("")),this.activate(n)}},{key:"activate",value:function(e){var t=this.$el.find('button:contains("'+e+'")');this._activateTabByButton(t)}},{key:"_onTabButton",value:function(e){var t=(0,u.default)(e.target);this._activateTabByButton(t),this.trigger("itemClick",t.text())}},{key:"_activateTabByButton",value:function(e){this._isActivatedButton(e)||this._updateClassByButton(e)}},{key:"_updateClassByButton",value:function(e){if(this._$activeButton){var t=this._$activeButton.attr("data-index");this._$activeButton.removeClass("te-tab-active"),this.sections&&this.sections[t].removeClass("te-tab-active")}e.addClass("te-tab-active"),this._$activeButton=e;var n=e.attr("data-index");this.sections&&this.sections[n].addClass("te-tab-active")}},{key:"_isActivatedButton",value:function(e){return this._$activeButton&&this._$activeButton.text()===e.text()}}]),t}(d.default);t.default=f},function(e,t,n){"use strict";var i=n(0),a=function(e){return e&&e.__esModule?e:{default:e}}(i),o=n(39);a.default.fn.tuiEditor=function(){var e=void 0,t=void 0,n=this.get(0);if(n){for(var i=arguments.length,r=Array(i),l=0;l<i;l++)r[l]=arguments[l];if(e=r[0]||{},t=a.default.data(n,"tuiEditor")){if("string"==typeof e){var s;return(s=t)[e].apply(s,r.slice(1))}}else e.el=n,t=o.factory(e),a.default.data(n,"tuiEditor",t)}return this},e.exports=o},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),l=i(r),s=n(1),u=i(s),c=n(30),d=i(c),f=n(40),h=i(f),g=n(9),v=i(g),p=n(49),m=i(p),y=n(62),_=i(y),b=n(12),k=i(b),w=n(2),C=i(w),E=n(13),M=i(E),T=n(18),S=i(T),O=n(36),L=i(O),B=n(14),N=i(B),x=n(29),P=i(x),A=n(4),I=i(A),R=n(63),$=i(R),D=n(3),j=i(D),H=n(34),F=i(H),U=n(35),W=i(U),V=n(7),q=i(V),K=n(77),Y=i(K),z=n(78),G=i(z),X=n(79),J=i(X),Q=n(80),Z=i(Q),ee=n(81),te=i(ee),ne=n(82),ie=i(ne),ae=n(83),oe=i(ae),re=n(84),le=i(re),se=n(85),ue=i(se),ce=n(86),de=i(ce),fe=n(87),he=i(fe),ge=n(88),ve=i(ge),pe=n(89),me=i(pe),ye=n(90),_e=i(ye),be=n(91),ke=i(be),we=n(92),Ce=i(we),Ee=n(93),Me=i(Ee),Te=n(94),Se=i(Te),Oe=n(95),Le=i(Oe),Be=n(96),Ne=i(Be),xe=n(97),Pe=i(xe),Ae=n(98),Ie=i(Ae),Re=n(99),$e=i(Re),De=n(100),je=i(De),He=n(101),Fe=i(He),Ue=n(102),We=i(Ue),Ve=n(103),qe=i(Ve),Ke=n(104),Ye=i(Ke),ze=n(105),Ge=i(ze),Xe=n(106),Je=i(Xe),Qe=n(107),Ze=i(Qe),et=n(108),tt=i(et),nt=n(109),it=i(nt),at=n(110),ot=i(at),rt=n(111),lt=i(rt),st=n(112),ut=i(st),ct=n(113),dt=i(ct),ft=n(114),ht=i(ft);n(115),n(116),n(117),n(118),n(119);var gt=[],vt=function(){function e(t){var n=this;a(this,e),this.options=l.default.extend({previewStyle:"tab",initialEditType:"markdown",height:"300px",minHeight:"200px",language:"en_US",useDefaultHTMLSanitizer:!0,useCommandShortcut:!0,codeBlockLanguages:V.CodeBlockManager.getHighlightJSLanguages()},t),this.eventManager=new k.default,this.importManager=new S.default(this.eventManager),this.commandManager=new C.default(this,{useCommandShortcut:this.options.useCommandShortcut}),this.convertor=new N.default(this.eventManager),this.options.useDefaultHTMLSanitizer&&this.convertor.initHtmlSanitizer(),this.options.hooks&&u.default.forEach(this.options.hooks,function(e,t){return n.addHook(t,e)}),this.options.events&&u.default.forEach(this.options.events,function(e,t){return n.on(t,e)}),this.layout=new _.default(t,this.eventManager),this.i18n=I.default,this.i18n.setCode(this.options.language),this.setUI(this.options.UI||new $.default(this)),this.mdEditor=h.default.factory(this.layout.getMdEditorContainerEl(),this.eventManager),this.preview=new v.default(this.layout.getPreviewEl(),this.eventManager,this.convertor),this.wwEditor=m.default.factory(this.layout.getWwEditorContainerEl(),this.eventManager,{useCommandShortcut:this.options.useCommandShortcut}),this.toMarkOptions=null,this.changePreviewStyle(this.options.previewStyle),this.changeMode(this.options.initialEditType,!0),this.setValue(this.options.initialValue,!1),this.minHeight(this.options.minHeight),this.height(this.options.height),M.default.applyExtension(this,this.options.exts),this.eventManager.emit("load",this),gt.push(this),this._addDefaultCommands()}return o(e,[{key:"changePreviewStyle",value:function(e){this.layout.changePreviewStyle(e),this.mdPreviewStyle=e,this.eventManager.emit("changePreviewStyle",e),this.eventManager.emit("previewNeedsRefresh")}},{key:"exec",value:function(){var e;(e=this.commandManager).exec.apply(e,arguments)}},{key:"_addDefaultCommands",value:function(){this.addCommand(Y.default),this.addCommand(G.default),this.addCommand(Z.default),this.addCommand(te.default),this.addCommand(ie.default),this.addCommand(oe.default),this.addCommand(le.default),this.addCommand(ue.default),this.addCommand(de.default),this.addCommand(he.default),this.addCommand(ve.default),this.addCommand(me.default),this.addCommand(_e.default),this.addCommand(ke.default),this.addCommand(J.default),this.addCommand(Ce.default),this.addCommand(Me.default),this.addCommand(Le.default),this.addCommand(Fe.default),this.addCommand(We.default),this.addCommand(Ne.default),this.addCommand(Pe.default),this.addCommand(Ie.default),this.addCommand($e.default),this.addCommand(je.default),this.addCommand(ot.default),this.addCommand(lt.default),this.addCommand(ut.default),this.addCommand(qe.default),this.addCommand(Ye.default),this.addCommand(Ge.default),this.addCommand(Je.default),this.addCommand(Ze.default),this.addCommand(tt.default),this.addCommand(it.default),this.addCommand(dt.default),this.addCommand(ht.default),this.addCommand(Se.default)}},{key:"addCommand",value:function(e,t){t?this.commandManager.addCommand(C.default.command(e,t)):this.commandManager.addCommand(e)}},{key:"afterAddedCommand",value:function(){this.eventManager.emit("afterAddedCommand",this)}},{key:"on",value:function(e,t){this.eventManager.listen(e,t)}},{key:"off",value:function(e){this.eventManager.removeEventHandler(e)}},{key:"addHook",value:function(e,t){this.eventManager.removeEventHandler(e),this.eventManager.listen(e,t)}},{key:"removeHook",value:function(e){this.eventManager.removeEventHandler(e)}},{key:"getCodeMirror",value:function(){return this.mdEditor.getEditor()}},{key:"getSquire",value:function(){return this.wwEditor.getEditor()}},{key:"focus",value:function(){this.getCurrentModeEditor().focus()}},{key:"blur",value:function(){this.getCurrentModeEditor().blur()}},{key:"moveCursorToEnd",value:function(){this.getCurrentModeEditor().moveCursorToEnd()}},{key:"moveCursorToStart",value:function(){this.getCurrentModeEditor().moveCursorToStart()}},{key:"setMarkdown",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];e=e||"",this.isMarkdownMode()?this.mdEditor.setValue(e,t):this.wwEditor.setValue(this.convertor.toHTML(e),t),this.eventManager.emit("setMarkdownAfter",e)}},{key:"setHtml",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(e=e||"",this.wwEditor.setValue(e),this.isMarkdownMode()){var n=this.convertor.toMarkdown(this.wwEditor.getValue(),this.toMarkOptions);this.mdEditor.setValue(n,t),this.eventManager.emit("setMarkdownAfter",n)}}},{key:"setValue",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.setMarkdown(e,t)}},{key:"getMarkdown",value:function(){return this.isMarkdownMode()?this.mdEditor.getValue():this.convertor.toMarkdown(this.wwEditor.getValue(),this.toMarkOptions)}},{key:"getHtml",value:function(){return this.isWysiwygMode()&&this.mdEditor.setValue(this.convertor.toMarkdown(this.wwEditor.getValue(),this.toMarkOptions)),this.convertor.toHTML(this.mdEditor.getValue())}},{key:"getValue",value:function(){return this.getMarkdown()}},{key:"insertText",value:function(e){this.isMarkdownMode()?this.mdEditor.replaceSelection(e):this.wwEditor.insertText(e)}},{key:"addWidget",value:function(e,t,n,i){this.getCurrentModeEditor().addWidget(e,t,n,i)}},{key:"height",value:function(e){return u.default.isExisty(e)&&("auto"===e?(this.options.el.classList.add("auto-height"),this.minHeight(this.minHeight())):(this.options.el.classList.remove("auto-height"),this.minHeight(e)),u.default.isNumber(e)&&(e+="px"),this.options.el.style.height=e,this._height=e),this._height}},{key:"minHeight",value:function(e){if(u.default.isExisty(e)){var t=this._ui.getEditorHeight(),n=this._ui.getEditorSectionHeight(),i=t-n;this._minHeight=e,e=parseInt(e,10),e=Math.max(e-i,0),this.wwEditor.setMinHeight(e),this.mdEditor.setMinHeight(e),this.preview.setMinHeight(e)}return this._minHeight}},{key:"getCurrentModeEditor",value:function(){return this.isMarkdownMode()?this.mdEditor:this.wwEditor}},{key:"isMarkdownMode",value:function(){return"markdown"===this.currentMode}},{key:"isWysiwygMode",value:function(){return"wysiwyg"===this.currentMode}},{key:"isViewer",value:function(){return!1}},{key:"getCurrentPreviewStyle",value:function(){return this.mdPreviewStyle}},{key:"changeMode",value:function(e,t){this.currentMode!==e&&(this.eventManager.emit("changeModeBefore",this.currentMode),this.currentMode=e,this.isWysiwygMode()?(this.layout.switchToWYSIWYG(),this.wwEditor.setValue(this.convertor.toHTML(this.mdEditor.getValue()),!t),this.eventManager.emit("changeModeToWysiwyg")):(this.layout.switchToMarkdown(),this.mdEditor.setValue(this.convertor.toMarkdown(this.wwEditor.getValue(),this.toMarkOptions),!t),this.getCodeMirror().refresh(),this.eventManager.emit("changeModeToMarkdown")),this.eventManager.emit("changeMode",e),t||this.focus())}},{key:"remove",value:function(){var e=this,t=gt.length-1;for(this.wwEditor.remove(),this.mdEditor.remove(),this.layout.remove(),this.getUI()&&this.getUI().remove(),this.eventManager.emit("removeEditor"),this.eventManager.events.forEach(function(t,n){e.off(n)}),this.eventManager=null;t>=0;t-=1)gt[t]===this&&gt.splice(t,1)}},{key:"hide",value:function(){this.eventManager.emit("hide",this)}},{key:"show",value:function(){this.eventManager.emit("show",this),this.getCodeMirror().refresh()}},{key:"scrollTop",value:function(e){return this.getCurrentModeEditor().scrollTop(e)}},{key:"setUI",value:function(e){this._ui=e}},{key:"getUI",value:function(){return this._ui}},{key:"reset",value:function(){this.wwEditor.reset(),this.mdEditor.reset()}},{key:"getRange",value:function(){return this.getCurrentModeEditor().getRange()}},{key:"getTextObject",value:function(e){return this.getCurrentModeEditor().getTextObject(e)}},{key:"getSelectedText",value:function(){var e=this.getRange();return this.getTextObject(e).getTextContent()||""}}],[{key:"getInstances",value:function(){return gt}},{key:"defineExtension",value:function(e,t){M.default.defineExtension(e,t)}},{key:"factory",value:function(t){return t.viewer?new P.default(t):new e(t)}}]),e}();vt.isViewer=!1,vt.i18n=I.default,vt.domUtils=j.default,vt.codeBlockManager=q.default,vt.Button=d.default,vt.WwCodeBlockManager=L.default,vt.WwTableManager=F.default,vt.WwTableSelectionManager=W.default,vt.CommandManager=C.default,vt.markdownitHighlight=N.default.getMarkdownitHighlightRenderer(),e.exports=vt},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=function e(t,n,i){null===t&&(t=Function.prototype);var a=Object.getOwnPropertyDescriptor(t,n);if(void 0===a){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in a)return a.value;var r=a.get;if(void 0!==r)return r.call(i)},u=n(1),c=i(u),d=n(32),f=i(d),h=n(15),g=i(h),v=n(47),p=i(v),m=n(33),y=i(m),_=n(48),b=i(_),k=g.default.getSharedInstance(),w=function(e){function t(e,n){a(this,t);var i=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e.get(0),{mode:"gfm",dragDrop:!0,allowDropFileTypes:["image"],extraKeys:{Enter:"newlineAndIndentContinue",Tab:"subListIndentTab","Shift-Tab":"indentLessOrderedList"}}));return i.eventManager=n,i.componentManager=new y.default(i),i.componentManager.addManager(p.default),i._latestState=null,i._initEvent(),i}return r(t,e),l(t,[{key:"_initEvent",value:function(){var e=this;this.cm.getWrapperElement().addEventListener("click",function(){e.eventManager.emit("click",{source:"markdown"})}),this.cm.on("beforeChange",function(t,n){"paste"===n.origin&&e.eventManager.emit("pasteBefore",{source:"markdown",data:n})}),this.cm.on("change",function(t,n){e._emitMarkdownEditorContentChangedEvent(),e._emitMarkdownEditorChangeEvent(n)}),this.cm.on("focus",function(){e.eventManager.emit("focus",{source:"markdown"}),e.getEditor().refresh()}),this.cm.on("blur",function(){e.eventManager.emit("blur",{source:"markdown"})}),this.cm.on("scroll",function(t,n){e.eventManager.emit("scroll",{source:"markdown",data:n})}),this.cm.on("keydown",function(t,n){e.eventManager.emit("keydown",{source:"markdown",data:n}),e.eventManager.emit("keyMap",{source:"markdown",keyMap:k.convert(n),data:n})}),this.cm.on("keyup",function(t,n){e.eventManager.emit("keyup",{source:"markdown",data:n})}),this.cm.on("copy",function(t,n){e.eventManager.emit("copy",{source:"markdown",data:n})}),this.cm.on("cut",function(t,n){e.eventManager.emit("cut",{source:"markdown",data:n})}),this.cm.on("paste",function(t,n){e.eventManager.emit("paste",{source:"markdown",data:n})}),this.cm.on("drop",function(t,n){n.preventDefault(),e.eventManager.emit("drop",{source:"markdown",data:n})}),this.cm.on("cursorActivity",function(){var t=e.cm.getTokenAt(e.cm.getCursor()),n=t.state,i=n.base,a=n.overlay,o={bold:!!i.strong,italic:!!i.em,strike:!!i.strikethrough,code:!!a.code,codeBlock:!!a.codeBlock,quote:!!i.quote,list:!!i.list,task:!!i.task,source:"markdown"};e._latestState&&!e._isStateChanged(e._latestState,o)||(e.eventManager.emit("stateChange",o),e._latestState=o)})}},{key:"setValue",value:function(e,n){s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,e,n),this._emitMarkdownEditorContentChangedEvent()}},{key:"getTextObject",value:function(e){return new b.default(this,e)}},{key:"_emitMarkdownEditorContentChangedEvent",value:function(){this.eventManager.emit("contentChangedFromMarkdown",this)}},{key:"_emitMarkdownEditorChangeEvent",value:function(e){if("setValue"!==e.origin){var t={source:"markdown"};this.eventManager.emit("changeFromMarkdown",t),this.eventManager.emit("change",t)}}},{key:"_isStateChanged",value:function(e,t){var n=!1;return c.default.forEach(t,function(t,i){return!(n=e[i]!==t)}),n}}],[{key:"factory",value:function(e,n){return new t(e,n)}}]),t}(f.default);t.default=w},function(e,t,n){"use strict";function i(e,t,n,a){var o=void 0,r=void 0,s=void 0,u=void 0,c=n,d=a.getLine(e);do{var f=l.exec(d);if(o=f[1],r=f[4],s=f[5],(u=o.length)===t)a.replaceRange(""+o+c+r+s,{line:e,ch:0},{line:e,ch:d.length}),c+=1,e+=1;else{if(!(u>t))return e;e=i(e,u,1,a)}d=a.getLine(e)}while(l.test(d));return e}function a(e,t){for(var n=e,i=t.getLine(e);l.test(i);)n-=1,i=t.getLine(n);return e===n?n=-1:n+=1,n}var o=n(6),r=function(e){return e&&e.__esModule?e:{default:e}}(o),l=/^(\s*)((\d+)([.)]\s(?:\[(?:x|\s)\]\s)?))(.*)/;r.default.commands.indentLessOrderedList=function(e){return e.getOption("disableInput")?r.default.Pass:(e.execCommand("indentLess"),e.execCommand("fixOrderedListNumber"),null)},r.default.commands.fixOrderedListNumber=function(e){if(e.getOption("disableInput"))return r.default.Pass;for(var t=e.listSelections(),n=0;n<t.length;n+=1){var o=t[n].head,s=a(o.line,e);if(s>=0){var u=e.getLine(s),c=l.exec(u),d=c[1],f=c[3];i(s,d.length,parseInt(f,10),e)}}return null}},function(e,t,n){"use strict";var i=n(6),a=function(e){return e&&e.__esModule?e:{default:e}}(i);a.default.overlayMode=function(e,t,n){return{startState:function(){return{base:a.default.startState(e),overlay:a.default.startState(t),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,streamSeen:null}},copyState:function(n){return{base:a.default.copyState(e,n.base),overlay:a.default.copyState(t,n.overlay),basePos:n.basePos,baseCur:null,overlayPos:n.overlayPos,overlayCur:null}},token:function(i,a){return(i!=a.streamSeen||Math.min(a.basePos,a.overlayPos)<i.start)&&(a.streamSeen=i,a.basePos=a.overlayPos=i.start),i.start==a.basePos&&(a.baseCur=e.token(i,a.base),a.basePos=i.pos),i.start==a.overlayPos&&(i.pos=i.start,a.overlayCur=t.token(i,a.overlay),a.overlayPos=i.pos),i.pos=Math.min(a.basePos,a.overlayPos),null==a.overlayCur?a.baseCur:null!=a.baseCur&&a.overlay.combineTokens||n&&null==a.overlay.combineTokens?a.baseCur+" "+a.overlayCur:a.overlayCur},indent:e.indent&&function(t,n){return e.indent(t.base,n)},electricChars:e.electricChars,innerMode:function(t){return{state:t.base,mode:e}},blankLine:function(n){e.blankLine&&e.blankLine(n.base),t.blankLine&&t.blankLine(n.overlay)}}}},function(e,t,n){"use strict";var i=n(6),a=function(e){return e&&e.__esModule?e:{default:e}}(i);a.default.defineMode("markdown",function(e,t){function n(t){if(a.default.findModeByName){var n=a.default.findModeByName(t);n&&(t=n.mime||n.mimes[0])}var i=a.default.getMode(e,t);return"null"==i.name?null:i}function i(e,t,n){return t.f=t.inline=n,n(e,t)}function o(e){return!e||!/\S/.test(e.string)}function r(e){return e.linkTitle=!1,e.em=!1,e.strong=!1,e.strikethrough=!1,e.quote=0,e.indentedCode=!1,k||e.f!=s||(e.f=h,e.block=l),e.trailingSpace=0,e.trailingSpaceNewLine=!1,e.prevLine=e.thisLine,e.thisLine=null,null}function l(e,a){var r=e.sol(),l=!1!==a.list,s=a.indentedCode;a.indentedCode=!1,l&&(a.indentationDiff>=0&&(a.indentationDiff<4&&(a.indentation-=a.indentationDiff),a.list=null),a.indentation>0?(a.list=null,a.listDepth=Math.floor(a.indentation/4)):(a.list=!1,a.listDepth=0));var c=null;if(a.indentationDiff>=4)return e.skipToEnd(),s||o(a.prevLine)?(a.indentation-=4,a.indentedCode=!0,M):null;if(e.eatSpace())return null;if((c=e.match(V))&&c[1].length<=6)return a.header=c[1].length,t.highlightFormatting&&(a.formatting="header"),a.f=a.inline,d(a);if(!(o(a.prevLine)||a.quote||l||s)&&(c=e.match(q)))return a.header="="==c[0].charAt(0)?1:2,t.highlightFormatting&&(a.formatting="header"),a.f=a.inline,d(a);if(e.eat(">"))return a.quote=r?1:a.quote+1,t.highlightFormatting&&(a.formatting="quote"),e.eatSpace(),d(a);if("["===e.peek())return i(e,a,m);if(e.match(H,!0))return a.hr=!0,B;if((o(a.prevLine)||l)&&(e.match(F,!1)||e.match(U,!1))){var f=null;return e.match(F,!0)?f="ul":(e.match(U,!0),f="ol"),a.indentation+=4,a.list=!0,a.listDepth++,t.taskLists&&e.match(W,!1)&&(a.taskList=!0,a.task=!0),a.f=a.inline,t.highlightFormatting&&(a.formatting=["list","list-"+f]),d(a)}return t.fencedCodeBlocks&&(c=e.match(Y,!0))?(a.fencedChars=c[1],a.localMode=n(c[2]),a.localMode&&(a.localState=a.localMode.startState()),a.f=a.block=u,t.highlightFormatting&&(a.formatting="code-block"),a.code=!0,d(a)):i(e,a,a.inline)}function s(e,t){var n=w.token(e,t.htmlState);return(k&&null===t.htmlState.tagStart&&!t.htmlState.context&&t.htmlState.tokenize.isInText||t.md_inside&&e.current().indexOf(">")>-1)&&(t.f=h,t.block=l,t.htmlState=null),n}function u(e,t){return e.sol()&&t.fencedChars&&e.match(t.fencedChars,!1)?(t.localMode=t.localState=null,t.f=t.block=c,null):t.localMode?t.localMode.token(e,t.localState):(e.skipToEnd(),M)}function c(e,n){e.match(n.fencedChars),n.block=l,n.f=h,n.fencedChars=null,t.highlightFormatting&&(n.formatting="code-block"),n.code=!0;var i=d(n);return n.code=!1,i}function d(e){var n=[];if(e.formatting){n.push(x),"string"==typeof e.formatting&&(e.formatting=[e.formatting]);for(var i=0;i<e.formatting.length;i++)n.push(x+"-"+e.formatting[i]),"header"===e.formatting[i]&&n.push(x+"-"+e.formatting[i]+"-"+e.header),"quote"===e.formatting[i]&&(!t.maxBlockquoteDepth||t.maxBlockquoteDepth>=e.quote?n.push(x+"-"+e.formatting[i]+"-"+e.quote):n.push("error"))}if(e.taskOpen)return n.push("meta"),n.length?n.join(" "):null;if(e.taskClosed)return n.push("property"),n.length?n.join(" "):null;if(e.linkHref?n.push(R,"url"):(e.strong&&n.push(D),e.em&&n.push($),e.strikethrough&&n.push(j),e.linkText&&n.push(I),e.code&&n.push(M)),e.header&&(n.push(E),n.push(E+"-"+e.header)),e.quote&&(n.push(T),!t.maxBlockquoteDepth||t.maxBlockquoteDepth>=e.quote?n.push(T+"-"+e.quote):n.push(T+"-"+t.maxBlockquoteDepth)),!1!==e.list){var a=(e.listDepth-1)%3;a?1===a?n.push(O):n.push(L):n.push(S)}return e.trailingSpaceNewLine?n.push("trailing-space-new-line"):e.trailingSpace&&n.push("trailing-space-"+(e.trailingSpace%2?"a":"b")),n.length?n.join(" "):null}function f(e,t){if(e.match(K,!0))return d(t)}function h(e,n){var i=n.text(e,n);if(void 0!==i)return i;if(n.list)return n.list=null,d(n);if(n.taskList){return"x"!==e.match(W,!0)[1]?n.taskOpen=!0:n.taskClosed=!0,t.highlightFormatting&&(n.formatting="task"),n.taskList=!1,d(n)}if(n.taskOpen=!1,n.taskClosed=!1,n.header&&e.match(/^#+$/,!0))return t.highlightFormatting&&(n.formatting="header"),d(n);var a=e.sol(),o=e.next();if("\\"===o&&(e.next(),t.highlightFormatting)){var r=d(n);return r?r+" formatting-escape":"formatting-escape"}if(n.linkTitle){n.linkTitle=!1;var l=o;"("===o&&(l=")"),l=(l+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1");var s="^\\s*(?:[^"+l+"\\\\]+|\\\\\\\\|\\\\.)"+l;if(e.match(new RegExp(s),!0))return R}if("`"===o){var u=n.formatting;t.highlightFormatting&&(n.formatting="code");var c=d(n),f=e.pos;e.eatWhile("`");var h=1+e.pos-f;return n.code?h===C?(n.code=!1,c):(n.formatting=u,d(n)):(C=h,n.code=!0,d(n))}if(n.code)return d(n);if("!"===o&&e.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return e.match(/\[[^\]]*\]/),N;if("["===o&&e.match(/.*\](\(.*\)| ?\[.*\])/,!1))return n.linkText=!0,t.highlightFormatting&&(n.formatting="link"),d(n);if("]"===o&&n.linkText&&e.match(/\(.*\)| ?\[.*\]/,!1)){t.highlightFormatting&&(n.formatting="link");var r=d(n);return n.linkText=!1,n.inline=n.f=v,r}if("<"===o&&e.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){n.f=n.inline=g,t.highlightFormatting&&(n.formatting="link");var r=d(n);return r?r+=" ":r="",r+P}if("<"===o&&e.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){n.f=n.inline=g,t.highlightFormatting&&(n.formatting="link");var r=d(n);return r?r+=" ":r="",r+A}var p=!1;if(!t.underscoresBreakWords&&"_"===o&&"_"!==e.peek()&&e.match(/(\w)/,!1)){var m=e.pos-2;if(m>=0){var y=e.string.charAt(m);"_"!==y&&y.match(/(\w)/,!1)&&(p=!0)}}if("*"===o||"_"===o&&!p)if(a&&" "===e.peek());else{if(n.strong===o&&e.eat(o)){t.highlightFormatting&&(n.formatting="strong");var c=d(n);return n.strong=!1,c}if(!n.strong&&e.eat(o))return n.strong=o,t.highlightFormatting&&(n.formatting="strong"),d(n);if(n.em===o){t.highlightFormatting&&(n.formatting="em");var c=d(n);return n.em=!1,c}if(!n.em)return n.em=o,t.highlightFormatting&&(n.formatting="em"),d(n)}else if(" "===o&&(e.eat("*")||e.eat("_"))){if(" "===e.peek())return d(n);e.backUp(1)}if(t.strikethrough)if("~"===o&&e.eatWhile(o)){if(n.strikethrough){t.highlightFormatting&&(n.formatting="strikethrough");var c=d(n);return n.strikethrough=!1,c}if(e.match(/^[^\s]/,!1))return n.strikethrough=!0,t.highlightFormatting&&(n.formatting="strikethrough"),d(n)}else if(" "===o&&e.match(/^~~/,!0)){if(" "===e.peek())return d(n);e.backUp(2)}return" "===o&&(e.match(/ +$/,!1)?n.trailingSpace++:n.trailingSpace&&(n.trailingSpaceNewLine=!0)),d(n)}function g(e,n){if(">"===e.next()){n.f=n.inline=h,t.highlightFormatting&&(n.formatting="link");var i=d(n);return i?i+=" ":i="",i+P}return e.match(/^[^>]+/,!0),P}function v(e,n){if(e.eatSpace())return null;var i=e.next();return"("===i||"["===i?(n.f=n.inline=p("("===i?")":"]"),t.highlightFormatting&&(n.formatting="link-string"),n.linkHref=!0,d(n)):"error"}function p(e){return function(n,i){if(n.next()===e){i.f=i.inline=h,t.highlightFormatting&&(i.formatting="link-string");var a=d(i);return i.linkHref=!1,a}return n.match(b(e),!0)&&n.backUp(1),i.linkHref=!0,d(i)}}function m(e,n){return e.match(/^[^\]]*\]:/,!1)?(n.f=y,e.next(),t.highlightFormatting&&(n.formatting="link"),n.linkText=!0,d(n)):i(e,n,h)}function y(e,n){if(e.match(/^\]:/,!0)){n.f=n.inline=_,t.highlightFormatting&&(n.formatting="link");var i=d(n);return n.linkText=!1,i}return e.match(/^[^\]]+/,!0),I}function _(e,t){return e.eatSpace()?null:(e.match(/^[^\s]+/,!0),void 0===e.peek()?t.linkTitle=!0:e.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),t.f=t.inline=h,R+" url")}function b(e){return z[e]||(e=(e+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),z[e]=new RegExp("^(?:[^\\\\]|\\\\.)*?("+e+")")),z[e]}var k=a.default.modes.hasOwnProperty("xml"),w=a.default.getMode(e,k?{name:"xml",htmlMode:!0}:"text/plain");void 0===t.highlightFormatting&&(t.highlightFormatting=!1),void 0===t.maxBlockquoteDepth&&(t.maxBlockquoteDepth=0),void 0===t.underscoresBreakWords&&(t.underscoresBreakWords=!0),void 0===t.taskLists&&(t.taskLists=!1),void 0===t.strikethrough&&(t.strikethrough=!1);var C=0,E="header",M="comment",T="quote",S="variable-2",O="variable-3",L="keyword",B="hr",N="tag",x="formatting",P="link",A="link",I="link",R="string",$="em",D="strong",j="strikethrough",H=/^([*\-_])(?:\s*\1){2,}\s*$/,F=/^[*\-+]\s+/,U=/^[0-9]+([.)])\s+/,W=/^\[(x| )\](?=\s)/,V=t.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,q=/^ *(?:\={1,}|-{1,})\s*$/,K=/^[^#!\[\]*_\\<>` "'(~]+/,Y=new RegExp("^("+(!0===t.fencedCodeBlocks?"~~~+|```+":t.fencedCodeBlocks)+")[ \\t]*([\\w+#]*)"),z=[],G={startState:function(){return{f:l,prevLine:null,thisLine:null,block:l,htmlState:null,indentation:0,inline:h,text:f,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,em:!1,strong:!1,header:0,hr:!1,task:!1,taskList:!1,list:!1,listDepth:0,quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,fencedChars:null}},copyState:function(e){return{f:e.f,prevLine:e.prevLine,thisLine:e.this,block:e.block,htmlState:e.htmlState&&a.default.copyState(w,e.htmlState),indentation:e.indentation,localMode:e.localMode,localState:e.localMode?a.default.copyState(e.localMode,e.localState):null,inline:e.inline,text:e.text,formatting:!1,linkTitle:e.linkTitle,code:e.code,em:e.em,strong:e.strong,strikethrough:e.strikethrough,header:e.header,hr:e.hr,taskList:e.taskList,task:e.task,list:e.list,listDepth:e.listDepth,quote:e.quote,indentedCode:e.indentedCode,trailingSpace:e.trailingSpace,trailingSpaceNewLine:e.trailingSpaceNewLine,md_inside:e.md_inside,fencedChars:e.fencedChars}},token:function(e,t){if(t.formatting=!1,e!=t.thisLine){var n=t.header||t.hr;if(t.header=0,t.hr=!1,e.match(/^\s*$/,!0)||n){if(r(t),!n)return null;t.prevLine=null}t.prevLine=t.thisLine,t.thisLine=e,t.taskList=!1,t.task=!1,t.trailingSpace=0,t.trailingSpaceNewLine=!1,t.f=t.block;var i=e.match(/^\s*/,!0)[0].replace(/\t/g,"    ").length,a=4*Math.floor((i-t.indentation)/4);a>4&&(a=4);var o=t.indentation+a;if(t.indentationDiff=o-t.indentation,t.indentation=o,i>0)return null}return t.f(e,t)},innerMode:function(e){return e.block==s?{state:e.htmlState,mode:w}:e.localState?{state:e.localState,mode:e.localMode}:{state:e,mode:G}},blankLine:r,getType:d,closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return G},"xml"),a.default.defineMIME("text/x-markdown","markdown")},function(e,t,n){"use strict";var i=n(6),a=function(e){return e&&e.__esModule?e:{default:e}}(i);a.default.defineMode("gfm",function(e,t){function n(e){return e.code=!1,null}var i=0,o={startState:function(){return{code:!1,codeBlock:!1,ateSpace:!1}},copyState:function(e){return{code:e.code,codeBlock:e.codeBlock,ateSpace:e.ateSpace}},token:function(e,t){if(t.combineTokens=null,t.codeBlock)return e.match(/^```+/)?(t.codeBlock=!1,null):(e.skipToEnd(),null);if(e.sol()&&(t.code=!1),e.sol()&&e.match(/^```+/))return e.skipToEnd(),t.codeBlock=!0,null;if("`"===e.peek()){e.next();var n=e.pos;e.eatWhile("`");var a=1+e.pos-n;return t.code?a===i&&(t.code=!1):(i=a,t.code=!0),null}return t.code?(e.next(),null):e.eatSpace()?(t.ateSpace=!0,null):((e.sol()||t.ateSpace)&&(t.ateSpace=!1),e.next(),null)},blankLine:n},r={underscoresBreakWords:!1,taskLists:!0,fencedCodeBlocks:"```",strikethrough:!0};for(var l in t)r[l]=t[l];return r.name="markdown",a.default.overlayMode(a.default.getMode(e,r),o)},"markdown"),a.default.defineMIME("text/x-gfm","gfm")},function(e,t,n){"use strict";var i=n(6),a=function(e){return e&&e.__esModule?e:{default:e}}(i),o=/^(\s*)(>[> ]*|[*+-]\s(?:\[(?:x|\s)\]\s)?|(\d+)([.)]\s(?:\[(?:x|\s)\]\s)?))(\s*)/,r=/^(\s*)(>[> ]*|[*+-]\s(?:\[(?:x|\s)\]\s)?|(\d+)([.)]\s(?:\[(?:x|\s)\]\s)?))(\s*)$/,l=/^ *(`{3,}|~{3,})[ \.]*\S+ */,s=/[*+-]\s/;a.default.commands.subListIndentTab=function(e){if(e.getOption("disableInput"))return a.default.Pass;for(var t=e.listSelections(),n=0;n<t.length;n++){var i=t[n].head,r=e.getLine(i.line),l=r.substr(0,i.ch);o.test(l)?(e.replaceRange(Array(e.getOption("indentUnit")+1).join(" ")+r,{line:i.line,ch:0},{line:i.line,ch:r.length},"+input"),e.setCursor(i.line,i.ch+4)):e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertSoftTab")}e.execCommand("fixOrderedListNumber")},a.default.commands.newlineAndIndentContinue=function(e){if(e.getOption("disableInput"))return a.default.Pass;for(var t=e.listSelections(),n=[],i=0;i<t.length;i++){var u=t[i].head,c=e.getStateAfter(u.line),d=!1!==c.base.list,f=0!==c.base.quote,h=e.getLine(u.line),g=l.test(h),v=o.exec(h),p=e.getCursor();if(!t[i].empty()||!d&&!f&&!g||!v&&!g)return void e.execCommand("newlineAndIndent");if(g&&(p=e.getCursor(),p.line!==u.line||p.ch!==h.length))return void e.execCommand("newlineAndIndent");if(r.test(h)&&p.ch>0)e.replaceRange("",{line:u.line,ch:0},{line:u.line,ch:h.length}),n[i]="\n";else if(g)n[i]="\n\n```";else{var m,y=v[1],_=v[5];m=y.length===u.ch?"":s.test(v[2])||v[2].indexOf(">")>=0?v[2]:parseInt(v[3],10)+1+v[4],n[i]="\n"+y+m+_}}e.replaceSelections(n),g&&e.setCursor(u.line+1,0)}},function(e,t,n){"use strict";function i(e){return a(e)&&e.anchor.ch===e.head.ch}function a(e){return e.anchor.line===e.head.line}function o(e,t,n,a){var o=e.getLine(n.line),r=e.getLine(n.line+a),l={anchor:t,head:n};e.replaceRange(r,{line:n.line,ch:0},{line:n.line,ch:o.length},"+input"),e.replaceRange(o,{line:n.line+a,ch:0},{line:n.line+a,ch:r.length},"+input"),i(l)?e.setCursor({line:n.line+a,ch:n.ch}):e.setSelection({line:t.line+a,ch:t.ch},{line:n.line+a,ch:n.ch})}function r(e,t,n,i){var a=e.getRange({line:t.line,ch:0},{line:n.line,ch:e.getLine(n.line).length}),o=i>0?n:t,r=e.getLine(o.line+i),l=void 0;l=i>0?t:n,e.replaceRange(r,{line:l.line,ch:0},{line:l.line,ch:e.getLine(l.line).length},"+input"),e.replaceRange(a,{line:t.line+i,ch:0},{line:n.line+i,ch:e.getLine(n.line+i).length},"+input"),e.setSelection({line:t.line+i,ch:t.ch},{line:n.line+i,ch:n.ch})}var l=n(6),s=function(e){return e&&e.__esModule?e:{default:e}}(l);s.default.commands.replaceLineTextToUpper=function(e){if(e.getOption("disableInput"))return s.default.Pass;for(var t=e.listSelections(),n=0;n<t.length;n++){var l=t[n],u=l.anchor,c=l.head;if(a(l)&&c.line>0)o(e,u,c,-1);else if(!i(l)){var d=u.line<c.line?u.line:c.line;if(d>0){var f=u.line===d?u:c,h=u.line===d?c:u;r(e,f,h,-1)}}}},s.default.commands.replaceLineTextToLower=function(e){if(e.getOption("disableInput"))return s.default.Pass;for(var t=e.listSelections(),n=0;n<t.length;n++){var l=t[n],u=l.anchor,c=l.head,d=c.line===e.lastLine();if(a(l)&&!d)o(e,u,c,1);else if(!i(l)){var f=u.line<c.line?u.line:c.line,h=u.line===f?u:c,g=u.line===f?c:u;g.line<e.lastLine()&&r(e,h,g,1)}}}},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=/^[ \t]*[\d]+\. .*/,r=/^[ \t]*[-*] .*/,l=/^[ \t]*[-*]( \[[ xX]])? .*/,s=/^\|([-\s\w\d\t<>?!@#$%^&*()_=+\\\/'";: \r[\]]*\|+)+/i,u=/^#+\s/,c=/^ {0,3}(```|\||>)/,d=function(){function e(t){i(this,e),this.mde=t,this.eventManager=t.eventManager,this.name="list"}return a(e,[{key:"isListOrParagraph",value:function(e){return!c.test(e)&&!s.test(e)&&!u.test(e)}},{key:"appendBlankLineIfNeed",value:function(e,t,n,i){var a=e.getDoc(),o=0,r=i!==n,l=a.getLine(this._getEndLineNumberOfList(a,n)+1),s=a.getLine(this._getStartLineNumberOfList(a,i)-1),u=a.getLine(t+1);(r&&this._isNeedAppendBlankLine(l)||!r&&this._isNeedAppendBlankLine(u))&&a.replaceRange("\n",{line:t,ch:a.getLine(t).length});var c=a.getLine(t-1);if((r&&this._isNeedAppendBlankLine(s)||!r&&this._isNeedAppendBlankLine(c))&&(a.replaceRange("\n",{line:i,ch:0}),o+=1),!r){var d=t+o;e.setCursor(d,a.getLine(d).length)}}},{key:"_isNeedAppendBlankLine",value:function(e){return e&&0!==e.length&&!this._isAList(e)}},{key:"createSortedLineRange",value:function(e){var t=e.from.line>e.to.line;return{start:{line:t?e.to.line:e.from.line,ch:0}.line,end:{line:t?e.from.line:e.to.line,ch:0}.line}}},{key:"expandLineRangeIfNeed",value:function(e,t,n){var i=this.createSortedLineRange(t),a=i.start,o=i.end,r=this._isDifferentListType(n,e.getLine(a)),l=this._isDifferentListType(n,e.getLine(o));return r&&(a=this._getStartLineNumberOfList(e,a)),l&&(o=this._getEndLineNumberOfList(e,o)),{start:a,end:o}}},{key:"replaceLineText",value:function(e,t,n,i){var a=e.getLine(t),o={line:t,ch:0},r={line:t,ch:a.length};a=a.replace(n,i),e.replaceRange(a,o,r)}},{key:"_isDifferentListType",value:function(e,t){return t&&0!==t.length&&e.call(this,t)}},{key:"_isAList",value:function(e){return e&&0!==e.length&&this._isListLine(e)}},{key:"_isListLine",value:function(e){return!!(e.match(l)||e.match(r)||e.match(o))}},{key:"_getStartLineNumberOfList",value:function(e,t){var n=void 0;for(n=t;n>0;n-=1){var i=e.getLine(n-1);if(!i||!this._isListLine(i))break}return n}},{key:"_getEndLineNumberOfList",value:function(e,t){var n=e.lineCount(),i=void 0;for(i=t;i<n;i+=1){var a=e.getLine(i+1);if(!a||!this._isListLine(a))break}return i}}]),e}();t.default=d},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=function(){function e(t,n){i(this,e),this._mde=t,this.setRange(n||t.getRange())}return a(e,[{key:"_setStart",value:function(e){this._start=e}},{key:"_setEnd",value:function(e){this._end=e}},{key:"setRange",value:function(e){this._setStart(e.start),this._setEnd(e.end)}},{key:"setEndBeforeRange",value:function(e){this._setEnd(e.start)}},{key:"expandStartOffset",value:function(){var e=this._start;0!==e.ch&&(e.ch-=1)}},{key:"expandEndOffset",value:function(){var e=this._end;e.ch<this._mde.getEditor().getDoc().getLine(e.line).length&&(e.ch+=1)}},{key:"getTextContent",value:function(){return this._mde.getEditor().getRange(this._start,this._end)}},{key:"replaceContent",value:function(e){this._mde.getEditor().replaceRange(e,this._start,this._end,"+input")}},{key:"deleteContent",value:function(){this._mde.getEditor().replaceRange("",this._start,this._end,"+delete")}},{key:"peekStartBeforeOffset",value:function(e){var t={line:this._start.line,ch:Math.max(this._start.ch-e,0)};return this._mde.getEditor().getRange(t,this._start)}}]),e}();t.default=o},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),l=i(r),s=n(1),u=i(s),c=n(3),d=i(c),f=n(50),h=i(f),g=n(52),v=i(g),p=n(53),m=i(p),y=n(34),_=i(y),b=n(35),k=i(b),w=n(54),C=i(w),E=n(55),M=i(E),T=n(56),S=i(T),O=n(36),L=i(O),B=n(57),N=i(B),x=n(15),P=i(x),A=n(59),I=i(A),R=n(33),$=i(R),D=n(60),j=i(D),H=P.default.getSharedInstance(),F=/<(.+)>(<br>|<br \/>|<BR>|<BR \/>)<\/\1>/g,U=/(?:<br>|<br \/>|<BR>|<BR \/>)<\/(.+?)>/g,W=/\b(H[\d]|LI|P|BLOCKQUOTE|TD|PRE)\b/,V="undefined"!=typeof MutationObserver,q=function(){function e(t,n){var i=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};a(this,e),this.componentManager=new $.default(this),this.eventManager=n,this.$editorContainerEl=t,this._height=0,this._silentChange=!1,this._keyEventHandlers={},this._managers={},this._options=l.default.extend({useCommandShortcut:!0},o),this._initEvent(),this._initDefaultKeyEventHandler(),this.debouncedPostProcessForChange=u.default.debounce(function(){return i.postProcessForChange()},0)}return o(e,[{key:"init",value:function(){var e=(0,l.default)("<div />");this.$editorContainerEl.append(e),this.editor=new N.default(e[0],{blockTag:"DIV",leafNodeNames:{HR:!1}}),this._options.useCommandShortcut||this.editor.blockCommandShortcuts(),this._clipboardManager=new h.default(this),this._initSquireEvent(),this._clipboardManager.init(),this.get$Body().addClass("tui-editor-contents"),this.$editorContainerEl.css("position","relative"),this.codeBlockGadget=new j.default({eventManager:this.eventManager,container:this.$editorContainerEl,wysiwygEditor:this})}},{key:"_preprocessForInlineElement",value:function(e){return e.replace(/<br>( *)<img/g,"<br><br>$1<img")}},{key:"_initEvent",value:function(){var e=this;this.eventManager.listen("wysiwygSetValueBefore",function(t){return e._preprocessForInlineElement(t)}),this.eventManager.listen("wysiwygKeyEvent",function(t){return e._runKeyEventHandlers(t.data,t.keyMap)}),this.eventManager.listen("wysiwygRangeChangeAfter",function(){return e._scrollToRangeIfNeed()})}},{key:"addKeyEventHandler",value:function(e,t){t||(t=e,e="DEFAULT"),this._keyEventHandlers[e]||(this._keyEventHandlers[e]=[]),this._keyEventHandlers[e].push(t)}},{key:"removeKeyEventHandler",value:function(e,t){t||(t=e,e="DEFAULT");var n=this._keyEventHandlers[e];n&&(this._keyEventHandlers[e]=n.filter(function(e){return e!==t}))}},{key:"_runKeyEventHandlers",value:function(e,t){var n=this.getRange(),i=void 0,a=void 0;i=this._keyEventHandlers.DEFAULT,i&&u.default.forEachArray(i,function(i){return a=i(e,n,t)}),(i=this._keyEventHandlers[t])&&!1!==a&&u.default.forEachArray(i,function(i){return i(e,n,t)})}},{key:"_initSquireEvent",value:function(){var e=this,t=this.getEditor(),n=!1;t.addEventListener("copy",function(t){e.eventManager.emit("copy",{source:"wysiwyg",data:t}),u.default.debounce(function(){e.isEditorValid()&&e.eventManager.emit("copyAfter",{source:"wysiwyg",data:t})})()}),t.addEventListener(u.default.browser.msie?"beforecut":"cut",function(t){e.eventManager.emit("cut",{source:"wysiwyg",data:t}),u.default.debounce(function(){e.isEditorValid()&&e.eventManager.emit("cutAfter",{source:"wysiwyg",data:t})})()}),t.addEventListener(u.default.browser.msie?"beforepaste":"paste",function(t){e.eventManager.emit("paste",{source:"wysiwyg",data:t})}),t.addEventListener("dragover",function(e){return e.preventDefault(),!1}),t.addEventListener("drop",function(t){return t.preventDefault(),e.eventManager.emit("drop",{source:"wysiwyg",data:t}),!1}),t.addEventListener("input",u.default.debounce(function(){if(e.isEditorValid()){if(e._silentChange)e._silentChange=!1;else{var t={source:"wysiwyg"};e.eventManager.emit("changeFromWysiwyg",t),e.eventManager.emit("change",t),e.eventManager.emit("contentChangedFromWysiwyg",e)}e.getEditor().preserveLastLine()}},0)),t.addEventListener("keydown",function(t){e.getEditor().getSelection().collapsed||(n=!0),e.eventManager.emit("keydown",{source:"wysiwyg",data:t}),e._onKeyDown(t)}),u.default.browser.firefox&&(t.addEventListener("keypress",function(t){var i=t.keyCode;if(13===i||9===i){e.getEditor().getSelection().collapsed||(n=!0),e.eventManager.emit("keydown",{source:"wysiwyg",data:t}),e._onKeyDown(t)}}),t.addEventListener("keyup",function(){var t=e.getRange();if(d.default.isTextNode(t.commonAncestorContainer)&&d.default.isTextNode(t.commonAncestorContainer.previousSibling)){var n=t.commonAncestorContainer.previousSibling.length,i=t.commonAncestorContainer;t.commonAncestorContainer.previousSibling.appendData(t.commonAncestorContainer.data),t.setStart(t.commonAncestorContainer.previousSibling,n+t.startOffset),t.collapse(!0),i.parentNode.removeChild(i),e.setRange(t),t.detach()}})),t.addEventListener("keyup",function(t){n&&(e.debouncedPostProcessForChange(),n=!1),e.eventManager.emit("keyup",{source:"wysiwyg",data:t})}),this.$editorContainerEl.on("scroll",function(t){e.eventManager.emit("scroll",{source:"wysiwyg",data:t})}),t.addEventListener("click",function(t){e.eventManager.emit("click",{source:"wysiwyg",data:t})}),t.addEventListener("mousedown",function(t){e.eventManager.emit("mousedown",{source:"wysiwyg",data:t})}),t.addEventListener("mouseover",function(t){e.eventManager.emit("mouseover",{source:"wysiwyg",data:t})}),t.addEventListener("mouseout",function(t){e.eventManager.emit("mouseout",{source:"wysiwyg",data:t})}),t.addEventListener("mouseup",function(t){e.eventManager.emit("mouseup",{source:"wysiwyg",data:t})}),t.addEventListener("contextmenu",function(t){e.eventManager.emit("contextmenu",{source:"wysiwyg",data:t})}),t.addEventListener("focus",function(){e.eventManager.emit("focus",{source:"wysiwyg"})}),t.addEventListener("blur",function(){e.eventManager.emit("blur",{source:"wysiwyg"})}),t.addEventListener("pathChange",function(t){var n={bold:/(>B|>STRONG|^B$|^STRONG$)/.test(t.path),italic:/(>I|>EM|^I$|^EM$)/.test(t.path),strike:/(^S>|>S$|>S>|^S$)/.test(t.path),code:/CODE/.test(t.path),codeBlock:/PRE/.test(t.path),quote:/BLOCKQUOTE/.test(t.path),list:/LI(?!.task-list-item)/.test(e._getLastLiString(t.path)),task:/LI.task-list-item/.test(e._getLastLiString(t.path)),source:"wysiwyg"};e.eventManager.emit("stateChange",n)}),t.addEventListener("willPaste",function(t){e.eventManager.emit("willPaste",{source:"wysiwyg",data:t})})}},{key:"_getLastLiString",value:function(e){var t=/LI[^UO]*$/.exec(e);return t?t[0]:""}},{key:"_onKeyDown",value:function(e){var t=H.convert(e);e.keyCode&&(this.eventManager.emit("keyMap",{source:"wysiwyg",keyMap:t,data:e}),e.defaultPrevented||this.eventManager.emit("wysiwygKeyEvent",{keyMap:t,data:e}))}},{key:"_initDefaultKeyEventHandler",value:function(){var e=this;this.addKeyEventHandler("ENTER",function(t,n){e._isInOrphanText(n)&&e.defer(function(){e._wrapDefaultBlockToOrphanTexts(),e.breakToNewDefaultBlock(n,"before")}),e.defer(function(){e._scrollToRangeIfNeed()})}),this.addKeyEventHandler("TAB",function(t){var n=e.getEditor(),i=n.getSelection(),a=i.collapsed&&e._isCursorNotInRestrictedAreaOfTabAction(n),o=!i.collapsed&&d.default.isTextNode(i.commonAncestorContainer);return t.preventDefault(),!a&&!o||(n.insertPlainText("    "),!1)})}},{key:"_wrapDefaultBlockToOrphanTexts",value:function(){this.get$Body().contents().filter(this.findTextNodeFilter).each(function(e,t){t.nextSibling&&"BR"===t.nextSibling.tagName&&(0,l.default)(t.nextSibling).remove(),(0,l.default)(t).wrap("<div />")})}},{key:"_scrollToRangeIfNeed",value:function(){var e=this.$editorContainerEl,t=this.getRange();if(this.getEditor().getCursorPosition(t).top-e.offset().top>=e.height()){var n=t.endContainer;n instanceof Element||(n=n.parentNode),n.scrollIntoView(!1)}}},{key:"_isInOrphanText",value:function(e){return e.startContainer.nodeType===Node.TEXT_NODE&&e.startContainer.parentNode===this.get$Body()[0]}},{key:"_wrapDefaultBlockTo",value:function(e){this.saveSelection(e),this._joinSplitedTextNodes(),this.restoreSavedSelection(),e=this.getRange();var t=e.startContainer,n=e.startOffset,i=this.getEditor().createDefaultBlock([e.startContainer]),a=d.default.getChildNodeByOffset(e.startContainer,e.startOffset);a?e.setStartBefore(a):e.selectNodeContents(e.startContainer),e.collapse(!0),e.insertNode(i),e.setStart(t,n),e.collapse(!0),this.setRange(e)}},{key:"findTextNodeFilter",value:function(){return this.nodeType===Node.TEXT_NODE}},{key:"_joinSplitedTextNodes",value:function(){var e=void 0,t=void 0,n=[];this.get$Body().contents().filter(this.findTextNodeFilter).each(function(i,a){e===a.previousSibling?(t.nodeValue+=a.nodeValue,n.push(a)):t=a,e=a}),(0,l.default)(n).remove()}},{key:"saveSelection",value:function(e){e||(e=this.getRange()),this.getEditor()._saveRangeToBookmark(e)}},{key:"restoreSavedSelection",value:function(){this.setRange(this.getEditor()._getRangeAndRemoveBookmark())}},{key:"reset",value:function(){this.setValue("")}},{key:"changeBlockFormatTo",value:function(e){this.getEditor().changeBlockFormatTo(e),this.eventManager.emit("wysiwygRangeChangeAfter",this)}},{key:"makeEmptyBlockCurrentSelection",value:function(){var e=this;this.getEditor().modifyBlocks(function(t){return t.textContent||(t=e.getEditor().createDefaultBlock()),t})}},{key:"focus",value:function(){var e=this.scrollTop();this.editor.focus(),e!==this.scrollTop()&&this.scrollTop(e)}},{key:"blur",value:function(){this.editor.blur()}},{key:"remove",value:function(){this.getEditor().destroy(),this.editor=null,this.$body=null,this.eventManager=null}},{key:"setHeight",value:function(e){this._height=e,this.$editorContainerEl.css("overflow","auto"),this.$editorContainerEl.css("height","100%"),this.$editorContainerEl.parent().height(e);var t=parseInt(this.$editorContainerEl.css("padding-top"),10)-parseInt(this.$editorContainerEl.css("padding-bottom"),10),n=parseInt(this.get$Body().css("margin-top"),10)-parseInt(this.get$Body().css("margin-bottom"),10);this.get$Body().css("min-height",e-n-t+"px")}},{key:"setMinHeight",value:function(e){this.get$Body().get(0).style.minHeight=e+"px"}},{key:"setValue",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];e=this.eventManager.emitReduce("wysiwygSetValueBefore",e),this.editor.setHTML(e),this.eventManager.emit("wysiwygSetValueAfter",this),this.eventManager.emit("contentChangedFromWysiwyg",this),t&&this.moveCursorToEnd(),this.getEditor().preserveLastLine(),this.getEditor().removeLastUndoStack(),this.getEditor().saveUndoState()}},{key:"insertText",value:function(e){this.editor.insertPlainText(e)}},{key:"getValue",value:function(){this._prepareGetHTML();var e=this.editor.getHTML();return e=e.replace(F,function(e,t){return"li"===t?e:"td"===t||"th"===t?"<"+t+"></"+t+">":"<br />"}),e=e.replace(U,"</$1>"),e=e.replace(/<div[^>]*>/g,""),e=e.replace(/<\/div>/g,"<br />"),e=this.eventManager.emitReduce("wysiwygProcessHTMLText",e)}},{key:"_prepareGetHTML",value:function(){var e=this;this.getEditor().modifyDocument(function(){e._joinSplitedTextNodes(),e.eventManager.emit("wysiwygGetValueBefore",e)})}},{key:"postProcessForChange",value:function(){var e=this;this.isEditorValid()&&this.getEditor().modifyDocument(function(){e.eventManager.emit("wysiwygRangeChangeAfter",e)})}},{key:"readySilentChange",value:function(){V&&!this.getEditor().isIgnoreChange()&&(this._silentChange=!0)}},{key:"getEditor",value:function(){return this.editor}},{key:"replaceSelection",value:function(e,t){this.getEditor().replaceSelection(e,t)}},{key:"replaceRelativeOffset",value:function(e,t,n){this.getEditor().replaceRelativeOffset(e,t,n)}},{key:"addWidget",value:function(e,t,n,i){var a=this.getEditor().getSelectionPosition(e,n,i),o=this.$editorContainerEl.offset();this.$editorContainerEl.append(t),(0,l.default)(t).css({position:"absolute",top:a.top-o.top,left:a.left-o.left})}},{key:"get$Body",value:function(){return this.getEditor().get$Body()}},{key:"hasFormatWithRx",value:function(e){return this.getEditor().getPath().match(e)}},{key:"breakToNewDefaultBlock",value:function(e,t){var n=this.editor.createDefaultBlock(),i=d.default.getChildNodeByOffset(e.startContainer,e.startOffset)||d.default.getChildNodeByOffset(e.startContainer,e.startOffset-1),a=d.default.getParentUntil(i,this.get$Body()[0]);"before"===t?(0,l.default)(a).before(n):(0,l.default)(a).after(n),e.setStart(n,0),e.collapse(!0),this.setRange(e)}},{key:"replaceContentText",value:function(e,t,n){var i=(0,l.default)(e).html();(0,l.default)(e).html(i.replace(t,n))}},{key:"unwrapBlockTag",value:function(e){e||(e=function(e){return W.test(e)}),this.getEditor().changeBlockFormat(e),this.eventManager.emit("wysiwygRangeChangeAfter",this)}},{key:"moveCursorToEnd",value:function(){this.getEditor().moveCursorToEnd();var e=this.get$Body().get(0).childNodes;e.length>0&&e[e.length-1].scrollIntoView(!1),this._correctRangeAfterMoveCursor("end")}},{key:"moveCursorToStart",value:function(){this.getEditor().moveCursorToStart(),this.scrollTop(0)}},{key:"scrollTop",value:function(e){return u.default.isUndefined(e)?this.$editorContainerEl.scrollTop():this.$editorContainerEl.scrollTop(e)}},{key:"_correctRangeAfterMoveCursor",value:function(e){var t=this.getRange(),n=this.get$Body().get(0);if("start"===e)for(;n.firstChild;)n=n.firstChild;else for(;n.lastChild;)n=n.lastChild;"BR"===n.tagName?t.setStartBefore(n):t.setStartAfter(n),t.collapse(!0),this.setRange(t)}},{key:"getRange",value:function(){return this.getEditor().getSelection().cloneRange()}},{key:"setRange",value:function(e){this.getEditor().setSelection(e)}},{key:"getTextObject",value:function(e){return new I.default(this,e)}},{key:"defer",value:function(e,t){var n=this,i=t||0;setTimeout(function(){n.isEditorValid()&&e(n)},i)}},{key:"isEditorValid",value:function(){return this.getEditor()&&l.default.contains(this.$editorContainerEl[0].ownerDocument,this.$editorContainerEl[0])}},{key:"_isCursorNotInRestrictedAreaOfTabAction",value:function(e){return!e.hasFormat("li")&&!e.hasFormat("blockquote")&&!e.hasFormat("table")}}],[{key:"factory",value:function(t,n,i){var a=new e(t,n,i);return a.init(),a.componentManager.addManager(v.default),a.componentManager.addManager(m.default),a.componentManager.addManager(k.default),a.componentManager.addManager(_.default),a.componentManager.addManager(C.default),a.componentManager.addManager(M.default),a.componentManager.addManager(S.default),a.componentManager.addManager(L.default),a}}]),e}();t.default=q},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),l=i(r),s=n(1),u=i(s),c=n(3),d=i(c),f=n(51),h=i(f),g=n(4),v=i(g),p=function(){function e(t){a(this,e),this.wwe=t,this._pch=new h.default(this.wwe),this._selectedSellCount=0,this._$clipboardArea=null}return o(e,[{key:"init",value:function(){var e=this;this.wwe.eventManager.listen("willPaste",function(t){return e._onWillPaste(t.data)}),this.wwe.eventManager.listen("copy",this._onCopyCut.bind(this)),this.wwe.eventManager.listen("copyAfter",this._onCopyAfter.bind(this)),this.wwe.eventManager.listen("cut",this._onCopyCut.bind(this)),this.wwe.eventManager.listen("cutAfter",this._onCutAfter.bind(this))}},{key:"_onCopyCut",value:function(e){var t=this.wwe.componentManager.getManager("tableSelection");if(t.getSelectedCells().length){if(!t.mergedTableSelectionManager)return t.createRangeBySelectedCells(),void t.removeClassAttrbuteFromAllCellsIfNeed();var n=this.wwe.getEditor(),i=e.data,a=n.getSelection().cloneRange(),o=(0,l.default)("<div />");this._extendRange(a),o.append(a.cloneContents()),this._updateCopyDataForListTypeIfNeed(a,o),this.wwe.eventManager.emit("copyBefore",{source:"wysiwyg",$clipboardContainer:o}),this._setClipboardData(i,o.html(),o.text())}}},{key:"_clearClipboardArea",value:function(){this._$clipboardArea&&(this._$clipboardArea.remove(),this._$clipboardArea=null)}},{key:"_onCopyAfter",value:function(){this.wwe.getEditor().get$Body().focus(),this._clearClipboardArea()}},{key:"_onCutAfter",value:function(){this.wwe.getEditor().getSelection().deleteContents(),this.wwe.getEditor().focus(),this._clearClipboardArea()}},{key:"_onWillPaste",value:function(e){var t=this,n=(0,l.default)("<div>").append(e.fragment.cloneNode(!0));this._setTableBookmark(n),this._pasteToTable(n)?e.preventDefault():(this._preparePaste(n),this._setTableBookmark(n),e.fragment=document.createDocumentFragment(),(0,l.default)(n[0].childNodes).each(function(t,n){e.fragment.appendChild(n)}));var i=function e(){t.wwe.getEditor().removeEventListener("input",e),t.wwe.eventManager.emit("wysiwygRangeChangeAfter",t),t._focusTableBookmark()};this.wwe.getEditor().addEventListener("input",i)}},{key:"_setClipboardData",value:function(e,t,n){u.default.browser.msie?(e.squirePrevented=!0,this._$clipboardArea=this._createClipboardArea(),this._$clipboardArea.html(t),this._$clipboardArea.focus(),window.getSelection().selectAllChildren(this._$clipboardArea[0])):(e.preventDefault(),e.stopPropagation(),e.clipboardData.setData("text/html",t),e.clipboardData.setData("text/plain",n))}},{key:"_createClipboardArea",value:function(){return(0,l.default)("<DIV>").attr({contenteditable:"true",style:"position:fixed; overflow:hidden; top:0; right:100%; width:1px; height:1px;"}).appendTo(document.body)}},{key:"_updateCopyDataForListTypeIfNeed",value:function(e,t){var n=e.commonAncestorContainer.nodeName;if("UL"===n||"OL"===n){var i=(0,l.default)("<"+n+" />");i.append(t.html()),t.html(""),t.append(i)}}},{key:"_removeEmptyFontElement",value:function(e){e.children("font").each(function(e,t){var n=(0,l.default)(t);n.text().trim()||n.remove()})}},{key:"_pasteToTable",value:function(e){var t=this.wwe.componentManager.getManager("table"),n=this.wwe.componentManager.getManager("tableSelection"),i=this.wwe.getEditor().getSelection(),a=t.isInTable(i),o=e.get(0),r=o.childNodes,l=1===r.length&&"TABLE"===r[0].nodeName,s=!1;return a&&(l?(t.pasteClipboardData(e.first()),e.html(""),s=!0):n.getSelectedCells().length&&(alert(v.default.get("Cannot paste values ​​other than a table in the cell selection state")),e.html(""),s=!0)),s}},{key:"_preparePaste",value:function(e){this._removeEmptyFontElement(e),this._pch.preparePaste(e),this.wwe.eventManager.emit("pasteBefore",{source:"wysiwyg",$clipboardContainer:e})}},{key:"_setTableBookmark",value:function(e){var t=(0,l.default)(e[0].childNodes).last();t[0]&&"TABLE"===t[0].nodeName&&t.addClass("tui-paste-table-bookmark")}},{key:"_focusTableBookmark",value:function(){var e=this.wwe.getEditor(),t=e.getSelection().cloneRange(),n=e.get$Body().find(".tui-paste-table-bookmark"),i=e.get$Body().find(".tui-paste-table-cell-bookmark");n.length&&(n.removeClass("tui-paste-table-bookmark"),t.setEndAfter(n[0]),t.collapse(!1),e.setSelection(t)),i.length&&(i.removeClass("tui-paste-table-cell-bookmark"),t.selectNodeContents(i[0]),t.collapse(!1),e.setSelection(t))}},{key:"_extendRange",value:function(e){(!d.default.isTextNode(e.commonAncestorContainer)||0===e.startOffset&&e.commonAncestorContainer.textContent.length===e.endOffset||"TD"===e.commonAncestorContainer.nodeName)&&(0===e.startOffset&&(e=this._extendStartRange(e)),e.endOffset===d.default.getOffsetLength(e.endContainer)&&(e=this._extendEndRange(e)),this._isWholeCommonAncestorContainerSelected(e)&&e.selectNode(e.commonAncestorContainer),this.wwe.getEditor().setSelection(e))}},{key:"_extendStartRange",value:function(e){for(var t=e.startContainer;t.parentNode!==e.commonAncestorContainer&&t.parentNode!==this.wwe.get$Body()[0]&&!t.previousSibling;)t=t.parentNode;return e.setStart(t.parentNode,d.default.getNodeOffsetOfParent(t)),e}},{key:"_extendEndRange",value:function(e){for(var t=e.endContainer,n=t.nextSibling;t.parentNode!==e.commonAncestorContainer&&t.parentNode!==this.wwe.get$Body()[0]&&(!n||"BR"===d.default.getNodeName(n)&&t.parentNode.lastChild===n);)t=t.parentNode,n=t.nextSibling;return e.setEnd(t.parentNode,d.default.getNodeOffsetOfParent(t)+1),e}},{key:"_isWholeCommonAncestorContainerSelected",value:function(e){return e.commonAncestorContainer.nodeType===Node.ELEMENT_NODE&&e.commonAncestorContainer!==this.wwe.get$Body()[0]&&0===e.startOffset&&e.endOffset===e.commonAncestorContainer.childNodes.length&&e.commonAncestorContainer===e.startContainer&&e.commonAncestorContainer===e.endContainer}}]),e}();t.default=p},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),l=i(r),s=n(1),u=i(s),c=n(3),d=i(c),f=n(11),h=i(f),g=function(){function e(t){a(this,e),this.wwe=t}return o(e,[{key:"preparePaste",value:function(e){var t=this.wwe.getEditor().getSelection().cloneRange(),n=this.wwe.componentManager.getManager("codeblock"),i=!1,a=(0,l.default)("<div />"),o=void 0,r=void 0,s=void 0;this._pasteFirstAid(e);var c=u.default.toArray(e[0].childNodes);for(c.length&&"DIV"===c[0].tagName&&(a.append(this._unwrapFragmentFirstChildForPasteAsInline(c[0])),c.shift());c.length;)r=c[0],o=d.default.getNodeName(r),s="LI"===o||"UL"===o||"OL"===o,n.isInCodeBlock(t)?a.append(n.prepareToPasteOnCodeblock(c)):s?(a.append(this._prepareToPasteList(c,t,i)),i=!0):a.append(c.shift());e.html(a.html())}},{key:"_wrapOrphanNodeWithDiv",value:function(e){var t=(0,l.default)("<div />"),n=u.default.toArray(e[0].childNodes),i=void 0;return u.default.forEachArray(n,function(e){var n=3===e.nodeType,a=/^(SPAN|A|CODE|EM|I|STRONG|B|S|ABBR|ACRONYM|CITE|DFN|KBD|SAMP|VAR|BDO|Q|SUB|SUP)$/gi.test(e.tagName);n||a?(i||(i=document.createElement("div"),t.append(i)),i.appendChild(e)):(i&&"BR"!==i.lastChild.tagName&&i.appendChild((0,l.default)("<br/>")[0]),i=null,t.append(e))}),t.html()}},{key:"_pasteFirstAid",value:function(e){var t=this,n="div, section, article, aside, nav, menus, p";e.html((0,h.default)(e.html(),!0)),e.find("*").each(function(e,n){t._removeStyles(n)}),this._unwrapIfNonBlockElementHasBr(e),this._unwrapNestedBlocks(e,n),this._removeUnnecessaryBlocks(e,n),e.html(this._wrapOrphanNodeWithDiv(e)),this._preElementAid(e),this._tableElementAid(e),e.children("br").remove()}},{key:"_preElementAid",value:function(e){this.wwe.componentManager.getManager("codeblock").splitCodeblockToEachLine(e)}},{key:"_unwrapIfNonBlockElementHasBr",value:function(e){e.find("span, a, b, em, i, s").each(function(e,t){var n=(0,l.default)(t).children("br");n.length&&"LI"!==t.nodeName&&"UL"!==t.nodeName&&n.eq(0).unwrap()})}},{key:"_unwrapNestedBlocks",value:function(e,t){e.find(":not(:has(*))").not("b,s,i,em,code,span").each(function(n,i){for(var a="BR"===i.nodeName?(0,l.default)(i.parentNode):(0,l.default)(i);a.parents(t).length;){var o=a.parent(t);o.length&&o[0]!==e[0]?a.unwrap():a=a.parent()}})}},{key:"_removeUnnecessaryBlocks",value:function(e,t){e.find(t).each(function(e,n){var i=(0,l.default)(n),a=n.tagName,o="DIV"===a,r=0!==i.parent("li").length,s=0!==i.parent("blockquote").length,u=i.children(t).length;o&&(r||s||!u)||i.replaceWith(i.html())})}},{key:"_removeStyles",value:function(e){var t=(0,l.default)(e),n=void 0;"SPAN"!==d.default.getNodeName(t[0])?t.removeAttr("style"):(t.attr("style")&&(n=t.css("color")),t.removeAttr("style"),n?t.css("color",n):t.contents().unwrap())}},{key:"_prepareToPasteList",value:function(e,t,n){var i=d.default.getNodeName(e[0]),a=e.shift(),o=this.wwe.getEditor().getDocument().createDocumentFragment();if("LI"!==i&&e.length&&"LI"===e[0].tagName&&(i="LI",a=this._makeNodeAndAppend({tagName:i},a)),"OL"===i||"UL"===i)!n&&this.wwe.getEditor().hasFormat("LI")?(0,l.default)(o).append(this._wrapCurrentFormat(a)):(0,l.default)(o).append(a);else if("LI"===i){var r=this.wwe.getEditor().getDocument().createDocumentFragment();for(r.appendChild(a);e.length&&"LI"===e[0].tagName;)r.appendChild(e.shift());!n&&this.wwe.getEditor().hasFormat("LI")?(0,l.default)(o).append(this._wrapCurrentFormat(r)):!t||"UL"!==t.commonAncestorName&&"OL"!==t.commonAncestorName?(0,l.default)(o).append(this._makeNodeAndAppend({tagName:"UL"},r)):(0,l.default)(o).append(this._makeNodeAndAppend({tagName:t.commonAncestorName},r))}return o}},{key:"_unwrapFragmentFirstChildForPasteAsInline",value:function(e){return(0,l.default)(e).find("br").remove(),e.childNodes}},{key:"_wrapCurrentFormat",value:function(e){var t=this,n=void 0;return this._eachCurrentPath(function(i){"DIV"!==i.tagName&&(n=d.default.isElemNode(e)?e.tagName:e.firstChild.tagName,i.tagName!==n&&(e=t._makeNodeAndAppend(i,e)))}),e}},{key:"_eachCurrentPath",value:function(e){for(var t=d.default.getPath(this.wwe.getEditor().getSelection().startContainer,this.wwe.get$Body()[0]),n=t.length-1;n>-1;n-=1)e(t[n])}},{key:"_makeNodeAndAppend",value:function(e,t){var n=(0,l.default)("<"+e.tagName+"/>");return n.append(t),e.id&&n.attr("id",e.id),e.className&&n.addClass(e.className),n[0]}},{key:"_tableElementAid",value:function(e){this._completeTableIfNeed(e),this._updateTableIDClassName(e)}},{key:"_completeTableIfNeed",value:function(e){var t=this.wwe.componentManager.getManager("table"),n=t.wrapDanglingTableCellsIntoTrIfNeed(e);n&&e.append(n);var i=t.wrapTrsIntoTbodyIfNeed(e);i&&e.append(i);var a=t.wrapTheadAndTbodyIntoTableIfNeed(e);a&&e.append(a)}},{key:"_updateTableIDClassName",value:function(e){var t=this.wwe.componentManager.getManager("table");e.find("table").each(function(e,t){(0,l.default)(t).removeClass(function(e,t){return t.replace(/.*\s*(te-content-table-\d+)\s*.*/,"$1")})}),e.find("table").each(function(e,n){(0,l.default)(n).addClass(t.getTableIDClassName())})}}]),e}();t.default=g},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),l=i(r),s=n(3),u=i(s),c=/<li/i,d=function(){function e(t){a(this,e),this.wwe=t,this.eventManager=t.eventManager,this.name="list",this._init()}return o(e,[{key:"_init",value:function(){this._initEvent(),this._initKeyHandler()}},{key:"_initEvent",value:function(){var e=this;this.eventManager.listen("wysiwygSetValueBefore",function(t){return e._convertToArbitraryNestingList(t)}),this.eventManager.listen("wysiwygRangeChangeAfter",function(){e._findAndRemoveEmptyList(),e._removeBranchListAll()}),this.eventManager.listen("wysiwygSetValueAfter",function(){e._removeBranchListAll()}),this.eventManager.listen("wysiwygProcessHTMLText",function(t){return t=e._insertBlankToBetweenSameList(t),t=e._convertFromArbitraryNestingList(t)}),this.eventManager.listen("convertorAfterHtmlToMarkdownConverted",function(e){return e.replace(/:BLANK_LINE:\n/g,"")})}},{key:"_initKeyHandler",value:function(){var e=this;this.wwe.addKeyEventHandler("TAB",function(t,n){var i=void 0;return n.collapsed&&e.wwe.getEditor().hasFormat("LI")&&(t.preventDefault(),e.eventManager.emit("command","IncreaseDepth"),i=!1),i}),this.wwe.addKeyEventHandler("SHIFT+TAB",function(t,n){var i=void 0;if(n.collapsed&&e.wwe.getEditor().hasFormat("LI")){t.preventDefault();var a=(0,l.default)(n.startContainer).closest("li").children("OL,UL");e.eventManager.emit("command","DecreaseDepth"),a.length&&!a.prev().length&&e._removeBranchList(a),i=!1}return i}),this.wwe.addKeyEventHandler("ENTER",function(t,n){n.collapsed&&e.wwe.getEditor().hasFormat("LI")&&e.wwe.defer(function(){var t=e.wwe.getRange(),n=(0,l.default)(t.startContainer).parents("li").eq(0);e._removeBranchListAll(n)})}),this.wwe.addKeyEventHandler("BACK_SPACE",function(t,n){n.collapsed&&e.wwe.getEditor().hasFormat("LI")&&e.wwe.defer(function(){e._removeBranchListAll()})})}},{key:"_findAndRemoveEmptyList",value:function(){this.wwe.get$Body().find("OL,UL").each(function(e,t){c.test(t.innerHTML)||(0,l.default)(t).remove()})}},{key:"_removeBranchListAll",value:function(e){var t=this;e=e?(0,l.default)(e):this.wwe.get$Body(),e.find("li ul, li ol").each(function(e,n){n&&!n.previousSibling&&t._removeBranchList(n)})}},{key:"_removeBranchList",value:function(e){for(var t=(0,l.default)(e),n=t;!n[0].previousSibling&&n[0].parentElement.tagName.match(/UL|OL|LI/g);)n=n.parent();var i=n.children("li").eq(0);n.prepend(t.children().unwrap()),i.remove()}},{key:"_insertBlankToBetweenSameList",value:function(e){return e.replace(/<\/(ul|ol)>(<br \/>|<br>){0,}<\1>/g,"</$1>:BLANK_LINE:<$1>")}},{key:"_convertToArbitraryNestingList",value:function(e){var t=document.createElement("div");t.innerHTML=e;for(var n=t.querySelector("li > ul, li > ol");null!==n;){var i=n.parentNode;i.parentNode.insertBefore(n,i.nextElementSibling),n=t.querySelector("li > ul, li > ol")}return t.innerHTML}},{key:"_convertFromArbitraryNestingList",value:function(e){var t=document.createElement("div");t.innerHTML=e;for(var n=t.querySelector("ol > ol, ol > ul, ul > ol, ul > ul");null!==n;){for(var i=n.previousElementSibling;"LI"!==i.tagName;)i=i.previousElementSibling;i.appendChild(n),n=t.querySelector("ol > ol, ol > ul, ul > ol, ul > ul")}return t.innerHTML}},{key:"getLinesOfSelection",value:function(e,t){var n=[],i=!1,a=!0,o=void 0;u.default.isTextNode(e)&&(e=(0,l.default)(e).parents("DIV,LI").first().get(0)),u.default.isTextNode(t)&&(t=(0,l.default)(t).parents("DIV,LI").first().get(0));for(var r=e;a&&(0,l.default)(r).is("DIV,LI");r=o)n.push(r),r===t?i=!0:o=this._getNextLine(r,t),a=o&&!i;return n}},{key:"_getNextLine",value:function(e,t){var n=e.nextElementSibling;return n?(0,l.default)(n).is("OL,UL")&&(n=n.querySelector("li")):n=e.parentNode.nextElementSibling,(0,l.default)(n).is("DIV,LI")||n===t?n:this._getNextLine(n)}},{key:"mergeList",value:function(e){var t=e.parentNode,n=t.previousElementSibling,i=t.nextElementSibling;t.firstElementChild===e&&n&&(0,l.default)(n).is("OL,UL")&&(this._mergeList(t,n),t=n),t.lastElementChild===e&&i&&(0,l.default)(i).is("OL,UL")&&this._mergeList(i,t)}},{key:"_mergeList",value:function(e,t){var n=e.firstElementChild;if(t&&(0,l.default)(t).is("OL,UL")){for(;n;){var i=n.nextElementSibling;t.appendChild(n),n=i}e.parentNode.removeChild(e)}}}]),e}();t.default=d},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),r=function(e){return e&&e.__esModule?e:{default:e}}(o),l=function(){function e(t){i(this,e),this.wwe=t,this.eventManager=t.eventManager,this.name="task",this._init()}return a(e,[{key:"_init",value:function(){this._initKeyHandler(),this._initEvent(),this.wwe.getEditor().addEventListener("mousedown",function(e){var t=e.offsetX<18&&e.offsetY<18;e.target.hasAttribute("data-te-task")&&t&&(0,r.default)(e.target).toggleClass("checked")})}},{key:"_initEvent",value:function(){var e=this;this.eventManager.listen("wysiwygSetValueAfter",function(){e._removeTaskListClass()})}},{key:"_initKeyHandler",value:function(){var e=this;this.wwe.addKeyEventHandler("ENTER",function(t,n){e.isInTaskList(n)&&e.wwe.defer(function(){var t=e.wwe.getRange();(0,r.default)(t.startContainer).closest("li").removeClass("checked")})})}},{key:"isInTaskList",value:function(e){var t=void 0;return e||(e=this.wwe.getEditor().getSelection().cloneRange()),t=e.startContainer.nodeType===Node.ELEMENT_NODE&&"LI"===e.startContainer.tagName?e.startContainer:(0,r.default)(e.startContainer).parents("li").get(0),(0,r.default)(t).hasClass("task-list-item")}},{key:"unformatTask",value:function(e){var t=(0,r.default)(e).closest("li");t.removeClass("task-list-item"),t.removeClass("checked"),t.removeAttr("data-te-task"),t.attr("class")||t.removeAttr("class")}},{key:"formatTask",value:function(e){var t=(0,r.default)(e),n=t.closest("li");n.addClass("task-list-item"),n.attr("data-te-task","")}},{key:"_formatTaskIfNeed",value:function(){var e=this.wwe.getEditor().getSelection().cloneRange();this.isInTaskList(e)&&this.formatTask(e.startContainer)}},{key:"_removeTaskListClass",value:function(){this.wwe.get$Body().find(".task-list").each(function(e,t){(0,r.default)(t).removeClass("task-list")})}}]),e}();t.default=l},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(){return this.nodeType===Node.TEXT_NODE}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=n(0),s=i(l),u=n(3),c=i(u),d=function(){function e(t){a(this,e),this.wwe=t,this.eventManager=t.eventManager,this.name="hr",this._init()}return r(e,[{key:"_init",value:function(){this._initKeyHandler(),this._initEvent()}},{key:"_initEvent",value:function(){var e=this;this.eventManager.listen("wysiwygSetValueAfter",function(){e._unwrapDivOnHr()}),this.eventManager.listen("wysiwygGetValueBefore",function(){e._wrapDefaultBlockToOrphanTexts()})}},{key:"_initKeyHandler",value:function(){var e=this;this.wwe.addKeyEventHandler(function(t,n){return e._onTypedInHr(n)}),this.wwe.addKeyEventHandler("ENTER",function(t,n){return!n.collapsed||e._removeHrOnEnter(n,t)}),this.wwe.addKeyEventHandler("BACK_SPACE",function(t,n){return!n.collapsed||e._removeHrOnBackspace(n,t)})}},{key:"_isInHr",value:function(e){return"HR"===c.default.getNodeName(e.startContainer.childNodes[e.startOffset])}},{key:"_isNearHr",value:function(e){var t=c.default.getChildNodeByOffset(e.startContainer,e.startOffset-1);return"HR"===c.default.getNodeName(t)}},{key:"_onTypedInHr",value:function(e){var t=this;(this._isInHr(e)||this._isNearHr(e))&&this.wwe.defer(function(e){e.saveSelection(),t._wrapDefaultBlockToOrphanTexts(),e.restoreSavedSelection()})}},{key:"_removeHrOnEnter",value:function(e,t){var n=void 0,i=void 0;return this._isInHr(e)?n=c.default.getChildNodeByOffset(e.startContainer,e.startOffset):this._isNearHr(e)&&(n=c.default.getChildNodeByOffset(e.startContainer,e.startOffset-1),i="before"),this._changeHrToNewDefaultBlock(n,e,t,i)}},{key:"_removeHrOnBackspace",value:function(e,t){var n=void 0,i=void 0;return this._isInHr(e)?n=c.default.getChildNodeByOffset(e.startContainer,e.startOffset):0===e.startOffset?(n=c.default.getTopPrevNodeUnder(e.startContainer,this.wwe.get$Body()[0]),i="none"):this._isNearHr(e)&&(n=c.default.getChildNodeByOffset(e.startContainer,e.startOffset-1),i="before"),this._changeHrToNewDefaultBlock(n,e,t,i)}},{key:"_changeHrToNewDefaultBlock",value:function(e,t,n,i){return!e||"HR"!==c.default.getNodeName(e)||(n.preventDefault(),"none"!==i&&this.wwe.breakToNewDefaultBlock(t,i),(0,s.default)(e).remove(),!1)}},{key:"_unwrapDivOnHr",value:function(){var e=this.wwe.get$Body().get(0);this.wwe.get$Body().find("hr").each(function(t,n){var i=(0,s.default)(n).parent("div");i[0]!==e&&(i.find("br").remove(),(0,s.default)(n).unwrap())})}},{key:"_wrapDefaultBlockToOrphanTexts",value:function(){this.wwe.get$Body().contents().filter(o).each(function(e,t){(0,s.default)(t).wrap("<div />")})}}]),e}();t.default=d},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),r=function(e){return e&&e.__esModule?e:{default:e}}(o),l=function(){function e(t){i(this,e),this.wwe=t,this.eventManager=t.eventManager,this.name="p",this._initEvent()}return a(e,[{key:"_initEvent",value:function(){var e=this;this.eventManager.listen("wysiwygSetValueBefore",function(t){return e._splitPtagContentLines(t)}),this.eventManager.listen("wysiwygSetValueAfter",function(){e._ensurePtagContentWrappedWithDiv(),e._unwrapPtags()})}},{key:"_splitPtagContentLines",value:function(e){if(e){var t=(0,r.default)("<div />");t.html(e),t.find("p").each(function(e,t){var n=t.innerHTML,i=n.split(/<br>/gi),a=i.length-1,o=t.nextElementSibling||t.nextSibling,l="";l=i.map(function(e,t){var n="";return t>0&&t<a&&(e=e||"<br>"),e&&(n="<div>"+e+"</div>"),n}),o&&"P"===o.nodeName&&l.push("<div><br></div>"),(0,r.default)(t).replaceWith((0,r.default)(l.join("")))}),e=t.html()}return e}},{key:"_ensurePtagContentWrappedWithDiv",value:function(){this.wwe.get$Body().find("p").each(function(e,t){(0,r.default)(t).find("div").length<=0&&(0,r.default)(t).wrapInner("<div />"),(0,r.default)(t).next().is("p")&&(0,r.default)(t).append("<div><br></div>")})}},{key:"_unwrapPtags",value:function(){this.wwe.get$Body().find("div").each(function(e,t){(0,r.default)(t).parent().is("p")&&(0,r.default)(t).unwrap()})}}]),e}();t.default=l},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),l=i(r),s=n(3),u=i(s),c=/h[\d]/i,d=function(){function e(t){a(this,e),this.wwe=t,this.eventManager=t.eventManager,this.name="heading",this._init()}return o(e,[{key:"_init",value:function(){this._initEvent(),this._initKeyHandler()}},{key:"_initEvent",value:function(){var e=this;this.eventManager.listen("wysiwygSetValueAfter",function(){e._wrapDefaultBlockToHeadingInner()})}},{key:"_initKeyHandler",value:function(){var e=this;this.wwe.addKeyEventHandler("ENTER",function(t,n){return!e.wwe.hasFormatWithRx(c)||(e._onEnter(t,n),!1)}),this.wwe.addKeyEventHandler("BACK_SPACE",function(t,n){return!e.wwe.hasFormatWithRx(c)||(e._removePrevTopNodeIfNeed(t,n),!1)})}},{key:"_wrapDefaultBlockToHeadingInner",value:function(){this.wwe.get$Body().find("h1, h2, h3, h4, h5, h6").each(function(e,t){(0,l.default)(t).children("div, p").length<=0&&(0,l.default)(t).wrapInner("<div />")})}},{key:"_unwrapHeading",value:function(){this.wwe.unwrapBlockTag(function(e){return c.test(e)})}},{key:"_onEnter",value:function(e,t){var n=this;t.startOffset>0?this.wwe.defer(function(e){n._unwrapHeading(),e.getEditor().removeLastUndoStack()}):(e.preventDefault(),this._insertEmptyBlockToPrevious(t))}},{key:"_insertEmptyBlockToPrevious",value:function(e){this.wwe.getEditor().saveUndoState(e),(0,l.default)("<div><br></div>").insertBefore(u.default.getParentUntil(e.startContainer,this.wwe.get$Body()[0]))}},{key:"_removePrevTopNodeIfNeed",value:function(e,t){var n=!1;if(t.collapsed&&0===t.startOffset){var i=t.startContainer,a=u.default.getTopPrevNodeUnder(i,this.wwe.get$Body()[0]),o=a&&0===a.textContent.length,r=this.wwe.getEditor();0===i.textContent.length?n=this._removeHedingAndChangeSelection(e,t,a):o&&(e.preventDefault(),r.saveUndoState(t),(0,l.default)(a).remove(),n=!0)}return n}},{key:"_removeHedingAndChangeSelection",value:function(e,t,n){var i=t.startContainer,a=this.wwe.getEditor(),o=this.wwe.get$Body(),r=c.test(u.default.getNodeName(i)),s=r?i:(0,l.default)(i).parents("h1,h2,h3,h4,h5,h6")[0],d=n,f=1;return e.defaultPrevented||(e.preventDefault(),a.saveUndoState(t)),(0,l.default)(s).remove(),n||(d=o.children("div").first().get(0),f=0),t.setStart(d,f),t.collapse(!0),a.setSelection(t),!0}}]),e}();t.default=d},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=n(0),u=i(s),c=n(1),d=i(c),f=n(58),h=i(f),g=n(3),v=i(g),p=/\b(H[\d]|LI|P|BLOCKQUOTE|TD)\b/,m=/Trident\/[456]\./.test(navigator.userAgent),y=function(e){function t(){var e;a(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var l=o(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return l._decorateHandlerToCancelable("copy"),l._decorateHandlerToCancelable(m?"beforecut":"cut"),l._decorateHandlerToCancelable(m?"beforepaste":"paste"),l.get$Body=function(){return l.$body=l.$body||(0,u.default)(l.getRoot()),l.$body},l}return r(t,e),l(t,[{key:"_decorateHandlerToCancelable",value:function(e){var t=this._events[e];if(t.length>1)throw new Error("too many"+e+"handlers in squire");var n=t[0].bind(this);t[0]=function(e){e.defaultPrevented||e.squirePrevented||n(e)}}},{key:"changeBlockFormat",value:function(e,t){var n=this;this.modifyBlocks(function(i){var a=void 0,o=void 0,r=void 0,l=void 0,s=void 0,u=void 0,c=void 0;if(i.childNodes.length?a=i.childNodes.item(0):(a=n.createDefaultBlock(),i.appendChild(a)),e){for(;a.firstChild;)a=a.firstChild;for(c=function(e){l.appendChild(e)};a!==i;){if(s=a.tagName,d.default.isFunction(e)?e(s):s===e){l=a.childNodes.item(0),(!v.default.isElemNode(l)||a.childNodes.length>1)&&(l=n.createDefaultBlock(),d.default.forEachArray(d.default.toArray(a.childNodes),c),(u=l.lastChild)&&"BR"===v.default.getNodeName(u)&&l.removeChild(u)),r=t?n.createElement(t,[l]):l,o=n.getDocument().createDocumentFragment(),o.appendChild(r),i=o;break}a=a.parentNode}}return o&&e||!t||"DIV"!==v.default.getNodeName(i.childNodes[0])||(i=n.createElement(t,[i.childNodes[0]])),i})}},{key:"changeBlockFormatTo",value:function(e){this.changeBlockFormat(function(e){return p.test(e)},e)}},{key:"getCaretPosition",value:function(){return this.getCursorPosition()}},{key:"replaceSelection",value:function(e,t){t&&this.setSelection(t),this._ignoreChange=!0,this.insertHTML(e)}},{key:"replaceRelativeOffset",value:function(e,t,n){var i=this.getSelection().cloneRange();this._replaceRelativeOffsetOfSelection(e,t,n,i)}},{key:"_replaceRelativeOffsetOfSelection",value:function(e,t,n,i){var a=void 0,o=void 0,r=void 0,l=i.endContainer,s=i.endOffset;"TEXT"!==v.default.getNodeName(l)&&(l=this._getClosestTextNode(l,s))&&(s=v.default.isTextNode(l)?l.nodeValue.length:l.textContent.length),l?(a=this.getSelectionInfoByOffset(l,s+t),i.setStart(a.element,a.offset),r=s+(t+n),o=this.getSelectionInfoByOffset(l,r),i.setEnd(o.element,o.offset),this.replaceSelection(e,i)):this.replaceSelection(e)}},{key:"_getClosestTextNode",value:function(e,t){var n=v.default.getChildNodeByOffset(e,t-1);return"TEXT"!==v.default.getNodeName(n)&&(n=n.previousSibling),n}},{key:"getSelectionInfoByOffset",value:function(e,t){var n=void 0,i=void 0,a=void 0,o=void 0,r=t>=0?"next":"previous",l=Math.abs(t),s=n;for(n="next"===r?e:e.previousSibling,a=l,o=0;n&&(i=v.default.isTextNode(n)?n.nodeValue.length:n.textContent.length,o+=i,!(l<=o));)a-=i,v.default.getTextLength(n)>0&&(s=n),n=n[r+"Sibling"];return n||(n=s,a=v.default.getTextLength(n)),"previous"===r&&(a=v.default.getTextLength(n)-a),{element:n,offset:a}}},{key:"getSelectionPosition",value:function(e,t,n){var i=this.createElement("INPUT"),a=e.cloneRange(),o=this.getSelectionInfoByOffset(e.endContainer,e.endOffset+(n||0));a.setStart(a.startContainer,a.startOffset),a.setEnd(o.element,o.offset),this._ignoreChange=!0,this.insertElement(i,a);var r=(0,u.default)(i).offset();return"over"!==t&&(r.top+=(0,u.default)(i).outerHeight()),i.parentNode.removeChild(i),e.setStart(e.endContainer,e.endOffset),e.collapse(!0),this.setSelection(e),r}},{key:"removeLastUndoStack",value:function(){this._undoStack.length&&(this._undoStackLength-=1,this._undoIndex-=1,this._undoStack.pop(),this._isInUndoState=!1)}},{key:"replaceParent",value:function(e,t,n){var i=(0,u.default)(e).closest(t);i.length&&(i.wrapInner("<"+n+"/>"),i.children().unwrap())}},{key:"preserveLastLine",value:function(){var e=this.get$Body().children().last();"DIV"!==v.default.getNodeName(e[0])&&(this._ignoreChange=!0,(0,u.default)(this.createDefaultBlock()).insertAfter(e))}},{key:"scrollTop",value:function(e){return d.default.isUndefined(e)?this.get$Body().scrollTop():this.get$Body().scrollTop(e)}},{key:"isIgnoreChange",value:function(){return this._ignoreChange}},{key:"focus",value:function(){h.default.prototype.focus.call(this)}},{key:"blockCommandShortcuts",value:function(){var e=this,t=/Mac/.test(navigator.platform),n=t?"meta":"ctrl";["b","i","u","shift-7","shift-5","shift-6","shift-8","shift-9","[","]"].forEach(function(t){e.setKeyHandler(n+"-"+t,function(e,t){t.preventDefault()})})}}]),t}(h.default);t.default=y},function(e,t){e.exports=r},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(1),l=i(r),s=n(3),u=i(s),c=l.default.browser.msie&&11===l.default.browser.version,d=-1!==navigator.appVersion.indexOf("Win")&&l.default.browser.chrome,f=c||d,h=function(){function e(t,n){a(this,e),this._wwe=t,f&&(this.isComposition=!1,this._initCompositionEvent()),this.setRange(n||this._wwe.getRange())}return o(e,[{key:"_initCompositionEvent",value:function(){var e=this;this._wwe.getEditor().addEventListener("compositionstart",function(){e.isComposition=!0}),this._wwe.getEditor().addEventListener("compositionend",function(){e.isComposition=!1})}},{key:"setRange",value:function(e){this._range&&this._range.detach(),this._range=e}},{key:"expandStartOffset",value:function(){var e=this._range;u.default.isTextNode(e.startContainer)&&e.startOffset>0&&e.setStart(e.startContainer,e.startOffset-1)}},{key:"expandEndOffset",value:function(){var e=this._range;u.default.isTextNode(e.endContainer)&&e.endOffset<e.endContainer.nodeValue.length&&e.setEnd(e.endContainer,e.endOffset+1)}},{key:"setEndBeforeRange",value:function(e){var t=e.startOffset;this.isComposition&&(t+=1),this._range.setEnd(e.startContainer,t)}},{key:"getTextContent",value:function(){return this._range.cloneContents().textContent}},{key:"replaceContent",value:function(e){this._wwe.getEditor().setSelection(this._range),this._wwe.getEditor().insertHTML(e),this._range=this._wwe.getRange()}},{key:"deleteContent",value:function(){this._wwe.getEditor().setSelection(this._range),this._wwe.getEditor().insertHTML(""),this._range=this._wwe.getRange()}},{key:"peekStartBeforeOffset",value:function(e){var t=this._range.cloneRange();return t.setStart(t.startContainer,Math.max(t.startOffset-e,0)),t.setEnd(this._range.startContainer,this._range.startOffset),t.cloneContents().textContent}}]),e}();t.default=h},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=function e(t,n,i){null===t&&(t=Function.prototype);var a=Object.getOwnPropertyDescriptor(t,n);if(void 0===a){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in a)return a.value;var r=a.get;if(void 0!==r)return r.call(i)},u=n(0),c=i(u),d=n(61),f=i(d),h=function(e){function t(e){var n=e.eventManager,i=e.container,r=e.wysiwygEditor;a(this,t);var l=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,{eventManager:n,container:i,attachedSelector:"pre"}));return l._wysiwygEditor=r,l._popupCodeBlockLanguages=null,l._initDOM(),l._initDOMEvent(),l}return r(t,e),l(t,[{key:"_initDOM",value:function(){this.$el.addClass("code-block-header"),this._$languageLabel=(0,c.default)("<span>text</span>"),this.$el.append(this._$languageLabel),this._$buttonOpenModalEditor=(0,c.default)('<button type="button">Editor</button>'),this.$el.append(this._$buttonOpenModalEditor)}},{key:"_initDOMEvent",value:function(){var e=this;this._$buttonOpenModalEditor.on("click",function(){return e._openPopupCodeBlockEditor()})}},{key:"_openPopupCodeBlockEditor",value:function(){this._eventManager.emit("openPopupCodeBlockEditor",this.getAttachedElement())}},{key:"_updateLanguage",value:function(){var e=this.getAttachedElement(),t=e?e.getAttribute("data-language"):null;this._$languageLabel.text(t||"text")}},{key:"syncLayout",value:function(){var e=(0,c.default)(this.getAttachedElement()),t=e.offset();t.left=t.left+(e.outerWidth()-250),this.$el.offset(t),this.$el.height(30),this.$el.width(250)}},{key:"onShow",value:function(){var e=this;s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"onShow",this).call(this),this._onAttachedElementChange=function(){return e._updateLanguage()},(0,c.default)(this.getAttachedElement()).on("language-changed",this._onAttachedElementChange),this._updateLanguage()}},{key:"onHide",value:function(){(0,c.default)(this.getAttachedElement()).off("language-changed",this._onAttachedElementChange),s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"onHide",this).call(this)}}]),t}(f.default);t.default=h},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),r=function(e){return e&&e.__esModule?e:{default:e}}(o),l=function(){function e(t){var n=t.eventManager,a=t.container,o=t.attachedSelector;i(this,e),this._eventManager=n,this._attachedSelector="[contenteditable=true] "+o,this._$container=(0,r.default)(a),this._$attachedElement=null,this.active=!1,this._createElement(),this._initEvent()}return a(e,[{key:"_createElement",value:function(){this.$el=(0,r.default)('<div class="te-ww-block-overlay">'),this.$el.css({position:"absolute",display:"none","z-index":1}),this._$container.append(this.$el)}},{key:"_initEvent",value:function(){var e=this;this._eventManager.listen("change",this._onChange.bind(this)),this._eventManager.listen("mouseover",this._onMouseOver.bind(this)),this._eventManager.listen("focus",function(){e.setVisibility(!1)}),this._eventManager.listen("mousedown",function(){e.setVisibility(!1)})}},{key:"_onChange",value:function(){this._$attachedElement&&r.default.contains(document,this._$attachedElement[0])?this.syncLayout():this.setVisibility(!1)}},{key:"_onMouseOver",value:function(e){var t=e.data,n=(0,r.default)(t.target),i=n.closest(this._attachedSelector);i.length?(this._$attachedElement=i,this.setVisibility(!0)):n.closest(this.$el).length?this.setVisibility(!0):this.active||this.setVisibility(!1)}},{key:"syncLayout",value:function(){this.$el.offset(this._$attachedElement.offset()),this.$el.width(this._$attachedElement.outerWidth()),this.$el.height(this._$attachedElement.outerHeight())}},{key:"getAttachedElement",value:function(){return this._$attachedElement?this._$attachedElement.get(0):null}},{key:"getVisibility",value:function(){return"block"===this.$el.css("display")}},{key:"setVisibility",value:function(e){e&&this._$attachedElement?this.getVisibility()||(this.$el.css("display","block"),this.syncLayout(),this.onShow()):e||this.getVisibility()&&(this.$el.css("display","none"),this.onHide())}},{key:"onShow",value:function(){}},{key:"onHide",value:function(){this.active=!1,this._$attachedElement=null}}]),e}();t.default=l},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),r=function(e){return e&&e.__esModule?e:{default:e}}(o),l=['<div class="tui-editor">','<div class="te-md-container">','<div class="te-editor" />','<div class="te-md-splitter" />','<div class="te-preview" />',"</div>",'<div class="te-ww-container">','<div class="te-editor" />',"</div>","</div>"].join(""),s=function(){function e(t,n){i(this,e),this.$el=(0,r.default)(t.el),this.height=t.height,this.type=t.initialEditType,this.eventManager=n,this.init(),this._initEvent()}return a(e,[{key:"init",value:function(){this._renderLayout(),this._initMarkdownAndPreviewSection(),this._initWysiwygSection()}},{key:"_initEvent",value:function(){this.eventManager.listen("hide",this.hide.bind(this)),this.eventManager.listen("show",this.show.bind(this))}},{key:"_renderLayout",value:function(){this.$el.css("box-sizing","border-box"),this.$containerEl=(0,r.default)(l).appendTo(this.$el)}},{key:"switchToWYSIWYG",value:function(){this.$containerEl.removeClass("te-md-mode"),this.$containerEl.addClass("te-ww-mode")}},{key:"switchToMarkdown",value:function(){this.$containerEl.removeClass("te-ww-mode"),this.$containerEl.addClass("te-md-mode")}},{key:"_initMarkdownAndPreviewSection",value:function(){this.$mdEditorContainerEl=this.$containerEl.find(".te-md-container .te-editor"),this.$previewEl=this.$containerEl.find(".te-md-container .te-preview")}},{key:"_initWysiwygSection",value:function(){this.$wwEditorContainerEl=this.$containerEl.find(".te-ww-container .te-editor")}},{key:"_verticalSplitStyle",value:function(){this.$containerEl.find(".te-md-container").removeClass("te-preview-style-tab"),this.$containerEl.find(".te-md-container").addClass("te-preview-style-vertical")}},{key:"_tabStyle",value:function(){this.$containerEl.find(".te-md-container").removeClass("te-preview-style-vertical"),this.$containerEl.find(".te-md-container").addClass("te-preview-style-tab")}},{key:"changePreviewStyle",value:function(e){"tab"===e?this._tabStyle():"vertical"===e&&this._verticalSplitStyle()}},{key:"hide",value:function(){this.$el.find(".tui-editor").addClass("te-hide")}},{key:"show",value:function(){this.$el.find(".tui-editor").removeClass("te-hide")}},{key:"remove",value:function(){this.$el.find(".tui-editor").remove()}},{key:"getEditorEl",value:function(){return this.$containerEl}},{key:"getPreviewEl",value:function(){return this.$previewEl}},{key:"getMdEditorContainerEl",value:function(){return this.$mdEditorContainerEl}},{key:"getWwEditorContainerEl",value:function(){return this.$wwEditorContainerEl}}]),e}();t.default=s},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),l=i(r),s=n(64),u=i(s),c=n(37),d=i(c),f=n(5),h=i(f),g=n(65),v=i(g),p=n(66),m=i(p),y=n(67),_=i(y),b=n(68),k=i(b),w=n(69),C=i(w),E=n(70),M=i(E),T=n(71),S=i(T),O=n(72),L=i(O),B=n(4),N=i(B),x=n(31),P=i(x),A=function(){function e(t){a(this,e),this.name="default",this.toolbar=null,this.$el=null,this._container=null,this._editorSection=null,this._editor=t,this._initialEditType=t.options.initialEditType,this._init(t.options.el),this._initEvent()}return o(e,[{key:"_init",value:function(e){this._container=e,this.$el=(0,l.default)('\n    <div class="tui-editor-defaultUI">\n        <div class="te-toolbar-section"><div class="te-markdown-tab-section"></div></div>\n        <div class="te-editor-section"></div>\n        <div class="te-mode-switch-section"></div>\n    </div>\n').appendTo(e),this._editorSection=this.$el.find(".te-editor-section").get(0),this._editorSection.appendChild(this._editor.layout.getEditorEl().get(0)),this._initToolbar(),this._initModeSwitch(),this._initPopupAddLink(),this._initPopupAddImage(),this._initPopupAddTable(),this._initPopupAddHeading(),this._initPopupTableUtils(),this._initPopupCodeBlockLanguages(),this._initPopupCodeBlockEditor(),this._initMarkdownTab()}},{key:"_initEvent",value:function(){this._editor.eventManager.listen("hide",this.hide.bind(this)),this._editor.eventManager.listen("show",this.show.bind(this)),this._editor.eventManager.listen("changeMode",this._markdownTabControl.bind(this)),this._editor.eventManager.listen("changePreviewStyle",this._markdownTabControl.bind(this))}},{key:"_initToolbar",value:function(){this.toolbar=new u.default(this._editor.eventManager),this.$el.find(".te-toolbar-section").append(this.toolbar.$el)}},{key:"_initModeSwitch",value:function(){var e=this;this._modeSwitch=new v.default("markdown"===this._initialEditType?v.default.TYPE.MARKDOWN:v.default.TYPE.WYSIWYG),this.$el.find(".te-mode-switch-section").append(this._modeSwitch.$el),this._modeSwitch.on("modeSwitched",function(t,n){return e._editor.changeMode(n)})}},{key:"_initMarkdownTab",value:function(){var e=this._editor;this.markdownTab=new d.default({initName:N.default.get("Write"),items:[N.default.get("Write"),N.default.get("Preview")],sections:[e.layout.getMdEditorContainerEl(),e.layout.getPreviewEl()]}),this._$markdownTabSection=this.$el.find(".te-markdown-tab-section"),this._$markdownTabSection.append(this.markdownTab.$el),this.markdownTab.on("itemClick",function(t,n){n===N.default.get("Preview")?e.eventManager.emit("previewNeedsRefresh"):e.getCodeMirror().focus()})}},{key:"_markdownTabControl",value:function(){this._editor.isMarkdownMode()&&"tab"===this._editor.getCurrentPreviewStyle()?(this._$markdownTabSection.show(),this.markdownTab.activate(N.default.get("Write"))):this._$markdownTabSection.hide()}},{key:"_initPopupAddLink",value:function(){this.popupAddLink=new m.default({$target:this.$el,editor:this._editor})}},{key:"_initPopupAddImage",value:function(){this.popupAddImage=new _.default({$target:this.$el,eventManager:this._editor.eventManager})}},{key:"_initPopupAddTable",value:function(){this.popupAddTable=new C.default({$target:this.$el,eventManager:this._editor.eventManager,$button:this.$el.find("button.tui-table"),css:{position:"absolute"}})}},{key:"_initPopupAddHeading",value:function(){this.popupAddHeading=new M.default({$target:this.$el,eventManager:this._editor.eventManager,$button:this.$el.find("button.tui-heading"),css:{position:"absolute"}})}},{key:"_initPopupTableUtils",value:function(){var e=this;this._editor.eventManager.listen("contextmenu",function(t){(0,l.default)(t.data.target).parents("[contenteditable=true] table").length>0&&(t.data.preventDefault(),e._editor.eventManager.emit("openPopupTableUtils",t.data))}),this.popupTableUtils=new k.default({$target:this.$el,eventManager:this._editor.eventManager})}},{key:"_initPopupCodeBlockLanguages",value:function(){var e=this._editor;this.popupCodeBlockLanguages=new S.default({$target:this.$el,eventManager:e.eventManager,languages:e.options.codeBlockLanguages})}},{key:"_initPopupCodeBlockEditor",value:function(){this.popupCodeBlockEditor=new L.default({$target:this.$el,eventManager:this._editor.eventManager,convertor:this._editor.convertor})}},{key:"getEditorSectionHeight",value:function(){var e=this._editorSection.getBoundingClientRect();return e.bottom-e.top}},{key:"getEditorHeight",value:function(){var e=this._container.getBoundingClientRect();return e.bottom-e.top}},{key:"hide",value:function(){this.$el.addClass("te-hide")}},{key:"show",value:function(){this.$el.removeClass("te-hide")}},{key:"remove",value:function(){this.$el.remove(),P.default.hide()}},{key:"createPopup",value:function(e){return new h.default(e)}}]),e}();t.default=A},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=n(0),u=i(s),c=n(1),d=i(c),f=n(8),h=i(f),g=n(30),v=i(g),p=n(4),m=i(p),y=function(e){function t(e){a(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,{tagName:"div",className:"tui-editor-defaultUI-toolbar"}));return n.buttons=[],n.eventManager=e,n._render(),n._initButton(["heading","bold","italic","strike","|","hr","quote","ul","ol","task","|","table","image","link","|","code","codeBlock"]),n.eventManager.listen("stateChange",function(e){d.default.forEach(n.buttons,function(t){t._state&&(e[t._state]?t.$el.addClass("active"):t.$el.removeClass("active"))})}),n}return r(t,e),l(t,[{key:"_render",value:function(){this.$buttonContainer=this.$el}},{key:"addButton",value:function(e,t){if(d.default.isArray(e))for(var n=e.length-1;n>=0;n-=1)d.default.isNumber(t)?this._addButton(e[n],t):this._addButton(e);else this._addButton(e,t)}},{key:"_addButton",value:function(e,t){var n=this._setButton(e,t).$el;d.default.isNumber(t)?this.$buttonContainer.find(".tui-toolbar-icons").eq(t-1).before(n):this.$buttonContainer.append(n)}},{key:"addDivider",value:function(){var e=(0,u.default)('<div class="tui-toolbar-divider"></div>');return this.$buttonContainer.append(e),e}},{key:"_setButton",value:function(e,t){var n=this.eventManager;return e instanceof v.default||(e=new v.default(e)),e.on("command",function(e,t){return n.emit("command",t)}),e.on("event",function(e,t){return n.emit(t)}),d.default.isNumber(t)?this.buttons.splice(t,0,e):this.buttons.push(e),e}},{key:"_initButton",value:function(e){var t=this;this.buttonOptions={heading:{className:"tui-heading",event:"openHeadingSelect",tooltip:m.default.get("Headings")},bold:{className:"tui-bold",command:"Bold",tooltip:m.default.get("Bold"),state:"bold"},italic:{className:"tui-italic",command:"Italic",tooltip:m.default.get("Italic"),state:"italic"},strike:{className:"tui-strike",command:"Strike",tooltip:m.default.get("Strike"),state:"strike"},ul:{className:"tui-ul",command:"UL",tooltip:m.default.get("Unordered list")},ol:{className:"tui-ol",command:"OL",tooltip:m.default.get("Ordered list")},task:{className:"tui-task",command:"Task",tooltip:m.default.get("Task")},hr:{className:"tui-hrline",command:"HR",tooltip:m.default.get("Line")},table:{className:"tui-table",event:"openPopupAddTable",tooltip:m.default.get("Insert table")},image:{className:"tui-image",event:"openPopupAddImage",tooltip:m.default.get("Insert image")},link:{className:"tui-link",event:"openPopupAddLink",tooltip:m.default.get("Insert link")},quote:{className:"tui-quote",command:"Blockquote",tooltip:m.default.get("Blockquote"),state:"quote"},codeBlock:{className:"tui-codeblock",command:"CodeBlock",tooltip:m.default.get("Insert CodeBlock"),state:"codeBlock"},code:{className:"tui-code",command:"Code",tooltip:m.default.get("Code"),state:"code"}},d.default.forEach(e,function(e){"|"===e?t.addDivider():t.buttonOptions[e]&&t.addButton(new v.default(t.buttonOptions[e]))})}}]),t}(h.default);t.default=y},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=n(0),u=i(s),c=n(1),d=i(c),f=n(8),h=i(f),g=n(4),v=i(g),p="markdown",m=function(e){function t(e){a(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,{tagName:"div",className:"te-mode-switch"}));return n._render(),n._switchType(d.default.isExisty(e)?e:p),n}return r(t,e),l(t,[{key:"_render",value:function(){this.buttons={},this.buttons.$markdown=(0,u.default)('<button class="te-switch-button markdown" type="button">'+v.default.get("Markdown")+"</button>"),this.buttons.$wysiwyg=(0,u.default)('<button class="te-switch-button wysiwyg" type="button">'+v.default.get("WYSIWYG")+"</button>"),this.$el.append(this.buttons.$markdown),this.$el.append(this.buttons.$wysiwyg),this.on("click .markdown",this._changeMarkdown.bind(this)),this.on("click .wysiwyg",this._changeWysiwyg.bind(this))}},{key:"_changeMarkdown",value:function(){this._switchType(p)}},{key:"_changeWysiwyg",value:function(){this._switchType("wysiwyg")}},{key:"_setActiveButton",value:function(e){this.buttons.$markdown.removeClass("active"),this.buttons.$wysiwyg.removeClass("active"),this.buttons["$"+e].addClass("active")}},{key:"_switchType",value:function(e){this.type!==e&&(this.type=e,this._setActiveButton(e),this.trigger("modeSwitched",this.type))}}]),t}(h.default);m.TYPE={MARKDOWN:p,WYSIWYG:"wysiwyg"},t.default=m},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=function e(t,n,i){null===t&&(t=Function.prototype);var a=Object.getOwnPropertyDescriptor(t,n);if(void 0===a){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in a)return a.value;var r=a.get;if(void 0!==r)return r.call(i)},u=n(1),c=i(u),d=n(5),f=i(d),h=n(4),g=i(h),v=/^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})(\/([^\s]*))?$/,p=function(e){function t(e){a(this,t);var n='\n            <label for="linkText">'+g.default.get("Link text")+'</label>\n            <input type="text" class="te-link-text-input" />\n            <label for="url">'+g.default.get("URL")+'</label>\n            <input type="text" class="te-url-input" />\n            <div class="te-button-section">\n                <button type="button" class="te-ok-button">'+g.default.get("OK")+'</button>\n                <button type="button" class="te-close-button">'+g.default.get("Cancel")+"</button>\n            </div>\n        ";return e=c.default.extend({header:!0,title:g.default.get("Insert link"),className:"te-popup-add-link tui-editor-popup",content:n},e),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return r(t,e),l(t,[{key:"_initInstance",value:function(e){s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_initInstance",this).call(this,e),this._editor=e.editor,this._eventManager=e.editor.eventManager}},{key:"_initDOM",value:function(){s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_initDOM",this).call(this);var e=this.$el.get(0);this._inputText=e.querySelector(".te-link-text-input"),this._inputURL=e.querySelector(".te-url-input")}},{key:"_initDOMEvent",value:function(){var e=this;s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_initDOMEvent",this).call(this),this.on("click .te-close-button",function(){return e.hide()}),this.on("click .te-ok-button",function(){return e._addLink()}),this.on("shown",function(){var t=e._inputText,n=e._inputURL,i=e._editor.getSelectedText().trim();t.value=i,v.exec(i)&&(n.value=i),i.length>0&&n.value.length<1?n.focus():(t.focus(),t.setSelectionRange(0,i.length))}),this.on("hidden",function(){e._resetInputs()})}},{key:"_initEditorEvent",value:function(){var e=this;s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_initEditorEvent",this).call(this);var n=this._eventManager;n.listen("focus",function(){return e.hide()}),n.listen("closeAllPopup",function(){return e.hide()}),n.listen("openPopupAddLink",function(){n.emit("closeAllPopup"),e.show()})}},{key:"_addLink",value:function(){var e=this._getValue(),t=e.url,n=e.linkText;return this._clearValidationStyle(),n.length<1?void this._inputText.classList.add("wrong"):t.length<1?void this._inputURL.classList.add("wrong"):(this._eventManager.emit("command","AddLink",{linkText:n,url:t}),void this.hide())}},{key:"_getValue",value:function(){return{url:this._inputURL.value,linkText:this._inputText.value}}},{key:"_clearValidationStyle",value:function(){this._inputURL.classList.remove("wrong"),this._inputText.classList.remove("wrong")}},{key:"_resetInputs",value:function(){this._inputText.value="",this._inputURL.value="",this._clearValidationStyle()}}]),t}(f.default);t.default=p},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=function e(t,n,i){null===t&&(t=Function.prototype);var a=Object.getOwnPropertyDescriptor(t,n);if(void 0===a){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in a)return a.value;var r=a.get;if(void 0!==r)return r.call(i)},u=n(1),c=i(u),d=n(5),f=i(d),h=n(37),g=i(h),v=n(4),p=i(v),m="te-image-url-input",y="te-image-file-input",_="te-alt-text-input",b="te-ok-button",k="te-close-button",w="te-file-type",C="te-url-type",E="te-tab-section",M=function(e){function t(e){a(this,t);var n='\n            <div class="'+E+'"></div>\n            <div class="'+C+'">\n                <label for="">'+p.default.get("Image URL")+'</label>\n                <input type="text" class="'+m+'" />\n            </div>\n            <form enctype="multipart/form-data" class="'+w+'">\n                <label for="">'+p.default.get("Select image file")+'</label>\n                <input type="file" class="'+y+'" accept="image/*" />\n            </form>\n            <label for="url">'+p.default.get("Description")+'</label>\n            <input type="text" class="'+_+'" />\n            <div class="te-button-section">\n                <button type="button" class="'+b+'">'+p.default.get("OK")+'</button>\n                <button type="button" class="'+k+'">'+p.default.get("Cancel")+"</button>\n            </div>\n        ";return e=c.default.extend({header:!0,title:p.default.get("Insert image"),className:"te-popup-add-image tui-editor-popup",content:n},e),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return r(t,e),l(t,[{key:"_initInstance",value:function(e){s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_initInstance",this).call(this,e),this.eventManager=e.eventManager}},{key:"_initDOM",value:function(){s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_initDOM",this).call(this);var e=this.$el;this._$imageUrlInput=e.find("."+m),this._$imageFileInput=e.find("."+y),this._$altTextInput=e.find("."+_);var n=e.find("."+w),i=e.find("."+C),a=this.$body.find("."+E);this.tab=new g.default({initName:p.default.get("File"),items:[p.default.get("File"),p.default.get("URL")],sections:[n,i]}),a.append(this.tab.$el)}},{key:"_initDOMEvent",value:function(){var e=this;s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_initDOMEvent",this).call(this),this.on("shown",function(){return e._$imageUrlInput.focus()}),this.on("hidden",function(){return e._resetInputs()}),this.on("change ."+y,function(){var t=e._$imageFileInput.val().split("\\").pop();e._$altTextInput.val(t)}),this.on("click ."+k,function(){return e.hide()}),this.on("click ."+b,function(){var t=e._$imageUrlInput.val(),n=e._$altTextInput.val();if(t)e._applyImage(t,n);else{var i=e._$imageFileInput.get(0).files.item(0),a=function(t,i){return e._applyImage(t,n||i)};e.eventManager.emit("addImageBlobHook",i,a,"ui")}e.hide()}),this.tab.on("itemClick",function(){return e._resetInputs()})}},{key:"_initEditorEvent",value:function(){var e=this;s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_initEditorEvent",this).call(this),this.eventManager.listen("focus",function(){return e.hide()}),this.eventManager.listen("closeAllPopup",function(){return e.hide()}),this.eventManager.listen("openPopupAddImage",function(){e.eventManager.emit("closeAllPopup"),e.show()})}},{key:"_applyImage",value:function(e,t){this.eventManager.emit("command","AddImage",{imageUrl:e,altText:t||"image"}),this.hide()}},{key:"_resetInputs",value:function(){this.$el.find("input").val("")}}]),t}(f.default);t.default=M},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=function e(t,n,i){null===t&&(t=Function.prototype);var a=Object.getOwnPropertyDescriptor(t,n);if(void 0===a){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in a)return a.value;var r=a.get;if(void 0!==r)return r.call(i)},u=n(0),c=i(u),d=n(1),f=i(d),h=n(5),g=i(h),v=n(4),p=i(v),m=function(e){function t(e){a(this,t);var n='\n            <button type="button" class="te-table-add-row">'+p.default.get("Add row")+'</button>\n            <button type="button" class="te-table-add-col">'+p.default.get("Add col")+'</button>\n            <button type="button" class="te-table-remove-row">'+p.default.get("Remove row")+'</button>\n            <button type="button" class="te-table-remove-col">'+p.default.get("Remove col")+'</button>\n            <hr/>\n            <button type="button" class="te-table-col-align-left">'+p.default.get("Align left")+'</button>\n            <button type="button" class="te-table-col-align-center">'+p.default.get("Align center")+'</button>\n            <button type="button" class="te-table-col-align-right">'+p.default.get("Align right")+'</button>\n            <hr/>\n            <button type="button" class="te-table-remove">'+p.default.get("Remove table")+"</button>\n        ";return e=f.default.extend({header:!1,className:"te-popup-table-utils",content:n},e),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return r(t,e),l(t,[{key:"_initInstance",value:function(e){s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_initInstance",this).call(this,e),this.eventManager=e.eventManager}},{key:"_initDOMEvent",value:function(){var e=this;s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_initDOMEvent",this).call(this),this.on("click .te-table-add-row",function(){return e.eventManager.emit("command","AddRow")}),this.on("click .te-table-add-col",function(){return e.eventManager.emit("command","AddCol")}),this.on("click .te-table-remove-row",function(){return e.eventManager.emit("command","RemoveRow")}),this.on("click .te-table-col-align-left",function(){return e.eventManager.emit("command","AlignCol","left")}),this.on("click .te-table-col-align-center",function(){return e.eventManager.emit("command","AlignCol","center")}),this.on("click .te-table-col-align-right",function(){return e.eventManager.emit("command","AlignCol","right")}),this.on("click .te-table-remove-col",function(){return e.eventManager.emit("command","RemoveCol")}),this.on("click .te-table-remove",function(){return e.eventManager.emit("command","RemoveTable")})}},{key:"_initEditorEvent",value:function(){var e=this;s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_initEditorEvent",this).call(this),this.eventManager.listen("focus",function(){return e.hide()}),this.eventManager.listen("mousedown",function(){return e.hide()}),this.eventManager.listen("closeAllPopup",function(){return e.hide()}),this.eventManager.listen("openPopupTableUtils",function(t){var n=e.$el.parent().offset(),i=t.clientX-n.left,a=t.clientY-n.top+(0,c.default)(window).scrollTop();e.eventManager.emit("closeAllPopup"),e.$el.css({position:"absolute",top:a+5,left:i+10}),e.show()})}}]),t}(g.default);t.default=m},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=function e(t,n,i){null===t&&(t=Function.prototype);var a=Object.getOwnPropertyDescriptor(t,n);if(void 0===a){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in a)return a.value;var r=a.get;if(void 0!==r)return r.call(i)},u=n(1),c=i(u),d=n(5),f=i(d),h='\n    <div class="te-table-selection">\n        <div class="te-table-header"></div>\n        <div class="te-table-body"></div>\n        <div class="te-selection-area"></div>\n    </div>\n    <p class="te-description"></p>\n',g=function(e){function t(e){return a(this,t),e=c.default.extend({header:!1,className:"te-popup-add-table",content:h},e),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return r(t,e),l(t,[{key:"_initInstance",value:function(e){s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_initInstance",this).call(this,e),this._selectedBound={},this._tableBound={},this._eventManager=e.eventManager,this.$button=e.$button}},{key:"_initDOM",value:function(){s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_initDOM",this).call(this),this._cacheElements(),this._setTableSizeByBound(5,7)}},{key:"_initDOMEvent",value:function(e){var n=this;s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_initDOMEvent",this).call(this,e),this.on("mousemove .te-table-selection",function(e){var t=e.pageX-n._selectionOffset.left,i=e.pageY-n._selectionOffset.top,a=n._getSelectionBoundByOffset(t,i);n._resizeTableBySelectionIfNeed(a.col,a.row),n._setSelectionAreaByBound(a.col,a.row),n._setDisplayText(a.col,a.row),n._setSelectedBound(a.col,a.row)}),this.on("click .te-table-selection",function(){var e=n._getSelectedTableSize();n._eventManager.emit("command","Table",e.col,e.row)})}},{key:"_initEditorEvent",value:function(){var e=this;s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_initEditorEvent",this).call(this),this._eventManager.listen("focus",function(){return e.hide()}),this._eventManager.listen("closeAllPopup",function(){return e.hide()}),this._eventManager.listen("openPopupAddTable",function(){e._eventManager.emit("closeAllPopup");var t=e.$button,n=t.position();e.$el.css({top:n.top+t.outerHeight(!0),left:n.left}),e.show(),e._selectionOffset=e.$el.find(".te-table-selection").offset()})}},{key:"_cacheElements",value:function(){this.$header=this.$el.find(".te-table-header"),this.$body=this.$el.find(".te-table-body"),this.$selection=this.$el.find(".te-selection-area"),this.$desc=this.$el.find(".te-description")}},{key:"_resizeTableBySelectionIfNeed",value:function(e,t){var n=this._getResizedTableBound(e,t);n&&this._setTableSizeByBound(n.col,n.row)}},{key:"_getResizedTableBound",value:function(e,t){var n=void 0,i=void 0,a=void 0;return e>=5&&e<9?n=e+1:e<5&&(n=5),t>=7&&t<14?i=t+1:t<7&&(i=7),this._isNeedResizeTable(n,i)&&(a={row:i||this._tableBound.row,col:n||this._tableBound.col}),a}},{key:"_isNeedResizeTable",value:function(e,t){return e&&e!==this._tableBound.col||t&&t!==this._tableBound.row}},{key:"_getBoundByOffset",value:function(e,t){return{row:parseInt(t/17,10),col:parseInt(e/25,10)}}},{key:"_getOffsetByBound",value:function(e,t){return{x:25*e+25,y:17*t+17}}},{key:"_setTableSizeByBound",value:function(e,t){var n=this._getOffsetByBound(e,t-1);this._setTableSize(n.x,n.y),this._tableBound.row=t,this._tableBound.col=e}},{key:"_getSelectionBoundByOffset",value:function(e,t){var n=this._getBoundByOffset(e,t);return n.row<1?n.row=1:n.row>this._tableBound.row&&(n.row=this._tableBound.row),n.col<1?n.col=1:n.col>this._tableBound.col&&(n.col=this._tableBound.col),n}},{key:"_setSelectionAreaByBound",value:function(e,t){var n=this._getOffsetByBound(e,t);this._setSelectionArea(n.x,n.y)}},{key:"_setSelectedBound",value:function(e,t){this._selectedBound.col=e,this._selectedBound.row=t}},{key:"_getSelectedTableSize",value:function(){return{row:this._selectedBound.row+1,col:this._selectedBound.col+1}}},{key:"_setDisplayText",value:function(e,t){this.$desc.html(e+1+" x "+(t+1))}},{key:"_setTableSize",value:function(e,t){e+=1,t+=1,this.$header.css({height:17,width:e}),this.$body.css({height:t,width:e}),this.$el.css({width:e+30})}},{key:"_setSelectionArea",value:function(e,t){e+=1,t+=1,this.$selection.css({height:t,width:e})}}]),t}(f.default);g.CELL_WIDTH=25,g.CELL_HEIGHT=17,g.MIN_ROW_SELECTION_INDEX=1,g.MIN_COL_SELECTION_INDEX=1,t.default=g},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=function e(t,n,i){null===t&&(t=Function.prototype);var a=Object.getOwnPropertyDescriptor(t,n);if(void 0===a){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in a)return a.value;var r=a.get;if(void 0!==r)return r.call(i)},u=n(0),c=i(u),d=n(1),f=i(d),h=n(5),g=i(h),v=n(4),p=i(v),m=function(e){function t(e){a(this,t);var n='\n            <ul>\n                <li data-value="1" data-type="Heading"><h1>'+p.default.get("Heading")+' 1</h1></li>\n                <li data-value="2" data-type="Heading"><h2>'+p.default.get("Heading")+' 2</h2></li>\n                <li data-value="3" data-type="Heading"><h3>'+p.default.get("Heading")+' 3</h3></li>\n                <li data-value="4" data-type="Heading"><h4>'+p.default.get("Heading")+' 4</h4></li>\n                <li data-value="5" data-type="Heading"><h5>'+p.default.get("Heading")+' 5</h5></li>\n                <li data-value="6" data-type="Heading"><h6>'+p.default.get("Heading")+' 6</h6></li>\n                <li data-type="Paragraph"><div>'+p.default.get("Paragraph")+"</div></li>\n            </ul>\n        ";return e=f.default.extend({header:!1,className:"te-heading-add",content:n},e),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return r(t,e),l(t,[{key:"_initInstance",value:function(e){s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_initInstance",this).call(this,e),this._eventManager=e.eventManager,this._$button=e.$button}},{key:"_initDOMEvent",value:function(){var e=this;s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_initDOMEvent",this).call(this),this.on("click li",function(t){var n=(0,c.default)(t.target).closest("li");e._eventManager.emit("command",n.data("type"),n.data("value"))})}},{key:"_initEditorEvent",value:function(){var e=this;s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_initEditorEvent",this).call(this),this._eventManager.listen("focus",this.hide.bind(this)),this._eventManager.listen("closeAllPopup",this.hide.bind(this)),this._eventManager.listen("openHeadingSelect",function(){e._eventManager.emit("closeAllPopup");var t=e._$button,n=t.position();e.$el.css({top:n.top+t.outerHeight(!0),left:n.left}),e.show()})}}]),t}(g.default);t.default=m},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=function e(t,n,i){null===t&&(t=Function.prototype);var a=Object.getOwnPropertyDescriptor(t,n);if(void 0===a){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in a)return a.value;var r=a.get;if(void 0!==r)return r.call(i)},u=n(0),c=i(u),d=n(1),f=i(d),h=n(5),g=i(h),v="te-popup-code-block-lang-",p=function(e){function t(e){a(this,t);var n=[];return e.languages.forEach(function(e){return n.push('<button type="button" class="'+v+e+'" data-lang="'+e+'">'+e+"</button>")}),e=f.default.extend({header:!1,className:"te-popup-code-block-languages",content:n.join("")},e),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return r(t,e),l(t,[{key:"_initInstance",value:function(e){s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_initInstance",this).call(this,e),this._onSelectedLanguage=null,this._onDismissed=null,this._currentButton=null,this._$buttons=null,this._languages=e.languages,this.eventManager=e.eventManager}},{key:"_initDOM",value:function(e){s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_initDOM",this).call(this,e),this.$el.css("z-index",1e4),this._$buttons=this.$el.find("button"),this._activateButtonByIndex(0)}},{key:"_initDOMEvent",value:function(){var e=this;s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_initDOMEvent",this).call(this);var n=function(t){var n=(0,c.default)(t.target).data("lang");e._onSelectedLanguage&&e._onSelectedLanguage(n),e.hide()};this._languages.forEach(function(t){return e.on("mousedown ."+v+t,n)})}},{key:"_initEditorEvent",value:function(){var e=this;s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_initEditorEvent",this).call(this),this.eventManager.listen("openPopupCodeBlockLanguages",function(t){e.show(t.callback);var n=e.$el.get(0).style;return n.top=t.offset.top+"px",n.left=t.offset.left+"px",e.setCurrentLanguage(t.language),e}),this.eventManager.listen("focus",function(){return e.hide()}),this.eventManager.listen("mousedown",function(){return e.hide()}),this.eventManager.listen("closeAllPopup",function(){return e.hide()}),this.eventManager.listen("closePopupCodeBlockLanguages",function(){return e.hide()}),this.eventManager.listen("scroll",function(){return e.hide()})}},{key:"_activateButtonByIndex",value:function(e){this._currentButton&&(0,c.default)(this._currentButton).removeClass("active"),this._currentButton=this._$buttons.get(e),(0,c.default)(this._currentButton).addClass("active"),this._currentButton.scrollIntoView()}},{key:"prev",value:function(){var e=this._$buttons.index(this._currentButton)-1;e<0&&(e=this._$buttons.length-1),this._activateButtonByIndex(e)}},{key:"next",value:function(){var e=this._$buttons.index(this._currentButton)+1;e>=this._$buttons.length&&(e=0),this._activateButtonByIndex(e)}},{key:"getCurrentLanguage",value:function(){return(0,c.default)(this._currentButton).data("lang")}},{key:"setCurrentLanguage",value:function(e){var t=this._$buttons.filter("."+v+e);if(t.length>0){var n=this._$buttons.index(t);this._activateButtonByIndex(n)}}},{key:"show",value:function(e){this._onSelectedLanguage=e.selected,this._onDismissed=e.dismissed,s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"show",this).call(this)}},{key:"hide",value:function(){this._onDismissed&&this._onDismissed(),this._onSelectedLanguage=null,this._onDismissed=null,s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"hide",this).call(this)}}]),t}(g.default);t.default=p},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=function e(t,n,i){null===t&&(t=Function.prototype);var a=Object.getOwnPropertyDescriptor(t,n);if(void 0===a){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in a)return a.value;var r=a.get;if(void 0!==r)return r.call(i)},u=n(0),c=i(u),d=n(1),f=i(d),h=n(5),g=i(h),v=n(73),p=i(v),m=n(74),y=i(m),_=n(75),b=i(_),k=n(76),w=i(k),C=n(4),E=i(C),M="popup-editor-",T="te-ok-button",S="te-close-button",O='\n    <button type="button" class="'+M+'toggle-scroll"></button>\n    <button type="button" class="'+M+'toggle-preview"></button>\n    <button type="button" class="'+M+'toggle-fit"></button>\n    <button type="button" class="tui-popup-close-button"></button>\n',L=function(e){function t(e){a(this,t);var n='\n            <div class="'+M+'body"></div>\n            <div class="te-button-section">\n                <button type="button" class="'+T+'">'+E.default.get("OK")+'</button>\n                <button type="button" class="'+S+'">'+E.default.get("Cancel")+"</button>\n            </div>\n        ";return e=f.default.extend({header:!0,title:"CodeBlock Editor",content:n,className:"tui-popup-code-block-editor",headerButtons:O,modal:!0},e),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return r(t,e),l(t,[{key:"_initInstance",value:function(e){s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_initInstance",this).call(this,e),this.eventManager=e.eventManager,this.convertor=e.convertor}},{key:"_initDOM",value:function(e){s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_initDOM",this).call(this,e);var n=this.$el.get(0);this._body=n.querySelector("."+M+"body"),this._toggleFitButton=n.querySelector("."+M+"toggle-fit"),this._togglePreviewButton=n.querySelector("."+M+"toggle-preview"),this._toggleScrollButton=n.querySelector("."+M+"toggle-scroll"),this._okButton=n.querySelector("."+T),this._closeButton=n.querySelector("."+S),this._codeMirrorWrapper=this._createCodeBlockEditor(),this._previewWrapper=this._createPreview(),this._scrollSyncSplit=new p.default(this._body,this._codeMirrorWrapper,this._previewWrapper),this._updateFitWindowButton(),this._updatePreviewButton(),this._updateScrollButton(),this._codeBlockLanguagesCombo=this._createCodeBlockLanguagesCombo()}},{key:"_initDOMEvent",value:function(){var e=this;s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_initDOMEvent",this).call(this),this.on("scroll",function(e){return e.preventDefault()}),this.on("click ."+M+"toggle-fit",function(){return e._toggleFitToWindow()}),this.on("click ."+M+"toggle-preview",function(){return e._togglePreview()}),this.on("click ."+M+"toggle-scroll",function(){return e._toggleScroll()}),this.on("click ."+T,function(){return e._save()}),this.on("click ."+S,function(){return e.hide()}),this.on("click ."+M+"close",function(){return e.hide()}),this.on("click ."+M+"editor-wrapper",function(t){t.target===e._codeMirrorWrapper&&e._focusEditor(!0)})}},{key:"_initEditorEvent",value:function(){var e=this;s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_initEditorEvent",this).call(this),this.eventManager.listen("openPopupCodeBlockEditor",function(t){return e.eventManager.emit("closeAllPopup"),e.show(t),e}),this.eventManager.listen("closeAllPopup",this.hide.bind(this)),this.eventManager.listen("closePopupCodeBlockEditor",this.hide.bind(this))}},{key:"_createCodeBlockEditor",value:function(){var e=document.createElement("div");return e.classList.add(M+"editor-wrapper"),this._codeBlockEditor=new y.default(e,this.eventManager),e}},{key:"_createPreview",value:function(){var e=document.createElement("div");return this._codeBlockPreview=new b.default((0,c.default)(e),this.eventManager,this.convertor,this._codeBlockEditor),e}},{key:"_createCodeBlockLanguagesCombo",value:function(){var e=this,t=this.getTitleElement(),n=new w.default(this.eventManager);return n.setOnLanguageSelected(function(t){e._codeBlockEditor.setLanguage(t),e._codeBlockEditor.refresh(),e._focusEditor()}),t.innerHTML="CodeBlock Editor",t.appendChild(n.getElement()),n}},{key:"_updateFitWindowButton",value:function(){(0,c.default)(this._toggleFitButton).toggleClass("active",this.isFitToWindow())}},{key:"_updatePreviewButton",value:function(){(0,c.default)(this._togglePreviewButton).toggleClass("active",this._scrollSyncSplit.isSplitView())}},{key:"_updateScrollButton",value:function(){this._scrollSyncSplit.isSplitView()?this._toggleScrollButton.style.display="inline-block":this._toggleScrollButton.style.display="none",(0,c.default)(this._toggleScrollButton).toggleClass("active",this._scrollSyncSplit.isScrollSynced())}},{key:"_focusEditor",value:function(e){this._codeBlockEditor.focus(),e?this._codeBlockEditor.moveCursorToEnd():this._codeBlockEditor.moveCursorToStart()}},{key:"_togglePreview",value:function(){this._scrollSyncSplit.toggleSplitView(),this._updatePreviewButton(),this._updateScrollButton(),this._codeBlockEditor.refresh()}},{key:"_toggleFitToWindow",value:function(){this.toggleFitToWindow(),this._updateFitWindowButton(),this._codeBlockEditor.refresh()}},{key:"_toggleScroll",value:function(){this._scrollSyncSplit.toggleScrollSync(),this._updateScrollButton()}},{key:"_save",value:function(){this._codeBlockEditor.save(this._codeBlockElement),this.hide()}},{key:"_load",value:function(e){this._codeBlockElement=e,this._codeBlockEditor.load(e),this._codeBlockLanguagesCombo.setLanguage(this._codeBlockEditor.getLanguage()),this._focusEditor(),this._codeBlockPreview.refresh()}},{key:"show",value:function(e){if(s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"show",this).call(this),!e)throw new Error("should be called with codeBlockElement");this._load(e)}},{key:"hide",value:function(){this.setFitToWindow(!1),this._codeBlockEditor&&this._codeBlockEditor.clear(),this._codeBlockPreview&&this._codeBlockPreview.clear(),this._codeBlockElement=null,s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"hide",this).call(this)}}]),t}(g.default);t.default=L},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),l=i(r),s=n(1),u=i(s),c={left:"tui-split-content-left",right:"tui-split-content-right"},d=function(){function e(t,n,i){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};a(this,e),o=u.default.extend({showScrollSyncButton:!1,scrollSync:!0,splitView:!0},o),this._baseElement=t,this._contentElements=[],this._initDom(n,i,o),this._initDomEvent()}return o(e,[{key:"_initDom",value:function(e,t,n){var i=document.createElement("div");i.className="tui-split-scroll",this._el=i;var a=document.createElement("div");a.className="tui-split-scroll-wrapper",this._scrollWrapper=a,this._setScrollSync(n.scrollSync),this.setSplitView(n.splitView);var o=document.createElement("div");o.className="tui-split-scroll-content",this._contentWrapper=o;var r=document.createElement("div");r.className="tui-splitter",this._baseElement.appendChild(i),i.appendChild(a),a.appendChild(o),a.appendChild(r),this._setLeft(e),this._setRight(t)}},{key:"_initDomEvent",value:function(){this._contentWrapper.addEventListener("scroll",this.sync.bind(this))}},{key:"_requireScrollIntoView",value:function(e){var t=e.target,n=t.getBoundingClientRect(),i=n.top,a=n.bottom,o=void 0,r=void 0,s=void 0;if(this.isScrollSynced())s=this._contentWrapper;else if((0,l.default)(t).parents(this._contentElements.left).length)s=this._contentElements.left;else{if(!(0,l.default)(t).parents(this._contentElements.right).length)return;s=this._contentElements.right}var u=s.getBoundingClientRect();o=u.top,r=u.bottom,i<o?s.scrollTop=s.scrollTop+i-o:a>r&&(s.scrollTop=s.scrollTop+a-r),this.sync()}},{key:"_setContentElement",value:function(e,t){var n=this,i=this._contentElements[t];i&&((0,l.default)(i).off("requireScrollIntoView"),this._contentWrapper.removeChild(i)),e.classList.add(c[t]),this._contentWrapper.appendChild(e),(0,l.default)(e).on("requireScrollIntoView",function(e){return n._requireScrollIntoView(e)}),(0,l.default)(e).on("requireScrollSync",function(){return n.sync()}),this._contentElements[t]=e,this.sync()}},{key:"_setLeft",value:function(e){this._setContentElement(e,"left")}},{key:"_setRight",value:function(e){this._setContentElement(e,"right")}},{key:"_setScrollSync",value:function(e){(0,l.default)(this._el).toggleClass("scroll-sync",e)}},{key:"toggleScrollSync",value:function(){this._el.classList.toggle("scroll-sync")}},{key:"setSplitView",value:function(e){(0,l.default)(this._el).toggleClass("single-content",!e)}},{key:"toggleSplitView",value:function(){this._el.classList.toggle("single-content")}},{key:"isScrollSynced",value:function(){return this._el.classList.contains("scroll-sync")}},{key:"isSplitView",value:function(){return!this._el.classList.contains("single-content")}},{key:"sync",value:function(){if(this._contentElements.left&&this._contentElements.right){var e=this._contentWrapper.clientHeight,t=this._contentWrapper.scrollTop,n=this._contentElements.left,i=this._contentElements.right,a=n.offsetHeight-e>0?n:i,o=a===n?i:n,r=a.offsetHeight,l=Math.max(r-e,0),s=Math.max(o.offsetHeight,e),u=r-s;a.style.top="0px",o.style.top=t/l*u+"px"}}},{key:"scrollTop",value:function(e){this._contentWrapper.scrollTop=e}}]),e}();t.default=d},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=n(0),u=i(s),c=n(32),d=i(c),f=function(e){function t(e,n){a(this,t);var i=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,{singleCursorHeightPerLine:!1,theme:"none"}));return i._language="",i._eventManager=n,i._initEvent(),i}return r(t,e),l(t,[{key:"_initEvent",value:function(){var e=this;this.on("cursorActivity",this._onRequireScrollIntoView.bind(this)),this.on("beforeChange",function(t,n){"paste"===n.origin&&e._eventManager.emit("pasteBefore",{source:"codeblock",data:n})})}},{key:"_onRequireScrollIntoView",value:function(){var e=this.getCursor(),t=this.getWrapperElement();setTimeout(function(){var n=t.querySelector("pre:nth-child("+(e.line+1)+")");(0,u.default)(n).trigger("requireScrollIntoView")},0)}},{key:"load",value:function(e){var t=e.cloneNode(!0),n=[],i=t.querySelectorAll("div");[].slice.call(i).forEach(function(e){n.push(e.innerText.replace(/\n$/,""))}),this.setLanguage(t.getAttribute("data-language")||""),this.setEditorCodeText(n.join("\n"))}},{key:"save",value:function(e){e.innerHTML="",this.getEditorCodeText().split("\n").forEach(function(t){var n=document.createElement("div");e.appendChild(n);var i=void 0;i=t.length>0?document.createTextNode(t):document.createElement("br"),n.appendChild(i)}),e.setAttribute("data-language",this._language),(0,u.default)(e).trigger("language-changed")}},{key:"clear",value:function(){this.setLanguage(""),this.setEditorCodeText("")}},{key:"getLanguage",value:function(){return this._language}},{key:"setLanguage",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this._language=e}},{key:"getEditorCodeText",value:function(){return this.getValue()}},{key:"setEditorCodeText",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.setValue(e)}},{key:"refresh",value:function(){this.cm.refresh()}}]),t}(d.default);t.default=f},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=function e(t,n,i){null===t&&(t=Function.prototype);var a=Object.getOwnPropertyDescriptor(t,n);if(void 0===a){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in a)return a.value;var r=a.get;if(void 0!==r)return r.call(i)},s=n(10),u=function(e){return e&&e.__esModule?e:{default:e}}(s),c=function(e){function t(e,n,o,r){i(this,t);var l=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,o,!0));return l._codeBlockEditor=r,l._initEvent(),l}return o(t,e),r(t,[{key:"_initEvent",value:function(){var e=this;this._codeBlockEditor.on("update",function(){return e.lazyRunner.run("refresh")})}},{key:"refresh",value:function(){var e=this._codeBlockEditor.getLanguage(),n=this._codeBlockEditor.getEditorCodeText();l(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"refresh",this).call(this,"```"+e+"\n"+n+"\n```"),this.$el.trigger("requireScrollSync")}},{key:"clear",value:function(){l(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"render",this).call(this,"")}}]),t}(u.default);t.default=c},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),l=i(r),s=n(4),u=i(s),c=n(15),d=i(c),f=function(){function e(t){a(this,e),this._eventManager=t,this._initDOM(),this._initDOMEvent()}return o(e,[{key:"_initDOM",value:function(){this._inputLanguage=(0,l.default)('<input type="text" maxlength="20" placeholder="'+u.default.get("Choose language")+'">').get(0),this._wrapper=(0,l.default)('<span class="te-input-language">').get(0),this._wrapper.appendChild(this._inputLanguage)}},{key:"_initDOMEvent",value:function(){var e=this;this._inputLanguage.addEventListener("keydown",function(t){return e._onKeyEvent(t)}),this._inputLanguage.addEventListener("focus",function(){return e._showPopupCodeBlockLanguages()}),this._inputLanguage.addEventListener("focusout",function(){return e._onFocusOut()}),this._wrapper.addEventListener("mousedown",function(t){t.target===e._wrapper&&(t.preventDefault(),e._toggleFocus())})}},{key:"_showPopupCodeBlockLanguages",value:function(){var e=this,t=this._inputLanguage.getBoundingClientRect();this._wrapper.classList.toggle("active",!0),this.active=!0,this._popupCodeBlockLanguages=this._eventManager.emitReduce("openPopupCodeBlockLanguages",{language:this._prevStoredLanguage,offset:{left:t.left,top:t.bottom},callback:{selected:function(t){return e._onLanguageSelectedFromList(t)},dismissed:function(){e._popupCodeBlockLanguages=null}}})}},{key:"_toggleFocus",value:function(){var e=this._inputLanguage;this._wrapper.classList.contains("active")?e.blur():e.focus()}},{key:"_onFocusOut",value:function(){this._wrapper.classList.toggle("active",!1),this._inputLanguage.value=this._prevStoredLanguage,this._hidePopupCodeBlockLanguages()}},{key:"_onKeyEvent",value:function(e){if(this._popupCodeBlockLanguages)switch(e.which){case d.default.keyCode("UP"):this._popupCodeBlockLanguages.prev(),e.preventDefault();break;case d.default.keyCode("DOWN"):this._popupCodeBlockLanguages.next(),e.preventDefault();break;case d.default.keyCode("ENTER"):case d.default.keyCode("TAB"):var t=this._popupCodeBlockLanguages.getCurrentLanguage();this._inputLanguage.value=t,this._storeInputLanguage(),e.preventDefault();break;default:this._popupCodeBlockLanguages.hide()}else e.which!==d.default.keyCode("ENTER")&&e.which!==d.default.keyCode("TAB")||(this._storeInputLanguage(),e.preventDefault())}},{key:"_onLanguageSelectedFromList",value:function(e){this._inputLanguage.value=e,this._storeInputLanguage()}},{key:"setOnLanguageSelected",value:function(e){this._onLanguageSelected=e}},{key:"_hidePopupCodeBlockLanguages",value:function(){this._eventManager.emit("closePopupCodeBlockLanguages")}},{key:"setLanguage",value:function(e){this._prevStoredLanguage=e,this._inputLanguage.value=e}},{key:"_storeInputLanguage",value:function(){var e=this._inputLanguage.value;this.setLanguage(e),this._onLanguageSelected&&this._onLanguageSelected(e),this._hidePopupCodeBlockLanguages()}},{key:"getElement",value:function(){return this._wrapper}}]),e}();t.default=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),a=function(e){return e&&e.__esModule?e:{default:e}}(i),o=/^[*_]{2,}[^*_]*[*_]{2,}$/,r=a.default.command("markdown",{name:"Bold",keyMap:["CTRL+B","META+B"],exec:function(e){var t=e.getEditor(),n=t.getDoc(),i=n.getCursor(),a=n.getSelection(),o=!a;if(o&&i.ch>1){a=this.expendSelection(n,i)||a}var r=this.isNeedRemove(a),l=r?this.remove(a):this.append(a);n.replaceSelection(l,"around"),o&&!r&&this.setCursorToCenter(n,i),t.focus()},isNeedRemove:function(e){return o.test(e)},append:function(e){return"**"+e+"**"},remove:function(e){return e.substr(2,e.length-4)},expendSelection:function(e,t){var n=e.getSelection(),i=void 0,a={line:t.line,ch:t.ch-2},o={line:t.line,ch:t.ch+2};return e.setSelection(a,o),"****"===n||"____"===n?i=n:e.setSelection(t),i},setCursorToCenter:function(e,t){e.setCursor(t.line,t.ch+2)}});t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),a=function(e){return e&&e.__esModule?e:{default:e}}(i),o=/^[*_]{3,}[^*_]*[*_]{3,}$/,r=/^[*_][^*_]*[*_]$/,l=a.default.command("markdown",{name:"Italic",keyMap:["CTRL+I","META+I"],exec:function(e){var t=e.getEditor(),n=t.getDoc(),i=n.getCursor(),a=n.getSelection(),o=!a,r=!1,l=void 0;o&&(i.ch>2&&(l=this.expendWithBoldSelection(n,i))&&(r="with"),"with"!==r&&i.ch>1&&(r=this.expendOnlyBoldSelection(n,i)),!r&&i.ch>0&&(this.expendSelection(n,i),a=l||a));var s=this.isNeedRemove(a),u=s?this.remove(a):this.append(a);n.replaceSelection(u,"around"),o&&this.setCursorToCenter(n,i,s),t.focus()},isNeedRemove:function(e){return r.test(e)||o.test(e)},append:function(e){return"_"+e+"_"},remove:function(e){return e.substr(1,e.length-2)},expendWithBoldSelection:function(e,t){var n=e.getSelection(),i=void 0,a={line:t.line,ch:t.ch-3},o={line:t.line,ch:t.ch+3};return e.setSelection(a,o),"******"===n||"______"===n?i=n:e.setSelection(t),i},expendOnlyBoldSelection:function(e,t){var n=e.getSelection(),i=!1,a={line:t.line,ch:t.ch-2},o={line:t.line,ch:t.ch+2};return e.setSelection(a,o),"****"!==n&&"____"!==n||(e.setSelection(t),i="only"),i},expendSelection:function(e,t){var n=e.getSelection(),i=void 0,a={line:t.line,ch:t.ch-2},o={line:t.line,ch:t.ch+2};return e.setSelection(a,o),"****"===n||"____"===n?i=n:e.setSelection(t),i},setCursorToCenter:function(e,t,n){var i=n?-1:1;e.setCursor(t.line,t.ch+i)}});t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),a=function(e){return e&&e.__esModule?e:{default:e}}(i),o=/^[~~](.*[\s\n]*.*)*[~~]$/,r=a.default.command("markdown",{name:"Strike",keyMap:["CTRL+S","META+S"],exec:function(e){var t=e.getEditor(),n=t.getDoc(),i=n.getCursor(),a=n.getSelection(),o=this.hasStrikeSyntax(a),r=void 0;r=o?this.remove(a):this.append(a),n.replaceSelection(r,"around"),!a&&!o&&this.setCursorToCenter(n,i,o),t.focus()},hasStrikeSyntax:function(e){return o.test(e)},append:function(e){return"~~"+e+"~~"},remove:function(e){return e.substr(2,e.length-4)},setCursorToCenter:function(e,t,n){var i=n?-2:2;e.setCursor(t.line,t.ch+i)}});t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),a=function(e){return e&&e.__esModule?e:{default:e}}(i),o=a.default.command("markdown",{name:"Blockquote",keyMap:["CTRL+Q","META+Q"],exec:function(e){for(var t=e.getEditor(),n=t.getDoc(),i=e.getCurrentRange(),a={line:i.from.line,ch:0},o={line:i.to.line,ch:n.getLineHandle(i.to.line).text.length},r=n.getRange(a,o),l=r.split("\n"),s=l.length,u=0;u<s;u+=1)l[u]=">"+l[u];n.replaceRange(l.join("\n"),a,o),i.to.ch+=1,n.setCursor(i.to),t.focus()}});t.default=o},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){var n=e.match(u),i="";do{i+="#",t-=1}while(t>0);if(n){e=e.split(n[0])[1]}return i+" "+e}Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),r=i(o),l=n(2),s=i(l),u=/^#+\s/g,c=s.default.command("markdown",{name:"Heading",exec:function(e,t){var n=e.getEditor(),i=n.getDoc(),o=e.getCurrentRange(),l={line:o.from.line,ch:0},s={line:o.to.line,ch:i.getLineHandle(o.to.line).text.length},u=i.getLine(s.line).length,c=i.getRange(l,s),d=c.split("\n");r.default.forEachArray(d,function(e,n){d[n]=a(e,t)}),i.replaceRange(d.join("\n"),l,s),o.to.ch+=i.getLine(s.line).length-u,i.setSelection(l,o.to),n.focus()}});t.default=c},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e){var t=/^(#{1,6}| *((?:\*|-|\d\.)(?: \[[ xX]])?)) /;return e.replace(t,"")}Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),r=i(o),l=n(2),s=i(l),u=s.default.command("markdown",{name:"Paragraph",exec:function(e){var t=e.getEditor(),n=t.getDoc(),i=e.getCurrentRange(),o={line:i.from.line,ch:0},l={line:i.to.line,ch:n.getLineHandle(i.to.line).text.length},s=n.getLine(l.line).length,u=n.getRange(o,l),c=u.split("\n");r.default.forEachArray(c,function(e,t){c[t]=a(e)}),n.replaceRange(c.join("\n"),o,l),i.to.ch+=n.getLine(l.line).length-s,n.setSelection(o,l),t.focus()}});t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),a=function(e){return e&&e.__esModule?e:{default:e}}(i),o=a.default.command("markdown",{name:"HR",keyMap:["CTRL+L","META+L"],exec:function(e){var t=e.getEditor(),n=t.getDoc(),i="",a=e.getCurrentRange(),o={line:a.from.line,ch:a.from.ch},r={line:a.to.line,ch:a.to.ch};a.collapsed&&(i=n.getLine(o.line),o.ch=0,r.ch=n.getLineHandle(a.to.line).text.length),n.getLine(o.line).length?i+="\n\n* * *\n\n":i+="\n* * *\n",n.replaceRange(i,o,r),t.focus()}});t.default=o},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=i(a),r=n(18),l=i(r),s=l.default.decodeURIGraceful,u=l.default.encodeMarkdownCharacters,c=l.default.escapeMarkdownCharacters,d=o.default.command("markdown",{name:"AddLink",exec:function(e,t){var n=e.getEditor(),i=n.getDoc(),a=e.getCurrentRange(),o={line:a.from.line,ch:a.from.ch},r={line:a.to.line,ch:a.to.ch},l=t.linkText,d=t.url;l=s(l),l=c(l),d=u(d);var f="["+l+"]("+d+")";i.replaceRange(f,o,r),n.focus()}});t.default=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),a=function(e){return e&&e.__esModule?e:{default:e}}(i),o=a.default.command("markdown",{name:"AddImage",exec:function(e,t){var n=e.getEditor(),i=n.getDoc(),a=e.getCurrentRange(),o={line:a.from.line,ch:a.from.ch},r={line:a.to.line,ch:a.to.ch},l="!["+t.altText+"]("+t.imageUrl+")";i.replaceRange(l,o,r,"+addImage"),n.focus()}});t.default=o},function(e,t,n){"use strict";function i(e){return!(!e||!e.match(s)&&!e.match(r))}Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=function(e){return e&&e.__esModule?e:{default:e}}(a),r=/^[ \t]*[\d]+\. .*/,l=/^[ \t]*[-*] .*/,s=/^[ \t]*[-*]( \[[ xX]])? .*/,u=o.default.command("markdown",{name:"UL",keyMap:["CTRL+U","META+U"],exec:function(e){for(var t=e.getEditor(),n=t.getDoc(),a=e.getCurrentRange(),o=e.componentManager.getManager("list"),r=o.expandLineRangeIfNeed(n,a,i),s=r.start,u=r.end,c=void 0,d=void 0,f=s;f<=u&&(d={line:f,ch:0},c=n.getLine(f),o.isListOrParagraph(c));f+=1)i(c)?o.replaceLineText(n,f,/[\d]+\. /,"* "):c.match(l)||n.replaceRange("* ",d),f===u&&o.appendBlankLineIfNeed(t,f,u,s);t.focus()}});t.default=u},function(e,t,n){"use strict";function i(e){return!(!e||!e.match(s)&&!e.match(l))}Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=function(e){return e&&e.__esModule?e:{default:e}}(a),r=/^[ \t]*[\d]+\. .*/,l=/^[ \t]*[-*] .*/,s=/^[ \t]*[-*]( \[[ xX]])? .*/,u=o.default.command("markdown",{name:"OL",keyMap:["CTRL+O","META+O"],exec:function(e){for(var t=e.getEditor(),n=t.getDoc(),a=e.getCurrentRange(),o=e.componentManager.getManager("list"),l=o.expandLineRangeIfNeed(n,a,i),s=l.start,u=l.end,c=1,d=void 0,f=void 0,h=s;h<=u&&(f={line:h,ch:0},d=n.getLine(h),o.isListOrParagraph(d));h+=1)i(d)?o.replaceLineText(n,h,/[*-] /,c+". "):d.match(r)||n.replaceRange(c+". ",f),c+=1,h===u&&o.appendBlankLineIfNeed(t,h,u,s);t.focus()}});t.default=u},function(e,t,n){"use strict";function i(e,t){for(var n="|",i="|",a=0;e;)t?(n+=" "+t[a]+" |",a+=1):n+="  |",i+=" --- |",e-=1;return n+"\n"+i+"\n"}function a(e,t,n){for(var i="",a=e,o=0;o<t;o+=1){i+="|";for(var r=0;r<e;r+=1)n?(i+=" "+n[a]+" |",a+=1):i+="  |";i+="\n"}return i=i.replace(/\n$/g,"")}Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),r=function(e){return e&&e.__esModule?e:{default:e}}(o),l=r.default.command("markdown",{name:"Table",exec:function(e,t,n,o){var r=e.getEditor(),l=r.getDoc(),s="\n";r.getCursor().ch>0&&(s+="\n"),s+=i(t,o),s+=a(t,n-1,o),l.replaceSelection(s),o||r.setCursor(r.getCursor().line-n,2),e.focus()}});t.default=l},function(e,t,n){"use strict";function i(e){return!(!e||!e.match(l)&&!e.match(r))}Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=function(e){return e&&e.__esModule?e:{default:e}}(a),r=/^[ \t]*[\d]+\. .*/,l=/^[ \t]*[-*] .*/,s=/^[ \t]*[-*]( \[[ xX]])? .*/,u=/([*-] |[\d]+\. )(\[[ xX]] )/,c=o.default.command("markdown",{name:"Task",keyMap:["CTRL+T","META+T"],exec:function(e){for(var t=e.getEditor(),n=t.getDoc(),a=e.getCurrentRange(),o=e.componentManager.getManager("list"),r=o.createSortedLineRange(a),l=r.start,c=r.end,d=void 0,f=void 0,h=l;h<=c;h+=1){f={line:h,ch:0},d=n.getLine(h);var g=!!d.match(u);if(!o.isListOrParagraph(d))break;i(d)&&g?o.replaceLineText(n,h,u,"$1"):i(d)&&!g?o.replaceLineText(n,h,/([*-] |[\d]+\. )/,"$1[ ] "):d.match(s)||n.replaceRange("* [ ] ",f),h===c&&o.appendBlankLineIfNeed(t,h,c,l)}t.focus()}});t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),a=function(e){return e&&e.__esModule?e:{default:e}}(i),o=a.default.command("markdown",{name:"Code",keyMap:["SHIFT+CTRL+C","SHIFT+META+C"],exec:function(e){var t=e.getEditor(),n=t.getDoc(),i=n.getSelection(),a=t.getCursor();n.replaceSelection(this.append(i),"around"),i||n.setCursor(a.line,a.ch+1),t.focus()},append:function(e){return"`"+e+"`"}});t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),a=function(e){return e&&e.__esModule?e:{default:e}}(i),o=a.default.command("markdown",{name:"CodeBlock",keyMap:["SHIFT+CTRL+P","SHIFT+META+P"],exec:function(e){var t=e.getEditor(),n=t.getDoc(),i=e.getCurrentRange(),a=["```",n.getSelection(),"```"],o=1;0!==i.from.ch&&(a.unshift(""),o+=1),i.to.ch!==n.getLine(i.to.line).length&&a.push(""),n.replaceSelection(a.join("\n")),t.setCursor(i.from.line+o,0),t.focus()}});t.default=o},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e){e.hasFormat("b")||e.hasFormat("strong")?e.changeFormat(null,{tag:"b"}):e.hasFormat("a")||e.hasFormat("PRE")||(e.hasFormat("code")&&e.changeFormat(null,{tag:"code"}),e.bold())}Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),r=i(o),l=n(3),s=i(l),u=r.default.command("wysiwyg",{name:"Bold",keyMap:["CTRL+B","META+B"],exec:function(e){var t=e.getEditor(),n=e.componentManager.getManager("tableSelection");e.focus(),t.hasFormat("table")&&n.getSelectedCells().length?n.styleToSelectedCells(a):a(t);var i=t.getSelection();t.hasFormat("table")&&!s.default.isTextNode(i.commonAncestorContainer)&&(i.collapse(!0),t.setSelection(i))}});t.default=u},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e){e.hasFormat("i")||e.hasFormat("em")?e.changeFormat(null,{tag:"i"}):e.hasFormat("a")||e.hasFormat("PRE")||(e.hasFormat("code")&&e.changeFormat(null,{tag:"code"}),e.italic())}Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),r=i(o),l=n(3),s=i(l),u=r.default.command("wysiwyg",{name:"Italic",keyMap:["CTRL+I","META+I"],exec:function(e){var t=e.getEditor(),n=t.getSelection(),i=e.componentManager.getManager("tableSelection");e.focus(),t.hasFormat("table")&&i.getSelectedCells().length?i.styleToSelectedCells(a):a(t),t.hasFormat("table")&&!s.default.isTextNode(n.commonAncestorContainer)&&(n.collapse(!0),t.setSelection(n))}});t.default=u},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e){e.hasFormat("S")?e.changeFormat(null,{tag:"S"}):e.hasFormat("a")||e.hasFormat("PRE")||(e.hasFormat("code")&&e.changeFormat(null,{tag:"code"}),e.strikethrough())}Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),r=i(o),l=n(3),s=i(l),u=r.default.command("wysiwyg",{name:"Strike",keyMap:["CTRL+S","META+S"],exec:function(e){var t=e.getEditor(),n=t.getSelection(),i=e.componentManager.getManager("tableSelection");e.focus(),t.hasFormat("table")&&i.getSelectedCells().length?i.styleToSelectedCells(a):a(t),t.hasFormat("table")&&!s.default.isTextNode(n.commonAncestorContainer)&&(n.collapse(!0),t.setSelection(n))}});t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),a=function(e){return e&&e.__esModule?e:{default:e}}(i),o=a.default.command("wysiwyg",{name:"Blockquote",keyMap:["CTRL+Q","META+Q"],exec:function(e){var t=e.getEditor();e.focus(),t.hasFormat("TABLE")||t.hasFormat("PRE")||(e.unwrapBlockTag(),t.increaseQuoteLevel())}});t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),a=function(e){return e&&e.__esModule?e:{default:e}}(i),o=a.default.command("wysiwyg",{name:"AddImage",exec:function(e,t){var n=e.getEditor();e.focus(),n.hasFormat("PRE")||n.insertImage(t.imageUrl,{alt:t.altText})}});t.default=o},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),o=i(a),r=n(2),l=i(r),s=n(18),u=i(s),c=u.default.decodeURIGraceful,d=u.default.encodeMarkdownCharacters,f=l.default.command("wysiwyg",{name:"AddLink",exec:function(e,t){var n=e.getEditor(),i=t.url,a=t.linkText;if(a=c(a),i=d(i),e.focus(),!n.hasFormat("PRE"))if(n.removeAllFormatting(),n.getSelectedText())n.makeLink(i);else{var r=n.createElement("A",{href:i});(0,o.default)(r).text(a),n.insertElement(r)}}});t.default=f},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=i(a),r=n(3),l=i(r),s=o.default.command("wysiwyg",{name:"HR",keyMap:["CTRL+L","META+L"],exec:function(e){var t=e.getEditor(),n=t.getSelection(),i=void 0,a=void 0,o=void 0;if(n.collapsed&&!t.hasFormat("TABLE")&&!t.hasFormat("PRE")){i=l.default.getChildNodeByOffset(n.startContainer,n.startOffset),a=l.default.getTopNextNodeUnder(i,e.get$Body()[0]),a||(a=t.createDefaultBlock(),e.get$Body().append(a));var r=t.createElement("HR");t.modifyBlocks(function(e){return e.appendChild(r),e}),o=r.previousSibling,o&&l.default.isTextNode(o)&&0===l.default.getTextLength(o)&&r.parentNode.removeChild(o),n.selectNodeContents(a),n.collapse(!0),t.setSelection(n)}e.focus()}});t.default=s},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),o=i(a),r=n(2),l=i(r),s=l.default.command("wysiwyg",{name:"Heading",exec:function(e,t){var n=e.getEditor();e.focus(),n.hasFormat("TABLE")||n.hasFormat("PRE")||n.modifyBlocks(function(e){return(0,o.default)(e).children("h1, h2, h3, h4, h5, h6, div").each(function(e,n){var i="<H"+t+" />",a=(0,o.default)(n);if(a.is("DIV"))a.wrap(i);else{var r=(0,o.default)(i);r.insertBefore(n),r.html(a.html()),a.remove()}}),e})}});t.default=s},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),o=i(a),r=n(2),l=i(r),s=l.default.command("wysiwyg",{name:"Paragraph",exec:function(e){var t=e.getEditor();e.focus(),t.hasFormat("TABLE")||t.hasFormat("PRE")||t.modifyBlocks(function(e){var t=(0,o.default)(document.createDocumentFragment());return(0,o.default)(e).children().each(function(e,n){n.nodeName.match(/h\d/i)?t.append((0,o.default)(n).children()):n.nodeName.match(/ul|ol/i)?(0,o.default)(n).find("li").each(function(e,n){t.append((0,o.default)(n).children())}):t.append(n)}),t[0]})}});t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),a=function(e){return e&&e.__esModule?e:{default:e}}(i),o=a.default.command("wysiwyg",{name:"UL",keyMap:["CTRL+U","META+U"],exec:function(e){var t=e.getEditor(),n=t.getSelection(),i=e.componentManager.getManager("list"),a=n,o=a.startContainer,r=a.endContainer,l=a.startOffset,s=a.endOffset;e.focus(),t.saveUndoState(n);for(var u=i.getLinesOfSelection(o,r),c=[],d=0;d<u.length;d+=1){var f=this._changeFormatToUnorderedListIfNeed(e,u[d]);c.push(f)}n=t.getSelection(),n.setStart(c[0].firstChild,l),n.setEnd(c[c.length-1].firstChild,s),t.setSelection(n),t.saveUndoState(n)},_changeFormatToUnorderedListIfNeed:function(e,t){var n=e.getEditor(),i=n.getSelection(),a=i.startContainer;return n.hasFormat("TABLE")||n.hasFormat("PRE")||(i.setStart(t,0),i.collapse(!0),n.setSelection(i),n.hasFormat("LI")?(e.saveSelection(i),n.replaceParent(i.startContainer,"ol","ul"),e.restoreSavedSelection()):(e.unwrapBlockTag(),n.makeUnorderedList()),a=n.getSelection().startContainer),a}});t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),a=function(e){return e&&e.__esModule?e:{default:e}}(i),o=a.default.command("wysiwyg",{name:"OL",keyMap:["CTRL+O","META+O"],exec:function(e){var t=e.getEditor(),n=t.getSelection(),i=e.componentManager.getManager("list"),a=n,o=a.startContainer,r=a.startOffset,l=a.endContainer,s=a.endOffset;e.focus(),t.saveUndoState(n);for(var u=i.getLinesOfSelection(o,l),c=[],d=0;d<u.length;d+=1){var f=this._changeFormatToOrderedListIfNeed(e,u[d]);c.push(f)}n=t.getSelection(),n.setStart(c[0].firstChild,r),n.setEnd(c[c.length-1].firstChild,s),t.setSelection(n),t.saveUndoState(n)},_changeFormatToOrderedListIfNeed:function(e,t){var n=e.getEditor(),i=n.getSelection(),a=i.startContainer;return n.hasFormat("TABLE")||n.hasFormat("PRE")||(i.setStart(t,0),i.collapse(!0),n.setSelection(i),n.hasFormat("LI")?(e.saveSelection(i),n.replaceParent(i.startContainer,"ul","ol"),e.restoreSavedSelection()):(e.unwrapBlockTag(),n.makeOrderedList()),a=n.getSelection().startContainer),a}});t.default=o},function(e,t,n){"use strict";function i(e,t){var n=e.getSelection();n.selectNodeContents(t.find("th")[0]),n.collapse(!0),e.setSelection(n)}function a(e,t){for(var n="<thead><tr>",i=0;e;)n+="<th>",t&&(n+=t[i],i+=1),n+="</th>",e-=1;return n+="</tr></thead>"}function o(e,t,n){for(var i="<tbody>",a=e,o=0;o<t;o+=1){i+="<tr>";for(var r=0;r<e;r+=1)i+="<td>",n&&(i+=n[a],a+=1),i+="</td>";i+="</tr>"}return i+="</tbody>"}Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),l=function(e){return e&&e.__esModule?e:{default:e}}(r),s=l.default.command("wysiwyg",{name:"Table",exec:function(e,t,n,r){var l=e.getEditor(),s=e.componentManager.getManager("table").getTableIDClassName(),u=void 0;if(!l.getSelection().collapsed||l.hasFormat("TABLE")||l.hasFormat("PRE"))return void e.focus();u='<table class="'+s+'">',u+=a(t,r),u+=o(t,n-1,r),u+="</table>",l.insertHTML(u),e.focus(),r||i(l,e.get$Body().find("."+s))}});t.default=s},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e){var t=e.componentManager.getManager("tableSelection"),n=t.getSelectedCells(),i=1;if(n.length>1){var a=n.first().get(0),o=n.last().get(0),r=t.getSelectionRangeFromTable(a,o);i=r.to.row-r.from.row+1}return i}function o(e){var t=e.clone(),n=c.default.browser.msie?"":"<br />";return t.find("td").html(n),t}function r(e,t){var n=e.getSelection();n.selectNodeContents(t.find("td")[0]),n.collapse(!0),e.setSelection(n)}Object.defineProperty(t,"__esModule",{value:!0});var l=n(0),s=i(l),u=n(1),c=i(u),d=n(2),f=i(d),h=f.default.command("wysiwyg",{name:"AddRow",exec:function(e){var t=e.getEditor(),n=t.getSelection().cloneRange(),i=a(e),l=void 0,u=void 0;if(e.focus(),t.hasFormat("TD")){t.saveUndoState(n),l=(0,s.default)(n.startContainer).closest("tr");for(var c=0;c<i;c+=1)u=o(l),u.insertAfter(l);r(t,u)}else if(t.hasFormat("TH")){t.saveUndoState(n),l=(0,s.default)(n.startContainer).parents("thead").next("tbody").children("tr").eq(0);for(var d=0;d<i;d+=1)u=o(l),u.insertBefore(l);r(t,u)}}});t.default=h},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e){var t=e.componentManager.getManager("tableSelection"),n=t.getSelectedCells(),i=1;if(n.length>0){var a=n.get(0).parentNode.querySelectorAll("td, th").length;i=Math.min(a,n.length)}return i}function o(e){var t=e.startContainer;return t="TD"===v.default.getNodeName(t)||"TH"===v.default.getNodeName(t)?(0,u.default)(t):(0,u.default)(t).parentsUntil("tr")}function r(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=e.index(),i=void 0;e.parents("table").find("tr").each(function(e,a){for(var o="TBODY"===v.default.getNodeName(a.parentNode),r=d.default.browser.msie,l=a.children[n],s=0;s<t;s+=1)i=o?document.createElement("td"):document.createElement("th"),r||i.appendChild(document.createElement("br")),(0,u.default)(i).insertAfter(l)})}function l(e,t){var n=e.getSelection();n.selectNodeContents(t.next()[0]),n.collapse(!0),e.setSelection(n)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(0),u=i(s),c=n(1),d=i(c),f=n(2),h=i(f),g=n(3),v=i(g),p=h.default.command("wysiwyg",{name:"AddCol",exec:function(e){var t=e.getEditor(),n=t.getSelection().cloneRange(),i=a(e),s=void 0;e.focus(),t.hasFormat("TR")&&(t.saveUndoState(n),s=o(n),r(s,i),l(t,s))}});t.default=p},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t,n,i){var a=n.find("td").get(0);t.setStart(a,0),t.collapse(!0),i.setLastCellNode(a),e.setSelection(t)}function o(e,t,n){var i=n.find("tbody tr").length,a=(0,s.default)(e).parents("thead").length,o=t.from.row,r=t.to.row;return a&&(o+=1),(1===o||a)&&r===i&&(r-=1),n.find("tr").slice(o,r+1)}function r(e,t,n){var i=t.getSelectedCells(),a=void 0,r=void 0;if(i.length)a=t.getSelectionRangeFromTable(i.first().get(0),i.last().get(0)),r=o(i.first()[0],a,n);else{var l=(0,s.default)(e.startContainer).closest("td,th").get(0);a=t.getSelectionRangeFromTable(l,l),r=o(l,a,n)}return r}Object.defineProperty(t,"__esModule",{value:!0});var l=n(0),s=i(l),u=n(2),c=i(u),d=c.default.command("wysiwyg",{name:"RemoveRow",exec:function(e){var t=e.getEditor(),n=t.getSelection().cloneRange(),i=(0,s.default)(n.startContainer).parents("table"),o=e.componentManager.getManager("tableSelection"),l=e.componentManager.getManager("table"),u=r(n,o,i),c=i.find("tbody tr").length;if(e.focus(),(t.hasFormat("TD")||t.hasFormat("TABLE"))&&c>1){t.saveUndoState(n);var d=u.last().next()[0]?u.last().next():u.first().prev();d.length&&a(t,n,d,l),u.remove()}o.removeClassAttrbuteFromAllCellsIfNeed()}});t.default=d},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e){var t=e.startContainer;return t="TD"===h.default.getNodeName(t)||"TH"===h.default.getNodeName(t)?(0,u.default)(t):(0,u.default)(t).parentsUntil("tr")}function o(e){for(var t=e.length,n=0;n<t;n+=1){e.eq(n).length>0&&r(e.eq(n))}}function r(e){var t=e.index();e.parents("table").find("tr").each(function(e,n){(0,u.default)(n).children().eq(t).remove()})}function l(e,t,n){var i=t.get(0);if(t.length&&u.default.contains(document,t)){var a=e.getSelection();a.selectNodeContents(t[0]),a.collapse(!0),e.setSelection(a),n.setLastCellNode(i)}}Object.defineProperty(t,"__esModule",{value:!0});var s=n(0),u=i(s),c=n(2),d=i(c),f=n(3),h=i(f),g=d.default.command("wysiwyg",{name:"RemoveCol",exec:function(e){var t=e.getEditor(),n=t.getSelection().cloneRange(),i=e.componentManager.getManager("table"),s=e.componentManager.getManager("tableSelection"),c=(0,u.default)(n.startContainer).closest("table").find("thead tr th").length>1;if(e.focus(),n.collapse(!0),t.setSelection(n),t.hasFormat("TR",null,n)&&c){t.saveUndoState(n);var d=void 0,f=void 0,h=s.getSelectedCells();if(h.length>1){var g=h.last(),v=h.first();d=g.next().length>0?g.next():v.prev(),o(h)}else f=a(n),d=f.next().length?f.next():f.prev(),r(f);l(t,d,i)}}});t.default=g},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t,n){var i=n.isDivided||!1,a=n.startColumnIndex,o=n.endColumnIndex,r=e.find("tr").eq(0).find("td,th").length;e.find("tr").each(function(e,n){(0,s.default)(n).children("td,th").each(function(e,n){i&&(a<=e&&e<=r||e<=o)?(0,s.default)(n).attr("align",t):a<=e&&e<=o&&(0,s.default)(n).attr("align",t)})})}function o(e,t){var n=e.find("tr").eq(0).find("td,th").length,i=t.from,a=t.to,o=void 0,r=void 0,l=void 0;return i.row===a.row?(o=i.cell,r=a.cell):i.row<a.row&&(i.cell<=a.cell?(o=0,r=n-1):(o=i.cell,r=a.cell,l=!0)),{startColumnIndex:o,endColumnIndex:r,isDivided:l}}function r(e,t){var n=t.getSelectedCells(),i=void 0,a=void 0;if(n.length)i=t.getSelectionRangeFromTable(n.first().get(0),n.last().get(0));else{var o=e.startContainer;a=f.default.isTextNode(o)?(0,s.default)(o).parent("td,th")[0]:o,i=t.getSelectionRangeFromTable(a,a)}return i}Object.defineProperty(t,"__esModule",{value:!0});var l=n(0),s=i(l),u=n(2),c=i(u),d=n(3),f=i(d),h=c.default.command("wysiwyg",{name:"AlignCol",exec:function(e,t){var n=e.getEditor(),i=n.getSelection().cloneRange(),l=e.componentManager.getManager("tableSelection"),u=r(i,l);if(e.focus(),n.hasFormat("TR")){n.saveUndoState(i);var c=(0,s.default)(i.startContainer).parents("table");a(c,t,o(c,u))}l.removeClassAttrbuteFromAllCellsIfNeed()}});t.default=h},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),o=i(a),r=n(2),l=i(r),s=l.default.command("wysiwyg",{name:"RemoveTable",exec:function(e){var t=e.getEditor(),n=t.getSelection().cloneRange();if(t.hasFormat("TABLE")){t.saveUndoState(n);(0,o.default)(n.startContainer).closest("table").remove()}e.focus()}});t.default=s},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),o=i(a),r=n(2),l=i(r),s=l.default.command("wysiwyg",{name:"IncreaseDepth",exec:function(e){var t=e.componentManager.getManager("list"),n=e.getEditor().getSelection(),i=(0,o.default)(n.startContainer).closest("li"),a=void 0,r=void 0,l=void 0,s=i.prev();if(s.length&&i.length){var u=i.find("li").eq(0);e.getEditor().saveUndoState(),r=i.attr("class"),a=s.attr("class"),l=u.attr("class"),i.removeAttr("class"),s.removeAttr("class"),u.length&&!u.children("div").length&&u.removeAttr("class"),e.getEditor().increaseListLevel(),t.mergeList(i.get(0)),i.attr("class",r),s.attr("class",a),u.attr("class",l)}}});t.default=s},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e){return!e.next().is("OL,UL")}function o(e){var t=e.getEditor().getSelection();return(0,l.default)(t.startContainer).closest("li")}Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),l=i(r),s=n(2),u=i(s),c=u.default.command("wysiwyg",{name:"DecreaseDepth",exec:function(e){var t=o(e);if(t.length&&a(t)){e.getEditor().saveUndoState();var n=t.attr("class");e.getEditor().decreaseListLevel(),t=o(e),t.attr("class",n)}}});t.default=c},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),o=i(a),r=n(2),l=i(r),s=l.default.command("wysiwyg",{name:"Task",keyMap:["CTRL+T","META+T"],exec:function(e){var t=e.getEditor(),n=t.getSelection(),i=e.componentManager.getManager("list"),a=n,o=a.startContainer,r=a.endContainer,l=a.startOffset,s=a.endOffset;e.focus(),t.saveUndoState(n);for(var u=i.getLinesOfSelection(o,r),c=[],d=0;d<u.length;d+=1){var f=this._changeFormatToTaskIfNeed(e,u[d]);c.push(f)}n=t.getSelection(),n.setStart(c[0].firstChild,l),n.setEnd(c[c.length-1].firstChild,s),t.setSelection(n),t.saveUndoState(n)},_changeFormatToTaskIfNeed:function(e,t){var n=e.getEditor(),i=n.getSelection(),a=e.componentManager.getManager("task"),r=i.startContainer;return n.hasFormat("TABLE")||n.hasFormat("PRE")||(i.setStart(t,0),i.collapse(!0),n.setSelection(i),n.hasFormat("li")||(n.makeUnorderedList(),t=n.getSelection().startContainer),(0,o.default)(t).hasClass("task-list-item")?a.unformatTask(t):a.formatTask(t),r=n.getSelection().startContainer),r}});t.default=s},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e){"CODE"===h.default.getNodeName(e.startContainer.nextSibling)&&0===h.default.getTextLength(e.startContainer.nextSibling)&&(0,l.default)(e.startContainer.nextSibling).remove()}function o(e,t){if(!t.hasFormat("PRE")&&t.hasFormat("code"))t.changeFormat(null,{tag:"code"}),a(e.getSelection().cloneRange());else if(!t.hasFormat("a")&&!t.hasFormat("PRE")){t.hasFormat("b")?t.removeBold():t.hasFormat("i")&&t.removeItalic(),t.changeFormat({tag:"code"});var n=t.getSelection().cloneRange();n.setStart(n.endContainer,n.endOffset),n.collapse(!0),t.setSelection(n)}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),l=i(r),s=n(1),u=i(s),c=n(2),d=i(c),f=n(3),h=i(f),g=d.default.command("wysiwyg",{name:"Code",keyMap:["SHIFT+CTRL+C","SHIFT+META+C"],exec:function(e){var t=e.getEditor(),n=t.getSelection(),i=e.componentManager.getManager("tableSelection"),a=u.default.bind(o,null,e.getEditor());e.focus(),t.hasFormat("table")&&i.getSelectedCells().length?i.styleToSelectedCells(a):a(t),t.hasFormat("table")&&!h.default.isTextNode(n.commonAncestorContainer)&&(n.collapse(!0),t.setSelection(n))}});t.default=g},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){var n=t.getEditor().getSelection().cloneRange();n.setStartBefore(e.find("div")[0].firstChild),n.collapse(!0),t.getEditor().setSelection(n)}function o(e,t){var n=t.componentManager.getManager("codeblock"),i=void 0,a=void 0;return e.collapsed?a=[(0,l.default)("<div><br></div>")[0]]:(i=e.extractContents(),a=u.default.toArray(i.childNodes)),n.convertToCodeblock(a).innerHTML}Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),l=i(r),s=n(1),u=i(s),c=n(2),d=i(c),f=0,h=d.default.command("wysiwyg",{name:"CodeBlock",keyMap:["SHIFT+CTRL+P","SHIFT+META+P"],exec:function(e,t){var n=e.getEditor(),i=n.getSelection().cloneRange();if(!n.hasFormat("PRE")&&!n.hasFormat("TABLE")){var r='data-te-codeblock class = "te-content-codeblock-'+f+'"';t&&(r+=' data-language="'+t+'"');var l=o(i,e);n.insertHTML("<pre "+r+">"+l+"</pre>"),a(e.get$Body().find(".te-content-codeblock-"+f),e),f+=1}e.focus()}});t.default=h},function(e,t,n){"use strict";var i=n(4);(function(e){return e&&e.__esModule?e:{default:e}})(i).default.setLanguage(["en","en_US"],{Markdown:"Markdown",WYSIWYG:"WYSIWYG",Write:"Write",Preview:"Preview",Headings:"Headings",Paragraph:"Paragraph",Bold:"Bold",Italic:"Italic",Strike:"Strike",Code:"Inline code",Line:"Line",Blockquote:"Blockquote","Unordered list":"Unordered list","Ordered list":"Ordered list",Task:"Task","Insert link":"Insert link","Insert CodeBlock":"Insert codeBlock","Insert table":"Insert table","Insert image":"Insert image",Heading:"Heading","Image URL":"Image URL","Select image file":"Select image file",Description:"Description",OK:"OK",Cancel:"Cancel",File:"File",URL:"URL","Link text":"Link text","Add row":"Add row","Add col":"Add col","Remove row":"Remove row","Remove col":"Remove col","Align left":"Align left","Align center":"Align center","Align right":"Align right","Remove table":"Remove table","Would you like to paste as table?":"Would you like to paste as table?","Text color":"Text color","Auto scroll enabled":"Auto scroll enabled","Auto scroll disabled":"Auto scroll disabled","Cannot paste values ​​other than a table in the cell selection state":"Cannot paste values ​​other than a table in the cell selection state.","Choose language":"Choose language"})},function(e,t,n){"use strict";var i=n(4);(function(e){return e&&e.__esModule?e:{default:e}})(i).default.setLanguage(["ko","ko_KR"],{Markdown:"마크다운",WYSIWYG:"위지윅",Write:"편집하기",Preview:"미리보기",Headings:"제목크기",Paragraph:"본문",Bold:"굵게",Italic:"기울임꼴",Strike:"취소선",Code:"인라인 코드",Line:"문단나눔",Blockquote:"인용구","Unordered list":"글머리 기호","Ordered list":"번호 매기기",Task:"체크박스","Insert link":"링크 삽입","Insert CodeBlock":"코드블럭 삽입","Insert table":"표 삽입","Insert image":"이미지 삽입",Heading:"제목","Image URL":"이미지 주소","Select image file":"이미지 파일을 선택하세요.",Description:"설명",OK:"확인",Cancel:"취소",File:"파일",URL:"주소","Link text":"링크 텍스트","Add row":"행 추가","Add col":"열 추가","Remove row":"행 삭제","Remove col":"열 삭제","Align left":"왼쪽 정렬","Align center":"가운데 정렬","Align right":"오른쪽 정렬","Remove table":"표 삭제","Would you like to paste as table?":"표형태로 붙여 넣겠습니까?","Text color":"글자 색상","Auto scroll enabled":"자동 스크롤 켜짐","Auto scroll disabled":"자동 스크롤 꺼짐","Cannot paste values ​​other than a table in the cell selection state.":"셀 선택 상태에서는 테이블 이외의 값은 붙여넣을 수 없습니다.","Choose language":"언어 선택"})},function(e,t,n){"use strict";var i=n(4);(function(e){return e&&e.__esModule?e:{default:e}})(i).default.setLanguage(["zh","zh_CN"],{Markdown:"Markdown",WYSIWYG:"所见即所得",Write:"编辑",Preview:"预览",Headings:"标题",Paragraph:"文本",Bold:"加粗",Italic:"斜体字",Strike:"删除线",Code:"内嵌代码",Line:"画水平线",Blockquote:"引用块","Unordered list":"无序列表","Ordered list":"有序列表",Task:"任务","Insert link":"插入链接","Insert CodeBlock":"插入代码块","Insert table":"插入表格","Insert image":"插入图片",Heading:"标题","Image URL":"图片网址","Select image file":"选择映像文件",Description:"说明",OK:"确认",Cancel:"取消",File:"文件",URL:"URL","Link text":"链接文本","Add row":"添加一行","Add col":"添加列","Remove row":"删除行","Remove col":"删除列","Align left":"左对齐","Align center":"居中对齐","Align right":"右对齐","Remove table":"删除表","Would you like to paste as table?":"你想粘贴表吗?","Text color":"文字色相","Auto scroll enabled":"自动滚动启用","Auto scroll disabled":"自动的滚动作非使用","Cannot paste values ​​other than a table in the cell selection state":"在单元格选择状态下无法粘贴表格以外的值。","Choose language":"选择语言"})},function(e,t,n){"use strict";var i=n(4);(function(e){return e&&e.__esModule?e:{default:e}})(i).default.setLanguage(["ja","ja_JP"],{Markdown:"マークダウン",WYSIWYG:"WYSIWYG",Write:"編集する",Preview:"プレビュー",Headings:"見出し",Paragraph:"本文",Bold:"太字",Italic:"イタリック",Strike:"ストライク",Code:"インラインコード",Line:"ライン",Blockquote:"引用","Unordered list":"番号なしリスト","Ordered list":"順序付きリスト",Task:"タスク","Insert link":"リンク挿入","Insert CodeBlock":"コードブロック挿入","Insert table":"テーブル挿入","Insert image":"画像挿入",Heading:"見出し","Image URL":"イメージURL","Select image file":"画像ファイル選択",Description:"ディスクリプション ",OK:"はい",Cancel:"キャンセル",File:"ファイル",URL:"URL","Link text":"リンクテキスト","Add row":"行追加","Add col":"列追加","Remove row":"行削除","Remove col":"列削除","Align left":"左揃え","Align center":"中央揃え","Align right":"右揃え","Remove table":"テーブル削除","Would you like to paste as table?":"テーブルを貼り付けますか?","Text color":"文字色相","Auto scroll enabled":"自動スクロールが有効","Auto scroll disabled":"自動スクロールを無効に","Cannot paste values ​​other than a table in the cell selection state":"表以外の値をセル選択状態に貼り付けることはできません。","Choose language":"言語選択"})},function(e,t,n){"use strict";var i=n(4);(function(e){return e&&e.__esModule?e:{default:e}})(i).default.setLanguage(["nl","nl_NL"],{Markdown:"Markdown",WYSIWYG:"WYSIWYG",Write:"Write",Preview:"Preview",Headings:"Koppen",Paragraph:"tekst",Bold:"Vet",Italic:"Cursief",Strike:"Doorhalen",Code:"Inline Code",Line:"Regel",Blockquote:"Citaatblok","Unordered list":"Opsomming","Ordered list":"Genummerde opsomming",Task:"Taak","Insert link":"Link invoegen","Insert CodeBlock":"Codeblok toevoegen","Insert table":"Tabel invoegen","Insert image":"Afbeelding invoegen",Heading:"Kop","Image URL":"Afbeelding URL","Select image file":"Selecteer een afbeelding",Description:"Omschrijving",OK:"OK",Cancel:"Annuleren",File:"Bestand",URL:"URL","Link text":"Link tekst","Add row":"Rij toevoegen","Add col":"Kolom toevoegen","Remove row":"Rij verwijderen","Remove col":"Kolom verwijderen","Align left":"Links uitlijnen","Align center":"Centreren","Align right":"Rechts uitlijnen","Remove table":"Verwijder tabel","Would you like to paste as table?":"Wil je dit als tabel plakken?","Text color":"Tekstkleur","Auto scroll enabled":"Autoscroll ingeschakeld","Auto scroll disabled":"Autoscroll uitgeschakeld","Cannot paste values ​​other than a table in the cell selection state":"Kan geen waardes anders dan de tabel in de cell plakken","Choose language":"Kies een taal"})}])});