{"version":3,"file":"ckeditor.js","sources":["webpack://ClassicEditor/ckeditor.js"],"sourcesContent":["/*!\n * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.\n * For licensing, see LICENSE.md.\n */\n(function(e){const t=e[\"zh-cn\"]=e[\"zh-cn\"]||{};t.dictionary=Object.assign(t.dictionary||{},{\"%0 of %1\":\"第 %0 步,共 %1 步\",\"Align center\":\"居中\",\"Align left\":\"左对齐\",\"Align right\":\"右对齐\",Aquamarine:\"海蓝色\",Big:\"大\",Black:\"黑色\",\"Block quote\":\"块引用\",Blue:\"蓝色\",\"Blue marker\":\"蓝色标记\",Bold:\"加粗\",\"Bulleted List\":\"项目列表\",Cancel:\"取消\",\"Cannot upload file:\":\"无法上传的文件:\",\"Centered image\":\"图片居中\",\"Change image text alternative\":\"更改图片替换文本\",\"Characters: %0\":\"字符数:%0\",\"Choose heading\":\"标题类型\",Code:\"代码\",Column:\"列\",\"Could not insert image at the current position.\":\"无法在当前位置插入图片\",\"Could not obtain resized image URL.\":\"无法获取重设大小的图片URL\",\"Decrease indent\":\"减少缩进\",Default:\"默认\",\"Delete column\":\"删除本列\",\"Delete row\":\"删除本行\",\"Dim grey\":\"暗灰色\",\"Document colors\":\"文档中的颜色\",Downloadable:\"可下载\",\"Dropdown toolbar\":\"下拉工具栏\",\"Edit link\":\"修改链接\",\"Editor toolbar\":\"编辑器工具栏\",\"Enter image caption\":\"输入图片标题\",\"Font Color\":\"字体颜色\",\"Font Family\":\"字体\",\"Font Size\":\"字体大小\",\"Full size image\":\"图片通栏显示\",Green:\"绿色\",\"Green marker\":\"绿色标记\",\"Green pen\":\"绿色笔\",Grey:\"灰色\",\"Header column\":\"标题列\",\"Header row\":\"标题行\",Heading:\"标题\",\"Heading 1\":\"标题 1\",\"Heading 2\":\"标题 2\",\"Heading 3\":\"标题 3\",\"Heading 4\":\"标题 4\",\"Heading 5\":\"标题 5\",\"Heading 6\":\"标题 6\",Highlight:\"高亮\",\"Horizontal line\":\"分割线\",Huge:\"极大\",\"Image resize list\":\"\",\"Image toolbar\":\"图片工具栏\",\"image widget\":\"图像小部件\",\"Increase indent\":\"增加缩进\",Insert:\"\",\"Insert code block\":\"插入代码块\",\"Insert column left\":\"左侧插入列\",\"Insert column right\":\"右侧插入列\",\"Insert image\":\"插入图像\",\"Insert image or file\":\"插入图片或文件\",\"Insert image via URL\":\"\",\"Insert media\":\"插入媒体\",\"Insert paragraph after block\":\"\",\"Insert paragraph before block\":\"\",\"Insert row above\":\"在上面插入一行\",\"Insert row below\":\"在下面插入一行\",\"Insert table\":\"插入表格\",\"Inserting image failed\":\"插入图片失败\",Italic:\"倾斜\",Justify:\"两端对齐\",\"Left aligned image\":\"图片左侧对齐\",\"Light blue\":\"浅蓝色\",\"Light green\":\"浅绿色\",\"Light grey\":\"浅灰色\",Link:\"超链接\",\"Link URL\":\"链接网址\",\"Media URL\":\"媒体URL\",\"media widget\":\"媒体小部件\",\"Merge cell down\":\"向下合并单元格\",\"Merge cell left\":\"向左合并单元格\",\"Merge cell right\":\"向右合并单元格\",\"Merge cell up\":\"向上合并单元格\",\"Merge cells\":\"合并单元格\",Next:\"下一步\",\"Numbered List\":\"编号列表\",\"Open in a new tab\":\"在新标签页中打开\",\"Open link in new tab\":\"在新标签页中打开链接\",Orange:\"橙色\",Original:\"\",Paragraph:\"段落\",\"Paste the image source URL.\":\"\",\"Paste the media URL in the input.\":\"在输入中粘贴媒体URL\",\"Pink marker\":\"粉色标记\",\"Plain text\":\"纯文本\",Previous:\"上一步\",Purple:\"紫色\",Red:\"红色\",\"Red pen\":\"红色笔\",Redo:\"重做\",\"Remove color\":\"移除颜色\",\"Remove highlight\":\"清除高亮\",\"Resize image\":\"\",\"Resize image to %0\":\"\",\"Resize image to the original size\":\"\",\"Rich Text Editor\":\"富文本编辑器\",\"Rich Text Editor, %0\":\"富文本编辑器, %0\",\"Right aligned image\":\"图片右侧对齐\",Row:\"行\",Save:\"保存\",\"Select column\":\"\",\"Select row\":\"\",\"Selecting resized image failed\":\"选择重设大小的图片失败\",\"Show more items\":\"显示更多\",\"Side image\":\"图片侧边显示\",Small:\"小\",\"Split cell horizontally\":\"水平分割单元格\",\"Split cell vertically\":\"垂直拆分单元格\",\"Table toolbar\":\"表格工具栏\",\"Text alignment\":\"对齐\",\"Text alignment toolbar\":\"对齐工具栏\",\"Text alternative\":\"替换文本\",\"Text highlight toolbar\":\"文本高亮工具栏\",\"The URL must not be empty.\":\"URL不可以为空。\",\"This link has no URL\":\"此链接没有设置网址\",\"This media URL is not supported.\":\"不支持此媒体URL。\",Tiny:\"极小\",\"Tip: Paste the URL into the content to embed faster.\":\"提示:将URL粘贴到内容中可更快地嵌入\",Turquoise:\"青色\",Underline:\"下划线\",Undo:\"撤销\",Unlink:\"取消超链接\",Update:\"\",\"Upload failed\":\"上传失败\",\"Upload in progress\":\"正在上传\",White:\"白色\",\"Widget toolbar\":\"小部件工具栏\",\"Words: %0\":\"字数:%0\",Yellow:\"黄色\",\"Yellow marker\":\"黄色标记\"});t.getPluralForm=function(e){return 0}})(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={}));(function e(t,n){if(typeof exports===\"object\"&&typeof module===\"object\")module.exports=n();else if(typeof define===\"function\"&&define.amd)define([],n);else if(typeof exports===\"object\")exports[\"ClassicEditor\"]=n();else t[\"ClassicEditor\"]=n()})(window,(function(){return function(e){var t={};function n(i){if(t[i]){return t[i].exports}var o=t[i]={i:i,l:false,exports:{}};e[i].call(o.exports,o,o.exports,n);o.l=true;return o.exports}n.m=e;n.c=t;n.d=function(e,t,i){if(!n.o(e,t)){Object.defineProperty(e,t,{enumerable:true,get:i})}};n.r=function(e){if(typeof Symbol!==\"undefined\"&&Symbol.toStringTag){Object.defineProperty(e,Symbol.toStringTag,{value:\"Module\"})}Object.defineProperty(e,\"__esModule\",{value:true})};n.t=function(e,t){if(t&1)e=n(e);if(t&8)return e;if(t&4&&typeof e===\"object\"&&e&&e.__esModule)return e;var i=Object.create(null);n.r(i);Object.defineProperty(i,\"default\",{enumerable:true,value:e});if(t&2&&typeof e!=\"string\")for(var o in e)n.d(i,o,function(t){return e[t]}.bind(null,o));return i};n.n=function(e){var t=e&&e.__esModule?function t(){return e[\"default\"]}:function t(){return e};n.d(t,\"a\",t);return t};n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};n.p=\"\";return n(n.s=120)}([function(e,t,n){\"use strict\";n.d(t,\"b\",(function(){return o}));n.d(t,\"a\",(function(){return s}));const i=\"https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/error-codes.html\";class o extends Error{constructor(e,t,n){e=s(e);if(n){e+=\" \"+JSON.stringify(n)}super(e);this.name=\"CKEditorError\";this.context=t;this.data=n}is(e){return e===\"CKEditorError\"}static rethrowUnexpectedError(e,t){if(e.is&&e.is(\"CKEditorError\")){throw e}const n=new o(e.message,t);n.stack=e.stack;throw n}}function s(e){const t=e.match(/^([^:]+):/);if(!t){return e}return e+` Read more: ${i}#error-${t[1]}\\n`}},function(e,t,n){\"use strict\";var i=function e(){var t;return function e(){if(typeof t===\"undefined\"){t=Boolean(window&&document&&document.all&&!window.atob)}return t}}();var o=function e(){var t={};return function e(n){if(typeof t[n]===\"undefined\"){var i=document.querySelector(n);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement){try{i=i.contentDocument.head}catch(e){i=null}}t[n]=i}return t[n]}}();var s=[];function r(e){var t=-1;for(var n=0;n
\").replace(/^\\s/,\" \").replace(/\\s$/,\" \").replace(/\\s\\s/g,\" \");if(e.indexOf(\"
\")>-1){e=`
${e}
`}return e}function Iv(e){return e.replace(/(\\s+)<\\/span>/g,(e,t)=>{if(t.length==1){return\" \"}return t})}const Nv=[\"figcaption\",\"li\"];function Rv(e){let t=\"\";if(e.is(\"$text\")||e.is(\"$textProxy\")){t=e.data}else if(e.is(\"element\",\"img\")&&e.hasAttribute(\"alt\")){t=e.getAttribute(\"alt\")}else{let n=null;for(const i of e.getChildren()){const e=Rv(i);if(n&&(n.is(\"containerElement\")||i.is(\"containerElement\"))){if(Nv.includes(n.name)||Nv.includes(i.name)){t+=\"\\n\"}else{t+=\"\\n\\n\"}}t+=e;n=i}}return t}class Ov extends ok{static get pluginName(){return\"Clipboard\"}init(){const e=this.editor;const t=e.model.document;const n=e.editing.view;const i=n.document;this._htmlDataProcessor=new Yp(i);n.addObserver(Sv);this.listenTo(i,\"clipboardInput\",t=>{if(e.isReadOnly){t.stop()}},{priority:\"highest\"});this.listenTo(i,\"clipboardInput\",(e,t)=>{const i=t.dataTransfer;let o=\"\";if(i.getData(\"text/html\")){o=Iv(i.getData(\"text/html\"))}else if(i.getData(\"text/plain\")){o=Mv(i.getData(\"text/plain\"))}o=this._htmlDataProcessor.toView(o);const s=new er(this,\"inputTransformation\");this.fire(s,{content:o,dataTransfer:i});if(s.stop.called){e.stop()}n.scrollToTheSelection()},{priority:\"low\"});this.listenTo(this,\"inputTransformation\",(e,n)=>{if(!n.content.isEmpty){const i=this.editor.data;const o=this.editor.model;const s=i.toModel(n.content,\"$clipboardHolder\");if(s.childCount==0){return}if(zv(s)){const e=s.getChild(0);o.change(n=>{n.setAttributes(t.selection.getAttributes(),e)})}o.insertContent(s);e.stop()}},{priority:\"low\"});function o(n,o){const s=o.dataTransfer;o.preventDefault();const r=e.data.toView(e.model.getSelectedContent(t.selection));i.fire(\"clipboardOutput\",{dataTransfer:s,content:r,method:n.name})}this.listenTo(i,\"copy\",o,{priority:\"low\"});this.listenTo(i,\"cut\",(t,n)=>{if(e.isReadOnly){n.preventDefault()}else{o(t,n)}},{priority:\"low\"});this.listenTo(i,\"clipboardOutput\",(n,i)=>{if(!i.content.isEmpty){i.dataTransfer.setData(\"text/html\",this._htmlDataProcessor.toData(i.content));i.dataTransfer.setData(\"text/plain\",Rv(i.content))}if(i.method==\"cut\"){e.model.deleteContent(t.selection)}},{priority:\"low\"})}}function zv(e){if(e.childCount>1){return false}const t=e.getChild(0);return[...t.getAttributeKeys()].length==0}class Lv{constructor(){this._definitions=new Set}get length(){return this._definitions.size}add(e){if(Array.isArray(e)){e.forEach(e=>this._definitions.add(e))}else{this._definitions.add(e)}}getDispatcher(){return e=>{e.on(\"attribute:linkHref\",(e,t,n)=>{if(!n.consumable.test(t.item,\"attribute:linkHref\")){return}const i=n.writer;const o=i.document.selection;for(const e of this._definitions){const s=i.createAttributeElement(\"a\",e.attributes,{priority:5});i.setCustomProperty(\"link\",true,s);if(e.callback(t.attributeNewValue)){if(t.item.is(\"selection\")){i.wrap(o.getFirstRange(),s)}else{i.wrap(n.mapper.toViewRange(t.range),s)}}else{i.unwrap(n.mapper.toViewRange(t.range),s)}}},{priority:\"high\"})}}getDispatcherForLinkedImage(){return e=>{e.on(\"attribute:linkHref:image\",(e,t,n)=>{const i=n.mapper.toViewElement(t.item);const o=Array.from(i.getChildren()).find(e=>e.name===\"a\");for(const e of this._definitions){const i=Ur(e.attributes);if(e.callback(t.attributeNewValue)){for(const[e,t]of i){if(e===\"class\"){n.writer.addClass(t,o)}else{n.writer.setAttribute(e,t,o)}}}else{for(const[e,t]of i){if(e===\"class\"){n.writer.removeClass(t,o)}else{n.writer.removeAttribute(e,o)}}}}})}}}function Dv(e,t,n){var i=e.length;n=n===undefined?i:n;return!t&&n>=i?e:Na(e,t,n)}var Vv=Dv;var jv=\"\\\\ud800-\\\\udfff\",Bv=\"\\\\u0300-\\\\u036f\",Fv=\"\\\\ufe20-\\\\ufe2f\",Hv=\"\\\\u20d0-\\\\u20ff\",Uv=Bv+Fv+Hv,Wv=\"\\\\ufe0e\\\\ufe0f\";var qv=\"\\\\u200d\";var $v=RegExp(\"[\"+qv+jv+Uv+Wv+\"]\");function Yv(e){return $v.test(e)}var Gv=Yv;function Kv(e){return e.split(\"\")}var Qv=Kv;var Jv=\"\\\\ud800-\\\\udfff\",Zv=\"\\\\u0300-\\\\u036f\",Xv=\"\\\\ufe20-\\\\ufe2f\",ey=\"\\\\u20d0-\\\\u20ff\",ty=Zv+Xv+ey,ny=\"\\\\ufe0e\\\\ufe0f\";var iy=\"[\"+Jv+\"]\",oy=\"[\"+ty+\"]\",sy=\"\\\\ud83c[\\\\udffb-\\\\udfff]\",ry=\"(?:\"+oy+\"|\"+sy+\")\",ay=\"[^\"+Jv+\"]\",cy=\"(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}\",ly=\"[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]\",dy=\"\\\\u200d\";var uy=ry+\"?\",hy=\"[\"+ny+\"]?\",fy=\"(?:\"+dy+\"(?:\"+[ay,cy,ly].join(\"|\")+\")\"+hy+uy+\")*\",my=hy+uy+fy,gy=\"(?:\"+[ay+oy+\"?\",oy,cy,ly,iy].join(\"|\")+\")\";var py=RegExp(sy+\"(?=\"+sy+\")|\"+gy+my,\"g\");function by(e){return e.match(py)||[]}var wy=by;function ky(e){return Gv(e)?wy(e):Qv(e)}var _y=ky;function vy(e){return function(t){t=va(t);var n=Gv(t)?_y(t):undefined;var i=n?n[0]:t.charAt(0);var o=n?Vv(n,1).join(\"\"):t.slice(1);return i[e]()+o}}var yy=vy;var xy=yy(\"toUpperCase\");var Ay=xy;const Cy=/[\\u0000-\\u0020\\u00A0\\u1680\\u180E\\u2000-\\u2029\\u205f\\u3000]/g;const Ty=/^(?:(?:https?|ftps?|mailto):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i;const Ey=\"Ctrl+K\";function Sy(e){return e.is(\"attributeElement\")&&!!e.getCustomProperty(\"link\")}function Py(e,{writer:t}){const n=t.createAttributeElement(\"a\",{href:e},{priority:5});t.setCustomProperty(\"link\",true,n);return n}function My(e){e=String(e);return Iy(e)?e:\"#\"}function Iy(e){const t=e.replace(Cy,\"\");return t.match(Ty)}function Ny(e,t){const n={\"Open in a new tab\":e(\"Open in a new tab\"),Downloadable:e(\"Downloadable\")};t.forEach(e=>{if(e.label&&n[e.label]){e.label=n[e.label]}return e});return t}function Ry(e){const t=[];if(e){for(const[n,i]of Object.entries(e)){const e=Object.assign({},i,{id:`link${Ay(n)}`});t.push(e)}}return t}function Oy(e,t){if(!e){return false}return e.is(\"element\",\"image\")&&t.checkAttribute(\"image\",\"linkHref\")}class zy extends rk{constructor(e){super(e);this.manualDecorators=new xr;this.automaticDecorators=new Lv}restoreManualDecoratorStates(){for(const e of this.manualDecorators){e.value=this._getDecoratorStateFromModel(e.id)}}refresh(){const e=this.editor.model;const t=e.document;const n=ck(t.selection.getSelectedBlocks());if(Oy(n,e.schema)){this.value=n.getAttribute(\"linkHref\");this.isEnabled=e.schema.checkAttribute(n,\"linkHref\")}else{this.value=t.selection.getAttribute(\"linkHref\");this.isEnabled=e.schema.checkAttributeInSelection(t.selection,\"linkHref\")}for(const e of this.manualDecorators){e.value=this._getDecoratorStateFromModel(e.id)}}execute(e,t={}){const n=this.editor.model;const i=n.document.selection;const o=[];const s=[];for(const e in t){if(t[e]){o.push(e)}else{s.push(e)}}n.change(t=>{if(i.isCollapsed){const r=i.getFirstPosition();if(i.hasAttribute(\"linkHref\")){const a=cv(r,\"linkHref\",i.getAttribute(\"linkHref\"),n);t.setAttribute(\"linkHref\",e,a);o.forEach(e=>{t.setAttribute(e,true,a)});s.forEach(e=>{t.removeAttribute(e,a)});t.setSelection(t.createPositionAfter(a.end.nodeBefore))}else if(e!==\"\"){const s=Ur(i.getAttributes());s.set(\"linkHref\",e);o.forEach(e=>{s.set(e,true)});const a=t.createText(e,s);n.insertContent(a,r);t.setSelection(t.createPositionAfter(a))}[\"linkHref\",...o,...s].forEach(e=>{t.removeSelectionAttribute(e)})}else{const r=n.schema.getValidRanges(i.getRanges(),\"linkHref\");const a=[];for(const e of i.getSelectedBlocks()){if(n.schema.checkAttribute(e,\"linkHref\")){a.push(t.createRangeOn(e))}}const c=a.slice();for(const e of r){if(this._isRangeToUpdate(e,a)){c.push(e)}}for(const n of c){t.setAttribute(\"linkHref\",e,n);o.forEach(e=>{t.setAttribute(e,true,n)});s.forEach(e=>{t.removeAttribute(e,n)})}}})}_getDecoratorStateFromModel(e){const t=this.editor.model;const n=t.document;const i=ck(n.selection.getSelectedBlocks());if(Oy(i,t.schema)){return i.getAttribute(e)}return n.selection.getAttribute(e)}_isRangeToUpdate(e,t){for(const n of t){if(n.containsRange(e)){return false}}return true}}class Ly extends rk{refresh(){const e=this.editor.model;const t=e.document;const n=ck(t.selection.getSelectedBlocks());if(Oy(n,e.schema)){this.isEnabled=e.schema.checkAttribute(n,\"linkHref\")}else{this.isEnabled=e.schema.checkAttributeInSelection(t.selection,\"linkHref\")}}execute(){const e=this.editor;const t=this.editor.model;const n=t.document.selection;const i=e.commands.get(\"link\");t.change(e=>{const o=n.isCollapsed?[cv(n.getFirstPosition(),\"linkHref\",n.getAttribute(\"linkHref\"),t)]:n.getRanges();for(const t of o){e.removeAttribute(\"linkHref\",t);if(i){for(const n of i.manualDecorators){e.removeAttribute(n.id,t)}}}})}}class Dy{constructor({id:e,label:t,attributes:n,defaultValue:i}){this.id=e;this.set(\"value\");this.defaultValue=i;this.label=t;this.attributes=n}}yr(Dy,Qc);var Vy=n(48);const jy=\"ck-link_selected\";const By=\"automatic\";const Fy=\"manual\";const Hy=/^(https?:)?\\/\\//;class Uy extends ok{static get pluginName(){return\"LinkEditing\"}static get requires(){return[nv,Cv,Ov]}constructor(e){super(e);e.config.define(\"link\",{addTargetToExternalLinks:false})}init(){const e=this.editor;e.model.schema.extend(\"$text\",{allowAttributes:\"linkHref\"});e.conversion.for(\"dataDowncast\").attributeToElement({model:\"linkHref\",view:Py});e.conversion.for(\"editingDowncast\").attributeToElement({model:\"linkHref\",view:(e,t)=>Py(My(e),t)});e.conversion.for(\"upcast\").elementToAttribute({view:{name:\"a\",attributes:{href:true}},model:{key:\"linkHref\",value:e=>e.getAttribute(\"href\")}});e.commands.add(\"link\",new zy(e));e.commands.add(\"unlink\",new Ly(e));const t=Ny(e.t,Ry(e.config.get(\"link.decorators\")));this._enableAutomaticDecorators(t.filter(e=>e.mode===By));this._enableManualDecorators(t.filter(e=>e.mode===Fy));const n=e.plugins.get(nv);n.registerAttribute(\"linkHref\");dv(e,\"linkHref\",\"a\",jy);this._enableInsertContentSelectionAttributesFixer();this._enableClickingAfterLink();this._enableTypingOverLink();this._handleDeleteContentAfterLink()}_enableAutomaticDecorators(e){const t=this.editor;const n=t.commands.get(\"link\");const i=n.automaticDecorators;if(t.config.get(\"link.addTargetToExternalLinks\")){i.add({id:\"linkIsExternal\",mode:By,callback:e=>Hy.test(e),attributes:{target:\"_blank\",rel:\"noopener noreferrer\"}})}i.add(e);if(i.length){t.conversion.for(\"downcast\").add(i.getDispatcher())}}_enableManualDecorators(e){if(!e.length){return}const t=this.editor;const n=t.commands.get(\"link\");const i=n.manualDecorators;e.forEach(e=>{t.model.schema.extend(\"$text\",{allowAttributes:e.id});i.add(new Dy(e));t.conversion.for(\"downcast\").attributeToElement({model:e.id,view:(t,{writer:n})=>{if(t){const t=i.get(e.id).attributes;const o=n.createAttributeElement(\"a\",t,{priority:5});n.setCustomProperty(\"link\",true,o);return o}}});t.conversion.for(\"upcast\").elementToAttribute({view:{name:\"a\",attributes:i.get(e.id).attributes},model:{key:e.id}})})}_enableInsertContentSelectionAttributesFixer(){const e=this.editor;const t=e.model;const n=t.document.selection;const i=e.commands.get(\"link\");this.listenTo(t,\"insertContent\",()=>{const e=n.anchor.nodeBefore;const o=n.anchor.nodeAfter;if(!n.hasAttribute(\"linkHref\")){return}if(!e){return}if(!e.hasAttribute(\"linkHref\")){return}if(o&&o.hasAttribute(\"linkHref\")){return}t.change(e=>{Wy(e,i.manualDecorators)})},{priority:\"low\"})}_enableClickingAfterLink(){const e=this.editor;const t=e.commands.get(\"link\");e.editing.view.addObserver(tv);let n=false;this.listenTo(e.editing.view.document,\"mousedown\",()=>{n=true});this.listenTo(e.editing.view.document,\"selectionChange\",()=>{if(!n){return}n=false;const i=e.model.document.selection;if(!i.isCollapsed){return}if(!i.hasAttribute(\"linkHref\")){return}const o=i.getFirstPosition();const s=cv(o,\"linkHref\",i.getAttribute(\"linkHref\"),e.model);if(o.isTouching(s.start)||o.isTouching(s.end)){e.model.change(e=>{Wy(e,t.manualDecorators)})}})}_enableTypingOverLink(){const e=this.editor;const t=e.editing.view;let n;let i;this.listenTo(t.document,\"delete\",()=>{i=true},{priority:\"high\"});this.listenTo(e.model,\"deleteContent\",()=>{const t=e.model.document.selection;if(t.isCollapsed){return}if(i){i=false;return}if(!$y(e)){return}if(qy(e.model)){n=t.getAttributes()}},{priority:\"high\"});this.listenTo(e.model,\"insertContent\",(t,[o])=>{i=false;if(!$y(e)){return}if(!n){return}e.model.change(e=>{for(const[t,i]of n){e.setAttribute(t,i,o)}});n=null},{priority:\"high\"})}_handleDeleteContentAfterLink(){const e=this.editor;const t=e.model;const n=t.document.selection;const i=e.editing.view;const o=e.commands.get(\"link\");let s=false;let r=false;this.listenTo(i.document,\"delete\",(e,t)=>{r=t.domEvent.keyCode===Ol.backspace},{priority:\"high\"});this.listenTo(t,\"deleteContent\",()=>{s=false;const e=n.getFirstPosition();const i=n.getAttribute(\"linkHref\");if(!i){return}const o=cv(e,\"linkHref\",i,t);s=o.containsPosition(e)||o.end.isEqual(e)},{priority:\"high\"});this.listenTo(t,\"deleteContent\",()=>{if(!r){return}r=false;if(s){return}e.model.enqueueChange(e=>{Wy(e,o.manualDecorators)})},{priority:\"low\"})}}function Wy(e,t){e.removeSelectionAttribute(\"linkHref\");for(const n of t){e.removeSelectionAttribute(n.id)}}function qy(e){const t=e.document.selection;const n=t.getFirstPosition();const i=t.getLastPosition();const o=n.nodeAfter;if(!o){return false}if(!o.is(\"$text\")){return false}if(!o.hasAttribute(\"linkHref\")){return false}const s=i.textNode||i.nodeBefore;if(o===s){return true}const r=cv(n,\"linkHref\",o.getAttribute(\"linkHref\"),e);return r.containsRange(e.createRange(n,i),true)}function $y(e){const t=e.plugins.get(\"Input\");return t.isInput(e.model.change(e=>e.batch))}class Yy{constructor(e){this.context=e}destroy(){this.stopListening()}static get isContextPlugin(){return true}}yr(Yy,Qc);class Gy extends Yy{static get pluginName(){return\"Notification\"}init(){this.on(\"show:warning\",(e,t)=>{window.alert(t.message)},{priority:\"lowest\"})}showSuccess(e,t={}){this._showNotification({message:e,type:\"success\",namespace:t.namespace,title:t.title})}showInfo(e,t={}){this._showNotification({message:e,type:\"info\",namespace:t.namespace,title:t.title})}showWarning(e,t={}){this._showNotification({message:e,type:\"warning\",namespace:t.namespace,title:t.title})}_showNotification(e){const t=`show:${e.type}`+(e.namespace?`:${e.namespace}`:\"\");this.fire(t,{message:e.message,type:e.type,title:e.title||\"\"})}}class Ky extends rk{constructor(e){super(e);this.stopListening(this.editor.model.document,\"change\");this.listenTo(this.editor.model.document,\"change\",()=>this.refresh(),{priority:\"low\"})}refresh(){const e=this.editor.commands.get(\"imageInsert\");const t=this.editor.commands.get(\"link\");this.isEnabled=e.isEnabled||t.isEnabled}execute(){const e=this.editor;const t=this.editor.config.get(\"ckfinder.openerMethod\")||\"modal\";if(t!=\"popup\"&&t!=\"modal\"){throw new rr[\"b\"]('ckfinder-unknown-openerMethod: The openerMethod config option must by \"popup\" or \"modal\".',e)}const n=this.editor.config.get(\"ckfinder.options\")||{};n.chooseFiles=true;const i=n.onInit;if(!n.language){n.language=e.locale.uiLanguage}n.onInit=t=>{if(i){i(t)}t.on(\"files:choose\",n=>{const i=n.data.files.toArray();const o=i.filter(e=>!e.isImage());const s=i.filter(e=>e.isImage());for(const t of o){e.execute(\"link\",t.getUrl())}const r=[];for(const e of s){const n=e.getUrl();r.push(n?n:t.request(\"file:getProxyUrl\",{file:e}))}if(r.length){Qy(e,r)}});t.on(\"file:choose:resizedImage\",t=>{const n=t.data.resizedUrl;if(!n){const t=e.plugins.get(\"Notification\");const n=e.locale.t;t.showWarning(n(\"Could not obtain resized image URL.\"),{title:n(\"Selecting resized image failed\"),namespace:\"ckfinder\"});return}Qy(e,[n])})};window.CKFinder[t](n)}}function Qy(e,t){const n=e.commands.get(\"imageInsert\");if(!n.isEnabled){const t=e.plugins.get(\"Notification\");const n=e.locale.t;t.showWarning(n(\"Could not insert image at the current position.\"),{title:n(\"Inserting image failed\"),namespace:\"ckfinder\"});return}e.execute(\"imageInsert\",{source:t})}class Jy extends ok{static get pluginName(){return\"CKFinderEditing\"}static get requires(){return[Gy,X_,Uy]}init(){const e=this.editor;e.commands.add(\"ckfinder\",new Ky(e))}}class Zy extends Yy{static get pluginName(){return\"PendingActions\"}init(){this.set(\"hasAny\",false);this._actions=new xr({idProperty:\"_id\"});this._actions.delegate(\"add\",\"remove\").to(this)}add(e){if(typeof e!==\"string\"){throw new rr[\"b\"](\"pendingactions-add-invalid-message: The message must be a string.\",this)}const t=Object.create(Qc);t.set(\"message\",e);this._actions.add(t);this.hasAny=true;return t}remove(e){this._actions.remove(e);this.hasAny=!!this._actions.length}get first(){return this._actions.get(0)}[Symbol.iterator](){return this._actions[Symbol.iterator]()}}class Xy{constructor(){const e=new window.FileReader;this._reader=e;this._data=undefined;this.set(\"loaded\",0);e.onprogress=e=>{this.loaded=e.loaded}}get error(){return this._reader.error}get data(){return this._data}read(e){const t=this._reader;this.total=e.size;return new Promise((n,i)=>{t.onload=()=>{const e=t.result;this._data=e;n(e)};t.onerror=()=>{i(\"error\")};t.onabort=()=>{i(\"aborted\")};this._reader.readAsDataURL(e)})}abort(){this._reader.abort()}}yr(Xy,Qc);class ex extends ok{static get pluginName(){return\"FileRepository\"}static get requires(){return[Zy]}init(){this.loaders=new xr;this.loaders.on(\"add\",()=>this._updatePendingAction());this.loaders.on(\"remove\",()=>this._updatePendingAction());this._loadersMap=new Map;this._pendingAction=null;this.set(\"uploaded\",0);this.set(\"uploadTotal\",null);this.bind(\"uploadedPercent\").to(this,\"uploaded\",this,\"uploadTotal\",(e,t)=>t?e/t*100:0)}getLoader(e){return this._loadersMap.get(e)||null}createLoader(e){if(!this.createUploadAdapter){console.warn(Object(rr[\"a\"])(\"filerepository-no-upload-adapter: Upload adapter is not defined.\"));return null}const t=new tx(Promise.resolve(e),this.createUploadAdapter);this.loaders.add(t);this._loadersMap.set(e,t);if(e instanceof Promise){t.file.then(e=>{this._loadersMap.set(e,t)}).catch(()=>{})}t.on(\"change:uploaded\",()=>{let e=0;for(const t of this.loaders){e+=t.uploaded}this.uploaded=e});t.on(\"change:uploadTotal\",()=>{let e=0;for(const t of this.loaders){if(t.uploadTotal){e+=t.uploadTotal}}this.uploadTotal=e});return t}destroyLoader(e){const t=e instanceof tx?e:this.getLoader(e);t._destroy();this.loaders.remove(t);this._loadersMap.forEach((e,n)=>{if(e===t){this._loadersMap.delete(n)}})}_updatePendingAction(){const e=this.editor.plugins.get(Zy);if(this.loaders.length){if(!this._pendingAction){const t=this.editor.t;const n=e=>`${t(\"Upload in progress\")} ${parseInt(e)}%.`;this._pendingAction=e.add(n(this.uploadedPercent));this._pendingAction.bind(\"message\").to(this,\"uploadedPercent\",n)}}else{e.remove(this._pendingAction);this._pendingAction=null}}}yr(ex,Qc);class tx{constructor(e,t){this.id=nr();this._filePromiseWrapper=this._createFilePromiseWrapper(e);this._adapter=t(this);this._reader=new Xy;this.set(\"status\",\"idle\");this.set(\"uploaded\",0);this.set(\"uploadTotal\",null);this.bind(\"uploadedPercent\").to(this,\"uploaded\",this,\"uploadTotal\",(e,t)=>t?e/t*100:0);this.set(\"uploadResponse\",null)}get file(){if(!this._filePromiseWrapper){return Promise.resolve(null)}else{return this._filePromiseWrapper.promise.then(e=>this._filePromiseWrapper?e:null)}}get data(){return this._reader.data}read(){if(this.status!=\"idle\"){throw new rr[\"b\"](\"filerepository-read-wrong-status: You cannot call read if the status is different than idle.\",this)}this.status=\"reading\";return this.file.then(e=>this._reader.read(e)).then(e=>{if(this.status!==\"reading\"){throw this.status}this.status=\"idle\";return e}).catch(e=>{if(e===\"aborted\"){this.status=\"aborted\";throw\"aborted\"}this.status=\"error\";throw this._reader.error?this._reader.error:e})}upload(){if(this.status!=\"idle\"){throw new rr[\"b\"](\"filerepository-upload-wrong-status: You cannot call upload if the status is different than idle.\",this)}this.status=\"uploading\";return this.file.then(()=>this._adapter.upload()).then(e=>{this.uploadResponse=e;this.status=\"idle\";return e}).catch(e=>{if(this.status===\"aborted\"){throw\"aborted\"}this.status=\"error\";throw e})}abort(){const e=this.status;this.status=\"aborted\";if(!this._filePromiseWrapper.isFulfilled){this._filePromiseWrapper.promise.catch(()=>{});this._filePromiseWrapper.rejecter(\"aborted\")}else if(e==\"reading\"){this._reader.abort()}else if(e==\"uploading\"&&this._adapter.abort){this._adapter.abort()}this._destroy()}_destroy(){this._filePromiseWrapper=undefined;this._reader=undefined;this._adapter=undefined;this.uploadResponse=undefined}_createFilePromiseWrapper(e){const t={};t.promise=new Promise((n,i)=>{t.rejecter=i;t.isFulfilled=false;e.then(e=>{t.isFulfilled=true;n(e)}).catch(e=>{t.isFulfilled=true;i(e)})});return t}}yr(tx,Qc);const nx=\"ckCsrfToken\";const ix=40;const ox=\"abcdefghijklmnopqrstuvwxyz0123456789\";function sx(){let e=rx(nx);if(!e||e.length!=ix){e=cx(ix);ax(nx,e)}return e}function rx(e){e=e.toLowerCase();const t=document.cookie.split(\";\");for(const n of t){const t=n.split(\"=\");const i=decodeURIComponent(t[0].trim().toLowerCase());if(i===e){return decodeURIComponent(t[1])}}return null}function ax(e,t){document.cookie=encodeURIComponent(e)+\"=\"+encodeURIComponent(t)+\";path=/\"}function cx(e){let t=\"\";const n=new Uint8Array(e);window.crypto.getRandomValues(n);for(let e=0;e