{"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(t){t[\"en\"]=Object.assign(t[\"en\"]||{},{a:\"Image toolbar\",b:\"Saving changes\",c:\"Block quote\",d:\"Choose heading\",e:\"Heading\",f:\"Link\",g:\"Numbered List\",h:\"Bulleted List\",i:\"Yellow marker\",j:\"Green marker\",k:\"Pink marker\",l:\"Blue marker\",m:\"Red pen\",n:\"Green pen\",o:\"Remove highlight\",p:\"Highlight\",q:\"Text highlight toolbar\",r:\"Remove Format\",s:\"Bold\",t:\"Italic\",u:\"Code\",v:\"image widget\",w:\"Font Size\",x:\"Default\",y:\"Tiny\",z:\"Small\",aa:\"Big\",ab:\"Huge\",ac:\"Font Family\",ad:\"Font Color\",ae:\"Font Background Color\",af:\"Widget toolbar\",ag:\"Paragraph\",ah:\"Heading 1\",ai:\"Heading 2\",aj:\"Heading 3\",ak:\"Heading 4\",al:\"Heading 5\",am:\"Heading 6\",an:\"Change image text alternative\",ao:\"Open in a new tab\",ap:\"Downloadable\",aq:\"Remove color\",ar:\"Document colors\",as:\"Editor toolbar\",at:\"Show more items\",au:\"Dropdown toolbar\",av:\"Rich Text Editor\",aw:\"Rich Text Editor, %0\",ax:\"%0 of %1\",ay:\"Previous\",az:\"Next\",ba:\"Undo\",bb:\"Redo\",bc:\"Save\",bd:\"Cancel\",be:\"Text alternative\",bf:\"Black\",bg:\"Dim grey\",bh:\"Grey\",bi:\"Light grey\",bj:\"White\",bk:\"Red\",bl:\"Orange\",bm:\"Yellow\",bn:\"Light green\",bo:\"Green\",bp:\"Aquamarine\",bq:\"Turquoise\",br:\"Light blue\",bs:\"Blue\",bt:\"Purple\",bu:\"Unlink\",bv:\"Edit link\",bw:\"Open link in new tab\",bx:\"This link has no URL\",by:\"Link URL\"})})(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={}));(function t(e,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 e[\"ClassicEditor\"]=n()})(window,(function(){return function(t){var e={};function n(i){if(e[i]){return e[i].exports}var o=e[i]={i:i,l:false,exports:{}};t[i].call(o.exports,o,o.exports,n);o.l=true;return o.exports}n.m=t;n.c=e;n.d=function(t,e,i){if(!n.o(t,e)){Object.defineProperty(t,e,{enumerable:true,get:i})}};n.r=function(t){if(typeof Symbol!==\"undefined\"&&Symbol.toStringTag){Object.defineProperty(t,Symbol.toStringTag,{value:\"Module\"})}Object.defineProperty(t,\"__esModule\",{value:true})};n.t=function(t,e){if(e&1)t=n(t);if(e&8)return t;if(e&4&&typeof t===\"object\"&&t&&t.__esModule)return t;var i=Object.create(null);n.r(i);Object.defineProperty(i,\"default\",{enumerable:true,value:t});if(e&2&&typeof t!=\"string\")for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i};n.n=function(t){var e=t&&t.__esModule?function e(){return t[\"default\"]}:function e(){return t};n.d(e,\"a\",e);return e};n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};n.p=\"\";return n(n.s=80)}([function(t,e,n){\"use strict\";n.d(e,\"b\",(function(){return o}));n.d(e,\"a\",(function(){return s}));const i=\"https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/error-codes.html\";class o extends Error{constructor(t,e,n){t=s(t);if(n){t+=\" \"+JSON.stringify(n)}super(t);this.name=\"CKEditorError\";this.context=e;this.data=n}is(t){return t===\"CKEditorError\"}static rethrowUnexpectedError(t,e){if(t.is&&t.is(\"CKEditorError\")){throw t}const n=new o(t.message,e);n.stack=t.stack;throw n}}function s(t){const e=t.match(/^([^:]+):/);if(!e){return t}return t+` Read more: ${i}#error-${e[1]}\\n`}},function(t,e,n){\"use strict\";var i=function t(){var e;return function t(){if(typeof e===\"undefined\"){e=Boolean(window&&document&&document.all&&!window.atob)}return e}}();var o=function t(){var e={};return function t(n){if(typeof e[n]===\"undefined\"){var i=document.querySelector(n);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement){try{i=i.contentDocument.head}catch(t){i=null}}e[n]=i}return e[n]}}();var s=[];function r(t){var e=-1;for(var n=0;n
\").replace(/^\\s/,\" \").replace(/\\s$/,\" \").replace(/\\s\\s/g,\" \");if(t.indexOf(\"
\")>-1){t=`
${t}
`}return t}function FA(t){return t.replace(/(\\s+)<\\/span>/g,(t,e)=>{if(e.length==1){return\" \"}return e})}const DA=[\"figcaption\",\"li\"];function LA(t){let e=\"\";if(t.is(\"text\")||t.is(\"textProxy\")){e=t.data}else if(t.is(\"img\")&&t.hasAttribute(\"alt\")){e=t.getAttribute(\"alt\")}else{let n=null;for(const i of t.getChildren()){const t=LA(i);if(n&&(n.is(\"containerElement\")||i.is(\"containerElement\"))){if(DA.includes(n.name)||DA.includes(i.name)){e+=\"\\n\"}else{e+=\"\\n\\n\"}}e+=t;n=i}}return e}class zA extends Mk{static get pluginName(){return\"Clipboard\"}init(){const t=this.editor;const e=t.model.document;const n=t.editing.view;const i=n.document;this._htmlDataProcessor=new _p(i);n.addObserver(NA);this.listenTo(i,\"clipboardInput\",e=>{if(t.isReadOnly){e.stop()}},{priority:\"highest\"});this.listenTo(i,\"clipboardInput\",(t,e)=>{const i=e.dataTransfer;let o=\"\";if(i.getData(\"text/html\")){o=FA(i.getData(\"text/html\"))}else if(i.getData(\"text/plain\")){o=BA(i.getData(\"text/plain\"))}o=this._htmlDataProcessor.toView(o);this.fire(\"inputTransformation\",{content:o,dataTransfer:i});n.scrollToTheSelection()},{priority:\"low\"});this.listenTo(this,\"inputTransformation\",(t,e)=>{if(!e.content.isEmpty){const t=this.editor.data;const n=this.editor.model;const i=t.toModel(e.content,\"$clipboardHolder\");if(i.childCount==0){return}n.insertContent(i)}},{priority:\"low\"});function o(n,o){const s=o.dataTransfer;o.preventDefault();const r=t.data.toView(t.model.getSelectedContent(e.selection));i.fire(\"clipboardOutput\",{dataTransfer:s,content:r,method:n.name})}this.listenTo(i,\"copy\",o,{priority:\"low\"});this.listenTo(i,\"cut\",(e,n)=>{if(t.isReadOnly){n.preventDefault()}else{o(e,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\",LA(i.content))}if(i.method==\"cut\"){t.model.deleteContent(e.selection)}},{priority:\"low\"})}}function*jA(t,e){for(const n of e){if(n&&t.getAttributeProperties(n[0]).copyOnEnter){yield n}}}class qA extends Bk{execute(){const t=this.editor.model;const e=t.document;t.change(n=>{WA(this.editor.model,n,e.selection,t.schema);this.fire(\"afterExecute\",{writer:n})})}}function WA(t,e,n,i){const o=n.isCollapsed;const s=n.getFirstRange();const r=s.start.parent;const a=s.end.parent;if(i.isLimit(r)||i.isLimit(a)){if(!o&&r==a){t.deleteContent(n)}return}if(o){const t=jA(e.model.schema,n.getAttributes());HA(e,s.start);e.setSelectionAttribute(t)}else{const i=!(s.start.isAtStart&&s.end.isAtEnd);const o=r==a;t.deleteContent(n,{leaveUnmerged:i});if(i){if(o){HA(e,n.focus)}else{e.setSelection(a,0)}}}}function HA(t,e){t.split(e);t.setSelection(e.parent.nextSibling,0)}class UA extends Gu{constructor(t){super(t);const e=this.document;e.on(\"keydown\",(t,n)=>{if(this.isEnabled&&n.keyCode==Nl.enter){let i;e.once(\"enter\",t=>i=t,{priority:\"highest\"});e.fire(\"enter\",new Kd(e,n.domEvent,{isSoft:n.shiftKey}));if(i&&i.stop.called){t.stop()}}})}observe(){}}class $A extends Mk{static get pluginName(){return\"Enter\"}init(){const t=this.editor;const e=t.editing.view;const n=e.document;e.addObserver(UA);t.commands.add(\"enter\",new qA(t));this.listenTo(n,\"enter\",(n,i)=>{i.preventDefault();if(i.isSoft){return}t.execute(\"enter\");e.scrollToTheSelection()},{priority:\"low\"})}}class GA extends Bk{execute(){const t=this.editor.model;const e=t.document;t.change(n=>{JA(t,n,e.selection);this.fire(\"afterExecute\",{writer:n})})}refresh(){const t=this.editor.model;const e=t.document;this.isEnabled=KA(t.schema,e.selection)}}function KA(t,e){if(e.rangeCount>1){return false}const n=e.anchor;if(!n||!t.checkChild(n,\"softBreak\")){return false}const i=e.getFirstRange();const o=i.start.parent;const s=i.end.parent;if((QA(o,t)||QA(s,t))&&o!==s){return false}return true}function JA(t,e,n){const i=n.isCollapsed;const o=n.getFirstRange();const s=o.start.parent;const r=o.end.parent;const a=s==r;if(i){const i=jA(t.schema,n.getAttributes());YA(t,e,o.end);e.removeSelectionAttribute(n.getAttributeKeys());e.setSelectionAttribute(i)}else{const i=!(o.start.isAtStart&&o.end.isAtEnd);t.deleteContent(n,{leaveUnmerged:i});if(a){YA(t,e,n.focus)}else{if(i){e.setSelection(r,0)}}}}function YA(t,e,n){const i=e.createElement(\"softBreak\");t.insertContent(i,n);e.setSelection(i,\"after\")}function QA(t,e){if(t.is(\"rootElement\")){return false}return e.isLimit(t)||QA(t.parent,e)}class XA extends Mk{static get pluginName(){return\"ShiftEnter\"}init(){const t=this.editor;const e=t.model.schema;const n=t.conversion;const i=t.editing.view;const o=i.document;e.register(\"softBreak\",{allowWhere:\"$text\",isInline:true});n.for(\"upcast\").elementToElement({model:\"softBreak\",view:\"br\"});n.for(\"downcast\").elementToElement({model:\"softBreak\",view:(t,e)=>e.createEmptyElement(\"br\")});i.addObserver(UA);t.commands.add(\"shiftEnter\",new GA(t));this.listenTo(o,\"enter\",(e,n)=>{n.preventDefault();if(!n.isSoft){return}t.execute(\"shiftEnter\");i.scrollToTheSelection()},{priority:\"low\"})}}class ZA{constructor(t,e=20){this.model=t;this.size=0;this.limit=e;this.isLocked=false;this._changeCallback=(t,e)=>{if(e.type!=\"transparent\"&&e!==this._batch){this._reset(true)}};this._selectionChangeCallback=()=>{this._reset()};this.model.document.on(\"change\",this._changeCallback);this.model.document.selection.on(\"change:range\",this._selectionChangeCallback);this.model.document.selection.on(\"change:attribute\",this._selectionChangeCallback)}get batch(){if(!this._batch){this._batch=this.model.createBatch()}return this._batch}input(t){this.size+=t;if(this.size>=this.limit){this._reset(true)}}lock(){this.isLocked=true}unlock(){this.isLocked=false}destroy(){this.model.document.off(\"change\",this._changeCallback);this.model.document.selection.off(\"change:range\",this._selectionChangeCallback);this.model.document.selection.off(\"change:attribute\",this._selectionChangeCallback)}_reset(t){if(!this.isLocked||t){this._batch=null;this.size=0}}}class tP extends Bk{constructor(t,e){super(t);this._buffer=new ZA(t.model,e);this._batches=new WeakSet}get buffer(){return this._buffer}destroy(){super.destroy();this._buffer.destroy()}execute(t={}){const e=this.editor.model;const n=e.document;const i=t.text||\"\";const o=i.length;const s=t.range?e.createSelection(t.range):n.selection;const r=t.resultRange;e.enqueueChange(this._buffer.batch,t=>{this._buffer.lock();e.deleteContent(s);if(i){e.insertContent(t.createText(i,n.selection.getAttributes()),s)}if(r){t.setSelection(r)}else if(!s.is(\"documentSelection\")){t.setSelection(s)}this._buffer.unlock();this._buffer.input(o);this._batches.add(this._buffer.batch)})}}function eP(t){let e=null;const n=t.model;const i=t.editing.view;const o=t.commands.get(\"input\");if(Pl.isAndroid){i.document.on(\"beforeinput\",(t,e)=>s(e),{priority:\"lowest\"})}else{i.document.on(\"keydown\",(t,e)=>s(e),{priority:\"lowest\"})}i.document.on(\"compositionstart\",r,{priority:\"lowest\"});i.document.on(\"compositionend\",()=>{e=n.createSelection(n.document.selection)},{priority:\"lowest\"});function s(t){const s=n.document;const r=i.document.isComposing;const c=e&&e.isEqual(s.selection);e=null;if(!o.isEnabled){return}if(iP(t)||s.selection.isCollapsed){return}if(r&&t.keyCode===229){return}if(!r&&t.keyCode===229&&c){return}a()}function r(){const t=n.document;const e=t.selection.rangeCount===1?t.selection.getFirstRange().isFlat:true;if(t.selection.isCollapsed||e){return}a()}function a(){const t=o.buffer;t.lock();n.enqueueChange(t.batch,()=>{n.deleteContent(n.document.selection)});t.unlock()}}const nP=[Vl(\"arrowUp\"),Vl(\"arrowRight\"),Vl(\"arrowDown\"),Vl(\"arrowLeft\"),9,16,17,18,19,20,27,33,34,35,36,45,91,93,144,145,173,174,175,176,177,178,179,255];for(let t=112;t<=135;t++){nP.push(t)}function iP(t){if(t.ctrlKey){return true}return nP.includes(t.keyCode)}function oP(t,e){const n=[];let i=0;let o;t.forEach(t=>{if(t==\"equal\"){s();i++}else if(t==\"insert\"){if(r(\"insert\")){o.values.push(e[i])}else{s();o={type:\"insert\",index:i,values:[e[i]]}}i++}else{if(r(\"delete\")){o.howMany++}else{s();o={type:\"delete\",index:i,howMany:1}}}});s();return n;function s(){if(o){n.push(o);o=null}}function r(t){return o&&o.type==t}}function sP(t){if(t.length==0){return false}for(const e of t){if(e.type===\"children\"&&!rP(e)){return true}}return false}function rP(t){if(t.newChildren.length-t.oldChildren.length!=1){return}const e=_u(t.oldChildren,t.newChildren,aP);const n=oP(e,t.newChildren);if(n.length>1){return}const i=n[0];if(!(!!i.values[0]&&i.values[0].is(\"text\"))){return}return i}function aP(t,e){if(!!t&&t.is(\"text\")&&!!e&&e.is(\"text\")){return t.data===e.data}else{return t===e}}function cP(t){t.editing.view.document.on(\"mutations\",(e,n,i)=>{new lP(t).handle(n,i)})}class lP{constructor(t){this.editor=t;this.editing=this.editor.editing}handle(t,e){if(sP(t)){this._handleContainerChildrenMutations(t,e)}else{for(const n of t){this._handleTextMutation(n,e);this._handleTextNodeInsertion(n)}}}_handleContainerChildrenMutations(t,e){const n=uP(t);if(!n){return}const i=this.editor.editing.view.domConverter;const o=i.mapViewToDom(n);const s=new Fu(this.editor.editing.view.document);const r=this.editor.data.toModel(s.domToView(o)).getChild(0);const a=this.editor.editing.mapper.toModelElement(n);if(!a){return}const c=Array.from(r.getChildren());const l=Array.from(a.getChildren());const u=c[c.length-1];const d=l[l.length-1];if(u&&u.is(\"softBreak\")&&d&&!d.is(\"softBreak\")){c.pop()}const h=this.editor.model.schema;if(!dP(c,h)||!dP(l,h)){return}const f=c.map(t=>t.is(\"text\")?t.data:\"@\").join(\"\").replace(/\\u00A0/g,\" \");const g=l.map(t=>t.is(\"text\")?t.data:\"@\").join(\"\").replace(/\\u00A0/g,\" \");if(g===f){return}const m=_u(g,f);const{firstChangeAt:p,insertions:b,deletions:k}=hP(m);let w=null;if(e){w=this.editing.mapper.toModelRange(e.getFirstRange())}const _=f.substr(p,b);const v=this.editor.model.createRange(this.editor.model.createPositionAt(a,p),this.editor.model.createPositionAt(a,p+k));this.editor.execute(\"input\",{text:_,range:v,resultRange:w})}_handleTextMutation(t,e){if(t.type!=\"text\"){return}const n=t.newText.replace(/\\u00A0/g,\" \");const i=t.oldText.replace(/\\u00A0/g,\" \");if(i===n){return}const o=_u(i,n);const{firstChangeAt:s,insertions:r,deletions:a}=hP(o);let c=null;if(e){c=this.editing.mapper.toModelRange(e.getFirstRange())}const l=this.editing.view.createPositionAt(t.node,s);const u=this.editing.mapper.toModelPosition(l);const d=this.editor.model.createRange(u,u.getShiftedBy(a));const h=n.substr(s,r);this.editor.execute(\"input\",{text:h,range:d,resultRange:c})}_handleTextNodeInsertion(t){if(t.type!=\"children\"){return}const e=rP(t);const n=this.editing.view.createPositionAt(t.node,e.index);const i=this.editing.mapper.toModelPosition(n);const o=e.values[0].data;this.editor.execute(\"input\",{text:o.replace(/\\u00A0/g,\" \"),range:this.editor.model.createRange(i)})}}function uP(t){const e=t.map(t=>t.node).reduce((t,e)=>t.getCommonAncestor(e,{includeSelf:true}));if(!e){return}return e.getAncestors({includeSelf:true,parentFirst:true}).find(t=>t.is(\"containerElement\")||t.is(\"rootElement\"))}function dP(t,e){return t.every(t=>e.isInline(t))}function hP(t){let e=null;let n=null;for(let i=0;i