@ckeditor/ckeditor5-html-support 45.2.1 → 46.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/build/html-support.js +2 -2
  2. package/dist/index.js +66 -13
  3. package/dist/index.js.map +1 -1
  4. package/package.json +13 -12
  5. package/src/converters.d.ts +21 -11
  6. package/src/converters.js +10 -0
  7. package/src/datafilter.d.ts +6 -6
  8. package/src/datafilter.js +7 -5
  9. package/src/dataschema.d.ts +14 -14
  10. package/src/dataschema.js +2 -2
  11. package/src/emptyblock.d.ts +1 -1
  12. package/src/emptyblock.js +1 -1
  13. package/src/fullpage.d.ts +1 -1
  14. package/src/fullpage.js +4 -4
  15. package/src/generalhtmlsupport.d.ts +20 -16
  16. package/src/generalhtmlsupport.js +21 -14
  17. package/src/generalhtmlsupportconfig.d.ts +5 -5
  18. package/src/htmlcomment.d.ts +6 -6
  19. package/src/htmlcomment.js +1 -1
  20. package/src/htmlpagedataprocessor.d.ts +1 -1
  21. package/src/htmlpagedataprocessor.js +3 -3
  22. package/src/index.d.ts +23 -19
  23. package/src/index.js +11 -7
  24. package/src/integrations/codeblock.d.ts +2 -2
  25. package/src/integrations/codeblock.js +2 -2
  26. package/src/integrations/customelement.d.ts +3 -3
  27. package/src/integrations/customelement.js +7 -6
  28. package/src/integrations/dualcontent.d.ts +6 -5
  29. package/src/integrations/dualcontent.js +6 -5
  30. package/src/integrations/heading.d.ts +2 -2
  31. package/src/integrations/heading.js +2 -2
  32. package/src/integrations/horizontalline.d.ts +2 -2
  33. package/src/integrations/horizontalline.js +2 -2
  34. package/src/integrations/image.d.ts +2 -2
  35. package/src/integrations/image.js +2 -2
  36. package/src/integrations/integrationutils.d.ts +2 -2
  37. package/src/integrations/list.d.ts +2 -2
  38. package/src/integrations/list.js +2 -2
  39. package/src/integrations/mediaembed.d.ts +2 -2
  40. package/src/integrations/mediaembed.js +3 -3
  41. package/src/integrations/script.d.ts +2 -2
  42. package/src/integrations/script.js +4 -3
  43. package/src/integrations/style.d.ts +2 -2
  44. package/src/integrations/style.js +4 -3
  45. package/src/integrations/table.d.ts +2 -2
  46. package/src/integrations/table.js +2 -2
  47. package/src/schemadefinitions.d.ts +4 -5
  48. package/src/schemadefinitions.js +5 -2
  49. package/src/utils.d.ts +26 -7
  50. package/src/utils.js +30 -0
@@ -1,5 +1,5 @@
1
- !function(e){const t=e.en=e.en||{};t.dictionary=Object.assign(t.dictionary||{},{"HTML object":"HTML object"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={})),
1
+ !function(t){const e=t.en=t.en||{};e.dictionary=Object.assign(e.dictionary||{},{"HTML object":"HTML object"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={})),
2
2
  /*!
3
3
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
4
4
  * For licensing, see LICENSE.md.
5
- */(()=>{var e={21:e=>{"use strict";e.exports=function(e,t){Object.keys(t).forEach(function(i){e.setAttribute(i,t[i])})}},51:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},128:e=>{"use strict";var t={};e.exports=function(e,i){var r=function(e){if(void 0===t[e]){var i=document.querySelector(e);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(e){i=null}t[e]=i}return t[e]}(e);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(i)}},237:e=>{"use strict";e.exports=CKEditor5.dll},275:(e,t,i)=>{"use strict";i.d(t,{A:()=>s});var r=i(758),o=i.n(r),n=i(935),l=i.n(n)()(o());l.push([e.id,":root{--ck-html-object-embed-unfocused-outline-width:1px}.ck-widget.html-object-embed{background-color:var(--ck-color-base-foreground);font-size:var(--ck-font-size-base);min-width:calc(76px + var(--ck-spacing-standard));padding:var(--ck-spacing-small);padding-top:calc(var(--ck-font-size-tiny) + var(--ck-spacing-large))}.ck-widget.html-object-embed:not(.ck-widget_selected):not(:hover){outline:var(--ck-html-object-embed-unfocused-outline-width) dashed var(--ck-color-widget-blurred-border)}.ck-widget.html-object-embed:before{background:#999;border-radius:0 0 var(--ck-border-radius) var(--ck-border-radius);color:var(--ck-color-base-background);content:attr(data-html-object-embed-label);font-family:var(--ck-font-face);font-size:var(--ck-font-size-tiny);font-style:normal;font-weight:400;left:var(--ck-spacing-standard);padding:calc(var(--ck-spacing-tiny) + var(--ck-html-object-embed-unfocused-outline-width)) var(--ck-spacing-small) var(--ck-spacing-tiny);position:absolute;top:0;transition:background var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve)}.ck-widget.html-object-embed .ck-widget__type-around .ck-widget__type-around__button.ck-widget__type-around__button_before{margin-left:50px}.ck-widget.html-object-embed .html-object-embed__content{pointer-events:none}div.ck-widget.html-object-embed{margin:1em auto}span.ck-widget.html-object-embed{display:inline-block}",""]);const s=l},507:(e,t,i)=>{e.exports=i(237)("./src/enter.js")},584:(e,t,i)=>{e.exports=i(237)("./src/utils.js")},591:e=>{"use strict";var t=[];function i(e){for(var i=-1,r=0;r<t.length;r++)if(t[r].identifier===e){i=r;break}return i}function r(e,r){for(var n={},l=[],s=0;s<e.length;s++){var a=e[s],m=r.base?a[0]+r.base:a[0],c=n[m]||0,u="".concat(m," ").concat(c);n[m]=c+1;var d=i(u),h={css:a[1],media:a[2],sourceMap:a[3],supports:a[4],layer:a[5]};if(-1!==d)t[d].references++,t[d].updater(h);else{var f=o(h,r);r.byIndex=s,t.splice(s,0,{identifier:u,updater:f,references:1})}l.push(u)}return l}function o(e,t){var i=t.domAPI(t);i.update(e);return function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;i.update(e=t)}else i.remove()}}e.exports=function(e,o){var n=r(e=e||[],o=o||{});return function(e){e=e||[];for(var l=0;l<n.length;l++){var s=i(n[l]);t[s].references--}for(var a=r(e,o),m=0;m<n.length;m++){var c=i(n[m]);0===t[c].references&&(t[c].updater(),t.splice(c,1))}n=a}}},639:e=>{"use strict";var t,i=(t=[],function(e,i){return t[e]=i,t.filter(Boolean).join("\n")});function r(e,t,r,o){var n;if(r)n="";else{n="",o.supports&&(n+="@supports (".concat(o.supports,") {")),o.media&&(n+="@media ".concat(o.media," {"));var l=void 0!==o.layer;l&&(n+="@layer".concat(o.layer.length>0?" ".concat(o.layer):""," {")),n+=o.css,l&&(n+="}"),o.media&&(n+="}"),o.supports&&(n+="}")}if(e.styleSheet)e.styleSheet.cssText=i(t,n);else{var s=document.createTextNode(n),a=e.childNodes;a[t]&&e.removeChild(a[t]),a.length?e.insertBefore(s,a[t]):e.appendChild(s)}}var o={singleton:null,singletonCounter:0};e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=o.singletonCounter++,i=o.singleton||(o.singleton=e.insertStyleElement(e));return{update:function(e){r(i,t,!1,e)},remove:function(e){r(i,t,!0,e)}}}},758:e=>{"use strict";e.exports=function(e){return e[1]}},782:(e,t,i)=>{e.exports=i(237)("./src/core.js")},783:(e,t,i)=>{e.exports=i(237)("./src/engine.js")},901:(e,t,i)=>{e.exports=i(237)("./src/widget.js")},935:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var i="",r=void 0!==t[5];return t[4]&&(i+="@supports (".concat(t[4],") {")),t[2]&&(i+="@media ".concat(t[2]," {")),r&&(i+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),i+=e(t),r&&(i+="}"),t[2]&&(i+="}"),t[4]&&(i+="}"),i}).join("")},t.i=function(e,i,r,o,n){"string"==typeof e&&(e=[[null,e,void 0]]);var l={};if(r)for(var s=0;s<this.length;s++){var a=this[s][0];null!=a&&(l[a]=!0)}for(var m=0;m<e.length;m++){var c=[].concat(e[m]);r&&l[c[0]]||(void 0!==n&&(void 0===c[5]||(c[1]="@layer".concat(c[5].length>0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=n),i&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=i):c[2]=i),o&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=o):c[4]="".concat(o)),t.push(c))}},t}}},t={};function i(r){var o=t[r];if(void 0!==o)return o.exports;var n=t[r]={id:r,exports:{}};return e[r](n,n.exports,i),n.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};(()=>{"use strict";i.r(r),i.d(r,{DataFilter:()=>we,DataSchema:()=>ne,EmptyBlock:()=>Ze,FullPage:()=>Qe,GeneralHtmlSupport:()=>qe,HtmlComment:()=>Ge,HtmlPageDataProcessor:()=>Xe});var e=i(782),t=i(584),o=i(783),n=i(901);function l(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function s(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const a="[object RegExp]",m="[object String]",c="[object Number]",u="[object Boolean]",d="[object Arguments]",h="[object Symbol]",f="[object Date]",g="[object Map]",b="[object Set]",p="[object Array]",w="[object ArrayBuffer]",A="[object Object]",y="[object DataView]",v="[object Uint8Array]",E="[object Uint8ClampedArray]",S="[object Uint16Array]",k="[object Uint32Array]",O="[object Int8Array]",C="[object Int16Array]",j="[object Int32Array]",P="[object Float32Array]",F="[object Float64Array]";function I(e){return null==e||"object"!=typeof e&&"function"!=typeof e}function $(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function _(e,t,i,r=new Map,o=void 0){const n=o?.(e,t,i,r);if(null!=n)return n;if(I(e))return e;if(r.has(e))return r.get(e);if(Array.isArray(e)){const t=new Array(e.length);r.set(e,t);for(let n=0;n<e.length;n++)t[n]=_(e[n],n,i,r,o);return Object.hasOwn(e,"index")&&(t.index=e.index),Object.hasOwn(e,"input")&&(t.input=e.input),t}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){const t=new RegExp(e.source,e.flags);return t.lastIndex=e.lastIndex,t}if(e instanceof Map){const t=new Map;r.set(e,t);for(const[n,l]of e)t.set(n,_(l,n,i,r,o));return t}if(e instanceof Set){const t=new Set;r.set(e,t);for(const n of e)t.add(_(n,void 0,i,r,o));return t}if("undefined"!=typeof Buffer&&Buffer.isBuffer(e))return e.subarray();if($(e)){const t=new(Object.getPrototypeOf(e).constructor)(e.length);r.set(e,t);for(let n=0;n<e.length;n++)t[n]=_(e[n],n,i,r,o);return t}if(e instanceof ArrayBuffer||"undefined"!=typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){const t=new DataView(e.buffer.slice(0),e.byteOffset,e.byteLength);return r.set(e,t),B(t,e,i,r,o),t}if("undefined"!=typeof File&&e instanceof File){const t=new File([e],e.name,{type:e.type});return r.set(e,t),B(t,e,i,r,o),t}if(e instanceof Blob){const t=new Blob([e],{type:e.type});return r.set(e,t),B(t,e,i,r,o),t}if(e instanceof Error){const t=new e.constructor;return r.set(e,t),t.message=e.message,t.name=e.name,t.stack=e.stack,t.cause=e.cause,B(t,e,i,r,o),t}if("object"==typeof e&&function(e){switch(s(e)){case d:case p:case w:case y:case u:case f:case P:case F:case O:case C:case j:case g:case c:case A:case a:case b:case m:case h:case v:case E:case S:case k:return!0;default:return!1}}(e)){const t=Object.create(Object.getPrototypeOf(e));return r.set(e,t),B(t,e,i,r,o),t}return e}function B(e,t,i=e,r,o){const n=[...Object.keys(t),...l(t)];for(let l=0;l<n.length;l++){const s=n[l],a=Object.getOwnPropertyDescriptor(e,s);(null==a||a.writable)&&(e[s]=_(t[s],s,i,r,o))}}function x(e,t){return function(e,t){return _(e,void 0,e,new Map,t)}(e,(i,r,o,n)=>{const l=t?.(i,r,o,n);if(null!=l)return l;if("object"==typeof e)switch(Object.prototype.toString.call(e)){case c:case m:case u:{const t=new e.constructor(e?.valueOf());return B(t,e),t}case d:{const t={};return B(t,e),t.length=e.length,t[Symbol.iterator]=e[Symbol.iterator],t}default:return}})}function T(e){return x(e)}const D=/\p{Lu}?\p{Ll}+|[0-9]+|\p{Lu}+(?!\p{Ll})|\p{Emoji_Presentation}|\p{Extended_Pictographic}|\p{L}+/gu;function R(e){if(null==e)return"";if(Array.isArray(e))return e.map(R).join(",");const t=String(e);return"0"===t&&Object.is(Number(e),-0)?"-0":t}function N(e){const t=function(e){return Array.from(e.match(D)??[])}(function(e){return"string"!=typeof e&&(e=R(e)),e.replace(/['\u2019]/g,"")}(e).trim());let i="";for(let e=0;e<t.length;e++){const r=t[e];i&&(i+=" "),r===r.toUpperCase()?i+=r:i+=r[0].toUpperCase()+r.slice(1).toLowerCase()}return i}function H(e,t,i,r){t&&function(e,t,i){if(t.attributes)for(const[r]of Object.entries(t.attributes))e.removeAttribute(r,i);if(t.styles)for(const r of Object.keys(t.styles))e.removeStyle(r,i);t.classes&&e.removeClass(t.classes,i)}(e,t,r),i&&V(e,i,r)}function V(e,t,i){if(t.attributes)for(const[r,o]of Object.entries(t.attributes))e.setAttribute(r,o,i);t.styles&&e.setStyle(t.styles,i),t.classes&&e.addClass(t.classes,i)}function L(e,t,i,r,o){const n=t.getAttribute(i),l={};for(const e of["attributes","styles","classes"]){if(e!=r){n&&n[e]&&(l[e]=n[e]);continue}if("classes"==r){const t=new Set(n&&n.classes||[]);o(t),t.size&&(l[e]=Array.from(t));continue}const t=new Map(Object.entries(n&&n[e]||{}));o(t),t.size&&(l[e]=Object.fromEntries(t))}Object.keys(l).length?t.is("documentSelection")?e.setSelectionAttribute(i,l):e.setAttribute(i,l,t):n&&(t.is("documentSelection")?e.removeSelectionAttribute(i):e.removeAttribute(i,t))}function M(e){return`html${t=e,N(t).replace(/ /g,"")}Attributes`;var t}function U({model:e}){return(t,i)=>i.writer.createElement(e,{htmlContent:t.getCustomProperty("$rawContent")})}function z(e,{view:t,isInline:i}){const r=e.t;return(e,{writer:o})=>{const l=r("HTML object"),s=W(t,e,o),a=e.getAttribute(M(t));o.addClass("html-object-embed__content",s),a&&V(o,a,s);const m=o.createContainerElement(i?"span":"div",{class:"html-object-embed","data-html-object-embed-label":l},s);return(0,n.toWidget)(m,o,{label:l})}}function W(e,t,i){return i.createRawElement(e,null,(e,i)=>{i.setContentOf(e,t.getAttribute("htmlContent"))})}function q({view:e,model:t,allowEmpty:i},r){return t=>{t.on(`element:${e}`,(e,t,n)=>{let l=r.processViewAttributes(t.viewItem,n);if(l||n.consumable.test(t.viewItem,{name:!0})){if(l=l||{},n.consumable.consume(t.viewItem,{name:!0}),t.modelRange||(t=Object.assign(t,n.convertChildren(t.viewItem,t.modelCursor))),i&&t.modelRange.isCollapsed&&Object.keys(l).length){const e=n.writer.createElement("htmlEmptyElement");if(!n.safeInsert(e,t.modelCursor))return;const i=n.getSplitParts(e);return t.modelRange=n.writer.createRange(t.modelRange.start,n.writer.createPositionAfter(i[i.length-1])),n.updateConversionResult(e,t),void o(e,l,n)}for(const e of t.modelRange.getItems())o(e,l,n)}},{priority:"low"})};function o(e,i,r){if(r.schema.checkAttribute(e,t)){const o=function(e,t){const i=T(e);let r="attributes";for(r in t)i[r]="classes"==r?Array.from(new Set([...e[r]||[],...t[r]])):{...e[r],...t[r]};return i}(i,e.getAttribute(t)||{});r.writer.setAttribute(t,o,e)}}}function K({model:e,view:t},i){return(r,{writer:o,consumable:l})=>{if(!r.hasAttribute(e))return null;const s=o.createContainerElement(t),a=r.getAttribute(e);return l.consume(r,`attribute:${e}`),V(o,a,s),s.getFillerOffset=()=>null,i?(0,n.toWidget)(s,o):s}}function G({priority:e,view:t}){return(i,r)=>{if(!i)return;const{writer:o}=r,n=o.createAttributeElement(t,null,{priority:e});return V(o,i,n),n}}function X({view:e},t){return i=>{i.on(`element:${e}`,(e,i,r)=>{if(!i.modelRange||i.modelRange.isCollapsed)return;const o=t.processViewAttributes(i.viewItem,r);o&&r.writer.setAttribute(M(i.viewItem.name),o,i.modelRange)},{priority:"low"})}}function Q({view:e,model:t}){return i=>{i.on(`attribute:${M(e)}:${t}`,(e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const{attributeOldValue:r,attributeNewValue:o}=t;H(i.writer,r,o,i.mapper.toViewElement(t.item))})}}const Y=[{model:"codeBlock",view:"pre"},{model:"paragraph",view:"p"},{model:"blockQuote",view:"blockquote"},{model:"listItem",view:"li"},{model:"pageBreak",view:"div"},{model:"rawHtml",view:"div"},{model:"table",view:"table"},{model:"tableRow",view:"tr"},{model:"tableCell",view:"td"},{model:"tableCell",view:"th"},{model:"tableColumnGroup",view:"colgroup"},{model:"tableColumn",view:"col"},{model:"caption",view:"caption"},{model:"caption",view:"figcaption"},{model:"imageBlock",view:"img"},{model:"imageInline",view:"img"},{model:"horizontalLine",view:"hr"},{model:"htmlP",view:"p",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlBlockquote",view:"blockquote",modelSchema:{inheritAllFrom:"$container"}},{model:"htmlTable",view:"table",modelSchema:{allowWhere:"$block",isBlock:!0}},{model:"htmlTbody",view:"tbody",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlThead",view:"thead",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlTfoot",view:"tfoot",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlCaption",view:"caption",modelSchema:{allowIn:"htmlTable",allowChildren:"$text",isBlock:!1}},{model:"htmlColgroup",view:"colgroup",modelSchema:{allowIn:"htmlTable",allowChildren:"col",isBlock:!1}},{model:"htmlCol",view:"col",modelSchema:{allowIn:"htmlColgroup",isBlock:!1}},{model:"htmlTr",view:"tr",modelSchema:{allowIn:["htmlTable","htmlThead","htmlTbody"],isLimit:!0}},{model:"htmlTd",view:"td",modelSchema:{allowIn:"htmlTr",allowContentOf:"$container",isLimit:!0,isBlock:!1}},{model:"htmlTh",view:"th",modelSchema:{allowIn:"htmlTr",allowContentOf:"$container",isLimit:!0,isBlock:!1}},{model:"htmlFigure",view:"figure",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlFigcaption",view:"figcaption",modelSchema:{allowIn:"htmlFigure",allowChildren:"$text",isBlock:!1}},{model:"htmlAddress",view:"address",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlAside",view:"aside",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlMain",view:"main",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlDetails",view:"details",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlSummary",view:"summary",modelSchema:{allowChildren:["htmlH1","htmlH2","htmlH3","htmlH4","htmlH5","htmlH6","$text"],allowIn:"htmlDetails",isBlock:!1}},{model:"htmlDiv",view:"div",paragraphLikeModel:"htmlDivParagraph",modelSchema:{inheritAllFrom:"$container"}},{model:"htmlFieldset",view:"fieldset",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlLegend",view:"legend",modelSchema:{allowIn:"htmlFieldset",allowChildren:"$text"}},{model:"htmlHeader",view:"header",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlFooter",view:"footer",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlForm",view:"form",modelSchema:{inheritAllFrom:"$container",isBlock:!0}},{model:"htmlHgroup",view:"hgroup",modelSchema:{allowIn:["$root","$container"],allowChildren:["paragraph","htmlP","htmlH1","htmlH2","htmlH3","htmlH4","htmlH5","htmlH6"],isBlock:!1}},{model:"htmlH1",view:"h1",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH2",view:"h2",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH3",view:"h3",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH4",view:"h4",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH5",view:"h5",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH6",view:"h6",modelSchema:{inheritAllFrom:"$block"}},{model:"$htmlList",modelSchema:{allowWhere:"$container",allowChildren:["$htmlList","htmlLi"],isBlock:!1}},{model:"htmlDir",view:"dir",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlMenu",view:"menu",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlUl",view:"ul",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlOl",view:"ol",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlLi",view:"li",modelSchema:{allowIn:"$htmlList",allowChildren:"$text",isBlock:!1}},{model:"htmlPre",view:"pre",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlArticle",view:"article",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlSection",view:"section",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlNav",view:"nav",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlDivDl",view:"div",modelSchema:{allowChildren:["htmlDt","htmlDd"],allowIn:"htmlDl"}},{model:"htmlDl",view:"dl",modelSchema:{allowWhere:"$container",allowChildren:["htmlDt","htmlDd","htmlDivDl"],isBlock:!1}},{model:"htmlDt",view:"dt",modelSchema:{allowChildren:"$block",isBlock:!1}},{model:"htmlDd",view:"dd",modelSchema:{allowChildren:"$block",isBlock:!1}},{model:"htmlCenter",view:"center",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlHr",view:"hr",isEmpty:!0,modelSchema:{inheritAllFrom:"$blockObject"}}],J=[{model:"htmlLiAttributes",view:"li",appliesToBlock:!0,coupledAttribute:"listItemId"},{model:"htmlOlAttributes",view:"ol",appliesToBlock:!0,coupledAttribute:"listItemId"},{model:"htmlUlAttributes",view:"ul",appliesToBlock:!0,coupledAttribute:"listItemId"},{model:"htmlFigureAttributes",view:"figure",appliesToBlock:"table"},{model:"htmlTheadAttributes",view:"thead",appliesToBlock:"table"},{model:"htmlTbodyAttributes",view:"tbody",appliesToBlock:"table"},{model:"htmlFigureAttributes",view:"figure",appliesToBlock:"imageBlock"},{model:"htmlAcronym",view:"acronym",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlTt",view:"tt",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlFont",view:"font",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlTime",view:"time",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlVar",view:"var",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlBig",view:"big",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSmall",view:"small",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSamp",view:"samp",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlQ",view:"q",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlOutput",view:"output",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlKbd",view:"kbd",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlBdi",view:"bdi",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlBdo",view:"bdo",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlAbbr",view:"abbr",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlA",view:"a",priority:5,coupledAttribute:"linkHref"},{model:"htmlStrong",view:"strong",coupledAttribute:"bold",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlB",view:"b",coupledAttribute:"bold",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlI",view:"i",coupledAttribute:"italic",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlEm",view:"em",coupledAttribute:"italic",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlS",view:"s",coupledAttribute:"strikethrough",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlDel",view:"del",coupledAttribute:"strikethrough",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlIns",view:"ins",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlU",view:"u",coupledAttribute:"underline",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSub",view:"sub",coupledAttribute:"subscript",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSup",view:"sup",coupledAttribute:"superscript",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlCode",view:"code",coupledAttribute:"code",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlMark",view:"mark",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSpan",view:"span",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlCite",view:"cite",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlLabel",view:"label",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlDfn",view:"dfn",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlObject",view:"object",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlIframe",view:"iframe",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlInput",view:"input",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlButton",view:"button",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlTextarea",view:"textarea",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlSelect",view:"select",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlVideo",view:"video",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlEmbed",view:"embed",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlOembed",view:"oembed",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlAudio",view:"audio",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlImg",view:"img",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlCanvas",view:"canvas",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlMeter",view:"meter",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlProgress",view:"progress",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlScript",view:"script",modelSchema:{allowWhere:["$text","$block"],isInline:!0}},{model:"htmlStyle",view:"style",modelSchema:{allowWhere:["$text","$block"],isInline:!0}},{model:"htmlCustomElement",view:"$customElement",modelSchema:{allowWhere:["$text","$block"],allowAttributesOf:"$inlineObject",isInline:!0}}];function Z(e){return null!==e&&"object"==typeof e&&"[object Arguments]"===s(e)}function ee(e){return"object"==typeof e&&null!==e}function te(e){if("object"!=typeof e)return!1;if(null==e)return!1;if(null===Object.getPrototypeOf(e))return!0;if("[object Object]"!==Object.prototype.toString.call(e)){const t=e[Symbol.toStringTag];if(null==t)return!1;return!!Object.getOwnPropertyDescriptor(e,Symbol.toStringTag)?.writable&&e.toString()===`[object ${t}]`}let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function ie(e){return $(e)}function re(e,...t){const i=t.slice(0,-1),r=t[t.length-1];let o=e;for(let e=0;e<i.length;e++){o=oe(o,i[e],r,new Map)}return o}function oe(e,t,i,r){if(I(e)&&(e=Object(e)),null==t||"object"!=typeof t)return e;if(r.has(t))return function(e){if(I(e))return e;if(Array.isArray(e)||$(e)||e instanceof ArrayBuffer||"undefined"!=typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer)return e.slice(0);const t=Object.getPrototypeOf(e),i=t.constructor;if(e instanceof Date||e instanceof Map||e instanceof Set)return new i(e);if(e instanceof RegExp){const t=new i(e);return t.lastIndex=e.lastIndex,t}if(e instanceof DataView)return new i(e.buffer.slice(0));if(e instanceof Error){const t=new i(e.message);return t.stack=e.stack,t.name=e.name,t.cause=e.cause,t}if("undefined"!=typeof File&&e instanceof File)return new i([e],e.name,{type:e.type,lastModified:e.lastModified});if("object"==typeof e){const i=Object.create(t);return Object.assign(i,e)}return e}(r.get(t));if(r.set(t,e),Array.isArray(t)){t=t.slice();for(let e=0;e<t.length;e++)t[e]=t[e]??void 0}const o=[...Object.keys(t),...l(t)];for(let n=0;n<o.length;n++){const l=o[n];let s=t[l],a=e[l];if(Z(s)&&(s={...s}),Z(a)&&(a={...a}),"undefined"!=typeof Buffer&&Buffer.isBuffer(s)&&(s=T(s)),Array.isArray(s))if("object"==typeof a&&null!=a){const e=[],t=Reflect.ownKeys(a);for(let i=0;i<t.length;i++){const r=t[i];e[r]=a[r]}a=e}else a=[];const m=i(a,s,l,e,t,r);null!=m?e[l]=m:Array.isArray(s)||ee(a)&&ee(s)?e[l]=oe(a,s,i,r):null==a&&te(s)?e[l]=oe({},s,i,r):null==a&&ie(s)?e[l]=T(s):void 0!==a&&void 0===s||(e[l]=s)}return e}class ne extends e.Plugin{_definitions=[];static get pluginName(){return"DataSchema"}static get isOfficialPlugin(){return!0}init(){for(const e of Y)this.registerBlockElement(e);for(const e of J)this.registerInlineElement(e)}registerBlockElement(e){this._definitions.push({...e,isBlock:!0})}registerInlineElement(e){this._definitions.push({...e,isInline:!0})}extendBlockElement(e){this._extendDefinition({...e,isBlock:!0})}extendInlineElement(e){this._extendDefinition({...e,isInline:!0})}getDefinitionsForView(e,t=!1){const i=new Set;for(const r of this._getMatchingViewDefinitions(e)){if(t)for(const e of this._getReferences(r.model))i.add(e);i.add(r)}return i}getDefinitionsForModel(e){return this._definitions.filter(t=>t.model==e)}_getMatchingViewDefinitions(e){return this._definitions.filter(t=>t.view&&function(e,t){if("string"==typeof e)return e===t;if(e instanceof RegExp)return e.test(t);return!1}(e,t.view))}*_getReferences(e){const i=["inheritAllFrom","inheritTypesFrom","allowWhere","allowContentOf","allowAttributesOf"],r=this._definitions.filter(t=>t.model==e);for(const{modelSchema:o}of r)if(o)for(const r of i)for(const i of(0,t.toArray)(o[r]||[])){const t=this._definitions.filter(e=>e.model==i);for(const r of t)i!==e&&(yield*this._getReferences(r.model),yield r)}}_extendDefinition(e){const t=Array.from(this._definitions.entries()).filter(([,t])=>t.model==e.model);if(0!=t.length)for(const[i,r]of t)this._definitions[i]=re({},r,e,(e,t)=>Array.isArray(e)?e.concat(t):void 0);else this._definitions.push(e)}}var le=i(591),se=i.n(le),ae=i(639),me=i.n(ae),ce=i(128),ue=i.n(ce),de=i(21),he=i.n(de),fe=i(51),ge=i.n(fe),be=i(275),pe={attributes:{"data-cke":!0}};pe.setAttributes=he(),pe.insert=ue().bind(null,"head"),pe.domAPI=me(),pe.insertStyleElement=ge();se()(be.A,pe);be.A&&be.A.locals&&be.A.locals;class we extends e.Plugin{_dataSchema;_allowedAttributes;_disallowedAttributes;_allowedElements;_disallowedElements;_dataInitialized;_coupledAttributes;constructor(e){super(e),this._dataSchema=e.plugins.get("DataSchema"),this._allowedAttributes=new o.Matcher,this._disallowedAttributes=new o.Matcher,this._allowedElements=new Set,this._disallowedElements=new Set,this._dataInitialized=!1,this._coupledAttributes=null,this._registerElementsAfterInit(),this._registerElementHandlers(),this._registerCoupledAttributesPostFixer(),this._registerAssociatedHtmlAttributesPostFixer()}static get pluginName(){return"DataFilter"}static get isOfficialPlugin(){return!0}static get requires(){return[ne,n.Widget]}loadAllowedConfig(e){for(const t of e){const e=t.name||/[\s\S]+/,i=Se(t);this.allowElement(e),i.forEach(e=>this.allowAttributes(e))}}loadDisallowedConfig(e){for(const t of e){const e=t.name||/[\s\S]+/,i=Se(t);0==i.length?this.disallowElement(e):i.forEach(e=>this.disallowAttributes(e))}}loadAllowedEmptyElementsConfig(e){for(const t of e)this.allowEmptyElement(t)}allowElement(e){for(const t of this._dataSchema.getDefinitionsForView(e,!0))this._addAllowedElement(t),this._coupledAttributes=null}disallowElement(e){for(const t of this._dataSchema.getDefinitionsForView(e,!1))this._disallowedElements.add(t.view)}allowEmptyElement(e){for(const t of this._dataSchema.getDefinitionsForView(e,!0))t.isInline&&this._dataSchema.extendInlineElement({...t,allowEmpty:!0})}allowAttributes(e){this._allowedAttributes.add(e)}disallowAttributes(e){this._disallowedAttributes.add(e)}processViewAttributes(e,t){const{consumable:i}=t;return Ae(e,this._disallowedAttributes,i),function(e,{attributes:t,classes:i,styles:r}){if(!t.length&&!i.length&&!r.length)return null;return{...t.length&&{attributes:ye(e,t)},...r.length&&{styles:ve(e,r)},...i.length&&{classes:i}}}(e,Ae(e,this._allowedAttributes,i))}_addAllowedElement(e){if(!this._allowedElements.has(e)){if(this._allowedElements.add(e),"appliesToBlock"in e&&"string"==typeof e.appliesToBlock)for(const t of this._dataSchema.getDefinitionsForModel(e.appliesToBlock))t.isBlock&&this._addAllowedElement(t);this._dataInitialized&&this.editor.data.once("set",()=>{this._fireRegisterEvent(e)},{priority:t.priorities.highest+1})}}_registerElementsAfterInit(){this.editor.data.on("init",()=>{this._dataInitialized=!0;for(const e of this._allowedElements)this._fireRegisterEvent(e)},{priority:t.priorities.highest+1})}_registerElementHandlers(){this.on("register",(e,i)=>{const r=this.editor.model.schema;if(i.isObject&&!r.isRegistered(i.model))this._registerObjectElement(i);else if(i.isBlock)this._registerBlockElement(i);else{if(!i.isInline)throw new t.CKEditorError("data-filter-invalid-definition",null,i);this._registerInlineElement(i)}e.stop()},{priority:"lowest"})}_registerCoupledAttributesPostFixer(){const e=this.editor.model,t=e.document.selection;e.document.registerPostFixer(t=>{const i=e.document.differ.getChanges();let r=!1;const o=this._getCoupledAttributesMap();for(const e of i){if("attribute"!=e.type||null!==e.attributeNewValue)continue;const i=o.get(e.attributeKey);if(i)for(const{item:o}of e.range.getWalker())for(const e of i)o.hasAttribute(e)&&(t.removeAttribute(e,o),r=!0)}return r}),this.listenTo(t,"change:attribute",(i,{attributeKeys:r})=>{const o=new Set,n=this._getCoupledAttributesMap();for(const e of r){if(t.hasAttribute(e))continue;const i=n.get(e);if(i)for(const e of i)t.hasAttribute(e)&&o.add(e)}0!=o.size&&e.change(e=>{for(const t of o)e.removeSelectionAttribute(t)})})}_registerAssociatedHtmlAttributesPostFixer(){const e=this.editor.model;e.document.registerPostFixer(t=>{const i=e.document.differ.getChanges();let r=!1;for(const o of i)if("insert"===o.type&&"$text"!==o.name)for(const i of o.attributes.keys())i.startsWith("html")&&i.endsWith("Attributes")&&(e.schema.checkAttribute(o.name,i)||(t.removeAttribute(i,o.position.nodeAfter),r=!0));return r})}_getCoupledAttributesMap(){if(this._coupledAttributes)return this._coupledAttributes;this._coupledAttributes=new Map;for(const e of this._allowedElements)if(e.coupledAttribute&&e.model){const t=this._coupledAttributes.get(e.coupledAttribute);t?t.push(e.model):this._coupledAttributes.set(e.coupledAttribute,[e.model])}return this._coupledAttributes}_fireRegisterEvent(e){e.view&&this._disallowedElements.has(e.view)||this.fire(e.view?`register:${e.view}`:"register",e)}_registerObjectElement(e){const i=this.editor,r=i.model.schema,o=i.conversion,{view:n,model:l}=e;r.register(l,e.modelSchema),n&&(r.extend(e.model,{allowAttributes:[M(n),"htmlContent"]}),i.data.registerRawContentMatcher({name:n}),o.for("upcast").elementToElement({view:n,model:U(e),converterPriority:t.priorities.low+2}),o.for("upcast").add(X(e,this)),o.for("editingDowncast").elementToStructure({model:{name:l,attributes:[M(n)]},view:z(i,e)}),o.for("dataDowncast").elementToElement({model:l,view:(e,{writer:t})=>W(n,e,t)}),o.for("dataDowncast").add(Q(e)))}_registerBlockElement(e){const i=this.editor,r=i.model.schema,o=i.conversion,{view:n,model:l}=e;if(!r.isRegistered(e.model)){if(!e.modelSchema)return;if(r.register(e.model,e.modelSchema),!n)return;o.for("upcast").elementToElement({model:l,view:n,converterPriority:t.priorities.low+2}),o.for("downcast").elementToElement({model:l,view:(t,{writer:i})=>e.isEmpty?i.createEmptyElement(n):i.createContainerElement(n)})}n&&(r.extend(e.model,{allowAttributes:M(n)}),o.for("upcast").add(X(e,this)),o.for("downcast").add(Q(e)))}_registerInlineElement(e){const t=this.editor,i=t.model.schema,r=t.conversion,o=e.model;if(!e.appliesToBlock&&(i.extend("$text",{allowAttributes:o}),e.attributeProperties&&i.setAttributeProperties(o,e.attributeProperties),r.for("upcast").add(q(e,this)),r.for("downcast").attributeToElement({model:o,view:G(e)}),e.allowEmpty)){if(i.setAttributeProperties(o,{copyFromObject:!1}),!i.isRegistered("htmlEmptyElement")){i.register("htmlEmptyElement",{inheritAllFrom:"$inlineObject"});const e=e=>Array.from(e.getAttributeKeys()).some(e=>e.startsWith("html"));t.model.document.registerPostFixer(i=>{const r=t.model.document.differ.getChanges(),o=new Set;for(const t of r)if("remove"!==t.type){if("attribute"===t.type&&null===t.attributeNewValue)for(const{item:i}of t.range)i.is("element","htmlEmptyElement")&&!e(i)&&o.add(i);if("insert"===t.type&&t.position.nodeAfter){const r=t.position.nodeAfter;for(const{item:t}of i.createRangeOn(r))t.is("element","htmlEmptyElement")&&!e(t)&&o.add(t)}}for(const e of o)i.remove(e);return o.size>0})}t.data.htmlProcessor.domConverter.registerInlineObjectMatcher(t=>t.name==e.view&&t.isEmpty&&Array.from(t.getAttributeKeys()).length?{name:!0}:null),r.for("editingDowncast").elementToElement({model:"htmlEmptyElement",view:K(e,!0)}),r.for("dataDowncast").elementToElement({model:"htmlEmptyElement",view:K(e)})}}}function Ae(e,t,i){const r=t.matchAll(e)||[],o=e.document.stylesProcessor;return r.reduce((t,{match:r})=>{for(const[n,l]of r.attributes||[])if("style"==n){const r=l,n=o.getRelatedStyles(r).filter(e=>e.split("-").length>r.split("-").length).sort((e,t)=>t.split("-").length-e.split("-").length);for(const r of n)i.consume(e,{styles:[r]})&&t.styles.push(r);i.consume(e,{styles:[r]})&&t.styles.push(r)}else if("class"==n){const r=l;i.consume(e,{classes:[r]})&&t.classes.push(r)}else i.consume(e,{attributes:[n]})&&t.attributes.push(n);return t},{attributes:[],classes:[],styles:[]})}function ye(e,i){const r={};for(const o of i){const i=e.getAttribute(o);void 0!==i&&(0,t.isValidAttributeName)(o)&&(r[o]=i)}return r}function ve(e,t){const i=new o.StylesMap(e.document.stylesProcessor);for(const r of t){const t=e.getStyle(r);void 0!==t&&i.set(r,t)}return Object.fromEntries(i.getStylesEntries())}function Ee(e,t){const{name:i}=e,r=e[t];return te(r)?Object.entries(r).map(([e,r])=>({name:i,[t]:{[e]:r}})):Array.isArray(r)?r.map(e=>({name:i,[t]:[e]})):[e]}function Se(e){const{name:t,attributes:i,classes:r,styles:o}=e,n=[];return i&&n.push(...Ee({name:t,attributes:i},"attributes")),r&&n.push(...Ee({name:t,classes:r},"classes")),o&&n.push(...Ee({name:t,styles:o},"styles")),n}class ke extends e.Plugin{static get requires(){return[we]}static get pluginName(){return"CodeBlockElementSupport"}static get isOfficialPlugin(){return!0}init(){if(!this.editor.plugins.has("CodeBlockEditing"))return;const e=this.editor.plugins.get(we);e.on("register:pre",(t,i)=>{if("codeBlock"!==i.model)return;const r=this.editor,o=r.model.schema,n=r.conversion;o.extend("codeBlock",{allowAttributes:["htmlPreAttributes","htmlContentAttributes"]}),n.for("upcast").add(function(e){return t=>{t.on("element:code",(t,i,r)=>{const o=i.viewItem,n=o.parent;function l(t,o){const n=e.processViewAttributes(t,r);n&&r.writer.setAttribute(o,n,i.modelRange)}n&&n.is("element","pre")&&(l(n,"htmlPreAttributes"),l(o,"htmlContentAttributes"))},{priority:"low"})}}(e)),n.for("downcast").add(e=>{e.on("attribute:htmlPreAttributes:codeBlock",(e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const{attributeOldValue:r,attributeNewValue:o}=t,n=i.mapper.toViewElement(t.item).parent;H(i.writer,r,o,n)}),e.on("attribute:htmlContentAttributes:codeBlock",(e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const{attributeOldValue:r,attributeNewValue:o}=t,n=i.mapper.toViewElement(t.item);H(i.writer,r,o,n)})}),t.stop()})}}class Oe extends e.Plugin{static get requires(){return[we]}static get pluginName(){return"DualContentModelElementSupport"}static get isOfficialPlugin(){return!0}init(){this.editor.plugins.get(we).on("register",(e,i)=>{const r=i,o=this.editor,n=o.model.schema,l=o.conversion;if(!r.paragraphLikeModel)return;if(n.isRegistered(r.model)||n.isRegistered(r.paragraphLikeModel))return;const s={model:r.paragraphLikeModel,view:r.view};n.register(r.model,r.modelSchema),n.register(s.model,{inheritAllFrom:"$block"}),l.for("upcast").elementToElement({view:r.view,model:(e,{writer:t})=>this._hasBlockContent(e)?t.createElement(r.model):t.createElement(s.model),converterPriority:t.priorities.low+.5}),l.for("downcast").elementToElement({view:r.view,model:r.model}),this._addAttributeConversion(r),l.for("downcast").elementToElement({view:s.view,model:s.model}),this._addAttributeConversion(s),e.stop()})}_hasBlockContent(e){const t=this.editor.editing.view,i=t.domConverter.blockElements;for(const r of t.createRangeIn(e).getItems())if(r.is("element")&&i.includes(r.name))return!0;return!1}_addAttributeConversion(e){const t=this.editor,i=t.conversion,r=t.plugins.get(we);t.model.schema.extend(e.model,{allowAttributes:M(e.view)}),i.for("upcast").add(X(e,r)),i.for("downcast").add(Q(e))}}var Ce=i(507);class je extends e.Plugin{static get requires(){return[ne,Ce.Enter]}static get pluginName(){return"HeadingElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;if(!e.plugins.has("HeadingEditing"))return;const t=e.config.get("heading.options");this.registerHeadingElements(e,t)}registerHeadingElements(e,t){const i=e.plugins.get(ne),r=[];for(const e of t)"model"in e&&"view"in e&&(i.registerBlockElement({view:e.view,model:e.model}),r.push(e.model));i.extendBlockElement({model:"htmlHgroup",modelSchema:{allowChildren:r}}),i.extendBlockElement({model:"htmlSummary",modelSchema:{allowChildren:r}})}}function Pe(e,t,i){const r=e.createRangeOn(t);for(const{item:e}of r.getWalker())if(e.is("element",i))return e}class Fe extends e.Plugin{static get requires(){return[we]}static get pluginName(){return"ImageElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;if(!e.plugins.has("ImageInlineEditing")&&!e.plugins.has("ImageBlockEditing"))return;const t=e.model.schema,i=e.conversion,r=e.plugins.get(we);r.on("register:figure",()=>{i.for("upcast").add(function(e){return t=>{t.on("element:figure",(t,i,r)=>{const o=i.viewItem;if(!i.modelRange||!o.hasClass("image"))return;const n=e.processViewAttributes(o,r);n&&r.writer.setAttribute("htmlFigureAttributes",n,i.modelRange)},{priority:"low"})}}(r))}),r.on("register:img",(o,n)=>{"imageBlock"!==n.model&&"imageInline"!==n.model||(t.isRegistered("imageBlock")&&t.extend("imageBlock",{allowAttributes:["htmlImgAttributes","htmlFigureAttributes","htmlLinkAttributes"]}),t.isRegistered("imageInline")&&t.extend("imageInline",{allowAttributes:["htmlA","htmlImgAttributes"]}),i.for("upcast").add(function(e){return t=>{t.on("element:img",(t,i,r)=>{if(!i.modelRange)return;const o=i.viewItem,n=e.processViewAttributes(o,r);n&&r.writer.setAttribute("htmlImgAttributes",n,i.modelRange)},{priority:"low"})}}(r)),i.for("downcast").add(e=>{function t(t){e.on(`attribute:${t}:imageInline`,(e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const{attributeOldValue:r,attributeNewValue:o}=t,n=i.mapper.toViewElement(t.item);H(i.writer,r,o,n)},{priority:"low"})}function i(t,i){e.on(`attribute:${i}:imageBlock`,(e,i,r)=>{if(!r.consumable.test(i.item,e.name))return;const{attributeOldValue:o,attributeNewValue:n}=i,l=r.mapper.toViewElement(i.item),s=Pe(r.writer,l,t);s&&(H(r.writer,o,n,s),r.consumable.consume(i.item,e.name))},{priority:"low"}),"a"===t&&e.on("attribute:linkHref:imageBlock",(e,t,i)=>{if(!i.consumable.consume(t.item,"attribute:htmlLinkAttributes:imageBlock"))return;const r=i.mapper.toViewElement(t.item),o=Pe(i.writer,r,"a");V(i.writer,t.item.getAttribute("htmlLinkAttributes"),o)},{priority:"low"})}t("htmlImgAttributes"),i("img","htmlImgAttributes"),i("figure","htmlFigureAttributes"),i("a","htmlLinkAttributes")}),e.plugins.has("LinkImage")&&i.for("upcast").add(function(e,t){const i=t.plugins.get("ImageUtils");return t=>{t.on("element:a",(t,r,o)=>{const n=r.viewItem;if(!i.findViewImgElement(n))return;const l=r.modelCursor.parent;if(!l.is("element","imageBlock"))return;const s=e.processViewAttributes(n,o);s&&o.writer.setAttribute("htmlLinkAttributes",s,l)},{priority:"low"})}}(r,e)),o.stop())})}}class Ie extends e.Plugin{static get requires(){return[we]}static get pluginName(){return"MediaEmbedElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;if(!e.plugins.has("MediaEmbed")||e.config.get("mediaEmbed.previewsInData"))return;const t=e.model.schema,i=e.conversion,r=this.editor.plugins.get(we),o=this.editor.plugins.get(ne),n=e.config.get("mediaEmbed.elementName");o.registerBlockElement({model:"media",view:n}),r.on("register:figure",()=>{i.for("upcast").add(function(e){return t=>{t.on("element:figure",(t,i,r)=>{const o=i.viewItem;if(!i.modelRange||!o.hasClass("media"))return;const n=e.processViewAttributes(o,r);n&&r.writer.setAttribute("htmlFigureAttributes",n,i.modelRange)},{priority:"low"})}}(r))}),r.on(`register:${n}`,(e,o)=>{"media"===o.model&&(t.extend("media",{allowAttributes:[M(n),"htmlFigureAttributes"]}),i.for("upcast").add(function(e,t){const i=(i,r,o)=>{function n(t,i){const n=e.processViewAttributes(t,o);n&&o.writer.setAttribute(i,n,r.modelRange)}n(r.viewItem,M(t))};return e=>{e.on(`element:${t}`,i,{priority:"low"})}}(r,n)),i.for("dataDowncast").add(function(e){return t=>{function i(e,i){t.on(`attribute:${i}:media`,(t,i,r)=>{if(!r.consumable.consume(i.item,t.name))return;const{attributeOldValue:o,attributeNewValue:n}=i,l=r.mapper.toViewElement(i.item),s=Pe(r.writer,l,e);H(r.writer,o,n,s)})}i(e,M(e)),i("figure","htmlFigureAttributes")}}(n)),e.stop())})}}class $e extends e.Plugin{static get requires(){return[we]}static get pluginName(){return"ScriptElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor.plugins.get(we);e.on("register:script",(t,i)=>{const r=this.editor,o=r.model.schema,n=r.conversion;o.register("htmlScript",i.modelSchema),o.extend("htmlScript",{allowAttributes:["htmlScriptAttributes","htmlContent"],isContent:!0}),r.data.registerRawContentMatcher({name:"script"}),n.for("upcast").elementToElement({view:"script",model:U(i)}),n.for("upcast").add(X(i,e)),n.for("downcast").elementToElement({model:"htmlScript",view:(e,{writer:t})=>W("script",e,t)}),n.for("downcast").add(Q(i)),t.stop()})}}const _e=["width","max-width","min-width","height","min-height","max-height"];class Be extends e.Plugin{static get requires(){return[we]}static get pluginName(){return"TableElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;if(!e.plugins.has("TableEditing"))return;const t=e.model.schema,i=e.conversion,r=e.plugins.get(we),o=e.plugins.get("TableUtils");r.on("register:figure",()=>{i.for("upcast").add(function(e){return t=>{t.on("element:figure",(t,i,r)=>{const o=i.viewItem;if(!i.modelRange||!o.hasClass("table"))return;const n=e.processViewAttributes(o,r);n&&r.writer.setAttribute("htmlFigureAttributes",n,i.modelRange)},{priority:"low"})}}(r))}),r.on("register:table",(n,l)=>{"table"===l.model&&(t.extend("table",{allowAttributes:["htmlTableAttributes","htmlFigureAttributes","htmlTheadAttributes","htmlTbodyAttributes"]}),i.for("upcast").add(function(e){return t=>{t.on("element:table",(t,i,r)=>{if(!i.modelRange)return;const o=i.viewItem;n(o,"htmlTableAttributes");for(const e of o.getChildren())e.is("element","thead")&&n(e,"htmlTheadAttributes"),e.is("element","tbody")&&n(e,"htmlTbodyAttributes");function n(t,o){const n=e.processViewAttributes(t,r);n&&r.writer.setAttribute(o,n,i.modelRange)}},{priority:"low"})}}(r)),i.for("downcast").add(e=>{function t(t,i){e.on(`attribute:${i}:table`,(e,r,o)=>{if(!o.consumable.test(r.item,e.name))return;const n=o.mapper.toViewElement(r.item),l=Pe(o.writer,n,t);if(l)if(o.consumable.consume(r.item,e.name),"htmlTableAttributes"===i&&n!==l){const e=xe(r.attributeOldValue),t=xe(r.attributeNewValue);H(o.writer,e.tableAttributes,t.tableAttributes,l),H(o.writer,e.figureAttributes,t.figureAttributes,n)}else H(o.writer,r.attributeOldValue,r.attributeNewValue,l)})}t("table","htmlTableAttributes"),t("figure","htmlFigureAttributes"),t("thead","htmlTheadAttributes"),t("tbody","htmlTbodyAttributes")}),e.model.document.registerPostFixer(function(e,t){return i=>{const r=e.document.differ.getChanges();let o=!1;for(const e of r){if("attribute"!=e.type||"headingRows"!=e.attributeKey)continue;const r=e.range.start.nodeAfter,n=r.getAttribute("htmlTheadAttributes"),l=r.getAttribute("htmlTbodyAttributes");n&&!e.attributeNewValue?(i.removeAttribute("htmlTheadAttributes",r),o=!0):l&&e.attributeNewValue==t.getRows(r)&&(i.removeAttribute("htmlTbodyAttributes",r),o=!0)}return o}}(e.model,o)),n.stop())})}}function xe(e){const t={},i={...e};if(!e||!("styles"in e))return{figureAttributes:t,tableAttributes:i};i.styles={};for(const[r,o]of Object.entries(e.styles))_e.includes(r)?t.styles={...t.styles,[r]:o}:i.styles={...i.styles,[r]:o};return{figureAttributes:t,tableAttributes:i}}class Te extends e.Plugin{static get requires(){return[we]}static get pluginName(){return"StyleElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor.plugins.get(we);e.on("register:style",(t,i)=>{const r=this.editor,o=r.model.schema,n=r.conversion;o.register("htmlStyle",i.modelSchema),o.extend("htmlStyle",{allowAttributes:["htmlStyleAttributes","htmlContent"],isContent:!0}),r.data.registerRawContentMatcher({name:"style"}),n.for("upcast").elementToElement({view:"style",model:U(i)}),n.for("upcast").add(X(i,e)),n.for("downcast").elementToElement({model:"htmlStyle",view:(e,{writer:t})=>W("style",e,t)}),n.for("downcast").add(Q(i)),t.stop()})}}function De(e){if(!e||"object"!=typeof e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t))&&"[object Object]"===Object.prototype.toString.call(e)}function Re(e,t,i,r,o,n,l){const s=l(e,t,i,r,o,n);if(void 0!==s)return s;if(typeof e==typeof t)switch(typeof e){case"bigint":case"string":case"boolean":case"symbol":case"undefined":case"function":return e===t;case"number":return e===t||Object.is(e,t);case"object":return Ne(e,t,n,l)}return Ne(e,t,n,l)}function Ne(e,t,i,r){if(Object.is(e,t))return!0;let o=s(e),n=s(t);if(o===d&&(o=A),n===d&&(n=A),o!==n)return!1;switch(o){case m:return e.toString()===t.toString();case c:{const i=e.valueOf(),r=t.valueOf();return(I=i)===($=r)||Number.isNaN(I)&&Number.isNaN($)}case u:case f:case h:return Object.is(e.valueOf(),t.valueOf());case a:return e.source===t.source&&e.flags===t.flags;case"[object Function]":return e===t}var I,$;const _=(i=i??new Map).get(e),B=i.get(t);if(null!=_&&null!=B)return _===t;i.set(e,t),i.set(t,e);try{switch(o){case g:if(e.size!==t.size)return!1;for(const[o,n]of e.entries())if(!t.has(o)||!Re(n,t.get(o),o,e,t,i,r))return!1;return!0;case b:{if(e.size!==t.size)return!1;const o=Array.from(e.values()),n=Array.from(t.values());for(let l=0;l<o.length;l++){const s=o[l],a=n.findIndex(o=>Re(s,o,void 0,e,t,i,r));if(-1===a)return!1;n.splice(a,1)}return!0}case p:case v:case E:case S:case k:case"[object BigUint64Array]":case O:case C:case j:case"[object BigInt64Array]":case P:case F:if("undefined"!=typeof Buffer&&Buffer.isBuffer(e)!==Buffer.isBuffer(t))return!1;if(e.length!==t.length)return!1;for(let o=0;o<e.length;o++)if(!Re(e[o],t[o],o,e,t,i,r))return!1;return!0;case w:return e.byteLength===t.byteLength&&Ne(new Uint8Array(e),new Uint8Array(t),i,r);case y:return e.byteLength===t.byteLength&&e.byteOffset===t.byteOffset&&Ne(new Uint8Array(e),new Uint8Array(t),i,r);case"[object Error]":return e.name===t.name&&e.message===t.message;case A:{if(!(Ne(e.constructor,t.constructor,i,r)||De(e)&&De(t)))return!1;const o=[...Object.keys(e),...l(e)],n=[...Object.keys(t),...l(t)];if(o.length!==n.length)return!1;for(let n=0;n<o.length;n++){const l=o[n],s=e[l];if(!Object.hasOwn(t,l))return!1;if(!Re(s,t[l],l,e,t,i,r))return!1}return!0}default:return!1}}finally{i.delete(e),i.delete(t)}}function He(){}function Ve(e,t){return function(e,t,i){return Re(e,t,void 0,void 0,void 0,void 0,i)}(e,t,He)}class Le extends e.Plugin{static get requires(){return[we]}static get pluginName(){return"ListElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;if(!e.plugins.has("ListEditing"))return;const t=e.model.schema,i=e.conversion,r=e.plugins.get(we),o=e.plugins.get("ListEditing"),n=e.plugins.get("ListUtils"),l=["ul","ol","li"];o.registerDowncastStrategy({scope:"item",attributeName:"htmlLiAttributes",setAttributeOnDowncast:V}),o.registerDowncastStrategy({scope:"list",attributeName:"htmlUlAttributes",setAttributeOnDowncast:V}),o.registerDowncastStrategy({scope:"list",attributeName:"htmlOlAttributes",setAttributeOnDowncast:V}),r.on("register",(e,o)=>{if(!l.includes(o.view))return;if(e.stop(),t.checkAttribute("$block","htmlLiAttributes"))return;const n=l.map(e=>M(e));t.extend("$listItem",{allowAttributes:n}),i.for("upcast").add(e=>{e.on("element:ul",Me("htmlUlAttributes",r),{priority:"low"}),e.on("element:ol",Me("htmlOlAttributes",r),{priority:"low"}),e.on("element:li",Me("htmlLiAttributes",r),{priority:"low"})})}),o.on("postFixer",(e,{listNodes:t,writer:i})=>{for(const{node:r,previousNodeInList:o}of t)if(o){if(o.getAttribute("listType")==r.getAttribute("listType")){const t=Ue(o.getAttribute("listType")),n=o.getAttribute(t);!Ve(r.getAttribute(t),n)&&i.model.schema.checkAttribute(r,t)&&(i.setAttribute(t,n,r),e.return=!0)}if(o.getAttribute("listItemId")==r.getAttribute("listItemId")){const t=o.getAttribute("htmlLiAttributes");!Ve(r.getAttribute("htmlLiAttributes"),t)&&i.model.schema.checkAttribute(r,"htmlLiAttributes")&&(i.setAttribute("htmlLiAttributes",t,r),e.return=!0)}}}),o.on("postFixer",(e,{listNodes:t,writer:i})=>{for(const{node:r}of t){const t=r.getAttribute("listType");!n.isNumberedListType(t)&&r.getAttribute("htmlOlAttributes")&&(i.removeAttribute("htmlOlAttributes",r),e.return=!0),n.isNumberedListType(t)&&r.getAttribute("htmlUlAttributes")&&(i.removeAttribute("htmlUlAttributes",r),e.return=!0)}})}afterInit(){const e=this.editor;if(!e.commands.get("indentList"))return;const t=e.commands.get("indentList");this.listenTo(t,"afterExecute",(t,i)=>{e.model.change(t=>{for(const r of i){const i=Ue(r.getAttribute("listType"));e.model.schema.checkAttribute(r,i)&&t.setAttribute(i,{},r)}})})}}function Me(e,t){return(i,r,o)=>{const n=r.viewItem;r.modelRange||Object.assign(r,o.convertChildren(r.viewItem,r.modelCursor));const l=t.processViewAttributes(n,o);for(const t of r.modelRange.getItems({shallow:!0}))t.hasAttribute("listItemId")&&(t.hasAttribute("htmlUlAttributes")||t.hasAttribute("htmlOlAttributes")||o.writer.model.schema.checkAttribute(t,e)&&o.writer.setAttribute(e,l||{},t))}}function Ue(e){return"numbered"===e||"customNumbered"==e?"htmlOlAttributes":"htmlUlAttributes"}class ze extends e.Plugin{static get requires(){return[we]}static get pluginName(){return"HorizontalLineElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;if(!e.plugins.has("HorizontalLineEditing"))return;const t=e.model.schema,i=e.conversion,r=e.plugins.get(we);r.on("register:hr",(e,o)=>{"horizontalLine"===o.model&&(t.extend("horizontalLine",{allowAttributes:["htmlHrAttributes"]}),i.for("upcast").add(X(o,r)),i.for("downcast").add(e=>{e.on("attribute:htmlHrAttributes:horizontalLine",(e,t,i)=>{if(!i.consumable.test(t.item,e.name))return;const{attributeOldValue:r,attributeNewValue:o}=t,n=i.mapper.toViewElement(t.item),l=Pe(i.writer,n,"hr");l&&(H(i.writer,r,o,l),i.consumable.consume(t.item,e.name))},{priority:"low"})}),e.stop())})}}class We extends e.Plugin{static get requires(){return[we,ne]}static get pluginName(){return"CustomElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor.plugins.get(we),t=this.editor.plugins.get(ne);e.on("register:$customElement",(i,r)=>{i.stop();const n=this.editor,l=n.model.schema,s=n.conversion,a=n.editing.view.domConverter.unsafeElements,m=n.data.htmlProcessor.domConverter.preElements;l.register(r.model,r.modelSchema),l.extend(r.model,{allowAttributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"],isContent:!0}),n.data.htmlProcessor.domConverter.registerRawContentMatcher({name:"template"}),s.for("upcast").elementToElement({view:/.*/,model:(i,l)=>{if("$comment"==i.name)return null;if(!function(e){try{document.createElement(e)}catch{return!1}return!0}(i.name))return null;if(t.getDefinitionsForView(i.name).size)return null;a.includes(i.name)||a.push(i.name),m.includes(i.name)||m.push(i.name);const s=l.writer.createElement(r.model,{htmlElementName:i.name}),c=e.processViewAttributes(i,l);let u;if(c&&l.writer.setAttribute("htmlCustomElementAttributes",c,s),i.is("element","template")&&i.getCustomProperty("$rawContent"))u=i.getCustomProperty("$rawContent");else{const e=new o.UpcastWriter(i.document).createDocumentFragment(i),t=n.data.htmlProcessor.domConverter.viewToDom(e),r=t.firstChild;for(;r.firstChild;)t.appendChild(r.firstChild);r.remove(),u=n.data.htmlProcessor.htmlWriter.getHtml(t)}l.writer.setAttribute("htmlContent",u,s);for(const{item:e}of n.editing.view.createRangeIn(i))l.consumable.consume(e,{name:!0});return s},converterPriority:"low"}),s.for("editingDowncast").elementToElement({model:{name:r.model,attributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"]},view:(e,{writer:t})=>{const i=e.getAttribute("htmlElementName"),r=t.createRawElement(i);return e.hasAttribute("htmlCustomElementAttributes")&&V(t,e.getAttribute("htmlCustomElementAttributes"),r),r}}),s.for("dataDowncast").elementToElement({model:{name:r.model,attributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"]},view:(e,{writer:t})=>{const i=e.getAttribute("htmlElementName"),r=e.getAttribute("htmlContent"),o=t.createRawElement(i,null,(e,t)=>{t.setContentOf(e,r)});return e.hasAttribute("htmlCustomElementAttributes")&&V(t,e.getAttribute("htmlCustomElementAttributes"),o),o}})})}}class qe extends e.Plugin{static get pluginName(){return"GeneralHtmlSupport"}static get isOfficialPlugin(){return!0}static get requires(){return[we,ke,Oe,je,Fe,Ie,$e,Be,Te,Le,ze,We]}init(){const e=this.editor,t=e.plugins.get(we);t.loadAllowedEmptyElementsConfig(e.config.get("htmlSupport.allowEmpty")||[]),t.loadAllowedConfig(e.config.get("htmlSupport.allow")||[]),t.loadDisallowedConfig(e.config.get("htmlSupport.disallow")||[])}getGhsAttributeNameForElement(e){const t=this.editor.plugins.get("DataSchema"),i=Array.from(t.getDefinitionsForView(e,!1)),r=i.find(e=>e.isInline&&!i[0].isObject);return r?r.model:M(e)}addModelHtmlClass(e,i,r){const o=this.editor.model,n=this.getGhsAttributeNameForElement(e);o.change(e=>{for(const l of Ke(o,r,n))L(e,l,n,"classes",e=>{for(const r of(0,t.toArray)(i))e.add(r)})})}removeModelHtmlClass(e,i,r){const o=this.editor.model,n=this.getGhsAttributeNameForElement(e);o.change(e=>{for(const l of Ke(o,r,n))L(e,l,n,"classes",e=>{for(const r of(0,t.toArray)(i))e.delete(r)})})}setModelHtmlAttributes(e,t,i){const r=this.editor.model,o=this.getGhsAttributeNameForElement(e);r.change(e=>{for(const n of Ke(r,i,o))L(e,n,o,"attributes",e=>{for(const[i,r]of Object.entries(t))e.set(i,r)})})}removeModelHtmlAttributes(e,i,r){const o=this.editor.model,n=this.getGhsAttributeNameForElement(e);o.change(e=>{for(const l of Ke(o,r,n))L(e,l,n,"attributes",e=>{for(const r of(0,t.toArray)(i))e.delete(r)})})}setModelHtmlStyles(e,t,i){const r=this.editor.model,o=this.getGhsAttributeNameForElement(e);r.change(e=>{for(const n of Ke(r,i,o))L(e,n,o,"styles",e=>{for(const[i,r]of Object.entries(t))e.set(i,r)})})}removeModelHtmlStyles(e,i,r){const o=this.editor.model,n=this.getGhsAttributeNameForElement(e);o.change(e=>{for(const l of Ke(o,r,n))L(e,l,n,"styles",e=>{for(const r of(0,t.toArray)(i))e.delete(r)})})}}function*Ke(e,t,i){if(t)if(!(Symbol.iterator in t)&&t.is("documentSelection")&&t.isCollapsed)e.schema.checkAttributeInSelection(t,i)&&(yield t);else for(const r of function(e,t,i){return!(Symbol.iterator in t)&&(t.is("node")||t.is("$text")||t.is("$textProxy"))?e.schema.checkAttribute(t,i)?[e.createRangeOn(t)]:[]:e.schema.getValidRanges(e.createSelection(t).getRanges(),i)}(e,t,i))yield*r.getItems({shallow:!0})}class Ge extends e.Plugin{static get pluginName(){return"HtmlComment"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,i=new Map;e.data.processor.skipComments=!1,e.model.schema.addAttributeCheck((e,t)=>{if(e.endsWith("$root")&&t.startsWith("$comment"))return!0}),e.conversion.for("upcast").elementToMarker({view:"$comment",model:e=>{const r=`$comment:${(0,t.uid)()}`,o=e.getCustomProperty("$rawContent");return i.set(r,o),r}}),e.conversion.for("dataDowncast").markerToElement({model:"$comment",view:(e,{writer:t})=>{let i;for(const t of this.editor.model.document.getRootNames())if(i=this.editor.model.document.getRoot(t),i.hasAttribute(e.markerName))break;const r=e.markerName,o=i.getAttribute(r),n=t.createUIElement("$comment");return t.setCustomProperty("$rawContent",o,n),n}}),e.model.document.registerPostFixer(t=>{let r=!1;const o=e.model.document.differ.getChangedMarkers().filter(e=>e.name.startsWith("$comment:"));for(const e of o){const{oldRange:o,newRange:n}=e.data;if(!o||!n||o.root!=n.root){if(o){const i=o.root;i.hasAttribute(e.name)&&(t.removeAttribute(e.name,i),r=!0)}if(n){const o=n.root;"$graveyard"==o.rootName?(t.removeMarker(e.name),r=!0):o.hasAttribute(e.name)||(t.setAttribute(e.name,i.get(e.name)||"",o),r=!0)}}}return r}),e.data.on("set",()=>{for(const t of e.model.markers.getMarkersGroup("$comment"))this.removeHtmlComment(t.name)},{priority:"high"}),e.model.on("deleteContent",(t,[i])=>{for(const t of i.getRanges()){const i=e.model.schema.getLimitElement(t),r=e.model.createPositionAt(i,0),o=e.model.createPositionAt(i,"end");let n;n=r.isTouching(t.start)&&o.isTouching(t.end)?this.getHtmlCommentsInRange(e.model.createRange(r,o)):this.getHtmlCommentsInRange(t,{skipBoundaries:!0});for(const e of n)this.removeHtmlComment(e)}},{priority:"high"})}createHtmlComment(e,i){const r=(0,t.uid)(),o=this.editor.model,n=o.document.getRoot(e.root.rootName),l=`$comment:${r}`;return o.change(t=>{const r=t.createRange(e);return t.addMarker(l,{usingOperation:!0,affectsData:!0,range:r}),t.setAttribute(l,i,n),l})}removeHtmlComment(e){const t=this.editor,i=t.model.markers.get(e);return!!i&&(t.model.change(e=>{e.removeMarker(i)}),!0)}getHtmlCommentData(e){const t=this.editor.model.markers.get(e);if(!t)return null;let i="";for(const t of this.editor.model.document.getRoots())if(t.hasAttribute(e)){i=t.getAttribute(e);break}return{content:i,position:t.getStart()}}getHtmlCommentsInRange(e,{skipBoundaries:t=!1}={}){const i=!t;return Array.from(this.editor.model.markers.getMarkersGroup("$comment")).filter(t=>function(e,t){const r=e.getRange().start;return(r.isAfter(t.start)||i&&r.isEqual(t.start))&&(r.isBefore(t.end)||i&&r.isEqual(t.end))}(t,e)).map(e=>e.name)}}class Xe extends o.HtmlDataProcessor{toView(e){if(!/<(?:html|body|head|meta)(?:\s[^>]*)?>/i.test(e.trim().slice(0,1e4)))return super.toView(e);let t="",i="";e=(e=e.trim().replace(/<\?xml\s[^?]*\?>/i,e=>(i=e,""))).trim().replace(/^<!DOCTYPE\s[^>]*?>/i,e=>(t=e,""));const r=this._toDom(e),n=this.domConverter.domToView(r,{skipComments:this.skipComments}),l=new o.UpcastWriter(n.document);l.setCustomProperty("$fullPageDocument",r.ownerDocument.documentElement.outerHTML,n);const s=Array.from(r.ownerDocument.querySelectorAll("head style"));return l.setCustomProperty("$fullPageHeadStyles",s,n),t&&l.setCustomProperty("$fullPageDocType",t,n),i&&l.setCustomProperty("$fullPageXmlDeclaration",i,n),n}toData(e){let t=super.toData(e);const i=e.getCustomProperty("$fullPageDocument"),r=e.getCustomProperty("$fullPageDocType"),o=e.getCustomProperty("$fullPageXmlDeclaration");return i&&(t=i.replace(/<\/body\s*>/,t+"$&"),r&&(t=r+"\n"+t),o&&(t=o+"\n"+t)),t}}class Qe extends e.Plugin{static get pluginName(){return"FullPage"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("htmlSupport.fullPage",{allowRenderStylesFromHead:!1,sanitizeCss:e=>((0,t.logWarning)("css-full-page-provide-sanitize-function"),{css:e,hasChanged:!1})}),e.data.processor=new Xe(e.data.viewDocument)}init(){const e=this.editor,t=["$fullPageDocument","$fullPageDocType","$fullPageXmlDeclaration","$fullPageHeadStyles"];e.model.schema.extend("$root",{allowAttributes:t}),e.data.on("toModel",(i,[r])=>{const o=e.model.document.getRoot();e.model.change(e=>{for(const i of t){const t=r.getCustomProperty(i);t&&e.setAttribute(i,t,o)}}),Ye(e)&&this._renderStylesFromHead(o)},{priority:"low"}),e.data.on("toView",(e,[i])=>{if(!i.is("rootElement"))return;const r=i,n=e.return;if(!r.hasAttribute("$fullPageDocument"))return;const l=new o.UpcastWriter(n.document);for(const e of t){const t=r.getAttribute(e);t&&l.setCustomProperty(e,t,n)}},{priority:"low"}),e.data.on("set",()=>{const i=e.model.document.getRoot();e.model.change(e=>{for(const r of t)i.hasAttribute(r)&&e.removeAttribute(r,i)})},{priority:"high"}),e.data.on("get",(e,t)=>{t[0]||(t[0]={}),t[0].trim=!1},{priority:"high"})}destroy(){super.destroy(),Ye(this.editor)&&this._removeStyleElementsFromDom()}_removeStyleElementsFromDom(){const e=Array.from(t.global.document.querySelectorAll(`[data-full-page-style-id="${this.editor.id}"]`));for(const t of e)t.remove()}_renderStyleElementsInDom(e){const i=this.editor,r=e.getAttribute("$fullPageHeadStyles");if(!r)return;const o=i.config.get("htmlSupport.fullPage.sanitizeCss");for(const e of r){e.setAttribute("data-full-page-style-id",i.id);const r=o(e.innerText);r.hasChanged&&(e.innerText=r.css),t.global.document.head.append(e)}}_renderStylesFromHead(e){this._removeStyleElementsFromDom(),this._renderStyleElementsInDom(e)}}function Ye(e){return e.config.get("htmlSupport.fullPage.allowRenderStylesFromHead")}const Je="htmlEmptyBlock";class Ze extends e.Plugin{static get pluginName(){return"EmptyBlock"}static get isOfficialPlugin(){return!0}afterInit(){const{model:e,conversion:t,plugins:i,config:r}=this.editor,o=e.schema,n=r.get("htmlSupport.preserveEmptyBlocksInEditingView");o.extend("$block",{allowAttributes:[Je]}),o.extend("$container",{allowAttributes:[Je]}),o.isRegistered("tableCell")&&o.extend("tableCell",{allowAttributes:[Je]}),n?t.for("downcast").add(et()):t.for("dataDowncast").add(et()),t.for("upcast").add(function(e){return t=>{t.on("element",(t,i,r)=>{const{viewItem:o,modelRange:n}=i;if(!o.is("element")||!o.isEmpty||o.getCustomProperty("$hasBlockFiller"))return;const l=n&&n.start.nodeAfter;if(!l||!e.checkAttribute(l,Je))return;if(r.writer.setAttribute(Je,!0,l),1!=l.childCount)return;const s=l.getChild(0);s.is("element","paragraph")&&e.checkAttribute(s,Je)&&r.writer.setAttribute(Je,!0,s)},{priority:"lowest"})}}(o)),i.has("ClipboardPipeline")&&this._registerClipboardPastingHandler()}_registerClipboardPastingHandler(){const e=this.editor.plugins.get("ClipboardPipeline");this.listenTo(e,"contentInsertion",(e,t)=>{t.sourceEditorId!==this.editor.id&&this.editor.model.change(e=>{for(const{item:i}of e.createRangeIn(t.content))i.is("element")&&i.hasAttribute(Je)&&e.removeAttribute(Je,i)})})}}function et(){return e=>{e.on(`attribute:${Je}`,(e,t,i)=>{const{mapper:r,consumable:o}=i,{item:n}=t;if(!o.consume(n,e.name))return;const l=r.toViewElement(n);l&&t.attributeNewValue&&(l.getFillerOffset=()=>null)})}}})(),(window.CKEditor5=window.CKEditor5||{}).htmlSupport=r})();
5
+ */(()=>{var t={21:t=>{"use strict";t.exports=function(t,e){Object.keys(e).forEach(function(r){t.setAttribute(r,e[r])})}},51:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},128:t=>{"use strict";var e={};t.exports=function(t,r){var i=function(t){if(void 0===e[t]){var r=document.querySelector(t);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(t){r=null}e[t]=r}return e[t]}(t);if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(r)}},237:t=>{"use strict";t.exports=CKEditor5.dll},275:(t,e,r)=>{"use strict";r.d(e,{A:()=>s});var i=r(758),o=r.n(i),n=r(935),l=r.n(n)()(o());l.push([t.id,":root{--ck-html-object-embed-unfocused-outline-width:1px}.ck-widget.html-object-embed{background-color:var(--ck-color-base-foreground);font-size:var(--ck-font-size-base);min-width:calc(76px + var(--ck-spacing-standard));padding:var(--ck-spacing-small);padding-top:calc(var(--ck-font-size-tiny) + var(--ck-spacing-large))}.ck-widget.html-object-embed:not(.ck-widget_selected):not(:hover){outline:var(--ck-html-object-embed-unfocused-outline-width) dashed var(--ck-color-widget-blurred-border)}.ck-widget.html-object-embed:before{background:#999;border-radius:0 0 var(--ck-border-radius) var(--ck-border-radius);color:var(--ck-color-base-background);content:attr(data-html-object-embed-label);font-family:var(--ck-font-face);font-size:var(--ck-font-size-tiny);font-style:normal;font-weight:400;left:var(--ck-spacing-standard);padding:calc(var(--ck-spacing-tiny) + var(--ck-html-object-embed-unfocused-outline-width)) var(--ck-spacing-small) var(--ck-spacing-tiny);position:absolute;top:0;transition:background var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve)}.ck-widget.html-object-embed .ck-widget__type-around .ck-widget__type-around__button.ck-widget__type-around__button_before{margin-left:50px}.ck-widget.html-object-embed .html-object-embed__content{pointer-events:none}div.ck-widget.html-object-embed{margin:1em auto}span.ck-widget.html-object-embed{display:inline-block}",""]);const s=l},507:(t,e,r)=>{t.exports=r(237)("./src/enter.js")},584:(t,e,r)=>{t.exports=r(237)("./src/utils.js")},591:t=>{"use strict";var e=[];function r(t){for(var r=-1,i=0;i<e.length;i++)if(e[i].identifier===t){r=i;break}return r}function i(t,i){for(var n={},l=[],s=0;s<t.length;s++){var a=t[s],m=i.base?a[0]+i.base:a[0],c=n[m]||0,u="".concat(m," ").concat(c);n[m]=c+1;var d=r(u),h={css:a[1],media:a[2],sourceMap:a[3],supports:a[4],layer:a[5]};if(-1!==d)e[d].references++,e[d].updater(h);else{var f=o(h,i);i.byIndex=s,e.splice(s,0,{identifier:u,updater:f,references:1})}l.push(u)}return l}function o(t,e){var r=e.domAPI(e);r.update(t);return function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;r.update(t=e)}else r.remove()}}t.exports=function(t,o){var n=i(t=t||[],o=o||{});return function(t){t=t||[];for(var l=0;l<n.length;l++){var s=r(n[l]);e[s].references--}for(var a=i(t,o),m=0;m<n.length;m++){var c=r(n[m]);0===e[c].references&&(e[c].updater(),e.splice(c,1))}n=a}}},639:t=>{"use strict";var e,r=(e=[],function(t,r){return e[t]=r,e.filter(Boolean).join("\n")});function i(t,e,i,o){var n;if(i)n="";else{n="",o.supports&&(n+="@supports (".concat(o.supports,") {")),o.media&&(n+="@media ".concat(o.media," {"));var l=void 0!==o.layer;l&&(n+="@layer".concat(o.layer.length>0?" ".concat(o.layer):""," {")),n+=o.css,l&&(n+="}"),o.media&&(n+="}"),o.supports&&(n+="}")}if(t.styleSheet)t.styleSheet.cssText=r(e,n);else{var s=document.createTextNode(n),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(s,a[e]):t.appendChild(s)}}var o={singleton:null,singletonCounter:0};t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=o.singletonCounter++,r=o.singleton||(o.singleton=t.insertStyleElement(t));return{update:function(t){i(r,e,!1,t)},remove:function(t){i(r,e,!0,t)}}}},758:t=>{"use strict";t.exports=function(t){return t[1]}},782:(t,e,r)=>{t.exports=r(237)("./src/core.js")},783:(t,e,r)=>{t.exports=r(237)("./src/engine.js")},901:(t,e,r)=>{t.exports=r(237)("./src/widget.js")},935:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var r="",i=void 0!==e[5];return e[4]&&(r+="@supports (".concat(e[4],") {")),e[2]&&(r+="@media ".concat(e[2]," {")),i&&(r+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),r+=t(e),i&&(r+="}"),e[2]&&(r+="}"),e[4]&&(r+="}"),r}).join("")},e.i=function(t,r,i,o,n){"string"==typeof t&&(t=[[null,t,void 0]]);var l={};if(i)for(var s=0;s<this.length;s++){var a=this[s][0];null!=a&&(l[a]=!0)}for(var m=0;m<t.length;m++){var c=[].concat(t[m]);i&&l[c[0]]||(void 0!==n&&(void 0===c[5]||(c[1]="@layer".concat(c[5].length>0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=n),r&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=r):c[2]=r),o&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=o):c[4]="".concat(o)),e.push(c))}},e}}},e={};function r(i){var o=e[i];if(void 0!==o)return o.exports;var n=e[i]={id:i,exports:{}};return t[i](n,n.exports,r),n.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var i in e)r.o(e,i)&&!r.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};(()=>{"use strict";r.r(i),r.d(i,{DataFilter:()=>Et,DataSchema:()=>mt,EmptyBlock:()=>ie,FullPage:()=>te,GeneralHtmlSupport:()=>Qt,HtmlComment:()=>Jt,HtmlPageDataProcessor:()=>Zt,_HTML_SUPPORT_SCHEMA_DEFINITIONS:()=>et,_attributeToInlineHtmlSupportConverter:()=>J,_createObjectHtmlSupportView:()=>X,_emptyInlineModelElementToViewHtmlSupportConverter:()=>Y,_getHtmlSupportAttributeName:()=>q,_getHtmlSupportDescendantElement:()=>$t,_mergeHtmlSupportViewElementAttributes:()=>L,_modelToViewBlockAttributeHtmlSupportConverter:()=>tt,_modifyHtmlSupportGhsAttribute:()=>U,_removeHtmlSupportViewAttributes:()=>M,_setHtmlSupportViewAttributes:()=>N,_toHtmlSupportPascalCase:()=>W,_toObjectWidgetHtmlSupportConverter:()=>K,_updateHtmlSupportViewAttributes:()=>V,_viewToAttributeInlineHtmlSupportConverter:()=>Q,_viewToModelBlockAttributeHtmlSupportConverter:()=>Z,_viewToModelObjectContentHtmlSupportConverter:()=>G});var t=r(782),e=r(584),o=r(783),n=r(901);function l(t){return Object.getOwnPropertySymbols(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}function s(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const a="[object RegExp]",m="[object String]",c="[object Number]",u="[object Boolean]",d="[object Arguments]",h="[object Symbol]",f="[object Date]",g="[object Map]",b="[object Set]",p="[object Array]",w="[object ArrayBuffer]",A="[object Object]",y="[object DataView]",v="[object Uint8Array]",E="[object Uint8ClampedArray]",S="[object Uint16Array]",k="[object Uint32Array]",O="[object Int8Array]",C="[object Int16Array]",j="[object Int32Array]",P="[object Float32Array]",F="[object Float64Array]";function _(t){return null==t||"object"!=typeof t&&"function"!=typeof t}function I(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function $(t,e,r,i=new Map,o=void 0){const n=o?.(t,e,r,i);if(null!=n)return n;if(_(t))return t;if(i.has(t))return i.get(t);if(Array.isArray(t)){const e=new Array(t.length);i.set(t,e);for(let n=0;n<t.length;n++)e[n]=$(t[n],n,r,i,o);return Object.hasOwn(t,"index")&&(e.index=t.index),Object.hasOwn(t,"input")&&(e.input=t.input),e}if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){const e=new RegExp(t.source,t.flags);return e.lastIndex=t.lastIndex,e}if(t instanceof Map){const e=new Map;i.set(t,e);for(const[n,l]of t)e.set(n,$(l,n,r,i,o));return e}if(t instanceof Set){const e=new Set;i.set(t,e);for(const n of t)e.add($(n,void 0,r,i,o));return e}if("undefined"!=typeof Buffer&&Buffer.isBuffer(t))return t.subarray();if(I(t)){const e=new(Object.getPrototypeOf(t).constructor)(t.length);i.set(t,e);for(let n=0;n<t.length;n++)e[n]=$(t[n],n,r,i,o);return e}if(t instanceof ArrayBuffer||"undefined"!=typeof SharedArrayBuffer&&t instanceof SharedArrayBuffer)return t.slice(0);if(t instanceof DataView){const e=new DataView(t.buffer.slice(0),t.byteOffset,t.byteLength);return i.set(t,e),T(e,t,r,i,o),e}if("undefined"!=typeof File&&t instanceof File){const e=new File([t],t.name,{type:t.type});return i.set(t,e),T(e,t,r,i,o),e}if(t instanceof Blob){const e=new Blob([t],{type:t.type});return i.set(t,e),T(e,t,r,i,o),e}if(t instanceof Error){const e=new t.constructor;return i.set(t,e),e.message=t.message,e.name=t.name,e.stack=t.stack,e.cause=t.cause,T(e,t,r,i,o),e}if("object"==typeof t&&function(t){switch(s(t)){case d:case p:case w:case y:case u:case f:case P:case F:case O:case C:case j:case g:case c:case A:case a:case b:case m:case h:case v:case E:case S:case k:return!0;default:return!1}}(t)){const e=Object.create(Object.getPrototypeOf(t));return i.set(t,e),T(e,t,r,i,o),e}return t}function T(t,e,r=t,i,o){const n=[...Object.keys(e),...l(e)];for(let l=0;l<n.length;l++){const s=n[l],a=Object.getOwnPropertyDescriptor(t,s);(null==a||a.writable)&&(t[s]=$(e[s],s,r,i,o))}}function B(t,e){return function(t,e){return $(t,void 0,t,new Map,e)}(t,(r,i,o,n)=>{const l=e?.(r,i,o,n);if(null!=l)return l;if("object"==typeof t)switch(Object.prototype.toString.call(t)){case c:case m:case u:{const e=new t.constructor(t?.valueOf());return T(e,t),e}case d:{const e={};return T(e,t),e.length=t.length,e[Symbol.iterator]=t[Symbol.iterator],e}default:return}})}function x(t){return B(t)}const D=/\p{Lu}?\p{Ll}+|[0-9]+|\p{Lu}+(?!\p{Ll})|\p{Emoji_Presentation}|\p{Extended_Pictographic}|\p{L}+/gu;function H(t){if(null==t)return"";if("string"==typeof t)return t;if(Array.isArray(t))return t.map(H).join(",");const e=String(t);return"0"===e&&Object.is(Number(t),-0)?"-0":e}function R(t){const e=function(t){return Array.from(t.match(D)??[])}(function(t){return"string"!=typeof t&&(t=H(t)),t.replace(/['\u2019]/g,"")}(t).trim());let r="";for(let t=0;t<e.length;t++){const i=e[t];r&&(r+=" "),i===i.toUpperCase()?r+=i:r+=i[0].toUpperCase()+i.slice(1).toLowerCase()}return r}function V(t,e,r,i){e&&M(t,e,i),r&&N(t,r,i)}function N(t,e,r){if(e.attributes)for(const[i,o]of Object.entries(e.attributes))t.setAttribute(i,o,r);e.styles&&t.setStyle(e.styles,r),e.classes&&t.addClass(e.classes,r)}function M(t,e,r){if(e.attributes)for(const[i]of Object.entries(e.attributes))t.removeAttribute(i,r);if(e.styles)for(const i of Object.keys(e.styles))t.removeStyle(i,r);e.classes&&t.removeClass(e.classes,r)}function L(t,e){const r=x(t);let i="attributes";for(i in e)r[i]="classes"==i?Array.from(new Set([...t[i]||[],...e[i]])):{...t[i],...e[i]};return r}function U(t,e,r,i,o){const n=e.getAttribute(r),l={};for(const t of["attributes","styles","classes"]){if(t!=i){n&&n[t]&&(l[t]=n[t]);continue}if("classes"==i){const e=new Set(n&&n.classes||[]);o(e),e.size&&(l[t]=Array.from(e));continue}const e=new Map(Object.entries(n&&n[t]||{}));o(e),e.size&&(l[t]=Object.fromEntries(e))}Object.keys(l).length?e.is("documentSelection")?t.setSelectionAttribute(r,l):t.setAttribute(r,l,e):n&&(e.is("documentSelection")?t.removeSelectionAttribute(r):t.removeAttribute(r,e))}function z(t,e,r){for(const i of e.getItems({shallow:!0})){const e=i.getAttribute(t);e&&e.attributes&&Object.keys(e.attributes).length?Object.keys(e).length>1&&r.setAttribute(t,{attributes:e.attributes},i):r.removeAttribute(t,i)}}function W(t){return R(t).replace(/ /g,"")}function q(t){return`html${W(t)}Attributes`}function G({model:t}){return(e,r)=>r.writer.createElement(t,{htmlContent:e.getCustomProperty("$rawContent")})}function K(t,{view:e,isInline:r}){const i=t.t;return(t,{writer:o})=>{const l=i("HTML object"),s=X(e,t,o),a=t.getAttribute(q(e));o.addClass("html-object-embed__content",s),a&&N(o,a,s);const m=o.createContainerElement(r?"span":"div",{class:"html-object-embed","data-html-object-embed-label":l},s);return(0,n.toWidget)(m,o,{label:l})}}function X(t,e,r){return r.createRawElement(t,null,(t,r)=>{r.setContentOf(t,e.getAttribute("htmlContent"))})}function Q({view:t,model:e,allowEmpty:r},i){return e=>{e.on(`element:${t}`,(t,e,n)=>{let l=i.processViewAttributes(e.viewItem,n);if(l||n.consumable.test(e.viewItem,{name:!0})){if(l=l||{},n.consumable.consume(e.viewItem,{name:!0}),e.modelRange||(e=Object.assign(e,n.convertChildren(e.viewItem,e.modelCursor))),r&&e.modelRange.isCollapsed&&Object.keys(l).length){const t=n.writer.createElement("htmlEmptyElement");if(!n.safeInsert(t,e.modelCursor))return;const r=n.getSplitParts(t);return e.modelRange=n.writer.createRange(e.modelRange.start,n.writer.createPositionAfter(r[r.length-1])),n.updateConversionResult(t,e),void o(t,l,n)}for(const t of e.modelRange.getItems())o(t,l,n)}},{priority:"low"})};function o(t,r,i){if(i.schema.checkAttribute(t,e)){const o=L(r,t.getAttribute(e)||{});i.writer.setAttribute(e,o,t)}}}function Y({model:t,view:e},r){return(i,{writer:o,consumable:l})=>{if(!i.hasAttribute(t))return null;const s=o.createContainerElement(e),a=i.getAttribute(t);return l.consume(i,`attribute:${t}`),N(o,a,s),s.getFillerOffset=()=>null,r?(0,n.toWidget)(s,o):s}}function J({priority:t,view:e}){return(r,i)=>{if(!r)return;const{writer:o}=i,n=o.createAttributeElement(e,null,{priority:t});return N(o,r,n),n}}function Z({view:t},e){return r=>{r.on(`element:${t}`,(t,r,i)=>{if(!r.modelRange||r.modelRange.isCollapsed)return;const o=e.processViewAttributes(r.viewItem,i);o&&i.writer.setAttribute(q(r.viewItem.name),o,r.modelRange)},{priority:"low"})}}function tt({view:t,model:e}){return r=>{r.on(`attribute:${q(t)}:${e}`,(t,e,r)=>{if(!r.consumable.consume(e.item,t.name))return;const{attributeOldValue:i,attributeNewValue:o}=e;V(r.writer,i,o,r.mapper.toViewElement(e.item))})}}const et={block:[{model:"codeBlock",view:"pre"},{model:"paragraph",view:"p"},{model:"blockQuote",view:"blockquote"},{model:"listItem",view:"li"},{model:"pageBreak",view:"div"},{model:"rawHtml",view:"div"},{model:"table",view:"table"},{model:"tableRow",view:"tr"},{model:"tableCell",view:"td"},{model:"tableCell",view:"th"},{model:"tableColumnGroup",view:"colgroup"},{model:"tableColumn",view:"col"},{model:"caption",view:"caption"},{model:"caption",view:"figcaption"},{model:"imageBlock",view:"img"},{model:"imageInline",view:"img"},{model:"horizontalLine",view:"hr"},{model:"htmlP",view:"p",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlBlockquote",view:"blockquote",modelSchema:{inheritAllFrom:"$container"}},{model:"htmlTable",view:"table",modelSchema:{allowWhere:"$block",isBlock:!0}},{model:"htmlTbody",view:"tbody",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlThead",view:"thead",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlTfoot",view:"tfoot",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlCaption",view:"caption",modelSchema:{allowIn:"htmlTable",allowChildren:"$text",isBlock:!1}},{model:"htmlColgroup",view:"colgroup",modelSchema:{allowIn:"htmlTable",allowChildren:"col",isBlock:!1}},{model:"htmlCol",view:"col",modelSchema:{allowIn:"htmlColgroup",isBlock:!1}},{model:"htmlTr",view:"tr",modelSchema:{allowIn:["htmlTable","htmlThead","htmlTbody"],isLimit:!0}},{model:"htmlTd",view:"td",modelSchema:{allowIn:"htmlTr",allowContentOf:"$container",isLimit:!0,isBlock:!1}},{model:"htmlTh",view:"th",modelSchema:{allowIn:"htmlTr",allowContentOf:"$container",isLimit:!0,isBlock:!1}},{model:"htmlFigure",view:"figure",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlFigcaption",view:"figcaption",modelSchema:{allowIn:"htmlFigure",allowChildren:"$text",isBlock:!1}},{model:"htmlAddress",view:"address",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlAside",view:"aside",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlMain",view:"main",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlDetails",view:"details",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlSummary",view:"summary",modelSchema:{allowChildren:["htmlH1","htmlH2","htmlH3","htmlH4","htmlH5","htmlH6","$text"],allowIn:"htmlDetails",isBlock:!1}},{model:"htmlDiv",view:"div",paragraphLikeModel:"htmlDivParagraph",modelSchema:{inheritAllFrom:"$container"}},{model:"htmlFieldset",view:"fieldset",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlLegend",view:"legend",modelSchema:{allowIn:"htmlFieldset",allowChildren:"$text"}},{model:"htmlHeader",view:"header",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlFooter",view:"footer",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlForm",view:"form",modelSchema:{inheritAllFrom:"$container",isBlock:!0}},{model:"htmlHgroup",view:"hgroup",modelSchema:{allowIn:["$root","$container"],allowChildren:["paragraph","htmlP","htmlH1","htmlH2","htmlH3","htmlH4","htmlH5","htmlH6"],isBlock:!1}},{model:"htmlH1",view:"h1",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH2",view:"h2",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH3",view:"h3",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH4",view:"h4",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH5",view:"h5",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH6",view:"h6",modelSchema:{inheritAllFrom:"$block"}},{model:"$htmlList",modelSchema:{allowWhere:"$container",allowChildren:["$htmlList","htmlLi"],isBlock:!1}},{model:"htmlDir",view:"dir",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlMenu",view:"menu",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlUl",view:"ul",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlOl",view:"ol",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlLi",view:"li",modelSchema:{allowIn:"$htmlList",allowChildren:"$text",isBlock:!1}},{model:"htmlPre",view:"pre",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlArticle",view:"article",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlSection",view:"section",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlNav",view:"nav",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlDivDl",view:"div",modelSchema:{allowChildren:["htmlDt","htmlDd"],allowIn:"htmlDl"}},{model:"htmlDl",view:"dl",modelSchema:{allowWhere:"$container",allowChildren:["htmlDt","htmlDd","htmlDivDl"],isBlock:!1}},{model:"htmlDt",view:"dt",modelSchema:{allowChildren:"$block",isBlock:!1}},{model:"htmlDd",view:"dd",modelSchema:{allowChildren:"$block",isBlock:!1}},{model:"htmlCenter",view:"center",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlHr",view:"hr",isEmpty:!0,modelSchema:{inheritAllFrom:"$blockObject"}}],inline:[{model:"htmlLiAttributes",view:"li",appliesToBlock:!0,coupledAttribute:"listItemId"},{model:"htmlOlAttributes",view:"ol",appliesToBlock:!0,coupledAttribute:"listItemId"},{model:"htmlUlAttributes",view:"ul",appliesToBlock:!0,coupledAttribute:"listItemId"},{model:"htmlFigureAttributes",view:"figure",appliesToBlock:"table"},{model:"htmlTheadAttributes",view:"thead",appliesToBlock:"table"},{model:"htmlTbodyAttributes",view:"tbody",appliesToBlock:"table"},{model:"htmlFigureAttributes",view:"figure",appliesToBlock:"imageBlock"},{model:"htmlAcronym",view:"acronym",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlTt",view:"tt",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlFont",view:"font",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlTime",view:"time",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlVar",view:"var",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlBig",view:"big",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSmall",view:"small",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSamp",view:"samp",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlQ",view:"q",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlOutput",view:"output",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlKbd",view:"kbd",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlBdi",view:"bdi",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlBdo",view:"bdo",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlAbbr",view:"abbr",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlA",view:"a",priority:5,coupledAttribute:"linkHref",attributeProperties:{isFormatting:!0}},{model:"htmlStrong",view:"strong",coupledAttribute:"bold",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlB",view:"b",coupledAttribute:"bold",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlI",view:"i",coupledAttribute:"italic",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlEm",view:"em",coupledAttribute:"italic",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlS",view:"s",coupledAttribute:"strikethrough",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlDel",view:"del",coupledAttribute:"strikethrough",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlIns",view:"ins",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlU",view:"u",coupledAttribute:"underline",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSub",view:"sub",coupledAttribute:"subscript",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSup",view:"sup",coupledAttribute:"superscript",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlCode",view:"code",coupledAttribute:"code",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlMark",view:"mark",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSpan",view:"span",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlCite",view:"cite",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlLabel",view:"label",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlDfn",view:"dfn",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlObject",view:"object",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlIframe",view:"iframe",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlInput",view:"input",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlButton",view:"button",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlTextarea",view:"textarea",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlSelect",view:"select",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlVideo",view:"video",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlEmbed",view:"embed",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlOembed",view:"oembed",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlAudio",view:"audio",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlImg",view:"img",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlCanvas",view:"canvas",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlMeter",view:"meter",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlProgress",view:"progress",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlScript",view:"script",modelSchema:{allowWhere:["$text","$block"],isInline:!0}},{model:"htmlStyle",view:"style",modelSchema:{allowWhere:["$text","$block"],isInline:!0}},{model:"htmlCustomElement",view:"$customElement",modelSchema:{allowWhere:["$text","$block"],allowAttributesOf:"$inlineObject",isInline:!0}}]};function rt(t){return"__proto__"===t}function it(t){return null!==t&&"object"==typeof t&&"[object Arguments]"===s(t)}function ot(t){return"object"==typeof t&&null!==t}function nt(t){if("object"!=typeof t)return!1;if(null==t)return!1;if(null===Object.getPrototypeOf(t))return!0;if("[object Object]"!==Object.prototype.toString.call(t)){const e=t[Symbol.toStringTag];if(null==e)return!1;return!!Object.getOwnPropertyDescriptor(t,Symbol.toStringTag)?.writable&&t.toString()===`[object ${e}]`}let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function lt(t){return I(t)}function st(t,...e){const r=e.slice(0,-1),i=e[e.length-1];let o=t;for(let t=0;t<r.length;t++){o=at(o,r[t],i,new Map)}return o}function at(t,e,r,i){if(_(t)&&(t=Object(t)),null==e||"object"!=typeof e)return t;if(i.has(e))return function(t){if(_(t))return t;if(Array.isArray(t)||I(t)||t instanceof ArrayBuffer||"undefined"!=typeof SharedArrayBuffer&&t instanceof SharedArrayBuffer)return t.slice(0);const e=Object.getPrototypeOf(t),r=e.constructor;if(t instanceof Date||t instanceof Map||t instanceof Set)return new r(t);if(t instanceof RegExp){const e=new r(t);return e.lastIndex=t.lastIndex,e}if(t instanceof DataView)return new r(t.buffer.slice(0));if(t instanceof Error){const e=new r(t.message);return e.stack=t.stack,e.name=t.name,e.cause=t.cause,e}if("undefined"!=typeof File&&t instanceof File)return new r([t],t.name,{type:t.type,lastModified:t.lastModified});if("object"==typeof t){const r=Object.create(e);return Object.assign(r,t)}return t}(i.get(e));if(i.set(e,t),Array.isArray(e)){e=e.slice();for(let t=0;t<e.length;t++)e[t]=e[t]??void 0}const o=[...Object.keys(e),...l(e)];for(let n=0;n<o.length;n++){const l=o[n];if(rt(l))continue;let s=e[l],a=t[l];if(it(s)&&(s={...s}),it(a)&&(a={...a}),"undefined"!=typeof Buffer&&Buffer.isBuffer(s)&&(s=x(s)),Array.isArray(s))if("object"==typeof a&&null!=a){const t=[],e=Reflect.ownKeys(a);for(let r=0;r<e.length;r++){const i=e[r];t[i]=a[i]}a=t}else a=[];const m=r(a,s,l,t,e,i);null!=m?t[l]=m:Array.isArray(s)||ot(a)&&ot(s)?t[l]=at(a,s,r,i):null==a&&nt(s)?t[l]=at({},s,r,i):null==a&&lt(s)?t[l]=x(s):void 0!==a&&void 0===s||(t[l]=s)}return t}class mt extends t.Plugin{_definitions=[];static get pluginName(){return"DataSchema"}static get isOfficialPlugin(){return!0}init(){for(const t of et.block)this.registerBlockElement(t);for(const t of et.inline)this.registerInlineElement(t)}registerBlockElement(t){this._definitions.push({...t,isBlock:!0})}registerInlineElement(t){this._definitions.push({...t,isInline:!0})}extendBlockElement(t){this._extendDefinition({...t,isBlock:!0})}extendInlineElement(t){this._extendDefinition({...t,isInline:!0})}getDefinitionsForView(t,e=!1){const r=new Set;for(const i of this._getMatchingViewDefinitions(t)){if(e)for(const t of this._getReferences(i.model))r.add(t);r.add(i)}return r}getDefinitionsForModel(t){return this._definitions.filter(e=>e.model==t)}_getMatchingViewDefinitions(t){return this._definitions.filter(e=>e.view&&function(t,e){if("string"==typeof t)return t===e;if(t instanceof RegExp)return t.test(e);return!1}(t,e.view))}*_getReferences(t){const r=["inheritAllFrom","inheritTypesFrom","allowWhere","allowContentOf","allowAttributesOf"],i=this._definitions.filter(e=>e.model==t);for(const{modelSchema:o}of i)if(o)for(const i of r)for(const r of(0,e.toArray)(o[i]||[])){const e=this._definitions.filter(t=>t.model==r);for(const i of e)r!==t&&(yield*this._getReferences(i.model),yield i)}}_extendDefinition(t){const e=Array.from(this._definitions.entries()).filter(([,e])=>e.model==t.model);if(0!=e.length)for(const[r,i]of e)this._definitions[r]=st({},i,t,(t,e)=>Array.isArray(t)?t.concat(e):void 0);else this._definitions.push(t)}}var ct=r(591),ut=r.n(ct),dt=r(639),ht=r.n(dt),ft=r(128),gt=r.n(ft),bt=r(21),pt=r.n(bt),wt=r(51),At=r.n(wt),yt=r(275),vt={attributes:{"data-cke":!0}};vt.setAttributes=pt(),vt.insert=gt().bind(null,"head"),vt.domAPI=ht(),vt.insertStyleElement=At();ut()(yt.A,vt);yt.A&&yt.A.locals&&yt.A.locals;class Et extends t.Plugin{_dataSchema;_allowedAttributes;_disallowedAttributes;_allowedElements;_disallowedElements;_dataInitialized;_coupledAttributes;constructor(t){super(t),this._dataSchema=t.plugins.get("DataSchema"),this._allowedAttributes=new o.Matcher,this._disallowedAttributes=new o.Matcher,this._allowedElements=new Set,this._disallowedElements=new Set,this._dataInitialized=!1,this._coupledAttributes=null,this._registerElementsAfterInit(),this._registerElementHandlers(),this._registerCoupledAttributesPostFixer(),this._registerAssociatedHtmlAttributesPostFixer()}static get pluginName(){return"DataFilter"}static get isOfficialPlugin(){return!0}static get requires(){return[mt,n.Widget]}loadAllowedConfig(t){for(const e of t){const t=e.name||/[\s\S]+/,r=jt(e);this.allowElement(t),r.forEach(t=>this.allowAttributes(t))}}loadDisallowedConfig(t){for(const e of t){const t=e.name||/[\s\S]+/,r=jt(e);0==r.length?this.disallowElement(t):r.forEach(t=>this.disallowAttributes(t))}}loadAllowedEmptyElementsConfig(t){for(const e of t)this.allowEmptyElement(e)}allowElement(t){for(const e of this._dataSchema.getDefinitionsForView(t,!0))this._addAllowedElement(e),this._coupledAttributes=null}disallowElement(t){for(const e of this._dataSchema.getDefinitionsForView(t,!1))this._disallowedElements.add(e.view)}allowEmptyElement(t){for(const e of this._dataSchema.getDefinitionsForView(t,!0))e.isInline&&this._dataSchema.extendInlineElement({...e,allowEmpty:!0})}allowAttributes(t){this._allowedAttributes.add(t)}disallowAttributes(t){this._disallowedAttributes.add(t)}processViewAttributes(t,e){const{consumable:r}=e;return St(t,this._disallowedAttributes,r),function(t,{attributes:e,classes:r,styles:i}){if(!e.length&&!r.length&&!i.length)return null;return{...e.length&&{attributes:kt(t,e)},...i.length&&{styles:Ot(t,i)},...r.length&&{classes:r}}}(t,St(t,this._allowedAttributes,r))}_addAllowedElement(t){if(!this._allowedElements.has(t)){if(this._allowedElements.add(t),"appliesToBlock"in t&&"string"==typeof t.appliesToBlock)for(const e of this._dataSchema.getDefinitionsForModel(t.appliesToBlock))e.isBlock&&this._addAllowedElement(e);this._dataInitialized&&this.editor.data.once("set",()=>{this._fireRegisterEvent(t)},{priority:e.priorities.highest+1})}}_registerElementsAfterInit(){this.editor.data.on("init",()=>{this._dataInitialized=!0;for(const t of this._allowedElements)this._fireRegisterEvent(t)},{priority:e.priorities.highest+1})}_registerElementHandlers(){this.on("register",(t,r)=>{const i=this.editor.model.schema;if(r.isObject&&!i.isRegistered(r.model))this._registerObjectElement(r);else if(r.isBlock)this._registerBlockElement(r);else{if(!r.isInline)throw new e.CKEditorError("data-filter-invalid-definition",null,r);this._registerInlineElement(r)}t.stop()},{priority:"lowest"})}_registerCoupledAttributesPostFixer(){const t=this.editor.model,e=t.document.selection;t.document.registerPostFixer(e=>{const r=t.document.differ.getChanges();let i=!1;const o=this._getCoupledAttributesMap();for(const t of r){if("attribute"!=t.type||null!==t.attributeNewValue)continue;const r=o.get(t.attributeKey);if(r)for(const{item:o}of t.range.getWalker())for(const t of r)o.hasAttribute(t)&&(e.removeAttribute(t,o),i=!0)}return i}),this.listenTo(e,"change:attribute",(r,{attributeKeys:i})=>{const o=new Set,n=this._getCoupledAttributesMap();for(const t of i){if(e.hasAttribute(t))continue;const r=n.get(t);if(r)for(const t of r)e.hasAttribute(t)&&o.add(t)}0!=o.size&&t.change(t=>{for(const e of o)t.removeSelectionAttribute(e)})})}_registerAssociatedHtmlAttributesPostFixer(){const t=this.editor.model;t.document.registerPostFixer(e=>{const r=t.document.differ.getChanges();let i=!1;for(const o of r)if("insert"===o.type&&"$text"!==o.name)for(const r of o.attributes.keys())r.startsWith("html")&&r.endsWith("Attributes")&&(t.schema.checkAttribute(o.name,r)||(e.removeAttribute(r,o.position.nodeAfter),i=!0));return i})}_getCoupledAttributesMap(){if(this._coupledAttributes)return this._coupledAttributes;this._coupledAttributes=new Map;for(const t of this._allowedElements)if(t.coupledAttribute&&t.model){const e=this._coupledAttributes.get(t.coupledAttribute);e?e.push(t.model):this._coupledAttributes.set(t.coupledAttribute,[t.model])}return this._coupledAttributes}_fireRegisterEvent(t){t.view&&this._disallowedElements.has(t.view)||this.fire(t.view?`register:${t.view}`:"register",t)}_registerObjectElement(t){const r=this.editor,i=r.model.schema,o=r.conversion,{view:n,model:l}=t;i.register(l,t.modelSchema),n&&(i.extend(t.model,{allowAttributes:[q(n),"htmlContent"]}),r.data.registerRawContentMatcher({name:n}),o.for("upcast").elementToElement({view:n,model:G(t),converterPriority:e.priorities.low+2}),o.for("upcast").add(Z(t,this)),o.for("editingDowncast").elementToStructure({model:{name:l,attributes:[q(n)]},view:K(r,t)}),o.for("dataDowncast").elementToElement({model:l,view:(t,{writer:e})=>X(n,t,e)}),o.for("dataDowncast").add(tt(t)))}_registerBlockElement(t){const r=this.editor,i=r.model.schema,o=r.conversion,{view:n,model:l}=t;if(!i.isRegistered(t.model)){if(!t.modelSchema)return;if(i.register(t.model,t.modelSchema),!n)return;o.for("upcast").elementToElement({model:l,view:n,converterPriority:e.priorities.low+2}),o.for("downcast").elementToElement({model:l,view:(e,{writer:r})=>t.isEmpty?r.createEmptyElement(n):r.createContainerElement(n)})}n&&(i.extend(t.model,{allowAttributes:q(n)}),o.for("upcast").add(Z(t,this)),o.for("downcast").add(tt(t)))}_registerInlineElement(t){const e=this.editor,r=e.model.schema,i=e.conversion,o=t.model;if(!t.appliesToBlock&&(r.extend("$text",{allowAttributes:o}),t.attributeProperties&&r.setAttributeProperties(o,t.attributeProperties),i.for("upcast").add(Q(t,this)),i.for("downcast").attributeToElement({model:o,view:J(t)}),t.allowEmpty)){if(r.setAttributeProperties(o,{copyFromObject:!1}),!r.isRegistered("htmlEmptyElement")){r.register("htmlEmptyElement",{inheritAllFrom:"$inlineObject"});const t=t=>Array.from(t.getAttributeKeys()).some(t=>t.startsWith("html"));e.model.document.registerPostFixer(r=>{const i=e.model.document.differ.getChanges(),o=new Set;for(const e of i)if("remove"!==e.type){if("attribute"===e.type&&null===e.attributeNewValue)for(const{item:r}of e.range)r.is("element","htmlEmptyElement")&&!t(r)&&o.add(r);if("insert"===e.type&&e.position.nodeAfter){const i=e.position.nodeAfter;for(const{item:e}of r.createRangeOn(i))e.is("element","htmlEmptyElement")&&!t(e)&&o.add(e)}}for(const t of o)r.remove(t);return o.size>0})}e.data.htmlProcessor.domConverter.registerInlineObjectMatcher(e=>e.name==t.view&&e.isEmpty&&Array.from(e.getAttributeKeys()).length?{name:!0}:null),i.for("editingDowncast").elementToElement({model:"htmlEmptyElement",view:Y(t,!0)}),i.for("dataDowncast").elementToElement({model:"htmlEmptyElement",view:Y(t)})}}}function St(t,e,r){const i=e.matchAll(t)||[],o=t.document.stylesProcessor;return i.reduce((e,{match:i})=>{for(const[n,l]of i.attributes||[])if("style"==n){const i=l,n=o.getRelatedStyles(i).filter(t=>t.split("-").length>i.split("-").length).sort((t,e)=>e.split("-").length-t.split("-").length);for(const i of n)r.consume(t,{styles:[i]})&&e.styles.push(i);r.consume(t,{styles:[i]})&&e.styles.push(i)}else if("class"==n){const i=l;r.consume(t,{classes:[i]})&&e.classes.push(i)}else r.consume(t,{attributes:[n]})&&e.attributes.push(n);return e},{attributes:[],classes:[],styles:[]})}function kt(t,r){const i={};for(const o of r){const r=t.getAttribute(o);void 0!==r&&(0,e.isValidAttributeName)(o)&&(i[o]=r)}return i}function Ot(t,e){const r=new o.StylesMap(t.document.stylesProcessor);for(const i of e){const e=t.getStyle(i);void 0!==e&&r.set(i,e)}return Object.fromEntries(r.getStylesEntries())}function Ct(t,e){const{name:r}=t,i=t[e];return nt(i)?Object.entries(i).map(([t,i])=>({name:r,[e]:{[t]:i}})):Array.isArray(i)?i.map(t=>({name:r,[e]:[t]})):[t]}function jt(t){const{name:e,attributes:r,classes:i,styles:o}=t,n=[];return r&&n.push(...Ct({name:e,attributes:r},"attributes")),i&&n.push(...Ct({name:e,classes:i},"classes")),o&&n.push(...Ct({name:e,styles:o},"styles")),n}class Pt extends t.Plugin{static get requires(){return[Et]}static get pluginName(){return"CodeBlockElementSupport"}static get isOfficialPlugin(){return!0}init(){if(!this.editor.plugins.has("CodeBlockEditing"))return;const t=this.editor.plugins.get(Et);t.on("register:pre",(e,r)=>{if("codeBlock"!==r.model)return;const i=this.editor,o=i.model.schema,n=i.conversion;o.extend("codeBlock",{allowAttributes:["htmlPreAttributes","htmlContentAttributes"]}),n.for("upcast").add(function(t){return e=>{e.on("element:code",(e,r,i)=>{const o=r.viewItem,n=o.parent;function l(e,o){const n=t.processViewAttributes(e,i);n&&i.writer.setAttribute(o,n,r.modelRange)}n&&n.is("element","pre")&&(l(n,"htmlPreAttributes"),l(o,"htmlContentAttributes"))},{priority:"low"})}}(t)),n.for("downcast").add(t=>{t.on("attribute:htmlPreAttributes:codeBlock",(t,e,r)=>{if(!r.consumable.consume(e.item,t.name))return;const{attributeOldValue:i,attributeNewValue:o}=e,n=r.mapper.toViewElement(e.item).parent;V(r.writer,i,o,n)}),t.on("attribute:htmlContentAttributes:codeBlock",(t,e,r)=>{if(!r.consumable.consume(e.item,t.name))return;const{attributeOldValue:i,attributeNewValue:o}=e,n=r.mapper.toViewElement(e.item);V(r.writer,i,o,n)})}),e.stop()})}}class Ft extends t.Plugin{static get requires(){return[Et]}static get pluginName(){return"DualContentModelElementSupport"}static get isOfficialPlugin(){return!0}init(){this.editor.plugins.get(Et).on("register",(t,r)=>{const i=r,o=this.editor,n=o.model.schema,l=o.conversion;if(!i.paragraphLikeModel)return;if(n.isRegistered(i.model)||n.isRegistered(i.paragraphLikeModel))return;const s={model:i.paragraphLikeModel,view:i.view};n.register(i.model,i.modelSchema),n.register(s.model,{inheritAllFrom:"$block"}),l.for("upcast").elementToElement({view:i.view,model:(t,{writer:e})=>this._hasBlockContent(t)?e.createElement(i.model):e.createElement(s.model),converterPriority:e.priorities.low+.5}),l.for("downcast").elementToElement({view:i.view,model:i.model}),this._addAttributeConversion(i),l.for("downcast").elementToElement({view:s.view,model:s.model}),this._addAttributeConversion(s),t.stop()})}_hasBlockContent(t){const e=this.editor.editing.view,r=e.domConverter.blockElements;for(const i of e.createRangeIn(t).getItems())if(i.is("element")&&r.includes(i.name))return!0;return!1}_addAttributeConversion(t){const e=this.editor,r=e.conversion,i=e.plugins.get(Et);e.model.schema.extend(t.model,{allowAttributes:q(t.view)}),r.for("upcast").add(Z(t,i)),r.for("downcast").add(tt(t))}}var _t=r(507);class It extends t.Plugin{static get requires(){return[mt,_t.Enter]}static get pluginName(){return"HeadingElementSupport"}static get isOfficialPlugin(){return!0}init(){const t=this.editor;if(!t.plugins.has("HeadingEditing"))return;const e=t.config.get("heading.options");this.registerHeadingElements(t,e)}registerHeadingElements(t,e){const r=t.plugins.get(mt),i=[];for(const t of e)"model"in t&&"view"in t&&(r.registerBlockElement({view:t.view,model:t.model}),i.push(t.model));r.extendBlockElement({model:"htmlHgroup",modelSchema:{allowChildren:i}}),r.extendBlockElement({model:"htmlSummary",modelSchema:{allowChildren:i}})}}function $t(t,e,r){const i=t.createRangeOn(e);for(const{item:t}of i.getWalker())if(t.is("element",r))return t}class Tt extends t.Plugin{static get requires(){return[Et]}static get pluginName(){return"ImageElementSupport"}static get isOfficialPlugin(){return!0}init(){const t=this.editor;if(!t.plugins.has("ImageInlineEditing")&&!t.plugins.has("ImageBlockEditing"))return;const e=t.model.schema,r=t.conversion,i=t.plugins.get(Et);i.on("register:figure",()=>{r.for("upcast").add(function(t){return e=>{e.on("element:figure",(e,r,i)=>{const o=r.viewItem;if(!r.modelRange||!o.hasClass("image"))return;const n=t.processViewAttributes(o,i);n&&i.writer.setAttribute("htmlFigureAttributes",n,r.modelRange)},{priority:"low"})}}(i))}),i.on("register:img",(o,n)=>{"imageBlock"!==n.model&&"imageInline"!==n.model||(e.isRegistered("imageBlock")&&e.extend("imageBlock",{allowAttributes:["htmlImgAttributes","htmlFigureAttributes","htmlLinkAttributes"]}),e.isRegistered("imageInline")&&e.extend("imageInline",{allowAttributes:["htmlA","htmlImgAttributes"]}),r.for("upcast").add(function(t){return e=>{e.on("element:img",(e,r,i)=>{if(!r.modelRange)return;const o=r.viewItem,n=t.processViewAttributes(o,i);n&&i.writer.setAttribute("htmlImgAttributes",n,r.modelRange)},{priority:"low"})}}(i)),r.for("downcast").add(t=>{function e(e){t.on(`attribute:${e}:imageInline`,(t,e,r)=>{if(!r.consumable.consume(e.item,t.name))return;const{attributeOldValue:i,attributeNewValue:o}=e,n=r.mapper.toViewElement(e.item);V(r.writer,i,o,n)},{priority:"low"})}function r(e,r){t.on(`attribute:${r}:imageBlock`,(t,r,i)=>{if(!i.consumable.test(r.item,t.name))return;const{attributeOldValue:o,attributeNewValue:n}=r,l=i.mapper.toViewElement(r.item),s=$t(i.writer,l,e);s&&(V(i.writer,o,n,s),i.consumable.consume(r.item,t.name))},{priority:"low"}),"a"===e&&t.on("attribute:linkHref:imageBlock",(t,e,r)=>{if(!r.consumable.consume(e.item,"attribute:htmlLinkAttributes:imageBlock"))return;const i=r.mapper.toViewElement(e.item),o=$t(r.writer,i,"a");N(r.writer,e.item.getAttribute("htmlLinkAttributes"),o)},{priority:"low"})}e("htmlImgAttributes"),r("img","htmlImgAttributes"),r("figure","htmlFigureAttributes"),r("a","htmlLinkAttributes")}),t.plugins.has("LinkImage")&&r.for("upcast").add(function(t,e){const r=e.plugins.get("ImageUtils");return e=>{e.on("element:a",(e,i,o)=>{const n=i.viewItem;if(!r.findViewImgElement(n))return;const l=i.modelCursor.parent;if(!l.is("element","imageBlock"))return;const s=t.processViewAttributes(n,o);s&&o.writer.setAttribute("htmlLinkAttributes",s,l)},{priority:"low"})}}(i,t)),o.stop())})}}class Bt extends t.Plugin{static get requires(){return[Et]}static get pluginName(){return"MediaEmbedElementSupport"}static get isOfficialPlugin(){return!0}init(){const t=this.editor;if(!t.plugins.has("MediaEmbed")||t.config.get("mediaEmbed.previewsInData"))return;const e=t.model.schema,r=t.conversion,i=this.editor.plugins.get(Et),o=this.editor.plugins.get(mt),n=t.config.get("mediaEmbed.elementName");o.registerBlockElement({model:"media",view:n}),i.on("register:figure",()=>{r.for("upcast").add(function(t){return e=>{e.on("element:figure",(e,r,i)=>{const o=r.viewItem;if(!r.modelRange||!o.hasClass("media"))return;const n=t.processViewAttributes(o,i);n&&i.writer.setAttribute("htmlFigureAttributes",n,r.modelRange)},{priority:"low"})}}(i))}),i.on(`register:${n}`,(t,o)=>{"media"===o.model&&(e.extend("media",{allowAttributes:[q(n),"htmlFigureAttributes"]}),r.for("upcast").add(function(t,e){const r=(r,i,o)=>{function n(e,r){const n=t.processViewAttributes(e,o);n&&o.writer.setAttribute(r,n,i.modelRange)}n(i.viewItem,q(e))};return t=>{t.on(`element:${e}`,r,{priority:"low"})}}(i,n)),r.for("dataDowncast").add(function(t){return e=>{function r(t,r){e.on(`attribute:${r}:media`,(e,r,i)=>{if(!i.consumable.consume(r.item,e.name))return;const{attributeOldValue:o,attributeNewValue:n}=r,l=i.mapper.toViewElement(r.item),s=$t(i.writer,l,t);V(i.writer,o,n,s)})}r(t,q(t)),r("figure","htmlFigureAttributes")}}(n)),t.stop())})}}class xt extends t.Plugin{static get requires(){return[Et]}static get pluginName(){return"ScriptElementSupport"}static get isOfficialPlugin(){return!0}init(){const t=this.editor.plugins.get(Et);t.on("register:script",(e,r)=>{const i=this.editor,o=i.model.schema,n=i.conversion;o.register("htmlScript",r.modelSchema),o.extend("htmlScript",{allowAttributes:["htmlScriptAttributes","htmlContent"],isContent:!0}),i.data.registerRawContentMatcher({name:"script"}),n.for("upcast").elementToElement({view:"script",model:G(r)}),n.for("upcast").add(Z(r,t)),n.for("downcast").elementToElement({model:"htmlScript",view:(t,{writer:e})=>X("script",t,e)}),n.for("downcast").add(tt(r)),e.stop()})}}const Dt=["width","max-width","min-width","height","min-height","max-height"];class Ht extends t.Plugin{static get requires(){return[Et]}static get pluginName(){return"TableElementSupport"}static get isOfficialPlugin(){return!0}init(){const t=this.editor;if(!t.plugins.has("TableEditing"))return;const e=t.model.schema,r=t.conversion,i=t.plugins.get(Et),o=t.plugins.get("TableUtils");i.on("register:figure",()=>{r.for("upcast").add(function(t){return e=>{e.on("element:figure",(e,r,i)=>{const o=r.viewItem;if(!r.modelRange||!o.hasClass("table"))return;const n=t.processViewAttributes(o,i);n&&i.writer.setAttribute("htmlFigureAttributes",n,r.modelRange)},{priority:"low"})}}(i))}),i.on("register:table",(n,l)=>{"table"===l.model&&(e.extend("table",{allowAttributes:["htmlTableAttributes","htmlFigureAttributes","htmlTheadAttributes","htmlTbodyAttributes"]}),r.for("upcast").add(function(t){return e=>{e.on("element:table",(e,r,i)=>{if(!r.modelRange)return;const o=r.viewItem;n(o,"htmlTableAttributes");for(const t of o.getChildren())t.is("element","thead")&&n(t,"htmlTheadAttributes"),t.is("element","tbody")&&n(t,"htmlTbodyAttributes");function n(e,o){const n=t.processViewAttributes(e,i);n&&i.writer.setAttribute(o,n,r.modelRange)}},{priority:"low"})}}(i)),r.for("downcast").add(t=>{function e(e,r){t.on(`attribute:${r}:table`,(t,i,o)=>{if(!o.consumable.test(i.item,t.name))return;const n=o.mapper.toViewElement(i.item),l=$t(o.writer,n,e);if(l)if(o.consumable.consume(i.item,t.name),"htmlTableAttributes"===r&&n!==l){const t=Rt(i.attributeOldValue),e=Rt(i.attributeNewValue);V(o.writer,t.tableAttributes,e.tableAttributes,l),V(o.writer,t.figureAttributes,e.figureAttributes,n)}else V(o.writer,i.attributeOldValue,i.attributeNewValue,l)})}e("table","htmlTableAttributes"),e("figure","htmlFigureAttributes"),e("thead","htmlTheadAttributes"),e("tbody","htmlTbodyAttributes")}),t.model.document.registerPostFixer(function(t,e){return r=>{const i=t.document.differ.getChanges();let o=!1;for(const t of i){if("attribute"!=t.type||"headingRows"!=t.attributeKey)continue;const i=t.range.start.nodeAfter,n=i.getAttribute("htmlTheadAttributes"),l=i.getAttribute("htmlTbodyAttributes");n&&!t.attributeNewValue?(r.removeAttribute("htmlTheadAttributes",i),o=!0):l&&t.attributeNewValue==e.getRows(i)&&(r.removeAttribute("htmlTbodyAttributes",i),o=!0)}return o}}(t.model,o)),n.stop())})}}function Rt(t){const e={},r={...t};if(!t||!("styles"in t))return{figureAttributes:e,tableAttributes:r};r.styles={};for(const[i,o]of Object.entries(t.styles))Dt.includes(i)?e.styles={...e.styles,[i]:o}:r.styles={...r.styles,[i]:o};return{figureAttributes:e,tableAttributes:r}}class Vt extends t.Plugin{static get requires(){return[Et]}static get pluginName(){return"StyleElementSupport"}static get isOfficialPlugin(){return!0}init(){const t=this.editor.plugins.get(Et);t.on("register:style",(e,r)=>{const i=this.editor,o=i.model.schema,n=i.conversion;o.register("htmlStyle",r.modelSchema),o.extend("htmlStyle",{allowAttributes:["htmlStyleAttributes","htmlContent"],isContent:!0}),i.data.registerRawContentMatcher({name:"style"}),n.for("upcast").elementToElement({view:"style",model:G(r)}),n.for("upcast").add(Z(r,t)),n.for("downcast").elementToElement({model:"htmlStyle",view:(t,{writer:e})=>X("style",t,e)}),n.for("downcast").add(tt(r)),e.stop()})}}function Nt(t){if(!t||"object"!=typeof t)return!1;const e=Object.getPrototypeOf(t);return!(null!==e&&e!==Object.prototype&&null!==Object.getPrototypeOf(e))&&"[object Object]"===Object.prototype.toString.call(t)}function Mt(t,e,r,i,o,n,l){const s=l(t,e,r,i,o,n);if(void 0!==s)return s;if(typeof t==typeof e)switch(typeof t){case"bigint":case"string":case"boolean":case"symbol":case"undefined":case"function":return t===e;case"number":return t===e||Object.is(t,e);case"object":return Lt(t,e,n,l)}return Lt(t,e,n,l)}function Lt(t,e,r,i){if(Object.is(t,e))return!0;let o=s(t),n=s(e);if(o===d&&(o=A),n===d&&(n=A),o!==n)return!1;switch(o){case m:return t.toString()===e.toString();case c:{const r=t.valueOf(),i=e.valueOf();return(_=r)===(I=i)||Number.isNaN(_)&&Number.isNaN(I)}case u:case f:case h:return Object.is(t.valueOf(),e.valueOf());case a:return t.source===e.source&&t.flags===e.flags;case"[object Function]":return t===e}var _,I;const $=(r=r??new Map).get(t),T=r.get(e);if(null!=$&&null!=T)return $===e;r.set(t,e),r.set(e,t);try{switch(o){case g:if(t.size!==e.size)return!1;for(const[o,n]of t.entries())if(!e.has(o)||!Mt(n,e.get(o),o,t,e,r,i))return!1;return!0;case b:{if(t.size!==e.size)return!1;const o=Array.from(t.values()),n=Array.from(e.values());for(let l=0;l<o.length;l++){const s=o[l],a=n.findIndex(o=>Mt(s,o,void 0,t,e,r,i));if(-1===a)return!1;n.splice(a,1)}return!0}case p:case v:case E:case S:case k:case"[object BigUint64Array]":case O:case C:case j:case"[object BigInt64Array]":case P:case F:if("undefined"!=typeof Buffer&&Buffer.isBuffer(t)!==Buffer.isBuffer(e))return!1;if(t.length!==e.length)return!1;for(let o=0;o<t.length;o++)if(!Mt(t[o],e[o],o,t,e,r,i))return!1;return!0;case w:return t.byteLength===e.byteLength&&Lt(new Uint8Array(t),new Uint8Array(e),r,i);case y:return t.byteLength===e.byteLength&&t.byteOffset===e.byteOffset&&Lt(new Uint8Array(t),new Uint8Array(e),r,i);case"[object Error]":return t.name===e.name&&t.message===e.message;case A:{if(!(Lt(t.constructor,e.constructor,r,i)||Nt(t)&&Nt(e)))return!1;const o=[...Object.keys(t),...l(t)],n=[...Object.keys(e),...l(e)];if(o.length!==n.length)return!1;for(let n=0;n<o.length;n++){const l=o[n],s=t[l];if(!Object.hasOwn(e,l))return!1;if(!Mt(s,e[l],l,t,e,r,i))return!1}return!0}default:return!1}}finally{r.delete(t),r.delete(e)}}function Ut(){}function zt(t,e){return function(t,e,r){return Mt(t,e,void 0,void 0,void 0,void 0,r)}(t,e,Ut)}class Wt extends t.Plugin{static get requires(){return[Et]}static get pluginName(){return"ListElementSupport"}static get isOfficialPlugin(){return!0}init(){const t=this.editor;if(!t.plugins.has("ListEditing"))return;const e=t.model.schema,r=t.conversion,i=t.plugins.get(Et),o=t.plugins.get("ListEditing"),n=t.plugins.get("ListUtils"),l=["ul","ol","li"];o.registerDowncastStrategy({scope:"item",attributeName:"htmlLiAttributes",setAttributeOnDowncast:N}),o.registerDowncastStrategy({scope:"list",attributeName:"htmlUlAttributes",setAttributeOnDowncast:N}),o.registerDowncastStrategy({scope:"list",attributeName:"htmlOlAttributes",setAttributeOnDowncast:N}),i.on("register",(t,o)=>{if(!l.includes(o.view))return;if(t.stop(),e.checkAttribute("$block","htmlLiAttributes"))return;const n=l.map(t=>q(t));e.extend("$listItem",{allowAttributes:n}),r.for("upcast").add(t=>{t.on("element:ul",qt("htmlUlAttributes",i),{priority:"low"}),t.on("element:ol",qt("htmlOlAttributes",i),{priority:"low"}),t.on("element:li",qt("htmlLiAttributes",i),{priority:"low"})})}),o.on("postFixer",(t,{listNodes:e,writer:r})=>{for(const{node:i,previousNodeInList:o}of e)if(o){if(o.getAttribute("listType")==i.getAttribute("listType")){const e=Gt(o.getAttribute("listType")),n=o.getAttribute(e);!zt(i.getAttribute(e),n)&&r.model.schema.checkAttribute(i,e)&&(r.setAttribute(e,n,i),t.return=!0)}if(o.getAttribute("listItemId")==i.getAttribute("listItemId")){const e=o.getAttribute("htmlLiAttributes");!zt(i.getAttribute("htmlLiAttributes"),e)&&r.model.schema.checkAttribute(i,"htmlLiAttributes")&&(r.setAttribute("htmlLiAttributes",e,i),t.return=!0)}}}),o.on("postFixer",(t,{listNodes:e,writer:r})=>{for(const{node:i}of e){const e=i.getAttribute("listType");!n.isNumberedListType(e)&&i.getAttribute("htmlOlAttributes")&&(r.removeAttribute("htmlOlAttributes",i),t.return=!0),n.isNumberedListType(e)&&i.getAttribute("htmlUlAttributes")&&(r.removeAttribute("htmlUlAttributes",i),t.return=!0)}})}afterInit(){const t=this.editor;if(!t.commands.get("indentList"))return;const e=t.commands.get("indentList");this.listenTo(e,"afterExecute",(e,r)=>{t.model.change(e=>{for(const i of r){const r=Gt(i.getAttribute("listType"));t.model.schema.checkAttribute(i,r)&&e.setAttribute(r,{},i)}})})}}function qt(t,e){return(r,i,o)=>{const n=i.viewItem;i.modelRange||Object.assign(i,o.convertChildren(i.viewItem,i.modelCursor));const l=e.processViewAttributes(n,o);for(const e of i.modelRange.getItems({shallow:!0}))e.hasAttribute("listItemId")&&(e.hasAttribute("htmlUlAttributes")||e.hasAttribute("htmlOlAttributes")||o.writer.model.schema.checkAttribute(e,t)&&o.writer.setAttribute(t,l||{},e))}}function Gt(t){return"numbered"===t||"customNumbered"==t?"htmlOlAttributes":"htmlUlAttributes"}class Kt extends t.Plugin{static get requires(){return[Et]}static get pluginName(){return"HorizontalLineElementSupport"}static get isOfficialPlugin(){return!0}init(){const t=this.editor;if(!t.plugins.has("HorizontalLineEditing"))return;const e=t.model.schema,r=t.conversion,i=t.plugins.get(Et);i.on("register:hr",(t,o)=>{"horizontalLine"===o.model&&(e.extend("horizontalLine",{allowAttributes:["htmlHrAttributes"]}),r.for("upcast").add(Z(o,i)),r.for("downcast").add(t=>{t.on("attribute:htmlHrAttributes:horizontalLine",(t,e,r)=>{if(!r.consumable.test(e.item,t.name))return;const{attributeOldValue:i,attributeNewValue:o}=e,n=r.mapper.toViewElement(e.item),l=$t(r.writer,n,"hr");l&&(V(r.writer,i,o,l),r.consumable.consume(e.item,t.name))},{priority:"low"})}),t.stop())})}}class Xt extends t.Plugin{static get requires(){return[Et,mt]}static get pluginName(){return"CustomElementSupport"}static get isOfficialPlugin(){return!0}init(){const t=this.editor.plugins.get(Et),e=this.editor.plugins.get(mt);t.on("register:$customElement",(r,i)=>{r.stop();const n=this.editor,l=n.model.schema,s=n.conversion,a=n.editing.view.domConverter.unsafeElements,m=n.data.htmlProcessor.domConverter.preElements;l.register(i.model,i.modelSchema),l.extend(i.model,{allowAttributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"],isContent:!0}),n.data.htmlProcessor.domConverter.registerRawContentMatcher({name:"template"}),s.for("upcast").elementToElement({view:/.*/,model:(r,l)=>{if("$comment"==r.name)return null;if(!function(t){try{document.createElement(t)}catch{return!1}return!0}(r.name))return null;if(e.getDefinitionsForView(r.name).size)return null;a.includes(r.name)||a.push(r.name),m.includes(r.name)||m.push(r.name);const s=l.writer.createElement(i.model,{htmlElementName:r.name}),c=t.processViewAttributes(r,l);let u;if(c&&l.writer.setAttribute("htmlCustomElementAttributes",c,s),r.is("element","template")&&r.getCustomProperty("$rawContent"))u=r.getCustomProperty("$rawContent");else{const t=new o.ViewUpcastWriter(r.document).createDocumentFragment(r),e=n.data.htmlProcessor.domConverter.viewToDom(t),i=e.firstChild;for(;i.firstChild;)e.appendChild(i.firstChild);i.remove(),u=n.data.htmlProcessor.htmlWriter.getHtml(e)}l.writer.setAttribute("htmlContent",u,s);for(const{item:t}of n.editing.view.createRangeIn(r))l.consumable.consume(t,{name:!0});return s},converterPriority:"low"}),s.for("editingDowncast").elementToElement({model:{name:i.model,attributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"]},view:(t,{writer:e})=>{const r=t.getAttribute("htmlElementName"),i=e.createRawElement(r);return t.hasAttribute("htmlCustomElementAttributes")&&N(e,t.getAttribute("htmlCustomElementAttributes"),i),i}}),s.for("dataDowncast").elementToElement({model:{name:i.model,attributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"]},view:(t,{writer:e})=>{const r=t.getAttribute("htmlElementName"),i=t.getAttribute("htmlContent"),o=e.createRawElement(r,null,(t,e)=>{e.setContentOf(t,i)});return t.hasAttribute("htmlCustomElementAttributes")&&N(e,t.getAttribute("htmlCustomElementAttributes"),o),o}})})}}class Qt extends t.Plugin{static get pluginName(){return"GeneralHtmlSupport"}static get isOfficialPlugin(){return!0}static get requires(){return[Et,Pt,Ft,It,Tt,Bt,xt,Ht,Vt,Wt,Kt,Xt]}init(){const t=this.editor,e=t.plugins.get(Et);e.loadAllowedEmptyElementsConfig(t.config.get("htmlSupport.allowEmpty")||[]),e.loadAllowedConfig(t.config.get("htmlSupport.allow")||[]),e.loadDisallowedConfig(t.config.get("htmlSupport.disallow")||[])}afterInit(){const t=this.editor.commands.get("removeFormat");t?.registerCustomAttribute(t=>t.startsWith("html")&&t.endsWith("Attributes"),z)}getGhsAttributeNameForElement(t){const e=this.editor.plugins.get("DataSchema"),r=Array.from(e.getDefinitionsForView(t,!1)),i=r.find(t=>t.isInline&&!r[0].isObject);return i?i.model:q(t)}addModelHtmlClass(t,r,i){const o=this.editor.model,n=this.getGhsAttributeNameForElement(t);o.change(t=>{for(const l of Yt(o,i,n))U(t,l,n,"classes",t=>{for(const i of(0,e.toArray)(r))t.add(i)})})}removeModelHtmlClass(t,r,i){const o=this.editor.model,n=this.getGhsAttributeNameForElement(t);o.change(t=>{for(const l of Yt(o,i,n))U(t,l,n,"classes",t=>{for(const i of(0,e.toArray)(r))t.delete(i)})})}setModelHtmlAttributes(t,e,r){const i=this.editor.model,o=this.getGhsAttributeNameForElement(t);i.change(t=>{for(const n of Yt(i,r,o))U(t,n,o,"attributes",t=>{for(const[r,i]of Object.entries(e))t.set(r,i)})})}removeModelHtmlAttributes(t,r,i){const o=this.editor.model,n=this.getGhsAttributeNameForElement(t);o.change(t=>{for(const l of Yt(o,i,n))U(t,l,n,"attributes",t=>{for(const i of(0,e.toArray)(r))t.delete(i)})})}setModelHtmlStyles(t,e,r){const i=this.editor.model,o=this.getGhsAttributeNameForElement(t);i.change(t=>{for(const n of Yt(i,r,o))U(t,n,o,"styles",t=>{for(const[r,i]of Object.entries(e))t.set(r,i)})})}removeModelHtmlStyles(t,r,i){const o=this.editor.model,n=this.getGhsAttributeNameForElement(t);o.change(t=>{for(const l of Yt(o,i,n))U(t,l,n,"styles",t=>{for(const i of(0,e.toArray)(r))t.delete(i)})})}}function*Yt(t,e,r){if(e)if(!(Symbol.iterator in e)&&e.is("documentSelection")&&e.isCollapsed)t.schema.checkAttributeInSelection(e,r)&&(yield e);else for(const i of function(t,e,r){return!(Symbol.iterator in e)&&(e.is("node")||e.is("$text")||e.is("$textProxy"))?t.schema.checkAttribute(e,r)?[t.createRangeOn(e)]:[]:t.schema.getValidRanges(t.createSelection(e).getRanges(),r)}(t,e,r))yield*i.getItems({shallow:!0})}class Jt extends t.Plugin{static get pluginName(){return"HtmlComment"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,r=new Map;t.data.processor.skipComments=!1,t.model.schema.addAttributeCheck((t,e)=>{if(t.endsWith("$root")&&e.startsWith("$comment"))return!0}),t.conversion.for("upcast").elementToMarker({view:"$comment",model:t=>{const i=`$comment:${(0,e.uid)()}`,o=t.getCustomProperty("$rawContent");return r.set(i,o),i}}),t.conversion.for("dataDowncast").markerToElement({model:"$comment",view:(t,{writer:e})=>{let r;for(const e of this.editor.model.document.getRootNames())if(r=this.editor.model.document.getRoot(e),r.hasAttribute(t.markerName))break;const i=t.markerName,o=r.getAttribute(i),n=e.createUIElement("$comment");return e.setCustomProperty("$rawContent",o,n),n}}),t.model.document.registerPostFixer(e=>{let i=!1;const o=t.model.document.differ.getChangedMarkers().filter(t=>t.name.startsWith("$comment:"));for(const t of o){const{oldRange:o,newRange:n}=t.data;if(!o||!n||o.root!=n.root){if(o){const r=o.root;r.hasAttribute(t.name)&&(e.removeAttribute(t.name,r),i=!0)}if(n){const o=n.root;"$graveyard"==o.rootName?(e.removeMarker(t.name),i=!0):o.hasAttribute(t.name)||(e.setAttribute(t.name,r.get(t.name)||"",o),i=!0)}}}return i}),t.data.on("set",()=>{for(const e of t.model.markers.getMarkersGroup("$comment"))this.removeHtmlComment(e.name)},{priority:"high"}),t.model.on("deleteContent",(e,[r])=>{for(const e of r.getRanges()){const r=t.model.schema.getLimitElement(e),i=t.model.createPositionAt(r,0),o=t.model.createPositionAt(r,"end");let n;n=i.isTouching(e.start)&&o.isTouching(e.end)?this.getHtmlCommentsInRange(t.model.createRange(i,o)):this.getHtmlCommentsInRange(e,{skipBoundaries:!0});for(const t of n)this.removeHtmlComment(t)}},{priority:"high"})}createHtmlComment(t,r){const i=(0,e.uid)(),o=this.editor.model,n=o.document.getRoot(t.root.rootName),l=`$comment:${i}`;return o.change(e=>{const i=e.createRange(t);return e.addMarker(l,{usingOperation:!0,affectsData:!0,range:i}),e.setAttribute(l,r,n),l})}removeHtmlComment(t){const e=this.editor,r=e.model.markers.get(t);return!!r&&(e.model.change(t=>{t.removeMarker(r)}),!0)}getHtmlCommentData(t){const e=this.editor.model.markers.get(t);if(!e)return null;let r="";for(const e of this.editor.model.document.getRoots())if(e.hasAttribute(t)){r=e.getAttribute(t);break}return{content:r,position:e.getStart()}}getHtmlCommentsInRange(t,{skipBoundaries:e=!1}={}){const r=!e;return Array.from(this.editor.model.markers.getMarkersGroup("$comment")).filter(e=>function(t,e){const i=t.getRange().start;return(i.isAfter(e.start)||r&&i.isEqual(e.start))&&(i.isBefore(e.end)||r&&i.isEqual(e.end))}(e,t)).map(t=>t.name)}}class Zt extends o.HtmlDataProcessor{toView(t){if(!/<(?:html|body|head|meta)(?:\s[^>]*)?>/i.test(t.trim().slice(0,1e4)))return super.toView(t);let e="",r="";t=(t=t.trim().replace(/<\?xml\s[^?]*\?>/i,t=>(r=t,""))).trim().replace(/^<!DOCTYPE\s[^>]*?>/i,t=>(e=t,""));const i=this._toDom(t),n=this.domConverter.domToView(i,{skipComments:this.skipComments}),l=new o.ViewUpcastWriter(n.document);l.setCustomProperty("$fullPageDocument",i.ownerDocument.documentElement.outerHTML,n);const s=Array.from(i.ownerDocument.querySelectorAll("head style"));return l.setCustomProperty("$fullPageHeadStyles",s,n),e&&l.setCustomProperty("$fullPageDocType",e,n),r&&l.setCustomProperty("$fullPageXmlDeclaration",r,n),n}toData(t){let e=super.toData(t);const r=t.getCustomProperty("$fullPageDocument"),i=t.getCustomProperty("$fullPageDocType"),o=t.getCustomProperty("$fullPageXmlDeclaration");return r&&(e=r.replace(/<\/body\s*>/,e+"$&"),i&&(e=i+"\n"+e),o&&(e=o+"\n"+e)),e}}class te extends t.Plugin{static get pluginName(){return"FullPage"}static get isOfficialPlugin(){return!0}constructor(t){super(t),t.config.define("htmlSupport.fullPage",{allowRenderStylesFromHead:!1,sanitizeCss:t=>((0,e.logWarning)("css-full-page-provide-sanitize-function"),{css:t,hasChanged:!1})}),t.data.processor=new Zt(t.data.viewDocument)}init(){const t=this.editor,e=["$fullPageDocument","$fullPageDocType","$fullPageXmlDeclaration","$fullPageHeadStyles"];t.model.schema.extend("$root",{allowAttributes:e}),t.data.on("toModel",(r,[i])=>{const o=t.model.document.getRoot();t.model.change(t=>{for(const r of e){const e=i.getCustomProperty(r);e&&t.setAttribute(r,e,o)}}),ee(t)&&this._renderStylesFromHead(o)},{priority:"low"}),t.data.on("toView",(t,[r])=>{if(!r.is("rootElement"))return;const i=r,n=t.return;if(!i.hasAttribute("$fullPageDocument"))return;const l=new o.ViewUpcastWriter(n.document);for(const t of e){const e=i.getAttribute(t);e&&l.setCustomProperty(t,e,n)}},{priority:"low"}),t.data.on("set",()=>{const r=t.model.document.getRoot();t.model.change(t=>{for(const i of e)r.hasAttribute(i)&&t.removeAttribute(i,r)})},{priority:"high"}),t.data.on("get",(t,e)=>{e[0]||(e[0]={}),e[0].trim=!1},{priority:"high"})}destroy(){super.destroy(),ee(this.editor)&&this._removeStyleElementsFromDom()}_removeStyleElementsFromDom(){const t=Array.from(e.global.document.querySelectorAll(`[data-full-page-style-id="${this.editor.id}"]`));for(const e of t)e.remove()}_renderStyleElementsInDom(t){const r=this.editor,i=t.getAttribute("$fullPageHeadStyles");if(!i)return;const o=r.config.get("htmlSupport.fullPage.sanitizeCss");for(const t of i){t.setAttribute("data-full-page-style-id",r.id);const i=o(t.innerText);i.hasChanged&&(t.innerText=i.css),e.global.document.head.append(t)}}_renderStylesFromHead(t){this._removeStyleElementsFromDom(),this._renderStyleElementsInDom(t)}}function ee(t){return t.config.get("htmlSupport.fullPage.allowRenderStylesFromHead")}const re="htmlEmptyBlock";class ie extends t.Plugin{static get pluginName(){return"EmptyBlock"}static get isOfficialPlugin(){return!0}afterInit(){const{model:t,conversion:e,plugins:r,config:i}=this.editor,o=t.schema,n=i.get("htmlSupport.preserveEmptyBlocksInEditingView");o.extend("$block",{allowAttributes:[re]}),o.extend("$container",{allowAttributes:[re]}),o.isRegistered("tableCell")&&o.extend("tableCell",{allowAttributes:[re]}),n?e.for("downcast").add(oe()):e.for("dataDowncast").add(oe()),e.for("upcast").add(function(t){return e=>{e.on("element",(e,r,i)=>{const{viewItem:o,modelRange:n}=r;if(!o.is("element")||!o.isEmpty||o.getCustomProperty("$hasBlockFiller"))return;const l=n&&n.start.nodeAfter;if(!l||!t.checkAttribute(l,re))return;if(i.writer.setAttribute(re,!0,l),1!=l.childCount)return;const s=l.getChild(0);s.is("element","paragraph")&&t.checkAttribute(s,re)&&i.writer.setAttribute(re,!0,s)},{priority:"lowest"})}}(o)),r.has("ClipboardPipeline")&&this._registerClipboardPastingHandler()}_registerClipboardPastingHandler(){const t=this.editor.plugins.get("ClipboardPipeline");this.listenTo(t,"contentInsertion",(t,e)=>{e.sourceEditorId!==this.editor.id&&this.editor.model.change(t=>{for(const{item:r}of t.createRangeIn(e.content))r.is("element")&&r.hasAttribute(re)&&t.removeAttribute(re,r)})})}}function oe(){return t=>{t.on(`attribute:${re}`,(t,e,r)=>{const{mapper:i,consumable:o}=r,{item:n}=e;if(!o.consume(n,t.name))return;const l=i.toViewElement(n);l&&e.attributeNewValue&&(l.getFillerOffset=()=>null)})}}})(),(window.CKEditor5=window.CKEditor5||{}).htmlSupport=i})();
package/dist/index.js CHANGED
@@ -4,9 +4,9 @@
4
4
  */
5
5
  import { Plugin } from '@ckeditor/ckeditor5-core/dist/index.js';
6
6
  import { toArray, priorities, CKEditorError, isValidAttributeName, uid, logWarning, global } from '@ckeditor/ckeditor5-utils/dist/index.js';
7
- import { Matcher, StylesMap, UpcastWriter, HtmlDataProcessor } from '@ckeditor/ckeditor5-engine/dist/index.js';
7
+ import { Matcher, StylesMap, ViewUpcastWriter, HtmlDataProcessor } from '@ckeditor/ckeditor5-engine/dist/index.js';
8
8
  import { toWidget, Widget } from '@ckeditor/ckeditor5-widget/dist/index.js';
9
- import { startCase, cloneDeep, mergeWith, isPlainObject, isEqual } from 'es-toolkit/compat';
9
+ import { cloneDeep, startCase, mergeWith, isPlainObject, isEqual } from 'es-toolkit/compat';
10
10
  import { Enter } from '@ckeditor/ckeditor5-enter/dist/index.js';
11
11
 
12
12
  /**
@@ -16,6 +16,7 @@ import { Enter } from '@ckeditor/ckeditor5-enter/dist/index.js';
16
16
  * @param oldViewAttributes The previous GHS attribute value.
17
17
  * @param newViewAttributes The current GHS attribute value.
18
18
  * @param viewElement The view element to update.
19
+ * @internal
19
20
  */ function updateViewAttributes(writer, oldViewAttributes, newViewAttributes, viewElement) {
20
21
  if (oldViewAttributes) {
21
22
  removeViewAttributes(writer, oldViewAttributes, viewElement);
@@ -30,6 +31,7 @@ import { Enter } from '@ckeditor/ckeditor5-enter/dist/index.js';
30
31
  * @param writer The view writer.
31
32
  * @param viewAttributes The GHS attribute value.
32
33
  * @param viewElement The view element to update.
34
+ * @internal
33
35
  */ function setViewAttributes(writer, viewAttributes, viewElement) {
34
36
  if (viewAttributes.attributes) {
35
37
  for (const [key, value] of Object.entries(viewAttributes.attributes)){
@@ -49,6 +51,7 @@ import { Enter } from '@ckeditor/ckeditor5-enter/dist/index.js';
49
51
  * @param writer The view writer.
50
52
  * @param viewAttributes The GHS attribute value.
51
53
  * @param viewElement The view element to update.
54
+ * @internal
52
55
  */ function removeViewAttributes(writer, viewAttributes, viewElement) {
53
56
  if (viewAttributes.attributes) {
54
57
  for (const [key] of Object.entries(viewAttributes.attributes)){
@@ -66,6 +69,8 @@ import { Enter } from '@ckeditor/ckeditor5-enter/dist/index.js';
66
69
  }
67
70
  /**
68
71
  * Merges view element attribute objects.
72
+ *
73
+ * @internal
69
74
  */ function mergeViewElementAttributes(target, source) {
70
75
  const result = cloneDeep(target);
71
76
  let key = 'attributes';
@@ -129,16 +134,43 @@ function modifyGhsAttribute(writer, item, ghsAttributeName, subject, callback) {
129
134
  }
130
135
  }
131
136
  }
137
+ /**
138
+ * Strips the `styles`, and `classes` keys from the GHS attribute value on the given item.
139
+ *
140
+ * @internal
141
+ */ function removeFormatting(ghsAttributeName, itemRange, writer) {
142
+ for (const item of itemRange.getItems({
143
+ shallow: true
144
+ })){
145
+ const value = item.getAttribute(ghsAttributeName);
146
+ // Copy only attributes to the new attribute value.
147
+ if (value && value.attributes && Object.keys(value.attributes).length) {
148
+ // But reset the GHS attribute only when there is anything more than just attributes.
149
+ if (Object.keys(value).length > 1) {
150
+ writer.setAttribute(ghsAttributeName, {
151
+ attributes: value.attributes
152
+ }, item);
153
+ }
154
+ } else {
155
+ // There are no attributes, so remove the GHS attribute completely.
156
+ writer.removeAttribute(ghsAttributeName, item);
157
+ }
158
+ }
159
+ }
132
160
  /**
133
161
  * Transforms passed string to PascalCase format. Examples:
134
162
  * * `div` => `Div`
135
163
  * * `h1` => `H1`
136
164
  * * `table` => `Table`
165
+ *
166
+ * @internal
137
167
  */ function toPascalCase(data) {
138
168
  return startCase(data).replace(/ /g, '');
139
169
  }
140
170
  /**
141
171
  * Returns the attribute name of the model element that holds raw HTML attributes.
172
+ *
173
+ * @internal
142
174
  */ function getHtmlAttributeName(viewElementName) {
143
175
  return `html${toPascalCase(viewElementName)}Attributes`;
144
176
  }
@@ -149,6 +181,7 @@ function modifyGhsAttribute(writer, item, ghsAttributeName, subject, callback) {
149
181
  * Preserves object element content in `htmlContent` attribute.
150
182
  *
151
183
  * @returns Returns a conversion callback.
184
+ * @internal
152
185
  */ function viewToModelObjectConverter({ model: modelName }) {
153
186
  return (viewElement, conversionApi)=>{
154
187
  // Let's keep element HTML and its attributes, so we can rebuild element in downcast conversions.
@@ -161,6 +194,7 @@ function modifyGhsAttribute(writer, item, ghsAttributeName, subject, callback) {
161
194
  * Conversion helper converting an object element to an HTML object widget.
162
195
  *
163
196
  * @returns Returns a conversion callback.
197
+ * @internal
164
198
  */ function toObjectWidgetConverter(editor, { view: viewName, isInline }) {
165
199
  const t = editor.t;
166
200
  return (modelElement, { writer })=>{
@@ -184,6 +218,8 @@ function modifyGhsAttribute(writer, item, ghsAttributeName, subject, callback) {
184
218
  }
185
219
  /**
186
220
  * Creates object view element from the given model element.
221
+ *
222
+ * @internal
187
223
  */ function createObjectView(viewName, modelElement, writer) {
188
224
  return writer.createRawElement(viewName, null, (domElement, domConverter)=>{
189
225
  domConverter.setContentOf(domElement, modelElement.getAttribute('htmlContent'));
@@ -193,6 +229,7 @@ function modifyGhsAttribute(writer, item, ghsAttributeName, subject, callback) {
193
229
  * View-to-attribute conversion helper preserving inline element attributes on `$text`.
194
230
  *
195
231
  * @returns Returns a conversion callback.
232
+ * @internal
196
233
  */ function viewToAttributeInlineConverter({ view: viewName, model: attributeKey, allowEmpty }, dataFilter) {
197
234
  return (dispatcher)=>{
198
235
  dispatcher.on(`element:${viewName}`, (evt, data, conversionApi)=>{
@@ -247,6 +284,8 @@ function modifyGhsAttribute(writer, item, ghsAttributeName, subject, callback) {
247
284
  }
248
285
  /**
249
286
  * Conversion helper converting an empty inline model element to an HTML element or widget.
287
+ *
288
+ * @internal
250
289
  */ function emptyInlineModelElementToViewConverter({ model: attributeKey, view: viewName }, asWidget) {
251
290
  return (item, { writer, consumable })=>{
252
291
  if (!item.hasAttribute(attributeKey)) {
@@ -264,6 +303,7 @@ function modifyGhsAttribute(writer, item, ghsAttributeName, subject, callback) {
264
303
  * Attribute-to-view conversion helper applying attributes to view element preserved on `$text`.
265
304
  *
266
305
  * @returns Returns a conversion callback.
306
+ * @internal
267
307
  */ function attributeToViewInlineConverter({ priority, view: viewName }) {
268
308
  return (attributeValue, conversionApi)=>{
269
309
  if (!attributeValue) {
@@ -283,6 +323,7 @@ function modifyGhsAttribute(writer, item, ghsAttributeName, subject, callback) {
283
323
  * All matched attributes will be preserved on `html*Attributes` attribute.
284
324
  *
285
325
  * @returns Returns a conversion callback.
326
+ * @internal
286
327
  */ function viewToModelBlockAttributeConverter({ view: viewName }, dataFilter) {
287
328
  return (dispatcher)=>{
288
329
  dispatcher.on(`element:${viewName}`, (evt, data, conversionApi)=>{
@@ -308,6 +349,7 @@ function modifyGhsAttribute(writer, item, ghsAttributeName, subject, callback) {
308
349
  * for block elements.
309
350
  *
310
351
  * @returns Returns a conversion callback.
352
+ * @internal
311
353
  */ function modelToViewBlockAttributeConverter({ view: viewName, model: modelName }) {
312
354
  return (dispatcher)=>{
313
355
  dispatcher.on(`attribute:${getHtmlAttributeName(viewName)}:${modelName}`, (evt, data, conversionApi)=>{
@@ -368,7 +410,7 @@ function modifyGhsAttribute(writer, item, ghsAttributeName, subject, callback) {
368
410
  // noscript
369
411
  //
370
412
  // When adding elements to this list, update the feature guide listing, too.
371
- var defaultConfig = {
413
+ const defaultConfig = {
372
414
  block: [
373
415
  // Existing features.
374
416
  {
@@ -1029,7 +1071,10 @@ var defaultConfig = {
1029
1071
  model: 'htmlA',
1030
1072
  view: 'a',
1031
1073
  priority: 5,
1032
- coupledAttribute: 'linkHref'
1074
+ coupledAttribute: 'linkHref',
1075
+ attributeProperties: {
1076
+ isFormatting: true
1077
+ }
1033
1078
  },
1034
1079
  {
1035
1080
  model: 'htmlStrong',
@@ -2075,7 +2120,7 @@ var defaultConfig = {
2075
2120
  const schema = editor.model.schema;
2076
2121
  const conversion = editor.conversion;
2077
2122
  const attributeKey = definition.model;
2078
- // This element is stored in the model as an attribute on a block element, for example DocumentLists.
2123
+ // This element is stored in the model as an attribute on a block element, for example Lists.
2079
2124
  if (definition.appliesToBlock) {
2080
2125
  return;
2081
2126
  }
@@ -2431,9 +2476,10 @@ var defaultConfig = {
2431
2476
  * * model element HTML is semantically correct and easier to work with.
2432
2477
  *
2433
2478
  * If element contains any block element, it will be treated as a sectioning element and registered using
2434
- * {@link module:html-support/dataschema~DataSchemaDefinition#model} and
2435
- * {@link module:html-support/dataschema~DataSchemaDefinition#modelSchema} in editor schema.
2436
- * Otherwise, it will be registered under {@link module:html-support/dataschema~DataSchemaBlockElementDefinition#paragraphLikeModel} model
2479
+ * {@link module:html-support/dataschema~HtmlSupportDataSchemaDefinition#model} and
2480
+ * {@link module:html-support/dataschema~HtmlSupportDataSchemaDefinition#modelSchema} in editor schema.
2481
+ * Otherwise, it will be registered under
2482
+ * {@link module:html-support/dataschema~HtmlSupportDataSchemaBlockElementDefinition#paragraphLikeModel} model
2437
2483
  * name with model schema accepting only inline content (inheriting from `$block`).
2438
2484
  */ class DualContentModelElementSupport extends Plugin {
2439
2485
  /**
@@ -3567,8 +3613,9 @@ const STYLE_ATTRIBUTES_TO_PROPAGATE = [
3567
3613
  if (viewElement.is('element', 'template') && viewElement.getCustomProperty('$rawContent')) {
3568
3614
  htmlContent = viewElement.getCustomProperty('$rawContent');
3569
3615
  } else {
3570
- // Store the whole element in the attribute so that DomConverter will be able to use the pre like element context.
3571
- const viewWriter = new UpcastWriter(viewElement.document);
3616
+ // Store the whole element in the attribute so that ViewDomConverter
3617
+ // will be able to use the pre like element context.
3618
+ const viewWriter = new ViewUpcastWriter(viewElement.document);
3572
3619
  const documentFragment = viewWriter.createDocumentFragment(viewElement);
3573
3620
  const domFragment = editor.data.htmlProcessor.domConverter.viewToDom(documentFragment);
3574
3621
  const domElement = domFragment.firstChild;
@@ -3690,6 +3737,12 @@ const STYLE_ATTRIBUTES_TO_PROPAGATE = [
3690
3737
  dataFilter.loadAllowedConfig(editor.config.get('htmlSupport.allow') || []);
3691
3738
  dataFilter.loadDisallowedConfig(editor.config.get('htmlSupport.disallow') || []);
3692
3739
  }
3740
+ /**
3741
+ * @inheritDoc
3742
+ */ afterInit() {
3743
+ const removeFormatCommand = this.editor.commands.get('removeFormat');
3744
+ removeFormatCommand?.registerCustomAttribute((attributeName)=>attributeName.startsWith('html') && attributeName.endsWith('Attributes'), removeFormatting);
3745
+ }
3693
3746
  /**
3694
3747
  * Returns a GHS model attribute name related to a given view element name.
3695
3748
  *
@@ -4095,7 +4148,7 @@ const STYLE_ATTRIBUTES_TO_PROPAGATE = [
4095
4148
  const viewFragment = this.domConverter.domToView(domFragment, {
4096
4149
  skipComments: this.skipComments
4097
4150
  });
4098
- const writer = new UpcastWriter(viewFragment.document);
4151
+ const writer = new ViewUpcastWriter(viewFragment.document);
4099
4152
  // Using the DOM document with body content extracted as a skeleton of the page.
4100
4153
  writer.setCustomProperty('$fullPageDocument', domFragment.ownerDocument.documentElement.outerHTML, viewFragment);
4101
4154
  // List of `<style>` elements extracted from document's `<head>` element.
@@ -4206,7 +4259,7 @@ const STYLE_ATTRIBUTES_TO_PROPAGATE = [
4206
4259
  if (!root.hasAttribute('$fullPageDocument')) {
4207
4260
  return;
4208
4261
  }
4209
- const writer = new UpcastWriter(viewFragment.document);
4262
+ const writer = new ViewUpcastWriter(viewFragment.document);
4210
4263
  for (const name of properties){
4211
4264
  const value = root.getAttribute(name);
4212
4265
  if (value) {
@@ -4439,5 +4492,5 @@ const EMPTY_BLOCK_MODEL_ATTRIBUTE = 'htmlEmptyBlock';
4439
4492
  };
4440
4493
  }
4441
4494
 
4442
- export { DataFilter, DataSchema, EmptyBlock, FullPage, GeneralHtmlSupport, HtmlComment, HtmlPageDataProcessor };
4495
+ export { DataFilter, DataSchema, EmptyBlock, FullPage, GeneralHtmlSupport, HtmlComment, HtmlPageDataProcessor, defaultConfig as _HTML_SUPPORT_SCHEMA_DEFINITIONS, attributeToViewInlineConverter as _attributeToInlineHtmlSupportConverter, createObjectView as _createObjectHtmlSupportView, emptyInlineModelElementToViewConverter as _emptyInlineModelElementToViewHtmlSupportConverter, getHtmlAttributeName as _getHtmlSupportAttributeName, getDescendantElement as _getHtmlSupportDescendantElement, mergeViewElementAttributes as _mergeHtmlSupportViewElementAttributes, modelToViewBlockAttributeConverter as _modelToViewBlockAttributeHtmlSupportConverter, modifyGhsAttribute as _modifyHtmlSupportGhsAttribute, removeViewAttributes as _removeHtmlSupportViewAttributes, setViewAttributes as _setHtmlSupportViewAttributes, toPascalCase as _toHtmlSupportPascalCase, toObjectWidgetConverter as _toObjectWidgetHtmlSupportConverter, updateViewAttributes as _updateHtmlSupportViewAttributes, viewToAttributeInlineConverter as _viewToAttributeInlineHtmlSupportConverter, viewToModelBlockAttributeConverter as _viewToModelBlockAttributeHtmlSupportConverter, viewToModelObjectConverter as _viewToModelObjectContentHtmlSupportConverter };
4443
4496
  //# sourceMappingURL=index.js.map