{"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){const e=t[\"it\"]=t[\"it\"]||{};e.dictionary=Object.assign(e.dictionary||{},{\"Align center\":\"Allinea al centro\",\"Align left\":\"Allinea a sinistra\",\"Align right\":\"Allinea a destra\",Aquamarine:\"Aquamarina\",Big:\"Grandi\",Black:\"Nero\",Blue:\"Blu\",Bold:\"Grassetto\",\"Bulleted List\":\"Elenco puntato\",Default:\"Predefinito\",\"Dim grey\":\"Grigio tenue\",\"Document colors\":\"Colori del docmento\",\"Dropdown toolbar\":\"Barra degli strumenti del menu a discesa\",\"Editor toolbar\":\"Barra degli strumenti dell'editor\",\"Font Background Color\":\"Colore di sfondo caratteri\",\"Font Color\":\"Colore caratteri\",\"Font Size\":\"Dimensione caratteri\",Green:\"Verde\",Grey:\"Grigio\",Huge:\"Grandissimi\",Italic:\"Corsivo\",Justify:\"Giustifica\",\"Light blue\":\"Azzurro\",\"Light green\":\"Verde chiaro\",\"Light grey\":\"Grigio chiaro\",\"Numbered List\":\"Elenco numerato\",Orange:\"Arancio\",Purple:\"Porpora\",Red:\"Rosso\",Redo:\"Ripristina\",\"Remove color\":\"Rimuovi colore\",\"Remove Format\":\"Rimuovi formato\",\"Rich Text Editor\":\"Editor di testo formattato\",\"Rich Text Editor, %0\":\"Editor di testo formattato, %0\",\"Select all\":\"Seleziona tutto\",\"Show more items\":\"Mostra più elementi\",Small:\"Piccoli\",Strikethrough:\"Barrato\",\"Text alignment\":\"Allineamento del testo\",\"Text alignment toolbar\":\"Barra degli strumenti dell'allineamento\",Tiny:\"Piccolissimi\",Turquoise:\"Turchese\",Underline:\"Sottolineato\",Undo:\"Annulla\",White:\"Bianco\",Yellow:\"Giallo\"});e.getPluralForm=function(t){return t!=1}})(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(o){if(e[o]){return e[o].exports}var i=e[o]={i:o,l:false,exports:{}};t[o].call(i.exports,i,i.exports,n);i.l=true;return i.exports}n.m=t;n.c=e;n.d=function(t,e,o){if(!n.o(t,e)){Object.defineProperty(t,e,{enumerable:true,get:o})}};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 o=Object.create(null);n.r(o);Object.defineProperty(o,\"default\",{enumerable:true,value:t});if(e&2&&typeof t!=\"string\")for(var i in t)n.d(o,i,function(e){return t[e]}.bind(null,i));return o};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=49)}([function(t,e,n){\"use strict\";n.d(e,\"b\",(function(){return i}));n.d(e,\"a\",(function(){return r}));const o=\"https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/error-codes.html\";class i extends Error{constructor(t,e,n){let o=r(t);if(n){o+=\" \"+JSON.stringify(n)}super(o);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 i(t.message,e);n.stack=t.stack;throw n}}function r(t){return t+` Read more: ${o}#error-${t}\\n`}},function(t,e,n){\"use strict\";t.exports=function(t){var e=[];e.toString=function e(){return this.map((function(e){var n=o(e,t);if(e[2]){return\"@media \".concat(e[2],\" {\").concat(n,\"}\")}return n})).join(\"\")};e.i=function(t,n,o){if(typeof t===\"string\"){t=[[null,t,\"\"]]}var i={};if(o){for(var r=0;r
\").replace(/\\r?\\n/g,\"
\").replace(/^\\s/,\" \").replace(/\\s$/,\" \").replace(/\\s\\s/g,\" \");if(t.includes(\"
\")||t.includes(\"
\")){t=`
${t}
`}return t}function Vw(t){return t.replace(/(\\s+)<\\/span>/g,((t,e)=>{if(e.length==1){return\" \"}return e}))}const zw=[\"figcaption\",\"li\"];function jw(t){let e=\"\";if(t.is(\"$text\")||t.is(\"$textProxy\")){e=t.data}else if(t.is(\"element\",\"img\")&&t.hasAttribute(\"alt\")){e=t.getAttribute(\"alt\")}else if(t.is(\"element\",\"br\")){e=\"\\n\"}else{let n=null;for(const o of t.getChildren()){const t=jw(o);if(n&&(n.is(\"containerElement\")||o.is(\"containerElement\"))){if(zw.includes(n.name)||zw.includes(o.name)){e+=\"\\n\"}else{e+=\"\\n\\n\"}}e+=t;n=o}}return e}class qw extends rw{static get pluginName(){return\"Clipboard\"}static get requires(){return[Mw]}init(){const t=this.editor;const e=t.model.document;const n=t.editing.view;const o=n.document;this._htmlDataProcessor=new Hp(o);n.addObserver(Nw);this.listenTo(o,\"clipboardInput\",(e=>{if(t.isReadOnly){e.stop()}}),{priority:\"highest\"});this.listenTo(o,\"clipboardInput\",((t,e)=>{const o=e.dataTransfer;let i=\"\";if(o.getData(\"text/html\")){i=Vw(o.getData(\"text/html\"))}else if(o.getData(\"text/plain\")){i=Lw(o.getData(\"text/plain\"))}i=this._htmlDataProcessor.toView(i);const r=new ts(this,\"inputTransformation\");this.fire(r,{content:i,dataTransfer:o,asPlainText:e.asPlainText});if(r.stop.called){t.stop()}n.scrollToTheSelection()}),{priority:\"low\"});this.listenTo(this,\"inputTransformation\",((n,o)=>{if(!o.content.isEmpty){const i=this.editor.data;const r=this.editor.model;const s=i.toModel(o.content,\"$clipboardHolder\");if(s.childCount==0){return}if(o.asPlainText||Kw(s)){const n=new Map(Array.from(e.selection.getAttributes()).filter((e=>t.model.schema.getAttributeProperties(e[0]).isFormatting)));r.change((t=>{const e=t.createRangeIn(s);for(const o of e.getItems()){if(o.is(\"$text\")||o.is(\"$textProxy\")){t.setAttributes(n,o)}}}))}r.insertContent(s);n.stop()}}),{priority:\"low\"});function i(n,i){const r=i.dataTransfer;i.preventDefault();const s=t.data.toView(t.model.getSelectedContent(e.selection));o.fire(\"clipboardOutput\",{dataTransfer:r,content:s,method:n.name})}this.listenTo(o,\"copy\",i,{priority:\"low\"});this.listenTo(o,\"cut\",((e,n)=>{if(t.isReadOnly){n.preventDefault()}else{i(e,n)}}),{priority:\"low\"});this.listenTo(o,\"clipboardOutput\",((n,o)=>{if(!o.content.isEmpty){o.dataTransfer.setData(\"text/html\",this._htmlDataProcessor.toData(o.content));o.dataTransfer.setData(\"text/plain\",jw(o.content))}if(o.method==\"cut\"){t.model.deleteContent(e.selection)}}),{priority:\"low\"})}}function Kw(t){if(t.childCount>1){return false}const e=t.getChild(0);return[...e.getAttributeKeys()].length==0}function*$w(t,e){for(const n of e){if(n&&t.getAttributeProperties(n[0]).copyOnEnter){yield n}}}class Gw extends aw{execute(){const t=this.editor.model;const e=t.document;t.change((n=>{Ww(this.editor.model,n,e.selection,t.schema);this.fire(\"afterExecute\",{writer:n})}))}}function Ww(t,e,n,o){const i=n.isCollapsed;const r=n.getFirstRange();const s=r.start.parent;const a=r.end.parent;if(o.isLimit(s)||o.isLimit(a)){if(!i&&s==a){t.deleteContent(n)}return}if(i){const t=$w(e.model.schema,n.getAttributes());Uw(e,r.start);e.setSelectionAttribute(t)}else{const o=!(r.start.isAtStart&&r.end.isAtEnd);const i=s==a;t.deleteContent(n,{leaveUnmerged:o});if(o){if(i){Uw(e,n.focus)}else{e.setSelection(a,0)}}}}function Uw(t,e){t.split(e);t.setSelection(e.parent.nextSibling,0)}class Hw extends Zu{constructor(t){super(t);const e=this.document;e.on(\"keydown\",((t,n)=>{if(this.isEnabled&&n.keyCode==Nl.enter){let o;e.once(\"enter\",(t=>o=t),{priority:\"highest\"});e.fire(\"enter\",new th(e,n.domEvent,{isSoft:n.shiftKey}));if(o&&o.stop.called){t.stop()}}}))}observe(){}}class Jw extends rw{static get pluginName(){return\"Enter\"}init(){const t=this.editor;const e=t.editing.view;const n=e.document;e.addObserver(Hw);t.commands.add(\"enter\",new Gw(t));this.listenTo(n,\"enter\",((n,o)=>{o.preventDefault();if(o.isSoft){return}t.execute(\"enter\");e.scrollToTheSelection()}),{priority:\"low\"})}}class Yw extends aw{execute(){const t=this.editor.model;const e=t.document;t.change((n=>{Xw(t,n,e.selection);this.fire(\"afterExecute\",{writer:n})}))}refresh(){const t=this.editor.model;const e=t.document;this.isEnabled=Qw(t.schema,e.selection)}}function Qw(t,e){if(e.rangeCount>1){return false}const n=e.anchor;if(!n||!t.checkChild(n,\"softBreak\")){return false}const o=e.getFirstRange();const i=o.start.parent;const r=o.end.parent;if((t_(i,t)||t_(r,t))&&i!==r){return false}return true}function Xw(t,e,n){const o=n.isCollapsed;const i=n.getFirstRange();const r=i.start.parent;const s=i.end.parent;const a=r==s;if(o){const o=$w(t.schema,n.getAttributes());Zw(t,e,i.end);e.removeSelectionAttribute(n.getAttributeKeys());e.setSelectionAttribute(o)}else{const o=!(i.start.isAtStart&&i.end.isAtEnd);t.deleteContent(n,{leaveUnmerged:o});if(a){Zw(t,e,n.focus)}else{if(o){e.setSelection(s,0)}}}}function Zw(t,e,n){const o=e.createElement(\"softBreak\");t.insertContent(o,n);e.setSelection(o,\"after\")}function t_(t,e){if(t.is(\"rootElement\")){return false}return e.isLimit(t)||t_(t.parent,e)}class e_ extends rw{static get pluginName(){return\"ShiftEnter\"}init(){const t=this.editor;const e=t.model.schema;const n=t.conversion;const o=t.editing.view;const i=o.document;e.register(\"softBreak\",{allowWhere:\"$text\",isInline:true});n.for(\"upcast\").elementToElement({model:\"softBreak\",view:\"br\"});n.for(\"downcast\").elementToElement({model:\"softBreak\",view:(t,{writer:e})=>e.createEmptyElement(\"br\")});o.addObserver(Hw);t.commands.add(\"shiftEnter\",new Yw(t));this.listenTo(i,\"enter\",((e,n)=>{n.preventDefault();if(!n.isSoft){return}t.execute(\"shiftEnter\");o.scrollToTheSelection()}),{priority:\"low\"})}}class n_ extends aw{execute(){const t=this.editor.model;const e=t.document.selection;let n=t.schema.getLimitElement(e);if(e.containsEntireContent(n)||!o_(t.schema,n)){do{n=n.parent;if(!n){return}}while(!o_(t.schema,n))}t.change((t=>{t.setSelection(n,\"in\")}))}}function o_(t,e){return t.isLimit(e)&&(t.checkChild(e,\"$text\")||t.checkChild(e,\"paragraph\"))}const i_=Ml(\"Ctrl+A\");class r_ extends rw{static get pluginName(){return\"SelectAllEditing\"}init(){const t=this.editor;const e=t.editing.view;const n=e.document;t.commands.add(\"selectAll\",new n_(t));this.listenTo(n,\"keydown\",((e,n)=>{if(Fl(n)===i_){t.execute(\"selectAll\");n.preventDefault()}}))}}var s_='';class a_ extends rw{static get pluginName(){return\"SelectAllUI\"}init(){const t=this.editor;t.ui.componentFactory.add(\"selectAll\",(e=>{const n=t.commands.get(\"selectAll\");const o=new Tk(e);const i=e.t;o.set({label:i(\"Select all\"),icon:s_,keystroke:\"Ctrl+A\",tooltip:true});o.bind(\"isOn\",\"isEnabled\").to(n,\"value\",\"isEnabled\");this.listenTo(o,\"execute\",(()=>{t.execute(\"selectAll\");t.editing.view.focus()}));return o}))}}class c_ extends rw{static get requires(){return[r_,a_]}static get pluginName(){return\"SelectAll\"}}class l_{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 u_ extends aw{constructor(t,e){super(t);this._buffer=new l_(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 o=t.text||\"\";const i=o.length;const r=t.range?e.createSelection(t.range):n.selection;const s=t.resultRange;e.enqueueChange(this._buffer.batch,(t=>{this._buffer.lock();this._batches.add(this._buffer.batch);e.deleteContent(r);if(o){e.insertContent(t.createText(o,n.selection.getAttributes()),r)}if(s){t.setSelection(s)}else if(!r.is(\"documentSelection\")){t.setSelection(r)}this._buffer.unlock();this._buffer.input(i)}))}}function d_(t){let e=null;const n=t.model;const o=t.editing.view;const i=t.commands.get(\"input\");if(El.isAndroid){o.document.on(\"beforeinput\",((t,e)=>r(e)),{priority:\"lowest\"})}else{o.document.on(\"keydown\",((t,e)=>r(e)),{priority:\"lowest\"})}o.document.on(\"compositionstart\",s,{priority:\"lowest\"});o.document.on(\"compositionend\",(()=>{e=n.createSelection(n.document.selection)}),{priority:\"lowest\"});function r(t){const r=n.document;const s=o.document.isComposing;const c=e&&e.isEqual(r.selection);e=null;if(!i.isEnabled){return}if(f_(t)||r.selection.isCollapsed){return}if(s&&t.keyCode===229){return}if(!s&&t.keyCode===229&&c){return}a()}function s(){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=i.buffer;t.lock();const e=t.batch;i._batches.add(e);n.enqueueChange(e,(()=>{n.deleteContent(n.document.selection)}));t.unlock()}}const h_=[Fl(\"arrowUp\"),Fl(\"arrowRight\"),Fl(\"arrowDown\"),Fl(\"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++){h_.push(t)}function f_(t){if(t.ctrlKey){return true}return h_.includes(t.keyCode)}function m_(t,e){const n=[];let o=0;let i;t.forEach((t=>{if(t==\"equal\"){r();o++}else if(t==\"insert\"){if(s(\"insert\")){i.values.push(e[o])}else{r();i={type:\"insert\",index:o,values:[e[o]]}}o++}else{if(s(\"delete\")){i.howMany++}else{r();i={type:\"delete\",index:o,howMany:1}}}}));r();return n;function r(){if(i){n.push(i);i=null}}function s(t){return i&&i.type==t}}function g_(t){if(t.length==0){return false}for(const e of t){if(e.type===\"children\"&&!p_(e)){return true}}return false}function p_(t){if(t.newChildren.length-t.oldChildren.length!=1){return}const e=Eu(t.oldChildren,t.newChildren,b_);const n=m_(e,t.newChildren);if(n.length>1){return}const o=n[0];if(!(!!o.values[0]&&o.values[0].is(\"$text\"))){return}return o}function b_(t,e){if(!!t&&t.is(\"$text\")&&!!e&&e.is(\"$text\")){return t.data===e.data}else{return t===e}}function k_(t){t.editing.view.document.on(\"mutations\",((e,n,o)=>{new w_(t).handle(n,o)}))}class w_{constructor(t){this.editor=t;this.editing=this.editor.editing}handle(t,e){if(g_(t)){this._handleContainerChildrenMutations(t,e)}else{for(const n of t){this._handleTextMutation(n,e);this._handleTextNodeInsertion(n)}}}_handleContainerChildrenMutations(t,e){const n=__(t);if(!n){return}const o=this.editor.editing.view.domConverter;const i=o.mapViewToDom(n);const r=new Ku(this.editor.editing.view.document);const s=this.editor.data.toModel(r.domToView(i)).getChild(0);const a=this.editor.editing.mapper.toModelElement(n);if(!a){return}const c=Array.from(s.getChildren());const l=Array.from(a.getChildren());const u=c[c.length-1];const d=l[l.length-1];const h=u&&u.is(\"element\",\"softBreak\");const f=d&&!d.is(\"element\",\"softBreak\");if(h&&f){c.pop()}const m=this.editor.model.schema;if(!v_(c,m)||!v_(l,m)){return}const g=c.map((t=>t.is(\"$text\")?t.data:\"@\")).join(\"\").replace(/\\u00A0/g,\" \");const p=l.map((t=>t.is(\"$text\")?t.data:\"@\")).join(\"\").replace(/\\u00A0/g,\" \");if(p===g){return}const b=Eu(p,g);const{firstChangeAt:k,insertions:w,deletions:_}=C_(b);let v=null;if(e){v=this.editing.mapper.toModelRange(e.getFirstRange())}const C=g.substr(k,w);const A=this.editor.model.createRange(this.editor.model.createPositionAt(a,k),this.editor.model.createPositionAt(a,k+_));this.editor.execute(\"input\",{text:C,range:A,resultRange:v})}_handleTextMutation(t,e){if(t.type!=\"text\"){return}const n=t.newText.replace(/\\u00A0/g,\" \");const o=t.oldText.replace(/\\u00A0/g,\" \");if(o===n){return}const i=Eu(o,n);const{firstChangeAt:r,insertions:s,deletions:a}=C_(i);let c=null;if(e){c=this.editing.mapper.toModelRange(e.getFirstRange())}const l=this.editing.view.createPositionAt(t.node,r);const u=this.editing.mapper.toModelPosition(l);const d=this.editor.model.createRange(u,u.getShiftedBy(a));const h=n.substr(r,s);this.editor.execute(\"input\",{text:h,range:d,resultRange:c})}_handleTextNodeInsertion(t){if(t.type!=\"children\"){return}const e=p_(t);const n=this.editing.view.createPositionAt(t.node,e.index);const o=this.editing.mapper.toModelPosition(n);const i=e.values[0].data;this.editor.execute(\"input\",{text:i.replace(/\\u00A0/g,\" \"),range:this.editor.model.createRange(o)})}}function __(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 v_(t,e){return t.every((t=>e.isInline(t)))}function C_(t){let e=null;let n=null;for(let o=0;o