|
|
/*!
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md.
|
|
|
*/
|
|
|
!function(e){e.en=Object.assign(e.en||{},{a:"Cannot upload file:",b:"Image toolbar",c:"Table toolbar",d:"Bold",e:"Code",f:"Strikethrough",g:"Italic",h:"Choose heading",i:"Heading",j:"Dropdown toolbar",k:"Upload in progress",l:"Block quote",m:"Cell properties",n:"Insert table",o:"Header column",p:"Insert column left",q:"Insert column right",r:"Delete column",s:"Column",t:"Header row",u:"Insert row below",v:"Insert row above",w:"Delete row",x:"Row",y:"Merge cell up",z:"Merge cell right",aa:"Merge cell down",ab:"Merge cell left",ac:"Split cell vertically",ad:"Split cell horizontally",ae:"Merge cells",af:"Table properties",ag:"Widget toolbar",ah:"Link",ai:"Rich Text Editor, %0",aj:"Editor toolbar",ak:"Show more items",al:"Upload failed",am:"%0 of %1",an:"Previous",ao:"Next",ap:"Undo",aq:"Redo",ar:"Black",as:"Dim grey",at:"Grey",au:"Light grey",av:"White",aw:"Red",ax:"Orange",ay:"Yellow",az:"Light green",ba:"Green",bb:"Aquamarine",bc:"Turquoise",bd:"Light blue",be:"Blue",bf:"Purple",bg:"Open in a new tab",bh:"Downloadable",bi:"Unlink",bj:"Edit link",bk:"Open link in new tab",bl:"This link has no URL",bm:"Save",bn:"Cancel",bo:"Link URL",bp:"None",bq:"Solid",br:"Dotted",bs:"Dashed",bt:"Double",bu:"Groove",bv:"Ridge",bw:"Inset",bx:"Outset",by:'The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".',bz:'The value is invalid. Try "10px" or "2em" or simply "2".',ca:"Border",cb:"Style",cc:"Width",cd:"Color",ce:"Background",cf:"Dimensions",cg:"Height",ch:"Alignment",ci:"Table alignment toolbar",cj:"Align table to the left",ck:"Center table",cl:"Align table to the right",cm:"Padding",cn:"Table cell text alignment",co:"Horizontal text alignment toolbar",cp:"Vertical text alignment toolbar",cq:"Align cell text to the left",cr:"Align cell text to the center",cs:"Align cell text to the right",ct:"Justify cell text",cu:"Align cell text to the top",cv:"Align cell text to the middle",cw:"Align cell text to the bottom",cx:"Paragraph",cy:"Heading 1",cz:"Heading 2",da:"Heading 3",db:"Heading 4",dc:"Heading 5",dd:"Heading 6",de:"Insert image",df:"To-do List",dg:"Numbered List",dh:"Bulleted List",di:"Full size image",dj:"Side image",dk:"Left aligned image",dl:"Centered image",dm:"Right aligned image",dn:"image widget",do:"Enter image caption",dp:"Remove color",dq:"Change image text alternative",dr:"Text alternative"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={})),function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.OPEditor=t():e.OPEditor=t()}(window,(function(){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(o,i,function(t){return e[t]}.bind(null,i));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=178)}([function(e,t,n){"use strict";n.d(t,"b",(function(){return o})),n.d(t,"a",(function(){return i}));class o extends Error{constructor(e,t,n){e=i(e),n&&(e+=" "+JSON.stringify(n)),super(e),this.name="CKEditorError",this.context=t,this.data=n}is(e){return"CKEditorError"===e}static rethrowUnexpectedError(e,t){if(e.is&&e.is("CKEditorError"))throw e;const n=new o(e.message,t);throw n.stack=e.stack,n}}function i(e){const t=e.match(/^([^:]+):/);return t?e+` Read more: https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/error-codes.html#error-${t[1]}\n`:e}},function(e,t,n){"use strict";var o,i=function(){return void 0===o&&(o=Boolean(window&&document&&document.all&&!window.atob)),o},r=function(){var e={};return function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}e[t]=n}return e[t]}}(),s=[];function a(e){for(var t=-1,n=0;n<s.length;n++)if(s[n].identifier===e){t=n;break}return t}function c(e,t){for(var n={},o=[],i=0;i<e.length;i++){var r=e[i],c=t.base?r[0]+t.base:r[0],l=n[c]||0,d="".concat(c," ").concat(l);n[c]=l+1;var u=a(d),h={css:r[1],media:r[2],sourceMap:r[3]};-1!==u?(s[u].references++,s[u].updater(h)):s.push({identifier:d,updater:g(h,t),references:1}),o.push(d)}return o}function l(e){var t=document.createElement("style"),o=e.attributes||{};if(void 0===o.nonce){var i=n.nc;i&&(o.nonce=i)}if(Object.keys(o).forEach((function(e){t.setAttribute(e,o[e])})),"function"==typeof e.insert)e.insert(t);else{var s=r(e.insert||"head");if(!s)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");s.appendChild(t)}return t}var d,u=(d=[],function(e,t){return d[e]=t,d.filter(Boolean).join("\n")});function h(e,t,n,o){var i=n?"":o.media?"@media ".concat(o.media," {").concat(o.css,"}"):o.css;if(e.styleSheet)e.styleSheet.cssText=u(t,i);else{var r=document.createTextNode(i),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(r,s[t]):e.appendChild(r)}}function f(e,t,n){var o=n.css,i=n.media,r=n.sourceMap;if(i?e.setAttribute("media",i):e.removeAttribute("media"),r&&btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),e.styleSheet)e.styleSheet.cssText=o;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(o))}}var p=null,m=0;function g(e,t){var n,o,i;if(t.singleton){var r=m++;n=p||(p=l(t)),o=h.bind(null,n,r,!1),i=h.bind(null,n,r,!0)}else n=l(t),o=f.bind(null,n,t),i=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(n)};return o(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;o(e=t)}else i()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=i());var n=c(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var o=0;o<n.length;o++){var i=a(n[o]);s[i].references--}for(var r=c(e,t),l=0;l<n.length;l++){var d=a(n[l]);0===s[d].references&&(s[d].updater(),s.splice(d,1))}n=r}}}},,function(e,t,n){"use strict";var o=Object.prototype.hasOwnProperty;function i(e,t){return o.call(e,t)}function r(e){return!(e>=55296&&e<=57343)&&(!(e>=64976&&e<=65007)&&(65535!=(65535&e)&&65534!=(65535&e)&&(!(e>=0&&e<=8)&&(11!==e&&(!(e>=14&&e<=31)&&(!(e>=127&&e<=159)&&!(e>1114111)))))))}function s(e){if(e>65535){var t=55296+((e-=65536)>>10),n=56320+(1023&e);return String.fromCharCode(t,n)}return String.fromCharCode(e)}var a=/\\([!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~])/g,c=new RegExp(a.source+"|"+/&([a-z#][a-z0-9]{1,31});/gi.source,"gi"),l=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i,d=n(19);var u=/[&<>"]/,h=/[&<>"]/g,f={"&":"&","<":"<",">":">",'"':"""};function p(e){return f[e]}var m=/[.?*+^$[\]\\(){}|-]/g;var g=n(12);t.lib={},t.lib.mdurl=n(20),t.lib.ucmicro=n(124),t.assign=function(e){var t=Array.prototype.slice.call(arguments,1);return t.forEach((function(t){if(t){if("object"!=typeof t)throw new TypeError(t+"must be object");Object.keys(t).forEach((function(n){e[n]=t[n]}))}})),e},t.isString=function(e){return"[object String]"===function(e){return Object.prototype.toString.call(e)}(e)},t.has=i,t.unescapeMd=function(e){return e.indexOf("\\")<0?e:e.replace(a,"$1")},t.unescapeAll=function(e){return e.indexOf("\\")<0&&e.indexOf("&")<0?e:e.replace(c,(function(e,t,n){return t||function(e,t){var n=0;return i(d,t)?d[t]:35===t.charCodeAt(0)&&l.test(t)&&r(n="x"===t[1].toLowerCase()?parseInt(t.slice(2),16):parseInt(t.slice(1),10))?s(n):e}(e,n)}))},t.isValidEntityCode=r,t.fromCodePoint=s,t.escapeHtml=function(e){return u.test(e)?e.replace(h,p):e},t.arrayReplaceAt=function(e,t,n){return[].concat(e.slice(0,t),n,e.slice(t+1))},t.isSpace=function(e){switch(e){case 9:case 32:return!0}return!1},t.isWhiteSpace=function(e){if(e>=8192&&e<=8202)return!0;switch(e){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1},t.isMdAsciiPunct=function(e){switch(e){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}},t.isPunctChar=function(e){return g.test(e)},t.escapeRE=function(e){return e.replace(m,"\\$&")},t.normalizeReference=function(e){return e=e.trim().replace(/\s+/g," "),"Ṿ"==="ẞ".toLowerCase()&&(e=e.replace(/ẞ/g,"ß")),e.toLowerCase().toUpperCase()}},function(e,t,n){"use strict";var o=n(8),i="object"==typeof self&&self&&self.Object===Object&&self,r=o.a||i||Function("return this")();t.a=r},function(e,t,n){"use strict";(function(e){var o=n(4),i=n(27),r="object"==typeof exports&&exports&&!exports.nodeType&&exports,s=r&&"object"==typeof e&&e&&!e.nodeType&&e,a=s&&s.exports===r?o.a.Buffer:void 0,c=(a?a.isBuffer:void 0)||i.a;t.a=c}).call(this,n(11)(e))},function(e,t,n){"use strict";(function(e){var o=n(8),i="object"==typeof exports&&exports&&!exports.nodeType&&exports,r=i&&"object"==typeof e&&e&&!e.nodeType&&e,s=r&&r.exports===i&&o.a.process,a=function(){try{var e=r&&r.require&&r.require("util").types;return e||s&&s.binding&&s.binding("util")}catch(e){}}();t.a=a}).call(this,n(11)(e))},function(e,t,n){"use strict";(function(e){var t=n(0);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/const o="object"==typeof window?window:e;if(o.CKEDITOR_VERSION)throw new t.b("ckeditor-duplicated-modules: Some CKEditor 5 modules are duplicated.",null);o.CKEDITOR_VERSION="18.0.0"}).call(this,n(10))},function(e,t,n){"use strict";(function(e){var n="object"==typeof e&&e&&e.Object===Object&&e;t.a=n}).call(this,n(10))},function(e,t,n){"use strict";(function(e){var o=n(4),i="object"==typeof exports&&exports&&!exports.nodeType&&exports,r=i&&"object"==typeof e&&e&&!e.nodeType&&e,s=r&&r.exports===i?o.a.Buffer:void 0,a=s?s.allocUnsafe:void 0;t.a=function(e,t){if(t)return e.slice();var n=e.length,o=a?a(n):new e.constructor(n);return e.copy(o),o}}).call(this,n(11)(e))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t){e.exports=function(e){if(!e.webpackPolyfill){var t=Object.create(e);t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),Object.defineProperty(t,"exports",{enumerable:!0}),t.webpackPolyfill=1}return t}},function(e,t){e.exports=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4E\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDF55-\uDF59]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD806[\uDC3B\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/},function(e,t,n){"use strict";function o(){this.__rules__=[],this.__cache__=null}o.prototype.__find__=function(e){for(var t=0;t<this.__rules__.length;t++)if(this.__rules__[t].name===e)return t;return-1},o.prototype.__compile__=function(){var e=this,t=[""];e.__rules__.forEach((function(e){e.enabled&&e.alt.forEach((function(e){t.indexOf(e)<0&&t.push(e)}))})),e.__cache__={},t.forEach((function(t){e.__cache__[t]=[],e.__rules__.forEach((function(n){n.enabled&&(t&&n.alt.indexOf(t)<0||e.__cache__[t].push(n.fn))}))}))},o.prototype.at=function(e,t,n){var o=this.__find__(e),i=n||{};if(-1===o)throw new Error("Parser rule not found: "+e);this.__rules__[o].fn=t,this.__rules__[o].alt=i.alt||[],this.__cache__=null},o.prototype.before=function(e,t,n,o){var i=this.__find__(e),r=o||{};if(-1===i)throw new Error("Parser rule not found: "+e);this.__rules__.splice(i,0,{name:t,enabled:!0,fn:n,alt:r.alt||[]}),this.__cache__=null},o.prototype.after=function(e,t,n,o){var i=this.__find__(e),r=o||{};if(-1===i)throw new Error("Parser rule not found: "+e);this.__rules__.splice(i+1,0,{name:t,enabled:!0,fn:n,alt:r.alt||[]}),this.__cache__=null},o.prototype.push=function(e,t,n){var o=n||{};this.__rules__.push({name:e,enabled:!0,fn:t,alt:o.alt||[]}),this.__cache__=null},o.prototype.enable=function(e,t){Array.isArray(e)||(e=[e]);var n=[];return e.forEach((function(e){var o=this.__find__(e);if(o<0){if(t)return;throw new Error("Rules manager: invalid rule name "+e)}this.__rules__[o].enabled=!0,n.push(e)}),this),this.__cache__=null,n},o.prototype.enableOnly=function(e,t){Array.isArray(e)||(e=[e]),this.__rules__.forEach((function(e){e.enabled=!1})),this.enable(e,t)},o.prototype.disable=function(e,t){Array.isArray(e)||(e=[e]);var n=[];return e.forEach((function(e){var o=this.__find__(e);if(o<0){if(t)return;throw new Error("Rules manager: invalid rule name "+e)}this.__rules__[o].enabled=!1,n.push(e)}),this),this.__cache__=null,n},o.prototype.getRules=function(e){return null===this.__cache__&&this.__compile__(),this.__cache__[e]||[]},e.exports=o},function(e,t,n){"use strict";function o(e,t,n){this.type=e,this.tag=t,this.attrs=null,this.map=null,this.nesting=n,this.level=0,this.children=null,this.content="",this.markup="",this.info="",this.meta=null,this.block=!1,this.hidden=!1}o.prototype.attrIndex=function(e){var t,n,o;if(!this.attrs)return-1;for(n=0,o=(t=this.attrs).length;n<o;n++)if(t[n][0]===e)return n;return-1},o.prototype.attrPush=function(e){this.attrs?this.attrs.push(e):this.attrs=[e]},o.prototype.attrSet=function(e,t){var n=this.attrIndex(e),o=[e,t];n<0?this.attrPush(o):this.attrs[n]=o},o.prototype.attrGet=function(e){var t=this.attrIndex(e),n=null;return t>=0&&(n=this.attrs[t][1]),n},o.prototype.attrJoin=function(e,t){var n=this.attrIndex(e);n<0?this.attrPush([e,t]):this.attrs[n][1]=this.attrs[n][1]+" "+t},e.exports=o},function(e,t,n){var o=n(1),i=n(66);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t,n){var o=n(1),i=n(69);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t,n){var o=n(1),i=n(108);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t,n){var o=n(1),i=n(109);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t,n){"use strict";e.exports=n(119)},function(e,t,n){"use strict";e.exports.encode=n(120),e.exports.decode=n(121),e.exports.format=n(122),e.exports.parse=n(123)},function(e,t){e.exports=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/},function(e,t){e.exports=/[\0-\x1F\x7F-\x9F]/},function(e,t){e.exports=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/},function(e,t,n){"use strict";var o="<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*\\/?>",i="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",r=new RegExp("^(?:"+o+"|"+i+"|\x3c!----\x3e|\x3c!--(?:-?[^>-])(?:-?[^-])*--\x3e|<[?].*?[?]>|<![A-Z]+\\s+[^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)"),s=new RegExp("^(?:"+o+"|"+i+")");e.exports.HTML_TAG_RE=r,e.exports.HTML_OPEN_CLOSE_TAG_RE=s},function(e,t,n){"use strict";function o(e,t){var n,o,i,r,s,a=[],c=t.length;for(n=0;n<c;n++)126===(i=t[n]).marker&&-1!==i.end&&(r=t[i.end],(s=e.tokens[i.token]).type="s_open",s.tag="s",s.nesting=1,s.markup="~~",s.content="",(s=e.tokens[r.token]).type="s_close",s.tag="s",s.nesting=-1,s.markup="~~",s.content="","text"===e.tokens[r.token-1].type&&"~"===e.tokens[r.token-1].content&&a.push(r.token-1));for(;a.length;){for(o=(n=a.pop())+1;o<e.tokens.length&&"s_close"===e.tokens[o].type;)o++;n!==--o&&(s=e.tokens[o],e.tokens[o]=e.tokens[n],e.tokens[n]=s)}}e.exports.tokenize=function(e,t){var n,o,i,r,s=e.pos,a=e.src.charCodeAt(s);if(t)return!1;if(126!==a)return!1;if(i=(o=e.scanDelims(e.pos,!0)).length,r=String.fromCharCode(a),i<2)return!1;for(i%2&&(e.push("text","",0).content=r,i--),n=0;n<i;n+=2)e.push("text","",0).content=r+r,e.delimiters.push({marker:a,length:0,jump:n,token:e.tokens.length-1,end:-1,open:o.can_open,close:o.can_close});return e.pos+=o.length,!0},e.exports.postProcess=function(e){var t,n=e.tokens_meta,i=e.tokens_meta.length;for(o(e,e.delimiters),t=0;t<i;t++)n[t]&&n[t].delimiters&&o(e,n[t].delimiters)}},function(e,t,n){"use strict";function o(e,t){var n,o,i,r,s,a;for(n=t.length-1;n>=0;n--)95!==(o=t[n]).marker&&42!==o.marker||-1!==o.end&&(i=t[o.end],a=n>0&&t[n-1].end===o.end+1&&t[n-1].token===o.token-1&&t[o.end+1].token===i.token+1&&t[n-1].marker===o.marker,s=String.fromCharCode(o.marker),(r=e.tokens[o.token]).type=a?"strong_open":"em_open",r.tag=a?"strong":"em",r.nesting=1,r.markup=a?s+s:s,r.content="",(r=e.tokens[i.token]).type=a?"strong_close":"em_close",r.tag=a?"strong":"em",r.nesting=-1,r.markup=a?s+s:s,r.content="",a&&(e.tokens[t[n-1].token].content="",e.tokens[t[o.end+1].token].content="",n--))}e.exports.tokenize=function(e,t){var n,o,i=e.pos,r=e.src.charCodeAt(i);if(t)return!1;if(95!==r&&42!==r)return!1;for(o=e.scanDelims(e.pos,42===r),n=0;n<o.length;n++)e.push("text","",0).content=String.fromCharCode(r),e.delimiters.push({marker:r,length:o.length,jump:n,token:e.tokens.length-1,end:-1,open:o.can_open,close:o.can_close});return e.pos+=o.length,!0},e.exports.postProcess=function(e){var t,n=e.tokens_meta,i=e.tokens_meta.length;for(o(e,e.delimiters),t=0;t<i;t++)n[t]&&n[t].delimiters&&o(e,n[t].delimiters)}},function(e,t,n){"use strict";t.a=function(){return!1}},function(e,t,n){var o=n(1),i=n(29);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=".ck.ck-placeholder:before,.ck .ck-placeholder:before{content:attr(data-placeholder);pointer-events:none}.ck.ck-read-only .ck-placeholder:before{display:none}.ck.ck-placeholder:before,.ck .ck-placeholder:before{cursor:text;color:var(--ck-color-engine-placeholder-text)}"},function(e,t,n){var o=n(1),i=n(31);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=".ck-hidden{display:none!important}.ck.ck-reset,.ck.ck-reset_all,.ck.ck-reset_all *{box-sizing:border-box;width:auto;height:auto;position:static}:root{--ck-z-default:1;--ck-z-modal:calc(var(--ck-z-default) + 999);--ck-color-base-foreground:#fafafa;--ck-color-base-background:#fff;--ck-color-base-border:#c4c4c4;--ck-color-base-action:#61b045;--ck-color-base-focus:#6cb5f9;--ck-color-base-text:#333;--ck-color-base-active:#198cf0;--ck-color-base-active-focus:#0e7fe1;--ck-color-base-error:#db3700;--ck-color-focus-border:#1f89e5;--ck-color-focus-outer-shadow:#bcdefb;--ck-color-focus-disabled-shadow:rgba(119,186,248,0.3);--ck-color-focus-error-shadow:rgba(255,64,31,0.3);--ck-color-text:var(--ck-color-base-text);--ck-color-shadow-drop:rgba(0,0,0,0.15);--ck-color-shadow-drop-active:rgba(0,0,0,0.2);--ck-color-shadow-inner:rgba(0,0,0,0.1);--ck-color-button-default-background:transparent;--ck-color-button-default-hover-background:#e6e6e6;--ck-color-button-default-active-background:#d9d9d9;--ck-color-button-default-active-shadow:#bfbfbf;--ck-color-button-default-disabled-background:transparent;--ck-color-button-on-background:#dedede;--ck-color-button-on-hover-background:#c4c4c4;--ck-color-button-on-active-background:#bababa;--ck-color-button-on-active-shadow:#a1a1a1;--ck-color-button-on-disabled-background:#dedede;--ck-color-button-action-background:var(--ck-color-base-action);--ck-color-button-action-hover-background:#579e3d;--ck-color-button-action-active-background:#53973b;--ck-color-button-action-active-shadow:#498433;--ck-color-button-action-disabled-background:#7ec365;--ck-color-button-action-text:var(--ck-color-base-background);--ck-color-button-save:#008a00;--ck-color-button-cancel:#db3700;--ck-color-switch-button-off-background:#b0b0b0;--ck-color-switch-button-off-hover-background:#a3a3a3;--ck-color-switch-button-on-background:var(--ck-color-button-action-background);--ck-color-switch-button-on-hover-background:#579e3d;--ck-color-switch-button-inner-background:var(--ck-color-base-background);--ck-color-switch-button-inner-shadow:rgba(0,0,0,0.1);--ck-color-dropdown-panel-background:var(--ck-color-base-background);--ck-color-dropdown-panel-border:var(--ck-color-base-border);--ck-color-input-background:var(--ck-color-base-background);--ck-color-input-border:#c7c7c7;--ck-color-input-error-border:var(--ck-color-base-error);--ck-color-input-text:var(--ck-color-base-text);--ck-color-input-disabled-background:#f2f2f2;--ck-color-input-disabled-border:#c7c7c7;--ck-color-input-disabled-text:#5c5c5c;--ck-color-list-background:var(--ck-color-base-background);--ck-color-list-button-hover-background:var(--ck-color-button-default-hover-background);--ck-color-list-button-on-background:var(--ck-color-base-active);--ck-color-list-button-on-background-focus:var(--ck-color-base-active-focus);--ck-color-list-button-on-text:var(--ck-color-base-background);--ck-color-panel-background:var(--ck-color-base-background);--ck-color-panel-border:var(--ck-color-base-border);--ck-color-toolbar-background:var(--ck-color-base-foreground);--ck-color-toolbar-border:var(--ck-color-base-border);--ck-color-tooltip-background:var(--ck-color-base-text);--ck-color-tooltip-text:var(--ck-color-base-background);--ck-color-engine-placeholder-text:#707070;--ck-color-upload-bar-background:#6cb5f9;--ck-color-link-default:#0000f0;--ck-color-link-selected-background:rgba(31,177,255,0.1);--ck-disabled-opacity:.5;--ck-focus-outer-shadow-geometry:0 0 0 3px;--ck-focus-outer-shadow:var(--ck-focus-outer-shadow-geometry) var(--ck-color-focus-outer-shadow);--ck-focus-disabled-outer-shadow:var(--ck-focus-outer-shadow-geometry) var(--ck-color-focus-disabled-shadow);--ck-focus-error-outer-shadow:var(--ck-focus-outer-shadow-geometry) var(--ck-color-focus-error-shadow);--ck-focus-ring:1px solid var(--ck-color-focus-border);--ck-font-size-base:13px;--ck-line-height-base:1.84615;--ck-font-face:Helvetica,Arial,Tahoma,Verdana,Sans-Serif;--ck-font-size-tiny:0.7em;--ck-font-size-small:0.75em;--ck-font-size-normal:1em;--ck-font-size-big:1.4em;--ck-font-size-large:1.8em;--ck-ui-component-min-height:2.3em}.ck.ck-reset,.ck.ck-reset_all,.ck.ck-reset_all *{margin:0;padding:0;border:0;background:transparent;text-decoration:none;vertical-align:middle;transition:none;word-wrap:break-word}.ck.ck-reset_all,.ck.ck-reset_all *{border-collapse:collapse;font:normal normal normal var(--ck-font-size-base)/var(--ck-line-height-base) var(--ck-font-face);color:var(--ck-color-text);text-align:left;white-space:nowrap;cursor:auto;float:none}.ck.ck-reset_all .ck-rtl *{text-align:right}.ck.ck-reset_all iframe{vertical-align:inherit}.ck.ck-reset_all textarea{white-space:pre-wrap}.ck.ck-reset_all input[type=password],.ck.ck-reset_all input[type=text],.ck.ck-reset_all textarea{cursor:text}.ck.ck-reset_all input[type=password][disabled],.ck.ck-reset_all input[type=text][disabled],.ck.ck-reset_all textarea[disabled]{cursor:default}.ck.ck-reset_all fieldset{padding:10px;border:2px groove #dfdee3}.ck.ck-reset_all button::-moz-focus-inner{padding:0;border:0}.ck[dir=rtl],.ck[dir=rtl] .ck{text-align:right}:root{--ck-border-radius:2px;--ck-inner-shadow:2px 2px 3px var(--ck-color-shadow-inner) inset;--ck-drop-shadow:0 1px 2px 1px var(--ck-color-shadow-drop);--ck-drop-shadow-active:0 3px 6px 1px var(--ck-color-shadow-drop-active);--ck-spacing-unit:0.6em;--ck-spacing-large:calc(var(--ck-spacing-unit)*1.5);--ck-spacing-standard:var(--ck-spacing-unit);--ck-spacing-medium:calc(var(--ck-spacing-unit)*0.8);--ck-spacing-small:calc(var(--ck-spacing-unit)*0.5);--ck-spacing-tiny:calc(var(--ck-spacing-unit)*0.3);--ck-spacing-extra-tiny:calc(var(--ck-spacing-unit)*0.16)}"},function(e,t,n){var o=n(1),i=n(33);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=".ck.ck-editor__editable:not(.ck-editor__nested-editable){border-radius:0}.ck-rounded-corners .ck.ck-editor__editable:not(.ck-editor__nested-editable),.ck.ck-editor__editable:not(.ck-editor__nested-editable).ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-editor__editable:not(.ck-editor__nested-editable).ck-focused{outline:none;border:var(--ck-focus-ring);box-shadow:var(--ck-inner-shadow),0 0}.ck.ck-editor__editable_inline{overflow:auto;padding:0 var(--ck-spacing-standard);border:1px solid transparent}.ck.ck-editor__editable_inline[dir=ltr]{text-align:left}.ck.ck-editor__editable_inline[dir=rtl]{text-align:right}.ck.ck-editor__editable_inline>:first-child{margin-top:var(--ck-spacing-large)}.ck.ck-editor__editable_inline>:last-child{margin-bottom:var(--ck-spacing-large)}.ck.ck-balloon-panel.ck-toolbar-container[class*=arrow_n]:after{border-bottom-color:var(--ck-color-base-foreground)}.ck.ck-balloon-panel.ck-toolbar-container[class*=arrow_s]:after{border-top-color:var(--ck-color-base-foreground)}"},function(e,t,n){var o=n(1),i=n(35);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=".ck.ck-dropdown{display:inline-block;position:relative}.ck.ck-dropdown .ck-dropdown__arrow{pointer-events:none;z-index:var(--ck-z-default)}.ck.ck-dropdown .ck-button.ck-dropdown__button{width:100%}.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-on .ck-tooltip{display:none}.ck.ck-dropdown .ck-dropdown__panel{-webkit-backface-visibility:hidden;display:none;z-index:var(--ck-z-modal);position:absolute}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel-visible{display:inline-block}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_ne,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_nw{bottom:100%}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_se,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_sw{top:100%;bottom:auto}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_ne,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_se{left:0}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_nw,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_sw{right:0}:root{--ck-dropdown-arrow-size:calc(0.5*var(--ck-icon-size))}.ck.ck-dropdown{font-size:inherit}.ck.ck-dropdown .ck-dropdown__arrow{width:var(--ck-dropdown-arrow-size)}[dir=ltr] .ck.ck-dropdown .ck-dropdown__arrow{right:var(--ck-spacing-standard);margin-left:var(--ck-spacing-small)}[dir=rtl] .ck.ck-dropdown .ck-dropdown__arrow{left:var(--ck-spacing-standard);margin-right:var(--ck-spacing-small)}.ck.ck-dropdown.ck-disabled .ck-dropdown__arrow{opacity:var(--ck-disabled-opacity)}[dir=ltr] .ck.ck-dropdown .ck-button.ck-dropdown__button:not(.ck-button_with-text){padding-left:var(--ck-spacing-small)}[dir=rtl] .ck.ck-dropdown .ck-button.ck-dropdown__button:not(.ck-button_with-text){padding-right:var(--ck-spacing-small)}.ck.ck-dropdown .ck-button.ck-dropdown__button .ck-button__label{width:7em;overflow:hidden;text-overflow:ellipsis}.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-disabled .ck-button__label{opacity:var(--ck-disabled-opacity)}.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-on{border-bottom-left-radius:0;border-bottom-right-radius:0}.ck.ck-dropdown__panel{border-radius:0}.ck-rounded-corners .ck.ck-dropdown__panel,.ck.ck-dropdown__panel.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-dropdown__panel{box-shadow:var(--ck-drop-shadow),0 0;background:var(--ck-color-dropdown-panel-background);border:1px solid var(--ck-color-dropdown-panel-border);bottom:0;min-width:100%}.ck.ck-dropdown__panel.ck-dropdown__panel_se{border-top-left-radius:0}.ck.ck-dropdown__panel.ck-dropdown__panel_sw{border-top-right-radius:0}.ck.ck-dropdown__panel.ck-dropdown__panel_ne{border-bottom-left-radius:0}.ck.ck-dropdown__panel.ck-dropdown__panel_nw{border-bottom-right-radius:0}"},function(e,t,n){var o=n(1),i=n(37);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=".ck.ck-icon{vertical-align:middle}:root{--ck-icon-size:calc(var(--ck-line-height-base)*var(--ck-font-size-normal))}.ck.ck-icon{width:var(--ck-icon-size);height:var(--ck-icon-size);font-size:.8333350694em;will-change:transform}.ck.ck-icon,.ck.ck-icon *{color:inherit;cursor:inherit}.ck.ck-icon :not([fill]){fill:currentColor}"},function(e,t,n){var o=n(1),i=n(39);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports='.ck.ck-tooltip,.ck.ck-tooltip .ck-tooltip__text:after{position:absolute;pointer-events:none;-webkit-backface-visibility:hidden}.ck.ck-tooltip{visibility:hidden;opacity:0;display:none;z-index:var(--ck-z-modal)}.ck.ck-tooltip .ck-tooltip__text{display:inline-block}.ck.ck-tooltip .ck-tooltip__text:after{content:"";width:0;height:0}:root{--ck-tooltip-arrow-size:5px}.ck.ck-tooltip{left:50%;top:0;transition:opacity .2s ease-in-out .2s}.ck.ck-tooltip .ck-tooltip__text{border-radius:0}.ck-rounded-corners .ck.ck-tooltip .ck-tooltip__text,.ck.ck-tooltip .ck-tooltip__text.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-tooltip .ck-tooltip__text{font-size:.9em;line-height:1.5;color:var(--ck-color-tooltip-text);padding:var(--ck-spacing-small) var(--ck-spacing-medium);background:var(--ck-color-tooltip-background);position:relative;left:-50%}.ck.ck-tooltip .ck-tooltip__text:after{transition:opacity .2s ease-in-out .2s;border-style:solid;left:50%}.ck.ck-tooltip.ck-tooltip_s{bottom:calc(-1*var(--ck-tooltip-arrow-size));transform:translateY(100%)}.ck.ck-tooltip.ck-tooltip_s .ck-tooltip__text:after{top:calc(-1*var(--ck-tooltip-arrow-size));transform:translateX(-50%);border-left-color:transparent;border-bottom-color:var(--ck-color-tooltip-background);border-right-color:transparent;border-top-color:transparent;border-left-width:var(--ck-tooltip-arrow-size);border-bottom-width:var(--ck-tooltip-arrow-size);border-right-width:var(--ck-tooltip-arrow-size);border-top-width:0}.ck.ck-tooltip.ck-tooltip_n{top:calc(-1*var(--ck-tooltip-arrow-size));transform:translateY(-100%)}.ck.ck-tooltip.ck-tooltip_n .ck-tooltip__text:after{bottom:calc(-1*var(--ck-tooltip-arrow-size));transform:translateX(-50%);border-left-color:transparent;border-bottom-color:transparent;border-right-color:transparent;border-top-color:var(--ck-color-tooltip-background);border-left-width:var(--ck-tooltip-arrow-size);border-bottom-width:0;border-right-width:var(--ck-tooltip-arrow-size);border-top-width:var(--ck-tooltip-arrow-size)}'},function(e,t,n){var o=n(1),i=n(41);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=".ck.ck-button,a.ck.ck-button{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.ck.ck-button .ck-tooltip,a.ck.ck-button .ck-tooltip{display:block}@media (hover:none){.ck.ck-button .ck-tooltip,a.ck.ck-button .ck-tooltip{display:none}}.ck.ck-button,a.ck.ck-button{position:relative;display:inline-flex;align-items:center;justify-content:left}.ck.ck-button .ck-button__label,a.ck.ck-button .ck-button__label{display:none}.ck.ck-button.ck-button_with-text .ck-button__label,a.ck.ck-button.ck-button_with-text .ck-button__label{display:inline-block}.ck.ck-button:not(.ck-button_with-text),a.ck.ck-button:not(.ck-button_with-text){justify-content:center}.ck.ck-button:hover .ck-tooltip,a.ck.ck-button:hover .ck-tooltip{visibility:visible;opacity:1}.ck.ck-button:focus:not(:hover) .ck-tooltip,a.ck.ck-button:focus:not(:hover) .ck-tooltip{display:none}.ck.ck-button,a.ck.ck-button{background:var(--ck-color-button-default-background)}.ck.ck-button:not(.ck-disabled):hover,a.ck.ck-button:not(.ck-disabled):hover{background:var(--ck-color-button-default-hover-background)}.ck.ck-button:not(.ck-disabled):active,a.ck.ck-button:not(.ck-disabled):active{background:var(--ck-color-button-default-active-background);box-shadow:inset 0 2px 2px var(--ck-color-button-default-active-shadow)}.ck.ck-button.ck-disabled,a.ck.ck-button.ck-disabled{background:var(--ck-color-button-default-disabled-background)}.ck.ck-button,a.ck.ck-button{border-radius:0}.ck-rounded-corners .ck.ck-button,.ck-rounded-corners a.ck.ck-button,.ck.ck-button.ck-rounded-corners,a.ck.ck-button.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-button,a.ck.ck-button{white-space:nowrap;cursor:default;vertical-align:middle;padding:var(--ck-spacing-tiny);text-align:center;min-width:var(--ck-ui-component-min-height);min-height:var(--ck-ui-component-min-height);line-height:1;font-size:inherit;border:1px solid transparent;transition:box-shadow .2s ease-in-out,border .2s ease-in-out;-webkit-appearance:none}.ck.ck-button:active,.ck.ck-button:focus,a.ck.ck-button:active,a.ck.ck-button:focus{outline:none;border:var(--ck-focus-ring);box-shadow:var(--ck-focus-outer-shadow),0 0}.ck.ck-button .ck-button__icon use,.ck.ck-button .ck-button__icon use *,a.ck.ck-button .ck-button__icon use,a.ck.ck-button .ck-button__icon use *{color:inherit}.ck.ck-button .ck-button__label,a.ck.ck-button .ck-button__label{font-size:inherit;font-weight:inherit;color:inherit;cursor:inherit;vertical-align:middle}[dir=ltr] .ck.ck-button .ck-button__label,[dir=ltr] a.ck.ck-button .ck-button__label{text-align:left}[dir=rtl] .ck.ck-button .ck-button__label,[dir=rtl] a.ck.ck-button .ck-button__label{text-align:right}.ck.ck-button .ck-button__keystroke,a.ck.ck-button .ck-button__keystroke{color:inherit}[dir=ltr] .ck.ck-button .ck-button__keystroke,[dir=ltr] a.ck.ck-button .ck-button__keystroke{margin-left:var(--ck-spacing-large)}[dir=rtl] .ck.ck-button .ck-button__keystroke,[dir=rtl] a.ck.ck-button .ck-button__keystroke{margin-right:var(--ck-spacing-large)}.ck.ck-button .ck-button__keystroke,a.ck.ck-button .ck-button__keystroke{font-weight:700;opacity:.7}.ck.ck-button.ck-disabled:active,.ck.ck-button.ck-disabled:focus,a.ck.ck-button.ck-disabled:active,a.ck.ck-button.ck-disabled:focus{box-shadow:var(--ck-focus-disabled-outer-shadow),0 0}.ck.ck-button.ck-disabled .ck-button__icon,a.ck.ck-button.ck-disabled .ck-button__icon{opacity:var(--ck-disabled-opacity)}.ck.ck-button.ck-disabled .ck-button__label,a.ck.ck-button.ck-disabled .ck-button__label{opacity:var(--ck-disabled-opacity)}.ck.ck-button.ck-disabled .ck-button__keystroke,a.ck.ck-button.ck-disabled .ck-button__keystroke{opacity:.3}.ck.ck-button.ck-button_with-text,a.ck.ck-button.ck-button_with-text{padding:var(--ck-spacing-tiny) var(--ck-spacing-standard)}[dir=ltr] .ck.ck-button.ck-button_with-text .ck-button__icon,[dir=ltr] a.ck.ck-button.ck-button_with-text .ck-button__icon{margin-left:calc(-1*var(--ck-spacing-small));margin-right:var(--ck-spacing-small)}[dir=rtl] .ck.ck-button.ck-button_with-text .ck-button__icon,[dir=rtl] a.ck.ck-button.ck-button_with-text .ck-button__icon{margin-right:calc(-1*var(--ck-spacing-small));margin-left:var(--ck-spacing-small)}.ck.ck-button.ck-button_with-keystroke .ck-button__label,a.ck.ck-button.ck-button_with-keystroke .ck-button__label{flex-grow:1}.ck.ck-button.ck-on,a.ck.ck-button.ck-on{background:var(--ck-color-button-on-background)}.ck.ck-button.ck-on:not(.ck-disabled):hover,a.ck.ck-button.ck-on:not(.ck-disabled):hover{background:var(--ck-color-button-on-hover-background)}.ck.ck-button.ck-on:not(.ck-disabled):active,a.ck.ck-button.ck-on:not(.ck-disabled):active{background:var(--ck-color-button-on-active-background);box-shadow:inset 0 2px 2px var(--ck-color-button-on-active-shadow)}.ck.ck-button.ck-on.ck-disabled,a.ck.ck-button.ck-on.ck-disabled{background:var(--ck-color-button-on-disabled-background)}.ck.ck-button.ck-button-save,a.ck.ck-button.ck-button-save{color:var(--ck-color-button-save)}.ck.ck-button.ck-button-cancel,a.ck.ck-button.ck-button-cancel{color:var(--ck-color-button-cancel)}.ck.ck-button-action,a.ck.ck-button-action{background:var(--ck-color-button-action-background)}.ck.ck-button-action:not(.ck-disabled):hover,a.ck.ck-button-action:not(.ck-disabled):hover{background:var(--ck-color-button-action-hover-background)}.ck.ck-button-action:not(.ck-disabled):active,a.ck.ck-button-action:not(.ck-disabled):active{background:var(--ck-color-button-action-active-background);box-shadow:inset 0 2px 2px var(--ck-color-button-action-active-shadow)}.ck.ck-button-action.ck-disabled,a.ck.ck-button-action.ck-disabled{background:var(--ck-color-button-action-disabled-background)}.ck.ck-button-action,a.ck.ck-button-action{color:var(--ck-color-button-action-text)}.ck.ck-button-bold,a.ck.ck-button-bold{font-weight:700}"},function(e,t,n){var o=n(1),i=n(43);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=".ck.ck-list{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none;display:flex;flex-direction:column}.ck.ck-list .ck-list__item,.ck.ck-list .ck-list__separator{display:block}.ck.ck-list .ck-list__item>:focus{position:relative;z-index:var(--ck-z-default)}.ck.ck-list{border-radius:0}.ck-rounded-corners .ck.ck-list,.ck.ck-list.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-list{list-style-type:none;background:var(--ck-color-list-background)}.ck.ck-list__item{cursor:default;min-width:12em}.ck.ck-list__item .ck-button{min-height:unset;width:100%;text-align:left;border-radius:0;padding:calc(0.2*var(--ck-line-height-base)*var(--ck-font-size-base)) calc(0.4*var(--ck-line-height-base)*var(--ck-font-size-base))}.ck.ck-list__item .ck-button .ck-button__label{line-height:calc(1.2*var(--ck-line-height-base)*var(--ck-font-size-base))}.ck.ck-list__item .ck-button:active{box-shadow:none}.ck.ck-list__item .ck-button.ck-on{background:var(--ck-color-list-button-on-background);color:var(--ck-color-list-button-on-text)}.ck.ck-list__item .ck-button.ck-on:active{box-shadow:none}.ck.ck-list__item .ck-button.ck-on:hover:not(.ck-disabled){background:var(--ck-color-list-button-on-background-focus)}.ck.ck-list__item .ck-button.ck-on:focus:not(.ck-disabled){border-color:var(--ck-color-base-background)}.ck.ck-list__item .ck-button:hover:not(.ck-disabled){background:var(--ck-color-list-button-hover-background)}.ck.ck-list__item .ck-switchbutton.ck-on{background:var(--ck-color-list-background);color:inherit}.ck.ck-list__item .ck-switchbutton.ck-on:hover:not(.ck-disabled){background:var(--ck-color-list-button-hover-background);color:inherit}.ck.ck-list__separator{height:1px;width:100%;background:var(--ck-color-base-border)}"},function(e,t,n){var o=n(1),i=n(45);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=".ck.ck-button.ck-switchbutton .ck-button__toggle,.ck.ck-button.ck-switchbutton .ck-button__toggle .ck-button__toggle__inner{display:block}:root{--ck-switch-button-toggle-width:2.6153846154em;--ck-switch-button-toggle-inner-size:1.0769230769em;--ck-switch-button-toggle-spacing:1px;--ck-switch-button-translation:1.3846153847em}[dir=ltr] .ck.ck-button.ck-switchbutton .ck-button__label{margin-right:calc(2*var(--ck-spacing-large))}[dir=rtl] .ck.ck-button.ck-switchbutton .ck-button__label{margin-left:calc(2*var(--ck-spacing-large))}.ck.ck-button.ck-switchbutton .ck-button__toggle{border-radius:0}.ck-rounded-corners .ck.ck-button.ck-switchbutton .ck-button__toggle,.ck.ck-button.ck-switchbutton .ck-button__toggle.ck-rounded-corners{border-radius:var(--ck-border-radius)}[dir=ltr] .ck.ck-button.ck-switchbutton .ck-button__toggle{margin-left:auto}[dir=rtl] .ck.ck-button.ck-switchbutton .ck-button__toggle{margin-right:auto}.ck.ck-button.ck-switchbutton .ck-button__toggle{transition:background .4s ease;width:var(--ck-switch-button-toggle-width);background:var(--ck-color-switch-button-off-background)}.ck.ck-button.ck-switchbutton .ck-button__toggle .ck-button__toggle__inner{border-radius:0}.ck-rounded-corners .ck.ck-button.ck-switchbutton .ck-button__toggle .ck-button__toggle__inner,.ck.ck-button.ck-switchbutton .ck-button__toggle .ck-button__toggle__inner.ck-rounded-corners{border-radius:var(--ck-border-radius);border-radius:calc(0.5*var(--ck-border-radius))}.ck.ck-button.ck-switchbutton .ck-button__toggle .ck-button__toggle__inner{margin:var(--ck-switch-button-toggle-spacing);width:var(--ck-switch-button-toggle-inner-size);height:var(--ck-switch-button-toggle-inner-size);background:var(--ck-color-switch-button-inner-background);transition:all .3s ease}.ck.ck-button.ck-switchbutton .ck-button__toggle:hover{background:var(--ck-color-switch-button-off-hover-background)}.ck.ck-button.ck-switchbutton .ck-button__toggle:hover .ck-button__toggle__inner{box-shadow:0 0 0 5px var(--ck-color-switch-button-inner-shadow)}.ck.ck-button.ck-switchbutton.ck-disabled .ck-button__toggle{opacity:var(--ck-disabled-opacity)}.ck.ck-button.ck-switchbutton.ck-on .ck-button__toggle{background:var(--ck-color-switch-button-on-background)}.ck.ck-button.ck-switchbutton.ck-on .ck-button__toggle:hover{background:var(--ck-color-switch-button-on-hover-background)}[dir=ltr] .ck.ck-button.ck-switchbutton.ck-on .ck-button__toggle .ck-button__toggle__inner{transform:translateX(var(--ck-switch-button-translation))}[dir=rtl] .ck.ck-button.ck-switchbutton.ck-on .ck-button__toggle .ck-button__toggle__inner{transform:translateX(calc(-1*var(--ck-switch-button-translation)))}"},function(e,t,n){var o=n(1),i=n(47);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=".ck.ck-toolbar-dropdown .ck.ck-toolbar .ck.ck-toolbar__items{flex-wrap:nowrap}.ck.ck-toolbar-dropdown .ck-dropdown__panel .ck-button:focus{z-index:calc(var(--ck-z-default) + 1)}.ck.ck-toolbar-dropdown .ck-toolbar{border:0}"},function(e,t,n){var o=n(1),i=n(49);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=".ck.ck-dropdown .ck-dropdown__panel .ck-list{border-radius:0}.ck-rounded-corners .ck.ck-dropdown .ck-dropdown__panel .ck-list,.ck.ck-dropdown .ck-dropdown__panel .ck-list.ck-rounded-corners{border-radius:var(--ck-border-radius);border-top-left-radius:0}.ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:first-child .ck-button{border-radius:0}.ck-rounded-corners .ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:first-child .ck-button,.ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:first-child .ck-button.ck-rounded-corners{border-radius:var(--ck-border-radius);border-top-left-radius:0;border-bottom-left-radius:0;border-bottom-right-radius:0}.ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:last-child .ck-button{border-radius:0}.ck-rounded-corners .ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:last-child .ck-button,.ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:last-child .ck-button.ck-rounded-corners{border-radius:var(--ck-border-radius);border-top-left-radius:0;border-top-right-radius:0}"},function(e,t,n){var o=n(1),i=n(51);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=".ck.ck-toolbar{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none;display:flex;flex-flow:row nowrap;align-items:center}.ck.ck-toolbar>.ck-toolbar__items{display:flex;flex-flow:row wrap;align-items:center;flex-grow:1}.ck.ck-toolbar .ck.ck-toolbar__separator{display:inline-block}.ck.ck-toolbar .ck.ck-toolbar__separator:first-child,.ck.ck-toolbar .ck.ck-toolbar__separator:last-child{display:none}.ck.ck-toolbar.ck-toolbar_grouping>.ck-toolbar__items{flex-wrap:nowrap}.ck.ck-toolbar.ck-toolbar_vertical>.ck-toolbar__items{flex-direction:column}.ck.ck-toolbar.ck-toolbar_floating>.ck-toolbar__items{flex-wrap:nowrap}.ck.ck-toolbar>.ck.ck-toolbar__grouped-dropdown>.ck-dropdown__button .ck-dropdown__arrow{display:none}.ck.ck-toolbar{border-radius:0}.ck-rounded-corners .ck.ck-toolbar,.ck.ck-toolbar.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-toolbar{background:var(--ck-color-toolbar-background);padding:0 var(--ck-spacing-small);border:1px solid var(--ck-color-toolbar-border)}.ck.ck-toolbar .ck.ck-toolbar__separator{align-self:stretch;width:1px;min-width:1px;margin-top:0;margin-bottom:0;background:var(--ck-color-toolbar-border)}.ck.ck-toolbar>.ck-toolbar__items>*{margin-top:var(--ck-spacing-small);margin-bottom:var(--ck-spacing-small);margin-right:var(--ck-spacing-small)}.ck.ck-toolbar>.ck-toolbar__items:empty+.ck.ck-toolbar__separator{display:none}.ck.ck-toolbar>.ck-toolbar__items>*,.ck.ck-toolbar>.ck.ck-toolbar__grouped-dropdown{margin-top:var(--ck-spacing-small);margin-bottom:var(--ck-spacing-small)}.ck.ck-toolbar.ck-toolbar_vertical{padding:0}.ck.ck-toolbar.ck-toolbar_vertical>.ck-toolbar__items>.ck{width:100%;margin:0;border-radius:0;border:0}.ck.ck-toolbar.ck-toolbar_compact{padding:0}.ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>*{margin:0}.ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>:not(:first-child):not(:last-child){border-radius:0}.ck.ck-toolbar>.ck.ck-toolbar__grouped-dropdown>.ck.ck-button.ck-dropdown__button{padding-left:var(--ck-spacing-tiny)}.ck-toolbar-container .ck.ck-toolbar{border:0}.ck.ck-toolbar[dir=rtl]>.ck-toolbar__items>.ck,[dir=rtl] .ck.ck-toolbar>.ck-toolbar__items>.ck{margin-right:0}.ck.ck-toolbar[dir=rtl]:not(.ck-toolbar_compact)>.ck-toolbar__items>.ck,[dir=rtl] .ck.ck-toolbar:not(.ck-toolbar_compact)>.ck-toolbar__items>.ck{margin-left:var(--ck-spacing-small)}.ck.ck-toolbar[dir=rtl]>.ck-toolbar__items>.ck:last-child,[dir=rtl] .ck.ck-toolbar>.ck-toolbar__items>.ck:last-child{margin-left:0}.ck.ck-toolbar[dir=rtl].ck-toolbar_compact>.ck-toolbar__items>.ck:first-child,[dir=rtl] .ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>.ck:first-child{border-top-left-radius:0;border-bottom-left-radius:0}.ck.ck-toolbar[dir=rtl].ck-toolbar_compact>.ck-toolbar__items>.ck:last-child,[dir=rtl] .ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>.ck:last-child{border-top-right-radius:0;border-bottom-right-radius:0}.ck.ck-toolbar[dir=rtl]>.ck.ck-toolbar__separator,[dir=rtl] .ck.ck-toolbar>.ck.ck-toolbar__separator{margin-left:var(--ck-spacing-small)}.ck.ck-toolbar[dir=rtl].ck-toolbar_grouping>.ck-toolbar__items:not(:empty):not(:only-child),[dir=rtl] .ck.ck-toolbar.ck-toolbar_grouping>.ck-toolbar__items:not(:empty):not(:only-child){margin-left:var(--ck-spacing-small)}.ck.ck-toolbar[dir=ltr]>.ck-toolbar__items>.ck:last-child,[dir=ltr] .ck.ck-toolbar>.ck-toolbar__items>.ck:last-child{margin-right:0}.ck.ck-toolbar[dir=ltr].ck-toolbar_compact>.ck-toolbar__items>.ck:first-child,[dir=ltr] .ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>.ck:first-child{border-top-right-radius:0;border-bottom-right-radius:0}.ck.ck-toolbar[dir=ltr].ck-toolbar_compact>.ck-toolbar__items>.ck:last-child,[dir=ltr] .ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>.ck:last-child{border-top-left-radius:0;border-bottom-left-radius:0}.ck.ck-toolbar[dir=ltr]>.ck.ck-toolbar__separator,[dir=ltr] .ck.ck-toolbar>.ck.ck-toolbar__separator{margin-right:var(--ck-spacing-small)}.ck.ck-toolbar[dir=ltr].ck-toolbar_grouping>.ck-toolbar__items:not(:empty):not(:only-child),[dir=ltr] .ck.ck-toolbar.ck-toolbar_grouping>.ck-toolbar__items:not(:empty):not(:only-child){margin-right:var(--ck-spacing-small)}"},function(e,t,n){var o=n(1),i=n(53);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=":root{--ck-color-resizer:var(--ck-color-focus-border);--ck-resizer-size:10px;--ck-resizer-border-width:1px;--ck-resizer-border-radius:2px;--ck-resizer-offset:calc(var(--ck-resizer-size)/-2 - 2px);--ck-resizer-tooltip-offset:10px;--ck-color-resizer-tooltip-background:#262626;--ck-color-resizer-tooltip-text:#f2f2f2}.ck .ck-widget.ck-widget_with-selection-handle{position:relative}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle{position:absolute}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle .ck-icon{display:block}.ck .ck-widget.ck-widget_with-selection-handle.ck-widget_selected .ck-widget__selection-handle,.ck .ck-widget.ck-widget_with-selection-handle:hover .ck-widget__selection-handle{visibility:visible}.ck .ck-size-view{background:var(--ck-color-resizer-tooltip-background);color:var(--ck-color-resizer-tooltip-text);border:1px solid var(--ck-color-resizer-tooltip-text);border-radius:var(--ck-resizer-border-radius);font-size:var(--ck-font-size-tiny);display:block;padding:var(--ck-spacing-small)}.ck .ck-size-view.ck-orientation-bottom-left,.ck .ck-size-view.ck-orientation-bottom-right,.ck .ck-size-view.ck-orientation-top-left,.ck .ck-size-view.ck-orientation-top-right{position:absolute}.ck .ck-size-view.ck-orientation-top-left{top:var(--ck-resizer-tooltip-offset);left:var(--ck-resizer-tooltip-offset)}.ck .ck-size-view.ck-orientation-top-right{top:var(--ck-resizer-tooltip-offset);right:var(--ck-resizer-tooltip-offset)}.ck .ck-size-view.ck-orientation-bottom-right{bottom:var(--ck-resizer-tooltip-offset);right:var(--ck-resizer-tooltip-offset)}.ck .ck-size-view.ck-orientation-bottom-left{bottom:var(--ck-resizer-tooltip-offset);left:var(--ck-resizer-tooltip-offset)}:root{--ck-widget-outline-thickness:3px;--ck-widget-handler-icon-size:16px;--ck-widget-handler-animation-duration:200ms;--ck-widget-handler-animation-curve:ease;--ck-color-widget-blurred-border:#dedede;--ck-color-widget-hover-border:#ffc83d;--ck-color-widget-editable-focus-background:var(--ck-color-base-background);--ck-color-widget-drag-handler-icon-color:var(--ck-color-base-background)}.ck .ck-widget{outline-width:var(--ck-widget-outline-thickness);outline-style:solid;outline-color:transparent;transition:outline-color var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve)}.ck .ck-widget.ck-widget_selected,.ck .ck-widget.ck-widget_selected:hover{outline:var(--ck-widget-outline-thickness) solid var(--ck-color-focus-border)}.ck .ck-widget:hover{outline-color:var(--ck-color-widget-hover-border)}.ck .ck-editor__nested-editable{border:1px solid transparent}.ck .ck-editor__nested-editable.ck-editor__nested-editable_focused,.ck .ck-editor__nested-editable:focus{outline:none;border:var(--ck-focus-ring);box-shadow:var(--ck-inner-shadow),0 0;background-color:var(--ck-color-widget-editable-focus-background)}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle{padding:4px;box-sizing:border-box;background-color:transparent;opacity:0;transition:background-color var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve),visibility var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve),opacity var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve);border-radius:var(--ck-border-radius) var(--ck-border-radius) 0 0;transform:translateY(-100%);left:calc(0px - var(--ck-widget-outline-thickness))}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle .ck-icon{width:var(--ck-widget-handler-icon-size);height:var(--ck-widget-handler-icon-size);color:var(--ck-color-widget-drag-handler-icon-color)}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle .ck-icon .ck-icon__selected-indicator{opacity:0;transition:opacity .3s var(--ck-widget-handler-animation-curve)}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle:hover .ck-icon .ck-icon__selected-indicator{opacity:1}.ck .ck-widget.ck-widget_with-selection-handle:hover .ck-widget__selection-handle{opacity:1;background-color:var(--ck-color-widget-hover-border)}.ck .ck-widget.ck-widget_with-selection-handle.ck-widget_selected .ck-widget__selection-handle,.ck .ck-widget.ck-widget_with-selection-handle.ck-widget_selected:hover .ck-widget__selection-handle{opacity:1;background-color:var(--ck-color-focus-border)}.ck .ck-widget.ck-widget_with-selection-handle.ck-widget_selected .ck-widget__selection-handle .ck-icon .ck-icon__selected-indicator,.ck .ck-widget.ck-widget_with-selection-handle.ck-widget_selected:hover .ck-widget__selection-handle .ck-icon .ck-icon__selected-indicator{opacity:1}.ck-editor__editable>.ck-widget.ck-widget_with-selection-handle:first-child,.ck-editor__editable blockquote>.ck-widget.ck-widget_with-selection-handle:first-child{margin-top:calc(1em + var(--ck-widget-handler-icon-size))}.ck[dir=rtl] .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle{left:auto;right:calc(0px - var(--ck-widget-outline-thickness))}.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected,.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected:hover{outline-color:var(--ck-color-widget-blurred-border)}.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected.ck-widget_with-selection-handle .ck-widget__selection-handle,.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected.ck-widget_with-selection-handle .ck-widget__selection-handle:hover,.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected:hover.ck-widget_with-selection-handle .ck-widget__selection-handle,.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected:hover.ck-widget_with-selection-handle .ck-widget__selection-handle:hover{background:var(--ck-color-widget-blurred-border)}.ck-editor__editable.ck-read-only .ck-widget{--ck-widget-outline-thickness:0}"},function(e,t,n){var o=n(1),i=n(55);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=':root{--ck-balloon-panel-arrow-z-index:calc(var(--ck-z-default) - 3)}.ck.ck-balloon-panel{display:none;position:absolute;z-index:var(--ck-z-modal)}.ck.ck-balloon-panel.ck-balloon-panel_with-arrow:after,.ck.ck-balloon-panel.ck-balloon-panel_with-arrow:before{content:"";position:absolute}.ck.ck-balloon-panel.ck-balloon-panel_with-arrow:before{z-index:var(--ck-balloon-panel-arrow-z-index)}.ck.ck-balloon-panel.ck-balloon-panel_with-arrow:after{z-index:calc(var(--ck-balloon-panel-arrow-z-index) + 1)}.ck.ck-balloon-panel[class*=arrow_n]:before{z-index:var(--ck-balloon-panel-arrow-z-index)}.ck.ck-balloon-panel[class*=arrow_n]:after{z-index:calc(var(--ck-balloon-panel-arrow-z-index) + 1)}.ck.ck-balloon-panel[class*=arrow_s]:before{z-index:var(--ck-balloon-panel-arrow-z-index)}.ck.ck-balloon-panel[class*=arrow_s]:after{z-index:calc(var(--ck-balloon-panel-arrow-z-index) + 1)}.ck.ck-balloon-panel.ck-balloon-panel_visible{display:block}:root{--ck-balloon-arrow-offset:2px;--ck-balloon-arrow-height:10px;--ck-balloon-arrow-half-width:8px}.ck.ck-balloon-panel{border-radius:0}.ck-rounded-corners .ck.ck-balloon-panel,.ck.ck-balloon-panel.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-balloon-panel{box-shadow:var(--ck-drop-shadow),0 0;min-height:15px;background:var(--ck-color-panel-background);border:1px solid var(--ck-color-panel-border)}.ck.ck-balloon-panel.ck-balloon-panel_with-arrow:after,.ck.ck-balloon-panel.ck-balloon-panel_with-arrow:before{width:0;height:0;border-style:solid}.ck.ck-balloon-panel[class*=arrow_n]:after,.ck.ck-balloon-panel[class*=arrow_n]:before{border-left-width:var(--ck-balloon-arrow-half-width);border-bottom-width:var(--ck-balloon-arrow-height);border-right-width:var(--ck-balloon-arrow-half-width);border-top-width:0}.ck.ck-balloon-panel[class*=arrow_n]:before{border-bottom-color:var(--ck-color-panel-border)}.ck.ck-balloon-panel[class*=arrow_n]:after,.ck.ck-balloon-panel[class*=arrow_n]:before{border-left-color:transparent;border-right-color:transparent;border-top-color:transparent}.ck.ck-balloon-panel[class*=arrow_n]:after{border-bottom-color:var(--ck-color-panel-background);margin-top:var(--ck-balloon-arrow-offset)}.ck.ck-balloon-panel[class*=arrow_s]:after,.ck.ck-balloon-panel[class*=arrow_s]:before{border-left-width:var(--ck-balloon-arrow-half-width);border-bottom-width:0;border-right-width:var(--ck-balloon-arrow-half-width);border-top-width:var(--ck-balloon-arrow-height)}.ck.ck-balloon-panel[class*=arrow_s]:before{border-top-color:var(--ck-color-panel-border)}.ck.ck-balloon-panel[class*=arrow_s]:after,.ck.ck-balloon-panel[class*=arrow_s]:before{border-left-color:transparent;border-bottom-color:transparent;border-right-color:transparent}.ck.ck-balloon-panel[class*=arrow_s]:after{border-top-color:var(--ck-color-panel-background);margin-bottom:var(--ck-balloon-arrow-offset)}.ck.ck-balloon-panel.ck-balloon-panel_arrow_n:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_n:before{left:50%;margin-left:calc(-1*var(--ck-balloon-arrow-half-width));top:calc(-1*var(--ck-balloon-arrow-height))}.ck.ck-balloon-panel.ck-balloon-panel_arrow_nw:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_nw:before{left:calc(2*var(--ck-balloon-arrow-half-width));top:calc(-1*var(--ck-balloon-arrow-height))}.ck.ck-balloon-panel.ck-balloon-panel_arrow_ne:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_ne:before{right:calc(2*var(--ck-balloon-arrow-half-width));top:calc(-1*var(--ck-balloon-arrow-height))}.ck.ck-balloon-panel.ck-balloon-panel_arrow_s:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_s:before{left:50%;margin-left:calc(-1*var(--ck-balloon-arrow-half-width));bottom:calc(-1*var(--ck-balloon-arrow-height))}.ck.ck-balloon-panel.ck-balloon-panel_arrow_sw:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_sw:before{left:calc(2*var(--ck-balloon-arrow-half-width));bottom:calc(-1*var(--ck-balloon-arrow-height))}.ck.ck-balloon-panel.ck-balloon-panel_arrow_se:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_se:before{right:calc(2*var(--ck-balloon-arrow-half-width));bottom:calc(-1*var(--ck-balloon-arrow-height))}.ck.ck-balloon-panel.ck-balloon-panel_arrow_sme:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_sme:before{right:25%;margin-right:calc(2*var(--ck-balloon-arrow-half-width));bottom:calc(-1*var(--ck-balloon-arrow-height))}.ck.ck-balloon-panel.ck-balloon-panel_arrow_smw:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_smw:before{left:25%;margin-left:calc(2*var(--ck-balloon-arrow-half-width));bottom:calc(-1*var(--ck-balloon-arrow-height))}.ck.ck-balloon-panel.ck-balloon-panel_arrow_nme:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_nme:before{right:25%;margin-right:calc(2*var(--ck-balloon-arrow-half-width));top:calc(-1*var(--ck-balloon-arrow-height))}.ck.ck-balloon-panel.ck-balloon-panel_arrow_nmw:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_nmw:before{left:25%;margin-left:calc(2*var(--ck-balloon-arrow-half-width));top:calc(-1*var(--ck-balloon-arrow-height))}'},function(e,t,n){var o=n(1),i=n(57);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=".ck .ck-balloon-rotator__navigation{display:flex;align-items:center;justify-content:center}.ck .ck-balloon-rotator__content .ck-toolbar{justify-content:center}.ck .ck-balloon-rotator__navigation{background:var(--ck-color-toolbar-background);border-bottom:1px solid var(--ck-color-toolbar-border);padding:0 var(--ck-spacing-small)}.ck .ck-balloon-rotator__navigation>*{margin-right:var(--ck-spacing-small);margin-top:var(--ck-spacing-small);margin-bottom:var(--ck-spacing-small)}.ck .ck-balloon-rotator__navigation .ck-balloon-rotator__counter{margin-right:var(--ck-spacing-standard);margin-left:var(--ck-spacing-small)}.ck .ck-balloon-rotator__content .ck.ck-annotation-wrapper{box-shadow:none}"},function(e,t,n){var o=n(1),i=n(59);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=".ck .ck-fake-panel{position:absolute;z-index:calc(var(--ck-z-modal) - 1)}.ck .ck-fake-panel div{position:absolute}.ck .ck-fake-panel div:first-child{z-index:2}.ck .ck-fake-panel div:nth-child(2){z-index:1}:root{--ck-balloon-fake-panel-offset-horizontal:6px;--ck-balloon-fake-panel-offset-vertical:6px}.ck .ck-fake-panel div{box-shadow:var(--ck-drop-shadow),0 0;min-height:15px;background:var(--ck-color-panel-background);border:1px solid var(--ck-color-panel-border);border-radius:var(--ck-border-radius);width:100%;height:100%}.ck .ck-fake-panel div:first-child{margin-left:var(--ck-balloon-fake-panel-offset-horizontal);margin-top:var(--ck-balloon-fake-panel-offset-vertical)}.ck .ck-fake-panel div:nth-child(2){margin-left:calc(var(--ck-balloon-fake-panel-offset-horizontal)*2);margin-top:calc(var(--ck-balloon-fake-panel-offset-vertical)*2)}.ck .ck-fake-panel div:nth-child(3){margin-left:calc(var(--ck-balloon-fake-panel-offset-horizontal)*3);margin-top:calc(var(--ck-balloon-fake-panel-offset-vertical)*3)}.ck .ck-balloon-panel_arrow_s+.ck-fake-panel,.ck .ck-balloon-panel_arrow_se+.ck-fake-panel,.ck .ck-balloon-panel_arrow_sw+.ck-fake-panel{--ck-balloon-fake-panel-offset-vertical:-6px}"},function(e,t,n){var o=n(1),i=n(61);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=".ck.ck-editor__editable .image{position:relative}.ck.ck-editor__editable .image .ck-progress-bar{position:absolute;top:0;left:0}.ck.ck-editor__editable .image.ck-appear{animation:fadeIn .7s}.ck.ck-editor__editable .image .ck-progress-bar{height:2px;width:0;background:var(--ck-color-upload-bar-background);transition:width .1s}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}"},function(e,t,n){var o=n(1),i=n(63);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports='.ck-image-upload-complete-icon{display:block;position:absolute;top:10px;right:10px;border-radius:50%}.ck-image-upload-complete-icon:after{content:"";position:absolute}:root{--ck-color-image-upload-icon:#fff;--ck-color-image-upload-icon-background:#008a00;--ck-image-upload-icon-size:20px;--ck-image-upload-icon-width:2px}.ck-image-upload-complete-icon{width:var(--ck-image-upload-icon-size);height:var(--ck-image-upload-icon-size);opacity:0;background:var(--ck-color-image-upload-icon-background);animation-name:ck-upload-complete-icon-show,ck-upload-complete-icon-hide;animation-fill-mode:forwards,forwards;animation-duration:.5s,.5s;font-size:var(--ck-image-upload-icon-size);animation-delay:0ms,3s}.ck-image-upload-complete-icon:after{left:25%;top:50%;opacity:0;height:0;width:0;transform:scaleX(-1) rotate(135deg);transform-origin:left top;border-top:var(--ck-image-upload-icon-width) solid var(--ck-color-image-upload-icon);border-right:var(--ck-image-upload-icon-width) solid var(--ck-color-image-upload-icon);animation-name:ck-upload-complete-icon-check;animation-duration:.5s;animation-delay:.5s;animation-fill-mode:forwards;box-sizing:border-box}@keyframes ck-upload-complete-icon-show{0%{opacity:0}to{opacity:1}}@keyframes ck-upload-complete-icon-hide{0%{opacity:1}to{opacity:0}}@keyframes ck-upload-complete-icon-check{0%{opacity:1;width:0;height:0}33%{width:.3em;height:0}to{opacity:1;width:.3em;height:.45em}}'},function(e,t,n){var o=n(1),i=n(65);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports='.ck .ck-upload-placeholder-loader{position:absolute;display:flex;align-items:center;justify-content:center;top:0;left:0}.ck .ck-upload-placeholder-loader:before{content:"";position:relative}:root{--ck-color-upload-placeholder-loader:#b3b3b3;--ck-upload-placeholder-loader-size:32px}.ck .ck-image-upload-placeholder{width:100%;margin:0}.ck .ck-upload-placeholder-loader{width:100%;height:100%}.ck .ck-upload-placeholder-loader:before{width:var(--ck-upload-placeholder-loader-size);height:var(--ck-upload-placeholder-loader-size);border-radius:50%;border-top:3px solid var(--ck-color-upload-placeholder-loader);border-right:2px solid transparent;animation:ck-upload-placeholder-loader 1s linear infinite}@keyframes ck-upload-placeholder-loader{to{transform:rotate(1turn)}}'},function(e,t){e.exports=".ck-content code{background-color:hsla(0,0%,78%,.3);padding:.15em;border-radius:2px}"},function(e,t,n){var o=n(1),i=n(68);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=".ck-content blockquote{overflow:hidden;padding-right:1.5em;padding-left:1.5em;margin-left:0;margin-right:0;font-style:italic;border-left:5px solid #ccc}.ck-content[dir=rtl] blockquote{border-left:0;border-right:5px solid #ccc}"},function(e,t){e.exports=".ck.ck-heading_heading1{font-size:20px}.ck.ck-heading_heading2{font-size:17px}.ck.ck-heading_heading3{font-size:14px}.ck[class*=ck-heading_heading]{font-weight:700}.ck.ck-dropdown.ck-heading-dropdown .ck-dropdown__button .ck-button__label{width:8em}.ck.ck-dropdown.ck-heading-dropdown .ck-dropdown__panel .ck-list__item{min-width:18em}"},function(e,t,n){var o=n(1),i=n(71);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=".ck.ck-label{display:block}.ck.ck-voice-label{display:none}.ck.ck-label{font-weight:700}"},function(e,t,n){var o=n(1),i=n(73);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=".ck.ck-labeled-input .ck-labeled-input__status{font-size:var(--ck-font-size-small);margin-top:var(--ck-spacing-small);white-space:normal}.ck.ck-labeled-input .ck-labeled-input__status_error{color:var(--ck-color-base-error)}"},function(e,t,n){var o=n(1),i=n(75);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=":root{--ck-input-text-width:18em}.ck.ck-input-text{border-radius:0}.ck-rounded-corners .ck.ck-input-text,.ck.ck-input-text.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-input-text{box-shadow:var(--ck-inner-shadow),0 0;background:var(--ck-color-input-background);border:1px solid var(--ck-color-input-border);padding:var(--ck-spacing-extra-tiny) var(--ck-spacing-medium);min-width:var(--ck-input-text-width);min-height:var(--ck-ui-component-min-height);transition:box-shadow .2s ease-in-out,border .2s ease-in-out}.ck.ck-input-text:focus{outline:none;border:var(--ck-focus-ring);box-shadow:var(--ck-focus-outer-shadow),var(--ck-inner-shadow)}.ck.ck-input-text[readonly]{border:1px solid var(--ck-color-input-disabled-border);background:var(--ck-color-input-disabled-background);color:var(--ck-color-input-disabled-text)}.ck.ck-input-text[readonly]:focus{box-shadow:var(--ck-focus-disabled-outer-shadow),var(--ck-inner-shadow)}.ck.ck-input-text.ck-error{border-color:var(--ck-color-input-error-border);animation:ck-text-input-shake .3s ease both}.ck.ck-input-text.ck-error:focus{box-shadow:var(--ck-focus-error-outer-shadow),var(--ck-inner-shadow)}@keyframes ck-text-input-shake{20%{transform:translateX(-2px)}40%{transform:translateX(2px)}60%{transform:translateX(-1px)}80%{transform:translateX(1px)}}"},function(e,t,n){var o=n(1),i=n(77);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=".ck.ck-text-alternative-form{display:flex;flex-direction:row;flex-wrap:nowrap}.ck.ck-text-alternative-form .ck-labeled-input{display:inline-block}.ck.ck-text-alternative-form .ck-label{display:none}@media screen and (max-width:600px){.ck.ck-text-alternative-form{flex-wrap:wrap}.ck.ck-text-alternative-form .ck-labeled-input{flex-basis:100%}.ck.ck-text-alternative-form .ck-button{flex-basis:50%}}.ck.ck-text-alternative-form{padding:var(--ck-spacing-standard)}.ck.ck-text-alternative-form:focus{outline:none}[dir=ltr] .ck.ck-text-alternative-form>:not(:first-child),[dir=rtl] .ck.ck-text-alternative-form>:not(:last-child){margin-left:var(--ck-spacing-standard)}@media screen and (max-width:600px){.ck.ck-text-alternative-form{padding:0;width:calc(0.8*var(--ck-input-text-width))}.ck.ck-text-alternative-form .ck-labeled-input{margin:var(--ck-spacing-standard) var(--ck-spacing-standard) 0}.ck.ck-text-alternative-form .ck-labeled-input .ck-input-text{min-width:0;width:100%}.ck.ck-text-alternative-form .ck-button{padding:var(--ck-spacing-standard);margin-top:var(--ck-spacing-standard);border-radius:0;border:0;border-top:1px solid var(--ck-color-base-border)}[dir=ltr] .ck.ck-text-alternative-form .ck-button{margin-left:0}[dir=ltr] .ck.ck-text-alternative-form .ck-button:first-of-type{border-right:1px solid var(--ck-color-base-border)}[dir=rtl] .ck.ck-text-alternative-form .ck-button{margin-left:0}[dir=rtl] .ck.ck-text-alternative-form .ck-button:last-of-type{border-right:1px solid var(--ck-color-base-border)}}"},function(e,t,n){var o=n(1),i=n(79);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=".ck-content .image{display:table;clear:both;text-align:center;margin:1em auto}.ck-content .image>img{display:block;margin:0 auto;max-width:100%;min-width:50px}"},function(e,t,n){var o=n(1),i=n(81);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=".ck-content .image>figcaption{display:table-caption;caption-side:bottom;word-break:break-word;color:#333;background-color:#f7f7f7;padding:.6em;font-size:.75em;outline-offset:-1px}"},function(e,t,n){var o=n(1),i=n(83);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=":root{--ck-image-style-spacing:1.5em}.ck-content .image-style-align-center,.ck-content .image-style-align-left,.ck-content .image-style-align-right,.ck-content .image-style-side{max-width:50%}.ck-content .image-style-side{float:right;margin-left:var(--ck-image-style-spacing)}.ck-content .image-style-align-left{float:left;margin-right:var(--ck-image-style-spacing)}.ck-content .image-style-align-center{margin-left:auto;margin-right:auto}.ck-content .image-style-align-right{float:right;margin-left:var(--ck-image-style-spacing)}"},function(e,t,n){var o=n(1),i=n(85);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=".ck .ck-link_selected{background:var(--ck-color-link-selected-background)}"},function(e,t,n){var o=n(1),i=n(87);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=".ck.ck-link-form{display:flex}.ck.ck-link-form .ck-label{display:none}@media screen and (max-width:600px){.ck.ck-link-form{flex-wrap:wrap}.ck.ck-link-form .ck-labeled-input{flex-basis:100%}.ck.ck-link-form .ck-button{flex-basis:50%}}.ck.ck-link-form_layout-vertical{display:block}.ck.ck-link-form{padding:var(--ck-spacing-standard)}.ck.ck-link-form:focus{outline:none}[dir=ltr] .ck.ck-link-form>:not(:first-child),[dir=rtl] .ck.ck-link-form>:not(:last-child){margin-left:var(--ck-spacing-standard)}@media screen and (max-width:600px){.ck.ck-link-form{padding:0;width:calc(0.8*var(--ck-input-text-width))}.ck.ck-link-form .ck-labeled-input{margin:var(--ck-spacing-standard) var(--ck-spacing-standard) 0}.ck.ck-link-form .ck-labeled-input .ck-input-text{min-width:0;width:100%}.ck.ck-link-form .ck-button{padding:var(--ck-spacing-standard);margin-top:var(--ck-spacing-standard);border-radius:0;border:0;border-top:1px solid var(--ck-color-base-border)}[dir=ltr] .ck.ck-link-form .ck-button{margin-left:0}[dir=ltr] .ck.ck-link-form .ck-button:first-of-type{border-right:1px solid var(--ck-color-base-border)}[dir=rtl] .ck.ck-link-form .ck-button{margin-left:0}[dir=rtl] .ck.ck-link-form .ck-button:last-of-type{border-right:1px solid var(--ck-color-base-border)}}.ck.ck-link-form_layout-vertical{padding:0;min-width:var(--ck-input-text-width)}.ck.ck-link-form_layout-vertical .ck-labeled-input{margin:var(--ck-spacing-standard) var(--ck-spacing-standard) var(--ck-spacing-small)}.ck.ck-link-form_layout-vertical .ck-labeled-input .ck-input-text{min-width:0;width:100%}.ck.ck-link-form_layout-vertical .ck-button{padding:var(--ck-spacing-standard);margin:0;border-radius:0;border:0;border-top:1px solid var(--ck-color-base-border);width:50%}[dir=ltr] .ck.ck-link-form_layout-vertical .ck-button{margin-left:0}[dir=ltr] .ck.ck-link-form_layout-vertical .ck-button:first-of-type{border-right:1px solid var(--ck-color-base-border)}[dir=rtl] .ck.ck-link-form_layout-vertical .ck-button{margin-left:0}[dir=rtl] .ck.ck-link-form_layout-vertical .ck-button:last-of-type{border-right:1px solid var(--ck-color-base-border)}.ck.ck-link-form_layout-vertical .ck.ck-list{margin-left:0}.ck.ck-link-form_layout-vertical .ck.ck-list .ck-button.ck-switchbutton{border:0;width:100%}.ck.ck-link-form_layout-vertical .ck.ck-list .ck-button.ck-switchbutton:hover{background:none}"},function(e,t,n){var o=n(1),i=n(89);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=".ck.ck-link-actions{display:flex;flex-direction:row;flex-wrap:nowrap}.ck.ck-link-actions .ck-link-actions__preview{display:inline-block}.ck.ck-link-actions .ck-link-actions__preview .ck-button__label{overflow:hidden}@media screen and (max-width:600px){.ck.ck-link-actions{flex-wrap:wrap}.ck.ck-link-actions .ck-link-actions__preview{flex-basis:100%}.ck.ck-link-actions .ck-button:not(.ck-link-actions__preview){flex-basis:50%}}.ck.ck-link-actions{padding:var(--ck-spacing-standard)}.ck.ck-link-actions .ck-button.ck-link-actions__preview{padding-left:0;padding-right:0}.ck.ck-link-actions .ck-button.ck-link-actions__preview .ck-button__label{padding:0 var(--ck-spacing-medium);color:var(--ck-color-link-default);text-overflow:ellipsis;cursor:pointer;max-width:var(--ck-input-text-width);min-width:3em;text-align:center}.ck.ck-link-actions .ck-button.ck-link-actions__preview .ck-button__label:hover{text-decoration:underline}.ck.ck-link-actions .ck-button.ck-link-actions__preview,.ck.ck-link-actions .ck-button.ck-link-actions__preview:active,.ck.ck-link-actions .ck-button.ck-link-actions__preview:focus,.ck.ck-link-actions .ck-button.ck-link-actions__preview:hover{background:none}.ck.ck-link-actions .ck-button.ck-link-actions__preview:active{box-shadow:none}.ck.ck-link-actions .ck-button.ck-link-actions__preview:focus .ck-button__label{text-decoration:underline}.ck.ck-link-actions:focus{outline:none}[dir=ltr] .ck.ck-link-actions .ck-button:not(:first-child),[dir=rtl] .ck.ck-link-actions .ck-button:not(:last-child){margin-left:var(--ck-spacing-standard)}@media screen and (max-width:600px){.ck.ck-link-actions{padding:0;width:calc(0.8*var(--ck-input-text-width))}.ck.ck-link-actions .ck-button.ck-link-actions__preview{margin:var(--ck-spacing-standard) var(--ck-spacing-standard) 0}.ck.ck-link-actions .ck-button.ck-link-actions__preview .ck-button__label{min-width:0;max-width:100%}.ck.ck-link-actions .ck-button:not(.ck-link-actions__preview){padding:var(--ck-spacing-standard);margin-top:var(--ck-spacing-standard);border-radius:0;border:0;border-top:1px solid var(--ck-color-base-border)}[dir=ltr] .ck.ck-link-actions .ck-button:not(.ck-link-actions__preview){margin-left:0}[dir=ltr] .ck.ck-link-actions .ck-button:not(.ck-link-actions__preview):first-of-type{border-right:1px solid var(--ck-color-base-border)}[dir=rtl] .ck.ck-link-actions .ck-button:not(.ck-link-actions__preview){margin-left:0}[dir=rtl] .ck.ck-link-actions .ck-button:not(.ck-link-actions__preview):last-of-type{border-right:1px solid var(--ck-color-base-border)}}"},function(e,t,n){var o=n(1),i=n(91);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=":root{--ck-color-table-focused-cell-background:rgba(158,207,250,0.3)}.ck-widget.table td.ck-editor__nested-editable.ck-editor__nested-editable_focused,.ck-widget.table td.ck-editor__nested-editable:focus,.ck-widget.table th.ck-editor__nested-editable.ck-editor__nested-editable_focused,.ck-widget.table th.ck-editor__nested-editable:focus{background:var(--ck-color-table-focused-cell-background);border-style:none;outline:1px solid var(--ck-color-focus-border);outline-offset:-1px}"},function(e,t,n){var o=n(1),i=n(93);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=".ck .ck-insert-table-dropdown__grid{display:flex;flex-direction:row;flex-wrap:wrap}:root{--ck-insert-table-dropdown-padding:10px;--ck-insert-table-dropdown-box-height:11px;--ck-insert-table-dropdown-box-width:12px;--ck-insert-table-dropdown-box-margin:1px}.ck .ck-insert-table-dropdown__grid{width:calc(var(--ck-insert-table-dropdown-box-width)*10 + var(--ck-insert-table-dropdown-box-margin)*20 + var(--ck-insert-table-dropdown-padding)*2);padding:var(--ck-insert-table-dropdown-padding) var(--ck-insert-table-dropdown-padding) 0}.ck .ck-insert-table-dropdown__label{text-align:center}.ck .ck-insert-table-dropdown-grid-box{width:var(--ck-insert-table-dropdown-box-width);height:var(--ck-insert-table-dropdown-box-height);margin:var(--ck-insert-table-dropdown-box-margin);border:1px solid var(--ck-color-base-border);border-radius:1px}.ck .ck-insert-table-dropdown-grid-box.ck-on{border-color:var(--ck-color-focus-border);background:var(--ck-color-focus-outer-shadow)}"},function(e,t,n){var o=n(1),i=n(95);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=":root{--ck-table-selected-cell-background:#cee5fd}.ck.ck-editor__editable .table table td.ck-editor__editable_selected,.ck.ck-editor__editable .table table th.ck-editor__editable_selected{background-color:var(--ck-table-selected-cell-background)!important;caret-color:transparent;outline:unset;box-shadow:unset}.ck.ck-editor__editable .table table td.ck-editor__editable_selected ::selection,.ck.ck-editor__editable .table table th.ck-editor__editable_selected ::selection{background-color:transparent}.ck.ck-editor__editable .table table td.ck-editor__editable_selected .ck-widget_selected,.ck.ck-editor__editable .table table th.ck-editor__editable_selected .ck-widget_selected{outline:unset}"},function(e,t,n){var o=n(1),i=n(97);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=".ck-content .table{margin:1em auto;display:table}.ck-content .table table{border-collapse:collapse;border-spacing:0;width:100%;height:100%;border:1px double #b3b3b3}.ck-content .table table td,.ck-content .table table th{min-width:2em;padding:.4em;border-color:#bfbfbf}.ck-content .table table th{font-weight:700;background:hsla(0,0%,0%,5%)}"},function(e,t,n){var o=n(1),i=n(99);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=".ck.ck-labeled-view .ck-labeled-view__status{font-size:var(--ck-font-size-small);margin-top:var(--ck-spacing-small);white-space:normal}.ck.ck-labeled-view .ck-labeled-view__status_error{color:var(--ck-color-base-error)}.ck.ck-labeled-view>.ck.ck-label{width:100%;text-overflow:ellipsis;overflow:hidden}"},function(e,t,n){var o=n(1),i=n(101);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=".ck.ck-color-grid{display:grid}:root{--ck-color-grid-tile-size:24px;--ck-color-color-grid-check-icon:#000}.ck.ck-color-grid{grid-gap:5px;padding:8px}.ck.ck-color-grid__tile{width:var(--ck-color-grid-tile-size);height:var(--ck-color-grid-tile-size);min-width:var(--ck-color-grid-tile-size);min-height:var(--ck-color-grid-tile-size);padding:0;transition:box-shadow .2s ease;border:0}.ck.ck-color-grid__tile.ck-disabled{cursor:unset;transition:unset}.ck.ck-color-grid__tile.ck-color-table__color-tile_bordered{box-shadow:0 0 0 1px var(--ck-color-base-border)}.ck.ck-color-grid__tile .ck.ck-icon{display:none;color:var(--ck-color-color-grid-check-icon)}.ck.ck-color-grid__tile.ck-on{box-shadow:inset 0 0 0 1px var(--ck-color-base-background),0 0 0 2px var(--ck-color-base-text)}.ck.ck-color-grid__tile.ck-on .ck.ck-icon{display:block}.ck.ck-color-grid__tile.ck-on,.ck.ck-color-grid__tile:focus:not(.ck-disabled),.ck.ck-color-grid__tile:hover:not(.ck-disabled){border:0}.ck.ck-color-grid__tile:focus:not(.ck-disabled),.ck.ck-color-grid__tile:hover:not(.ck-disabled){box-shadow:inset 0 0 0 1px var(--ck-color-base-background),0 0 0 2px var(--ck-color-focus-border)}.ck.ck-color-grid__label{padding:0 var(--ck-spacing-standard)}"},function(e,t,n){var o=n(1),i=n(103);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=".ck.ck-input-color{width:100%;display:flex}.ck.ck-input-color>input.ck.ck-input-text{min-width:auto;flex-grow:1}.ck.ck-input-color>input.ck.ck-input-text:active,.ck.ck-input-color>input.ck.ck-input-text:focus{z-index:var(--ck-z-default)}.ck.ck-input-color>div.ck.ck-dropdown{min-width:auto}.ck.ck-input-color>div.ck.ck-dropdown>.ck-input-color__button .ck-dropdown__arrow{display:none}.ck.ck-input-color .ck.ck-input-color__button .ck.ck-input-color__button__preview{position:relative;overflow:hidden}.ck.ck-input-color .ck.ck-input-color__button .ck.ck-input-color__button__preview>.ck.ck-input-color__button__preview__no-color-indicator{position:absolute;display:block}[dir=ltr] .ck.ck-input-color>.ck.ck-input-text{border-top-right-radius:0;border-bottom-right-radius:0}[dir=rtl] .ck.ck-input-color>.ck.ck-input-text{border-top-left-radius:0;border-bottom-left-radius:0}.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-input-color__button{padding:0}[dir=ltr] .ck.ck-input-color>.ck.ck-dropdown>.ck.ck-input-color__button{border-top-left-radius:0;border-bottom-left-radius:0;margin-left:-1px}[dir=rtl] .ck.ck-input-color>.ck.ck-dropdown>.ck.ck-input-color__button{border-top-right-radius:0;border-bottom-right-radius:0;margin-right:-1px}.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-input-color__button.ck-disabled{background:var(--ck-color-input-disabled-background)}.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-input-color__button>.ck.ck-input-color__button__preview{border-radius:0}.ck-rounded-corners .ck.ck-input-color>.ck.ck-dropdown>.ck.ck-input-color__button>.ck.ck-input-color__button__preview,.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-input-color__button>.ck.ck-input-color__button__preview.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-input-color__button>.ck.ck-input-color__button__preview{width:20px;height:20px;border:1px solid var(--ck-color-input-border)}.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-input-color__button>.ck.ck-input-color__button__preview>.ck.ck-input-color__button__preview__no-color-indicator{top:-30%;left:50%;height:150%;width:8%;background:red;border-radius:2px;transform:rotate(45deg);transform-origin:50%}.ck.ck-input-color .ck.ck-input-color__remove-color{width:100%;border-bottom:1px solid var(--ck-color-input-border);padding:calc(var(--ck-spacing-standard)/2) var(--ck-spacing-standard);border-bottom-left-radius:0;border-bottom-right-radius:0}[dir=ltr] .ck.ck-input-color .ck.ck-input-color__remove-color{border-top-right-radius:0}[dir=rtl] .ck.ck-input-color .ck.ck-input-color__remove-color{border-top-left-radius:0}.ck.ck-input-color .ck.ck-input-color__remove-color .ck.ck-icon{margin-right:var(--ck-spacing-standard)}[dir=rtl] .ck.ck-input-color .ck.ck-input-color__remove-color .ck.ck-icon{margin-right:0;margin-left:var(--ck-spacing-standard)}"},function(e,t,n){var o=n(1),i=n(105);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=".ck.ck-form__row{display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:space-between}.ck.ck-form__row>:not(.ck-label){flex-grow:1}.ck.ck-form__row.ck-table-form__action-row .ck-button-cancel,.ck.ck-form__row.ck-table-form__action-row .ck-button-save{justify-content:center}.ck.ck-form__row{padding:var(--ck-spacing-standard) var(--ck-spacing-large) 0}[dir=ltr] .ck.ck-form__row>:not(.ck-label)+*{margin-left:var(--ck-spacing-large)}[dir=rtl] .ck.ck-form__row>:not(.ck-label)+*{margin-right:var(--ck-spacing-large)}.ck.ck-form__row>.ck-label{width:100%;min-width:100%}.ck.ck-form__row.ck-table-form__action-row{margin-top:var(--ck-spacing-large)}.ck.ck-form__row.ck-table-form__action-row .ck-button .ck-button__label{color:var(--ck-color-text)}"},function(e,t,n){var o=n(1),i=n(107);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=":root{--ck-table-form-header-height:38px}.ck.ck-form__header{padding:0 var(--ck-spacing-large);height:var(--ck-table-form-header-height);line-height:var(--ck-table-form-header-height);border-bottom:1px solid var(--ck-color-base-border)}.ck.ck-form__header .ck-form__header__label{font-weight:700}"},function(e,t){e.exports=".ck.ck-form{padding:0 0 var(--ck-spacing-large)}.ck.ck-form:focus{outline:none}.ck.ck-form .ck.ck-input-text{min-width:100%;width:0}.ck.ck-form .ck.ck-dropdown{min-width:100%}.ck.ck-form .ck.ck-dropdown .ck-dropdown__button:not(:focus){border:1px solid var(--ck-color-base-border)}.ck.ck-form .ck.ck-dropdown .ck-dropdown__button .ck-button__label{width:100%}"},function(e,t){e.exports='.ck.ck-table-form .ck-form__row.ck-table-form__border-row{flex-wrap:wrap}.ck.ck-table-form .ck-form__row.ck-table-form__border-row .ck-labeled-view{display:flex;flex-direction:column-reverse}.ck.ck-table-form .ck-form__row.ck-table-form__border-row .ck-labeled-view .ck.ck-dropdown,.ck.ck-table-form .ck-form__row.ck-table-form__border-row .ck-table-form__border-style,.ck.ck-table-form .ck-form__row.ck-table-form__border-row .ck-table-form__border-width{flex-grow:0}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row{flex-wrap:wrap;align-items:center}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-labeled-view{display:flex;flex-direction:column-reverse;align-items:center}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-labeled-view .ck.ck-dropdown,.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-table-form__dimension-operator{flex-grow:0}.ck.ck-table-form .ck.ck-labeled-view{position:relative}.ck.ck-table-form .ck.ck-labeled-view .ck.ck-labeled-view__status{position:absolute;left:50%;bottom:calc(-1*var(--ck-table-properties-error-arrow-size));transform:translate(-50%,100%);z-index:1}.ck.ck-table-form .ck.ck-labeled-view .ck.ck-labeled-view__status:after{content:"";position:absolute;top:calc(-1*var(--ck-table-properties-error-arrow-size));left:50%;transform:translateX(-50%)}:root{--ck-table-properties-error-arrow-size:6px;--ck-table-properties-min-error-width:150px}.ck.ck-table-form .ck-form__row.ck-table-form__border-row .ck-labeled-view>.ck-label{font-size:var(--ck-font-size-tiny);text-align:center}.ck.ck-table-form .ck-form__row.ck-table-form__border-row .ck-table-form__border-style{width:80px;min-width:80px}.ck.ck-table-form .ck-form__row.ck-table-form__border-row .ck-table-form__border-width{width:50px;min-width:50px}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row{padding:0}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-labeled-view>.ck-label{font-size:10px;text-align:center}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-table-form__dimensions-row__height,.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-table-form__dimensions-row__width{margin:0}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-table-form__dimension-operator{align-self:start;display:inline-block;height:var(--ck-ui-component-min-height);line-height:var(--ck-ui-component-min-height);margin:0 var(--ck-spacing-small)}.ck.ck-table-form .ck.ck-labeled-view .ck.ck-labeled-view__status{border-radius:0}.ck-rounded-corners .ck.ck-table-form .ck.ck-labeled-view .ck.ck-labeled-view__status,.ck.ck-table-form .ck.ck-labeled-view .ck.ck-labeled-view__status.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-table-form .ck.ck-labeled-view .ck.ck-labeled-view__status{background:var(--ck-color-base-error);color:var(--ck-color-base-background);padding:var(--ck-spacing-small) var(--ck-spacing-medium);min-width:var(--ck-table-properties-min-error-width);text-align:center}.ck.ck-table-form .ck.ck-labeled-view .ck.ck-labeled-view__status:after{border-left:var(--ck-table-properties-error-arrow-size) solid transparent;border-bottom:var(--ck-table-properties-error-arrow-size) solid var(--ck-color-base-error);border-right:var(--ck-table-properties-error-arrow-size) solid transparent;border-top:0 solid transparent}.ck.ck-table-form .ck.ck-labeled-view .ck.ck-labeled-view__status{animation:ck-table-form-labeled-view-status-appear .15s ease both}.ck.ck-table-form .ck.ck-labeled-view .ck-input.ck-error:not(:focus)+.ck.ck-labeled-view__status{display:none}@keyframes ck-table-form-labeled-view-status-appear{0%{opacity:0}to{opacity:1}}'},function(e,t,n){var o=n(1),i=n(111);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=".ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row{flex-wrap:wrap;flex-basis:0;align-content:baseline}.ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row .ck.ck-toolbar .ck-toolbar__items{flex-wrap:nowrap}.ck.ck-table-properties-form{width:320px}.ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row{padding:0}.ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row .ck.ck-toolbar{background:none}.ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row .ck.ck-toolbar .ck-toolbar__items>*{width:40px}"},function(e,t,n){var o=n(1),i=n(113);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=".ck.ck-table-cell-properties-form .ck-form__row.ck-table-cell-properties-form__alignment-row{flex-wrap:wrap}.ck.ck-table-cell-properties-form .ck-form__row.ck-table-cell-properties-form__alignment-row .ck.ck-toolbar{flex-grow:0}.ck.ck-table-cell-properties-form{width:320px}.ck.ck-table-cell-properties-form .ck-form__row.ck-table-cell-properties-form__padding-row{padding:0;width:35%}.ck.ck-table-cell-properties-form .ck-form__row.ck-table-cell-properties-form__alignment-row .ck.ck-toolbar{background:none}"},function(e,t,n){var o=n(1),i=n(115);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=':root{--ck-todo-list-checkmark-size:16px}.ck-content .todo-list{list-style:none}.ck-content .todo-list li{margin-bottom:5px}.ck-content .todo-list li .todo-list{margin-top:5px}.ck-content .todo-list .todo-list__label>input{-webkit-appearance:none;display:inline-block;position:relative;width:var(--ck-todo-list-checkmark-size);height:var(--ck-todo-list-checkmark-size);vertical-align:middle;border:0;left:-25px;margin-right:-15px;right:0;margin-left:0}.ck-content .todo-list .todo-list__label>input:before{display:block;position:absolute;box-sizing:border-box;content:"";width:100%;height:100%;border:1px solid #333;border-radius:2px;transition:box-shadow .25s ease-in-out,background .25s ease-in-out,border .25s ease-in-out}.ck-content .todo-list .todo-list__label>input:after{display:block;position:absolute;box-sizing:content-box;pointer-events:none;content:"";left:calc(var(--ck-todo-list-checkmark-size)/3);top:calc(var(--ck-todo-list-checkmark-size)/5.3);width:calc(var(--ck-todo-list-checkmark-size)/5.3);height:calc(var(--ck-todo-list-checkmark-size)/2.6);border-left:0 solid transparent;border-bottom:calc(var(--ck-todo-list-checkmark-size)/8) solid transparent;border-right:calc(var(--ck-todo-list-checkmark-size)/8) solid transparent;border-top:0 solid transparent;transform:rotate(45deg)}.ck-content .todo-list .todo-list__label>input[checked]:before{background:#26ab33;border-color:#26ab33}.ck-content .todo-list .todo-list__label>input[checked]:after{border-color:#fff}.ck-content .todo-list .todo-list__label .todo-list__label__description{vertical-align:middle}[dir=rtl] .todo-list .todo-list__label>input{left:0;margin-right:0;right:-25px;margin-left:-15px}.ck-editor__editable .todo-list .todo-list__label>input{cursor:pointer}.ck-editor__editable .todo-list .todo-list__label>input:hover:before{box-shadow:0 0 0 5px rgba(0,0,0,.1)}'},function(e,t){},function(e,t,n){"use strict";e.exports=n(118)},function(e,t,n){"use strict";var o=n(3),i=n(126),r=n(130),s=n(131),a=n(139),c=n(153),l=n(166),d=n(20),u=n(168),h={default:n(170),zero:n(171),commonmark:n(172)},f=/^(vbscript|javascript|file|data):/,p=/^data:image\/(gif|png|jpeg|webp);/;function m(e){var t=e.trim().toLowerCase();return!f.test(t)||!!p.test(t)}var g=["http:","https:","mailto:"];function b(e){var t=d.parse(e,!0);if(t.hostname&&(!t.protocol||g.indexOf(t.protocol)>=0))try{t.hostname=u.toASCII(t.hostname)}catch(e){}return d.encode(d.format(t))}function w(e){var t=d.parse(e,!0);if(t.hostname&&(!t.protocol||g.indexOf(t.protocol)>=0))try{t.hostname=u.toUnicode(t.hostname)}catch(e){}return d.decode(d.format(t))}function k(e,t){if(!(this instanceof k))return new k(e,t);t||o.isString(e)||(t=e||{},e="default"),this.inline=new c,this.block=new a,this.core=new s,this.renderer=new r,this.linkify=new l,this.validateLink=m,this.normalizeLink=b,this.normalizeLinkText=w,this.utils=o,this.helpers=o.assign({},i),this.options={},this.configure(e),t&&this.set(t)}k.prototype.set=function(e){return o.assign(this.options,e),this},k.prototype.configure=function(e){var t,n=this;if(o.isString(e)&&!(e=h[t=e]))throw new Error('Wrong `markdown-it` preset "'+t+'", check name');if(!e)throw new Error("Wrong `markdown-it` preset, can't be empty");return e.options&&n.set(e.options),e.components&&Object.keys(e.components).forEach((function(t){e.components[t].rules&&n[t].ruler.enableOnly(e.components[t].rules),e.components[t].rules2&&n[t].ruler2.enableOnly(e.components[t].rules2)})),this},k.prototype.enable=function(e,t){var n=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach((function(t){n=n.concat(this[t].ruler.enable(e,!0))}),this),n=n.concat(this.inline.ruler2.enable(e,!0));var o=e.filter((function(e){return n.indexOf(e)<0}));if(o.length&&!t)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+o);return this},k.prototype.disable=function(e,t){var n=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach((function(t){n=n.concat(this[t].ruler.disable(e,!0))}),this),n=n.concat(this.inline.ruler2.disable(e,!0));var o=e.filter((function(e){return n.indexOf(e)<0}));if(o.length&&!t)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+o);return this},k.prototype.use=function(e){var t=[this].concat(Array.prototype.slice.call(arguments,1));return e.apply(e,t),this},k.prototype.parse=function(e,t){if("string"!=typeof e)throw new Error("Input data should be a String");var n=new this.core.State(e,this,t);return this.core.process(n),n.tokens},k.prototype.render=function(e,t){return t=t||{},this.renderer.render(this.parse(e,t),this.options,t)},k.prototype.parseInline=function(e,t){var n=new this.core.State(e,this,t);return n.inlineMode=!0,this.core.process(n),n.tokens},k.prototype.renderInline=function(e,t){return t=t||{},this.renderer.render(this.parseInline(e,t),this.options,t)},e.exports=k},function(e){e.exports=JSON.parse('{"Aacute":"Á","aacute":"á","Abreve":"Ă","abreve":"ă","ac":"∾","acd":"∿","acE":"∾̳","Acirc":"Â","acirc":"â","acute":"´","Acy":"А","acy":"а","AElig":"Æ","aelig":"æ","af":"","Afr":"𝔄","afr":"𝔞","Agrave":"À","agrave":"à","alefsym":"ℵ","aleph":"ℵ","Alpha":"Α","alpha":"α","Amacr":"Ā","amacr":"ā","amalg":"⨿","amp":"&","AMP":"&","andand":"⩕","And":"⩓","and":"∧","andd":"⩜","andslope":"⩘","andv":"⩚","ang":"∠","ange":"⦤","angle":"∠","angmsdaa":"⦨","angmsdab":"⦩","angmsdac":"⦪","angmsdad":"⦫","angmsdae":"⦬","angmsdaf":"⦭","angmsdag":"⦮","angmsdah":"⦯","angmsd":"∡","angrt":"∟","angrtvb":"⊾","angrtvbd":"⦝","angsph":"∢","angst":"Å","angzarr":"⍼","Aogon":"Ą","aogon":"ą","Aopf":"𝔸","aopf":"𝕒","apacir":"⩯","ap":"≈","apE":"⩰","ape":"≊","apid":"≋","apos":"\'","ApplyFunction":"","approx":"≈","approxeq":"≊","Aring":"Å","aring":"å","Ascr":"𝒜","ascr":"𝒶","Assign":"≔","ast":"*","asymp":"≈","asympeq":"≍","Atilde":"Ã","atilde":"ã","Auml":"Ä","auml":"ä","awconint":"∳","awint":"⨑","backcong":"≌","backepsilon":"϶","backprime":"‵","backsim":"∽","backsimeq":"⋍","Backslash":"∖","Barv":"⫧","barvee":"⊽","barwed":"⌅","Barwed":"⌆","barwedge":"⌅","bbrk":"⎵","bbrktbrk":"⎶","bcong":"≌","Bcy":"Б","bcy":"б","bdquo":"„","becaus":"∵","because":"∵","Because":"∵","bemptyv":"⦰","bepsi":"϶","bernou":"ℬ","Bernoullis":"ℬ","Beta":"Β","beta":"β","beth":"ℶ","between":"≬","Bfr":"𝔅","bfr":"𝔟","bigcap":"⋂","bigcirc":"◯","bigcup":"⋃","bigodot":"⨀","bigoplus":"⨁","bigotimes":"⨂","bigsqcup":"⨆","bigstar":"★","bigtriangledown":"▽","bigtriangleup":"△","biguplus":"⨄","bigvee":"⋁","bigwedge":"⋀","bkarow":"⤍","blacklozenge":"⧫","blacksquare":"▪","blacktriangle":"▴","blacktriangledown":"▾","blacktriangleleft":"◂","blacktriangleright":"▸","blank":"␣","blk12":"▒","blk14":"░","blk34":"▓","block":"█","bne":"=⃥","bnequiv":"≡⃥","bNot":"⫭","bnot":"⌐","Bopf":"𝔹","bopf":"𝕓","bot":"⊥","bottom":"⊥","bowtie":"⋈","boxbox":"⧉","boxdl":"┐","boxdL":"╕","boxDl":"╖","boxDL":"╗","boxdr":"┌","boxdR":"╒","boxDr":"╓","boxDR":"╔","boxh":"─","boxH":"═","boxhd":"┬","boxHd":"╤","boxhD":"╥","boxHD":"╦","boxhu":"┴","boxHu":"╧","boxhU":"╨","boxHU":"╩","boxminus":"⊟","boxplus":"⊞","boxtimes":"⊠","boxul":"┘","boxuL":"╛","boxUl":"╜","boxUL":"╝","boxur":"└","boxuR":"╘","boxUr":"╙","boxUR":"╚","boxv":"│","boxV":"║","boxvh":"┼","boxvH":"╪","boxVh":"╫","boxVH":"╬","boxvl":"┤","boxvL":"╡","boxVl":"╢","boxVL":"╣","boxvr":"├","boxvR":"╞","boxVr":"╟","boxVR":"╠","bprime":"‵","breve":"˘","Breve":"˘","brvbar":"¦","bscr":"𝒷","Bscr":"ℬ","bsemi":"⁏","bsim":"∽","bsime":"⋍","bsolb":"⧅","bsol":"\\\\","bsolhsub":"⟈","bull":"•","bullet":"•","bump":"≎","bumpE":"⪮","bumpe":"≏","Bumpeq":"≎","bumpeq":"≏","Cacute":"Ć","cacute":"ć","capand":"⩄","capbrcup":"⩉","capcap":"⩋","cap":"∩","Cap":"⋒","capcup":"⩇","capdot":"⩀","CapitalDifferentialD":"ⅅ","caps":"∩︀","caret":"⁁","caron":"ˇ","Cayleys":"ℭ","ccaps":"⩍","Ccaron":"Č","ccaron":"č","Ccedil":"Ç","ccedil":"ç","Ccirc":"Ĉ","ccirc":"ĉ","Cconint":"∰","ccups":"⩌","ccupssm":"⩐","Cdot":"Ċ","cdot":"ċ","cedil":"¸","Cedilla":"¸","cemptyv":"⦲","cent":"¢","centerdot":"·","CenterDot":"·","cfr":"𝔠","Cfr":"ℭ","CHcy":"Ч","chcy":"ч","check":"✓","checkmark":"✓","Chi":"Χ","chi":"χ","circ":"ˆ","circeq":"≗","circlearrowleft":"↺","circlearrowright":"↻","circledast":"⊛","circledcirc":"⊚","circleddash":"⊝","CircleDot":"⊙","circledR":"®","circledS":"Ⓢ","CircleMinus":"⊖","CirclePlus":"⊕","CircleTimes":"⊗","cir":"○","cirE":"⧃","cire":"≗","cirfnint":"⨐","cirmid":"⫯","cirscir":"⧂","ClockwiseContourIntegral":"∲","CloseCurlyDoubleQuote":"”","CloseCurlyQuote":"’","clubs":"♣","clubsuit":"♣","colon":":","Colon":"∷","Colone":"⩴","colone":"≔","coloneq":"≔","comma":",","commat":"@","comp":"∁","compfn":"∘","complement":"∁","complexes":"ℂ","cong":"≅","congdot":"⩭","Congruent":"≡","conint":"∮","Conint":"∯","ContourIntegral":"∮","copf":"𝕔","Copf":"ℂ","coprod":"∐","Coproduct":"∐","copy":"©","COPY":"©","copysr":"℗","CounterClockwiseContourIntegral":"∳","crarr":"↵","cross":"✗","Cross":"⨯","Cscr":"𝒞","cscr":"𝒸","csub":"⫏","csube":"⫑","csup":"⫐","csupe":"⫒","ctdot":"⋯","cudarrl":"⤸","cudarrr":"⤵","cuepr":"⋞","cuesc":"⋟","cularr":"↶","cularrp":"⤽","cupbrcap":"⩈","cupcap":"⩆","CupCap":"≍","cup":"∪","Cup":"⋓","cupcup":"⩊","cupdot":"⊍","cupor":"⩅","cups":"∪︀","curarr":"↷","curarrm":"⤼","curlyeqprec":"⋞","curlyeqsucc":"⋟","curlyvee":"⋎","curlywedge":"⋏","curren":"¤","curvearrowleft":"↶","curvearrowright":"↷","cuvee":"⋎","cuwed":"⋏","cwconint":"∲","cwint":"∱","cylcty":"⌭","dagger":"†","Dagger":"‡","daleth":"ℸ","darr":"↓","Darr":"↡","dArr":"⇓","dash":"‐","Dashv":"⫤","dashv":"⊣","dbkarow":"⤏","dblac":"˝","Dcaron":"Ď","dcaron":"ď","Dcy":"Д","dcy":"д","ddagger":"‡","ddarr":"⇊","DD":"ⅅ","dd":"ⅆ","DDotrahd":"⤑","ddotseq":"⩷","deg":"°","Del":"∇","Delta":"Δ","delta":"δ","demptyv":"⦱","dfisht":"⥿","Dfr":"𝔇","dfr":"𝔡","dHar":"⥥","dharl":"⇃","dharr":"⇂","DiacriticalAcute":"´","DiacriticalDot":"˙","DiacriticalDoubleAcute":"˝","DiacriticalGrave":"`","DiacriticalTilde":"˜","diam":"⋄","diamond":"⋄","Diamond":"⋄","diamondsuit":"♦","diams":"♦","die":"¨","DifferentialD":"ⅆ","digamma":"ϝ","disin":"⋲","div":"÷","divide":"÷","divideontimes":"⋇","divonx":"⋇","DJcy":"Ђ","djcy":"ђ","dlcorn":"⌞","dlcrop":"⌍","dollar":"$","Dopf":"𝔻","dopf":"𝕕","Dot":"¨","dot":"˙","DotDot":"⃜","doteq":"≐","doteqdot":"≑","DotEqual":"≐","dotminus":"∸","dotplus":"∔","dotsquare":"⊡","doublebarwedge":"⌆","DoubleContourIntegral":"∯","DoubleDot":"¨","DoubleDownArrow":"⇓","DoubleLeftArrow":"⇐","DoubleLeftRightArrow":"⇔","DoubleLeftTee":"⫤","DoubleLongLeftArrow":"⟸","DoubleLongLeftRightArrow":"⟺","DoubleLongRightArrow":"⟹","DoubleRightArrow":"⇒","DoubleRightTee":"⊨","DoubleUpArrow":"⇑","DoubleUpDownArrow":"⇕","DoubleVerticalBar":"∥","DownArrowBar":"⤓","downarrow":"↓","DownArrow":"↓","Downarrow":"⇓","DownArrowUpArrow":"⇵","DownBreve":"̑","downdownarrows":"⇊","downharpoonleft":"⇃","downharpoonright":"⇂","DownLeftRightVector":"⥐","DownLeftTeeVector":"⥞","DownLeftVectorBar":"⥖","DownLeftVector":"↽","DownRightTeeVector":"⥟","DownRightVectorBar":"⥗","DownRightVector":"⇁","DownTeeArrow":"↧","DownTee":"⊤","drbkarow":"⤐","drcorn":"⌟","drcrop":"⌌","Dscr":"𝒟","dscr":"𝒹","DScy":"Ѕ","dscy":"ѕ","dsol":"⧶","Dstrok":"Đ","dstrok":"đ","dtdot":"⋱","dtri":"▿","dtrif":"▾","duarr":"⇵","duhar":"⥯","dwangle":"⦦","DZcy":"Џ","dzcy":"џ","dzigrarr":"⟿","Eacute":"É","eacute":"é","easter":"⩮","Ecaron":"Ě","ecaron":"ě","Ecirc":"Ê","ecirc":"ê","ecir":"≖","ecolon":"≕","Ecy":"Э","ecy":"э","eDDot":"⩷","Edot":"Ė","edot":"ė","eDot":"≑","ee":"ⅇ","efDot":"≒","Efr":"𝔈","efr":"𝔢","eg":"⪚","Egrave":"È","egrave":"è","egs":"⪖","egsdot":"⪘","el":"⪙","Element":"∈","elinters":"⏧","ell":"ℓ","els":"⪕","elsdot":"⪗","Emacr":"Ē","emacr":"ē","empty":"∅","emptyset":"∅","EmptySmallSquare":"◻","emptyv":"∅","EmptyVerySmallSquare":"▫","emsp13":" ","emsp14":" ","emsp":" ","ENG":"Ŋ","eng":"ŋ","ensp":" ","Eogon":"Ę","eogon":"ę","Eopf":"𝔼","eopf":"𝕖","epar":"⋕","eparsl":"⧣","eplus":"⩱","epsi":"ε","Epsilon":"Ε","epsilon":"ε","epsiv":"ϵ","eqcirc":"≖","eqcolon":"≕","eqsim":"≂","eqslantgtr":"⪖","eqslantless":"⪕","Equal":"⩵","equals":"=","EqualTilde":"≂","equest":"≟","Equilibrium":"⇌","equiv":"≡","equivDD":"⩸","eqvparsl":"⧥","erarr":"⥱","erDot":"≓","escr":"ℯ","Escr":"ℰ","esdot":"≐","Esim":"⩳","esim":"≂","Eta":"Η","eta":"η","ETH":"Ð","eth":"ð","Euml":"Ë","euml":"ë","euro":"€","excl":"!","exist":"∃","Exists":"∃","expectation":"ℰ","exponentiale":"ⅇ","ExponentialE":"ⅇ","fallingdotseq":"≒","Fcy":"Ф","fcy":"ф","female":"♀","ffilig":"ffi","fflig":"ff","ffllig":"ffl","Ffr":"𝔉","ffr":"𝔣","filig":"fi","FilledSmallSquare":"◼","FilledVerySmallSquare":"▪","fjlig":"fj","flat":"♭","fllig":"fl","fltns":"▱","fnof":"ƒ","Fopf":"𝔽","fopf":"𝕗","forall":"∀","ForAll":"∀","fork":"⋔","forkv":"⫙","Fouriertrf":"ℱ","fpartint":"⨍","frac12":"½","frac13":"⅓","frac14":"¼","frac15":"⅕","frac16":"⅙","frac18":"⅛","frac23":"⅔","frac25":"⅖","frac34":"¾","frac35":"⅗","frac38":"⅜","frac45":"⅘","frac56":"⅚","frac58":"⅝","frac78":"⅞","frasl":"⁄","frown":"⌢","fscr":"𝒻","Fscr":"ℱ","gacute":"ǵ","Gamma":"Γ","gamma":"γ","Gammad":"Ϝ","gammad":"ϝ","gap":"⪆","Gbreve":"Ğ","gbreve":"ğ","Gcedil":"Ģ","Gcirc":"Ĝ","gcirc":"ĝ","Gcy":"Г","gcy":"г","Gdot":"Ġ","gdot":"ġ","ge":"≥","gE":"≧","gEl":"⪌","gel":"⋛","geq":"≥","geqq":"≧","geqslant":"⩾","gescc":"⪩","ges":"⩾","gesdot":"⪀","gesdoto":"⪂","gesdotol":"⪄","gesl":"⋛︀","gesles":"⪔","Gfr":"𝔊","gfr":"𝔤","gg":"≫","Gg":"⋙","ggg":"⋙","gimel":"ℷ","GJcy":"Ѓ","gjcy":"ѓ","gla":"⪥","gl":"≷","glE":"⪒","glj":"⪤","gnap":"⪊","gnapprox":"⪊","gne":"⪈","gnE":"≩","gneq":"⪈","gneqq":"≩","gnsim":"⋧","Gopf":"𝔾","gopf":"𝕘","grave":"`","GreaterEqual":"≥","GreaterEqualLess":"⋛","GreaterFullEqual":"≧","GreaterGreater":"⪢","GreaterLess":"≷","GreaterSlantEqual":"⩾","GreaterTilde":"≳","Gscr":"𝒢","gscr":"ℊ","gsim":"≳","gsime":"⪎","gsiml":"⪐","gtcc":"⪧","gtcir":"⩺","gt":">","GT":">","Gt":"≫","gtdot":"⋗","gtlPar":"⦕","gtquest":"⩼","gtrapprox":"⪆","gtrarr":"⥸","gtrdot":"⋗","gtreqless":"⋛","gtreqqless":"⪌","gtrless":"≷","gtrsim":"≳","gvertneqq":"≩︀","gvnE":"≩︀","Hacek":"ˇ","hairsp":" ","half":"½","hamilt":"ℋ","HARDcy":"Ъ","hardcy":"ъ","harrcir":"⥈","harr":"↔","hArr":"⇔","harrw":"↭","Hat":"^","hbar":"ℏ","Hcirc":"Ĥ","hcirc":"ĥ","hearts":"♥","heartsuit":"♥","hellip":"…","hercon":"⊹","hfr":"𝔥","Hfr":"ℌ","HilbertSpace":"ℋ","hksearow":"⤥","hkswarow":"⤦","hoarr":"⇿","homtht":"∻","hookleftarrow":"↩","hookrightarrow":"↪","hopf":"𝕙","Hopf":"ℍ","horbar":"―","HorizontalLine":"─","hscr":"𝒽","Hscr":"ℋ","hslash":"ℏ","Hstrok":"Ħ","hstrok":"ħ","HumpDownHump":"≎","HumpEqual":"≏","hybull":"⁃","hyphen":"‐","Iacute":"Í","iacute":"í","ic":"","Icirc":"Î","icirc":"î","Icy":"И","icy":"и","Idot":"İ","IEcy":"Е","iecy":"е","iexcl":"¡","iff":"⇔","ifr":"𝔦","Ifr":"ℑ","Igrave":"Ì","igrave":"ì","ii":"ⅈ","iiiint":"⨌","iiint":"∭","iinfin":"⧜","iiota":"℩","IJlig":"IJ","ijlig":"ij","Imacr":"Ī","imacr":"ī","image":"ℑ","ImaginaryI":"ⅈ","imagline":"ℐ","imagpart":"ℑ","imath":"ı","Im":"ℑ","imof":"⊷","imped":"Ƶ","Implies":"⇒","incare":"℅","in":"∈","infin":"∞","infintie":"⧝","inodot":"ı","intcal":"⊺","int":"∫","Int":"∬","integers":"ℤ","Integral":"∫","intercal":"⊺","Intersection":"⋂","intlarhk":"⨗","intprod":"⨼","InvisibleComma":"","InvisibleTimes":"","IOcy":"Ё","iocy":"ё","Iogon":"Į","iogon":"į","Iopf":"𝕀","iopf":"𝕚","Iota":"Ι","iota":"ι","iprod":"⨼","iquest":"¿","iscr":"𝒾","Iscr":"ℐ","isin":"∈","isindot":"⋵","isinE":"⋹","isins":"⋴","isinsv":"⋳","isinv":"∈","it":"","Itilde":"Ĩ","itilde":"ĩ","Iukcy":"І","iukcy":"і","Iuml":"Ï","iuml":"ï","Jcirc":"Ĵ","jcirc":"ĵ","Jcy":"Й","jcy":"й","Jfr":"𝔍","jfr":"𝔧","jmath":"ȷ","Jopf":"𝕁","jopf":"𝕛","Jscr":"𝒥","jscr":"𝒿","Jsercy":"Ј","jsercy":"ј","Jukcy":"Є","jukcy":"є","Kappa":"Κ","kappa":"κ","kappav":"ϰ","Kcedil":"Ķ","kcedil":"ķ","Kcy":"К","kcy":"к","Kfr":"𝔎","kfr":"𝔨","kgreen":"ĸ","KHcy":"Х","khcy":"х","KJcy":"Ќ","kjcy":"ќ","Kopf":"𝕂","kopf":"𝕜","Kscr":"𝒦","kscr":"𝓀","lAarr":"⇚","Lacute":"Ĺ","lacute":"ĺ","laemptyv":"⦴","lagran":"ℒ","Lambda":"Λ","lambda":"λ","lang":"⟨","Lang":"⟪","langd":"⦑","langle":"⟨","lap":"⪅","Laplacetrf":"ℒ","laquo":"«","larrb":"⇤","larrbfs":"⤟","larr":"←","Larr":"↞","lArr":"⇐","larrfs":"⤝","larrhk":"↩","larrlp":"↫","larrpl":"⤹","larrsim":"⥳","larrtl":"↢","latail":"⤙","lAtail":"⤛","lat":"⪫","late":"⪭","lates":"⪭︀","lbarr":"⤌","lBarr":"⤎","lbbrk":"❲","lbrace":"{","lbrack":"[","lbrke":"⦋","lbrksld":"⦏","lbrkslu":"⦍","Lcaron":"Ľ","lcaron":"ľ","Lcedil":"Ļ","lcedil":"ļ","lceil":"⌈","lcub":"{","Lcy":"Л","lcy":"л","ldca":"⤶","ldquo":"“","ldquor":"„","ldrdhar":"⥧","ldrushar":"⥋","ldsh":"↲","le":"≤","lE":"≦","LeftAngleBracket":"⟨","LeftArrowBar":"⇤","leftarrow":"←","LeftArrow":"←","Leftarrow":"⇐","LeftArrowRightArrow":"⇆","leftarrowtail":"↢","LeftCeiling":"⌈","LeftDoubleBracket":"⟦","LeftDownTeeVector":"⥡","LeftDownVectorBar":"⥙","LeftDownVector":"⇃","LeftFloor":"⌊","leftharpoondown":"↽","leftharpoonup":"↼","leftleftarrows":"⇇","leftrightarrow":"↔","LeftRightArrow":"↔","Leftrightarrow":"⇔","leftrightarrows":"⇆","leftrightharpoons":"⇋","leftrightsquigarrow":"↭","LeftRightVector":"⥎","LeftTeeArrow":"↤","LeftTee":"⊣","LeftTeeVector":"⥚","leftthreetimes":"⋋","LeftTriangleBar":"⧏","LeftTriangle":"⊲","LeftTriangleEqual":"⊴","LeftUpDownVector":"⥑","LeftUpTeeVector":"⥠","LeftUpVectorBar":"⥘","LeftUpVector":"↿","LeftVectorBar":"⥒","LeftVector":"↼","lEg":"⪋","leg":"⋚","leq":"≤","leqq":"≦","leqslant":"⩽","lescc":"⪨","les":"⩽","lesdot":"⩿","lesdoto":"⪁","lesdotor":"⪃","lesg":"⋚︀","lesges":"⪓","lessapprox":"⪅","lessdot":"⋖","lesseqgtr":"⋚","lesseqqgtr":"⪋","LessEqualGreater":"⋚","LessFullEqual":"≦","LessGreater":"≶","lessgtr":"≶","LessLess":"⪡","lesssim":"≲","LessSlantEqual":"⩽","LessTilde":"≲","lfisht":"⥼","lfloor":"⌊","Lfr":"𝔏","lfr":"𝔩","lg":"≶","lgE":"⪑","lHar":"⥢","lhard":"↽","lharu":"↼","lharul":"⥪","lhblk":"▄","LJcy":"Љ","ljcy":"љ","llarr":"⇇","ll":"≪","Ll":"⋘","llcorner":"⌞","Lleftarrow":"⇚","llhard":"⥫","lltri":"◺","Lmidot":"Ŀ","lmidot":"ŀ","lmoustache":"⎰","lmoust":"⎰","lnap":"⪉","lnapprox":"⪉","lne":"⪇","lnE":"≨","lneq":"⪇","lneqq":"≨","lnsim":"⋦","loang":"⟬","loarr":"⇽","lobrk":"⟦","longleftarrow":"⟵","LongLeftArrow":"⟵","Longleftarrow":"⟸","longleftrightarrow":"⟷","LongLeftRightArrow":"⟷","Longleftrightarrow":"⟺","longmapsto":"⟼","longrightarrow":"⟶","LongRightArrow":"⟶","Longrightarrow":"⟹","looparrowleft":"↫","looparrowright":"↬","lopar":"⦅","Lopf":"𝕃","lopf":"𝕝","loplus":"⨭","lotimes":"⨴","lowast":"∗","lowbar":"_","LowerLeftArrow":"↙","LowerRightArrow":"↘","loz":"◊","lozenge":"◊","lozf":"⧫","lpar":"(","lparlt":"⦓","lrarr":"⇆","lrcorner":"⌟","lrhar":"⇋","lrhard":"⥭","lrm":"","lrtri":"⊿","lsaquo":"‹","lscr":"𝓁","Lscr":"ℒ","lsh":"↰","Lsh":"↰","lsim":"≲","lsime":"⪍","lsimg":"⪏","lsqb":"[","lsquo":"‘","lsquor":"‚","Lstrok":"Ł","lstrok":"ł","ltcc":"⪦","ltcir":"⩹","lt":"<","LT":"<","Lt":"≪","ltdot":"⋖","lthree":"⋋","ltimes":"⋉","ltlarr":"⥶","ltquest":"⩻","ltri":"◃","ltrie":"⊴","ltrif":"◂","ltrPar":"⦖","lurdshar":"⥊","luruhar":"⥦","lvertneqq":"≨︀","lvnE":"≨︀","macr":"¯","male":"♂","malt":"✠","maltese":"✠","Map":"⤅","map":"↦","mapsto":"↦","mapstodown":"↧","mapstoleft":"↤","mapstoup":"↥","marker":"▮","mcomma":"⨩","Mcy":"М","mcy":"м","mdash":"—","mDDot":"∺","measuredangle":"∡","MediumSpace":" ","Mellintrf":"ℳ","Mfr":"𝔐","mfr":"𝔪","mho":"℧","micro":"µ","midast":"*","midcir":"⫰","mid":"∣","middot":"·","minusb":"⊟","minus":"−","minusd":"∸","minusdu":"⨪","MinusPlus":"∓","mlcp":"⫛","mldr":"…","mnplus":"∓","models":"⊧","Mopf":"𝕄","mopf":"𝕞","mp":"∓","mscr":"𝓂","Mscr":"ℳ","mstpos":"∾","Mu":"Μ","mu":"μ","multimap":"⊸","mumap":"⊸","nabla":"∇","Nacute":"Ń","nacute":"ń","nang":"∠⃒","nap":"≉","napE":"⩰̸","napid":"≋̸","napos":"ʼn","napprox":"≉","natural":"♮","naturals":"ℕ","natur":"♮","nbsp":" ","nbump":"≎̸","nbumpe":"≏̸","ncap":"⩃","Ncaron":"Ň","ncaron":"ň","Ncedil":"Ņ","ncedil":"ņ","ncong":"≇","ncongdot":"⩭̸","ncup":"⩂","Ncy":"Н","ncy":"н","ndash":"–","nearhk":"⤤","nearr":"↗","neArr":"⇗","nearrow":"↗","ne":"≠","nedot":"≐̸","NegativeMediumSpace":"","NegativeThickSpace":"","NegativeThinSpace":"","NegativeVeryThinSpace":"","nequiv":"≢","nesear":"⤨","nesim":"≂̸","NestedGreaterGreater":"≫","NestedLessLess":"≪","NewLine":"\\n","nexist":"∄","nexists":"∄","Nfr":"𝔑","nfr":"𝔫","ngE":"≧̸","nge":"≱","ngeq":"≱","ngeqq":"≧̸","ngeqslant":"⩾̸","nges":"⩾̸","nGg":"⋙̸","ngsim":"≵","nGt":"≫⃒","ngt":"≯","ngtr":"≯","nGtv":"≫̸","nharr":"↮","nhArr":"⇎","nhpar":"⫲","ni":"∋","nis":"⋼","nisd":"⋺","niv":"∋","NJcy":"Њ","njcy":"њ","nlarr":"↚","nlArr":"⇍","nldr":"‥","nlE":"≦̸","nle":"≰","nleftarrow":"↚","nLeftarrow":"⇍","nleftrightarrow":"↮","nLeftrightarrow":"⇎","nleq":"≰","nleqq":"≦̸","nleqslant":"⩽̸","nles":"⩽̸","nless":"≮","nLl":"⋘̸","nlsim":"≴","nLt":"≪⃒","nlt":"≮","nltri":"⋪","nltrie":"⋬","nLtv":"≪̸","nmid":"∤","NoBreak":"","NonBreakingSpace":" ","nopf":"𝕟","Nopf":"ℕ","Not":"⫬","not":"¬","NotCongruent":"≢","NotCupCap":"≭","NotDoubleVerticalBar":"∦","NotElement":"∉","NotEqual":"≠","NotEqualTilde":"≂̸","NotExists":"∄","NotGreater":"≯","NotGreaterEqual":"≱","NotGreaterFullEqual":"≧̸","NotGreaterGreater":"≫̸","NotGreaterLess":"≹","NotGreaterSlantEqual":"⩾̸","NotGreaterTilde":"≵","NotHumpDownHump":"≎̸","NotHumpEqual":"≏̸","notin":"∉","notindot":"⋵̸","notinE":"⋹̸","notinva":"∉","notinvb":"⋷","notinvc":"⋶","NotLeftTriangleBar":"⧏̸","NotLeftTriangle":"⋪","NotLeftTriangleEqual":"⋬","NotLess":"≮","NotLessEqual":"≰","NotLessGreater":"≸","NotLessLess":"≪̸","NotLessSlantEqual":"⩽̸","NotLessTilde":"≴","NotNestedGreaterGreater":"⪢̸","NotNestedLessLess":"⪡̸","notni":"∌","notniva":"∌","notnivb":"⋾","notnivc":"⋽","NotPrecedes":"⊀","NotPrecedesEqual":"⪯̸","NotPrecedesSlantEqual":"⋠","NotReverseElement":"∌","NotRightTriangleBar":"⧐̸","NotRightTriangle":"⋫","NotRightTriangleEqual":"⋭","NotSquareSubset":"⊏̸","NotSquareSubsetEqual":"⋢","NotSquareSuperset":"⊐̸","NotSquareSupersetEqual":"⋣","NotSubset":"⊂⃒","NotSubsetEqual":"⊈","NotSucceeds":"⊁","NotSucceedsEqual":"⪰̸","NotSucceedsSlantEqual":"⋡","NotSucceedsTilde":"≿̸","NotSuperset":"⊃⃒","NotSupersetEqual":"⊉","NotTilde":"≁","NotTildeEqual":"≄","NotTildeFullEqual":"≇","NotTildeTilde":"≉","NotVerticalBar":"∤","nparallel":"∦","npar":"∦","nparsl":"⫽⃥","npart":"∂̸","npolint":"⨔","npr":"⊀","nprcue":"⋠","nprec":"⊀","npreceq":"⪯̸","npre":"⪯̸","nrarrc":"⤳̸","nrarr":"↛","nrArr":"⇏","nrarrw":"↝̸","nrightarrow":"↛","nRightarrow":"⇏","nrtri":"⋫","nrtrie":"⋭","nsc":"⊁","nsccue":"⋡","nsce":"⪰̸","Nscr":"𝒩","nscr":"𝓃","nshortmid":"∤","nshortparallel":"∦","nsim":"≁","nsime":"≄","nsimeq":"≄","nsmid":"∤","nspar":"∦","nsqsube":"⋢","nsqsupe":"⋣","nsub":"⊄","nsubE":"⫅̸","nsube":"⊈","nsubset":"⊂⃒","nsubseteq":"⊈","nsubseteqq":"⫅̸","nsucc":"⊁","nsucceq":"⪰̸","nsup":"⊅","nsupE":"⫆̸","nsupe":"⊉","nsupset":"⊃⃒","nsupseteq":"⊉","nsupseteqq":"⫆̸","ntgl":"≹","Ntilde":"Ñ","ntilde":"ñ","ntlg":"≸","ntriangleleft":"⋪","ntrianglelefteq":"⋬","ntriangleright":"⋫","ntrianglerighteq":"⋭","Nu":"Ν","nu":"ν","num":"#","numero":"№","numsp":" ","nvap":"≍⃒","nvdash":"⊬","nvDash":"⊭","nVdash":"⊮","nVDash":"⊯","nvge":"≥⃒","nvgt":">⃒","nvHarr":"⤄","nvinfin":"⧞","nvlArr":"⤂","nvle":"≤⃒","nvlt":"<⃒","nvltrie":"⊴⃒","nvrArr":"⤃","nvrtrie":"⊵⃒","nvsim":"∼⃒","nwarhk":"⤣","nwarr":"↖","nwArr":"⇖","nwarrow":"↖","nwnear":"⤧","Oacute":"Ó","oacute":"ó","oast":"⊛","Ocirc":"Ô","ocirc":"ô","ocir":"⊚","Ocy":"О","ocy":"о","odash":"⊝","Odblac":"Ő","odblac":"ő","odiv":"⨸","odot":"⊙","odsold":"⦼","OElig":"Œ","oelig":"œ","ofcir":"⦿","Ofr":"𝔒","ofr":"𝔬","ogon":"˛","Ograve":"Ò","ograve":"ò","ogt":"⧁","ohbar":"⦵","ohm":"Ω","oint":"∮","olarr":"↺","olcir":"⦾","olcross":"⦻","oline":"‾","olt":"⧀","Omacr":"Ō","omacr":"ō","Omega":"Ω","omega":"ω","Omicron":"Ο","omicron":"ο","omid":"⦶","ominus":"⊖","Oopf":"𝕆","oopf":"𝕠","opar":"⦷","OpenCurlyDoubleQuote":"“","OpenCurlyQuote":"‘","operp":"⦹","oplus":"⊕","orarr":"↻","Or":"⩔","or":"∨","ord":"⩝","order":"ℴ","orderof":"ℴ","ordf":"ª","ordm":"º","origof":"⊶","oror":"⩖","orslope":"⩗","orv":"⩛","oS":"Ⓢ","Oscr":"𝒪","oscr":"ℴ","Oslash":"Ø","oslash":"ø","osol":"⊘","Otilde":"Õ","otilde":"õ","otimesas":"⨶","Otimes":"⨷","otimes":"⊗","Ouml":"Ö","ouml":"ö","ovbar":"⌽","OverBar":"‾","OverBrace":"⏞","OverBracket":"⎴","OverParenthesis":"⏜","para":"¶","parallel":"∥","par":"∥","parsim":"⫳","parsl":"⫽","part":"∂","PartialD":"∂","Pcy":"П","pcy":"п","percnt":"%","period":".","permil":"‰","perp":"⊥","pertenk":"‱","Pfr":"𝔓","pfr":"𝔭","Phi":"Φ","phi":"φ","phiv":"ϕ","phmmat":"ℳ","phone":"☎","Pi":"Π","pi":"π","pitchfork":"⋔","piv":"ϖ","planck":"ℏ","planckh":"ℎ","plankv":"ℏ","plusacir":"⨣","plusb":"⊞","pluscir":"⨢","plus":"+","plusdo":"∔","plusdu":"⨥","pluse":"⩲","PlusMinus":"±","plusmn":"±","plussim":"⨦","plustwo":"⨧","pm":"±","Poincareplane":"ℌ","pointint":"⨕","popf":"𝕡","Popf":"ℙ","pound":"£","prap":"⪷","Pr":"⪻","pr":"≺","prcue":"≼","precapprox":"⪷","prec":"≺","preccurlyeq":"≼","Precedes":"≺","PrecedesEqual":"⪯","PrecedesSlantEqual":"≼","PrecedesTilde":"≾","preceq":"⪯","precnapprox":"⪹","precneqq":"⪵","precnsim":"⋨","pre":"⪯","prE":"⪳","precsim":"≾","prime":"′","Prime":"″","primes":"ℙ","prnap":"⪹","prnE":"⪵","prnsim":"⋨","prod":"∏","Product":"∏","profalar":"⌮","profline":"⌒","profsurf":"⌓","prop":"∝","Proportional":"∝","Proportion":"∷","propto":"∝","prsim":"≾","prurel":"⊰","Pscr":"𝒫","pscr":"𝓅","Psi":"Ψ","psi":"ψ","puncsp":" ","Qfr":"𝔔","qfr":"𝔮","qint":"⨌","qopf":"𝕢","Qopf":"ℚ","qprime":"⁗","Qscr":"𝒬","qscr":"𝓆","quaternions":"ℍ","quatint":"⨖","quest":"?","questeq":"≟","quot":"\\"","QUOT":"\\"","rAarr":"⇛","race":"∽̱","Racute":"Ŕ","racute":"ŕ","radic":"√","raemptyv":"⦳","rang":"⟩","Rang":"⟫","rangd":"⦒","range":"⦥","rangle":"⟩","raquo":"»","rarrap":"⥵","rarrb":"⇥","rarrbfs":"⤠","rarrc":"⤳","rarr":"→","Rarr":"↠","rArr":"⇒","rarrfs":"⤞","rarrhk":"↪","rarrlp":"↬","rarrpl":"⥅","rarrsim":"⥴","Rarrtl":"⤖","rarrtl":"↣","rarrw":"↝","ratail":"⤚","rAtail":"⤜","ratio":"∶","rationals":"ℚ","rbarr":"⤍","rBarr":"⤏","RBarr":"⤐","rbbrk":"❳","rbrace":"}","rbrack":"]","rbrke":"⦌","rbrksld":"⦎","rbrkslu":"⦐","Rcaron":"Ř","rcaron":"ř","Rcedil":"Ŗ","rcedil":"ŗ","rceil":"⌉","rcub":"}","Rcy":"Р","rcy":"р","rdca":"⤷","rdldhar":"⥩","rdquo":"”","rdquor":"”","rdsh":"↳","real":"ℜ","realine":"ℛ","realpart":"ℜ","reals":"ℝ","Re":"ℜ","rect":"▭","reg":"®","REG":"®","ReverseElement":"∋","ReverseEquilibrium":"⇋","ReverseUpEquilibrium":"⥯","rfisht":"⥽","rfloor":"⌋","rfr":"𝔯","Rfr":"ℜ","rHar":"⥤","rhard":"⇁","rharu":"⇀","rharul":"⥬","Rho":"Ρ","rho":"ρ","rhov":"ϱ","RightAngleBracket":"⟩","RightArrowBar":"⇥","rightarrow":"→","RightArrow":"→","Rightarrow":"⇒","RightArrowLeftArrow":"⇄","rightarrowtail":"↣","RightCeiling":"⌉","RightDoubleBracket":"⟧","RightDownTeeVector":"⥝","RightDownVectorBar":"⥕","RightDownVector":"⇂","RightFloor":"⌋","rightharpoondown":"⇁","rightharpoonup":"⇀","rightleftarrows":"⇄","rightleftharpoons":"⇌","rightrightarrows":"⇉","rightsquigarrow":"↝","RightTeeArrow":"↦","RightTee":"⊢","RightTeeVector":"⥛","rightthreetimes":"⋌","RightTriangleBar":"⧐","RightTriangle":"⊳","RightTriangleEqual":"⊵","RightUpDownVector":"⥏","RightUpTeeVector":"⥜","RightUpVectorBar":"⥔","RightUpVector":"↾","RightVectorBar":"⥓","RightVector":"⇀","ring":"˚","risingdotseq":"≓","rlarr":"⇄","rlhar":"⇌","rlm":"","rmoustache":"⎱","rmoust":"⎱","rnmid":"⫮","roang":"⟭","roarr":"⇾","robrk":"⟧","ropar":"⦆","ropf":"𝕣","Ropf":"ℝ","roplus":"⨮","rotimes":"⨵","RoundImplies":"⥰","rpar":")","rpargt":"⦔","rppolint":"⨒","rrarr":"⇉","Rrightarrow":"⇛","rsaquo":"›","rscr":"𝓇","Rscr":"ℛ","rsh":"↱","Rsh":"↱","rsqb":"]","rsquo":"’","rsquor":"’","rthree":"⋌","rtimes":"⋊","rtri":"▹","rtrie":"⊵","rtrif":"▸","rtriltri":"⧎","RuleDelayed":"⧴","ruluhar":"⥨","rx":"℞","Sacute":"Ś","sacute":"ś","sbquo":"‚","scap":"⪸","Scaron":"Š","scaron":"š","Sc":"⪼","sc":"≻","sccue":"≽","sce":"⪰","scE":"⪴","Scedil":"Ş","scedil":"ş","Scirc":"Ŝ","scirc":"ŝ","scnap":"⪺","scnE":"⪶","scnsim":"⋩","scpolint":"⨓","scsim":"≿","Scy":"С","scy":"с","sdotb":"⊡","sdot":"⋅","sdote":"⩦","searhk":"⤥","searr":"↘","seArr":"⇘","searrow":"↘","sect":"§","semi":";","seswar":"⤩","setminus":"∖","setmn":"∖","sext":"✶","Sfr":"𝔖","sfr":"𝔰","sfrown":"⌢","sharp":"♯","SHCHcy":"Щ","shchcy":"щ","SHcy":"Ш","shcy":"ш","ShortDownArrow":"↓","ShortLeftArrow":"←","shortmid":"∣","shortparallel":"∥","ShortRightArrow":"→","ShortUpArrow":"↑","shy":"","Sigma":"Σ","sigma":"σ","sigmaf":"ς","sigmav":"ς","sim":"∼","simdot":"⩪","sime":"≃","simeq":"≃","simg":"⪞","simgE":"⪠","siml":"⪝","simlE":"⪟","simne":"≆","simplus":"⨤","simrarr":"⥲","slarr":"←","SmallCircle":"∘","smallsetminus":"∖","smashp":"⨳","smeparsl":"⧤","smid":"∣","smile":"⌣","smt":"⪪","smte":"⪬","smtes":"⪬︀","SOFTcy":"Ь","softcy":"ь","solbar":"⌿","solb":"⧄","sol":"/","Sopf":"𝕊","sopf":"𝕤","spades":"♠","spadesuit":"♠","spar":"∥","sqcap":"⊓","sqcaps":"⊓︀","sqcup":"⊔","sqcups":"⊔︀","Sqrt":"√","sqsub":"⊏","sqsube":"⊑","sqsubset":"⊏","sqsubseteq":"⊑","sqsup":"⊐","sqsupe":"⊒","sqsupset":"⊐","sqsupseteq":"⊒","square":"□","Square":"□","SquareIntersection":"⊓","SquareSubset":"⊏","SquareSubsetEqual":"⊑","SquareSuperset":"⊐","SquareSupersetEqual":"⊒","SquareUnion":"⊔","squarf":"▪","squ":"□","squf":"▪","srarr":"→","Sscr":"𝒮","sscr":"𝓈","ssetmn":"∖","ssmile":"⌣","sstarf":"⋆","Star":"⋆","star":"☆","starf":"★","straightepsilon":"ϵ","straightphi":"ϕ","strns":"¯","sub":"⊂","Sub":"⋐","subdot":"⪽","subE":"⫅","sube":"⊆","subedot":"⫃","submult":"⫁","subnE":"⫋","subne":"⊊","subplus":"⪿","subrarr":"⥹","subset":"⊂","Subset":"⋐","subseteq":"⊆","subseteqq":"⫅","SubsetEqual":"⊆","subsetneq":"⊊","subsetneqq":"⫋","subsim":"⫇","subsub":"⫕","subsup":"⫓","succapprox":"⪸","succ":"≻","succcurlyeq":"≽","Succeeds":"≻","SucceedsEqual":"⪰","SucceedsSlantEqual":"≽","SucceedsTilde":"≿","succeq":"⪰","succnapprox":"⪺","succneqq":"⪶","succnsim":"⋩","succsim":"≿","SuchThat":"∋","sum":"∑","Sum":"∑","sung":"♪","sup1":"¹","sup2":"²","sup3":"³","sup":"⊃","Sup":"⋑","supdot":"⪾","supdsub":"⫘","supE":"⫆","supe":"⊇","supedot":"⫄","Superset":"⊃","SupersetEqual":"⊇","suphsol":"⟉","suphsub":"⫗","suplarr":"⥻","supmult":"⫂","supnE":"⫌","supne":"⊋","supplus":"⫀","supset":"⊃","Supset":"⋑","supseteq":"⊇","supseteqq":"⫆","supsetneq":"⊋","supsetneqq":"⫌","supsim":"⫈","supsub":"⫔","supsup":"⫖","swarhk":"⤦","swarr":"↙","swArr":"⇙","swarrow":"↙","swnwar":"⤪","szlig":"ß","Tab":"\\t","target":"⌖","Tau":"Τ","tau":"τ","tbrk":"⎴","Tcaron":"Ť","tcaron":"ť","Tcedil":"Ţ","tcedil":"ţ","Tcy":"Т","tcy":"т","tdot":"⃛","telrec":"⌕","Tfr":"𝔗","tfr":"𝔱","there4":"∴","therefore":"∴","Therefore":"∴","Theta":"Θ","theta":"θ","thetasym":"ϑ","thetav":"ϑ","thickapprox":"≈","thicksim":"∼","ThickSpace":" ","ThinSpace":" ","thinsp":" ","thkap":"≈","thksim":"∼","THORN":"Þ","thorn":"þ","tilde":"˜","Tilde":"∼","TildeEqual":"≃","TildeFullEqual":"≅","TildeTilde":"≈","timesbar":"⨱","timesb":"⊠","times":"×","timesd":"⨰","tint":"∭","toea":"⤨","topbot":"⌶","topcir":"⫱","top":"⊤","Topf":"𝕋","topf":"𝕥","topfork":"⫚","tosa":"⤩","tprime":"‴","trade":"™","TRADE":"™","triangle":"▵","triangledown":"▿","triangleleft":"◃","trianglelefteq":"⊴","triangleq":"≜","triangleright":"▹","trianglerighteq":"⊵","tridot":"◬","trie":"≜","triminus":"⨺","TripleDot":"⃛","triplus":"⨹","trisb":"⧍","tritime":"⨻","trpezium":"⏢","Tscr":"𝒯","tscr":"𝓉","TScy":"Ц","tscy":"ц","TSHcy":"Ћ","tshcy":"ћ","Tstrok":"Ŧ","tstrok":"ŧ","twixt":"≬","twoheadleftarrow":"↞","twoheadrightarrow":"↠","Uacute":"Ú","uacute":"ú","uarr":"↑","Uarr":"↟","uArr":"⇑","Uarrocir":"⥉","Ubrcy":"Ў","ubrcy":"ў","Ubreve":"Ŭ","ubreve":"ŭ","Ucirc":"Û","ucirc":"û","Ucy":"У","ucy":"у","udarr":"⇅","Udblac":"Ű","udblac":"ű","udhar":"⥮","ufisht":"⥾","Ufr":"𝔘","ufr":"𝔲","Ugrave":"Ù","ugrave":"ù","uHar":"⥣","uharl":"↿","uharr":"↾","uhblk":"▀","ulcorn":"⌜","ulcorner":"⌜","ulcrop":"⌏","ultri":"◸","Umacr":"Ū","umacr":"ū","uml":"¨","UnderBar":"_","UnderBrace":"⏟","UnderBracket":"⎵","UnderParenthesis":"⏝","Union":"⋃","UnionPlus":"⊎","Uogon":"Ų","uogon":"ų","Uopf":"𝕌","uopf":"𝕦","UpArrowBar":"⤒","uparrow":"↑","UpArrow":"↑","Uparrow":"⇑","UpArrowDownArrow":"⇅","updownarrow":"↕","UpDownArrow":"↕","Updownarrow":"⇕","UpEquilibrium":"⥮","upharpoonleft":"↿","upharpoonright":"↾","uplus":"⊎","UpperLeftArrow":"↖","UpperRightArrow":"↗","upsi":"υ","Upsi":"ϒ","upsih":"ϒ","Upsilon":"Υ","upsilon":"υ","UpTeeArrow":"↥","UpTee":"⊥","upuparrows":"⇈","urcorn":"⌝","urcorner":"⌝","urcrop":"⌎","Uring":"Ů","uring":"ů","urtri":"◹","Uscr":"𝒰","uscr":"𝓊","utdot":"⋰","Utilde":"Ũ","utilde":"ũ","utri":"▵","utrif":"▴","uuarr":"⇈","Uuml":"Ü","uuml":"ü","uwangle":"⦧","vangrt":"⦜","varepsilon":"ϵ","varkappa":"ϰ","varnothing":"∅","varphi":"ϕ","varpi":"ϖ","varpropto":"∝","varr":"↕","vArr":"⇕","varrho":"ϱ","varsigma":"ς","varsubsetneq":"⊊︀","varsubsetneqq":"⫋︀","varsupsetneq":"⊋︀","varsupsetneqq":"⫌︀","vartheta":"ϑ","vartriangleleft":"⊲","vartriangleright":"⊳","vBar":"⫨","Vbar":"⫫","vBarv":"⫩","Vcy":"В","vcy":"в","vdash":"⊢","vDash":"⊨","Vdash":"⊩","VDash":"⊫","Vdashl":"⫦","veebar":"⊻","vee":"∨","Vee":"⋁","veeeq":"≚","vellip":"⋮","verbar":"|","Verbar":"‖","vert":"|","Vert":"‖","VerticalBar":"∣","VerticalLine":"|","VerticalSeparator":"❘","VerticalTilde":"≀","VeryThinSpace":" ","Vfr":"𝔙","vfr":"𝔳","vltri":"⊲","vnsub":"⊂⃒","vnsup":"⊃⃒","Vopf":"𝕍","vopf":"𝕧","vprop":"∝","vrtri":"⊳","Vscr":"𝒱","vscr":"𝓋","vsubnE":"⫋︀","vsubne":"⊊︀","vsupnE":"⫌︀","vsupne":"⊋︀","Vvdash":"⊪","vzigzag":"⦚","Wcirc":"Ŵ","wcirc":"ŵ","wedbar":"⩟","wedge":"∧","Wedge":"⋀","wedgeq":"≙","weierp":"℘","Wfr":"𝔚","wfr":"𝔴","Wopf":"𝕎","wopf":"𝕨","wp":"℘","wr":"≀","wreath":"≀","Wscr":"𝒲","wscr":"𝓌","xcap":"⋂","xcirc":"◯","xcup":"⋃","xdtri":"▽","Xfr":"𝔛","xfr":"𝔵","xharr":"⟷","xhArr":"⟺","Xi":"Ξ","xi":"ξ","xlarr":"⟵","xlArr":"⟸","xmap":"⟼","xnis":"⋻","xodot":"⨀","Xopf":"𝕏","xopf":"𝕩","xoplus":"⨁","xotime":"⨂","xrarr":"⟶","xrArr":"⟹","Xscr":"𝒳","xscr":"𝓍","xsqcup":"⨆","xuplus":"⨄","xutri":"△","xvee":"⋁","xwedge":"⋀","Yacute":"Ý","yacute":"ý","YAcy":"Я","yacy":"я","Ycirc":"Ŷ","ycirc":"ŷ","Ycy":"Ы","ycy":"ы","yen":"¥","Yfr":"𝔜","yfr":"𝔶","YIcy":"Ї","yicy":"ї","Yopf":"𝕐","yopf":"𝕪","Yscr":"𝒴","yscr":"𝓎","YUcy":"Ю","yucy":"ю","yuml":"ÿ","Yuml":"Ÿ","Zacute":"Ź","zacute":"ź","Zcaron":"Ž","zcaron":"ž","Zcy":"З","zcy":"з","Zdot":"Ż","zdot":"ż","zeetrf":"ℨ","ZeroWidthSpace":"","Zeta":"Ζ","zeta":"ζ","zfr":"𝔷","Zfr":"ℨ","ZHcy":"Ж","zhcy":"ж","zigrarr":"⇝","zopf":"𝕫","Zopf":"ℤ","Zscr":"𝒵","zscr":"𝓏","zwj":"","zwnj":""}')},function(e,t,n){"use strict";var o={};function i(e,t,n){var r,s,a,c,l,d="";for("string"!=typeof t&&(n=t,t=i.defaultChars),void 0===n&&(n=!0),l=function(e){var t,n,i=o[e];if(i)return i;for(i=o[e]=[],t=0;t<128;t++)n=String.fromCharCode(t),/^[0-9a-z]$/i.test(n)?i.push(n):i.push("%"+("0"+t.toString(16).toUpperCase()).slice(-2));for(t=0;t<e.length;t++)i[e.charCodeAt(t)]=e[t];return i}(t),r=0,s=e.length;r<s;r++)if(a=e.charCodeAt(r),n&&37===a&&r+2<s&&/^[0-9a-f]{2}$/i.test(e.slice(r+1,r+3)))d+=e.slice(r,r+3),r+=2;else if(a<128)d+=l[a];else if(a>=55296&&a<=57343){if(a>=55296&&a<=56319&&r+1<s&&(c=e.charCodeAt(r+1))>=56320&&c<=57343){d+=encodeURIComponent(e[r]+e[r+1]),r++;continue}d+="%EF%BF%BD"}else d+=encodeURIComponent(e[r]);return d}i.defaultChars=";/?:@&=+$,-_.!~*'()#",i.componentChars="-_.!~*'()",e.exports=i},function(e,t,n){"use strict";var o={};function i(e,t){var n;return"string"!=typeof t&&(t=i.defaultChars),n=function(e){var t,n,i=o[e];if(i)return i;for(i=o[e]=[],t=0;t<128;t++)n=String.fromCharCode(t),i.push(n);for(t=0;t<e.length;t++)i[n=e.charCodeAt(t)]="%"+("0"+n.toString(16).toUpperCase()).slice(-2);return i}(t),e.replace(/(%[a-f0-9]{2})+/gi,(function(e){var t,o,i,r,s,a,c,l="";for(t=0,o=e.length;t<o;t+=3)(i=parseInt(e.slice(t+1,t+3),16))<128?l+=n[i]:192==(224&i)&&t+3<o&&128==(192&(r=parseInt(e.slice(t+4,t+6),16)))?(l+=(c=i<<6&1984|63&r)<128?"<EFBFBD><EFBFBD>":String.fromCharCode(c),t+=3):224==(240&i)&&t+6<o&&(r=parseInt(e.slice(t+4,t+6),16),s=parseInt(e.slice(t+7,t+9),16),128==(192&r)&&128==(192&s))?(l+=(c=i<<12&61440|r<<6&4032|63&s)<2048||c>=55296&&c<=57343?"<EFBFBD><EFBFBD><EFBFBD>":String.fromCharCode(c),t+=6):240==(248&i)&&t+9<o&&(r=parseInt(e.slice(t+4,t+6),16),s=parseInt(e.slice(t+7,t+9),16),a=parseInt(e.slice(t+10,t+12),16),128==(192&r)&&128==(192&s)&&128==(192&a))?((c=i<<18&1835008|r<<12&258048|s<<6&4032|63&a)<65536||c>1114111?l+="<EFBFBD><EFBFBD><EFBFBD><EFBFBD>":(c-=65536,l+=String.fromCharCode(55296+(c>>10),56320+(1023&c))),t+=9):l+="<EFBFBD>";return l}))}i.defaultChars=";/?:@&=+$,#",i.componentChars="",e.exports=i},function(e,t,n){"use strict";e.exports=function(e){var t="";return t+=e.protocol||"",t+=e.slashes?"//":"",t+=e.auth?e.auth+"@":"",e.hostname&&-1!==e.hostname.indexOf(":")?t+="["+e.hostname+"]":t+=e.hostname||"",t+=e.port?":"+e.port:"",t+=e.pathname||"",t+=e.search||"",t+=e.hash||""}},function(e,t,n){"use strict";function o(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}var i=/^([a-z0-9.+-]+:)/i,r=/:[0-9]*$/,s=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,a=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),c=["'"].concat(a),l=["%","/","?",";","#"].concat(c),d=["/","?","#"],u=/^[+a-z0-9A-Z_-]{0,63}$/,h=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,f={javascript:!0,"javascript:":!0},p={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};o.prototype.parse=function(e,t){var n,o,r,a,c,m=e;if(m=m.trim(),!t&&1===e.split("#").length){var g=s.exec(m);if(g)return this.pathname=g[1],g[2]&&(this.search=g[2]),this}var b=i.exec(m);if(b&&(r=(b=b[0]).toLowerCase(),this.protocol=b,m=m.substr(b.length)),(t||b||m.match(/^\/\/[^@\/]+@[^@\/]+/))&&(!(c="//"===m.substr(0,2))||b&&f[b]||(m=m.substr(2),this.slashes=!0)),!f[b]&&(c||b&&!p[b])){var w,k,_=-1;for(n=0;n<d.length;n++)-1!==(a=m.indexOf(d[n]))&&(-1===_||a<_)&&(_=a);for(-1!==(k=-1===_?m.lastIndexOf("@"):m.lastIndexOf("@",_))&&(w=m.slice(0,k),m=m.slice(k+1),this.auth=w),_=-1,n=0;n<l.length;n++)-1!==(a=m.indexOf(l[n]))&&(-1===_||a<_)&&(_=a);-1===_&&(_=m.length),":"===m[_-1]&&_--;var v=m.slice(0,_);m=m.slice(_),this.parseHost(v),this.hostname=this.hostname||"";var y="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!y){var x=this.hostname.split(/\./);for(n=0,o=x.length;n<o;n++){var C=x[n];if(C&&!C.match(u)){for(var A="",T=0,P=C.length;T<P;T++)C.charCodeAt(T)>127?A+="x":A+=C[T];if(!A.match(u)){var E=x.slice(0,n),S=x.slice(n+1),R=C.match(h);R&&(E.push(R[1]),S.unshift(R[2])),S.length&&(m=S.join(".")+m),this.hostname=E.join(".");break}}}}this.hostname.length>255&&(this.hostname=""),y&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}var I=m.indexOf("#");-1!==I&&(this.hash=m.substr(I),m=m.slice(0,I));var O=m.indexOf("?");return-1!==O&&(this.search=m.substr(O),m=m.slice(0,O)),m&&(this.pathname=m),p[r]&&this.hostname&&!this.pathname&&(this.pathname=""),this},o.prototype.parseHost=function(e){var t=r.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)},e.exports=function(e,t){if(e&&e instanceof o)return e;var n=new o;return n.parse(e,t),n}},function(e,t,n){"use strict";t.Any=n(21),t.Cc=n(22),t.Cf=n(125),t.P=n(12),t.Z=n(23)},function(e,t){e.exports=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/},function(e,t,n){"use strict";t.parseLinkLabel=n(127),t.parseLinkDestination=n(128),t.parseLinkTitle=n(129)},function(e,t,n){"use strict";e.exports=function(e,t,n){var o,i,r,s,a=-1,c=e.posMax,l=e.pos;for(e.pos=t+1,o=1;e.pos<c;){if(93===(r=e.src.charCodeAt(e.pos))&&0===--o){i=!0;break}if(s=e.pos,e.md.inline.skipToken(e),91===r)if(s===e.pos-1)o++;else if(n)return e.pos=l,-1}return i&&(a=e.pos),e.pos=l,a}},function(e,t,n){"use strict";var o=n(3).unescapeAll;e.exports=function(e,t,n){var i,r,s=t,a={ok:!1,pos:0,lines:0,str:""};if(60===e.charCodeAt(t)){for(t++;t<n;){if(10===(i=e.charCodeAt(t)))return a;if(62===i)return a.pos=t+1,a.str=o(e.slice(s+1,t)),a.ok=!0,a;92===i&&t+1<n?t+=2:t++}return a}for(r=0;t<n&&32!==(i=e.charCodeAt(t))&&!(i<32||127===i);)if(92===i&&t+1<n)t+=2;else{if(40===i&&r++,41===i){if(0===r)break;r--}t++}return s===t||0!==r||(a.str=o(e.slice(s,t)),a.lines=0,a.pos=t,a.ok=!0),a}},function(e,t,n){"use strict";var o=n(3).unescapeAll;e.exports=function(e,t,n){var i,r,s=0,a=t,c={ok:!1,pos:0,lines:0,str:""};if(t>=n)return c;if(34!==(r=e.charCodeAt(t))&&39!==r&&40!==r)return c;for(t++,40===r&&(r=41);t<n;){if((i=e.charCodeAt(t))===r)return c.pos=t+1,c.lines=s,c.str=o(e.slice(a+1,t)),c.ok=!0,c;10===i?s++:92===i&&t+1<n&&(t++,10===e.charCodeAt(t)&&s++),t++}return c}},function(e,t,n){"use strict";var o=n(3).assign,i=n(3).unescapeAll,r=n(3).escapeHtml,s={};function a(){this.rules=o({},s)}s.code_inline=function(e,t,n,o,i){var s=e[t];return"<code"+i.renderAttrs(s)+">"+r(e[t].content)+"</code>"},s.code_block=function(e,t,n,o,i){var s=e[t];return"<pre"+i.renderAttrs(s)+"><code>"+r(e[t].content)+"</code></pre>\n"},s.fence=function(e,t,n,o,s){var a,c,l,d,u=e[t],h=u.info?i(u.info).trim():"",f="";return h&&(f=h.split(/\s+/g)[0]),0===(a=n.highlight&&n.highlight(u.content,f)||r(u.content)).indexOf("<pre")?a+"\n":h?(c=u.attrIndex("class"),l=u.attrs?u.attrs.slice():[],c<0?l.push(["class",n.langPrefix+f]):l[c][1]+=" "+n.langPrefix+f,d={attrs:l},"<pre><code"+s.renderAttrs(d)+">"+a+"</code></pre>\n"):"<pre><code"+s.renderAttrs(u)+">"+a+"</code></pre>\n"},s.image=function(e,t,n,o,i){var r=e[t];return r.attrs[r.attrIndex("alt")][1]=i.renderInlineAsText(r.children,n,o),i.renderToken(e,t,n)},s.hardbreak=function(e,t,n){return n.xhtmlOut?"<br />\n":"<br>\n"},s.softbreak=function(e,t,n){return n.breaks?n.xhtmlOut?"<br />\n":"<br>\n":"\n"},s.text=function(e,t){return r(e[t].content)},s.html_block=function(e,t){return e[t].content},s.html_inline=function(e,t){return e[t].content},a.prototype.renderAttrs=function(e){var t,n,o;if(!e.attrs)return"";for(o="",t=0,n=e.attrs.length;t<n;t++)o+=" "+r(e.attrs[t][0])+'="'+r(e.attrs[t][1])+'"';return o},a.prototype.renderToken=function(e,t,n){var o,i="",r=!1,s=e[t];return s.hidden?"":(s.block&&-1!==s.nesting&&t&&e[t-1].hidden&&(i+="\n"),i+=(-1===s.nesting?"</":"<")+s.tag,i+=this.renderAttrs(s),0===s.nesting&&n.xhtmlOut&&(i+=" /"),s.block&&(r=!0,1===s.nesting&&t+1<e.length&&("inline"===(o=e[t+1]).type||o.hidden||-1===o.nesting&&o.tag===s.tag)&&(r=!1)),i+=r?">\n":">")},a.prototype.renderInline=function(e,t,n){for(var o,i="",r=this.rules,s=0,a=e.length;s<a;s++)void 0!==r[o=e[s].type]?i+=r[o](e,s,t,n,this):i+=this.renderToken(e,s,t);return i},a.prototype.renderInlineAsText=function(e,t,n){for(var o="",i=0,r=e.length;i<r;i++)"text"===e[i].type?o+=e[i].content:"image"===e[i].type&&(o+=this.renderInlineAsText(e[i].children,t,n));return o},a.prototype.render=function(e,t,n){var o,i,r,s="",a=this.rules;for(o=0,i=e.length;o<i;o++)"inline"===(r=e[o].type)?s+=this.renderInline(e[o].children,t,n):void 0!==a[r]?s+=a[e[o].type](e,o,t,n,this):s+=this.renderToken(e,o,t,n);return s},e.exports=a},function(e,t,n){"use strict";var o=n(13),i=[["normalize",n(132)],["block",n(133)],["inline",n(134)],["linkify",n(135)],["replacements",n(136)],["smartquotes",n(137)]];function r(){this.ruler=new o;for(var e=0;e<i.length;e++)this.ruler.push(i[e][0],i[e][1])}r.prototype.process=function(e){var t,n,o;for(t=0,n=(o=this.ruler.getRules("")).length;t<n;t++)o[t](e)},r.prototype.State=n(138),e.exports=r},function(e,t,n){"use strict";var o=/\r\n?|\n/g,i=/\0/g;e.exports=function(e){var t;t=(t=e.src.replace(o,"\n")).replace(i,"<EFBFBD>"),e.src=t}},function(e,t,n){"use strict";e.exports=function(e){var t;e.inlineMode?((t=new e.Token("inline","",0)).content=e.src,t.map=[0,1],t.children=[],e.tokens.push(t)):e.md.block.parse(e.src,e.md,e.env,e.tokens)}},function(e,t,n){"use strict";e.exports=function(e){var t,n,o,i=e.tokens;for(n=0,o=i.length;n<o;n++)"inline"===(t=i[n]).type&&e.md.inline.parse(t.content,e.md,e.env,t.children)}},function(e,t,n){"use strict";var o=n(3).arrayReplaceAt;function i(e){return/^<\/a\s*>/i.test(e)}e.exports=function(e){var t,n,r,s,a,c,l,d,u,h,f,p,m,g,b,w,k,_,v=e.tokens;if(e.md.options.linkify)for(n=0,r=v.length;n<r;n++)if("inline"===v[n].type&&e.md.linkify.pretest(v[n].content))for(m=0,t=(s=v[n].children).length-1;t>=0;t--)if("link_close"!==(c=s[t]).type){if("html_inline"===c.type&&(_=c.content,/^<a[>\s]/i.test(_)&&m>0&&m--,i(c.content)&&m++),!(m>0)&&"text"===c.type&&e.md.linkify.test(c.content)){for(u=c.content,k=e.md.linkify.match(u),l=[],p=c.level,f=0,d=0;d<k.length;d++)g=k[d].url,b=e.md.normalizeLink(g),e.md.validateLink(b)&&(w=k[d].text,w=k[d].schema?"mailto:"!==k[d].schema||/^mailto:/i.test(w)?e.md.normalizeLinkText(w):e.md.normalizeLinkText("mailto:"+w).replace(/^mailto:/,""):e.md.normalizeLinkText("http://"+w).replace(/^http:\/\//,""),(h=k[d].index)>f&&((a=new e.Token("text","",0)).content=u.slice(f,h),a.level=p,l.push(a)),(a=new e.Token("link_open","a",1)).attrs=[["href",b]],a.level=p++,a.markup="linkify",a.info="auto",l.push(a),(a=new e.Token("text","",0)).content=w,a.level=p,l.push(a),(a=new e.Token("link_close","a",-1)).level=--p,a.markup="linkify",a.info="auto",l.push(a),f=k[d].lastIndex);f<u.length&&((a=new e.Token("text","",0)).content=u.slice(f),a.level=p,l.push(a)),v[n].children=s=o(s,t,l)}}else for(t--;s[t].level!==c.level&&"link_open"!==s[t].type;)t--}},function(e,t,n){"use strict";var o=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,i=/\((c|tm|r|p)\)/i,r=/\((c|tm|r|p)\)/gi,s={c:"©",r:"®",p:"§",tm:"™"};function a(e,t){return s[t.toLowerCase()]}function c(e){var t,n,o=0;for(t=e.length-1;t>=0;t--)"text"!==(n=e[t]).type||o||(n.content=n.content.replace(r,a)),"link_open"===n.type&&"auto"===n.info&&o--,"link_close"===n.type&&"auto"===n.info&&o++}function l(e){var t,n,i=0;for(t=e.length-1;t>=0;t--)"text"!==(n=e[t]).type||i||o.test(n.content)&&(n.content=n.content.replace(/\+-/g,"±").replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---([^-]|$)/gm,"$1—$2").replace(/(^|\s)--(\s|$)/gm,"$1–$2").replace(/(^|[^-\s])--([^-\s]|$)/gm,"$1–$2")),"link_open"===n.type&&"auto"===n.info&&i--,"link_close"===n.type&&"auto"===n.info&&i++}e.exports=function(e){var t;if(e.md.options.typographer)for(t=e.tokens.length-1;t>=0;t--)"inline"===e.tokens[t].type&&(i.test(e.tokens[t].content)&&c(e.tokens[t].children),o.test(e.tokens[t].content)&&l(e.tokens[t].children))}},function(e,t,n){"use strict";var o=n(3).isWhiteSpace,i=n(3).isPunctChar,r=n(3).isMdAsciiPunct,s=/['"]/,a=/['"]/g;function c(e,t,n){return e.substr(0,t)+n+e.substr(t+1)}function l(e,t){var n,s,l,d,u,h,f,p,m,g,b,w,k,_,v,y,x,C,A,T,P;for(A=[],n=0;n<e.length;n++){for(s=e[n],f=e[n].level,x=A.length-1;x>=0&&!(A[x].level<=f);x--);if(A.length=x+1,"text"===s.type){u=0,h=(l=s.content).length;e:for(;u<h&&(a.lastIndex=u,d=a.exec(l));){if(v=y=!0,u=d.index+1,C="'"===d[0],m=32,d.index-1>=0)m=l.charCodeAt(d.index-1);else for(x=n-1;x>=0&&("softbreak"!==e[x].type&&"hardbreak"!==e[x].type);x--)if("text"===e[x].type){m=e[x].content.charCodeAt(e[x].content.length-1);break}if(g=32,u<h)g=l.charCodeAt(u);else for(x=n+1;x<e.length&&("softbreak"!==e[x].type&&"hardbreak"!==e[x].type);x++)if("text"===e[x].type){g=e[x].content.charCodeAt(0);break}if(b=r(m)||i(String.fromCharCode(m)),w=r(g)||i(String.fromCharCode(g)),k=o(m),(_=o(g))?v=!1:w&&(k||b||(v=!1)),k?y=!1:b&&(_||w||(y=!1)),34===g&&'"'===d[0]&&m>=48&&m<=57&&(y=v=!1),v&&y&&(v=!1,y=w),v||y){if(y)for(x=A.length-1;x>=0&&(p=A[x],!(A[x].level<f));x--)if(p.single===C&&A[x].level===f){p=A[x],C?(T=t.md.options.quotes[2],P=t.md.options.quotes[3]):(T=t.md.options.quotes[0],P=t.md.options.quotes[1]),s.content=c(s.content,d.index,P),e[p.token].content=c(e[p.token].content,p.pos,T),u+=P.length-1,p.token===n&&(u+=T.length-1),h=(l=s.content).length,A.length=x;continue e}v?A.push({token:n,pos:d.index,single:C,level:f}):y&&C&&(s.content=c(s.content,d.index,"’"))}else C&&(s.content=c(s.content,d.index,"’"))}}}}e.exports=function(e){var t;if(e.md.options.typographer)for(t=e.tokens.length-1;t>=0;t--)"inline"===e.tokens[t].type&&s.test(e.tokens[t].content)&&l(e.tokens[t].children,e)}},function(e,t,n){"use strict";var o=n(14);function i(e,t,n){this.src=e,this.env=n,this.tokens=[],this.inlineMode=!1,this.md=t}i.prototype.Token=o,e.exports=i},function(e,t,n){"use strict";var o=n(13),i=[["table",n(140),["paragraph","reference"]],["code",n(141)],["fence",n(142),["paragraph","reference","blockquote","list"]],["blockquote",n(143),["paragraph","reference","blockquote","list"]],["hr",n(144),["paragraph","reference","blockquote","list"]],["list",n(145),["paragraph","reference","blockquote"]],["reference",n(146)],["heading",n(147),["paragraph","reference","blockquote"]],["lheading",n(148)],["html_block",n(149),["paragraph","reference","blockquote"]],["paragraph",n(151)]];function r(){this.ruler=new o;for(var e=0;e<i.length;e++)this.ruler.push(i[e][0],i[e][1],{alt:(i[e][2]||[]).slice()})}r.prototype.tokenize=function(e,t,n){for(var o,i=this.ruler.getRules(""),r=i.length,s=t,a=!1,c=e.md.options.maxNesting;s<n&&(e.line=s=e.skipEmptyLines(s),!(s>=n))&&!(e.sCount[s]<e.blkIndent);){if(e.level>=c){e.line=n;break}for(o=0;o<r&&!i[o](e,s,n,!1);o++);e.tight=!a,e.isEmpty(e.line-1)&&(a=!0),(s=e.line)<n&&e.isEmpty(s)&&(a=!0,s++,e.line=s)}},r.prototype.parse=function(e,t,n,o){var i;e&&(i=new this.State(e,t,n,o),this.tokenize(i,i.line,i.lineMax))},r.prototype.State=n(152),e.exports=r},function(e,t,n){"use strict";var o=n(3).isSpace;function i(e,t){var n=e.bMarks[t]+e.blkIndent,o=e.eMarks[t];return e.src.substr(n,o-n)}function r(e){var t,n=[],o=0,i=e.length,r=0,s=0,a=!1,c=0;for(t=e.charCodeAt(o);o<i;)96===t?a?(a=!1,c=o):r%2==0&&(a=!0,c=o):124!==t||r%2!=0||a||(n.push(e.substring(s,o)),s=o+1),92===t?r++:r=0,++o===i&&a&&(a=!1,o=c+1),t=e.charCodeAt(o);return n.push(e.substring(s)),n}e.exports=function(e,t,n,s){var a,c,l,d,u,h,f,p,m,g,b,w;if(t+2>n)return!1;if(u=t+1,e.sCount[u]<e.blkIndent)return!1;if(e.sCount[u]-e.blkIndent>=4)return!1;if((l=e.bMarks[u]+e.tShift[u])>=e.eMarks[u])return!1;if(124!==(a=e.src.charCodeAt(l++))&&45!==a&&58!==a)return!1;for(;l<e.eMarks[u];){if(124!==(a=e.src.charCodeAt(l))&&45!==a&&58!==a&&!o(a))return!1;l++}for(h=(c=i(e,t+1)).split("|"),m=[],d=0;d<h.length;d++){if(!(g=h[d].trim())){if(0===d||d===h.length-1)continue;return!1}if(!/^:?-+:?$/.test(g))return!1;58===g.charCodeAt(g.length-1)?m.push(58===g.charCodeAt(0)?"center":"right"):58===g.charCodeAt(0)?m.push("left"):m.push("")}if(-1===(c=i(e,t).trim()).indexOf("|"))return!1;if(e.sCount[t]-e.blkIndent>=4)return!1;if((f=(h=r(c.replace(/^\||\|$/g,""))).length)>m.length)return!1;if(s)return!0;for((p=e.push("table_open","table",1)).map=b=[t,0],(p=e.push("thead_open","thead",1)).map=[t,t+1],(p=e.push("tr_open","tr",1)).map=[t,t+1],d=0;d<h.length;d++)(p=e.push("th_open","th",1)).map=[t,t+1],m[d]&&(p.attrs=[["style","text-align:"+m[d]]]),(p=e.push("inline","",0)).content=h[d].trim(),p.map=[t,t+1],p.children=[],p=e.push("th_close","th",-1);for(p=e.push("tr_close","tr",-1),p=e.push("thead_close","thead",-1),(p=e.push("tbody_open","tbody",1)).map=w=[t+2,0],u=t+2;u<n&&!(e.sCount[u]<e.blkIndent)&&-1!==(c=i(e,u).trim()).indexOf("|")&&!(e.sCount[u]-e.blkIndent>=4);u++){for(h=r(c.replace(/^\||\|$/g,"")),p=e.push("tr_open","tr",1),d=0;d<f;d++)p=e.push("td_open","td",1),m[d]&&(p.attrs=[["style","text-align:"+m[d]]]),(p=e.push("inline","",0)).content=h[d]?h[d].trim():"",p.children=[],p=e.push("td_close","td",-1);p=e.push("tr_close","tr",-1)}return p=e.push("tbody_close","tbody",-1),p=e.push("table_close","table",-1),b[1]=w[1]=u,e.line=u,!0}},function(e,t,n){"use strict";e.exports=function(e,t,n){var o,i,r;if(e.sCount[t]-e.blkIndent<4)return!1;for(i=o=t+1;o<n;)if(e.isEmpty(o))o++;else{if(!(e.sCount[o]-e.blkIndent>=4))break;i=++o}return e.line=i,(r=e.push("code_block","code",0)).content=e.getLines(t,i,4+e.blkIndent,!0),r.map=[t,e.line],!0}},function(e,t,n){"use strict";e.exports=function(e,t,n,o){var i,r,s,a,c,l,d,u=!1,h=e.bMarks[t]+e.tShift[t],f=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;if(h+3>f)return!1;if(126!==(i=e.src.charCodeAt(h))&&96!==i)return!1;if(c=h,(r=(h=e.skipChars(h,i))-c)<3)return!1;if(d=e.src.slice(c,h),s=e.src.slice(h,f),96===i&&s.indexOf(String.fromCharCode(i))>=0)return!1;if(o)return!0;for(a=t;!(++a>=n)&&!((h=c=e.bMarks[a]+e.tShift[a])<(f=e.eMarks[a])&&e.sCount[a]<e.blkIndent);)if(e.src.charCodeAt(h)===i&&!(e.sCount[a]-e.blkIndent>=4||(h=e.skipChars(h,i))-c<r||(h=e.skipSpaces(h))<f)){u=!0;break}return r=e.sCount[t],e.line=a+(u?1:0),(l=e.push("fence","code",0)).info=s,l.content=e.getLines(t+1,a,r,!0),l.markup=d,l.map=[t,e.line],!0}},function(e,t,n){"use strict";var o=n(3).isSpace;e.exports=function(e,t,n,i){var r,s,a,c,l,d,u,h,f,p,m,g,b,w,k,_,v,y,x,C,A=e.lineMax,T=e.bMarks[t]+e.tShift[t],P=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;if(62!==e.src.charCodeAt(T++))return!1;if(i)return!0;for(c=f=e.sCount[t]+T-(e.bMarks[t]+e.tShift[t]),32===e.src.charCodeAt(T)?(T++,c++,f++,r=!1,_=!0):9===e.src.charCodeAt(T)?(_=!0,(e.bsCount[t]+f)%4==3?(T++,c++,f++,r=!1):r=!0):_=!1,p=[e.bMarks[t]],e.bMarks[t]=T;T<P&&(s=e.src.charCodeAt(T),o(s));)9===s?f+=4-(f+e.bsCount[t]+(r?1:0))%4:f++,T++;for(m=[e.bsCount[t]],e.bsCount[t]=e.sCount[t]+1+(_?1:0),d=T>=P,w=[e.sCount[t]],e.sCount[t]=f-c,k=[e.tShift[t]],e.tShift[t]=T-e.bMarks[t],y=e.md.block.ruler.getRules("blockquote"),b=e.parentType,e.parentType="blockquote",C=!1,h=t+1;h<n&&(e.sCount[h]<e.blkIndent&&(C=!0),!((T=e.bMarks[h]+e.tShift[h])>=(P=e.eMarks[h])));h++)if(62!==e.src.charCodeAt(T++)||C){if(d)break;for(v=!1,a=0,l=y.length;a<l;a++)if(y[a](e,h,n,!0)){v=!0;break}if(v){e.lineMax=h,0!==e.blkIndent&&(p.push(e.bMarks[h]),m.push(e.bsCount[h]),k.push(e.tShift[h]),w.push(e.sCount[h]),e.sCount[h]-=e.blkIndent);break}p.push(e.bMarks[h]),m.push(e.bsCount[h]),k.push(e.tShift[h]),w.push(e.sCount[h]),e.sCount[h]=-1}else{for(c=f=e.sCount[h]+T-(e.bMarks[h]+e.tShift[h]),32===e.src.charCodeAt(T)?(T++,c++,f++,r=!1,_=!0):9===e.src.charCodeAt(T)?(_=!0,(e.bsCount[h]+f)%4==3?(T++,c++,f++,r=!1):r=!0):_=!1,p.push(e.bMarks[h]),e.bMarks[h]=T;T<P&&(s=e.src.charCodeAt(T),o(s));)9===s?f+=4-(f+e.bsCount[h]+(r?1:0))%4:f++,T++;d=T>=P,m.push(e.bsCount[h]),e.bsCount[h]=e.sCount[h]+1+(_?1:0),w.push(e.sCount[h]),e.sCount[h]=f-c,k.push(e.tShift[h]),e.tShift[h]=T-e.bMarks[h]}for(g=e.blkIndent,e.blkIndent=0,(x=e.push("blockquote_open","blockquote",1)).markup=">",x.map=u=[t,0],e.md.block.tokenize(e,t,h),(x=e.push("blockquote_close","blockquote",-1)).markup=">",e.lineMax=A,e.parentType=b,u[1]=e.line,a=0;a<k.length;a++)e.bMarks[a+t]=p[a],e.tShift[a+t]=k[a],e.sCount[a+t]=w[a],e.bsCount[a+t]=m[a];return e.blkIndent=g,!0}},function(e,t,n){"use strict";var o=n(3).isSpace;e.exports=function(e,t,n,i){var r,s,a,c,l=e.bMarks[t]+e.tShift[t],d=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;if(42!==(r=e.src.charCodeAt(l++))&&45!==r&&95!==r)return!1;for(s=1;l<d;){if((a=e.src.charCodeAt(l++))!==r&&!o(a))return!1;a===r&&s++}return!(s<3)&&(i||(e.line=t+1,(c=e.push("hr","hr",0)).map=[t,e.line],c.markup=Array(s+1).join(String.fromCharCode(r))),!0)}},function(e,t,n){"use strict";var o=n(3).isSpace;function i(e,t){var n,i,r,s;return i=e.bMarks[t]+e.tShift[t],r=e.eMarks[t],42!==(n=e.src.charCodeAt(i++))&&45!==n&&43!==n||i<r&&(s=e.src.charCodeAt(i),!o(s))?-1:i}function r(e,t){var n,i=e.bMarks[t]+e.tShift[t],r=i,s=e.eMarks[t];if(r+1>=s)return-1;if((n=e.src.charCodeAt(r++))<48||n>57)return-1;for(;;){if(r>=s)return-1;if(!((n=e.src.charCodeAt(r++))>=48&&n<=57)){if(41===n||46===n)break;return-1}if(r-i>=10)return-1}return r<s&&(n=e.src.charCodeAt(r),!o(n))?-1:r}e.exports=function(e,t,n,o){var s,a,c,l,d,u,h,f,p,m,g,b,w,k,_,v,y,x,C,A,T,P,E,S,R,I,O,N,M=!1,V=!0;if(e.sCount[t]-e.blkIndent>=4)return!1;if(e.listIndent>=0&&e.sCount[t]-e.listIndent>=4&&e.sCount[t]<e.blkIndent)return!1;if(o&&"paragraph"===e.parentType&&e.tShift[t]>=e.blkIndent&&(M=!0),(E=r(e,t))>=0){if(h=!0,R=e.bMarks[t]+e.tShift[t],w=Number(e.src.substr(R,E-R-1)),M&&1!==w)return!1}else{if(!((E=i(e,t))>=0))return!1;h=!1}if(M&&e.skipSpaces(E)>=e.eMarks[t])return!1;if(b=e.src.charCodeAt(E-1),o)return!0;for(g=e.tokens.length,h?(N=e.push("ordered_list_open","ol",1),1!==w&&(N.attrs=[["start",w]])):N=e.push("bullet_list_open","ul",1),N.map=m=[t,0],N.markup=String.fromCharCode(b),_=t,S=!1,O=e.md.block.ruler.getRules("list"),x=e.parentType,e.parentType="list";_<n;){for(P=E,k=e.eMarks[_],u=v=e.sCount[_]+E-(e.bMarks[t]+e.tShift[t]);P<k;){if(9===(s=e.src.charCodeAt(P)))v+=4-(v+e.bsCount[_])%4;else{if(32!==s)break;v++}P++}if((d=(a=P)>=k?1:v-u)>4&&(d=1),l=u+d,(N=e.push("list_item_open","li",1)).markup=String.fromCharCode(b),N.map=f=[t,0],T=e.tight,A=e.tShift[t],C=e.sCount[t],y=e.listIndent,e.listIndent=e.blkIndent,e.blkIndent=l,e.tight=!0,e.tShift[t]=a-e.bMarks[t],e.sCount[t]=v,a>=k&&e.isEmpty(t+1)?e.line=Math.min(e.line+2,n):e.md.block.tokenize(e,t,n,!0),e.tight&&!S||(V=!1),S=e.line-t>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=y,e.tShift[t]=A,e.sCount[t]=C,e.tight=T,(N=e.push("list_item_close","li",-1)).markup=String.fromCharCode(b),_=t=e.line,f[1]=_,a=e.bMarks[t],_>=n)break;if(e.sCount[_]<e.blkIndent)break;if(e.sCount[t]-e.blkIndent>=4)break;for(I=!1,c=0,p=O.length;c<p;c++)if(O[c](e,_,n,!0)){I=!0;break}if(I)break;if(h){if((E=r(e,_))<0)break}else if((E=i(e,_))<0)break;if(b!==e.src.charCodeAt(E-1))break}return(N=h?e.push("ordered_list_close","ol",-1):e.push("bullet_list_close","ul",-1)).markup=String.fromCharCode(b),m[1]=_,e.line=_,e.parentType=x,V&&function(e,t){var n,o,i=e.level+2;for(n=t+2,o=e.tokens.length-2;n<o;n++)e.tokens[n].level===i&&"paragraph_open"===e.tokens[n].type&&(e.tokens[n+2].hidden=!0,e.tokens[n].hidden=!0,n+=2)}(e,g),!0}},function(e,t,n){"use strict";var o=n(3).normalizeReference,i=n(3).isSpace;e.exports=function(e,t,n,r){var s,a,c,l,d,u,h,f,p,m,g,b,w,k,_,v,y=0,x=e.bMarks[t]+e.tShift[t],C=e.eMarks[t],A=t+1;if(e.sCount[t]-e.blkIndent>=4)return!1;if(91!==e.src.charCodeAt(x))return!1;for(;++x<C;)if(93===e.src.charCodeAt(x)&&92!==e.src.charCodeAt(x-1)){if(x+1===C)return!1;if(58!==e.src.charCodeAt(x+1))return!1;break}for(l=e.lineMax,_=e.md.block.ruler.getRules("reference"),m=e.parentType,e.parentType="reference";A<l&&!e.isEmpty(A);A++)if(!(e.sCount[A]-e.blkIndent>3||e.sCount[A]<0)){for(k=!1,u=0,h=_.length;u<h;u++)if(_[u](e,A,l,!0)){k=!0;break}if(k)break}for(C=(w=e.getLines(t,A,e.blkIndent,!1).trim()).length,x=1;x<C;x++){if(91===(s=w.charCodeAt(x)))return!1;if(93===s){p=x;break}(10===s||92===s&&++x<C&&10===w.charCodeAt(x))&&y++}if(p<0||58!==w.charCodeAt(p+1))return!1;for(x=p+2;x<C;x++)if(10===(s=w.charCodeAt(x)))y++;else if(!i(s))break;if(!(g=e.md.helpers.parseLinkDestination(w,x,C)).ok)return!1;if(d=e.md.normalizeLink(g.str),!e.md.validateLink(d))return!1;for(a=x=g.pos,c=y+=g.lines,b=x;x<C;x++)if(10===(s=w.charCodeAt(x)))y++;else if(!i(s))break;for(g=e.md.helpers.parseLinkTitle(w,x,C),x<C&&b!==x&&g.ok?(v=g.str,x=g.pos,y+=g.lines):(v="",x=a,y=c);x<C&&(s=w.charCodeAt(x),i(s));)x++;if(x<C&&10!==w.charCodeAt(x)&&v)for(v="",x=a,y=c;x<C&&(s=w.charCodeAt(x),i(s));)x++;return!(x<C&&10!==w.charCodeAt(x))&&(!!(f=o(w.slice(1,p)))&&(r||(void 0===e.env.references&&(e.env.references={}),void 0===e.env.references[f]&&(e.env.references[f]={title:v,href:d}),e.parentType=m,e.line=t+y+1),!0))}},function(e,t,n){"use strict";var o=n(3).isSpace;e.exports=function(e,t,n,i){var r,s,a,c,l=e.bMarks[t]+e.tShift[t],d=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;if(35!==(r=e.src.charCodeAt(l))||l>=d)return!1;for(s=1,r=e.src.charCodeAt(++l);35===r&&l<d&&s<=6;)s++,r=e.src.charCodeAt(++l);return!(s>6||l<d&&!o(r))&&(i||(d=e.skipSpacesBack(d,l),(a=e.skipCharsBack(d,35,l))>l&&o(e.src.charCodeAt(a-1))&&(d=a),e.line=t+1,(c=e.push("heading_open","h"+String(s),1)).markup="########".slice(0,s),c.map=[t,e.line],(c=e.push("inline","",0)).content=e.src.slice(l,d).trim(),c.map=[t,e.line],c.children=[],(c=e.push("heading_close","h"+String(s),-1)).markup="########".slice(0,s)),!0)}},function(e,t,n){"use strict";e.exports=function(e,t,n){var o,i,r,s,a,c,l,d,u,h,f=t+1,p=e.md.block.ruler.getRules("paragraph");if(e.sCount[t]-e.blkIndent>=4)return!1;for(h=e.parentType,e.parentType="paragraph";f<n&&!e.isEmpty(f);f++)if(!(e.sCount[f]-e.blkIndent>3)){if(e.sCount[f]>=e.blkIndent&&(c=e.bMarks[f]+e.tShift[f])<(l=e.eMarks[f])&&(45===(u=e.src.charCodeAt(c))||61===u)&&(c=e.skipChars(c,u),(c=e.skipSpaces(c))>=l)){d=61===u?1:2;break}if(!(e.sCount[f]<0)){for(i=!1,r=0,s=p.length;r<s;r++)if(p[r](e,f,n,!0)){i=!0;break}if(i)break}}return!!d&&(o=e.getLines(t,f,e.blkIndent,!1).trim(),e.line=f+1,(a=e.push("heading_open","h"+String(d),1)).markup=String.fromCharCode(u),a.map=[t,e.line],(a=e.push("inline","",0)).content=o,a.map=[t,e.line-1],a.children=[],(a=e.push("heading_close","h"+String(d),-1)).markup=String.fromCharCode(u),e.parentType=h,!0)}},function(e,t,n){"use strict";var o=n(150),i=n(24).HTML_OPEN_CLOSE_TAG_RE,r=[[/^<(script|pre|style)(?=(\s|>|$))/i,/<\/(script|pre|style)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[new RegExp("^</?("+o.join("|")+")(?=(\\s|/?>|$))","i"),/^$/,!0],[new RegExp(i.source+"\\s*$"),/^$/,!1]];e.exports=function(e,t,n,o){var i,s,a,c,l=e.bMarks[t]+e.tShift[t],d=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;if(!e.md.options.html)return!1;if(60!==e.src.charCodeAt(l))return!1;for(c=e.src.slice(l,d),i=0;i<r.length&&!r[i][0].test(c);i++);if(i===r.length)return!1;if(o)return r[i][2];if(s=t+1,!r[i][1].test(c))for(;s<n&&!(e.sCount[s]<e.blkIndent);s++)if(l=e.bMarks[s]+e.tShift[s],d=e.eMarks[s],c=e.src.slice(l,d),r[i][1].test(c)){0!==c.length&&s++;break}return e.line=s,(a=e.push("html_block","",0)).map=[t,s],a.content=e.getLines(t,s,e.blkIndent,!0),!0}},function(e,t,n){"use strict";e.exports=["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","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","meta","nav","noframes","ol","optgroup","option","p","param","section","source","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"]},function(e,t,n){"use strict";e.exports=function(e,t){var n,o,i,r,s,a,c=t+1,l=e.md.block.ruler.getRules("paragraph"),d=e.lineMax;for(a=e.parentType,e.parentType="paragraph";c<d&&!e.isEmpty(c);c++)if(!(e.sCount[c]-e.blkIndent>3||e.sCount[c]<0)){for(o=!1,i=0,r=l.length;i<r;i++)if(l[i](e,c,d,!0)){o=!0;break}if(o)break}return n=e.getLines(t,c,e.blkIndent,!1).trim(),e.line=c,(s=e.push("paragraph_open","p",1)).map=[t,e.line],(s=e.push("inline","",0)).content=n,s.map=[t,e.line],s.children=[],s=e.push("paragraph_close","p",-1),e.parentType=a,!0}},function(e,t,n){"use strict";var o=n(14),i=n(3).isSpace;function r(e,t,n,o){var r,s,a,c,l,d,u,h;for(this.src=e,this.md=t,this.env=n,this.tokens=o,this.bMarks=[],this.eMarks=[],this.tShift=[],this.sCount=[],this.bsCount=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.ddIndent=-1,this.listIndent=-1,this.parentType="root",this.level=0,this.result="",h=!1,a=c=d=u=0,l=(s=this.src).length;c<l;c++){if(r=s.charCodeAt(c),!h){if(i(r)){d++,9===r?u+=4-u%4:u++;continue}h=!0}10!==r&&c!==l-1||(10!==r&&c++,this.bMarks.push(a),this.eMarks.push(c),this.tShift.push(d),this.sCount.push(u),this.bsCount.push(0),h=!1,d=0,u=0,a=c+1)}this.bMarks.push(s.length),this.eMarks.push(s.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}r.prototype.push=function(e,t,n){var i=new o(e,t,n);return i.block=!0,n<0&&this.level--,i.level=this.level,n>0&&this.level++,this.tokens.push(i),i},r.prototype.isEmpty=function(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]},r.prototype.skipEmptyLines=function(e){for(var t=this.lineMax;e<t&&!(this.bMarks[e]+this.tShift[e]<this.eMarks[e]);e++);return e},r.prototype.skipSpaces=function(e){for(var t,n=this.src.length;e<n&&(t=this.src.charCodeAt(e),i(t));e++);return e},r.prototype.skipSpacesBack=function(e,t){if(e<=t)return e;for(;e>t;)if(!i(this.src.charCodeAt(--e)))return e+1;return e},r.prototype.skipChars=function(e,t){for(var n=this.src.length;e<n&&this.src.charCodeAt(e)===t;e++);return e},r.prototype.skipCharsBack=function(e,t,n){if(e<=n)return e;for(;e>n;)if(t!==this.src.charCodeAt(--e))return e+1;return e},r.prototype.getLines=function(e,t,n,o){var r,s,a,c,l,d,u,h=e;if(e>=t)return"";for(d=new Array(t-e),r=0;h<t;h++,r++){for(s=0,u=c=this.bMarks[h],l=h+1<t||o?this.eMarks[h]+1:this.eMarks[h];c<l&&s<n;){if(a=this.src.charCodeAt(c),i(a))9===a?s+=4-(s+this.bsCount[h])%4:s++;else{if(!(c-u<this.tShift[h]))break;s++}c++}d[r]=s>n?new Array(s-n+1).join(" ")+this.src.slice(c,l):this.src.slice(c,l)}return d.join("")},r.prototype.Token=o,e.exports=r},function(e,t,n){"use strict";var o=n(13),i=[["text",n(154)],["newline",n(155)],["escape",n(156)],["backticks",n(157)],["strikethrough",n(25).tokenize],["emphasis",n(26).tokenize],["link",n(158)],["image",n(159)],["autolink",n(160)],["html_inline",n(161)],["entity",n(162)]],r=[["balance_pairs",n(163)],["strikethrough",n(25).postProcess],["emphasis",n(26).postProcess],["text_collapse",n(164)]];function s(){var e;for(this.ruler=new o,e=0;e<i.length;e++)this.ruler.push(i[e][0],i[e][1]);for(this.ruler2=new o,e=0;e<r.length;e++)this.ruler2.push(r[e][0],r[e][1])}s.prototype.skipToken=function(e){var t,n,o=e.pos,i=this.ruler.getRules(""),r=i.length,s=e.md.options.maxNesting,a=e.cache;if(void 0===a[o]){if(e.level<s)for(n=0;n<r&&(e.level++,t=i[n](e,!0),e.level--,!t);n++);else e.pos=e.posMax;t||e.pos++,a[o]=e.pos}else e.pos=a[o]},s.prototype.tokenize=function(e){for(var t,n,o=this.ruler.getRules(""),i=o.length,r=e.posMax,s=e.md.options.maxNesting;e.pos<r;){if(e.level<s)for(n=0;n<i&&!(t=o[n](e,!1));n++);if(t){if(e.pos>=r)break}else e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()},s.prototype.parse=function(e,t,n,o){var i,r,s,a=new this.State(e,t,n,o);for(this.tokenize(a),s=(r=this.ruler2.getRules("")).length,i=0;i<s;i++)r[i](a)},s.prototype.State=n(165),e.exports=s},function(e,t,n){"use strict";function o(e){switch(e){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}e.exports=function(e,t){for(var n=e.pos;n<e.posMax&&!o(e.src.charCodeAt(n));)n++;return n!==e.pos&&(t||(e.pending+=e.src.slice(e.pos,n)),e.pos=n,!0)}},function(e,t,n){"use strict";var o=n(3).isSpace;e.exports=function(e,t){var n,i,r=e.pos;if(10!==e.src.charCodeAt(r))return!1;for(n=e.pending.length-1,i=e.posMax,t||(n>=0&&32===e.pending.charCodeAt(n)?n>=1&&32===e.pending.charCodeAt(n-1)?(e.pending=e.pending.replace(/ +$/,""),e.push("hardbreak","br",0)):(e.pending=e.pending.slice(0,-1),e.push("softbreak","br",0)):e.push("softbreak","br",0)),r++;r<i&&o(e.src.charCodeAt(r));)r++;return e.pos=r,!0}},function(e,t,n){"use strict";for(var o=n(3).isSpace,i=[],r=0;r<256;r++)i.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach((function(e){i[e.charCodeAt(0)]=1})),e.exports=function(e,t){var n,r=e.pos,s=e.posMax;if(92!==e.src.charCodeAt(r))return!1;if(++r<s){if((n=e.src.charCodeAt(r))<256&&0!==i[n])return t||(e.pending+=e.src[r]),e.pos+=2,!0;if(10===n){for(t||e.push("hardbreak","br",0),r++;r<s&&(n=e.src.charCodeAt(r),o(n));)r++;return e.pos=r,!0}}return t||(e.pending+="\\"),e.pos++,!0}},function(e,t,n){"use strict";e.exports=function(e,t){var n,o,i,r,s,a,c=e.pos;if(96!==e.src.charCodeAt(c))return!1;for(n=c,c++,o=e.posMax;c<o&&96===e.src.charCodeAt(c);)c++;for(i=e.src.slice(n,c),r=s=c;-1!==(r=e.src.indexOf("`",s));){for(s=r+1;s<o&&96===e.src.charCodeAt(s);)s++;if(s-r===i.length)return t||((a=e.push("code_inline","code",0)).markup=i,a.content=e.src.slice(c,r).replace(/\n/g," ").replace(/^ (.+) $/,"$1")),e.pos=s,!0}return t||(e.pending+=i),e.pos+=i.length,!0}},function(e,t,n){"use strict";var o=n(3).normalizeReference,i=n(3).isSpace;e.exports=function(e,t){var n,r,s,a,c,l,d,u,h,f="",p=e.pos,m=e.posMax,g=e.pos,b=!0;if(91!==e.src.charCodeAt(e.pos))return!1;if(c=e.pos+1,(a=e.md.helpers.parseLinkLabel(e,e.pos,!0))<0)return!1;if((l=a+1)<m&&40===e.src.charCodeAt(l)){for(b=!1,l++;l<m&&(r=e.src.charCodeAt(l),i(r)||10===r);l++);if(l>=m)return!1;for(g=l,(d=e.md.helpers.parseLinkDestination(e.src,l,e.posMax)).ok&&(f=e.md.normalizeLink(d.str),e.md.validateLink(f)?l=d.pos:f=""),g=l;l<m&&(r=e.src.charCodeAt(l),i(r)||10===r);l++);if(d=e.md.helpers.parseLinkTitle(e.src,l,e.posMax),l<m&&g!==l&&d.ok)for(h=d.str,l=d.pos;l<m&&(r=e.src.charCodeAt(l),i(r)||10===r);l++);else h="";(l>=m||41!==e.src.charCodeAt(l))&&(b=!0),l++}if(b){if(void 0===e.env.references)return!1;if(l<m&&91===e.src.charCodeAt(l)?(g=l+1,(l=e.md.helpers.parseLinkLabel(e,l))>=0?s=e.src.slice(g,l++):l=a+1):l=a+1,s||(s=e.src.slice(c,a)),!(u=e.env.references[o(s)]))return e.pos=p,!1;f=u.href,h=u.title}return t||(e.pos=c,e.posMax=a,e.push("link_open","a",1).attrs=n=[["href",f]],h&&n.push(["title",h]),e.md.inline.tokenize(e),e.push("link_close","a",-1)),e.pos=l,e.posMax=m,!0}},function(e,t,n){"use strict";var o=n(3).normalizeReference,i=n(3).isSpace;e.exports=function(e,t){var n,r,s,a,c,l,d,u,h,f,p,m,g,b="",w=e.pos,k=e.posMax;if(33!==e.src.charCodeAt(e.pos))return!1;if(91!==e.src.charCodeAt(e.pos+1))return!1;if(l=e.pos+2,(c=e.md.helpers.parseLinkLabel(e,e.pos+1,!1))<0)return!1;if((d=c+1)<k&&40===e.src.charCodeAt(d)){for(d++;d<k&&(r=e.src.charCodeAt(d),i(r)||10===r);d++);if(d>=k)return!1;for(g=d,(h=e.md.helpers.parseLinkDestination(e.src,d,e.posMax)).ok&&(b=e.md.normalizeLink(h.str),e.md.validateLink(b)?d=h.pos:b=""),g=d;d<k&&(r=e.src.charCodeAt(d),i(r)||10===r);d++);if(h=e.md.helpers.parseLinkTitle(e.src,d,e.posMax),d<k&&g!==d&&h.ok)for(f=h.str,d=h.pos;d<k&&(r=e.src.charCodeAt(d),i(r)||10===r);d++);else f="";if(d>=k||41!==e.src.charCodeAt(d))return e.pos=w,!1;d++}else{if(void 0===e.env.references)return!1;if(d<k&&91===e.src.charCodeAt(d)?(g=d+1,(d=e.md.helpers.parseLinkLabel(e,d))>=0?a=e.src.slice(g,d++):d=c+1):d=c+1,a||(a=e.src.slice(l,c)),!(u=e.env.references[o(a)]))return e.pos=w,!1;b=u.href,f=u.title}return t||(s=e.src.slice(l,c),e.md.inline.parse(s,e.md,e.env,m=[]),(p=e.push("image","img",0)).attrs=n=[["src",b],["alt",""]],p.children=m,p.content=s,f&&n.push(["title",f])),e.pos=d,e.posMax=k,!0}},function(e,t,n){"use strict";var o=/^<([a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>/,i=/^<([a-zA-Z][a-zA-Z0-9+.\-]{1,31}):([^<>\x00-\x20]*)>/;e.exports=function(e,t){var n,r,s,a,c,l,d=e.pos;return 60===e.src.charCodeAt(d)&&(!((n=e.src.slice(d)).indexOf(">")<0)&&(i.test(n)?(a=(r=n.match(i))[0].slice(1,-1),c=e.md.normalizeLink(a),!!e.md.validateLink(c)&&(t||((l=e.push("link_open","a",1)).attrs=[["href",c]],l.markup="autolink",l.info="auto",(l=e.push("text","",0)).content=e.md.normalizeLinkText(a),(l=e.push("link_close","a",-1)).markup="autolink",l.info="auto"),e.pos+=r[0].length,!0)):!!o.test(n)&&(a=(s=n.match(o))[0].slice(1,-1),c=e.md.normalizeLink("mailto:"+a),!!e.md.validateLink(c)&&(t||((l=e.push("link_open","a",1)).attrs=[["href",c]],l.markup="autolink",l.info="auto",(l=e.push("text","",0)).content=e.md.normalizeLinkText(a),(l=e.push("link_close","a",-1)).markup="autolink",l.info="auto"),e.pos+=s[0].length,!0))))}},function(e,t,n){"use strict";var o=n(24).HTML_TAG_RE;e.exports=function(e,t){var n,i,r,s=e.pos;return!!e.md.options.html&&(r=e.posMax,!(60!==e.src.charCodeAt(s)||s+2>=r)&&(!(33!==(n=e.src.charCodeAt(s+1))&&63!==n&&47!==n&&!function(e){var t=32|e;return t>=97&&t<=122}(n))&&(!!(i=e.src.slice(s).match(o))&&(t||(e.push("html_inline","",0).content=e.src.slice(s,s+i[0].length)),e.pos+=i[0].length,!0))))}},function(e,t,n){"use strict";var o=n(19),i=n(3).has,r=n(3).isValidEntityCode,s=n(3).fromCodePoint,a=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,c=/^&([a-z][a-z0-9]{1,31});/i;e.exports=function(e,t){var n,l,d=e.pos,u=e.posMax;if(38!==e.src.charCodeAt(d))return!1;if(d+1<u)if(35===e.src.charCodeAt(d+1)){if(l=e.src.slice(d).match(a))return t||(n="x"===l[1][0].toLowerCase()?parseInt(l[1].slice(1),16):parseInt(l[1],10),e.pending+=r(n)?s(n):s(65533)),e.pos+=l[0].length,!0}else if((l=e.src.slice(d).match(c))&&i(o,l[1]))return t||(e.pending+=o[l[1]]),e.pos+=l[0].length,!0;return t||(e.pending+="&"),e.pos++,!0}},function(e,t,n){"use strict";function o(e,t){var n,o,i,r,s,a,c,l,d={},u=t.length;for(n=0;n<u;n++)if((i=t[n]).length=i.length||0,i.close){for(d.hasOwnProperty(i.marker)||(d[i.marker]=[-1,-1,-1]),s=d[i.marker][i.length%3],a=-1,o=n-i.jump-1;o>s;o-=r.jump+1)if((r=t[o]).marker===i.marker&&(-1===a&&(a=o),r.open&&r.end<0&&r.level===i.level&&(c=!1,(r.close||i.open)&&(r.length+i.length)%3==0&&(r.length%3==0&&i.length%3==0||(c=!0)),!c))){l=o>0&&!t[o-1].open?t[o-1].jump+1:0,i.jump=n-o+l,i.open=!1,r.end=n,r.jump=l,r.close=!1,a=-1;break}-1!==a&&(d[i.marker][(i.length||0)%3]=a)}}e.exports=function(e){var t,n=e.tokens_meta,i=e.tokens_meta.length;for(o(0,e.delimiters),t=0;t<i;t++)n[t]&&n[t].delimiters&&o(0,n[t].delimiters)}},function(e,t,n){"use strict";e.exports=function(e){var t,n,o=0,i=e.tokens,r=e.tokens.length;for(t=n=0;t<r;t++)i[t].nesting<0&&o--,i[t].level=o,i[t].nesting>0&&o++,"text"===i[t].type&&t+1<r&&"text"===i[t+1].type?i[t+1].content=i[t].content+i[t+1].content:(t!==n&&(i[n]=i[t]),n++);t!==n&&(i.length=n)}},function(e,t,n){"use strict";var o=n(14),i=n(3).isWhiteSpace,r=n(3).isPunctChar,s=n(3).isMdAsciiPunct;function a(e,t,n,o){this.src=e,this.env=n,this.md=t,this.tokens=o,this.tokens_meta=Array(o.length),this.pos=0,this.posMax=this.src.length,this.level=0,this.pending="",this.pendingLevel=0,this.cache={},this.delimiters=[],this._prev_delimiters=[]}a.prototype.pushPending=function(){var e=new o("text","",0);return e.content=this.pending,e.level=this.pendingLevel,this.tokens.push(e),this.pending="",e},a.prototype.push=function(e,t,n){this.pending&&this.pushPending();var i=new o(e,t,n),r=null;return n<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),i.level=this.level,n>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],r={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(i),this.tokens_meta.push(r),i},a.prototype.scanDelims=function(e,t){var n,o,a,c,l,d,u,h,f,p=e,m=!0,g=!0,b=this.posMax,w=this.src.charCodeAt(e);for(n=e>0?this.src.charCodeAt(e-1):32;p<b&&this.src.charCodeAt(p)===w;)p++;return a=p-e,o=p<b?this.src.charCodeAt(p):32,u=s(n)||r(String.fromCharCode(n)),f=s(o)||r(String.fromCharCode(o)),d=i(n),(h=i(o))?m=!1:f&&(d||u||(m=!1)),d?g=!1:u&&(h||f||(g=!1)),t?(c=m,l=g):(c=m&&(!g||u),l=g&&(!m||f)),{can_open:c,can_close:l,length:a}},a.prototype.Token=o,e.exports=a},function(e,t,n){"use strict";function o(e){var t=Array.prototype.slice.call(arguments,1);return t.forEach((function(t){t&&Object.keys(t).forEach((function(n){e[n]=t[n]}))})),e}function i(e){return Object.prototype.toString.call(e)}function r(e){return"[object Function]"===i(e)}function s(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}var a={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};var c={"http:":{validate:function(e,t,n){var o=e.slice(t);return n.re.http||(n.re.http=new RegExp("^\\/\\/"+n.re.src_auth+n.re.src_host_port_strict+n.re.src_path,"i")),n.re.http.test(o)?o.match(n.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(e,t,n){var o=e.slice(t);return n.re.no_http||(n.re.no_http=new RegExp("^"+n.re.src_auth+"(?:localhost|(?:(?:"+n.re.src_domain+")\\.)+"+n.re.src_domain_root+")"+n.re.src_port+n.re.src_host_terminator+n.re.src_path,"i")),n.re.no_http.test(o)?t>=3&&":"===e[t-3]||t>=3&&"/"===e[t-3]?0:o.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,n){var o=e.slice(t);return n.re.mailto||(n.re.mailto=new RegExp("^"+n.re.src_email_name+"@"+n.re.src_host_strict,"i")),n.re.mailto.test(o)?o.match(n.re.mailto)[0].length:0}}},l="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function d(e){var t=e.re=n(167)(e.__opts__),o=e.__tlds__.slice();function a(e){return e.replace("%TLDS%",t.src_tlds)}e.onCompile(),e.__tlds_replaced__||o.push("a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]"),o.push(t.src_xn),t.src_tlds=o.join("|"),t.email_fuzzy=RegExp(a(t.tpl_email_fuzzy),"i"),t.link_fuzzy=RegExp(a(t.tpl_link_fuzzy),"i"),t.link_no_ip_fuzzy=RegExp(a(t.tpl_link_no_ip_fuzzy),"i"),t.host_fuzzy_test=RegExp(a(t.tpl_host_fuzzy_test),"i");var c=[];function l(e,t){throw new Error('(LinkifyIt) Invalid schema "'+e+'": '+t)}e.__compiled__={},Object.keys(e.__schemas__).forEach((function(t){var n=e.__schemas__[t];if(null!==n){var o={validate:null,link:null};if(e.__compiled__[t]=o,"[object Object]"===i(n))return!function(e){return"[object RegExp]"===i(e)}(n.validate)?r(n.validate)?o.validate=n.validate:l(t,n):o.validate=function(e){return function(t,n){var o=t.slice(n);return e.test(o)?o.match(e)[0].length:0}}(n.validate),void(r(n.normalize)?o.normalize=n.normalize:n.normalize?l(t,n):o.normalize=function(e,t){t.normalize(e)});!function(e){return"[object String]"===i(e)}(n)?l(t,n):c.push(t)}})),c.forEach((function(t){e.__compiled__[e.__schemas__[t]]&&(e.__compiled__[t].validate=e.__compiled__[e.__schemas__[t]].validate,e.__compiled__[t].normalize=e.__compiled__[e.__schemas__[t]].normalize)})),e.__compiled__[""]={validate:null,normalize:function(e,t){t.normalize(e)}};var d=Object.keys(e.__compiled__).filter((function(t){return t.length>0&&e.__compiled__[t]})).map(s).join("|");e.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+t.src_ZPCc+"))("+d+")","i"),e.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+t.src_ZPCc+"))("+d+")","ig"),e.re.pretest=RegExp("("+e.re.schema_test.source+")|("+e.re.host_fuzzy_test.source+")|@","i"),function(e){e.__index__=-1,e.__text_cache__=""}(e)}function u(e,t){var n=e.__index__,o=e.__last_index__,i=e.__text_cache__.slice(n,o);this.schema=e.__schema__.toLowerCase(),this.index=n+t,this.lastIndex=o+t,this.raw=i,this.text=i,this.url=i}function h(e,t){var n=new u(e,t);return e.__compiled__[n.schema].normalize(n,e),n}function f(e,t){if(!(this instanceof f))return new f(e,t);var n;t||(n=e,Object.keys(n||{}).reduce((function(e,t){return e||a.hasOwnProperty(t)}),!1)&&(t=e,e={})),this.__opts__=o({},a,t),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=o({},c,e),this.__compiled__={},this.__tlds__=l,this.__tlds_replaced__=!1,this.re={},d(this)}f.prototype.add=function(e,t){return this.__schemas__[e]=t,d(this),this},f.prototype.set=function(e){return this.__opts__=o(this.__opts__,e),this},f.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;var t,n,o,i,r,s,a,c;if(this.re.schema_test.test(e))for((a=this.re.schema_search).lastIndex=0;null!==(t=a.exec(e));)if(i=this.testSchemaAt(e,t[2],a.lastIndex)){this.__schema__=t[2],this.__index__=t.index+t[1].length,this.__last_index__=t.index+t[0].length+i;break}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(c=e.search(this.re.host_fuzzy_test))>=0&&(this.__index__<0||c<this.__index__)&&null!==(n=e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))&&(r=n.index+n[1].length,(this.__index__<0||r<this.__index__)&&(this.__schema__="",this.__index__=r,this.__last_index__=n.index+n[0].length)),this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&e.indexOf("@")>=0&&null!==(o=e.match(this.re.email_fuzzy))&&(r=o.index+o[1].length,s=o.index+o[0].length,(this.__index__<0||r<this.__index__||r===this.__index__&&s>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=r,this.__last_index__=s)),this.__index__>=0},f.prototype.pretest=function(e){return this.re.pretest.test(e)},f.prototype.testSchemaAt=function(e,t,n){return this.__compiled__[t.toLowerCase()]?this.__compiled__[t.toLowerCase()].validate(e,n,this):0},f.prototype.match=function(e){var t=0,n=[];this.__index__>=0&&this.__text_cache__===e&&(n.push(h(this,t)),t=this.__last_index__);for(var o=t?e.slice(t):e;this.test(o);)n.push(h(this,t)),o=o.slice(this.__last_index__),t+=this.__last_index__;return n.length?n:null},f.prototype.tlds=function(e,t){return e=Array.isArray(e)?e:[e],t?(this.__tlds__=this.__tlds__.concat(e).sort().filter((function(e,t,n){return e!==n[t-1]})).reverse(),d(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,d(this),this)},f.prototype.normalize=function(e){e.schema||(e.url="http://"+e.url),"mailto:"!==e.schema||/^mailto:/i.test(e.url)||(e.url="mailto:"+e.url)},f.prototype.onCompile=function(){},e.exports=f},function(e,t,n){"use strict";e.exports=function(e){var t={};t.src_Any=n(21).source,t.src_Cc=n(22).source,t.src_Z=n(23).source,t.src_P=n(12).source,t.src_ZPCc=[t.src_Z,t.src_P,t.src_Cc].join("|"),t.src_ZCc=[t.src_Z,t.src_Cc].join("|");return t.src_pseudo_letter="(?:(?![><|]|"+t.src_ZPCc+")"+t.src_Any+")",t.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",t.src_auth="(?:(?:(?!"+t.src_ZCc+"|[@/\\[\\]()]).)+@)?",t.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",t.src_host_terminator="(?=$|[><|]|"+t.src_ZPCc+")(?!-|_|:\\d|\\.-|\\.(?!$|"+t.src_ZPCc+"))",t.src_path="(?:[/?#](?:(?!"+t.src_ZCc+"|[><|]|[()[\\]{}.,\"'?!\\-]).|\\[(?:(?!"+t.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+t.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+t.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+t.src_ZCc+'|["]).)+\\"|\\\'(?:(?!'+t.src_ZCc+"|[']).)+\\'|\\'(?="+t.src_pseudo_letter+"|[-]).|\\.{2,4}[a-zA-Z0-9%/]|\\.(?!"+t.src_ZCc+"|[.]).|"+(e&&e["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+"\\,(?!"+t.src_ZCc+").|\\!(?!"+t.src_ZCc+"|[!]).|\\?(?!"+t.src_ZCc+"|[?]).)+|\\/)?",t.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*',t.src_xn="xn--[a-z0-9\\-]{1,59}",t.src_domain_root="(?:"+t.src_xn+"|"+t.src_pseudo_letter+"{1,63})",t.src_domain="(?:"+t.src_xn+"|(?:"+t.src_pseudo_letter+")|(?:"+t.src_pseudo_letter+"(?:-|"+t.src_pseudo_letter+"){0,61}"+t.src_pseudo_letter+"))",t.src_host="(?:(?:(?:(?:"+t.src_domain+")\\.)*"+t.src_domain+"))",t.tpl_host_fuzzy="(?:"+t.src_ip4+"|(?:(?:(?:"+t.src_domain+")\\.)+(?:%TLDS%)))",t.tpl_host_no_ip_fuzzy="(?:(?:(?:"+t.src_domain+")\\.)+(?:%TLDS%))",t.src_host_strict=t.src_host+t.src_host_terminator,t.tpl_host_fuzzy_strict=t.tpl_host_fuzzy+t.src_host_terminator,t.src_host_port_strict=t.src_host+t.src_port+t.src_host_terminator,t.tpl_host_port_fuzzy_strict=t.tpl_host_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_port_no_ip_fuzzy_strict=t.tpl_host_no_ip_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+t.src_ZPCc+"|>|$))",t.tpl_email_fuzzy='(^|[><|]|"|\\(|'+t.src_ZCc+")("+t.src_email_name+"@"+t.tpl_host_fuzzy_strict+")",t.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_fuzzy_strict+t.src_path+")",t.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_no_ip_fuzzy_strict+t.src_path+")",t}},function(e,t,n){(function(e,o){var i;/*! https://mths.be/punycode v1.4.1 by @mathias */!function(r){t&&t.nodeType,e&&e.nodeType;var s="object"==typeof o&&o;s.global!==s&&s.window!==s&&s.self;var a,c=2147483647,l=/^xn--/,d=/[^\x20-\x7E]/,u=/[\x2E\u3002\uFF0E\uFF61]/g,h={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},f=Math.floor,p=String.fromCharCode;function m(e){throw new RangeError(h[e])}function g(e,t){for(var n=e.length,o=[];n--;)o[n]=t(e[n]);return o}function b(e,t){var n=e.split("@"),o="";return n.length>1&&(o=n[0]+"@",e=n[1]),o+g((e=e.replace(u,".")).split("."),t).join(".")}function w(e){for(var t,n,o=[],i=0,r=e.length;i<r;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<r?56320==(64512&(n=e.charCodeAt(i++)))?o.push(((1023&t)<<10)+(1023&n)+65536):(o.push(t),i--):o.push(t);return o}function k(e){return g(e,(function(e){var t="";return e>65535&&(t+=p((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=p(e)})).join("")}function _(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function v(e,t,n){var o=0;for(e=n?f(e/700):e>>1,e+=f(e/t);e>455;o+=36)e=f(e/35);return f(o+36*e/(e+38))}function y(e){var t,n,o,i,r,s,a,l,d,u,h,p=[],g=e.length,b=0,w=128,_=72;for((n=e.lastIndexOf("-"))<0&&(n=0),o=0;o<n;++o)e.charCodeAt(o)>=128&&m("not-basic"),p.push(e.charCodeAt(o));for(i=n>0?n+1:0;i<g;){for(r=b,s=1,a=36;i>=g&&m("invalid-input"),((l=(h=e.charCodeAt(i++))-48<10?h-22:h-65<26?h-65:h-97<26?h-97:36)>=36||l>f((c-b)/s))&&m("overflow"),b+=l*s,!(l<(d=a<=_?1:a>=_+26?26:a-_));a+=36)s>f(c/(u=36-d))&&m("overflow"),s*=u;_=v(b-r,t=p.length+1,0==r),f(b/t)>c-w&&m("overflow"),w+=f(b/t),b%=t,p.splice(b++,0,w)}return k(p)}function x(e){var t,n,o,i,r,s,a,l,d,u,h,g,b,k,y,x=[];for(g=(e=w(e)).length,t=128,n=0,r=72,s=0;s<g;++s)(h=e[s])<128&&x.push(p(h));for(o=i=x.length,i&&x.push("-");o<g;){for(a=c,s=0;s<g;++s)(h=e[s])>=t&&h<a&&(a=h);for(a-t>f((c-n)/(b=o+1))&&m("overflow"),n+=(a-t)*b,t=a,s=0;s<g;++s)if((h=e[s])<t&&++n>c&&m("overflow"),h==t){for(l=n,d=36;!(l<(u=d<=r?1:d>=r+26?26:d-r));d+=36)y=l-u,k=36-u,x.push(p(_(u+y%k,0))),l=f(y/k);x.push(p(_(l,0))),r=v(n,b,o==i),n=0,++o}++n,++t}return x.join("")}a={version:"1.4.1",ucs2:{decode:w,encode:k},decode:y,encode:x,toASCII:function(e){return b(e,(function(e){return d.test(e)?"xn--"+x(e):e}))},toUnicode:function(e){return b(e,(function(e){return l.test(e)?y(e.slice(4).toLowerCase()):e}))}},void 0===(i=function(){return a}.call(t,n,t,e))||(e.exports=i)}()}).call(this,n(169)(e),n(10))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";e.exports={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}}},function(e,t,n){"use strict";e.exports={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","text_collapse"]}}}},function(e,t,n){"use strict";e.exports={options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","text_collapse"]}}}},function(e,t){var n=!0,o=!1,i=!1;function r(e,t,n){var o=e.attrIndex(t),i=[t,n];o<0?e.attrPush(i):e.attrs[o]=i}function s(e,t){for(var n=e[t].level-1,o=t-1;o>=0;o--)if(e[o].level===n)return o;return-1}function a(e,t){return"inline"===e[t].type&&function(e){return"paragraph_open"===e.type}(e[t-1])&&function(e){return"list_item_open"===e.type}(e[t-2])&&function(e){return 0===e.content.indexOf("[ ] ")||0===e.content.indexOf("[x] ")||0===e.content.indexOf("[X] ")}(e[t])}function c(e,t){if(e.children.unshift(function(e,t){var o=new t("html_inline","",0),i=n?' disabled="" ':"";0===e.content.indexOf("[ ] ")?o.content='<input class="task-list-item-checkbox"'+i+'type="checkbox">':0!==e.content.indexOf("[x] ")&&0!==e.content.indexOf("[X] ")||(o.content='<input class="task-list-item-checkbox" checked=""'+i+'type="checkbox">');return o}(e,t)),e.children[1].content=e.children[1].content.slice(3),e.content=e.content.slice(3),o)if(i){e.children.pop();var r="task-item-"+Math.ceil(1e7*Math.random()-1e3);e.children[0].content=e.children[0].content.slice(0,-1)+' id="'+r+'">',e.children.push(function(e,t,n){var o=new n("html_inline","",0);return o.content='<label class="task-list-item-label" for="'+t+'">'+e+"</label>",o.attrs=[{for:t}],o}(e.content,r,t))}else e.children.unshift(function(e){var t=new e("html_inline","",0);return t.content="<label>",t}(t)),e.children.push(function(e){var t=new e("html_inline","",0);return t.content="</label>",t}(t))}e.exports=function(e,t){t&&(n=!t.enabled,o=!!t.label,i=!!t.labelAfter),e.core.ruler.after("inline","github-task-lists",(function(e){for(var t=e.tokens,o=2;o<t.length;o++)a(t,o)&&(c(t[o],e.Token),r(t[o-2],"class","task-list-item"+(n?"":" enabled")),r(t[s(t,o-2)],"class","contains-task-list"))}))}},function(e,t,n){var o=n(1),i=n(175);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=":root{--ck-mention-list-max-height:300px}.ck.ck-mentions{max-height:var(--ck-mention-list-max-height);overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain}.ck.ck-mentions>.ck-list__item{overflow:hidden;flex-shrink:0}"},function(e,t,n){var o=n(1),i=n(177);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",insert:"head",singleton:!0},s=(o(i,r),i.locals?i.locals:{});e.exports=s},function(e,t){e.exports=":root{--ck-color-mention-background:rgba(153,0,48,0.1);--ck-color-mention-text:#990030}.ck-content .mention{background:var(--ck-color-mention-background);color:var(--ck-color-mention-text)}"},function(e,t,n){"use strict";n.r(t),n.d(t,"ConstrainedEditor",(function(){return Ik})),n.d(t,"FullEditor",(function(){return Ok}));var o=n(4),i=o.a.Symbol,r=Object.prototype,s=r.hasOwnProperty,a=r.toString,c=i?i.toStringTag:void 0;var l=function(e){var t=s.call(e,c),n=e[c];try{e[c]=void 0;var o=!0}catch(e){}var i=a.call(e);return o&&(t?e[c]=n:delete e[c]),i},d=Object.prototype.toString;var u=function(e){return d.call(e)},h=i?i.toStringTag:void 0;var f=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":h&&h in Object(e)?l(e):u(e)};var p=function(e,t){return function(n){return e(t(n))}},m=p(Object.getPrototypeOf,Object);var g=function(e){return null!=e&&"object"==typeof e},b=Function.prototype,w=Object.prototype,k=b.toString,v=w.hasOwnProperty,y=k.call(Object);var x=function(e){if(!g(e)||"[object Object]"!=f(e))return!1;var t=m(e);if(null===t)return!0;var n=v.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&k.call(n)==y};var C=function(){this.__data__=[],this.size=0};var A=function(e,t){return e===t||e!=e&&t!=t};var T=function(e,t){for(var n=e.length;n--;)if(A(e[n][0],t))return n;return-1},P=Array.prototype.splice;var E=function(e){var t=this.__data__,n=T(t,e);return!(n<0)&&(n==t.length-1?t.pop():P.call(t,n,1),--this.size,!0)};var S=function(e){var t=this.__data__,n=T(t,e);return n<0?void 0:t[n][1]};var R=function(e){return T(this.__data__,e)>-1};var I=function(e,t){var n=this.__data__,o=T(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this};function O(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}O.prototype.clear=C,O.prototype.delete=E,O.prototype.get=S,O.prototype.has=R,O.prototype.set=I;var N=O;var M=function(){this.__data__=new N,this.size=0};var V=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n};var D=function(e){return this.__data__.get(e)};var F=function(e){return this.__data__.has(e)};var B=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};var L,z=function(e){if(!B(e))return!1;var t=f(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},q=o.a["__core-js_shared__"],j=(L=/[^.]+$/.exec(q&&q.keys&&q.keys.IE_PROTO||""))?"Symbol(src)_1."+L:"";var H=function(e){return!!j&&j in e},W=Function.prototype.toString;var U=function(e){if(null!=e){try{return W.call(e)}catch(e){}try{return e+""}catch(e){}}return""},$=/^\[object .+?Constructor\]$/,G=Function.prototype,K=Object.prototype,J=G.toString,Z=K.hasOwnProperty,Q=RegExp("^"+J.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Y=function(e){return!(!B(e)||H(e))&&(z(e)?Q:$).test(U(e))};var X=function(e,t){return null==e?void 0:e[t]};var ee=function(e,t){var n=X(e,t);return Y(n)?n:void 0},te=ee(o.a,"Map"),ne=ee(Object,"create");var oe=function(){this.__data__=ne?ne(null):{},this.size=0};var ie=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},re=Object.prototype.hasOwnProperty;var se=function(e){var t=this.__data__;if(ne){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return re.call(t,e)?t[e]:void 0},ae=Object.prototype.hasOwnProperty;var ce=function(e){var t=this.__data__;return ne?void 0!==t[e]:ae.call(t,e)};var le=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=ne&&void 0===t?"__lodash_hash_undefined__":t,this};function de(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}de.prototype.clear=oe,de.prototype.delete=ie,de.prototype.get=se,de.prototype.has=ce,de.prototype.set=le;var ue=de;var he=function(){this.size=0,this.__data__={hash:new ue,map:new(te||N),string:new ue}};var fe=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var pe=function(e,t){var n=e.__data__;return fe(t)?n["string"==typeof t?"string":"hash"]:n.map};var me=function(e){var t=pe(this,e).delete(e);return this.size-=t?1:0,t};var ge=function(e){return pe(this,e).get(e)};var be=function(e){return pe(this,e).has(e)};var we=function(e,t){var n=pe(this,e),o=n.size;return n.set(e,t),this.size+=n.size==o?0:1,this};function ke(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}ke.prototype.clear=he,ke.prototype.delete=me,ke.prototype.get=ge,ke.prototype.has=be,ke.prototype.set=we;var _e=ke;var ve=function(e,t){var n=this.__data__;if(n instanceof N){var o=n.__data__;if(!te||o.length<199)return o.push([e,t]),this.size=++n.size,this;n=this.__data__=new _e(o)}return n.set(e,t),this.size=n.size,this};function ye(e){var t=this.__data__=new N(e);this.size=t.size}ye.prototype.clear=M,ye.prototype.delete=V,ye.prototype.get=D,ye.prototype.has=F,ye.prototype.set=ve;var xe=ye;var Ce=function(e,t){for(var n=-1,o=null==e?0:e.length;++n<o&&!1!==t(e[n],n,e););return e},Ae=function(){try{var e=ee(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var Te=function(e,t,n){"__proto__"==t&&Ae?Ae(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},Pe=Object.prototype.hasOwnProperty;var Ee=function(e,t,n){var o=e[t];Pe.call(e,t)&&A(o,n)&&(void 0!==n||t in e)||Te(e,t,n)};var Se=function(e,t,n,o){var i=!n;n||(n={});for(var r=-1,s=t.length;++r<s;){var a=t[r],c=o?o(n[a],e[a],a,n,e):void 0;void 0===c&&(c=e[a]),i?Te(n,a,c):Ee(n,a,c)}return n};var Re=function(e,t){for(var n=-1,o=Array(e);++n<e;)o[n]=t(n);return o};var Ie=function(e){return g(e)&&"[object Arguments]"==f(e)},Oe=Object.prototype,Ne=Oe.hasOwnProperty,Me=Oe.propertyIsEnumerable,Ve=Ie(function(){return arguments}())?Ie:function(e){return g(e)&&Ne.call(e,"callee")&&!Me.call(e,"callee")},De=Array.isArray,Fe=n(5),Be=/^(?:0|[1-9]\d*)$/;var Le=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&Be.test(e))&&e>-1&&e%1==0&&e<t};var ze=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},qe={};qe["[object Float32Array]"]=qe["[object Float64Array]"]=qe["[object Int8Array]"]=qe["[object Int16Array]"]=qe["[object Int32Array]"]=qe["[object Uint8Array]"]=qe["[object Uint8ClampedArray]"]=qe["[object Uint16Array]"]=qe["[object Uint32Array]"]=!0,qe["[object Arguments]"]=qe["[object Array]"]=qe["[object ArrayBuffer]"]=qe["[object Boolean]"]=qe["[object DataView]"]=qe["[object Date]"]=qe["[object Error]"]=qe["[object Function]"]=qe["[object Map]"]=qe["[object Number]"]=qe["[object Object]"]=qe["[object RegExp]"]=qe["[object Set]"]=qe["[object String]"]=qe["[object WeakMap]"]=!1;var je=function(e){return g(e)&&ze(e.length)&&!!qe[f(e)]};var He=function(e){return function(t){return e(t)}},We=n(6),Ue=We.a&&We.a.isTypedArray,$e=Ue?He(Ue):je,Ge=Object.prototype.hasOwnProperty;var Ke=function(e,t){var n=De(e),o=!n&&Ve(e),i=!n&&!o&&Object(Fe.a)(e),r=!n&&!o&&!i&&$e(e),s=n||o||i||r,a=s?Re(e.length,String):[],c=a.length;for(var l in e)!t&&!Ge.call(e,l)||s&&("length"==l||i&&("offset"==l||"parent"==l)||r&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||Le(l,c))||a.push(l);return a},Je=Object.prototype;var Ze=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Je)},Qe=p(Object.keys,Object),Ye=Object.prototype.hasOwnProperty;var Xe=function(e){if(!Ze(e))return Qe(e);var t=[];for(var n in Object(e))Ye.call(e,n)&&"constructor"!=n&&t.push(n);return t};var et=function(e){return null!=e&&ze(e.length)&&!z(e)};var tt=function(e){return et(e)?Ke(e):Xe(e)};var nt=function(e,t){return e&&Se(t,tt(t),e)};var ot=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t},it=Object.prototype.hasOwnProperty;var rt=function(e){if(!B(e))return ot(e);var t=Ze(e),n=[];for(var o in e)("constructor"!=o||!t&&it.call(e,o))&&n.push(o);return n};var st=function(e){return et(e)?Ke(e,!0):rt(e)};var at=function(e,t){return e&&Se(t,st(t),e)},ct=n(9);var lt=function(e,t){var n=-1,o=e.length;for(t||(t=Array(o));++n<o;)t[n]=e[n];return t};var dt=function(e,t){for(var n=-1,o=null==e?0:e.length,i=0,r=[];++n<o;){var s=e[n];t(s,n,e)&&(r[i++]=s)}return r};var ut=function(){return[]},ht=Object.prototype.propertyIsEnumerable,ft=Object.getOwnPropertySymbols,pt=ft?function(e){return null==e?[]:(e=Object(e),dt(ft(e),(function(t){return ht.call(e,t)})))}:ut;var mt=function(e,t){return Se(e,pt(e),t)};var gt=function(e,t){for(var n=-1,o=t.length,i=e.length;++n<o;)e[i+n]=t[n];return e},bt=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)gt(t,pt(e)),e=m(e);return t}:ut;var wt=function(e,t){return Se(e,bt(e),t)};var kt=function(e,t,n){var o=t(e);return De(e)?o:gt(o,n(e))};var _t=function(e){return kt(e,tt,pt)};var vt=function(e){return kt(e,st,bt)},yt=ee(o.a,"DataView"),xt=ee(o.a,"Promise"),Ct=ee(o.a,"Set"),At=ee(o.a,"WeakMap"),Tt=U(yt),Pt=U(te),Et=U(xt),St=U(Ct),Rt=U(At),It=f;(yt&&"[object DataView]"!=It(new yt(new ArrayBuffer(1)))||te&&"[object Map]"!=It(new te)||xt&&"[object Promise]"!=It(xt.resolve())||Ct&&"[object Set]"!=It(new Ct)||At&&"[object WeakMap]"!=It(new At))&&(It=function(e){var t=f(e),n="[object Object]"==t?e.constructor:void 0,o=n?U(n):"";if(o)switch(o){case Tt:return"[object DataView]";case Pt:return"[object Map]";case Et:return"[object Promise]";case St:return"[object Set]";case Rt:return"[object WeakMap]"}return t});var Ot=It,Nt=Object.prototype.hasOwnProperty;var Mt=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Nt.call(e,"index")&&(n.index=e.index,n.input=e.input),n},Vt=o.a.Uint8Array;var Dt=function(e){var t=new e.constructor(e.byteLength);return new Vt(t).set(new Vt(e)),t};var Ft=function(e,t){var n=t?Dt(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)},Bt=/\w*$/;var Lt=function(e){var t=new e.constructor(e.source,Bt.exec(e));return t.lastIndex=e.lastIndex,t},zt=i?i.prototype:void 0,qt=zt?zt.valueOf:void 0;var jt=function(e){return qt?Object(qt.call(e)):{}};var Ht=function(e,t){var n=t?Dt(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)};var Wt=function(e,t,n){var o=e.constructor;switch(t){case"[object ArrayBuffer]":return Dt(e);case"[object Boolean]":case"[object Date]":return new o(+e);case"[object DataView]":return Ft(e,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return Ht(e,n);case"[object Map]":return new o;case"[object Number]":case"[object String]":return new o(e);case"[object RegExp]":return Lt(e);case"[object Set]":return new o;case"[object Symbol]":return jt(e)}},Ut=Object.create,$t=function(){function e(){}return function(t){if(!B(t))return{};if(Ut)return Ut(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();var Gt=function(e){return"function"!=typeof e.constructor||Ze(e)?{}:$t(m(e))};var Kt=function(e){return g(e)&&"[object Map]"==Ot(e)},Jt=We.a&&We.a.isMap,Zt=Jt?He(Jt):Kt;var Qt=function(e){return g(e)&&"[object Set]"==Ot(e)},Yt=We.a&&We.a.isSet,Xt=Yt?He(Yt):Qt,en={};en["[object Arguments]"]=en["[object Array]"]=en["[object ArrayBuffer]"]=en["[object DataView]"]=en["[object Boolean]"]=en["[object Date]"]=en["[object Float32Array]"]=en["[object Float64Array]"]=en["[object Int8Array]"]=en["[object Int16Array]"]=en["[object Int32Array]"]=en["[object Map]"]=en["[object Number]"]=en["[object Object]"]=en["[object RegExp]"]=en["[object Set]"]=en["[object String]"]=en["[object Symbol]"]=en["[object Uint8Array]"]=en["[object Uint8ClampedArray]"]=en["[object Uint16Array]"]=en["[object Uint32Array]"]=!0,en["[object Error]"]=en["[object Function]"]=en["[object WeakMap]"]=!1;var tn=function e(t,n,o,i,r,s){var a,c=1&n,l=2&n,d=4&n;if(o&&(a=r?o(t,i,r,s):o(t)),void 0!==a)return a;if(!B(t))return t;var u=De(t);if(u){if(a=Mt(t),!c)return lt(t,a)}else{var h=Ot(t),f="[object Function]"==h||"[object GeneratorFunction]"==h;if(Object(Fe.a)(t))return Object(ct.a)(t,c);if("[object Object]"==h||"[object Arguments]"==h||f&&!r){if(a=l||f?{}:Gt(t),!c)return l?wt(t,at(a,t)):mt(t,nt(a,t))}else{if(!en[h])return r?t:{};a=Wt(t,h,c)}}s||(s=new xe);var p=s.get(t);if(p)return p;s.set(t,a),Xt(t)?t.forEach((function(i){a.add(e(i,n,o,i,t,s))})):Zt(t)&&t.forEach((function(i,r){a.set(r,e(i,n,o,r,t,s))}));var m=d?l?vt:_t:l?keysIn:tt,g=u?void 0:m(t);return Ce(g||t,(function(i,r){g&&(i=t[r=i]),Ee(a,r,e(i,n,o,r,t,s))})),a};var nn=function(e,t){return tn(e,5,t="function"==typeof t?t:void 0)};var on=function(e){return g(e)&&1===e.nodeType&&!x(e)};
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class rn{constructor(e,t){this._config={},t&&this.define(sn(t)),e&&this._setObjectToTarget(this._config,e)}set(e,t){this._setToTarget(this._config,e,t)}define(e,t){this._setToTarget(this._config,e,t,!0)}get(e){return this._getFromSource(this._config,e)}*names(){for(const e of Object.keys(this._config))yield e}_setToTarget(e,t,n,o=!1){if(x(t))return void this._setObjectToTarget(e,t,o);const i=t.split(".");t=i.pop();for(const t of i)x(e[t])||(e[t]={}),e=e[t];if(x(n))return x(e[t])||(e[t]={}),e=e[t],void this._setObjectToTarget(e,n,o);o&&void 0!==e[t]||(e[t]=n)}_getFromSource(e,t){const n=t.split(".");t=n.pop();for(const t of n){if(!x(e[t])){e=null;break}e=e[t]}return e?sn(e[t]):void 0}_setObjectToTarget(e,t,n){Object.keys(t).forEach(o=>{this._setToTarget(e,o,t[o],n)})}}function sn(e){return nn(e,an)}function an(e){return on(e)?e:void 0}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/var cn=function(){return function e(){e.called=!0}};
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class ln{constructor(e,t){this.source=e,this.name=t,this.path=[],this.stop=cn(),this.off=cn()}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/const dn=new Array(256).fill().map((e,t)=>("0"+t.toString(16)).slice(-2));function un(){const e=4294967296*Math.random()>>>0,t=4294967296*Math.random()>>>0,n=4294967296*Math.random()>>>0,o=4294967296*Math.random()>>>0;return"e"+dn[e>>0&255]+dn[e>>8&255]+dn[e>>16&255]+dn[e>>24&255]+dn[t>>0&255]+dn[t>>8&255]+dn[t>>16&255]+dn[t>>24&255]+dn[n>>0&255]+dn[n>>8&255]+dn[n>>16&255]+dn[n>>24&255]+dn[o>>0&255]+dn[o>>8&255]+dn[o>>16&255]+dn[o>>24&255]}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/var hn={get(e){return"number"!=typeof e?this[e]||this.normal:e},highest:1e5,high:1e3,normal:0,low:-1e3,lowest:-1e5},fn=(n(7),n(0));
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
const pn=Symbol("listeningTo"),mn=Symbol("emitterId");var gn={on(e,t,n={}){this.listenTo(this,e,t,n)},once(e,t,n){let o=!1;this.listenTo(this,e,(function(e,...n){o||(o=!0,e.off(),t.call(this,e,...n))}),n)},off(e,t){this.stopListening(this,e,t)},listenTo(e,t,n,o={}){let i,r;this[pn]||(this[pn]={});const s=this[pn];wn(e)||bn(e);const a=wn(e);(i=s[a])||(i=s[a]={emitter:e,callbacks:{}}),(r=i.callbacks[t])||(r=i.callbacks[t]=[]),r.push(n),function(e,t){const n=kn(e);if(n[t])return;let o=t,i=null;const r=[];for(;""!==o&&!n[o];)n[o]={callbacks:[],childEvents:[]},r.push(n[o]),i&&n[o].childEvents.push(i),i=o,o=o.substr(0,o.lastIndexOf(":"));if(""!==o){for(const e of r)e.callbacks=n[o].callbacks.slice();n[o].childEvents.push(i)}}(e,t);const c=_n(e,t),l=hn.get(o.priority),d={callback:n,priority:l};for(const e of c){let t=!1;for(let n=0;n<e.length;n++)if(e[n].priority<l){e.splice(n,0,d),t=!0;break}t||e.push(d)}},stopListening(e,t,n){const o=this[pn];let i=e&&wn(e);const r=o&&i&&o[i],s=r&&t&&r.callbacks[t];if(!(!o||e&&!r||t&&!s))if(n)yn(e,t,n);else if(s){for(;n=s.pop();)yn(e,t,n);delete r.callbacks[t]}else if(r){for(t in r.callbacks)this.stopListening(e,t);delete o[i]}else{for(i in o)this.stopListening(o[i].emitter);delete this[pn]}},fire(e,...t){try{const n=e instanceof ln?e:new ln(this,e),o=n.name;let i=function e(t,n){let o;if(!t._events||!(o=t._events[n])||!o.callbacks.length)return n.indexOf(":")>-1?e(t,n.substr(0,n.lastIndexOf(":"))):null;return o.callbacks}(this,o);if(n.path.push(this),i){const e=[n,...t];i=Array.from(i);for(let t=0;t<i.length&&(i[t].callback.apply(this,e),n.off.called&&(delete n.off.called,yn(this,o,i[t].callback)),!n.stop.called);t++);}if(this._delegations){const e=this._delegations.get(o),i=this._delegations.get("*");e&&vn(e,n,t),i&&vn(i,n,t)}return n.return}catch(e){fn.b.rethrowUnexpectedError(e,this)}},delegate(...e){return{to:(t,n)=>{this._delegations||(this._delegations=new Map),e.forEach(e=>{const o=this._delegations.get(e);o?o.set(t,n):this._delegations.set(e,new Map([[t,n]]))})}}},stopDelegating(e,t){if(this._delegations)if(e)if(t){const n=this._delegations.get(e);n&&n.delete(t)}else this._delegations.delete(e);else this._delegations.clear()}};function bn(e,t){e[mn]||(e[mn]=t||un())}function wn(e){return e[mn]}function kn(e){return e._events||Object.defineProperty(e,"_events",{value:{}}),e._events}function _n(e,t){const n=kn(e)[t];if(!n)return[];let o=[n.callbacks];for(let t=0;t<n.childEvents.length;t++){const i=_n(e,n.childEvents[t]);o=o.concat(i)}return o}function vn(e,t,n){for(let[o,i]of e){i?"function"==typeof i&&(i=i(t.name)):i=t.name;const e=new ln(t.source,i);e.path=[...t.path],o.fire(e,...n)}}function yn(e,t,n){const o=_n(e,t);for(const e of o)for(let t=0;t<e.length;t++)e[t].callback==n&&(e.splice(t,1),t--)}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function xn(e,...t){t.forEach(t=>{Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t)).forEach(n=>{if(n in e.prototype)return;const o=Object.getOwnPropertyDescriptor(t,n);o.enumerable=!1,Object.defineProperty(e.prototype,n,o)})})}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Cn{constructor(e={}){this._items=[],this._itemMap=new Map,this._idProperty=e.idProperty||"id",this._bindToExternalToInternalMap=new WeakMap,this._bindToInternalToExternalMap=new WeakMap,this._skippedIndexesFromExternal=[]}get length(){return this._items.length}get first(){return this._items[0]||null}get last(){return this._items[this.length-1]||null}add(e,t){let n;const o=this._idProperty;if(o in e){if(n=e[o],"string"!=typeof n)throw new fn.b("collection-add-invalid-id",this);if(this.get(n))throw new fn.b("collection-add-item-already-exists",this)}else e[o]=n=un();if(void 0===t)t=this._items.length;else if(t>this._items.length||t<0)throw new fn.b("collection-add-item-invalid-index",this);return this._items.splice(t,0,e),this._itemMap.set(n,e),this.fire("add",e,t),this}get(e){let t;if("string"==typeof e)t=this._itemMap.get(e);else{if("number"!=typeof e)throw new fn.b("collection-get-invalid-arg: Index or id must be given.",this);t=this._items[e]}return t||null}has(e){if("string"==typeof e)return this._itemMap.has(e);{const t=e[this._idProperty];return this._itemMap.has(t)}}getIndex(e){let t;return t="string"==typeof e?this._itemMap.get(e):e,this._items.indexOf(t)}remove(e){let t,n,o,i=!1;const r=this._idProperty;if("string"==typeof e?(n=e,o=this._itemMap.get(n),i=!o,o&&(t=this._items.indexOf(o))):"number"==typeof e?(t=e,o=this._items[t],i=!o,o&&(n=o[r])):(o=e,n=o[r],t=this._items.indexOf(o),i=-1==t||!this._itemMap.get(n)),i)throw new fn.b("collection-remove-404: Item not found.",this);this._items.splice(t,1),this._itemMap.delete(n);const s=this._bindToInternalToExternalMap.get(o);return this._bindToInternalToExternalMap.delete(o),this._bindToExternalToInternalMap.delete(s),this.fire("remove",o,t),o}map(e,t){return this._items.map(e,t)}find(e,t){return this._items.find(e,t)}filter(e,t){return this._items.filter(e,t)}clear(){for(this._bindToCollection&&(this.stopListening(this._bindToCollection),this._bindToCollection=null);this.length;)this.remove(0)}bindTo(e){if(this._bindToCollection)throw new fn.b("collection-bind-to-rebind: The collection cannot be bound more than once.",this);return this._bindToCollection=e,{as:e=>{this._setUpBindToBinding(t=>new e(t))},using:e=>{"function"==typeof e?this._setUpBindToBinding(t=>e(t)):this._setUpBindToBinding(t=>t[e])}}}_setUpBindToBinding(e){const t=this._bindToCollection,n=(n,o,i)=>{const r=t._bindToCollection==this,s=t._bindToInternalToExternalMap.get(o);if(r&&s)this._bindToExternalToInternalMap.set(o,s),this._bindToInternalToExternalMap.set(s,o);else{const n=e(o);if(!n)return void this._skippedIndexesFromExternal.push(i);let r=i;for(const e of this._skippedIndexesFromExternal)i>e&&r--;for(const e of t._skippedIndexesFromExternal)r>=e&&r++;this._bindToExternalToInternalMap.set(o,n),this._bindToInternalToExternalMap.set(n,o),this.add(n,r);for(let e=0;e<t._skippedIndexesFromExternal.length;e++)r<=t._skippedIndexesFromExternal[e]&&t._skippedIndexesFromExternal[e]++}};for(const e of t)n(0,e,t.getIndex(e));this.listenTo(t,"add",n),this.listenTo(t,"remove",(e,t,n)=>{const o=this._bindToExternalToInternalMap.get(t);o&&this.remove(o),this._skippedIndexesFromExternal=this._skippedIndexesFromExternal.reduce((e,t)=>(n<t&&e.push(t-1),n>t&&e.push(t),e),[])})}[Symbol.iterator](){return this._items[Symbol.iterator]()}}xn(Cn,gn);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
class An{constructor(e,t=[],n=[]){this._context=e,this._plugins=new Map,this._availablePlugins=new Map;for(const e of t)e.pluginName&&this._availablePlugins.set(e.pluginName,e);this._contextPlugins=new Map;for(const[e,t]of n)this._contextPlugins.set(e,t),this._contextPlugins.set(t,e),e.pluginName&&this._availablePlugins.set(e.pluginName,e)}*[Symbol.iterator](){for(const e of this._plugins)"function"==typeof e[0]&&(yield e)}get(e){const t=this._plugins.get(e);if(!t){const t="plugincollection-plugin-not-loaded: The requested plugin is not loaded.";let n=e;throw"function"==typeof e&&(n=e.pluginName||e.name),new fn.b(t,this._context,{plugin:n})}return t}has(e){return this._plugins.has(e)}init(e,t=[]){const n=this,o=this._context,i=new Set,r=[],s=h(e),a=h(t),c=function(e){const t=[];for(const n of e)u(n)||t.push(n);return t.length?t:null}(e);if(c){const e="plugincollection-plugin-not-found: Some plugins are not available and could not be loaded.";return console.error(Object(fn.a)(e),{plugins:c}),Promise.reject(new fn.b(e,o,{plugins:c}))}return Promise.all(s.map(l)).then(()=>d(r,"init")).then(()=>d(r,"afterInit")).then(()=>r);function l(e){if(!a.includes(e)&&!n._plugins.has(e)&&!i.has(e))return function(e){return new Promise(s=>{i.add(e),e.requires&&e.requires.forEach(n=>{const i=u(n);if(e.isContextPlugin&&!i.isContextPlugin)throw new fn.b("plugincollection-context-required: Context plugin can not require plugin which is not a context plugin",null,{plugin:i.name,requiredBy:e.name});if(t.includes(i))throw new fn.b("plugincollection-required: Cannot load a plugin because one of its dependencies is listed inthe `removePlugins` option.",o,{plugin:i.name,requiredBy:e.name});l(i)});const a=n._contextPlugins.get(e)||new e(o);n._add(e,a),r.push(a),s()})}(e).catch(t=>{throw console.error(Object(fn.a)("plugincollection-load: It was not possible to load the plugin."),{plugin:e}),t})}function d(e,t){return e.reduce((e,o)=>o[t]?n._contextPlugins.has(o)?e:e.then(o[t].bind(o)):e,Promise.resolve())}function u(e){return"function"==typeof e?e:n._availablePlugins.get(e)}function h(e){return e.map(e=>u(e)).filter(e=>!!e)}}destroy(){const e=[];for(const[,t]of this)"function"!=typeof t.destroy||this._contextPlugins.has(t)||e.push(t.destroy());return Promise.all(e)}_add(e,t){this._plugins.set(e,t);const n=e.pluginName;if(n){if(this._plugins.has(n))throw new fn.b("plugincollection-plugin-name-conflict: Two plugins with the same name were loaded.",null,{pluginName:n,plugin1:this._plugins.get(n).constructor,plugin2:e});this._plugins.set(n,t)}}}function Tn(e,t){const n=Object.keys(window.CKEDITOR_TRANSLATIONS).length;return 1===n&&(e=Object.keys(window.CKEDITOR_TRANSLATIONS)[0]),0!==n&&function(e,t){return e in window.CKEDITOR_TRANSLATIONS&&t in window.CKEDITOR_TRANSLATIONS[e]}(e,t)?window.CKEDITOR_TRANSLATIONS[e][t].replace(/ \[context: [^\]]+\]$/,""):t.replace(/ \[context: [^\]]+\]$/,"")}xn(An,gn),
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={});
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
const Pn=["ar","fa","he","ku","ug"];class En{constructor(e={}){this.uiLanguage=e.uiLanguage||"en",this.contentLanguage=e.contentLanguage||this.uiLanguage,this.uiLanguageDirection=Sn(this.uiLanguage),this.contentLanguageDirection=Sn(this.contentLanguage),this.t=(...e)=>this._t(...e)}get language(){return console.warn("locale-deprecated-language-property: The Locale#language property has been deprecated and will be removed in the near future. Please use #uiLanguage and #contentLanguage properties instead."),this.uiLanguage}_t(e,t){let n=Tn(this.uiLanguage,e);return t&&(n=n.replace(/%(\d+)/g,(e,n)=>n<t.length?t[n]:e)),n}}function Sn(e){return Pn.includes(e)?"rtl":"ltr"}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Rn{constructor(e){this.config=new rn(e,this.constructor.defaultConfig);const t=this.constructor.builtinPlugins;this.config.define("plugins",t),this.plugins=new An(this,t);const n=this.config.get("language")||{};this.locale=new En({uiLanguage:"string"==typeof n?n:n.ui,contentLanguage:this.config.get("language.content")}),this.t=this.locale.t,this.editors=new Cn,this._contextOwner=null}initPlugins(){const e=this.config.get("plugins")||[];for(const t of e){if("function"!=typeof t)throw new fn.b("context-initplugins-constructor-only: Only a constructor function is allowed as a context plugin.",null,{Plugin:t});if(!0!==t.isContextPlugin)throw new fn.b("context-initplugins-invalid-plugin: Only a plugin marked as a context plugin is allowed to be used with a context.",null,{Plugin:t})}return this.plugins.init(e)}destroy(){return Promise.all(Array.from(this.editors,e=>e.destroy())).then(()=>this.plugins.destroy())}_addEditor(e,t){if(this._contextOwner)throw new fn.b("context-addEditor-private-context: Cannot add multiple editors to the context which is created by the editor.");this.editors.add(e),t&&(this._contextOwner=e)}_removeEditor(e){return this.editors.has(e)&&this.editors.remove(e),this._contextOwner===e?this.destroy():Promise.resolve()}_getEditorConfig(){const e={};for(const t of this.config.names())["plugins","removePlugins","extraPlugins"].includes(t)||(e[t]=this.config.get(t));return e}static create(e){return new Promise(t=>{const n=new this(e);t(n.initPlugins().then(()=>n))})}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function In(e,t){const n=Math.min(e.length,t.length);for(let o=0;o<n;o++)if(e[o]!=t[o])return o;return e.length==t.length?"same":e.length<t.length?"prefix":"extension"}var On=function(e){return tn(e,4)};
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Nn{constructor(e){this.document=e,this.parent=null}get index(){let e;if(!this.parent)return null;if(-1==(e=this.parent.getChildIndex(this)))throw new fn.b("view-node-not-found-in-parent: The node's parent does not contain this node.",this);return e}get nextSibling(){const e=this.index;return null!==e&&this.parent.getChild(e+1)||null}get previousSibling(){const e=this.index;return null!==e&&this.parent.getChild(e-1)||null}get root(){let e=this;for(;e.parent;)e=e.parent;return e}isAttached(){return this.root.is("rootElement")}getPath(){const e=[];let t=this;for(;t.parent;)e.unshift(t.index),t=t.parent;return e}getAncestors(e={includeSelf:!1,parentFirst:!1}){const t=[];let n=e.includeSelf?this:this.parent;for(;n;)t[e.parentFirst?"push":"unshift"](n),n=n.parent;return t}getCommonAncestor(e,t={}){const n=this.getAncestors(t),o=e.getAncestors(t);let i=0;for(;n[i]==o[i]&&n[i];)i++;return 0===i?null:n[i-1]}isBefore(e){if(this==e)return!1;if(this.root!==e.root)return!1;const t=this.getPath(),n=e.getPath(),o=In(t,n);switch(o){case"prefix":return!0;case"extension":return!1;default:return t[o]<n[o]}}isAfter(e){return this!=e&&(this.root===e.root&&!this.isBefore(e))}_remove(){this.parent._removeChildren(this.index)}_fireChange(e,t){this.fire("change:"+e,t),this.parent&&this.parent._fireChange(e,t)}toJSON(){const e=On(this);return delete e.parent,e}is(e){return"node"==e||"view:node"==e}}xn(Nn,gn);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
class Mn extends Nn{constructor(e,t){super(e),this._textData=t}is(e){return"text"==e||"view:text"==e||super.is(e)}get data(){return this._textData}get _data(){return this.data}set _data(e){this._fireChange("text",this),this._textData=e}isSimilar(e){return e instanceof Mn&&(this===e||this.data===e.data)}_clone(){return new Mn(this.document,this.data)}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Vn{constructor(e,t,n){if(this.textNode=e,t<0||t>e.data.length)throw new fn.b("view-textproxy-wrong-offsetintext: Given offsetInText value is incorrect.",this);if(n<0||t+n>e.data.length)throw new fn.b("view-textproxy-wrong-length: Given length value is incorrect.",this);this.data=e.data.substring(t,t+n),this.offsetInText=t}get offsetSize(){return this.data.length}get isPartial(){return this.data.length!==this.textNode.data.length}get parent(){return this.textNode.parent}get root(){return this.textNode.root}get document(){return this.textNode.document}is(e){return"textProxy"==e||"view:textProxy"==e}getAncestors(e={includeSelf:!1,parentFirst:!1}){const t=[];let n=e.includeSelf?this.textNode:this.parent;for(;null!==n;)t[e.parentFirst?"push":"unshift"](n),n=n.parent;return t}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
function Dn(e){return!(!e||!e[Symbol.iterator])}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function Fn(e){return Dn(e)?new Map(e):function(e){const t=new Map;for(const n in e)t.set(n,e[n]);return t}(e)}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Bn{constructor(...e){this._patterns=[],this.add(...e)}add(...e){for(let t of e)("string"==typeof t||t instanceof RegExp)&&(t={name:t}),t.classes&&("string"==typeof t.classes||t.classes instanceof RegExp)&&(t.classes=[t.classes]),this._patterns.push(t)}match(...e){for(const t of e)for(const e of this._patterns){const n=Ln(t,e);if(n)return{element:t,pattern:e,match:n}}return null}matchAll(...e){const t=[];for(const n of e)for(const e of this._patterns){const o=Ln(n,e);o&&t.push({element:n,pattern:e,match:o})}return t.length>0?t:null}getElementName(){if(1!==this._patterns.length)return null;const e=this._patterns[0],t=e.name;return"function"==typeof e||!t||t instanceof RegExp?null:t}}function Ln(e,t){if("function"==typeof t)return t(e);const n={};return t.name&&(n.name=function(e,t){if(e instanceof RegExp)return e.test(t);return e===t}(t.name,e.name),!n.name)||t.attributes&&(n.attributes=function(e,t){const n=[];for(const o in e){const i=e[o];if(!t.hasAttribute(o))return null;{const e=t.getAttribute(o);if(!0===i)n.push(o);else if(i instanceof RegExp){if(!i.test(e))return null;n.push(o)}else{if(e!==i)return null;n.push(o)}}}return n}(t.attributes,e),!n.attributes)?null:!(t.classes&&(n.classes=function(e,t){const n=[];for(const o of e)if(o instanceof RegExp){const e=t.getClassNames();for(const t of e)o.test(t)&&n.push(t);if(0===n.length)return null}else{if(!t.hasClass(o))return null;n.push(o)}return n}(t.classes,e),!n.classes))&&(!(t.styles&&(n.styles=function(e,t){const n=[];for(const o in e){const i=e[o];if(!t.hasStyle(o))return null;{const e=t.getStyle(o);if(i instanceof RegExp){if(!i.test(e))return null;n.push(o)}else{if(e!==i)return null;n.push(o)}}}return n}(t.styles,e),!n.styles))&&n)}var zn=function(e){return"symbol"==typeof e||g(e)&&"[object Symbol]"==f(e)},qn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,jn=/^\w*$/;var Hn=function(e,t){if(De(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!zn(e))||(jn.test(e)||!qn.test(e)||null!=t&&e in Object(t))};function Wn(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var o=arguments,i=t?t.apply(this,o):o[0],r=n.cache;if(r.has(i))return r.get(i);var s=e.apply(this,o);return n.cache=r.set(i,s)||r,s};return n.cache=new(Wn.Cache||_e),n}Wn.Cache=_e;var Un=Wn;var $n=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Gn=/\\(\\)?/g,Kn=function(e){var t=Un(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace($n,(function(e,n,o,i){t.push(o?i.replace(Gn,"$1"):n||e)})),t}));var Jn=function(e,t){for(var n=-1,o=null==e?0:e.length,i=Array(o);++n<o;)i[n]=t(e[n],n,e);return i},Zn=i?i.prototype:void 0,Qn=Zn?Zn.toString:void 0;var Yn=function e(t){if("string"==typeof t)return t;if(De(t))return Jn(t,e)+"";if(zn(t))return Qn?Qn.call(t):"";var n=t+"";return"0"==n&&1/t==-1/0?"-0":n};var Xn=function(e){return null==e?"":Yn(e)};var eo=function(e,t){return De(e)?e:Hn(e,t)?[e]:Kn(Xn(e))};var to=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0};var no=function(e){if("string"==typeof e||zn(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t};var oo=function(e,t){for(var n=0,o=(t=eo(t,e)).length;null!=e&&n<o;)e=e[no(t[n++])];return n&&n==o?e:void 0};var io=function(e,t,n){var o=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var r=Array(i);++o<i;)r[o]=e[o+t];return r};var ro=function(e,t){return t.length<2?e:oo(e,io(t,0,-1))};var so=function(e,t){return t=eo(t,e),null==(e=ro(e,t))||delete e[no(to(t))]};var ao=function(e,t){return null==e||so(e,t)};var co=function(e,t,n){var o=null==e?void 0:oo(e,t);return void 0===o?n:o};var lo=function(e,t,n){(void 0===n||A(e[t],n))&&(void 0!==n||t in e)||Te(e,t,n)};var uo=function(e){return function(t,n,o){for(var i=-1,r=Object(t),s=o(t),a=s.length;a--;){var c=s[e?a:++i];if(!1===n(r[c],c,r))break}return t}}();var ho=function(e){return g(e)&&et(e)};var fo=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]};var po=function(e){return Se(e,st(e))};var mo=function(e,t,n,o,i,r,s){var a=fo(e,n),c=fo(t,n),l=s.get(c);if(l)lo(e,n,l);else{var d=r?r(a,c,n+"",e,t,s):void 0,u=void 0===d;if(u){var h=De(c),f=!h&&Object(Fe.a)(c),p=!h&&!f&&$e(c);d=c,h||f||p?De(a)?d=a:ho(a)?d=lt(a):f?(u=!1,d=Object(ct.a)(c,!0)):p?(u=!1,d=Ht(c,!0)):d=[]:x(c)||Ve(c)?(d=a,Ve(a)?d=po(a):B(a)&&!z(a)||(d=Gt(c))):u=!1}u&&(s.set(c,d),i(d,c,o,r,s),s.delete(c)),lo(e,n,d)}};var go=function e(t,n,o,i,r){t!==n&&uo(n,(function(s,a){if(r||(r=new xe),B(s))mo(t,n,a,o,e,i,r);else{var c=i?i(fo(t,a),s,a+"",t,n,r):void 0;void 0===c&&(c=s),lo(t,a,c)}}),st)};var bo=function(e){return e};var wo=function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)},ko=Math.max;var _o=function(e,t,n){return t=ko(void 0===t?e.length-1:t,0),function(){for(var o=arguments,i=-1,r=ko(o.length-t,0),s=Array(r);++i<r;)s[i]=o[t+i];i=-1;for(var a=Array(t+1);++i<t;)a[i]=o[i];return a[t]=n(s),wo(e,this,a)}};var vo=function(e){return function(){return e}},yo=Ae?function(e,t){return Ae(e,"toString",{configurable:!0,enumerable:!1,value:vo(t),writable:!0})}:bo,xo=Date.now;var Co=function(e){var t=0,n=0;return function(){var o=xo(),i=16-(o-n);if(n=o,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(yo);var Ao=function(e,t){return Co(_o(e,t,bo),e+"")};var To=function(e,t,n){if(!B(n))return!1;var o=typeof t;return!!("number"==o?et(n)&&Le(t,n.length):"string"==o&&t in n)&&A(n[t],e)};var Po=function(e){return Ao((function(t,n){var o=-1,i=n.length,r=i>1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(r=e.length>3&&"function"==typeof r?(i--,r):void 0,s&&To(n[0],n[1],s)&&(r=i<3?void 0:r,i=1),t=Object(t);++o<i;){var a=n[o];a&&e(t,a,o,r)}return t}))},Eo=Po((function(e,t,n){go(e,t,n)}));var So=function(e,t,n,o){if(!B(e))return e;for(var i=-1,r=(t=eo(t,e)).length,s=r-1,a=e;null!=a&&++i<r;){var c=no(t[i]),l=n;if(i!=s){var d=a[c];void 0===(l=o?o(d,c,a):void 0)&&(l=B(d)?d:Le(t[i+1])?[]:{})}Ee(a,c,l),a=a[c]}return e};var Ro=function(e,t,n){return null==e?e:So(e,t,n)};
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Io{constructor(e){this._styles={},this._styleProcessor=e}get isEmpty(){const e=Object.entries(this._styles);return!Array.from(e).length}get size(){return this.isEmpty?0:this.getStyleNames().length}setTo(e){this.clear();const t=Array.from(function(e){let t=null,n=0,o=0,i=null;const r=new Map;if(""===e)return r;";"!=e.charAt(e.length-1)&&(e+=";");for(let s=0;s<e.length;s++){const a=e.charAt(s);if(null===t)switch(a){case":":i||(i=e.substr(n,s-n),o=s+1);break;case'"':case"'":t=a;break;case";":{const t=e.substr(o,s-o);i&&r.set(i.trim(),t.trim()),i=null,n=s+1;break}}else a===t&&(t=null)}return r}(e).entries());for(const[e,n]of t)this._styleProcessor.toNormalizedForm(e,n,this._styles)}has(e){if(this.isEmpty)return!1;const t=this._styleProcessor.getReducedForm(e,this._styles).find(([t])=>t===e);return Array.isArray(t)}set(e,t){if(B(e))for(const[t,n]of Object.entries(e))this._styleProcessor.toNormalizedForm(t,n,this._styles);else this._styleProcessor.toNormalizedForm(e,t,this._styles)}remove(e){const t=No(e);ao(this._styles,t),delete this._styles[e],this._cleanEmptyObjectsOnPath(t)}getNormalized(e){return this._styleProcessor.getNormalized(e,this._styles)}toString(){return this.isEmpty?"":this._getStylesEntries().map(e=>e.join(":")).sort().join(";")+";"}getAsString(e){if(this.isEmpty)return;if(this._styles[e]&&!B(this._styles[e]))return this._styles[e];const t=this._styleProcessor.getReducedForm(e,this._styles).find(([t])=>t===e);return Array.isArray(t)?t[1]:void 0}getStyleNames(){if(this.isEmpty)return[];return this._getStylesEntries().map(([e])=>e)}clear(){this._styles={}}_getStylesEntries(){const e=[],t=Object.keys(this._styles);for(const n of t)e.push(...this._styleProcessor.getReducedForm(n,this._styles));return e}_cleanEmptyObjectsOnPath(e){const t=e.split(".");if(!(t.length>1))return;const n=t.splice(0,t.length-1).join("."),o=co(this._styles,n);o&&!Array.from(Object.keys(o)).length&&this.remove(n)}}class Oo{constructor(){this._normalizers=new Map,this._extractors=new Map,this._reducers=new Map,this._consumables=new Map}toNormalizedForm(e,t,n){if(B(t))Mo(n,No(e),t);else if(this._normalizers.has(e)){const o=this._normalizers.get(e),{path:i,value:r}=o(t);Mo(n,i,r)}else Mo(n,e,t)}getNormalized(e,t){if(!e)return Eo({},t);if(void 0!==t[e])return t[e];if(this._extractors.has(e)){const n=this._extractors.get(e);if("string"==typeof n)return co(t,n);const o=n(e,t);if(o)return o}return co(t,No(e))}getReducedForm(e,t){const n=this.getNormalized(e,t);if(void 0===n)return[];if(this._reducers.has(e)){return this._reducers.get(e)(n)}return[[e,n]]}getRelatedStyles(e){return this._consumables.get(e)||[]}setNormalizer(e,t){this._normalizers.set(e,t)}setExtractor(e,t){this._extractors.set(e,t)}setReducer(e,t){this._reducers.set(e,t)}setStyleRelation(e,t){this._mapStyleNames(e,t);for(const n of t)this._mapStyleNames(n,[e])}_mapStyleNames(e,t){this._consumables.has(e)||this._consumables.set(e,[]),this._consumables.get(e).push(...t)}}function No(e){return e.replace("-",".")}function Mo(e,t,n){let o=n;B(n)&&(o=Eo({},co(e,t),n)),Ro(e,t,o)}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Vo extends Nn{constructor(e,t,n,o){if(super(e),this.name=t,this._attrs=function(e){e=Fn(e);for(const[t,n]of e)null===n?e.delete(t):"string"!=typeof n&&e.set(t,String(n));return e}(n),this._children=[],o&&this._insertChild(0,o),this._classes=new Set,this._attrs.has("class")){const e=this._attrs.get("class");Do(this._classes,e),this._attrs.delete("class")}this._styles=new Io(this.document.stylesProcessor),this._attrs.has("style")&&(this._styles.setTo(this._attrs.get("style")),this._attrs.delete("style")),this._customProperties=new Map}get childCount(){return this._children.length}get isEmpty(){return 0===this._children.length}is(e,t=null){const n=e.replace(/^view:/,"");return t?"element"==n&&t==this.name:"element"==n||n==this.name||super.is(e)}getChild(e){return this._children[e]}getChildIndex(e){return this._children.indexOf(e)}getChildren(){return this._children[Symbol.iterator]()}*getAttributeKeys(){this._classes.size>0&&(yield"class"),this._styles.isEmpty||(yield"style"),yield*this._attrs.keys()}*getAttributes(){yield*this._attrs.entries(),this._classes.size>0&&(yield["class",this.getAttribute("class")]),this._styles.isEmpty||(yield["style",this.getAttribute("style")])}getAttribute(e){if("class"==e)return this._classes.size>0?[...this._classes].join(" "):void 0;if("style"==e){const e=this._styles.toString();return""==e?void 0:e}return this._attrs.get(e)}hasAttribute(e){return"class"==e?this._classes.size>0:"style"==e?!this._styles.isEmpty:this._attrs.has(e)}isSimilar(e){if(!(e instanceof Vo))return!1;if(this===e)return!0;if(this.name!=e.name)return!1;if(this._attrs.size!==e._attrs.size||this._classes.size!==e._classes.size||this._styles.size!==e._styles.size)return!1;for(const[t,n]of this._attrs)if(!e._attrs.has(t)||e._attrs.get(t)!==n)return!1;for(const t of this._classes)if(!e._classes.has(t))return!1;for(const t of this._styles.getStyleNames())if(!e._styles.has(t)||e._styles.getAsString(t)!==this._styles.getAsString(t))return!1;return!0}hasClass(...e){for(const t of e)if(!this._classes.has(t))return!1;return!0}getClassNames(){return this._classes.keys()}getStyle(e){return this._styles.getAsString(e)}getNormalizedStyle(e){return this._styles.getNormalized(e)}getStyleNames(){return this._styles.getStyleNames()}hasStyle(...e){for(const t of e)if(!this._styles.has(t))return!1;return!0}findAncestor(...e){const t=new Bn(...e);let n=this.parent;for(;n;){if(t.match(n))return n;n=n.parent}return null}getCustomProperty(e){return this._customProperties.get(e)}*getCustomProperties(){yield*this._customProperties.entries()}getIdentity(){const e=Array.from(this._classes).sort().join(","),t=this._styles.toString(),n=Array.from(this._attrs).map(e=>`${e[0]}="${e[1]}"`).sort().join(" ");return this.name+(""==e?"":` class="${e}"`)+(t?` style="${t}"`:"")+(""==n?"":` ${n}`)}_clone(e=!1){const t=[];if(e)for(const n of this.getChildren())t.push(n._clone(e));const n=new this.constructor(this.document,this.name,this._attrs,t);return n._classes=new Set(this._classes),n._styles.set(this._styles.getNormalized()),n._customProperties=new Map(this._customProperties),n.getFillerOffset=this.getFillerOffset,n}_appendChild(e){return this._insertChild(this.childCount,e)}_insertChild(e,t){this._fireChange("children",this);let n=0;const o=function(e,t){if("string"==typeof t)return[new Mn(e,t)];Dn(t)||(t=[t]);return Array.from(t).map(t=>"string"==typeof t?new Mn(e,t):t instanceof Vn?new Mn(e,t.data):t)}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/(this.document,t);for(const t of o)null!==t.parent&&t._remove(),t.parent=this,t.document=this.document,this._children.splice(e,0,t),e++,n++;return n}_removeChildren(e,t=1){this._fireChange("children",this);for(let n=e;n<e+t;n++)this._children[n].parent=null;return this._children.splice(e,t)}_setAttribute(e,t){t=String(t),this._fireChange("attributes",this),"class"==e?Do(this._classes,t):"style"==e?this._styles.setTo(t):this._attrs.set(e,t)}_removeAttribute(e){return this._fireChange("attributes",this),"class"==e?this._classes.size>0&&(this._classes.clear(),!0):"style"==e?!this._styles.isEmpty&&(this._styles.clear(),!0):this._attrs.delete(e)}_addClass(e){this._fireChange("attributes",this),(e=Array.isArray(e)?e:[e]).forEach(e=>this._classes.add(e))}_removeClass(e){this._fireChange("attributes",this),(e=Array.isArray(e)?e:[e]).forEach(e=>this._classes.delete(e))}_setStyle(e,t){this._fireChange("attributes",this),this._styles.set(e,t)}_removeStyle(e){this._fireChange("attributes",this),(e=Array.isArray(e)?e:[e]).forEach(e=>this._styles.remove(e))}_setCustomProperty(e,t){this._customProperties.set(e,t)}_removeCustomProperty(e){return this._customProperties.delete(e)}}function Do(e,t){const n=t.split(/\s+/);e.clear(),n.forEach(t=>e.add(t))}class Fo extends Vo{constructor(e,t,n,o){super(e,t,n,o),this.getFillerOffset=Bo}is(e,t=null){const n=e&&e.replace(/^view:/,"");return t?"containerElement"==n&&t==this.name||super.is(e,t):"containerElement"==n||super.is(e)}}function Bo(){const e=[...this.getChildren()],t=e[this.childCount-1];if(t&&t.is("element","br"))return this.childCount;for(const t of e)if(!t.is("uiElement"))return null;return this.childCount}var Lo=Po((function(e,t){Se(t,st(t),e)}));
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
const zo=Symbol("observableProperties"),qo=Symbol("boundObservables"),jo=Symbol("boundProperties"),Ho={set(e,t){if(B(e))return void Object.keys(e).forEach(t=>{this.set(t,e[t])},this);Uo(this);const n=this[zo];if(e in this&&!n.has(e))throw new fn.b("observable-set-cannot-override: Cannot override an existing property.",this);Object.defineProperty(this,e,{enumerable:!0,configurable:!0,get:()=>n.get(e),set(t){const o=n.get(e);let i=this.fire("set:"+e,e,t,o);void 0===i&&(i=t),o===i&&n.has(e)||(n.set(e,i),this.fire("change:"+e,e,i,o))}}),this[e]=t},bind(...e){if(!e.length||!Ko(e))throw new fn.b("observable-bind-wrong-properties: All properties must be strings.",this);if(new Set(e).size!==e.length)throw new fn.b("observable-bind-duplicate-properties: Properties must be unique.",this);Uo(this);const t=this[jo];e.forEach(e=>{if(t.has(e))throw new fn.b("observable-bind-rebind: Cannot bind the same property more than once.",this)});const n=new Map;return e.forEach(e=>{const o={property:e,to:[]};t.set(e,o),n.set(e,o)}),{to:$o,toMany:Go,_observable:this,_bindProperties:e,_to:[],_bindings:n}},unbind(...e){if(!(zo in this))return;const t=this[jo],n=this[qo];if(e.length){if(!Ko(e))throw new fn.b("observable-unbind-wrong-properties: Properties must be strings.",this);e.forEach(e=>{const o=t.get(e);if(!o)return;let i,r,s,a;o.to.forEach(e=>{i=e[0],r=e[1],s=n.get(i),a=s[r],a.delete(o),a.size||delete s[r],Object.keys(s).length||(n.delete(i),this.stopListening(i,"change"))}),t.delete(e)})}else n.forEach((e,t)=>{this.stopListening(t,"change")}),n.clear(),t.clear()},decorate(e){const t=this[e];if(!t)throw new fn.b("observablemixin-cannot-decorate-undefined: Cannot decorate an undefined method.",this,{object:this,methodName:e});this.on(e,(e,n)=>{e.return=t.apply(this,n)}),this[e]=function(...t){return this.fire(e,t)}}};Lo(Ho,gn);var Wo=Ho;function Uo(e){zo in e||(Object.defineProperty(e,zo,{value:new Map}),Object.defineProperty(e,qo,{value:new Map}),Object.defineProperty(e,jo,{value:new Map}))}function $o(...e){const t=function(...e){if(!e.length)throw new fn.b("observable-bind-to-parse-error: Invalid argument syntax in `to()`.",null);const t={to:[]};let n;"function"==typeof e[e.length-1]&&(t.callback=e.pop());return e.forEach(e=>{if("string"==typeof e)n.properties.push(e);else{if("object"!=typeof e)throw new fn.b("observable-bind-to-parse-error: Invalid argument syntax in `to()`.",null);n={observable:e,properties:[]},t.to.push(n)}}),t}(...e),n=Array.from(this._bindings.keys()),o=n.length;if(!t.callback&&t.to.length>1)throw new fn.b("observable-bind-to-no-callback: Binding multiple observables only possible with callback.",this);if(o>1&&t.callback)throw new fn.b("observable-bind-to-extra-callback: Cannot bind multiple properties and use a callback in one binding.",this);var i;
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/t.to.forEach(e=>{if(e.properties.length&&e.properties.length!==o)throw new fn.b("observable-bind-to-properties-length: The number of properties must match.",this);e.properties.length||(e.properties=this._bindProperties)}),this._to=t.to,t.callback&&(this._bindings.get(n[0]).callback=t.callback),i=this._observable,this._to.forEach(e=>{const t=i[qo];let n;t.get(e.observable)||i.listenTo(e.observable,"change",(o,r)=>{n=t.get(e.observable)[r],n&&n.forEach(e=>{Jo(i,e.property)})})}),function(e){let t;e._bindings.forEach((n,o)=>{e._to.forEach(i=>{t=i.properties[n.callback?0:e._bindProperties.indexOf(o)],n.to.push([i.observable,t]),function(e,t,n,o){const i=e[qo],r=i.get(n),s=r||{};s[o]||(s[o]=new Set);s[o].add(t),r||i.set(n,s)}(e._observable,n,i.observable,t)})})}(this),this._bindProperties.forEach(e=>{Jo(this._observable,e)})}function Go(e,t,n){if(this._bindings.size>1)throw new fn.b("observable-bind-to-many-not-one-binding: Cannot bind multiple properties with toMany().",this);this.to(...function(e,t){const n=e.map(e=>[e,t]);return Array.prototype.concat.apply([],n)}(e,t),n)}function Ko(e){return e.every(e=>"string"==typeof e)}function Jo(e,t){const n=e[jo].get(t);let o;n.callback?o=n.callback.apply(e,n.to.map(e=>e[0][e[1]])):(o=n.to[0],o=o[0][o[1]]),e.hasOwnProperty(t)?e[t]=o:e.set(t,o)}class Zo extends Fo{constructor(e,t,n,o){super(e,t,n,o),this.set("isReadOnly",!1),this.set("isFocused",!1),this.bind("isReadOnly").to(e),this.bind("isFocused").to(e,"isFocused",t=>t&&e.selection.editableElement==this),this.listenTo(e.selection,"change",()=>{this.isFocused=e.isFocused&&e.selection.editableElement==this})}is(e,t=null){const n=e&&e.replace(/^view:/,"");return t?"editableElement"==n&&t==this.name||super.is(e,t):"editableElement"==n||super.is(e)}destroy(){this.stopListening()}}xn(Zo,Wo);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
const Qo=Symbol("rootName");class Yo extends Zo{constructor(e,t){super(e,t),this.rootName="main"}is(e,t=null){const n=e.replace(/^view:/,"");return t?"rootElement"==n&&t==this.name||super.is(e,t):"rootElement"==n||super.is(e)}get rootName(){return this.getCustomProperty(Qo)}set rootName(e){this._setCustomProperty(Qo,e)}set _name(e){this.name=e}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Xo{constructor(e={}){if(!e.boundaries&&!e.startPosition)throw new fn.b("view-tree-walker-no-start-position: Neither boundaries nor starting position have been defined.",null);if(e.direction&&"forward"!=e.direction&&"backward"!=e.direction)throw new fn.b("view-tree-walker-unknown-direction: Only `backward` and `forward` direction allowed.",e.startPosition,{direction:e.direction});this.boundaries=e.boundaries||null,e.startPosition?this.position=ei._createAt(e.startPosition):this.position=ei._createAt(e.boundaries["backward"==e.direction?"end":"start"]),this.direction=e.direction||"forward",this.singleCharacters=!!e.singleCharacters,this.shallow=!!e.shallow,this.ignoreElementEnd=!!e.ignoreElementEnd,this._boundaryStartParent=this.boundaries?this.boundaries.start.parent:null,this._boundaryEndParent=this.boundaries?this.boundaries.end.parent:null}[Symbol.iterator](){return this}skip(e){let t,n,o;do{o=this.position,({done:t,value:n}=this.next())}while(!t&&e(n));t||(this.position=o)}next(){return"forward"==this.direction?this._next():this._previous()}_next(){let e=this.position.clone();const t=this.position,n=e.parent;if(null===n.parent&&e.offset===n.childCount)return{done:!0};if(n===this._boundaryEndParent&&e.offset==this.boundaries.end.offset)return{done:!0};let o;if(n instanceof Mn){if(e.isAtEnd)return this.position=ei._createAfter(n),this._next();o=n.data[e.offset]}else o=n.getChild(e.offset);if(o instanceof Vo)return this.shallow?e.offset++:e=new ei(o,0),this.position=e,this._formatReturnValue("elementStart",o,t,e,1);if(o instanceof Mn){if(this.singleCharacters)return e=new ei(o,0),this.position=e,this._next();{let n,i=o.data.length;return o==this._boundaryEndParent?(i=this.boundaries.end.offset,n=new Vn(o,0,i),e=ei._createAfter(n)):(n=new Vn(o,0,o.data.length),e.offset++),this.position=e,this._formatReturnValue("text",n,t,e,i)}}if("string"==typeof o){let o;if(this.singleCharacters)o=1;else{o=(n===this._boundaryEndParent?this.boundaries.end.offset:n.data.length)-e.offset}const i=new Vn(n,e.offset,o);return e.offset+=o,this.position=e,this._formatReturnValue("text",i,t,e,o)}return e=ei._createAfter(n),this.position=e,this.ignoreElementEnd?this._next():this._formatReturnValue("elementEnd",n,t,e)}_previous(){let e=this.position.clone();const t=this.position,n=e.parent;if(null===n.parent&&0===e.offset)return{done:!0};if(n==this._boundaryStartParent&&e.offset==this.boundaries.start.offset)return{done:!0};let o;if(n instanceof Mn){if(e.isAtStart)return this.position=ei._createBefore(n),this._previous();o=n.data[e.offset-1]}else o=n.getChild(e.offset-1);if(o instanceof Vo)return this.shallow?(e.offset--,this.position=e,this._formatReturnValue("elementStart",o,t,e,1)):(e=new ei(o,o.childCount),this.position=e,this.ignoreElementEnd?this._previous():this._formatReturnValue("elementEnd",o,t,e));if(o instanceof Mn){if(this.singleCharacters)return e=new ei(o,o.data.length),this.position=e,this._previous();{let n,i=o.data.length;if(o==this._boundaryStartParent){const t=this.boundaries.start.offset;n=new Vn(o,t,o.data.length-t),i=n.data.length,e=ei._createBefore(n)}else n=new Vn(o,0,o.data.length),e.offset--;return this.position=e,this._formatReturnValue("text",n,t,e,i)}}if("string"==typeof o){let o;if(this.singleCharacters)o=1;else{const t=n===this._boundaryStartParent?this.boundaries.start.offset:0;o=e.offset-t}e.offset-=o;const i=new Vn(n,e.offset,o);return this.position=e,this._formatReturnValue("text",i,t,e,o)}return e=ei._createBefore(n),this.position=e,this._formatReturnValue("elementStart",n,t,e,1)}_formatReturnValue(e,t,n,o,i){return t instanceof Vn&&(t.offsetInText+t.data.length==t.textNode.data.length&&("forward"!=this.direction||this.boundaries&&this.boundaries.end.isEqual(this.position)?n=ei._createAfter(t.textNode):(o=ei._createAfter(t.textNode),this.position=o)),0===t.offsetInText&&("backward"!=this.direction||this.boundaries&&this.boundaries.start.isEqual(this.position)?n=ei._createBefore(t.textNode):(o=ei._createBefore(t.textNode),this.position=o))),{done:!1,value:{type:e,item:t,previousPosition:n,nextPosition:o,length:i}}}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class ei{constructor(e,t){this.parent=e,this.offset=t}get nodeAfter(){return this.parent.is("text")?null:this.parent.getChild(this.offset)||null}get nodeBefore(){return this.parent.is("text")?null:this.parent.getChild(this.offset-1)||null}get isAtStart(){return 0===this.offset}get isAtEnd(){const e=this.parent.is("text")?this.parent.data.length:this.parent.childCount;return this.offset===e}get root(){return this.parent.root}get editableElement(){let e=this.parent;for(;!(e instanceof Zo);){if(!e.parent)return null;e=e.parent}return e}getShiftedBy(e){const t=ei._createAt(this),n=t.offset+e;return t.offset=n<0?0:n,t}getLastMatchingPosition(e,t={}){t.startPosition=this;const n=new Xo(t);return n.skip(e),n.position}getAncestors(){return this.parent.is("documentFragment")?[this.parent]:this.parent.getAncestors({includeSelf:!0})}getCommonAncestor(e){const t=this.getAncestors(),n=e.getAncestors();let o=0;for(;t[o]==n[o]&&t[o];)o++;return 0===o?null:t[o-1]}is(e){return"position"==e||"view:position"==e}isEqual(e){return this.parent==e.parent&&this.offset==e.offset}isBefore(e){return"before"==this.compareWith(e)}isAfter(e){return"after"==this.compareWith(e)}compareWith(e){if(this.root!==e.root)return"different";if(this.isEqual(e))return"same";const t=this.parent.is("node")?this.parent.getPath():[],n=e.parent.is("node")?e.parent.getPath():[];t.push(this.offset),n.push(e.offset);const o=In(t,n);switch(o){case"prefix":return"before";case"extension":return"after";default:return t[o]<n[o]?"before":"after"}}getWalker(e={}){return e.startPosition=this,new Xo(e)}clone(){return new ei(this.parent,this.offset)}static _createAt(e,t){if(e instanceof ei)return new this(e.parent,e.offset);{const n=e;if("end"==t)t=n.is("text")?n.data.length:n.childCount;else{if("before"==t)return this._createBefore(n);if("after"==t)return this._createAfter(n);if(0!==t&&!t)throw new fn.b("view-createPositionAt-offset-required: View#createPositionAt() requires the offset when the first parameter is a view item.",n)}return new ei(n,t)}}static _createAfter(e){if(e.is("textProxy"))return new ei(e.textNode,e.offsetInText+e.data.length);if(!e.parent)throw new fn.b("view-position-after-root: You can not make position after root.",e,{root:e});return new ei(e.parent,e.index+1)}static _createBefore(e){if(e.is("textProxy"))return new ei(e.textNode,e.offsetInText);if(!e.parent)throw new fn.b("view-position-before-root: You can not make position before root.",e,{root:e});return new ei(e.parent,e.index)}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class ti{constructor(e,t=null){this.start=e.clone(),this.end=t?t.clone():e.clone()}*[Symbol.iterator](){yield*new Xo({boundaries:this,ignoreElementEnd:!0})}get isCollapsed(){return this.start.isEqual(this.end)}get isFlat(){return this.start.parent===this.end.parent}get root(){return this.start.root}getEnlarged(){let e=this.start.getLastMatchingPosition(ni,{direction:"backward"}),t=this.end.getLastMatchingPosition(ni);return e.parent.is("text")&&e.isAtStart&&(e=ei._createBefore(e.parent)),t.parent.is("text")&&t.isAtEnd&&(t=ei._createAfter(t.parent)),new ti(e,t)}getTrimmed(){let e=this.start.getLastMatchingPosition(ni);if(e.isAfter(this.end)||e.isEqual(this.end))return new ti(e,e);let t=this.end.getLastMatchingPosition(ni,{direction:"backward"});const n=e.nodeAfter,o=t.nodeBefore;return n&&n.is("text")&&(e=new ei(n,0)),o&&o.is("text")&&(t=new ei(o,o.data.length)),new ti(e,t)}isEqual(e){return this==e||this.start.isEqual(e.start)&&this.end.isEqual(e.end)}containsPosition(e){return e.isAfter(this.start)&&e.isBefore(this.end)}containsRange(e,t=!1){e.isCollapsed&&(t=!1);const n=this.containsPosition(e.start)||t&&this.start.isEqual(e.start),o=this.containsPosition(e.end)||t&&this.end.isEqual(e.end);return n&&o}getDifference(e){const t=[];return this.isIntersecting(e)?(this.containsPosition(e.start)&&t.push(new ti(this.start,e.start)),this.containsPosition(e.end)&&t.push(new ti(e.end,this.end))):t.push(this.clone()),t}getIntersection(e){if(this.isIntersecting(e)){let t=this.start,n=this.end;return this.containsPosition(e.start)&&(t=e.start),this.containsPosition(e.end)&&(n=e.end),new ti(t,n)}return null}getWalker(e={}){return e.boundaries=this,new Xo(e)}getCommonAncestor(){return this.start.getCommonAncestor(this.end)}getContainedElement(){if(this.isCollapsed)return null;let e=this.start.nodeAfter,t=this.end.nodeBefore;return this.start.parent.is("text")&&this.start.isAtEnd&&this.start.parent.nextSibling&&(e=this.start.parent.nextSibling),this.end.parent.is("text")&&this.end.isAtStart&&this.end.parent.previousSibling&&(t=this.end.parent.previousSibling),e&&e.is("element")&&e===t?e:null}clone(){return new ti(this.start,this.end)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const t=new Xo(e);for(const e of t)yield e.item}*getPositions(e={}){e.boundaries=this;const t=new Xo(e);yield t.position;for(const e of t)yield e.nextPosition}is(e){return"range"==e||"view:range"==e}isIntersecting(e){return this.start.isBefore(e.end)&&this.end.isAfter(e.start)}static _createFromParentsAndOffsets(e,t,n,o){return new this(new ei(e,t),new ei(n,o))}static _createFromPositionAndShift(e,t){const n=e,o=e.getShiftedBy(t);return t>0?new this(n,o):new this(o,n)}static _createIn(e){return this._createFromParentsAndOffsets(e,0,e,e.childCount)}static _createOn(e){const t=e.is("textProxy")?e.offsetSize:1;return this._createFromPositionAndShift(ei._createBefore(e),t)}}function ni(e){return!(!e.item.is("attributeElement")&&!e.item.is("uiElement"))}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function oi(e){let t=0;for(const n of e)t++;return t}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class ii{constructor(e=null,t,n){this._ranges=[],this._lastRangeBackward=!1,this._isFake=!1,this._fakeSelectionLabel="",this.setTo(e,t,n)}get isFake(){return this._isFake}get fakeSelectionLabel(){return this._fakeSelectionLabel}get anchor(){if(!this._ranges.length)return null;const e=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?e.end:e.start).clone()}get focus(){if(!this._ranges.length)return null;const e=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?e.start:e.end).clone()}get isCollapsed(){return 1===this.rangeCount&&this._ranges[0].isCollapsed}get rangeCount(){return this._ranges.length}get isBackward(){return!this.isCollapsed&&this._lastRangeBackward}get editableElement(){return this.anchor?this.anchor.editableElement:null}*getRanges(){for(const e of this._ranges)yield e.clone()}getFirstRange(){let e=null;for(const t of this._ranges)e&&!t.start.isBefore(e.start)||(e=t);return e?e.clone():null}getLastRange(){let e=null;for(const t of this._ranges)e&&!t.end.isAfter(e.end)||(e=t);return e?e.clone():null}getFirstPosition(){const e=this.getFirstRange();return e?e.start.clone():null}getLastPosition(){const e=this.getLastRange();return e?e.end.clone():null}isEqual(e){if(this.isFake!=e.isFake)return!1;if(this.isFake&&this.fakeSelectionLabel!=e.fakeSelectionLabel)return!1;if(this.rangeCount!=e.rangeCount)return!1;if(0===this.rangeCount)return!0;if(!this.anchor.isEqual(e.anchor)||!this.focus.isEqual(e.focus))return!1;for(const t of this._ranges){let n=!1;for(const o of e._ranges)if(t.isEqual(o)){n=!0;break}if(!n)return!1}return!0}isSimilar(e){if(this.isBackward!=e.isBackward)return!1;const t=oi(this.getRanges());if(t!=oi(e.getRanges()))return!1;if(0==t)return!0;for(let t of this.getRanges()){t=t.getTrimmed();let n=!1;for(let o of e.getRanges())if(o=o.getTrimmed(),t.start.isEqual(o.start)&&t.end.isEqual(o.end)){n=!0;break}if(!n)return!1}return!0}getSelectedElement(){return 1!==this.rangeCount?null:this.getFirstRange().getContainedElement()}setTo(e,t,n){if(null===e)this._setRanges([]),this._setFakeOptions(t);else if(e instanceof ii||e instanceof ri)this._setRanges(e.getRanges(),e.isBackward),this._setFakeOptions({fake:e.isFake,label:e.fakeSelectionLabel});else if(e instanceof ti)this._setRanges([e],t&&t.backward),this._setFakeOptions(t);else if(e instanceof ei)this._setRanges([new ti(e)]),this._setFakeOptions(t);else if(e instanceof Nn){const o=!!n&&!!n.backward;let i;if(void 0===t)throw new fn.b("view-selection-setTo-required-second-parameter: selection.setTo requires the second parameter when the first parameter is a node.",this);i="in"==t?ti._createIn(e):"on"==t?ti._createOn(e):new ti(ei._createAt(e,t)),this._setRanges([i],o),this._setFakeOptions(n)}else{if(!Dn(e))throw new fn.b("view-selection-setTo-not-selectable: Cannot set selection to given place.",this);this._setRanges(e,t&&t.backward),this._setFakeOptions(t)}this.fire("change")}setFocus(e,t){if(null===this.anchor)throw new fn.b("view-selection-setFocus-no-ranges: Cannot set selection focus if there are no ranges in selection.",this);const n=ei._createAt(e,t);if("same"==n.compareWith(this.focus))return;const o=this.anchor;this._ranges.pop(),"before"==n.compareWith(o)?this._addRange(new ti(n,o),!0):this._addRange(new ti(o,n)),this.fire("change")}is(e){return"selection"==e||"view:selection"==e}_setRanges(e,t=!1){e=Array.from(e),this._ranges=[];for(const t of e)this._addRange(t);this._lastRangeBackward=!!t}_setFakeOptions(e={}){this._isFake=!!e.fake,this._fakeSelectionLabel=e.fake&&e.label||""}_addRange(e,t=!1){if(!(e instanceof ti))throw new fn.b("view-selection-add-range-not-range: Selection range set to an object that is not an instance of view.Range",this);this._pushRange(e),this._lastRangeBackward=!!t}_pushRange(e){for(const t of this._ranges)if(e.isIntersecting(t))throw new fn.b("view-selection-range-intersects: Trying to add a range that intersects with another range from selection.",this,{addedRange:e,intersectingRange:t});this._ranges.push(new ti(e.start,e.end))}}xn(ii,gn);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
class ri{constructor(e=null,t,n){this._selection=new ii,this._selection.delegate("change").to(this),this._selection.setTo(e,t,n)}get isFake(){return this._selection.isFake}get fakeSelectionLabel(){return this._selection.fakeSelectionLabel}get anchor(){return this._selection.anchor}get focus(){return this._selection.focus}get isCollapsed(){return this._selection.isCollapsed}get rangeCount(){return this._selection.rangeCount}get isBackward(){return this._selection.isBackward}get editableElement(){return this._selection.editableElement}get _ranges(){return this._selection._ranges}*getRanges(){yield*this._selection.getRanges()}getFirstRange(){return this._selection.getFirstRange()}getLastRange(){return this._selection.getLastRange()}getFirstPosition(){return this._selection.getFirstPosition()}getLastPosition(){return this._selection.getLastPosition()}getSelectedElement(){return this._selection.getSelectedElement()}isEqual(e){return this._selection.isEqual(e)}isSimilar(e){return this._selection.isSimilar(e)}is(e){return"selection"==e||"documentSelection"==e||"view:selection"==e||"view:documentSelection"==e}_setTo(e,t,n){this._selection.setTo(e,t,n)}_setFocus(e,t){this._selection.setFocus(e,t)}}xn(ri,gn);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
class si{constructor(e){this.selection=new ri,this.roots=new Cn({idProperty:"rootName"}),this.stylesProcessor=e,this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("isComposing",!1),this._postFixers=new Set}getRoot(e="main"){return this.roots.get(e)}registerPostFixer(e){this._postFixers.add(e)}destroy(){this.roots.map(e=>e.destroy()),this.stopListening()}_callPostFixers(e){let t=!1;do{for(const n of this._postFixers)if(t=n(e),t)break}while(t)}}xn(si,Wo);class ai extends Vo{constructor(e,t,n,o){super(e,t,n,o),this.getFillerOffset=ci,this._priority=10,this._id=null,this._clonesGroup=null}get priority(){return this._priority}get id(){return this._id}getElementsWithSameId(){if(null===this.id)throw new fn.b("attribute-element-get-elements-with-same-id-no-id: Cannot get elements with the same id for an attribute element without id.",this);return new Set(this._clonesGroup)}is(e,t=null){const n=e&&e.replace(/^view:/,"");return t?"attributeElement"==n&&t==this.name||super.is(e,t):"attributeElement"==n||super.is(e)}isSimilar(e){return null!==this.id||null!==e.id?this.id===e.id:super.isSimilar(e)&&this.priority==e.priority}_clone(e){const t=super._clone(e);return t._priority=this._priority,t._id=this._id,t}}function ci(){if(li(this))return null;let e=this.parent;for(;e&&e.is("attributeElement");){if(li(e)>1)return null;e=e.parent}return!e||li(e)>1?null:this.childCount}function li(e){return Array.from(e.getChildren()).filter(e=>!e.is("uiElement")).length}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/ai.DEFAULT_PRIORITY=10;class di extends Vo{constructor(e,t,n,o){super(e,t,n,o),this.getFillerOffset=ui}is(e,t=null){const n=e.replace(/^view:/,"");return t?"emptyElement"==n&&t==this.name||super.is(e,t):"emptyElement"==n||super.is(e)}_insertChild(e,t){if(t&&(t instanceof Nn||Array.from(t).length>0))throw new fn.b("view-emptyelement-cannot-add: Cannot add child nodes to EmptyElement instance.",[this,t])}}function ui(){return null}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/const hi=navigator.userAgent.toLowerCase();var fi={isMac:function(e){return e.indexOf("macintosh")>-1}(hi),isEdge:function(e){return!!e.match(/edge\/(\d+.?\d*)/)}(hi),isGecko:function(e){return!!e.match(/gecko\/\d+/)}(hi),isSafari:function(e){return e.indexOf(" applewebkit/")>-1&&-1===e.indexOf("chrome")}(hi),isAndroid:function(e){return e.indexOf("android")>-1}(hi),features:{isRegExpUnicodePropertySupported:function(){let e=!1;try{e=0==="ć".search(new RegExp("[\\p{L}]","u"))}catch(e){}return e}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/()}};const pi={"⌘":"ctrl","⇧":"shift","⌥":"alt"},mi={ctrl:"⌘",shift:"⇧",alt:"⌥"},gi=function(){const e={arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,backspace:8,delete:46,enter:13,space:32,esc:27,tab:9,ctrl:1114112,cmd:1114112,shift:2228224,alt:4456448};for(let t=65;t<=90;t++){const n=String.fromCharCode(t);e[n.toLowerCase()]=t}for(let t=48;t<=57;t++)e[t-48]=t;for(let t=112;t<=123;t++)e["f"+(t-111)]=t;return e}();function bi(e){let t;if("string"==typeof e){if(t=gi[e.toLowerCase()],!t)throw new fn.b("keyboard-unknown-key: Unknown key name.",null,{key:e})}else t=e.keyCode+(e.altKey?gi.alt:0)+(e.ctrlKey?gi.ctrl:0)+(e.shiftKey?gi.shift:0);return t}function wi(e){return"string"==typeof e&&(e=_i(e)),e.map(e=>"string"==typeof e?bi(e):e).reduce((e,t)=>t+e,0)}function ki(e){return fi.isMac?_i(e).map(e=>mi[e.toLowerCase()]||e).reduce((e,t)=>e.slice(-1)in pi?e+t:e+"+"+t):e}function _i(e){return e.split(/\s*\+\s*/)}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class vi extends Vo{constructor(e,t,n,o){super(e,t,n,o),this.getFillerOffset=xi}is(e,t=null){const n=e.replace(/^view:/,"");return t?"uiElement"==n&&t==this.name||super.is(e,t):"uiElement"==n||super.is(e)}_insertChild(e,t){if(t&&(t instanceof Nn||Array.from(t).length>0))throw new fn.b("view-uielement-cannot-add: Cannot add child nodes to UIElement instance.",this)}render(e){return this.toDomElement(e)}toDomElement(e){const t=e.createElement(this.name);for(const e of this.getAttributeKeys())t.setAttribute(e,this.getAttribute(e));return t}}function yi(e){e.document.on("keydown",(t,n)=>function(e,t,n){if(t.keyCode==gi.arrowright){const e=t.domTarget.ownerDocument.defaultView.getSelection(),o=1==e.rangeCount&&e.getRangeAt(0).collapsed;if(o||t.shiftKey){const t=e.focusNode,i=e.focusOffset,r=n.domPositionToView(t,i);if(null===r)return;let s=!1;const a=r.getLastMatchingPosition(e=>(e.item.is("uiElement")&&(s=!0),!(!e.item.is("uiElement")&&!e.item.is("attributeElement"))));if(s){const t=n.viewPositionToDom(a);o?e.collapse(t.parent,t.offset):e.extend(t.parent,t.offset)}}}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/(0,n,e.domConverter))}function xi(){return null}class Ci{constructor(e,t){this.document=e,this._children=[],t&&this._insertChild(0,t)}[Symbol.iterator](){return this._children[Symbol.iterator]()}get childCount(){return this._children.length}get isEmpty(){return 0===this.childCount}get root(){return this}get parent(){return null}is(e){return"documentFragment"==e||"view:documentFragment"==e}_appendChild(e){return this._insertChild(this.childCount,e)}getChild(e){return this._children[e]}getChildIndex(e){return this._children.indexOf(e)}getChildren(){return this._children[Symbol.iterator]()}_insertChild(e,t){this._fireChange("children",this);let n=0;const o=function(e,t){if("string"==typeof t)return[new Mn(e,t)];Dn(t)||(t=[t]);return Array.from(t).map(t=>"string"==typeof t?new Mn(e,t):t instanceof Vn?new Mn(e,t.data):t)}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/(this.document,t);for(const t of o)null!==t.parent&&t._remove(),t.parent=this,this._children.splice(e,0,t),e++,n++;return n}_removeChildren(e,t=1){this._fireChange("children",this);for(let n=e;n<e+t;n++)this._children[n].parent=null;return this._children.splice(e,t)}_fireChange(e,t){this.fire("change:"+e,t)}}xn(Ci,gn);class Ai{constructor(e){this.document=e,this._cloneGroups=new Map}setSelection(e,t,n){this.document.selection._setTo(e,t,n)}setSelectionFocus(e,t){this.document.selection._setFocus(e,t)}createText(e){return new Mn(this.document,e)}createAttributeElement(e,t,n={}){const o=new ai(this.document,e,t);return n.priority&&(o._priority=n.priority),n.id&&(o._id=n.id),o}createContainerElement(e,t){return new Fo(this.document,e,t)}createEditableElement(e,t){const n=new Zo(this.document,e,t);return n._document=this.document,n}createEmptyElement(e,t){return new di(this.document,e,t)}createUIElement(e,t,n){const o=new vi(this.document,e,t);return n&&(o.render=n),o}setAttribute(e,t,n){n._setAttribute(e,t)}removeAttribute(e,t){t._removeAttribute(e)}addClass(e,t){t._addClass(e)}removeClass(e,t){t._removeClass(e)}setStyle(e,t,n){x(e)&&void 0===n&&(n=t),n._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,n){n._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}breakAttributes(e){return e instanceof ei?this._breakAttributes(e):this._breakAttributesRange(e)}breakContainer(e){const t=e.parent;if(!t.is("containerElement"))throw new fn.b("view-writer-break-non-container-element: Trying to break an element which is not a container element.",this.document);if(!t.parent)throw new fn.b("view-writer-break-root: Trying to break root element.",this.document);if(e.isAtStart)return ei._createBefore(t);if(!e.isAtEnd){const n=t._clone(!1);this.insert(ei._createAfter(t),n);const o=new ti(e,ei._createAt(t,"end")),i=new ei(n,0);this.move(o,i)}return ei._createAfter(t)}mergeAttributes(e){const t=e.offset,n=e.parent;if(n.is("text"))return e;if(n.is("attributeElement")&&0===n.childCount){const e=n.parent,t=n.index;return n._remove(),this._removeFromClonedElementsGroup(n),this.mergeAttributes(new ei(e,t))}const o=n.getChild(t-1),i=n.getChild(t);if(!o||!i)return e;if(o.is("text")&&i.is("text"))return Ri(o,i);if(o.is("attributeElement")&&i.is("attributeElement")&&o.isSimilar(i)){const e=o.childCount;return o._appendChild(i.getChildren()),i._remove(),this._removeFromClonedElementsGroup(i),this.mergeAttributes(new ei(o,e))}return e}mergeContainers(e){const t=e.nodeBefore,n=e.nodeAfter;if(!(t&&n&&t.is("containerElement")&&n.is("containerElement")))throw new fn.b("view-writer-merge-containers-invalid-position: Element before and after given position cannot be merged.",this.document);const o=t.getChild(t.childCount-1),i=o instanceof Mn?ei._createAt(o,"end"):ei._createAt(t,"end");return this.move(ti._createIn(n),ei._createAt(t,"end")),this.remove(ti._createOn(n)),i}insert(e,t){(function e(t,n){for(const o of t){if(!Ii.some(e=>o instanceof e))throw new fn.b("view-writer-insert-invalid-node",n);o.is("text")||e(o.getChildren(),n)}})(t=Dn(t)?[...t]:[t],this.document);const n=Ti(e);if(!n)throw new fn.b("view-writer-invalid-position-container",this.document);const o=this._breakAttributes(e,!0),i=n._insertChild(o.offset,t);for(const e of t)this._addToClonedElementsGroup(e);const r=o.getShiftedBy(i),s=this.mergeAttributes(o);if(0===i)return new ti(s,s);{s.isEqual(o)||r.offset--;const e=this.mergeAttributes(r);return new ti(s,e)}}remove(e){const t=e instanceof ti?e:ti._createOn(e);if(Ni(t,this.document),t.isCollapsed)return new Ci(this.document);const{start:n,end:o}=this._breakAttributesRange(t,!0),i=n.parent,r=o.offset-n.offset,s=i._removeChildren(n.offset,r);for(const e of s)this._removeFromClonedElementsGroup(e);const a=this.mergeAttributes(n);return t.start=a,t.end=a.clone(),new Ci(this.document,s)}clear(e,t){Ni(e,this.document);const n=e.getWalker({direction:"backward",ignoreElementEnd:!0});for(const o of n){const n=o.item;let i;if(n.is("element")&&t.isSimilar(n))i=ti._createOn(n);else if(!o.nextPosition.isAfter(e.start)&&n.is("textProxy")){const e=n.getAncestors().find(e=>e.is("element")&&t.isSimilar(e));e&&(i=ti._createIn(e))}i&&(i.end.isAfter(e.end)&&(i.end=e.end),i.start.isBefore(e.start)&&(i.start=e.start),this.remove(i))}}move(e,t){let n;if(t.isAfter(e.end)){const o=(t=this._breakAttributes(t,!0)).parent,i=o.childCount;e=this._breakAttributesRange(e,!0),n=this.remove(e),t.offset+=o.childCount-i}else n=this.remove(e);return this.insert(t,n)}wrap(e,t){if(!(t instanceof ai))throw new fn.b("view-writer-wrap-invalid-attribute",this.document);if(Ni(e,this.document),e.isCollapsed){let o=e.start;o.parent.is("element")&&(n=o.parent,!Array.from(n.getChildren()).some(e=>!e.is("uiElement")))&&(o=o.getLastMatchingPosition(e=>e.item.is("uiElement"))),o=this._wrapPosition(o,t);const i=this.document.selection;return i.isCollapsed&&i.getFirstPosition().isEqual(e.start)&&this.setSelection(o),new ti(o)}return this._wrapRange(e,t);var n}unwrap(e,t){if(!(t instanceof ai))throw new fn.b("view-writer-unwrap-invalid-attribute",this.document);if(Ni(e,this.document),e.isCollapsed)return e;const{start:n,end:o}=this._breakAttributesRange(e,!0),i=n.parent,r=this._unwrapChildren(i,n.offset,o.offset,t),s=this.mergeAttributes(r.start);s.isEqual(r.start)||r.end.offset--;const a=this.mergeAttributes(r.end);return new ti(s,a)}rename(e,t){const n=new Fo(this.document,e,t.getAttributes());return this.insert(ei._createAfter(t),n),this.move(ti._createIn(t),ei._createAt(n,0)),this.remove(ti._createOn(t)),n}clearClonedElementsGroup(e){this._cloneGroups.delete(e)}createPositionAt(e,t){return ei._createAt(e,t)}createPositionAfter(e){return ei._createAfter(e)}createPositionBefore(e){return ei._createBefore(e)}createRange(e,t){return new ti(e,t)}createRangeOn(e){return ti._createOn(e)}createRangeIn(e){return ti._createIn(e)}createSelection(e,t,n){return new ii(e,t,n)}_wrapChildren(e,t,n,o){let i=t;const r=[];for(;i<n;){const t=e.getChild(i),n=t.is("text"),s=t.is("attributeElement"),a=t.is("emptyElement"),c=t.is("uiElement");if(s&&this._wrapAttributeElement(o,t))r.push(new ei(e,i));else if(n||a||c||s&&Pi(o,t)){const n=o._clone();t._remove(),n._appendChild(t),e._insertChild(i,n),this._addToClonedElementsGroup(n),r.push(new ei(e,i))}else s&&this._wrapChildren(t,0,t.childCount,o);i++}let s=0;for(const e of r){if(e.offset-=s,e.offset==t)continue;this.mergeAttributes(e).isEqual(e)||(s++,n--)}return ti._createFromParentsAndOffsets(e,t,e,n)}_unwrapChildren(e,t,n,o){let i=t;const r=[];for(;i<n;){const t=e.getChild(i);if(t.is("attributeElement"))if(t.isSimilar(o)){const o=t.getChildren(),s=t.childCount;t._remove(),e._insertChild(i,o),this._removeFromClonedElementsGroup(t),r.push(new ei(e,i),new ei(e,i+s)),i+=s,n+=s-1}else this._unwrapAttributeElement(o,t)?(r.push(new ei(e,i),new ei(e,i+1)),i++):(this._unwrapChildren(t,0,t.childCount,o),i++);else i++}let s=0;for(const e of r){if(e.offset-=s,e.offset==t||e.offset==n)continue;this.mergeAttributes(e).isEqual(e)||(s++,n--)}return ti._createFromParentsAndOffsets(e,t,e,n)}_wrapRange(e,t){const{start:n,end:o}=this._breakAttributesRange(e,!0),i=n.parent,r=this._wrapChildren(i,n.offset,o.offset,t),s=this.mergeAttributes(r.start);s.isEqual(r.start)||r.end.offset--;const a=this.mergeAttributes(r.end);return new ti(s,a)}_wrapPosition(e,t){if(t.isSimilar(e.parent))return Ei(e.clone());e.parent.is("text")&&(e=Si(e));const n=this.createAttributeElement();n._priority=Number.POSITIVE_INFINITY,n.isSimilar=()=>!1,e.parent._insertChild(e.offset,n);const o=new ti(e,e.getShiftedBy(1));this.wrap(o,t);const i=new ei(n.parent,n.index);n._remove();const r=i.nodeBefore,s=i.nodeAfter;return r instanceof Mn&&s instanceof Mn?Ri(r,s):Ei(i)}_wrapAttributeElement(e,t){if(!Mi(e,t))return!1;if(e.name!==t.name||e.priority!==t.priority)return!1;for(const n of e.getAttributeKeys())if("class"!==n&&"style"!==n&&t.hasAttribute(n)&&t.getAttribute(n)!==e.getAttribute(n))return!1;for(const n of e.getStyleNames())if(t.hasStyle(n)&&t.getStyle(n)!==e.getStyle(n))return!1;for(const n of e.getAttributeKeys())"class"!==n&&"style"!==n&&(t.hasAttribute(n)||this.setAttribute(n,e.getAttribute(n),t));for(const n of e.getStyleNames())t.hasStyle(n)||this.setStyle(n,e.getStyle(n),t);for(const n of e.getClassNames())t.hasClass(n)||this.addClass(n,t);return!0}_unwrapAttributeElement(e,t){if(!Mi(e,t))return!1;if(e.name!==t.name||e.priority!==t.priority)return!1;for(const n of e.getAttributeKeys())if("class"!==n&&"style"!==n&&(!t.hasAttribute(n)||t.getAttribute(n)!==e.getAttribute(n)))return!1;if(!t.hasClass(...e.getClassNames()))return!1;for(const n of e.getStyleNames())if(!t.hasStyle(n)||t.getStyle(n)!==e.getStyle(n))return!1;for(const n of e.getAttributeKeys())"class"!==n&&"style"!==n&&this.removeAttribute(n,t);return this.removeClass(Array.from(e.getClassNames()),t),this.removeStyle(Array.from(e.getStyleNames()),t),!0}_breakAttributesRange(e,t=!1){const n=e.start,o=e.end;if(Ni(e,this.document),e.isCollapsed){const n=this._breakAttributes(e.start,t);return new ti(n,n)}const i=this._breakAttributes(o,t),r=i.parent.childCount,s=this._breakAttributes(n,t);return i.offset+=i.parent.childCount-r,new ti(s,i)}_breakAttributes(e,t=!1){const n=e.offset,o=e.parent;if(e.parent.is("emptyElement"))throw new fn.b("view-writer-cannot-break-empty-element",this.document);if(e.parent.is("uiElement"))throw new fn.b("view-writer-cannot-break-ui-element",this.document);if(!t&&o.is("text")&&Oi(o.parent))return e.clone();if(Oi(o))return e.clone();if(o.is("text"))return this._breakAttributes(Si(e),t);if(n==o.childCount){const e=new ei(o.parent,o.index+1);return this._breakAttributes(e,t)}if(0===n){const e=new ei(o.parent,o.index);return this._breakAttributes(e,t)}{const e=o.index+1,i=o._clone();o.parent._insertChild(e,i),this._addToClonedElementsGroup(i);const r=o.childCount-n,s=o._removeChildren(n,r);i._appendChild(s);const a=new ei(o.parent,e);return this._breakAttributes(a,t)}}_addToClonedElementsGroup(e){if(!e.root.is("rootElement"))return;if(e.is("element"))for(const t of e.getChildren())this._addToClonedElementsGroup(t);const t=e.id;if(!t)return;let n=this._cloneGroups.get(t);n||(n=new Set,this._cloneGroups.set(t,n)),n.add(e),e._clonesGroup=n}_removeFromClonedElementsGroup(e){if(e.is("element"))for(const t of e.getChildren())this._removeFromClonedElementsGroup(t);const t=e.id;if(!t)return;const n=this._cloneGroups.get(t);n&&n.delete(e)}}function Ti(e){let t=e.parent;for(;!Oi(t);){if(!t)return;t=t.parent}return t}function Pi(e,t){return e.priority<t.priority||!(e.priority>t.priority)&&e.getIdentity()<t.getIdentity()}function Ei(e){const t=e.nodeBefore;if(t&&t.is("text"))return new ei(t,t.data.length);const n=e.nodeAfter;return n&&n.is("text")?new ei(n,0):e}function Si(e){if(e.offset==e.parent.data.length)return new ei(e.parent.parent,e.parent.index+1);if(0===e.offset)return new ei(e.parent.parent,e.parent.index);const t=e.parent.data.slice(e.offset);return e.parent._data=e.parent.data.slice(0,e.offset),e.parent.parent._insertChild(e.parent.index+1,new Mn(e.root.document,t)),new ei(e.parent.parent,e.parent.index+1)}function Ri(e,t){const n=e.data.length;return e._data+=t.data,t._remove(),new ei(e,n)}const Ii=[Mn,ai,Fo,di,vi];function Oi(e){return e&&(e.is("containerElement")||e.is("documentFragment"))}function Ni(e,t){const n=Ti(e.start),o=Ti(e.end);if(!n||!o||n!==o)throw new fn.b("view-writer-invalid-range-container",t)}function Mi(e,t){return null===e.id&&null===t.id}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function Vi(e){return"[object Text]"==Object.prototype.toString.call(e)}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/const Di=e=>e.createTextNode(" "),Fi=e=>{const t=e.createElement("br");return t.dataset.ckeFiller=!0,t},Bi=(()=>{let e="";for(let t=0;t<7;t++)e+="";return e})();function Li(e){return Vi(e)&&e.data.substr(0,7)===Bi}function zi(e){return 7==e.data.length&&Li(e)}function qi(e){return Li(e)?e.data.slice(7):e.data}function ji(e,t){if(t.keyCode==gi.arrowleft){const e=t.domTarget.ownerDocument.defaultView.getSelection();if(1==e.rangeCount&&e.getRangeAt(0).collapsed){const t=e.getRangeAt(0).startContainer,n=e.getRangeAt(0).startOffset;Li(t)&&n<=7&&e.collapse(t,0)}}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function Hi(e,t,n,o=!1){n=n||function(e,t){return e===t},Array.isArray(e)||(e=Array.from(e)),Array.isArray(t)||(t=Array.from(t));const i=function(e,t,n){const o=Wi(e,t,n);if(-1===o)return{firstIndex:-1,lastIndexOld:-1,lastIndexNew:-1};const i=Ui(e,o),r=Ui(t,o),s=Wi(i,r,n),a=e.length-s,c=t.length-s;return{firstIndex:o,lastIndexOld:a,lastIndexNew:c}}(e,t,n);return o?function(e,t){const{firstIndex:n,lastIndexOld:o,lastIndexNew:i}=e;if(-1===n)return Array(t).fill("equal");let r=[];n>0&&(r=r.concat(Array(n).fill("equal")));i-n>0&&(r=r.concat(Array(i-n).fill("insert")));o-n>0&&(r=r.concat(Array(o-n).fill("delete")));i<t&&(r=r.concat(Array(t-i).fill("equal")));return r}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/(i,t.length):function(e,t){const n=[],{firstIndex:o,lastIndexOld:i,lastIndexNew:r}=t;r-o>0&&n.push({index:o,type:"insert",values:e.slice(o,r)});i-o>0&&n.push({index:o+(r-o),type:"delete",howMany:i-o});return n}(t,i)}function Wi(e,t,n){for(let o=0;o<Math.max(e.length,t.length);o++)if(void 0===e[o]||void 0===t[o]||!n(e[o],t[o]))return o;return-1}function Ui(e,t){return e.slice(t).reverse()}function $i(e,t,n){n=n||function(e,t){return e===t};const o=e.length,i=t.length;if(o>200||i>200||o+i>300)return $i.fastDiff(e,t,n,!0);let r,s;if(i<o){const n=e;e=t,t=n,r="delete",s="insert"}else r="insert",s="delete";const a=e.length,c=t.length,l=c-a,d={},u={};function h(o){const i=(void 0!==u[o-1]?u[o-1]:-1)+1,l=void 0!==u[o+1]?u[o+1]:-1,h=i>l?-1:1;d[o+h]&&(d[o]=d[o+h].slice(0)),d[o]||(d[o]=[]),d[o].push(i>l?r:s);let f=Math.max(i,l),p=f-o;for(;p<a&&f<c&&n(e[p],t[f]);)p++,f++,d[o].push("equal");return f}let f,p=0;do{for(f=-p;f<l;f++)u[f]=h(f);for(f=l+p;f>l;f--)u[f]=h(f);u[l]=h(l),p++}while(u[l]!==c);return d[l].slice(1)}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
function Gi(e,t,n){e.insertBefore(n,e.childNodes[t]||null)}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function Ki(e){const t=e.parentNode;t&&t.removeChild(e)}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function Ji(e){if(e){if(e.defaultView)return e instanceof e.defaultView.Document;if(e.ownerDocument&&e.ownerDocument.defaultView)return e instanceof e.ownerDocument.defaultView.Node}return!1}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/$i.fastDiff=Hi;class Zi{constructor(e,t){this.domDocuments=new Set,this.domConverter=e,this.markedAttributes=new Set,this.markedChildren=new Set,this.markedTexts=new Set,this.selection=t,this.isFocused=!1,this._inlineFiller=null,this._fakeSelectionContainer=null}markToSync(e,t){if("text"===e)this.domConverter.mapViewToDom(t.parent)&&this.markedTexts.add(t);else{if(!this.domConverter.mapViewToDom(t))return;if("attributes"===e)this.markedAttributes.add(t);else{if("children"!==e)throw new fn.b("view-renderer-unknown-type: Unknown type passed to Renderer.markToSync.",this);this.markedChildren.add(t)}}}render(){let e;for(const e of this.markedChildren)this._updateChildrenMappings(e);this._inlineFiller&&!this._isSelectionInInlineFiller()&&this._removeInlineFiller(),this._inlineFiller?e=this._getInlineFillerPosition():this._needsInlineFillerAtSelection()&&(e=this.selection.getFirstPosition(),this.markedChildren.add(e.parent));for(const e of this.markedAttributes)this._updateAttrs(e);for(const t of this.markedChildren)this._updateChildren(t,{inlineFillerPosition:e});for(const t of this.markedTexts)!this.markedChildren.has(t.parent)&&this.domConverter.mapViewToDom(t.parent)&&this._updateText(t,{inlineFillerPosition:e});if(e){const t=this.domConverter.viewPositionToDom(e),n=t.parent.ownerDocument;Li(t.parent)?this._inlineFiller=t.parent:this._inlineFiller=Qi(n,t.parent,t.offset)}else this._inlineFiller=null;this._updateSelection(),this._updateFocus(),this.markedTexts.clear(),this.markedAttributes.clear(),this.markedChildren.clear()}_updateChildrenMappings(e){const t=this.domConverter.mapViewToDom(e);if(!t)return;const n=this.domConverter.mapViewToDom(e).childNodes,o=Array.from(this.domConverter.viewChildrenToDom(e,t.ownerDocument,{withChildren:!1})),i=this._diffNodeLists(n,o),r=this._findReplaceActions(i,n,o);if(-1!==r.indexOf("replace")){const t={equal:0,insert:0,delete:0};for(const i of r)if("replace"===i){const i=t.equal+t.insert,r=t.equal+t.delete,s=e.getChild(i);s&&!s.is("uiElement")&&this._updateElementMappings(s,n[r]),Ki(o[i]),t.equal++}else t[i]++}}_updateElementMappings(e,t){this.domConverter.unbindDomElement(t),this.domConverter.bindElements(t,e),this.markedChildren.add(e),this.markedAttributes.add(e)}_getInlineFillerPosition(){const e=this.selection.getFirstPosition();return e.parent.is("text")?ei._createBefore(this.selection.getFirstPosition().parent):e}_isSelectionInInlineFiller(){if(1!=this.selection.rangeCount||!this.selection.isCollapsed)return!1;const e=this.selection.getFirstPosition(),t=this.domConverter.viewPositionToDom(e);return!!(t&&Vi(t.parent)&&Li(t.parent))}_removeInlineFiller(){const e=this._inlineFiller;if(!Li(e))throw new fn.b("view-renderer-filler-was-lost: The inline filler node was lost.",this);zi(e)?e.parentNode.removeChild(e):e.data=e.data.substr(7),this._inlineFiller=null}_needsInlineFillerAtSelection(){if(1!=this.selection.rangeCount||!this.selection.isCollapsed)return!1;const e=this.selection.getFirstPosition(),t=e.parent,n=e.offset;if(!this.domConverter.mapViewToDom(t.root))return!1;if(!t.is("element"))return!1;if(!function(e){if("false"==e.getAttribute("contenteditable"))return!1;const t=e.findAncestor(e=>e.hasAttribute("contenteditable"));return!t||"true"==t.getAttribute("contenteditable")}(t))return!1;if(n===t.getFillerOffset())return!1;const o=e.nodeBefore,i=e.nodeAfter;return!(o instanceof Mn||i instanceof Mn)}_updateText(e,t){const n=this.domConverter.findCorrespondingDomText(e),o=this.domConverter.viewToDom(e,n.ownerDocument),i=n.data;let r=o.data;const s=t.inlineFillerPosition;if(s&&s.parent==e.parent&&s.offset==e.index&&(r=Bi+r),i!=r){const e=Hi(i,r);for(const t of e)"insert"===t.type?n.insertData(t.index,t.values.join("")):n.deleteData(t.index,t.howMany)}}_updateAttrs(e){const t=this.domConverter.mapViewToDom(e);if(!t)return;const n=Array.from(t.attributes).map(e=>e.name),o=e.getAttributeKeys();for(const n of o)t.setAttribute(n,e.getAttribute(n));for(const o of n)e.hasAttribute(o)||t.removeAttribute(o)}_updateChildren(e,t){const n=this.domConverter.mapViewToDom(e);if(!n)return;const o=t.inlineFillerPosition,i=this.domConverter.mapViewToDom(e).childNodes,r=Array.from(this.domConverter.viewChildrenToDom(e,n.ownerDocument,{bind:!0,inlineFillerPosition:o}));o&&o.parent===e&&Qi(n.ownerDocument,r,o.offset);const s=this._diffNodeLists(i,r);let a=0;const c=new Set;for(const e of s)"delete"===e?(c.add(i[a]),Ki(i[a])):"equal"===e&&a++;a=0;for(const e of s)"insert"===e?(Gi(n,a,r[a]),a++):"equal"===e&&(this._markDescendantTextToSync(this.domConverter.domToView(r[a])),a++);for(const e of c)e.parentNode||this.domConverter.unbindDomElement(e)}_diffNodeLists(e,t){return $i(e=function(e,t){const n=Array.from(e);if(0==n.length||!t)return n;n[n.length-1]==t&&n.pop();return n}(e,this._fakeSelectionContainer),t,Xi.bind(null,this.domConverter))}_findReplaceActions(e,t,n){if(-1===e.indexOf("insert")||-1===e.indexOf("delete"))return e;let o=[],i=[],r=[];const s={equal:0,insert:0,delete:0};for(const a of e)"insert"===a?r.push(n[s.equal+s.insert]):"delete"===a?i.push(t[s.equal+s.delete]):(o=o.concat($i(i,r,Yi).map(e=>"equal"===e?"replace":e)),o.push("equal"),i=[],r=[]),s[a]++;return o.concat($i(i,r,Yi).map(e=>"equal"===e?"replace":e))}_markDescendantTextToSync(e){if(e)if(e.is("text"))this.markedTexts.add(e);else if(e.is("element"))for(const t of e.getChildren())this._markDescendantTextToSync(t)}_updateSelection(){if(0===this.selection.rangeCount)return this._removeDomSelection(),void this._removeFakeSelection();const e=this.domConverter.mapViewToDom(this.selection.editableElement);this.isFocused&&e&&(this.selection.isFake?this._updateFakeSelection(e):(this._removeFakeSelection(),this._updateDomSelection(e)))}_updateFakeSelection(e){const t=e.ownerDocument;this._fakeSelectionContainer||(this._fakeSelectionContainer=function(e){const t=e.createElement("div");return Object.assign(t.style,{position:"fixed",top:0,left:"-9999px",width:"42px"}),t.textContent=" ",t}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/(t));const n=this._fakeSelectionContainer;if(this.domConverter.bindFakeSelection(n,this.selection),!this._fakeSelectionNeedsUpdate(e))return;n.parentElement&&n.parentElement==e||e.appendChild(n),n.textContent=this.selection.fakeSelectionLabel||" ";const o=t.getSelection(),i=t.createRange();o.removeAllRanges(),i.selectNodeContents(n),o.addRange(i)}_updateDomSelection(e){const t=e.ownerDocument.defaultView.getSelection();if(!this._domSelectionNeedsUpdate(t))return;const n=this.domConverter.viewPositionToDom(this.selection.anchor),o=this.domConverter.viewPositionToDom(this.selection.focus);e.focus(),t.collapse(n.parent,n.offset),t.extend(o.parent,o.offset),fi.isGecko&&function(e,t){const n=e.parent;if(n.nodeType!=Node.ELEMENT_NODE||e.offset!=n.childNodes.length-1)return;const o=n.childNodes[e.offset];o&&"BR"==o.tagName&&t.addRange(t.getRangeAt(0))}(o,t)}_domSelectionNeedsUpdate(e){if(!this.domConverter.isDomSelectionCorrect(e))return!0;const t=e&&this.domConverter.domSelectionToView(e);return(!t||!this.selection.isEqual(t))&&!(!this.selection.isCollapsed&&this.selection.isSimilar(t))}_fakeSelectionNeedsUpdate(e){const t=this._fakeSelectionContainer,n=e.ownerDocument.getSelection();return!t||t.parentElement!==e||(n.anchorNode!==t&&!t.contains(n.anchorNode)||t.textContent!==this.selection.fakeSelectionLabel)}_removeDomSelection(){for(const e of this.domDocuments){if(e.getSelection().rangeCount){const t=e.activeElement,n=this.domConverter.mapDomToView(t);t&&n&&e.getSelection().removeAllRanges()}}}_removeFakeSelection(){const e=this._fakeSelectionContainer;e&&e.remove()}_updateFocus(){if(this.isFocused){const e=this.selection.editableElement;e&&this.domConverter.focus(e)}}}function Qi(e,t,n){const o=t instanceof Array?t:t.childNodes,i=o[n];if(Vi(i))return i.data=Bi+i.data,i;{const i=e.createTextNode(Bi);return Array.isArray(t)?o.splice(n,0,i):Gi(t,n,i),i}}function Yi(e,t){return Ji(e)&&Ji(t)&&!Vi(e)&&!Vi(t)&&e.tagName.toLowerCase()===t.tagName.toLowerCase()}function Xi(e,t,n){return t===n||(Vi(t)&&Vi(n)?t.data===n.data:!(!e.isBlockFiller(t)||!e.isBlockFiller(n)))}xn(Zi,Wo);var er={window:window,document:document};
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function tr(e){let t=0;for(;e.previousSibling;)e=e.previousSibling,t++;return t}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function nr(e){const t=[];for(;e&&e.nodeType!=Node.DOCUMENT_NODE;)t.unshift(e),e=e.parentNode;return t}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
const or=Fi(document);class ir{constructor(e,t={}){this.document=e,this.blockFillerMode=t.blockFillerMode||"br",this.preElements=["pre"],this.blockElements=["p","div","h1","h2","h3","h4","h5","h6","li","dd","dt","figcaption"],this._blockFiller="br"==this.blockFillerMode?Fi:Di,this._domToViewMapping=new WeakMap,this._viewToDomMapping=new WeakMap,this._fakeSelectionMapping=new WeakMap}bindFakeSelection(e,t){this._fakeSelectionMapping.set(e,new ii(t))}fakeSelectionToView(e){return this._fakeSelectionMapping.get(e)}bindElements(e,t){this._domToViewMapping.set(e,t),this._viewToDomMapping.set(t,e)}unbindDomElement(e){const t=this._domToViewMapping.get(e);if(t){this._domToViewMapping.delete(e),this._viewToDomMapping.delete(t);for(const t of Array.from(e.childNodes))this.unbindDomElement(t)}}bindDocumentFragments(e,t){this._domToViewMapping.set(e,t),this._viewToDomMapping.set(t,e)}viewToDom(e,t,n={}){if(e.is("text")){const n=this._processDataFromViewText(e);return t.createTextNode(n)}{if(this.mapViewToDom(e))return this.mapViewToDom(e);let o;if(e.is("documentFragment"))o=t.createDocumentFragment(),n.bind&&this.bindDocumentFragments(o,e);else{if(e.is("uiElement"))return o=e.render(t),n.bind&&this.bindElements(o,e),o;o=e.hasAttribute("xmlns")?t.createElementNS(e.getAttribute("xmlns"),e.name):t.createElement(e.name),n.bind&&this.bindElements(o,e);for(const t of e.getAttributeKeys())o.setAttribute(t,e.getAttribute(t))}if(n.withChildren||void 0===n.withChildren)for(const i of this.viewChildrenToDom(e,t,n))o.appendChild(i);return o}}*viewChildrenToDom(e,t,n={}){const o=e.getFillerOffset&&e.getFillerOffset();let i=0;for(const r of e.getChildren())o===i&&(yield this._blockFiller(t)),yield this.viewToDom(r,t,n),i++;o===i&&(yield this._blockFiller(t))}viewRangeToDom(e){const t=this.viewPositionToDom(e.start),n=this.viewPositionToDom(e.end),o=document.createRange();return o.setStart(t.parent,t.offset),o.setEnd(n.parent,n.offset),o}viewPositionToDom(e){const t=e.parent;if(t.is("text")){const n=this.findCorrespondingDomText(t);if(!n)return null;let o=e.offset;return Li(n)&&(o+=7),{parent:n,offset:o}}{let n,o,i;if(0===e.offset){if(n=this.mapViewToDom(t),!n)return null;i=n.childNodes[0]}else{const t=e.nodeBefore;if(o=t.is("text")?this.findCorrespondingDomText(t):this.mapViewToDom(e.nodeBefore),!o)return null;n=o.parentNode,i=o.nextSibling}if(Vi(i)&&Li(i))return{parent:i,offset:7};return{parent:n,offset:o?tr(o)+1:0}}}domToView(e,t={}){if(this.isBlockFiller(e,this.blockFillerMode))return null;const n=this.getParentUIElement(e,this._domToViewMapping);if(n)return n;if(Vi(e)){if(zi(e))return null;{const t=this._processDataFromDomText(e);return""===t?null:new Mn(this.document,t)}}if(this.isComment(e))return null;{if(this.mapDomToView(e))return this.mapDomToView(e);let n;if(this.isDocumentFragment(e))n=new Ci(this.document),t.bind&&this.bindDocumentFragments(e,n);else{const o=t.keepOriginalCase?e.tagName:e.tagName.toLowerCase();n=new Vo(this.document,o),t.bind&&this.bindElements(e,n);const i=e.attributes;for(let e=i.length-1;e>=0;e--)n._setAttribute(i[e].name,i[e].value)}if(t.withChildren||void 0===t.withChildren)for(const o of this.domChildrenToView(e,t))n._appendChild(o);return n}}*domChildrenToView(e,t={}){for(let n=0;n<e.childNodes.length;n++){const o=e.childNodes[n],i=this.domToView(o,t);null!==i&&(yield i)}}domSelectionToView(e){if(1===e.rangeCount){let t=e.getRangeAt(0).startContainer;Vi(t)&&(t=t.parentNode);const n=this.fakeSelectionToView(t);if(n)return n}const t=this.isDomSelectionBackward(e),n=[];for(let t=0;t<e.rangeCount;t++){const o=e.getRangeAt(t),i=this.domRangeToView(o);i&&n.push(i)}return new ii(n,{backward:t})}domRangeToView(e){const t=this.domPositionToView(e.startContainer,e.startOffset),n=this.domPositionToView(e.endContainer,e.endOffset);return t&&n?new ti(t,n):null}domPositionToView(e,t){if(this.isBlockFiller(e,this.blockFillerMode))return this.domPositionToView(e.parentNode,tr(e));const n=this.mapDomToView(e);if(n&&n.is("uiElement"))return ei._createBefore(n);if(Vi(e)){if(zi(e))return this.domPositionToView(e.parentNode,tr(e));const n=this.findCorrespondingViewText(e);let o=t;return n?(Li(e)&&(o-=7,o=o<0?0:o),new ei(n,o)):null}if(0===t){const t=this.mapDomToView(e);if(t)return new ei(t,0)}else{const n=e.childNodes[t-1],o=Vi(n)?this.findCorrespondingViewText(n):this.mapDomToView(n);if(o&&o.parent)return new ei(o.parent,o.index+1)}return null}mapDomToView(e){return this.getParentUIElement(e)||this._domToViewMapping.get(e)}findCorrespondingViewText(e){if(zi(e))return null;const t=this.getParentUIElement(e);if(t)return t;const n=e.previousSibling;if(n){if(!this.isElement(n))return null;const e=this.mapDomToView(n);if(e){return e.nextSibling instanceof Mn?e.nextSibling:null}}else{const t=this.mapDomToView(e.parentNode);if(t){const e=t.getChild(0);return e instanceof Mn?e:null}}return null}mapViewToDom(e){return this._viewToDomMapping.get(e)}findCorrespondingDomText(e){const t=e.previousSibling;return t&&this.mapViewToDom(t)?this.mapViewToDom(t).nextSibling:!t&&e.parent&&this.mapViewToDom(e.parent)?this.mapViewToDom(e.parent).childNodes[0]:null}focus(e){const t=this.mapViewToDom(e);if(t&&t.ownerDocument.activeElement!==t){const{scrollX:e,scrollY:n}=er.window,o=[];sr(t,e=>{const{scrollLeft:t,scrollTop:n}=e;o.push([t,n])}),t.focus(),sr(t,e=>{const[t,n]=o.shift();e.scrollLeft=t,e.scrollTop=n}),er.window.scrollTo(e,n)}}isElement(e){return e&&e.nodeType==Node.ELEMENT_NODE}isDocumentFragment(e){return e&&e.nodeType==Node.DOCUMENT_FRAGMENT_NODE}isComment(e){return e&&e.nodeType==Node.COMMENT_NODE}isBlockFiller(e){return"br"==this.blockFillerMode?e.isEqualNode(or):!("BR"!==e.tagName||!ar(e,this.blockElements)||1!==e.parentNode.childNodes.length)||function(e,t){return Vi(e)&&" "==e.data&&ar(e,t)&&1===e.parentNode.childNodes.length}(e,this.blockElements)}isDomSelectionBackward(e){if(e.isCollapsed)return!1;const t=document.createRange();t.setStart(e.anchorNode,e.anchorOffset),t.setEnd(e.focusNode,e.focusOffset);const n=t.collapsed;return t.detach(),n}getParentUIElement(e){const t=nr(e);for(t.pop();t.length;){const e=t.pop(),n=this._domToViewMapping.get(e);if(n&&n.is("uiElement"))return n}return null}isDomSelectionCorrect(e){return this._isDomSelectionPositionCorrect(e.anchorNode,e.anchorOffset)&&this._isDomSelectionPositionCorrect(e.focusNode,e.focusOffset)}_isDomSelectionPositionCorrect(e,t){if(Vi(e)&&Li(e)&&t<7)return!1;if(this.isElement(e)&&Li(e.childNodes[t]))return!1;const n=this.mapDomToView(e);return!n||!n.is("uiElement")}_processDataFromViewText(e){let t=e.data;if(e.getAncestors().some(e=>this.preElements.includes(e.name)))return t;if(" "==t.charAt(0)){const n=this._getTouchingViewTextNode(e,!1);!(n&&this._nodeEndsWithSpace(n))&&n||(t=" "+t.substr(1))}if(" "==t.charAt(t.length-1)){const n=this._getTouchingViewTextNode(e,!0);" "!=t.charAt(t.length-2)&&n&&" "!=n.data.charAt(0)||(t=t.substr(0,t.length-1)+" ")}return t.replace(/ {2}/g," ")}_nodeEndsWithSpace(e){if(e.getAncestors().some(e=>this.preElements.includes(e.name)))return!1;const t=this._processDataFromViewText(e);return" "==t.charAt(t.length-1)}_processDataFromDomText(e){let t=e.data;if(rr(e,this.preElements))return qi(e);t=t.replace(/[ \n\t\r]{1,}/g," ");const n=this._getTouchingInlineDomNode(e,!1),o=this._getTouchingInlineDomNode(e,!0),i=this._checkShouldLeftTrimDomText(n),r=this._checkShouldRightTrimDomText(e,o);return i&&(t=t.replace(/^ /,"")),r&&(t=t.replace(/ $/,"")),t=qi(new Text(t)),t=t.replace(/ \u00A0/g," "),(/( |\u00A0)\u00A0$/.test(t)||!o||o.data&&" "==o.data.charAt(0))&&(t=t.replace(/\u00A0$/," ")),i&&(t=t.replace(/^\u00A0/," ")),t}_checkShouldLeftTrimDomText(e){return!e||(!!on(e)||/[^\S\u00A0]/.test(e.data.charAt(e.data.length-1)))}_checkShouldRightTrimDomText(e,t){return!t&&!Li(e)}_getTouchingViewTextNode(e,t){const n=new Xo({startPosition:t?ei._createAfter(e):ei._createBefore(e),direction:t?"forward":"backward"});for(const e of n){if(e.item.is("containerElement"))return null;if(e.item.is("br"))return null;if(e.item.is("textProxy"))return e.item}return null}_getTouchingInlineDomNode(e,t){if(!e.parentNode)return null;const n=t?"nextNode":"previousNode",o=e.ownerDocument,i=nr(e)[0],r=o.createTreeWalker(i,NodeFilter.SHOW_TEXT|NodeFilter.SHOW_ELEMENT,{acceptNode:e=>Vi(e)||"BR"==e.tagName?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});r.currentNode=e;const s=r[n]();if(null!==s){const t=function(e,t){const n=nr(e),o=nr(t);let i=0;for(;n[i]==o[i]&&n[i];)i++;return 0===i?null:n[i-1]}(e,s);if(t&&!rr(e,this.blockElements,t)&&!rr(s,this.blockElements,t))return s}return null}}function rr(e,t,n){let o=nr(e);return n&&(o=o.slice(o.indexOf(n)+1)),o.some(e=>e.tagName&&t.includes(e.tagName.toLowerCase()))}function sr(e,t){for(;e&&e!=er.document;)t(e),e=e.parentNode}function ar(e,t){const n=e.parentNode;return n&&n.tagName&&t.includes(n.tagName.toLowerCase())}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function cr(e){const t=Object.prototype.toString.apply(e);return"[object Window]"==t||"[object global]"==t}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/var lr=Lo({},gn,{listenTo(e,...t){if(Ji(e)||cr(e)){const n=this._getProxyEmitter(e)||new dr(e);n.attach(...t),e=n}gn.listenTo.call(this,e,...t)},stopListening(e,t,n){if(Ji(e)||cr(e)){const t=this._getProxyEmitter(e);if(!t)return;e=t}gn.stopListening.call(this,e,t,n),e instanceof dr&&e.detach(t)},_getProxyEmitter(e){return t=this,n=ur(e),t[pn]&&t[pn][n]?t[pn][n].emitter:null;var t,n}});class dr{constructor(e){bn(this,ur(e)),this._domNode=e}}function ur(e){return e["data-ck-expando"]||(e["data-ck-expando"]=un())}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/Lo(dr.prototype,gn,{attach(e,t,n={}){if(this._domListeners&&this._domListeners[e])return;const o=this._createDomListener(e,!!n.useCapture);this._domNode.addEventListener(e,o,!!n.useCapture),this._domListeners||(this._domListeners={}),this._domListeners[e]=o},detach(e){let t;!this._domListeners[e]||(t=this._events[e])&&t.callbacks.length||this._domListeners[e].removeListener()},_createDomListener(e,t){const n=t=>{this.fire(e,t)};return n.removeListener=()=>{this._domNode.removeEventListener(e,n,t),delete this._domListeners[e]},n}});class hr{constructor(e){this.view=e,this.document=e.document,this.isEnabled=!1}enable(){this.isEnabled=!0}disable(){this.isEnabled=!1}destroy(){this.disable(),this.stopListening()}}xn(hr,lr);var fr=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this};var pr=function(e){return this.__data__.has(e)};function mr(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new _e;++t<n;)this.add(e[t])}mr.prototype.add=mr.prototype.push=fr,mr.prototype.has=pr;var gr=mr;var br=function(e,t){for(var n=-1,o=null==e?0:e.length;++n<o;)if(t(e[n],n,e))return!0;return!1};var wr=function(e,t){return e.has(t)};var kr=function(e,t,n,o,i,r){var s=1&n,a=e.length,c=t.length;if(a!=c&&!(s&&c>a))return!1;var l=r.get(e);if(l&&r.get(t))return l==t;var d=-1,u=!0,h=2&n?new gr:void 0;for(r.set(e,t),r.set(t,e);++d<a;){var f=e[d],p=t[d];if(o)var m=s?o(p,f,d,t,e,r):o(f,p,d,e,t,r);if(void 0!==m){if(m)continue;u=!1;break}if(h){if(!br(t,(function(e,t){if(!wr(h,t)&&(f===e||i(f,e,n,o,r)))return h.push(t)}))){u=!1;break}}else if(f!==p&&!i(f,p,n,o,r)){u=!1;break}}return r.delete(e),r.delete(t),u};var _r=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,o){n[++t]=[o,e]})),n};var vr=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n},yr=i?i.prototype:void 0,xr=yr?yr.valueOf:void 0;var Cr=function(e,t,n,o,i,r,s){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!r(new Vt(e),new Vt(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return A(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var a=_r;case"[object Set]":var c=1&o;if(a||(a=vr),e.size!=t.size&&!c)return!1;var l=s.get(e);if(l)return l==t;o|=2,s.set(e,t);var d=kr(a(e),a(t),o,i,r,s);return s.delete(e),d;case"[object Symbol]":if(xr)return xr.call(e)==xr.call(t)}return!1},Ar=Object.prototype.hasOwnProperty;var Tr=function(e,t,n,o,i,r){var s=1&n,a=_t(e),c=a.length;if(c!=_t(t).length&&!s)return!1;for(var l=c;l--;){var d=a[l];if(!(s?d in t:Ar.call(t,d)))return!1}var u=r.get(e);if(u&&r.get(t))return u==t;var h=!0;r.set(e,t),r.set(t,e);for(var f=s;++l<c;){var p=e[d=a[l]],m=t[d];if(o)var g=s?o(m,p,d,t,e,r):o(p,m,d,e,t,r);if(!(void 0===g?p===m||i(p,m,n,o,r):g)){h=!1;break}f||(f="constructor"==d)}if(h&&!f){var b=e.constructor,w=t.constructor;b!=w&&"constructor"in e&&"constructor"in t&&!("function"==typeof b&&b instanceof b&&"function"==typeof w&&w instanceof w)&&(h=!1)}return r.delete(e),r.delete(t),h},Pr=Object.prototype.hasOwnProperty;var Er=function(e,t,n,o,i,r){var s=De(e),a=De(t),c=s?"[object Array]":Ot(e),l=a?"[object Array]":Ot(t),d="[object Object]"==(c="[object Arguments]"==c?"[object Object]":c),u="[object Object]"==(l="[object Arguments]"==l?"[object Object]":l),h=c==l;if(h&&Object(Fe.a)(e)){if(!Object(Fe.a)(t))return!1;s=!0,d=!1}if(h&&!d)return r||(r=new xe),s||$e(e)?kr(e,t,n,o,i,r):Cr(e,t,c,n,o,i,r);if(!(1&n)){var f=d&&Pr.call(e,"__wrapped__"),p=u&&Pr.call(t,"__wrapped__");if(f||p){var m=f?e.value():e,g=p?t.value():t;return r||(r=new xe),i(m,g,n,o,r)}}return!!h&&(r||(r=new xe),Tr(e,t,n,o,i,r))};var Sr=function e(t,n,o,i,r){return t===n||(null==t||null==n||!g(t)&&!g(n)?t!=t&&n!=n:Er(t,n,o,i,e,r))};var Rr=function(e,t,n){var o=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===o?Sr(e,t,void 0,n):!!o};
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Ir extends hr{constructor(e){super(e),this._config={childList:!0,characterData:!0,characterDataOldValue:!0,subtree:!0},this.domConverter=e.domConverter,this.renderer=e._renderer,this._domElements=[],this._mutationObserver=new window.MutationObserver(this._onMutations.bind(this))}flush(){this._onMutations(this._mutationObserver.takeRecords())}observe(e){this._domElements.push(e),this.isEnabled&&this._mutationObserver.observe(e,this._config)}enable(){super.enable();for(const e of this._domElements)this._mutationObserver.observe(e,this._config)}disable(){super.disable(),this._mutationObserver.disconnect()}destroy(){super.destroy(),this._mutationObserver.disconnect()}_onMutations(e){if(0===e.length)return;const t=this.domConverter,n=new Map,o=new Set;for(const n of e)if("childList"===n.type){const e=t.mapDomToView(n.target);if(e&&e.is("uiElement"))continue;e&&!this._isBogusBrMutation(n)&&o.add(e)}for(const i of e){const e=t.mapDomToView(i.target);if((!e||!e.is("uiElement"))&&"characterData"===i.type){const e=t.findCorrespondingViewText(i.target);e&&!o.has(e.parent)?n.set(e,{type:"text",oldText:e.data,newText:qi(i.target),node:e}):!e&&Li(i.target)&&o.add(t.mapDomToView(i.target.parentNode))}}const i=[];for(const e of n.values())this.renderer.markToSync("text",e.node),i.push(e);for(const e of o){const n=t.mapViewToDom(e),o=Array.from(e.getChildren()),r=Array.from(t.domChildrenToView(n,{withChildren:!1}));Rr(o,r,a)||(this.renderer.markToSync("children",e),i.push({type:"children",oldChildren:o,newChildren:r,node:e}))}const r=e[0].target.ownerDocument.getSelection();let s=null;if(r&&r.anchorNode){const e=t.domPositionToView(r.anchorNode,r.anchorOffset),n=t.domPositionToView(r.focusNode,r.focusOffset);e&&n&&(s=new ii(e),s.setFocus(n))}function a(e,t){if(!Array.isArray(e))return e===t||!(!e.is("text")||!t.is("text"))&&e.data===t.data}i.length&&(this.document.fire("mutations",i,s),this.view.forceRender())}_isBogusBrMutation(e){let t=null;return null===e.nextSibling&&0===e.removedNodes.length&&1==e.addedNodes.length&&(t=this.domConverter.domToView(e.addedNodes[0],{withChildren:!1})),t&&t.is("element","br")}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Or{constructor(e,t,n){this.view=e,this.document=e.document,this.domEvent=t,this.domTarget=t.target,Lo(this,n)}get target(){return this.view.domConverter.mapDomToView(this.domTarget)}preventDefault(){this.domEvent.preventDefault()}stopPropagation(){this.domEvent.stopPropagation()}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Nr extends hr{constructor(e){super(e),this.useCapture=!1}observe(e){("string"==typeof this.domEventType?[this.domEventType]:this.domEventType).forEach(t=>{this.listenTo(e,t,(e,t)=>{this.isEnabled&&this.onDomEvent(t)},{useCapture:this.useCapture})})}fire(e,t,n){this.isEnabled&&this.document.fire(e,new Or(this.view,t,n))}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Mr extends Nr{constructor(e){super(e),this.domEventType=["keydown","keyup"]}onDomEvent(e){this.fire(e.type,e,{keyCode:e.keyCode,altKey:e.altKey,ctrlKey:e.ctrlKey||e.metaKey,shiftKey:e.shiftKey,get keystroke(){return bi(this)}})}}var Vr=function(){return o.a.Date.now()},Dr=/^\s+|\s+$/g,Fr=/^[-+]0x[0-9a-f]+$/i,Br=/^0b[01]+$/i,Lr=/^0o[0-7]+$/i,zr=parseInt;var qr=function(e){if("number"==typeof e)return e;if(zn(e))return NaN;if(B(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=B(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(Dr,"");var n=Br.test(e);return n||Lr.test(e)?zr(e.slice(2),n?2:8):Fr.test(e)?NaN:+e},jr=Math.max,Hr=Math.min;var Wr=function(e,t,n){var o,i,r,s,a,c,l=0,d=!1,u=!1,h=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function f(t){var n=o,r=i;return o=i=void 0,l=t,s=e.apply(r,n)}function p(e){return l=e,a=setTimeout(g,t),d?f(e):s}function m(e){var n=e-c;return void 0===c||n>=t||n<0||u&&e-l>=r}function g(){var e=Vr();if(m(e))return b(e);a=setTimeout(g,function(e){var n=t-(e-c);return u?Hr(n,r-(e-l)):n}(e))}function b(e){return a=void 0,h&&o?f(e):(o=i=void 0,s)}function w(){var e=Vr(),n=m(e);if(o=arguments,i=this,c=e,n){if(void 0===a)return p(c);if(u)return clearTimeout(a),a=setTimeout(g,t),f(c)}return void 0===a&&(a=setTimeout(g,t)),s}return t=qr(t)||0,B(n)&&(d=!!n.leading,r=(u="maxWait"in n)?jr(qr(n.maxWait)||0,t):r,h="trailing"in n?!!n.trailing:h),w.cancel=function(){void 0!==a&&clearTimeout(a),l=0,o=c=i=a=void 0},w.flush=function(){return void 0===a?s:b(Vr())},w};
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Ur extends hr{constructor(e){super(e),this._fireSelectionChangeDoneDebounced=Wr(e=>this.document.fire("selectionChangeDone",e),200)}observe(){const e=this.document;e.on("keydown",(t,n)=>{var o;
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/e.selection.isFake&&((o=n.keyCode)==gi.arrowright||o==gi.arrowleft||o==gi.arrowup||o==gi.arrowdown)&&this.isEnabled&&(n.preventDefault(),this._handleSelectionMove(n.keyCode))},{priority:"lowest"})}destroy(){super.destroy(),this._fireSelectionChangeDoneDebounced.cancel()}_handleSelectionMove(e){const t=this.document.selection,n=new ii(t.getRanges(),{backward:t.isBackward,fake:!1});e!=gi.arrowleft&&e!=gi.arrowup||n.setTo(n.getFirstPosition()),e!=gi.arrowright&&e!=gi.arrowdown||n.setTo(n.getLastPosition());const o={oldSelection:t,newSelection:n,domSelection:null};this.document.fire("selectionChange",o),this._fireSelectionChangeDoneDebounced(o)}}class $r extends hr{constructor(e){super(e),this.mutationObserver=e.getObserver(Ir),this.selection=this.document.selection,this.domConverter=e.domConverter,this._documents=new WeakSet,this._fireSelectionChangeDoneDebounced=Wr(e=>this.document.fire("selectionChangeDone",e),200),this._clearInfiniteLoopInterval=setInterval(()=>this._clearInfiniteLoop(),1e3),this._loopbackCounter=0}observe(e){const t=e.ownerDocument;this._documents.has(t)||(this.listenTo(t,"selectionchange",()=>{this._handleSelectionChange(t)}),this._documents.add(t))}destroy(){super.destroy(),clearInterval(this._clearInfiniteLoopInterval),this._fireSelectionChangeDoneDebounced.cancel()}_handleSelectionChange(e){if(!this.isEnabled)return;this.mutationObserver.flush();const t=e.defaultView.getSelection(),n=this.domConverter.domSelectionToView(t);if(0!=n.rangeCount&&!(this.selection.isEqual(n)&&this.domConverter.isDomSelectionCorrect(t)||++this._loopbackCounter>60))if(this.selection.isSimilar(n))this.view.forceRender();else{const e={oldSelection:this.selection,newSelection:n,domSelection:t};this.document.fire("selectionChange",e),this._fireSelectionChangeDoneDebounced(e)}}_clearInfiniteLoop(){this._loopbackCounter=0}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Gr extends Nr{constructor(e){super(e),this.domEventType=["focus","blur"],this.useCapture=!0;const t=this.document;t.on("focus",()=>{t.isFocused=!0,this._renderTimeoutId=setTimeout(()=>e.forceRender(),50)}),t.on("blur",(n,o)=>{const i=t.selection.editableElement;null!==i&&i!==o.target||(t.isFocused=!1,e.forceRender())})}onDomEvent(e){this.fire(e.type,e)}destroy(){this._renderTimeoutId&&clearTimeout(this._renderTimeoutId),super.destroy()}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Kr extends Nr{constructor(e){super(e),this.domEventType=["compositionstart","compositionupdate","compositionend"];const t=this.document;t.on("compositionstart",()=>{t.isComposing=!0}),t.on("compositionend",()=>{t.isComposing=!1})}onDomEvent(e){this.fire(e.type,e)}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md.
|
|
|
*/class Jr extends Nr{constructor(e){super(e),this.domEventType=["beforeinput"]}onDomEvent(e){this.fire(e.type,e)}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function Zr(e){return"[object Range]"==Object.prototype.toString.apply(e)}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function Qr(e){const t=e.ownerDocument.defaultView.getComputedStyle(e);return{top:parseInt(t.borderTopWidth,10),right:parseInt(t.borderRightWidth,10),bottom:parseInt(t.borderBottomWidth,10),left:parseInt(t.borderLeftWidth,10)}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/const Yr=["top","right","bottom","left","width","height"];class Xr{constructor(e){const t=Zr(e);if(Object.defineProperty(this,"_source",{value:e._source||e,writable:!0,enumerable:!1}),on(e)||t)es(this,t?Xr.getDomRangeRects(e)[0]:e.getBoundingClientRect());else if(cr(e)){const{innerWidth:t,innerHeight:n}=e;es(this,{top:0,right:t,bottom:n,left:0,width:t,height:n})}else es(this,e)}clone(){return new Xr(this)}moveTo(e,t){return this.top=t,this.right=e+this.width,this.bottom=t+this.height,this.left=e,this}moveBy(e,t){return this.top+=t,this.right+=e,this.left+=e,this.bottom+=t,this}getIntersection(e){const t={top:Math.max(this.top,e.top),right:Math.min(this.right,e.right),bottom:Math.min(this.bottom,e.bottom),left:Math.max(this.left,e.left)};return t.width=t.right-t.left,t.height=t.bottom-t.top,t.width<0||t.height<0?null:new Xr(t)}getIntersectionArea(e){const t=this.getIntersection(e);return t?t.getArea():0}getArea(){return this.width*this.height}getVisible(){const e=this._source;let t=this.clone();if(!ts(e)){let n=e.parentNode||e.commonAncestorContainer;for(;n&&!ts(n);){const e=new Xr(n),o=t.getIntersection(e);if(!o)return null;o.getArea()<t.getArea()&&(t=o),n=n.parentNode}}return t}isEqual(e){for(const t of Yr)if(this[t]!==e[t])return!1;return!0}contains(e){const t=this.getIntersection(e);return!(!t||!t.isEqual(e))}excludeScrollbarsAndBorders(){const e=this._source;let t,n,o;if(cr(e))t=e.innerWidth-e.document.documentElement.clientWidth,n=e.innerHeight-e.document.documentElement.clientHeight,o=e.getComputedStyle(e.document.documentElement).direction;else{const i=Qr(this._source);t=e.offsetWidth-e.clientWidth-i.left-i.right,n=e.offsetHeight-e.clientHeight-i.top-i.bottom,o=e.ownerDocument.defaultView.getComputedStyle(e).direction,this.left+=i.left,this.top+=i.top,this.right-=i.right,this.bottom-=i.bottom,this.width=this.right-this.left,this.height=this.bottom-this.top}return this.width-=t,"ltr"===o?this.right-=t:this.left+=t,this.height-=n,this.bottom-=n,this}static getDomRangeRects(e){const t=[],n=Array.from(e.getClientRects());if(n.length)for(const e of n)t.push(new Xr(e));else{let n=e.startContainer;Vi(n)&&(n=n.parentNode);const o=new Xr(n.getBoundingClientRect());o.right=o.left,o.width=0,t.push(o)}return t}}function es(e,t){for(const n of Yr)e[n]=t[n]}function ts(e){return!!on(e)&&e===e.ownerDocument.body}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function ns({target:e,viewportOffset:t=0}){const n=ls(e);let o=n,i=null;for(;o;){let r;r=ds(o==n?e:i),is(r,()=>us(e,o));const s=us(e,o);if(os(o,s,t),o.parent!=o){if(i=o.frameElement,o=o.parent,!i)return}else o=null}}function os(e,t,n){const o=t.clone().moveBy(0,n),i=t.clone().moveBy(0,-n),r=new Xr(e).excludeScrollbarsAndBorders();if(![i,o].every(e=>r.contains(e))){let{scrollX:s,scrollY:a}=e;ss(i,r)?a-=r.top-t.top+n:rs(o,r)&&(a+=t.bottom-r.bottom+n),as(t,r)?s-=r.left-t.left+n:cs(t,r)&&(s+=t.right-r.right+n),e.scrollTo(s,a)}}function is(e,t){const n=ls(e);let o,i;for(;e!=n.document.body;)i=t(),o=new Xr(e).excludeScrollbarsAndBorders(),o.contains(i)||(ss(i,o)?e.scrollTop-=o.top-i.top:rs(i,o)&&(e.scrollTop+=i.bottom-o.bottom),as(i,o)?e.scrollLeft-=o.left-i.left:cs(i,o)&&(e.scrollLeft+=i.right-o.right)),e=e.parentNode}function rs(e,t){return e.bottom>t.bottom}function ss(e,t){return e.top<t.top}function as(e,t){return e.left<t.left}function cs(e,t){return e.right>t.right}function ls(e){return Zr(e)?e.startContainer.ownerDocument.defaultView:e.ownerDocument.defaultView}function ds(e){if(Zr(e)){let t=e.commonAncestorContainer;return Vi(t)&&(t=t.parentNode),t}return e.parentNode}function us(e,t){const n=ls(e),o=new Xr(e);if(n===t)return o;{let e=n;for(;e!=t;){const t=e.frameElement,n=new Xr(t).excludeScrollbarsAndBorders();o.moveBy(n.left,n.top),e=e.parent}}return o}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/Object.assign({},{scrollViewportToShowTarget:ns,scrollAncestorsToShowTarget:function(e){is(ds(e),()=>new Xr(e))}});class hs{constructor(e){this.document=new si(e),this.domConverter=new ir(this.document),this.domRoots=new Map,this.set("isRenderingInProgress",!1),this._renderer=new Zi(this.domConverter,this.document.selection),this._renderer.bind("isFocused").to(this.document),this._initialDomRootAttributes=new WeakMap,this._observers=new Map,this._ongoingChange=!1,this._postFixersInProgress=!1,this._renderingDisabled=!1,this._hasChangedSinceTheLastRendering=!1,this._writer=new Ai(this.document),this.addObserver(Ir),this.addObserver($r),this.addObserver(Gr),this.addObserver(Mr),this.addObserver(Ur),this.addObserver(Kr),fi.isAndroid&&this.addObserver(Jr),this.document.on("keydown",ji),yi(this),this.on("render",()=>{this._render(),this.document.fire("layoutChanged"),this._hasChangedSinceTheLastRendering=!1}),this.listenTo(this.document.selection,"change",()=>{this._hasChangedSinceTheLastRendering=!0})}attachDomRoot(e,t="main"){const n=this.document.getRoot(t);n._name=e.tagName.toLowerCase();const o={};for(const{name:t,value:i}of Array.from(e.attributes))o[t]=i,"class"===t?this._writer.addClass(i.split(" "),n):this._writer.setAttribute(t,i,n);this._initialDomRootAttributes.set(e,o);const i=()=>{this._writer.setAttribute("contenteditable",!n.isReadOnly,n),n.isReadOnly?this._writer.addClass("ck-read-only",n):this._writer.removeClass("ck-read-only",n)};i(),this.domRoots.set(t,e),this.domConverter.bindElements(e,n),this._renderer.markToSync("children",n),this._renderer.markToSync("attributes",n),this._renderer.domDocuments.add(e.ownerDocument),n.on("change:children",(e,t)=>this._renderer.markToSync("children",t)),n.on("change:attributes",(e,t)=>this._renderer.markToSync("attributes",t)),n.on("change:text",(e,t)=>this._renderer.markToSync("text",t)),n.on("change:isReadOnly",()=>this.change(i)),n.on("change",()=>{this._hasChangedSinceTheLastRendering=!0});for(const n of this._observers.values())n.observe(e,t)}detachDomRoot(e){const t=this.domRoots.get(e);Array.from(t.attributes).forEach(({name:e})=>t.removeAttribute(e));const n=this._initialDomRootAttributes.get(t);for(const e in n)t.setAttribute(e,n[e]);this.domRoots.delete(e),this.domConverter.unbindDomElement(t)}getDomRoot(e="main"){return this.domRoots.get(e)}addObserver(e){let t=this._observers.get(e);if(t)return t;t=new e(this),this._observers.set(e,t);for(const[e,n]of this.domRoots)t.observe(n,e);return t.enable(),t}getObserver(e){return this._observers.get(e)}disableObservers(){for(const e of this._observers.values())e.disable()}enableObservers(){for(const e of this._observers.values())e.enable()}scrollToTheSelection(){const e=this.document.selection.getFirstRange();e&&ns({target:this.domConverter.viewRangeToDom(e),viewportOffset:20})}focus(){if(!this.document.isFocused){const e=this.document.selection.editableElement;e&&(this.domConverter.focus(e),this.forceRender())}}change(e){if(this.isRenderingInProgress||this._postFixersInProgress)throw new fn.b("cannot-change-view-tree: Attempting to make changes to the view when it is in an incorrect state: rendering or post-fixers are in progress. This may cause some unexpected behavior and inconsistency between the DOM and the view.",this);try{if(this._ongoingChange)return e(this._writer);this._ongoingChange=!0;const t=e(this._writer);return this._ongoingChange=!1,!this._renderingDisabled&&this._hasChangedSinceTheLastRendering&&(this._postFixersInProgress=!0,this.document._callPostFixers(this._writer),this._postFixersInProgress=!1,this.fire("render")),t}catch(e){fn.b.rethrowUnexpectedError(e,this)}}forceRender(){this._hasChangedSinceTheLastRendering=!0,this.change(()=>{})}destroy(){for(const e of this._observers.values())e.destroy();this.document.destroy(),this.stopListening()}createPositionAt(e,t){return ei._createAt(e,t)}createPositionAfter(e){return ei._createAfter(e)}createPositionBefore(e){return ei._createBefore(e)}createRange(e,t){return new ti(e,t)}createRangeOn(e){return ti._createOn(e)}createRangeIn(e){return ti._createIn(e)}createSelection(e,t,n){return new ii(e,t,n)}_disableRendering(e){this._renderingDisabled=e,0==e&&this.change(()=>{})}_render(){this.isRenderingInProgress=!0,this.disableObservers(),this._renderer.render(),this.enableObservers(),this.isRenderingInProgress=!1}}xn(hs,Wo);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
class fs{constructor(e){this.parent=null,this._attrs=Fn(e)}get index(){let e;if(!this.parent)return null;if(null===(e=this.parent.getChildIndex(this)))throw new fn.b("model-node-not-found-in-parent: The node's parent does not contain this node.",this);return e}get startOffset(){let e;if(!this.parent)return null;if(null===(e=this.parent.getChildStartOffset(this)))throw new fn.b("model-node-not-found-in-parent: The node's parent does not contain this node.",this);return e}get offsetSize(){return 1}get endOffset(){return this.parent?this.startOffset+this.offsetSize:null}get nextSibling(){const e=this.index;return null!==e&&this.parent.getChild(e+1)||null}get previousSibling(){const e=this.index;return null!==e&&this.parent.getChild(e-1)||null}get root(){let e=this;for(;e.parent;)e=e.parent;return e}isAttached(){return this.root.is("rootElement")}getPath(){const e=[];let t=this;for(;t.parent;)e.unshift(t.startOffset),t=t.parent;return e}getAncestors(e={includeSelf:!1,parentFirst:!1}){const t=[];let n=e.includeSelf?this:this.parent;for(;n;)t[e.parentFirst?"push":"unshift"](n),n=n.parent;return t}getCommonAncestor(e,t={}){const n=this.getAncestors(t),o=e.getAncestors(t);let i=0;for(;n[i]==o[i]&&n[i];)i++;return 0===i?null:n[i-1]}isBefore(e){if(this==e)return!1;if(this.root!==e.root)return!1;const t=this.getPath(),n=e.getPath(),o=In(t,n);switch(o){case"prefix":return!0;case"extension":return!1;default:return t[o]<n[o]}}isAfter(e){return this!=e&&(this.root===e.root&&!this.isBefore(e))}hasAttribute(e){return this._attrs.has(e)}getAttribute(e){return this._attrs.get(e)}getAttributes(){return this._attrs.entries()}getAttributeKeys(){return this._attrs.keys()}toJSON(){const e={};return this._attrs.size&&(e.attributes=Array.from(this._attrs).reduce((e,t)=>(e[t[0]]=t[1],e),{})),e}is(e){return"node"==e||"model:node"==e}_clone(){return new fs(this._attrs)}_remove(){this.parent._removeChildren(this.index)}_setAttribute(e,t){this._attrs.set(e,t)}_setAttributesTo(e){this._attrs=Fn(e)}_removeAttribute(e){return this._attrs.delete(e)}_clearAttributes(){this._attrs.clear()}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class ps extends fs{constructor(e,t){super(t),this._data=e||""}get offsetSize(){return this.data.length}get data(){return this._data}is(e){return"text"==e||"model:text"==e||super.is(e)}toJSON(){const e=super.toJSON();return e.data=this.data,e}_clone(){return new ps(this.data,this.getAttributes())}static fromJSON(e){return new ps(e.data,e.attributes)}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class ms{constructor(e,t,n){if(this.textNode=e,t<0||t>e.offsetSize)throw new fn.b("model-textproxy-wrong-offsetintext: Given offsetInText value is incorrect.",this);if(n<0||t+n>e.offsetSize)throw new fn.b("model-textproxy-wrong-length: Given length value is incorrect.",this);this.data=e.data.substring(t,t+n),this.offsetInText=t}get startOffset(){return null!==this.textNode.startOffset?this.textNode.startOffset+this.offsetInText:null}get offsetSize(){return this.data.length}get endOffset(){return null!==this.startOffset?this.startOffset+this.offsetSize:null}get isPartial(){return this.offsetSize!==this.textNode.offsetSize}get parent(){return this.textNode.parent}get root(){return this.textNode.root}is(e){return"textProxy"==e||"model:textProxy"==e}getPath(){const e=this.textNode.getPath();return e.length>0&&(e[e.length-1]+=this.offsetInText),e}getAncestors(e={includeSelf:!1,parentFirst:!1}){const t=[];let n=e.includeSelf?this:this.parent;for(;n;)t[e.parentFirst?"push":"unshift"](n),n=n.parent;return t}hasAttribute(e){return this.textNode.hasAttribute(e)}getAttribute(e){return this.textNode.getAttribute(e)}getAttributes(){return this.textNode.getAttributes()}getAttributeKeys(){return this.textNode.getAttributeKeys()}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class gs{constructor(e){this._nodes=[],e&&this._insertNodes(0,e)}[Symbol.iterator](){return this._nodes[Symbol.iterator]()}get length(){return this._nodes.length}get maxOffset(){return this._nodes.reduce((e,t)=>e+t.offsetSize,0)}getNode(e){return this._nodes[e]||null}getNodeIndex(e){const t=this._nodes.indexOf(e);return-1==t?null:t}getNodeStartOffset(e){const t=this.getNodeIndex(e);return null===t?null:this._nodes.slice(0,t).reduce((e,t)=>e+t.offsetSize,0)}indexToOffset(e){if(e==this._nodes.length)return this.maxOffset;const t=this._nodes[e];if(!t)throw new fn.b("model-nodelist-index-out-of-bounds: Given index cannot be found in the node list.",this);return this.getNodeStartOffset(t)}offsetToIndex(e){let t=0;for(const n of this._nodes){if(e>=t&&e<t+n.offsetSize)return this.getNodeIndex(n);t+=n.offsetSize}if(t!=e)throw new fn.b("model-nodelist-offset-out-of-bounds: Given offset cannot be found in the node list.",this,{offset:e,nodeList:this});return this.length}_insertNodes(e,t){for(const e of t)if(!(e instanceof fs))throw new fn.b("model-nodelist-insertNodes-not-node: Trying to insert an object which is not a Node instance.",this);this._nodes.splice(e,0,...t)}_removeNodes(e,t=1){return this._nodes.splice(e,t)}toJSON(){return this._nodes.map(e=>e.toJSON())}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class bs extends fs{constructor(e,t,n){super(t),this.name=e,this._children=new gs,n&&this._insertChild(0,n)}get childCount(){return this._children.length}get maxOffset(){return this._children.maxOffset}get isEmpty(){return 0===this.childCount}is(e,t=null){const n=e.replace(/^model:/,"");return t?"element"==n&&t==this.name:"element"==n||n==this.name||super.is(e)}getChild(e){return this._children.getNode(e)}getChildren(){return this._children[Symbol.iterator]()}getChildIndex(e){return this._children.getNodeIndex(e)}getChildStartOffset(e){return this._children.getNodeStartOffset(e)}offsetToIndex(e){return this._children.offsetToIndex(e)}getNodeByPath(e){let t=this;for(const n of e)t=t.getChild(t.offsetToIndex(n));return t}toJSON(){const e=super.toJSON();if(e.name=this.name,this._children.length>0){e.children=[];for(const t of this._children)e.children.push(t.toJSON())}return e}_clone(e=!1){const t=e?Array.from(this._children).map(e=>e._clone(!0)):null;return new bs(this.name,this.getAttributes(),t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const n=function(e){if("string"==typeof e)return[new ps(e)];Dn(e)||(e=[e]);return Array.from(e).map(e=>"string"==typeof e?new ps(e):e instanceof ms?new ps(e.data,e.getAttributes()):e)}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/(t);for(const e of n)null!==e.parent&&e._remove(),e.parent=this;this._children._insertNodes(e,n)}_removeChildren(e,t=1){const n=this._children._removeNodes(e,t);for(const e of n)e.parent=null;return n}static fromJSON(e){let t=null;if(e.children){t=[];for(const n of e.children)n.name?t.push(bs.fromJSON(n)):t.push(ps.fromJSON(n))}return new bs(e.name,e.attributes,t)}}class ws{constructor(e={}){if(!e.boundaries&&!e.startPosition)throw new fn.b("model-tree-walker-no-start-position: Neither boundaries nor starting position have been defined.",null);const t=e.direction||"forward";if("forward"!=t&&"backward"!=t)throw new fn.b("model-tree-walker-unknown-direction: Only `backward` and `forward` direction allowed.",e,{direction:t});this.direction=t,this.boundaries=e.boundaries||null,e.startPosition?this.position=e.startPosition.clone():this.position=_s._createAt(this.boundaries["backward"==this.direction?"end":"start"]),this.position.stickiness="toNone",this.singleCharacters=!!e.singleCharacters,this.shallow=!!e.shallow,this.ignoreElementEnd=!!e.ignoreElementEnd,this._boundaryStartParent=this.boundaries?this.boundaries.start.parent:null,this._boundaryEndParent=this.boundaries?this.boundaries.end.parent:null,this._visitedParent=this.position.parent}[Symbol.iterator](){return this}skip(e){let t,n,o,i;do{o=this.position,i=this._visitedParent,({done:t,value:n}=this.next())}while(!t&&e(n));t||(this.position=o,this._visitedParent=i)}next(){return"forward"==this.direction?this._next():this._previous()}_next(){const e=this.position,t=this.position.clone(),n=this._visitedParent;if(null===n.parent&&t.offset===n.maxOffset)return{done:!0};if(n===this._boundaryEndParent&&t.offset==this.boundaries.end.offset)return{done:!0};const o=t.textNode?t.textNode:t.nodeAfter;if(o instanceof bs)return this.shallow?t.offset++:(t.path.push(0),this._visitedParent=o),this.position=t,ks("elementStart",o,e,t,1);if(o instanceof ps){let i;if(this.singleCharacters)i=1;else{let e=o.endOffset;this._boundaryEndParent==n&&this.boundaries.end.offset<e&&(e=this.boundaries.end.offset),i=e-t.offset}const r=t.offset-o.startOffset,s=new ms(o,r,i);return t.offset+=i,this.position=t,ks("text",s,e,t,i)}return t.path.pop(),t.offset++,this.position=t,this._visitedParent=n.parent,this.ignoreElementEnd?this._next():ks("elementEnd",n,e,t)}_previous(){const e=this.position,t=this.position.clone(),n=this._visitedParent;if(null===n.parent&&0===t.offset)return{done:!0};if(n==this._boundaryStartParent&&t.offset==this.boundaries.start.offset)return{done:!0};const o=t.textNode?t.textNode:t.nodeBefore;if(o instanceof bs)return t.offset--,this.shallow?(this.position=t,ks("elementStart",o,e,t,1)):(t.path.push(o.maxOffset),this.position=t,this._visitedParent=o,this.ignoreElementEnd?this._previous():ks("elementEnd",o,e,t));if(o instanceof ps){let i;if(this.singleCharacters)i=1;else{let e=o.startOffset;this._boundaryStartParent==n&&this.boundaries.start.offset>e&&(e=this.boundaries.start.offset),i=t.offset-e}const r=t.offset-o.startOffset,s=new ms(o,r-i,i);return t.offset-=i,this.position=t,ks("text",s,e,t,i)}return t.path.pop(),this.position=t,this._visitedParent=n.parent,ks("elementStart",n,e,t,1)}}function ks(e,t,n,o,i){return{done:!1,value:{type:e,item:t,previousPosition:n,nextPosition:o,length:i}}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class _s{constructor(e,t,n="toNone"){if(!e.is("element")&&!e.is("documentFragment"))throw new fn.b("model-position-root-invalid: Position root invalid.",e);if(!(t instanceof Array)||0===t.length)throw new fn.b("model-position-path-incorrect-format: Position path must be an array with at least one item.",e,{path:t});t=e.getPath().concat(t),e=e.root,this.root=e,this.path=t,this.stickiness=n}get offset(){return to(this.path)}set offset(e){this.path[this.path.length-1]=e}get parent(){let e=this.root;for(let t=0;t<this.path.length-1;t++)if(e=e.getChild(e.offsetToIndex(this.path[t])),!e)throw new fn.b("model-position-path-incorrect: The position's path is incorrect.",this,{position:this});if(e.is("text"))throw new fn.b("model-position-path-incorrect: The position's path is incorrect.",this,{position:this});return e}get index(){return this.parent.offsetToIndex(this.offset)}get textNode(){const e=this.parent.getChild(this.index);return e instanceof ps&&e.startOffset<this.offset?e:null}get nodeAfter(){return null===this.textNode?this.parent.getChild(this.index):null}get nodeBefore(){return null===this.textNode?this.parent.getChild(this.index-1):null}get isAtStart(){return 0===this.offset}get isAtEnd(){return this.offset==this.parent.maxOffset}compareWith(e){if(this.root!=e.root)return"different";const t=In(this.path,e.path);switch(t){case"same":return"same";case"prefix":return"before";case"extension":return"after";default:return this.path[t]<e.path[t]?"before":"after"}}getLastMatchingPosition(e,t={}){t.startPosition=this;const n=new ws(t);return n.skip(e),n.position}getParentPath(){return this.path.slice(0,-1)}getAncestors(){return this.parent.is("documentFragment")?[this.parent]:this.parent.getAncestors({includeSelf:!0})}getCommonPath(e){if(this.root!=e.root)return[];const t=In(this.path,e.path),n="string"==typeof t?Math.min(this.path.length,e.path.length):t;return this.path.slice(0,n)}getCommonAncestor(e){const t=this.getAncestors(),n=e.getAncestors();let o=0;for(;t[o]==n[o]&&t[o];)o++;return 0===o?null:t[o-1]}getShiftedBy(e){const t=this.clone(),n=t.offset+e;return t.offset=n<0?0:n,t}isAfter(e){return"after"==this.compareWith(e)}isBefore(e){return"before"==this.compareWith(e)}isEqual(e){return"same"==this.compareWith(e)}isTouching(e){let t=null,n=null;switch(this.compareWith(e)){case"same":return!0;case"before":t=_s._createAt(this),n=_s._createAt(e);break;case"after":t=_s._createAt(e),n=_s._createAt(this);break;default:return!1}let o=t.parent;for(;t.path.length+n.path.length;){if(t.isEqual(n))return!0;if(t.path.length>n.path.length){if(t.offset!==o.maxOffset)return!1;t.path=t.path.slice(0,-1),o=o.parent,t.offset++}else{if(0!==n.offset)return!1;n.path=n.path.slice(0,-1)}}}is(e){return"position"==e||"model:position"==e}hasSameParentAs(e){if(this.root!==e.root)return!1;return"same"==In(this.getParentPath(),e.getParentPath())}getTransformedByOperation(e){let t;switch(e.type){case"insert":t=this._getTransformedByInsertOperation(e);break;case"move":case"remove":case"reinsert":t=this._getTransformedByMoveOperation(e);break;case"split":t=this._getTransformedBySplitOperation(e);break;case"merge":t=this._getTransformedByMergeOperation(e);break;default:t=_s._createAt(this)}return t}_getTransformedByInsertOperation(e){return this._getTransformedByInsertion(e.position,e.howMany)}_getTransformedByMoveOperation(e){return this._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany)}_getTransformedBySplitOperation(e){const t=e.movedRange;return t.containsPosition(this)||t.start.isEqual(this)&&"toNext"==this.stickiness?this._getCombined(e.splitPosition,e.moveTargetPosition):e.graveyardPosition?this._getTransformedByMove(e.graveyardPosition,e.insertionPosition,1):this._getTransformedByInsertion(e.insertionPosition,1)}_getTransformedByMergeOperation(e){const t=e.movedRange;let n;return t.containsPosition(this)||t.start.isEqual(this)?(n=this._getCombined(e.sourcePosition,e.targetPosition),e.sourcePosition.isBefore(e.targetPosition)&&(n=n._getTransformedByDeletion(e.deletionPosition,1))):n=this.isEqual(e.deletionPosition)?_s._createAt(e.deletionPosition):this._getTransformedByMove(e.deletionPosition,e.graveyardPosition,1),n}_getTransformedByDeletion(e,t){const n=_s._createAt(this);if(this.root!=e.root)return n;if("same"==In(e.getParentPath(),this.getParentPath())){if(e.offset<this.offset){if(e.offset+t>this.offset)return null;n.offset-=t}}else if("prefix"==In(e.getParentPath(),this.getParentPath())){const o=e.path.length-1;if(e.offset<=this.path[o]){if(e.offset+t>this.path[o])return null;n.path[o]-=t}}return n}_getTransformedByInsertion(e,t){const n=_s._createAt(this);if(this.root!=e.root)return n;if("same"==In(e.getParentPath(),this.getParentPath()))(e.offset<this.offset||e.offset==this.offset&&"toPrevious"!=this.stickiness)&&(n.offset+=t);else if("prefix"==In(e.getParentPath(),this.getParentPath())){const o=e.path.length-1;e.offset<=this.path[o]&&(n.path[o]+=t)}return n}_getTransformedByMove(e,t,n){if(t=t._getTransformedByDeletion(e,n),e.isEqual(t))return _s._createAt(this);const o=this._getTransformedByDeletion(e,n);return null===o||e.isEqual(this)&&"toNext"==this.stickiness||e.getShiftedBy(n).isEqual(this)&&"toPrevious"==this.stickiness?this._getCombined(e,t):o._getTransformedByInsertion(t,n)}_getCombined(e,t){const n=e.path.length-1,o=_s._createAt(t);return o.stickiness=this.stickiness,o.offset=o.offset+this.path[n]-e.offset,o.path=o.path.concat(this.path.slice(n+1)),o}toJSON(){return{root:this.root.toJSON(),path:Array.from(this.path),stickiness:this.stickiness}}clone(){return new this.constructor(this.root,this.path,this.stickiness)}static _createAt(e,t,n="toNone"){if(e instanceof _s)return new _s(e.root,e.path,e.stickiness);{const o=e;if("end"==t)t=o.maxOffset;else{if("before"==t)return this._createBefore(o,n);if("after"==t)return this._createAfter(o,n);if(0!==t&&!t)throw new fn.b("model-createPositionAt-offset-required: Model#createPositionAt() requires the offset when the first parameter is a model item.",[this,e])}if(!o.is("element")&&!o.is("documentFragment"))throw new fn.b("model-position-parent-incorrect: Position parent have to be a element or document fragment.",[this,e]);const i=o.getPath();return i.push(t),new this(o.root,i,n)}}static _createAfter(e,t){if(!e.parent)throw new fn.b("model-position-after-root: You cannot make a position after root.",[this,e],{root:e});return this._createAt(e.parent,e.endOffset,t)}static _createBefore(e,t){if(!e.parent)throw new fn.b("model-position-before-root: You cannot make a position before root.",e,{root:e});return this._createAt(e.parent,e.startOffset,t)}static fromJSON(e,t){if("$graveyard"===e.root){const n=new _s(t.graveyard,e.path);return n.stickiness=e.stickiness,n}if(!t.getRoot(e.root))throw new fn.b("model-position-fromjson-no-root: Cannot create position for document. Root with specified name does not exist.",t,{rootName:e.root});return new _s(t.getRoot(e.root),e.path,e.stickiness)}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class vs{constructor(e,t=null){this.start=_s._createAt(e),this.end=t?_s._createAt(t):_s._createAt(e),this.start.stickiness=this.isCollapsed?"toNone":"toNext",this.end.stickiness=this.isCollapsed?"toNone":"toPrevious"}*[Symbol.iterator](){yield*new ws({boundaries:this,ignoreElementEnd:!0})}get isCollapsed(){return this.start.isEqual(this.end)}get isFlat(){return"same"==In(this.start.getParentPath(),this.end.getParentPath())}get root(){return this.start.root}containsPosition(e){return e.isAfter(this.start)&&e.isBefore(this.end)}containsRange(e,t=!1){e.isCollapsed&&(t=!1);const n=this.containsPosition(e.start)||t&&this.start.isEqual(e.start),o=this.containsPosition(e.end)||t&&this.end.isEqual(e.end);return n&&o}containsItem(e){const t=_s._createBefore(e);return this.containsPosition(t)||this.start.isEqual(t)}is(e){return"range"==e||"model:range"==e}isEqual(e){return this.start.isEqual(e.start)&&this.end.isEqual(e.end)}isIntersecting(e){return this.start.isBefore(e.end)&&this.end.isAfter(e.start)}getDifference(e){const t=[];return this.isIntersecting(e)?(this.containsPosition(e.start)&&t.push(new vs(this.start,e.start)),this.containsPosition(e.end)&&t.push(new vs(e.end,this.end))):t.push(new vs(this.start,this.end)),t}getIntersection(e){if(this.isIntersecting(e)){let t=this.start,n=this.end;return this.containsPosition(e.start)&&(t=e.start),this.containsPosition(e.end)&&(n=e.end),new vs(t,n)}return null}getMinimalFlatRanges(){const e=[],t=this.start.getCommonPath(this.end).length,n=_s._createAt(this.start);let o=n.parent;for(;n.path.length>t+1;){const t=o.maxOffset-n.offset;0!==t&&e.push(new vs(n,n.getShiftedBy(t))),n.path=n.path.slice(0,-1),n.offset++,o=o.parent}for(;n.path.length<=this.end.path.length;){const t=this.end.path[n.path.length-1],o=t-n.offset;0!==o&&e.push(new vs(n,n.getShiftedBy(o))),n.offset=t,n.path.push(0)}return e}getWalker(e={}){return e.boundaries=this,new ws(e)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const t=new ws(e);for(const e of t)yield e.item}*getPositions(e={}){e.boundaries=this;const t=new ws(e);yield t.position;for(const e of t)yield e.nextPosition}getTransformedByOperation(e){switch(e.type){case"insert":return this._getTransformedByInsertOperation(e);case"move":case"remove":case"reinsert":return this._getTransformedByMoveOperation(e);case"split":return[this._getTransformedBySplitOperation(e)];case"merge":return[this._getTransformedByMergeOperation(e)]}return[new vs(this.start,this.end)]}getTransformedByOperations(e){const t=[new vs(this.start,this.end)];for(const n of e)for(let e=0;e<t.length;e++){const o=t[e].getTransformedByOperation(n);t.splice(e,1,...o),e+=o.length-1}for(let e=0;e<t.length;e++){const n=t[e];for(let o=e+1;o<t.length;o++){const e=t[o];(n.containsRange(e)||e.containsRange(n)||n.isEqual(e))&&t.splice(o,1)}}return t}getCommonAncestor(){return this.start.getCommonAncestor(this.end)}getContainedElement(){if(this.isCollapsed)return null;const e=this.start.nodeAfter,t=this.end.nodeBefore;return e&&e.is("element")&&e===t?e:null}toJSON(){return{start:this.start.toJSON(),end:this.end.toJSON()}}clone(){return new this.constructor(this.start,this.end)}_getTransformedByInsertOperation(e,t=!1){return this._getTransformedByInsertion(e.position,e.howMany,t)}_getTransformedByMoveOperation(e,t=!1){const n=e.sourcePosition,o=e.howMany,i=e.targetPosition;return this._getTransformedByMove(n,i,o,t)}_getTransformedBySplitOperation(e){const t=this.start._getTransformedBySplitOperation(e);let n=this.end._getTransformedBySplitOperation(e);return this.end.isEqual(e.insertionPosition)&&(n=this.end.getShiftedBy(1)),t.root!=n.root&&(n=this.end.getShiftedBy(-1)),new vs(t,n)}_getTransformedByMergeOperation(e){if(this.start.isEqual(e.targetPosition)&&this.end.isEqual(e.deletionPosition))return new vs(this.start);let t=this.start._getTransformedByMergeOperation(e),n=this.end._getTransformedByMergeOperation(e);return t.root!=n.root&&(n=this.end.getShiftedBy(-1)),t.isAfter(n)?(e.sourcePosition.isBefore(e.targetPosition)?(t=_s._createAt(n),t.offset=0):(e.deletionPosition.isEqual(t)||(n=e.deletionPosition),t=e.targetPosition),new vs(t,n)):new vs(t,n)}_getTransformedByInsertion(e,t,n=!1){if(n&&this.containsPosition(e))return[new vs(this.start,e),new vs(e.getShiftedBy(t),this.end._getTransformedByInsertion(e,t))];{const n=new vs(this.start,this.end);return n.start=n.start._getTransformedByInsertion(e,t),n.end=n.end._getTransformedByInsertion(e,t),[n]}}_getTransformedByMove(e,t,n,o=!1){if(this.isCollapsed){const o=this.start._getTransformedByMove(e,t,n);return[new vs(o)]}const i=vs._createFromPositionAndShift(e,n),r=t._getTransformedByDeletion(e,n);if(this.containsPosition(t)&&!o&&(i.containsPosition(this.start)||i.containsPosition(this.end))){const o=this.start._getTransformedByMove(e,t,n),i=this.end._getTransformedByMove(e,t,n);return[new vs(o,i)]}let s;const a=this.getDifference(i);let c=null;const l=this.getIntersection(i);if(1==a.length?c=new vs(a[0].start._getTransformedByDeletion(e,n),a[0].end._getTransformedByDeletion(e,n)):2==a.length&&(c=new vs(this.start,this.end._getTransformedByDeletion(e,n))),s=c?c._getTransformedByInsertion(r,n,null!==l||o):[],l){const e=new vs(l.start._getCombined(i.start,r),l.end._getCombined(i.start,r));2==s.length?s.splice(1,0,e):s.push(e)}return s}_getTransformedByDeletion(e,t){let n=this.start._getTransformedByDeletion(e,t),o=this.end._getTransformedByDeletion(e,t);return null==n&&null==o?null:(null==n&&(n=e),null==o&&(o=e),new vs(n,o))}static _createFromPositionAndShift(e,t){const n=e,o=e.getShiftedBy(t);return t>0?new this(n,o):new this(o,n)}static _createIn(e){return new this(_s._createAt(e,0),_s._createAt(e,e.maxOffset))}static _createOn(e){return this._createFromPositionAndShift(_s._createBefore(e),e.offsetSize)}static _createFromRanges(e){if(0===e.length)throw new fn.b("range-create-from-ranges-empty-array: At least one range has to be passed.",null);if(1==e.length)return e[0].clone();const t=e[0];e.sort((e,t)=>e.start.isAfter(t.start)?1:-1);const n=e.indexOf(t),o=new this(t.start,t.end);if(n>0)for(let t=n-1;e[t].end.isEqual(o.start);t++)o.start=_s._createAt(e[t].start);for(let t=n+1;t<e.length&&e[t].start.isEqual(o.end);t++)o.end=_s._createAt(e[t].end);return o}static fromJSON(e,t){return new this(_s.fromJSON(e.start,t),_s.fromJSON(e.end,t))}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class ys{constructor(){this._modelToViewMapping=new WeakMap,this._viewToModelMapping=new WeakMap,this._viewToModelLengthCallbacks=new Map,this._markerNameToElements=new Map,this._elementToMarkerNames=new Map,this._unboundMarkerNames=new Set,this.on("modelToViewPosition",(e,t)=>{if(t.viewPosition)return;const n=this._modelToViewMapping.get(t.modelPosition.parent);t.viewPosition=this._findPositionIn(n,t.modelPosition.offset)},{priority:"low"}),this.on("viewToModelPosition",(e,t)=>{if(t.modelPosition)return;const n=this.findMappedViewAncestor(t.viewPosition),o=this._viewToModelMapping.get(n),i=this._toModelOffset(t.viewPosition.parent,t.viewPosition.offset,n);t.modelPosition=_s._createAt(o,i)},{priority:"low"})}bindElements(e,t){this._modelToViewMapping.set(e,t),this._viewToModelMapping.set(t,e)}unbindViewElement(e){const t=this.toModelElement(e);if(this._viewToModelMapping.delete(e),this._elementToMarkerNames.has(e))for(const t of this._elementToMarkerNames.get(e))this._unboundMarkerNames.add(t);this._modelToViewMapping.get(t)==e&&this._modelToViewMapping.delete(t)}unbindModelElement(e){const t=this.toViewElement(e);this._modelToViewMapping.delete(e),this._viewToModelMapping.get(t)==e&&this._viewToModelMapping.delete(t)}bindElementToMarker(e,t){const n=this._markerNameToElements.get(t)||new Set;n.add(e);const o=this._elementToMarkerNames.get(e)||new Set;o.add(t),this._markerNameToElements.set(t,n),this._elementToMarkerNames.set(e,o)}unbindElementFromMarkerName(e,t){const n=this._markerNameToElements.get(t);n&&(n.delete(e),0==n.size&&this._markerNameToElements.delete(t));const o=this._elementToMarkerNames.get(e);o&&(o.delete(t),0==o.size&&this._elementToMarkerNames.delete(e))}flushUnboundMarkerNames(){const e=Array.from(this._unboundMarkerNames);return this._unboundMarkerNames.clear(),e}clearBindings(){this._modelToViewMapping=new WeakMap,this._viewToModelMapping=new WeakMap,this._markerNameToElements=new Map,this._elementToMarkerNames=new Map,this._unboundMarkerNames=new Set}toModelElement(e){return this._viewToModelMapping.get(e)}toViewElement(e){return this._modelToViewMapping.get(e)}toModelRange(e){return new vs(this.toModelPosition(e.start),this.toModelPosition(e.end))}toViewRange(e){return new ti(this.toViewPosition(e.start),this.toViewPosition(e.end))}toModelPosition(e){const t={viewPosition:e,mapper:this};return this.fire("viewToModelPosition",t),t.modelPosition}toViewPosition(e,t={isPhantom:!1}){const n={modelPosition:e,mapper:this,isPhantom:t.isPhantom};return this.fire("modelToViewPosition",n),n.viewPosition}markerNameToElements(e){const t=this._markerNameToElements.get(e);if(!t)return null;const n=new Set;for(const e of t)if(e.is("attributeElement"))for(const t of e.getElementsWithSameId())n.add(t);else n.add(e);return n}registerViewToModelLength(e,t){this._viewToModelLengthCallbacks.set(e,t)}findMappedViewAncestor(e){let t=e.parent;for(;!this._viewToModelMapping.has(t);)t=t.parent;return t}_toModelOffset(e,t,n){if(n!=e){return this._toModelOffset(e.parent,e.index,n)+this._toModelOffset(e,t,e)}if(e.is("text"))return t;let o=0;for(let n=0;n<t;n++)o+=this.getModelLength(e.getChild(n));return o}getModelLength(e){if(this._viewToModelLengthCallbacks.get(e.name)){return this._viewToModelLengthCallbacks.get(e.name)(e)}if(this._viewToModelMapping.has(e))return 1;if(e.is("text"))return e.data.length;if(e.is("uiElement"))return 0;{let t=0;for(const n of e.getChildren())t+=this.getModelLength(n);return t}}_findPositionIn(e,t){let n,o=0,i=0,r=0;if(e.is("text"))return new ei(e,t);for(;i<t;)n=e.getChild(r),o=this.getModelLength(n),i+=o,r++;return i==t?this._moveViewPositionToTextNode(new ei(e,r)):this._findPositionIn(n,t-(i-o))}_moveViewPositionToTextNode(e){const t=e.nodeBefore,n=e.nodeAfter;return t instanceof Mn?new ei(t,t.data.length):n instanceof Mn?new ei(n,0):e}}xn(ys,gn);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
class xs{constructor(){this._consumable=new Map,this._textProxyRegistry=new Map}add(e,t){t=Cs(t),e instanceof ms&&(e=this._getSymbolForTextProxy(e)),this._consumable.has(e)||this._consumable.set(e,new Map),this._consumable.get(e).set(t,!0)}consume(e,t){return t=Cs(t),e instanceof ms&&(e=this._getSymbolForTextProxy(e)),!!this.test(e,t)&&(this._consumable.get(e).set(t,!1),!0)}test(e,t){t=Cs(t),e instanceof ms&&(e=this._getSymbolForTextProxy(e));const n=this._consumable.get(e);if(void 0===n)return null;const o=n.get(t);return void 0===o?null:o}revert(e,t){t=Cs(t),e instanceof ms&&(e=this._getSymbolForTextProxy(e));const n=this.test(e,t);return!1===n?(this._consumable.get(e).set(t,!0),!0):!0!==n&&null}_getSymbolForTextProxy(e){let t=null;const n=this._textProxyRegistry.get(e.startOffset);if(n){const o=n.get(e.endOffset);o&&(t=o.get(e.parent))}return t||(t=this._addSymbolForTextProxy(e.startOffset,e.endOffset,e.parent)),t}_addSymbolForTextProxy(e,t,n){const o=Symbol("textProxySymbol");let i,r;return i=this._textProxyRegistry.get(e),i||(i=new Map,this._textProxyRegistry.set(e,i)),r=i.get(t),r||(r=new Map,i.set(t,r)),r.set(n,o),o}}function Cs(e){const t=e.split(":");return t.length>1?t[0]+":"+t[1]:t[0]}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class As{constructor(e){this.conversionApi=Lo({dispatcher:this},e)}convertChanges(e,t,n){for(const t of e.getMarkersToRemove())this.convertMarkerRemove(t.name,t.range,n);for(const t of e.getChanges())"insert"==t.type?this.convertInsert(vs._createFromPositionAndShift(t.position,t.length),n):"remove"==t.type?this.convertRemove(t.position,t.length,t.name,n):this.convertAttribute(t.range,t.attributeKey,t.attributeOldValue,t.attributeNewValue,n);for(const e of this.conversionApi.mapper.flushUnboundMarkerNames()){const o=t.get(e).getRange();this.convertMarkerRemove(e,o,n),this.convertMarkerAdd(e,o,n)}for(const t of e.getMarkersToAdd())this.convertMarkerAdd(t.name,t.range,n)}convertInsert(e,t){this.conversionApi.writer=t,this.conversionApi.consumable=this._createInsertConsumable(e);for(const t of e){const e=t.item,n={item:e,range:vs._createFromPositionAndShift(t.previousPosition,t.length)};this._testAndFire("insert",n);for(const t of e.getAttributeKeys())n.attributeKey=t,n.attributeOldValue=null,n.attributeNewValue=e.getAttribute(t),this._testAndFire(`attribute:${t}`,n)}this._clearConversionApi()}convertRemove(e,t,n,o){this.conversionApi.writer=o,this.fire("remove:"+n,{position:e,length:t},this.conversionApi),this._clearConversionApi()}convertAttribute(e,t,n,o,i){this.conversionApi.writer=i,this.conversionApi.consumable=this._createConsumableForRange(e,`attribute:${t}`);for(const i of e){const e={item:i.item,range:vs._createFromPositionAndShift(i.previousPosition,i.length),attributeKey:t,attributeOldValue:n,attributeNewValue:o};this._testAndFire(`attribute:${t}`,e)}this._clearConversionApi()}convertSelection(e,t,n){const o=Array.from(t.getMarkersAtPosition(e.getFirstPosition()));if(this.conversionApi.writer=n,this.conversionApi.consumable=this._createSelectionConsumable(e,o),this.fire("selection",{selection:e},this.conversionApi),e.isCollapsed){for(const t of o){const n=t.getRange();if(!Ts(e.getFirstPosition(),t,this.conversionApi.mapper))continue;const o={item:e,markerName:t.name,markerRange:n};this.conversionApi.consumable.test(e,"addMarker:"+t.name)&&this.fire("addMarker:"+t.name,o,this.conversionApi)}for(const t of e.getAttributeKeys()){const n={item:e,range:e.getFirstRange(),attributeKey:t,attributeOldValue:null,attributeNewValue:e.getAttribute(t)};this.conversionApi.consumable.test(e,"attribute:"+n.attributeKey)&&this.fire("attribute:"+n.attributeKey+":$text",n,this.conversionApi)}this._clearConversionApi()}}convertMarkerAdd(e,t,n){if(!t.root.document||"$graveyard"==t.root.rootName)return;this.conversionApi.writer=n;const o="addMarker:"+e,i=new xs;if(i.add(t,o),this.conversionApi.consumable=i,this.fire(o,{markerName:e,markerRange:t},this.conversionApi),i.test(t,o)){this.conversionApi.consumable=this._createConsumableForRange(t,o);for(const n of t.getItems()){if(!this.conversionApi.consumable.test(n,o))continue;const i={item:n,range:vs._createOn(n),markerName:e,markerRange:t};this.fire(o,i,this.conversionApi)}this._clearConversionApi()}}convertMarkerRemove(e,t,n){t.root.document&&"$graveyard"!=t.root.rootName&&(this.conversionApi.writer=n,this.fire("removeMarker:"+e,{markerName:e,markerRange:t},this.conversionApi),this._clearConversionApi())}_createInsertConsumable(e){const t=new xs;for(const n of e){const e=n.item;t.add(e,"insert");for(const n of e.getAttributeKeys())t.add(e,"attribute:"+n)}return t}_createConsumableForRange(e,t){const n=new xs;for(const o of e.getItems())n.add(o,t);return n}_createSelectionConsumable(e,t){const n=new xs;n.add(e,"selection");for(const o of t)n.add(e,"addMarker:"+o.name);for(const t of e.getAttributeKeys())n.add(e,"attribute:"+t);return n}_testAndFire(e,t){if(!this.conversionApi.consumable.test(t.item,e))return;const n=t.item.name||"$text";this.fire(e+":"+n,t,this.conversionApi)}_clearConversionApi(){delete this.conversionApi.writer,delete this.conversionApi.consumable}}function Ts(e,t,n){const o=t.getRange(),i=Array.from(e.getAncestors());return i.shift(),i.reverse(),!i.some(e=>{if(o.containsItem(e)){return!!n.toViewElement(e).getCustomProperty("addHighlight")}})}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/xn(As,gn);class Ps{constructor(e,t,n){this._lastRangeBackward=!1,this._ranges=[],this._attrs=new Map,e&&this.setTo(e,t,n)}get anchor(){if(this._ranges.length>0){const e=this._ranges[this._ranges.length-1];return this._lastRangeBackward?e.end:e.start}return null}get focus(){if(this._ranges.length>0){const e=this._ranges[this._ranges.length-1];return this._lastRangeBackward?e.start:e.end}return null}get isCollapsed(){return 1===this._ranges.length&&this._ranges[0].isCollapsed}get rangeCount(){return this._ranges.length}get isBackward(){return!this.isCollapsed&&this._lastRangeBackward}isEqual(e){if(this.rangeCount!=e.rangeCount)return!1;if(0===this.rangeCount)return!0;if(!this.anchor.isEqual(e.anchor)||!this.focus.isEqual(e.focus))return!1;for(const t of this._ranges){let n=!1;for(const o of e._ranges)if(t.isEqual(o)){n=!0;break}if(!n)return!1}return!0}*getRanges(){for(const e of this._ranges)yield new vs(e.start,e.end)}getFirstRange(){let e=null;for(const t of this._ranges)e&&!t.start.isBefore(e.start)||(e=t);return e?new vs(e.start,e.end):null}getLastRange(){let e=null;for(const t of this._ranges)e&&!t.end.isAfter(e.end)||(e=t);return e?new vs(e.start,e.end):null}getFirstPosition(){const e=this.getFirstRange();return e?e.start.clone():null}getLastPosition(){const e=this.getLastRange();return e?e.end.clone():null}setTo(e,t,n){if(null===e)this._setRanges([]);else if(e instanceof Ps)this._setRanges(e.getRanges(),e.isBackward);else if(e&&"function"==typeof e.getRanges)this._setRanges(e.getRanges(),e.isBackward);else if(e instanceof vs)this._setRanges([e],!!t&&!!t.backward);else if(e instanceof _s)this._setRanges([new vs(e)]);else if(e instanceof fs){const o=!!n&&!!n.backward;let i;if("in"==t)i=vs._createIn(e);else if("on"==t)i=vs._createOn(e);else{if(void 0===t)throw new fn.b("model-selection-setTo-required-second-parameter: selection.setTo requires the second parameter when the first parameter is a node.",[this,e]);i=new vs(_s._createAt(e,t))}this._setRanges([i],o)}else{if(!Dn(e))throw new fn.b("model-selection-setTo-not-selectable: Cannot set the selection to the given place.",[this,e]);this._setRanges(e,t&&!!t.backward)}}_setRanges(e,t=!1){const n=(e=Array.from(e)).some(t=>{if(!(t instanceof vs))throw new fn.b("model-selection-set-ranges-not-range: Selection range set to an object that is not an instance of model.Range.",[this,e]);return this._ranges.every(e=>!e.isEqual(t))});if(e.length!==this._ranges.length||n){this._removeAllRanges();for(const t of e)this._pushRange(t);this._lastRangeBackward=!!t,this.fire("change:range",{directChange:!0})}}setFocus(e,t){if(null===this.anchor)throw new fn.b("model-selection-setFocus-no-ranges: Cannot set selection focus if there are no ranges in selection.",[this,e]);const n=_s._createAt(e,t);if("same"==n.compareWith(this.focus))return;const o=this.anchor;this._ranges.length&&this._popRange(),"before"==n.compareWith(o)?(this._pushRange(new vs(n,o)),this._lastRangeBackward=!0):(this._pushRange(new vs(o,n)),this._lastRangeBackward=!1),this.fire("change:range",{directChange:!0})}getAttribute(e){return this._attrs.get(e)}getAttributes(){return this._attrs.entries()}getAttributeKeys(){return this._attrs.keys()}hasAttribute(e){return this._attrs.has(e)}removeAttribute(e){this.hasAttribute(e)&&(this._attrs.delete(e),this.fire("change:attribute",{attributeKeys:[e],directChange:!0}))}setAttribute(e,t){this.getAttribute(e)!==t&&(this._attrs.set(e,t),this.fire("change:attribute",{attributeKeys:[e],directChange:!0}))}getSelectedElement(){return 1!==this.rangeCount?null:this.getFirstRange().getContainedElement()}is(e){return"selection"==e||"model:selection"==e}*getSelectedBlocks(){const e=new WeakSet;for(const t of this.getRanges()){const n=Rs(t.start,e);n&&Is(n,t)&&(yield n);for(const n of t.getWalker()){const o=n.item;"elementEnd"==n.type&&Ss(o,e,t)&&(yield o)}const o=Rs(t.end,e);o&&!t.end.isTouching(_s._createAt(o,0))&&Is(o,t)&&(yield o)}}containsEntireContent(e=this.anchor.root){const t=_s._createAt(e,0),n=_s._createAt(e,"end");return t.isTouching(this.getFirstPosition())&&n.isTouching(this.getLastPosition())}_pushRange(e){this._checkRange(e),this._ranges.push(new vs(e.start,e.end))}_checkRange(e){for(let t=0;t<this._ranges.length;t++)if(e.isIntersecting(this._ranges[t]))throw new fn.b("model-selection-range-intersects: Trying to add a range that intersects with another range in the selection.",[this,e],{addedRange:e,intersectingRange:this._ranges[t]})}_removeAllRanges(){for(;this._ranges.length>0;)this._popRange()}_popRange(){this._ranges.pop()}}function Es(e,t){return!t.has(e)&&(t.add(e),e.root.document.model.schema.isBlock(e)&&e.parent)}function Ss(e,t,n){return Es(e,t)&&Is(e,n)}function Rs(e,t){const n=e.parent.root.document.model.schema,o=e.parent.getAncestors({parentFirst:!0,includeSelf:!0});let i=!1;const r=o.find(e=>!i&&(i=n.isLimit(e),!i&&Es(e,t)));return o.forEach(e=>t.add(e)),r}function Is(e,t){const n=function(e){const t=e.root.document.model.schema;let n=e.parent;for(;n;){if(t.isBlock(n))return n;n=n.parent}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/(e);return!n||!t.containsRange(vs._createOn(n),!0)}xn(Ps,gn);class Os extends vs{constructor(e,t){super(e,t),Ns.call(this)}detach(){this.stopListening()}is(e){return"liveRange"==e||"model:liveRange"==e||super.is(e)}toRange(){return new vs(this.start,this.end)}static fromRange(e){return new Os(e.start,e.end)}}function Ns(){this.listenTo(this.root.document.model,"applyOperation",(e,t)=>{const n=t[0];n.isDocumentOperation&&Ms.call(this,n)},{priority:"low"})}function Ms(e){const t=this.getTransformedByOperation(e),n=vs._createFromRanges(t),o=!n.isEqual(this),i=function(e,t){switch(t.type){case"insert":return e.containsPosition(t.position);case"move":case"remove":case"reinsert":case"merge":return e.containsPosition(t.sourcePosition)||e.start.isEqual(t.sourcePosition)||e.containsPosition(t.targetPosition);case"split":return e.containsPosition(t.splitPosition)||e.containsPosition(t.insertionPosition)}return!1}(this,e);let r=null;if(o){"$graveyard"==n.root.rootName&&(r="remove"==e.type?e.sourcePosition:e.deletionPosition);const t=this.toRange();this.start=n.start,this.end=n.end,this.fire("change:range",t,{deletionPosition:r})}else i&&this.fire("change:content",this.toRange(),{deletionPosition:r})}xn(Os,gn);class Vs{constructor(e){this._selection=new Ds(e),this._selection.delegate("change:range").to(this),this._selection.delegate("change:attribute").to(this),this._selection.delegate("change:marker").to(this)}get isCollapsed(){return this._selection.isCollapsed}get anchor(){return this._selection.anchor}get focus(){return this._selection.focus}get rangeCount(){return this._selection.rangeCount}get hasOwnRange(){return this._selection.hasOwnRange}get isBackward(){return this._selection.isBackward}get isGravityOverridden(){return this._selection.isGravityOverridden}get markers(){return this._selection.markers}get _ranges(){return this._selection._ranges}getRanges(){return this._selection.getRanges()}getFirstPosition(){return this._selection.getFirstPosition()}getLastPosition(){return this._selection.getLastPosition()}getFirstRange(){return this._selection.getFirstRange()}getLastRange(){return this._selection.getLastRange()}getSelectedBlocks(){return this._selection.getSelectedBlocks()}getSelectedElement(){return this._selection.getSelectedElement()}containsEntireContent(e){return this._selection.containsEntireContent(e)}destroy(){this._selection.destroy()}getAttributeKeys(){return this._selection.getAttributeKeys()}getAttributes(){return this._selection.getAttributes()}getAttribute(e){return this._selection.getAttribute(e)}hasAttribute(e){return this._selection.hasAttribute(e)}refresh(){this._selection._updateMarkers(),this._selection._updateAttributes(!1)}is(e){return"selection"==e||"model:selection"==e||"documentSelection"==e||"model:documentSelection"==e}_setFocus(e,t){this._selection.setFocus(e,t)}_setTo(e,t,n){this._selection.setTo(e,t,n)}_setAttribute(e,t){this._selection.setAttribute(e,t)}_removeAttribute(e){this._selection.removeAttribute(e)}_getStoredAttributes(){return this._selection._getStoredAttributes()}_overrideGravity(){return this._selection.overrideGravity()}_restoreGravity(e){this._selection.restoreGravity(e)}static _getStoreAttributeKey(e){return"selection:"+e}static _isStoreAttributeKey(e){return e.startsWith("selection:")}}xn(Vs,gn);class Ds extends Ps{constructor(e){super(),this.markers=new Cn({idProperty:"name"}),this._model=e.model,this._document=e,this._attributePriority=new Map,this._fixGraveyardRangesData=[],this._hasChangedRange=!1,this._overriddenGravityRegister=new Set,this.listenTo(this._model,"applyOperation",(e,t)=>{const n=t[0];if(n.isDocumentOperation&&"marker"!=n.type&&"rename"!=n.type&&"noop"!=n.type){for(;this._fixGraveyardRangesData.length;){const{liveRange:e,sourcePosition:t}=this._fixGraveyardRangesData.shift();this._fixGraveyardSelection(e,t)}this._hasChangedRange&&(this._hasChangedRange=!1,this.fire("change:range",{directChange:!1}))}},{priority:"lowest"}),this.on("change:range",()=>{for(const e of this.getRanges())if(!this._document._validateSelectionRange(e))throw new fn.b("document-selection-wrong-position: Range from document selection starts or ends at incorrect position.",this,{range:e})}),this.listenTo(this._model.markers,"update",()=>this._updateMarkers()),this.listenTo(this._document,"change",(e,t)=>{!function(e,t){const n=e.document.differ;for(const o of n.getChanges()){if("insert"!=o.type)continue;const n=o.position.parent;o.length===n.maxOffset&&e.enqueueChange(t,e=>{const t=Array.from(n.getAttributeKeys()).filter(e=>e.startsWith("selection:"));for(const o of t)e.removeAttribute(o,n)})}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/(this._model,t)})}get isCollapsed(){return 0===this._ranges.length?this._document._getDefaultRange().isCollapsed:super.isCollapsed}get anchor(){return super.anchor||this._document._getDefaultRange().start}get focus(){return super.focus||this._document._getDefaultRange().end}get rangeCount(){return this._ranges.length?this._ranges.length:1}get hasOwnRange(){return this._ranges.length>0}get isGravityOverridden(){return!!this._overriddenGravityRegister.size}destroy(){for(let e=0;e<this._ranges.length;e++)this._ranges[e].detach();this.stopListening()}*getRanges(){this._ranges.length?yield*super.getRanges():yield this._document._getDefaultRange()}getFirstRange(){return super.getFirstRange()||this._document._getDefaultRange()}getLastRange(){return super.getLastRange()||this._document._getDefaultRange()}setTo(e,t,n){super.setTo(e,t,n),this._updateAttributes(!0),this._updateMarkers()}setFocus(e,t){super.setFocus(e,t),this._updateAttributes(!0),this._updateMarkers()}setAttribute(e,t){if(this._setAttribute(e,t)){const t=[e];this.fire("change:attribute",{attributeKeys:t,directChange:!0})}}removeAttribute(e){if(this._removeAttribute(e)){const t=[e];this.fire("change:attribute",{attributeKeys:t,directChange:!0})}}overrideGravity(){const e=un();return this._overriddenGravityRegister.add(e),1===this._overriddenGravityRegister.size&&this._updateAttributes(!0),e}restoreGravity(e){if(!this._overriddenGravityRegister.has(e))throw new fn.b("document-selection-gravity-wrong-restore: Attempting to restore the selection gravity for an unknown UID.",this,{uid:e});this._overriddenGravityRegister.delete(e),this.isGravityOverridden||this._updateAttributes(!0)}_popRange(){this._ranges.pop().detach()}_pushRange(e){const t=this._prepareRange(e);t&&this._ranges.push(t)}_prepareRange(e){if(this._checkRange(e),e.root==this._document.graveyard)return;const t=Os.fromRange(e);return t.on("change:range",(e,n,o)=>{this._hasChangedRange=!0,t.root==this._document.graveyard&&this._fixGraveyardRangesData.push({liveRange:t,sourcePosition:o.deletionPosition})}),t}_updateMarkers(){const e=[];let t=!1;for(const t of this._model.markers){const n=t.getRange();for(const o of this.getRanges())n.containsRange(o,!o.isCollapsed)&&e.push(t)}const n=Array.from(this.markers);for(const n of e)this.markers.has(n)||(this.markers.add(n),t=!0);for(const n of Array.from(this.markers))e.includes(n)||(this.markers.remove(n),t=!0);t&&this.fire("change:marker",{oldMarkers:n,directChange:!1})}_updateAttributes(e){const t=Fn(this._getSurroundingAttributes()),n=Fn(this.getAttributes());if(e)this._attributePriority=new Map,this._attrs=new Map;else for(const[e,t]of this._attributePriority)"low"==t&&(this._attrs.delete(e),this._attributePriority.delete(e));this._setAttributesTo(t);const o=[];for(const[e,t]of this.getAttributes())n.has(e)&&n.get(e)===t||o.push(e);for(const[e]of n)this.hasAttribute(e)||o.push(e);o.length>0&&this.fire("change:attribute",{attributeKeys:o,directChange:!1})}_setAttribute(e,t,n=!0){const o=n?"normal":"low";return("low"!=o||"normal"!=this._attributePriority.get(e))&&(super.getAttribute(e)!==t&&(this._attrs.set(e,t),this._attributePriority.set(e,o),!0))}_removeAttribute(e,t=!0){const n=t?"normal":"low";return("low"!=n||"normal"!=this._attributePriority.get(e))&&(this._attributePriority.set(e,n),!!super.hasAttribute(e)&&(this._attrs.delete(e),!0))}_setAttributesTo(e){const t=new Set;for(const[t,n]of this.getAttributes())e.get(t)!==n&&this._removeAttribute(t,!1);for(const[n,o]of e){this._setAttribute(n,o,!1)&&t.add(n)}return t}*_getStoredAttributes(){const e=this.getFirstPosition().parent;if(this.isCollapsed&&e.isEmpty)for(const t of e.getAttributeKeys())if(t.startsWith("selection:")){const n=t.substr("selection:".length);yield[n,e.getAttribute(t)]}}_getSurroundingAttributes(){const e=this.getFirstPosition(),t=this._model.schema;let n=null;if(this.isCollapsed){const t=e.textNode?e.textNode:e.nodeBefore,o=e.textNode?e.textNode:e.nodeAfter;if(this.isGravityOverridden||(n=Fs(t)),n||(n=Fs(o)),!this.isGravityOverridden&&!n){let e=t;for(;e&&!n;)e=e.previousSibling,n=Fs(e)}if(!n){let e=o;for(;e&&!n;)e=e.nextSibling,n=Fs(e)}n||(n=this._getStoredAttributes())}else{const e=this.getFirstRange();for(const o of e){if(o.item.is("element")&&t.isObject(o.item))break;if("text"==o.type){n=o.item.getAttributes();break}}}return n}_fixGraveyardSelection(e,t){const n=t.clone(),o=this._model.schema.getNearestSelectionRange(n),i=this._ranges.indexOf(e);if(this._ranges.splice(i,1),e.detach(),o){const e=this._prepareRange(o);this._ranges.splice(i,0,e)}}}function Fs(e){return e instanceof ms||e instanceof ps?e.getAttributes():null}class Bs{constructor(e){this._dispatchers=e}add(e){for(const t of this._dispatchers)e(t);return this}}var Ls=function(e){return tn(e,5)};
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class zs extends Bs{elementToElement(e){return this.add(function(e){return(e=Ls(e)).view=js(e.view,"container"),t=>{var n;t.on("insert:"+e.model,(n=e.view,(e,t,o)=>{const i=n(t.item,o.writer);if(!i)return;if(!o.consumable.consume(t.item,"insert"))return;const r=o.mapper.toViewPosition(t.range.start);o.mapper.bindElements(t.item,i),o.writer.insert(r,i)}),{priority:e.converterPriority||"normal"})}}(e))}attributeToElement(e){return this.add(function(e){let t="attribute:"+((e=Ls(e)).model.key?e.model.key:e.model);e.model.name&&(t+=":"+e.model.name);if(e.model.values)for(const t of e.model.values)e.view[t]=js(e.view[t],"attribute");else e.view=js(e.view,"attribute");const n=Hs(e);return o=>{o.on(t,function(e){return(t,n,o)=>{const i=e(n.attributeOldValue,o.writer),r=e(n.attributeNewValue,o.writer);if(!i&&!r)return;if(!o.consumable.consume(n.item,t.name))return;const s=o.writer,a=s.document.selection;if(n.item instanceof Ps||n.item instanceof Vs)s.wrap(a.getFirstRange(),r);else{let e=o.mapper.toViewRange(n.range);null!==n.attributeOldValue&&i&&(e=s.unwrap(e,i)),null!==n.attributeNewValue&&r&&s.wrap(e,r)}}}(n),{priority:e.converterPriority||"normal"})}}(e))}attributeToAttribute(e){return this.add(function(e){let t="attribute:"+((e=Ls(e)).model.key?e.model.key:e.model);e.model.name&&(t+=":"+e.model.name);if(e.model.values)for(const t of e.model.values)e.view[t]=Ws(e.view[t]);else e.view=Ws(e.view);const n=Hs(e);return o=>{var i;o.on(t,(i=n,(e,t,n)=>{const o=i(t.attributeOldValue,t),r=i(t.attributeNewValue,t);if(!o&&!r)return;if(!n.consumable.consume(t.item,e.name))return;const s=n.mapper.toViewElement(t.item),a=n.writer;if(!s)throw new fn.b("conversion-attribute-to-attribute-on-text: Trying to convert text node's attribute with attribute-to-attribute converter.",[t,n]);if(null!==t.attributeOldValue&&o)if("class"==o.key){const e=Array.isArray(o.value)?o.value:[o.value];for(const t of e)a.removeClass(t,s)}else if("style"==o.key){const e=Object.keys(o.value);for(const t of e)a.removeStyle(t,s)}else a.removeAttribute(o.key,s);if(null!==t.attributeNewValue&&r)if("class"==r.key){const e=Array.isArray(r.value)?r.value:[r.value];for(const t of e)a.addClass(t,s)}else if("style"==r.key){const e=Object.keys(r.value);for(const t of e)a.setStyle(t,r.value[t],s)}else a.setAttribute(r.key,r.value,s)}),{priority:e.converterPriority||"normal"})}}(e))}markerToElement(e){return this.add(function(e){return(e=Ls(e)).view=js(e.view,"ui"),t=>{var n;t.on("addMarker:"+e.model,(n=e.view,(e,t,o)=>{t.isOpening=!0;const i=n(t,o.writer);t.isOpening=!1;const r=n(t,o.writer);if(!i||!r)return;const s=t.markerRange;if(s.isCollapsed&&!o.consumable.consume(s,e.name))return;for(const t of s)if(!o.consumable.consume(t.item,e.name))return;const a=o.mapper,c=o.writer;c.insert(a.toViewPosition(s.start),i),o.mapper.bindElementToMarker(i,t.markerName),s.isCollapsed||(c.insert(a.toViewPosition(s.end),r),o.mapper.bindElementToMarker(r,t.markerName)),e.stop()}),{priority:e.converterPriority||"normal"}),t.on("removeMarker:"+e.model,(e.view,(e,t,n)=>{const o=n.mapper.markerNameToElements(t.markerName);if(o){for(const e of o)n.mapper.unbindElementFromMarkerName(e,t.markerName),n.writer.clear(n.writer.createRangeOn(e),e);n.writer.clearClonedElementsGroup(t.markerName),e.stop()}}),{priority:e.converterPriority||"normal"})}}(e))}markerToHighlight(e){return this.add(function(e){return t=>{var n;t.on("addMarker:"+e.model,(n=e.view,(e,t,o)=>{if(!t.item)return;if(!(t.item instanceof Ps||t.item instanceof Vs||t.item.is("textProxy")))return;const i=Us(n,t,o);if(!i)return;if(!o.consumable.consume(t.item,e.name))return;const r=o.writer,s=qs(r,i),a=r.document.selection;if(t.item instanceof Ps||t.item instanceof Vs)r.wrap(a.getFirstRange(),s,a);else{const e=o.mapper.toViewRange(t.range),n=r.wrap(e,s);for(const e of n.getItems())if(e.is("attributeElement")&&e.isSimilar(s)){o.mapper.bindElementToMarker(e,t.markerName);break}}}),{priority:e.converterPriority||"normal"}),t.on("addMarker:"+e.model,function(e){return(t,n,o)=>{if(!n.item)return;if(!(n.item instanceof bs))return;const i=Us(e,n,o);if(!i)return;if(!o.consumable.test(n.item,t.name))return;const r=o.mapper.toViewElement(n.item);if(r&&r.getCustomProperty("addHighlight")){o.consumable.consume(n.item,t.name);for(const e of vs._createIn(n.item))o.consumable.consume(e.item,t.name);r.getCustomProperty("addHighlight")(r,i,o.writer),o.mapper.bindElementToMarker(r,n.markerName)}}}(e.view),{priority:e.converterPriority||"normal"}),t.on("removeMarker:"+e.model,function(e){return(t,n,o)=>{if(n.markerRange.isCollapsed)return;const i=Us(e,n,o);if(!i)return;const r=qs(o.writer,i),s=o.mapper.markerNameToElements(n.markerName);if(s){for(const e of s)o.mapper.unbindElementFromMarkerName(e,n.markerName),e.is("attributeElement")?o.writer.unwrap(o.writer.createRangeOn(e),r):e.getCustomProperty("removeHighlight")(e,i.id,o.writer);o.writer.clearClonedElementsGroup(n.markerName),t.stop()}}}(e.view),{priority:e.converterPriority||"normal"})}}(e))}}function qs(e,t){const n=e.createAttributeElement("span",t.attributes);return t.classes&&n._addClass(t.classes),t.priority&&(n._priority=t.priority),n._id=t.id,n}function js(e,t){return"function"==typeof e?e:(n,o)=>function(e,t,n){"string"==typeof e&&(e={name:e});let o;const i=Object.assign({},e.attributes);if("container"==n)o=t.createContainerElement(e.name,i);else if("attribute"==n){const n={priority:e.priority||ai.DEFAULT_PRIORITY};o=t.createAttributeElement(e.name,i,n)}else o=t.createUIElement(e.name,i);if(e.styles){const n=Object.keys(e.styles);for(const i of n)t.setStyle(i,e.styles[i],o)}if(e.classes){const n=e.classes;if("string"==typeof n)t.addClass(n,o);else for(const e of n)t.addClass(e,o)}return o}(e,o,t)}function Hs(e){return e.model.values?(t,n)=>{const o=e.view[t];return o?o(t,n):null}:e.view}function Ws(e){return"string"==typeof e?t=>({key:e,value:t}):"object"==typeof e?e.value?()=>e:t=>({key:e.key,value:t}):e}function Us(e,t,n){const o="function"==typeof e?e(t,n):e;return o?(o.priority||(o.priority=10),o.id||(o.id=t.markerName),o):null}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class $s extends Bs{elementToElement(e){return this.add(Gs(e))}elementToAttribute(e){return this.add(function(e){Js(e=Ls(e));const t=Zs(e,!1),n=Ks(e.view),o=n?"element:"+n:"element";return n=>{n.on(o,t,{priority:e.converterPriority||"low"})}}(e))}attributeToAttribute(e){return this.add(function(e){e=Ls(e);let t=null;("string"==typeof e.view||e.view.key)&&(t=function(e){"string"==typeof e.view&&(e.view={key:e.view});const t=e.view.key;let n;if("class"==t||"style"==t){n={["class"==t?"classes":"styles"]:e.view.value}}else{const o=void 0===e.view.value?/[\s\S]*/:e.view.value;n={attributes:{[t]:o}}}e.view.name&&(n.name=e.view.name);return e.view=n,t}(e));Js(e,t);const n=Zs(e,!0);return t=>{t.on("element",n,{priority:e.converterPriority||"low"})}}(e))}elementToMarker(e){return this.add(function(e){return function(e){const t=e.model;e.model=(e,n)=>{const o="string"==typeof t?t:t(e);return n.createElement("$marker",{"data-name":o})}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/(e=Ls(e)),Gs(e)}(e))}}function Gs(e){const t=function(e){const t=e.view?new Bn(e.view):null;return(n,o,i)=>{let r={};if(t){const e=t.match(o.viewItem);if(!e)return;r=e.match}r.name=!0;const s=(a=e.model,c=o.viewItem,l=i.writer,a instanceof Function?a(c,l):l.createElement(a));var a,c,l;if(!s)return;if(!i.consumable.test(o.viewItem,r))return;const d=i.splitToAllowedParent(s,o.modelCursor);if(!d)return;i.writer.insert(s,d.position),i.convertChildren(o.viewItem,i.writer.createPositionAt(s,0)),i.consumable.consume(o.viewItem,r);const u=i.getSplitParts(s);o.modelRange=new vs(i.writer.createPositionBefore(s),i.writer.createPositionAfter(u[u.length-1])),d.cursorParent?o.modelCursor=i.writer.createPositionAt(d.cursorParent,0):o.modelCursor=o.modelRange.end}}(e=Ls(e)),n=Ks(e.view),o=n?"element:"+n:"element";return n=>{n.on(o,t,{priority:e.converterPriority||"normal"})}}function Ks(e){return"string"==typeof e?e:"object"==typeof e&&"string"==typeof e.name?e.name:null}function Js(e,t=null){const n=null===t||(e=>e.getAttribute(t)),o="object"!=typeof e.model?e.model:e.model.key,i="object"!=typeof e.model||void 0===e.model.value?n:e.model.value;e.model={key:o,value:i}}function Zs(e,t){const n=new Bn(e.view);return(o,i,r)=>{const s=n.match(i.viewItem);if(!s)return;const a=e.model.key,c="function"==typeof e.model.value?e.model.value(i.viewItem):e.model.value;null!==c&&(!function(e,t){const n="function"==typeof e?e(t):e;if("object"==typeof n&&!Ks(n))return!1;return!n.classes&&!n.attributes&&!n.styles}(e.view,i.viewItem)?delete s.match.name:s.match.name=!0,r.consumable.test(i.viewItem,s.match)&&(i.modelRange||(i=Object.assign(i,r.convertChildren(i.viewItem,i.modelCursor))),function(e,t,n,o){let i=!1;for(const r of Array.from(e.getItems({shallow:n})))o.schema.checkAttribute(r,t.key)&&(o.writer.setAttribute(t.key,t.value,r),i=!0);return i}(i.modelRange,{key:a,value:c},t,r)&&r.consumable.consume(i.viewItem,s.match)))}}class Qs{constructor(e,t){this.model=e,this.view=new hs(t),this.mapper=new ys,this.downcastDispatcher=new As({mapper:this.mapper});const n=this.model.document,o=n.selection,i=this.model.markers;this.listenTo(this.model,"_beforeChanges",()=>{this.view._disableRendering(!0)},{priority:"highest"}),this.listenTo(this.model,"_afterChanges",()=>{this.view._disableRendering(!1)},{priority:"lowest"}),this.listenTo(n,"change",()=>{this.view.change(e=>{this.downcastDispatcher.convertChanges(n.differ,i,e),this.downcastDispatcher.convertSelection(o,i,e)})},{priority:"low"}),this.listenTo(this.view.document,"selectionChange",function(e,t){return(n,o)=>{const i=o.newSelection,r=new Ps,s=[];for(const e of i.getRanges())s.push(t.toModelRange(e));r.setTo(s,{backward:i.isBackward}),r.isEqual(e.document.selection)||e.change(e=>{e.setSelection(r)})}}(this.model,this.mapper)),this.downcastDispatcher.on("insert:$text",(e,t,n)=>{if(!n.consumable.consume(t.item,"insert"))return;const o=n.writer,i=n.mapper.toViewPosition(t.range.start),r=o.createText(t.item.data);o.insert(i,r)},{priority:"lowest"}),this.downcastDispatcher.on("remove",(e,t,n)=>{const o=n.mapper.toViewPosition(t.position),i=t.position.getShiftedBy(t.length),r=n.mapper.toViewPosition(i,{isPhantom:!0}),s=n.writer.createRange(o,r),a=n.writer.remove(s.getTrimmed());for(const e of n.writer.createRangeIn(a).getItems())n.mapper.unbindViewElement(e)},{priority:"low"}),this.downcastDispatcher.on("selection",(e,t,n)=>{const o=n.writer,i=o.document.selection;for(const e of i.getRanges())e.isCollapsed&&e.end.parent.isAttached()&&n.writer.mergeAttributes(e.start);o.setSelection(null)},{priority:"low"}),this.downcastDispatcher.on("selection",(e,t,n)=>{const o=t.selection;if(o.isCollapsed)return;if(!n.consumable.consume(o,"selection"))return;const i=[];for(const e of o.getRanges()){const t=n.mapper.toViewRange(e);i.push(t)}n.writer.setSelection(i,{backward:o.isBackward})},{priority:"low"}),this.downcastDispatcher.on("selection",(e,t,n)=>{const o=t.selection;if(!o.isCollapsed)return;if(!n.consumable.consume(o,"selection"))return;const i=n.writer,r=o.getFirstPosition(),s=n.mapper.toViewPosition(r),a=i.breakAttributes(s);i.setSelection(a)},{priority:"low"}),this.view.document.roots.bindTo(this.model.document.roots).using(e=>{if("$graveyard"==e.rootName)return null;const t=new Yo(this.view.document,e.name);return t.rootName=e.rootName,this.mapper.bindElements(e,t),t})}destroy(){this.view.destroy(),this.stopListening()}}xn(Qs,Wo);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
class Ys{constructor(){this._commands=new Map}add(e,t){this._commands.set(e,t)}get(e){return this._commands.get(e)}execute(e,...t){const n=this.get(e);if(!n)throw new fn.b("commandcollection-command-not-found: Command does not exist.",this,{commandName:e});n.execute(...t)}*names(){yield*this._commands.keys()}*commands(){yield*this._commands.values()}[Symbol.iterator](){return this._commands[Symbol.iterator]()}destroy(){for(const e of this.commands())e.destroy()}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Xs{constructor(){this._consumables=new Map}add(e,t){let n;e.is("text")||e.is("documentFragment")?this._consumables.set(e,!0):(this._consumables.has(e)?n=this._consumables.get(e):(n=new ea(e),this._consumables.set(e,n)),n.add(t))}test(e,t){const n=this._consumables.get(e);return void 0===n?null:e.is("text")||e.is("documentFragment")?n:n.test(t)}consume(e,t){return!!this.test(e,t)&&(e.is("text")||e.is("documentFragment")?this._consumables.set(e,!1):this._consumables.get(e).consume(t),!0)}revert(e,t){const n=this._consumables.get(e);void 0!==n&&(e.is("text")||e.is("documentFragment")?this._consumables.set(e,!0):n.revert(t))}static consumablesFromElement(e){const t={element:e,name:!0,attributes:[],classes:[],styles:[]},n=e.getAttributeKeys();for(const e of n)"style"!=e&&"class"!=e&&t.attributes.push(e);const o=e.getClassNames();for(const e of o)t.classes.push(e);const i=e.getStyleNames();for(const e of i)t.styles.push(e);return t}static createFrom(e,t){if(t||(t=new Xs(e)),e.is("text"))return t.add(e),t;e.is("element")&&t.add(e,Xs.consumablesFromElement(e)),e.is("documentFragment")&&t.add(e);for(const n of e.getChildren())t=Xs.createFrom(n,t);return t}}class ea{constructor(e){this.element=e,this._canConsumeName=null,this._consumables={attributes:new Map,styles:new Map,classes:new Map}}add(e){e.name&&(this._canConsumeName=!0);for(const t in this._consumables)t in e&&this._add(t,e[t])}test(e){if(e.name&&!this._canConsumeName)return this._canConsumeName;for(const t in this._consumables)if(t in e){const n=this._test(t,e[t]);if(!0!==n)return n}return!0}consume(e){e.name&&(this._canConsumeName=!1);for(const t in this._consumables)t in e&&this._consume(t,e[t])}revert(e){e.name&&(this._canConsumeName=!0);for(const t in this._consumables)t in e&&this._revert(t,e[t])}_add(e,t){const n=De(t)?t:[t],o=this._consumables[e];for(const t of n){if("attributes"===e&&("class"===t||"style"===t))throw new fn.b("viewconsumable-invalid-attribute: Classes and styles should be handled separately.",this);if(o.set(t,!0),"styles"===e)for(const e of this.element.document.stylesProcessor.getRelatedStyles(t))o.set(e,!0)}}_test(e,t){const n=De(t)?t:[t],o=this._consumables[e];for(const t of n)if("attributes"!==e||"class"!==t&&"style"!==t){const e=o.get(t);if(void 0===e)return null;if(!e)return!1}else{const e="class"==t?"classes":"styles",n=this._test(e,[...this._consumables[e].keys()]);if(!0!==n)return n}return!0}_consume(e,t){const n=De(t)?t:[t],o=this._consumables[e];for(const t of n)if("attributes"!==e||"class"!==t&&"style"!==t){if(o.set(t,!1),"styles"==e)for(const e of this.element.document.stylesProcessor.getRelatedStyles(t))o.set(e,!1)}else{const e="class"==t?"classes":"styles";this._consume(e,[...this._consumables[e].keys()])}}_revert(e,t){const n=De(t)?t:[t],o=this._consumables[e];for(const t of n)if("attributes"!==e||"class"!==t&&"style"!==t){!1===o.get(t)&&o.set(t,!0)}else{const e="class"==t?"classes":"styles";this._revert(e,[...this._consumables[e].keys()])}}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class ta{constructor(){this._sourceDefinitions={},this._attributeProperties={},this.decorate("checkChild"),this.decorate("checkAttribute"),this.on("checkAttribute",(e,t)=>{t[0]=new na(t[0])},{priority:"highest"}),this.on("checkChild",(e,t)=>{t[0]=new na(t[0]),t[1]=this.getDefinition(t[1])},{priority:"highest"})}register(e,t){if(this._sourceDefinitions[e])throw new fn.b("schema-cannot-register-item-twice: A single item cannot be registered twice in the schema.",this,{itemName:e});this._sourceDefinitions[e]=[Object.assign({},t)],this._clearCache()}extend(e,t){if(!this._sourceDefinitions[e])throw new fn.b("schema-cannot-extend-missing-item: Cannot extend an item which was not registered yet.",this,{itemName:e});this._sourceDefinitions[e].push(Object.assign({},t)),this._clearCache()}getDefinitions(){return this._compiledDefinitions||this._compile(),this._compiledDefinitions}getDefinition(e){let t;return t="string"==typeof e?e:e.is&&(e.is("text")||e.is("textProxy"))?"$text":e.name,this.getDefinitions()[t]}isRegistered(e){return!!this.getDefinition(e)}isBlock(e){const t=this.getDefinition(e);return!(!t||!t.isBlock)}isLimit(e){const t=this.getDefinition(e);return!!t&&!(!t.isLimit&&!t.isObject)}isObject(e){const t=this.getDefinition(e);return!(!t||!t.isObject)}isInline(e){const t=this.getDefinition(e);return!(!t||!t.isInline)}checkChild(e,t){return!!t&&this._checkContextMatch(t,e)}checkAttribute(e,t){const n=this.getDefinition(e.last);return!!n&&n.allowAttributes.includes(t)}checkMerge(e,t=null){if(e instanceof _s){const t=e.nodeBefore,n=e.nodeAfter;if(!(t instanceof bs))throw new fn.b("schema-check-merge-no-element-before: The node before the merge position must be an element.",this);if(!(n instanceof bs))throw new fn.b("schema-check-merge-no-element-after: The node after the merge position must be an element.",this);return this.checkMerge(t,n)}for(const n of t.getChildren())if(!this.checkChild(e,n))return!1;return!0}addChildCheck(e){this.on("checkChild",(t,[n,o])=>{if(!o)return;const i=e(n,o);"boolean"==typeof i&&(t.stop(),t.return=i)},{priority:"high"})}addAttributeCheck(e){this.on("checkAttribute",(t,[n,o])=>{const i=e(n,o);"boolean"==typeof i&&(t.stop(),t.return=i)},{priority:"high"})}setAttributeProperties(e,t){this._attributeProperties[e]=Object.assign(this.getAttributeProperties(e),t)}getAttributeProperties(e){return this._attributeProperties[e]||{}}getLimitElement(e){let t;if(e instanceof _s)t=e.parent;else{t=(e instanceof vs?[e]:Array.from(e.getRanges())).reduce((e,t)=>{const n=t.getCommonAncestor();return e?e.getCommonAncestor(n,{includeSelf:!0}):n},null)}for(;!this.isLimit(t)&&t.parent;)t=t.parent;return t}checkAttributeInSelection(e,t){if(e.isCollapsed){const n=[...e.getFirstPosition().getAncestors(),new ps("",e.getAttributes())];return this.checkAttribute(n,t)}{const n=e.getRanges();for(const e of n)for(const n of e)if(this.checkAttribute(n.item,t))return!0}return!1}*getValidRanges(e,t){e=function*(e){for(const t of e)yield*t.getMinimalFlatRanges()}(e);for(const n of e)yield*this._getValidRangesForRange(n,t)}getNearestSelectionRange(e,t="both"){if(this.checkChild(e,"$text"))return new vs(e);let n,o;const i=e.getAncestors().reverse().find(e=>this.isLimit(e))||e.root;"both"!=t&&"backward"!=t||(n=new ws({boundaries:vs._createIn(i),startPosition:e,direction:"backward"})),"both"!=t&&"forward"!=t||(o=new ws({boundaries:vs._createIn(i),startPosition:e}));for(const e of function*(e,t){let n=!1;for(;!n;){if(n=!0,e){const t=e.next();t.done||(n=!1,yield{walker:e,value:t.value})}if(t){const e=t.next();e.done||(n=!1,yield{walker:t,value:e.value})}}}(n,o)){const t=e.walker==n?"elementEnd":"elementStart",o=e.value;if(o.type==t&&this.isObject(o.item))return vs._createOn(o.item);if(this.checkChild(o.nextPosition,"$text"))return new vs(o.nextPosition)}return null}findAllowedParent(e,t){let n=e.parent;for(;n;){if(this.checkChild(n,t))return n;if(this.isLimit(n))return null;n=n.parent}return null}removeDisallowedAttributes(e,t){for(const n of e)if(n.is("text"))fa(this,n,t);else{const e=vs._createIn(n).getPositions();for(const n of e){fa(this,n.nodeBefore||n.parent,t)}}}createContext(e){return new na(e)}_clearCache(){this._compiledDefinitions=null}_compile(){const e={},t=this._sourceDefinitions,n=Object.keys(t);for(const o of n)e[o]=oa(t[o],o);for(const t of n)ia(e,t);for(const t of n)ra(e,t);for(const t of n)sa(e,t),aa(e,t);for(const t of n)ca(e,t),la(e,t);this._compiledDefinitions=e}_checkContextMatch(e,t,n=t.length-1){const o=t.getItem(n);if(e.allowIn.includes(o.name)){if(0==n)return!0;{const e=this.getDefinition(o);return this._checkContextMatch(e,t,n-1)}}return!1}*_getValidRangesForRange(e,t){let n=e.start,o=e.start;for(const i of e.getItems({shallow:!0}))i.is("element")&&(yield*this._getValidRangesForRange(vs._createIn(i),t)),this.checkAttribute(i,t)||(n.isEqual(o)||(yield new vs(n,o)),n=_s._createAfter(i)),o=_s._createAfter(i);n.isEqual(o)||(yield new vs(n,o))}}xn(ta,Wo);class na{constructor(e){if(e instanceof na)return e;"string"==typeof e?e=[e]:Array.isArray(e)||(e=e.getAncestors({includeSelf:!0})),e[0]&&"string"!=typeof e[0]&&e[0].is("documentFragment")&&e.shift(),this._items=e.map(ha)}get length(){return this._items.length}get last(){return this._items[this._items.length-1]}[Symbol.iterator](){return this._items[Symbol.iterator]()}push(e){const t=new na([e]);return t._items=[...this._items,...t._items],t}getItem(e){return this._items[e]}*getNames(){yield*this._items.map(e=>e.name)}endsWith(e){return Array.from(this.getNames()).join(" ").endsWith(e)}startsWith(e){return Array.from(this.getNames()).join(" ").startsWith(e)}}function oa(e,t){const n={name:t,allowIn:[],allowContentOf:[],allowWhere:[],allowAttributes:[],allowAttributesOf:[],inheritTypesFrom:[]};return function(e,t){for(const n of e){const e=Object.keys(n).filter(e=>e.startsWith("is"));for(const o of e)t[o]=n[o]}}(e,n),da(e,n,"allowIn"),da(e,n,"allowContentOf"),da(e,n,"allowWhere"),da(e,n,"allowAttributes"),da(e,n,"allowAttributesOf"),da(e,n,"inheritTypesFrom"),function(e,t){for(const n of e){const e=n.inheritAllFrom;e&&(t.allowContentOf.push(e),t.allowWhere.push(e),t.allowAttributesOf.push(e),t.inheritTypesFrom.push(e))}}(e,n),n}function ia(e,t){for(const n of e[t].allowContentOf)if(e[n]){ua(e,n).forEach(e=>{e.allowIn.push(t)})}delete e[t].allowContentOf}function ra(e,t){for(const n of e[t].allowWhere){const o=e[n];if(o){const n=o.allowIn;e[t].allowIn.push(...n)}}delete e[t].allowWhere}function sa(e,t){for(const n of e[t].allowAttributesOf){const o=e[n];if(o){const n=o.allowAttributes;e[t].allowAttributes.push(...n)}}delete e[t].allowAttributesOf}function aa(e,t){const n=e[t];for(const t of n.inheritTypesFrom){const o=e[t];if(o){const e=Object.keys(o).filter(e=>e.startsWith("is"));for(const t of e)t in n||(n[t]=o[t])}}delete n.inheritTypesFrom}function ca(e,t){const n=e[t],o=n.allowIn.filter(t=>e[t]);n.allowIn=Array.from(new Set(o))}function la(e,t){const n=e[t];n.allowAttributes=Array.from(new Set(n.allowAttributes))}function da(e,t,n){for(const o of e)"string"==typeof o[n]?t[n].push(o[n]):Array.isArray(o[n])&&t[n].push(...o[n])}function ua(e,t){const n=e[t];return(o=e,Object.keys(o).map(e=>o[e])).filter(e=>e.allowIn.includes(n.name));var o}function ha(e){return"string"==typeof e?{name:e,*getAttributeKeys(){},getAttribute(){}}:{name:e.is("element")?e.name:"$text",*getAttributeKeys(){yield*e.getAttributeKeys()},getAttribute:t=>e.getAttribute(t)}}function fa(e,t,n){for(const o of t.getAttributeKeys())e.checkAttribute(t,o)||n.removeAttribute(o,t)}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class pa{constructor(e={}){this._splitParts=new Map,this._modelCursor=null,this.conversionApi=Object.assign({},e),this.conversionApi.convertItem=this._convertItem.bind(this),this.conversionApi.convertChildren=this._convertChildren.bind(this),this.conversionApi.splitToAllowedParent=this._splitToAllowedParent.bind(this),this.conversionApi.getSplitParts=this._getSplitParts.bind(this)}convert(e,t,n=["$root"]){this.fire("viewCleanup",e),this._modelCursor=function(e,t){let n;for(const o of new na(e)){const e={};for(const t of o.getAttributeKeys())e[t]=o.getAttribute(t);const i=t.createElement(o.name,e);n&&t.append(i,n),n=_s._createAt(i,0)}return n}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/(n,t),this.conversionApi.writer=t,this.conversionApi.consumable=Xs.createFrom(e),this.conversionApi.store={};const{modelRange:o}=this._convertItem(e,this._modelCursor),i=t.createDocumentFragment();if(o){this._removeEmptyElements();for(const e of Array.from(this._modelCursor.parent.getChildren()))t.append(e,i);i.markers=function(e,t){const n=new Set,o=new Map,i=vs._createIn(e).getItems();for(const e of i)"$marker"==e.name&&n.add(e);for(const e of n){const n=e.getAttribute("data-name"),i=t.createPositionBefore(e);o.has(n)?o.get(n).end=i.clone():o.set(n,new vs(i.clone())),t.remove(e)}return o}(i,t)}return this._modelCursor=null,this._splitParts.clear(),this.conversionApi.writer=null,this.conversionApi.store=null,i}_convertItem(e,t){const n=Object.assign({viewItem:e,modelCursor:t,modelRange:null});if(e.is("element")?this.fire("element:"+e.name,n,this.conversionApi):e.is("text")?this.fire("text",n,this.conversionApi):this.fire("documentFragment",n,this.conversionApi),n.modelRange&&!(n.modelRange instanceof vs))throw new fn.b("view-conversion-dispatcher-incorrect-result: Incorrect conversion result was dropped.",this);return{modelRange:n.modelRange,modelCursor:n.modelCursor}}_convertChildren(e,t){const n=new vs(t);let o=t;for(const t of Array.from(e.getChildren())){const e=this._convertItem(t,o);e.modelRange instanceof vs&&(n.end=e.modelRange.end,o=e.modelCursor)}return{modelRange:n,modelCursor:o}}_splitToAllowedParent(e,t){const n=this.conversionApi.schema.findAllowedParent(t,e);if(!n)return null;if(n===t.parent)return{position:t};if(this._modelCursor.parent.getAncestors().includes(n))return null;const o=this.conversionApi.writer.split(t,n),i=[];for(const e of o.range.getWalker())if("elementEnd"==e.type)i.push(e.item);else{const t=i.pop(),n=e.item;this._registerSplitPair(t,n)}return{position:o.position,cursorParent:o.range.end.parent}}_registerSplitPair(e,t){this._splitParts.has(e)||this._splitParts.set(e,[e]);const n=this._splitParts.get(e);this._splitParts.set(t,n),n.push(t)}_getSplitParts(e){let t;return t=this._splitParts.has(e)?this._splitParts.get(e):[e],t}_removeEmptyElements(){let e=!1;for(const t of this._splitParts.keys())t.isEmpty&&(this.conversionApi.writer.remove(t),this._splitParts.delete(t),e=!0);e&&this._removeEmptyElements()}}xn(pa,gn);class ma{constructor(e,t){this.model=e,this.stylesProcessor=t,this.processor,this.mapper=new ys,this.downcastDispatcher=new As({mapper:this.mapper}),this.downcastDispatcher.on("insert:$text",(e,t,n)=>{if(!n.consumable.consume(t.item,"insert"))return;const o=n.writer,i=n.mapper.toViewPosition(t.range.start),r=o.createText(t.item.data);o.insert(i,r)},{priority:"lowest"}),this.upcastDispatcher=new pa({schema:e.schema}),this.viewDocument=new si(t),this._viewWriter=new Ai(this.viewDocument),this.upcastDispatcher.on("text",(e,t,n)=>{if(n.schema.checkChild(t.modelCursor,"$text")&&n.consumable.consume(t.viewItem)){const e=n.writer.createText(t.viewItem.data);n.writer.insert(e,t.modelCursor),t.modelRange=vs._createFromPositionAndShift(t.modelCursor,e.offsetSize),t.modelCursor=t.modelRange.end}},{priority:"lowest"}),this.upcastDispatcher.on("element",(e,t,n)=>{if(!t.modelRange&&n.consumable.consume(t.viewItem,{name:!0})){const{modelRange:e,modelCursor:o}=n.convertChildren(t.viewItem,t.modelCursor);t.modelRange=e,t.modelCursor=o}},{priority:"lowest"}),this.upcastDispatcher.on("documentFragment",(e,t,n)=>{if(!t.modelRange&&n.consumable.consume(t.viewItem,{name:!0})){const{modelRange:e,modelCursor:o}=n.convertChildren(t.viewItem,t.modelCursor);t.modelRange=e,t.modelCursor=o}},{priority:"lowest"}),this.decorate("init"),this.on("init",()=>{this.fire("ready")},{priority:"lowest"})}get(e){const{rootName:t="main",trim:n="empty"}=e||{};if(!this._checkIfRootsExists([t]))throw new fn.b("datacontroller-get-non-existent-root: Attempting to get data from a non-existing root.",this);const o=this.model.document.getRoot(t);return"empty"!==n||this.model.hasContent(o,{ignoreWhitespaces:!0})?this.stringify(o):""}stringify(e){const t=this.toView(e);return this.processor.toData(t)}toView(e){const t=this.viewDocument,n=this._viewWriter;this.mapper.clearBindings();const o=vs._createIn(e),i=new Ci(t);if(this.mapper.bindElements(e,i),this.downcastDispatcher.convertInsert(o,n),!e.is("documentFragment")){const t=function(e){const t=[],n=e.root.document;if(!n)return[];const o=vs._createIn(e);for(const e of n.model.markers){const n=o.getIntersection(e.getRange());n&&t.push([e.name,n])}return t}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/(e);for(const[e,o]of t)this.downcastDispatcher.convertMarkerAdd(e,o,n)}return i}init(e){if(this.model.document.version)throw new fn.b("datacontroller-init-document-not-empty: Trying to set initial data to not empty document.",this);let t={};if("string"==typeof e?t.main=e:t=e,!this._checkIfRootsExists(Object.keys(t)))throw new fn.b("datacontroller-init-non-existent-root: Attempting to init data on a non-existing root.",this);return this.model.enqueueChange("transparent",e=>{for(const n of Object.keys(t)){const o=this.model.document.getRoot(n);e.insert(this.parse(t[n],o),o,0)}}),Promise.resolve()}set(e){let t={};if("string"==typeof e?t.main=e:t=e,!this._checkIfRootsExists(Object.keys(t)))throw new fn.b("datacontroller-set-non-existent-root: Attempting to set data on a non-existing root.",this);this.model.enqueueChange("transparent",e=>{e.setSelection(null),e.removeSelectionAttribute(this.model.document.selection.getAttributeKeys());for(const n of Object.keys(t)){const o=this.model.document.getRoot(n);e.remove(e.createRangeIn(o)),e.insert(this.parse(t[n],o),o,0)}})}parse(e,t="$root"){const n=this.processor.toView(e);return this.toModel(n,t)}toModel(e,t="$root"){return this.model.change(n=>this.upcastDispatcher.convert(e,n,t))}addStyleProcessorRules(e){e(this.stylesProcessor)}destroy(){this.stopListening()}_checkIfRootsExists(e){for(const t of e)if(!this.model.document.getRootNames().includes(t))return!1;return!0}}xn(ma,Wo);class ga{constructor(e,t){this._helpers=new Map,this._downcast=Array.isArray(e)?e:[e],this._createConversionHelpers({name:"downcast",dispatchers:this._downcast,isDowncast:!0}),this._upcast=Array.isArray(t)?t:[t],this._createConversionHelpers({name:"upcast",dispatchers:this._upcast,isDowncast:!1})}addAlias(e,t){const n=this._downcast.includes(t);if(!this._upcast.includes(t)&&!n)throw new fn.b("conversion-add-alias-dispatcher-not-registered: Trying to register and alias for a dispatcher that nas not been registered.",this);this._createConversionHelpers({name:e,dispatchers:[t],isDowncast:n})}for(e){if(!this._helpers.has(e))throw new fn.b("conversion-for-unknown-group: Trying to add a converter to an unknown dispatchers group.",this);return this._helpers.get(e)}elementToElement(e){this.for("downcast").elementToElement(e);for(const{model:t,view:n}of ba(e))this.for("upcast").elementToElement({model:t,view:n,converterPriority:e.converterPriority})}attributeToElement(e){this.for("downcast").attributeToElement(e);for(const{model:t,view:n}of ba(e))this.for("upcast").elementToAttribute({view:n,model:t,converterPriority:e.converterPriority})}attributeToAttribute(e){this.for("downcast").attributeToAttribute(e);for(const{model:t,view:n}of ba(e))this.for("upcast").attributeToAttribute({view:n,model:t})}_createConversionHelpers({name:e,dispatchers:t,isDowncast:n}){if(this._helpers.has(e))throw new fn.b("conversion-group-exists: Trying to register a group name that has already been registered.",this);const o=n?new zs(t):new $s(t);this._helpers.set(e,o)}}function*ba(e){if(e.model.values)for(const t of e.model.values){const n={key:e.model.key,value:t},o=e.view[t],i=e.upcastAlso?e.upcastAlso[t]:void 0;yield*wa(n,o,i)}else yield*wa(e.model,e.view,e.upcastAlso)}function*wa(e,t,n){if(yield{model:e,view:t},n){n=Array.isArray(n)?n:[n];for(const t of n)yield{model:e,view:t}}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class ka{constructor(e="default"){this.operations=[],this.type=e}get baseVersion(){for(const e of this.operations)if(null!==e.baseVersion)return e.baseVersion;return null}addOperation(e){return e.batch=this,this.operations.push(e),e}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class _a{constructor(e){this.baseVersion=e,this.isDocumentOperation=null!==this.baseVersion,this.batch=null}_validate(){}toJSON(){const e=Object.assign({},this);return e.__className=this.constructor.className,delete e.batch,delete e.isDocumentOperation,e}static get className(){return"Operation"}static fromJSON(e){return new this(e.baseVersion)}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class va{constructor(e){this.markers=new Map,this._children=new gs,e&&this._insertChild(0,e)}[Symbol.iterator](){return this.getChildren()}get childCount(){return this._children.length}get maxOffset(){return this._children.maxOffset}get isEmpty(){return 0===this.childCount}get root(){return this}get parent(){return null}is(e){return"documentFragment"==e||"model:documentFragment"==e}getChild(e){return this._children.getNode(e)}getChildren(){return this._children[Symbol.iterator]()}getChildIndex(e){return this._children.getNodeIndex(e)}getChildStartOffset(e){return this._children.getNodeStartOffset(e)}getPath(){return[]}getNodeByPath(e){let t=this;for(const n of e)t=t.getChild(t.offsetToIndex(n));return t}offsetToIndex(e){return this._children.offsetToIndex(e)}toJSON(){const e=[];for(const t of this._children)e.push(t.toJSON());return e}static fromJSON(e){const t=[];for(const n of e)n.name?t.push(bs.fromJSON(n)):t.push(ps.fromJSON(n));return new va(t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const n=function(e){if("string"==typeof e)return[new ps(e)];Dn(e)||(e=[e]);return Array.from(e).map(e=>"string"==typeof e?new ps(e):e instanceof ms?new ps(e.data,e.getAttributes()):e)}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/(t);for(const e of n)null!==e.parent&&e._remove(),e.parent=this;this._children._insertNodes(e,n)}_removeChildren(e,t=1){const n=this._children._removeNodes(e,t);for(const e of n)e.parent=null;return n}}function ya(e,t){const n=(t=Aa(t)).reduce((e,t)=>e+t.offsetSize,0),o=e.parent;Pa(e);const i=e.index;return o._insertChild(i,t),Ta(o,i+t.length),Ta(o,i),new vs(e,e.getShiftedBy(n))}function xa(e){if(!e.isFlat)throw new fn.b("operation-utils-remove-range-not-flat: Trying to remove a range which starts and ends in different element.",this);const t=e.start.parent;Pa(e.start),Pa(e.end);const n=t._removeChildren(e.start.index,e.end.index-e.start.index);return Ta(t,e.start.index),n}function Ca(e,t){if(!e.isFlat)throw new fn.b("operation-utils-move-range-not-flat: Trying to move a range which starts and ends in different element.",this);const n=xa(e);return ya(t=t._getTransformedByDeletion(e.start,e.end.offset-e.start.offset),n)}function Aa(e){const t=[];e instanceof Array||(e=[e]);for(let n=0;n<e.length;n++)if("string"==typeof e[n])t.push(new ps(e[n]));else if(e[n]instanceof ms)t.push(new ps(e[n].data,e[n].getAttributes()));else if(e[n]instanceof va||e[n]instanceof gs)for(const o of e[n])t.push(o);else e[n]instanceof fs&&t.push(e[n]);for(let e=1;e<t.length;e++){const n=t[e],o=t[e-1];n instanceof ps&&o instanceof ps&&Ea(n,o)&&(t.splice(e-1,2,new ps(o.data+n.data,o.getAttributes())),e--)}return t}function Ta(e,t){const n=e.getChild(t-1),o=e.getChild(t);if(n&&o&&n.is("text")&&o.is("text")&&Ea(n,o)){const i=new ps(n.data+o.data,n.getAttributes());e._removeChildren(t-1,2),e._insertChild(t-1,i)}}function Pa(e){const t=e.textNode,n=e.parent;if(t){const o=e.offset-t.startOffset,i=t.index;n._removeChildren(i,1);const r=new ps(t.data.substr(0,o),t.getAttributes()),s=new ps(t.data.substr(o),t.getAttributes());n._insertChild(i,[r,s])}}function Ea(e,t){const n=e.getAttributes(),o=t.getAttributes();for(const e of n){if(e[1]!==t.getAttribute(e[0]))return!1;o.next()}return o.next().done}var Sa=function(e,t){return Sr(e,t)};
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Ra extends _a{constructor(e,t,n,o,i){super(i),this.range=e.clone(),this.key=t,this.oldValue=void 0===n?null:n,this.newValue=void 0===o?null:o}get type(){return null===this.oldValue?"addAttribute":null===this.newValue?"removeAttribute":"changeAttribute"}clone(){return new Ra(this.range,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new Ra(this.range,this.key,this.newValue,this.oldValue,this.baseVersion+1)}toJSON(){const e=super.toJSON();return e.range=this.range.toJSON(),e}_validate(){if(!this.range.isFlat)throw new fn.b("attribute-operation-range-not-flat: The range to change is not flat.",this);for(const e of this.range.getItems({shallow:!0})){if(null!==this.oldValue&&!Sa(e.getAttribute(this.key),this.oldValue))throw new fn.b("attribute-operation-wrong-old-value: Changed node has different attribute value than operation's old attribute value.",this,{item:e,key:this.key,value:this.oldValue});if(null===this.oldValue&&null!==this.newValue&&e.hasAttribute(this.key))throw new fn.b("attribute-operation-attribute-exists: The attribute with given key already exists.",this,{node:e,key:this.key})}}_execute(){Sa(this.oldValue,this.newValue)||function(e,t,n){Pa(e.start),Pa(e.end);for(const o of e.getItems({shallow:!0})){const e=o.is("textProxy")?o.textNode:o;null!==n?e._setAttribute(t,n):e._removeAttribute(t),Ta(e.parent,e.index)}Ta(e.end.parent,e.end.index)}(this.range,this.key,this.newValue)}static get className(){return"AttributeOperation"}static fromJSON(e,t){return new Ra(vs.fromJSON(e.range,t),e.key,e.oldValue,e.newValue,e.baseVersion)}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Ia extends _a{constructor(e,t){super(null),this.sourcePosition=e.clone(),this.howMany=t}get type(){return"detach"}toJSON(){const e=super.toJSON();return e.sourcePosition=this.sourcePosition.toJSON(),e}_validate(){if(this.sourcePosition.root.document)throw new fn.b("detach-operation-on-document-node: Cannot detach document node.",this)}_execute(){xa(vs._createFromPositionAndShift(this.sourcePosition,this.howMany))}static get className(){return"DetachOperation"}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Oa extends _a{constructor(e,t,n,o){super(o),this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toNext",this.howMany=t,this.targetPosition=n.clone(),this.targetPosition.stickiness="toNone"}get type(){return"$graveyard"==this.targetPosition.root.rootName?"remove":"$graveyard"==this.sourcePosition.root.rootName?"reinsert":"move"}clone(){return new this.constructor(this.sourcePosition,this.howMany,this.targetPosition,this.baseVersion)}getMovedRangeStart(){return this.targetPosition._getTransformedByDeletion(this.sourcePosition,this.howMany)}getReversed(){const e=this.sourcePosition._getTransformedByInsertion(this.targetPosition,this.howMany);return new this.constructor(this.getMovedRangeStart(),this.howMany,e,this.baseVersion+1)}_validate(){const e=this.sourcePosition.parent,t=this.targetPosition.parent,n=this.sourcePosition.offset,o=this.targetPosition.offset;if(n+this.howMany>e.maxOffset)throw new fn.b("move-operation-nodes-do-not-exist: The nodes which should be moved do not exist.",this);if(e===t&&n<o&&o<n+this.howMany)throw new fn.b("move-operation-range-into-itself: Trying to move a range of nodes to the inside of that range.",this);if(this.sourcePosition.root==this.targetPosition.root&&"prefix"==In(this.sourcePosition.getParentPath(),this.targetPosition.getParentPath())){const e=this.sourcePosition.path.length-1;if(this.targetPosition.path[e]>=n&&this.targetPosition.path[e]<n+this.howMany)throw new fn.b("move-operation-node-into-itself: Trying to move a range of nodes into one of nodes from that range.",this)}}_execute(){Ca(vs._createFromPositionAndShift(this.sourcePosition,this.howMany),this.targetPosition)}toJSON(){const e=super.toJSON();return e.sourcePosition=this.sourcePosition.toJSON(),e.targetPosition=this.targetPosition.toJSON(),e}static get className(){return"MoveOperation"}static fromJSON(e,t){const n=_s.fromJSON(e.sourcePosition,t),o=_s.fromJSON(e.targetPosition,t);return new this(n,e.howMany,o,e.baseVersion)}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Na extends _a{constructor(e,t,n){super(n),this.position=e.clone(),this.position.stickiness="toNone",this.nodes=new gs(Aa(t)),this.shouldReceiveAttributes=!1}get type(){return"insert"}get howMany(){return this.nodes.maxOffset}clone(){const e=new gs([...this.nodes].map(e=>e._clone(!0))),t=new Na(this.position,e,this.baseVersion);return t.shouldReceiveAttributes=this.shouldReceiveAttributes,t}getReversed(){const e=this.position.root.document.graveyard,t=new _s(e,[0]);return new Oa(this.position,this.nodes.maxOffset,t,this.baseVersion+1)}_validate(){const e=this.position.parent;if(!e||e.maxOffset<this.position.offset)throw new fn.b("insert-operation-position-invalid: Insertion position is invalid.",this)}_execute(){const e=this.nodes;this.nodes=new gs([...e].map(e=>e._clone(!0))),ya(this.position,e)}toJSON(){const e=super.toJSON();return e.position=this.position.toJSON(),e.nodes=this.nodes.toJSON(),e}static get className(){return"InsertOperation"}static fromJSON(e,t){const n=[];for(const t of e.nodes)t.name?n.push(bs.fromJSON(t)):n.push(ps.fromJSON(t));const o=new Na(_s.fromJSON(e.position,t),n,e.baseVersion);return o.shouldReceiveAttributes=e.shouldReceiveAttributes,o}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Ma extends _a{constructor(e,t,n,o,i,r){super(r),this.name=e,this.oldRange=t?t.clone():null,this.newRange=n?n.clone():null,this.affectsData=i,this._markers=o}get type(){return"marker"}clone(){return new Ma(this.name,this.oldRange,this.newRange,this._markers,this.affectsData,this.baseVersion)}getReversed(){return new Ma(this.name,this.newRange,this.oldRange,this._markers,this.affectsData,this.baseVersion+1)}_execute(){const e=this.newRange?"_set":"_remove";this._markers[e](this.name,this.newRange,!0,this.affectsData)}toJSON(){const e=super.toJSON();return this.oldRange&&(e.oldRange=this.oldRange.toJSON()),this.newRange&&(e.newRange=this.newRange.toJSON()),delete e._markers,e}static get className(){return"MarkerOperation"}static fromJSON(e,t){return new Ma(e.name,e.oldRange?vs.fromJSON(e.oldRange,t):null,e.newRange?vs.fromJSON(e.newRange,t):null,t.model.markers,e.affectsData,e.baseVersion)}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Va extends _a{constructor(e,t,n,o){super(o),this.position=e,this.position.stickiness="toNext",this.oldName=t,this.newName=n}get type(){return"rename"}clone(){return new Va(this.position.clone(),this.oldName,this.newName,this.baseVersion)}getReversed(){return new Va(this.position.clone(),this.newName,this.oldName,this.baseVersion+1)}_validate(){const e=this.position.nodeAfter;if(!(e instanceof bs))throw new fn.b("rename-operation-wrong-position: Given position is invalid or node after it is not an instance of Element.",this);if(e.name!==this.oldName)throw new fn.b("rename-operation-wrong-name: Element to change has different name than operation's old name.",this)}_execute(){this.position.nodeAfter.name=this.newName}toJSON(){const e=super.toJSON();return e.position=this.position.toJSON(),e}static get className(){return"RenameOperation"}static fromJSON(e,t){return new Va(_s.fromJSON(e.position,t),e.oldName,e.newName,e.baseVersion)}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Da extends _a{constructor(e,t,n,o,i){super(i),this.root=e,this.key=t,this.oldValue=n,this.newValue=o}get type(){return null===this.oldValue?"addRootAttribute":null===this.newValue?"removeRootAttribute":"changeRootAttribute"}clone(){return new Da(this.root,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new Da(this.root,this.key,this.newValue,this.oldValue,this.baseVersion+1)}_validate(){if(this.root!=this.root.root||this.root.is("documentFragment"))throw new fn.b("rootattribute-operation-not-a-root: The element to change is not a root element.",this,{root:this.root,key:this.key});if(null!==this.oldValue&&this.root.getAttribute(this.key)!==this.oldValue)throw new fn.b("rootattribute-operation-wrong-old-value: Changed node has different attribute value than operation's old attribute value.",this,{root:this.root,key:this.key});if(null===this.oldValue&&null!==this.newValue&&this.root.hasAttribute(this.key))throw new fn.b("rootattribute-operation-attribute-exists: The attribute with given key already exists.",this,{root:this.root,key:this.key})}_execute(){null!==this.newValue?this.root._setAttribute(this.key,this.newValue):this.root._removeAttribute(this.key)}toJSON(){const e=super.toJSON();return e.root=this.root.toJSON(),e}static get className(){return"RootAttributeOperation"}static fromJSON(e,t){if(!t.getRoot(e.root))throw new fn.b("rootattribute-operation-fromjson-no-root: Cannot create RootAttributeOperation. Root with specified name does not exist.",this,{rootName:e.root});return new Da(t.getRoot(e.root),e.key,e.oldValue,e.newValue,e.baseVersion)}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Fa extends _a{constructor(e,t,n,o,i){super(i),this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toPrevious",this.howMany=t,this.targetPosition=n.clone(),this.targetPosition.stickiness="toNext",this.graveyardPosition=o.clone()}get type(){return"merge"}get deletionPosition(){return new _s(this.sourcePosition.root,this.sourcePosition.path.slice(0,-1))}get movedRange(){const e=this.sourcePosition.getShiftedBy(Number.POSITIVE_INFINITY);return new vs(this.sourcePosition,e)}clone(){return new this.constructor(this.sourcePosition,this.howMany,this.targetPosition,this.graveyardPosition,this.baseVersion)}getReversed(){const e=this.targetPosition._getTransformedByMergeOperation(this),t=this.sourcePosition.path.slice(0,-1),n=new _s(this.sourcePosition.root,t)._getTransformedByMergeOperation(this),o=new Ba(e,this.howMany,this.graveyardPosition,this.baseVersion+1);return o.insertionPosition=n,o}_validate(){const e=this.sourcePosition.parent,t=this.targetPosition.parent;if(!e.parent)throw new fn.b("merge-operation-source-position-invalid: Merge source position is invalid.",this);if(!t.parent)throw new fn.b("merge-operation-target-position-invalid: Merge target position is invalid.",this);if(this.howMany!=e.maxOffset)throw new fn.b("merge-operation-how-many-invalid: Merge operation specifies wrong number of nodes to move.",this)}_execute(){const e=this.sourcePosition.parent;Ca(vs._createIn(e),this.targetPosition),Ca(vs._createOn(e),this.graveyardPosition)}toJSON(){const e=super.toJSON();return e.sourcePosition=e.sourcePosition.toJSON(),e.targetPosition=e.targetPosition.toJSON(),e.graveyardPosition=e.graveyardPosition.toJSON(),e}static get className(){return"MergeOperation"}static fromJSON(e,t){const n=_s.fromJSON(e.sourcePosition,t),o=_s.fromJSON(e.targetPosition,t),i=_s.fromJSON(e.graveyardPosition,t);return new this(n,e.howMany,o,i,e.baseVersion)}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Ba extends _a{constructor(e,t,n,o){super(o),this.splitPosition=e.clone(),this.splitPosition.stickiness="toNext",this.howMany=t,this.insertionPosition=Ba.getInsertionPosition(e),this.insertionPosition.stickiness="toNone",this.graveyardPosition=n?n.clone():null,this.graveyardPosition&&(this.graveyardPosition.stickiness="toNext")}get type(){return"split"}get moveTargetPosition(){const e=this.insertionPosition.path.slice();return e.push(0),new _s(this.insertionPosition.root,e)}get movedRange(){const e=this.splitPosition.getShiftedBy(Number.POSITIVE_INFINITY);return new vs(this.splitPosition,e)}clone(){const e=new this.constructor(this.splitPosition,this.howMany,this.graveyardPosition,this.baseVersion);return e.insertionPosition=this.insertionPosition,e}getReversed(){const e=this.splitPosition.root.document.graveyard,t=new _s(e,[0]);return new Fa(this.moveTargetPosition,this.howMany,this.splitPosition,t,this.baseVersion+1)}_validate(){const e=this.splitPosition.parent,t=this.splitPosition.offset;if(!e||e.maxOffset<t)throw new fn.b("split-operation-position-invalid: Split position is invalid.",this);if(!e.parent)throw new fn.b("split-operation-split-in-root: Cannot split root element.",this);if(this.howMany!=e.maxOffset-this.splitPosition.offset)throw new fn.b("split-operation-how-many-invalid: Split operation specifies wrong number of nodes to move.",this);if(this.graveyardPosition&&!this.graveyardPosition.nodeAfter)throw new fn.b("split-operation-graveyard-position-invalid: Graveyard position invalid.",this)}_execute(){const e=this.splitPosition.parent;if(this.graveyardPosition)Ca(vs._createFromPositionAndShift(this.graveyardPosition,1),this.insertionPosition);else{const t=e._clone();ya(this.insertionPosition,t)}Ca(new vs(_s._createAt(e,this.splitPosition.offset),_s._createAt(e,e.maxOffset)),this.moveTargetPosition)}toJSON(){const e=super.toJSON();return e.splitPosition=this.splitPosition.toJSON(),e.insertionPosition=this.insertionPosition.toJSON(),this.graveyardPosition&&(e.graveyardPosition=this.graveyardPosition.toJSON()),e}static get className(){return"SplitOperation"}static getInsertionPosition(e){const t=e.path.slice(0,-1);return t[t.length-1]++,new _s(e.root,t)}static fromJSON(e,t){const n=_s.fromJSON(e.splitPosition,t),o=_s.fromJSON(e.insertionPosition,t),i=e.graveyardPosition?_s.fromJSON(e.graveyardPosition,t):null,r=new this(n,e.howMany,i,e.baseVersion);return r.insertionPosition=o,r}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class La extends bs{constructor(e,t,n="main"){super(t),this._document=e,this.rootName=n}get document(){return this._document}is(e,t){const n=e.replace("model:","");return t?"rootElement"==n&&t==this.name||super.is(e,t):"rootElement"==n||super.is(e)}toJSON(){return this.rootName}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class za{constructor(e,t){this.model=e,this.batch=t}createText(e,t){return new ps(e,t)}createElement(e,t){return new bs(e,t)}createDocumentFragment(){return new va}insert(e,t,n=0){if(this._assertWriterUsedCorrectly(),e instanceof ps&&""==e.data)return;const o=_s._createAt(t,n);if(e.parent){if(Ua(e.root,o.root))return void this.move(vs._createOn(e),o);if(e.root.document)throw new fn.b("model-writer-insert-forbidden-move: Cannot move a node from a document to a different tree. It is forbidden to move a node that was already in a document outside of it.",this);this.remove(e)}const i=o.root.document?o.root.document.version:null,r=new Na(o,e,i);if(e instanceof ps&&(r.shouldReceiveAttributes=!0),this.batch.addOperation(r),this.model.applyOperation(r),e instanceof va)for(const[t,n]of e.markers){const e=_s._createAt(n.root,0),i={range:new vs(n.start._getCombined(e,o),n.end._getCombined(e,o)),usingOperation:!0,affectsData:!0};this.model.markers.has(t)?this.updateMarker(t,i):this.addMarker(t,i)}}insertText(e,t,n,o){t instanceof va||t instanceof bs||t instanceof _s?this.insert(this.createText(e),t,n):this.insert(this.createText(e,t),n,o)}insertElement(e,t,n,o){t instanceof va||t instanceof bs||t instanceof _s?this.insert(this.createElement(e),t,n):this.insert(this.createElement(e,t),n,o)}append(e,t){this.insert(e,t,"end")}appendText(e,t,n){t instanceof va||t instanceof bs?this.insert(this.createText(e),t,"end"):this.insert(this.createText(e,t),n,"end")}appendElement(e,t,n){t instanceof va||t instanceof bs?this.insert(this.createElement(e),t,"end"):this.insert(this.createElement(e,t),n,"end")}setAttribute(e,t,n){if(this._assertWriterUsedCorrectly(),n instanceof vs){const o=n.getMinimalFlatRanges();for(const n of o)qa(this,e,t,n)}else ja(this,e,t,n)}setAttributes(e,t){for(const[n,o]of Fn(e))this.setAttribute(n,o,t)}removeAttribute(e,t){if(this._assertWriterUsedCorrectly(),t instanceof vs){const n=t.getMinimalFlatRanges();for(const t of n)qa(this,e,null,t)}else ja(this,e,null,t)}clearAttributes(e){this._assertWriterUsedCorrectly();const t=e=>{for(const t of e.getAttributeKeys())this.removeAttribute(t,e)};if(e instanceof vs)for(const n of e.getItems())t(n);else t(e)}move(e,t,n){if(this._assertWriterUsedCorrectly(),!(e instanceof vs))throw new fn.b("writer-move-invalid-range: Invalid range to move.",this);if(!e.isFlat)throw new fn.b("writer-move-range-not-flat: Range to move is not flat.",this);const o=_s._createAt(t,n);if(o.isEqual(e.start))return;if(this._addOperationForAffectedMarkers("move",e),!Ua(e.root,o.root))throw new fn.b("writer-move-different-document: Range is going to be moved between different documents.",this);const i=e.root.document?e.root.document.version:null,r=new Oa(e.start,e.end.offset-e.start.offset,o,i);this.batch.addOperation(r),this.model.applyOperation(r)}remove(e){this._assertWriterUsedCorrectly();const t=(e instanceof vs?e:vs._createOn(e)).getMinimalFlatRanges().reverse();for(const e of t)this._addOperationForAffectedMarkers("move",e),Wa(e.start,e.end.offset-e.start.offset,this.batch,this.model)}merge(e){this._assertWriterUsedCorrectly();const t=e.nodeBefore,n=e.nodeAfter;if(this._addOperationForAffectedMarkers("merge",e),!(t instanceof bs))throw new fn.b("writer-merge-no-element-before: Node before merge position must be an element.",this);if(!(n instanceof bs))throw new fn.b("writer-merge-no-element-after: Node after merge position must be an element.",this);e.root.document?this._merge(e):this._mergeDetached(e)}createPositionFromPath(e,t,n){return this.model.createPositionFromPath(e,t,n)}createPositionAt(e,t){return this.model.createPositionAt(e,t)}createPositionAfter(e){return this.model.createPositionAfter(e)}createPositionBefore(e){return this.model.createPositionBefore(e)}createRange(e,t){return this.model.createRange(e,t)}createRangeIn(e){return this.model.createRangeIn(e)}createRangeOn(e){return this.model.createRangeOn(e)}createSelection(e,t,n){return this.model.createSelection(e,t,n)}_mergeDetached(e){const t=e.nodeBefore,n=e.nodeAfter;this.move(vs._createIn(n),_s._createAt(t,"end")),this.remove(n)}_merge(e){const t=_s._createAt(e.nodeBefore,"end"),n=_s._createAt(e.nodeAfter,0),o=e.root.document.graveyard,i=new _s(o,[0]),r=e.root.document.version,s=new Fa(n,e.nodeAfter.maxOffset,t,i,r);this.batch.addOperation(s),this.model.applyOperation(s)}rename(e,t){if(this._assertWriterUsedCorrectly(),!(e instanceof bs))throw new fn.b("writer-rename-not-element-instance: Trying to rename an object which is not an instance of Element.",this);const n=e.root.document?e.root.document.version:null,o=new Va(_s._createBefore(e),e.name,t,n);this.batch.addOperation(o),this.model.applyOperation(o)}split(e,t){this._assertWriterUsedCorrectly();let n,o,i=e.parent;if(!i.parent)throw new fn.b("writer-split-element-no-parent: Element with no parent can not be split.",this);if(t||(t=i.parent),!e.parent.getAncestors({includeSelf:!0}).includes(t))throw new fn.b("writer-split-invalid-limit-element: Limit element is not a position ancestor.",this);do{const t=i.root.document?i.root.document.version:null,r=i.maxOffset-e.offset,s=new Ba(e,r,null,t);this.batch.addOperation(s),this.model.applyOperation(s),n||o||(n=i,o=e.parent.nextSibling),i=(e=this.createPositionAfter(e.parent)).parent}while(i!==t);return{position:e,range:new vs(_s._createAt(n,"end"),_s._createAt(o,0))}}wrap(e,t){if(this._assertWriterUsedCorrectly(),!e.isFlat)throw new fn.b("writer-wrap-range-not-flat: Range to wrap is not flat.",this);const n=t instanceof bs?t:new bs(t);if(n.childCount>0)throw new fn.b("writer-wrap-element-not-empty: Element to wrap with is not empty.",this);if(null!==n.parent)throw new fn.b("writer-wrap-element-attached: Element to wrap with is already attached to tree model.",this);this.insert(n,e.start);const o=new vs(e.start.getShiftedBy(1),e.end.getShiftedBy(1));this.move(o,_s._createAt(n,0))}unwrap(e){if(this._assertWriterUsedCorrectly(),null===e.parent)throw new fn.b("writer-unwrap-element-no-parent: Trying to unwrap an element which has no parent.",this);this.move(vs._createIn(e),this.createPositionAfter(e)),this.remove(e)}addMarker(e,t){if(this._assertWriterUsedCorrectly(),!t||"boolean"!=typeof t.usingOperation)throw new fn.b("writer-addMarker-no-usingOperation: The options.usingOperation parameter is required when adding a new marker.",this);const n=t.usingOperation,o=t.range,i=void 0!==t.affectsData&&t.affectsData;if(this.model.markers.has(e))throw new fn.b("writer-addMarker-marker-exists: Marker with provided name already exists.",this);if(!o)throw new fn.b("writer-addMarker-no-range: Range parameter is required when adding a new marker.",this);return n?(Ha(this,e,null,o,i),this.model.markers.get(e)):this.model.markers._set(e,o,n,i)}updateMarker(e,t){this._assertWriterUsedCorrectly();const n="string"==typeof e?e:e.name,o=this.model.markers.get(n);if(!o)throw new fn.b("writer-updateMarker-marker-not-exists: Marker with provided name does not exists.",this);if(!t)return void this.model.markers._refresh(o);const i="boolean"==typeof t.usingOperation,r="boolean"==typeof t.affectsData,s=r?t.affectsData:o.affectsData;if(!i&&!t.range&&!r)throw new fn.b("writer-updateMarker-wrong-options: One of the options is required - provide range, usingOperations or affectsData.",this);const a=o.getRange(),c=t.range?t.range:a;i&&t.usingOperation!==o.managedUsingOperations?t.usingOperation?Ha(this,n,null,c,s):(Ha(this,n,a,null,s),this.model.markers._set(n,c,void 0,s)):o.managedUsingOperations?Ha(this,n,a,c,s):this.model.markers._set(n,c,void 0,s)}removeMarker(e){this._assertWriterUsedCorrectly();const t="string"==typeof e?e:e.name;if(!this.model.markers.has(t))throw new fn.b("writer-removeMarker-no-marker: Trying to remove marker which does not exist.",this);const n=this.model.markers.get(t);n.managedUsingOperations?Ha(this,t,n.getRange(),null,n.affectsData):this.model.markers._remove(t)}setSelection(e,t,n){this._assertWriterUsedCorrectly(),this.model.document.selection._setTo(e,t,n)}setSelectionFocus(e,t){this._assertWriterUsedCorrectly(),this.model.document.selection._setFocus(e,t)}setSelectionAttribute(e,t){if(this._assertWriterUsedCorrectly(),"string"==typeof e)this._setSelectionAttribute(e,t);else for(const[t,n]of Fn(e))this._setSelectionAttribute(t,n)}removeSelectionAttribute(e){if(this._assertWriterUsedCorrectly(),"string"==typeof e)this._removeSelectionAttribute(e);else for(const t of e)this._removeSelectionAttribute(t)}overrideSelectionGravity(){return this.model.document.selection._overrideGravity()}restoreSelectionGravity(e){this.model.document.selection._restoreGravity(e)}_setSelectionAttribute(e,t){const n=this.model.document.selection;if(n.isCollapsed&&n.anchor.parent.isEmpty){const o=Vs._getStoreAttributeKey(e);this.setAttribute(o,t,n.anchor.parent)}n._setAttribute(e,t)}_removeSelectionAttribute(e){const t=this.model.document.selection;if(t.isCollapsed&&t.anchor.parent.isEmpty){const n=Vs._getStoreAttributeKey(e);this.removeAttribute(n,t.anchor.parent)}t._removeAttribute(e)}_assertWriterUsedCorrectly(){if(this.model._currentWriter!==this)throw new fn.b("writer-incorrect-use: Trying to use a writer outside the change() block.",this)}_addOperationForAffectedMarkers(e,t){for(const n of this.model.markers){if(!n.managedUsingOperations)continue;const o=n.getRange();let i=!1;if("move"==e)i=t.containsPosition(o.start)||t.start.isEqual(o.start)||t.containsPosition(o.end)||t.end.isEqual(o.end);else{const e=t.nodeBefore,n=t.nodeAfter,r=o.start.parent==e&&o.start.isAtEnd,s=o.end.parent==n&&0==o.end.offset,a=o.end.nodeAfter==n,c=o.start.nodeAfter==n;i=r||s||a||c}i&&this.updateMarker(n.name,{range:o})}}}function qa(e,t,n,o){const i=e.model,r=i.document;let s,a,c,l=o.start;for(const e of o.getWalker({shallow:!0}))c=e.item.getAttribute(t),s&&a!=c&&(a!=n&&d(),l=s),s=e.nextPosition,a=c;function d(){const o=new vs(l,s),c=o.root.document?r.version:null,d=new Ra(o,t,a,n,c);e.batch.addOperation(d),i.applyOperation(d)}s instanceof _s&&s!=l&&a!=n&&d()}function ja(e,t,n,o){const i=e.model,r=i.document,s=o.getAttribute(t);let a,c;if(s!=n){if(o.root===o){const e=o.document?r.version:null;c=new Da(o,t,s,n,e)}else{a=new vs(_s._createBefore(o),e.createPositionAfter(o));const i=a.root.document?r.version:null;c=new Ra(a,t,s,n,i)}e.batch.addOperation(c),i.applyOperation(c)}}function Ha(e,t,n,o,i){const r=e.model,s=r.document,a=new Ma(t,n,o,r.markers,i,s.version);e.batch.addOperation(a),r.applyOperation(a)}function Wa(e,t,n,o){let i;if(e.root.document){const n=o.document,r=new _s(n.graveyard,[0]);i=new Oa(e,t,r,n.version)}else i=new Ia(e,t);n.addOperation(i),o.applyOperation(i)}function Ua(e,t){return e===t||e instanceof La&&t instanceof La}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class $a{constructor(e){this._markerCollection=e,this._changesInElement=new Map,this._elementSnapshots=new Map,this._changedMarkers=new Map,this._changeCount=0,this._cachedChanges=null,this._cachedChangesWithGraveyard=null}get isEmpty(){return 0==this._changesInElement.size&&0==this._changedMarkers.size}refreshItem(e){if(this._isInInsertedElement(e.parent))return;this._markRemove(e.parent,e.startOffset,e.offsetSize),this._markInsert(e.parent,e.startOffset,e.offsetSize);const t=vs._createOn(e);for(const e of this._markerCollection.getMarkersIntersectingRange(t)){const t=e.getRange();this.bufferMarkerChange(e.name,t,t,e.affectsData)}this._cachedChanges=null}bufferOperation(e){switch(e.type){case"insert":if(this._isInInsertedElement(e.position.parent))return;this._markInsert(e.position.parent,e.position.offset,e.nodes.maxOffset);break;case"addAttribute":case"removeAttribute":case"changeAttribute":for(const t of e.range.getItems({shallow:!0}))this._isInInsertedElement(t.parent)||this._markAttribute(t);break;case"remove":case"move":case"reinsert":{if(e.sourcePosition.isEqual(e.targetPosition)||e.sourcePosition.getShiftedBy(e.howMany).isEqual(e.targetPosition))return;const t=this._isInInsertedElement(e.sourcePosition.parent),n=this._isInInsertedElement(e.targetPosition.parent);t||this._markRemove(e.sourcePosition.parent,e.sourcePosition.offset,e.howMany),n||this._markInsert(e.targetPosition.parent,e.getMovedRangeStart().offset,e.howMany);break}case"rename":{if(this._isInInsertedElement(e.position.parent))return;this._markRemove(e.position.parent,e.position.offset,1),this._markInsert(e.position.parent,e.position.offset,1);const t=vs._createFromPositionAndShift(e.position,1);for(const e of this._markerCollection.getMarkersIntersectingRange(t)){const t=e.getRange();this.bufferMarkerChange(e.name,t,t,e.affectsData)}break}case"split":{const t=e.splitPosition.parent;this._isInInsertedElement(t)||this._markRemove(t,e.splitPosition.offset,e.howMany),this._isInInsertedElement(e.insertionPosition.parent)||this._markInsert(e.insertionPosition.parent,e.insertionPosition.offset,1),e.graveyardPosition&&this._markRemove(e.graveyardPosition.parent,e.graveyardPosition.offset,1);break}case"merge":{const t=e.sourcePosition.parent;this._isInInsertedElement(t.parent)||this._markRemove(t.parent,t.startOffset,1);const n=e.graveyardPosition.parent;this._markInsert(n,e.graveyardPosition.offset,1);const o=e.targetPosition.parent;this._isInInsertedElement(o)||this._markInsert(o,e.targetPosition.offset,t.maxOffset);break}}this._cachedChanges=null}bufferMarkerChange(e,t,n,o){const i=this._changedMarkers.get(e);i?(i.newRange=n,i.affectsData=o,null==i.oldRange&&null==i.newRange&&this._changedMarkers.delete(e)):this._changedMarkers.set(e,{oldRange:t,newRange:n,affectsData:o})}getMarkersToRemove(){const e=[];for(const[t,n]of this._changedMarkers)null!=n.oldRange&&e.push({name:t,range:n.oldRange});return e}getMarkersToAdd(){const e=[];for(const[t,n]of this._changedMarkers)null!=n.newRange&&e.push({name:t,range:n.newRange});return e}getChangedMarkers(){return Array.from(this._changedMarkers).map(e=>({name:e[0],data:{oldRange:e[1].oldRange,newRange:e[1].newRange}}))}hasDataChanges(){for(const[,e]of this._changedMarkers)if(e.affectsData)return!0;return this._changesInElement.size>0}getChanges(e={includeChangesInGraveyard:!1}){if(this._cachedChanges)return e.includeChangesInGraveyard?this._cachedChangesWithGraveyard.slice():this._cachedChanges.slice();const t=[];for(const e of this._changesInElement.keys()){const n=this._changesInElement.get(e).sort((e,t)=>e.offset===t.offset?e.type!=t.type?"remove"==e.type?-1:1:0:e.offset<t.offset?-1:1),o=this._elementSnapshots.get(e),i=Ga(e.getChildren()),r=Ka(o.length,n);let s=0,a=0;for(const n of r)if("i"===n)t.push(this._getInsertDiff(e,s,i[s].name)),s++;else if("r"===n)t.push(this._getRemoveDiff(e,s,o[a].name)),a++;else if("a"===n){const n=i[s].attributes,r=o[a].attributes;let c;if("$text"==i[s].name)c=new vs(_s._createAt(e,s),_s._createAt(e,s+1));else{const t=e.offsetToIndex(s);c=new vs(_s._createAt(e,s),_s._createAt(e.getChild(t),0))}t.push(...this._getAttributesDiff(c,r,n)),s++,a++}else s++,a++}t.sort((e,t)=>e.position.root!=t.position.root?e.position.root.rootName<t.position.root.rootName?-1:1:e.position.isEqual(t.position)?e.changeCount-t.changeCount:e.position.isBefore(t.position)?-1:1);for(let e=1;e<t.length;e++){const n=t[e-1],o=t[e],i="remove"==n.type&&"remove"==o.type&&"$text"==n.name&&"$text"==o.name&&n.position.isEqual(o.position),r="insert"==n.type&&"insert"==o.type&&"$text"==n.name&&"$text"==o.name&&n.position.parent==o.position.parent&&n.position.offset+n.length==o.position.offset,s="attribute"==n.type&&"attribute"==o.type&&n.position.parent==o.position.parent&&n.range.isFlat&&o.range.isFlat&&n.position.offset+n.length==o.position.offset&&n.attributeKey==o.attributeKey&&n.attributeOldValue==o.attributeOldValue&&n.attributeNewValue==o.attributeNewValue;(i||r||s)&&(t[e-1].length++,s&&(t[e-1].range.end=t[e-1].range.end.getShiftedBy(1)),t.splice(e,1),e--)}for(const e of t)delete e.changeCount,"attribute"==e.type&&(delete e.position,delete e.length);return this._changeCount=0,this._cachedChangesWithGraveyard=t.slice(),this._cachedChanges=t.slice().filter(Ja),e.includeChangesInGraveyard?this._cachedChangesWithGraveyard:this._cachedChanges}reset(){this._changesInElement.clear(),this._elementSnapshots.clear(),this._changedMarkers.clear(),this._cachedChanges=null}_markInsert(e,t,n){const o={type:"insert",offset:t,howMany:n,count:this._changeCount++};this._markChange(e,o)}_markRemove(e,t,n){const o={type:"remove",offset:t,howMany:n,count:this._changeCount++};this._markChange(e,o),this._removeAllNestedChanges(e,t,n)}_markAttribute(e){const t={type:"attribute",offset:e.startOffset,howMany:e.offsetSize,count:this._changeCount++};this._markChange(e.parent,t)}_markChange(e,t){this._makeSnapshot(e);const n=this._getChangesForElement(e);this._handleChange(t,n),n.push(t);for(let e=0;e<n.length;e++)n[e].howMany<1&&(n.splice(e,1),e--)}_getChangesForElement(e){let t;return this._changesInElement.has(e)?t=this._changesInElement.get(e):(t=[],this._changesInElement.set(e,t)),t}_makeSnapshot(e){this._elementSnapshots.has(e)||this._elementSnapshots.set(e,Ga(e.getChildren()))}_handleChange(e,t){e.nodesToHandle=e.howMany;for(const n of t){const o=e.offset+e.howMany,i=n.offset+n.howMany;if("insert"==e.type&&("insert"==n.type&&(e.offset<=n.offset?n.offset+=e.howMany:e.offset<i&&(n.howMany+=e.nodesToHandle,e.nodesToHandle=0)),"remove"==n.type&&e.offset<n.offset&&(n.offset+=e.howMany),"attribute"==n.type))if(e.offset<=n.offset)n.offset+=e.howMany;else if(e.offset<i){const i=n.howMany;n.howMany=e.offset-n.offset,t.unshift({type:"attribute",offset:o,howMany:i-n.howMany,count:this._changeCount++})}if("remove"==e.type){if("insert"==n.type)if(o<=n.offset)n.offset-=e.howMany;else if(o<=i)if(e.offset<n.offset){const t=o-n.offset;n.offset=e.offset,n.howMany-=t,e.nodesToHandle-=t}else n.howMany-=e.nodesToHandle,e.nodesToHandle=0;else if(e.offset<=n.offset)e.nodesToHandle-=n.howMany,n.howMany=0;else if(e.offset<i){const t=i-e.offset;n.howMany-=t,e.nodesToHandle-=t}if("remove"==n.type&&(o<=n.offset?n.offset-=e.howMany:e.offset<n.offset&&(e.nodesToHandle+=n.howMany,n.howMany=0)),"attribute"==n.type)if(o<=n.offset)n.offset-=e.howMany;else if(e.offset<n.offset){const t=o-n.offset;n.offset=e.offset,n.howMany-=t}else if(e.offset<i)if(o<=i){const o=n.howMany;n.howMany=e.offset-n.offset;const i=o-n.howMany-e.nodesToHandle;t.unshift({type:"attribute",offset:e.offset,howMany:i,count:this._changeCount++})}else n.howMany-=i-e.offset}if("attribute"==e.type){if("insert"==n.type)if(e.offset<n.offset&&o>n.offset){if(o>i){const e={type:"attribute",offset:i,howMany:o-i,count:this._changeCount++};this._handleChange(e,t),t.push(e)}e.nodesToHandle=n.offset-e.offset,e.howMany=e.nodesToHandle}else e.offset>=n.offset&&e.offset<i&&(o>i?(e.nodesToHandle=o-i,e.offset=i):e.nodesToHandle=0);if("remove"==n.type&&e.offset<n.offset&&o>n.offset){const i={type:"attribute",offset:n.offset,howMany:o-n.offset,count:this._changeCount++};this._handleChange(i,t),t.push(i),e.nodesToHandle=n.offset-e.offset,e.howMany=e.nodesToHandle}"attribute"==n.type&&(e.offset>=n.offset&&o<=i?(e.nodesToHandle=0,e.howMany=0,e.offset=0):e.offset<=n.offset&&o>=i&&(n.howMany=0))}}e.howMany=e.nodesToHandle,delete e.nodesToHandle}_getInsertDiff(e,t,n){return{type:"insert",position:_s._createAt(e,t),name:n,length:1,changeCount:this._changeCount++}}_getRemoveDiff(e,t,n){return{type:"remove",position:_s._createAt(e,t),name:n,length:1,changeCount:this._changeCount++}}_getAttributesDiff(e,t,n){const o=[];n=new Map(n);for(const[i,r]of t){const t=n.has(i)?n.get(i):null;t!==r&&o.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:i,attributeOldValue:r,attributeNewValue:t,changeCount:this._changeCount++}),n.delete(i)}for(const[t,i]of n)o.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:t,attributeOldValue:null,attributeNewValue:i,changeCount:this._changeCount++});return o}_isInInsertedElement(e){const t=e.parent;if(!t)return!1;const n=this._changesInElement.get(t),o=e.startOffset;if(n)for(const e of n)if("insert"==e.type&&o>=e.offset&&o<e.offset+e.howMany)return!0;return this._isInInsertedElement(t)}_removeAllNestedChanges(e,t,n){const o=new vs(_s._createAt(e,t),_s._createAt(e,t+n));for(const e of o.getItems({shallow:!0}))e.is("element")&&(this._elementSnapshots.delete(e),this._changesInElement.delete(e),this._removeAllNestedChanges(e,0,e.maxOffset))}}function Ga(e){const t=[];for(const n of e)if(n.is("text"))for(let e=0;e<n.data.length;e++)t.push({name:"$text",attributes:new Map(n.getAttributes())});else t.push({name:n.name,attributes:new Map(n.getAttributes())});return t}function Ka(e,t){const n=[];let o=0,i=0;for(const e of t){if(e.offset>o){for(let t=0;t<e.offset-o;t++)n.push("e");i+=e.offset-o}if("insert"==e.type){for(let t=0;t<e.howMany;t++)n.push("i");o=e.offset+e.howMany}else if("remove"==e.type){for(let t=0;t<e.howMany;t++)n.push("r");o=e.offset,i+=e.howMany}else n.push(..."a".repeat(e.howMany).split("")),o=e.offset+e.howMany,i+=e.howMany}if(i<e)for(let t=0;t<e-i-o;t++)n.push("e");return n}function Ja(e){const t=e.position&&"$graveyard"==e.position.root.rootName,n=e.range&&"$graveyard"==e.range.root.rootName;return!t&&!n}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Za{constructor(){this._operations=[],this._undoPairs=new Map,this._undoneOperations=new Set}addOperation(e){this._operations.includes(e)||this._operations.push(e)}getOperations(e=0,t=Number.POSITIVE_INFINITY){return e<0?[]:this._operations.slice(e,t)}getOperation(e){return this._operations[e]}setOperationAsUndone(e,t){this._undoPairs.set(t,e),this._undoneOperations.add(e)}isUndoingOperation(e){return this._undoPairs.has(e)}isUndoneOperation(e){return this._undoneOperations.has(e)}getUndoneOperation(e){return this._undoPairs.get(e)}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function Qa(e,t){return!!(n=e.charAt(t-1))&&1==n.length&&/[\ud800-\udbff]/.test(n)&&function(e){return!!e&&1==e.length&&/[\udc00-\udfff]/.test(e)}(e.charAt(t));var n}function Ya(e,t){return!!(n=e.charAt(t))&&1==n.length&&/[\u0300-\u036f\u1ab0-\u1aff\u1dc0-\u1dff\u20d0-\u20ff\ufe20-\ufe2f]/.test(n);var n}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Xa{constructor(e){this.model=e,this.version=0,this.history=new Za(this),this.selection=new Vs(this),this.roots=new Cn({idProperty:"rootName"}),this.differ=new $a(e.markers),this._postFixers=new Set,this._hasSelectionChangedFromTheLastChangeBlock=!1,this.createRoot("$root","$graveyard"),this.listenTo(e,"applyOperation",(e,t)=>{const n=t[0];if(n.isDocumentOperation&&n.baseVersion!==this.version)throw new fn.b("model-document-applyOperation-wrong-version: Only operations with matching versions can be applied.",this,{operation:n})},{priority:"highest"}),this.listenTo(e,"applyOperation",(e,t)=>{const n=t[0];n.isDocumentOperation&&this.differ.bufferOperation(n)},{priority:"high"}),this.listenTo(e,"applyOperation",(e,t)=>{const n=t[0];n.isDocumentOperation&&(this.version++,this.history.addOperation(n))},{priority:"low"}),this.listenTo(this.selection,"change",()=>{this._hasSelectionChangedFromTheLastChangeBlock=!0}),this.listenTo(e.markers,"update",(e,t,n,o)=>{this.differ.bufferMarkerChange(t.name,n,o,t.affectsData),null===n&&t.on("change",(e,n)=>{this.differ.bufferMarkerChange(t.name,n,t.getRange(),t.affectsData)})})}get graveyard(){return this.getRoot("$graveyard")}createRoot(e="$root",t="main"){if(this.roots.get(t))throw new fn.b("model-document-createRoot-name-exists: Root with specified name already exists.",this,{name:t});const n=new La(this,e,t);return this.roots.add(n),n}destroy(){this.selection.destroy(),this.stopListening()}getRoot(e="main"){return this.roots.get(e)}getRootNames(){return Array.from(this.roots,e=>e.rootName).filter(e=>"$graveyard"!=e)}registerPostFixer(e){this._postFixers.add(e)}toJSON(){const e=On(this);return e.selection="[engine.model.DocumentSelection]",e.model="[engine.model.Model]",e}_handleChangeBlock(e){this._hasDocumentChangedFromTheLastChangeBlock()&&(this._callPostFixers(e),this.selection.refresh(),this.differ.hasDataChanges()?this.fire("change:data",e.batch):this.fire("change",e.batch),this.selection.refresh(),this.differ.reset()),this._hasSelectionChangedFromTheLastChangeBlock=!1}_hasDocumentChangedFromTheLastChangeBlock(){return!this.differ.isEmpty||this._hasSelectionChangedFromTheLastChangeBlock}_getDefaultRoot(){for(const e of this.roots)if(e!==this.graveyard)return e;return this.graveyard}_getDefaultRange(){const e=this._getDefaultRoot(),t=this.model,n=t.schema,o=t.createPositionFromPath(e,[0]);return n.getNearestSelectionRange(o)||t.createRange(o)}_validateSelectionRange(e){return ec(e.start)&&ec(e.end)}_callPostFixers(e){let t=!1;do{for(const n of this._postFixers)if(this.selection.refresh(),t=n(e),t)break}while(t)}}function ec(e){const t=e.textNode;if(t){const n=t.data,o=e.offset-t.startOffset;return!Qa(n,o)&&!Ya(n,o)}return!0}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/xn(Xa,gn);class tc{constructor(){this._markers=new Map}[Symbol.iterator](){return this._markers.values()}has(e){return this._markers.has(e)}get(e){return this._markers.get(e)||null}_set(e,t,n=!1,o=!1){const i=e instanceof nc?e.name:e,r=this._markers.get(i);if(r){const e=r.getRange();let s=!1;return e.isEqual(t)||(r._attachLiveRange(Os.fromRange(t)),s=!0),n!=r.managedUsingOperations&&(r._managedUsingOperations=n,s=!0),"boolean"==typeof o&&o!=r.affectsData&&(r._affectsData=o,s=!0),s&&this.fire("update:"+i,r,e,t),r}const s=Os.fromRange(t),a=new nc(i,s,n,o);return this._markers.set(i,a),this.fire("update:"+i,a,null,t),a}_remove(e){const t=e instanceof nc?e.name:e,n=this._markers.get(t);return!!n&&(this._markers.delete(t),this.fire("update:"+t,n,n.getRange(),null),this._destroyMarker(n),!0)}_refresh(e){const t=e instanceof nc?e.name:e,n=this._markers.get(t);if(!n)throw new fn.b("markercollection-refresh-marker-not-exists: Marker with provided name does not exists.",this);const o=n.getRange();this.fire("update:"+t,n,o,o,n.managedUsingOperations,n.affectsData)}*getMarkersAtPosition(e){for(const t of this)t.getRange().containsPosition(e)&&(yield t)}*getMarkersIntersectingRange(e){for(const t of this)null!==t.getRange().getIntersection(e)&&(yield t)}destroy(){for(const e of this._markers.values())this._destroyMarker(e);this._markers=null,this.stopListening()}*getMarkersGroup(e){for(const t of this._markers.values())t.name.startsWith(e+":")&&(yield t)}_destroyMarker(e){e.stopListening(),e._detachLiveRange()}}xn(tc,gn);class nc{constructor(e,t,n,o){this.name=e,this._liveRange=this._attachLiveRange(t),this._managedUsingOperations=n,this._affectsData=o}get managedUsingOperations(){if(!this._liveRange)throw new fn.b("marker-destroyed: Cannot use a destroyed marker instance.",this);return this._managedUsingOperations}get affectsData(){if(!this._liveRange)throw new fn.b("marker-destroyed: Cannot use a destroyed marker instance.",this);return this._affectsData}getStart(){if(!this._liveRange)throw new fn.b("marker-destroyed: Cannot use a destroyed marker instance.",this);return this._liveRange.start.clone()}getEnd(){if(!this._liveRange)throw new fn.b("marker-destroyed: Cannot use a destroyed marker instance.",this);return this._liveRange.end.clone()}getRange(){if(!this._liveRange)throw new fn.b("marker-destroyed: Cannot use a destroyed marker instance.",this);return this._liveRange.toRange()}is(e){return"marker"==e||"model:marker"==e}_attachLiveRange(e){return this._liveRange&&this._detachLiveRange(),e.delegate("change:range").to(this),e.delegate("change:content").to(this),this._liveRange=e,e}_detachLiveRange(){this._liveRange.stopDelegating("change:range",this),this._liveRange.stopDelegating("change:content",this),this._liveRange.detach(),this._liveRange=null}}xn(nc,gn);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
class oc extends _a{get type(){return"noop"}clone(){return new oc(this.baseVersion)}getReversed(){return new oc(this.baseVersion+1)}_execute(){}static get className(){return"NoOperation"}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/const ic={};ic[Ra.className]=Ra,ic[Na.className]=Na,ic[Ma.className]=Ma,ic[Oa.className]=Oa,ic[oc.className]=oc,ic[_a.className]=_a,ic[Va.className]=Va,ic[Da.className]=Da,ic[Ba.className]=Ba,ic[Fa.className]=Fa;
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
class rc extends _s{constructor(e,t,n="toNone"){if(super(e,t,n),!this.root.is("rootElement"))throw new fn.b("model-liveposition-root-not-rootelement: LivePosition's root has to be an instance of RootElement.",e);sc.call(this)}detach(){this.stopListening()}is(e){return"livePosition"==e||"model:livePosition"==e||super.is(e)}toPosition(){return new _s(this.root,this.path.slice(),this.stickiness)}static fromPosition(e,t){return new this(e.root,e.path.slice(),t||e.stickiness)}}function sc(){this.listenTo(this.root.document.model,"applyOperation",(e,t)=>{const n=t[0];n.isDocumentOperation&&ac.call(this,n)},{priority:"low"})}function ac(e){const t=this.getTransformedByOperation(e);if(!this.isEqual(t)){const e=this.toPosition();this.path=t.path,this.root=t.root,this.fire("change",e)}}xn(rc,gn);class cc{constructor(e,t,n){this.model=e,this.writer=t,this.position=n,this.canMergeWith=new Set([this.position.parent]),this.schema=e.schema,this._filterAttributesOf=[],this._affectedStart=null,this._affectedEnd=null}handleNodes(e,t){e=Array.from(e);for(let n=0;n<e.length;n++){const o=e[n];this._handleNode(o,{isFirst:0===n&&t.isFirst,isLast:n===e.length-1&&t.isLast})}this.schema.removeDisallowedAttributes(this._filterAttributesOf,this.writer),this._filterAttributesOf=[]}getSelectionRange(){return this.nodeToSelect?vs._createOn(this.nodeToSelect):this.model.schema.getNearestSelectionRange(this.position)}getAffectedRange(){return this._affectedStart?new vs(this._affectedStart,this._affectedEnd):null}destroy(){this._affectedStart&&this._affectedStart.detach(),this._affectedEnd&&this._affectedEnd.detach()}_handleNode(e,t){if(this.schema.isObject(e))return void this._handleObject(e,t);this._checkAndSplitToAllowedPosition(e,t)?(this._insert(e),this._mergeSiblingsOf(e,t)):this._handleDisallowedNode(e,t)}_handleObject(e,t){this._checkAndSplitToAllowedPosition(e)?this._insert(e):this._tryAutoparagraphing(e,t)}_handleDisallowedNode(e,t){e.is("element")?this.handleNodes(e.getChildren(),t):this._tryAutoparagraphing(e,t)}_insert(e){if(!this.schema.checkChild(this.position,e))throw new fn.b("insertcontent-wrong-position: Given node cannot be inserted on the given position.",this,{node:e,position:this.position});const t=rc.fromPosition(this.position,"toNext");this._setAffectedBoundaries(this.position),this.writer.insert(e,this.position),this.position=t.toPosition(),t.detach(),this.schema.isObject(e)&&!this.schema.checkChild(this.position,"$text")?this.nodeToSelect=e:this.nodeToSelect=null,this._filterAttributesOf.push(e)}_setAffectedBoundaries(e){this._affectedStart||(this._affectedStart=rc.fromPosition(e,"toPrevious")),this._affectedEnd&&!this._affectedEnd.isBefore(e)||(this._affectedEnd&&this._affectedEnd.detach(),this._affectedEnd=rc.fromPosition(e,"toNext"))}_mergeSiblingsOf(e,t){if(!(e instanceof bs))return;const n=this._canMergeLeft(e,t),o=this._canMergeRight(e,t),i=rc._createBefore(e);i.stickiness="toNext";const r=rc._createAfter(e);if(r.stickiness="toNext",n){const e=rc.fromPosition(this.position);e.stickiness="toNext",this._affectedStart.isEqual(i)&&(this._affectedStart.detach(),this._affectedStart=rc._createAt(i.nodeBefore,"end","toPrevious")),this.writer.merge(i),i.isEqual(this._affectedEnd)&&t.isLast&&(this._affectedEnd.detach(),this._affectedEnd=rc._createAt(i.nodeBefore,"end","toNext")),this.position=e.toPosition(),e.detach()}if(o){if(!this.position.isEqual(r))throw new fn.b("insertcontent-invalid-insertion-position",this);this.position=_s._createAt(r.nodeBefore,"end");const e=rc.fromPosition(this.position,"toPrevious");this._affectedEnd.isEqual(r)&&(this._affectedEnd.detach(),this._affectedEnd=rc._createAt(r.nodeBefore,"end","toNext")),this.writer.merge(r),r.getShiftedBy(-1).isEqual(this._affectedStart)&&t.isFirst&&(this._affectedStart.detach(),this._affectedStart=rc._createAt(r.nodeBefore,0,"toPrevious")),this.position=e.toPosition(),e.detach()}(n||o)&&this._filterAttributesOf.push(this.position.parent),i.detach(),r.detach()}_canMergeLeft(e,t){const n=e.previousSibling;return t.isFirst&&n instanceof bs&&this.canMergeWith.has(n)&&this.model.schema.checkMerge(n,e)}_canMergeRight(e,t){const n=e.nextSibling;return t.isLast&&n instanceof bs&&this.canMergeWith.has(n)&&this.model.schema.checkMerge(e,n)}_tryAutoparagraphing(e,t){const n=this.writer.createElement("paragraph");this._getAllowedIn(n,this.position.parent)&&this.schema.checkChild(n,e)&&(n._appendChild(e),this._handleNode(n,t))}_checkAndSplitToAllowedPosition(e){const t=this._getAllowedIn(e,this.position.parent);if(!t)return!1;for(;t!=this.position.parent;){if(this.schema.isLimit(this.position.parent))return!1;if(this.position.isAtStart){const e=this.position.parent;this.position=this.writer.createPositionBefore(e),e.isEmpty&&e.parent===t&&this.writer.remove(e)}else if(this.position.isAtEnd)this.position=this.writer.createPositionAfter(this.position.parent);else{const e=this.writer.createPositionAfter(this.position.parent);this._setAffectedBoundaries(this.position),this.writer.split(this.position),this.position=e,this.canMergeWith.add(this.position.nodeAfter)}}return!0}_getAllowedIn(e,t){return this.schema.checkChild(t,e)?t:t.parent?this._getAllowedIn(e,t.parent):null}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function lc(e,t,n={}){if(t.isCollapsed)return;const o=t.getFirstRange();if("$graveyard"==o.root.rootName)return;const i=e.schema;e.change(e=>{if(!n.doNotResetEntireContent&&function(e,t){const n=e.getLimitElement(t);if(!t.containsEntireContent(n))return!1;const o=t.getFirstRange();if(o.start.parent==o.end.parent)return!1;return e.checkChild(n,"paragraph")}(i,t))return void function(e,t){const n=e.model.schema.getLimitElement(t);e.remove(e.createRangeIn(n)),dc(e,e.createPositionAt(n,0),t)}(e,t);const r=o.start,s=rc.fromPosition(o.end,"toNext");o.start.isTouching(o.end)||e.remove(o),n.leaveUnmerged||(!function e(t,n,o){const i=n.parent,r=o.parent;if(i==r)return;if(t.model.schema.isLimit(i)||t.model.schema.isLimit(r))return;if(!function(e,t,n){const o=new vs(e,t);for(const e of o.getWalker())if(n.isLimit(e.item))return!1;return!0}(n,o,t.model.schema))return;n=t.createPositionAfter(i),(o=t.createPositionBefore(r)).isEqual(n)||t.insert(r,n);t.merge(n);for(;o.parent.isEmpty;){const e=o.parent;o=t.createPositionBefore(e),t.remove(e)}e(t,n,o)}(e,r,s),i.removeDisallowedAttributes(r.parent.getChildren(),e)),uc(e,t,r),!n.doNotAutoparagraph&&function(e,t){const n=e.checkChild(t,"$text"),o=e.checkChild(t,"paragraph");return!n&&o}(i,r)&&dc(e,r,t),s.detach()})}function dc(e,t,n){const o=e.createElement("paragraph");e.insert(o,t),uc(e,n,e.createPositionAt(o,0))}function uc(e,t,n){t instanceof Vs?e.setSelection(n):t.setTo(n)}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function hc(e,t){if("text"==t.type)return"word"===e.unit?function(e,t){let n=e.position.textNode;if(n){let o=e.position.offset-n.startOffset;for(;!pc(n.data,o,t)&&!mc(n,o,t);){e.next();const i=t?e.position.nodeAfter:e.position.nodeBefore;if(i&&i.is("text")){const o=i.data.charAt(t?0:i.data.length-1);' ,.?!:;"-()'.includes(o)||(e.next(),n=e.position.textNode)}o=e.position.offset-n.startOffset}}return e.position}(e.walker,e.isForward):function(e,t){const n=e.position.textNode;if(n){const o=n.data;let i=e.position.offset-n.startOffset;for(;Qa(o,i)||"character"==t&&Ya(o,i);)e.next(),i=e.position.offset-n.startOffset}return e.position}(e.walker,e.unit,e.isForward);if(t.type==(e.isForward?"elementStart":"elementEnd")){if(e.schema.isObject(t.item))return _s._createAt(t.item,e.isForward?"after":"before");if(e.schema.checkChild(t.nextPosition,"$text"))return t.nextPosition}else{if(e.schema.isLimit(t.item))return void e.walker.skip(()=>!0);if(e.schema.checkChild(t.nextPosition,"$text"))return t.nextPosition}}function fc(e,t){const n=e.root,o=_s._createAt(n,t?"end":0);return t?new vs(e,o):new vs(o,e)}function pc(e,t,n){const o=t+(n?0:-1);return' ,.?!:;"-()'.includes(e.charAt(o))}function mc(e,t,n){return t===(n?e.endOffset:0)}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function gc(e,t){const n=[];Array.from(e.getItems({direction:"backward"})).map(e=>t.createRangeOn(e)).filter(t=>(t.start.isAfter(e.start)||t.start.isEqual(e.start))&&(t.end.isBefore(e.end)||t.end.isEqual(e.end))).forEach(e=>{n.push(e.start.parent),t.remove(e)}),n.forEach(e=>{let n=e;for(;n.parent&&n.isEmpty;){const e=t.createRangeOn(n);n=n.parent,t.remove(e)}})}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function bc(e){e.document.registerPostFixer(t=>function(e,t){const n=t.document.selection,o=t.schema,i=[];let r=!1;for(const e of n.getRanges()){const t=wc(e,o);t?(i.push(t),r=!0):i.push(e)}r&&e.setSelection(function(e){const t=[];t.push(e.shift());for(const n of e){const e=t.pop();if(n.isIntersecting(e)){const o=e.start.isAfter(n.start)?n.start:e.start,i=e.end.isAfter(n.end)?e.end:n.end,r=new vs(o,i);t.push(r)}else t.push(e),t.push(n)}return t}(i),{backward:n.isBackward})}(t,e))}function wc(e,t){return e.isCollapsed?function(e,t){const n=e.start,o=t.getNearestSelectionRange(n);if(!o)return null;if(!o.isCollapsed)return o;const i=o.start;if(n.isEqual(i))return null;return new vs(i)}(e,t):function(e,t){const n=e.start,o=e.end,i=t.checkChild(n,"$text"),r=t.checkChild(o,"$text"),s=t.getLimitElement(n),a=t.getLimitElement(o);if(s===a){if(i&&r)return null;if(function(e,t,n){const o=e.nodeAfter&&!n.isLimit(e.nodeAfter)||n.checkChild(e,"$text"),i=t.nodeBefore&&!n.isLimit(t.nodeBefore)||n.checkChild(t,"$text");return o||i}(n,o,t)){const e=n.nodeAfter&&t.isObject(n.nodeAfter)?null:t.getNearestSelectionRange(n,"forward"),i=o.nodeBefore&&t.isObject(o.nodeBefore)?null:t.getNearestSelectionRange(o,"backward"),r=e?e.start:n,s=i?i.start:o;return new vs(r,s)}}const c=s&&!s.is("rootElement"),l=a&&!a.is("rootElement");if(c||l){const e=n.nodeAfter&&o.nodeBefore&&n.nodeAfter.parent===o.nodeBefore.parent,i=c&&(!e||!_c(n.nodeAfter,t)),r=l&&(!e||!_c(o.nodeBefore,t));let d=n,u=o;return i&&(d=_s._createBefore(kc(s,t))),r&&(u=_s._createAfter(kc(a,t))),new vs(d,u)}return null}(e,t)}function kc(e,t){let n=e,o=n;for(;t.isLimit(o)&&o.parent;)n=o,o=o.parent;return n}function _c(e,t){return e&&t.isObject(e)}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class vc{constructor(){this.markers=new tc,this.document=new Xa(this),this.schema=new ta,this._pendingChanges=[],this._currentWriter=null,["insertContent","deleteContent","modifySelection","getSelectedContent","applyOperation"].forEach(e=>this.decorate(e)),this.on("applyOperation",(e,t)=>{t[0]._validate()},{priority:"highest"}),this.schema.register("$root",{isLimit:!0}),this.schema.register("$block",{allowIn:"$root",isBlock:!0}),this.schema.register("$text",{allowIn:"$block",isInline:!0}),this.schema.register("$clipboardHolder",{allowContentOf:"$root",isLimit:!0}),this.schema.extend("$text",{allowIn:"$clipboardHolder"}),this.schema.register("$marker"),this.schema.addChildCheck((e,t)=>{if("$marker"===t.name)return!0}),bc(this)}change(e){try{return 0===this._pendingChanges.length?(this._pendingChanges.push({batch:new ka,callback:e}),this._runPendingChanges()[0]):e(this._currentWriter)}catch(e){fn.b.rethrowUnexpectedError(e,this)}}enqueueChange(e,t){try{"string"==typeof e?e=new ka(e):"function"==typeof e&&(t=e,e=new ka),this._pendingChanges.push({batch:e,callback:t}),1==this._pendingChanges.length&&this._runPendingChanges()}catch(e){fn.b.rethrowUnexpectedError(e,this)}}applyOperation(e){e._execute()}insertContent(e,t,n){
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
return function(e,t,n,o){return e.change(i=>{let r;r=n?n instanceof Ps||n instanceof Vs?n:i.createSelection(n,o):e.document.selection,r.isCollapsed||e.deleteContent(r,{doNotAutoparagraph:!0});const s=new cc(e,i,r.anchor);let a;a=t.is("documentFragment")?t.getChildren():[t],s.handleNodes(a,{isFirst:!0,isLast:!0});const c=s.getSelectionRange();c&&(r instanceof Vs?i.setSelection(c):r.setTo(c));const l=s.getAffectedRange()||e.createRange(r.anchor);return s.destroy(),l})}(this,e,t,n)}deleteContent(e,t){lc(this,e,t)}modifySelection(e,t){!function(e,t,n={}){const o=e.schema,i="backward"!=n.direction,r=n.unit?n.unit:"character",s=t.focus,a=new ws({boundaries:fc(s,i),singleCharacters:!0,direction:i?"forward":"backward"}),c={walker:a,schema:o,isForward:i,unit:r};let l;for(;l=a.next();){if(l.done)return;const n=hc(c,l.value);if(n)return void(t instanceof Vs?e.change(e=>{e.setSelectionFocus(n)}):t.setFocus(n))}}(this,e,t)}getSelectedContent(e){return function(e,t){return e.change(e=>{const n=e.createDocumentFragment(),o=t.getFirstRange();if(!o||o.isCollapsed)return n;const i=o.start.root,r=o.start.getCommonPath(o.end),s=i.getNodeByPath(r);let a;a=o.start.parent==o.end.parent?o:e.createRange(e.createPositionAt(s,o.start.path[r.length]),e.createPositionAt(s,o.end.path[r.length]+1));const c=a.end.offset-a.start.offset;for(const t of a.getItems({shallow:!0}))t.is("textProxy")?e.appendText(t.data,t.getAttributes(),n):e.append(t._clone(!0),n);if(a!=o){const t=o._getTransformedByMove(a.start,e.createPositionAt(n,0),c)[0],i=e.createRange(e.createPositionAt(n,0),t.start);gc(e.createRange(t.end,e.createPositionAt(n,"end")),e),gc(i,e)}return n})}(this,e)}hasContent(e,t){const n=e instanceof bs?vs._createIn(e):e;if(n.isCollapsed)return!1;for(const e of this.markers.getMarkersIntersectingRange(n))if(e.affectsData)return!0;const{ignoreWhitespaces:o=!1}=t||{};for(const e of n.getItems())if(e.is("textProxy")){if(!o)return!0;if(-1!==e.data.search(/\S/))return!0}else if(this.schema.isObject(e))return!0;return!1}createPositionFromPath(e,t,n){return new _s(e,t,n)}createPositionAt(e,t){return _s._createAt(e,t)}createPositionAfter(e){return _s._createAfter(e)}createPositionBefore(e){return _s._createBefore(e)}createRange(e,t){return new vs(e,t)}createRangeIn(e){return vs._createIn(e)}createRangeOn(e){return vs._createOn(e)}createSelection(e,t,n){return new Ps(e,t,n)}createBatch(e){return new ka(e)}createOperationFromJSON(e){return class{static fromJSON(e,t){return ic[e.__className].fromJSON(e,t)}}.fromJSON(e,this.document)}destroy(){this.document.destroy(),this.stopListening()}_runPendingChanges(){const e=[];for(this.fire("_beforeChanges");this._pendingChanges.length;){const t=this._pendingChanges[0].batch;this._currentWriter=new za(this,t);const n=this._pendingChanges[0].callback(this._currentWriter);e.push(n),this.document._handleChangeBlock(this._currentWriter),this._pendingChanges.shift(),this._currentWriter=null}return this.fire("_afterChanges"),e}}xn(vc,Wo);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
class yc{constructor(){this._listener=Object.create(lr)}listenTo(e){this._listener.listenTo(e,"keydown",(e,t)=>{this._listener.fire("_keydown:"+bi(t),t)})}set(e,t,n={}){const o=wi(e),i=n.priority;this._listener.listenTo(this._listener,"_keydown:"+o,(e,n)=>{t(n,()=>{n.preventDefault(),n.stopPropagation(),e.stop()}),e.return=!0},{priority:i})}press(e){return!!this._listener.fire("_keydown:"+bi(e),e)}destroy(){this._listener.stopListening()}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class xc extends yc{constructor(e){super(),this.editor=e}set(e,t,n={}){if("string"==typeof t){const e=t;t=(t,n)=>{this.editor.execute(e),n()}}super.set(e,t,n)}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Cc{constructor(e={}){this._context=e.context||new Rn({language:e.language}),this._context._addEditor(this,!e.context);const t=Array.from(this.constructor.builtinPlugins||[]);this.config=new rn(e,this.constructor.defaultConfig),this.config.define("plugins",t),this.config.define(this._context._getEditorConfig()),this.plugins=new An(this,t,this._context.plugins),this.locale=this._context.locale,this.t=this.locale.t,this.commands=new Ys,this.set("state","initializing"),this.once("ready",()=>this.state="ready",{priority:"high"}),this.once("destroy",()=>this.state="destroyed",{priority:"high"}),this.set("isReadOnly",!1),this.model=new vc;const n=new Oo;this.data=new ma(this.model,n),this.editing=new Qs(this.model,n),this.editing.view.document.bind("isReadOnly").to(this),this.conversion=new ga([this.editing.downcastDispatcher,this.data.downcastDispatcher],this.data.upcastDispatcher),this.conversion.addAlias("dataDowncast",this.data.downcastDispatcher),this.conversion.addAlias("editingDowncast",this.editing.downcastDispatcher),this.keystrokes=new xc(this),this.keystrokes.listenTo(this.editing.view.document)}initPlugins(){const e=this.config,t=e.get("plugins"),n=e.get("removePlugins")||[],o=e.get("extraPlugins")||[];return this.plugins.init(t.concat(o),n)}destroy(){let e=Promise.resolve();return"initializing"==this.state&&(e=new Promise(e=>this.once("ready",e))),e.then(()=>{this.fire("destroy"),this.stopListening(),this.commands.destroy()}).then(()=>this.plugins.destroy()).then(()=>{this.model.destroy(),this.data.destroy(),this.editing.destroy(),this.keystrokes.destroy()}).then(()=>this._context._removeEditor(this))}execute(...e){try{this.commands.execute(...e)}catch(e){fn.b.rethrowUnexpectedError(e,this)}}}xn(Cc,Wo);var Ac={setData(e){this.data.set(e)},getData(e){return this.data.get(e)}};
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Tc{getHtml(e){const t=document.implementation.createHTMLDocument("").createElement("div");return t.appendChild(e),t.innerHTML}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Pc{constructor(e){this._domParser=new DOMParser,this._domConverter=new ir(e,{blockFillerMode:"nbsp"}),this._htmlWriter=new Tc}toData(e){const t=this._domConverter.viewToDom(e,document);return this._htmlWriter.getHtml(t)}toView(e){const t=this._toDom(e);return this._domConverter.domToView(t)}_toDom(e){const t=this._domParser.parseFromString(e,"text/html"),n=t.createDocumentFragment(),o=t.body.childNodes;for(;o.length>0;)n.appendChild(o[0]);return n}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Ec{constructor(e){this.editor=e,this._components=new Map}*names(){for(const e of this._components.values())yield e.originalName}add(e,t){if(this.has(e))throw new fn.b("componentfactory-item-exists: The item already exists in the component factory.",this,{name:e});this._components.set(Sc(e),{callback:t,originalName:e})}create(e){if(!this.has(e))throw new fn.b("componentfactory-item-missing: The required component is not registered in the factory.",this,{name:e});return this._components.get(Sc(e)).callback(this.editor.locale)}has(e){return this._components.has(Sc(e))}}function Sc(e){return String(e).toLowerCase()}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Rc{constructor(){this.set("isFocused",!1),this.set("focusedElement",null),this._elements=new Set,this._nextEventLoopTimeout=null}add(e){if(this._elements.has(e))throw new fn.b("focusTracker-add-element-already-exist",this);this.listenTo(e,"focus",()=>this._focus(e),{useCapture:!0}),this.listenTo(e,"blur",()=>this._blur(),{useCapture:!0}),this._elements.add(e)}remove(e){e===this.focusedElement&&this._blur(e),this._elements.has(e)&&(this.stopListening(e),this._elements.delete(e))}destroy(){this.stopListening()}_focus(e){clearTimeout(this._nextEventLoopTimeout),this.focusedElement=e,this.isFocused=!0}_blur(){clearTimeout(this._nextEventLoopTimeout),this._nextEventLoopTimeout=setTimeout(()=>{this.focusedElement=null,this.isFocused=!1},0)}}xn(Rc,lr),xn(Rc,Wo);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
class Ic{constructor(e){this.editor=e,this.componentFactory=new Ec(e),this.focusTracker=new Rc,this._editableElementsMap=new Map,this.listenTo(e.editing.view.document,"layoutChanged",()=>this.update())}get element(){return null}update(){this.fire("update")}destroy(){this.stopListening(),this.focusTracker.destroy();for(const e of this._editableElementsMap.values())e.ckeditorInstance=null;this._editableElementsMap=new Map}setEditableElement(e,t){this._editableElementsMap.set(e,t),t.ckeditorInstance||(t.ckeditorInstance=this.editor)}getEditableElement(e="main"){return this._editableElementsMap.get(e)}getEditableElementsNames(){return this._editableElementsMap.keys()}get _editableElements(){return console.warn("editor-ui-deprecated-editable-elements: The EditorUI#_editableElements property has been deprecated and will be removed in the near future.",{editorUI:this}),this._editableElementsMap}}xn(Ic,gn);n(28);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/const Oc=new WeakMap;function Nc(e){const{view:t,element:n,text:o,isDirectHost:i=!0}=e,r=t.document;Oc.has(r)||(Oc.set(r,new Map),r.registerPostFixer(e=>Vc(r,e))),Oc.get(r).set(n,{text:o,isDirectHost:i}),t.change(e=>Vc(r,e))}function Mc(e,t){return!!t.hasClass("ck-placeholder")&&(e.removeClass("ck-placeholder",t),!0)}function Vc(e,t){const n=Oc.get(e);let o=!1;for(const[e,i]of n)Dc(t,e,i)&&(o=!0);return o}function Dc(e,t,n){const{text:o,isDirectHost:i}=n,r=i?t:function(e){if(1===e.childCount){const t=e.getChild(0);if(t.is("element")&&!t.is("uiElement"))return t}return null}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/(t);let s=!1;return!!r&&(n.hostElement=r,r.getAttribute("data-placeholder")!==o&&(e.setAttribute("data-placeholder",o,r),s=!0),!function(e){if(!e.isAttached())return!1;const t=!Array.from(e.getChildren()).some(e=>!e.is("uiElement")),n=e.document;if(!n.isFocused&&t)return!0;const o=n.selection.anchor;return!(!t||!o||o.parent===e)}(r)?Mc(e,r)&&(s=!0):function(e,t){return!t.hasClass("ck-placeholder")&&(e.addClass("ck-placeholder",t),!0)}(e,r)&&(s=!0),s)}class Fc extends Ic{constructor(e,t){
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
var n;super(e),this.view=t,this._toolbarConfig=(n=e.config.get("toolbar"),Array.isArray(n)?{items:n}:n?Object.assign({items:[]},n):{items:[]})}init(){const e=this.editor,t=this.view,n=e.editing.view,o=t.editable,i=n.document.getRoot();t.editable.name=i.rootName,t.render();const r=o.element;this.setEditableElement(o.name,r),this.focusTracker.add(r),t.editable.bind("isFocused").to(this.focusTracker),n.attachDomRoot(r),this._initPlaceholder(),this._initToolbar(),this.fire("ready")}destroy(){const e=this.view;this.editor.editing.view.detachDomRoot(e.editable.name),e.destroy(),super.destroy()}_initToolbar(){const e=this.editor,t=this.view.toolbar;t.fillFromConfig(this._toolbarConfig.items,this.componentFactory),
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
function({origin:e,originKeystrokeHandler:t,originFocusTracker:n,toolbar:o,beforeFocus:i,afterBlur:r}){n.add(o.element),t.set("Alt+F10",(e,t)=>{n.isFocused&&!o.focusTracker.isFocused&&(i&&i(),o.focus(),t())}),o.keystrokes.set("Esc",(t,n)=>{o.focusTracker.isFocused&&(e.focus(),r&&r(),n())})}({origin:e.editing.view,originFocusTracker:this.focusTracker,originKeystrokeHandler:e.keystrokes,toolbar:t})}_initPlaceholder(){const e=this.editor,t=e.editing.view,n=t.document.getRoot(),o=e.sourceElement,i=e.config.get("placeholder")||o&&"textarea"===o.tagName.toLowerCase()&&o.getAttribute("placeholder");i&&Nc({view:t,element:n,text:i,isDirectHost:!1})}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Bc extends Cn{constructor(e){super({idProperty:"viewUid"}),this.on("add",(e,t,n)=>{t.isRendered||t.render(),t.element&&this._parentElement&&this._parentElement.insertBefore(t.element,this._parentElement.children[n])}),this.on("remove",(e,t)=>{t.element&&this._parentElement&&t.element.remove()}),this.locale=e,this._parentElement=null}destroy(){this.map(e=>e.destroy())}setParent(e){this._parentElement=e}delegate(...e){if(!e.length||!e.every(e=>"string"==typeof e))throw new fn.b("ui-viewcollection-delegate-wrong-events: All event names must be strings.",this);return{to:t=>{for(const n of this)for(const o of e)n.delegate(o).to(t);this.on("add",(n,o)=>{for(const n of e)o.delegate(n).to(t)}),this.on("remove",(n,o)=>{for(const n of e)o.stopDelegating(n,t)})}}}}class Lc{constructor(e){Object.assign(this,Jc(Kc(e))),this._isRendered=!1,this._revertData=null}render(){const e=this._renderNode({intoFragment:!0});return this._isRendered=!0,e}apply(e){return this._revertData={children:[],bindings:[],attributes:{}},this._renderNode({node:e,isApplying:!0,revertData:this._revertData}),e}revert(e){if(!this._revertData)throw new fn.b("ui-template-revert-not-applied: Attempting to revert a template which has not been applied yet.",[this,e]);this._revertTemplateFromNode(e,this._revertData)}*getViews(){yield*function*e(t){if(t.children)for(const n of t.children)el(n)?yield n:tl(n)&&(yield*e(n))}(this)}static bind(e,t){return{to:(n,o)=>new qc({eventNameOrFunction:n,attribute:n,observable:e,emitter:t,callback:o}),if:(n,o,i)=>new jc({observable:e,emitter:t,attribute:n,valueIfTrue:o,callback:i})}}static extend(e,t){if(e._isRendered)throw new fn.b("template-extend-render: Attempting to extend a template which has already been rendered.",[this,e]);!function e(t,n){n.attributes&&(t.attributes||(t.attributes={}),Yc(t.attributes,n.attributes));n.eventListeners&&(t.eventListeners||(t.eventListeners={}),Yc(t.eventListeners,n.eventListeners));n.text&&t.text.push(...n.text);if(n.children&&n.children.length){if(t.children.length!=n.children.length)throw new fn.b("ui-template-extend-children-mismatch: The number of children in extended definition does not match.",t);let o=0;for(const i of n.children)e(t.children[o++],i)}}(e,Jc(Kc(t)))}_renderNode(e){let t;if(t=e.node?this.tag&&this.text:this.tag?this.text:!this.text,t)throw new fn.b('ui-template-wrong-syntax: Node definition must have either "tag" or "text" when rendering a new Node.',this);return this.text?this._renderText(e):this._renderElement(e)}_renderElement(e){let t=e.node;return t||(t=e.node=document.createElementNS(this.ns||"http://www.w3.org/1999/xhtml",this.tag)),this._renderAttributes(e),this._renderElementChildren(e),this._setUpListeners(e),t}_renderText(e){let t=e.node;return t?e.revertData.text=t.textContent:t=e.node=document.createTextNode(""),Hc(this.text)?this._bindToObservable({schema:this.text,updater:Uc(t),data:e}):t.textContent=this.text.join(""),t}_renderAttributes(e){let t,n,o,i;if(!this.attributes)return;const r=e.node,s=e.revertData;for(t in this.attributes)if(o=r.getAttribute(t),n=this.attributes[t],s&&(s.attributes[t]=o),i=B(n[0])&&n[0].ns?n[0].ns:null,Hc(n)){const a=i?n[0].value:n;s&&ol(t)&&a.unshift(o),this._bindToObservable({schema:a,updater:$c(r,t,i),data:e})}else"style"==t&&"string"!=typeof n[0]?this._renderStyleAttribute(n[0],e):(s&&o&&ol(t)&&n.unshift(o),n=n.map(e=>e&&e.value||e).reduce((e,t)=>e.concat(t),[]).reduce(Qc,""),Xc(n)||r.setAttributeNS(i,t,n))}_renderStyleAttribute(e,t){const n=t.node;for(const o in e){const i=e[o];Hc(i)?this._bindToObservable({schema:[i],updater:Gc(n,o),data:t}):n.style[o]=i}}_renderElementChildren(e){const t=e.node,n=e.intoFragment?document.createDocumentFragment():t,o=e.isApplying;let i=0;for(const r of this.children)if(nl(r)){if(!o){r.setParent(t);for(const e of r)n.appendChild(e.element)}}else if(el(r))o||(r.isRendered||r.render(),n.appendChild(r.element));else if(Ji(r))n.appendChild(r);else if(o){const t={children:[],bindings:[],attributes:{}};e.revertData.children.push(t),r._renderNode({node:n.childNodes[i++],isApplying:!0,revertData:t})}else n.appendChild(r.render());e.intoFragment&&t.appendChild(n)}_setUpListeners(e){if(this.eventListeners)for(const t in this.eventListeners){const n=this.eventListeners[t].map(n=>{const[o,i]=t.split("@");return n.activateDomEventListener(o,i,e)});e.revertData&&e.revertData.bindings.push(n)}}_bindToObservable({schema:e,updater:t,data:n}){const o=n.revertData;Wc(e,t,n);const i=e.filter(e=>!Xc(e)).filter(e=>e.observable).map(o=>o.activateAttributeListener(e,t,n));o&&o.bindings.push(i)}_revertTemplateFromNode(e,t){for(const e of t.bindings)for(const t of e)t();if(t.text)e.textContent=t.text;else{for(const n in t.attributes){const o=t.attributes[n];null===o?e.removeAttribute(n):e.setAttribute(n,o)}for(let n=0;n<t.children.length;++n)this._revertTemplateFromNode(e.childNodes[n],t.children[n])}}}xn(Lc,gn);class zc{constructor(e){Object.assign(this,e)}getValue(e){const t=this.observable[this.attribute];return this.callback?this.callback(t,e):t}activateAttributeListener(e,t,n){const o=()=>Wc(e,t,n);return this.emitter.listenTo(this.observable,"change:"+this.attribute,o),()=>{this.emitter.stopListening(this.observable,"change:"+this.attribute,o)}}}class qc extends zc{activateDomEventListener(e,t,n){const o=(e,n)=>{t&&!n.target.matches(t)||("function"==typeof this.eventNameOrFunction?this.eventNameOrFunction(n):this.observable.fire(this.eventNameOrFunction,n))};return this.emitter.listenTo(n.node,e,o),()=>{this.emitter.stopListening(n.node,e,o)}}}class jc extends zc{getValue(e){return!Xc(super.getValue(e))&&(this.valueIfTrue||!0)}}function Hc(e){return!!e&&(e.value&&(e=e.value),Array.isArray(e)?e.some(Hc):e instanceof zc)}function Wc(e,t,{node:n}){let o=function(e,t){return e.map(e=>e instanceof zc?e.getValue(t):e)}(e,n);o=1==e.length&&e[0]instanceof jc?o[0]:o.reduce(Qc,""),Xc(o)?t.remove():t.set(o)}function Uc(e){return{set(t){e.textContent=t},remove(){e.textContent=""}}}function $c(e,t,n){return{set(o){e.setAttributeNS(n,t,o)},remove(){e.removeAttributeNS(n,t)}}}function Gc(e,t){return{set(n){e.style[t]=n},remove(){e.style[t]=null}}}function Kc(e){return nn(e,e=>{if(e&&(e instanceof zc||tl(e)||el(e)||nl(e)))return e})}function Jc(e){if("string"==typeof e?e=function(e){return{text:[e]}}(e):e.text&&function(e){Array.isArray(e.text)||(e.text=[e.text])}(e),e.on&&(e.eventListeners=function(e){for(const t in e)Zc(e,t);return e}(e.on),delete e.on),!e.text){e.attributes&&function(e){for(const t in e)e[t].value&&(e[t].value=[].concat(e[t].value)),Zc(e,t)}(e.attributes);const t=[];if(e.children)if(nl(e.children))t.push(e.children);else for(const n of e.children)tl(n)||el(n)||Ji(n)?t.push(n):t.push(new Lc(n));e.children=t}return e}function Zc(e,t){Array.isArray(e[t])||(e[t]=[e[t]])}function Qc(e,t){return Xc(t)?e:Xc(e)?t:`${e} ${t}`}function Yc(e,t){for(const n in t)e[n]?e[n].push(...t[n]):e[n]=t[n]}function Xc(e){return!e&&0!==e}function el(e){return e instanceof il}function tl(e){return e instanceof Lc}function nl(e){return e instanceof Bc}function ol(e){return"class"==e||"style"==e}n(30);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class il{constructor(e){this.element=null,this.isRendered=!1,this.locale=e,this.t=e&&e.t,this._viewCollections=new Cn,this._unboundChildren=this.createCollection(),this._viewCollections.on("add",(t,n)=>{n.locale=e}),this.decorate("render")}get bindTemplate(){return this._bindTemplate?this._bindTemplate:this._bindTemplate=Lc.bind(this,this)}createCollection(){const e=new Bc;return this._viewCollections.add(e),e}registerChild(e){Dn(e)||(e=[e]);for(const t of e)this._unboundChildren.add(t)}deregisterChild(e){Dn(e)||(e=[e]);for(const t of e)this._unboundChildren.remove(t)}setTemplate(e){this.template=new Lc(e)}extendTemplate(e){Lc.extend(this.template,e)}render(){if(this.isRendered)throw new fn.b("ui-view-render-already-rendered: This View has already been rendered.",this);this.template&&(this.element=this.template.render(),this.registerChild(this.template.getViews())),this.isRendered=!0}destroy(){this.stopListening(),this._viewCollections.map(e=>e.destroy()),this.template&&this.template._revertData&&this.template.revert(this.element)}}xn(il,lr),xn(il,Wo);var rl=function(e){return"string"==typeof e||!De(e)&&g(e)&&"[object String]"==f(e)};
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function sl(e,t,n={},o=[]){const i=n&&n.xmlns,r=i?e.createElementNS(i,t):e.createElement(t);for(const e in n)r.setAttribute(e,n[e]);!rl(o)&&Dn(o)||(o=[o]);for(let t of o)rl(t)&&(t=e.createTextNode(t)),r.appendChild(t);return r}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class al extends Bc{attachToDom(){this._bodyCollectionContainer=new Lc({tag:"div",attributes:{class:["ck","ck-reset_all","ck-body","ck-rounded-corners"],dir:this.locale.uiLanguageDirection},children:this}).render();let e=document.querySelector(".ck-body-wrapper");e||(e=sl(document,"div",{class:"ck-body-wrapper"}),document.body.appendChild(e)),e.appendChild(this._bodyCollectionContainer)}detachFromDom(){super.destroy(),this._bodyCollectionContainer&&this._bodyCollectionContainer.remove();const e=document.querySelector(".ck-body-wrapper");e&&0==e.childElementCount&&e.remove()}}n(32);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class cl extends il{constructor(e){super(e),this.body=new al(e)}render(){super.render(),this.body.attachToDom()}destroy(){return this.body.detachFromDom(),super.destroy()}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class ll extends il{constructor(e,t,n){super(e),this.setTemplate({tag:"div",attributes:{class:["ck","ck-content","ck-editor__editable","ck-rounded-corners"],lang:e.contentLanguage,dir:e.contentLanguageDirection}}),this.name=null,this.set("isFocused",!1),this._editableElement=n,this._hasExternalElement=!!this._editableElement,this._editingView=t}render(){super.render(),this._hasExternalElement?this.template.apply(this.element=this._editableElement):this._editableElement=this.element,this.on("change:isFocused",()=>this._updateIsFocusedClasses()),this._updateIsFocusedClasses()}destroy(){this._hasExternalElement&&this.template.revert(this._editableElement),super.destroy()}_updateIsFocusedClasses(){const e=this._editingView;function t(t){e.change(n=>{const o=e.document.getRoot(t.name);n.addClass(t.isFocused?"ck-focused":"ck-blurred",o),n.removeClass(t.isFocused?"ck-blurred":"ck-focused",o)})}e.isRenderingInProgress?function n(o){e.once("change:isRenderingInProgress",(e,i,r)=>{r?n(o):t(o)})}(this):t(this)}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class dl extends ll{constructor(e,t,n){super(e,t,n),this.extendTemplate({attributes:{role:"textbox",class:"ck-editor__editable_inline"}})}render(){super.render();const e=this._editingView,t=this.t;e.change(n=>{const o=e.document.getRoot(this.name);n.setAttribute("aria-label",t("ai",[this.name]),o)})}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class ul{constructor(e){if(Object.assign(this,e),e.actions&&e.keystrokeHandler)for(const t in e.actions){let n=e.actions[t];"string"==typeof n&&(n=[n]);for(const o of n)e.keystrokeHandler.set(o,(e,n)=>{this[t](),n()})}}get first(){return this.focusables.find(hl)||null}get last(){return this.focusables.filter(hl).slice(-1)[0]||null}get next(){return this._getFocusableItem(1)}get previous(){return this._getFocusableItem(-1)}get current(){let e=null;return null===this.focusTracker.focusedElement?null:(this.focusables.find((t,n)=>{const o=t.element===this.focusTracker.focusedElement;return o&&(e=n),o}),e)}focusFirst(){this._focus(this.first)}focusLast(){this._focus(this.last)}focusNext(){this._focus(this.next)}focusPrevious(){this._focus(this.previous)}_focus(e){e&&e.focus()}_getFocusableItem(e){const t=this.current,n=this.focusables.length;if(!n)return null;if(null===t)return this[1===e?"first":"last"];let o=(t+n+e)%n;do{const t=this.focusables.get(o);if(hl(t))return t;o=(o+n+e)%n}while(o!==t);return null}}function hl(e){return!(!e.focus||"none"==er.window.getComputedStyle(e.element).display)}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class fl extends il{constructor(e){super(e),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__separator"]}})}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class pl{constructor(e,t){pl._observerInstance||pl._createObserver(),this._element=e,this._callback=t,pl._addElementCallback(e,t),pl._observerInstance.observe(e)}destroy(){pl._deleteElementCallback(this._element,this._callback)}static _addElementCallback(e,t){pl._elementCallbacks||(pl._elementCallbacks=new Map);let n=pl._elementCallbacks.get(e);n||(n=new Set,pl._elementCallbacks.set(e,n)),n.add(t)}static _deleteElementCallback(e,t){const n=pl._getElementCallbacks(e);n&&(n.delete(t),n.size||(pl._elementCallbacks.delete(e),pl._observerInstance.unobserve(e))),pl._elementCallbacks&&!pl._elementCallbacks.size&&(pl._observerInstance=null,pl._elementCallbacks=null)}static _getElementCallbacks(e){return pl._elementCallbacks?pl._elementCallbacks.get(e):null}static _createObserver(){let e;e="function"==typeof er.window.ResizeObserver?er.window.ResizeObserver:ml,pl._observerInstance=new e(e=>{for(const t of e){const e=pl._getElementCallbacks(t.target);if(e)for(const n of e)n(t)}})}}pl._observerInstance=null,pl._elementCallbacks=null;class ml{constructor(e){this._callback=e,this._elements=new Set,this._previousRects=new Map,this._periodicCheckTimeout=null}observe(e){this._elements.add(e),this._checkElementRectsAndExecuteCallback(),1===this._elements.size&&this._startPeriodicCheck()}unobserve(e){this._elements.delete(e),this._previousRects.delete(e),this._elements.size||this._stopPeriodicCheck()}_startPeriodicCheck(){const e=()=>{this._checkElementRectsAndExecuteCallback(),this._periodicCheckTimeout=setTimeout(e,100)};this.listenTo(er.window,"resize",()=>{this._checkElementRectsAndExecuteCallback()}),this._periodicCheckTimeout=setTimeout(e,100)}_stopPeriodicCheck(){clearTimeout(this._periodicCheckTimeout),this.stopListening(),this._previousRects.clear()}_checkElementRectsAndExecuteCallback(){const e=[];for(const t of this._elements)this._hasRectChanged(t)&&e.push({target:t,contentRect:this._previousRects.get(t)});e.length&&this._callback(e)}_hasRectChanged(e){if(!e.ownerDocument.body.contains(e))return!1;const t=new Xr(e),n=this._previousRects.get(e),o=!n||!n.isEqual(t);return this._previousRects.set(e,t),o}}xn(ml,lr);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
class gl extends il{constructor(e){super(e);const t=this.bindTemplate;this.set("isVisible",!1),this.set("position","se"),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-reset","ck-dropdown__panel",t.to("position",e=>`ck-dropdown__panel_${e}`),t.if("isVisible","ck-dropdown__panel-visible")]},children:this.children,on:{selectstart:t.to(e=>e.preventDefault())}})}focus(){this.children.length&&this.children.first.focus()}focusLast(){if(this.children.length){const e=this.children.last;"function"==typeof e.focusLast?e.focusLast():e.focus()}}}n(34);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
function bl({element:e,target:t,positions:n,limiter:o,fitInViewport:i}){z(t)&&(t=t()),z(o)&&(o=o());const r=function(e){for(;e&&"html"!=e.tagName.toLowerCase();){if("static"!=er.window.getComputedStyle(e).position)return e;e=e.parentElement}return null}(e.parentElement),s=new Xr(e),a=new Xr(t);let c,l;if(o||i){const e=o&&new Xr(o).getVisible(),t=i&&new Xr(er.window);[l,c]=function(e,t,n,o,i){let r,s,a=0,c=0;const l=n.getArea();return e.some(e=>{const[d,u]=wl(e,t,n);let h,f;if(o)if(i){const e=o.getIntersection(i);h=e?e.getIntersectionArea(u):0}else h=o.getIntersectionArea(u);function p(){c=f,a=h,r=u,s=d}return i&&(f=i.getIntersectionArea(u)),i&&!o?f>c&&p():!i&&o?h>a&&p():(f>c&&h>=a||f>=c&&h>a)&&p(),h===l}),r?[s,r]:null}(n,a,s,e,t)||wl(n[0],a,s)}else[l,c]=wl(n[0],a,s);let{left:d,top:u}=kl(c);if(r){const e=kl(new Xr(r)),t=Qr(r);d-=e.left,u-=e.top,d+=r.scrollLeft,u+=r.scrollTop,d-=t.left,u-=t.top}return{left:d,top:u,name:l}}function wl(e,t,n){const{left:o,top:i,name:r}=e(t,n);return[r,n.clone().moveTo(o,i)]}function kl({left:e,top:t}){const{scrollX:n,scrollY:o}=er.window;return{left:e+n,top:t+o}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class _l extends il{constructor(e,t,n){super(e);const o=this.bindTemplate;this.buttonView=t,this.panelView=n,this.set("isOpen",!1),this.set("isEnabled",!0),this.set("class"),this.set("id"),this.set("panelPosition","auto"),this.focusTracker=new Rc,this.keystrokes=new yc,this.setTemplate({tag:"div",attributes:{class:["ck","ck-dropdown",o.to("class"),o.if("isEnabled","ck-disabled",e=>!e)],id:o.to("id"),"aria-describedby":o.to("ariaDescribedById")},children:[t,n]}),t.extendTemplate({attributes:{class:["ck-dropdown__button"]}})}render(){super.render(),this.listenTo(this.buttonView,"open",()=>{this.isOpen=!this.isOpen}),this.panelView.bind("isVisible").to(this,"isOpen"),this.on("change:isOpen",()=>{this.isOpen&&("auto"===this.panelPosition?this.panelView.position=_l._getOptimalPosition({element:this.panelView.element,target:this.buttonView.element,fitInViewport:!0,positions:this._panelPositions}).name:this.panelView.position=this.panelPosition)}),this.keystrokes.listenTo(this.element),this.focusTracker.add(this.element);const e=(e,t)=>{this.isOpen&&(this.buttonView.focus(),this.isOpen=!1,t())};this.keystrokes.set("arrowdown",(e,t)=>{this.buttonView.isEnabled&&!this.isOpen&&(this.isOpen=!0,t())}),this.keystrokes.set("arrowright",(e,t)=>{this.isOpen&&t()}),this.keystrokes.set("arrowleft",e),this.keystrokes.set("esc",e)}focus(){this.buttonView.focus()}get _panelPositions(){const{southEast:e,southWest:t,northEast:n,northWest:o}=_l.defaultPanelPositions;return"ltr"===this.locale.uiLanguageDirection?[e,t,n,o]:[t,e,o,n]}}_l.defaultPanelPositions={southEast:e=>({top:e.bottom,left:e.left,name:"se"}),southWest:(e,t)=>({top:e.bottom,left:e.left-t.width+e.width,name:"sw"}),northEast:(e,t)=>({top:e.top-t.height,left:e.left,name:"ne"}),northWest:(e,t)=>({top:e.bottom-t.height,left:e.left-t.width+e.width,name:"nw"})},_l._getOptimalPosition=bl;n(36);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class vl extends il{constructor(){super();const e=this.bindTemplate;this.set("content",""),this.set("viewBox","0 0 20 20"),this.set("fillColor",""),this.setTemplate({tag:"svg",ns:"http://www.w3.org/2000/svg",attributes:{class:["ck","ck-icon"],viewBox:e.to("viewBox")}})}render(){super.render(),this._updateXMLContent(),this._colorFillPaths(),this.on("change:content",()=>{this._updateXMLContent(),this._colorFillPaths()}),this.on("change:fillColor",()=>{this._colorFillPaths()})}_updateXMLContent(){if(this.content){const e=(new DOMParser).parseFromString(this.content.trim(),"image/svg+xml").querySelector("svg"),t=e.getAttribute("viewBox");for(t&&(this.viewBox=t),this.element.innerHTML="";e.childNodes.length>0;)this.element.appendChild(e.childNodes[0])}}_colorFillPaths(){this.fillColor&&this.element.querySelectorAll(".ck-icon__fill").forEach(e=>{e.style.fill=this.fillColor})}}n(38);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class yl extends il{constructor(e){super(e),this.set("text",""),this.set("position","s");const t=this.bindTemplate;this.setTemplate({tag:"span",attributes:{class:["ck","ck-tooltip",t.to("position",e=>"ck-tooltip_"+e),t.if("text","ck-hidden",e=>!e.trim())]},children:[{tag:"span",attributes:{class:["ck","ck-tooltip__text"]},children:[{text:t.to("text")}]}]})}}n(40);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class xl extends il{constructor(e){super(e);const t=this.bindTemplate,n=un();this.set("class"),this.set("labelStyle"),this.set("icon"),this.set("isEnabled",!0),this.set("isOn",!1),this.set("isVisible",!0),this.set("isToggleable",!1),this.set("keystroke"),this.set("label"),this.set("tabindex",-1),this.set("tooltip"),this.set("tooltipPosition","s"),this.set("type","button"),this.set("withText",!1),this.set("withKeystroke",!1),this.children=this.createCollection(),this.tooltipView=this._createTooltipView(),this.labelView=this._createLabelView(n),this.iconView=new vl,this.iconView.extendTemplate({attributes:{class:"ck-button__icon"}}),this.keystrokeView=this._createKeystrokeView(),this.bind("_tooltipString").to(this,"tooltip",this,"label",this,"keystroke",this._getTooltipString.bind(this)),this.setTemplate({tag:"button",attributes:{class:["ck","ck-button",t.to("class"),t.if("isEnabled","ck-disabled",e=>!e),t.if("isVisible","ck-hidden",e=>!e),t.to("isOn",e=>e?"ck-on":"ck-off"),t.if("withText","ck-button_with-text"),t.if("withKeystroke","ck-button_with-keystroke")],type:t.to("type",e=>e||"button"),tabindex:t.to("tabindex"),"aria-labelledby":`ck-editor__aria-label_${n}`,"aria-disabled":t.if("isEnabled",!0,e=>!e),"aria-pressed":t.to("isOn",e=>!!this.isToggleable&&String(e))},children:this.children,on:{mousedown:t.to(e=>{e.preventDefault()}),click:t.to(e=>{this.isEnabled?this.fire("execute"):e.preventDefault()})}})}render(){super.render(),this.icon&&(this.iconView.bind("content").to(this,"icon"),this.children.add(this.iconView)),this.children.add(this.tooltipView),this.children.add(this.labelView),this.withKeystroke&&this.children.add(this.keystrokeView)}focus(){this.element.focus()}_createTooltipView(){const e=new yl;return e.bind("text").to(this,"_tooltipString"),e.bind("position").to(this,"tooltipPosition"),e}_createLabelView(e){const t=new il,n=this.bindTemplate;return t.setTemplate({tag:"span",attributes:{class:["ck","ck-button__label"],style:n.to("labelStyle"),id:`ck-editor__aria-label_${e}`},children:[{text:this.bindTemplate.to("label")}]}),t}_createKeystrokeView(){const e=new il;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__keystroke"]},children:[{text:this.bindTemplate.to("keystroke",e=>ki(e))}]}),e}_getTooltipString(e,t,n){return e?"string"==typeof e?e:(n&&(n=ki(n)),e instanceof Function?e(t,n):`${t}${n?` (${n})`:""}`):""}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
class Cl extends xl{constructor(e){super(e),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{"aria-haspopup":!0}}),this.delegate("execute").to(this,"open")}render(){super.render(),this.children.add(this.arrowView)}_createArrowView(){const e=new vl;return e.content='<svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"><path d="M.941 4.523a.75.75 0 1 1 1.06-1.06l3.006 3.005 3.005-3.005a.75.75 0 1 1 1.06 1.06l-3.549 3.55a.75.75 0 0 1-1.168-.136L.941 4.523z"/></svg>',e.extendTemplate({attributes:{class:"ck-dropdown__arrow"}}),e}}n(42);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Al extends il{constructor(){super(),this.items=this.createCollection(),this.focusTracker=new Rc,this.keystrokes=new yc,this._focusCycler=new ul({focusables:this.items,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"arrowup",focusNext:"arrowdown"}}),this.setTemplate({tag:"ul",attributes:{class:["ck","ck-reset","ck-list"]},children:this.items})}render(){super.render();for(const e of this.items)this.focusTracker.add(e.element);this.items.on("add",(e,t)=>{this.focusTracker.add(t.element)}),this.items.on("remove",(e,t)=>{this.focusTracker.remove(t.element)}),this.keystrokes.listenTo(this.element)}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Tl extends il{constructor(e){super(e),this.children=this.createCollection(),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__item"]},children:this.children})}focus(){this.children.first.focus()}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Pl extends il{constructor(e){super(e),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__separator"]}})}}n(44);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class El extends xl{constructor(e){super(e),this.isToggleable=!0,this.toggleSwitchView=this._createToggleView(),this.extendTemplate({attributes:{class:"ck-switchbutton"}})}render(){super.render(),this.children.add(this.toggleSwitchView)}_createToggleView(){const e=new il;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__toggle"]},children:[{tag:"span",attributes:{class:["ck","ck-button__toggle__inner"]}}]}),e}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function Sl({emitter:e,activator:t,callback:n,contextElements:o}){e.listenTo(document,"mousedown",(e,{target:i})=>{if(t()){for(const e of o)if(e.contains(i))return;n()}})}n(46),n(48);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
function Rl(e,t=Cl){const n=new t(e),o=new gl(e),i=new _l(e,n,o);return n.bind("isEnabled").to(i),n instanceof Cl?n.bind("isOn").to(i,"isOpen"):n.arrowView.bind("isOn").to(i,"isOpen"),function(e){(function(e){e.on("render",()=>{Sl({emitter:e,activator:()=>e.isOpen,callback:()=>{e.isOpen=!1},contextElements:[e.element]})})})(e),function(e){e.on("execute",t=>{t.source instanceof El||(e.isOpen=!1)})}(e),function(e){e.keystrokes.set("arrowdown",(t,n)=>{e.isOpen&&(e.panelView.focus(),n())}),e.keystrokes.set("arrowup",(t,n)=>{e.isOpen&&(e.panelView.focusLast(),n())})}(e)}(i),i}function Il(e,t){const n=e.locale,o=n.t,i=e.toolbarView=new Nl(n);i.set("ariaLabel",o("j")),e.extendTemplate({attributes:{class:["ck-toolbar-dropdown"]}}),t.map(e=>i.items.add(e)),e.panelView.children.add(i),i.items.delegate("execute").to(e)}function Ol(e,t){const n=e.locale,o=e.listView=new Al(n);o.items.bindTo(t).using(({type:e,model:t})=>{if("separator"===e)return new Pl(n);if("button"===e||"switchbutton"===e){const o=new Tl(n);let i;return i="button"===e?new xl(n):new El(n),i.bind(...Object.keys(t)).to(t),i.delegate("execute").to(o),o.children.add(i),o}}),e.panelView.children.add(o),o.items.delegate("execute").to(e)}n(50);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
class Nl extends il{constructor(e,t){super(e);const n=this.bindTemplate,o=this.t;
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
var i;this.options=t||{},this.set("ariaLabel",o("aj")),this.set("maxWidth","auto"),this.items=this.createCollection(),this.focusTracker=new Rc,this.keystrokes=new yc,this.set("class"),this.set("isCompact",!1),this.itemsView=new Ml(e),this.children=this.createCollection(),this.children.add(this.itemsView),this.focusables=this.createCollection(),this._focusCycler=new ul({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:["arrowleft","arrowup"],focusNext:["arrowright","arrowdown"]}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-toolbar",n.to("class"),n.if("isCompact","ck-toolbar_compact")],role:"toolbar","aria-label":n.to("ariaLabel"),style:{maxWidth:n.to("maxWidth")}},children:this.children,on:{mousedown:(i=this,i.bindTemplate.to(e=>{e.target===i.element&&e.preventDefault()}))}}),this._behavior=this.options.shouldGroupWhenFull?new Dl(this):new Vl(this)}render(){super.render();for(const e of this.items)this.focusTracker.add(e.element);this.items.on("add",(e,t)=>{this.focusTracker.add(t.element)}),this.items.on("remove",(e,t)=>{this.focusTracker.remove(t.element)}),this.keystrokes.listenTo(this.element),this._behavior.render(this)}destroy(){return this._behavior.destroy(),super.destroy()}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}fillFromConfig(e,t){e.map(e=>{"|"==e?this.items.add(new fl):t.has(e)?this.items.add(t.create(e)):console.warn(Object(fn.a)("toolbarview-item-unavailable: The requested toolbar item is unavailable."),{name:e})})}}class Ml extends il{constructor(e){super(e),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-toolbar__items"]},children:this.children})}}class Vl{constructor(e){const t=e.bindTemplate;e.set("isVertical",!1),e.itemsView.children.bindTo(e.items).using(e=>e),e.focusables.bindTo(e.items).using(e=>e),e.extendTemplate({attributes:{class:[t.if("isVertical","ck-toolbar_vertical")]}})}render(){}destroy(){}}class Dl{constructor(e){this.viewChildren=e.children,this.viewFocusables=e.focusables,this.viewItemsView=e.itemsView,this.viewFocusTracker=e.focusTracker,this.viewLocale=e.locale,this.ungroupedItems=e.createCollection(),this.groupedItems=e.createCollection(),this.groupedItemsDropdown=this._createGroupedItemsDropdown(),this.resizeObserver=null,this.cachedPadding=null,e.itemsView.children.bindTo(this.ungroupedItems).using(e=>e),this.ungroupedItems.on("add",this._updateFocusCycleableItems.bind(this)),this.ungroupedItems.on("remove",this._updateFocusCycleableItems.bind(this)),e.children.on("add",this._updateFocusCycleableItems.bind(this)),e.children.on("remove",this._updateFocusCycleableItems.bind(this)),e.items.on("add",(e,t,n)=>{n>this.ungroupedItems.length?this.groupedItems.add(t,n-this.ungroupedItems.length):this.ungroupedItems.add(t,n),this._updateGrouping()}),e.items.on("remove",(e,t,n)=>{n>this.ungroupedItems.length?this.groupedItems.remove(t):this.ungroupedItems.remove(t),this._updateGrouping()}),e.extendTemplate({attributes:{class:["ck-toolbar_grouping"]}})}render(e){this.viewElement=e.element,this._enableGroupingOnResize(),this._enableGroupingOnMaxWidthChange(e)}destroy(){this.groupedItemsDropdown.destroy(),this.resizeObserver.destroy()}_updateGrouping(){if(!this.viewElement.ownerDocument.body.contains(this.viewElement))return;let e;for(;this._areItemsOverflowing;)this._groupLastItem(),e=!0;if(!e&&this.groupedItems.length){for(;this.groupedItems.length&&!this._areItemsOverflowing;)this._ungroupFirstItem();this._areItemsOverflowing&&this._groupLastItem()}}get _areItemsOverflowing(){if(!this.ungroupedItems.length)return!1;const e=this.viewElement,t=this.viewLocale.uiLanguageDirection,n=new Xr(e.lastChild),o=new Xr(e);if(!this.cachedPadding){const n=er.window.getComputedStyle(e),o="ltr"===t?"paddingRight":"paddingLeft";this.cachedPadding=Number.parseInt(n[o])}return"ltr"===t?n.right>o.right-this.cachedPadding:n.left<o.left+this.cachedPadding}_enableGroupingOnResize(){let e;this.resizeObserver=new pl(this.viewElement,t=>{e&&e===t.contentRect.width||(this._updateGrouping(),e=t.contentRect.width)}),this._updateGrouping()}_enableGroupingOnMaxWidthChange(e){e.on("change:maxWidth",()=>{this._updateGrouping()})}_groupLastItem(){this.groupedItems.length||(this.viewChildren.add(new fl),this.viewChildren.add(this.groupedItemsDropdown),this.viewFocusTracker.add(this.groupedItemsDropdown.element)),this.groupedItems.add(this.ungroupedItems.remove(this.ungroupedItems.last),0)}_ungroupFirstItem(){this.ungroupedItems.add(this.groupedItems.remove(this.groupedItems.first)),this.groupedItems.length||(this.viewChildren.remove(this.groupedItemsDropdown),this.viewChildren.remove(this.viewChildren.last),this.viewFocusTracker.remove(this.groupedItemsDropdown.element))}_createGroupedItemsDropdown(){const e=this.viewLocale,t=e.t,n=Rl(e);return n.class="ck-toolbar__grouped-dropdown",n.panelPosition="ltr"===e.uiLanguageDirection?"sw":"se",Il(n,[]),n.buttonView.set({label:t("ak"),tooltip:!0,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><circle cx="9.5" cy="4.5" r="1.5"/><circle cx="9.5" cy="10.5" r="1.5"/><circle cx="9.5" cy="16.5" r="1.5"/></svg>'}),n.toolbarView.items.bindTo(this.groupedItems).using(e=>e),n}_updateFocusCycleableItems(){this.viewFocusables.clear(),this.ungroupedItems.map(e=>{this.viewFocusables.add(e)}),this.groupedItems.length&&this.viewFocusables.add(this.groupedItemsDropdown)}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Fl extends cl{constructor(e,t,n={}){super(e),this.toolbar=new Nl(e,{shouldGroupWhenFull:n.shouldToolbarGroupWhenFull}),this.editable=new dl(e,t,n.editableElement),this.toolbar.extendTemplate({attributes:{class:["ck-reset_all","ck-rounded-corners"],dir:e.uiLanguageDirection}})}render(){super.render(),this.registerChild([this.toolbar,this.editable])}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
class Bl extends Cc{constructor(e,t){super(t),on(e)&&(this.sourceElement=e,
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
function(e){const t=e.sourceElement;if(t){if(t.ckeditorInstance)throw new fn.b("editor-source-element-already-used: The DOM element cannot be used to create multiple editor instances.",e);t.ckeditorInstance=e,e.once("destroy",()=>{delete t.ckeditorInstance})}}(this)),this.data.processor=new Pc(this.data.viewDocument),this.model.document.createRoot();const n=!this.config.get("toolbar.shouldNotGroupWhenFull"),o=new Fl(this.locale,this.editing.view,{editableElement:this.sourceElement,shouldToolbarGroupWhenFull:n});this.ui=new Fc(this,o)}destroy(){const e=this.getData();return this.ui.destroy(),super.destroy().then(()=>{this.sourceElement&&
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
function(e,t){e instanceof HTMLTextAreaElement&&(e.value=t),e.innerHTML=t}(this.sourceElement,e)})}static create(e,t={}){return new Promise(n=>{const o=on(e);if(o&&"TEXTAREA"===e.tagName)throw new fn.b("editor-wrong-element: This type of editor cannot be initialized inside <textarea> element.",null);const i=new this(e,t);n(i.initPlugins().then(()=>{i.ui.init()}).then(()=>{if(!o&&t.initialData)throw new fn.b("editor-create-initial-data: The config.initialData option cannot be used together with initial data passed in Editor.create().",null);const n=t.initialData||function(e){return on(e)?(t=e,t instanceof HTMLTextAreaElement?t.value:t.innerHTML):e;var t}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/(e);return i.data.init(n)}).then(()=>i.fire("ready")).then(()=>i))})}}xn(Bl,Ac);class Ll{constructor(e){this.editor=e,this.set("isEnabled",!0),this._disableStack=new Set}forceDisabled(e){this._disableStack.add(e),1==this._disableStack.size&&(this.on("set:isEnabled",zl,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),0==this._disableStack.size&&(this.off("set:isEnabled",zl),this.isEnabled=!0)}destroy(){this.stopListening()}static get isContextPlugin(){return!1}}function zl(e){e.return=!1,e.stop()}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/xn(Ll,Wo);class ql{constructor(){this._stack=[]}add(e,t){const n=this._stack,o=n[0];this._insertDescriptor(e);const i=n[0];o===i||jl(o,i)||this.fire("change:top",{oldDescriptor:o,newDescriptor:i,writer:t})}remove(e,t){const n=this._stack,o=n[0];this._removeDescriptor(e);const i=n[0];o===i||jl(o,i)||this.fire("change:top",{oldDescriptor:o,newDescriptor:i,writer:t})}_insertDescriptor(e){const t=this._stack,n=t.findIndex(t=>t.id===e.id);if(jl(e,t[n]))return;n>-1&&t.splice(n,1);let o=0;for(;t[o]&&Hl(t[o],e);)o++;t.splice(o,0,e)}_removeDescriptor(e){const t=this._stack,n=t.findIndex(t=>t.id===e);n>-1&&t.splice(n,1)}}function jl(e,t){return e&&t&&e.priority==t.priority&&Wl(e.classes)==Wl(t.classes)}function Hl(e,t){return e.priority>t.priority||!(e.priority<t.priority)&&Wl(e.classes)>Wl(t.classes)}function Wl(e){return Array.isArray(e)?e.sort().join(","):e}xn(ql,gn);function Ul(e){return!!e.is("element")&&!!e.getCustomProperty("widget")}function $l(e,t,n={}){return fi.isEdge||t.setAttribute("contenteditable","false",e),t.addClass("ck-widget",e),t.setCustomProperty("widget",!0,e),e.getFillerOffset=Zl,n.label&&function(e,t,n){n.setCustomProperty("widgetLabel",t,e)}(e,n.label,t),n.hasSelectionHandle&&function(e,t){const n=t.createUIElement("div",{class:"ck ck-widget__selection-handle"},(function(e){const t=this.toDomElement(e),n=new vl;return n.set("content",'<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M4 0v1H1v3H0V.5A.5.5 0 0 1 .5 0H4zm8 0h3.5a.5.5 0 0 1 .5.5V4h-1V1h-3V0zM4 16H.5a.5.5 0 0 1-.5-.5V12h1v3h3v1zm8 0v-1h3v-3h1v3.5a.5.5 0 0 1-.5.5H12z"/><path fill-opacity=".256" d="M1 1h14v14H1z"/><g class="ck-icon__selected-indicator"><path d="M7 0h2v1H7V0zM0 7h1v2H0V7zm15 0h1v2h-1V7zm-8 8h2v1H7v-1z"/><path fill-opacity=".254" d="M1 1h14v14H1z"/></g></svg>'),n.render(),t.appendChild(n.element),t}));t.insert(t.createPositionAt(e,0),n),t.addClass(["ck-widget_with-selection-handle"],e)}(e,t),function(e,t,n,o){const i=new ql;i.on("change:top",(t,i)=>{i.oldDescriptor&&o(e,i.oldDescriptor,i.writer),i.newDescriptor&&n(e,i.newDescriptor,i.writer)}),t.setCustomProperty("addHighlight",(e,t,n)=>i.add(t,n),e),t.setCustomProperty("removeHighlight",(e,t,n)=>i.remove(t,n),e)}(e,t,(e,t,n)=>n.addClass(o(t.classes),e),(e,t,n)=>n.removeClass(o(t.classes),e)),e;function o(e){return Array.isArray(e)?e:[e]}}function Gl(e){const t=e.getCustomProperty("widgetLabel");return t?"function"==typeof t?t():t:""}function Kl(e,t){return t.addClass(["ck-editor__editable","ck-editor__nested-editable"],e),fi.isEdge||(t.setAttribute("contenteditable",e.isReadOnly?"false":"true",e),e.on("change:isReadOnly",(n,o,i)=>{t.setAttribute("contenteditable",i?"false":"true",e)})),e.on("change:isFocused",(n,o,i)=>{i?t.addClass("ck-editor__nested-editable_focused",e):t.removeClass("ck-editor__nested-editable_focused",e)}),e}function Jl(e,t){const n=e.getSelectedElement();if(n&&t.schema.isBlock(n))return t.createPositionAfter(n);const o=e.getSelectedBlocks().next().value;if(o){if(o.isEmpty)return t.createPositionAt(o,0);const n=t.createPositionAfter(o);return e.focus.isTouching(n)?n:t.createPositionBefore(o)}return e.focus}function Zl(){return null}class Ql extends Ll{static get pluginName(){return"OPMacroToc"}static get buttonName(){return"insertToc"}init(){const e=this.editor,t=e.model,n=e.conversion;t.schema.register("op-macro-toc",{allowWhere:"$block",isBlock:!0,isLimit:!0}),n.for("upcast").elementToElement({view:{name:"macro",classes:"toc"},model:"op-macro-toc"}),n.for("editingDowncast").elementToElement({model:"op-macro-toc",view:(e,t)=>$l(this.createTocViewElement(t),t,{label:this.label})}),n.for("dataDowncast").elementToElement({model:"op-macro-toc",view:(e,t)=>this.createTocDataElement(t)}),e.ui.componentFactory.add(Ql.buttonName,t=>{const n=new xl(t);return n.set({label:this.label,withText:!0}),n.on("execute",()=>{e.model.change(t=>{const n=t.createElement("op-macro-toc",{});e.model.insertContent(n,e.model.document.selection)})}),n})}get label(){return window.I18n.t("js.editor.macro.toc")}createTocViewElement(e){const t=e.createText(this.label),n=e.createContainerElement("div",{class:"macro -toc"});return e.insert(e.createPositionAt(n,0),t),n}createTocDataElement(e){return e.createContainerElement("macro",{class:"toc"})}}const Yl=Symbol("isOPEmbeddedTable");function Xl(e){const t=e.getSelectedElement();return!(!t||!function(e){return!!e.getCustomProperty(Yl)&&Ul(e)}(t))}function ed(e,t){return td(e).services[t]}function td(e){return _.get(e.config,"_config.openProject.pluginContext")}function nd(e){return _.get(e.config,"_config.openProject.context.resource")}function od(e,t){return ed(e,"pathHelperService")}class id extends Ll{static get pluginName(){return"EmbeddedTableEditing"}static get buttonName(){return"insertEmbeddedTable"}init(){const e=this.editor,t=e.model,n=e.conversion,o=td(e);this.text={button:window.I18n.t("js.editor.macro.embedded_table.button"),macro_text:window.I18n.t("js.editor.macro.embedded_table.text")},t.schema.register("op-macro-embedded-table",{allowWhere:"$block",allowAttributes:["opEmbeddedTableQuery"],isBlock:!0,isObject:!0}),n.for("upcast").elementToElement({view:{name:"macro",classes:"embedded-table"},model:(e,t)=>{const n=e.getAttribute("data-query-props");return t.createElement("op-macro-embedded-table",{opEmbeddedTableQuery:n?JSON.parse(n):{}})}}),n.for("editingDowncast").elementToElement({model:"op-macro-embedded-table",view:(e,t)=>{return n=this.createEmbeddedTableView(t),o=t,this.label,o.setCustomProperty(Yl,!0,n),$l(n,o,{label:"your label here"});var n,o}}),n.for("dataDowncast").elementToElement({model:"op-macro-embedded-table",view:(e,t)=>this.createEmbeddedTableDataElement(e,t)}),e.ui.componentFactory.add(id.buttonName,t=>{const n=new xl(t);return n.set({label:this.text.button,withText:!0}),n.on("execute",()=>o.runInZone(()=>{o.services.externalQueryConfiguration.show({},t=>e.model.change(n=>{const o=n.createElement("op-macro-embedded-table",{opEmbeddedTableQuery:t});e.model.insertContent(o,e.model.document.selection)}))})),n})}createEmbeddedTableView(e){const t=e.createText(this.text.macro_text),n=e.createContainerElement("div",{class:"macro -embedded-table"});return e.insert(e.createPositionAt(n,0),t),n}createEmbeddedTableDataElement(e,t){const n=e.getAttribute("opEmbeddedTableQuery")||{};return t.createContainerElement("macro",{class:"embedded-table","data-query-props":JSON.stringify(n)})}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class rd extends Nr{constructor(e){super(e),this.domEventType="mousedown"}onDomEvent(e){this.fire(e.type,e)}}n(52);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/const sd=wi("Ctrl+A");class ad extends Ll{static get pluginName(){return"Widget"}init(){const e=this.editor.editing.view,t=e.document;this._previouslySelected=new Set,this.editor.editing.downcastDispatcher.on("selection",(e,t,n)=>{this._clearPreviouslySelectedWidgets(n.writer);const o=n.writer,i=o.document.selection,r=i.getSelectedElement();let s=null;for(const e of i.getRanges())for(const t of e){const e=t.item;Ul(e)&&!cd(e,s)&&(o.addClass("ck-widget_selected",e),this._previouslySelected.add(e),s=e,e==r&&o.setSelection(i.getRanges(),{fake:!0,label:Gl(r)}))}},{priority:"low"}),e.addObserver(rd),this.listenTo(t,"mousedown",(...e)=>this._onMousedown(...e)),this.listenTo(t,"keydown",(...e)=>this._onKeydown(...e),{priority:"high"}),this.listenTo(t,"delete",(e,t)=>{this._handleDelete("forward"==t.direction)&&(t.preventDefault(),e.stop())},{priority:"high"})}_onMousedown(e,t){const n=this.editor,o=n.editing.view,i=o.document;let r=t.target;if(function(e){for(;e;){if(e.is("editableElement")&&!e.is("rootElement"))return!0;if(Ul(e))return!1;e=e.parent}return!1}(r)){if(fi.isSafari&&t.domEvent.detail>=3){const e=n.editing.mapper.toModelElement(r);this.editor.model.change(n=>{t.preventDefault(),n.setSelection(e,"in")})}return}if(!Ul(r)&&(r=r.findAncestor(Ul),!r))return;t.preventDefault(),i.isFocused||o.focus();const s=n.editing.mapper.toModelElement(r);this._setSelectionOverElement(s)}_onKeydown(e,t){const n=t.keyCode,o="ltr"===this.editor.locale.contentLanguageDirection,i=n==gi.arrowdown||n==gi[o?"arrowright":"arrowleft"];let r=!1;!function(e){return e==gi.arrowright||e==gi.arrowleft||e==gi.arrowup||e==gi.arrowdown}(n)?!function(e){return bi(e)==sd}(t)?n===gi.enter&&(r=this._handleEnterKey(t.shiftKey)):r=this._selectAllNestedEditableContent()||this._selectAllContent():r=this._handleArrowKeys(i),r&&(t.preventDefault(),e.stop())}_handleDelete(e){if(this.editor.isReadOnly)return;const t=this.editor.model.document.selection;if(!t.isCollapsed)return;const n=this._getObjectElementNextToSelection(e);return n?(this.editor.model.change(e=>{let o=t.anchor.parent;for(;o.isEmpty;){const t=o;o=t.parent,e.remove(t)}this._setSelectionOverElement(n)}),!0):void 0}_handleArrowKeys(e){const t=this.editor.model,n=t.schema,o=t.document.selection,i=o.getSelectedElement();if(i&&n.isObject(i)){const i=e?o.getLastPosition():o.getFirstPosition(),r=n.getNearestSelectionRange(i,e?"forward":"backward");return r&&t.change(e=>{e.setSelection(r)}),!0}if(!o.isCollapsed)return;const r=this._getObjectElementNextToSelection(e);return r&&n.isObject(r)?(this._setSelectionOverElement(r),!0):void 0}_handleEnterKey(e){const t=this.editor.model,n=t.document.selection.getSelectedElement();if(o=n,i=t.schema,o&&i.isObject(o)&&!i.isInline(o))return t.change(o=>{let i=o.createPositionAt(n,e?"before":"after");const r=o.createElement("paragraph");if(t.schema.isBlock(n.parent)){const e=t.schema.findAllowedParent(i,r);i=o.split(i,e).position}o.insert(r,i),o.setSelection(r,"in")}),!0;var o,i;
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/}_selectAllNestedEditableContent(){const e=this.editor.model,t=e.document.selection,n=e.schema.getLimitElement(t);return t.getFirstRange().root!=n&&(e.change(e=>{e.setSelection(e.createRangeIn(n))}),!0)}_selectAllContent(){const e=this.editor.model,t=this.editor.editing,n=t.view.document.selection.getSelectedElement();if(n&&Ul(n)){const o=t.mapper.toModelElement(n.parent);return e.change(e=>{e.setSelection(e.createRangeIn(o))}),!0}return!1}_setSelectionOverElement(e){this.editor.model.change(t=>{t.setSelection(t.createRangeOn(e))})}_getObjectElementNextToSelection(e){const t=this.editor.model,n=t.schema,o=t.document.selection,i=t.createSelection(o);t.modifySelection(i,{direction:e?"forward":"backward"});const r=e?i.focus.nodeBefore:i.focus.nodeAfter;return r&&n.isObject(r)?r:null}_clearPreviouslySelectedWidgets(e){for(const t of this._previouslySelected)e.removeClass("ck-widget_selected",t);this._previouslySelected.clear()}}function cd(e,t){return!!t&&Array.from(e.getAncestors()).includes(t)}function ld(e){return t=>t+e}n(54);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md.
|
|
|
*/const dd=ld("px"),ud=er.document.body;class hd extends il{constructor(e){super(e);const t=this.bindTemplate;this.set("top",0),this.set("left",0),this.set("position","arrow_nw"),this.set("isVisible",!1),this.set("withArrow",!0),this.set("class"),this.content=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-balloon-panel",t.to("position",e=>`ck-balloon-panel_${e}`),t.if("isVisible","ck-balloon-panel_visible"),t.if("withArrow","ck-balloon-panel_with-arrow"),t.to("class")],style:{top:t.to("top",dd),left:t.to("left",dd)}},children:this.content})}show(){this.isVisible=!0}hide(){this.isVisible=!1}attachTo(e){this.show();const t=hd.defaultPositions,n=Object.assign({},{element:this.element,positions:[t.southArrowNorth,t.southArrowNorthMiddleWest,t.southArrowNorthMiddleEast,t.southArrowNorthWest,t.southArrowNorthEast,t.northArrowSouth,t.northArrowSouthMiddleWest,t.northArrowSouthMiddleEast,t.northArrowSouthWest,t.northArrowSouthEast],limiter:ud,fitInViewport:!0},e),o=hd._getOptimalPosition(n),i=parseInt(o.left),r=parseInt(o.top),s=o.name;Object.assign(this,{top:r,left:i,position:s})}pin(e){this.unpin(),this._pinWhenIsVisibleCallback=()=>{this.isVisible?this._startPinning(e):this._stopPinning()},this._startPinning(e),this.listenTo(this,"change:isVisible",this._pinWhenIsVisibleCallback)}unpin(){this._pinWhenIsVisibleCallback&&(this._stopPinning(),this.stopListening(this,"change:isVisible",this._pinWhenIsVisibleCallback),this._pinWhenIsVisibleCallback=null,this.hide())}_startPinning(e){this.attachTo(e);const t=fd(e.target),n=e.limiter?fd(e.limiter):ud;this.listenTo(er.document,"scroll",(o,i)=>{const r=i.target,s=t&&r.contains(t),a=n&&r.contains(n);!s&&!a&&t&&n||this.attachTo(e)},{useCapture:!0}),this.listenTo(er.window,"resize",()=>{this.attachTo(e)})}_stopPinning(){this.stopListening(er.document,"scroll"),this.stopListening(er.window,"resize")}}function fd(e){return on(e)?e:Zr(e)?e.commonAncestorContainer:"function"==typeof e?fd(e()):null}function pd(e,t){return e.top-t.height-hd.arrowVerticalOffset}function md(e){return e.bottom+hd.arrowVerticalOffset}hd.arrowHorizontalOffset=25,hd.arrowVerticalOffset=10,hd._getOptimalPosition=bl,hd.defaultPositions={northWestArrowSouthWest:(e,t)=>({top:pd(e,t),left:e.left-hd.arrowHorizontalOffset,name:"arrow_sw"}),northWestArrowSouthMiddleWest:(e,t)=>({top:pd(e,t),left:e.left-.25*t.width-hd.arrowHorizontalOffset,name:"arrow_smw"}),northWestArrowSouth:(e,t)=>({top:pd(e,t),left:e.left-t.width/2,name:"arrow_s"}),northWestArrowSouthMiddleEast:(e,t)=>({top:pd(e,t),left:e.left-.75*t.width+hd.arrowHorizontalOffset,name:"arrow_sme"}),northWestArrowSouthEast:(e,t)=>({top:pd(e,t),left:e.left-t.width+hd.arrowHorizontalOffset,name:"arrow_se"}),northArrowSouthWest:(e,t)=>({top:pd(e,t),left:e.left+e.width/2-hd.arrowHorizontalOffset,name:"arrow_sw"}),northArrowSouthMiddleWest:(e,t)=>({top:pd(e,t),left:e.left+e.width/2-.25*t.width-hd.arrowHorizontalOffset,name:"arrow_smw"}),northArrowSouth:(e,t)=>({top:pd(e,t),left:e.left+e.width/2-t.width/2,name:"arrow_s"}),northArrowSouthMiddleEast:(e,t)=>({top:pd(e,t),left:e.left+e.width/2-.75*t.width+hd.arrowHorizontalOffset,name:"arrow_sme"}),northArrowSouthEast:(e,t)=>({top:pd(e,t),left:e.left+e.width/2-t.width+hd.arrowHorizontalOffset,name:"arrow_se"}),northEastArrowSouthWest:(e,t)=>({top:pd(e,t),left:e.right-hd.arrowHorizontalOffset,name:"arrow_sw"}),northEastArrowSouthMiddleWest:(e,t)=>({top:pd(e,t),left:e.right-.25*t.width-hd.arrowHorizontalOffset,name:"arrow_smw"}),northEastArrowSouth:(e,t)=>({top:pd(e,t),left:e.right-t.width/2,name:"arrow_s"}),northEastArrowSouthMiddleEast:(e,t)=>({top:pd(e,t),left:e.right-.75*t.width+hd.arrowHorizontalOffset,name:"arrow_sme"}),northEastArrowSouthEast:(e,t)=>({top:pd(e,t),left:e.right-t.width+hd.arrowHorizontalOffset,name:"arrow_se"}),southWestArrowNorthWest:(e,t)=>({top:md(e),left:e.left-hd.arrowHorizontalOffset,name:"arrow_nw"}),southWestArrowNorthMiddleWest:(e,t)=>({top:md(e),left:e.left-.25*t.width-hd.arrowHorizontalOffset,name:"arrow_nmw"}),southWestArrowNorth:(e,t)=>({top:md(e),left:e.left-t.width/2,name:"arrow_n"}),southWestArrowNorthMiddleEast:(e,t)=>({top:md(e),left:e.left-.75*t.width+hd.arrowHorizontalOffset,name:"arrow_nme"}),southWestArrowNorthEast:(e,t)=>({top:md(e),left:e.left-t.width+hd.arrowHorizontalOffset,name:"arrow_ne"}),southArrowNorthWest:(e,t)=>({top:md(e),left:e.left+e.width/2-hd.arrowHorizontalOffset,name:"arrow_nw"}),southArrowNorthMiddleWest:(e,t)=>({top:md(e),left:e.left+e.width/2-.25*t.width-hd.arrowHorizontalOffset,name:"arrow_nmw"}),southArrowNorth:(e,t)=>({top:md(e),left:e.left+e.width/2-t.width/2,name:"arrow_n"}),southArrowNorthMiddleEast:(e,t)=>({top:md(e),left:e.left+e.width/2-.75*t.width+hd.arrowHorizontalOffset,name:"arrow_nme"}),southArrowNorthEast:(e,t)=>({top:md(e),left:e.left+e.width/2-t.width+hd.arrowHorizontalOffset,name:"arrow_ne"}),southEastArrowNorthWest:(e,t)=>({top:md(e),left:e.right-hd.arrowHorizontalOffset,name:"arrow_nw"}),southEastArrowNorthMiddleWest:(e,t)=>({top:md(e),left:e.right-.25*t.width-hd.arrowHorizontalOffset,name:"arrow_nmw"}),southEastArrowNorth:(e,t)=>({top:md(e),left:e.right-t.width/2,name:"arrow_n"}),southEastArrowNorthMiddleEast:(e,t)=>({top:md(e),left:e.right-.75*t.width+hd.arrowHorizontalOffset,name:"arrow_nme"}),southEastArrowNorthEast:(e,t)=>({top:md(e),left:e.right-t.width+hd.arrowHorizontalOffset,name:"arrow_ne"})};n(56),n(58);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
const gd=ld("px");class bd extends Ll{static get pluginName(){return"ContextualBalloon"}constructor(e){super(e),this.positionLimiter=()=>{const e=this.editor.editing.view,t=e.document.selection.editableElement;return t?e.domConverter.mapViewToDom(t.root):null},this.set("visibleView",null),this.view=new hd(e.locale),e.ui.view.body.add(this.view),e.ui.focusTracker.add(this.view.element),this._viewToStack=new Map,this._idToStack=new Map,this.set("_numberOfStacks",0),this.set("_singleViewMode",!1),this._rotatorView=this._createRotatorView(),this._fakePanelsView=this._createFakePanelsView()}hasView(e){return Array.from(this._viewToStack.keys()).includes(e)}add(e){if(this.hasView(e.view))throw new fn.b("contextualballoon-add-view-exist: Cannot add configuration of the same view twice.",[this,e]);const t=e.stackId||"main";if(!this._idToStack.has(t))return this._idToStack.set(t,new Map([[e.view,e]])),this._viewToStack.set(e.view,this._idToStack.get(t)),this._numberOfStacks=this._idToStack.size,void(this._visibleStack&&!e.singleViewMode||this.showStack(t));const n=this._idToStack.get(t);e.singleViewMode&&this.showStack(t),n.set(e.view,e),this._viewToStack.set(e.view,n),n===this._visibleStack&&this._showView(e)}remove(e){if(!this.hasView(e))throw new fn.b("contextualballoon-remove-view-not-exist: Cannot remove the configuration of a non-existent view.",[this,e]);const t=this._viewToStack.get(e);this._singleViewMode&&this.visibleView===e&&(this._singleViewMode=!1),this.visibleView===e&&(1===t.size?this._idToStack.size>1?this._showNextStack():(this.view.hide(),this.visibleView=null,this._rotatorView.hideView()):this._showView(Array.from(t.values())[t.size-2])),1===t.size?(this._idToStack.delete(this._getStackId(t)),this._numberOfStacks=this._idToStack.size):t.delete(e),this._viewToStack.delete(e)}updatePosition(e){e&&(this._visibleStack.get(this.visibleView).position=e),this.view.pin(this._getBalloonPosition()),this._fakePanelsView.updatePosition()}showStack(e){this.visibleStack=e;const t=this._idToStack.get(e);if(!t)throw new fn.b("contextualballoon-showstack-stack-not-exist: Cannot show a stack that does not exist.",this);this._visibleStack!==t&&this._showView(Array.from(t.values()).pop())}get _visibleStack(){return this._viewToStack.get(this.visibleView)}_getStackId(e){return Array.from(this._idToStack.entries()).find(t=>t[1]===e)[0]}_showNextStack(){const e=Array.from(this._idToStack.values());let t=e.indexOf(this._visibleStack)+1;e[t]||(t=0),this.showStack(this._getStackId(e[t]))}_showPrevStack(){const e=Array.from(this._idToStack.values());let t=e.indexOf(this._visibleStack)-1;e[t]||(t=e.length-1),this.showStack(this._getStackId(e[t]))}_createRotatorView(){const e=new wd(this.editor.locale),t=this.editor.locale.t;return this.view.content.add(e),e.bind("isNavigationVisible").to(this,"_numberOfStacks",this,"_singleViewMode",(e,t)=>!t&&e>1),e.on("change:isNavigationVisible",()=>this.updatePosition(),{priority:"low"}),e.bind("counter").to(this,"visibleView",this,"_numberOfStacks",(e,n)=>{if(n<2)return"";const o=Array.from(this._idToStack.values()).indexOf(this._visibleStack)+1;return t("am",[o,n])}),e.buttonNextView.on("execute",()=>{e.focusTracker.isFocused&&this.editor.editing.view.focus(),this._showNextStack()}),e.buttonPrevView.on("execute",()=>{e.focusTracker.isFocused&&this.editor.editing.view.focus(),this._showPrevStack()}),e}_createFakePanelsView(){const e=new kd(this.editor.locale,this.view);return e.bind("numberOfPanels").to(this,"_numberOfStacks",this,"_singleViewMode",(e,t)=>!t&&e>=2?Math.min(e-1,2):0),e.listenTo(this.view,"change:top",()=>e.updatePosition()),e.listenTo(this.view,"change:left",()=>e.updatePosition()),this.editor.ui.view.body.add(e),e}_showView({view:e,balloonClassName:t="",withArrow:n=!0,singleViewMode:o=!1}){this.view.class=t,this.view.withArrow=n,this._rotatorView.showView(e),this.visibleView=e,this.view.pin(this._getBalloonPosition()),this._fakePanelsView.updatePosition(),o&&(this._singleViewMode=!0)}_getBalloonPosition(){let e=Array.from(this._visibleStack.values()).pop().position;return e&&!e.limiter&&(e=Object.assign({},e,{limiter:this.positionLimiter})),e}}class wd extends il{constructor(e){super(e);const t=e.t,n=this.bindTemplate;this.set("isNavigationVisible",!0),this.focusTracker=new Rc,this.buttonPrevView=this._createButtonView(t("an"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.463 5.187a.888.888 0 1 1 1.254 1.255L9.16 10l3.557 3.557a.888.888 0 1 1-1.254 1.255L7.26 10.61a.888.888 0 0 1 .16-1.382l4.043-4.042z"/></svg>'),this.buttonNextView=this._createButtonView(t("ao"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M8.537 14.813a.888.888 0 1 1-1.254-1.255L10.84 10 7.283 6.442a.888.888 0 1 1 1.254-1.255L12.74 9.39a.888.888 0 0 1-.16 1.382l-4.043 4.042z"/></svg>'),this.content=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-balloon-rotator"],"z-index":"-1"},children:[{tag:"div",attributes:{class:["ck-balloon-rotator__navigation",n.to("isNavigationVisible",e=>e?"":"ck-hidden")]},children:[this.buttonPrevView,{tag:"span",attributes:{class:["ck-balloon-rotator__counter"]},children:[{text:n.to("counter")}]},this.buttonNextView]},{tag:"div",attributes:{class:"ck-balloon-rotator__content"},children:this.content}]})}render(){super.render(),this.focusTracker.add(this.element)}showView(e){this.hideView(),this.content.add(e)}hideView(){this.content.clear()}_createButtonView(e,t){const n=new xl(this.locale);return n.set({label:e,icon:t,tooltip:!0}),n}}class kd extends il{constructor(e,t){super(e);const n=this.bindTemplate;this.set("top",0),this.set("left",0),this.set("height",0),this.set("width",0),this.set("numberOfPanels",0),this.content=this.createCollection(),this._balloonPanelView=t,this.setTemplate({tag:"div",attributes:{class:["ck-fake-panel",n.to("numberOfPanels",e=>e?"":"ck-hidden")],style:{top:n.to("top",gd),left:n.to("left",gd),width:n.to("width",gd),height:n.to("height",gd)}},children:this.content}),this.on("change:numberOfPanels",(e,t,n,o)=>{n>o?this._addPanels(n-o):this._removePanels(o-n),this.updatePosition()})}_addPanels(e){for(;e--;){const e=new il;e.setTemplate({tag:"div"}),this.content.add(e),this.registerChild(e)}}_removePanels(e){for(;e--;){const e=this.content.last;this.content.remove(e),this.deregisterChild(e),e.destroy()}}updatePosition(){if(this.numberOfPanels){const{top:e,left:t}=this._balloonPanelView,{width:n,height:o}=new Xr(this._balloonPanelView.element);Object.assign(this,{top:e,left:t,width:n,height:o})}}}function _d(e,t,n){e.ui.componentFactory.add(t,t=>{const o=new xl(t);return o.set({label:I18n.t("js.button_edit"),icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="20" height="20"><path d="M1.586 18.227l.398-2.753.398-2.753 2.355 2.388 2.355 2.355-2.753.365zM14.954 8.01l-7.099 7.065-.763-.796 7.065-7.066-1.592-1.559L5.5 12.721l-.763-.796 7.065-7.066-.796-.796-7.861 7.862 4.71 4.71 7.861-7.828zm3.25-1.56c.398-.397.398-1.094-.033-1.525L15.02 1.775c-.431-.432-1.128-.465-1.526-.034l-.1.1-1.525 1.493 4.71 4.71 1.526-1.493-.033-.033c.033-.033.099-.033.132-.066z"/></svg>\n',tooltip:!0}),o.on("execute",()=>{const t=e.model.document.selection.getSelectedElement();t&&n(t)}),o})}function vd(e,t,n,o){const i=t.config.get(n+".toolbar");if(!i||!i.length)return;const r=t.plugins.get("ContextualBalloon"),s=new Nl(t.locale);function a(){t.ui.focusTracker.isFocused&&o(t.editing.view.document.selection)?l()?function(e,t){const n=e.plugins.get("ContextualBalloon");if(t(e.editing.view.document.selection)){const t=yd(e);n.updatePosition(t)}}(t,o):r.hasView(s)||r.add({view:s,position:yd(t),balloonClassName:"ck-toolbar-container"}):c()}function c(){l()&&r.remove(s)}function l(){return r.visibleView==s}s.fillFromConfig(i,t.ui.componentFactory),e.listenTo(t.editing.view,"render",a),e.listenTo(t.ui.focusTracker,"change:isFocused",a,{priority:"low"})}function yd(e){const t=e.editing.view,n=hd.defaultPositions;return{target:t.domConverter.viewToDom(t.document.selection.getSelectedElement()),positions:[n.northArrowSouth,n.northArrowSouthWest,n.northArrowSouthEast,n.southArrowNorth,n.southArrowNorthWest,n.southArrowNorthEast]}}class xd extends Ll{static get requires(){return[bd]}static get pluginName(){return"EmbeddedTableToolbar"}init(){const e=this.editor,t=this.editor.model,n=td(e);_d(e,"opEditEmbeddedTableQuery",e=>{const o=n.services.externalQueryConfiguration,i=e.getAttribute("opEmbeddedTableQuery")||{};n.runInZone(()=>{o.show(i,n=>t.change(t=>{t.setAttribute("opEmbeddedTableQuery",n,e)}))})})}afterInit(){vd(this,this.editor,"OPMacroEmbeddedTable",Xl)}}const Cd=Symbol("isWpButtonMacroSymbol");function Ad(e){const t=e.getSelectedElement();return!(!t||!function(e){return!!e.getCustomProperty(Cd)&&Ul(e)}(t))}class Td extends Ll{static get pluginName(){return"OPMacroWpButtonEditing"}static get buttonName(){return"insertWorkPackageButton"}init(){const e=this.editor,t=e.model,n=e.conversion,o=td(e);t.schema.register("op-macro-wp-button",{allowWhere:["$block"],allowAttributes:["type","classes"],isBlock:!0,isLimit:!0}),n.for("upcast").elementToElement({view:{name:"macro",classes:"create_work_package_link"},model:(e,t)=>{const n=e.getAttribute("data-type")||"",o=e.getAttribute("data-classes")||"";return t.createElement("op-macro-wp-button",{type:n,classes:o})}}),n.for("editingDowncast").elementToElement({model:"op-macro-wp-button",view:(e,t)=>this.createMacroViewElement(e,t)}),n.for("dataDowncast").elementToElement({model:"op-macro-wp-button",view:(e,t)=>t.createContainerElement("macro",{class:"create_work_package_link","data-type":e.getAttribute("type")||"","data-classes":e.getAttribute("classes")||""})}),e.ui.componentFactory.add(Td.buttonName,t=>{const n=new xl(t);return n.set({label:window.I18n.t("js.editor.macro.work_package_button.button"),withText:!0}),n.on("execute",()=>{o.services.macros.configureWorkPackageButton().then(t=>e.model.change(n=>{const o=n.createElement("op-macro-wp-button",{});n.setAttribute("type",t.type,o),n.setAttribute("classes",t.classes,o),e.model.insertContent(o,e.model.document.selection)}))}),n})}macroLabel(e){return e?window.I18n.t("js.editor.macro.work_package_button.with_type",{typename:e}):window.I18n.t("js.editor.macro.work_package_button.without_type")}createMacroViewElement(e,t){e.getAttribute("type");const n=e.getAttribute("classes")||"",o=this.macroLabel(),i=t.createText(o),r=t.createContainerElement("span",{class:"macro -create_work_package_link "+n});return t.insert(t.createPositionAt(r,0),i),function(e,t,n){return t.setCustomProperty(Cd,!0,e),$l(e,t,{label:n})}(r,t,{label:o})}}class Pd extends Ll{static get requires(){return[bd]}static get pluginName(){return"OPMacroWpButtonToolbar"}init(){const e=this.editor,t=(this.editor.model,td(e));_d(e,"opEditWpMacroButton",n=>{const o=t.services.macros,i=n.getAttribute("type"),r=n.getAttribute("classes");o.configureWorkPackageButton(i,r).then(t=>e.model.change(e=>{e.setAttribute("classes",t.classes,n),e.setAttribute("type",t.type,n)}))})}afterInit(){vd(this,this.editor,"OPMacroWpButton",Ad)}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
class Ed{constructor(e){this.context=e}destroy(){this.stopListening()}static get isContextPlugin(){return!0}}xn(Ed,Wo);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
class Sd extends Ed{static get pluginName(){return"PendingActions"}init(){this.set("hasAny",!1),this._actions=new Cn({idProperty:"_id"}),this._actions.delegate("add","remove").to(this)}add(e){if("string"!=typeof e)throw new fn.b("pendingactions-add-invalid-message: The message must be a string.",this);const t=Object.create(Wo);return t.set("message",e),this._actions.add(t),this.hasAny=!0,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]()}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Rd{constructor(){const e=new window.FileReader;this._reader=e,this._data=void 0,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;return this.total=e.size,new Promise((n,o)=>{t.onload=()=>{const e=t.result;this._data=e,n(e)},t.onerror=()=>{o("error")},t.onabort=()=>{o("aborted")},this._reader.readAsDataURL(e)})}abort(){this._reader.abort()}}xn(Rd,Wo);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
class Id extends Ll{static get pluginName(){return"FileRepository"}static get requires(){return[Sd]}init(){this.loaders=new Cn,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)return console.warn(Object(fn.a)("filerepository-no-upload-adapter: Upload adapter is not defined.")),null;const t=new Od(Promise.resolve(e),this.createUploadAdapter);return this.loaders.add(t),this._loadersMap.set(e,t),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)t.uploadTotal&&(e+=t.uploadTotal);this.uploadTotal=e}),t}destroyLoader(e){const t=e instanceof Od?e:this.getLoader(e);t._destroy(),this.loaders.remove(t),this._loadersMap.forEach((e,n)=>{e===t&&this._loadersMap.delete(n)})}_updatePendingAction(){const e=this.editor.plugins.get(Sd);if(this.loaders.length){if(!this._pendingAction){const t=this.editor.t,n=e=>`${t("k")} ${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}}xn(Id,Wo);class Od{constructor(e,t){this.id=un(),this._filePromiseWrapper=this._createFilePromiseWrapper(e),this._adapter=t(this),this._reader=new Rd,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(){return this._filePromiseWrapper?this._filePromiseWrapper.promise.then(e=>this._filePromiseWrapper?e:null):Promise.resolve(null)}get data(){return this._reader.data}read(){if("idle"!=this.status)throw new fn.b("filerepository-read-wrong-status: You cannot call read if the status is different than idle.",this);return this.status="reading",this.file.then(e=>this._reader.read(e)).then(e=>(this.status="idle",e)).catch(e=>{if("aborted"===e)throw this.status="aborted","aborted";throw this.status="error",this._reader.error?this._reader.error:e})}upload(){if("idle"!=this.status)throw new fn.b("filerepository-upload-wrong-status: You cannot call upload if the status is different than idle.",this);return this.status="uploading",this.file.then(()=>this._adapter.upload()).then(e=>(this.uploadResponse=e,this.status="idle",e)).catch(e=>{if("aborted"===this.status)throw"aborted";throw this.status="error",e})}abort(){const e=this.status;this.status="aborted",this._filePromiseWrapper.isFulfilled?"reading"==e?this._reader.abort():"uploading"==e&&this._adapter.abort&&this._adapter.abort():(this._filePromiseWrapper.promise.catch(()=>{}),this._filePromiseWrapper.rejecter("aborted")),this._destroy()}_destroy(){this._filePromiseWrapper=void 0,this._reader=void 0,this._adapter=void 0,this.uploadResponse=void 0}_createFilePromiseWrapper(e){const t={};return t.promise=new Promise((n,o)=>{t.rejecter=o,t.isFulfilled=!1,e.then(e=>{t.isFulfilled=!0,n(e)}).catch(e=>{t.isFulfilled=!0,o(e)})}),t}}xn(Od,Wo);class Nd{constructor(e,t,n){this.loader=e,this.resource=t,this.editor=n}upload(){const e=this.resource;if(!e||!e.uploadAttachments){const t=e?e.name:"Missing context";return console.warn(`uploadAttachments not present on context: ${t}`),Promise.reject("You're not allowed to upload attachments on this resource.")}return this.loader.file.then(t=>e.uploadAttachments([t]).then(e=>(this.editor.model.fire("op:attachment-added",e),this.buildResponse(e[0]))).catch(e=>{console.error("Failed upload %O",e)}))}buildResponse(e){return{default:e.uploadUrl}}abort(){return!1}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Md extends il{constructor(e){super(e),this.buttonView=new xl(e),this._fileInputView=new Vd(e),this._fileInputView.bind("acceptedType").to(this),this._fileInputView.bind("allowMultipleFiles").to(this),this._fileInputView.delegate("done").to(this),this.setTemplate({tag:"span",attributes:{class:"ck-file-dialog-button"},children:[this.buttonView,this._fileInputView]}),this.buttonView.on("execute",()=>{this._fileInputView.open()})}focus(){this.buttonView.focus()}}class Vd extends il{constructor(e){super(e),this.set("acceptedType"),this.set("allowMultipleFiles",!1);const t=this.bindTemplate;this.setTemplate({tag:"input",attributes:{class:["ck-hidden"],type:"file",tabindex:"-1",accept:t.to("acceptedType"),multiple:t.to("allowMultipleFiles")},on:{change:t.to(()=>{this.element&&this.element.files&&this.element.files.length&&this.fire("done",this.element.files),this.element.value=""})}})}open(){this.element.click()}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
function Dd(e){const t=e.map(e=>e.replace("+","\\+"));return new RegExp(`^image\\/(${t.join("|")})$`)}function Fd(e){return new Promise((t,n)=>{const o=e.getAttribute("src");fetch(o).then(e=>e.blob()).then(e=>{const i=function(e,t){return e.type?e.type:t.match(/data:(image\/\w+);base64/)?t.match(/data:(image\/\w+);base64/)[1].toLowerCase():"image/jpeg"}(e,o),r=function(e,t,n){try{return new File([e],t,{type:n})}catch(e){return null}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/(e,`image.${i.replace("image/","")}`,i);r?t(r):n()}).catch(n)})}class Bd extends Ll{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("imageUpload",n=>{const o=new Md(n),i=e.commands.get("imageUpload"),r=e.config.get("image.upload.types"),s=Dd(r);return o.set({acceptedType:r.map(e=>`image/${e}`).join(","),allowMultipleFiles:!0}),o.buttonView.set({label:t("de"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M6.91 10.54c.26-.23.64-.21.88.03l3.36 3.14 2.23-2.06a.64.64 0 0 1 .87 0l2.52 2.97V4.5H3.2v10.12l3.71-4.08zm10.27-7.51c.6 0 1.09.47 1.09 1.05v11.84c0 .59-.49 1.06-1.09 1.06H2.79c-.6 0-1.09-.47-1.09-1.06V4.08c0-.58.49-1.05 1.1-1.05h14.38zm-5.22 5.56a1.96 1.96 0 1 1 3.4-1.96 1.96 1.96 0 0 1-3.4 1.96z"/></svg>',tooltip:!0}),o.buttonView.bind("isEnabled").to(i),o.on("done",(t,n)=>{const o=Array.from(n).filter(e=>s.test(e.type));o.length&&e.execute("imageUpload",{file:o})}),o})}}function Ld(e){const t=e.getSelectedElement();return t&&function(e){return!!e.getCustomProperty("image")&&Ul(e)}(t)?t:null}function zd(e){return!!e&&e.is("image")}function qd(e,t,n={}){const o=e.createElement("image",n),i=Jl(t.document.selection,t);t.insertContent(o,i),o.parent&&e.setSelection(o,"on")}function jd(e){const t=e.schema,n=e.document.selection;return function(e,t,n){const o=function(e,t){const n=Jl(e,t).parent;if(n.isEmpty&&!n.is("$root"))return n.parent;return n}(e,n);return t.checkChild(o,"image")}(n,t,e)&&!function(e,t){const n=e.getSelectedElement();return n&&t.isObject(n)}(n,t)&&function(e){return[...e.focus.getAncestors()].every(e=>!e.is("image"))}(n)}function Hd(e){return Array.from(e.getChildren()).find(e=>e.is("img"))}n(60),n(62),n(64);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
class Wd extends Ll{constructor(e){super(e),this.placeholder="data:image/svg+xml;utf8,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 700 250"><rect rx="4"/></svg>')}init(){this.editor.editing.downcastDispatcher.on("attribute:uploadStatus:image",(...e)=>this.uploadStatusChange(...e))}uploadStatusChange(e,t,n){const o=this.editor,i=t.item,r=i.getAttribute("uploadId");if(!n.consumable.consume(t.item,e.name))return;const s=o.plugins.get(Id),a=r?t.attributeNewValue:null,c=this.placeholder,l=o.editing.mapper.toViewElement(i),d=n.writer;if("reading"==a)return Ud(l,d),void $d(c,l,d);if("uploading"==a){const e=s.loaders.get(r);return Ud(l,d),void(e?(Gd(l,d),function(e,t,n,o){const i=function(e){const t=e.createUIElement("div",{class:"ck-progress-bar"});return e.setCustomProperty("progressBar",!0,t),t}(t);t.insert(t.createPositionAt(e,"end"),i),n.on("change:uploadedPercent",(e,t,n)=>{o.change(e=>{e.setStyle("width",n+"%",i)})})}(l,d,e,o.editing.view),function(e,t,n){if(n.data){const o=Hd(e);t.setAttribute("src",n.data,o)}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/(l,d,e)):$d(c,l,d))}"complete"==a&&s.loaders.get(r)&&!fi.isEdge&&function(e,t,n){const o=t.createUIElement("div",{class:"ck-image-upload-complete-icon"});t.insert(t.createPositionAt(e,"end"),o),setTimeout(()=>{n.change(e=>e.remove(e.createRangeOn(o)))},3e3)}(l,d,o.editing.view),function(e,t){Jd(e,t,"progressBar")}(l,d),Gd(l,d),function(e,t){t.removeClass("ck-appear",e)}(l,d)}}function Ud(e,t){e.hasClass("ck-appear")||t.addClass("ck-appear",e)}function $d(e,t,n){t.hasClass("ck-image-upload-placeholder")||n.addClass("ck-image-upload-placeholder",t);const o=Hd(t);o.getAttribute("src")!==e&&n.setAttribute("src",e,o),Kd(t,"placeholder")||n.insert(n.createPositionAfter(o),function(e){const t=e.createUIElement("div",{class:"ck-upload-placeholder-loader"});return e.setCustomProperty("placeholder",!0,t),t}(n))}function Gd(e,t){e.hasClass("ck-image-upload-placeholder")&&t.removeClass("ck-image-upload-placeholder",e),Jd(e,t,"placeholder")}function Kd(e,t){for(const n of e.getChildren())if(n.getCustomProperty(t))return n}function Jd(e,t,n){const o=Kd(e,n);o&&t.remove(t.createRangeOn(o))}class Zd extends Ed{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||""})}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Qd{constructor(e){this.files=function(e){const t=e.files?Array.from(e.files):[],n=e.items?Array.from(e.items):[];if(t.length)return t;return n.filter(e=>"file"===e.kind).map(e=>e.getAsFile())}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/(e),this._native=e}get types(){return this._native.types}getData(e){return this._native.getData(e)}setData(e,t){this._native.setData(e,t)}}class Yd extends Nr{constructor(e){super(e);const t=this.document;function n(e,n){n.preventDefault();const o=n.dropRange?[n.dropRange]:Array.from(t.selection.getRanges()),i=new ln(t,"clipboardInput");t.fire(i,{dataTransfer:n.dataTransfer,targetRanges:o}),i.stop.called&&n.stopPropagation()}this.domEventType=["paste","copy","cut","drop","dragover"],this.listenTo(t,"paste",n,{priority:"low"}),this.listenTo(t,"drop",n,{priority:"low"})}onDomEvent(e){const t={dataTransfer:new Qd(e.clipboardData?e.clipboardData:e.dataTransfer)};"drop"==e.type&&(t.dropRange=function(e,t){const n=t.target.ownerDocument,o=t.clientX,i=t.clientY;let r;n.caretRangeFromPoint&&n.caretRangeFromPoint(o,i)?r=n.caretRangeFromPoint(o,i):t.rangeParent&&(r=n.createRange(),r.setStart(t.rangeParent,t.rangeOffset),r.collapse(!0));return r?e.domConverter.domRangeToView(r):e.document.selection.getFirstRange()}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/(this.view,e)),this.fire(e.type,e,t)}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
const Xd=["figcaption","li"];
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
class eu extends Ll{static get pluginName(){return"Clipboard"}init(){const e=this.editor,t=e.model.document,n=e.editing.view,o=n.document;function i(n,i){const r=i.dataTransfer;i.preventDefault();const s=e.data.toView(e.model.getSelectedContent(t.selection));o.fire("clipboardOutput",{dataTransfer:r,content:s,method:n.name})}this._htmlDataProcessor=new Pc(o),n.addObserver(Yd),this.listenTo(o,"clipboardInput",t=>{e.isReadOnly&&t.stop()},{priority:"highest"}),this.listenTo(o,"clipboardInput",(e,t)=>{const o=t.dataTransfer;let i="";var r;
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/o.getData("text/html")?i=function(e){return e.replace(/<span(?: class="Apple-converted-space"|)>(\s+)<\/span>/g,(e,t)=>1==t.length?" ":t)}(o.getData("text/html")):o.getData("text/plain")&&((r=(r=o.getData("text/plain")).replace(/</g,"<").replace(/>/g,">").replace(/\n/g,"</p><p>").replace(/^\s/," ").replace(/\s$/," ").replace(/\s\s/g," ")).indexOf("</p><p>")>-1&&(r=`<p>${r}</p>`),i=r),i=this._htmlDataProcessor.toView(i),this.fire("inputTransformation",{content:i,dataTransfer:o}),n.scrollToTheSelection()},{priority:"low"}),this.listenTo(this,"inputTransformation",(e,t)=>{if(!t.content.isEmpty){const e=this.editor.data,n=this.editor.model,o=e.toModel(t.content,"$clipboardHolder");if(0==o.childCount)return;n.insertContent(o)}},{priority:"low"}),this.listenTo(o,"copy",i,{priority:"low"}),this.listenTo(o,"cut",(t,n)=>{e.isReadOnly?n.preventDefault():i(t,n)},{priority:"low"}),this.listenTo(o,"clipboardOutput",(n,o)=>{o.content.isEmpty||(o.dataTransfer.setData("text/html",this._htmlDataProcessor.toData(o.content)),o.dataTransfer.setData("text/plain",function e(t){let n="";if(t.is("text")||t.is("textProxy"))n=t.data;else if(t.is("img")&&t.hasAttribute("alt"))n=t.getAttribute("alt");else{let o=null;for(const i of t.getChildren()){const t=e(i);o&&(o.is("containerElement")||i.is("containerElement"))&&(Xd.includes(o.name)||Xd.includes(i.name)?n+="\n":n+="\n\n"),n+=t,o=i}}return n}(o.content))),"cut"==o.method&&e.model.deleteContent(t.selection)},{priority:"low"})}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class tu{constructor(e){this.document=e}createDocumentFragment(e){return new Ci(this.document,e)}createElement(e,t,n){return new Vo(this.document,e,t,n)}createText(e){return new Mn(this.document,e)}clone(e,t=!1){return e._clone(t)}appendChild(e,t){return t._appendChild(e)}insertChild(e,t,n){return n._insertChild(e,t)}removeChildren(e,t,n){return n._removeChildren(e,t)}remove(e){const t=e.parent;return t?this.removeChildren(t.getChildIndex(e),1,t):[]}replace(e,t){const n=e.parent;if(n){const o=n.getChildIndex(e);return this.removeChildren(o,1,n),this.insertChild(o,t,n),!0}return!1}unwrapElement(e){const t=e.parent;if(t){const n=t.getChildIndex(e);this.remove(e),this.insertChild(n,e.getChildren(),t)}}rename(e,t){const n=new Vo(this.document,e,t.getAttributes(),t.getChildren());return this.replace(t,n)?n:null}setAttribute(e,t,n){n._setAttribute(e,t)}removeAttribute(e,t){t._removeAttribute(e)}addClass(e,t){t._addClass(e)}removeClass(e,t){t._removeClass(e)}setStyle(e,t,n){x(e)&&void 0===n&&(n=t),n._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,n){n._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}createPositionAt(e,t){return ei._createAt(e,t)}createPositionAfter(e){return ei._createAfter(e)}createPositionBefore(e){return ei._createBefore(e)}createRange(e,t){return new ti(e,t)}createRangeOn(e){return ti._createOn(e)}createRangeIn(e){return ti._createIn(e)}createSelection(e,t,n){return new ii(e,t,n)}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class nu{constructor(e){this.editor=e,this.set("value",void 0),this.set("isEnabled",!1),this._disableStack=new Set,this.decorate("execute"),this.listenTo(this.editor.model.document,"change",()=>{this.refresh()}),this.on("execute",e=>{this.isEnabled||e.stop()},{priority:"high"}),this.listenTo(e,"change:isReadOnly",(e,t,n)=>{n?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")})}refresh(){this.isEnabled=!0}forceDisabled(e){this._disableStack.add(e),1==this._disableStack.size&&(this.on("set:isEnabled",ou,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),0==this._disableStack.size&&(this.off("set:isEnabled",ou),this.refresh())}execute(){}destroy(){this.stopListening()}}function ou(e){e.return=!1,e.stop()}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/xn(nu,Wo);class iu extends nu{refresh(){this.isEnabled=jd(this.editor.model)}execute(e){const t=this.editor,n=t.model,o=t.plugins.get(Id);n.change(t=>{const i=Array.isArray(e.file)?e.file:[e.file];for(const e of i)ru(t,n,o,e)})}}function ru(e,t,n,o){const i=n.createLoader(o);i&&qd(e,t,{uploadId:i.id})}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class su extends Ll{static get requires(){return[Id,Zd,eu]}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,t=e.model.document,n=e.model.schema,o=e.conversion,i=e.plugins.get(Id),r=Dd(e.config.get("image.upload.types"));n.extend("image",{allowAttributes:["uploadId","uploadStatus"]}),e.commands.add("imageUpload",new iu(e)),o.for("upcast").attributeToAttribute({view:{name:"img",key:"uploadId"},model:"uploadId"}),this.listenTo(e.editing.view.document,"clipboardInput",(t,n)=>{if(o=n.dataTransfer,Array.from(o.types).includes("text/html")&&""!==o.getData("text/html"))return;var o;const i=Array.from(n.dataTransfer.files).filter(e=>!!e&&r.test(e.type)),s=n.targetRanges.map(t=>e.editing.mapper.toModelRange(t));e.model.change(n=>{n.setSelection(s),i.length&&(t.stop(),e.model.enqueueChange("default",()=>{e.execute("imageUpload",{file:i})}))})}),this.listenTo(e.plugins.get(eu),"inputTransformation",(t,n)=>{const o=Array.from(e.editing.view.createRangeIn(n.content)).filter(e=>{return!(!(t=e.item).is("element","img")||!t.getAttribute("src"))&&(t.getAttribute("src").match(/^data:image\/\w+;base64,/g)||t.getAttribute("src").match(/^blob:/g))&&!e.item.getAttribute("uploadProcessed");var t}).map(e=>({promise:Fd(e.item),imageElement:e.item}));if(!o.length)return;const r=new tu(e.editing.view.document);for(const e of o){r.setAttribute("uploadProcessed",!0,e.imageElement);const t=i.createLoader(e.promise);t&&(r.setAttribute("src","",e.imageElement),r.setAttribute("uploadId",t.id,e.imageElement))}}),e.editing.view.document.on("dragover",(e,t)=>{t.preventDefault()}),t.on("change",()=>{const n=t.differ.getChanges({includeChangesInGraveyard:!0});for(const t of n)if("insert"==t.type&&"$text"!=t.name){const n=t.position.nodeAfter,o="$graveyard"==t.position.root.rootName;for(const t of au(e,n)){const e=t.getAttribute("uploadId");if(!e)continue;const n=i.loaders.get(e);n&&(o?n.abort():"idle"==n.status&&this._readAndUpload(n,t))}}})}_readAndUpload(e,t){const n=this.editor,o=n.model,i=n.locale.t,r=n.plugins.get(Id),s=n.plugins.get(Zd);return o.enqueueChange("transparent",e=>{e.setAttribute("uploadStatus","reading",t)}),e.read().then(()=>{const i=e.upload();if(fi.isSafari){const e=Hd(n.editing.mapper.toViewElement(t));n.editing.view.once("render",()=>{if(!e.parent)return;const t=n.editing.view.domConverter.mapViewToDom(e.parent);if(!t)return;const o=t.style.display;t.style.display="none",t._ckHack=t.offsetHeight,t.style.display=o})}return o.enqueueChange("transparent",e=>{e.setAttribute("uploadStatus","uploading",t)}),i}).then(e=>{o.enqueueChange("transparent",n=>{n.setAttributes({uploadStatus:"complete",src:e.default},t),this._parseAndSetSrcsetAttributeOnImage(e,t,n)}),a()}).catch(n=>{if("error"!==e.status&&"aborted"!==e.status)throw n;"error"==e.status&&n&&s.showWarning(n,{title:i("al"),namespace:"upload"}),a(),o.enqueueChange("transparent",e=>{e.remove(t)})});function a(){o.enqueueChange("transparent",e=>{e.removeAttribute("uploadId",t),e.removeAttribute("uploadStatus",t)}),r.destroyLoader(e)}}_parseAndSetSrcsetAttributeOnImage(e,t,n){let o=0;const i=Object.keys(e).filter(e=>{const t=parseInt(e,10);if(!isNaN(t))return o=Math.max(o,t),!0}).map(t=>`${e[t]} ${t}w`).join(", ");""!=i&&n.setAttribute("srcset",{data:i,width:o},t)}}function au(e,t){return Array.from(e.model.createRangeOn(t)).filter(e=>e.item.is("image")).map(e=>e.item)}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class cu extends Ll{static get pluginName(){return"ImageUpload"}static get requires(){return[su,Bd,Wd]}}const lu=Symbol("isWpButtonMacroSymbol");function du(e){const t=e.getSelectedElement();return!(!t||!function(e){return!!e.getCustomProperty(lu)&&Ul(e)}(t))}class uu extends Ll{static get pluginName(){return"OPChildPagesEditing"}static get buttonName(){return"insertChildPages"}init(){const e=this.editor,t=e.model,n=e.conversion;t.schema.register("op-macro-child-pages",{allowWhere:["$block"],allowAttributes:["page"],isBlock:!0,isLimit:!0}),n.for("upcast").elementToElement({view:{name:"macro",classes:"child_pages"},model:(e,t)=>{const n=e.getAttribute("data-page")||"",o="true"==e.getAttribute("data-include-parent");return t.createElement("op-macro-child-pages",{page:n,includeParent:o})}}),n.for("editingDowncast").elementToElement({model:"op-macro-child-pages",view:(e,t)=>this.createMacroViewElement(e,t)}).add(e=>e.on("attribute:page",this.modelAttributeToView.bind(this))).add(e=>e.on("attribute:includeParent",this.modelAttributeToView.bind(this))),n.for("dataDowncast").elementToElement({model:"op-macro-child-pages",view:(e,t)=>t.createContainerElement("macro",{class:"child_pages","data-page":e.getAttribute("page")||"","data-include-parent":e.getAttribute("includeParent")||""})}),e.ui.componentFactory.add(uu.buttonName,t=>{const n=new xl(t);return n.set({label:window.I18n.t("js.editor.macro.child_pages.button"),withText:!0}),n.on("execute",()=>{e.model.change(t=>{const n=t.createElement("op-macro-child-pages",{});e.model.insertContent(n,e.model.document.selection)})}),n})}modelAttributeToView(e,t,n){const o=t.item;if(!o.is("op-macro-child-pages"))return;n.consumable.consume(t.item,e.name);const i=n.mapper.toViewElement(o);n.writer.remove(n.writer.createRangeIn(i)),this.setPlaceholderContent(n.writer,o,i)}macroLabel(){return window.I18n.t("js.editor.macro.child_pages.text")}pageLabel(e){return e&&e.length>0?e:window.I18n.t("js.editor.macro.child_pages.this_page")}includeParentText(e){return e?` (${window.I18n.t("js.editor.macro.child_pages.include_parent")})`:""}createMacroViewElement(e,t){const n=t.createContainerElement("div",{class:"macro -child_pages"});return this.setPlaceholderContent(t,e,n),function(e,t,n){return t.setCustomProperty(lu,!0,e),$l(e,t,{label:n})}(n,t,{label:this.macroLabel()})}setPlaceholderContent(e,t,n){const o=t.getAttribute("page"),i=t.getAttribute("includeParent"),r=this.macroLabel(),s=this.pageLabel(o),a=e.createContainerElement("span",{class:"macro-value"});let c=[e.createText(`${r} `)];e.insert(e.createPositionAt(a,0),e.createText(`${s}`)),c.push(a),c.push(e.createText(this.includeParentText(i))),e.insert(e.createPositionAt(n,0),c)}}class hu extends Ll{static get requires(){return[bd]}static get pluginName(){return"OPChildPagesToolbar"}init(){const e=this.editor,t=this.editor.model,n=td(e);_d(e,"opEditChildPagesMacroButton",e=>{const o=n.services.macros,i=e.getAttribute("page"),r=e.getAttribute("includeParent"),s=i&&i.length>0?i:"";o.configureChildPages(s,r).then(n=>t.change(t=>{t.setAttribute("page",n.page,e),t.setAttribute("includeParent",n.includeParent,e)}))})}afterInit(){vd(this,this.editor,"OPChildPages",du)}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
function*fu(e,t){for(const n of t)n&&e.getAttributeProperties(n[0]).copyOnEnter&&(yield n)}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class pu extends nu{execute(){const e=this.editor.model,t=e.document;e.change(n=>{!function(e,t,n,o){const i=n.isCollapsed,r=n.getFirstRange(),s=r.start.parent,a=r.end.parent;if(o.isLimit(s)||o.isLimit(a))return void(i||s!=a||e.deleteContent(n));if(i){const e=fu(t.model.schema,n.getAttributes());mu(t,r.start),t.setSelectionAttribute(e)}else{const o=!(r.start.isAtStart&&r.end.isAtEnd),i=s==a;e.deleteContent(n,{leaveUnmerged:o}),o&&(i?mu(t,n.focus):t.setSelection(a,0))}}(this.editor.model,n,t.selection,e.schema),this.fire("afterExecute",{writer:n})})}}function mu(e,t){e.split(t),e.setSelection(t.parent.nextSibling,0)}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class gu extends hr{constructor(e){super(e);const t=this.document;t.on("keydown",(e,n)=>{if(this.isEnabled&&n.keyCode==gi.enter){let o;t.once("enter",e=>o=e,{priority:"highest"}),t.fire("enter",new Or(t,n.domEvent,{isSoft:n.shiftKey})),o&&o.stop.called&&e.stop()}})}observe(){}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class bu extends Ll{static get pluginName(){return"Enter"}init(){const e=this.editor,t=e.editing.view,n=t.document;t.addObserver(gu),e.commands.add("enter",new pu(e)),this.listenTo(n,"enter",(n,o)=>{o.preventDefault(),o.isSoft||(e.execute("enter"),t.scrollToTheSelection())},{priority:"low"})}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class wu extends nu{execute(){const e=this.editor.model,t=e.document;e.change(n=>{!function(e,t,n){const o=n.isCollapsed,i=n.getFirstRange(),r=i.start.parent,s=i.end.parent,a=r==s;if(o){const o=fu(e.schema,n.getAttributes());ku(e,t,i.end),t.removeSelectionAttribute(n.getAttributeKeys()),t.setSelectionAttribute(o)}else{const o=!(i.start.isAtStart&&i.end.isAtEnd);e.deleteContent(n,{leaveUnmerged:o}),a?ku(e,t,n.focus):o&&t.setSelection(s,0)}}(e,n,t.selection),this.fire("afterExecute",{writer:n})})}refresh(){const e=this.editor.model,t=e.document;this.isEnabled=function(e,t){if(t.rangeCount>1)return!1;const n=t.anchor;if(!n||!e.checkChild(n,"softBreak"))return!1;const o=t.getFirstRange(),i=o.start.parent,r=o.end.parent;if((_u(i,e)||_u(r,e))&&i!==r)return!1;return!0}(e.schema,t.selection)}}function ku(e,t,n){const o=t.createElement("softBreak");e.insertContent(o,n),t.setSelection(o,"after")}function _u(e,t){return!e.is("rootElement")&&(t.isLimit(e)||_u(e.parent,t))}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class vu extends Ll{static get pluginName(){return"ShiftEnter"}init(){const e=this.editor,t=e.model.schema,n=e.conversion,o=e.editing.view,i=o.document;t.register("softBreak",{allowWhere:"$text",isInline:!0}),n.for("upcast").elementToElement({model:"softBreak",view:"br"}),n.for("downcast").elementToElement({model:"softBreak",view:(e,t)=>t.createEmptyElement("br")}),o.addObserver(gu),e.commands.add("shiftEnter",new wu(e)),this.listenTo(i,"enter",(t,n)=>{n.preventDefault(),n.isSoft&&(e.execute("shiftEnter"),o.scrollToTheSelection())},{priority:"low"})}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class yu{constructor(e,t=20){this.model=e,this.size=0,this.limit=t,this.isLocked=!1,this._changeCallback=(e,t)=>{"transparent"!=t.type&&t!==this._batch&&this._reset(!0)},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(){return this._batch||(this._batch=this.model.createBatch()),this._batch}input(e){this.size+=e,this.size>=this.limit&&this._reset(!0)}lock(){this.isLocked=!0}unlock(){this.isLocked=!1}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(e){this.isLocked&&!e||(this._batch=null,this.size=0)}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class xu extends nu{constructor(e,t){super(e),this._buffer=new yu(e.model,t),this._batches=new WeakSet}get buffer(){return this._buffer}destroy(){super.destroy(),this._buffer.destroy()}execute(e={}){const t=this.editor.model,n=t.document,o=e.text||"",i=o.length,r=e.range?t.createSelection(e.range):n.selection,s=e.resultRange;t.enqueueChange(this._buffer.batch,e=>{this._buffer.lock(),t.deleteContent(r),o&&t.insertContent(e.createText(o,n.selection.getAttributes()),r),s?e.setSelection(s):r.is("documentSelection")||e.setSelection(r),this._buffer.unlock(),this._buffer.input(i),this._batches.add(this._buffer.batch)})}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function Cu(e){let t=null;const n=e.model,o=e.editing.view,i=e.commands.get("input");function r(e){const r=n.document,a=o.document.isComposing,c=t&&t.isEqual(r.selection);t=null,i.isEnabled&&(function(e){if(e.ctrlKey)return!0;return Au.includes(e.keyCode)}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/(e)||r.selection.isCollapsed||a&&229===e.keyCode||!a&&229===e.keyCode&&c||s())}function s(){const e=i.buffer;e.lock(),n.enqueueChange(e.batch,()=>{n.deleteContent(n.document.selection)}),e.unlock()}fi.isAndroid?o.document.on("beforeinput",(e,t)=>r(t),{priority:"lowest"}):o.document.on("keydown",(e,t)=>r(t),{priority:"lowest"}),o.document.on("compositionstart",(function(){const e=n.document,t=1!==e.selection.rangeCount||e.selection.getFirstRange().isFlat;if(e.selection.isCollapsed||t)return;s()}),{priority:"lowest"}),o.document.on("compositionend",()=>{t=n.createSelection(n.document.selection)},{priority:"lowest"})}const Au=[bi("arrowUp"),bi("arrowRight"),bi("arrowDown"),bi("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 e=112;e<=135;e++)Au.push(e);function Tu(e){if(e.newChildren.length-e.oldChildren.length!=1)return;const t=function(e,t){const n=[];let o,i=0;return e.forEach(e=>{"equal"==e?(r(),i++):"insert"==e?(s("insert")?o.values.push(t[i]):(r(),o={type:"insert",index:i,values:[t[i]]}),i++):s("delete")?o.howMany++:(r(),o={type:"delete",index:i,howMany:1})}),r(),n;function r(){o&&(n.push(o),o=null)}function s(e){return o&&o.type==e}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/($i(e.oldChildren,e.newChildren,Pu),e.newChildren);if(t.length>1)return;const n=t[0];return n.values[0]&&n.values[0].is("text")?n:void 0}function Pu(e,t){return e&&e.is("text")&&t&&t.is("text")?e.data===t.data:e===t}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Eu{constructor(e){this.editor=e,this.editing=this.editor.editing}handle(e,t){if(function(e){if(0==e.length)return!1;for(const t of e)if("children"===t.type&&!Tu(t))return!0;return!1}(e))this._handleContainerChildrenMutations(e,t);else for(const n of e)this._handleTextMutation(n,t),this._handleTextNodeInsertion(n)}_handleContainerChildrenMutations(e,t){const n=function(e){const t=e.map(e=>e.node).reduce((e,t)=>e.getCommonAncestor(t,{includeSelf:!0}));if(!t)return;return t.getAncestors({includeSelf:!0,parentFirst:!0}).find(e=>e.is("containerElement")||e.is("rootElement"))}(e);if(!n)return;const o=this.editor.editing.view.domConverter.mapViewToDom(n),i=new ir(this.editor.editing.view.document),r=this.editor.data.toModel(i.domToView(o)).getChild(0),s=this.editor.editing.mapper.toModelElement(n);if(!s)return;const a=Array.from(r.getChildren()),c=Array.from(s.getChildren()),l=a[a.length-1],d=c[c.length-1];l&&l.is("softBreak")&&d&&!d.is("softBreak")&&a.pop();const u=this.editor.model.schema;if(!Su(a,u)||!Su(c,u))return;const h=a.map(e=>e.is("text")?e.data:"@").join("").replace(/\u00A0/g," "),f=c.map(e=>e.is("text")?e.data:"@").join("").replace(/\u00A0/g," ");if(f===h)return;const p=$i(f,h),{firstChangeAt:m,insertions:g,deletions:b}=Ru(p);let w=null;t&&(w=this.editing.mapper.toModelRange(t.getFirstRange()));const k=h.substr(m,g),_=this.editor.model.createRange(this.editor.model.createPositionAt(s,m),this.editor.model.createPositionAt(s,m+b));this.editor.execute("input",{text:k,range:_,resultRange:w})}_handleTextMutation(e,t){if("text"!=e.type)return;const n=e.newText.replace(/\u00A0/g," "),o=e.oldText.replace(/\u00A0/g," ");if(o===n)return;const i=$i(o,n),{firstChangeAt:r,insertions:s,deletions:a}=Ru(i);let c=null;t&&(c=this.editing.mapper.toModelRange(t.getFirstRange()));const l=this.editing.view.createPositionAt(e.node,r),d=this.editing.mapper.toModelPosition(l),u=this.editor.model.createRange(d,d.getShiftedBy(a)),h=n.substr(r,s);this.editor.execute("input",{text:h,range:u,resultRange:c})}_handleTextNodeInsertion(e){if("children"!=e.type)return;const t=Tu(e),n=this.editing.view.createPositionAt(e.node,t.index),o=this.editing.mapper.toModelPosition(n),i=t.values[0].data;this.editor.execute("input",{text:i.replace(/\u00A0/g," "),range:this.editor.model.createRange(o)})}}function Su(e,t){return e.every(e=>t.isInline(e))}function Ru(e){let t=null,n=null;for(let o=0;o<e.length;o++){"equal"!=e[o]&&(t=null===t?o:t,n=o)}let o=0,i=0;for(let r=t;r<=n;r++)"insert"!=e[r]&&o++,"delete"!=e[r]&&i++;return{insertions:i,deletions:o,firstChangeAt:t}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Iu extends Ll{static get pluginName(){return"Input"}init(){const e=this.editor,t=new xu(e,e.config.get("typing.undoStep")||20);e.commands.add("input",t),Cu(e),function(e){e.editing.view.document.on("mutations",(t,n,o)=>{new Eu(e).handle(n,o)})}(e)}isInput(e){return this.editor.commands.get("input")._batches.has(e)}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Ou extends nu{constructor(e,t){super(e),this.direction=t,this._buffer=new yu(e.model,e.config.get("typing.undoStep"))}get buffer(){return this._buffer}execute(e={}){const t=this.editor.model,n=t.document;t.enqueueChange(this._buffer.batch,o=>{this._buffer.lock();const i=o.createSelection(e.selection||n.selection),r=i.isCollapsed;if(i.isCollapsed&&t.modifySelection(i,{direction:this.direction,unit:e.unit}),this._shouldEntireContentBeReplacedWithParagraph(e.sequence||1))return void this._replaceEntireContentWithParagraph(o);if(i.isCollapsed)return;let s=0;i.getFirstRange().getMinimalFlatRanges().forEach(e=>{s+=oi(e.getWalker({singleCharacters:!0,ignoreElementEnd:!0,shallow:!0}))}),t.deleteContent(i,{doNotResetEntireContent:r,direction:this.direction}),this._buffer.input(s),o.setSelection(i),this._buffer.unlock()})}_shouldEntireContentBeReplacedWithParagraph(e){if(e>1)return!1;const t=this.editor.model,n=t.document.selection,o=t.schema.getLimitElement(n);if(!(n.isCollapsed&&n.containsEntireContent(o)))return!1;if(!t.schema.checkChild(o,"paragraph"))return!1;const i=o.getChild(0);return!i||"paragraph"!==i.name}_replaceEntireContentWithParagraph(e){const t=this.editor.model,n=t.document.selection,o=t.schema.getLimitElement(n),i=e.createElement("paragraph");e.remove(e.createRangeIn(o)),e.insert(i,o),e.setSelection(i,0)}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Nu extends hr{constructor(e){super(e);const t=e.document;let n=0;function o(e,n,o){let i;t.once("delete",e=>i=e,{priority:Number.POSITIVE_INFINITY}),t.fire("delete",new Or(t,n,o)),i&&i.stop.called&&e.stop()}t.on("keyup",(e,t)=>{t.keyCode!=gi.delete&&t.keyCode!=gi.backspace||(n=0)}),t.on("keydown",(e,t)=>{const i={};if(t.keyCode==gi.delete)i.direction="forward",i.unit="character";else{if(t.keyCode!=gi.backspace)return;i.direction="backward",i.unit="codePoint"}const r=fi.isMac?t.altKey:t.ctrlKey;i.unit=r?"word":i.unit,i.sequence=++n,o(e,t.domEvent,i)}),fi.isAndroid&&t.on("beforeinput",(t,n)=>{if("deleteContentBackward"!=n.domEvent.inputType)return;const i={unit:"codepoint",direction:"backward",sequence:1},r=n.domTarget.ownerDocument.defaultView.getSelection();r.anchorNode==r.focusNode&&r.anchorOffset+1!=r.focusOffset&&(i.selectionToRemove=e.domConverter.domSelectionToView(r)),o(t,n.domEvent,i)})}observe(){}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Mu extends Ll{static get pluginName(){return"Delete"}init(){const e=this.editor,t=e.editing.view,n=t.document;if(t.addObserver(Nu),e.commands.add("forwardDelete",new Ou(e,"forward")),e.commands.add("delete",new Ou(e,"backward")),this.listenTo(n,"delete",(n,o)=>{const i={unit:o.unit,sequence:o.sequence};if(o.selectionToRemove){const t=e.model.createSelection(),n=[];for(const t of o.selectionToRemove.getRanges())n.push(e.editing.mapper.toModelRange(t));t.setTo(n),i.selection=t}e.execute("forward"==o.direction?"forwardDelete":"delete",i),o.preventDefault(),t.scrollToTheSelection()}),fi.isAndroid){let e=null;this.listenTo(n,"delete",(t,n)=>{const o=n.domTarget.ownerDocument.defaultView.getSelection();e={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}},{priority:"lowest"}),this.listenTo(n,"keyup",(t,n)=>{if(e){const t=n.domTarget.ownerDocument.defaultView.getSelection();t.collapse(e.anchorNode,e.anchorOffset),t.extend(e.focusNode,e.focusOffset),e=null}})}}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Vu extends Ll{static get requires(){return[Iu,Mu]}static get pluginName(){return"Typing"}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/const Du=new Map;function Fu(e,t,n){let o=Du.get(e);o||(o=new Map,Du.set(e,o)),o.set(t,n)}function Bu(e){return[e]}function Lu(e,t,n={}){const o=function(e,t){const n=Du.get(e);return n&&n.has(t)?n.get(t):Bu}(e.constructor,t.constructor);try{return o(e=e.clone(),t,n)}catch(e){throw e}}function zu(e,t,n){e=e.slice(),t=t.slice();const o=new qu(n.document,n.useRelations,n.forceWeakRemove);o.setOriginalOperations(e),o.setOriginalOperations(t);const i=o.originalOperations;if(0==e.length||0==t.length)return{operationsA:e,operationsB:t,originalOperations:i};const r=new WeakMap;for(const t of e)r.set(t,0);const s={nextBaseVersionA:e[e.length-1].baseVersion+1,nextBaseVersionB:t[t.length-1].baseVersion+1,originalOperationsACount:e.length,originalOperationsBCount:t.length};let a=0;for(;a<e.length;){const n=e[a],i=r.get(n);if(i==t.length){a++;continue}const s=t[i],c=Lu(n,s,o.getContext(n,s,!0)),l=Lu(s,n,o.getContext(s,n,!1));o.updateRelation(n,s),o.setOriginalOperations(c,n),o.setOriginalOperations(l,s);for(const e of c)r.set(e,i+l.length);e.splice(a,1,...c),t.splice(i,1,...l)}if(n.padWithNoOps){const n=e.length-s.originalOperationsACount,o=t.length-s.originalOperationsBCount;Hu(e,o-n),Hu(t,n-o)}return ju(e,s.nextBaseVersionB),ju(t,s.nextBaseVersionA),{operationsA:e,operationsB:t,originalOperations:i}}class qu{constructor(e,t,n=!1){this.originalOperations=new Map,this._history=e.history,this._useRelations=t,this._forceWeakRemove=!!n,this._relations=new Map}setOriginalOperations(e,t=null){const n=t?this.originalOperations.get(t):null;for(const t of e)this.originalOperations.set(t,n||t)}updateRelation(e,t){switch(e.constructor){case Oa:switch(t.constructor){case Fa:e.targetPosition.isEqual(t.sourcePosition)||t.movedRange.containsPosition(e.targetPosition)?this._setRelation(e,t,"insertAtSource"):e.targetPosition.isEqual(t.deletionPosition)?this._setRelation(e,t,"insertBetween"):e.targetPosition.isAfter(t.sourcePosition)&&this._setRelation(e,t,"moveTargetAfter");break;case Oa:e.targetPosition.isEqual(t.sourcePosition)||e.targetPosition.isBefore(t.sourcePosition)?this._setRelation(e,t,"insertBefore"):this._setRelation(e,t,"insertAfter")}break;case Ba:switch(t.constructor){case Fa:e.splitPosition.isBefore(t.sourcePosition)&&this._setRelation(e,t,"splitBefore");break;case Oa:(e.splitPosition.isEqual(t.sourcePosition)||e.splitPosition.isBefore(t.sourcePosition))&&this._setRelation(e,t,"splitBefore")}break;case Fa:switch(t.constructor){case Fa:e.targetPosition.isEqual(t.sourcePosition)||this._setRelation(e,t,"mergeTargetNotMoved"),e.sourcePosition.isEqual(t.targetPosition)&&this._setRelation(e,t,"mergeSourceNotMoved"),e.sourcePosition.isEqual(t.sourcePosition)&&this._setRelation(e,t,"mergeSameElement");break;case Ba:e.sourcePosition.isEqual(t.splitPosition)&&this._setRelation(e,t,"splitAtSource")}break;case Ma:{const n=e.newRange;if(!n)return;switch(t.constructor){case Oa:{const o=vs._createFromPositionAndShift(t.sourcePosition,t.howMany),i=o.containsPosition(n.start)||o.start.isEqual(n.start),r=o.containsPosition(n.end)||o.end.isEqual(n.end);!i&&!r||o.containsRange(n)||this._setRelation(e,t,{side:i?"left":"right",path:i?n.start.path.slice():n.end.path.slice()});break}case Fa:{const o=n.start.isEqual(t.targetPosition),i=n.start.isEqual(t.deletionPosition),r=n.end.isEqual(t.deletionPosition),s=n.end.isEqual(t.sourcePosition);(o||i||r||s)&&this._setRelation(e,t,{wasInLeftElement:o,wasStartBeforeMergedElement:i,wasEndBeforeMergedElement:r,wasInRightElement:s});break}}break}}}getContext(e,t,n){return{aIsStrong:n,aWasUndone:this._wasUndone(e),bWasUndone:this._wasUndone(t),abRelation:this._useRelations?this._getRelation(e,t):null,baRelation:this._useRelations?this._getRelation(t,e):null,forceWeakRemove:this._forceWeakRemove}}_wasUndone(e){const t=this.originalOperations.get(e);return t.wasUndone||this._history.isUndoneOperation(t)}_getRelation(e,t){const n=this.originalOperations.get(t),o=this._history.getUndoneOperation(n);if(!o)return null;const i=this.originalOperations.get(e),r=this._relations.get(i);return r&&r.get(o)||null}_setRelation(e,t,n){const o=this.originalOperations.get(e),i=this.originalOperations.get(t);let r=this._relations.get(o);r||(r=new Map,this._relations.set(o,r)),r.set(i,n)}}function ju(e,t){for(const n of e)n.baseVersion=t++}function Hu(e,t){for(let n=0;n<t;n++)e.push(new oc(0))}function Wu(e,t,n){const o=e.nodes.getNode(0).getAttribute(t);if(o==n)return null;const i=new vs(e.position,e.position.getShiftedBy(e.howMany));return new Ra(i,t,o,n,0)}function Uu(e,t){return null===e.targetPosition._getTransformedByDeletion(t.sourcePosition,t.howMany)}function $u(e,t){const n=[];for(let o=0;o<e.length;o++){const i=e[o],r=new Oa(i.start,i.end.offset-i.start.offset,t,0);n.push(r);for(let t=o+1;t<e.length;t++)e[t]=e[t]._getTransformedByMove(r.sourcePosition,r.targetPosition,r.howMany)[0];t=t._getTransformedByMove(r.sourcePosition,r.targetPosition,r.howMany)}return n}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/Fu(Ra,Ra,(e,t,n)=>{if(e.key===t.key){const o=e.range.getDifference(t.range).map(t=>new Ra(t,e.key,e.oldValue,e.newValue,0)),i=e.range.getIntersection(t.range);return i&&n.aIsStrong&&o.push(new Ra(i,t.key,t.newValue,e.newValue,0)),0==o.length?[new oc(0)]:o}return[e]}),Fu(Ra,Na,(e,t)=>{if(e.range.start.hasSameParentAs(t.position)&&e.range.containsPosition(t.position)){const n=e.range._getTransformedByInsertion(t.position,t.howMany,!t.shouldReceiveAttributes).map(t=>new Ra(t,e.key,e.oldValue,e.newValue,e.baseVersion));if(t.shouldReceiveAttributes){const o=Wu(t,e.key,e.oldValue);o&&n.unshift(o)}return n}return e.range=e.range._getTransformedByInsertion(t.position,t.howMany,!1)[0],[e]}),Fu(Ra,Fa,(e,t)=>{const n=[];e.range.start.hasSameParentAs(t.deletionPosition)&&(e.range.containsPosition(t.deletionPosition)||e.range.start.isEqual(t.deletionPosition))&&n.push(vs._createFromPositionAndShift(t.graveyardPosition,1));const o=e.range._getTransformedByMergeOperation(t);return o.isCollapsed||n.push(o),n.map(t=>new Ra(t,e.key,e.oldValue,e.newValue,e.baseVersion))}),Fu(Ra,Oa,(e,t)=>function(e,t){const n=vs._createFromPositionAndShift(t.sourcePosition,t.howMany);let o=null,i=[];n.containsRange(e,!0)?o=e:e.start.hasSameParentAs(n.start)?(i=e.getDifference(n),o=e.getIntersection(n)):i=[e];const r=[];for(let e of i){e=e._getTransformedByDeletion(t.sourcePosition,t.howMany);const n=t.getMovedRangeStart(),o=e.start.hasSameParentAs(n);e=e._getTransformedByInsertion(n,t.howMany,o),r.push(...e)}o&&r.push(o._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany,!1)[0]);return r}(e.range,t).map(t=>new Ra(t,e.key,e.oldValue,e.newValue,e.baseVersion))),Fu(Ra,Ba,(e,t)=>{if(e.range.end.isEqual(t.insertionPosition))return t.graveyardPosition||e.range.end.offset++,[e];if(e.range.start.hasSameParentAs(t.splitPosition)&&e.range.containsPosition(t.splitPosition)){const n=e.clone();return n.range=new vs(t.moveTargetPosition.clone(),e.range.end._getCombined(t.splitPosition,t.moveTargetPosition)),e.range.end=t.splitPosition.clone(),e.range.end.stickiness="toPrevious",[e,n]}return e.range=e.range._getTransformedBySplitOperation(t),[e]}),Fu(Na,Ra,(e,t)=>{const n=[e];if(e.shouldReceiveAttributes&&e.position.hasSameParentAs(t.range.start)&&t.range.containsPosition(e.position)){const o=Wu(e,t.key,t.newValue);o&&n.push(o)}return n}),Fu(Na,Na,(e,t,n)=>(e.position.isEqual(t.position)&&n.aIsStrong||(e.position=e.position._getTransformedByInsertOperation(t)),[e])),Fu(Na,Oa,(e,t)=>(e.position=e.position._getTransformedByMoveOperation(t),[e])),Fu(Na,Ba,(e,t)=>(e.position=e.position._getTransformedBySplitOperation(t),[e])),Fu(Na,Fa,(e,t)=>(e.position=e.position._getTransformedByMergeOperation(t),[e])),Fu(Ma,Na,(e,t)=>(e.oldRange&&(e.oldRange=e.oldRange._getTransformedByInsertOperation(t)[0]),e.newRange&&(e.newRange=e.newRange._getTransformedByInsertOperation(t)[0]),[e])),Fu(Ma,Ma,(e,t,n)=>{if(e.name==t.name){if(!n.aIsStrong)return[new oc(0)];e.oldRange=t.newRange?t.newRange.clone():null}return[e]}),Fu(Ma,Fa,(e,t)=>(e.oldRange&&(e.oldRange=e.oldRange._getTransformedByMergeOperation(t)),e.newRange&&(e.newRange=e.newRange._getTransformedByMergeOperation(t)),[e])),Fu(Ma,Oa,(e,t,n)=>{if(e.oldRange&&(e.oldRange=vs._createFromRanges(e.oldRange._getTransformedByMoveOperation(t))),e.newRange){if(n.abRelation){const o=vs._createFromRanges(e.newRange._getTransformedByMoveOperation(t));if("left"==n.abRelation.side&&t.targetPosition.isEqual(e.newRange.start))return e.newRange.start.path=n.abRelation.path,e.newRange.end=o.end,[e];if("right"==n.abRelation.side&&t.targetPosition.isEqual(e.newRange.end))return e.newRange.start=o.start,e.newRange.end.path=n.abRelation.path,[e]}e.newRange=vs._createFromRanges(e.newRange._getTransformedByMoveOperation(t))}return[e]}),Fu(Ma,Ba,(e,t,n)=>{if(e.oldRange&&(e.oldRange=e.oldRange._getTransformedBySplitOperation(t)),e.newRange){if(n.abRelation){const o=e.newRange._getTransformedBySplitOperation(t);return e.newRange.start.isEqual(t.splitPosition)&&n.abRelation.wasStartBeforeMergedElement?e.newRange.start=_s._createAt(t.insertionPosition):e.newRange.start.isEqual(t.splitPosition)&&!n.abRelation.wasInLeftElement&&(e.newRange.start=_s._createAt(t.moveTargetPosition)),e.newRange.end.isEqual(t.splitPosition)&&n.abRelation.wasInRightElement?e.newRange.end=_s._createAt(t.moveTargetPosition):e.newRange.end.isEqual(t.splitPosition)&&n.abRelation.wasEndBeforeMergedElement?e.newRange.end=_s._createAt(t.insertionPosition):e.newRange.end=o.end,[e]}e.newRange=e.newRange._getTransformedBySplitOperation(t)}return[e]}),Fu(Fa,Na,(e,t)=>(e.sourcePosition.hasSameParentAs(t.position)&&(e.howMany+=t.howMany),e.sourcePosition=e.sourcePosition._getTransformedByInsertOperation(t),e.targetPosition=e.targetPosition._getTransformedByInsertOperation(t),[e])),Fu(Fa,Fa,(e,t,n)=>{if(e.sourcePosition.isEqual(t.sourcePosition)&&e.targetPosition.isEqual(t.targetPosition)){if(n.bWasUndone){const n=t.graveyardPosition.path.slice();return n.push(0),e.sourcePosition=new _s(t.graveyardPosition.root,n),e.howMany=0,[e]}return[new oc(0)]}if(e.sourcePosition.isEqual(t.sourcePosition)&&!e.targetPosition.isEqual(t.targetPosition)&&!n.bWasUndone&&"splitAtSource"!=n.abRelation){const o="$graveyard"==e.targetPosition.root.rootName,i="$graveyard"==t.targetPosition.root.rootName,r=o&&!i;if(i&&!o||!r&&n.aIsStrong){const n=t.targetPosition._getTransformedByMergeOperation(t),o=e.targetPosition._getTransformedByMergeOperation(t);return[new Oa(n,e.howMany,o,0)]}return[new oc(0)]}return e.sourcePosition.hasSameParentAs(t.targetPosition)&&(e.howMany+=t.howMany),e.sourcePosition=e.sourcePosition._getTransformedByMergeOperation(t),e.targetPosition=e.targetPosition._getTransformedByMergeOperation(t),e.graveyardPosition.isEqual(t.graveyardPosition)&&n.aIsStrong||(e.graveyardPosition=e.graveyardPosition._getTransformedByMergeOperation(t)),[e]}),Fu(Fa,Oa,(e,t,n)=>{const o=vs._createFromPositionAndShift(t.sourcePosition,t.howMany);return"remove"==t.type&&!n.bWasUndone&&!n.forceWeakRemove&&e.deletionPosition.hasSameParentAs(t.sourcePosition)&&o.containsPosition(e.sourcePosition)?[new oc(0)]:(e.sourcePosition.hasSameParentAs(t.targetPosition)&&(e.howMany+=t.howMany),e.sourcePosition.hasSameParentAs(t.sourcePosition)&&(e.howMany-=t.howMany),e.sourcePosition=e.sourcePosition._getTransformedByMoveOperation(t),e.targetPosition=e.targetPosition._getTransformedByMoveOperation(t),e.graveyardPosition.isEqual(t.targetPosition)||(e.graveyardPosition=e.graveyardPosition._getTransformedByMoveOperation(t)),[e])}),Fu(Fa,Ba,(e,t,n)=>{if(t.graveyardPosition&&(e.graveyardPosition=e.graveyardPosition._getTransformedByDeletion(t.graveyardPosition,1),e.deletionPosition.isEqual(t.graveyardPosition)&&(e.howMany=t.howMany)),e.targetPosition.isEqual(t.splitPosition)){const o=0!=t.howMany,i=t.graveyardPosition&&e.deletionPosition.isEqual(t.graveyardPosition);if(o||i||"mergeTargetNotMoved"==n.abRelation)return e.sourcePosition=e.sourcePosition._getTransformedBySplitOperation(t),[e]}if(e.sourcePosition.isEqual(t.splitPosition)){if("mergeSourceNotMoved"==n.abRelation)return e.howMany=0,e.targetPosition=e.targetPosition._getTransformedBySplitOperation(t),[e];if("mergeSameElement"==n.abRelation||e.sourcePosition.offset>0)return e.sourcePosition=t.moveTargetPosition.clone(),e.targetPosition=e.targetPosition._getTransformedBySplitOperation(t),[e]}return e.sourcePosition.hasSameParentAs(t.splitPosition)&&(e.howMany=t.splitPosition.offset),e.sourcePosition=e.sourcePosition._getTransformedBySplitOperation(t),e.targetPosition=e.targetPosition._getTransformedBySplitOperation(t),[e]}),Fu(Oa,Na,(e,t)=>{const n=vs._createFromPositionAndShift(e.sourcePosition,e.howMany)._getTransformedByInsertOperation(t,!1)[0];return e.sourcePosition=n.start,e.howMany=n.end.offset-n.start.offset,e.targetPosition.isEqual(t.position)||(e.targetPosition=e.targetPosition._getTransformedByInsertOperation(t)),[e]}),Fu(Oa,Oa,(e,t,n)=>{const o=vs._createFromPositionAndShift(e.sourcePosition,e.howMany),i=vs._createFromPositionAndShift(t.sourcePosition,t.howMany);let r,s=n.aIsStrong,a=!n.aIsStrong;if("insertBefore"==n.abRelation||"insertAfter"==n.baRelation?a=!0:"insertAfter"!=n.abRelation&&"insertBefore"!=n.baRelation||(a=!1),r=e.targetPosition.isEqual(t.targetPosition)&&a?e.targetPosition._getTransformedByDeletion(t.sourcePosition,t.howMany):e.targetPosition._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),Uu(e,t)&&Uu(t,e))return[t.getReversed()];if(o.containsPosition(t.targetPosition)&&o.containsRange(i,!0))return o.start=o.start._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),o.end=o.end._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),$u([o],r);if(i.containsPosition(e.targetPosition)&&i.containsRange(o,!0))return o.start=o.start._getCombined(t.sourcePosition,t.getMovedRangeStart()),o.end=o.end._getCombined(t.sourcePosition,t.getMovedRangeStart()),$u([o],r);const c=In(e.sourcePosition.getParentPath(),t.sourcePosition.getParentPath());if("prefix"==c||"extension"==c)return o.start=o.start._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),o.end=o.end._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),$u([o],r);"remove"!=e.type||"remove"==t.type||n.aWasUndone||n.forceWeakRemove?"remove"==e.type||"remove"!=t.type||n.bWasUndone||n.forceWeakRemove||(s=!1):s=!0;const l=[],d=o.getDifference(i);for(const e of d){e.start=e.start._getTransformedByDeletion(t.sourcePosition,t.howMany),e.end=e.end._getTransformedByDeletion(t.sourcePosition,t.howMany);const n="same"==In(e.start.getParentPath(),t.getMovedRangeStart().getParentPath()),o=e._getTransformedByInsertion(t.getMovedRangeStart(),t.howMany,n);l.push(...o)}const u=o.getIntersection(i);return null!==u&&s&&(u.start=u.start._getCombined(t.sourcePosition,t.getMovedRangeStart()),u.end=u.end._getCombined(t.sourcePosition,t.getMovedRangeStart()),0===l.length?l.push(u):1==l.length?i.start.isBefore(o.start)||i.start.isEqual(o.start)?l.unshift(u):l.push(u):l.splice(1,0,u)),0===l.length?[new oc(e.baseVersion)]:$u(l,r)}),Fu(Oa,Ba,(e,t,n)=>{let o=e.targetPosition.clone();e.targetPosition.isEqual(t.insertionPosition)&&t.graveyardPosition&&"moveTargetAfter"!=n.abRelation||(o=e.targetPosition._getTransformedBySplitOperation(t));const i=vs._createFromPositionAndShift(e.sourcePosition,e.howMany);if(i.end.isEqual(t.insertionPosition))return t.graveyardPosition||e.howMany++,e.targetPosition=o,[e];if(i.start.hasSameParentAs(t.splitPosition)&&i.containsPosition(t.splitPosition)){let e=new vs(t.splitPosition,i.end);return e=e._getTransformedBySplitOperation(t),$u([new vs(i.start,t.splitPosition),e],o)}e.targetPosition.isEqual(t.splitPosition)&&"insertAtSource"==n.abRelation&&(o=t.moveTargetPosition),e.targetPosition.isEqual(t.insertionPosition)&&"insertBetween"==n.abRelation&&(o=e.targetPosition);const r=[i._getTransformedBySplitOperation(t)];if(t.graveyardPosition){const o=i.start.isEqual(t.graveyardPosition)||i.containsPosition(t.graveyardPosition);e.howMany>1&&o&&!n.aWasUndone&&r.push(vs._createFromPositionAndShift(t.insertionPosition,1))}return $u(r,o)}),Fu(Oa,Fa,(e,t,n)=>{const o=vs._createFromPositionAndShift(e.sourcePosition,e.howMany);if(t.deletionPosition.hasSameParentAs(e.sourcePosition)&&o.containsPosition(t.sourcePosition))if("remove"!=e.type||n.forceWeakRemove){if(1==e.howMany)return n.bWasUndone?(e.sourcePosition=t.graveyardPosition.clone(),e.targetPosition=e.targetPosition._getTransformedByMergeOperation(t),[e]):[new oc(0)]}else if(!n.aWasUndone){const n=[];let o=t.graveyardPosition.clone(),i=t.targetPosition._getTransformedByMergeOperation(t);e.howMany>1&&(n.push(new Oa(e.sourcePosition,e.howMany-1,e.targetPosition,0)),o=o._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany-1),i=i._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany-1));const r=t.deletionPosition._getCombined(e.sourcePosition,e.targetPosition),s=new Oa(o,1,r,0),a=s.getMovedRangeStart().path.slice();a.push(0);const c=new _s(s.targetPosition.root,a);i=i._getTransformedByMove(o,r,1);const l=new Oa(i,t.howMany,c,0);return n.push(s),n.push(l),n}const i=vs._createFromPositionAndShift(e.sourcePosition,e.howMany)._getTransformedByMergeOperation(t);return e.sourcePosition=i.start,e.howMany=i.end.offset-i.start.offset,e.targetPosition=e.targetPosition._getTransformedByMergeOperation(t),[e]}),Fu(Va,Na,(e,t)=>(e.position=e.position._getTransformedByInsertOperation(t),[e])),Fu(Va,Fa,(e,t)=>e.position.isEqual(t.deletionPosition)?(e.position=t.graveyardPosition.clone(),e.position.stickiness="toNext",[e]):(e.position=e.position._getTransformedByMergeOperation(t),[e])),Fu(Va,Oa,(e,t)=>(e.position=e.position._getTransformedByMoveOperation(t),[e])),Fu(Va,Va,(e,t,n)=>{if(e.position.isEqual(t.position)){if(!n.aIsStrong)return[new oc(0)];e.oldName=t.newName}return[e]}),Fu(Va,Ba,(e,t)=>{if("same"==In(e.position.path,t.splitPosition.getParentPath())&&!t.graveyardPosition){const t=new Va(e.position.getShiftedBy(1),e.oldName,e.newName,0);return[e,t]}return e.position=e.position._getTransformedBySplitOperation(t),[e]}),Fu(Da,Da,(e,t,n)=>{if(e.root===t.root&&e.key===t.key){if(!n.aIsStrong||e.newValue===t.newValue)return[new oc(0)];e.oldValue=t.newValue}return[e]}),Fu(Ba,Na,(e,t)=>(e.splitPosition.hasSameParentAs(t.position)&&e.splitPosition.offset<t.position.offset&&(e.howMany+=t.howMany),e.splitPosition=e.splitPosition._getTransformedByInsertOperation(t),e.insertionPosition=Ba.getInsertionPosition(e.splitPosition),[e])),Fu(Ba,Fa,(e,t,n)=>{if(!e.graveyardPosition&&!n.bWasUndone&&e.splitPosition.hasSameParentAs(t.sourcePosition)){const n=t.graveyardPosition.path.slice();n.push(0);const o=new _s(t.graveyardPosition.root,n),i=Ba.getInsertionPosition(new _s(t.graveyardPosition.root,n)),r=new Ba(o,0,null,0);return r.insertionPosition=i,e.splitPosition=e.splitPosition._getTransformedByMergeOperation(t),e.insertionPosition=Ba.getInsertionPosition(e.splitPosition),e.graveyardPosition=r.insertionPosition.clone(),e.graveyardPosition.stickiness="toNext",[r,e]}return e.splitPosition.hasSameParentAs(t.deletionPosition)&&!e.splitPosition.isAfter(t.deletionPosition)&&e.howMany--,e.splitPosition.hasSameParentAs(t.targetPosition)&&(e.howMany+=t.howMany),e.splitPosition=e.splitPosition._getTransformedByMergeOperation(t),e.insertionPosition=Ba.getInsertionPosition(e.splitPosition),e.graveyardPosition&&(e.graveyardPosition=e.graveyardPosition._getTransformedByMergeOperation(t)),[e]}),Fu(Ba,Oa,(e,t,n)=>{const o=vs._createFromPositionAndShift(t.sourcePosition,t.howMany);if(e.graveyardPosition){const i=o.start.isEqual(e.graveyardPosition)||o.containsPosition(e.graveyardPosition);if(!n.bWasUndone&&i){const n=e.splitPosition._getTransformedByMoveOperation(t),o=e.graveyardPosition._getTransformedByMoveOperation(t),i=o.path.slice();i.push(0);const r=new _s(o.root,i);return[new Oa(n,e.howMany,r,0)]}e.graveyardPosition=e.graveyardPosition._getTransformedByMoveOperation(t)}if(e.splitPosition.hasSameParentAs(t.sourcePosition)&&o.containsPosition(e.splitPosition)){const n=t.howMany-(e.splitPosition.offset-t.sourcePosition.offset);return e.howMany-=n,e.splitPosition.hasSameParentAs(t.targetPosition)&&e.splitPosition.offset<t.targetPosition.offset&&(e.howMany+=t.howMany),e.splitPosition=t.sourcePosition.clone(),e.insertionPosition=Ba.getInsertionPosition(e.splitPosition),[e]}return!e.splitPosition.isEqual(t.targetPosition)||"insertAtSource"!=n.baRelation&&"splitBefore"!=n.abRelation?(t.sourcePosition.isEqual(t.targetPosition)||(e.splitPosition.hasSameParentAs(t.sourcePosition)&&e.splitPosition.offset<=t.sourcePosition.offset&&(e.howMany-=t.howMany),e.splitPosition.hasSameParentAs(t.targetPosition)&&e.splitPosition.offset<t.targetPosition.offset&&(e.howMany+=t.howMany)),e.splitPosition.stickiness="toNone",e.splitPosition=e.splitPosition._getTransformedByMoveOperation(t),e.splitPosition.stickiness="toNext",e.graveyardPosition?e.insertionPosition=e.insertionPosition._getTransformedByMoveOperation(t):e.insertionPosition=Ba.getInsertionPosition(e.splitPosition),[e]):(e.howMany+=t.howMany,e.splitPosition=e.splitPosition._getTransformedByDeletion(t.sourcePosition,t.howMany),e.insertionPosition=Ba.getInsertionPosition(e.splitPosition),[e])}),Fu(Ba,Ba,(e,t,n)=>{if(e.splitPosition.isEqual(t.splitPosition)){if(!e.graveyardPosition&&!t.graveyardPosition)return[new oc(0)];if(e.graveyardPosition&&t.graveyardPosition&&e.graveyardPosition.isEqual(t.graveyardPosition))return[new oc(0)];if("splitBefore"==n.abRelation)return e.howMany=0,e.graveyardPosition=e.graveyardPosition._getTransformedBySplitOperation(t),[e]}if(e.graveyardPosition&&t.graveyardPosition&&e.graveyardPosition.isEqual(t.graveyardPosition)){const o="$graveyard"==e.splitPosition.root.rootName,i="$graveyard"==t.splitPosition.root.rootName,r=o&&!i;if(i&&!o||!r&&n.aIsStrong){const n=[];return t.howMany&&n.push(new Oa(t.moveTargetPosition,t.howMany,t.splitPosition,0)),e.howMany&&n.push(new Oa(e.splitPosition,e.howMany,e.moveTargetPosition,0)),n}return[new oc(0)]}if(e.graveyardPosition&&(e.graveyardPosition=e.graveyardPosition._getTransformedBySplitOperation(t)),e.splitPosition.isEqual(t.insertionPosition)&&"splitBefore"==n.abRelation)return e.howMany++,[e];if(t.splitPosition.isEqual(e.insertionPosition)&&"splitBefore"==n.baRelation){const n=t.insertionPosition.path.slice();n.push(0);const o=new _s(t.insertionPosition.root,n);return[e,new Oa(e.insertionPosition,1,o,0)]}return e.splitPosition.hasSameParentAs(t.splitPosition)&&e.splitPosition.offset<t.splitPosition.offset&&(e.howMany-=t.howMany),e.splitPosition=e.splitPosition._getTransformedBySplitOperation(t),e.insertionPosition=Ba.getInsertionPosition(e.splitPosition),[e]});class Gu extends nu{constructor(e){super(e),this._stack=[],this._createdBatches=new WeakSet,this.refresh()}refresh(){this.isEnabled=this._stack.length>0}addBatch(e){const t=this.editor.model.document.selection,n={ranges:t.hasOwnRange?Array.from(t.getRanges()):[],isBackward:t.isBackward};this._stack.push({batch:e,selection:n}),this.refresh()}clearStack(){this._stack=[],this.refresh()}_restoreSelection(e,t,n){const o=this.editor.model,i=o.document,r=[];for(const t of e){const e=Ku(t,n).find(e=>e.start.root!=i.graveyard);e&&r.push(e)}r.length&&o.change(e=>{e.setSelection(r,{backward:t})})}_undo(e,t){const n=this.editor.model,o=n.document;this._createdBatches.add(t);const i=e.operations.slice().filter(e=>e.isDocumentOperation);i.reverse();for(const e of i){const i=e.baseVersion+1,r=Array.from(o.history.getOperations(i)),s=zu([e.getReversed()],r,{useRelations:!0,document:this.editor.model.document,padWithNoOps:!1,forceWeakRemove:!0}).operationsA;for(const i of s)t.addOperation(i),n.applyOperation(i),o.history.setOperationAsUndone(e,i)}}}function Ku(e,t){const n=e.getTransformedByOperations(t);n.sort((e,t)=>e.start.isBefore(t.start)?-1:1);for(let e=1;e<n.length;e++){const t=n[e-1],o=n[e];t.end.isTouching(o.start)&&(t.end=o.end,n.splice(e,1),e--)}return n}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Ju extends Gu{execute(e=null){const t=e?this._stack.findIndex(t=>t.batch==e):this._stack.length-1,n=this._stack.splice(t,1)[0],o=this.editor.model.createBatch("transparent");this.editor.model.enqueueChange(o,()=>{this._undo(n.batch,o);const e=this.editor.model.document.history.getOperations(n.batch.baseVersion);this._restoreSelection(n.selection.ranges,n.selection.isBackward,e),this.fire("revert",n.batch,o)}),this.refresh()}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Zu extends Gu{execute(){const e=this._stack.pop(),t=this.editor.model.createBatch("transparent");this.editor.model.enqueueChange(t,()=>{const n=e.batch.operations[e.batch.operations.length-1].baseVersion+1,o=this.editor.model.document.history.getOperations(n);this._restoreSelection(e.selection.ranges,e.selection.isBackward,o),this._undo(e.batch,t)}),this.refresh()}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Qu extends Ll{static get pluginName(){return"UndoEditing"}constructor(e){super(e),this._batchRegistry=new WeakSet}init(){const e=this.editor;this._undoCommand=new Ju(e),this._redoCommand=new Zu(e),e.commands.add("undo",this._undoCommand),e.commands.add("redo",this._redoCommand),this.listenTo(e.model,"applyOperation",(e,t)=>{const n=t[0];if(!n.isDocumentOperation)return;const o=n.batch,i=this._redoCommand._createdBatches.has(o),r=this._undoCommand._createdBatches.has(o);this._batchRegistry.has(o)||"transparent"==o.type&&!i&&!r||(i?this._undoCommand.addBatch(o):r||(this._undoCommand.addBatch(o),this._redoCommand.clearStack()),this._batchRegistry.add(o))},{priority:"highest"}),this.listenTo(this._undoCommand,"revert",(e,t,n)=>{this._redoCommand.addBatch(n)}),e.keystrokes.set("CTRL+Z","undo"),e.keystrokes.set("CTRL+Y","redo"),e.keystrokes.set("CTRL+SHIFT+Z","redo")}}var Yu='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M5.042 9.367l2.189 1.837a.75.75 0 0 1-.965 1.149l-3.788-3.18a.747.747 0 0 1-.21-.284.75.75 0 0 1 .17-.945L6.23 4.762a.75.75 0 1 1 .964 1.15L4.863 7.866h8.917A.75.75 0 0 1 14 7.9a4 4 0 1 1-1.477 7.718l.344-1.489a2.5 2.5 0 1 0 1.094-4.73l.008-.032H5.042z"/></svg>',Xu='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M14.958 9.367l-2.189 1.837a.75.75 0 0 0 .965 1.149l3.788-3.18a.747.747 0 0 0 .21-.284.75.75 0 0 0-.17-.945L13.77 4.762a.75.75 0 1 0-.964 1.15l2.331 1.955H6.22A.75.75 0 0 0 6 7.9a4 4 0 1 0 1.477 7.718l-.344-1.489A2.5 2.5 0 1 1 6.039 9.4l-.008-.032h8.927z"/></svg>';
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
class eh extends Ll{init(){const e=this.editor,t=e.locale,n=e.t,o="ltr"==t.uiLanguageDirection?Yu:Xu,i="ltr"==t.uiLanguageDirection?Xu:Yu;this._addButton("undo",n("ap"),"CTRL+Z",o),this._addButton("redo",n("aq"),"CTRL+Y",i)}_addButton(e,t,n,o){const i=this.editor;i.ui.componentFactory.add(e,r=>{const s=i.commands.get(e),a=new xl(r);return a.set({label:t,icon:o,keystroke:n,tooltip:!0}),a.bind("isEnabled").to(s,"isEnabled"),this.listenTo(a,"execute",()=>{i.execute(e),i.editing.view.focus()}),a})}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class th extends Ll{static get requires(){return[Qu,eh]}static get pluginName(){return"Undo"}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function nh(){let e=function(e){e=e.toLowerCase();const t=document.cookie.split(";");for(const n of t){const t=n.split("=");if(decodeURIComponent(t[0].trim().toLowerCase())===e)return decodeURIComponent(t[1])}return null}("ckCsrfToken");var t,n;return e&&40==e.length||(e=function(e){let t="";const n=new Uint8Array(e);window.crypto.getRandomValues(n);for(let e=0;e<n.length;e++){const o="abcdefghijklmnopqrstuvwxyz0123456789".charAt(n[e]%"abcdefghijklmnopqrstuvwxyz0123456789".length);t+=Math.random()>.5?o.toUpperCase():o}return t}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/(40),t="ckCsrfToken",n=e,document.cookie=encodeURIComponent(t)+"="+encodeURIComponent(n)+";path=/"),e}class oh{constructor(e,t,n){this.loader=e,this.url=t,this.t=n}upload(){return this.loader.file.then(e=>new Promise((t,n)=>{this._initRequest(),this._initListeners(t,n,e),this._sendRequest(e)}))}abort(){this.xhr&&this.xhr.abort()}_initRequest(){const e=this.xhr=new XMLHttpRequest;e.open("POST",this.url,!0),e.responseType="json"}_initListeners(e,t,n){const o=this.xhr,i=this.loader,r=(0,this.t)("a")+` ${n.name}.`;o.addEventListener("error",()=>t(r)),o.addEventListener("abort",()=>t()),o.addEventListener("load",()=>{const n=o.response;if(!n||!n.uploaded)return t(n&&n.error&&n.error.message?n.error.message:r);e({default:n.url})}),o.upload&&o.upload.addEventListener("progress",e=>{e.lengthComputable&&(i.uploadTotal=e.total,i.uploaded=e.loaded)})}_sendRequest(e){const t=new FormData;t.append("upload",e),t.append("ckCsrfToken",nh()),this.xhr.send(t)}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class ih{static get pluginName(){return"BlockAutoformatEditing"}constructor(e,t,n){let o,i=null;"function"==typeof n?o=n:(i=e.commands.get(n),o=()=>{e.execute(n)}),e.model.document.on("change",(n,r)=>{if(i&&!i.isEnabled)return;if("transparent"==r.type)return;const s=Array.from(e.model.document.differ.getChanges()),a=s[0];if(1!=s.length||"insert"!==a.type||"$text"!=a.name||1!=a.length)return;const c=a.position.parent;if(!c.is("paragraph")||1!==c.childCount)return;const l=t.exec(c.getChild(0).data);l&&e.model.enqueueChange(e=>{const t=e.createPositionAt(c,0),n=e.createPositionAt(c,l[0].length),i=new Os(t,n);!1!==o({match:l})&&e.remove(i),i.detach()})})}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function rh(e,t){let n=e.start;return{text:Array.from(e.getItems()).reduce((e,o)=>o.is("text")||o.is("textProxy")?e+o.data:(n=t.createPositionAfter(o),""),""),range:t.createRange(n,e.end)}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class sh{static get pluginName(){return"InlineAutoformatEditing"}constructor(e,t,n){let o,i,r,s;t instanceof RegExp?o=t:r=t,"string"==typeof n?i=n:s=n,r=r||(e=>{let t;const n=[],i=[];for(;null!==(t=o.exec(e))&&!(t&&t.length<4);){let{index:e,1:o,2:r,3:s}=t;const a=o+r+s;e+=t[0].length-a.length;const c=[e,e+o.length],l=[e+o.length+r.length,e+o.length+r.length+s.length];n.push(c),n.push(l),i.push([e+o.length,e+o.length+r.length])}return{remove:n,format:i}}),s=s||((t,n)=>{const o=e.model.schema.getValidRanges(n,i);for(const e of o)t.setAttribute(i,!0,e);t.removeSelectionAttribute(i)}),e.model.document.on("change",(t,n)=>{if("transparent"==n.type)return;const o=e.model,i=o.document.selection;if(!i.isCollapsed)return;const a=Array.from(o.document.differ.getChanges()),c=a[0];if(1!=a.length||"insert"!==c.type||"$text"!=c.name||1!=c.length)return;const l=i.focus,d=l.parent,{text:u,range:h}=rh(o.createRange(o.createPositionAt(d,0),l),o),f=r(u),p=ah(h.start,f.format,o),m=ah(h.start,f.remove,o);p.length&&m.length&&o.enqueueChange(e=>{if(!1!==s(e,p))for(const t of m.reverse())e.remove(t)})})}}function ah(e,t,n){return t.filter(e=>void 0!==e[0]&&void 0!==e[1]).map(t=>n.createRange(e.getShiftedBy(t[0]),e.getShiftedBy(t[1])))}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function ch(e,t){return(n,o)=>{if(!e.commands.get(t).isEnabled)return!1;const i=e.model.schema.getValidRanges(o,t);for(const e of i)n.setAttribute(t,!0,e);n.removeSelectionAttribute(t)}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class lh extends nu{constructor(e,t){super(e),this.attributeKey=t}refresh(){const e=this.editor.model,t=e.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,this.attributeKey)}execute(e={}){const t=this.editor.model,n=t.document.selection,o=void 0===e.forceValue?!this.value:e.forceValue;t.change(e=>{if(n.isCollapsed)o?e.setSelectionAttribute(this.attributeKey,!0):e.removeSelectionAttribute(this.attributeKey);else{const i=t.schema.getValidRanges(n.getRanges(),this.attributeKey);for(const t of i)o?e.setAttribute(this.attributeKey,o,t):e.removeAttribute(this.attributeKey,t)}})}_getValueFromFirstAllowedNode(){const e=this.editor.model,t=e.schema,n=e.document.selection;if(n.isCollapsed)return n.hasAttribute(this.attributeKey);for(const e of n.getRanges())for(const n of e.getItems())if(t.checkAttribute(n,this.attributeKey))return n.hasAttribute(this.attributeKey);return!1}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class dh extends Ll{static get pluginName(){return"BoldEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"bold"}),e.model.schema.setAttributeProperties("bold",{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:"bold",view:"strong",upcastAlso:["b",e=>{const t=e.getStyle("font-weight");return t?"bold"==t||Number(t)>=600?{name:!0,styles:["font-weight"]}:void 0:null}]}),e.commands.add("bold",new lh(e,"bold")),e.keystrokes.set("CTRL+B","bold")}}class uh extends Ll{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("bold",n=>{const o=e.commands.get("bold"),i=new xl(n);return i.set({label:t("d"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.187 17H5.773c-.637 0-1.092-.138-1.364-.415-.273-.277-.409-.718-.409-1.323V4.738c0-.617.14-1.062.419-1.332.279-.27.73-.406 1.354-.406h4.68c.69 0 1.288.041 1.793.124.506.083.96.242 1.36.478.341.197.644.447.906.75a3.262 3.262 0 0 1 .808 2.162c0 1.401-.722 2.426-2.167 3.075C15.05 10.175 16 11.315 16 13.01a3.756 3.756 0 0 1-2.296 3.504 6.1 6.1 0 0 1-1.517.377c-.571.073-1.238.11-2 .11zm-.217-6.217H7v4.087h3.069c1.977 0 2.965-.69 2.965-2.072 0-.707-.256-1.22-.768-1.537-.512-.319-1.277-.478-2.296-.478zM7 5.13v3.619h2.606c.729 0 1.292-.067 1.69-.2a1.6 1.6 0 0 0 .91-.765c.165-.267.247-.566.247-.897 0-.707-.26-1.176-.778-1.409-.519-.232-1.31-.348-2.375-.348H7z"/></svg>',keystroke:"CTRL+B",tooltip:!0,isToggleable:!0}),i.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(i,"execute",()=>{e.execute("bold"),e.editing.view.focus()}),i})}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class hh extends Ll{static get pluginName(){return"CodeEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"code"}),e.model.schema.setAttributeProperties("code",{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:"code",view:"code",upcastAlso:{styles:{"word-wrap":"break-word"}}}),e.commands.add("code",new lh(e,"code"))}}n(15);class fh extends Ll{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("code",n=>{const o=e.commands.get("code"),i=new xl(n);return i.set({label:t("e"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M12.5 5.7l5.2 3.9v1.3l-5.6 4c-.1.2-.3.2-.5.2-.3-.1-.6-.7-.6-1l.3-.4 4.7-3.5L11.5 7l-.2-.2c-.1-.3-.1-.6 0-.8.2-.2.5-.4.8-.4a.8.8 0 0 1 .4.1zm-5.2 0L2 9.6v1.3l5.6 4c.1.2.3.2.5.2.3-.1.7-.7.6-1 0-.1 0-.3-.2-.4l-5-3.5L8.2 7l.2-.2c.1-.3.1-.6 0-.8-.2-.2-.5-.4-.8-.4a.8.8 0 0 0-.3.1z"/></svg>',tooltip:!0,isToggleable:!0}),i.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(i,"execute",()=>{e.execute("code"),e.editing.view.focus()}),i})}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class ph extends Ll{static get pluginName(){return"StrikethroughEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"strikethrough"}),e.model.schema.setAttributeProperties("strikethrough",{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:"strikethrough",view:"s",upcastAlso:["del","strike",{styles:{"text-decoration":"line-through"}}]}),e.commands.add("strikethrough",new lh(e,"strikethrough")),e.keystrokes.set("CTRL+SHIFT+X","strikethrough")}}class mh extends Ll{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("strikethrough",n=>{const o=e.commands.get("strikethrough"),i=new xl(n);return i.set({label:t("f"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M7 16.4c-.8-.4-1.5-.9-2.2-1.5a.6.6 0 0 1-.2-.5l.3-.6h1c1 1.2 2.1 1.7 3.7 1.7 1 0 1.8-.3 2.3-.6.6-.4.6-1.2.6-1.3.2-1.2-.9-2.1-.9-2.1h2.1c.3.7.4 1.2.4 1.7v.8l-.6 1.2c-.6.8-1.1 1-1.6 1.2a6 6 0 0 1-2.4.6c-1 0-1.8-.3-2.5-.6zM6.8 9L6 8.3c-.4-.5-.5-.8-.5-1.6 0-.7.1-1.3.5-1.8.4-.6 1-1 1.6-1.3a6.3 6.3 0 0 1 4.7 0 4 4 0 0 1 1.7 1l.3.7c0 .1.2.4-.2.7-.4.2-.9.1-1 0a3 3 0 0 0-1.2-1c-.4-.2-1-.3-2-.4-.7 0-1.4.2-2 .6-.8.6-1 .8-1 1.5 0 .8.5 1 1.2 1.5.6.4 1.1.7 1.9 1H6.8z"/><path d="M3 10.5V9h14v1.5z"/></svg>',keystroke:"CTRL+SHIFT+X",tooltip:!0,isToggleable:!0}),i.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(i,"execute",()=>{e.execute("strikethrough"),e.editing.view.focus()}),i})}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class gh extends Ll{static get pluginName(){return"ItalicEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"italic"}),e.model.schema.setAttributeProperties("italic",{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:"italic",view:"i",upcastAlso:["em",{styles:{"font-style":"italic"}}]}),e.commands.add("italic",new lh(e,"italic")),e.keystrokes.set("CTRL+I","italic")}}class bh extends Ll{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("italic",n=>{const o=e.commands.get("italic"),i=new xl(n);return i.set({label:t("g"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M9.586 14.633l.021.004c-.036.335.095.655.393.962.082.083.173.15.274.201h1.474a.6.6 0 1 1 0 1.2H5.304a.6.6 0 0 1 0-1.2h1.15c.474-.07.809-.182 1.005-.334.157-.122.291-.32.404-.597l2.416-9.55a1.053 1.053 0 0 0-.281-.823 1.12 1.12 0 0 0-.442-.296H8.15a.6.6 0 0 1 0-1.2h6.443a.6.6 0 1 1 0 1.2h-1.195c-.376.056-.65.155-.823.296-.215.175-.423.439-.623.79l-2.366 9.347z"/></svg>',keystroke:"CTRL+I",tooltip:!0,isToggleable:!0}),i.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(i,"execute",()=>{e.execute("italic"),e.editing.view.focus()}),i})}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
function wh(e){const t=e.next();return t.done?null:t.value}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class kh extends nu{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,n=t.schema,o=t.document.selection,i=Array.from(o.getSelectedBlocks()),r=void 0===e.forceValue?!this.value:e.forceValue;t.change(e=>{if(r){const t=i.filter(e=>_h(e)||yh(n,e));this._applyQuote(e,t)}else this._removeQuote(e,i.filter(_h))})}_getValue(){const e=wh(this.editor.model.document.selection.getSelectedBlocks());return!(!e||!_h(e))}_checkEnabled(){if(this.value)return!0;const e=this.editor.model.document.selection,t=this.editor.model.schema,n=wh(e.getSelectedBlocks());return!!n&&yh(t,n)}_removeQuote(e,t){vh(e,t).reverse().forEach(t=>{if(t.start.isAtStart&&t.end.isAtEnd)return void e.unwrap(t.start.parent);if(t.start.isAtStart){const n=e.createPositionBefore(t.start.parent);return void e.move(t,n)}t.end.isAtEnd||e.split(t.end);const n=e.createPositionAfter(t.end.parent);e.move(t,n)})}_applyQuote(e,t){const n=[];vh(e,t).reverse().forEach(t=>{let o=_h(t.start);o||(o=e.createElement("blockQuote"),e.wrap(t,o)),n.push(o)}),n.reverse().reduce((t,n)=>t.nextSibling==n?(e.merge(e.createPositionAfter(t)),t):n)}}function _h(e){return"blockQuote"==e.parent.name?e.parent:null}function vh(e,t){let n,o=0;const i=[];for(;o<t.length;){const r=t[o],s=t[o+1];n||(n=e.createPositionBefore(r)),s&&r.nextSibling==s||(i.push(e.createRange(n,e.createPositionAfter(r))),n=null),o++}return i}function yh(e,t){const n=e.checkChild(t.parent,"blockQuote"),o=e.checkChild(["$root","blockQuote"],t);return n&&o}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class xh extends Ll{static get pluginName(){return"BlockQuoteEditing"}init(){const e=this.editor,t=e.model.schema;e.commands.add("blockQuote",new kh(e)),t.register("blockQuote",{allowWhere:"$block",allowContentOf:"$root"}),t.addChildCheck((e,t)=>{if(e.endsWith("blockQuote")&&"blockQuote"==t.name)return!1}),e.conversion.elementToElement({model:"blockQuote",view:"blockquote"}),e.model.document.registerPostFixer(n=>{const o=e.model.document.differ.getChanges();for(const e of o)if("insert"==e.type){const o=e.position.nodeAfter;if(!o)continue;if(o.is("blockQuote")&&o.isEmpty)return n.remove(o),!0;if(o.is("blockQuote")&&!t.checkChild(e.position,o))return n.unwrap(o),!0;if(o.is("element")){const e=n.createRangeIn(o);for(const o of e.getItems())if(o.is("blockQuote")&&!t.checkChild(n.createPositionBefore(o),o))return n.unwrap(o),!0}}else if("remove"==e.type){const t=e.position.parent;if(t.is("blockQuote")&&t.isEmpty)return n.remove(t),!0}return!1})}afterInit(){const e=this.editor.commands.get("blockQuote");this.listenTo(this.editor.editing.view.document,"enter",(t,n)=>{const o=this.editor.model.document,i=o.selection.getLastPosition().parent;o.selection.isCollapsed&&i.isEmpty&&e.value&&(this.editor.execute("blockQuote"),this.editor.editing.view.scrollToTheSelection(),n.preventDefault(),t.stop())})}}n(67);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
class Ch extends Ll{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("blockQuote",n=>{const o=e.commands.get("blockQuote"),i=new xl(n);return i.set({label:t("l"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 10.423a6.5 6.5 0 0 1 6.056-6.408l.038.67C6.448 5.423 5.354 7.663 5.22 10H9c.552 0 .5.432.5.986v4.511c0 .554-.448.503-1 .503h-5c-.552 0-.5-.449-.5-1.003v-4.574zm8 0a6.5 6.5 0 0 1 6.056-6.408l.038.67c-2.646.739-3.74 2.979-3.873 5.315H17c.552 0 .5.432.5.986v4.511c0 .554-.448.503-1 .503h-5c-.552 0-.5-.449-.5-1.003v-4.574z"/></svg>',tooltip:!0,isToggleable:!0}),i.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(i,"execute",()=>{e.execute("blockQuote"),e.editing.view.focus()}),i})}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
class Ah extends nu{refresh(){const e=this.editor.model,t=wh(e.document.selection.getSelectedBlocks());this.value=!!t&&t.is("paragraph"),this.isEnabled=!!t&&Th(t,e.schema)}execute(e={}){const t=this.editor.model,n=t.document;t.change(o=>{const i=(e.selection||n.selection).getSelectedBlocks();for(const e of i)!e.is("paragraph")&&Th(e,t.schema)&&o.rename(e,"paragraph")})}}function Th(e,t){return t.checkChild(e.parent,"paragraph")&&!t.isObject(e)}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Ph extends Ll{static get pluginName(){return"Paragraph"}init(){const e=this.editor,t=e.model,n=e.data;e.commands.add("paragraph",new Ah(e)),t.schema.register("paragraph",{inheritAllFrom:"$block"}),e.conversion.elementToElement({model:"paragraph",view:"p"}),e.conversion.for("upcast").elementToElement({model:(e,t)=>Ph.paragraphLikeElements.has(e.name)?e.isEmpty?null:t.createElement("paragraph"):null,converterPriority:"low"}),n.upcastDispatcher.on("element",(e,t,n)=>{n.consumable.test(t.viewItem,{name:t.viewItem.name})&&Sh(t.viewItem,t.modelCursor,n.schema)&&Object.assign(t,Eh(t.viewItem,t.modelCursor,n))},{priority:"low"}),n.upcastDispatcher.on("text",(e,t,n)=>{t.modelRange||Sh(t.viewItem,t.modelCursor,n.schema)&&Object.assign(t,Eh(t.viewItem,t.modelCursor,n))},{priority:"lowest"}),t.document.registerPostFixer(e=>this._autoparagraphEmptyRoots(e)),e.data.on("ready",()=>{t.enqueueChange("transparent",e=>this._autoparagraphEmptyRoots(e))},{priority:"lowest"})}_autoparagraphEmptyRoots(e){const t=this.editor.model;for(const n of t.document.getRootNames()){const o=t.document.getRoot(n);if(o.isEmpty&&"$graveyard"!=o.rootName&&t.schema.checkChild(o,"paragraph"))return e.insertElement("paragraph",o),!0}}}function Eh(e,t,n){const o=n.writer.createElement("paragraph");return n.writer.insert(o,t),n.convertItem(e,n.writer.createPositionAt(o,0))}function Sh(e,t,n){const o=n.createContext(t);return!!n.checkChild(o,"paragraph")&&!!n.checkChild(o.push("paragraph"),e)}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/Ph.paragraphLikeElements=new Set(["blockquote","dd","div","dt","h1","h2","h3","h4","h5","h6","li","p","td"]);class Rh extends nu{constructor(e,t){super(e),this.modelElements=t}refresh(){const e=wh(this.editor.model.document.selection.getSelectedBlocks());this.value=!!e&&this.modelElements.includes(e.name)&&e.name,this.isEnabled=!!e&&this.modelElements.some(t=>Ih(e,t,this.editor.model.schema))}execute(e){const t=this.editor.model,n=t.document,o=e.value;t.change(e=>{const i=Array.from(n.selection.getSelectedBlocks()).filter(e=>Ih(e,o,t.schema));for(const t of i)t.is(o)||e.rename(t,o)})}}function Ih(e,t,n){return n.checkChild(e.parent,t)&&!n.isObject(e)}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Oh extends Ll{static get pluginName(){return"HeadingEditing"}constructor(e){super(e),e.config.define("heading",{options:[{model:"paragraph",title:"Paragraph",class:"ck-heading_paragraph"},{model:"heading1",view:"h2",title:"Heading 1",class:"ck-heading_heading1"},{model:"heading2",view:"h3",title:"Heading 2",class:"ck-heading_heading2"},{model:"heading3",view:"h4",title:"Heading 3",class:"ck-heading_heading3"}]})}static get requires(){return[Ph]}init(){const e=this.editor,t=e.config.get("heading.options"),n=[];for(const o of t)"paragraph"!==o.model&&(e.model.schema.register(o.model,{inheritAllFrom:"$block"}),e.conversion.elementToElement(o),n.push(o.model));this._addDefaultH1Conversion(e),e.commands.add("heading",new Rh(e,n))}afterInit(){const e=this.editor,t=e.commands.get("enter"),n=e.config.get("heading.options");t&&this.listenTo(t,"afterExecute",(t,o)=>{const i=e.model.document.selection.getFirstPosition().parent;n.some(e=>i.is(e.model))&&!i.is("paragraph")&&0===i.childCount&&o.writer.rename(i,"paragraph")})}_addDefaultH1Conversion(e){e.conversion.for("upcast").elementToElement({model:"heading1",view:"h1",converterPriority:hn.get("low")+1})}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Nh{constructor(e,t){t&&Lo(this,t),e&&this.set(e)}}xn(Nh,Wo);n(16);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Mh extends Ll{init(){const e=this.editor,t=e.t,n=
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
function(e){const t=e.t,n={Paragraph:t("cx"),"Heading 1":t("cy"),"Heading 2":t("cz"),"Heading 3":t("da"),"Heading 4":t("db"),"Heading 5":t("dc"),"Heading 6":t("dd")};return e.config.get("heading.options").map(e=>{const t=n[e.title];return t&&t!=e.title&&(e.title=t),e})}(e),o=t("h"),i=t("i");e.ui.componentFactory.add("heading",t=>{const r={},s=new Cn,a=e.commands.get("heading"),c=e.commands.get("paragraph"),l=[a];for(const e of n){const t={type:"button",model:new Nh({label:e.title,class:e.class,withText:!0})};"paragraph"===e.model?(t.model.bind("isOn").to(c,"value"),t.model.set("commandName","paragraph"),l.push(c)):(t.model.bind("isOn").to(a,"value",t=>t===e.model),t.model.set({commandName:"heading",commandValue:e.model})),s.add(t),r[e.model]=e.title}const d=Rl(t);return Ol(d,s),d.buttonView.set({isOn:!1,withText:!0,tooltip:i}),d.extendTemplate({attributes:{class:["ck-heading-dropdown"]}}),d.bind("isEnabled").toMany(l,"isEnabled",(...e)=>e.some(e=>e)),d.buttonView.bind("label").to(a,"value",c,"value",(e,t)=>{const n=e||t&&"paragraph";return r[n]?r[n]:o}),this.listenTo(d,"execute",t=>{e.execute(t.source.commandName,t.source.commandValue?{value:t.source.commandValue}:void 0),e.editing.view.focus()}),d})}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
class Vh extends hr{observe(e){this.listenTo(e,"load",(e,t)=>{"IMG"==t.target.tagName&&this._fireEvents(t)},{useCapture:!0})}_fireEvents(e){this.isEnabled&&(this.document.fire("layoutChanged"),this.document.fire("imageLoaded",e))}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function Dh(e){return n=>{n.on(`attribute:${e}:image`,t)};function t(e,t,n){if(!n.consumable.consume(t.item,e.name))return;const o=n.writer,i=Hd(n.mapper.toViewElement(t.item));null!==t.attributeNewValue?o.setAttribute(t.attributeKey,t.attributeNewValue,i):o.removeAttribute(t.attributeKey,i)}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Fh extends nu{refresh(){this.isEnabled=jd(this.editor.model)}execute(e){const t=this.editor.model;t.change(n=>{const o=Array.isArray(e.source)?e.source:[e.source];for(const e of o)qd(n,t,{src:e})})}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Bh extends Ll{static get pluginName(){return"ImageEditing"}init(){const e=this.editor,t=e.model.schema,n=e.t,o=e.conversion;e.editing.view.addObserver(Vh),t.register("image",{isObject:!0,isBlock:!0,allowWhere:"$block",allowAttributes:["alt","src","srcset"]}),o.for("dataDowncast").elementToElement({model:"image",view:(e,t)=>Lh(t)}),o.for("editingDowncast").elementToElement({model:"image",view:(e,t)=>{return o=Lh(t),i=t,r=n("dn"),i.setCustomProperty("image",!0,o),$l(o,i,{label:function(){const e=Hd(o).getAttribute("alt");return e?`${e} ${r}`:r}});
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
var o,i,r}}),o.for("downcast").add(Dh("src")).add(Dh("alt")).add(function(){return t=>{t.on("attribute:srcset:image",e)};function e(e,t,n){if(!n.consumable.consume(t.item,e.name))return;const o=n.writer,i=Hd(n.mapper.toViewElement(t.item));if(null===t.attributeNewValue){const e=t.attributeOldValue;e.data&&(o.removeAttribute("srcset",i),o.removeAttribute("sizes",i),e.width&&o.removeAttribute("width",i))}else{const e=t.attributeNewValue;e.data&&(o.setAttribute("srcset",e.data,i),o.setAttribute("sizes","100vw",i),e.width&&o.setAttribute("width",e.width,i))}}}()),o.for("upcast").elementToElement({view:{name:"img",attributes:{src:!0}},model:(e,t)=>t.createElement("image",{src:e.getAttribute("src")})}).attributeToAttribute({view:{name:"img",key:"alt"},model:"alt"}).attributeToAttribute({view:{name:"img",key:"srcset"},model:{key:"srcset",value:e=>{const t={data:e.getAttribute("srcset")};return e.hasAttribute("width")&&(t.width=e.getAttribute("width")),t}}}).add(function(){return t=>{t.on("element:figure",e)};function e(e,t,n){if(!n.consumable.test(t.viewItem,{name:!0,classes:"image"}))return;const o=Hd(t.viewItem);if(!o||!o.hasAttribute("src")||!n.consumable.test(o,{name:!0}))return;const i=n.convertItem(o,t.modelCursor),r=wh(i.modelRange.getItems());r&&(n.convertChildren(t.viewItem,n.writer.createPositionAt(r,0)),t.modelRange=i.modelRange,t.modelCursor=i.modelCursor)}}()),e.commands.add("imageInsert",new Fh(e))}}function Lh(e){const t=e.createEmptyElement("img"),n=e.createContainerElement("figure",{class:"image"});return e.insert(e.createPositionAt(n,0),t),n}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class zh extends nu{refresh(){const e=this.editor.model.document.selection.getSelectedElement();this.isEnabled=zd(e),zd(e)&&e.hasAttribute("alt")?this.value=e.getAttribute("alt"):this.value=!1}execute(e){const t=this.editor.model,n=t.document.selection.getSelectedElement();t.change(t=>{t.setAttribute("alt",e.newValue,n)})}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class qh extends Ll{static get pluginName(){return"ImageTextAlternativeEditing"}init(){this.editor.commands.add("imageTextAlternative",new zh(this.editor))}}n(70);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class jh extends il{constructor(e){super(e),this.set("text"),this.set("for"),this.id=`ck-editor__label_${un()}`;const t=this.bindTemplate;this.setTemplate({tag:"label",attributes:{class:["ck","ck-label"],id:this.id,for:t.to("for")},children:[{text:t.to("text")}]})}}n(72);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Hh extends il{constructor(e,t){super(e);const n=`ck-input-${un()}`,o=`ck-status-${un()}`;this.set("label"),this.set("value"),this.set("isReadOnly",!1),this.set("errorText",null),this.set("infoText",null),this.labelView=this._createLabelView(n),this.inputView=this._createInputView(t,n,o),this.statusView=this._createStatusView(o),this.bind("_statusText").to(this,"errorText",this,"infoText",(e,t)=>e||t);const i=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-input",i.if("isReadOnly","ck-disabled")]},children:[this.labelView,this.inputView,this.statusView]})}_createLabelView(e){const t=new jh(this.locale);return t.for=e,t.bind("text").to(this,"label"),t}_createInputView(e,t,n){const o=new e(this.locale,n);return o.id=t,o.ariaDescribedById=n,o.bind("value").to(this),o.bind("isReadOnly").to(this),o.bind("hasError").to(this,"errorText",e=>!!e),o.on("input",()=>{this.errorText=null}),o}_createStatusView(e){const t=new il(this.locale),n=this.bindTemplate;return t.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-input__status",n.if("errorText","ck-labeled-input__status_error"),n.if("_statusText","ck-hidden",e=>!e)],id:e,role:n.if("errorText","alert")},children:[{text:n.to("_statusText")}]}),t}select(){this.inputView.select()}focus(){this.inputView.focus()}}n(74);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Wh extends il{constructor(e){super(e),this.set("value"),this.set("id"),this.set("placeholder"),this.set("isReadOnly",!1),this.set("hasError",!1),this.set("ariaDescribedById");const t=this.bindTemplate;this.setTemplate({tag:"input",attributes:{type:"text",class:["ck","ck-input","ck-input-text",t.if("hasError","ck-error")],id:t.to("id"),placeholder:t.to("placeholder"),readonly:t.to("isReadOnly"),"aria-invalid":t.if("hasError",!0),"aria-describedby":t.to("ariaDescribedById")},on:{input:t.to("input")}})}render(){super.render();const e=e=>{this.element.value=e||0===e?e:""};e(this.value),this.on("change:value",(t,n,o)=>{e(o)})}select(){this.element.select()}focus(){this.element.focus()}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function Uh({view:e}){e.listenTo(e.element,"submit",(t,n)=>{n.preventDefault(),e.fire("submit")},{useCapture:!0})}var $h='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M6.972 16.615a.997.997 0 0 1-.744-.292l-4.596-4.596a1 1 0 1 1 1.414-1.414l3.926 3.926 9.937-9.937a1 1 0 0 1 1.414 1.415L7.717 16.323a.997.997 0 0 1-.745.292z"/></svg>',Gh='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.591 10.177l4.243 4.242a1 1 0 0 1-1.415 1.415l-4.242-4.243-4.243 4.243a1 1 0 0 1-1.414-1.415l4.243-4.242L4.52 5.934A1 1 0 0 1 5.934 4.52l4.243 4.243 4.242-4.243a1 1 0 1 1 1.415 1.414l-4.243 4.243z"/></svg>';n(76);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
class Kh extends il{constructor(e){super(e);const t=this.locale.t;this.focusTracker=new Rc,this.keystrokes=new yc,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(t("bm"),$h,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(t("bn"),Gh,"ck-button-cancel","cancel"),this._focusables=new Bc,this._focusCycler=new ul({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-text-alternative-form"],tabindex:"-1"},children:[this.labeledInput,this.saveButtonView,this.cancelButtonView]})}render(){super.render(),this.keystrokes.listenTo(this.element),Uh({view:this}),[this.labeledInput,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)})}_createButton(e,t,n,o){const i=new xl(this.locale);return i.set({label:e,icon:t,tooltip:!0}),i.extendTemplate({attributes:{class:n}}),o&&i.delegate("execute").to(this,o),i}_createLabeledInputView(){const e=this.locale.t,t=new Hh(this.locale,Wh);return t.label=e("dr"),t.inputView.placeholder=e("dr"),t}}function Jh(e){const t=e.editing.view,n=hd.defaultPositions;return{target:t.domConverter.viewToDom(t.document.selection.getSelectedElement()),positions:[n.northArrowSouth,n.northArrowSouthWest,n.northArrowSouthEast,n.southArrowNorth,n.southArrowNorthWest,n.southArrowNorthEast]}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Zh extends Ll{static get requires(){return[bd]}static get pluginName(){return"ImageTextAlternativeUI"}init(){this._createButton(),this._createForm()}destroy(){super.destroy(),this._form.destroy()}_createButton(){const e=this.editor,t=e.t;e.ui.componentFactory.add("imageTextAlternative",n=>{const o=e.commands.get("imageTextAlternative"),i=new xl(n);return i.set({label:t("dq"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M5.085 6.22L2.943 4.078a.75.75 0 1 1 1.06-1.06l2.592 2.59A11.094 11.094 0 0 1 10 5.068c4.738 0 8.578 3.101 8.578 5.083 0 1.197-1.401 2.803-3.555 3.887l1.714 1.713a.75.75 0 0 1-.09 1.138.488.488 0 0 1-.15.084.75.75 0 0 1-.821-.16L6.17 7.304c-.258.11-.51.233-.757.365l6.239 6.24-.006.005.78.78c-.388.094-.78.166-1.174.215l-1.11-1.11h.011L4.55 8.197a7.2 7.2 0 0 0-.665.514l-.112.098 4.897 4.897-.005.006 1.276 1.276a10.164 10.164 0 0 1-1.477-.117l-.479-.479-.009.009-4.863-4.863-.022.031a2.563 2.563 0 0 0-.124.2c-.043.077-.08.158-.108.241a.534.534 0 0 0-.028.133.29.29 0 0 0 .008.072.927.927 0 0 0 .082.226c.067.133.145.26.234.379l3.242 3.365.025.01.59.623c-3.265-.918-5.59-3.155-5.59-4.668 0-1.194 1.448-2.838 3.663-3.93zm7.07.531a4.632 4.632 0 0 1 1.108 5.992l.345.344.046-.018a9.313 9.313 0 0 0 2-1.112c.256-.187.5-.392.727-.613.137-.134.27-.277.392-.431.072-.091.141-.185.203-.286.057-.093.107-.19.148-.292a.72.72 0 0 0 .036-.12.29.29 0 0 0 .008-.072.492.492 0 0 0-.028-.133.999.999 0 0 0-.036-.096 2.165 2.165 0 0 0-.071-.145 2.917 2.917 0 0 0-.125-.2 3.592 3.592 0 0 0-.263-.335 5.444 5.444 0 0 0-.53-.523 7.955 7.955 0 0 0-1.054-.768 9.766 9.766 0 0 0-1.879-.891c-.337-.118-.68-.219-1.027-.301zm-2.85.21l-.069.002a.508.508 0 0 0-.254.097.496.496 0 0 0-.104.679.498.498 0 0 0 .326.199l.045.005c.091.003.181.003.272.012a2.45 2.45 0 0 1 2.017 1.513c.024.061.043.125.069.185a.494.494 0 0 0 .45.287h.008a.496.496 0 0 0 .35-.158.482.482 0 0 0 .13-.335.638.638 0 0 0-.048-.219 3.379 3.379 0 0 0-.36-.723 3.438 3.438 0 0 0-2.791-1.543l-.028-.001h-.013z"/></svg>',tooltip:!0}),i.bind("isEnabled").to(o,"isEnabled"),this.listenTo(i,"execute",()=>{this._showForm()}),i})}_createForm(){const e=this.editor,t=e.editing.view.document;this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new Kh(e.locale),this._form.render(),this.listenTo(this._form,"submit",()=>{e.execute("imageTextAlternative",{newValue:this._form.labeledInput.inputView.element.value}),this._hideForm(!0)}),this.listenTo(this._form,"cancel",()=>{this._hideForm(!0)}),this._form.keystrokes.set("Esc",(e,t)=>{this._hideForm(!0),t()}),this.listenTo(e.ui,"update",()=>{Ld(t.selection)?this._isVisible&&
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
function(e){const t=e.plugins.get("ContextualBalloon");if(Ld(e.editing.view.document.selection)){const n=Jh(e);t.updatePosition(n)}}(e):this._hideForm(!0)}),Sl({emitter:this._form,activator:()=>this._isVisible,contextElements:[this._balloon.view.element],callback:()=>this._hideForm()})}_showForm(){if(this._isVisible)return;const e=this.editor,t=e.commands.get("imageTextAlternative"),n=this._form.labeledInput;this._isInBalloon||this._balloon.add({view:this._form,position:Jh(e)}),n.value=n.inputView.element.value=t.value||"",this._form.labeledInput.select()}_hideForm(e){this._isInBalloon&&(this._form.focusTracker.isFocused&&this._form.saveButtonView.focus(),this._balloon.remove(this._form),e&&this.editor.editing.view.focus())}get _isVisible(){return this._balloon.visibleView===this._form}get _isInBalloon(){return this._balloon.hasView(this._form)}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Qh extends Ll{static get requires(){return[qh,Zh]}static get pluginName(){return"ImageTextAlternative"}}n(78);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function Yh(e){for(const t of e.getChildren())if(t&&t.is("caption"))return t;return null}function Xh(e){const t=e.parent;return"figcaption"==e.name&&t&&"figure"==t.name&&t.hasClass("image")?{name:!0}:null}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class ef extends Ll{static get pluginName(){return"ImageCaptionEditing"}init(){const e=this.editor,t=e.editing.view,n=e.model.schema,o=e.data,i=e.editing,r=e.t;n.register("caption",{allowIn:"image",allowContentOf:"$block",isLimit:!0}),e.model.document.registerPostFixer(e=>this._insertMissingModelCaptionElement(e)),e.conversion.for("upcast").elementToElement({view:Xh,model:"caption"});o.downcastDispatcher.on("insert:caption",tf(e=>e.createContainerElement("figcaption"),!1));const s=
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
function(e,t){return n=>{const o=n.createEditableElement("figcaption");return n.setCustomProperty("imageCaption",!0,o),Nc({view:e,element:o,text:t}),Kl(o,n)}}(t,r("do"));i.downcastDispatcher.on("insert:caption",tf(s)),i.downcastDispatcher.on("insert",this._fixCaptionVisibility(e=>e.item),{priority:"high"}),i.downcastDispatcher.on("remove",this._fixCaptionVisibility(e=>e.position.parent),{priority:"high"}),t.document.registerPostFixer(e=>this._updateCaptionVisibility(e))}_updateCaptionVisibility(e){const t=this.editor.editing.mapper,n=this._lastSelectedCaption;let o;const i=this.editor.model.document.selection,r=i.getSelectedElement();if(r&&r.is("image")){const e=Yh(r);o=t.toViewElement(e)}const s=nf(i.getFirstPosition().parent);if(s&&(o=t.toViewElement(s)),o)return n?(n===o||(of(n,e),this._lastSelectedCaption=o),rf(o,e)):(this._lastSelectedCaption=o,rf(o,e));if(n){const t=of(n,e);return this._lastSelectedCaption=null,t}return!1}_fixCaptionVisibility(e){return(t,n,o)=>{const i=nf(e(n)),r=this.editor.editing.mapper,s=o.writer;if(i){const e=r.toViewElement(i);e&&(i.childCount?s.removeClass("ck-hidden",e):s.addClass("ck-hidden",e))}}}_insertMissingModelCaptionElement(e){const t=this.editor.model,n=t.document.differ.getChanges(),o=[];for(const e of n)if("insert"==e.type&&"$text"!=e.name){const n=e.position.nodeAfter;if(n.is("image")&&!Yh(n)&&o.push(n),!n.is("image")&&n.childCount)for(const e of t.createRangeIn(n).getItems())e.is("image")&&!Yh(e)&&o.push(e)}for(const t of o)e.appendElement("caption",t);return!!o.length}}function tf(e,t=!0){return(n,o,i)=>{const r=o.item;if((r.childCount||t)&&zd(r.parent)){if(!i.consumable.consume(o.item,"insert"))return;const t=i.mapper.toViewElement(o.range.start.parent),n=e(i.writer),s=i.writer;r.childCount||s.addClass("ck-hidden",n),function(e,t,n,o){const i=o.writer.createPositionAt(n,"end");o.writer.insert(i,e),o.mapper.bindElements(t,e)}(n,o.item,t,i)}}}function nf(e){const t=e.getAncestors({includeSelf:!0}).find(e=>"caption"==e.name);return t&&t.parent&&"image"==t.parent.name?t:null}function of(e,t){return!e.childCount&&!e.hasClass("ck-hidden")&&(t.addClass("ck-hidden",e),!0)}function rf(e,t){return!!e.hasClass("ck-hidden")&&(t.removeClass("ck-hidden",e),!0)}n(80);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
class sf extends nu{constructor(e,t){super(e),this.defaultStyle=!1,this.styles=t.reduce((e,t)=>(e[t.name]=t,t.isDefault&&(this.defaultStyle=t.name),e),{})}refresh(){const e=this.editor.model.document.selection.getSelectedElement();if(this.isEnabled=zd(e),e)if(e.hasAttribute("imageStyle")){const t=e.getAttribute("imageStyle");this.value=!!this.styles[t]&&t}else this.value=this.defaultStyle;else this.value=!1}execute(e){const t=e.value,n=this.editor.model,o=n.document.selection.getSelectedElement();n.change(e=>{this.styles[t].isDefault?e.removeAttribute("imageStyle",o):e.setAttribute("imageStyle",t,o)})}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function af(e,t){for(const n of t)if(n.name===e)return n}var cf='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 4.5V3h16v1.5zm2.5 3V12h11V7.5h-11zM4.061 6H15.94c.586 0 1.061.407 1.061.91v5.68c0 .503-.475.91-1.061.91H4.06c-.585 0-1.06-.407-1.06-.91V6.91C3 6.406 3.475 6 4.061 6zM2 16.5V15h16v1.5z"/></svg>',lf='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path d="M18 4.5V3H2v1.5h16zm0 3V6h-5.674v1.5H18zm0 3V9h-5.674v1.5H18zm0 3V12h-5.674v1.5H18zm-8.5-6V12h-6V7.5h6zm.818-1.5H2.682C2.305 6 2 6.407 2 6.91v5.68c0 .503.305.91.682.91h7.636c.377 0 .682-.407.682-.91V6.91c0-.503-.305-.91-.682-.91zM18 16.5V15H2v1.5h16z"/></svg>',df='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 4.5V3h16v1.5zm4.5 3V12h7V7.5h-7zM5.758 6h8.484c.419 0 .758.407.758.91v5.681c0 .502-.34.909-.758.909H5.758c-.419 0-.758-.407-.758-.91V6.91c0-.503.34-.91.758-.91zM2 16.5V15h16v1.5z"/></svg>',uf='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 4.5V3h16v1.5zm0 3V6h5.674v1.5zm0 3V9h5.674v1.5zm0 3V12h5.674v1.5zm8.5-6V12h6V7.5h-6zM9.682 6h7.636c.377 0 .682.407.682.91v5.68c0 .503-.305.91-.682.91H9.682c-.377 0-.682-.407-.682-.91V6.91c0-.503.305-.91.682-.91zM2 16.5V15h16v1.5z"/></svg>';
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
const hf={full:{name:"full",title:"Full size image",icon:cf,isDefault:!0},side:{name:"side",title:"Side image",icon:uf,className:"image-style-side"},alignLeft:{name:"alignLeft",title:"Left aligned image",icon:lf,className:"image-style-align-left"},alignCenter:{name:"alignCenter",title:"Centered image",icon:df,className:"image-style-align-center"},alignRight:{name:"alignRight",title:"Right aligned image",icon:uf,className:"image-style-align-right"}},ff={full:cf,left:lf,right:uf,center:df};function pf(e=[]){return e.map(mf)}function mf(e){if("string"==typeof e){const t=e;hf[t]?e=Object.assign({},hf[t]):(console.warn(Object(fn.a)("image-style-not-found: There is no such image style of given name."),{name:t}),e={name:t})}else if(hf[e.name]){const t=hf[e.name],n=Object.assign({},e);for(const o in t)e.hasOwnProperty(o)||(n[o]=t[o]);e=n}return"string"==typeof e.icon&&ff[e.icon]&&(e.icon=ff[e.icon]),e}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class gf extends Ll{static get pluginName(){return"ImageStyleEditing"}init(){const e=this.editor,t=e.model.schema,n=e.data,o=e.editing;e.config.define("image.styles",["full","side"]);const i=pf(e.config.get("image.styles"));t.extend("image",{allowAttributes:"imageStyle"});const r=function(e){return(t,n,o)=>{if(!o.consumable.consume(n.item,t.name))return;const i=af(n.attributeNewValue,e),r=af(n.attributeOldValue,e),s=o.mapper.toViewElement(n.item),a=o.writer;r&&a.removeClass(r.className,s),i&&a.addClass(i.className,s)}}(i);o.downcastDispatcher.on("attribute:imageStyle:image",r),n.downcastDispatcher.on("attribute:imageStyle:image",r),n.upcastDispatcher.on("element:figure",function(e){const t=e.filter(e=>!e.isDefault);return(e,n,o)=>{if(!n.modelRange)return;const i=n.viewItem,r=wh(n.modelRange.getItems());if(o.schema.checkAttribute(r,"imageStyle"))for(const e of t)o.consumable.consume(i,{classes:e.className})&&o.writer.setAttribute("imageStyle",e.name,r)}}(i),{priority:"low"}),e.commands.add("imageStyle",new sf(e,i))}}n(82);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class bf extends Ll{static get pluginName(){return"ImageStyleUI"}get localizedDefaultStylesTitles(){const e=this.editor.t;return{"Full size image":e("di"),"Side image":e("dj"),"Left aligned image":e("dk"),"Centered image":e("dl"),"Right aligned image":e("dm")}}init(){const e=function(e,t){for(const n of e)t[n.title]&&(n.title=t[n.title]);return e}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/(pf(this.editor.config.get("image.styles")),this.localizedDefaultStylesTitles);for(const t of e)this._createButton(t)}_createButton(e){const t=this.editor,n=`imageStyle:${e.name}`;t.ui.componentFactory.add(n,n=>{const o=t.commands.get("imageStyle"),i=new xl(n);return i.set({label:e.title,icon:e.icon,tooltip:!0,isToggleable:!0}),i.bind("isEnabled").to(o,"isEnabled"),i.bind("isOn").to(o,"value",t=>t===e.name),this.listenTo(i,"execute",()=>{t.execute("imageStyle",{value:e.name}),t.editing.view.focus()}),i})}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
class wf extends Ll{static get requires(){return[bd]}static get pluginName(){return"WidgetToolbarRepository"}init(){const e=this.editor;if(e.plugins.has("BalloonToolbar")){const t=e.plugins.get("BalloonToolbar");this.listenTo(t,"show",t=>{(function(e){const t=e.getSelectedElement();return!(!t||!Ul(t))}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/)(e.editing.view.document.selection)&&t.stop()},{priority:"high"})}this._toolbarDefinitions=new Map,this._balloon=this.editor.plugins.get("ContextualBalloon"),this.on("change:isEnabled",()=>{this._updateToolbarsVisibility()}),this.listenTo(e.ui,"update",()=>{this._updateToolbarsVisibility()}),this.listenTo(e.ui.focusTracker,"change:isFocused",()=>{this._updateToolbarsVisibility()},{priority:"low"})}destroy(){super.destroy();for(const e of this._toolbarDefinitions.values())e.view.destroy()}register(e,{ariaLabel:t,items:n,getRelatedElement:o,balloonClassName:i="ck-toolbar-container"}){const r=this.editor,s=r.t,a=new Nl(r.locale);if(a.ariaLabel=t||s("ag"),this._toolbarDefinitions.has(e))throw new fn.b("widget-toolbar-duplicated: Toolbar with the given id was already added.",this,{toolbarId:e});a.fillFromConfig(n,r.ui.componentFactory),this._toolbarDefinitions.set(e,{view:a,getRelatedElement:o,balloonClassName:i})}_updateToolbarsVisibility(){let e=0,t=null,n=null;for(const o of this._toolbarDefinitions.values()){const i=o.getRelatedElement(this.editor.editing.view.document.selection);if(this.isEnabled&&i)if(this.editor.ui.focusTracker.isFocused){const r=i.getAncestors().length;r>e&&(e=r,t=i,n=o)}else this._isToolbarVisible(o)&&this._hideToolbar(o);else this._isToolbarInBalloon(o)&&this._hideToolbar(o)}n&&this._showToolbar(n,t)}_hideToolbar(e){this._balloon.remove(e.view),this.stopListening(this._balloon,"change:visibleView")}_showToolbar(e,t){this._isToolbarVisible(e)?kf(this.editor,t):this._isToolbarInBalloon(e)||(this._balloon.add({view:e.view,position:_f(this.editor,t),balloonClassName:e.balloonClassName}),this.listenTo(this._balloon,"change:visibleView",()=>{for(const e of this._toolbarDefinitions.values())if(this._isToolbarVisible(e)){const t=e.getRelatedElement(this.editor.editing.view.document.selection);kf(this.editor,t)}}))}_isToolbarVisible(e){return this._balloon.visibleView===e.view}_isToolbarInBalloon(e){return this._balloon.hasView(e.view)}}function kf(e,t){const n=e.plugins.get("ContextualBalloon"),o=_f(e,t);n.updatePosition(o)}function _f(e,t){const n=e.editing.view,o=hd.defaultPositions;return{target:n.domConverter.mapViewToDom(t),positions:[o.northArrowSouth,o.northArrowSouthWest,o.northArrowSouthEast,o.southArrowNorth,o.southArrowNorthWest,o.southArrowNorthEast]}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
function vf(e,t,n){return n.createRange(yf(e,t,!0,n),yf(e,t,!1,n))}function yf(e,t,n,o){let i=e.textNode||(n?e.nodeBefore:e.nodeAfter),r=null;for(;i&&i.getAttribute("linkHref")==t;)r=i,i=n?i.previousSibling:i.nextSibling;return r?o.createPositionAt(r,n?"before":"after"):e}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class xf extends nu{constructor(e){super(e),this.manualDecorators=new Cn}restoreManualDecoratorStates(){for(const e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}refresh(){const e=this.editor.model,t=e.document;this.value=t.selection.getAttribute("linkHref");for(const e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id);this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"linkHref")}execute(e,t={}){const n=this.editor.model,o=n.document.selection,i=[],r=[];for(const e in t)t[e]?i.push(e):r.push(e);n.change(t=>{if(o.isCollapsed){const s=o.getFirstPosition();if(o.hasAttribute("linkHref")){const a=vf(s,o.getAttribute("linkHref"),n);t.setAttribute("linkHref",e,a),i.forEach(e=>{t.setAttribute(e,!0,a)}),r.forEach(e=>{t.removeAttribute(e,a)}),t.setSelection(a)}else if(""!==e){const r=Fn(o.getAttributes());r.set("linkHref",e),i.forEach(e=>{r.set(e,!0)});const a=t.createText(e,r);n.insertContent(a,s),t.setSelection(t.createRangeOn(a))}}else{const s=n.schema.getValidRanges(o.getRanges(),"linkHref");for(const n of s)t.setAttribute("linkHref",e,n),i.forEach(e=>{t.setAttribute(e,!0,n)}),r.forEach(e=>{t.removeAttribute(e,n)})}})}_getDecoratorStateFromModel(e){return this.editor.model.document.selection.getAttribute(e)||!1}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Cf extends nu{refresh(){this.isEnabled=this.editor.model.document.selection.hasAttribute("linkHref")}execute(){const e=this.editor,t=this.editor.model,n=t.document.selection,o=e.commands.get("link");t.change(e=>{const i=n.isCollapsed?[vf(n.getFirstPosition(),n.getAttribute("linkHref"),t)]:n.getRanges();for(const t of i)if(e.removeAttribute("linkHref",t),o)for(const n of o.manualDecorators)e.removeAttribute(n.id,t)})}}var Af=function(e,t,n){var o=e.length;return n=void 0===n?o:n,!t&&n>=o?e:io(e,t,n)},Tf=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var Pf=function(e){return Tf.test(e)};var Ef=function(e){return e.split("")},Sf="[\\ud800-\\udfff]",Rf="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",If="\\ud83c[\\udffb-\\udfff]",Of="[^\\ud800-\\udfff]",Nf="(?:\\ud83c[\\udde6-\\uddff]){2}",Mf="[\\ud800-\\udbff][\\udc00-\\udfff]",Vf="(?:"+Rf+"|"+If+")"+"?",Df="[\\ufe0e\\ufe0f]?"+Vf+("(?:\\u200d(?:"+[Of,Nf,Mf].join("|")+")[\\ufe0e\\ufe0f]?"+Vf+")*"),Ff="(?:"+[Of+Rf+"?",Rf,Nf,Mf,Sf].join("|")+")",Bf=RegExp(If+"(?="+If+")|"+Ff+Df,"g");var Lf=function(e){return e.match(Bf)||[]};var zf=function(e){return Pf(e)?Lf(e):Ef(e)};var qf=function(e){return function(t){t=Xn(t);var n=Pf(t)?zf(t):void 0,o=n?n[0]:t.charAt(0),i=n?Af(n,1).join(""):t.slice(1);return o[e]()+i}}("toUpperCase");
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
const jf=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,Hf=/^(?:(?:https?|ftps?|mailto):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i;function Wf(e,t){const n=t.createAttributeElement("a",{href:e},{priority:5});return t.setCustomProperty("link",!0,n),n}function Uf(e){return function(e){return e.replace(jf,"").match(Hf)}(e=String(e))?e:"#"}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md.
|
|
|
*/
|
|
|
class $f{constructor(){this._definitions=new Set}get length(){return this._definitions.size}add(e){Array.isArray(e)?e.forEach(e=>this._definitions.add(e)):this._definitions.add(e)}getDispatcher(){return e=>{e.on("attribute:linkHref",(e,t,n)=>{if(!n.consumable.test(t.item,"attribute:linkHref"))return;const o=n.writer,i=o.document.selection;for(const e of this._definitions){const r=o.createAttributeElement("a",e.attributes,{priority:5});o.setCustomProperty("link",!0,r),e.callback(t.attributeNewValue)?t.item.is("selection")?o.wrap(i.getFirstRange(),r):o.wrap(n.mapper.toViewRange(t.range),r):o.unwrap(n.mapper.toViewRange(t.range),r)}},{priority:"high"})}}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Gf{constructor({id:e,label:t,attributes:n}){this.id=e,this.set("value"),this.label=t,this.attributes=n}}xn(Gf,Wo);class Kf{constructor(e,t,n){this.model=e,this.attribute=n,this._modelSelection=e.document.selection,this._overrideUid=null,this._isNextGravityRestorationSkipped=!1,t.listenTo(this._modelSelection,"change:range",(e,t)=>{this._isNextGravityRestorationSkipped?this._isNextGravityRestorationSkipped=!1:this._isGravityOverridden&&(!t.directChange&&Jf(this._modelSelection.getFirstPosition(),n)||this._restoreGravity())})}handleForwardMovement(e,t){const n=this.attribute;if(!(this._isGravityOverridden||e.isAtStart&&this._hasSelectionAttribute))return Yf(e,n)&&this._hasSelectionAttribute?(this._preventCaretMovement(t),this._removeSelectionAttribute(),!0):Zf(e,n)||Qf(e,n)&&this._hasSelectionAttribute?(this._preventCaretMovement(t),this._overrideGravity(),!0):void 0}handleBackwardMovement(e,t){const n=this.attribute;return this._isGravityOverridden?Yf(e,n)&&this._hasSelectionAttribute?(this._preventCaretMovement(t),this._restoreGravity(),this._removeSelectionAttribute(),!0):(this._preventCaretMovement(t),this._restoreGravity(),e.isAtStart&&this._removeSelectionAttribute(),!0):Yf(e,n)&&!this._hasSelectionAttribute?(this._preventCaretMovement(t),this._setSelectionAttributeFromTheNodeBefore(e),!0):e.isAtEnd&&Qf(e,n)?this._hasSelectionAttribute?void(Xf(e,n)&&(this._skipNextAutomaticGravityRestoration(),this._overrideGravity())):(this._preventCaretMovement(t),this._setSelectionAttributeFromTheNodeBefore(e),!0):e.isAtStart?this._hasSelectionAttribute?(this._removeSelectionAttribute(),this._preventCaretMovement(t),!0):void 0:void(Xf(e,n)&&(this._skipNextAutomaticGravityRestoration(),this._overrideGravity()))}get _isGravityOverridden(){return!!this._overrideUid}get _hasSelectionAttribute(){return this._modelSelection.hasAttribute(this.attribute)}_overrideGravity(){this._overrideUid=this.model.change(e=>e.overrideSelectionGravity())}_restoreGravity(){this.model.change(e=>{e.restoreSelectionGravity(this._overrideUid),this._overrideUid=null})}_preventCaretMovement(e){e.preventDefault()}_removeSelectionAttribute(){this.model.change(e=>{e.removeSelectionAttribute(this.attribute)})}_setSelectionAttributeFromTheNodeBefore(e){const t=this.attribute;this.model.change(n=>{n.setSelectionAttribute(this.attribute,e.nodeBefore.getAttribute(t))})}_skipNextAutomaticGravityRestoration(){this._isNextGravityRestorationSkipped=!0}}function Jf(e,t){return Zf(e,t)||Qf(e,t)}function Zf(e,t){const{nodeBefore:n,nodeAfter:o}=e,i=!!n&&n.hasAttribute(t);return!!o&&o.hasAttribute(t)&&(!i||n.getAttribute(t)!==o.getAttribute(t))}function Qf(e,t){const{nodeBefore:n,nodeAfter:o}=e,i=!!n&&n.hasAttribute(t),r=!!o&&o.hasAttribute(t);return i&&(!r||n.getAttribute(t)!==o.getAttribute(t))}function Yf(e,t){const{nodeBefore:n,nodeAfter:o}=e,i=!!n&&n.hasAttribute(t);if(!!o&&o.hasAttribute(t)&&i)return o.getAttribute(t)!==n.getAttribute(t)}function Xf(e,t){return Jf(e.getShiftedBy(-1),t)}n(84);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/const ep=/^(https?:)?\/\//;class tp extends Ll{static get pluginName(){return"LinkEditing"}constructor(e){super(e),e.config.define("link",{addTargetToExternalLinks:!1})}init(){const e=this.editor,t=e.locale;e.model.schema.extend("$text",{allowAttributes:"linkHref"}),e.conversion.for("dataDowncast").attributeToElement({model:"linkHref",view:Wf}),e.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(e,t)=>Wf(Uf(e),t)}),e.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:e=>e.getAttribute("href")}}),e.commands.add("link",new xf(e)),e.commands.add("unlink",new Cf(e));const n=function(e,t){const n={"Open in a new tab":e("bg"),Downloadable:e("bh")};return t.forEach(e=>(e.label&&n[e.label]&&(e.label=n[e.label]),e)),t}(e.t,function(e){const t=[];if(e)for(const[n,o]of Object.entries(e)){const e=Object.assign({},o,{id:`link${qf(n)}`});t.push(e)}return t}(e.config.get("link.decorators")));this._enableAutomaticDecorators(n.filter(e=>"automatic"===e.mode)),this._enableManualDecorators(n.filter(e=>"manual"===e.mode)),
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
function({view:e,model:t,emitter:n,attribute:o,locale:i}){const r=new Kf(t,n,o),s=t.document.selection;n.listenTo(e.document,"keydown",(e,t)=>{if(!s.isCollapsed)return;if(t.shiftKey||t.altKey||t.ctrlKey)return;const n=t.keyCode==gi.arrowright,o=t.keyCode==gi.arrowleft;if(!n&&!o)return;const a=s.getFirstPosition(),c=i.contentLanguageDirection;let l;l="ltr"===c&&n||"rtl"===c&&o?r.handleForwardMovement(a,t):r.handleBackwardMovement(a,t),l&&e.stop()},{priority:hn.get("high")+1})}({view:e.editing.view,model:e.model,emitter:this,attribute:"linkHref",locale:t}),this._setupLinkHighlight()}_enableAutomaticDecorators(e){const t=this.editor,n=new $f;t.config.get("link.addTargetToExternalLinks")&&n.add({id:"linkIsExternal",mode:"automatic",callback:e=>ep.test(e),attributes:{target:"_blank",rel:"noopener noreferrer"}}),n.add(e),n.length&&t.conversion.for("downcast").add(n.getDispatcher())}_enableManualDecorators(e){if(!e.length)return;const t=this.editor,n=t.commands.get("link").manualDecorators;e.forEach(e=>{t.model.schema.extend("$text",{allowAttributes:e.id}),n.add(new Gf(e)),t.conversion.for("downcast").attributeToElement({model:e.id,view:(t,o)=>{if(t){const t=n.get(e.id).attributes,i=o.createAttributeElement("a",t,{priority:5});return o.setCustomProperty("link",!0,i),i}}}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:n.get(e.id).attributes},model:{key:e.id}})})}_setupLinkHighlight(){const e=this.editor,t=e.editing.view,n=new Set;t.document.registerPostFixer(t=>{const o=e.model.document.selection;let i=!1;if(o.hasAttribute("linkHref")){const r=vf(o.getFirstPosition(),o.getAttribute("linkHref"),e.model),s=e.editing.mapper.toViewRange(r);for(const e of s.getItems())e.is("a")&&!e.hasClass("ck-link_selected")&&(t.addClass("ck-link_selected",e),n.add(e),i=!0)}return i}),e.conversion.for("editingDowncast").add(e=>{function o(){t.change(e=>{for(const t of n.values())e.removeClass("ck-link_selected",t),n.delete(t)})}e.on("insert",o,{priority:"highest"}),e.on("remove",o,{priority:"highest"}),e.on("attribute",o,{priority:"highest"}),e.on("selection",o,{priority:"highest"})})}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class np extends Nr{constructor(e){super(e),this.domEventType="click"}onDomEvent(e){this.fire(e.type,e)}}n(86);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class op extends il{constructor(e,t=[]){super(e);const n=e.t;this.focusTracker=new Rc,this.keystrokes=new yc,this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(n("bm"),$h,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(n("bn"),Gh,"ck-button-cancel","cancel"),this._manualDecoratorSwitches=this._createManualDecoratorSwitches(t),this.children=this._createFormChildren(t),this._focusables=new Bc,this._focusCycler=new ul({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const o=["ck","ck-link-form"];t.length&&o.push("ck-link-form_layout-vertical"),this.setTemplate({tag:"form",attributes:{class:o,tabindex:"-1"},children:this.children})}getDecoratorSwitchesState(){return Array.from(this._manualDecoratorSwitches).reduce((e,t)=>(e[t.name]=t.isOn,e),{})}render(){super.render(),Uh({view:this}),[this.urlInputView,...this._manualDecoratorSwitches,this.saveButtonView,this.cancelButtonView].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,t=new Hh(this.locale,Wh);return t.label=e("bo"),t.inputView.placeholder="https://example.com",t}_createButton(e,t,n,o){const i=new xl(this.locale);return i.set({label:e,icon:t,tooltip:!0}),i.extendTemplate({attributes:{class:n}}),o&&i.delegate("execute").to(this,o),i}_createManualDecoratorSwitches(e){const t=this.createCollection();for(const n of e){const e=new El(this.locale);e.set({name:n.id,label:n.label,withText:!0}),e.bind("isOn").to(n,"value"),e.on("execute",()=>{n.set("value",!e.isOn)}),t.add(e)}return t}_createFormChildren(e){const t=this.createCollection();if(t.add(this.urlInputView),e.length){const e=new il;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)}return t.add(this.saveButtonView),t.add(this.cancelButtonView),t}}n(88);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
class ip extends il{constructor(e){super(e);const t=e.t;this.focusTracker=new Rc,this.keystrokes=new yc,this.previewButtonView=this._createPreviewButton(),this.unlinkButtonView=this._createButton(t("bi"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.077 15l.991-1.416a.75.75 0 1 1 1.229.86l-1.148 1.64a.748.748 0 0 1-.217.206 5.251 5.251 0 0 1-8.503-5.955.741.741 0 0 1 .12-.274l1.147-1.639a.75.75 0 1 1 1.228.86L4.933 10.7l.006.003a3.75 3.75 0 0 0 6.132 4.294l.006.004zm5.494-5.335a.748.748 0 0 1-.12.274l-1.147 1.639a.75.75 0 1 1-1.228-.86l.86-1.23a3.75 3.75 0 0 0-6.144-4.301l-.86 1.229a.75.75 0 0 1-1.229-.86l1.148-1.64a.748.748 0 0 1 .217-.206 5.251 5.251 0 0 1 8.503 5.955zm-4.563-2.532a.75.75 0 0 1 .184 1.045l-3.155 4.505a.75.75 0 1 1-1.229-.86l3.155-4.506a.75.75 0 0 1 1.045-.184zm4.919 10.562l-1.414 1.414a.75.75 0 1 1-1.06-1.06l1.414-1.415-1.415-1.414a.75.75 0 0 1 1.061-1.06l1.414 1.414 1.414-1.415a.75.75 0 0 1 1.061 1.061l-1.414 1.414 1.414 1.415a.75.75 0 0 1-1.06 1.06l-1.415-1.414z"/></svg>',"unlink"),this.editButtonView=this._createButton(t("bj"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M7.3 17.37l-.061.088a1.518 1.518 0 0 1-.934.535l-4.178.663-.806-4.153a1.495 1.495 0 0 1 .187-1.058l.056-.086L8.77 2.639c.958-1.351 2.803-1.076 4.296-.03 1.497 1.047 2.387 2.693 1.433 4.055L7.3 17.37zM9.14 4.728l-5.545 8.346 3.277 2.294 5.544-8.346L9.14 4.728zM6.07 16.512l-3.276-2.295.53 2.73 2.746-.435zM9.994 3.506L13.271 5.8c.316-.452-.16-1.333-1.065-1.966-.905-.634-1.895-.78-2.212-.328zM8 18.5L9.375 17H19v1.5H8z"/></svg>',"edit"),this.set("href"),this._focusables=new Bc,this._focusCycler=new ul({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(),[this.previewButtonView,this.editButtonView,this.unlinkButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}focus(){this._focusCycler.focusFirst()}_createButton(e,t,n){const o=new xl(this.locale);return o.set({label:e,icon:t,tooltip:!0}),o.delegate("execute").to(this,n),o}_createPreviewButton(){const e=new xl(this.locale),t=this.bindTemplate,n=this.t;return e.set({withText:!0,tooltip:n("bk")}),e.extendTemplate({attributes:{class:["ck","ck-link-actions__preview"],href:t.to("href",e=>e&&Uf(e)),target:"_blank",rel:"noopener noreferrer"}}),e.bind("label").to(this,"href",e=>e||n("bl")),e.bind("isEnabled").to(this,"href",e=>!!e),e.template.tag="a",e.template.eventListeners={},e}}class rp extends Ll{static get requires(){return[bd]}static get pluginName(){return"LinkUI"}init(){const e=this.editor;e.editing.view.addObserver(np),this.actionsView=this._createActionsView(),this.formView=this._createFormView(),this._balloon=e.plugins.get(bd),this._createToolbarLinkButton(),this._enableUserBalloonInteractions()}destroy(){super.destroy(),this.formView.destroy()}_createActionsView(){const e=this.editor,t=new ip(e.locale),n=e.commands.get("link"),o=e.commands.get("unlink");return t.bind("href").to(n,"value"),t.editButtonView.bind("isEnabled").to(n),t.unlinkButtonView.bind("isEnabled").to(o),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("Ctrl+K",(e,t)=>{this._addFormView(),t()}),t}_createFormView(){const e=this.editor,t=e.commands.get("link"),n=new op(e.locale,t.manualDecorators);return n.urlInputView.bind("value").to(t,"value"),n.urlInputView.bind("isReadOnly").to(t,"isEnabled",e=>!e),n.saveButtonView.bind("isEnabled").to(t),this.listenTo(n,"submit",()=>{e.execute("link",n.urlInputView.inputView.element.value,n.getDecoratorSwitchesState()),this._closeFormView()}),this.listenTo(n,"cancel",()=>{this._closeFormView()}),n.keystrokes.set("Esc",(e,t)=>{this._closeFormView(),t()}),n}_createToolbarLinkButton(){const e=this.editor,t=e.commands.get("link"),n=e.t;e.keystrokes.set("Ctrl+K",(e,t)=>{t(),this._showUI(!0)}),e.ui.componentFactory.add("link",e=>{const o=new xl(e);return o.isEnabled=!0,o.label=n("ah"),o.icon='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.077 15l.991-1.416a.75.75 0 1 1 1.229.86l-1.148 1.64a.748.748 0 0 1-.217.206 5.251 5.251 0 0 1-8.503-5.955.741.741 0 0 1 .12-.274l1.147-1.639a.75.75 0 1 1 1.228.86L4.933 10.7l.006.003a3.75 3.75 0 0 0 6.132 4.294l.006.004zm5.494-5.335a.748.748 0 0 1-.12.274l-1.147 1.639a.75.75 0 1 1-1.228-.86l.86-1.23a3.75 3.75 0 0 0-6.144-4.301l-.86 1.229a.75.75 0 0 1-1.229-.86l1.148-1.64a.748.748 0 0 1 .217-.206 5.251 5.251 0 0 1 8.503 5.955zm-4.563-2.532a.75.75 0 0 1 .184 1.045l-3.155 4.505a.75.75 0 1 1-1.229-.86l3.155-4.506a.75.75 0 0 1 1.045-.184z"/></svg>',o.keystroke="Ctrl+K",o.tooltip=!0,o.isToggleable=!0,o.bind("isEnabled").to(t,"isEnabled"),o.bind("isOn").to(t,"value",e=>!!e),this.listenTo(o,"execute",()=>this._showUI(!0)),o})}_enableUserBalloonInteractions(){const e=this.editor.editing.view.document;this.listenTo(e,"click",()=>{this._getSelectedLinkElement()&&this._showUI()}),this.editor.keystrokes.set("Tab",(e,t)=>{this._areActionsVisible&&!this.actionsView.focusTracker.isFocused&&(this.actionsView.focus(),t())},{priority:"high"}),this.editor.keystrokes.set("Esc",(e,t)=>{this._isUIVisible&&(this._hideUI(),t())}),Sl({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:[this._balloon.view.element],callback:()=>this._hideUI()})}_addActionsView(){this._areActionsInPanel||this._balloon.add({view:this.actionsView,position:this._getBalloonPositionData()})}_addFormView(){if(this._isFormInPanel)return;const e=this.editor.commands.get("link");this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this._balloon.visibleView===this.formView&&this.formView.urlInputView.select(),this.formView.urlInputView.inputView.element.value=e.value||""}_closeFormView(){const e=this.editor.commands.get("link");e.restoreManualDecoratorStates(),void 0!==e.value?this._removeFormView():this._hideUI()}_removeFormView(){this._isFormInPanel&&(this.formView.saveButtonView.focus(),this._balloon.remove(this.formView),this.editor.editing.view.focus())}_showUI(e=!1){this._getSelectedLinkElement()?(this._areActionsVisible?this._addFormView():this._addActionsView(),e&&this._balloon.showStack("main")):(this._addActionsView(),e&&this._balloon.showStack("main"),this._addFormView()),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,t=e.editing.view.document;let n=this._getSelectedLinkElement(),o=r();const i=()=>{const e=this._getSelectedLinkElement(),t=r();n&&!e||!n&&t!==o?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),n=e,o=t};function r(){return t.selection.focus.getAncestors().reverse().find(e=>e.is("element"))}this.listenTo(e.ui,"update",i),this.listenTo(this._balloon,"change:visibleView",i)}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(){return this._balloon.visibleView==this.formView||this._areActionsVisible}_getBalloonPositionData(){const e=this.editor.editing.view,t=e.document,n=this._getSelectedLinkElement();return{target:n?e.domConverter.mapViewToDom(n):e.domConverter.viewRangeToDom(t.selection.getFirstRange())}}_getSelectedLinkElement(){const e=this.editor.editing.view,t=e.document.selection;if(t.isCollapsed)return sp(t.getFirstPosition());{const n=t.getFirstRange().getTrimmed(),o=sp(n.start),i=sp(n.end);return o&&o==i&&e.createRangeIn(o).getTrimmed().isEqual(n)?o:null}}}function sp(e){return e.getAncestors().find(e=>{return(t=e).is("attributeElement")&&!!t.getCustomProperty("link");var t})}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
class ap extends nu{constructor(e,t){super(e),this.type=t}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(){const e=this.editor.model,t=e.document,n=Array.from(t.selection.getSelectedBlocks()).filter(t=>lp(t,e.schema)),o=!0===this.value;e.change(e=>{if(o){let t=n[n.length-1].nextSibling,o=Number.POSITIVE_INFINITY,i=[];for(;t&&"listItem"==t.name&&0!==t.getAttribute("listIndent");){const e=t.getAttribute("listIndent");e<o&&(o=e);const n=e-o;i.push({element:t,listIndent:n}),t=t.nextSibling}i=i.reverse();for(const t of i)e.setAttribute("listIndent",t.listIndent,t.element)}if(!o){let e=Number.POSITIVE_INFINITY;for(const t of n)t.is("listItem")&&t.getAttribute("listIndent")<e&&(e=t.getAttribute("listIndent"));e=0===e?1:e,cp(n,!0,e),cp(n,!1,e)}for(const t of n.reverse())o&&"listItem"==t.name?e.rename(t,"paragraph"):o||"listItem"==t.name?o||"listItem"!=t.name||t.getAttribute("listType")==this.type||e.setAttribute("listType",this.type,t):(e.setAttributes({listType:this.type,listIndent:0},t),e.rename(t,"listItem"))})}_getValue(){const e=wh(this.editor.model.document.selection.getSelectedBlocks());return!!e&&e.is("listItem")&&e.getAttribute("listType")==this.type}_checkEnabled(){if(this.value)return!0;const e=this.editor.model.document.selection,t=this.editor.model.schema,n=wh(e.getSelectedBlocks());return!!n&&lp(n,t)}}function cp(e,t,n){const o=t?e[0]:e[e.length-1];if(o.is("listItem")){let i=o[t?"previousSibling":"nextSibling"],r=o.getAttribute("listIndent");for(;i&&i.is("listItem")&&i.getAttribute("listIndent")>=n;)r>i.getAttribute("listIndent")&&(r=i.getAttribute("listIndent")),i.getAttribute("listIndent")==r&&e[t?"unshift":"push"](i),i=i[t?"previousSibling":"nextSibling"]}}function lp(e,t){return t.checkChild(e.parent,"listItem")&&!t.isObject(e)}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class dp extends nu{constructor(e,t){super(e),this._indentBy="forward"==t?1:-1}refresh(){this.isEnabled=this._checkEnabled()}execute(){const e=this.editor.model,t=e.document;let n=Array.from(t.selection.getSelectedBlocks());e.change(e=>{const t=n[n.length-1];let o=t.nextSibling;for(;o&&"listItem"==o.name&&o.getAttribute("listIndent")>t.getAttribute("listIndent");)n.push(o),o=o.nextSibling;this._indentBy<0&&(n=n.reverse());for(const t of n){const n=t.getAttribute("listIndent")+this._indentBy;n<0?e.rename(t,"paragraph"):e.setAttribute("listIndent",n,t)}})}_checkEnabled(){const e=wh(this.editor.model.document.selection.getSelectedBlocks());if(!e||!e.is("listItem"))return!1;if(this._indentBy>0){const t=e.getAttribute("listIndent"),n=e.getAttribute("listType");let o=e.previousSibling;for(;o&&o.is("listItem")&&o.getAttribute("listIndent")>=t;){if(o.getAttribute("listIndent")==t)return o.getAttribute("listType")==n;o=o.previousSibling}return!1}return!0}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function up(e,t){const n=t.mapper,o=t.writer,i="numbered"==e.getAttribute("listType")?"ol":"ul",r=function(e){const t=e.createContainerElement("li");return t.getFillerOffset=bp,t}(o),s=o.createContainerElement(i,null);return o.insert(o.createPositionAt(s,0),r),n.bindElements(e,r),r}function hp(e,t,n,o){const i=t.parent,r=n.mapper,s=n.writer;let a=r.toViewPosition(o.createPositionBefore(e));const c=mp(e.previousSibling,{sameIndent:!0,smallerIndent:!0,listIndent:e.getAttribute("listIndent")}),l=e.previousSibling;if(c&&c.getAttribute("listIndent")==e.getAttribute("listIndent")){const e=r.toViewElement(c);a=s.breakContainer(s.createPositionAfter(e))}else a=l&&"listItem"==l.name?r.toViewPosition(o.createPositionAt(l,"end")):r.toViewPosition(o.createPositionBefore(e));if(a=pp(a),s.insert(a,i),l&&"listItem"==l.name){const e=r.toViewElement(l),n=s.createRange(s.createPositionAt(e,0),a).getWalker({ignoreElementEnd:!0});for(const e of n)if(e.item.is("li")){const o=s.breakContainer(s.createPositionBefore(e.item)),i=e.item.parent,r=s.createPositionAt(t,"end");fp(s,r.nodeBefore,r.nodeAfter),s.move(s.createRangeOn(i),r),n.position=o}}else{const n=i.nextSibling;if(n&&(n.is("ul")||n.is("ol"))){let o=null;for(const t of n.getChildren()){const n=r.toModelElement(t);if(!(n&&n.getAttribute("listIndent")>e.getAttribute("listIndent")))break;o=t}o&&(s.breakContainer(s.createPositionAfter(o)),s.move(s.createRangeOn(o.parent),s.createPositionAt(t,"end")))}}fp(s,i,i.nextSibling),fp(s,i.previousSibling,i)}function fp(e,t,n){return!t||!n||"ul"!=t.name&&"ol"!=t.name||t.name!=n.name||t.getAttribute("class")!==n.getAttribute("class")?null:e.mergeContainers(e.createPositionAfter(t))}function pp(e){return e.getLastMatchingPosition(e=>e.item.is("uiElement"))}function mp(e,t){const n=!!t.sameIndent,o=!!t.smallerIndent,i=t.listIndent;let r=e;for(;r&&"listItem"==r.name;){const e=r.getAttribute("listIndent");if(n&&i==e||o&&i>e)return r;r=r.previousSibling}return null}function gp(e,t,n,o){e.ui.componentFactory.add(t,i=>{const r=e.commands.get(t),s=new xl(i);return s.set({label:n,icon:o,tooltip:!0,isToggleable:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),s.on("execute",()=>{e.execute(t),e.editing.view.focus()}),s})}function bp(){const e=!this.isEmpty&&("ul"==this.getChild(0).name||"ol"==this.getChild(0).name);return this.isEmpty||e?0:Bo.call(this)}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function wp(e){return(t,n,o)=>{const i=o.consumable;if(!i.test(n.item,"insert")||!i.test(n.item,"attribute:listType")||!i.test(n.item,"attribute:listIndent"))return;i.consume(n.item,"insert"),i.consume(n.item,"attribute:listType"),i.consume(n.item,"attribute:listIndent");const r=n.item;hp(r,up(r,o),o,e)}}function kp(e,t,n){if(!n.consumable.consume(t.item,"attribute:listType"))return;const o=n.mapper.toViewElement(t.item),i=n.writer;i.breakContainer(i.createPositionBefore(o)),i.breakContainer(i.createPositionAfter(o));const r=o.parent,s="numbered"==t.attributeNewValue?"ol":"ul";i.rename(s,r)}function _p(e,t,n){const o=n.mapper.toViewElement(t.item).parent,i=n.writer;fp(i,o,o.nextSibling),fp(i,o.previousSibling,o);for(const e of t.item.getChildren())n.consumable.consume(e,"insert")}function vp(e,t,n){if("listItem"!=t.item.name){let e=n.mapper.toViewPosition(t.range.start);const o=n.writer,i=[];for(;("ul"==e.parent.name||"ol"==e.parent.name)&&(e=o.breakContainer(e),"li"==e.parent.name);){const t=e,n=o.createPositionAt(e.parent,"end");if(!t.isEqual(n)){const e=o.remove(o.createRange(t,n));i.push(e)}e=o.createPositionAfter(e.parent)}if(i.length>0){for(let t=0;t<i.length;t++){const n=e.nodeBefore;if(e=o.insert(e,i[t]).end,t>0){const t=fp(o,n,n.nextSibling);t&&t.parent==n&&e.offset--}}fp(o,e.nodeBefore,e.nodeAfter)}}}function yp(e,t,n){const o=n.mapper.toViewPosition(t.position),i=o.nodeBefore,r=o.nodeAfter;fp(n.writer,i,r)}function xp(e,t,n){if(n.consumable.consume(t.viewItem,{name:!0})){const e=n.writer,o=e.createElement("listItem"),i=function(e){let t=0,n=e.parent;for(;n;){if(n.is("li"))t++;else{const e=n.previousSibling;e&&e.is("li")&&t++}n=n.parent}return t}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/(t.viewItem);e.setAttribute("listIndent",i,o);const r=t.viewItem.parent&&"ol"==t.viewItem.parent.name?"numbered":"bulleted";e.setAttribute("listType",r,o);const s=n.splitToAllowedParent(o,t.modelCursor);if(!s)return;e.insert(o,s.position);const a=function(e,t,n){const{writer:o,schema:i}=n;let r=o.createPositionAfter(e);for(const s of t)if("ul"==s.name||"ol"==s.name)r=n.convertItem(s,r).modelCursor;else{const t=n.convertItem(s,o.createPositionAt(e,"end")),a=t.modelRange.start.nodeAfter;a&&a.is("element")&&!i.checkChild(e,a.name)&&(e=t.modelCursor.parent.is("listItem")?t.modelCursor.parent:Ep(t.modelCursor),r=o.createPositionAfter(e))}return r}(o,t.viewItem.getChildren(),n);t.modelRange=e.createRange(t.modelCursor,a),s.cursorParent?t.modelCursor=e.createPositionAt(s.cursorParent,0):t.modelCursor=t.modelRange.end}}function Cp(e,t,n){if(n.consumable.test(t.viewItem,{name:!0})){const e=Array.from(t.viewItem.getChildren());for(const t of e){!(t.is("li")||Rp(t))&&t._remove()}}}function Ap(e,t,n){if(n.consumable.test(t.viewItem,{name:!0})){if(0===t.viewItem.childCount)return;const e=[...t.viewItem.getChildren()];let n=!1,o=!0;for(const t of e)n&&!Rp(t)&&t._remove(),t.is("text")?(o&&(t._data=t.data.replace(/^\s+/,"")),t.nextSibling&&!Rp(t.nextSibling)||(t._data=t.data.replace(/\s+$/,""))):Rp(t)&&(n=!0),o=!1}}function Tp(e){return(t,n)=>{if(n.isPhantom)return;const o=n.modelPosition.nodeBefore;if(o&&o.is("listItem")){const t=n.mapper.toViewElement(o),i=t.getAncestors().find(Rp),r=e.createPositionAt(t,0).getWalker();for(const e of r){if("elementStart"==e.type&&e.item.is("li")){n.viewPosition=e.previousPosition;break}if("elementEnd"==e.type&&e.item==i){n.viewPosition=e.nextPosition;break}}}}}function Pp(e,[t,n]){let o,i=t.is("documentFragment")?t.getChild(0):t;if(o=n?this.createSelection(n):this.document.selection,i&&i.is("listItem")){const e=o.getFirstPosition();let t=null;if(e.parent.is("listItem")?t=e.parent:e.nodeBefore&&e.nodeBefore.is("listItem")&&(t=e.nodeBefore),t){const e=t.getAttribute("listIndent");if(e>0)for(;i&&i.is("listItem");)i._setAttribute("listIndent",i.getAttribute("listIndent")+e),i=i.nextSibling}}}function Ep(e){const t=new ws({startPosition:e});let n;do{n=t.next()}while(!n.value.item.is("listItem"));return n.value.item}function Sp(e,t,n,o,i,r){const s=mp(t.nodeBefore,{sameIndent:!0,smallerIndent:!0,listIndent:e,foo:"b"}),a=i.mapper,c=i.writer,l=s?s.getAttribute("listIndent"):null;let d;if(s)if(l==e){const e=a.toViewElement(s).parent;d=c.createPositionAfter(e)}else{const e=r.createPositionAt(s,"end");d=a.toViewPosition(e)}else d=n;d=pp(d);for(const e of[...o.getChildren()])Rp(e)&&(d=c.move(c.createRangeOn(e),d).end,fp(c,e,e.nextSibling),fp(c,e.previousSibling,e))}function Rp(e){return e.is("ol")||e.is("ul")}class Ip extends Ll{static get pluginName(){return"ListEditing"}static get requires(){return[Ph]}init(){const e=this.editor;e.model.schema.register("listItem",{inheritAllFrom:"$block",allowAttributes:["listType","listIndent"]});const t=e.data,n=e.editing;var o;e.model.document.registerPostFixer(t=>function(e,t){const n=e.document.differ.getChanges(),o=new Map;let i=!1;for(const o of n)if("insert"==o.type&&"listItem"==o.name)r(o.position);else if("insert"==o.type&&"listItem"!=o.name){if("$text"!=o.name){const n=o.position.nodeAfter;n.hasAttribute("listIndent")&&(t.removeAttribute("listIndent",n),i=!0),n.hasAttribute("listType")&&(t.removeAttribute("listType",n),i=!0);for(const t of Array.from(e.createRangeIn(n)).filter(e=>e.item.is("listItem")))r(t.previousPosition)}r(o.position.getShiftedBy(o.length))}else"remove"==o.type&&"listItem"==o.name?r(o.position):("attribute"==o.type&&"listIndent"==o.attributeKey||"attribute"==o.type&&"listType"==o.attributeKey)&&r(o.range.start);for(const e of o.values())s(e),a(e);return i;function r(e){const t=e.nodeBefore;if(t&&t.is("listItem")){let n=t;if(o.has(n))return;for(;n.previousSibling&&n.previousSibling.is("listItem");)if(n=n.previousSibling,o.has(n))return;o.set(e.nodeBefore,n)}else{const t=e.nodeAfter;t&&t.is("listItem")&&o.set(t,t)}}function s(e){let n=0,o=null;for(;e&&e.is("listItem");){const r=e.getAttribute("listIndent");if(r>n){let s;null===o?(o=r-n,s=n):(o>r&&(o=r),s=r-o),t.setAttribute("listIndent",s,e),i=!0}else o=null,n=e.getAttribute("listIndent")+1;e=e.nextSibling}}function a(e){let n=[],o=null;for(;e&&e.is("listItem");){const r=e.getAttribute("listIndent");if(o&&o.getAttribute("listIndent")>r&&(n=n.slice(0,r+1)),0!=r)if(n[r]){const o=n[r];e.getAttribute("listType")!=o&&(t.setAttribute("listType",o,e),i=!0)}else n[r]=e.getAttribute("listType");o=e,e=e.nextSibling}}}(e.model,t)),n.mapper.registerViewToModelLength("li",Op),t.mapper.registerViewToModelLength("li",Op),n.mapper.on("modelToViewPosition",Tp(n.view)),n.mapper.on("viewToModelPosition",(o=e.model,(e,t)=>{const n=t.viewPosition,i=n.parent,r=t.mapper;if("ul"==i.name||"ol"==i.name){if(n.isAtEnd){const e=r.toModelElement(n.nodeBefore),i=r.getModelLength(n.nodeBefore);t.modelPosition=o.createPositionBefore(e).getShiftedBy(i)}else{const e=r.toModelElement(n.nodeAfter);t.modelPosition=o.createPositionBefore(e)}e.stop()}else if("li"==i.name&&n.nodeBefore&&("ul"==n.nodeBefore.name||"ol"==n.nodeBefore.name)){const s=r.toModelElement(i);let a=1,c=n.nodeBefore;for(;c&&Rp(c);)a+=r.getModelLength(c),c=c.previousSibling;t.modelPosition=o.createPositionBefore(s).getShiftedBy(a),e.stop()}})),t.mapper.on("modelToViewPosition",Tp(n.view)),e.conversion.for("editingDowncast").add(t=>{t.on("insert",vp,{priority:"high"}),t.on("insert:listItem",wp(e.model)),t.on("attribute:listType:listItem",kp,{priority:"high"}),t.on("attribute:listType:listItem",_p,{priority:"low"}),t.on("attribute:listIndent:listItem",function(e){return(t,n,o)=>{if(!o.consumable.consume(n.item,"attribute:listIndent"))return;const i=o.mapper.toViewElement(n.item),r=o.writer;r.breakContainer(r.createPositionBefore(i)),r.breakContainer(r.createPositionAfter(i));const s=i.parent,a=s.previousSibling,c=r.createRangeOn(s);r.remove(c),a&&a.nextSibling&&fp(r,a,a.nextSibling),Sp(n.attributeOldValue+1,n.range.start,c.start,i,o,e),hp(n.item,i,o,e);for(const e of n.item.getChildren())o.consumable.consume(e,"insert")}}(e.model)),t.on("remove:listItem",function(e){return(t,n,o)=>{const i=o.mapper.toViewPosition(n.position).getLastMatchingPosition(e=>!e.item.is("li")).nodeAfter,r=o.writer;r.breakContainer(r.createPositionBefore(i)),r.breakContainer(r.createPositionAfter(i));const s=i.parent,a=s.previousSibling,c=r.createRangeOn(s),l=r.remove(c);a&&a.nextSibling&&fp(r,a,a.nextSibling),Sp(o.mapper.toModelElement(i).getAttribute("listIndent")+1,n.position,c.start,i,o,e);for(const e of r.createRangeIn(l).getItems())o.mapper.unbindViewElement(e);t.stop()}}(e.model)),t.on("remove",yp,{priority:"low"})}),e.conversion.for("dataDowncast").add(t=>{t.on("insert",vp,{priority:"high"}),t.on("insert:listItem",wp(e.model))}),e.conversion.for("upcast").add(e=>{e.on("element:ul",Cp,{priority:"high"}),e.on("element:ol",Cp,{priority:"high"}),e.on("element:li",Ap,{priority:"high"}),e.on("element:li",xp)}),e.model.on("insertContent",Pp,{priority:"high"}),e.commands.add("numberedList",new ap(e,"numbered")),e.commands.add("bulletedList",new ap(e,"bulleted")),e.commands.add("indentList",new dp(e,"forward")),e.commands.add("outdentList",new dp(e,"backward"));const i=n.view.document;this.listenTo(i,"enter",(e,t)=>{const n=this.editor.model.document,o=n.selection.getLastPosition().parent;n.selection.isCollapsed&&"listItem"==o.name&&o.isEmpty&&(this.editor.execute("outdentList"),t.preventDefault(),e.stop())}),this.listenTo(i,"delete",(e,t)=>{if("backward"!==t.direction)return;const n=this.editor.model.document.selection;if(!n.isCollapsed)return;const o=n.getFirstPosition();if(!o.isAtStart)return;const i=o.parent;"listItem"===i.name&&(i.previousSibling&&"listItem"===i.previousSibling.name||(this.editor.execute("outdentList"),t.preventDefault(),e.stop()))},{priority:"high"});const r=e=>(t,n)=>{this.editor.commands.get(e).isEnabled&&(this.editor.execute(e),n())};e.keystrokes.set("Tab",r("indentList")),e.keystrokes.set("Shift+Tab",r("outdentList"))}afterInit(){const e=this.editor.commands,t=e.get("indent"),n=e.get("outdent");t&&t.registerChildCommand(e.get("indentList")),n&&n.registerChildCommand(e.get("outdentList"))}}function Op(e){let t=1;for(const n of e.getChildren())if("ul"==n.name||"ol"==n.name)for(const e of n.getChildren())t+=Op(e);return t}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
class Np extends Ll{init(){const e=this.editor.t;gp(this.editor,"numberedList",e("dg"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M7 5.75c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zM3.5 3v5H2V3.7H1v-1h2.5V3zM.343 17.857l2.59-3.257H2.92a.6.6 0 1 0-1.04 0H.302a2 2 0 1 1 3.995 0h-.001c-.048.405-.16.734-.333.988-.175.254-.59.692-1.244 1.312H4.3v1h-4l.043-.043zM7 14.75a.75.75 0 0 1 .75-.75h9.5a.75.75 0 1 1 0 1.5h-9.5a.75.75 0 0 1-.75-.75z"/></svg>'),gp(this.editor,"bulletedList",e("dh"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M7 5.75c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zm-6 0C1 4.784 1.777 4 2.75 4c.966 0 1.75.777 1.75 1.75 0 .966-.777 1.75-1.75 1.75C1.784 7.5 1 6.723 1 5.75zm6 9c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zm-6 0c0-.966.777-1.75 1.75-1.75.966 0 1.75.777 1.75 1.75 0 .966-.777 1.75-1.75 1.75-.966 0-1.75-.777-1.75-1.75z"/></svg>')}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/const Mp=Symbol("isOPCodeBlock");function Vp(e){return!!e.getCustomProperty(Mp)&&Ul(e)}function Dp(e){const t=e.getSelectedElement();return!(!t||!Vp(t))}function Fp(e,t,n){const o=t.createContainerElement("div",{class:"op-ckeditor--code-block",title:window.I18n.t("js.editor.macro.toolbar_help")});return Bp(t,e,o),function(e,t,n){return t.setCustomProperty(Mp,!0,e),$l(e,t,{label:n})}(o,t,n)}function Bp(e,t,n){const o=(t.getAttribute("opCodeblockLanguage")||"language-text").replace(/^language-/,""),i=e.createContainerElement("div",{class:"op-ckeditor--code-block-language"});Lp(e,o,i,"text"),e.insert(e.createPositionAt(n,0),i),Lp(e,t.getAttribute("opCodeblockContent"),n,"(empty)")}function Lp(e,t,n,o){const i=e.createText(t||o);e.insert(e.createPositionAt(n,0),i)}class zp extends Nr{constructor(e){super(e),this.domEventType="dblclick"}onDomEvent(e){this.fire(e.type,e)}}class qp extends Ll{static get pluginName(){return"CodeBlockEditing"}init(){const e=this.editor,t=e.model.schema,n=e.conversion,o=e.editing.view,i=o.document,r=td(e);t.register("codeblock",{isObject:!0,isBlock:!0,allowContentOf:"$block",allowWhere:["$root","$block"],allowIn:["$root"],allowAttributes:["opCodeblockLanguage","opCodeblockContent"]}),n.for("upcast").add(function(){return t=>{t.on("element:pre",e,{priority:"high"})};function e(e,t,n){if(!n.consumable.test(t.viewItem,{name:!0}))return;const o=Array.from(t.viewItem.getChildren()).find(e=>e.is("code"));if(!o||!n.consumable.consume(o,{name:!0}))return;const i=n.writer.createElement("codeblock");n.writer.setAttribute("opCodeblockLanguage",o.getAttribute("class"),i);const r=n.splitToAllowedParent(i,t.modelCursor);if(r){n.writer.insert(i,r.position);const e=o.getChild(0);n.consumable.consume(e,{name:!0});const s=e.data.replace(/\n$/,"");n.writer.setAttribute("opCodeblockContent",s,i),t.modelRange=new vs(n.writer.createPositionBefore(i),n.writer.createPositionAfter(i)),t.modelCursor=t.modelRange.end}}}()),n.for("editingDowncast").elementToElement({model:"codeblock",view:(e,t)=>Fp(e,t,"Code block")}).add(function(){return t=>{t.on("attribute:opCodeblockContent",e),t.on("attribute:opCodeblockLanguage",e)};function e(e,t,n){const o=t.item;n.consumable.consume(t.item,e.name);const i=n.mapper.toViewElement(o);n.writer.remove(n.writer.createRangeOn(i.getChild(1))),n.writer.remove(n.writer.createRangeOn(i.getChild(0))),Bp(n.writer,o,i)}}()),n.for("dataDowncast").add(function(){return t=>{t.on("insert:codeblock",e,{priority:"high"})};function e(e,t,n){const o=t.item,i=o.getAttribute("opCodeblockLanguage")||"language-text",r=o.getAttribute("opCodeblockContent");n.consumable.consume(o,"insert");const s=n.writer,a=s.createContainerElement("pre"),c=s.createContainerElement("div",{class:"op-ckeditor--code-block-language"}),l=s.createContainerElement("code",{class:i}),d=s.createText(i),u=s.createText(r);s.insert(s.createPositionAt(l,0),u),s.insert(s.createPositionAt(c,0),d),s.insert(s.createPositionAt(a,0),c),s.insert(s.createPositionAt(a,0),l),n.mapper.bindElements(o,l),n.mapper.bindElements(o,a);const h=n.mapper.toViewPosition(t.range.start);s.insert(h,a),e.stop()}}()),o.addObserver(zp),this.listenTo(i,"dblclick",(t,n)=>{let o=n.target,i=n.domEvent;if(i.shiftKey||i.altKey||i.metaKey)return;if(!Vp(o)&&(o=o.findAncestor(Vp),!o))return;n.preventDefault(),n.stopPropagation();const s=e.editing.mapper.toModelElement(o),a=r.services.macros,c=s.getAttribute("opCodeblockLanguage"),l=s.getAttribute("opCodeblockContent");a.editCodeBlock(l,c).then(t=>e.model.change(e=>{e.setAttribute("opCodeblockLanguage",t.languageClass,s),e.setAttribute("opCodeblockContent",t.content,s)}))}),e.ui.componentFactory.add("insertCodeBlock",t=>{const n=new xl(t);return n.set({label:window.I18n.t("js.editor.macro.code_block.button"),icon:'<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n<svg\n xmlns:dc="http://purl.org/dc/elements/1.1/"\n xmlns:cc="http://creativecommons.org/ns#"\n xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\n xmlns:svg="http://www.w3.org/2000/svg"\n xmlns="http://www.w3.org/2000/svg"\n xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"\n xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"\n class="ck ck-icon ck-button__icon"\n viewBox="0 0 20 20"\n version="1.1"\n id="svg10"\n sodipodi:docname="code-block.svg"\n inkscape:version="0.92.3 (2405546, 2018-03-11)">\n <defs\n id="defs14" />\n <sodipodi:namedview\n pagecolor="#ffffff"\n bordercolor="#666666"\n borderopacity="1"\n objecttolerance="10"\n gridtolerance="10"\n guidetolerance="10"\n inkscape:pageopacity="0"\n inkscape:pageshadow="2"\n inkscape:window-width="640"\n inkscape:window-height="480"\n id="namedview12"\n showgrid="false"\n inkscape:zoom="33.37544"\n inkscape:cx="10.656564"\n inkscape:cy="13.670445"\n inkscape:current-layer="svg10" />\n <g\n id="g8"\n style="fill:none;fill-rule:evenodd"\n transform="matrix(0.8751128,0,0,0.8751128,1.3360704,0.91121972)">\n <g\n id="g6"\n style="fill:#353535">\n <g\n transform="translate(2,5.6)"\n id="g4">\n <path\n d="M 10.5,0.1 15.7,4 v 1.3 l -5.6,4 C 10,9.5 9.8,9.5 9.6,9.5 9.3,9.4 9,8.8 9,8.5 L 9.3,8.1 14,4.6 9.5,1.4 9.3,1.2 C 9.2,0.9 9.2,0.6 9.3,0.4 9.5,0.2 9.8,0 10.1,0 a 0.8,0.8 0 0 1 0.4,0.1 z M 5.3,0.1 0,4 v 1.3 l 5.6,4 C 5.7,9.5 5.9,9.5 6.1,9.5 6.4,9.4 6.8,8.8 6.7,8.5 6.7,8.4 6.7,8.2 6.5,8.1 L 1.5,4.6 6.2,1.4 6.4,1.2 C 6.5,0.9 6.5,0.6 6.4,0.4 6.2,0.2 5.9,0 5.6,0 A 0.8,0.8 0 0 0 5.3,0.1 Z"\n id="path2"\n inkscape:connector-curvature="0" />\n </g>\n </g>\n </g>\n <path\n style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#353535;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.09228408;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"\n d="M 0.22004104,0.22004104 V 0.76600468 19.779959 H 19.779959 V 0.22004104 Z M 1.3119682,1.3119682 H 18.688032 V 18.688032 H 1.3119682 Z"\n id="rect3722"\n inkscape:connector-curvature="0" />\n <metadata\n id="metadata4596">\n <rdf:RDF>\n <cc:Work\n rdf:about="">\n <dc:title></dc:title>\n <dc:format>image/svg+xml</dc:format>\n <dc:type\n rdf:resource="http://purl.org/dc/dcmitype/StillImage" />\n </cc:Work>\n </rdf:RDF>\n </metadata>\n</svg>\n',tooltip:!0}),n.on("execute",()=>{r.services.macros.editCodeBlock().then(t=>e.model.change(n=>{const o=n.createElement("codeblock");n.setAttribute("opCodeblockLanguage",t.languageClass,o),n.setAttribute("opCodeblockContent",t.content,o),e.model.insertContent(o,e.model.document.selection)}))}),n})}}class jp extends Ll{static get requires(){return[bd]}static get pluginName(){return"CodeBlockToolbar"}init(){const e=this.editor,t=this.editor.model,n=td(e);_d(e,"opEditCodeBlock",e=>{const o=n.services.macros,i=e.getAttribute("opCodeblockLanguage"),r=e.getAttribute("opCodeblockContent");o.editCodeBlock(r,i).then(n=>t.change(t=>{t.setAttribute("opCodeblockLanguage",n.languageClass,e),t.setAttribute("opCodeblockContent",n.content,e)}))})}afterInit(){vd(this,this.editor,"OPCodeBlock",Dp)}}function Hp(e){return e.__currentlyDisabled=e.__currentlyDisabled||[],e.ui.view.toolbar?e.ui.view.toolbar.items._items:[]}function Wp(e,t){jQuery.each(Hp(e),(function(n,o){let i=o;o instanceof Md?i=o.buttonView:o!==t&&o.hasOwnProperty("isEnabled")||(i=null),i&&(i.isEnabled?i.isEnabled=!1:e.__currentlyDisabled.push(i))}))}function Up(e){jQuery.each(Hp(e),(function(t,n){let o=n;n instanceof Md&&(o=n.buttonView),e.__currentlyDisabled.indexOf(o)<0&&(o.isEnabled=!0)})),e.__currentlyDisabled=[]}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
function $p(e,t){let n=t.parent;for(;n;){if(n.name===e)return n;n=n.parent}}function Gp(e,t,n,o,i=1){t>i?o.setAttribute(e,t,n):o.removeAttribute(e,n)}function Kp(e,t,n={}){const o=e.createElement("tableCell",n);e.insertElement("paragraph",o),e.insert(o,t)}function Jp(e){if(!e||!B(e))return e;const{top:t,right:n,bottom:o,left:i}=e;return t==n&&n==o&&o==i?t:void 0}function Zp(e,t){const n=parseFloat(e);return Number.isNaN(n)||String(n)!==String(e)?e:`${n}${t}`}function Qp(e,t){const n=t.parent.parent,o=parseInt(n.getAttribute("headingColumns")||0),{column:i}=e.getCellLocation(t);return!!o&&i<o}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function Yp(){return e=>{e.on("element:table",(e,t,n)=>{const o=t.viewItem;if(!n.consumable.test(o,{name:!0}))return;const{rows:i,headingRows:r,headingColumns:s}=function(e){const t={headingRows:0,headingColumns:0},n=[],o=[];let i;for(const r of Array.from(e.getChildren()))if("tbody"===r.name||"thead"===r.name||"tfoot"===r.name){"thead"!==r.name||i||(i=r);const e=Array.from(r.getChildren()).filter(e=>e.is("element","tr"));for(const r of e)if("thead"===r.parent.name&&r.parent===i)t.headingRows++,n.push(r);else{o.push(r);const e=em(r);e>t.headingColumns&&(t.headingColumns=e)}}return t.rows=[...n,...o],t}(o),a={};s&&(a.headingColumns=s),r&&(a.headingRows=r);const c=n.writer.createElement("table",a),l=n.splitToAllowedParent(c,t.modelCursor);if(l){if(n.writer.insert(c,l.position),n.consumable.consume(o,{name:!0}),i.length)i.forEach(e=>n.convertItem(e,n.writer.createPositionAt(c,"end")));else{const e=n.writer.createElement("tableRow");n.writer.insert(e,n.writer.createPositionAt(c,"end")),Kp(n.writer,n.writer.createPositionAt(e,"end"))}t.modelRange=n.writer.createRange(n.writer.createPositionBefore(c),n.writer.createPositionAfter(c)),l.cursorParent?t.modelCursor=n.writer.createPositionAt(l.cursorParent,0):t.modelCursor=t.modelRange.end}})}}function Xp(e){return t=>{t.on(`element:${e}`,(e,t,n)=>{const o=t.viewItem;if(!n.consumable.test(o,{name:!0}))return;const i=n.writer.createElement("tableCell"),r=n.splitToAllowedParent(i,t.modelCursor);if(!r)return;n.writer.insert(i,r.position),n.consumable.consume(o,{name:!0});const s=n.writer.createPositionAt(i,0);n.convertChildren(o,s),i.childCount||n.writer.insertElement("paragraph",s),t.modelRange=n.writer.createRange(n.writer.createPositionBefore(i),n.writer.createPositionAfter(i)),t.modelCursor=t.modelRange.end})}}function em(e){let t=0,n=0;const o=Array.from(e.getChildren()).filter(e=>"th"===e.name||"td"===e.name);for(;n<o.length&&"th"===o[n].name;){const e=o[n];t+=parseInt(e.getAttribute("colspan")||1),n++}return t}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class tm{constructor(e,t={}){this.table=e,this.startRow=t.startRow||0,this.endRow="number"==typeof t.endRow?t.endRow:void 0,this.includeSpanned=!!t.includeSpanned,this.column="number"==typeof t.column?t.column:void 0,this._skipRows=new Set,this._row=0,this._column=0,this._cellIndex=0,this._spannedCells=new Map,this._nextCellAtColumn=-1}[Symbol.iterator](){return this}next(){const e=this.table.getChild(this._row);if(!e||this._isOverEndRow())return{done:!0};let t,n,o;if(this._isSpanned(this._row,this._column))t=this._getSpanned(this._row,this._column),n=!this.includeSpanned||this._shouldSkipRow()||this._shouldSkipColumn(),o=this._formatOutValue(t,this._column,!0);else{if(t=e.getChild(this._cellIndex),!t)return this._row++,this._column=0,this._cellIndex=0,this._nextCellAtColumn=-1,this.next();const i=parseInt(t.getAttribute("colspan")||1),r=parseInt(t.getAttribute("rowspan")||1);(i>1||r>1)&&this._recordSpans(this._row,this._column,r,i,t),this._nextCellAtColumn=this._column+i,n=this._shouldSkipRow()||this._shouldSkipColumn(),o=this._formatOutValue(t,this._column,!1,r,i)}return this._column++,this._column==this._nextCellAtColumn&&this._cellIndex++,n?this.next():o}skipRow(e){this._skipRows.add(e)}_isOverEndRow(){return void 0!==this.endRow&&this._row>this.endRow}_formatOutValue(e,t,n,o=1,i=1){return{done:!1,value:{cell:e,row:this._row,column:t,isSpanned:n,rowspan:o,colspan:i,cellIndex:this._cellIndex}}}_shouldSkipRow(){const e=this._row<this.startRow,t=this._skipRows.has(this._row);return e||t}_shouldSkipColumn(){return void 0!==this.column&&this.column!=this._column}_isSpanned(e,t){if(!this._spannedCells.has(e))return!1;return this._spannedCells.get(e).has(t)}_getSpanned(e,t){return this._spannedCells.get(e).get(t)}_recordSpans(e,t,n,o,i){for(let n=t+1;n<=t+o-1;n++)this._markSpannedCell(e,n,i);for(let r=e+1;r<e+n;r++)for(let e=t;e<=t+o-1;e++)this._markSpannedCell(r,e,i)}_markSpannedCell(e,t,n){this._spannedCells.has(e)||this._spannedCells.set(e,new Map),this._spannedCells.get(e).set(t,n)}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function nm(e){return!!e.getCustomProperty("table")&&Ul(e)}function om(e){const t=e.getSelectedElement();return t&&nm(t)?t:null}function im(e){const t=$p("table",e.getFirstPosition());return t&&nm(t.parent)?t.parent:null}function rm(e){const t=[];for(const o of(n=e.getRanges(),Array.from(n).sort(cm))){const e=o.getContainedElement();e&&e.is("tableCell")&&t.push(e)}var n;return t}function sm(e){const t=[];for(const n of e.getRanges()){const e=$p("tableCell",n.start);e&&t.push(e)}return t}function am(e){const t=rm(e);return t.length?t:sm(e)}function cm(e,t){const n=e.start,o=t.start;return n.isEqual(o)?0:n.isBefore(o)?-1:1}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function lm(e={}){return t=>t.on("insert:table",(t,n,o)=>{const i=n.item;if(!o.consumable.consume(i,"insert"))return;o.consumable.consume(i,"attribute:headingRows:table"),o.consumable.consume(i,"attribute:headingColumns:table");const r=e&&e.asWidget,s=o.writer.createContainerElement("figure",{class:"table"}),a=o.writer.createContainerElement("table");let c;var l,d;o.writer.insert(o.writer.createPositionAt(s,0),a),r&&(l=s,(d=o.writer).setCustomProperty("table",!0,l),c=$l(l,d,{hasSelectionHandle:!0}));const u=new tm(i),h={headingRows:i.getAttribute("headingRows")||0,headingColumns:i.getAttribute("headingColumns")||0},f=new Map;for(const t of u){const{row:n,cell:r}=t,s=_m(km(n,h),a,o),c=i.getChild(n),l=f.get(n)||bm(c,n,s,o);f.set(n,l),o.consumable.consume(r,"insert"),gm(t,h,o.writer.createPositionAt(l,"end"),o,e)}const p=o.mapper.toViewPosition(n.range.start);o.mapper.bindElements(i,r?c:s),o.writer.insert(p,r?c:s)})}function dm(e={}){return t=>t.on("insert:tableRow",(t,n,o)=>{const i=n.item;if(!o.consumable.consume(i,"insert"))return;const r=i.parent,s=Cm(o.mapper.toViewElement(r)),a=r.getChildIndex(i),c=new tm(r,{startRow:a,endRow:a}),l={headingRows:r.getAttribute("headingRows")||0,headingColumns:r.getAttribute("headingColumns")||0},d=new Map;for(const t of c){const n=_m(km(a,l),s,o),r=d.get(a)||bm(i,a,n,o);d.set(a,r),o.consumable.consume(t.cell,"insert"),gm(t,l,o.writer.createPositionAt(r,"end"),o,e)}})}function um(e={}){return t=>t.on("insert:tableCell",(t,n,o)=>{const i=n.item;if(!o.consumable.consume(i,"insert"))return;const r=i.parent,s=r.parent,a=s.getChildIndex(r),c=new tm(s,{startRow:a,endRow:a}),l={headingRows:s.getAttribute("headingRows")||0,headingColumns:s.getAttribute("headingColumns")||0};for(const t of c)if(t.cell===i){const n=o.mapper.toViewElement(r);return void gm(t,l,o.writer.createPositionAt(n,r.getChildIndex(i)),o,e)}})}function hm(e={}){const t=!!e.asWidget;return e=>e.on("attribute:headingRows:table",(e,n,o)=>{const i=n.item;if(!o.consumable.consume(n.item,e.name))return;const r=Cm(o.mapper.toViewElement(i)),s=n.attributeOldValue,a=n.attributeNewValue;if(a>s){const e=Array.from(i.getChildren()).filter(({index:e})=>c(e,s-1,a));xm(e,_m("thead",r,o),o,"end");for(const n of e)for(const e of n.getChildren())pm(e,"th",o,t);ym("tbody",r,o)}else{xm(Array.from(i.getChildren()).filter(({index:e})=>c(e,a-1,s)).reverse(),_m("tbody",r,o),o,0);const e=new tm(i,{startRow:a?a-1:a,endRow:s-1}),n={headingRows:i.getAttribute("headingRows")||0,headingColumns:i.getAttribute("headingColumns")||0};for(const i of e)mm(i,n,o,t);ym("thead",r,o)}function c(e,t,n){return e>t&&e<n}})}function fm(e={}){const t=!!e.asWidget;return e=>e.on("attribute:headingColumns:table",(e,n,o)=>{const i=n.item;if(!o.consumable.consume(n.item,e.name))return;const r={headingRows:i.getAttribute("headingRows")||0,headingColumns:i.getAttribute("headingColumns")||0},s=n.attributeOldValue,a=n.attributeNewValue,c=(s>a?s:a)-1;for(const e of new tm(i))e.column>c||mm(e,r,o,t)})}function pm(e,t,n,o){const i=n.writer,r=n.mapper.toViewElement(e);if(!r)return;let s;if(o){s=Kl(i.createEditableElement(t,r.getAttributes()),i),i.insert(i.createPositionAfter(r),s),i.move(i.createRangeIn(r),i.createPositionAt(s,0)),i.remove(i.createRangeOn(r))}else s=i.rename(t,r);n.mapper.unbindViewElement(r),n.mapper.bindElements(e,s)}function mm(e,t,n,o){const{cell:i}=e,r=wm(e,t),s=n.mapper.toViewElement(i);s&&s.name!==r&&pm(i,r,n,o)}function gm(e,t,n,o,i){const r=i&&i.asWidget,s=wm(e,t),a=r?Kl(o.writer.createEditableElement(s),o.writer):o.writer.createContainerElement(s),c=e.cell,l=c.getChild(0),d=1===c.childCount&&"paragraph"===l.name;if(o.writer.insert(n,a),d&&![...l.getAttributeKeys()].length){const e=c.getChild(0),t=o.writer.createPositionAt(a,"end");if(o.consumable.consume(e,"insert"),i.asWidget){const n=o.writer.createContainerElement("span",{style:"display:inline-block"});o.mapper.bindElements(e,n),o.writer.insert(t,n),o.mapper.bindElements(c,a)}else o.mapper.bindElements(c,a),o.mapper.bindElements(e,a)}else o.mapper.bindElements(c,a)}function bm(e,t,n,o){o.consumable.consume(e,"insert");const i=o.writer.createContainerElement("tr");o.mapper.bindElements(e,i);const r=e.parent.getAttribute("headingRows")||0,s=r>0&&t>=r?t-r:t,a=o.writer.createPositionAt(n,s);return o.writer.insert(a,i),i}function wm(e,t){const{row:n,column:o}=e,{headingColumns:i,headingRows:r}=t;return r&&r>n||i&&i>o?"th":"td"}function km(e,t){return e<t.headingRows?"thead":"tbody"}function _m(e,t,n){const o=vm(e,t);return o||function(e,t,n){const o=n.writer.createContainerElement(e),i=n.writer.createPositionAt(t,"tbody"==e?"end":0);return n.writer.insert(i,o),o}(e,t,n)}function vm(e,t){for(const n of t.getChildren())if(n.name==e)return n}function ym(e,t,n){const o=vm(e,t);o&&0===o.childCount&&n.writer.remove(n.writer.createRangeOn(o))}function xm(e,t,n,o){for(const i of e){const e=n.mapper.toViewElement(i);e&&n.writer.move(n.writer.createRangeOn(e),n.writer.createPositionAt(t,o))}}function Cm(e){for(const t of e.getChildren())if("table"===t.name)return t}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
class Am extends nu{refresh(){const e=this.editor.model,t=e.document.selection,n=e.schema,o=function(e){const t=e.parent;return t===t.root?t:t.parent}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/(t.getFirstPosition());this.isEnabled=n.checkChild(o,"table")}execute(e={}){const t=this.editor.model,n=t.document.selection,o=this.editor.plugins.get("TableUtils"),i=parseInt(e.rows)||2,r=parseInt(e.columns)||2,s=Jl(n,t);t.change(e=>{const n=o.createTable(e,i,r);t.insertContent(n,s),e.setSelection(e.createPositionAt(n.getNodeByPath([0,0,0]),0))})}}class Tm extends nu{constructor(e,t={}){super(e),this.order=t.order||"below"}refresh(){const e=$p("table",this.editor.model.document.selection.getFirstPosition());this.isEnabled=!!e}execute(){const e=this.editor,t=e.model.document.selection,n=e.plugins.get("TableUtils"),o="above"===this.order,i=o?t.getFirstPosition():t.getLastPosition(),r=((o?t.getFirstRange():t.getLastRange()).getContainedElement()||$p("tableCell",i)).parent,s=r.parent,a=s.getChildIndex(r);n.insertRows(s,{rows:1,at:"below"===this.order?a+1:a})}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Pm extends nu{constructor(e,t={}){super(e),this.order=t.order||"right"}refresh(){const e=$p("table",this.editor.model.document.selection.getFirstPosition());this.isEnabled=!!e}execute(){const e=this.editor,t=e.model.document.selection,n=e.plugins.get("TableUtils"),o="left"===this.order,i=o?t.getFirstPosition():t.getLastPosition(),r=(o?t.getFirstRange():t.getLastRange()).getContainedElement()||$p("tableCell",i),s=r.parent.parent,{column:a}=n.getCellLocation(r);n.insertColumns(s,{columns:1,at:o?a:a+1})}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Em extends nu{constructor(e,t={}){super(e),this.direction=t.direction||"horizontally"}refresh(){const e=am(this.editor.model.document.selection);this.isEnabled=1===e.length}execute(){const e=am(this.editor.model.document.selection)[0],t="horizontally"===this.direction,n=this.editor.plugins.get("TableUtils");t?n.splitCellHorizontally(e,2):n.splitCellVertically(e,2)}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Sm extends nu{constructor(e,t){super(e),this.direction=t.direction,this.isHorizontal="right"==this.direction||"left"==this.direction}refresh(){const e=this._getMergeableCell();this.value=e,this.isEnabled=!!e}execute(){const e=this.editor.model,t=sm(e.document.selection)[0],n=this.value,o=this.direction;e.change(e=>{const i="right"==o||"down"==o,r=i?t:n,s=i?n:t,a=s.parent;!function(e,t,n){Rm(e)||(Rm(t)&&n.remove(n.createRangeIn(t)),n.move(n.createRangeIn(e),n.createPositionAt(t,"end")));n.remove(e)}(s,r,e);const c=this.isHorizontal?"colspan":"rowspan",l=parseInt(t.getAttribute(c)||1),d=parseInt(n.getAttribute(c)||1);e.setAttribute(c,l+d,r),e.setSelection(e.createRangeIn(r)),a.childCount||function(e,t){const n=e.parent,o=n.getChildIndex(e);for(const{cell:e,row:i,rowspan:r}of new tm(n,{endRow:o})){i+r-1>=o&&Gp("rowspan",r-1,e,t)}t.remove(e)}(a,e)})}_getMergeableCell(){const e=sm(this.editor.model.document.selection)[0];if(!e)return;const t=this.editor.plugins.get("TableUtils"),n=this.isHorizontal?function(e,t,n){const o=e.parent.parent,i="right"==t?e.nextSibling:e.previousSibling,r=(o.getAttribute("headingColumns")||0)>0;if(!i)return;const s="right"==t?e:i,a="right"==t?i:e,{column:c}=n.getCellLocation(s),{column:l}=n.getCellLocation(a),d=parseInt(s.getAttribute("colspan")||1),u=Qp(n,s),h=Qp(n,a);if(r&&u!=h)return;return c+d===l?i:void 0}(e,this.direction,t):function(e,t){const n=e.parent,o=n.parent,i=o.getChildIndex(n);if("down"==t&&i===o.childCount-1||"up"==t&&0===i)return;const r=parseInt(e.getAttribute("rowspan")||1),s=o.getAttribute("headingRows")||0,a="down"==t&&i+r===s,c="up"==t&&i===s;if(s&&(a||c))return;const l=parseInt(e.getAttribute("rowspan")||1),d="down"==t?i+l:i,u=[...new tm(o,{endRow:d})],h=u.find(t=>t.cell===e).column,f=u.find(({row:e,rowspan:n,column:o})=>o===h&&("down"==t?e===d:d===e+n));return f&&f.cell}(e,this.direction);if(!n)return;const o=this.isHorizontal?"rowspan":"colspan",i=parseInt(e.getAttribute(o)||1);return parseInt(n.getAttribute(o)||1)===i?n:void 0}}function Rm(e){return 1==e.childCount&&e.getChild(0).is("paragraph")&&e.getChild(0).isEmpty}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Im extends nu{refresh(){const e=am(this.editor.model.document.selection),t=e[0];if(t){const n=t.parent.parent,o=this.editor.plugins.get("TableUtils").getRows(n),i=[...new tm(n)].filter(t=>e.includes(t.cell)).map(e=>e.row),r=i[0],s=i[i.length-1];this.isEnabled=s-r<o-1}else this.isEnabled=!1}execute(){const e=am(this.editor.model.document.selection),t=function(e){const t=e.map(e=>e.parent.index).sort();return{first:t[0],last:t[t.length-1]}}(e),n=e[0],o=n.parent.parent,i=[...new tm(o,{endRow:t.last})],r=this.editor.model.createBatch(),s=function(e,t){return e.find(e=>e.cell===t).column}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/(i,n);let a;this.editor.model.enqueueChange(r,e=>{e.setSelection(e.createSelection(o,"on"))});for(let e=t.last;e>=t.first;e--)this.editor.model.enqueueChange(r,t=>{const n=e;this._removeRow(n,o,t,i),a=Om(o,n,s)});this.editor.model.enqueueChange(r,e=>{e.setSelection(e.createPositionAt(a,0))})}_removeRow(e,t,n,o){const i=new Map,r=t.getChild(e),s=t.getAttribute("headingRows")||0;s&&e<s&&Gp("headingRows",s-1,t,n,0),o.filter(({row:t,rowspan:n})=>t===e&&n>1).forEach(({column:e,cell:t,rowspan:n})=>i.set(e,{cell:t,rowspanToSet:n-1})),o.filter(({row:t,rowspan:n})=>t<=e-1&&t+n>e).forEach(({cell:e,rowspan:t})=>Gp("rowspan",t-1,e,n));const a=e+1,c=new tm(t,{includeSpanned:!0,startRow:a,endRow:a});let l;for(const{row:e,column:o,cell:r}of[...c])if(i.has(o)){const{cell:r,rowspanToSet:s}=i.get(o),a=l?n.createPositionAfter(l):n.createPositionAt(t.getChild(e),0);n.move(n.createRangeOn(r),a),Gp("rowspan",s,r,n),l=r}else l=r;n.remove(r)}}function Om(e,t,n){const o=e.getChild(t)||e.getChild(e.childCount-1);let i=o.getChild(0),r=0;for(const e of o.getChildren()){if(r>n)return i;i=e,r+=parseInt(e.getAttribute("colspan")||1)}return i}class Nm extends nu{refresh(){const e=am(this.editor.model.document.selection),t=e[0];if(t){const n=t.parent.parent,o=this.editor.plugins.get("TableUtils").getColumns(n),i=[...new tm(n)].filter(t=>e.includes(t.cell)).map(e=>e.column).sort(),r=i[0],s=i[i.length-1];this.isEnabled=s-r<o-1}else this.isEnabled=!1}execute(){const[e,t]=function(e){const t=am(e),n=t[0],o=t.pop(),i=[n,o];return n.isBefore(o)?i:i.reverse()}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/(this.editor.model.document.selection),n=e.parent.parent,o=[...new tm(n)],i={first:o.find(t=>t.cell===e).column,last:o.find(e=>e.cell===t).column},r=function(e,t,n,o){return parseInt(n.getAttribute("colspan")||1)>1?n:t.previousSibling||n.nextSibling?n.nextSibling||t.previousSibling:o.first?e.reverse().find(({column:e})=>e<o.first).cell:e.reverse().find(({column:e})=>e>o.last).cell}(o,e,t,i);this.editor.model.change(e=>{e.setSelection(e.createRangeOn(n)),function(e,t,n){const o=e.getAttribute("headingColumns")||0;if(o&&t.first<=o){const i=Math.min(o-1,t.last)-t.first+1;n.setAttribute("headingColumns",o-i,e)}}(n,i,e);for(let t=i.last;t>=i.first;t--)for(const{cell:n,column:i,colspan:r}of o)if(i<=t&&r>1&&i+r>t)Gp("colspan",r-1,n,e);else if(i===t){const t=n.parent;e.remove(n),t.childCount||e.remove(t)}e.setSelection(e.createPositionAt(r,0))})}}class Mm extends nu{refresh(){const e=am(this.editor.model.document.selection),t=e.length>0;this.isEnabled=t,this.value=t&&e.every(e=>this._isInHeading(e,e.parent.parent))}execute(e={}){const t=this.editor.model,n=am(t.document.selection),o=n[0],i=n[n.length-1],r=o.parent.parent,s=r.getAttribute("headingRows")||0,[a,c]=[o.parent.index,i.parent.index].sort();if(e.forceValue===this.value)return;const l=this.value?a:c+1;t.change(e=>{if(l){const t=function(e,t,n){const o=[],i=new tm(e,{startRow:t>n?n:0,endRow:t-1});for(const{row:e,rowspan:n,cell:r}of i)n>1&&e+n>t&&o.push(r);return o}(r,l,s);for(const n of t)Vm(n,l,e)}Gp("headingRows",l,r,e,0)})}_isInHeading(e,t){const n=parseInt(t.getAttribute("headingRows")||0);return!!n&&e.parent.index<n}}function Vm(e,t,n){const o=e.parent,i=o.parent,r=t-o.index,s={},a=parseInt(e.getAttribute("rowspan"))-r;a>1&&(s.rowspan=a);const c=parseInt(e.getAttribute("colspan")||1);c>1&&(s.colspan=c);const l=i.getChildIndex(o),d=l+r,u=[...new tm(i,{startRow:l,endRow:d,includeSpanned:!0})];let h;for(const{row:t,column:o,cell:r,cellIndex:a}of u)if(r===e&&void 0===h&&(h=o),void 0!==h&&h===o&&t===d){const e=i.getChild(t),o=n.createPositionAt(e,a);Kp(n,o,s)}Gp("rowspan",r,e,n)}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Dm extends nu{refresh(){const e=am(this.editor.model.document.selection),t=this.editor.plugins.get("TableUtils"),n=e.length>0;this.isEnabled=n,this.value=n&&e.every(e=>Qp(t,e))}execute(e={}){const t=this.editor.model,n=this.editor.plugins.get("TableUtils"),o=am(t.document.selection),i=o[0],r=o[o.length-1],s=i.parent.parent,[a,c]=[n.getCellLocation(i).column,n.getCellLocation(r).column].sort();if(e.forceValue===this.value)return;const l=this.value?a:c+1;t.change(e=>{Gp("headingColumns",l,s,e,0)})}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Fm extends Ll{static get pluginName(){return"TableUtils"}getCellLocation(e){const t=e.parent,n=t.parent,o=n.getChildIndex(t),i=new tm(n,{startRow:o,endRow:o});for(const{cell:t,row:n,column:o}of i)if(t===e)return{row:n,column:o}}createTable(e,t,n){const o=e.createElement("table");return Bm(e,o,0,t,n),o}insertRows(e,t={}){const n=this.editor.model,o=t.at||0,i=t.rows||1;n.change(t=>{const n=e.getAttribute("headingRows")||0;if(n>o&&t.setAttribute("headingRows",n+i,e),0===o||o===e.childCount)return void Bm(t,e,o,i,this.getColumns(e));const r=new tm(e,{endRow:o});let s=0;for(const{row:e,rowspan:n,colspan:a,cell:c}of r){const r=e+n>o;e<o&&r&&t.setAttribute("rowspan",n+i,c),e===o&&(s+=a)}Bm(t,e,o,i,s)})}insertColumns(e,t={}){const n=this.editor.model,o=t.at||0,i=t.columns||1;n.change(t=>{const n=e.getAttribute("headingColumns");o<n&&t.setAttribute("headingColumns",n+i,e);const r=this.getColumns(e);if(0===o||r===o){for(const n of e.getChildren())Lm(i,t,t.createPositionAt(n,o?"end":0));return}const s=new tm(e,{column:o,includeSpanned:!0});for(const{row:n,cell:r,cellIndex:a}of s){const c=parseInt(r.getAttribute("rowspan")||1),l=parseInt(r.getAttribute("colspan")||1);if(r.index!==o&&l>1){if(t.setAttribute("colspan",l+i,r),s.skipRow(n),c>1)for(let e=n+1;e<n+c;e++)s.skipRow(e)}else{const o=t.createPositionAt(e.getChild(n),a);Lm(i,t,o)}}})}splitCellVertically(e,t=2){const n=this.editor.model,o=e.parent.parent,i=parseInt(e.getAttribute("rowspan")||1),r=parseInt(e.getAttribute("colspan")||1);n.change(n=>{if(r>1){const{newCellsSpan:o,updatedSpan:s}=zm(r,t);Gp("colspan",s,e,n);const a={};o>1&&(a.colspan=o),i>1&&(a.rowspan=i),Lm(r>t?t-1:r-1,n,n.createPositionAfter(e),a)}if(r<t){const s=t-r,a=[...new tm(o)],{column:c}=a.find(({cell:t})=>t===e),l=a.filter(({cell:t,colspan:n,column:o})=>t!==e&&o===c||o<c&&o+n>c);for(const{cell:e,colspan:t}of l)n.setAttribute("colspan",t+s,e);const d={};i>1&&(d.rowspan=i),Lm(s,n,n.createPositionAfter(e),d);const u=o.getAttribute("headingColumns")||0;u>c&&Gp("headingColumns",u+s,o,n)}})}splitCellHorizontally(e,t=2){const n=this.editor.model,o=e.parent,i=o.parent,r=i.getChildIndex(o),s=parseInt(e.getAttribute("rowspan")||1),a=parseInt(e.getAttribute("colspan")||1);n.change(n=>{if(s>1){const o=[...new tm(i,{startRow:r,endRow:r+s-1,includeSpanned:!0})],{newCellsSpan:c,updatedSpan:l}=zm(s,t);Gp("rowspan",l,e,n);const{column:d}=o.find(({cell:t})=>t===e),u={};c>1&&(u.rowspan=c),a>1&&(u.colspan=a);for(const{column:e,row:t,cellIndex:s}of o){const o=e===d,a=(t+r+l)%c==0;if(t>=r+l&&o&&a){const e=n.createPositionAt(i.getChild(t),s);Lm(1,n,e,u)}}}if(s<t){const o=t-s,c=[...new tm(i,{startRow:0,endRow:r})];for(const{cell:t,rowspan:i,row:s}of c)if(t!==e&&s+i>r){const e=i+o;n.setAttribute("rowspan",e,t)}const l={};a>1&&(l.colspan=a),Bm(n,i,r+1,o,1,l);const d=i.getAttribute("headingRows")||0;d>r&&Gp("headingRows",d+o,i,n)}})}getColumns(e){return[...e.getChild(0).getChildren()].reduce((e,t)=>e+parseInt(t.getAttribute("colspan")||1),0)}getRows(e){return e.childCount}}function Bm(e,t,n,o,i,r={}){for(let s=0;s<o;s++){const o=e.createElement("tableRow");e.insert(o,t,n),Lm(i,e,e.createPositionAt(o,"end"),r)}}function Lm(e,t,n,o={}){for(let i=0;i<e;i++)Kp(t,n,o)}function zm(e,t){if(e<t)return{newCellsSpan:1,updatedSpan:1};const n=Math.floor(e/t);return{newCellsSpan:n,updatedSpan:e-n*t+n}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function qm(e){e.document.registerPostFixer(t=>function(e,t){const n=t.document.differ.getChanges();let o=!1;const i=new Set;for(const t of n){let n;"table"==t.name&&"insert"==t.type&&(n=t.position.nodeAfter),"tableRow"!=t.name&&"tableCell"!=t.name||(n=$p("table",t.position)),Wm(t)&&(n=$p("table",t.range.start)),n&&!i.has(n)&&(o=jm(n,e)||o,o=Hm(n,e)||o,i.add(n))}return o}(t,e))}function jm(e,t){let n=!1;const o=function(e){const t=parseInt(e.getAttribute("headingRows")||0),n=e.childCount,o=[];for(const{row:i,rowspan:r,cell:s}of new tm(e)){if(r<2)continue;const e=i<t?t:n;if(i+r>e){const t=e-i;o.push({cell:s,rowspan:t})}}return o}(e);if(o.length){n=!0;for(const e of o)Gp("rowspan",e.rowspan,e.cell,t,1)}return n}function Hm(e,t){let n=!1;const o=function(e){const t={};for(const{row:n}of new tm(e,{includeSpanned:!0}))t[n]||(t[n]=0),t[n]+=1;return t}(e),i=o[0];if(!Object.values(o).every(e=>e===i)){const i=Object.values(o).reduce((e,t)=>t>e?t:e,0);for(const[r,s]of Object.entries(o)){const o=i-s;if(o){for(let n=0;n<o;n++)Kp(t,t.createPositionAt(e.getChild(r),"end"));n=!0}}}return n}function Wm(e){const t="attribute"===e.type,n=e.attributeKey;return t&&("headingRows"===n||"colspan"===n||"rowspan"===n)}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function Um(e){e.document.registerPostFixer(t=>function(e,t){const n=t.document.differ.getChanges();let o=!1;for(const t of n)"insert"==t.type&&"table"==t.name&&(o=$m(t.position.nodeAfter,e)||o),"insert"==t.type&&"tableRow"==t.name&&(o=Gm(t.position.nodeAfter,e)||o),"insert"==t.type&&"tableCell"==t.name&&(o=Km(t.position.nodeAfter,e)||o),Jm(t)&&(o=Km(t.position.parent,e)||o);return o}(t,e))}function $m(e,t){let n=!1;for(const o of e.getChildren())n=Gm(o,t)||n;return n}function Gm(e,t){let n=!1;for(const o of e.getChildren())n=Km(o,t)||n;return n}function Km(e,t){if(0==e.childCount)return t.insertElement("paragraph",e),!0;const n=Array.from(e.getChildren()).filter(e=>e.is("text"));for(const e of n)t.wrap(t.createRangeOn(e),"paragraph");return!!n.length}function Jm(e){return!(!e.position||!e.position.parent.is("tableCell"))&&("insert"==e.type&&"$text"==e.name||"remove"==e.type)}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function Zm(e){e.document.registerPostFixer(()=>function(e){const t=e.document.differ,n=new Set;for(const e of t.getChanges()){const t="insert"==e.type||"remove"==e.type?e.position.parent:e.range.start.parent;t.is("tableCell")&&Qm(t,e.type)&&n.add(t)}if(n.size){for(const e of n.values())t.refreshItem(e);return!0}return!1}(e))}function Qm(e,t){if(!Array.from(e.getChildren()).some(e=>e.is("paragraph")))return!1;if("attribute"==t){const t=Array.from(e.getChild(0).getAttributeKeys()).length;return 1===e.childCount&&t<2}return e.childCount<=("insert"==t?2:1)}n(90);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Ym extends Ll{static get pluginName(){return"TableEditing"}init(){const e=this.editor,t=e.model,n=t.schema,o=e.conversion;n.register("table",{allowWhere:"$block",allowAttributes:["headingRows","headingColumns"],isLimit:!0,isObject:!0,isBlock:!0}),n.register("tableRow",{allowIn:"table",isLimit:!0}),n.register("tableCell",{allowIn:"tableRow",allowAttributes:["colspan","rowspan"],isObject:!0}),n.extend("$block",{allowIn:"tableCell"}),n.addChildCheck((e,t)=>{if("table"==t.name&&Array.from(e.getNames()).includes("table"))return!1}),o.for("upcast").add(Yp()),o.for("editingDowncast").add(lm({asWidget:!0})),o.for("dataDowncast").add(lm()),o.for("upcast").elementToElement({model:"tableRow",view:"tr"}),o.for("editingDowncast").add(dm({asWidget:!0})),o.for("dataDowncast").add(dm()),o.for("downcast").add(e=>e.on("remove:tableRow",(e,t,n)=>{e.stop();const o=n.writer,i=n.mapper,r=i.toViewPosition(t.position).getLastMatchingPosition(e=>!e.item.is("tr")).nodeAfter,s=r.parent,a=o.createRangeOn(r),c=o.remove(a);for(const e of o.createRangeIn(c).getItems())i.unbindViewElement(e);s.childCount||o.remove(o.createRangeOn(s))},{priority:"higher"})),o.for("upcast").add(Xp("td")),o.for("upcast").add(Xp("th")),o.for("editingDowncast").add(um({asWidget:!0})),o.for("dataDowncast").add(um()),o.attributeToAttribute({model:"colspan",view:"colspan"}),o.attributeToAttribute({model:"rowspan",view:"rowspan"}),o.for("editingDowncast").add(fm({asWidget:!0})),o.for("dataDowncast").add(fm()),o.for("editingDowncast").add(hm({asWidget:!0})),o.for("dataDowncast").add(hm()),e.commands.add("insertTable",new Am(e)),e.commands.add("insertTableRowAbove",new Tm(e,{order:"above"})),e.commands.add("insertTableRowBelow",new Tm(e,{order:"below"})),e.commands.add("insertTableColumnLeft",new Pm(e,{order:"left"})),e.commands.add("insertTableColumnRight",new Pm(e,{order:"right"})),e.commands.add("removeTableRow",new Im(e)),e.commands.add("removeTableColumn",new Nm(e)),e.commands.add("splitTableCellVertically",new Em(e,{direction:"vertically"})),e.commands.add("splitTableCellHorizontally",new Em(e,{direction:"horizontally"})),e.commands.add("mergeTableCellRight",new Sm(e,{direction:"right"})),e.commands.add("mergeTableCellLeft",new Sm(e,{direction:"left"})),e.commands.add("mergeTableCellDown",new Sm(e,{direction:"down"})),e.commands.add("mergeTableCellUp",new Sm(e,{direction:"up"})),e.commands.add("setTableColumnHeader",new Dm(e)),e.commands.add("setTableRowHeader",new Mm(e)),qm(t),Zm(t),Um(t),this.editor.keystrokes.set("Tab",(...e)=>this._handleTabOnSelectedTable(...e),{priority:"low"}),this.editor.keystrokes.set("Tab",this._getTabHandler(!0),{priority:"low"}),this.editor.keystrokes.set("Shift+Tab",this._getTabHandler(!1),{priority:"low"})}static get requires(){return[Fm]}_handleTabOnSelectedTable(e,t){const n=this.editor,o=n.model.document.selection;if(!o.isCollapsed&&1===o.rangeCount&&o.getFirstRange().isFlat){const e=o.getSelectedElement();if(!e||!e.is("table"))return;t(),n.model.change(t=>{t.setSelection(t.createRangeIn(e.getChild(0).getChild(0)))})}}_getTabHandler(e){const t=this.editor;return(n,o)=>{const i=sm(t.model.document.selection)[0];if(!i)return;o();const r=i.parent,s=r.parent,a=s.getChildIndex(r),c=r.getChildIndex(i),l=0===c;if(!e&&l&&0===a)return;const d=c===r.childCount-1,u=a===s.childCount-1;if(e&&u&&d&&(t.execute("insertTableRowBelow"),a===s.childCount-1))return;let h;if(e&&d){const e=s.getChild(a+1);h=e.getChild(0)}else if(!e&&l){const e=s.getChild(a-1);h=e.getChild(e.childCount-1)}else h=r.getChild(c+(e?1:-1));t.model.change(e=>{e.setSelection(e.createRangeIn(h))})}}}n(92);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Xm extends il{constructor(e){super(e);const t=this.bindTemplate;this.items=this.createCollection(),this.set("rows",0),this.set("columns",0),this.bind("label").to(this,"columns",this,"rows",(e,t)=>`${t} × ${e}`),this.setTemplate({tag:"div",attributes:{class:["ck"]},children:[{tag:"div",attributes:{class:["ck-insert-table-dropdown__grid"]},children:this.items},{tag:"div",attributes:{class:["ck-insert-table-dropdown__label"]},children:[{text:t.to("label")}]}],on:{mousedown:t.to(e=>{e.preventDefault()}),click:t.to(()=>{this.fire("execute")})}});for(let e=0;e<100;e++){const t=new eg;t.on("over",()=>{const t=Math.floor(e/10),n=e%10;this.set("rows",t+1),this.set("columns",n+1)}),this.items.add(t)}this.on("change:columns",()=>{this._highlightGridBoxes()}),this.on("change:rows",()=>{this._highlightGridBoxes()})}focus(){}focusLast(){}_highlightGridBoxes(){const e=this.rows,t=this.columns;this.items.map((n,o)=>{const i=Math.floor(o/10)<e&&o%10<t;n.set("isOn",i)})}}class eg extends il{constructor(e){super(e);const t=this.bindTemplate;this.set("isOn",!1),this.setTemplate({tag:"div",attributes:{class:["ck-insert-table-dropdown-grid-box",t.if("isOn","ck-on")]},on:{mouseover:t.to("over")}})}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
class tg extends Ll{init(){const e=this.editor,t=this.editor.t,n="ltr"===e.locale.contentLanguageDirection;e.ui.componentFactory.add("insertTable",n=>{const o=e.commands.get("insertTable"),i=Rl(n);let r;return i.bind("isEnabled").to(o),i.buttonView.set({icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 6v3h4V6H3zm0 4v3h4v-3H3zm0 4v3h4v-3H3zm5 3h4v-3H8v3zm5 0h4v-3h-4v3zm4-4v-3h-4v3h4zm0-4V6h-4v3h4zm1.5 8a1.5 1.5 0 0 1-1.5 1.5H3A1.5 1.5 0 0 1 1.5 17V4c.222-.863 1.068-1.5 2-1.5h13c.932 0 1.778.637 2 1.5v13zM12 13v-3H8v3h4zm0-4V6H8v3h4z"/></svg>',label:t("n"),tooltip:!0}),i.on("change:isOpen",()=>{r||(r=new Xm(n),i.panelView.children.add(r),r.delegate("execute").to(i),i.buttonView.on("open",()=>{r.rows=0,r.columns=0}),i.on("execute",()=>{e.execute("insertTable",{rows:r.rows,columns:r.columns}),e.editing.view.focus()}))}),i}),e.ui.componentFactory.add("tableColumn",e=>{const o=[{type:"switchbutton",model:{commandName:"setTableColumnHeader",label:t("o"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:n?"insertTableColumnLeft":"insertTableColumnRight",label:t("p")}},{type:"button",model:{commandName:n?"insertTableColumnRight":"insertTableColumnLeft",label:t("q")}},{type:"button",model:{commandName:"removeTableColumn",label:t("r")}}];return this._prepareDropdown(t("s"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M18 7v1H2V7h16zm0 5v1H2v-1h16z" opacity=".6"/><path d="M14 1v18a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V1a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1zm-2 1H8v4h4V2zm0 6H8v4h4V8zm0 6H8v4h4v-4z"/></svg>',o,e)}),e.ui.componentFactory.add("tableRow",e=>{const n=[{type:"switchbutton",model:{commandName:"setTableRowHeader",label:t("t"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:"insertTableRowBelow",label:t("u")}},{type:"button",model:{commandName:"insertTableRowAbove",label:t("v")}},{type:"button",model:{commandName:"removeTableRow",label:t("w")}}];return this._prepareDropdown(t("x"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M7 2h1v16H7V2zm5 0h1v16h-1V2z" opacity=".6"/><path d="M1 6h18a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H1a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1zm1 2v4h4V8H2zm6 0v4h4V8H8zm6 0v4h4V8h-4z"/></svg>',n,e)}),e.ui.componentFactory.add("mergeTableCells",e=>{const o=[{type:"button",model:{commandName:"mergeTableCellUp",label:t("y")}},{type:"button",model:{commandName:n?"mergeTableCellRight":"mergeTableCellLeft",label:t("z")}},{type:"button",model:{commandName:"mergeTableCellDown",label:t("aa")}},{type:"button",model:{commandName:n?"mergeTableCellLeft":"mergeTableCellRight",label:t("ab")}},{type:"separator"},{type:"button",model:{commandName:"splitTableCellVertically",label:t("ac")}},{type:"button",model:{commandName:"splitTableCellHorizontally",label:t("ad")}}];return this._prepareDropdown(t("ae"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M7 2h1v16H7V2zm5 0h1v7h-1V2zm6 5v1H2V7h16zM8 12v1H2v-1h6z" opacity=".6"/><path d="M7 7h12a1 1 0 0 1 1 1v11a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1zm1 2v9h10V9H8z"/></svg>',o,e)})}_prepareDropdown(e,t,n,o){const i=this.editor,r=Rl(o),s=[],a=new Cn;for(const e of n)ng(e,i,s,a);return Ol(r,a,i.ui.componentFactory),r.buttonView.set({label:e,icon:t,tooltip:!0}),r.bind("isEnabled").toMany(s,"isEnabled",(...e)=>e.some(e=>e)),this.listenTo(r,"execute",e=>{i.execute(e.source.commandName),i.editing.view.focus()}),r}}function ng(e,t,n,o){const i=e.model=new Nh(e.model),{commandName:r,bindIsOn:s}=e.model;if("button"===e.type||"switchbutton"===e.type){const e=t.commands.get(r);n.push(e),i.set({commandName:r}),i.bind("isEnabled").to(e),s&&i.bind("isOn").to(e,"value")}i.set({withText:!0}),o.add(e)}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class og extends Nr{constructor(e){super(e),this.domEventType=["mousemove","mouseup","mouseleave"]}onDomEvent(e){this.fire(e.type,e)}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function ig(e,t,n){const o=Array.from(e),i=o[0],r=o[o.length-1],{row:s,column:a}=t.getCellLocation(i),c=function(e,t,n,o){const i=n.createElement("table"),r=new Map,s=new Map;for(const t of e){const e=$p("tableRow",t);if(!r.has(e)){const t=e._clone();n.append(t,i),r.set(e,t)}const a=t._clone(!0),{column:c}=o.getCellLocation(t);s.set(a,c),n.append(a,r.get(e))}return function(e,t,n,o,i){for(const r of e.getChildren())for(const e of Array.from(r.getChildren())){const{column:r}=i.getCellLocation(e),s=n.get(e)-t;if(r!==s)for(let t=0;t<s-r;t++){const t=o.createElement("tableCell");o.insert(t,o.createPositionBefore(e));const n=o.createElement("paragraph");o.insert(n,t,0),o.insertText("",n,0)}}}(i,t,s,n,o),i}(o,a,n,t),{row:l,column:d}=t.getCellLocation(r);return function(e,t,n,o,i){for(const r of e.getChildren())for(const e of r.getChildren()){const r=parseInt(e.getAttribute("colspan")||1),s=parseInt(e.getAttribute("rowspan")||1),{row:a,column:c}=i.getCellLocation(e);if(c+r>t){const n=t-c;n>1?o.setAttribute("colspan",n,e):o.removeAttribute("colspan",e)}if(a+s>n){const t=n-a;t>1?o.setAttribute("rowspan",t,e):o.removeAttribute("rowspan",e)}}}(c,d-a+1,l-s+1,n,t),function(e,t,n,o,i){const r=parseInt(t.getAttribute("headingRows")||0);if(r>0){const t=r-n;i.setAttribute("headingRows",t,e)}const s=parseInt(t.getAttribute("headingColumns")||0);if(s>0){const t=s-o;i.setAttribute("headingColumns",t,e)}}(c,$p("table",i),s,a,n),c}n(94);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class rg extends Ll{static get pluginName(){return"TableSelection"}static get requires(){return[Fm]}init(){const e=this.editor,t=e.model;this.listenTo(t,"deleteContent",(e,t)=>this._handleDeleteContent(e,t),{priority:"high"}),e.editing.view.addObserver(og),this._defineSelectionConverter(),this._enableShiftClickSelection(),this._enableMouseDragSelection()}getSelectedTableCells(){const e=rm(this.editor.model.document.selection);return 0==e.length?null:e}getSelectionAsFragment(){const e=this.getSelectedTableCells();return e?this.editor.model.change(t=>{const n=t.createDocumentFragment(),o=ig(e,this.editor.plugins.get("TableUtils"),t);return t.insert(o,n,0),n}):null}_defineSelectionConverter(){const e=this.editor,t=new Set;e.conversion.for("editingDowncast").add(e=>e.on("selection",(e,n,o)=>{const i=o.writer;!function(e){for(const n of t)e.removeClass("ck-editor__editable_selected",n);t.clear()}(i);const r=this.getSelectedTableCells();if(!r)return;for(const e of r){const n=o.mapper.toViewElement(e);i.addClass("ck-editor__editable_selected",n),t.add(n)}const s=o.mapper.toViewElement(r[r.length-1]);i.setSelection(s,0)},{priority:"lowest"}))}_enableShiftClickSelection(){const e=this.editor;let t=!1;this.listenTo(e.editing.view.document,"mousedown",(n,o)=>{if(!this.isEnabled)return;if(!o.domEvent.shiftKey)return;const i=sm(e.model.document.selection)[0];if(!i)return;const r=this._getModelTableCellFromDomEvent(o);r&&sg(i,r)&&(t=!0,this._setCellSelection(i,r),o.preventDefault())}),this.listenTo(e.editing.view.document,"mouseup",()=>{t=!1}),this.listenTo(e.editing.view.document,"selectionChange",e=>{t&&e.stop()},{priority:"highest"})}_enableMouseDragSelection(){const e=this.editor;let t,n,o=!1,i=!1;this.listenTo(e.editing.view.document,"mousedown",(e,n)=>{this.isEnabled&&(n.domEvent.shiftKey||n.domEvent.ctrlKey||n.domEvent.altKey||(t=this._getModelTableCellFromDomEvent(n)))}),this.listenTo(e.editing.view.document,"mousemove",(e,r)=>{if(!r.domEvent.buttons)return;if(!t)return;const s=this._getModelTableCellFromDomEvent(r);s&&sg(t,s)&&(n=s,o||n==t||(o=!0)),o&&(i=!0,this._setCellSelection(t,n),r.preventDefault())}),this.listenTo(e.editing.view.document,"mouseup",()=>{o=!1,i=!1,t=null,n=null}),this.listenTo(e.editing.view.document,"selectionChange",e=>{i&&e.stop()},{priority:"highest"})}_handleDeleteContent(e,t){const[n,o]=t,i=this.editor.model,r=!o||"backward"==o.direction,s=rm(n);s.length&&(e.stop(),i.change(e=>{const t=s[r?s.length-1:0];i.change(e=>{for(const t of s)i.deleteContent(e.createSelection(t,"in"))});const o=i.schema.getNearestSelectionRange(e.createPositionAt(t,0));o&&(n.is("documentSelection")?e.setSelection(o):n.setTo(o))}))}_setCellSelection(e,t){const n=this._getCellsToSelect(e,t);this.editor.model.change(e=>{e.setSelection(n.cells.map(t=>e.createRangeOn(t)),{backward:n.backward})})}_getModelTableCellFromDomEvent(e){const t=e.target,n=this.editor.editing.view.createPositionAt(t,0),o=this.editor.editing.mapper.toModelPosition(n).parent;if(o)return o.is("tableCell")?o:$p("tableCell",o)}_getCellsToSelect(e,t){const n=this.editor.plugins.get("TableUtils"),o=n.getCellLocation(e),i=n.getCellLocation(t),r=Math.min(o.row,i.row),s=Math.max(o.row,i.row),a=Math.min(o.column,i.column),c=Math.max(o.column,i.column),l=[];for(const t of new tm($p("table",e),{startRow:r,endRow:s}))t.column>=a&&t.column<=c&&l.push(t.cell);return function(e,t){if(e.row>t.row)return!0;if(e.row==t.row&&e.column>t.column)return!0;return!1}(o,i)?{cells:l.reverse(),backward:!0}:{cells:l,backward:!1}}}function sg(e,t){return e.parent.parent==t.parent.parent}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class ag extends Ll{static get pluginName(){return"TableClipboard"}static get requires(){return[rg]}init(){const e=this.editor.editing.view.document;this.listenTo(e,"copy",(e,t)=>this._onCopyCut(e,t)),this.listenTo(e,"cut",(e,t)=>this._onCopyCut(e,t))}_onCopyCut(e,t){const n=this.editor.plugins.get("TableSelection");if(!n.getSelectedTableCells())return;if("cut"==e.name&&this.editor.isReadOnly)return;t.preventDefault(),e.stop();const o=this.editor.data,i=this.editor.editing.view.document,r=o.toView(n.getSelectionAsFragment());i.fire("clipboardOutput",{dataTransfer:t.dataTransfer,content:r,method:e.name})}}n(96);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
const cg=/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,lg=/^rgb\([ ]?([0-9]{1,3}[ %]?,[ ]?){2,3}[0-9]{1,3}[ %]?\)$/i,dg=/^rgba\([ ]?([0-9]{1,3}[ %]?,[ ]?){3}(1|[0-9]+%|[0]?\.?[0-9]+)\)$/i,ug=/^hsl\([ ]?([0-9]{1,3}[ %]?[,]?[ ]*){3}(1|[0-9]+%|[0]?\.?[0-9]+)?\)$/i,hg=/^hsla\([ ]?([0-9]{1,3}[ %]?,[ ]?){2,3}(1|[0-9]+%|[0]?\.?[0-9]+)\)$/i,fg=new Set(["black","silver","gray","white","maroon","red","purple","fuchsia","green","lime","olive","yellow","navy","blue","teal","aqua","orange","aliceblue","antiquewhite","aquamarine","azure","beige","bisque","blanchedalmond","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","gainsboro","ghostwhite","gold","goldenrod","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","limegreen","linen","magenta","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","oldlace","olivedrab","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","thistle","tomato","turquoise","violet","wheat","whitesmoke","yellowgreen","rebeccapurple","currentcolor","transparent"]);function pg(e){return e.startsWith("#")?cg.test(e):e.startsWith("rgb")?lg.test(e)||dg.test(e):e.startsWith("hsl")?ug.test(e)||hg.test(e):fg.has(e.toLowerCase())}const mg=["none","hidden","dotted","dashed","solid","double","groove","ridge","inset","outset"];function gg(e){return mg.includes(e)}const bg=/^([+-]?[0-9]*[.]?[0-9]+(px|cm|mm|in|pc|pt|ch|em|ex|rem|vh|vw|vmin|vmax)|0)$/;function wg(e){return bg.test(e)}const kg=/^[+-]?[0-9]*[.]?[0-9]+%$/;const _g=["repeat-x","repeat-y","repeat","space","round","no-repeat"];const vg=["center","top","bottom","left","right"];function yg(e){return vg.includes(e)}const xg=["fixed","scroll","local"];function Cg(e){return xg.includes(e)}const Ag=/^url\(/;function Tg(e){return Ag.test(e)}function Pg(e=""){if(""===e)return{top:void 0,right:void 0,bottom:void 0,left:void 0};const t=Rg(e),n=t[0],o=t[2]||n,i=t[1]||n;return{top:n,bottom:o,right:i,left:t[3]||i}}function Eg(e){return t=>{const{top:n,right:o,bottom:i,left:r}=t,s=[];return[n,o,r,i].every(e=>!!e)?s.push([e,Sg(t)]):(n&&s.push([e+"-top",n]),o&&s.push([e+"-right",o]),i&&s.push([e+"-bottom",i]),r&&s.push([e+"-left",r])),s}}function Sg({top:e,right:t,bottom:n,left:o}){const i=[];return o!==t?i.push(e,t,n,o):n!==e?i.push(e,t,n):t!==e?i.push(e,t):i.push(e),i.join(" ")}function Rg(e){return e.replace(/, /g,",").split(" ").map(e=>e.replace(/,/g,", "))}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function Ig(e){e.setNormalizer("border",Og),e.setNormalizer("border-top",Ng("top")),e.setNormalizer("border-right",Ng("right")),e.setNormalizer("border-bottom",Ng("bottom")),e.setNormalizer("border-left",Ng("left")),e.setNormalizer("border-color",Mg("color")),e.setNormalizer("border-width",Mg("width")),e.setNormalizer("border-style",Mg("style")),e.setNormalizer("border-top-color",Dg("color","top")),e.setNormalizer("border-top-style",Dg("style","top")),e.setNormalizer("border-top-width",Dg("width","top")),e.setNormalizer("border-right-color",Dg("color","right")),e.setNormalizer("border-right-style",Dg("style","right")),e.setNormalizer("border-right-width",Dg("width","right")),e.setNormalizer("border-bottom-color",Dg("color","bottom")),e.setNormalizer("border-bottom-style",Dg("style","bottom")),e.setNormalizer("border-bottom-width",Dg("width","bottom")),e.setNormalizer("border-left-color",Dg("color","left")),e.setNormalizer("border-left-style",Dg("style","left")),e.setNormalizer("border-left-width",Dg("width","left")),e.setExtractor("border-top",Fg("top")),e.setExtractor("border-right",Fg("right")),e.setExtractor("border-bottom",Fg("bottom")),e.setExtractor("border-left",Fg("left")),e.setExtractor("border-top-color","border.color.top"),e.setExtractor("border-right-color","border.color.right"),e.setExtractor("border-bottom-color","border.color.bottom"),e.setExtractor("border-left-color","border.color.left"),e.setExtractor("border-top-width","border.width.top"),e.setExtractor("border-right-width","border.width.right"),e.setExtractor("border-bottom-width","border.width.bottom"),e.setExtractor("border-left-width","border.width.left"),e.setExtractor("border-top-style","border.style.top"),e.setExtractor("border-right-style","border.style.right"),e.setExtractor("border-bottom-style","border.style.bottom"),e.setExtractor("border-left-style","border.style.left"),e.setReducer("border-color",Eg("border-color")),e.setReducer("border-style",Eg("border-style")),e.setReducer("border-width",Eg("border-width")),e.setReducer("border-top",qg("top")),e.setReducer("border-right",qg("right")),e.setReducer("border-bottom",qg("bottom")),e.setReducer("border-left",qg("left")),e.setReducer("border",zg),e.setStyleRelation("border",["border-color","border-style","border-width","border-top","border-right","border-bottom","border-left","border-top-color","border-right-color","border-bottom-color","border-left-color","border-top-style","border-right-style","border-bottom-style","border-left-style","border-top-width","border-right-width","border-bottom-width","border-left-width"]),e.setStyleRelation("border-color",["border-top-color","border-right-color","border-bottom-color","border-left-color"]),e.setStyleRelation("border-style",["border-top-style","border-right-style","border-bottom-style","border-left-style"]),e.setStyleRelation("border-width",["border-top-width","border-right-width","border-bottom-width","border-left-width"]),e.setStyleRelation("border-top",["border-top-color","border-top-style","border-top-width"]),e.setStyleRelation("border-right",["border-right-color","border-right-style","border-right-width"]),e.setStyleRelation("border-bottom",["border-bottom-color","border-bottom-style","border-bottom-width"]),e.setStyleRelation("border-left",["border-left-color","border-left-style","border-left-width"])}function Og(e){const{color:t,style:n,width:o}=Lg(e);return{path:"border",value:{color:Pg(t),style:Pg(n),width:Pg(o)}}}function Ng(e){return t=>{const{color:n,style:o,width:i}=Lg(t),r={};return void 0!==n&&(r.color={[e]:n}),void 0!==o&&(r.style={[e]:o}),void 0!==i&&(r.width={[e]:i}),{path:"border",value:r}}}function Mg(e){return t=>({path:"border",value:Vg(t,e)})}function Vg(e,t){return{[t]:Pg(e)}}function Dg(e,t){return n=>({path:"border",value:{[e]:{[t]:n}}})}function Fg(e){return(t,n)=>{if(n.border)return Bg(n.border,e)}}function Bg(e,t){const n={};return e.width&&e.width[t]&&(n.width=e.width[t]),e.style&&e.style[t]&&(n.style=e.style[t]),e.color&&e.color[t]&&(n.color=e.color[t]),n}function Lg(e){const t={},n=Rg(e);for(const e of n)wg(e)||/thin|medium|thick/.test(e)?t.width=e:gg(e)?t.style=e:t.color=e;return t}function zg(e){const t=[];return t.push(...jg(Bg(e,"top"),"top")),t.push(...jg(Bg(e,"right"),"right")),t.push(...jg(Bg(e,"bottom"),"bottom")),t.push(...jg(Bg(e,"left"),"left")),t}function qg(e){return t=>jg(t,e)}function jg(e,t){const n=[];return e&&void 0!==e.width&&n.push(e.width),e&&void 0!==e.style&&n.push(e.style),e&&void 0!==e.color&&n.push(e.color),n.length?[[`border-${t}`,n.join(" ")]]:[]}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function Hg(e){e.setNormalizer("background",Wg),e.setNormalizer("background-color",e=>({path:"background.color",value:e})),e.setReducer("background",e=>{const t=[];return t.push(["background-color",e.color]),t})}function Wg(e){const t={},n=Rg(e);for(const e of n)o=e,_g.includes(o)?(t.repeat=t.repeat||[],t.repeat.push(e)):yg(e)?(t.position=t.position||[],t.position.push(e)):Cg(e)?t.attachment=e:pg(e)?t.color=e:Tg(e)&&(t.image=e);var o;return{path:"background",value:t}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function Ug(e,t,n,o){e.for("upcast").attributeToAttribute({view:{styles:{[o]:/[\s\S]+/}},model:{name:t,key:n,value:e=>e.getNormalizedStyle(o)}})}function $g(e,t){e.for("upcast").add(e=>e.on("element:"+t,(e,t,n)=>{const o=["border-top","border-right","border-bottom","border-left"].filter(e=>t.viewItem.hasStyle(e));if(!o.length)return;const i={styles:o};if(!n.consumable.test(t.viewItem,i))return;t.modelRange||(t=Object.assign(t,n.convertChildren(t.viewItem,t.modelCursor)));const r=[...t.modelRange.getItems({shallow:!0})].pop();n.consumable.consume(t.viewItem,i),n.writer.setAttribute("borderStyle",t.viewItem.getNormalizedStyle("border-style"),r),n.writer.setAttribute("borderColor",t.viewItem.getNormalizedStyle("border-color"),r),n.writer.setAttribute("borderWidth",t.viewItem.getNormalizedStyle("border-width"),r)}))}function Gg(e,t,n,o){e.for("downcast").attributeToAttribute({model:{name:t,key:n},view:e=>({key:"style",value:{[o]:e}})})}function Kg(e,t,n){e.for("downcast").add(e=>e.on(`attribute:${t}:table`,(e,t,o)=>{const{item:i,attributeNewValue:r}=t,{mapper:s,writer:a}=o;if(!o.consumable.consume(t.item,e.name))return;const c=[...s.toViewElement(i).getChildren()].find(e=>e.is("table"));r?a.setStyle(n,r,c):a.removeStyle(n,c)}))}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Jg extends nu{constructor(e,t){super(e),this.attributeName=t}refresh(){const e=$p("table",this.editor.model.document.selection.getFirstPosition());this.isEnabled=!!e,this.value=this._getValue(e)}execute(e={}){const t=this.editor.model,n=t.document.selection,{value:o,batch:i}=e,r=$p("table",n.getFirstPosition()),s=this._getValueToSet(o);t.enqueueChange(i||"default",e=>{s?e.setAttribute(this.attributeName,s,r):e.removeAttribute(this.attributeName,r)})}_getValue(e){if(e)return e.getAttribute(this.attributeName)}_getValueToSet(e){return e}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Zg extends Jg{constructor(e){super(e,"backgroundColor")}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Qg extends Jg{constructor(e){super(e,"borderColor")}_getValue(e){if(e)return Jp(e.getAttribute(this.attributeName))}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Yg extends Jg{constructor(e){super(e,"borderStyle")}_getValue(e){if(e)return Jp(e.getAttribute(this.attributeName))}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Xg extends Jg{constructor(e){super(e,"borderWidth")}_getValue(e){if(e)return Jp(e.getAttribute(this.attributeName))}_getValueToSet(e){return Zp(e,"px")}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class eb extends Jg{constructor(e){super(e,"width")}_getValueToSet(e){return Zp(e,"px")}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class tb extends Jg{constructor(e){super(e,"height")}_getValueToSet(e){return Zp(e,"px")}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class nb extends Jg{constructor(e){super(e,"alignment")}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/const ob=/^(left|right)$/;class ib extends Ll{static get pluginName(){return"TablePropertiesEditing"}static get requires(){return[Ym]}init(){const e=this.editor,t=e.model.schema,n=e.conversion;e.data.addStyleProcessorRules(Ig),function(e,t){e.extend("table",{allowAttributes:["borderWidth","borderColor","borderStyle"]}),$g(t,"table"),Kg(t,"borderColor","border-color"),Kg(t,"borderStyle","border-style"),Kg(t,"borderWidth","border-width")}(t,n),e.commands.add("tableBorderColor",new Qg(e)),e.commands.add("tableBorderStyle",new Yg(e)),e.commands.add("tableBorderWidth",new Xg(e)),function(e,t){e.extend("table",{allowAttributes:["alignment"]}),t.attributeToAttribute({model:{name:"table",key:"alignment",values:["left","right"]},view:{left:{key:"style",value:{float:"left"}},right:{key:"style",value:{float:"right"}}},converterPriority:"high"}),t.for("upcast").attributeToAttribute({view:{attributes:{align:ob}},model:{name:"table",key:"alignment",value:e=>e.getAttribute("align")}})}(t,n),e.commands.add("tableAlignment",new nb(e)),rb(t,n,"width","width"),e.commands.add("tableWidth",new eb(e)),rb(t,n,"height","height"),e.commands.add("tableHeight",new tb(e)),e.data.addStyleProcessorRules(Hg),function(e,t,n,o){e.extend("table",{allowAttributes:[n]}),Ug(t,"table",n,o),Kg(t,n,o)}(t,n,"backgroundColor","background-color"),e.commands.add("tableBackgroundColor",new Zg(e))}}function rb(e,t,n,o){e.extend("table",{allowAttributes:[n]}),Ug(t,"table",n,o),Gg(t,"table",n,o)}n(98);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class sb extends il{constructor(e,t){super(e);const n=`ck-labeled-view-${un()}`,o=`ck-labeled-view-status-${un()}`;this.view=t(this,n,o),this.set("label"),this.set("isEnabled",!0),this.set("errorText",null),this.set("infoText",null),this.set("class"),this.labelView=this._createLabelView(n),this.statusView=this._createStatusView(o),this.bind("_statusText").to(this,"errorText",this,"infoText",(e,t)=>e||t);const i=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-view",i.to("class"),i.if("isEnabled","ck-disabled",e=>!e)]},children:[this.labelView,this.view,this.statusView]})}_createLabelView(e){const t=new jh(this.locale);return t.for=e,t.bind("text").to(this,"label"),t}_createStatusView(e){const t=new il(this.locale),n=this.bindTemplate;return t.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-view__status",n.if("errorText","ck-labeled-view__status_error"),n.if("_statusText","ck-hidden",e=>!e)],id:e,role:n.if("errorText","alert")},children:[{text:n.to("_statusText")}]}),t}focus(){this.view.focus()}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function ab(e,t,n){const o=new Wh(e.locale);return o.set({id:t,ariaDescribedById:n}),o.bind("isReadOnly").to(e,"isEnabled",e=>!e),o.bind("hasError").to(e,"errorText",e=>!!e),o.on("input",()=>{e.errorText=null}),o}function cb(e,t,n){const o=Rl(e.locale);return o.set({id:t,ariaDescribedById:n}),o.bind("isEnabled").to(e),o}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
class lb extends xl{constructor(e){super(e);const t=this.bindTemplate;this.set("color"),this.set("hasBorder"),this.icon='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path class="ck-icon__fill" d="M16.935 5.328a2 2 0 0 1 0 2.829l-7.778 7.778a2 2 0 0 1-2.829 0L3.5 13.107a1.999 1.999 0 1 1 2.828-2.829l.707.707a1 1 0 0 0 1.414 0l5.658-5.657a2 2 0 0 1 2.828 0z"/><path d="M14.814 6.035L8.448 12.4a1 1 0 0 1-1.414 0l-1.413-1.415A1 1 0 1 0 4.207 12.4l2.829 2.829a1 1 0 0 0 1.414 0l7.778-7.778a1 1 0 1 0-1.414-1.415z"/></svg>',this.extendTemplate({attributes:{style:{backgroundColor:t.to("color")},class:["ck","ck-color-grid__tile",t.if("hasBorder","ck-color-table__color-tile_bordered")]}})}render(){super.render(),this.iconView.fillColor="hsl(0, 0%, 100%)"}}n(100);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class db extends il{constructor(e,t){super(e);const n=t&&t.colorDefinitions||[],o={};t&&t.columns&&(o.gridTemplateColumns=`repeat( ${t.columns}, 1fr)`),this.set("selectedColor"),this.items=this.createCollection(),this.focusTracker=new Rc,this.keystrokes=new yc,this._focusCycler=new ul({focusables:this.items,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"arrowleft",focusNext:"arrowright"}}),this.items.on("add",(e,t)=>{t.isOn=t.color===this.selectedColor}),n.forEach(e=>{const t=new lb;t.set({color:e.color,label:e.label,tooltip:!0,hasBorder:e.options.hasBorder}),t.on("execute",()=>{this.fire("execute",{value:e.color,hasBorder:e.options.hasBorder,label:e.label})}),this.items.add(t)}),this.setTemplate({tag:"div",children:this.items,attributes:{class:["ck","ck-color-grid"],style:o}}),this.on("change:selectedColor",(e,t,n)=>{for(const e of this.items)e.isOn=e.color===n})}focus(){this.items.length&&this.items.first.focus()}focusLast(){this.items.length&&this.items.last.focus()}render(){super.render();for(const e of this.items)this.focusTracker.add(e.element);this.items.on("add",(e,t)=>{this.focusTracker.add(t.element)}),this.items.on("remove",(e,t)=>{this.focusTracker.remove(t.element)}),this.keystrokes.listenTo(this.element)}}n(102);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
class ub extends il{constructor(e,t){super(e);const n=this.bindTemplate;this.set("value",""),this.set("id"),this.set("isReadOnly",!1),this.set("hasError",!1),this.set("ariaDescribedById"),this.options=t,this._dropdownView=this._createDropdownView(e),this._inputView=this._createInputTextView(e),this.setTemplate({tag:"div",attributes:{class:["ck","ck-input-color",n.if("hasError","ck-error")],id:n.to("id"),"aria-invalid":n.if("hasError",!0),"aria-describedby":n.to("ariaDescribedById")},children:[this._inputView,this._dropdownView]})}focus(){this._inputView.focus()}_createDropdownView(){const e=this.locale,t=this.bindTemplate,n=this._createColorGrid(e),o=Rl(e),i=new il,r=this._createRemoveColorButton(e);return i.setTemplate({tag:"span",attributes:{class:["ck","ck-input-color__button__preview"],style:{backgroundColor:t.to("value")}},children:[{tag:"span",attributes:{class:["ck","ck-input-color__button__preview__no-color-indicator",t.if("value","ck-hidden",e=>""!=e)]}}]}),o.buttonView.extendTemplate({attributes:{class:"ck-input-color__button"}}),o.buttonView.children.add(i),o.panelPosition="rtl"===e.uiLanguageDirection?"se":"sw",o.panelView.children.add(r),o.panelView.children.add(n),o.bind("isEnabled").to(this,"isReadOnly",e=>!e),o}_createInputTextView(){const e=this.locale,t=new Wh(e);return t.bind("value").to(this),t.bind("isReadOnly").to(this),t.bind("hasError").to(this),t.on("input",()=>{this.value=t.element.value}),t.delegate("input").to(this),t}_createRemoveColorButton(){const e=this.locale,t=e.t,n=new xl(e);return n.class="ck-input-color__remove-color",n.withText=!0,n.icon='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M8.636 9.531l-2.758 3.94a.5.5 0 0 0 .122.696l3.224 2.284h1.314l2.636-3.736L8.636 9.53zm.288 8.451L5.14 15.396a2 2 0 0 1-.491-2.786l6.673-9.53a2 2 0 0 1 2.785-.49l3.742 2.62a2 2 0 0 1 .491 2.785l-7.269 10.053-2.147-.066z"/><path d="M4 18h5.523v-1H4zm-2 0h1v-1H2z"/></svg>',n.label=t("dp"),n.on("execute",()=>{this.value="",this._dropdownView.isOpen=!1,this.fire("input")}),n}_createColorGrid(e){const t=new db(e,{colorDefinitions:this.options.colorDefinitions,columns:this.options.columns});return t.on("execute",(e,t)=>{this.value=t.value,this._dropdownView.isOpen=!1,this.fire("input")}),t.bind("selectedColor").to(this,"value"),t}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/const hb=hd.defaultPositions,fb=[hb.northArrowSouth,hb.northArrowSouthWest,hb.northArrowSouthEast,hb.southArrowNorth,hb.southArrowNorthWest,hb.southArrowNorthEast],pb=e=>""===e;function mb(e,t){const n=e.plugins.get("ContextualBalloon");if(im(e.editing.view.document.selection)){let o;o="cell"===t?bb(e):gb(e),n.updatePosition(o)}}function gb(e){const t=$p("table",e.model.document.selection.getFirstPosition()),n=e.editing.mapper.toViewElement(t);return{target:e.editing.view.domConverter.viewToDom(n),positions:fb}}function bb(e){const t=(n=e.model.document.selection.getFirstPosition()).nodeAfter&&n.nodeAfter.is("tableCell")?n.nodeAfter:$p("tableCell",n);var n;const o=e.editing.mapper.toViewElement(t);return{target:e.editing.view.domConverter.viewToDom(o),positions:fb}}function wb(e){return{none:e("bp"),solid:e("bq"),dotted:e("br"),dashed:e("bs"),double:e("bt"),groove:e("bu"),ridge:e("bv"),inset:e("bw"),outset:e("bx")}}function kb(e){return e("by")}function _b(e){return e("bz")}function vb(e){return e=e.trim(),pb(e)||pg(e)}function yb(e){return e=e.trim(),pb(e)||Eb(e)||wg(e)||(t=e,kg.test(t));var t}function xb(e){return e=e.trim(),pb(e)||Eb(e)||wg(e)}function Cb(e){const t=new Cn,n=wb(e.t);for(const o in n){const i={type:"button",model:new Nh({_borderStyleValue:"none"===o?"":o,label:n[o],withText:!0})};"none"===o?i.model.bind("isOn").to(e,"borderStyle",e=>!e):i.model.bind("isOn").to(e,"borderStyle",e=>e===o),t.add(i)}return t}function Ab({view:e,icons:t,toolbar:n,labels:o,propertyName:i,nameToValue:r}){for(const s in o){const a=new xl(e.locale);a.set({label:o[s],icon:t[s]}),a.bind("isOn").to(e,i,e=>e===r(s)),a.on("execute",()=>{e[i]=r(s)}),n.items.add(a)}}const Tb=[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}];function Pb(e){return(t,n,o)=>{const i=new ub(t.locale,{colorDefinitions:(r=e.colorConfig,r.map(e=>({color:e.model,label:e.label,options:{hasBorder:e.hasBorder}}))),columns:e.columns});var r;return i.set({id:n,ariaDescribedById:o}),i.bind("isReadOnly").to(t,"isEnabled",e=>!e),i.bind("errorText").to(t),i.on("input",()=>{t.errorText=null}),i}}function Eb(e){const t=parseFloat(e);return!Number.isNaN(t)&&e===String(t)}n(104);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Sb extends il{constructor(e,t={}){super(e);const n=this.bindTemplate;this.set("class",t.class||null),this.children=this.createCollection(),t.children&&t.children.forEach(e=>this.children.add(e)),this.set("_role",null),this.set("_ariaLabelledBy",null),t.labelView&&this.set({_role:"group",_ariaLabelledBy:t.labelView.id}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-form__row",n.to("class")],role:n.to("_role"),"aria-labelledby":n.to("_ariaLabelledBy")},children:this.children})}}n(106);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Rb extends il{constructor(e,t={}){super(e);const n=this.bindTemplate;this.children=this.createCollection(),this.set("class",t.class||null),this.set("label",t.label||"");const o=new il(e);o.setTemplate({tag:"span",attributes:{class:["ck","ck-form__header__label"]},children:[{text:n.to("label")}]}),this.children.add(o),this.setTemplate({tag:"div",attributes:{class:["ck","ck-form__header",n.to("class")]},children:this.children})}}n(17),n(18),n(110);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
const Ib={left:lf,center:df,right:uf};class Ob extends il{constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",alignment:""}),this.options=t;const{borderStyleDropdown:n,borderWidthInput:o,borderColorInput:i,borderRowLabel:r}=this._createBorderFields(),{widthInput:s,operatorLabel:a,heightInput:c,dimensionsLabel:l}=this._createDimensionFields(),{alignmentToolbar:d,alignmentLabel:u}=this._createAlignmentFields();this.focusTracker=new Rc,this.keystrokes=new yc,this.children=this.createCollection(),this.borderStyleDropdown=n,this.borderWidthInput=o,this.borderColorInput=i,this.backgroundInput=this._createBackgroundField(),this.widthInput=s,this.heightInput=c,this.alignmentToolbar=d;const{saveButtonView:h,cancelButtonView:f}=this._createActionButtons();this.saveButtonView=h,this.cancelButtonView=f,this._focusables=new Bc,this._focusCycler=new ul({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.add(new Rb(e,{label:this.t("Table properties")})),this.children.add(new Sb(e,{labelView:r,children:[r,n,i,o],class:"ck-table-form__border-row"})),this.children.add(new Sb(e,{children:[this.backgroundInput]})),this.children.add(new Sb(e,{children:[new Sb(e,{labelView:l,children:[l,s,a,c],class:"ck-table-form__dimensions-row"}),new Sb(e,{labelView:u,children:[u,d],class:"ck-table-properties-form__alignment-row"})]})),this.children.add(new Sb(e,{children:[this.saveButtonView,this.cancelButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-properties-form"],tabindex:"-1"},children:this.children})}render(){super.render(),Uh({view:this}),[this.borderStyleDropdown,this.borderColorInput,this.borderWidthInput,this.backgroundInput,this.widthInput,this.heightInput,this.alignmentToolbar,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}focus(){this._focusCycler.focusFirst()}_createBorderFields(){const e=Pb({colorConfig:this.options.borderColors,columns:5}),t=this.locale,n=this.t,o=new jh(t);o.text=n("ca");const i=wb(this.t),r=new sb(t,cb);r.set({label:n("cb"),class:"ck-table-form__border-style"}),r.view.buttonView.set({isOn:!1,withText:!0,tooltip:n("cb")}),r.view.buttonView.bind("label").to(this,"borderStyle",e=>i[e||"none"]),r.view.on("execute",e=>{this.borderStyle=e.source._borderStyleValue}),Ol(r.view,Cb(this));const s=new sb(t,ab);s.set({label:n("cc"),class:"ck-table-form__border-width"}),s.view.bind("value").to(this,"borderWidth"),s.bind("isEnabled").to(this,"borderStyle",Nb),s.view.on("input",()=>{this.borderWidth=s.view.element.value});const a=new sb(t,e);return a.set({label:n("cd"),class:"ck-table-form__border-color"}),a.view.bind("value").to(this,"borderColor"),a.bind("isEnabled").to(this,"borderStyle",Nb),a.view.on("input",()=>{this.borderColor=a.view.value}),this.on("change:borderStyle",(e,t,n)=>{Nb(n)||(this.borderColor="",this.borderWidth="")}),{borderRowLabel:o,borderStyleDropdown:r,borderColorInput:a,borderWidthInput:s}}_createBackgroundField(){const e=Pb({colorConfig:this.options.backgroundColors,columns:5}),t=this.locale,n=this.t,o=new sb(t,e);return o.set({label:n("ce"),class:"ck-table-properties-form__background"}),o.view.bind("value").to(this,"backgroundColor"),o.view.on("input",()=>{this.backgroundColor=o.view.value}),o}_createDimensionFields(){const e=this.locale,t=this.t,n=new jh(e);n.text=t("cf");const o=new sb(e,ab);o.set({label:t("cc"),class:"ck-table-form__dimensions-row__width"}),o.view.bind("value").to(this,"width"),o.view.on("input",()=>{this.width=o.view.element.value});const i=new il(e);i.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const r=new sb(e,ab);return r.set({label:t("cg"),class:"ck-table-form__dimensions-row__height"}),r.view.bind("value").to(this,"height"),r.view.on("input",()=>{this.height=r.view.element.value}),{dimensionsLabel:n,widthInput:o,operatorLabel:i,heightInput:r}}_createAlignmentFields(){const e=this.locale,t=this.t,n=new jh(e);n.text=t("ch");const o=new Nl(e);return o.set({isCompact:!0,ariaLabel:t("ci")}),Ab({view:this,icons:Ib,toolbar:o,labels:this._alignmentLabels,propertyName:"alignment",nameToValue:e=>"center"===e?"":e}),{alignmentLabel:n,alignmentToolbar:o}}_createActionButtons(){const e=this.locale,t=this.t,n=new xl(e),o=new xl(e),i=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.widthInput,this.heightInput];return n.set({label:t("bm"),icon:$h,class:"ck-button-save",type:"submit",withText:!0}),n.bind("isEnabled").toMany(i,"errorText",(...e)=>e.every(e=>!e)),o.set({label:t("bn"),icon:Gh,class:"ck-button-cancel",type:"cancel",withText:!0}),o.delegate("execute").to(this,"cancel"),{saveButtonView:n,cancelButtonView:o}}get _alignmentLabels(){const e=this.locale,t=this.t,n=t("cj"),o=t("ck"),i=t("cl");return"rtl"===e.uiLanguageDirection?{right:i,center:o,left:n}:{left:n,center:o,right:i}}}function Nb(e){return!!e}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
function Mb(e,t){const n=e.t,o={Black:n("ar"),"Dim grey":n("as"),Grey:n("at"),"Light grey":n("au"),White:n("av"),Red:n("aw"),Orange:n("ax"),Yellow:n("ay"),"Light green":n("az"),Green:n("ba"),Aquamarine:n("bb"),Turquoise:n("bc"),"Light blue":n("bd"),Blue:n("be"),Purple:n("bf")};return t.map(e=>{const t=o[e.label];return t&&t!=e.label&&(e.label=t),e})}function Vb(e){return e.map(Db).filter(e=>!!e)}function Db(e){return"string"==typeof e?{model:e.replace(/ /g,""),label:e,hasBorder:!1,view:{name:"span",styles:{color:e}}}:{model:e.color.replace(/ /g,""),label:e.label||e.color,hasBorder:void 0!==e.hasBorder&&e.hasBorder,view:{name:"span",styles:{color:`${e.color}`}}}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Fb extends Ll{static get requires(){return[bd]}static get pluginName(){return"TablePropertiesUI"}constructor(e){super(e),e.config.define("table.tableProperties",{borderColors:Tb,backgroundColors:Tb})}init(){const e=this.editor,t=e.t;this._balloon=e.plugins.get(bd),this.view=this._createPropertiesView(),this._undoStepBatch=null,e.ui.componentFactory.add("tableProperties",e=>{const n=new xl(e);return n.set({label:t("af"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M8 2v5h4V2h1v5h5v1h-5v4h.021l-.172.351-1.916.28-.151.027c-.287.063-.54.182-.755.341L8 13v5H7v-5H2v-1h5V8H2V7h5V2h1zm4 6H8v4h4V8z" opacity=".6"/><path d="M15.5 11.5l1.323 2.68 2.957.43-2.14 2.085.505 2.946L15.5 18.25l-2.645 1.39.505-2.945-2.14-2.086 2.957-.43L15.5 11.5zM17 1a2 2 0 0 1 2 2v9.475l-.85-.124-.857-1.736a2.048 2.048 0 0 0-.292-.44L17 3H3v14h7.808l.402.392L10.935 19H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h14z"/></svg>',tooltip:!0}),this.listenTo(n,"execute",()=>this._showView()),n})}destroy(){super.destroy(),this.view.destroy()}_createPropertiesView(){const e=this.editor,t=e.editing.view.document,n=e.config.get("table.tableProperties"),o=Vb(n.borderColors),i=Mb(e.locale,o),r=Vb(n.backgroundColors),s=Mb(e.locale,r),a=new Ob(e.locale,{borderColors:i,backgroundColors:s}),c=e.t;a.render(),this.listenTo(a,"submit",()=>{this._hideView()}),this.listenTo(a,"cancel",()=>{this._undoStepBatch.operations.length&&e.execute("undo",this._undoStepBatch),this._hideView()}),a.keystrokes.set("Esc",(e,t)=>{this._hideView(),t()}),this.listenTo(e.ui,"update",()=>{im(t.selection)?this._isViewVisible&&mb(e,"table"):this._hideView()}),Sl({emitter:a,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const l=kb(c),d=_b(c);return a.on("change:borderStyle",this._getPropertyChangeCallback("tableBorderStyle")),a.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:a.borderColorInput,commandName:"tableBorderColor",errorText:l,validator:vb})),a.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:a.borderWidthInput,commandName:"tableBorderWidth",errorText:d,validator:xb})),a.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:a.backgroundInput,commandName:"tableBackgroundColor",errorText:l,validator:vb})),a.on("change:width",this._getValidatedPropertyChangeCallback({viewField:a.widthInput,commandName:"tableWidth",errorText:d,validator:yb})),a.on("change:height",this._getValidatedPropertyChangeCallback({viewField:a.heightInput,commandName:"tableHeight",errorText:d,validator:yb})),a.on("change:alignment",this._getPropertyChangeCallback("tableAlignment")),a}_fillViewFormFromCommandValues(){const e=this.editor.commands;this.view.set({borderStyle:e.get("tableBorderStyle").value||"",borderColor:e.get("tableBorderColor").value||"",borderWidth:e.get("tableBorderWidth").value||"",backgroundColor:e.get("tableBackgroundColor").value||"",width:e.get("tableWidth").value||"",height:e.get("tableHeight").value||"",alignment:e.get("tableAlignment").value||""})}_showView(){const e=this.editor;this._balloon.add({view:this.view,position:gb(e)}),this._undoStepBatch=e.model.createBatch(),this._fillViewFormFromCommandValues(),this.view.focus()}_hideView(){if(!this._isViewInBalloon)return;const e=this.editor;this.stopListening(e.ui,"update"),this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}get _isViewVisible(){return this._balloon.visibleView===this.view}get _isViewInBalloon(){return this._balloon.hasView(this.view)}_getPropertyChangeCallback(e){return(t,n,o)=>{this.editor.execute(e,{value:o,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback({commandName:e,viewField:t,validator:n,errorText:o}){const i=Wr(()=>{t.errorText=o},500);return(o,r,s)=>{i.cancel(),n(s)?(this.editor.execute(e,{value:s,batch:this._undoStepBatch}),t.errorText=null):i()}}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/n(112);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
const Bb={left:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 4c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0-8c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75z"/></svg>',center:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm2.286 4c0 .414.336.75.75.75h9.928a.75.75 0 1 0 0-1.5H5.036a.75.75 0 0 0-.75.75zm0-8c0 .414.336.75.75.75h9.928a.75.75 0 1 0 0-1.5H5.036a.75.75 0 0 0-.75.75z"/></svg>',right:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M18 3.75a.75.75 0 0 1-.75.75H2.75a.75.75 0 1 1 0-1.5h14.5a.75.75 0 0 1 .75.75zm0 8a.75.75 0 0 1-.75.75H2.75a.75.75 0 1 1 0-1.5h14.5a.75.75 0 0 1 .75.75zm0 4a.75.75 0 0 1-.75.75H7.321a.75.75 0 1 1 0-1.5h9.929a.75.75 0 0 1 .75.75zm0-8a.75.75 0 0 1-.75.75H7.321a.75.75 0 1 1 0-1.5h9.929a.75.75 0 0 1 .75.75z"/></svg>',justify:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 4c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0-8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75z"/></svg>',top:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.261 7.062l2.88 1.663a.75.75 0 0 1-.75 1.3L10.5 8.933v7.317a.75.75 0 1 1-1.5 0V8.932l-1.89 1.093a.75.75 0 0 1-.75-1.3l2.879-1.663a.752.752 0 0 1 .511-.187.752.752 0 0 1 .511.187zM15.25 4a.75.75 0 1 1 0 1.5H4.75a.75.75 0 0 1 0-1.5h10.5z"/></svg>',middle:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M9.75 11.875a.752.752 0 0 1 .508.184l2.883 1.666a.75.75 0 0 1-.659 1.344l-.091-.044-1.892-1.093.001 4.318a.75.75 0 1 1-1.5 0v-4.317l-1.89 1.092a.75.75 0 0 1-.75-1.3l2.879-1.663a.752.752 0 0 1 .51-.187zM15.25 9a.75.75 0 1 1 0 1.5H4.75a.75.75 0 1 1 0-1.5h10.5zM9.75.375a.75.75 0 0 1 .75.75v4.318l1.89-1.093.092-.045a.75.75 0 0 1 .659 1.344l-2.883 1.667a.752.752 0 0 1-.508.184.752.752 0 0 1-.511-.187L6.359 5.65a.75.75 0 0 1 .75-1.299L9 5.442V1.125a.75.75 0 0 1 .75-.75z"/></svg>',bottom:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M9.239 13.938l-2.88-1.663a.75.75 0 0 1 .75-1.3L9 12.067V4.75a.75.75 0 1 1 1.5 0v7.318l1.89-1.093a.75.75 0 0 1 .75 1.3l-2.879 1.663a.752.752 0 0 1-.511.187.752.752 0 0 1-.511-.187zM4.25 17a.75.75 0 1 1 0-1.5h10.5a.75.75 0 0 1 0 1.5H4.25z"/></svg>'};class Lb extends il{constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",padding:"",backgroundColor:"",width:"",height:"",horizontalAlignment:"",verticalAlignment:""}),this.options=t;const{borderStyleDropdown:n,borderWidthInput:o,borderColorInput:i,borderRowLabel:r}=this._createBorderFields(),{widthInput:s,operatorLabel:a,heightInput:c,dimensionsLabel:l}=this._createDimensionFields(),{horizontalAlignmentToolbar:d,verticalAlignmentToolbar:u,alignmentLabel:h}=this._createAlignmentFields();this.focusTracker=new Rc,this.keystrokes=new yc,this.children=this.createCollection(),this.borderStyleDropdown=n,this.borderWidthInput=o,this.borderColorInput=i,this.backgroundInput=this._createBackgroundField(),this.paddingInput=this._createPaddingField(),this.widthInput=s,this.heightInput=c,this.horizontalAlignmentToolbar=d,this.verticalAlignmentToolbar=u;const{saveButtonView:f,cancelButtonView:p}=this._createActionButtons();this.saveButtonView=f,this.cancelButtonView=p,this._focusables=new Bc,this._focusCycler=new ul({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.add(new Rb(e,{label:this.t("Cell properties")})),this.children.add(new Sb(e,{labelView:r,children:[r,n,i,o],class:"ck-table-form__border-row"})),this.children.add(new Sb(e,{children:[this.backgroundInput]})),this.children.add(new Sb(e,{children:[new Sb(e,{labelView:l,children:[l,s,a,c],class:"ck-table-form__dimensions-row"}),new Sb(e,{children:[this.paddingInput],class:"ck-table-cell-properties-form__padding-row"})]})),this.children.add(new Sb(e,{labelView:h,children:[h,d,u],class:"ck-table-cell-properties-form__alignment-row"})),this.children.add(new Sb(e,{children:[this.saveButtonView,this.cancelButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-cell-properties-form"],tabindex:"-1"},children:this.children})}render(){super.render(),Uh({view:this}),[this.borderStyleDropdown,this.borderColorInput,this.borderWidthInput,this.backgroundInput,this.widthInput,this.heightInput,this.paddingInput,this.horizontalAlignmentToolbar,this.verticalAlignmentToolbar,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}focus(){this._focusCycler.focusFirst()}_createBorderFields(){const e=Pb({colorConfig:this.options.borderColors,columns:5}),t=this.locale,n=this.t,o=new jh(t);o.text=n("ca");const i=wb(n),r=new sb(t,cb);r.set({label:n("cb"),class:"ck-table-form__border-style"}),r.view.buttonView.set({isOn:!1,withText:!0,tooltip:n("cb")}),r.view.buttonView.bind("label").to(this,"borderStyle",e=>i[e||"none"]),r.view.on("execute",e=>{this.borderStyle=e.source._borderStyleValue}),Ol(r.view,Cb(this));const s=new sb(t,ab);s.set({label:n("cc"),class:"ck-table-form__border-width"}),s.view.bind("value").to(this,"borderWidth"),s.bind("isEnabled").to(this,"borderStyle",zb),s.view.on("input",()=>{this.borderWidth=s.view.element.value});const a=new sb(t,e);return a.set({label:n("cd"),class:"ck-table-form__border-color"}),a.view.bind("value").to(this,"borderColor"),a.bind("isEnabled").to(this,"borderStyle",zb),a.view.on("input",()=>{this.borderColor=a.view.value}),this.on("change:borderStyle",(e,t,n)=>{zb(n)||(this.borderColor="",this.borderWidth="")}),{borderRowLabel:o,borderStyleDropdown:r,borderColorInput:a,borderWidthInput:s}}_createBackgroundField(){const e=this.locale,t=this.t,n=Pb({colorConfig:this.options.backgroundColors,columns:5}),o=new sb(e,n);return o.set({label:t("ce"),class:"ck-table-cell-properties-form__background"}),o.view.bind("value").to(this,"backgroundColor"),o.view.on("input",()=>{this.backgroundColor=o.view.value}),o}_createDimensionFields(){const e=this.locale,t=this.t,n=new jh(e);n.text=t("cf");const o=new sb(e,ab);o.set({label:t("cc"),class:"ck-table-form__dimensions-row__width"}),o.view.bind("value").to(this,"width"),o.view.on("input",()=>{this.width=o.view.element.value});const i=new il(e);i.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const r=new sb(e,ab);return r.set({label:t("cg"),class:"ck-table-form__dimensions-row__height"}),r.view.bind("value").to(this,"height"),r.view.on("input",()=>{this.height=r.view.element.value}),{dimensionsLabel:n,widthInput:o,operatorLabel:i,heightInput:r}}_createPaddingField(){const e=this.locale,t=this.t,n=new sb(e,ab);return n.set({label:t("cm"),class:"ck-table-cell-properties-form__padding"}),n.view.bind("value").to(this,"padding"),n.view.on("input",()=>{this.padding=n.view.element.value}),n}_createAlignmentFields(){const e=this.locale,t=this.t,n=new jh(e);n.text=t("cn");const o=new Nl(e),i="rtl"===this.locale.contentLanguageDirection;o.set({isCompact:!0,ariaLabel:t("co")}),Ab({view:this,icons:Bb,toolbar:o,labels:this._horizontalAlignmentLabels,propertyName:"horizontalAlignment",nameToValue:e=>e===(i?"right":"left")?"":e});const r=new Nl(e);return r.set({isCompact:!0,ariaLabel:t("cp")}),Ab({view:this,icons:Bb,toolbar:r,labels:this._verticalAlignmentLabels,propertyName:"verticalAlignment",nameToValue:e=>"middle"===e?"":e}),{horizontalAlignmentToolbar:o,verticalAlignmentToolbar:r,alignmentLabel:n}}_createActionButtons(){const e=this.locale,t=this.t,n=new xl(e),o=new xl(e),i=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.paddingInput];return n.set({label:t("bm"),icon:$h,class:"ck-button-save",type:"submit",withText:!0}),n.bind("isEnabled").toMany(i,"errorText",(...e)=>e.every(e=>!e)),o.set({label:t("bn"),icon:Gh,class:"ck-button-cancel",type:"cancel",withText:!0}),o.delegate("execute").to(this,"cancel"),{saveButtonView:n,cancelButtonView:o}}get _horizontalAlignmentLabels(){const e=this.locale,t=this.t,n=t("cq"),o=t("cr"),i=t("cs"),r=t("ct");return"rtl"===e.uiLanguageDirection?{right:i,center:o,left:n,justify:r}:{left:n,center:o,right:i,justify:r}}get _verticalAlignmentLabels(){const e=this.t;return{top:e("cu"),middle:e("cv"),bottom:e("cw")}}}function zb(e){return!!e}class qb extends Ll{static get requires(){return[bd]}static get pluginName(){return"TableCellPropertiesUI"}constructor(e){super(e),e.config.define("table.tableCellProperties",{borderColors:Tb,backgroundColors:Tb})}init(){const e=this.editor,t=e.t;this._balloon=e.plugins.get(bd),this.view=this._createPropertiesView(),this._undoStepBatch=null,e.ui.componentFactory.add("tableCellProperties",e=>{const n=new xl(e);return n.set({label:t("m"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.105 18l-.17 1H2.5A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1h15A1.5 1.5 0 0 1 19 2.5v9.975l-.85-.124-.15-.302V8h-5v4h.021l-.172.351-1.916.28-.151.027c-.287.063-.54.182-.755.341L8 13v5h3.105zM2 12h5V8H2v4zm10-4H8v4h4V8zM2 2v5h5V2H2zm0 16h5v-5H2v5zM13 7h5V2h-5v5zM8 2v5h4V2H8z" opacity=".6"/><path d="M15.5 11.5l1.323 2.68 2.957.43-2.14 2.085.505 2.946L15.5 18.25l-2.645 1.39.505-2.945-2.14-2.086 2.957-.43L15.5 11.5zM13 6a1 1 0 0 1 1 1v3.172a2.047 2.047 0 0 0-.293.443l-.858 1.736-1.916.28-.151.027A1.976 1.976 0 0 0 9.315 14H7a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h6zm-1 2H8v4h4V8z"/></svg>',tooltip:!0}),this.listenTo(n,"execute",()=>this._showView()),n})}destroy(){super.destroy(),this.view.destroy()}_createPropertiesView(){const e=this.editor,t=e.editing.view.document,n=e.config.get("table.tableCellProperties"),o=Vb(n.borderColors),i=Mb(e.locale,o),r=Vb(n.backgroundColors),s=Mb(e.locale,r),a=new Lb(e.locale,{borderColors:i,backgroundColors:s}),c=e.t;a.render(),this.listenTo(a,"submit",()=>{this._hideView()}),this.listenTo(a,"cancel",()=>{this._undoStepBatch.operations.length&&e.execute("undo",this._undoStepBatch),this._hideView()}),a.keystrokes.set("Esc",(e,t)=>{this._hideView(),t()}),this.listenTo(e.ui,"update",()=>{im(t.selection)?this._isViewVisible&&mb(e,"cell"):this._hideView()}),Sl({emitter:a,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const l=kb(c),d=_b(c);return a.on("change:borderStyle",this._getPropertyChangeCallback("tableCellBorderStyle")),a.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:a.borderColorInput,commandName:"tableCellBorderColor",errorText:l,validator:vb})),a.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:a.borderWidthInput,commandName:"tableCellBorderWidth",errorText:d,validator:xb})),a.on("change:padding",this._getValidatedPropertyChangeCallback({viewField:a.paddingInput,commandName:"tableCellPadding",errorText:d,validator:yb})),a.on("change:width",this._getValidatedPropertyChangeCallback({viewField:a.widthInput,commandName:"tableCellWidth",errorText:d,validator:yb})),a.on("change:height",this._getValidatedPropertyChangeCallback({viewField:a.heightInput,commandName:"tableCellHeight",errorText:d,validator:yb})),a.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:a.backgroundInput,commandName:"tableCellBackgroundColor",errorText:l,validator:vb})),a.on("change:horizontalAlignment",this._getPropertyChangeCallback("tableCellHorizontalAlignment")),a.on("change:verticalAlignment",this._getPropertyChangeCallback("tableCellVerticalAlignment")),a}_fillViewFormFromCommandValues(){const e=this.editor.commands;this.view.set({borderStyle:e.get("tableCellBorderStyle").value||"",borderColor:e.get("tableCellBorderColor").value||"",borderWidth:e.get("tableCellBorderWidth").value||"",width:e.get("tableCellWidth").value||"",height:e.get("tableCellHeight").value||"",padding:e.get("tableCellPadding").value||"",backgroundColor:e.get("tableCellBackgroundColor").value||"",horizontalAlignment:e.get("tableCellHorizontalAlignment").value||"",verticalAlignment:e.get("tableCellVerticalAlignment").value||""})}_showView(){const e=this.editor;this._balloon.add({view:this.view,position:bb(e)}),this._undoStepBatch=e.model.createBatch(),this._fillViewFormFromCommandValues(),this.view.focus()}_hideView(){if(!this._isViewInBalloon)return;const e=this.editor;this.stopListening(e.ui,"update"),this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}get _isViewVisible(){return this._balloon.visibleView===this.view}get _isViewInBalloon(){return this._balloon.hasView(this.view)}_getPropertyChangeCallback(e){return(t,n,o)=>{this.editor.execute(e,{value:o,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback({commandName:e,viewField:t,validator:n,errorText:o}){const i=Wr(()=>{t.errorText=o},500);return(o,r,s)=>{i.cancel(),n(s)?(this.editor.execute(e,{value:s,batch:this._undoStepBatch}),t.errorText=null):i()}}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function jb(e){var t;e.setNormalizer("padding",(t="padding",e=>({path:t,value:Pg(e)}))),e.setNormalizer("padding-top",e=>({path:"padding.top",value:e})),e.setNormalizer("padding-right",e=>({path:"padding.right",value:e})),e.setNormalizer("padding-bottom",e=>({path:"padding.bottom",value:e})),e.setNormalizer("padding-left",e=>({path:"padding.left",value:e})),e.setReducer("padding",Eg("padding")),e.setStyleRelation("padding",["padding-top","padding-right","padding-bottom","padding-left"])}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Hb extends nu{constructor(e,t){super(e),this.attributeName=t}refresh(){const e=am(this.editor.model.document.selection);this.isEnabled=!!e.length,this.value=this._getSingleValue(e)}execute(e={}){const{value:t,batch:n}=e,o=this.editor.model,i=am(o.document.selection),r=this._getValueToSet(t);o.enqueueChange(n||"default",e=>{r?i.forEach(t=>e.setAttribute(this.attributeName,r,t)):i.forEach(t=>e.removeAttribute(this.attributeName,t))})}_getAttribute(e){if(e)return e.getAttribute(this.attributeName)}_getValueToSet(e){return e}_getSingleValue(e){const t=this._getAttribute(e[0]);return e.every(e=>this._getAttribute(e)===t)?t:void 0}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Wb extends Hb{constructor(e){super(e,"padding")}_getAttribute(e){if(e)return Jp(e.getAttribute(this.attributeName))}_getValueToSet(e){return Zp(e,"px")}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Ub extends Hb{constructor(e){super(e,"width")}_getValueToSet(e){return Zp(e,"px")}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class $b extends Hb{constructor(e){super(e,"height")}_getValueToSet(e){return Zp(e,"px")}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Gb extends Hb{constructor(e){super(e,"backgroundColor")}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Kb extends Hb{constructor(e){super(e,"verticalAlignment")}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Jb extends Hb{constructor(e){super(e,"horizontalAlignment")}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Zb extends Hb{constructor(e){super(e,"borderStyle")}_getAttribute(e){if(e)return Jp(e.getAttribute(this.attributeName))}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Qb extends Hb{constructor(e){super(e,"borderColor")}_getAttribute(e){if(e)return Jp(e.getAttribute(this.attributeName))}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class Yb extends Hb{constructor(e){super(e,"borderWidth")}_getAttribute(e){if(e)return Jp(e.getAttribute(this.attributeName))}_getValueToSet(e){return Zp(e,"px")}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/const Xb=/^(top|bottom)$/;class ew extends Ll{static get pluginName(){return"TableCellPropertiesEditing"}static get requires(){return[Ym]}init(){const e=this.editor,t=e.model.schema,n=e.conversion;e.data.addStyleProcessorRules(Ig),function(e,t){e.extend("tableCell",{allowAttributes:["borderWidth","borderColor","borderStyle"]}),$g(t,"td"),$g(t,"th"),Gg(t,"tableCell","borderStyle","border-style"),Gg(t,"tableCell","borderColor","border-color"),Gg(t,"tableCell","borderWidth","border-width")}(t,n),e.commands.add("tableCellBorderStyle",new Zb(e)),e.commands.add("tableCellBorderColor",new Qb(e)),e.commands.add("tableCellBorderWidth",new Yb(e)),function(e,t){e.extend("tableCell",{allowAttributes:["horizontalAlignment"]}),t.attributeToAttribute({model:{name:"tableCell",key:"horizontalAlignment",values:["right","center","justify"]},view:{right:{key:"style",value:{"text-align":"right"}},center:{key:"style",value:{"text-align":"center"}},justify:{key:"style",value:{"text-align":"justify"}}}})}(t,n),e.commands.add("tableCellHorizontalAlignment",new Jb(e)),tw(t,n,"width","width"),e.commands.add("tableCellWidth",new Ub(e)),tw(t,n,"height","height"),e.commands.add("tableCellHeight",new $b(e)),e.data.addStyleProcessorRules(jb),tw(t,n,"padding","padding"),e.commands.add("tableCellPadding",new Wb(e)),e.data.addStyleProcessorRules(Hg),tw(t,n,"backgroundColor","background-color"),e.commands.add("tableCellBackgroundColor",new Gb(e)),function(e,t){e.extend("tableCell",{allowAttributes:["verticalAlignment"]}),t.attributeToAttribute({model:{name:"tableCell",key:"verticalAlignment",values:["top","bottom"]},view:{top:{key:"style",value:{"vertical-align":"top"}},bottom:{key:"style",value:{"vertical-align":"bottom"}}}}),t.for("upcast").attributeToAttribute({view:{attributes:{valign:Xb}},model:{name:"tableCell",key:"verticalAlignment",value:e=>e.getAttribute("valign")}})}(t,n),e.commands.add("tableCellVerticalAlignment",new Kb(e))}}function tw(e,t,n,o){e.extend("tableCell",{allowAttributes:[n]}),Ug(t,"tableCell",n,o),Gg(t,"tableCell",n,o)}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
function nw(e,t){if(!e.childCount)return;const n=new tu(e.document),o=function(e,t){const n=t.createRangeIn(e),o=new Bn({name:/^p|h\d+$/,styles:{"mso-list":/.*/}}),i=[];for(const e of n)if("elementStart"===e.type&&o.match(e.item)){const t=iw(e.item);i.push({element:e.item,id:t.id,order:t.order,indent:t.indent})}return i}(e,n);if(!o.length)return;let i=null,r=1;o.forEach((e,s)=>{const a=function(e,t){if(!e)return!0;if(e.id!==t.id)return!0;const n=t.element.previousSibling;if(!n)return!0;return o=n,!(o.is("ol")||o.is("ul"));var o}(o[s-1],e),c=a?null:o[s-1],l=(u=e,(d=c)?u.indent-d.indent:u.indent-1);var d,u;if(a&&(i=null,r=1),!i||0!==l){const o=function(e,t){const n=new RegExp(`@list l${e.id}:level${e.indent}\\s*({[^}]*)`,"gi"),o=/mso-level-number-format:([^;]*);/gi,i=n.exec(t);let r="decimal";if(i&&i[1]){const e=o.exec(i[1]);e&&e[1]&&(r=e[1].trim())}return{type:"bullet"!==r&&"image"!==r?"ol":"ul",style:r}}(e,t);if(i){if(e.indent>r){const e=i.getChild(i.childCount-1),t=e.getChild(e.childCount-1);i=ow(o,t,n),r+=1}else if(e.indent<r){const t=r-e.indent;i=function(e,t){const n=e.getAncestors({parentFirst:!0});let o=null,i=0;for(const e of n)if("ul"!==e.name&&"ol"!==e.name||i++,i===t){o=e;break}return o}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/(i,t),r=parseInt(e.indent)}}else i=ow(o,e.element,n);e.indent<=r&&(i.is(o.type)||(i=n.rename(o.type,i)))}const h=function(e,t){return function(e,t){const n=new Bn({name:"span",styles:{"mso-list":"Ignore"}}),o=t.createRangeIn(e);for(const e of o)"elementStart"===e.type&&n.match(e.item)&&t.remove(e.item)}(e,t),t.rename("li",e)}(e.element,n);n.appendChild(h,i)})}function ow(e,t,n){const o=t.parent,i=n.createElement(e.type),r=o.getChildIndex(t)+1;return n.insertChild(r,i,o),i}function iw(e){const t={},n=e.getStyle("mso-list");if(n){const e=n.match(/(^|\s+)l(\d+)/i),o=n.match(/\s*lfo(\d+)/i),i=n.match(/\s*level(\d+)/i);e&&o&&i&&(t.id=e[2],t.order=o[1],t.indent=i[1])}return t}const rw=/id=("|')docs-internal-guid-[-0-9a-f]+("|')/i;class sw{constructor(e){this.document=e}isActive(e){return rw.test(e)}execute(e){const t=new tu(this.document);!
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
function(e,t){for(const n of e.getChildren())if(n.is("b")&&"normal"===n.getStyle("font-weight")){const o=e.getChildIndex(n);t.remove(n),t.insertChild(o,n.getChildren(),e)}}(e.content,t),function(e,t){for(const n of t.createRangeIn(e)){const e=n.item;if(e.is("li")){const n=e.getChild(0);n.is("p")&&t.unwrapElement(n)}}}(e.content,t)}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function aw(e){return e.replace(/<span(?: class="Apple-converted-space"|)>(\s+)<\/span>/g,(e,t)=>1===t.length?" ":Array(t.length+1).join(" ").substr(0,t.length))}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function cw(e){const t=new DOMParser,n=function(e){return aw(aw(e)).replace(/(<span\s+style=['"]mso-spacerun:yes['"]>[\s]*?)[\r\n]+(\s*<\/span>)/g,"$1$2").replace(/<span\s+style=['"]mso-spacerun:yes['"]><\/span>/g,"").replace(/ <\//g," </").replace(/ <o:p><\/o:p>/g," <o:p></o:p>").replace(/<o:p>( |\u00A0)<\/o:p>/g,"").replace(/>(\s*[\r\n]\s*)</g,"><")}(function(e){const t=e.match(/<\/body>(.*?)(<\/html>|$)/);t&&t[1]&&(e=e.slice(0,t.index)+e.slice(t.index).replace(t[1],""));return e}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/(e=e.replace(/<!--\[if gte vml 1]>/g,""))),o=t.parseFromString(n,"text/html");!function(e){e.querySelectorAll("span[style*=spacerun]").forEach(e=>{const t=e.childNodes&&e.childNodes[0]&&e.childNodes[0].data&&e.childNodes[0].data.length||0;e.innerHTML=Array(t+1).join(" ").substr(0,t)})}(o);const i=o.body.innerHTML,r=function(e){const t=new si(new Oo),n=new ir(t,{blockFillerMode:"nbsp"}),o=e.createDocumentFragment(),i=e.body.childNodes;for(;i.length>0;)o.appendChild(i[0]);return n.domToView(o)}(o),s=function(e){const t=[],n=[],o=Array.from(e.getElementsByTagName("style"));for(const e of o)e.sheet&&e.sheet.cssRules&&e.sheet.cssRules.length&&(t.push(e.sheet),n.push(e.innerHTML));return{styles:t,stylesString:n.join(" ")}}(o);return{body:r,bodyString:i,styles:s.styles,stylesString:s.stylesString}}function lw(e,t){if(!e.childCount)return;const n=new tu;!function(e,t,n){const o=n.createRangeIn(t),i=new Bn({name:"img"}),r=[];for(const t of o)if(i.match(t.item)){const n=t.item,o=n.getAttribute("v:shapes")?n.getAttribute("v:shapes").split(" "):[];o.length&&o.every(t=>e.indexOf(t)>-1)?r.push(n):n.getAttribute("src")||r.push(n)}for(const e of r)n.remove(e)}(function(e,t){const n=t.createRangeIn(e),o=new Bn({name:/v:(.+)/}),i=[];for(const e of n){const t=e.item,n=t.previousSibling&&t.previousSibling.name||null;o.match(t)&&t.getAttribute("o:gfxdata")&&"v:shapetype"!==n&&i.push(e.item.getAttribute("id"))}return i}(e,n),e,n),function(e,t){const n=t.createRangeIn(e),o=new Bn({name:/v:(.+)/}),i=[];for(const e of n)o.match(e.item)&&i.push(e.item);for(const e of i)t.remove(e)}(e,n);const o=function(e,t){const n=t.createRangeIn(e),o=new Bn({name:"img"}),i=[];for(const e of n)o.match(e.item)&&e.item.getAttribute("src").startsWith("file://")&&i.push(e.item);return i}(e,n);o.length&&function(e,t,n){if(e.length===t.length)for(let i=0;i<e.length;i++){const r=`data:${t[i].type};base64,${o=t[i].hex,btoa(o.match(/\w{2}/g).map(e=>String.fromCharCode(parseInt(e,16))).join(""))}`;n.setAttribute("src",r,e[i])}var o}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/(o,function(e){if(!e)return[];const t=/{\\pict[\s\S]+?\\bliptag-?\d+(\\blipupi-?\d+)?({\\\*\\blipuid\s?[\da-fA-F]+)?[\s}]*?/,n=new RegExp("(?:("+t.source+"))([\\da-fA-F\\s]+)\\}","g"),o=e.match(n),i=[];if(o)for(const e of o){let n=!1;e.includes("\\pngblip")?n="image/png":e.includes("\\jpegblip")&&(n="image/jpeg"),n&&i.push({hex:e.replace(t,"").replace(/[^\da-fA-F]/g,""),type:n})}return i}(t),n)}const dw=/<meta\s*name="?generator"?\s*content="?microsoft\s*word\s*\d+"?\/?>/i,uw=/xmlns:o="urn:schemas-microsoft-com/i;class hw{isActive(e){return dw.test(e)||uw.test(e)}execute(e){const{body:t,stylesString:n}=cw(e.dataTransfer.getData("text/html"));nw(t,n),lw(t,e.dataTransfer.getData("text/rtf")),e.content=t}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class fw extends nu{constructor(e){super(e),this._selectedElements=[],this.on("execute",()=>{this.refresh()},{priority:"highest"})}refresh(){this._selectedElements=this._getSelectedItems(),this.value=this._selectedElements.every(e=>!!e.getAttribute("todoListChecked")),this.isEnabled=!!this._selectedElements.length}_getSelectedItems(){const e=this.editor.model,t=e.schema,n=e.document.selection.getFirstRange(),o=n.start.parent,i=[];t.checkAttribute(o,"todoListChecked")&&i.push(o);for(const e of n.getItems())t.checkAttribute(e,"todoListChecked")&&!i.includes(e)&&i.push(e);return i}execute(e={}){this.editor.model.change(t=>{for(const n of this._selectedElements){(void 0===e.forceValue?!this.value:e.forceValue)?t.setAttribute("todoListChecked",!0,n):t.removeAttribute("todoListChecked",n)}})}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/function pw(e,t,n){const o=t.range.start.parent;if("listItem"!=o.name||"todo"!=o.getAttribute("listType"))return;if(!n.consumable.consume(t.item,"insert"))return;const i=n.writer,r=n.mapper.toViewPosition(t.range.start),s=i.createText(t.item.data),a=i.createAttributeElement("span",{class:"todo-list__label__description"}),c=r.parent.getChild(0);i.insert(i.createPositionAt(r.parent,"end"),s),i.wrap(i.createRangeOn(s),a),i.wrap(i.createRangeOn(s.parent),c)}function mw(e,t,n){const o=t.modelCursor,i=o.parent,r=t.viewItem;if("checkbox"!=r.getAttribute("type")||"listItem"!=i.name||!o.isAtStart)return;if(!n.consumable.consume(r,{name:!0}))return;const s=n.writer;s.setAttribute("listType","todo",i),t.viewItem.hasAttribute("checked")&&s.setAttribute("todoListChecked",!0,i),t.modelRange=s.createRange(o)}function gw(e,t,n,o){return t.createUIElement("label",{class:"todo-list__label",contenteditable:!1},(function(t){const i=sl(document,"input",{type:"checkbox"});n&&i.setAttribute("checked","checked"),i.addEventListener("change",()=>o(e));const r=this.toDomElement(t);return r.appendChild(i),r}))}function bw(e,t){const n=t.createRangeIn(e);for(const e of n)if(e.item.is("uiElement","label"))return e.item}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class ww extends Ll{static get pluginName(){return"TodoListEditing"}static get requires(){return[Ip]}init(){const e=this.editor,{editing:t,data:n,model:o}=e;var i,r;o.schema.extend("listItem",{allowAttributes:["todoListChecked"]}),o.schema.addAttributeCheck((e,t)=>{const n=e.last;if("todoListChecked"==t&&"listItem"==n.name&&"todo"!=n.getAttribute("listType"))return!1}),e.commands.add("todoList",new ap(e,"todo")),e.commands.add("todoListCheck",new fw(e)),n.downcastDispatcher.on("insert:listItem",function(e){return(t,n,o)=>{const i=o.consumable;if(!i.test(n.item,"insert")||!i.test(n.item,"attribute:listType")||!i.test(n.item,"attribute:listIndent"))return;if("todo"!=n.item.getAttribute("listType"))return;i.consume(n.item,"insert"),i.consume(n.item,"attribute:listType"),i.consume(n.item,"attribute:listIndent");const r=o.writer,s=n.item,a=up(s,o);r.addClass("todo-list",a.parent);const c=r.createAttributeElement("label",{class:"todo-list__label"}),l=r.createEmptyElement("input",{type:"checkbox",disabled:"disabled"});n.item.getAttribute("todoListChecked")&&(r.setAttribute("checked","checked",l),r.addClass("todo-list__label",c)),r.insert(r.createPositionAt(a,0),l),r.wrap(r.createRangeOn(l),c),hp(s,a,o,e)}}(o),{priority:"high"}),n.downcastDispatcher.on("insert:$text",pw,{priority:"high"}),t.downcastDispatcher.on("insert:listItem",function(e,t){return(n,o,i)=>{const r=i.consumable;if(!r.test(o.item,"insert")||!r.test(o.item,"attribute:listType")||!r.test(o.item,"attribute:listIndent"))return;if("todo"!=o.item.getAttribute("listType"))return;const s=o.item;r.consume(s,"insert"),r.consume(s,"attribute:listType"),r.consume(s,"attribute:listIndent"),r.consume(s,"attribute:todoListChecked");const a=i.writer,c=up(s,i),l=!!s.getAttribute("todoListChecked"),d=gw(s,a,l,t);a.addClass("todo-list",c.parent),a.insert(a.createPositionAt(c,0),d),hp(s,c,i,e)}}(o,e=>this._handleCheckmarkChange(e)),{priority:"high"}),t.downcastDispatcher.on("attribute:listType:listItem",(i=e=>this._handleCheckmarkChange(e),r=t.view,(e,t,n)=>{const o=n.mapper.toViewElement(t.item),s=n.writer;if("todo"==t.attributeNewValue){const e=!!t.item.getAttribute("todoListChecked"),n=gw(t.item,s,e,i);s.addClass("todo-list",o.parent),s.insert(s.createPositionAt(o,0),n)}else"todo"==t.attributeOldValue&&(s.removeClass("todo-list",o.parent),s.remove(bw(o,r)))})),t.downcastDispatcher.on("attribute:todoListChecked:listItem",function(e){return(t,n,o)=>{if("todo"!=n.item.getAttribute("listType"))return;if(!o.consumable.consume(n.item,"attribute:todoListChecked"))return;const{mapper:i,writer:r}=o,s=!!n.item.getAttribute("todoListChecked"),a=i.toViewElement(n.item).getChild(0),c=gw(n.item,r,s,e);r.insert(r.createPositionAfter(a),c),r.remove(a)}}(e=>this._handleCheckmarkChange(e))),t.mapper.on("modelToViewPosition",function(e,t){return(n,o)=>{const i=o.modelPosition,r=i.parent;if(!r.is("listItem")||"todo"!=r.getAttribute("listType")||0!==i.offset)return;const s=bw(t.toViewElement(r),e);s&&(s.nextSibling&&!s.nextSibling.is("uiElement")?o.viewPosition=e.createPositionAt(s.nextSibling,0):o.viewPosition=e.createPositionAfter(s))}}(t.view,t.mapper)),n.upcastDispatcher.on("element:input",mw,{priority:"high"});const s="ltr"===e.locale.contentLanguageDirection?"arrowleft":"arrowright";e.keystrokes.set(s,(e,t)=>function(e,t){const n=t.schema,o=t.document.selection;if(!o.isCollapsed)return;const i=o.getFirstPosition(),r=i.parent;if("listItem"===r.name&&"todo"==r.getAttribute("listType")&&i.isAtStart){const o=n.getNearestSelectionRange(t.createPositionBefore(r),"backward");o&&(e(),t.change(e=>e.setSelection(o)))}}(t,o)),e.keystrokes.set("Ctrl+space",()=>e.execute("todoListCheck"));const a=new Set;this.listenTo(o,"applyOperation",(e,t)=>{const n=t[0];if("rename"==n.type&&"listItem"==n.oldName){const e=n.position.nodeAfter;e.hasAttribute("todoListChecked")&&a.add(e)}else if("changeAttribute"==n.type&&"listType"==n.key&&"todo"===n.oldValue)for(const e of n.range.getItems())e.hasAttribute("todoListChecked")&&"todo"!==e.getAttribute("listType")&&a.add(e)}),o.document.registerPostFixer(e=>{let t=!1;for(const n of a)e.removeAttribute("todoListChecked",n),t=!0;return a.clear(),t})}_handleCheckmarkChange(e){const t=this.editor,n=t.model,o=Array.from(n.document.selection.getRanges());n.change(n=>{n.setSelection(e,"end"),t.execute("todoListCheck"),n.setSelection(o)})}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
class kw extends Ll{init(){const e=this.editor.t;gp(this.editor,"todoList",e("df"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.315 14.705l2.224-2.24a.689.689 0 0 1 .963 0 .664.664 0 0 1 0 .949L2.865 16.07a.682.682 0 0 1-.112.089.647.647 0 0 1-.852-.051L.688 14.886a.635.635 0 0 1 0-.903.647.647 0 0 1 .91 0l.717.722zm5.185.045a.75.75 0 0 1 .75-.75h9.5a.75.75 0 1 1 0 1.5h-9.5a.75.75 0 0 1-.75-.75zM2.329 5.745l2.21-2.226a.689.689 0 0 1 .963 0 .664.664 0 0 1 0 .95L2.865 7.125a.685.685 0 0 1-.496.196.644.644 0 0 1-.468-.187L.688 5.912a.635.635 0 0 1 0-.903.647.647 0 0 1 .91 0l.73.736zM7.5 5.75A.75.75 0 0 1 8.25 5h9.5a.75.75 0 1 1 0 1.5h-9.5a.75.75 0 0 1-.75-.75z"/></svg>')}}n(114);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/var _w=/highlight-(?:text|source)-([a-z0-9]+)/;function vw(e){e.addRule("highlightedCodeBlock",{filter:function(e){var t=e.firstChild;return"DIV"===e.nodeName&&_w.test(e.className)&&t&&"PRE"===t.nodeName},replacement:function(e,t,n){var o=((t.className||"").match(_w)||[null,""])[1];return"\n\n"+n.fence+o+"\n"+t.firstChild.textContent+"\n"+n.fence+"\n\n"}})}var yw=Array.prototype.indexOf,xw=Array.prototype.every,Cw={};function Aw(e){var t,n,o=e.parentNode;return"THEAD"===o.nodeName||o.firstChild===e&&("TABLE"===o.nodeName||(n=(t=o).previousSibling,"TBODY"===t.nodeName&&(!n||"THEAD"===n.nodeName&&/^\s*$/i.test(n.textContent))))&&xw.call(e.childNodes,(function(e){return"TH"===e.nodeName}))}function Tw(e,t){var n=" ";return 0===yw.call(t.parentNode.childNodes,t)&&(n="| "),n+e+" |"}function Pw(e,t){return Array(t+1).join(e)}Cw.tableCell={filter:["th","td"],replacement:function(e,t){return Tw(e,t)}},Cw.tableRow={filter:"tr",replacement:function(e,t){var n="",o={left:":--",right:"--:",center:":-:"};if(Aw(t))for(var i=0;i<t.childNodes.length;i++){var r="---",s=(t.childNodes[i].getAttribute("align")||"").toLowerCase();s&&(r=o[s]||r),n+=Tw(r,t.childNodes[i])}return"\n"+e+(n?"\n"+n:"")}},Cw.table={filter:function(e){return"TABLE"===e.nodeName&&Aw(e.rows[0])},replacement:function(e){return"\n\n"+(e=e.replace("\n\n","\n"))+"\n\n"}},Cw.tableSection={filter:["thead","tbody","tfoot"],replacement:function(e){return e}};var Ew=["address","article","aside","audio","blockquote","body","canvas","center","dd","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frameset","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","isindex","li","main","menu","nav","noframes","noscript","ol","output","p","pre","section","table","tbody","td","tfoot","th","thead","tr","ul"];function Sw(e){return-1!==Ew.indexOf(e.nodeName.toLowerCase())}var Rw=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"];function Iw(e){return-1!==Rw.indexOf(e.nodeName.toLowerCase())}var Ow=Rw.join();var Nw={};function Mw(e){for(var t in this.options=e,this._keep=[],this._remove=[],this.blankRule={replacement:e.blankReplacement},this.keepReplacement=e.keepReplacement,this.defaultRule={replacement:e.defaultReplacement},this.array=[],e.rules)this.array.push(e.rules[t])}function Vw(e,t,n){for(var o=0;o<e.length;o++){var i=e[o];if(Dw(i,t,n))return i}}function Dw(e,t,n){var o=e.filter;if("string"==typeof o){if(o===t.nodeName.toLowerCase())return!0}else if(Array.isArray(o)){if(o.indexOf(t.nodeName.toLowerCase())>-1)return!0}else{if("function"!=typeof o)throw new TypeError("`filter` needs to be a string, array, or function");if(o.call(e,t,n))return!0}}function Fw(e){var t=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),t}function Bw(e,t,n){return e&&e.parentNode===t||n(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}Nw.paragraph={filter:"p",replacement:function(e){return"\n\n"+e+"\n\n"}},Nw.lineBreak={filter:"br",replacement:function(e,t,n){return n.br+"\n"}},Nw.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(e,t,n){var o=Number(t.nodeName.charAt(1));return"setext"===n.headingStyle&&o<3?"\n\n"+e+"\n"+Pw(1===o?"=":"-",e.length)+"\n\n":"\n\n"+Pw("#",o)+" "+e+"\n\n"}},Nw.blockquote={filter:"blockquote",replacement:function(e){return"\n\n"+(e=(e=e.replace(/^\n+|\n+$/g,"")).replace(/^/gm,"> "))+"\n\n"}},Nw.list={filter:["ul","ol"],replacement:function(e,t){var n=t.parentNode;return"LI"===n.nodeName&&n.lastElementChild===t?"\n"+e:"\n\n"+e+"\n\n"}},Nw.listItem={filter:"li",replacement:function(e,t,n){e=e.replace(/^\n+/,"").replace(/\n+$/,"\n").replace(/\n/gm,"\n ");var o=n.bulletListMarker+" ",i=t.parentNode;if("OL"===i.nodeName){var r=i.getAttribute("start"),s=Array.prototype.indexOf.call(i.children,t);o=(r?Number(r)+s:s+1)+". "}return o+e+(t.nextSibling&&!/\n$/.test(e)?"\n":"")}},Nw.indentedCodeBlock={filter:function(e,t){return"indented"===t.codeBlockStyle&&"PRE"===e.nodeName&&e.firstChild&&"CODE"===e.firstChild.nodeName},replacement:function(e,t,n){return"\n\n "+t.firstChild.textContent.replace(/\n/g,"\n ")+"\n\n"}},Nw.fencedCodeBlock={filter:function(e,t){return"fenced"===t.codeBlockStyle&&"PRE"===e.nodeName&&e.firstChild&&"CODE"===e.firstChild.nodeName},replacement:function(e,t,n){for(var o,i=((t.firstChild.className||"").match(/language-(\S+)/)||[null,""])[1],r=t.firstChild.textContent,s=n.fence.charAt(0),a=3,c=new RegExp("^"+s+"{3,}","gm");o=c.exec(r);)o[0].length>=a&&(a=o[0].length+1);var l=Pw(s,a);return"\n\n"+l+i+"\n"+r.replace(/\n$/,"")+"\n"+l+"\n\n"}},Nw.horizontalRule={filter:"hr",replacement:function(e,t,n){return"\n\n"+n.hr+"\n\n"}},Nw.inlineLink={filter:function(e,t){return"inlined"===t.linkStyle&&"A"===e.nodeName&&e.getAttribute("href")},replacement:function(e,t){return"["+e+"]("+t.getAttribute("href")+(t.title?' "'+t.title+'"':"")+")"}},Nw.referenceLink={filter:function(e,t){return"referenced"===t.linkStyle&&"A"===e.nodeName&&e.getAttribute("href")},replacement:function(e,t,n){var o,i,r=t.getAttribute("href"),s=t.title?' "'+t.title+'"':"";switch(n.linkReferenceStyle){case"collapsed":o="["+e+"][]",i="["+e+"]: "+r+s;break;case"shortcut":o="["+e+"]",i="["+e+"]: "+r+s;break;default:var a=this.references.length+1;o="["+e+"]["+a+"]",i="["+a+"]: "+r+s}return this.references.push(i),o},references:[],append:function(e){var t="";return this.references.length&&(t="\n\n"+this.references.join("\n")+"\n\n",this.references=[]),t}},Nw.emphasis={filter:["em","i"],replacement:function(e,t,n){return e.trim()?n.emDelimiter+e+n.emDelimiter:""}},Nw.strong={filter:["strong","b"],replacement:function(e,t,n){return e.trim()?n.strongDelimiter+e+n.strongDelimiter:""}},Nw.code={filter:function(e){var t=e.previousSibling||e.nextSibling,n="PRE"===e.parentNode.nodeName&&!t;return"CODE"===e.nodeName&&!n},replacement:function(e){if(!e.trim())return"";var t="`",n="",o="",i=e.match(/`+/gm);if(i)for(/^`/.test(e)&&(n=" "),/`$/.test(e)&&(o=" ");-1!==i.indexOf(t);)t+="`";return t+n+e+o+t}},Nw.image={filter:"img",replacement:function(e,t){var n=t.alt||"",o=t.getAttribute("src")||"",i=t.title||"";return o?"!["+n+"]("+o+(i?' "'+i+'"':"")+")":""}},Mw.prototype={add:function(e,t){this.array.unshift(t)},keep:function(e){this._keep.unshift({filter:e,replacement:this.keepReplacement})},remove:function(e){this._remove.unshift({filter:e,replacement:function(){return""}})},forNode:function(e){return e.isBlank?this.blankRule:(t=Vw(this.array,e,this.options))||(t=Vw(this._keep,e,this.options))||(t=Vw(this._remove,e,this.options))?t:this.defaultRule;var t},forEach:function(e){for(var t=0;t<this.array.length;t++)e(this.array[t],t)}};var Lw="undefined"!=typeof window?window:{};var zw,qw,jw,Hw=function(){var e=Lw.DOMParser,t=!1;try{(new e).parseFromString("","text/html")&&(t=!0)}catch(e){}return t}()?Lw.DOMParser:(zw=function(){},qw=n(116).JSDOM,zw.prototype.parseFromString=function(e){return new qw(e).window.document},zw);function Ww(e){var t;"string"==typeof e?t=(jw=jw||new Hw).parseFromString('<x-turndown id="turndown-root">'+e+"</x-turndown>","text/html").getElementById("turndown-root"):t=e.cloneNode(!0);return function(e){var t=e.element,n=e.isBlock,o=e.isVoid,i=e.isPre||function(e){return"PRE"===e.nodeName};if(t.firstChild&&!i(t)){for(var r=null,s=!1,a=null,c=Bw(a,t,i);c!==t;){if(3===c.nodeType||4===c.nodeType){var l=c.data.replace(/[ \r\n\t]+/g," ");if(r&&!/ $/.test(r.data)||s||" "!==l[0]||(l=l.substr(1)),!l){c=Fw(c);continue}c.data=l,r=c}else{if(1!==c.nodeType){c=Fw(c);continue}n(c)||"BR"===c.nodeName?(r&&(r.data=r.data.replace(/ $/,"")),r=null,s=!1):o(c)&&(r=null,s=!0)}var d=Bw(a,c,i);a=c,c=d}r&&(r.data=r.data.replace(/ $/,""),r.data||Fw(r))}}({element:t,isBlock:Sw,isVoid:Iw}),t}function Uw(e){return e.isBlock=Sw(e),e.isCode="code"===e.nodeName.toLowerCase()||e.parentNode.isCode,e.isBlank=function(e){return-1===["A","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"].indexOf(e.nodeName)&&/^\s*$/i.test(e.textContent)&&!Iw(e)&&!function(e){return e.querySelector&&e.querySelector(Ow)}(e)}(e),e.flankingWhitespace=function(e){var t="",n="";if(!e.isBlock){var o=/^\s/.test(e.textContent),i=/\s$/.test(e.textContent),r=e.isBlank&&o&&i;o&&!$w("left",e)&&(t=" "),r||!i||$w("right",e)||(n=" ")}return{leading:t,trailing:n}}(e),e}function $w(e,t){var n,o,i;return"left"===e?(n=t.previousSibling,o=/ $/):(n=t.nextSibling,o=/^ /),n&&(3===n.nodeType?i=o.test(n.nodeValue):1!==n.nodeType||Sw(n)||(i=o.test(n.textContent))),i}var Gw=Array.prototype.reduce,Kw=/^\n*/,Jw=/\n*$/,Zw=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function Qw(e){if(!(this instanceof Qw))return new Qw(e);var t={rules:Nw,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",blankReplacement:function(e,t){return t.isBlock?"\n\n":""},keepReplacement:function(e,t){return t.isBlock?"\n\n"+t.outerHTML+"\n\n":t.outerHTML},defaultReplacement:function(e,t){return t.isBlock?"\n\n"+e+"\n\n":e}};this.options=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)n.hasOwnProperty(o)&&(e[o]=n[o])}return e}({},t,e),this.rules=new Mw(this.options)}function Yw(e){var t=this;return Gw.call(e.childNodes,(function(e,n){var o="";return 3===(n=new Uw(n)).nodeType?o=n.isCode?n.nodeValue:t.escape(n.nodeValue):1===n.nodeType&&(o=ek.call(t,n)),tk(e,o)}),"")}function Xw(e){var t=this;return this.rules.forEach((function(n){"function"==typeof n.append&&(e=tk(e,n.append(t.options)))})),e.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function ek(e){var t=this.rules.forNode(e),n=Yw.call(this,e),o=e.flankingWhitespace;return(o.leading||o.trailing)&&(n=n.trim()),o.leading+t.replacement(n,e,this.options)+o.trailing}function tk(e,t){var n,o,i,r=(n=t,o=[e.match(Jw)[0],n.match(Kw)[0]].sort(),(i=o[o.length-1]).length<2?i:"\n\n");return(e=e.replace(Jw,""))+r+(t=t.replace(Kw,""))}Qw.prototype={turndown:function(e){if(!function(e){return null!=e&&("string"==typeof e||e.nodeType&&(1===e.nodeType||9===e.nodeType||11===e.nodeType))}(e))throw new TypeError(e+" is not a string, or an element/document/fragment node.");if(""===e)return"";var t=Yw.call(this,new Ww(e));return Xw.call(this,t)},use:function(e){if(Array.isArray(e))for(var t=0;t<e.length;t++)this.use(e[t]);else{if("function"!=typeof e)throw new TypeError("plugin must be a Function or an Array of Functions");e(this)}return this},addRule:function(e,t){return this.rules.add(e,t),this},keep:function(e){return this.rules.keep(e),this},remove:function(e){return this.rules.remove(e),this},escape:function(e){return Zw.reduce((function(e,t){return e.replace(t[0],t[1])}),e)}};var nk=Qw;function ok(e,t){let n=e.parentElement;for(;n;){if(t.indexOf(n.tagName)>=0)return!0;n=n.parentElement}return!1}class ik{constructor(e){this._htmlDP=new Pc(e),this._domConverter=new ir(e)}toView(e){const t=n(117)({html:!0,langPrefix:"language-"});let o=n(173);const i=t.use(o,{label:!0}).render(e),r=this._htmlDP._toDom(i);return function(e){let t,n=document.createNodeIterator(e,NodeFilter.SHOW_ELEMENT,{acceptNode:function(e){if("P"===e.tagName&&e.parentElement&&"LI"===e.parentElement.tagName)return NodeFilter.FILTER_ACCEPT}},!1);for(;t=n.nextNode();)t.outerHTML=t.innerHTML}(r),function(e){let t,n=document.createNodeIterator(e,NodeFilter.SHOW_ELEMENT,{acceptNode:function(e){if("CODE"===e.tagName&&e.parentElement&&"PRE"===e.parentElement.tagName)return NodeFilter.FILTER_ACCEPT}},!1);for(;t=n.nextNode();)0!==t.children.length||t.textContent||(t.textContent="\n")}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md.
|
|
|
*/(r),this._domConverter.domToView(r)}toData(e){const t=this._domConverter.viewToDom(e,document);!function(e,t,n){t=t.map(e=>e.toUpperCase()),n=n.map(e=>e.toUpperCase());let o,i=document.createNodeIterator(e,NodeFilter.SHOW_TEXT);for(;o=i.nextNode();)o.parentElement&&t.indexOf(o.parentElement.nodeName)>=0&&(o.nodeValue=o.nodeValue.replace(/^[\u00a0]+/g," ").replace(/[\u00a0]+$/g," ")),ok(o,n)||(o.nodeValue=_.escape(o.nodeValue))}(t,["strong","em"],["pre","code","table"]),function(e,t,n){let o,i=document.createNodeIterator(e,NodeFilter.SHOW_ELEMENT,(function(e){return"a"===e.nodeName.toLowerCase()?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}));for(;o=i.nextNode();)o.setAttribute("href",o.href)}(t);const n=new nk({headingStyle:"atx",codeBlockStyle:"fenced"});return n.use([vw]),n.addRule("todolist",{filter:function(e){return"LI"===e.nodeName&&e.closest("ul.todo-list")},replacement:function(e,t,n){e=e.replace(/^\n+/,"").replace(/\n+$/,"\n").replace(/\n/gm,"\n ");var o=n.bulletListMarker+" ",i=t.querySelector("input[type=checkbox]");return o+(i&&i.checked?"[x] ":"[ ] ")+e+(t.nextSibling&&!/\n$/.test(e)?"\n":"")}}),n.addRule("img",{filter:"img",replacement:function(e,t){var n=t.alt||"",o=t.getAttribute("data-original-src")||t.getAttribute("src")||"",i=t.title||"";return o?"!["+n+"]("+o+(i?' "'+i+'"':"")+")":""}}),n.addRule("htmlTables",{filter:function(e){return"FIGURE"===e.nodeName&&e.classList.contains("table")},replacement:function(e,t){return t.querySelectorAll("td br[data-cke-filler]").forEach(e=>e.remove()),t.outerHTML}}),n.addRule("strikethrough",{filter:["del","s","strike"],replacement:function(e){return"~~"+e+"~~"}}),n.addRule("openProjectMacros",{filter:["macro"],replacement:(e,t)=>(t.innerHTML="",t.outerHTML.replace("</macro>","\n</macro>"))}),n.turndown(t)}}var rk='<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n<svg\n xmlns:dc="http://purl.org/dc/elements/1.1/"\n xmlns:cc="http://creativecommons.org/ns#"\n xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\n xmlns:svg="http://www.w3.org/2000/svg"\n xmlns="http://www.w3.org/2000/svg"\n xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"\n xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"\n class="ck ck-icon ck-button__icon"\n viewBox="0 0 20 20"\n version="1.1"\n id="svg10"\n sodipodi:docname="source.svg"\n inkscape:version="0.92.3 (2405546, 2018-03-11)">\n <defs\n id="defs14" />\n <sodipodi:namedview\n pagecolor="#ffffff"\n bordercolor="#666666"\n borderopacity="1"\n objecttolerance="10"\n gridtolerance="10"\n guidetolerance="10"\n inkscape:pageopacity="0"\n inkscape:pageshadow="2"\n inkscape:window-width="640"\n inkscape:window-height="480"\n id="namedview12"\n showgrid="false"\n inkscape:zoom="33.37544"\n inkscape:cx="10.656564"\n inkscape:cy="13.670445"\n inkscape:current-layer="svg10" />\n <g\n id="g8"\n style="fill:#000000;fill-rule:evenodd"\n transform="matrix(0.8751128,0,0,0.8751128,4.2423992,5.525391)">\n <g\n id="g6"\n style="fill:#000000">\n <g\n transform="translate(2,5.6)"\n id="g4"\n style="fill:#000000">\n <path\n d="M 10.5,0.1 15.7,4 v 1.3 l -5.6,4 C 10,9.5 9.8,9.5 9.6,9.5 9.3,9.4 9,8.8 9,8.5 L 9.3,8.1 14,4.6 9.5,1.4 9.3,1.2 C 9.2,0.9 9.2,0.6 9.3,0.4 9.5,0.2 9.8,0 10.1,0 a 0.8,0.8 0 0 1 0.4,0.1 z M 5.3,0.1 0,4 v 1.3 l 5.6,4 C 5.7,9.5 5.9,9.5 6.1,9.5 6.4,9.4 6.8,8.8 6.7,8.5 6.7,8.4 6.7,8.2 6.5,8.1 L 1.5,4.6 6.2,1.4 6.4,1.2 C 6.5,0.9 6.5,0.6 6.4,0.4 6.2,0.2 5.9,0 5.6,0 A 0.8,0.8 0 0 0 5.3,0.1 Z"\n id="path2"\n inkscape:connector-curvature="0"\n style="fill:#000000" />\n </g>\n </g>\n </g>\n <metadata\n id="metadata4596">\n <rdf:RDF>\n <cc:Work\n rdf:about="">\n <dc:title></dc:title>\n <dc:format>image/svg+xml</dc:format>\n <dc:type\n rdf:resource="http://purl.org/dc/dcmitype/StillImage" />\n </cc:Work>\n </rdf:RDF>\n </metadata>\n <path\n style="stroke-width:0.0390625"\n d="M 1.2772336,0.02277222 V 20.022772 H 6.2381712 V 18.225897 H 3.0741087 V 1.8196472 h 8.2031253 l 3.554687,3.59375 v 3.5546875 h 1.796875 V 4.6712097 L 12.019421,0.02277222 Z"\n id="path2-3"\n inkscape:connector-curvature="0" />\n</svg>\n';
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
|
class sk extends nu{refresh(){const e=this.editor.model,t=e.document;this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"mention")}execute(e){const t=this.editor.model,n=t.document.selection,o="string"==typeof e.mention?{id:e.mention}:e.mention,i=o.id,r=e.range||n.getFirstRange(),s=e.text||i,a=ck({_text:s,id:i},o);if(1!=e.marker.length)throw new fn.b("mentioncommand-incorrect-marker: The marker must be a single character.",this);if(i.charAt(0)!=e.marker)throw new fn.b("mentioncommand-incorrect-id: The item id must start with the marker character.",this);t.change(e=>{const o=Fn(n.getAttributes()),i=new Map(o.entries());i.set("mention",a),t.insertContent(e.createText(s,i),r),t.insertContent(e.createText(" ",o),r.start.getShiftedBy(s.length))})}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class ak extends Ll{static get pluginName(){return"MentionEditing"}init(){const e=this.editor,t=e.model,n=t.document;t.schema.extend("$text",{allowAttributes:"mention"}),e.conversion.for("upcast").elementToAttribute({view:{name:"span",key:"data-mention",classes:"mention"},model:{key:"mention",value:lk}}),e.conversion.for("downcast").attributeToElement({model:"mention",view:uk}),e.conversion.for("downcast").add(dk),n.registerPostFixer(e=>function(e,t,n){const o=t.differ.getChanges();let i=!1;for(const t of o){const o=t.position;if("$text"==t.name){const t=o.textNode&&o.textNode.nextSibling;i=fk(o.textNode,e)||i,i=fk(t,e)||i,i=fk(o.nodeBefore,e)||i,i=fk(o.nodeAfter,e)||i}if("$text"!=t.name&&"insert"==t.type){const t=o.nodeAfter;for(const n of e.createRangeIn(t).getItems())i=fk(n,e)||i}if("insert"==t.type&&n.isInline(t.name)){const t=o.nodeAfter&&o.nodeAfter.nextSibling;i=fk(o.nodeBefore,e)||i,i=fk(t,e)||i}}return i}(e,n,t.schema)),n.registerPostFixer(e=>function(e,t){const n=t.differ.getChanges();let o=!1;for(const t of n)if("attribute"===t.type&&"mention"!=t.attributeKey){const n=t.range.start.nodeBefore,i=t.range.end.nodeAfter;for(const r of[n,i])hk(r)&&r.getAttribute(t.attributeKey)!=t.attributeNewValue&&(e.setAttribute(t.attributeKey,t.attributeNewValue,r),o=!0)}return o}(e,n)),n.registerPostFixer(e=>function(e,t){const n=t.selection,o=n.focus;if(n.isCollapsed&&n.hasAttribute("mention")&&function(e){const t=e.isAtStart;return e.nodeBefore&&e.nodeBefore.is("text")||t}(o))return e.removeSelectionAttribute("mention"),!0}(e,n)),e.commands.add("mention",new sk(e))}}function ck(e,t){return Object.assign({_uid:un()},e,t||{})}function lk(e,t){const n=e.getAttribute("data-mention"),o=e.getChild(0);if(o)return ck({id:n,_text:o.data},t)}function dk(e){e.on("attribute:mention",(e,t,n)=>{const o=t.attributeNewValue;if(!t.item.is("textProxy")||!o)return;const i=t.range.start;(i.textNode||i.nodeAfter).data!=o._text&&n.consumable.consume(t.item,e.name)},{priority:"highest"})}function uk(e,t){if(!e)return;const n={class:"mention","data-mention":e.id},o={id:e._uid,priority:20};return t.createAttributeElement("span",n,o)}function hk(e){if(!e||!e.is("text")&&!e.is("textProxy")||!e.hasAttribute("mention"))return!1;return e.data!=e.getAttribute("mention")._text}function fk(e,t){return!!hk(e)&&(t.removeAttribute("mention",e),!0)}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class pk{constructor(e,t){this.model=e,this.testCallback=t,this.hasMatch=!1,this.set("isEnabled",!0),this.on("change:isEnabled",()=>{this.isEnabled?this._startListening():(this.stopListening(e.document.selection),this.stopListening(e.document))}),this._startListening()}_startListening(){const e=this.model.document;this.listenTo(e.selection,"change:range",(t,{directChange:n})=>{n&&(e.selection.isCollapsed?this._evaluateTextBeforeSelection("selection"):this.hasMatch&&(this.fire("unmatched"),this.hasMatch=!1))}),this.listenTo(e,"change:data",(e,t)=>{"transparent"!=t.type&&this._evaluateTextBeforeSelection("data",{batch:t})})}_evaluateTextBeforeSelection(e,t={}){const n=this.model,o=n.document.selection,i=n.createRange(n.createPositionAt(o.focus.parent,0),o.focus),{text:r,range:s}=rh(i,n),a=this.testCallback(r);if(!a&&this.hasMatch&&this.fire("unmatched"),this.hasMatch=!!a,a){const n=Object.assign(t,{text:r,range:s});"object"==typeof a&&Object.assign(n,a),this.fire(`matched:${e}`,n)}}}xn(pk,Wo);n(174);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class mk extends Al{constructor(e){super(e),this.extendTemplate({attributes:{class:["ck-mentions"],tabindex:"-1"}})}selectFirst(){this.select(0)}selectNext(){const e=this.selected,t=this.items.getIndex(e);this.select(t+1)}selectPrevious(){const e=this.selected,t=this.items.getIndex(e);this.select(t-1)}select(e){let t=0;e>0&&e<this.items.length?t=e:e<0&&(t=this.items.length-1);const n=this.items.get(t);this.selected!==n&&(this.selected&&this.selected.removeHighlight(),n.highlight(),this.selected=n,this._isItemVisibleInScrolledArea(n)||(this.element.scrollTop=n.element.offsetTop))}executeSelected(){this.selected.fire("execute")}_isItemVisibleInScrolledArea(e){return new Xr(this.element).contains(new Xr(e.element))}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class gk extends il{constructor(e,t){super(e),this.template=!1,this.domElement=t,this.domElement.classList.add("ck-button"),this.set("isOn",!1),this.on("change:isOn",(e,t,n)=>{n?(this.domElement.classList.add("ck-on"),this.domElement.classList.remove("ck-off")):(this.domElement.classList.add("ck-off"),this.domElement.classList.remove("ck-on"))}),this.listenTo(this.domElement,"click",()=>{this.fire("execute")})}render(){super.render(),this.element=this.domElement}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/class bk extends Tl{highlight(){this.children.first.isOn=!0}removeHighlight(){this.children.first.isOn=!1}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/const wk=[gi.arrowup,gi.arrowdown,gi.enter,gi.tab,gi.space,gi.esc];class kk extends Ll{static get pluginName(){return"MentionUI"}static get requires(){return[bd]}constructor(e){super(e),this._mentionsView=this._createMentionView(),this._mentionsConfigurations=new Map,this._requestFeedDebounced=Wr(this._requestFeed,100),e.config.define("mention",{feeds:[]})}init(){const e=this.editor;this._balloon=e.plugins.get(bd),e.editing.view.document.on("keydown",(e,t)=>{var n;n=t.keyCode,wk.includes(n)&&this._isUIVisible&&(t.preventDefault(),e.stop(),t.keyCode==gi.arrowdown&&this._mentionsView.selectNext(),t.keyCode==gi.arrowup&&this._mentionsView.selectPrevious(),t.keyCode!=gi.enter&&t.keyCode!=gi.tab&&t.keyCode!=gi.space||this._mentionsView.executeSelected(),t.keyCode==gi.esc&&this._hideUIAndRemoveMarker())},{priority:"highest"}),Sl({emitter:this._mentionsView,activator:()=>this._isUIVisible,contextElements:[this._balloon.view.element],callback:()=>this._hideUIAndRemoveMarker()});const t=e.config.get("mention.feeds");for(const e of t){const t=e.feed,n=e.marker;if(!xk(n))throw new fn.b("mentionconfig-incorrect-marker: The marker must be provided and it must be a single character.",null);const o=e.minimumCharacters||0,i="function"==typeof t?t.bind(this.editor):yk(t),r={watcher:this._setupTextWatcherForFeed(n,o),marker:n,feedCallback:i,itemRenderer:e.itemRenderer};this._mentionsConfigurations.set(n,r)}this.on("requestFeed:response",(e,t)=>this._handleFeedResponse(t)),this.on("requestFeed:error",()=>this._hideUIAndRemoveMarker())}destroy(){super.destroy(),this._mentionsView.destroy()}get _isUIVisible(){return this._balloon.visibleView===this._mentionsView}_createMentionView(){const e=this.editor.locale,t=new mk(e);return this._items=new Cn,t.items.bindTo(this._items).using(n=>{const{item:o,marker:i}=n,r=new bk(e),s=this._renderItem(o,i);return s.delegate("execute").to(r),r.children.add(s),r.item=o,r.marker=i,r.on("execute",()=>{t.fire("execute",{item:o,marker:i})}),r}),t.on("execute",(e,t)=>{const n=this.editor,o=n.model,i=t.item,r=t.marker,s=n.model.markers.get("mention"),a=o.createPositionAt(o.document.selection.focus),c=o.createPositionAt(s.getStart()),l=o.createRange(c,a);this._hideUIAndRemoveMarker(),n.execute("mention",{mention:i,text:i.text,marker:r,range:l}),n.editing.view.focus()}),t}_getItemRenderer(e){const{itemRenderer:t}=this._mentionsConfigurations.get(e);return t}_requestFeed(e,t){this._lastRequested=t;const{feedCallback:n}=this._mentionsConfigurations.get(e),o=n(t);o instanceof Promise?o.then(n=>{this._lastRequested==t?this.fire("requestFeed:response",{feed:n,marker:e,feedText:t}):this.fire("requestFeed:discarded",{feed:n,marker:e,feedText:t})}).catch(e=>{this.fire("requestFeed:error",{error:e}),console.warn(Object(fn.a)("mention-feed-callback-error: Could not obtain mention autocomplete feed."))}):this.fire("requestFeed:response",{feed:o,marker:e,feedText:t})}_setupTextWatcherForFeed(e,t){const n=this.editor,o=new pk(n.model,function(e,t){const n=vk(e,t);return e=>n.test(e)}(e,t));return o.on("matched",(t,o)=>{const i=n.model.document.selection.focus;if(function(e){const t=e.textNode&&e.textNode.hasAttribute("mention"),n=e.nodeBefore;return t||n&&n.is("text")&&n.hasAttribute("mention")}(i))return void this._hideUIAndRemoveMarker();const r=function(e,t){const n=vk(e,0);return t.match(n)[2]}(e,o.text),s=e.length+r.length,a=i.getShiftedBy(-s),c=i.getShiftedBy(-r.length),l=n.model.createRange(a,c);if(Ck(n)){const e=n.model.markers.get("mention");n.model.change(t=>{t.updateMarker(e,{range:l})})}else n.model.change(e=>{e.addMarker("mention",{range:l,usingOperation:!1,affectsData:!1})});this._requestFeedDebounced(e,r)}),o.on("unmatched",()=>{this._hideUIAndRemoveMarker()}),o}_handleFeedResponse(e){const{feed:t,marker:n}=e;if(!Ck(this.editor))return;this._items.clear();for(const e of t){const t="object"!=typeof e?{id:e,text:e}:e;this._items.add({item:t,marker:n})}const o=this.editor.model.markers.get("mention");this._items.length?this._showOrUpdateUI(o):this._hideUIAndRemoveMarker()}_showOrUpdateUI(e){this._isUIVisible?this._balloon.updatePosition(this._getBalloonPanelPositionData(e,this._mentionsView.position)):this._balloon.add({view:this._mentionsView,position:this._getBalloonPanelPositionData(e,this._mentionsView.position),withArrow:!1,singleViewMode:!0}),this._mentionsView.position=this._balloon.view.position,this._mentionsView.selectFirst()}_hideUIAndRemoveMarker(){this._balloon.hasView(this._mentionsView)&&this._balloon.remove(this._mentionsView),Ck(this.editor)&&this.editor.model.change(e=>e.removeMarker("mention")),this._mentionsView.position=void 0}_renderItem(e,t){const n=this.editor;let o,i=e.id;const r=this._getItemRenderer(t);if(r){const t=r(e);"string"!=typeof t?o=new gk(n.locale,t):i=t}if(!o){const e=new xl(n.locale);e.label=i,e.withText=!0,o=e}return o}_getBalloonPanelPositionData(e,t){const n=this.editor,o=n.editing,i=o.view.domConverter,r=o.mapper;return{target:()=>{let t=e.getRange();"$graveyard"==t.start.root.rootName&&(t=n.model.document.selection.getFirstRange());const o=r.toViewRange(t);return Xr.getDomRangeRects(i.viewRangeToDom(o)).pop()},limiter:()=>{const e=this.editor.editing.view,t=e.document.selection.editableElement;return t?e.domConverter.mapViewToDom(t.root):null},positions:_k(t)}}}function _k(e){const t={caret_se:e=>({top:e.bottom+3,left:e.right,name:"caret_se"}),caret_ne:(e,t)=>({top:e.top-t.height-3,left:e.right,name:"caret_ne"}),caret_sw:(e,t)=>({top:e.bottom+3,left:e.right-t.width,name:"caret_sw"}),caret_nw:(e,t)=>({top:e.top-t.height-3,left:e.right-t.width,name:"caret_nw"})};return t.hasOwnProperty(e)?[t[e]]:[t.caret_se,t.caret_sw,t.caret_ne,t.caret_nw]}function vk(e,t){const n=0==t?"*":`{${t},}`,o=fi.features.isRegExpUnicodePropertySupported?"\\p{Ps}\\p{Pi}\"'":"\\(\\[{\"'",i=fi.features.isRegExpUnicodePropertySupported?"\\p{L}\\p{N}":"a-zA-ZÀ-ž0-9";return new RegExp(`(?:^|[ ${o}])([${e}])([_${i}]${n})$`,"u")}function yk(e){return t=>e.filter(e=>("string"==typeof e?e:String(e.id)).toLowerCase().includes(t.toLowerCase())).slice(0,10)}function xk(e){return e&&1==e.length}function Ck(e){return e.model.markers.has("mention")}n(176);
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/const Ak=[Ql,class extends Ll{static get requires(){return[id,ad,xd]}static get pluginName(){return"OPMacroEmbeddedTable"}static get buttonName(){return id.buttonName}},class extends Ll{static get requires(){return[Td,ad,Pd]}static get pluginName(){return"OPMacroWpButton"}static get buttonName(){return Td.buttonName}},class extends Ll{static get requires(){return[uu,ad,hu]}static get pluginName(){return"OPChildPages"}static get buttonName(){return uu.buttonName}}],Tk=[class extends Ll{static get requires(){return[Id,cu]}static get pluginName(){return"OpUploadPlugin"}init(){this.editor.plugins.get("FileRepository").createUploadAdapter=e=>{const t=nd(this.editor);return new Nd(e,t,this.editor)}}},class extends Ll{static get pluginName(){return"OPAttachmentListener"}init(){this.editor.model.on("op:attachment-removed",(e,t)=>{this.removeDeletedImage(t)})}removeDeletedImage(e){let t=this.editor.model.document.getRoot();for(const n of Array.from(t.getChildren()))if("image"===n.name&&e.indexOf(n.getAttribute("src"))>-1){const e=new Ps(n,"on");this.editor.model.deleteContent(e)}}}],Pk=[class extends Ll{static get requires(){return[eu,bu,vu,Vu,th]}static get pluginName(){return"Essentials"}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/,class extends Ll{static get requires(){return[Id]}static get pluginName(){return"CKFinderUploadAdapter"}init(){const e=this.editor.config.get("ckfinder.uploadUrl");e&&(this.editor.plugins.get(Id).createUploadAdapter=t=>new oh(t,e,this.editor.t))}},class extends Ll{static get pluginName(){return"Autoformat"}afterInit(){this._addListAutoformats(),this._addBasicStylesAutoformats(),this._addHeadingAutoformats(),this._addBlockQuoteAutoformats(),this._addCodeBlockAutoformats()}_addListAutoformats(){const e=this.editor.commands;e.get("bulletedList")&&new ih(this.editor,/^[*-]\s$/,"bulletedList"),e.get("numberedList")&&new ih(this.editor,/^1[.|)]\s$/,"numberedList")}_addBasicStylesAutoformats(){const e=this.editor.commands;if(e.get("bold")){const e=ch(this.editor,"bold");new sh(this.editor,/(\*\*)([^*]+)(\*\*)$/g,e),new sh(this.editor,/(__)([^_]+)(__)$/g,e)}if(e.get("italic")){const e=ch(this.editor,"italic");new sh(this.editor,/(?:^|[^*])(\*)([^*_]+)(\*)$/g,e),new sh(this.editor,/(?:^|[^_])(_)([^_]+)(_)$/g,e)}if(e.get("code")){const e=ch(this.editor,"code");new sh(this.editor,/(`)([^`]+)(`)$/g,e)}}_addHeadingAutoformats(){const e=this.editor.commands.get("heading");e&&e.modelElements.filter(e=>e.match(/^heading[1-6]$/)).forEach(t=>{const n=t[7],o=new RegExp(`^(#{${n}})\\s$`);new ih(this.editor,o,()=>{if(!e.isEnabled)return!1;this.editor.execute("heading",{value:t})})})}_addBlockQuoteAutoformats(){this.editor.commands.get("blockQuote")&&new ih(this.editor,/^>\s$/,"blockQuote")}_addCodeBlockAutoformats(){this.editor.commands.get("codeBlock")&&new ih(this.editor,/^```$/,"codeBlock")}},class extends Ll{static get requires(){return[dh,uh]}static get pluginName(){return"Bold"}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/,class extends Ll{static get requires(){return[hh,fh]}static get pluginName(){return"Code"}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/,class extends Ll{static get requires(){return[gh,bh]}static get pluginName(){return"Italic"}},class extends Ll{static get requires(){return[ph,mh]}static get pluginName(){return"Strikethrough"}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/,class extends Ll{static get requires(){return[xh,Ch]}static get pluginName(){return"BlockQuote"}},class extends Ll{static get requires(){return[Oh,Mh]}static get pluginName(){return"Heading"}},class extends Ll{static get requires(){return[Bh,ad,Qh]}static get pluginName(){return"Image"}},class extends Ll{static get requires(){return[ef]}static get pluginName(){return"ImageCaption"}},class extends Ll{static get requires(){return[gf,bf]}static get pluginName(){return"ImageStyle"}},class extends Ll{static get requires(){return[wf]}static get pluginName(){return"ImageToolbar"}afterInit(){const e=this.editor,t=e.t;e.plugins.get(wf).register("image",{ariaLabel:t("b"),items:e.config.get("image.toolbar")||[],getRelatedElement:Ld})}},class extends Ll{static get pluginName(){return"OpImageAttachmentLookup"}init(){const e=this.editor,t=e.conversion,n=nd(e);t.for("editingDowncast").add(function(e){return e=>{e.on("attribute:src:image",t,{priority:"highest"})};function t(t,n,o){let i=n.attributeNewValue;if(!i||!e.lookupDownloadLocationByName)return;const r=e.lookupDownloadLocationByName(i);n.attributeNewValue=r||i}}(n)),t.for("dataDowncast").add(function(e){return e=>{e.on("attribute:src:image",t,{priority:"highest"})};function t(t,n,o){let i=n.attributeNewValue;if(!i||!e.lookupDownloadLocationByName)return;const r=e.lookupDownloadLocationByName(i);n.attributeNewValue=r||i;const s=o.writer,a=o.mapper.toViewElement(n.item).getChild(0);r&&s.setAttribute("data-original-src",i,a)}}(n))}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md.
|
|
|
*/,class extends Ll{static get requires(){return[tp,rp]}static get pluginName(){return"Link"}},class extends Ll{static get requires(){return[Ip,Np]}static get pluginName(){return"List"}},class extends Ll{static get requires(){return[ww,kw]}static get pluginName(){return"TodoList"}},Ph,Vu,class extends Ll{toMentionAttribute(e,t){return lk(e,t)}static get pluginName(){return"Mention"}static get requires(){return[ak,kk]}},function(e){e.conversion.for("upcast").elementToAttribute({view:{name:"a",key:"data-mention",classes:"mention",attributes:{href:!0,"data-user-id":!0}},model:{key:"mention",value:t=>e.plugins.get("Mention").toMentionAttribute(t,{link:t.getAttribute("href"),userId:t.getAttribute("data-user-id")})},converterPriority:"high"}),e.conversion.for("downcast").attributeToElement({model:"mention",converterPriority:"high",view:(e,t)=>{if(!e)return;return t.createAttributeElement("span",{class:"mention","data-type":e.type||""})}})},class extends Ll{static get pluginName(){return"PasteFromOffice"}static get requires(){return[eu]}init(){const e=this.editor,t=[];t.push(new hw),t.push(new sw(e.editing.view.document)),e.plugins.get("Clipboard").on("inputTransformation",(e,n)=>{if(n.isTransformedWithPasteFromOffice)return;const o=n.dataTransfer.getData("text/html"),i=t.find(e=>e.isActive(o));i&&(i.execute(n),n.isTransformedWithPasteFromOffice=!0)},{priority:"high"})}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/,class extends Ll{static get pluginName(){return"OPHelpLinkPlugin"}init(){const e=this.editor,t=(e.model,e.config.get("openProject.helpURL"));e.ui.componentFactory.add("openProjectShowFormattingHelp",e=>{const n=new xl(e);return n.set({label:window.I18n.t("js.inplace.link_formatting_help"),icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M415.462 96.978c-88.1-88.1-230.824-88.1-318.924 0-87.22 87.22-87.22 229.943 0 318.044 88.1 88.1 230.824 88.1 318.924 0 87.22-88.1 87.22-230.824 0-318.044zM246.31 437.047c-24.668 0-44.05-20.263-44.05-44.05 0-24.669 19.382-44.05 44.05-44.05 24.668 0 44.05 19.381 44.05 44.05 0 23.787-20.263 44.05-44.05 44.05zm30.835-154.176v23.787c0 12.334-4.405 16.74-15.858 16.74h-32.597c-11.453 0-15.858-4.406-15.858-16.74v-53.742c0-14.096 14.096-18.5 26.43-22.025 2.643-.88 6.167-1.762 8.81-2.643 16.74-6.167 26.43-13.215 26.43-30.835 0-6.167 0-23.787-29.073-23.787-17.62 0-33.478 7.048-43.17 10.572-5.285 2.643-7.929 3.524-11.453 3.524-5.286 0-10.572-4.405-11.453-9.691L167.9 148.958c-.88-2.643-.88-5.286-.88-7.048 0-21.145 66.075-33.479 88.1-33.479 55.503 0 93.387 36.122 93.387 88.982 0 58.146-44.05 75.767-71.362 85.458z"/></svg>',tooltip:!0}),n.on("execute",()=>{window.open(t,"_blank")}),n})}},class extends Ll{static get pluginName(){return"CodeBlock"}static get requires(){return[qp,jp]}},class extends Ll{static get pluginName(){return"OPPreview"}init(){const e=this.editor;let t=!1,n=null;e.ui.componentFactory.add("preview",o=>{const i=new xl(o);i.set({label:this.label,icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="20"><path d="M124 334v14c84 139 279 139 362 0v-14c-83-139-278-139-362 0zm181 91c-46 0-83-38-83-84s37-83 83-83c47 0 84 37 84 83s-37 84-84 84zm42-84c0 23-19 42-42 42s-41-19-41-42 18-42 41-42 42 19 42 42zm83-254L312-32H37v512h127v-46H83V14h210l91 92v91h46V87z"/></svg>\n',tooltip:!0});let r=function(t){let o,r=jQuery(e.ui.getEditableElement()).parent();o=r.length?r:$editable;let s=jQuery('<div class="ck-editor__preview"></div>');o.siblings(".ck-editor__preview").remove();const a=ed(e,"ckEditorPreview");n=a.render(s[0],t),o.hide(),o.after(s),Wp(e,i)},s=function(){let t=function(e){return _.get(e.config,"_config.openProject.context.previewContext")}(e),n=od(e).api.v3.previewMarkup(t);jQuery.ajax({data:e.getData(),url:n,response_type:"text",contentType:"text/plain; charset=UTF-8",method:"POST"}).done(r)};return i.on("execute",()=>{t?(t=!1,function(){let t=jQuery(e.ui.getEditableElement()).parent();n(),t.siblings(".ck-editor__preview").remove(),t.show(),Up(e)}()):(t=!0,s())}),i})}get label(){return window.I18n.t("js.editor.preview")}},class extends Ll{static get pluginName(){return"OPSourceCode"}init(){const e=this.editor;let t=!1,n={source:window.I18n.t("js.editor.mode.manual"),wysiwyg:window.I18n.t("js.editor.mode.wysiwyg")};e.ui.componentFactory.add("opShowSource",o=>{const i=new xl(o);i.set({label:n.source,class:"",icon:rk,tooltip:!0});return i.on("execute",()=>{t?(t=!1,function(){let t=jQuery(e.ui.getEditableElement()).parent();e.fire("op:source-code-disabled"),t.siblings(".ck-editor__source").remove(),t.show(),Up(e),i.set({label:n.source,class:"",icon:rk,tooltip:!0})}()):(t=!0,function(t){let o,r=jQuery(e.ui.getEditableElement()).parent();o=r.length?r:$editable;let s=jQuery('<div class="ck-editor__source"></div>');o.siblings(".ck-editor__source").remove(),o.hide(),o.after(s),Wp(e,i),e.fire("op:source-code-enabled"),i.set({label:n.wysiwyg,class:"-source-enabled",icon:'<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n<svg\n xmlns:dc="http://purl.org/dc/elements/1.1/"\n xmlns:cc="http://creativecommons.org/ns#"\n xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\n xmlns:svg="http://www.w3.org/2000/svg"\n xmlns="http://www.w3.org/2000/svg"\n xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"\n xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"\n viewBox="0 0 512 512"\n version="1.1"\n id="svg4"\n sodipodi:docname="wysiwyg.svg"\n inkscape:version="0.92.3 (2405546, 2018-03-11)">\n <metadata\n id="metadata10">\n <rdf:RDF>\n <cc:Work\n rdf:about="">\n <dc:format>image/svg+xml</dc:format>\n <dc:type\n rdf:resource="http://purl.org/dc/dcmitype/StillImage" />\n </cc:Work>\n </rdf:RDF>\n </metadata>\n <defs\n id="defs8" />\n <sodipodi:namedview\n pagecolor="#ffffff"\n bordercolor="#666666"\n borderopacity="1"\n objecttolerance="10"\n gridtolerance="10"\n guidetolerance="10"\n inkscape:pageopacity="0"\n inkscape:pageshadow="2"\n inkscape:window-width="640"\n inkscape:window-height="480"\n id="namedview6"\n showgrid="false"\n inkscape:zoom="1.3037281"\n inkscape:cx="252.52639"\n inkscape:cy="155.86537"\n inkscape:current-layer="svg4" />\n <path\n d="m 166.9714,230.61312 h 185 v 31 h -185 z m 1,-61 h 185 v 32 h -185 z m 0,-61 h 185 v 32 h -185 z m 289,5 -118,-118.0000009 H 63.971404 V 507.61312 H 457.9714 v -394 z m -347,348 V 41.613119 h 210 l 92,92.000001 v 328 z"\n id="path2"\n inkscape:connector-curvature="0"\n sodipodi:nodetypes="cccccccccccccccccccccccccccc" />\n <rect\n style="fill:#000000;fill-opacity:1;stroke:#353535;stroke-opacity:1"\n id="rect832"\n width="184.08746"\n height="112.75357"\n x="169.51387"\n y="313.33896" />\n</svg>\n',tooltip:!0})}())}),i})}},function(e){e.data.processor=new ik(e.editing.view.document)},class extends Ll{static get requires(){return[Ym,tg,rg,ag,ad]}static get pluginName(){return"Table"}}
|
|
|
/**
|
|
|
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/,class extends Ll{static get requires(){return[wf]}static get pluginName(){return"TableToolbar"}afterInit(){const e=this.editor,t=e.t,n=e.plugins.get(wf),o=e.config.get("table.contentToolbar"),i=e.config.get("table.tableToolbar");o&&n.register("tableContent",{ariaLabel:t("c"),items:o,getRelatedElement:im}),i&&n.register("table",{ariaLabel:t("c"),items:i,getRelatedElement:om})}},class extends Ll{static get pluginName(){return"TableProperties"}static get requires(){return[ib,Fb]}},class extends Ll{static get pluginName(){return"TableCellProperties"}static get requires(){return[ew,qb]}},class extends Ll{init(){const e=this.editor,t=(e.config.get("removePlugins")||[]).map(e=>e.pluginName),n=window.I18n.t("js.editor.macro.dropdown.chose_macro");!0!==e.config.get("openProject.disableAllMacros")&&e.ui.componentFactory.add("macroList",o=>{const i=[];for(const n of Ak){if(-1!==t.indexOf(n.pluginName))continue;const o=e.ui.componentFactory.create(n.buttonName);i.push(o)}const r=Rl(o);return Il(r,i),r.buttonView.set({isOn:!1,withText:!0,tooltip:n,label:window.I18n.t("js.editor.macro.dropdown.macros")}),r.toolbarView.isVertical=!0,r.toolbarView.className="op-macro-list-button",r})}}].concat(Ak,Tk);function Ek(e){const t=document.createElement("span");return t.classList.add("mention-list-item"),t.textContent=e.name,t}const Sk={heading:{options:[{model:"paragraph",title:"Paragraph",class:"ck-heading_paragraph"},{model:"heading1",view:"h1",title:"Heading 1",class:"ck-heading_heading1"},{model:"heading2",view:"h2",title:"Heading 2",class:"ck-heading_heading2"},{model:"heading3",view:"h3",title:"Heading 3",class:"ck-heading_heading3"},{model:"heading4",view:"h4",title:"Heading 4",class:"ck-heading_heading4"},{model:"heading5",view:"h5",title:"Heading 5",class:"ck-heading_heading5"}]},toolbar:{},OPMacroEmbeddedTable:{toolbar:["opEditEmbeddedTableQuery"]},OPMacroWpButton:{toolbar:["opEditWpMacroButton"]},OPWikiIncludePage:{toolbar:["opEditWikiIncludeMacroButton"]},OPCodeBlock:{toolbar:["opEditCodeBlock"]},OPChildPages:{toolbar:["opEditChildPagesMacroButton"]},image:{toolbar:["imageStyle:full","|","imageTextAlternative"]},table:{contentToolbar:["tableColumn","tableRow","mergeTableCells","tableProperties","tableCellProperties"]},mention:{feeds:[{marker:"@",feed:function(e){let t=nd(this);if(!t||"WorkPackage"!==t._type)return[];const n=t.project.idFromLink,o=od(this).api.v3.principals(n,e);let i=window.OpenProject.urlRoot+"/users/";return new Promise((e,t)=>{jQuery.getJSON(o,t=>{e(t._embedded.elements.map(e=>{const t=`${e._type.toLowerCase()}#${e.id}`;return{type:"user",id:`@${e.id}`,text:t,name:e.name,link:i+e.id}}))})})},itemRenderer:Ek,minimumCharacters:0},{marker:"#",feed:function(e){const t=window.OpenProject.urlRoot+"/work_packages/auto_complete.json";let n=window.OpenProject.urlRoot+"/work_packages/";return new Promise((o,i)=>{jQuery.getJSON(t,{q:e,scope:"all"},e=>{o(e.map(e=>{const t=`#${e.id}`;return{type:"work_package",id:t,text:t,name:e.to_s,link:n+e.id}}))})})},itemRenderer:Ek,minimumCharacters:1}]},language:"en"};function Rk(e){return(t,n)=>{const o=n.openProject.context;n.removePlugins=n.removePlugins||[];const i=o.resource;if(i&&i.canAddAttachments||n.removePlugins.push(...Tk.map(e=>e.pluginName)),!1===o.macros&&(n.openProject.disableAllMacros=!0,n.removePlugins.push(...Ak.map(e=>e.pluginName))),Array.isArray(o.macros)){const e=Ak.filter(e=>-1===o.macros.indexOf(e.pluginName));n.removePlugins.push(...e)}return e.create(t,n)}}class Ik extends Bl{}class Ok extends Bl{}window.OPConstrainedEditor=Ik,window.OPClassicEditor=Ok,Ok.createCustomized=Rk(Ok),Ok.builtinPlugins=Pk,Ok.defaultConfig=Object.assign({},Sk),Ok.defaultConfig.toolbar={items:["heading","|","bold","italic","strikethrough","code","insertCodeBlock","link","bulletedList","numberedList","todoList","imageUpload","blockQuote","|","insertTable","macroList","|","undo","redo","openProjectShowFormattingHelp","|","preview","opShowSource"]},Ik.createCustomized=Rk(Ik),Ik.builtinPlugins=Pk,Ik.defaultConfig=Object.assign({},Sk),Ik.defaultConfig.toolbar={items:["bold","italic","strikethrough","code","insertCodeBlock","link","bulletedList","numberedList","todoList","imageUpload","blockQuote","|","openProjectShowFormattingHelp","preview","opShowSource"]}}]).default}));
|
|
|
//# sourceMappingURL=ckeditor.js.map
|