{"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){e[\"en\"]=Object.assign(e[\"en\"]||{},{a:\"Cannot upload file:\",b:\"Image toolbar\",c:\"Media toolbar\",d:\"Table toolbar\",e:\"Words: %0\",f:\"Characters: %0\",g:\"Block quote\",h:\"Insert image or file\",i:\"Choose heading\",j:\"Heading\",k:\"Increase indent\",l:\"Decrease indent\",m:\"media widget\",n:\"Bold\",o:\"Italic\",p:\"Code\",q:\"Subscript\",r:\"Superscript\",s:\"Underline\",t:\"Strikethrough\",u:\"image widget\",v:\"Enter image caption\",w:\"Full size image\",x:\"Side image\",y:\"Left aligned image\",z:\"Centered image\",aa:\"Right aligned image\",ab:\"Insert image\",ac:\"Upload failed\",ad:\"Upload in progress\",ae:\"Widget toolbar\",af:\"Page break\",ag:\"Horizontal line\",ah:\"Yellow marker\",ai:\"Green marker\",aj:\"Pink marker\",ak:\"Blue marker\",al:\"Red pen\",am:\"Green pen\",an:\"Remove highlight\",ao:\"Highlight\",ap:\"Text highlight toolbar\",aq:\"Insert code block\",ar:\"Align left\",as:\"Align right\",at:\"Align center\",au:\"Justify\",av:\"Text alignment\",aw:\"Text alignment toolbar\",ax:\"Insert table\",ay:\"Header column\",az:\"Insert column left\",ba:\"Insert column right\",bb:\"Delete column\",bc:\"Column\",bd:\"Header row\",be:\"Insert row below\",bf:\"Insert row above\",bg:\"Delete row\",bh:\"Row\",bi:\"Merge cell up\",bj:\"Merge cell right\",bk:\"Merge cell down\",bl:\"Merge cell left\",bm:\"Split cell vertically\",bn:\"Split cell horizontally\",bo:\"Merge cells\",bp:\"Font Family\",bq:\"Default\",br:\"Font Size\",bs:\"Tiny\",bt:\"Small\",bu:\"Big\",bv:\"Huge\",bw:\"Font Color\",bx:\"Font Background Color\",by:\"Could not obtain resized image URL.\",bz:\"Selecting resized image failed\",ca:\"Could not insert image at the current position.\",cb:\"Inserting image failed\",cc:\"Change image text alternative\",cd:\"Rich Text Editor\",ce:\"Plain text\",cf:\"Black\",cg:\"Dim grey\",ch:\"Grey\",ci:\"Light grey\",cj:\"White\",ck:\"Red\",cl:\"Orange\",cm:\"Yellow\",cn:\"Light green\",co:\"Green\",cp:\"Aquamarine\",cq:\"Turquoise\",cr:\"Light blue\",cs:\"Blue\",ct:\"Purple\",cu:\"Dropdown toolbar\",cv:\"Remove color\",cw:\"Document colors\",cx:\"Editor toolbar\",cy:\"Show more items\",cz:\"Undo\",da:\"Redo\",db:\"%0 of %1\",dc:\"Previous\",dd:\"Next\",de:\"Save\",df:\"Cancel\",dg:\"Text alternative\",dh:\"Open in a new tab\",di:\"Downloadable\",dj:\"Paragraph\",dk:\"Heading 1\",dl:\"Heading 2\",dm:\"Heading 3\",dn:\"Heading 4\",do:\"Heading 5\",dp:\"Heading 6\",dq:\"Rich Text Editor, %0\",dr:\"Insert media\",ds:\"The URL must not be empty.\",dt:\"This media URL is not supported.\",du:\"Numbered List\",dv:\"Bulleted List\",dw:\"Link\",dx:\"Unlink\",dy:\"Edit link\",dz:\"Open link in new tab\",ea:\"This link has no URL\",eb:\"Link URL\",ec:\"Paste the media URL in the input.\",ed:\"Tip: Paste the URL into the content to embed faster.\",ee:\"Media URL\"})})(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={}));(function e(t,i){if(typeof exports===\"object\"&&typeof module===\"object\")module.exports=i();else if(typeof define===\"function\"&&define.amd)define([],i);else if(typeof exports===\"object\")exports[\"ClassicEditor\"]=i();else t[\"ClassicEditor\"]=i()})(window,(function(){return function(e){var t={};function i(n){if(t[n]){return t[n].exports}var o=t[n]={i:n,l:false,exports:{}};e[n].call(o.exports,o,o.exports,i);o.l=true;return o.exports}i.m=e;i.c=t;i.d=function(e,t,n){if(!i.o(e,t)){Object.defineProperty(e,t,{enumerable:true,get:n})}};i.r=function(e){if(typeof Symbol!==\"undefined\"&&Symbol.toStringTag){Object.defineProperty(e,Symbol.toStringTag,{value:\"Module\"})}Object.defineProperty(e,\"__esModule\",{value:true})};i.t=function(e,t){if(t&1)e=i(e);if(t&8)return e;if(t&4&&typeof e===\"object\"&&e&&e.__esModule)return e;var n=Object.create(null);i.r(n);Object.defineProperty(n,\"default\",{enumerable:true,value:e});if(t&2&&typeof e!=\"string\")for(var o in e)i.d(n,o,function(t){return e[t]}.bind(null,o));return n};i.n=function(e){var t=e&&e.__esModule?function t(){return e[\"default\"]}:function t(){return e};i.d(t,\"a\",t);return t};i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};i.p=\"\";return i(i.s=116)}([function(e,t,i){\"use strict\";i.d(t,\"b\",(function(){return o}));i.d(t,\"a\",(function(){return s}));const n=\"https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/error-codes.html\";class o extends Error{constructor(e,t,i){e=s(e);if(i){e+=\" \"+JSON.stringify(i)}super(e);this.name=\"CKEditorError\";this.context=t;this.data=i}is(e){return e===\"CKEditorError\"}static rethrowUnexpectedError(e,t){if(e.is&&e.is(\"CKEditorError\")){throw e}const i=new o(e.message,t);i.stack=e.stack;throw i}}function s(e){const t=e.match(/^([^:]+):/);if(!t){return e}return e+` Read more: ${n}#error-${t[1]}\\n`}},function(e,t,i){\"use strict\";var n=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(i){if(typeof t[i]===\"undefined\"){var n=document.querySelector(i);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement){try{n=n.contentDocument.head}catch(e){n=null}}t[i]=n}return t[i]}}();var s=[];function r(e){var t=-1;for(var i=0;i
\";else if(typeof console!=\"undefined\"&&console.log!=null)console.log(i)};js.Boot.__clear_trace=function(){var e=document.getElementById(\"haxe:trace\");if(e!=null)e.innerHTML=\"\"};js.Boot.isClass=function(e){return e.__name__};js.Boot.isEnum=function(e){return e.__ename__};js.Boot.getClass=function(e){return e.__class__};js.Boot.__string_rec=function(e,t){if(e==null)return\"null\";if(t.length>=5)return\"<...>\";var i=typeof e;if(i==\"function\"&&(e.__name__||e.__ename__))i=\"object\";switch(i){case\"object\":if(e instanceof Array){if(e.__enum__){if(e.length==2)return e[0];var n=e[0]+\"(\";t+=\"\\t\";var o=2,s=e.length;while(o0?\",\":\"\")+js.Boot.__string_rec(e[c],t)}n+=\"]\";return n}var l;try{l=e.toString}catch(e){return\"???\"}if(l!=null&&l!=Object.toString){var d=e.toString();if(d!=\"[object Object]\")return d}var u=null;var n=\"{\\n\";t+=\"\\t\";var h=e.hasOwnProperty!=null;for(var u in e){if(h&&!e.hasOwnProperty(u)){continue}if(u==\"prototype\"||u==\"__class__\"||u==\"__super__\"||u==\"__interfaces__\"||u==\"__properties__\"){continue}if(n.length!=2)n+=\", \\n\";n+=t+u+\" : \"+js.Boot.__string_rec(e[u],t)}t=t.substring(1);n+=\"\\n\"+t+\"}\";return n;case\"function\":return\"
\";else if(typeof console!=\"undefined\"&&console.log!=null)console.log(i)};js.Boot.__clear_trace=function(){var e=document.getElementById(\"haxe:trace\");if(e!=null)e.innerHTML=\"\"};js.Boot.isClass=function(e){return e.__name__};js.Boot.isEnum=function(e){return e.__ename__};js.Boot.getClass=function(e){return e.__class__};js.Boot.__string_rec=function(e,t){if(e==null)return\"null\";if(t.length>=5)return\"<...>\";var i=typeof e;if(i==\"function\"&&(e.__name__||e.__ename__))i=\"object\";switch(i){case\"object\":if(e instanceof Array){if(e.__enum__){if(e.length==2)return e[0];var n=e[0]+\"(\";t+=\"\\t\";var o=2,s=e.length;while(o0?\",\":\"\")+js.Boot.__string_rec(e[c],t)}n+=\"]\";return n}var l;try{l=e.toString}catch(e){return\"???\"}if(l!=null&&l!=Object.toString){var d=e.toString();if(d!=\"[object Object]\")return d}var u=null;var n=\"{\\n\";t+=\"\\t\";var h=e.hasOwnProperty!=null;for(var u in e){if(h&&!e.hasOwnProperty(u)){continue}if(u==\"prototype\"||u==\"__class__\"||u==\"__super__\"||u==\"__interfaces__\"||u==\"__properties__\"){continue}if(n.length!=2)n+=\", \\n\";n+=t+u+\" : \"+js.Boot.__string_rec(e[u],t)}t=t.substring(1);n+=\"\\n\"+t+\"}\";return n;case\"function\":return\"0){if(++t>=ea){return arguments[0]}}else{t=0}return e.apply(undefined,arguments)}}var oa=na;var sa=oa(Zr);var ra=sa;function aa(e,t){return ra(Jr(e,t,Wr),e+\"\")}var ca=aa;function la(e,t,i){if(!ce(i)){return false}var n=typeof t;if(n==\"number\"?Xi(i)&&ei(t,i.length):n==\"string\"&&t in i){return D(i[t],e)}return false}var da=la;function ua(e){return ca((function(t,i){var n=-1,o=i.length,s=o>1?i[o-1]:undefined,r=o>2?i[2]:undefined;s=e.length>3&&typeof s==\"function\"?(o--,s):undefined;if(r&&da(i[0],i[1],r)){s=o<3?undefined:s;o=1}t=Object(t);while(++n
\").replace(/^\\s/,\" \").replace(/\\s$/,\" \").replace(/\\s\\s/g,\" \");if(e.indexOf(\"
\")>-1){e=`
${e}
`}return e}function by(e){return e.replace(/(\\s+)<\\/span>/g,(e,t)=>{if(t.length==1){return\" \"}return t})}const wy=[\"figcaption\",\"li\"];function _y(e){let t=\"\";if(e.is(\"text\")||e.is(\"textProxy\")){t=e.data}else if(e.is(\"img\")&&e.hasAttribute(\"alt\")){t=e.getAttribute(\"alt\")}else{let i=null;for(const n of e.getChildren()){const e=_y(n);if(i&&(i.is(\"containerElement\")||n.is(\"containerElement\"))){if(wy.includes(i.name)||wy.includes(n.name)){t+=\"\\n\"}else{t+=\"\\n\\n\"}}t+=e;i=n}}return t}class vy extends db{static get pluginName(){return\"Clipboard\"}init(){const e=this.editor;const t=e.model.document;const i=e.editing.view;const n=i.document;this._htmlDataProcessor=new ng;i.addObserver(my);this.listenTo(n,\"clipboardInput\",t=>{if(e.isReadOnly){t.stop()}},{priority:\"highest\"});this.listenTo(n,\"clipboardInput\",(e,t)=>{const n=t.dataTransfer;let o=\"\";if(n.getData(\"text/html\")){o=by(n.getData(\"text/html\"))}else if(n.getData(\"text/plain\")){o=py(n.getData(\"text/plain\"))}o=this._htmlDataProcessor.toView(o);this.fire(\"inputTransformation\",{content:o,dataTransfer:n});i.scrollToTheSelection()},{priority:\"low\"});this.listenTo(this,\"inputTransformation\",(e,t)=>{if(!t.content.isEmpty){const e=this.editor.data;const i=this.editor.model;const n=e.toModel(t.content,\"$clipboardHolder\");if(n.childCount==0){return}i.insertContent(n)}},{priority:\"low\"});function o(i,o){const s=o.dataTransfer;o.preventDefault();const r=e.data.toView(e.model.getSelectedContent(t.selection));n.fire(\"clipboardOutput\",{dataTransfer:s,content:r,method:i.name})}this.listenTo(n,\"copy\",o,{priority:\"low\"});this.listenTo(n,\"cut\",(t,i)=>{if(e.isReadOnly){i.preventDefault()}else{o(t,i)}},{priority:\"low\"});this.listenTo(n,\"clipboardOutput\",(i,n)=>{if(!n.content.isEmpty){n.dataTransfer.setData(\"text/html\",this._htmlDataProcessor.toData(n.content));n.dataTransfer.setData(\"text/plain\",_y(n.content))}if(n.method==\"cut\"){e.model.deleteContent(t.selection)}},{priority:\"low\"})}}class ky{createDocumentFragment(e){return new pc(e)}createElement(e,t,i){return new zr(e,t,i)}createText(e){return new Tr(e)}clone(e,t=false){return e._clone(t)}appendChild(e,t){return t._appendChild(e)}insertChild(e,t,i){return i._insertChild(e,t)}removeChildren(e,t,i){return i._removeChildren(e,t)}remove(e){const t=e.parent;if(t){return this.removeChildren(t.getChildIndex(e),1,t)}return[]}replace(e,t){const i=e.parent;if(i){const n=i.getChildIndex(e);this.removeChildren(n,1,i);this.insertChild(n,t,i);return true}return false}unwrapElement(e){const t=e.parent;if(t){const i=t.getChildIndex(e);this.remove(e);this.insertChild(i,e.getChildren(),t)}}rename(e,t){const i=new zr(e,t.getAttributes(),t.getChildren());return this.replace(t,i)?i:null}setAttribute(e,t,i){i._setAttribute(e,t)}removeAttribute(e,t){t._removeAttribute(e)}addClass(e,t){t._addClass(e)}removeClass(e,t){t._removeClass(e)}setStyle(e,t,i){if(L(e)&&i===undefined){i=t}i._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,i){i._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}createPositionAt(e,t){return Ra._createAt(e,t)}createPositionAfter(e){return Ra._createAfter(e)}createPositionBefore(e){return Ra._createBefore(e)}createRange(e,t){return new za(e,t)}createRangeOn(e){return za._createOn(e)}createRangeIn(e){return za._createIn(e)}createSelection(e,t,i){return new Ba(e,t,i)}}class yy extends fb{refresh(){this.isEnabled=rw(this.editor.model)}execute(e){const t=this.editor;const i=t.model;const n=t.plugins.get(q_);i.change(t=>{const o=Array.isArray(e.file)?e.file:[e.file];for(const e of o){xy(t,i,n,e)}})}}function xy(e,t,i,n){const o=i.createLoader(n);if(!o){return}sw(e,t,{uploadId:o.id})}class Ay extends db{static get requires(){return[q_,V_,vy]}static get pluginName(){return\"ImageUploadEditing\"}constructor(e){super(e);e.config.define(\"image\",{upload:{types:[\"jpeg\",\"png\",\"gif\",\"bmp\",\"webp\",\"tiff\"]}})}init(){const e=this.editor;const t=e.model.document;const i=e.model.schema;const n=e.conversion;const o=e.plugins.get(q_);const s=Uk(e.config.get(\"image.upload.types\"));i.extend(\"image\",{allowAttributes:[\"uploadId\",\"uploadStatus\"]});e.commands.add(\"imageUpload\",new yy(e));n.for(\"upcast\").attributeToAttribute({view:{name:\"img\",key:\"uploadId\"},model:\"uploadId\"});this.listenTo(e.editing.view.document,\"clipboardInput\",(t,i)=>{if(Cy(i.dataTransfer)){return}const n=Array.from(i.dataTransfer.files).filter(e=>{if(!e){return false}return s.test(e.type)});const o=i.targetRanges.map(t=>e.editing.mapper.toModelRange(t));e.model.change(i=>{i.setSelection(o);if(n.length){t.stop();e.model.enqueueChange(\"default\",()=>{e.execute(\"imageUpload\",{file:n})})}})});this.listenTo(e.plugins.get(vy),\"inputTransformation\",(t,i)=>{const n=Array.from(e.editing.view.createRangeIn(i.content)).filter(e=>$k(e.item)&&!e.item.getAttribute(\"uploadProcessed\")).map(e=>({promise:Wk(e.item),imageElement:e.item}));if(!n.length){return}const s=new ky;for(const e of n){s.setAttribute(\"uploadProcessed\",true,e.imageElement);const t=o.createLoader(e.promise);if(t){s.setAttribute(\"src\",\"\",e.imageElement);s.setAttribute(\"uploadId\",t.id,e.imageElement)}}});e.editing.view.document.on(\"dragover\",(e,t)=>{t.preventDefault()});t.on(\"change\",()=>{const i=t.differ.getChanges({includeChangesInGraveyard:true});for(const t of i){if(t.type==\"insert\"&&t.name!=\"$text\"){const i=t.position.nodeAfter;const n=t.position.root.rootName==\"$graveyard\";for(const t of Ty(e,i)){const e=t.getAttribute(\"uploadId\");if(!e){continue}const i=o.loaders.get(e);if(!i){continue}if(n){i.abort()}else if(i.status==\"idle\"){this._readAndUpload(i,t)}}}}})}_readAndUpload(e,t){const i=this.editor;const n=i.model;const o=i.locale.t;const s=i.plugins.get(q_);const r=i.plugins.get(V_);n.enqueueChange(\"transparent\",e=>{e.setAttribute(\"uploadStatus\",\"reading\",t)});return e.read().then(()=>{const o=e.upload();if(Xa.isSafari){const e=i.editing.mapper.toViewElement(t);const n=e.getChild(0);i.editing.view.once(\"render\",()=>{if(!n.parent){return}const e=i.editing.view.domConverter.mapViewToDom(n.parent);if(!e){return}const t=e.style.display;e.style.display=\"none\";e._ckHack=e.offsetHeight;e.style.display=t})}n.enqueueChange(\"transparent\",e=>{e.setAttribute(\"uploadStatus\",\"uploading\",t)});return o}).then(e=>{n.enqueueChange(\"transparent\",i=>{i.setAttributes({uploadStatus:\"complete\",src:e.default},t);this._parseAndSetSrcsetAttributeOnImage(e,t,i)});a()}).catch(i=>{if(e.status!==\"error\"&&e.status!==\"aborted\"){throw i}if(e.status==\"error\"&&i){r.showWarning(i,{title:o(\"ac\"),namespace:\"upload\"})}a();n.enqueueChange(\"transparent\",e=>{e.remove(t)})});function a(){n.enqueueChange(\"transparent\",e=>{e.removeAttribute(\"uploadId\",t);e.removeAttribute(\"uploadStatus\",t)});s.destroyLoader(e)}}_parseAndSetSrcsetAttributeOnImage(e,t,i){let n=0;const o=Object.keys(e).filter(e=>{const t=parseInt(e,10);if(!isNaN(t)){n=Math.max(n,t);return true}}).map(t=>`${e[t]} ${t}w`).join(\", \");if(o!=\"\"){i.setAttribute(\"srcset\",{data:o,width:n},t)}}}function Cy(e){return Array.from(e.types).includes(\"text/html\")&&e.getData(\"text/html\")!==\"\"}function Ty(e,t){return Array.from(e.model.createRangeOn(t)).filter(e=>e.item.is(\"image\")).map(e=>e.item)}class My extends db{static get pluginName(){return\"ImageUpload\"}static get requires(){return[Ay,Gk,Zk]}}class Py extends fb{constructor(e){super(e);this._childCommands=[]}refresh(){}execute(...e){const t=this._getFirstEnabledCommand();t.execute(e)}registerChildCommand(e){this._childCommands.push(e);e.on(\"change:isEnabled\",()=>this._checkEnabled());this._checkEnabled()}_checkEnabled(){this.isEnabled=!!this._getFirstEnabledCommand()}_getFirstEnabledCommand(){return this._childCommands.find(e=>e.isEnabled)}}class Ey extends db{static get pluginName(){return\"IndentEditing\"}init(){const e=this.editor;e.commands.add(\"indent\",new Py(e));e.commands.add(\"outdent\",new Py(e))}}var Sy='\\n';var Iy='\\n';class Oy extends db{static get pluginName(){return\"IndentUI\"}init(){const e=this.editor;const t=e.locale;const i=e.t;const n=t.uiLanguageDirection==\"ltr\"?Sy:Iy;const o=t.uiLanguageDirection==\"ltr\"?Iy:Sy;this._defineButton(\"indent\",i(\"k\"),n);this._defineButton(\"outdent\",i(\"l\"),o)}_defineButton(e,t,i){const n=this.editor;n.ui.componentFactory.add(e,o=>{const s=n.commands.get(e);const r=new Sp(o);r.set({label:t,icon:i,tooltip:true});r.bind(\"isOn\",\"isEnabled\").to(s,\"value\",\"isEnabled\");this.listenTo(r,\"execute\",()=>n.execute(e));return r})}}class Ny extends db{static get pluginName(){return\"Indent\"}static get requires(){return[Ey,Oy]}}const Ly=\"italic\";class Ry extends db{static get pluginName(){return\"ItalicEditing\"}init(){const e=this.editor;e.model.schema.extend(\"$text\",{allowAttributes:Ly});e.model.schema.setAttributeProperties(Ly,{isFormatting:true,copyOnEnter:true});e.conversion.attributeToElement({model:Ly,view:\"i\",upcastAlso:[\"em\",{styles:{\"font-style\":\"italic\"}}]});e.commands.add(Ly,new Cb(e,Ly));e.keystrokes.set(\"CTRL+I\",Ly)}}var zy='';const jy=\"italic\";class Dy extends db{init(){const e=this.editor;const t=e.t;e.ui.componentFactory.add(jy,i=>{const n=e.commands.get(jy);const o=new Sp(i);o.set({label:t(\"o\"),icon:zy,keystroke:\"CTRL+I\",tooltip:true,isToggleable:true});o.bind(\"isOn\",\"isEnabled\").to(n,\"value\",\"isEnabled\");this.listenTo(o,\"execute\",()=>e.execute(jy));return o})}}class By extends db{static get requires(){return[Ry,Dy]}static get pluginName(){return\"Italic\"}}class Vy extends kd{constructor(e){super(e);this.domEventType=\"click\"}onDomEvent(e){this.fire(e.type,e)}}var Fy=i(76);class Hy extends Qg{constructor(e,t=[]){super(e);const i=e.t;this.focusTracker=new rg;this.keystrokes=new Ym;this.urlInputView=this._createUrlInput();this.saveButtonView=this._createButton(i(\"de\"),Lv,\"ck-button-save\");this.saveButtonView.type=\"submit\";this.cancelButtonView=this._createButton(i(\"df\"),Rv,\"ck-button-cancel\",\"cancel\");this._manualDecoratorSwitches=this._createManualDecoratorSwitches(t);this.children=this._createFormChildren(t);this._focusables=new yg;this._focusCycler=new dp({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:\"shift + tab\",focusNext:\"tab\"}});const n=[\"ck\",\"ck-link-form\"];if(t.length){n.push(\"ck-link-form_layout-vertical\")}this.setTemplate({tag:\"form\",attributes:{class:n,tabindex:\"-1\"},children:this.children})}getDecoratorSwitchesState(){return Array.from(this._manualDecoratorSwitches).reduce((e,t)=>{e[t.name]=t.isOn;return e},{})}render(){super.render();Nv({view:this});const e=[this.urlInputView,...this._manualDecoratorSwitches,this.saveButtonView,this.cancelButtonView];e.forEach(e=>{this._focusables.add(e);this.focusTracker.add(e.element)});this.keystrokes.listenTo(this.element)}focus(){this._focusCycler.focusFirst()}_createUrlInput(){const e=this.locale.t;const t=new Sv(this.locale,Ov);t.label=e(\"eb\");t.inputView.placeholder=\"https://example.com\";return t}_createButton(e,t,i,n){const o=new Sp(this.locale);o.set({label:e,icon:t,tooltip:true});o.extendTemplate({attributes:{class:i}});if(n){o.delegate(\"execute\").to(this,n)}return o}_createManualDecoratorSwitches(e){const t=this.createCollection();for(const i of e){const e=new Dp(this.locale);e.set({name:i.id,label:i.label,withText:true});e.bind(\"isOn\").to(i,\"value\");e.on(\"execute\",()=>{i.set(\"value\",!e.isOn)});t.add(e)}return t}_createFormChildren(e){const t=this.createCollection();t.add(this.urlInputView);if(e.length){const e=new Qg;e.setTemplate({tag:\"ul\",children:this._manualDecoratorSwitches.map(e=>({tag:\"li\",children:[e],attributes:{class:[\"ck\",\"ck-list__item\"]}})),attributes:{class:[\"ck\",\"ck-reset\",\"ck-list\"]}});t.add(e)}t.add(this.saveButtonView);t.add(this.cancelButtonView);return t}}var Uy='';var Wy='';var $y=i(78);class qy extends Qg{constructor(e){super(e);const t=e.t;this.focusTracker=new rg;this.keystrokes=new Ym;this.previewButtonView=this._createPreviewButton();this.unlinkButtonView=this._createButton(t(\"dx\"),Uy,\"unlink\");this.editButtonView=this._createButton(t(\"dy\"),Wy,\"edit\");this.set(\"href\");this._focusables=new yg;this._focusCycler=new dp({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:\"shift + tab\",focusNext:\"tab\"}});this.setTemplate({tag:\"div\",attributes:{class:[\"ck\",\"ck-link-actions\"],tabindex:\"-1\"},children:[this.previewButtonView,this.editButtonView,this.unlinkButtonView]})}render(){super.render();const e=[this.previewButtonView,this.editButtonView,this.unlinkButtonView];e.forEach(e=>{this._focusables.add(e);this.focusTracker.add(e.element)});this.keystrokes.listenTo(this.element)}focus(){this._focusCycler.focusFirst()}_createButton(e,t,i){const n=new Sp(this.locale);n.set({label:e,icon:t,tooltip:true});n.delegate(\"execute\").to(this,i);return n}_createPreviewButton(){const e=new Sp(this.locale);const t=this.bindTemplate;const i=this.t;e.set({withText:true,tooltip:i(\"dz\")});e.extendTemplate({attributes:{class:[\"ck\",\"ck-link-actions__preview\"],href:t.to(\"href\",e=>e&&k_(e)),target:\"_blank\",rel:\"noopener noreferrer\"}});e.bind(\"label\").to(this,\"href\",e=>e||i(\"ea\"));e.bind(\"isEnabled\").to(this,\"href\",e=>!!e);e.template.tag=\"a\";e.template.eventListeners={};return e}}var Yy='';const Gy=\"Ctrl+K\";class Jy extends db{static get requires(){return[Kv]}static get pluginName(){return\"LinkUI\"}init(){const e=this.editor;e.editing.view.addObserver(Vy);this.actionsView=this._createActionsView();this.formView=this._createFormView();this._balloon=e.plugins.get(Kv);this._createToolbarLinkButton();this._enableUserBalloonInteractions()}destroy(){super.destroy();this.formView.destroy()}_createActionsView(){const e=this.editor;const t=new qy(e.locale);const i=e.commands.get(\"link\");const n=e.commands.get(\"unlink\");t.bind(\"href\").to(i,\"value\");t.editButtonView.bind(\"isEnabled\").to(i);t.unlinkButtonView.bind(\"isEnabled\").to(n);this.listenTo(t,\"edit\",()=>{this._addFormView()});this.listenTo(t,\"unlink\",()=>{e.execute(\"unlink\");this._hideUI()});t.keystrokes.set(\"Esc\",(e,t)=>{this._hideUI();t()});t.keystrokes.set(Gy,(e,t)=>{this._addFormView();t()});return t}_createFormView(){const e=this.editor;const t=e.commands.get(\"link\");const i=new Hy(e.locale,t.manualDecorators);i.urlInputView.bind(\"value\").to(t,\"value\");i.urlInputView.bind(\"isReadOnly\").to(t,\"isEnabled\",e=>!e);i.saveButtonView.bind(\"isEnabled\").to(t);this.listenTo(i,\"submit\",()=>{e.execute(\"link\",i.urlInputView.inputView.element.value,i.getDecoratorSwitchesState());this._closeFormView()});this.listenTo(i,\"cancel\",()=>{this._closeFormView()});i.keystrokes.set(\"Esc\",(e,t)=>{this._closeFormView();t()});return i}_createToolbarLinkButton(){const e=this.editor;const t=e.commands.get(\"link\");const i=e.t;e.keystrokes.set(Gy,(e,i)=>{i();if(t.isEnabled){this._showUI(true)}});e.ui.componentFactory.add(\"link\",e=>{const n=new Sp(e);n.isEnabled=true;n.label=i(\"dw\");n.icon=Yy;n.keystroke=Gy;n.tooltip=true;n.isToggleable=true;n.bind(\"isEnabled\").to(t,\"isEnabled\");n.bind(\"isOn\").to(t,\"value\",e=>!!e);this.listenTo(n,\"execute\",()=>this._showUI(true));return n})}_enableUserBalloonInteractions(){const e=this.editor.editing.view.document;this.listenTo(e,\"click\",()=>{const e=this._getSelectedLinkElement();if(e){this._showUI()}});this.editor.keystrokes.set(\"Tab\",(e,t)=>{if(this._areActionsVisible&&!this.actionsView.focusTracker.isFocused){this.actionsView.focus();t()}},{priority:\"high\"});this.editor.keystrokes.set(\"Esc\",(e,t)=>{if(this._isUIVisible){this._hideUI();t()}});Bp({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:[this._balloon.view.element],callback:()=>this._hideUI()})}_addActionsView(){if(this._areActionsInPanel){return}this._balloon.add({view:this.actionsView,position:this._getBalloonPositionData()})}_addFormView(){if(this._isFormInPanel){return}const e=this.editor;const t=e.commands.get(\"link\");this._balloon.add({view:this.formView,position:this._getBalloonPositionData()});if(this._balloon.visibleView===this.formView){this.formView.urlInputView.select()}this.formView.urlInputView.inputView.element.value=t.value||\"\"}_closeFormView(){const e=this.editor.commands.get(\"link\");e.restoreManualDecoratorStates();if(e.value!==undefined){this._removeFormView()}else{this._hideUI()}}_removeFormView(){if(this._isFormInPanel){this.formView.saveButtonView.focus();this._balloon.remove(this.formView);this.editor.editing.view.focus()}}_showUI(e=false){const t=this.editor;const i=t.commands.get(\"link\");if(!i.isEnabled){return}if(!this._getSelectedLinkElement()){this._addActionsView();if(e){this._balloon.showStack(\"main\")}this._addFormView()}else{if(this._areActionsVisible){this._addFormView()}else{this._addActionsView()}if(e){this._balloon.showStack(\"main\")}}this._startUpdatingUI()}_hideUI(){if(!this._isUIInPanel){return}const e=this.editor;this.stopListening(e.ui,\"update\");this.stopListening(this._balloon,\"change:visibleView\");e.editing.view.focus();this._removeFormView();this._balloon.remove(this.actionsView)}_startUpdatingUI(){const e=this.editor;const t=e.editing.view.document;let i=this._getSelectedLinkElement();let n=s();const o=()=>{const e=this._getSelectedLinkElement();const t=s();if(i&&!e||!i&&t!==n){this._hideUI()}else if(this._isUIVisible){this._balloon.updatePosition(this._getBalloonPositionData())}i=e;n=t};function s(){return t.selection.focus.getAncestors().reverse().find(e=>e.is(\"element\"))}this.listenTo(e.ui,\"update\",o);this.listenTo(this._balloon,\"change:visibleView\",o)}get _isFormInPanel(){return this._balloon.hasView(this.formView)}get _areActionsInPanel(){return this._balloon.hasView(this.actionsView)}get _areActionsVisible(){return this._balloon.visibleView===this.actionsView}get _isUIInPanel(){return this._isFormInPanel||this._areActionsInPanel}get _isUIVisible(){const e=this._balloon.visibleView;return e==this.formView||this._areActionsVisible}_getBalloonPositionData(){const e=this.editor.editing.view;const t=e.document;const i=this._getSelectedLinkElement();const n=i?e.domConverter.mapViewToDom(i):e.domConverter.viewRangeToDom(t.selection.getFirstRange());return{target:n}}_getSelectedLinkElement(){const e=this.editor.editing.view;const t=e.document.selection;if(t.isCollapsed){return Ky(t.getFirstPosition())}else{const i=t.getFirstRange().getTrimmed();const n=Ky(i.start);const o=Ky(i.end);if(!n||n!=o){return null}if(e.createRangeIn(n).getTrimmed().isEqual(i)){return n}else{return null}}}}function Ky(e){return e.getAncestors().find(e=>__(e))}class Xy extends db{static get requires(){return[B_,Jy]}static get pluginName(){return\"Link\"}}class Qy extends fb{constructor(e,t){super(e);this.type=t}refresh(){this.value=this._getValue();this.isEnabled=this._checkEnabled()}execute(){const e=this.editor.model;const t=e.document;const i=Array.from(t.selection.getSelectedBlocks()).filter(t=>ex(t,e.schema));const n=this.value===true;e.change(e=>{if(n){let t=i[i.length-1].nextSibling;let n=Number.POSITIVE_INFINITY;let o=[];while(t&&t.name==\"listItem\"&&t.getAttribute(\"listIndent\")!==0){const e=t.getAttribute(\"listIndent\");if(e