@arcgis/common-components 5.1.0-next.90 → 5.1.0-next.91
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.
|
@@ -8071,7 +8071,7 @@ $&
|
|
|
8071
8071
|
`).replace(/<br[^>]*>/g,`$&
|
|
8072
8072
|
`).split(`
|
|
8073
8073
|
`),i=0,r=!1;return o.filter((s=>s.length)).map((s=>(r=(function(a,l){return new RegExp("<pre( .*?)?>").test(a)?"first":new RegExp("</pre>").test(a)?"last":(l==="first"||l==="middle")&&"middle"})(s,r),(function(a,l){return l.some((c=>!c.isVoid&&!!new RegExp(`<${c.name}( .*?)?>`).test(a)))})(s,e)?Tc(s,i++):(function(a,l){return l.some((c=>new RegExp(`</${c.name}>`).test(a)))})(s,e)?Tc(s,--i):r==="middle"||r==="last"?s:Tc(s,i)))).join(`
|
|
8074
|
-
`)}function Tc(n,e,t=" "){return`${t.repeat(Math.max(0,e))}${n}`}var pb=z(671),dT={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(pb.Z,dT),pb.Z.locals;let Fs="SourceEditingMode";class fb extends L{static get pluginName(){return"SourceEditing"}static get requires(){return[Pm]}constructor(e){super(e),this.set("isSourceEditingMode",!1),this._elementReplacer=new Sd,this._replacedRoots=new Map,this._dataFromRoots=new Map,e.config.define("sourceEditing.allowCollaborationFeatures",!1)}init(){this._checkCompatibility();let e=this.editor,t=e.locale.t;e.ui.componentFactory.add("sourceEditing",(()=>{let o=this._createButton(ne);return o.set({label:t("Source"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m12.5 0 5 4.5v15.003h-16V0h11zM3 1.5v3.25l-1.497 1-.003 8 1.5 1v3.254L7.685 18l-.001 1.504H17.5V8.002L16 9.428l-.004-4.22-4.222-3.692L3 1.5z"/><path d="M4.06 6.64a.75.75 0 0 1 .958 1.15l-.085.07L2.29 9.75l2.646 1.89c.302.216.4.62.232.951l-.058.095a.75.75 0 0 1-.951.232l-.095-.058-3.5-2.5V9.14l3.496-2.5zm4.194 6.22a.75.75 0 0 1-.958-1.149l.085-.07 2.643-1.89-2.646-1.89a.75.75 0 0 1-.232-.952l.058-.095a.75.75 0 0 1 .95-.232l.096.058 3.5 2.5v1.22l-3.496 2.5zm7.644-.836 2.122 2.122-5.825 5.809-2.125-.005.003-2.116zm2.539-1.847 1.414 1.414a.5.5 0 0 1 0 .707l-1.06 1.06-2.122-2.12 1.061-1.061a.5.5 0 0 1 .707 0z"/></svg>',tooltip:!0,class:"ck-source-editing-button"}),o})),e.ui.componentFactory.add("menuBar:sourceEditing",(()=>{let o=this._createButton(Pe);return o.set({label:t("Show source")}),o})),this._isAllowedToHandleSourceEditingMode()&&(this.on("change:isSourceEditingMode",((o,i,r)=>{r?(this._hideVisibleDialog(),this._showSourceEditing(),this._disableCommands()):(this._hideSourceEditing(),this._enableCommands())})),this.on("change:isEnabled",((o,i,r)=>this._handleReadOnlyMode(!r))),this.listenTo(e,"change:isReadOnly",((o,i,r)=>this._handleReadOnlyMode(r)))),e.data.on("get",(()=>{this.isSourceEditingMode&&this.updateEditorData()}),{priority:"high"})}updateEditorData(){let e=this.editor,t={};for(let[o,i]of this._replacedRoots){let r=this._dataFromRoots.get(o),s=i.dataset.value;r!==s&&(t[o]=s,this._dataFromRoots.set(o,s))}Object.keys(t).length&&e.data.set(t,{batchType:{isUndoable:!0},suppressErrorInCollaboration:!0})}_checkCompatibility(){let e=this.editor,t=e.config.get("sourceEditing.allowCollaborationFeatures");if(!t&&e.plugins.has("RealTimeCollaborativeEditing"))throw new y("source-editing-incompatible-with-real-time-collaboration",null);!t&&["CommentsEditing","TrackChangesEditing","RevisionHistory"].some((o=>e.plugins.has(o)))&&console.warn("You initialized the editor with the source editing feature and at least one of the collaboration features. Please be advised that the source editing feature may not work, and be careful when editing document source that contains markers created by the collaboration features."),e.plugins.has("RestrictedEditingModeEditing")&&console.warn("You initialized the editor with the source editing feature and restricted editing feature. Please be advised that the source editing feature may not work, and be careful when editing document source that contains markers created by the restricted editing feature.")}_showSourceEditing(){let e=this.editor,t=e.editing.view,o=e.model;o.change((i=>{i.setSelection(null),i.removeSelectionAttribute(o.document.selection.getAttributeKeys())}));for(let[i,r]of t.domRoots){let s=uT(e.data.get({rootName:i})),a=kt(r.ownerDocument,"textarea",{rows:"1","aria-label":"Source code editing area"}),l=kt(r.ownerDocument,"div",{class:"ck-source-editing-area","data-value":s},[a]);a.value=s,a.setSelectionRange(0,0),a.addEventListener("input",(()=>{l.dataset.value=a.value,e.ui.update()})),t.change((c=>{let d=t.document.getRoot(i);c.addClass("ck-hidden",d)})),e.ui.setEditableElement("sourceEditing:"+i,a),this._replacedRoots.set(i,l),this._elementReplacer.replace(r,l),this._dataFromRoots.set(i,s)}this._focusSourceEditing()}_hideSourceEditing(){let e=this.editor.editing.view;this.updateEditorData(),e.change((t=>{for(let[o]of this._replacedRoots)t.removeClass("ck-hidden",e.document.getRoot(o))})),this._elementReplacer.restore(),this._replacedRoots.clear(),this._dataFromRoots.clear(),e.focus()}_focusSourceEditing(){let e=this.editor,[t]=this._replacedRoots.values(),o=t.querySelector("textarea");e.editing.view.document.isFocused=!1,o.focus()}_disableCommands(){let e=this.editor;for(let t of e.commands.commands())t.forceDisabled(Fs);e.plugins.has("CommentsArchiveUI")&&e.plugins.get("CommentsArchiveUI").forceDisabled(Fs)}_enableCommands(){let e=this.editor;for(let t of e.commands.commands())t.clearForceDisabled(Fs);e.plugins.has("CommentsArchiveUI")&&e.plugins.get("CommentsArchiveUI").clearForceDisabled(Fs)}_handleReadOnlyMode(e){if(this.isSourceEditingMode)for(let[,t]of this._replacedRoots)t.querySelector("textarea").readOnly=e}_isAllowedToHandleSourceEditingMode(){let e=this.editor.ui.view.editable;return e&&!e.hasExternalElement}_hideVisibleDialog(){if(this.editor.plugins.has("Dialog")){let e=this.editor.plugins.get("Dialog");e.isOpen&&e.hide()}}_createButton(e){let t=this.editor,o=new e(t.locale);return o.set({withText:!0}),o.bind("isOn").to(this,"isSourceEditingMode"),o.bind("isEnabled").to(this,"isEnabled",t,"isReadOnly",t.plugins.get(Pm),"hasAny",((i,r,s)=>!!i&&!r&&!s)),this.listenTo(o,"execute",(()=>{this.isSourceEditingMode=!this.isSourceEditingMode})),o}}function uT(n){return(function(e){return e.startsWith("<")})(n)?cT(n):n}function Sc(n,e){let{modelAttribute:t,styleName:o,viewElement:i,defaultValue:r,reduceBoxSides:s=!1,shouldUpcast:a=()=>!0}=e;n.for("upcast").attributeToAttribute({view:{name:i,styles:{[o]:/[\s\S]+/}},model:{key:t,value:l=>{if(!a(l))return;let c=l.getNormalizedStyle(o),d=s?js(c):c;return r!==d?d:void 0}}})}function Ic(n,e,t,o){n.for("upcast").add((i=>i.on("element:"+e,((r,s,a)=>{if(!s.modelRange)return;let l=["border-top-width","border-top-color","border-top-style","border-bottom-width","border-bottom-color","border-bottom-style","border-right-width","border-right-color","border-right-style","border-left-width","border-left-color","border-left-style"].filter((m=>s.viewItem.hasStyle(m)));if(!l.length)return;let c={styles:l};if(!a.consumable.test(s.viewItem,c))return;let d=[...s.modelRange.getItems({shallow:!0})].pop();a.consumable.consume(s.viewItem,c);let u={style:s.viewItem.getNormalizedStyle("border-style"),color:s.viewItem.getNormalizedStyle("border-color"),width:s.viewItem.getNormalizedStyle("border-width")},h={style:js(u.style),color:js(u.color),width:js(u.width)};h.style!==o.style&&a.writer.setAttribute(t.style,h.style,d),h.color!==o.color&&a.writer.setAttribute(t.color,h.color,d),h.width!==o.width&&a.writer.setAttribute(t.width,h.width,d)}))))}function or(n,e){let{modelElement:t,modelAttribute:o,styleName:i}=e;n.for("downcast").attributeToAttribute({model:{name:t,key:o},view:r=>({key:"style",value:{[i]:r}})})}function Vs(n,e){let{modelAttribute:t,styleName:o}=e;n.for("downcast").add((i=>i.on(`attribute:${t}:table`,((r,s,a)=>{let{item:l,attributeNewValue:c}=s,{mapper:d,writer:u}=a;if(!a.consumable.consume(s.item,r.name))return;let h=[...d.toViewElement(l).getChildren()].find((m=>m.is("element","table")));c?u.setStyle(o,c,h):u.removeStyle(o,h)}))))}function js(n){if(!n)return;let e=["top","right","bottom","left"];if(!e.every((o=>n[o])))return n;let t=n.top;return e.every((o=>n[o]===t))?t:n}function Re(n,e,t,o,i=1){e!=null&&i!=null&&e>i?o.setAttribute(n,e,t):o.removeAttribute(n,t)}function ti(n,e,t={}){let o=n.createElement("tableCell",t);return n.insertElement("paragraph",o),n.insert(o,e),o}function Bc(n,e){let t=e.parent.parent,o=parseInt(t.getAttribute("headingColumns")||"0"),{column:i}=n.getCellLocation(e);return!!o&&i<o}function Hs(n,e,t){let{modelAttribute:o}=t;n.extend("tableCell",{allowAttributes:[o]}),Sc(e,{viewElement:/^(td|th)$/,...t}),or(e,{modelElement:"tableCell",...t})}function Mc(n){let e=n.getSelectedElement();return e&&e.is("element","table")?e:n.getFirstPosition().findAncestor("table")}function hT(){return n=>{n.on("element:table",((e,t,o)=>{let i=t.viewItem;if(!o.consumable.test(i,{name:!0}))return;let{rows:r,headingRows:s,headingColumns:a}=(function(d){let u,h=0,m=[],g=[],b;for(let w of Array.from(d.getChildren())){if(w.name!=="tbody"&&w.name!=="thead"&&w.name!=="tfoot")continue;w.name!=="thead"||b||(b=w);let A=Array.from(w.getChildren()).filter((S=>S.is("element","tr")));for(let S of A)if(b&&w===b||w.name==="tbody"&&Array.from(S.getChildren()).length&&Array.from(S.getChildren()).every((M=>M.is("element","th"))))h++,m.push(S);else{g.push(S);let M=mT(S);(!u||M<u)&&(u=M)}}return{headingRows:h,headingColumns:u||0,rows:[...m,...g]}})(i),l={};a&&(l.headingColumns=a),s&&(l.headingRows=s);let c=o.writer.createElement("table",l);if(o.safeInsert(c,t.modelCursor)){if(o.consumable.consume(i,{name:!0}),r.forEach((d=>o.convertItem(d,o.writer.createPositionAt(c,"end")))),o.convertChildren(i,o.writer.createPositionAt(c,"end")),c.isEmpty){let d=o.writer.createElement("tableRow");o.writer.insert(d,o.writer.createPositionAt(c,"end")),ti(o.writer,o.writer.createPositionAt(d,"end"))}o.updateConversionResult(c,t)}}))}}function kb(n){return e=>{e.on(`element:${n}`,((t,o,{writer:i})=>{if(!o.modelRange)return;let r=o.modelRange.start.nodeAfter,s=i.createPositionAt(r,0);if(o.viewItem.isEmpty)return void i.insertElement("paragraph",s);let a=Array.from(r.getChildren());if(a.every((l=>l.is("element","$marker")))){let l=i.createElement("paragraph");i.insert(l,i.createPositionAt(r,0));for(let c of a)i.move(i.createRangeOn(c),i.createPositionAt(l,"end"))}}),{priority:"low"})}}function mT(n){let e=0,t=0,o=Array.from(n.getChildren()).filter((i=>i.name==="th"||i.name==="td"));for(;t<o.length&&o[t].name==="th";){let i=o[t];e+=parseInt(i.getAttribute("colspan")||"1"),t++}return e}class Ae{constructor(e,t={}){this._jumpedToStartRow=!1,this._table=e,this._startRow=t.row!==void 0?t.row:t.startRow||0,this._endRow=t.row!==void 0?t.row:t.endRow,this._startColumn=t.column!==void 0?t.column:t.startColumn||0,this._endColumn=t.column!==void 0?t.column:t.endColumn,this._includeAllSlots=!!t.includeAllSlots,this._skipRows=new Set,this._row=0,this._rowIndex=0,this._column=0,this._cellIndex=0,this._spannedCells=new Map,this._nextCellAtColumn=-1}[Symbol.iterator](){return this}next(){this._canJumpToStartRow()&&this._jumpToNonSpannedRowClosestToStartRow();let e=this._table.getChild(this._rowIndex);if(!e||this._isOverEndRow())return{done:!0,value:void 0};if(!e.is("element","tableRow"))return this._rowIndex++,this.next();if(this._isOverEndColumn())return this._advanceToNextRow();let t=null,o=this._getSpanned();if(o)this._includeAllSlots&&!this._shouldSkipSlot()&&(t=this._formatOutValue(o.cell,o.row,o.column));else{let i=e.getChild(this._cellIndex);if(!i)return this._advanceToNextRow();let r=parseInt(i.getAttribute("colspan")||"1"),s=parseInt(i.getAttribute("rowspan")||"1");(r>1||s>1)&&this._recordSpans(i,s,r),this._shouldSkipSlot()||(t=this._formatOutValue(i)),this._nextCellAtColumn=this._column+r}return this._column++,this._column==this._nextCellAtColumn&&this._cellIndex++,t||this.next()}skipRow(e){this._skipRows.add(e)}_advanceToNextRow(){return this._row++,this._rowIndex++,this._column=0,this._cellIndex=0,this._nextCellAtColumn=-1,this.next()}_isOverEndRow(){return this._endRow!==void 0&&this._row>this._endRow}_isOverEndColumn(){return this._endColumn!==void 0&&this._column>this._endColumn}_formatOutValue(e,t=this._row,o=this._column){return{done:!1,value:new gT(this,e,t,o)}}_shouldSkipSlot(){let e=this._skipRows.has(this._row),t=this._row<this._startRow,o=this._column<this._startColumn,i=this._endColumn!==void 0&&this._column>this._endColumn;return e||t||o||i}_getSpanned(){let e=this._spannedCells.get(this._row);return e&&e.get(this._column)||null}_recordSpans(e,t,o){let i={cell:e,row:this._row,column:this._column};for(let r=this._row;r<this._row+t;r++)for(let s=this._column;s<this._column+o;s++)r==this._row&&s==this._column||this._markSpannedCell(r,s,i)}_markSpannedCell(e,t,o){this._spannedCells.has(e)||this._spannedCells.set(e,new Map),this._spannedCells.get(e).set(t,o)}_canJumpToStartRow(){return!!this._startRow&&this._startRow>0&&!this._jumpedToStartRow}_jumpToNonSpannedRowClosestToStartRow(){let e=this._getRowLength(0);for(let t=this._startRow;!this._jumpedToStartRow;t--)e===this._getRowLength(t)&&(this._row=t,this._rowIndex=t,this._jumpedToStartRow=!0)}_getRowLength(e){return[...this._table.getChild(e).getChildren()].reduce(((t,o)=>t+parseInt(o.getAttribute("colspan")||"1")),0)}}class gT{constructor(e,t,o,i){this.cell=t,this.row=e._row,this.column=e._column,this.cellAnchorRow=o,this.cellAnchorColumn=i,this._cellIndex=e._cellIndex,this._rowIndex=e._rowIndex,this._table=e._table}get isAnchor(){return this.row===this.cellAnchorRow&&this.column===this.cellAnchorColumn}get cellWidth(){return parseInt(this.cell.getAttribute("colspan")||"1")}get cellHeight(){return parseInt(this.cell.getAttribute("rowspan")||"1")}get rowIndex(){return this._rowIndex}getPositionBefore(){return this._table.root.document.model.createPositionAt(this._table.getChild(this.row),this._cellIndex)}}function bb(n,e){return(t,{writer:o})=>{let i=t.getAttribute("headingRows")||0,r=o.createContainerElement("table",null,[]),s=o.createContainerElement("figure",{class:"table"},r);i>0&&o.insert(o.createPositionAt(r,"end"),o.createContainerElement("thead",null,o.createSlot((a=>a.is("element","tableRow")&&a.index<i)))),i<n.getRows(t)&&o.insert(o.createPositionAt(r,"end"),o.createContainerElement("tbody",null,o.createSlot((a=>a.is("element","tableRow")&&a.index>=i))));for(let{positionOffset:a,filter:l}of e.additionalSlots)o.insert(o.createPositionAt(r,a),o.createSlot(l));return o.insert(o.createPositionAt(r,"after"),o.createSlot((a=>!a.is("element","tableRow")&&!e.additionalSlots.some((({filter:l})=>l(a)))))),e.asWidget?(function(a,l){return l.setCustomProperty("table",!0,a),Hi(a,l,{hasSelectionHandle:!0})})(s,o):s}}function wb(n={}){return(e,{writer:t})=>{let o=e.parent,i=o.parent,r=i.getChildIndex(o),s=new Ae(i,{row:r}),a=i.getAttribute("headingRows")||0,l=i.getAttribute("headingColumns")||0,c=null;for(let d of s)if(d.cell==e){let u=d.row<a||d.column<l?"th":"td";c=n.asWidget?af(t.createEditableElement(u),t):t.createContainerElement(u);break}return c}}function _b(n={}){return(e,{writer:t})=>{if(!e.parent.is("element","tableCell")||!Ab(e))return null;if(n.asWidget)return t.createContainerElement("span",{class:"ck-table-bogus-paragraph"});{let o=t.createContainerElement("p");return t.setCustomProperty("dataPipeline:transparentRendering",!0,o),o}}}function Ab(n){return n.parent.childCount==1&&!!n.getAttributeKeys().next().done}class pT extends re{refresh(){let e=this.editor.model,t=e.document.selection,o=e.schema;this.isEnabled=(function(i,r){let s=i.getFirstPosition().parent,a=s===s.root?s:s.parent;return r.checkChild(a,"table")})(t,o)}execute(e={}){let t=this.editor,o=t.model,i=t.plugins.get("TableUtils"),r=t.config.get("table.defaultHeadings.rows"),s=t.config.get("table.defaultHeadings.columns");e.headingRows===void 0&&r&&(e.headingRows=r),e.headingColumns===void 0&&s&&(e.headingColumns=s),o.change((a=>{let l=i.createTable(a,e);o.insertObject(l,null,null,{findOptimalPosition:"auto"}),a.setSelection(a.createPositionAt(l.getNodeByPath([0,0,0]),0))}))}}class Cb extends re{constructor(e,t={}){super(e),this.order=t.order||"below"}refresh(){let e=this.editor.model.document.selection,t=!!this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e).length;this.isEnabled=t}execute(){let e=this.editor,t=e.model.document.selection,o=e.plugins.get("TableUtils"),i=this.order==="above",r=o.getSelectionAffectedTableCells(t),s=o.getRowIndexes(r),a=i?s.first:s.last,l=r[0].findAncestor("table");o.insertRows(l,{at:i?a:a+1,copyStructureFromAbove:!i})}}class vb extends re{constructor(e,t={}){super(e),this.order=t.order||"right"}refresh(){let e=this.editor.model.document.selection,t=!!this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e).length;this.isEnabled=t}execute(){let e=this.editor,t=e.model.document.selection,o=e.plugins.get("TableUtils"),i=this.order==="left",r=o.getSelectionAffectedTableCells(t),s=o.getColumnIndexes(r),a=i?s.first:s.last,l=r[0].findAncestor("table");o.insertColumns(l,{columns:1,at:i?a:a+1})}}class yb extends re{constructor(e,t={}){super(e),this.direction=t.direction||"horizontally"}refresh(){let e=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=e.length===1}execute(){let e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection)[0];this.direction==="horizontally"?e.splitCellHorizontally(t,2):e.splitCellVertically(t,2)}}function xb(n,e,t){let{startRow:o,startColumn:i,endRow:r,endColumn:s}=e,a=t.createElement("table"),l=r-o+1;for(let d=0;d<l;d++)t.insertElement("tableRow",a,"end");let c=[...new Ae(n,{startRow:o,endRow:r,startColumn:i,endColumn:s,includeAllSlots:!0})];for(let{row:d,column:u,cell:h,isAnchor:m,cellAnchorRow:g,cellAnchorColumn:b}of c){let w=d-o,A=a.getChild(w);if(m){let S=t.cloneElement(h);t.append(S,A),Ib(S,d,u,r,s,t)}else(g<o||b<i)&&ti(t,t.createPositionAt(A,"end"))}return(function(d,u,h,m,g){let b=parseInt(u.getAttribute("headingRows")||"0");b>0&&Re("headingRows",b-h,d,g,0);let w=parseInt(u.getAttribute("headingColumns")||"0");w>0&&Re("headingColumns",w-m,d,g,0)})(a,n,o,i,t),a}function Eb(n,e,t=0){let o=[],i=new Ae(n,{startRow:t,endRow:e-1});for(let r of i){let{row:s,cellHeight:a}=r;s<e&&e<=s+a-1&&o.push(r)}return o}function Db(n,e,t){let o=n.parent,i=o.parent,r=o.index,s=e-r,a={},l=parseInt(n.getAttribute("rowspan"))-s;l>1&&(a.rowspan=l);let c=parseInt(n.getAttribute("colspan")||"1");c>1&&(a.colspan=c);let d=r+s,u=[...new Ae(i,{startRow:r,endRow:d,includeAllSlots:!0})],h,m=null;for(let g of u){let{row:b,column:w,cell:A}=g;A===n&&h===void 0&&(h=w),h!==void 0&&h===w&&b===d&&(m=ti(t,g.getPositionBefore(),a))}return Re("rowspan",s,n,t),m}function Tb(n,e){let t=[],o=new Ae(n);for(let i of o){let{column:r,cellWidth:s}=i;r<e&&e<=r+s-1&&t.push(i)}return t}function Sb(n,e,t,o){let i=t-e,r={},s=parseInt(n.getAttribute("colspan"))-i;s>1&&(r.colspan=s);let a=parseInt(n.getAttribute("rowspan")||"1");a>1&&(r.rowspan=a);let l=ti(o,o.createPositionAfter(n),r);return Re("colspan",i,n,o),l}function Ib(n,e,t,o,i,r){let s=parseInt(n.getAttribute("colspan")||"1"),a=parseInt(n.getAttribute("rowspan")||"1");t+s-1>i&&Re("colspan",i-t+1,n,r,1),e+a-1>o&&Re("rowspan",o-e+1,n,r,1)}function Nc(n,e){let t=e.getColumns(n),o=new Array(t).fill(0);for(let{column:r}of new Ae(n))o[r]++;let i=o.reduce(((r,s,a)=>s?r:[...r,a]),[]);if(i.length>0){let r=i[i.length-1];return e.removeColumns(n,{at:r}),!0}return!1}function Pc(n,e){let t=[],o=e.getRows(n);for(let i=0;i<o;i++)n.getChild(i).isEmpty&&t.push(i);if(t.length>0){let i=t[t.length-1];return e.removeRows(n,{at:i}),!0}return!1}function Lc(n,e){Nc(n,e)||Pc(n,e)}function Bb(n,e){let t=Array.from(new Ae(n,{startColumn:e.firstColumn,endColumn:e.lastColumn,row:e.lastRow}));if(t.every((({cellHeight:i})=>i===1)))return e.lastRow;let o=t[0].cellHeight-1;return e.lastRow+o}function Mb(n,e){let t=Array.from(new Ae(n,{startRow:e.firstRow,endRow:e.lastRow,column:e.lastColumn}));if(t.every((({cellWidth:i})=>i===1)))return e.lastColumn;let o=t[0].cellWidth-1;return e.lastColumn+o}class Us extends re{constructor(e,t){super(e),this.direction=t.direction,this.isHorizontal=this.direction=="right"||this.direction=="left"}refresh(){let e=this._getMergeableCell();this.value=e,this.isEnabled=!!e}execute(){let e=this.editor.model,t=e.document,o=this.editor.plugins.get("TableUtils").getTableCellsContainingSelection(t.selection)[0],i=this.value,r=this.direction;e.change((s=>{let a=r=="right"||r=="down",l=a?o:i,c=a?i:o,d=c.parent;(function(b,w,A){Nb(b)||(Nb(w)&&A.remove(A.createRangeIn(w)),A.move(A.createRangeIn(b),A.createPositionAt(w,"end"))),A.remove(b)})(c,l,s);let u=this.isHorizontal?"colspan":"rowspan",h=parseInt(o.getAttribute(u)||"1"),m=parseInt(i.getAttribute(u)||"1");s.setAttribute(u,h+m,l),s.setSelection(s.createRangeIn(l));let g=this.editor.plugins.get("TableUtils");Lc(d.findAncestor("table"),g)}))}_getMergeableCell(){let e=this.editor.model.document,t=this.editor.plugins.get("TableUtils"),o=t.getTableCellsContainingSelection(e.selection)[0];if(!o)return;let i=this.isHorizontal?(function(a,l,c){let d=a.parent,u=d.parent,h=l=="right"?a.nextSibling:a.previousSibling,m=(u.getAttribute("headingColumns")||0)>0;if(!h)return;let g=l=="right"?a:h,b=l=="right"?h:a,{column:w}=c.getCellLocation(g),{column:A}=c.getCellLocation(b),S=parseInt(g.getAttribute("colspan")||"1"),M=Bc(c,g),F=Bc(c,b);if(!(m&&M!=F))return w+S===A?h:void 0})(o,this.direction,t):(function(a,l,c){let d=a.parent,u=d.parent,h=u.getChildIndex(d);if(l=="down"&&h===c.getRows(u)-1||l=="up"&&h===0)return null;let m=parseInt(a.getAttribute("rowspan")||"1"),g=u.getAttribute("headingRows")||0,b=l=="down"&&h+m===g,w=l=="up"&&h===g;if(g&&(b||w))return null;let A=parseInt(a.getAttribute("rowspan")||"1"),S=l=="down"?h+A:h,M=[...new Ae(u,{endRow:S})],F=M.find((ae=>ae.cell===a)),G=F.column,X=M.find((({row:ae,cellHeight:De,column:$e})=>$e===G&&(l=="down"?ae===S:S===ae+De)));return X&&X.cell?X.cell:null})(o,this.direction,t);if(!i)return;let r=this.isHorizontal?"rowspan":"colspan",s=parseInt(o.getAttribute(r)||"1");return parseInt(i.getAttribute(r)||"1")===s?i:void 0}}function Nb(n){let e=n.getChild(0);return n.childCount==1&&e.is("element","paragraph")&&e.isEmpty}class fT extends re{refresh(){let e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection),o=t[0];if(o){let i=o.findAncestor("table"),r=e.getRows(i)-1,s=e.getRowIndexes(t),a=s.first===0&&s.last===r;this.isEnabled=!a}else this.isEnabled=!1}execute(){let e=this.editor.model,t=this.editor.plugins.get("TableUtils"),o=t.getSelectionAffectedTableCells(e.document.selection),i=t.getRowIndexes(o),r=o[0],s=r.findAncestor("table"),a=t.getCellLocation(r).column;e.change((l=>{let c=i.last-i.first+1;t.removeRows(s,{at:i.first,rows:c});let d=(function(u,h,m,g){let b=u.getChild(Math.min(h,g-1)),w=b.getChild(0),A=0;for(let S of b.getChildren()){if(A>m)return w;w=S,A+=parseInt(S.getAttribute("colspan")||"1")}return w})(s,i.first,a,t.getRows(s));l.setSelection(l.createPositionAt(d,0))}))}}class kT extends re{refresh(){let e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection),o=t[0];if(o){let i=o.findAncestor("table"),r=e.getColumns(i),{first:s,last:a}=e.getColumnIndexes(t);this.isEnabled=a-s<r-1}else this.isEnabled=!1}execute(){let e=this.editor.plugins.get("TableUtils"),[t,o]=(function(l,c){let d=c.getSelectionAffectedTableCells(l),u=d[0],h=d.pop(),m=[u,h];return u.isBefore(h)?m:m.reverse()})(this.editor.model.document.selection,e),i=t.parent.parent,r=[...new Ae(i)],s={first:r.find((l=>l.cell===t)).column,last:r.find((l=>l.cell===o)).column},a=(function(l,c,d,u){return parseInt(d.getAttribute("colspan")||"1")>1?d:c.previousSibling||d.nextSibling?d.nextSibling||c.previousSibling:u.first?l.reverse().find((({column:h})=>h<u.first)).cell:l.reverse().find((({column:h})=>h>u.last)).cell})(r,t,o,s);this.editor.model.change((l=>{let c=s.last-s.first+1;e.removeColumns(i,{at:s.first,columns:c}),l.setSelection(l.createPositionAt(a,0))}))}}class bT extends re{refresh(){let e=this.editor.plugins.get("TableUtils"),t=this.editor.model,o=e.getSelectionAffectedTableCells(t.document.selection),i=o.length>0;this.isEnabled=i,this.value=i&&o.every((r=>this._isInHeading(r,r.parent.parent)))}execute(e={}){if(e.forceValue===this.value)return;let t=this.editor.plugins.get("TableUtils"),o=this.editor.model,i=t.getSelectionAffectedTableCells(o.document.selection),r=i[0].findAncestor("table"),{first:s,last:a}=t.getRowIndexes(i),l=this.value?s:a+1,c=r.getAttribute("headingRows")||0;o.change((d=>{if(l){let u=Eb(r,l,l>c?c:0);for(let{cell:h}of u)Db(h,l,d)}Re("headingRows",l,r,d,0)}))}_isInHeading(e,t){let o=parseInt(t.getAttribute("headingRows")||"0");return!!o&&e.parent.index<o}}class wT extends re{refresh(){let e=this.editor.model,t=this.editor.plugins.get("TableUtils"),o=t.getSelectionAffectedTableCells(e.document.selection),i=o.length>0;this.isEnabled=i,this.value=i&&o.every((r=>Bc(t,r)))}execute(e={}){if(e.forceValue===this.value)return;let t=this.editor.plugins.get("TableUtils"),o=this.editor.model,i=t.getSelectionAffectedTableCells(o.document.selection),r=i[0].findAncestor("table"),{first:s,last:a}=t.getColumnIndexes(i),l=this.value?s:a+1;o.change((c=>{if(l){let d=Tb(r,l);for(let{cell:u,column:h}of d)Sb(u,h,l,c)}Re("headingColumns",l,r,c,0)}))}}function _T(n){if(n.is("element","tableColumnGroup"))return n;let e=n.getChildren();return Array.from(e).find((t=>t.is("element","tableColumnGroup")))}function AT(n){let e=_T(n);return e?Array.from(e.getChildren()):[]}class nt extends L{static get pluginName(){return"TableUtils"}init(){this.decorate("insertColumns"),this.decorate("insertRows")}getCellLocation(e){let t=e.parent,o=t.parent,i=o.getChildIndex(t),r=new Ae(o,{row:i});for(let{cell:s,row:a,column:l}of r)if(s===e)return{row:a,column:l}}createTable(e,t){let o=e.createElement("table"),i=t.rows||2,r=t.columns||2;return zc(e,o,0,i,r),t.headingRows&&Re("headingRows",Math.min(t.headingRows,i),o,e,0),t.headingColumns&&Re("headingColumns",Math.min(t.headingColumns,r),o,e,0),o}insertRows(e,t={}){let o=this.editor.model,i=t.at||0,r=t.rows||1,s=t.copyStructureFromAbove!==void 0,a=t.copyStructureFromAbove?i-1:i,l=this.getRows(e),c=this.getColumns(e);if(i>l)throw new y("tableutils-insertrows-insert-out-of-range",this,{options:t});o.change((d=>{let u=e.getAttribute("headingRows")||0;if(u>i&&Re("headingRows",u+r,e,d,0),!s&&(i===0||i===l))return void zc(d,e,i,r,c);let h=s?Math.max(i,a):i,m=new Ae(e,{endRow:h}),g=new Array(c).fill(1);for(let{row:b,column:w,cellHeight:A,cellWidth:S,cell:M}of m){let F=b+A-1,G=b<=a&&a<=F;b<i&&i<=F?(d.setAttribute("rowspan",A+r,M),g[w]=-S):s&&G&&(g[w]=S)}for(let b=0;b<r;b++){let w=d.createElement("tableRow");d.insert(w,e,i);for(let A=0;A<g.length;A++){let S=g[A],M=d.createPositionAt(w,"end");S>0&&ti(d,M,S>1?{colspan:S}:void 0),A+=Math.abs(S)-1}}}))}insertColumns(e,t={}){let o=this.editor.model,i=t.at||0,r=t.columns||1;o.change((s=>{let a=e.getAttribute("headingColumns");i<a&&s.setAttribute("headingColumns",a+r,e);let l=this.getColumns(e);if(i===0||l===i){for(let d of e.getChildren())d.is("element","tableRow")&&qi(r,s,s.createPositionAt(d,i?"end":0));return}let c=new Ae(e,{column:i,includeAllSlots:!0});for(let d of c){let{row:u,cell:h,cellAnchorColumn:m,cellAnchorRow:g,cellWidth:b,cellHeight:w}=d;if(m<i){s.setAttribute("colspan",b+r,h);let A=g+w-1;for(let S=u;S<=A;S++)c.skipRow(S)}else qi(r,s,d.getPositionBefore())}}))}removeRows(e,t){let o=this.editor.model,i=t.rows||1,r=this.getRows(e),s=t.at,a=s+i-1;if(a>r-1)throw new y("tableutils-removerows-row-index-out-of-range",this,{table:e,options:t});o.change((l=>{let c={first:s,last:a},{cellsToMove:d,cellsToTrim:u}=(function(h,{first:m,last:g}){let b=new Map,w=[];for(let{row:A,column:S,cellHeight:M,cell:F}of new Ae(h,{endRow:g})){let G=A+M-1;if(A>=m&&A<=g&&G>g){let X=M-(g-A+1);b.set(S,{cell:F,rowspan:X})}if(A<m&&G>=m){let X;X=G>=g?g-m+1:G-m+1,w.push({cell:F,rowspan:M-X})}}return{cellsToMove:b,cellsToTrim:w}})(e,c);d.size&&(function(h,m,g,b){let w=new Ae(h,{includeAllSlots:!0,row:m}),A=[...w],S=h.getChild(m),M;for(let{column:F,cell:G,isAnchor:X}of A)if(g.has(F)){let{cell:ae,rowspan:De}=g.get(F),$e=M?b.createPositionAfter(M):b.createPositionAt(S,0);b.move(b.createRangeOn(ae),$e),Re("rowspan",De,ae,b),M=ae}else X&&(M=G)})(e,a+1,d,l);for(let h=a;h>=s;h--)l.remove(e.getChild(h));for(let{rowspan:h,cell:m}of u)Re("rowspan",h,m,l);(function(h,{first:m,last:g},b){let w=h.getAttribute("headingRows")||0;m<w&&Re("headingRows",g<w?w-(g-m+1):m,h,b,0)})(e,c,l),Nc(e,this)||Pc(e,this)}))}removeColumns(e,t){let o=this.editor.model,i=t.at,r=t.columns||1,s=t.at+r-1;o.change((a=>{(function(c,d,u){let h=c.getAttribute("headingColumns")||0;if(h&&d.first<h){let m=Math.min(h-1,d.last)-d.first+1;u.setAttribute("headingColumns",h-m,c)}})(e,{first:i,last:s},a);let l=AT(e);for(let c=s;c>=i;c--){for(let{cell:d,column:u,cellWidth:h}of[...new Ae(e)])u<=c&&h>1&&u+h>c?Re("colspan",h-1,d,a):u===c&&a.remove(d);if(l[c]){let d=c===0?l[1]:l[c-1],u=parseFloat(l[c].getAttribute("columnWidth")),h=parseFloat(d.getAttribute("columnWidth"));a.remove(l[c]),a.setAttribute("columnWidth",u+h+"%",d)}}Pc(e,this)||Nc(e,this)}))}splitCellVertically(e,t=2){let o=this.editor.model,i=e.parent.parent,r=parseInt(e.getAttribute("rowspan")||"1"),s=parseInt(e.getAttribute("colspan")||"1");o.change((a=>{if(s>1){let{newCellsSpan:l,updatedSpan:c}=Pb(s,t);Re("colspan",c,e,a);let d={};l>1&&(d.colspan=l),r>1&&(d.rowspan=r),qi(s>t?t-1:s-1,a,a.createPositionAfter(e),d)}if(s<t){let l=t-s,c=[...new Ae(i)],{column:d}=c.find((({cell:g})=>g===e)),u=c.filter((({cell:g,cellWidth:b,column:w})=>g!==e&&w===d||w<d&&w+b>d));for(let{cell:g,cellWidth:b}of u)a.setAttribute("colspan",b+l,g);let h={};r>1&&(h.rowspan=r),qi(l,a,a.createPositionAfter(e),h);let m=i.getAttribute("headingColumns")||0;m>d&&Re("headingColumns",m+l,i,a)}}))}splitCellHorizontally(e,t=2){let o=this.editor.model,i=e.parent,r=i.parent,s=r.getChildIndex(i),a=parseInt(e.getAttribute("rowspan")||"1"),l=parseInt(e.getAttribute("colspan")||"1");o.change((c=>{if(a>1){let d=[...new Ae(r,{startRow:s,endRow:s+a-1,includeAllSlots:!0})],{newCellsSpan:u,updatedSpan:h}=Pb(a,t);Re("rowspan",h,e,c);let{column:m}=d.find((({cell:b})=>b===e)),g={};u>1&&(g.rowspan=u),l>1&&(g.colspan=l);for(let b of d){let{column:w,row:A}=b;A>=s+h&&w===m&&(A+s+h)%u==0&&qi(1,c,b.getPositionBefore(),g)}}if(a<t){let d=t-a,u=[...new Ae(r,{startRow:0,endRow:s})];for(let{cell:g,cellHeight:b,row:w}of u)if(g!==e&&w+b>s){let A=b+d;c.setAttribute("rowspan",A,g)}let h={};l>1&&(h.colspan=l),zc(c,r,s+1,d,1,h);let m=r.getAttribute("headingRows")||0;m>s&&Re("headingRows",m+d,r,c)}}))}getColumns(e){return[...e.getChild(0).getChildren()].filter((t=>t.is("element","tableCell"))).reduce(((t,o)=>t+parseInt(o.getAttribute("colspan")||"1")),0)}getRows(e){return Array.from(e.getChildren()).reduce(((t,o)=>o.is("element","tableRow")?t+1:t),0)}createTableWalker(e,t={}){return new Ae(e,t)}getSelectedTableCells(e){let t=[];for(let o of this.sortRanges(e.getRanges())){let i=o.getContainedElement();i&&i.is("element","tableCell")&&t.push(i)}return t}getTableCellsContainingSelection(e){let t=[];for(let o of e.getRanges()){let i=o.start.findAncestor("tableCell");i&&t.push(i)}return t}getSelectionAffectedTableCells(e){let t=this.getSelectedTableCells(e);return t.length?t:this.getTableCellsContainingSelection(e)}getRowIndexes(e){let t=e.map((o=>o.parent.index));return this._getFirstLastIndexesObject(t)}getColumnIndexes(e){let t=e[0].findAncestor("table"),o=[...new Ae(t)].filter((i=>e.includes(i.cell))).map((i=>i.column));return this._getFirstLastIndexesObject(o)}isSelectionRectangular(e){if(e.length<2||!this._areCellInTheSameTableSection(e))return!1;let t=new Set,o=new Set,i=0;for(let r of e){let{row:s,column:a}=this.getCellLocation(r),l=parseInt(r.getAttribute("rowspan"))||1,c=parseInt(r.getAttribute("colspan"))||1;t.add(s),o.add(a),l>1&&t.add(s+l-1),c>1&&o.add(a+c-1),i+=l*c}return(function(r,s){let a=Array.from(r.values()),l=Array.from(s.values()),c=Math.max(...a),d=Math.min(...a),u=Math.max(...l),h=Math.min(...l);return(c-d+1)*(u-h+1)})(t,o)==i}sortRanges(e){return Array.from(e).sort(CT)}_getFirstLastIndexesObject(e){let t=e.sort(((o,i)=>o-i));return{first:t[0],last:t[t.length-1]}}_areCellInTheSameTableSection(e){let t=e[0].findAncestor("table"),o=this.getRowIndexes(e),i=parseInt(t.getAttribute("headingRows"))||0;if(!this._areIndexesInSameSection(o,i))return!1;let r=this.getColumnIndexes(e),s=parseInt(t.getAttribute("headingColumns"))||0;return this._areIndexesInSameSection(r,s)}_areIndexesInSameSection({first:e,last:t},o){return e<o==t<o}}function zc(n,e,t,o,i,r={}){for(let s=0;s<o;s++){let a=n.createElement("tableRow");n.insert(a,e,t),qi(i,n,n.createPositionAt(a,"end"),r)}}function qi(n,e,t,o={}){for(let i=0;i<n;i++)ti(e,t,o)}function Pb(n,e){if(n<e)return{newCellsSpan:1,updatedSpan:1};let t=Math.floor(n/e);return{newCellsSpan:t,updatedSpan:n-t*e+t}}function CT(n,e){let t=n.start,o=e.start;return t.isBefore(o)?-1:1}class vT extends re{refresh(){let e=this.editor.plugins.get(nt),t=e.getSelectedTableCells(this.editor.model.document.selection);this.isEnabled=e.isSelectionRectangular(t)}execute(){let e=this.editor.model,t=this.editor.plugins.get(nt);e.change((o=>{let i=t.getSelectedTableCells(e.document.selection),r=i.shift(),{mergeWidth:s,mergeHeight:a}=(function(l,c,d){let u=0,h=0;for(let A of c){let{row:S,column:M}=d.getCellLocation(A);u=zb(A,M,u,"colspan"),h=zb(A,S,h,"rowspan")}let{row:m,column:g}=d.getCellLocation(l),b=u-g,w=h-m;return{mergeWidth:b,mergeHeight:w}})(r,i,t);Re("colspan",s,r,o),Re("rowspan",a,r,o);for(let l of i)yT(l,r,o);Lc(r.findAncestor("table"),t),o.setSelection(r,"in")}))}}function yT(n,e,t){Lb(n)||(Lb(e)&&t.remove(t.createRangeIn(e)),t.move(t.createRangeIn(n),t.createPositionAt(e,"end"))),t.remove(n)}function Lb(n){let e=n.getChild(0);return n.childCount==1&&e.is("element","paragraph")&&e.isEmpty}function zb(n,e,t,o){let i=parseInt(n.getAttribute(o)||"1");return Math.max(t,e+i)}class xT extends re{constructor(e){super(e),this.affectsData=!1}refresh(){let e=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=e.length>0}execute(){let e=this.editor.model,t=this.editor.plugins.get("TableUtils"),o=t.getSelectionAffectedTableCells(e.document.selection),i=t.getRowIndexes(o),r=o[0].findAncestor("table"),s=[];for(let a=i.first;a<=i.last;a++)for(let l of r.getChild(a).getChildren())s.push(e.createRangeOn(l));e.change((a=>{a.setSelection(s)}))}}class ET extends re{constructor(e){super(e),this.affectsData=!1}refresh(){let e=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=e.length>0}execute(){let e=this.editor.plugins.get("TableUtils"),t=this.editor.model,o=e.getSelectionAffectedTableCells(t.document.selection),i=o[0],r=o.pop(),s=i.findAncestor("table"),a=e.getCellLocation(i),l=e.getCellLocation(r),c=Math.min(a.column,l.column),d=Math.max(a.column,l.column),u=[];for(let h of new Ae(s,{startColumn:c,endColumn:d}))u.push(t.createRangeOn(h.cell));t.change((h=>{h.setSelection(u)}))}}function DT(n){n.document.registerPostFixer((e=>(function(t,o){let i=o.document.differ.getChanges(),r=!1,s=new Set;for(let a of i){let l=null;a.type=="insert"&&a.name=="table"&&(l=a.position.nodeAfter),a.type!="insert"&&a.type!="remove"||a.name!="tableRow"&&a.name!="tableCell"||(l=a.position.findAncestor("table")),IT(a)&&(l=a.range.start.findAncestor("table")),l&&!s.has(l)&&(r=TT(l,t)||r,r=ST(l,t)||r,s.add(l))}return r})(e,n)))}function TT(n,e){let t=!1,o=(function(i){let r=parseInt(i.getAttribute("headingRows")||"0"),s=Array.from(i.getChildren()).reduce(((l,c)=>c.is("element","tableRow")?l+1:l),0),a=[];for(let{row:l,cell:c,cellHeight:d}of new Ae(i)){if(d<2)continue;let u=l<r?r:s;if(l+d>u){let h=u-l;a.push({cell:c,rowspan:h})}}return a})(n);if(o.length){t=!0;for(let i of o)Re("rowspan",i.rowspan,i.cell,e,1)}return t}function ST(n,e){let t=!1,o=(function(a){let l=new Array(a.childCount).fill(0);for(let{rowIndex:c}of new Ae(a,{includeAllSlots:!0}))l[c]++;return l})(n),i=[];for(let[a,l]of o.entries())!l&&n.getChild(a).is("element","tableRow")&&i.push(a);if(i.length){t=!0;for(let a of i.reverse())e.remove(n.getChild(a)),o.splice(a,1)}let r=o.filter(((a,l)=>n.getChild(l).is("element","tableRow"))),s=r[0];if(!r.every((a=>a===s))){let a=r.reduce(((l,c)=>c>l?c:l),0);for(let[l,c]of r.entries()){let d=a-c;if(d){for(let u=0;u<d;u++)ti(e,e.createPositionAt(n.getChild(l),"end"));t=!0}}}return t}function IT(n){if(n.type!=="attribute")return!1;let e=n.attributeKey;return e==="headingRows"||e==="colspan"||e==="rowspan"}function BT(n){n.document.registerPostFixer((e=>(function(t,o){let i=o.document.differ.getChanges(),r=!1;for(let s of i)s.type=="insert"&&s.name=="table"&&(r=MT(s.position.nodeAfter,t)||r),s.type=="insert"&&s.name=="tableRow"&&(r=Ob(s.position.nodeAfter,t)||r),s.type=="insert"&&s.name=="tableCell"&&(r=Oc(s.position.nodeAfter,t)||r),s.type!="remove"&&s.type!="insert"||!NT(s)||(r=Oc(s.position.parent,t)||r);return r})(e,n)))}function MT(n,e){let t=!1;for(let o of n.getChildren())o.is("element","tableRow")&&(t=Ob(o,e)||t);return t}function Ob(n,e){let t=!1;for(let o of n.getChildren())t=Oc(o,e)||t;return t}function Oc(n,e){if(n.childCount==0)return e.insertElement("paragraph",n),!0;let t=Array.from(n.getChildren()).filter((o=>o.is("$text")));for(let o of t)e.wrap(e.createRangeOn(o),"paragraph");return!!t.length}function NT(n){return!!n.position.parent.is("element","tableCell")&&(n.type=="insert"&&n.name=="$text"||n.type=="remove")}function PT(n,e){if(!n.is("element","paragraph"))return!1;let t=e.toViewElement(n);return!!t&&Ab(n)!==t.is("element","span")}var Rb=z(4777),LT={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(Rb.Z,LT),Rb.Z.locals;class $s extends L{static get pluginName(){return"TableEditing"}static get requires(){return[nt]}constructor(e){super(e),this._additionalSlots=[]}init(){let e=this.editor,t=e.model,o=t.schema,i=e.conversion,r=e.plugins.get(nt);o.register("table",{inheritAllFrom:"$blockObject",allowAttributes:["headingRows","headingColumns"]}),o.register("tableRow",{allowIn:"table",isLimit:!0}),o.register("tableCell",{allowContentOf:"$container",allowIn:"tableRow",allowAttributes:["colspan","rowspan"],isLimit:!0,isSelectable:!0}),i.for("upcast").add((s=>{s.on("element:figure",((a,l,c)=>{if(!c.consumable.test(l.viewItem,{name:!0,classes:"table"}))return;let d=(function(h){for(let m of h.getChildren())if(m.is("element","table"))return m})(l.viewItem);if(!d||!c.consumable.test(d,{name:!0}))return;c.consumable.consume(l.viewItem,{name:!0,classes:"table"});let u=Be(c.convertItem(d,l.modelCursor).modelRange.getItems());u?(c.convertChildren(l.viewItem,c.writer.createPositionAt(u,"end")),c.updateConversionResult(u,l)):c.consumable.revert(l.viewItem,{name:!0,classes:"table"})}))})),i.for("upcast").add(hT()),i.for("editingDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:bb(r,{asWidget:!0,additionalSlots:this._additionalSlots})}),i.for("dataDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:bb(r,{additionalSlots:this._additionalSlots})}),i.for("upcast").elementToElement({model:"tableRow",view:"tr"}),i.for("upcast").add((s=>{s.on("element:tr",((a,l)=>{l.viewItem.isEmpty&&l.modelCursor.index==0&&a.stop()}),{priority:"high"})})),i.for("downcast").elementToElement({model:"tableRow",view:(s,{writer:a})=>s.isEmpty?a.createEmptyElement("tr"):a.createContainerElement("tr")}),i.for("upcast").elementToElement({model:"tableCell",view:"td"}),i.for("upcast").elementToElement({model:"tableCell",view:"th"}),i.for("upcast").add(kb("td")),i.for("upcast").add(kb("th")),i.for("editingDowncast").elementToElement({model:"tableCell",view:wb({asWidget:!0})}),i.for("dataDowncast").elementToElement({model:"tableCell",view:wb()}),i.for("editingDowncast").elementToElement({model:"paragraph",view:_b({asWidget:!0}),converterPriority:"high"}),i.for("dataDowncast").elementToElement({model:"paragraph",view:_b(),converterPriority:"high"}),i.for("downcast").attributeToAttribute({model:"colspan",view:"colspan"}),i.for("upcast").attributeToAttribute({model:{key:"colspan",value:Fb("colspan")},view:"colspan"}),i.for("downcast").attributeToAttribute({model:"rowspan",view:"rowspan"}),i.for("upcast").attributeToAttribute({model:{key:"rowspan",value:Fb("rowspan")},view:"rowspan"}),e.config.define("table.defaultHeadings.rows",0),e.config.define("table.defaultHeadings.columns",0),e.commands.add("insertTable",new pT(e)),e.commands.add("insertTableRowAbove",new Cb(e,{order:"above"})),e.commands.add("insertTableRowBelow",new Cb(e,{order:"below"})),e.commands.add("insertTableColumnLeft",new vb(e,{order:"left"})),e.commands.add("insertTableColumnRight",new vb(e,{order:"right"})),e.commands.add("removeTableRow",new fT(e)),e.commands.add("removeTableColumn",new kT(e)),e.commands.add("splitTableCellVertically",new yb(e,{direction:"vertically"})),e.commands.add("splitTableCellHorizontally",new yb(e,{direction:"horizontally"})),e.commands.add("mergeTableCells",new vT(e)),e.commands.add("mergeTableCellRight",new Us(e,{direction:"right"})),e.commands.add("mergeTableCellLeft",new Us(e,{direction:"left"})),e.commands.add("mergeTableCellDown",new Us(e,{direction:"down"})),e.commands.add("mergeTableCellUp",new Us(e,{direction:"up"})),e.commands.add("setTableColumnHeader",new wT(e)),e.commands.add("setTableRowHeader",new bT(e)),e.commands.add("selectTableRow",new xT(e)),e.commands.add("selectTableColumn",new ET(e)),DT(t),BT(t),this.listenTo(t.document,"change:data",(()=>{(function(s,a){let l=s.document.differ;for(let c of l.getChanges()){let d,u=!1;if(c.type=="attribute"){let b=c.range.start.nodeAfter;if(!b||!b.is("element","table")||c.attributeKey!="headingRows"&&c.attributeKey!="headingColumns")continue;d=b,u=c.attributeKey=="headingRows"}else c.name!="tableRow"&&c.name!="tableCell"||(d=c.position.findAncestor("table"),u=c.name=="tableRow");if(!d)continue;let h=d.getAttribute("headingRows")||0,m=d.getAttribute("headingColumns")||0,g=new Ae(d);for(let b of g){let w=b.row<h||b.column<m?"th":"td",A=a.mapper.toViewElement(b.cell);A&&A.is("element")&&A.name!=w&&a.reconvertItem(u?b.cell.parent:b.cell)}}})(t,e.editing),(function(s,a){let l=s.document.differ,c=new Set;for(let d of l.getChanges()){let u=d.type=="attribute"?d.range.start.parent:d.position.parent;u.is("element","tableCell")&&c.add(u)}for(let d of c.values()){let u=Array.from(d.getChildren()).filter((h=>PT(h,a.mapper)));for(let h of u)a.reconvertItem(h)}})(t,e.editing)}))}registerAdditionalSlot(e){this._additionalSlots.push(e)}}function Fb(n){return e=>{let t=parseInt(e.getAttribute(n));return Number.isNaN(t)||t<=0?null:t}}var Vb=z(7284),zT={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(Vb.Z,zT),Vb.Z.locals;class jb extends K{constructor(e){super(e);let t=this.bindTemplate;this.items=this._createGridCollection(),this.keystrokes=new Ve,this.focusTracker=new Me,this.set("rows",0),this.set("columns",0),this.bind("label").to(this,"columns",this,"rows",((o,i)=>`${i} \xD7 ${o}`)),this.setTemplate({tag:"div",attributes:{class:["ck"]},children:[{tag:"div",attributes:{class:["ck-insert-table-dropdown__grid"]},on:{"mouseover@.ck-insert-table-dropdown-grid-box":t.to("boxover")},children:this.items},{tag:"div",attributes:{class:["ck","ck-insert-table-dropdown__label"],"aria-hidden":!0},children:[{text:t.to("label")}]}],on:{mousedown:t.to((o=>{o.preventDefault()})),click:t.to((()=>{this.fire("execute")}))}}),this.on("boxover",((o,i)=>{let{row:r,column:s}=i.target.dataset;this.items.get(10*(parseInt(r,10)-1)+(parseInt(s,10)-1)).focus()})),this.focusTracker.on("change:focusedElement",((o,i,r)=>{if(!r)return;let{row:s,column:a}=r.dataset;this.set({rows:parseInt(s),columns:parseInt(a)})})),this.on("change:columns",(()=>this._highlightGridBoxes())),this.on("change:rows",(()=>this._highlightGridBoxes()))}render(){super.render(),x({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.items,numberOfColumns:10,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection});for(let e of this.items)this.focusTracker.add(e.element);this.keystrokes.listenTo(this.element)}reset(){this.set({rows:1,columns:1})}focus(){this.items.get(0).focus()}focusLast(){this.items.get(0).focus()}_highlightGridBoxes(){let e=this.rows,t=this.columns;this.items.map(((o,i)=>{let r=Math.floor(i/10)<e&&i%10<t;o.set("isOn",r)}))}_createGridButton(e,t,o,i){let r=new ne(e);return r.set({label:i,class:"ck-insert-table-dropdown-grid-box"}),r.extendTemplate({attributes:{"data-row":t,"data-column":o}}),r}_createGridCollection(){let e=[];for(let t=0;t<100;t++){let o=Math.floor(t/10),i=t%10,r=`${o+1} \xD7 ${i+1}`;e.push(this._createGridButton(this.locale,o+1,i+1,r))}return this.createCollection(e)}}class OT extends L{static get pluginName(){return"TableUI"}init(){let e=this.editor,t=this.editor.t,o=e.locale.contentLanguageDirection==="ltr";e.ui.componentFactory.add("insertTable",(i=>{let r=e.commands.get("insertTable"),s=ot(i),a;return s.bind("isEnabled").to(r),s.buttonView.set({icon:Y.table,label:t("Insert table"),tooltip:!0}),s.on("change:isOpen",(()=>{a||(a=new jb(i),s.panelView.children.add(a),a.delegate("execute").to(s),s.on("execute",(()=>{e.execute("insertTable",{rows:a.rows,columns:a.columns}),e.editing.view.focus()})))})),s})),e.ui.componentFactory.add("menuBar:insertTable",(i=>{let r=e.commands.get("insertTable"),s=new eo(i),a=new jb(i);return a.delegate("execute").to(s),s.on("change:isOpen",((l,c,d)=>{d||a.reset()})),a.on("execute",(()=>{e.execute("insertTable",{rows:a.rows,columns:a.columns}),e.editing.view.focus()})),s.buttonView.set({label:t("Table"),icon:Y.table}),s.panelView.children.add(a),s.bind("isEnabled").to(r),s})),e.ui.componentFactory.add("tableColumn",(i=>{let r=[{type:"switchbutton",model:{commandName:"setTableColumnHeader",label:t("Header column"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:o?"insertTableColumnLeft":"insertTableColumnRight",label:t("Insert column left")}},{type:"button",model:{commandName:o?"insertTableColumnRight":"insertTableColumnLeft",label:t("Insert column right")}},{type:"button",model:{commandName:"removeTableColumn",label:t("Delete column")}},{type:"button",model:{commandName:"selectTableColumn",label:t("Select column")}}];return this._prepareDropdown(t("Column"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M18 7v1H2V7h16zm0 5v1H2v-1h16z" opacity=".6"/><path d="M14 1v18a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V1a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1zm-2 1H8v4h4V2zm0 6H8v4h4V8zm0 6H8v4h4v-4z"/></svg>',r,i)})),e.ui.componentFactory.add("tableRow",(i=>{let r=[{type:"switchbutton",model:{commandName:"setTableRowHeader",label:t("Header row"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:"insertTableRowAbove",label:t("Insert row above")}},{type:"button",model:{commandName:"insertTableRowBelow",label:t("Insert row below")}},{type:"button",model:{commandName:"removeTableRow",label:t("Delete row")}},{type:"button",model:{commandName:"selectTableRow",label:t("Select row")}}];return this._prepareDropdown(t("Row"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M7 2h1v16H7V2zm5 0h1v16h-1V2z" opacity=".6"/><path d="M1 6h18a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H1a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1zm1 2v4h4V8H2zm6 0v4h4V8H8zm6 0v4h4V8h-4z"/></svg>',r,i)})),e.ui.componentFactory.add("mergeTableCells",(i=>{let r=[{type:"button",model:{commandName:"mergeTableCellUp",label:t("Merge cell up")}},{type:"button",model:{commandName:o?"mergeTableCellRight":"mergeTableCellLeft",label:t("Merge cell right")}},{type:"button",model:{commandName:"mergeTableCellDown",label:t("Merge cell down")}},{type:"button",model:{commandName:o?"mergeTableCellLeft":"mergeTableCellRight",label:t("Merge cell left")}},{type:"separator"},{type:"button",model:{commandName:"splitTableCellVertically",label:t("Split cell vertically")}},{type:"button",model:{commandName:"splitTableCellHorizontally",label:t("Split cell horizontally")}}];return this._prepareMergeSplitButtonDropdown(t("Merge cells"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M7 2h1v16H7V2zm5 0h1v7h-1V2zm6 5v1H2V7h16zM8 12v1H2v-1h6z" opacity=".6"/><path d="M7 7h12a1 1 0 0 1 1 1v11a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1zm1 2v9h10V9H8z"/></svg>',r,i)}))}_prepareDropdown(e,t,o,i){let r=this.editor,s=ot(i),a=this._fillDropdownWithListOptions(s,o);return s.buttonView.set({label:e,icon:t,tooltip:!0}),s.bind("isEnabled").toMany(a,"isEnabled",((...l)=>l.some((c=>c)))),this.listenTo(s,"execute",(l=>{r.execute(l.source.commandName),l.source instanceof rs||r.editing.view.focus()})),s}_prepareMergeSplitButtonDropdown(e,t,o,i){let r=this.editor,s=ot(i,Fn),a="mergeTableCells",l=r.commands.get(a),c=this._fillDropdownWithListOptions(s,o);return s.buttonView.set({label:e,icon:t,tooltip:!0,isEnabled:!0}),s.bind("isEnabled").toMany([l,...c],"isEnabled",((...d)=>d.some((u=>u)))),this.listenTo(s.buttonView,"execute",(()=>{r.execute(a),r.editing.view.focus()})),this.listenTo(s,"execute",(d=>{r.execute(d.source.commandName),r.editing.view.focus()})),s}_fillDropdownWithListOptions(e,t){let o=this.editor,i=[],r=new Je;for(let s of t)RT(s,o,i,r);return vo(e,r),i}}function RT(n,e,t,o){if(n.type==="button"||n.type==="switchbutton"){let i=n.model=new Wo(n.model),{commandName:r,bindIsOn:s}=n.model,a=e.commands.get(r);t.push(a),i.set({commandName:r}),i.bind("isEnabled").to(a),s&&i.bind("isOn").to(a,"value"),i.set({withText:!0})}o.add(n)}var Hb=z(5593),FT={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(Hb.Z,FT),Hb.Z.locals;class oi extends L{static get pluginName(){return"TableSelection"}static get requires(){return[nt,nt]}init(){let e=this.editor,t=e.model,o=e.editing.view;this.listenTo(t,"deleteContent",((i,r)=>this._handleDeleteContent(i,r)),{priority:"high"}),this.listenTo(o.document,"insertText",((i,r)=>this._handleInsertTextEvent(i,r)),{priority:"high"}),this._defineSelectionConverter(),this._enablePluginDisabling()}getSelectedTableCells(){let e=this.editor.plugins.get(nt),t=this.editor.model.document.selection,o=e.getSelectedTableCells(t);return o.length==0?null:o}getSelectionAsFragment(){let e=this.editor.plugins.get(nt),t=this.getSelectedTableCells();return t?this.editor.model.change((o=>{let i=o.createDocumentFragment(),{first:r,last:s}=e.getColumnIndexes(t),{first:a,last:l}=e.getRowIndexes(t),c=t[0].findAncestor("table"),d=l,u=s;if(e.isSelectionRectangular(t)){let m={firstColumn:r,lastColumn:s,firstRow:a,lastRow:l};d=Bb(c,m),u=Mb(c,m)}let h=xb(c,{startRow:a,startColumn:r,endRow:d,endColumn:u},o);return o.insert(h,i,0),i})):null}setCellSelection(e,t){let o=this._getCellsToSelect(e,t);this.editor.model.change((i=>{i.setSelection(o.cells.map((r=>i.createRangeOn(r))),{backward:o.backward})}))}getFocusCell(){let e=[...this.editor.model.document.selection.getRanges()].pop().getContainedElement();return e&&e.is("element","tableCell")?e:null}getAnchorCell(){let e=Be(this.editor.model.document.selection.getRanges()).getContainedElement();return e&&e.is("element","tableCell")?e:null}_defineSelectionConverter(){let e=this.editor,t=new Set;e.conversion.for("editingDowncast").add((o=>o.on("selection",((i,r,s)=>{let a=s.writer;(function(d){for(let u of t)d.removeClass("ck-editor__editable_selected",u);t.clear()})(a);let l=this.getSelectedTableCells();if(!l)return;for(let d of l){let u=s.mapper.toViewElement(d);a.addClass("ck-editor__editable_selected",u),t.add(u)}let c=s.mapper.toViewElement(l[l.length-1]);a.setSelection(c,0)}),{priority:"lowest"})))}_enablePluginDisabling(){let e=this.editor;this.on("change:isEnabled",(()=>{if(!this.isEnabled){let t=this.getSelectedTableCells();if(!t)return;e.model.change((o=>{let i=o.createPositionAt(t[0],0),r=e.model.schema.getNearestSelectionRange(i);o.setSelection(r)}))}}))}_handleDeleteContent(e,t){let o=this.editor.plugins.get(nt),i=t[0],r=t[1],s=this.editor.model,a=!r||r.direction=="backward",l=o.getSelectedTableCells(i);l.length&&(e.stop(),s.change((c=>{let d=l[a?l.length-1:0];s.change((h=>{for(let m of l)s.deleteContent(h.createSelection(m,"in"))}));let u=s.schema.getNearestSelectionRange(c.createPositionAt(d,0));i.is("documentSelection")?c.setSelection(u):i.setTo(u)})))}_handleInsertTextEvent(e,t){let o=this.editor,i=this.getSelectedTableCells();if(!i)return;let r=o.editing.view,s=o.editing.mapper,a=i.map((l=>r.createRangeOn(s.toViewElement(l))));t.selection=r.createSelection(a)}_getCellsToSelect(e,t){let o=this.editor.plugins.get("TableUtils"),i=o.getCellLocation(e),r=o.getCellLocation(t),s=Math.min(i.row,r.row),a=Math.max(i.row,r.row),l=Math.min(i.column,r.column),c=Math.max(i.column,r.column),d=new Array(a-s+1).fill(null).map((()=>[])),u={startRow:s,endRow:a,startColumn:l,endColumn:c};for(let{row:g,cell:b}of new Ae(e.findAncestor("table"),u))d[g-s].push(b);let h=r.row<i.row,m=r.column<i.column;return h&&d.reverse(),m&&d.forEach((g=>g.reverse())),{cells:d.flat(),backward:h||m}}}class VT extends L{static get pluginName(){return"TableClipboard"}static get requires(){return[Qn,Lt,oi,nt]}init(){let e=this.editor,t=e.editing.view.document;this.listenTo(t,"copy",((o,i)=>this._onCopyCut(o,i))),this.listenTo(t,"cut",((o,i)=>this._onCopyCut(o,i))),this.listenTo(e.model,"insertContent",((o,[i,r])=>this._onInsertContent(o,i,r)),{priority:"high"}),this.decorate("_replaceTableSlotCell")}_onCopyCut(e,t){let o=this.editor.editing.view,i=this.editor.plugins.get(oi),r=this.editor.plugins.get(Qn);i.getSelectedTableCells()&&(e.name!="cut"||this.editor.model.canEditAt(this.editor.model.document.selection))&&(t.preventDefault(),e.stop(),this.editor.model.enqueueChange({isUndoable:e.name==="cut"},(()=>{let s=r._copySelectedFragmentWithMarkers(e.name,this.editor.model.document.selection,(()=>i.getSelectionAsFragment()));o.document.fire("clipboardOutput",{dataTransfer:t.dataTransfer,content:this.editor.data.toView(s),method:e.name})})))}_onInsertContent(e,t,o){if(o&&!o.is("documentSelection"))return;let i=this.editor.model,r=this.editor.plugins.get(nt),s=this.editor.plugins.get(Qn),a=this.getTableIfOnlyTableInContent(t,i);if(!a)return;let l=r.getSelectionAffectedTableCells(i.document.selection);l.length?(e.stop(),t.is("documentFragment")?s._pasteMarkersIntoTransformedElement(t.markers,(c=>this._replaceSelectedCells(a,l,c))):this.editor.model.change((c=>{this._replaceSelectedCells(a,l,c)}))):Lc(a,r)}_replaceSelectedCells(e,t,o){let i=this.editor.plugins.get(nt),r={width:i.getColumns(e),height:i.getRows(e)},s=(function(u,h,m,g){let b=u[0].findAncestor("table"),w=g.getColumnIndexes(u),A=g.getRowIndexes(u),S={firstColumn:w.first,lastColumn:w.last,firstRow:A.first,lastRow:A.last},M=u.length===1;return M&&(S.lastRow+=h.height-1,S.lastColumn+=h.width-1,(function(F,G,X,ae){let De=ae.getColumns(F),$e=ae.getRows(F);X>De&&ae.insertColumns(F,{at:De,columns:X-De}),G>$e&&ae.insertRows(F,{at:$e,rows:G-$e})})(b,S.lastRow+1,S.lastColumn+1,g)),M||!g.isSelectionRectangular(u)?(function(F,G,X){let{firstRow:ae,lastRow:De,firstColumn:$e,lastColumn:e_}=G,t_={first:ae,last:De},o_={first:$e,last:e_};Fc(F,$e,t_,X),Fc(F,e_+1,t_,X),Rc(F,ae,o_,X),Rc(F,De+1,o_,X,ae)})(b,S,m):(S.lastRow=Bb(b,S),S.lastColumn=Mb(b,S)),S})(t,r,o,i),a=s.lastRow-s.firstRow+1,l=s.lastColumn-s.firstColumn+1;e=xb(e,{startRow:0,startColumn:0,endRow:Math.min(a,r.height)-1,endColumn:Math.min(l,r.width)-1},o);let c=t[0].findAncestor("table"),d=this._replaceSelectedCellsWithPasted(e,r,c,s,o);if(this.editor.plugins.get("TableSelection").isEnabled){let u=i.sortRanges(d.map((h=>o.createRangeOn(h))));o.setSelection(u)}else o.setSelection(d[0],0);return c}_replaceSelectedCellsWithPasted(e,t,o,i,r){let{width:s,height:a}=t,l=(function(w,A,S){let M=new Array(S).fill(null).map((()=>new Array(A).fill(null)));for(let{column:F,row:G,cell:X}of new Ae(w))M[G][F]=X;return M})(e,s,a),c=[...new Ae(o,{startRow:i.firstRow,endRow:i.lastRow,startColumn:i.firstColumn,endColumn:i.lastColumn,includeAllSlots:!0})],d=[],u;for(let w of c){let{row:A,column:S}=w;S===i.firstColumn&&(u=w.getPositionBefore());let M=A-i.firstRow,F=S-i.firstColumn,G=l[M%a][F%s],X=G?r.cloneElement(G):null,ae=this._replaceTableSlotCell(w,X,u,r);ae&&(Ib(ae,A,S,i.lastRow,i.lastColumn,r),d.push(ae),u=r.createPositionAfter(ae))}let h=parseInt(o.getAttribute("headingRows")||"0"),m=parseInt(o.getAttribute("headingColumns")||"0"),g=i.firstRow<h&&h<=i.lastRow,b=i.firstColumn<m&&m<=i.lastColumn;if(g){let w=Rc(o,h,{first:i.firstColumn,last:i.lastColumn},r,i.firstRow);d.push(...w)}if(b){let w=Fc(o,m,{first:i.firstRow,last:i.lastRow},r);d.push(...w)}return d}_replaceTableSlotCell(e,t,o,i){let{cell:r,isAnchor:s}=e;return s&&i.remove(r),t?(i.insert(t,o),t):null}getTableIfOnlyTableInContent(e,t){if(!e.is("documentFragment")&&!e.is("element"))return null;if(e.is("element","table"))return e;if(e.childCount==1&&e.getChild(0).is("element","table"))return e.getChild(0);let o=t.createRangeIn(e);for(let i of o.getItems())if(i.is("element","table")){let r=t.createRange(o.start,t.createPositionBefore(i));if(t.hasContent(r,{ignoreWhitespaces:!0}))return null;let s=t.createRange(t.createPositionAfter(i),o.end);return t.hasContent(s,{ignoreWhitespaces:!0})?null:i}return null}}function Rc(n,e,t,o,i=0){if(!(e<1))return Eb(n,e,i).filter((({column:r,cellWidth:s})=>Ub(r,s,t))).map((({cell:r})=>Db(r,e,o)))}function Fc(n,e,t,o){if(!(e<1))return Tb(n,e).filter((({row:i,cellHeight:r})=>Ub(i,r,t))).map((({cell:i,column:r})=>Sb(i,r,e,o)))}function Ub(n,e,t){let o=n+e-1,{first:i,last:r}=t;return n>=i&&n<=r||n<i&&o>=i}class jT extends L{static get pluginName(){return"TableKeyboard"}static get requires(){return[oi,nt]}init(){let e=this.editor,t=e.editing.view.document,o=e.t;this.listenTo(t,"arrowKey",((...i)=>this._onArrowKey(...i)),{context:"table"}),this.listenTo(t,"tab",((...i)=>this._handleTabOnSelectedTable(...i)),{context:"figure"}),this.listenTo(t,"tab",((...i)=>this._handleTab(...i)),{context:["th","td"]}),e.accessibility.addKeystrokeInfoGroup({id:"table",label:o("Keystrokes that can be used in a table cell"),keystrokes:[{label:o("Move the selection to the next cell"),keystroke:"Tab"},{label:o("Move the selection to the previous cell"),keystroke:"Shift+Tab"},{label:o("Insert a new table row (when in the last cell of a table)"),keystroke:"Tab"},{label:o("Navigate through the table"),keystroke:[["arrowup"],["arrowright"],["arrowdown"],["arrowleft"]]}]})}_handleTabOnSelectedTable(e,t){let o=this.editor,i=o.model.document.selection.getSelectedElement();i&&i.is("element","table")&&(t.preventDefault(),t.stopPropagation(),e.stop(),o.model.change((r=>{r.setSelection(r.createRangeIn(i.getChild(0).getChild(0)))})))}_handleTab(e,t){let o=this.editor,i=this.editor.plugins.get(nt),r=this.editor.plugins.get("TableSelection"),s=o.model.document.selection,a=!t.shiftKey,l=i.getTableCellsContainingSelection(s)[0];if(l||(l=r.getFocusCell()),!l)return;t.preventDefault(),t.stopPropagation(),e.stop();let c=l.parent,d=c.parent,u=d.getChildIndex(c),h=c.getChildIndex(l),m=h===0;if(!a&&m&&u===0)return void o.model.change((A=>{A.setSelection(A.createRangeOn(d))}));let g=h===c.childCount-1,b=u===i.getRows(d)-1;if(a&&b&&g&&(o.execute("insertTableRowBelow"),u===i.getRows(d)-1))return void o.model.change((A=>{A.setSelection(A.createRangeOn(d))}));let w;if(a&&g)w=d.getChild(u+1).getChild(0);else if(!a&&m){let A=d.getChild(u-1);w=A.getChild(A.childCount-1)}else w=c.getChild(h+(a?1:-1));o.model.change((A=>{A.setSelection(A.createRangeIn(w))}))}_onArrowKey(e,t){let o=this.editor,i=Za(t.keyCode,o.locale.contentLanguageDirection);this._handleArrowKeys(i,t.shiftKey)&&(t.preventDefault(),t.stopPropagation(),e.stop())}_handleArrowKeys(e,t){let o=this.editor.plugins.get(nt),i=this.editor.plugins.get("TableSelection"),r=this.editor.model,s=r.document.selection,a=["right","down"].includes(e),l=o.getSelectedTableCells(s);if(l.length){let d;return d=t?i.getFocusCell():a?l[l.length-1]:l[0],this._navigateFromCellInDirection(d,e,t),!0}let c=s.focus.findAncestor("tableCell");if(!c)return!1;if(!s.isCollapsed)if(t){if(s.isBackward==a&&!s.containsEntireContent(c))return!1}else{let d=s.getSelectedElement();if(!d||!r.schema.isObject(d))return!1}return!!this._isSelectionAtCellEdge(s,c,a)&&(this._navigateFromCellInDirection(c,e,t),!0)}_isSelectionAtCellEdge(e,t,o){let i=this.editor.model,r=this.editor.model.schema,s=o?e.getLastPosition():e.getFirstPosition();if(!r.getLimitElement(s).is("element","tableCell"))return i.createPositionAt(t,o?"end":0).isTouching(s);let a=i.createSelection(s);return i.modifySelection(a,{direction:o?"forward":"backward"}),s.isEqual(a.focus)}_navigateFromCellInDirection(e,t,o=!1){let i=this.editor.model,r=e.findAncestor("table"),s=[...new Ae(r,{includeAllSlots:!0})],{row:a,column:l}=s[s.length-1],c=s.find((({cell:b})=>b==e)),{row:d,column:u}=c;switch(t){case"left":u--;break;case"up":d--;break;case"right":u+=c.cellWidth;break;case"down":d+=c.cellHeight}if(d<0||d>a||u<0&&d<=0||u>l&&d>=a)return void i.change((b=>{b.setSelection(b.createRangeOn(r))}));u<0?(u=o?0:l,d--):u>l&&(u=o?l:0,d++);let h=s.find((b=>b.row==d&&b.column==u)).cell,m=["right","down"].includes(t),g=this.editor.plugins.get("TableSelection");if(o&&g.isEnabled){let b=g.getAnchorCell()||e;g.setCellSelection(b,h)}else{let b=i.createPositionAt(h,m?0:"end");i.change((w=>{w.setSelection(b)}))}}}class HT extends _o{constructor(){super(...arguments),this.domEventType=["mousemove","mouseleave"]}onDomEvent(e){this.fire(e.type,e)}}class UT extends L{static get pluginName(){return"TableMouse"}static get requires(){return[oi,nt]}init(){this.editor.editing.view.addObserver(HT),this._enableShiftClickSelection(),this._enableMouseDragSelection()}_enableShiftClickSelection(){let e=this.editor,t=e.plugins.get(nt),o=!1,i=e.plugins.get(oi);this.listenTo(e.editing.view.document,"mousedown",((r,s)=>{let a=e.model.document.selection;if(!this.isEnabled||!i.isEnabled||!s.domEvent.shiftKey)return;let l=i.getAnchorCell()||t.getTableCellsContainingSelection(a)[0];if(!l)return;let c=this._getModelTableCellFromDomEvent(s);c&&$b(l,c)&&(o=!0,i.setCellSelection(l,c),s.preventDefault())})),this.listenTo(e.editing.view.document,"mouseup",(()=>{o=!1})),this.listenTo(e.editing.view.document,"selectionChange",(r=>{o&&r.stop()}),{priority:"highest"})}_enableMouseDragSelection(){let e=this.editor,t,o,i=!1,r=!1,s=e.plugins.get(oi);this.listenTo(e.editing.view.document,"mousedown",((a,l)=>{this.isEnabled&&s.isEnabled&&(l.domEvent.shiftKey||l.domEvent.ctrlKey||l.domEvent.altKey||(t=this._getModelTableCellFromDomEvent(l)))})),this.listenTo(e.editing.view.document,"mousemove",((a,l)=>{if(!l.domEvent.buttons||!t)return;let c=this._getModelTableCellFromDomEvent(l);c&&$b(t,c)&&(o=c,i||o==t||(i=!0)),i&&(r=!0,s.setCellSelection(t,o),l.preventDefault())})),this.listenTo(e.editing.view.document,"mouseup",(()=>{i=!1,r=!1,t=null,o=null})),this.listenTo(e.editing.view.document,"selectionChange",(a=>{r&&a.stop()}),{priority:"highest"})}_getModelTableCellFromDomEvent(e){let t=e.target,o=this.editor.editing.view.createPositionAt(t,0);return this.editor.editing.mapper.toModelPosition(o).parent.findAncestor("tableCell",{includeSelf:!0})}}function $b(n,e){return n.parent.parent==e.parent.parent}var qb=z(4104),$T={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(qb.Z,$T),qb.Z.locals;class Wb extends L{static get requires(){return[$s,OT,oi,UT,jT,VT,Qo]}static get pluginName(){return"Table"}}function Gb(n){return Zb(n)||qs(n)}function Zb(n){let e=n.getSelectedElement();return e&&Kb(e)?e:null}function qs(n){let e=n.getFirstPosition();if(!e)return null;let t=e.parent;for(;t;){if(t.is("element")&&Kb(t))return t;t=t.parent}return null}function Kb(n){return!!n.getCustomProperty("table")&&He(n)}class ii extends re{constructor(e,t,o){super(e),this.attributeName=t,this._defaultValue=o}refresh(){let e=Mc(this.editor.model.document.selection);this.isEnabled=!!e,this.value=this._getValue(e)}execute(e={}){let t=this.editor.model,o=t.document.selection,{value:i,batch:r}=e,s=Mc(o),a=this._getValueToSet(i);t.enqueueChange(r,(l=>{a?l.setAttribute(this.attributeName,a,s):l.removeAttribute(this.attributeName,s)}))}_getValue(e){if(!e)return;let t=e.getAttribute(this.attributeName);return t!==this._defaultValue?t:void 0}_getValueToSet(e){if(e!==this._defaultValue)return e}}class qT extends ii{constructor(e,t){super(e,"tableBackgroundColor",t)}}function ni(n){if(!n||!xe(n))return n;let{top:e,right:t,bottom:o,left:i}=n;return e==t&&t==o&&o==i?e:void 0}function ri(n,e){let t=parseFloat(n);return Number.isNaN(t)||String(t)!==String(n)?n:`${t}${e}`}function ir(n,e={}){let t={borderStyle:"none",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",...n};return e.includeAlignmentProperty&&!t.alignment&&(t.alignment="center"),e.includePaddingProperty&&!t.padding&&(t.padding=""),e.includeVerticalAlignmentProperty&&!t.verticalAlignment&&(t.verticalAlignment="middle"),e.includeHorizontalAlignmentProperty&&!t.horizontalAlignment&&(t.horizontalAlignment=e.isRightToLeftContent?"right":"left"),t}class WT extends ii{constructor(e,t){super(e,"tableBorderColor",t)}_getValue(e){if(!e)return;let t=ni(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class GT extends ii{constructor(e,t){super(e,"tableBorderStyle",t)}_getValue(e){if(!e)return;let t=ni(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class ZT extends ii{constructor(e,t){super(e,"tableBorderWidth",t)}_getValue(e){if(!e)return;let t=ni(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}_getValueToSet(e){let t=ri(e,"px");if(t!==this._defaultValue)return t}}class KT extends ii{constructor(e,t){super(e,"tableWidth",t)}_getValueToSet(e){if((e=ri(e,"px"))!==this._defaultValue)return e}}class YT extends ii{constructor(e,t){super(e,"tableHeight",t)}_getValueToSet(e){if((e=ri(e,"px"))!==this._defaultValue)return e}}class QT extends ii{constructor(e,t){super(e,"tableAlignment",t)}}let JT=/^(left|center|right)$/,XT=/^(left|none|right)$/;class eS extends L{static get pluginName(){return"TablePropertiesEditing"}static get requires(){return[$s]}init(){let e=this.editor,t=e.model.schema,o=e.conversion;e.config.define("table.tableProperties.defaultProperties",{});let i=ir(e.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0});e.data.addStyleProcessorRules(Bm),(function(r,s,a){let l={width:"tableBorderWidth",color:"tableBorderColor",style:"tableBorderStyle"};r.extend("table",{allowAttributes:Object.values(l)}),Ic(s,"table",l,a),Vs(s,{modelAttribute:l.color,styleName:"border-color"}),Vs(s,{modelAttribute:l.style,styleName:"border-style"}),Vs(s,{modelAttribute:l.width,styleName:"border-width"})})(t,o,{color:i.borderColor,style:i.borderStyle,width:i.borderWidth}),e.commands.add("tableBorderColor",new WT(e,i.borderColor)),e.commands.add("tableBorderStyle",new GT(e,i.borderStyle)),e.commands.add("tableBorderWidth",new ZT(e,i.borderWidth)),(function(r,s,a){r.extend("table",{allowAttributes:["tableAlignment"]}),s.for("downcast").attributeToAttribute({model:{name:"table",key:"tableAlignment"},view:l=>({key:"style",value:{float:l==="center"?"none":l}}),converterPriority:"high"}),s.for("upcast").attributeToAttribute({view:{name:/^(table|figure)$/,styles:{float:XT}},model:{key:"tableAlignment",value:l=>{let c=l.getStyle("float");return c==="none"&&(c="center"),c===a?null:c}}}).attributeToAttribute({view:{attributes:{align:JT}},model:{name:"table",key:"tableAlignment",value:l=>{let c=l.getAttribute("align");return c===a?null:c}}})})(t,o,i.alignment),e.commands.add("tableAlignment",new QT(e,i.alignment)),Yb(t,o,{modelAttribute:"tableWidth",styleName:"width",defaultValue:i.width}),e.commands.add("tableWidth",new KT(e,i.width)),Yb(t,o,{modelAttribute:"tableHeight",styleName:"height",defaultValue:i.height}),e.commands.add("tableHeight",new YT(e,i.height)),e.data.addStyleProcessorRules(Pl),(function(r,s,a){let{modelAttribute:l}=a;r.extend("table",{allowAttributes:[l]}),Sc(s,{viewElement:"table",...a}),Vs(s,a)})(t,o,{modelAttribute:"tableBackgroundColor",styleName:"background-color",defaultValue:i.backgroundColor}),e.commands.add("tableBackgroundColor",new qT(e,i.backgroundColor))}}function Yb(n,e,t){let{modelAttribute:o}=t;n.extend("table",{allowAttributes:[o]}),Sc(e,{viewElement:/^(table|figure)$/,shouldUpcast:i=>!(i.name=="table"&&i.parent.name=="figure"),...t}),or(e,{modelElement:"table",...t})}var Qb=z(4082),tS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(Qb.Z,tS),Qb.Z.locals;class oS extends K{constructor(e,t){super(e),this.set("value",""),this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("isEmpty",!0),this.options=t,this.focusTracker=new Me,this._focusables=new et,this.dropdownView=this._createDropdownView(),this.inputView=this._createInputTextView(),this.keystrokes=new Ve,this._stillTyping=!1,this.focusCycler=new tt({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-input-color"]},children:[this.dropdownView,this.inputView]}),this.on("change:value",((o,i,r)=>this._setInputValue(r)))}render(){super.render(),[this.inputView,this.dropdownView.buttonView].forEach((e=>{this.focusTracker.add(e.element),this._focusables.add(e)})),this.keystrokes.listenTo(this.element)}focus(e){e===-1?this.focusCycler.focusLast():this.focusCycler.focusFirst()}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createDropdownView(){let e=this.locale,t=e.t,o=this.bindTemplate,i=this._createColorSelector(e),r=ot(e),s=new K;return s.setTemplate({tag:"span",attributes:{class:["ck","ck-input-color__button__preview"],style:{backgroundColor:o.to("value")}},children:[{tag:"span",attributes:{class:["ck","ck-input-color__button__preview__no-color-indicator",o.if("value","ck-hidden",(a=>a!=""))]}}]}),r.buttonView.extendTemplate({attributes:{class:"ck-input-color__button"}}),r.buttonView.children.add(s),r.buttonView.label=t("Color picker"),r.buttonView.tooltip=!0,r.panelPosition=e.uiLanguageDirection==="rtl"?"se":"sw",r.panelView.children.add(i),r.bind("isEnabled").to(this,"isReadOnly",(a=>!a)),r.on("change:isOpen",((a,l,c)=>{c&&(i.updateSelectedColors(),i.showColorGridsFragment())})),r}_createInputTextView(){let e=this.locale,t=new ug(e);return t.extendTemplate({on:{blur:t.bindTemplate.to("blur")}}),t.value=this.value,t.bind("isReadOnly","hasError").to(this),this.bind("isFocused","isEmpty").to(t),t.on("input",(()=>{let o=t.element.value,i=this.options.colorDefinitions.find((r=>o===r.label));this._stillTyping=!0,this.value=i&&i.color||o})),t.on("blur",(()=>{this._stillTyping=!1,this._setInputValue(t.element.value)})),t.delegate("input").to(this),t}_createColorSelector(e){let t=e.t,o=this.options.defaultColorValue||"",i=t(o?"Restore default":"Remove color"),r=new Yl(e,{colors:this.options.colorDefinitions,columns:this.options.columns,removeButtonLabel:i,colorPickerLabel:t("Color picker"),colorPickerViewConfig:this.options.colorPickerConfig!==!1&&{...this.options.colorPickerConfig,hideInput:!0}});r.appendUI(),r.on("execute",((a,l)=>{l.source!=="colorPickerSaveButton"?(this.value=l.value||o,this.fire("input"),l.source!=="colorPicker"&&(this.dropdownView.isOpen=!1)):this.dropdownView.isOpen=!1}));let s=this.value;return r.on("colorPicker:cancel",(()=>{this.value=s,this.fire("input"),this.dropdownView.isOpen=!1})),r.colorGridsFragmentView.colorPickerButtonView.on("execute",(()=>{s=this.value})),r.bind("selectedColor").to(this,"value"),r}_setInputValue(e){if(!this._stillTyping){let t=Jb(e),o=this.options.colorDefinitions.find((i=>t===Jb(i.color)));this.inputView.value=o?o.label:e||""}}}function Jb(n){return n.replace(/([(,])\s+/g,"$1").replace(/^\s+|\s+(?=[),\s]|$)/g,"").replace(/,|\s/g," ")}let Vc=n=>n==="";function jc(n){return{none:n("None"),solid:n("Solid"),dotted:n("Dotted"),dashed:n("Dashed"),double:n("Double"),groove:n("Groove"),ridge:n("Ridge"),inset:n("Inset"),outset:n("Outset")}}function Xb(n){return n('The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".')}function ew(n){return n('The value is invalid. Try "10px" or "2em" or simply "2".')}function Ws(n){return n=n.trim().toLowerCase(),Vc(n)||Tm(n)}function nr(n){return n=n.trim(),Vc(n)||iw(n)||Jr(n)||Sm(n)}function tw(n){return n=n.trim(),Vc(n)||iw(n)||Jr(n)}function ow(n,e){let t=new Je,o=jc(n.t);for(let i in o){let r={type:"button",model:new Wo({_borderStyleValue:i,label:o[i],role:"menuitemradio",withText:!0})};i==="none"?r.model.bind("isOn").to(n,"borderStyle",(s=>e==="none"?!s:s===i)):r.model.bind("isOn").to(n,"borderStyle",(s=>s===i)),t.add(r)}return t}function Hc(n){let{view:e,icons:t,toolbar:o,labels:i,propertyName:r,nameToValue:s,defaultValue:a}=n;for(let l in i){let c=new ne(e.locale);c.set({label:i[l],icon:t[l],tooltip:i[l]});let d=s?s(l):l;c.bind("isOn").to(e,r,(u=>{let h=u;return u===""&&a&&(h=a),d===h})),c.on("execute",(()=>{e[r]=d})),o.items.add(c)}}let Gs=[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}];function Zs(n){return(e,t,o)=>{let i=new oS(e.locale,{colorDefinitions:(r=n.colorConfig,r.map((s=>({color:s.model,label:s.label,options:{hasBorder:s.hasBorder}})))),columns:n.columns,defaultColorValue:n.defaultColorValue,colorPickerConfig:n.colorPickerConfig});var r;return i.inputView.set({id:t,ariaDescribedById:o}),i.bind("isReadOnly").to(e,"isEnabled",(s=>!s)),i.bind("hasError").to(e,"errorText",(s=>!!s)),i.on("input",(()=>{e.errorText=null})),e.bind("isEmpty","isFocused").to(i),i}}function iw(n){let e=parseFloat(n);return!Number.isNaN(e)&&n===String(e)}var nw=z(9865),iS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(nw.Z,iS),nw.Z.locals;class Et extends K{constructor(e,t={}){super(e);let o=this.bindTemplate;this.set("class",t.class||null),this.children=this.createCollection(),t.children&&t.children.forEach((i=>this.children.add(i))),this.set("_role",null),this.set("_ariaLabelledBy",null),t.labelView&&this.set({_role:"group",_ariaLabelledBy:t.labelView.id}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-form__row",o.to("class")],role:o.to("_role"),"aria-labelledby":o.to("_ariaLabelledBy")},children:this.children})}}var rw=z(4880),nS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(rw.Z,nS),rw.Z.locals;var sw=z(198),rS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(sw.Z,rS),sw.Z.locals;var aw=z(9221),sS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(aw.Z,sS),aw.Z.locals;let aS={left:Y.objectLeft,center:Y.objectCenter,right:Y.objectRight};class lS extends K{constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",alignment:""}),this.options=t;let{borderStyleDropdown:o,borderWidthInput:i,borderColorInput:r,borderRowLabel:s}=this._createBorderFields(),{backgroundRowLabel:a,backgroundInput:l}=this._createBackgroundFields(),{widthInput:c,operatorLabel:d,heightInput:u,dimensionsLabel:h}=this._createDimensionFields(),{alignmentToolbar:m,alignmentLabel:g}=this._createAlignmentFields();this.focusTracker=new Me,this.keystrokes=new Ve,this.children=this.createCollection(),this.borderStyleDropdown=o,this.borderWidthInput=i,this.borderColorInput=r,this.backgroundInput=l,this.widthInput=c,this.heightInput=u,this.alignmentToolbar=m;let{saveButtonView:b,cancelButtonView:w}=this._createActionButtons();this.saveButtonView=b,this.cancelButtonView=w,this._focusables=new et,this._focusCycler=new tt({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.add(new Jl(e,{label:this.t("Table properties")})),this.children.add(new Et(e,{labelView:s,children:[s,o,r,i],class:"ck-table-form__border-row"})),this.children.add(new Et(e,{labelView:a,children:[a,l],class:"ck-table-form__background-row"})),this.children.add(new Et(e,{children:[new Et(e,{labelView:h,children:[h,c,d,u],class:"ck-table-form__dimensions-row"}),new Et(e,{labelView:g,children:[g,m],class:"ck-table-properties-form__alignment-row"})]})),this.children.add(new Et(e,{children:[this.saveButtonView,this.cancelButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-properties-form"],tabindex:"-1"},children:this.children})}render(){super.render(),p({view:this}),[this.borderColorInput,this.backgroundInput].forEach((e=>{e.fieldView.focusCycler.on("forwardCycle",(t=>{this._focusCycler.focusNext(),t.stop()})),e.fieldView.focusCycler.on("backwardCycle",(t=>{this._focusCycler.focusPrevious(),t.stop()}))})),[this.borderStyleDropdown,this.borderColorInput,this.borderWidthInput,this.backgroundInput,this.widthInput,this.heightInput,this.alignmentToolbar,this.saveButtonView,this.cancelButtonView].forEach((e=>{this._focusables.add(e),this.focusTracker.add(e.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createBorderFields(){let e=this.options.defaultTableProperties,t={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},o=Zs({colorConfig:this.options.borderColors,columns:5,defaultColorValue:t.color,colorPickerConfig:this.options.colorPickerConfig}),i=this.locale,r=this.t,s=r("Style"),a=new yt(i);a.text=r("Border");let l=jc(r),c=new Ge(i,xg);c.set({label:s,class:"ck-table-form__border-style"}),c.fieldView.buttonView.set({ariaLabel:s,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:s}),c.fieldView.buttonView.bind("label").to(this,"borderStyle",(h=>l[h||"none"])),c.fieldView.on("execute",(h=>{this.borderStyle=h.source._borderStyleValue})),c.bind("isEmpty").to(this,"borderStyle",(h=>!h)),vo(c.fieldView,ow(this,t.style),{role:"menu",ariaLabel:s});let d=new Ge(i,xt);d.set({label:r("Width"),class:"ck-table-form__border-width"}),d.fieldView.bind("value").to(this,"borderWidth"),d.bind("isEnabled").to(this,"borderStyle",Ks),d.fieldView.on("input",(()=>{this.borderWidth=d.fieldView.element.value}));let u=new Ge(i,o);return u.set({label:r("Color"),class:"ck-table-form__border-color"}),u.fieldView.bind("value").to(this,"borderColor"),u.bind("isEnabled").to(this,"borderStyle",Ks),u.fieldView.on("input",(()=>{this.borderColor=u.fieldView.value})),this.on("change:borderStyle",((h,m,g,b)=>{Ks(g)||(this.borderColor="",this.borderWidth=""),Ks(b)||(this.borderColor=t.color,this.borderWidth=t.width)})),{borderRowLabel:a,borderStyleDropdown:c,borderColorInput:u,borderWidthInput:d}}_createBackgroundFields(){let e=this.locale,t=this.t,o=new yt(e);o.text=t("Background");let i=Zs({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableProperties.backgroundColor,colorPickerConfig:this.options.colorPickerConfig}),r=new Ge(e,i);return r.set({label:t("Color"),class:"ck-table-properties-form__background"}),r.fieldView.bind("value").to(this,"backgroundColor"),r.fieldView.on("input",(()=>{this.backgroundColor=r.fieldView.value})),{backgroundRowLabel:o,backgroundInput:r}}_createDimensionFields(){let e=this.locale,t=this.t,o=new yt(e);o.text=t("Dimensions");let i=new Ge(e,xt);i.set({label:t("Width"),class:"ck-table-form__dimensions-row__width"}),i.fieldView.bind("value").to(this,"width"),i.fieldView.on("input",(()=>{this.width=i.fieldView.element.value}));let r=new K(e);r.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"\xD7"}]});let s=new Ge(e,xt);return s.set({label:t("Height"),class:"ck-table-form__dimensions-row__height"}),s.fieldView.bind("value").to(this,"height"),s.fieldView.on("input",(()=>{this.height=s.fieldView.element.value})),{dimensionsLabel:o,widthInput:i,operatorLabel:r,heightInput:s}}_createAlignmentFields(){let e=this.locale,t=this.t,o=new yt(e);o.text=t("Alignment");let i=new Li(e);return i.set({isCompact:!0,ariaLabel:t("Table alignment toolbar")}),Hc({view:this,icons:aS,toolbar:i,labels:this._alignmentLabels,propertyName:"alignment",defaultValue:this.options.defaultTableProperties.alignment}),{alignmentLabel:o,alignmentToolbar:i}}_createActionButtons(){let e=this.locale,t=this.t,o=new ne(e),i=new ne(e),r=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.widthInput,this.heightInput];return o.set({label:t("Save"),icon:Y.check,class:"ck-button-save",type:"submit",withText:!0}),o.bind("isEnabled").toMany(r,"errorText",((...s)=>s.every((a=>!a)))),i.set({label:t("Cancel"),icon:Y.cancel,class:"ck-button-cancel",withText:!0}),i.delegate("execute").to(this,"cancel"),{saveButtonView:o,cancelButtonView:i}}get _alignmentLabels(){let e=this.locale,t=this.t,o=t("Align table to the left"),i=t("Center table"),r=t("Align table to the right");return e.uiLanguageDirection==="rtl"?{right:r,center:i,left:o}:{left:o,center:i,right:r}}}function Ks(n){return n!=="none"}let si=Oi.defaultPositions,Uc=[si.northArrowSouth,si.northArrowSouthWest,si.northArrowSouthEast,si.southArrowNorth,si.southArrowNorthWest,si.southArrowNorthEast,si.viewportStickyNorth];function lw(n,e){let t=n.plugins.get("ContextualBalloon"),o=n.editing.view.document.selection,i;e==="cell"?qs(o)&&(i=dw(n)):Gb(o)&&(i=cw(n)),i&&t.updatePosition(i)}function cw(n){let e=Mc(n.model.document.selection),t=n.editing.mapper.toViewElement(e);return{target:n.editing.view.domConverter.mapViewToDom(t),positions:Uc}}function dw(n){let e=n.editing.mapper,t=n.editing.view.domConverter,o=n.model.document.selection;if(o.rangeCount>1)return{target:()=>(function(s,a){let l=a.editing.mapper,c=a.editing.view.domConverter,d=Array.from(s).map((u=>{let h=uw(u.start),m=l.toViewElement(h);return new ue(c.mapViewToDom(m))}));return ue.getBoundingRect(d)})(o.getRanges(),n),positions:Uc};let i=uw(o.getFirstPosition()),r=e.toViewElement(i);return{target:t.mapViewToDom(r),positions:Uc}}function uw(n){return n.nodeAfter&&n.nodeAfter.is("element","tableCell")?n.nodeAfter:n.findAncestor("tableCell")}let hw={borderStyle:"tableBorderStyle",borderColor:"tableBorderColor",borderWidth:"tableBorderWidth",backgroundColor:"tableBackgroundColor",width:"tableWidth",height:"tableHeight",alignment:"tableAlignment"};class cS extends L{static get requires(){return[Xt]}static get pluginName(){return"TablePropertiesUI"}constructor(e){super(e),this.view=null,e.config.define("table.tableProperties",{borderColors:Gs,backgroundColors:Gs})}init(){let e=this.editor,t=e.t;this._defaultTableProperties=ir(e.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0}),this._balloon=e.plugins.get(Xt),e.ui.componentFactory.add("tableProperties",(o=>{let i=new ne(o);i.set({label:t("Table properties"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M8 2v5h4V2h1v5h5v1h-5v4h.021l-.172.351-1.916.28-.151.027c-.287.063-.54.182-.755.341L8 13v5H7v-5H2v-1h5V8H2V7h5V2h1zm4 6H8v4h4V8z" opacity=".6"/><path d="m15.5 11.5 1.323 2.68 2.957.43-2.14 2.085.505 2.946L15.5 18.25l-2.645 1.39.505-2.945-2.14-2.086 2.957-.43L15.5 11.5zM17 1a2 2 0 0 1 2 2v9.475l-.85-.124-.857-1.736a2.048 2.048 0 0 0-.292-.44L17 3H3v14h7.808l.402.392L10.935 19H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h14z"/></svg>',tooltip:!0}),this.listenTo(i,"execute",(()=>this._showView()));let r=Object.values(hw).map((s=>e.commands.get(s)));return i.bind("isEnabled").toMany(r,"isEnabled",((...s)=>s.some((a=>a)))),i}))}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(){let e=this.editor,t=e.config.get("table.tableProperties"),o=zn(t.borderColors),i=Ln(e.locale,o),r=zn(t.backgroundColors),s=Ln(e.locale,r),a=t.colorPicker!==!1,l=new lS(e.locale,{borderColors:i,backgroundColors:s,defaultTableProperties:this._defaultTableProperties,colorPickerConfig:!!a&&(t.colorPicker||{})}),c=e.t;l.render(),this.listenTo(l,"submit",(()=>{this._hideView()})),this.listenTo(l,"cancel",(()=>{this._undoStepBatch.operations.length&&e.execute("undo",this._undoStepBatch),this._hideView()})),l.keystrokes.set("Esc",((h,m)=>{this._hideView(),m()})),v({emitter:l,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});let d=Xb(c),u=ew(c);return l.on("change:borderStyle",this._getPropertyChangeCallback("tableBorderStyle")),l.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:l.borderColorInput,commandName:"tableBorderColor",errorText:d,validator:Ws})),l.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:l.borderWidthInput,commandName:"tableBorderWidth",errorText:u,validator:tw})),l.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:l.backgroundInput,commandName:"tableBackgroundColor",errorText:d,validator:Ws})),l.on("change:width",this._getValidatedPropertyChangeCallback({viewField:l.widthInput,commandName:"tableWidth",errorText:u,validator:nr})),l.on("change:height",this._getValidatedPropertyChangeCallback({viewField:l.heightInput,commandName:"tableHeight",errorText:u,validator:nr})),l.on("change:alignment",this._getPropertyChangeCallback("tableAlignment")),l}_fillViewFormFromCommandValues(){let e=this.editor.commands,t=e.get("tableBorderStyle");Object.entries(hw).map((([o,i])=>{let r=o,s=this._defaultTableProperties[r]||"";return[r,e.get(i).value||s]})).forEach((([o,i])=>{(o!=="borderColor"&&o!=="borderWidth"||t.value!=="none")&&this.view.set(o,i)})),this._isReady=!0}_showView(){let e=this.editor;this.view||(this.view=this._createPropertiesView()),this.listenTo(e.ui,"update",(()=>{this._updateView()})),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:cw(e)}),this._undoStepBatch=e.model.createBatch(),this.view.focus()}_hideView(){let e=this.editor;this.stopListening(e.ui,"update"),this._isReady=!1,this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}_updateView(){let e=this.editor;Gb(e.editing.view.document.selection)?this._isViewVisible&&lw(e,"table"):this._hideView()}get _isViewVisible(){return!!this.view&&this._balloon.visibleView===this.view}get _isViewInBalloon(){return!!this.view&&this._balloon.hasView(this.view)}_getPropertyChangeCallback(e){return(t,o,i)=>{this._isReady&&this.editor.execute(e,{value:i,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){let{commandName:t,viewField:o,validator:i,errorText:r}=e,s=Yt((()=>{o.errorText=r}),500);return(a,l,c)=>{s.cancel(),this._isReady&&(i(c)?(this.editor.execute(t,{value:c,batch:this._undoStepBatch}),o.errorText=null):s())}}}var mw=z(5737),dS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(mw.Z,dS),mw.Z.locals;let gw={left:Y.alignLeft,center:Y.alignCenter,right:Y.alignRight,justify:Y.alignJustify,top:Y.alignTop,middle:Y.alignMiddle,bottom:Y.alignBottom};class uS extends K{constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",padding:"",backgroundColor:"",width:"",height:"",horizontalAlignment:"",verticalAlignment:""}),this.options=t;let{borderStyleDropdown:o,borderWidthInput:i,borderColorInput:r,borderRowLabel:s}=this._createBorderFields(),{backgroundRowLabel:a,backgroundInput:l}=this._createBackgroundFields(),{widthInput:c,operatorLabel:d,heightInput:u,dimensionsLabel:h}=this._createDimensionFields(),{horizontalAlignmentToolbar:m,verticalAlignmentToolbar:g,alignmentLabel:b}=this._createAlignmentFields();this.focusTracker=new Me,this.keystrokes=new Ve,this.children=this.createCollection(),this.borderStyleDropdown=o,this.borderWidthInput=i,this.borderColorInput=r,this.backgroundInput=l,this.paddingInput=this._createPaddingField(),this.widthInput=c,this.heightInput=u,this.horizontalAlignmentToolbar=m,this.verticalAlignmentToolbar=g;let{saveButtonView:w,cancelButtonView:A}=this._createActionButtons();this.saveButtonView=w,this.cancelButtonView=A,this._focusables=new et,this._focusCycler=new tt({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.add(new Jl(e,{label:this.t("Cell properties")})),this.children.add(new Et(e,{labelView:s,children:[s,o,r,i],class:"ck-table-form__border-row"})),this.children.add(new Et(e,{labelView:a,children:[a,l],class:"ck-table-form__background-row"})),this.children.add(new Et(e,{children:[new Et(e,{labelView:h,children:[h,c,d,u],class:"ck-table-form__dimensions-row"}),new Et(e,{children:[this.paddingInput],class:"ck-table-cell-properties-form__padding-row"})]})),this.children.add(new Et(e,{labelView:b,children:[b,m,g],class:"ck-table-cell-properties-form__alignment-row"})),this.children.add(new Et(e,{children:[this.saveButtonView,this.cancelButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-cell-properties-form"],tabindex:"-1"},children:this.children})}render(){super.render(),p({view:this}),[this.borderColorInput,this.backgroundInput].forEach((e=>{e.fieldView.focusCycler.on("forwardCycle",(t=>{this._focusCycler.focusNext(),t.stop()})),e.fieldView.focusCycler.on("backwardCycle",(t=>{this._focusCycler.focusPrevious(),t.stop()}))})),[this.borderStyleDropdown,this.borderColorInput,this.borderWidthInput,this.backgroundInput,this.widthInput,this.heightInput,this.paddingInput,this.horizontalAlignmentToolbar,this.verticalAlignmentToolbar,this.saveButtonView,this.cancelButtonView].forEach((e=>{this._focusables.add(e),this.focusTracker.add(e.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createBorderFields(){let e=this.options.defaultTableCellProperties,t={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},o=Zs({colorConfig:this.options.borderColors,columns:5,defaultColorValue:t.color,colorPickerConfig:this.options.colorPickerConfig}),i=this.locale,r=this.t,s=r("Style"),a=new yt(i);a.text=r("Border");let l=jc(r),c=new Ge(i,xg);c.set({label:s,class:"ck-table-form__border-style"}),c.fieldView.buttonView.set({ariaLabel:s,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:s}),c.fieldView.buttonView.bind("label").to(this,"borderStyle",(h=>l[h||"none"])),c.fieldView.on("execute",(h=>{this.borderStyle=h.source._borderStyleValue})),c.bind("isEmpty").to(this,"borderStyle",(h=>!h)),vo(c.fieldView,ow(this,t.style),{role:"menu",ariaLabel:s});let d=new Ge(i,xt);d.set({label:r("Width"),class:"ck-table-form__border-width"}),d.fieldView.bind("value").to(this,"borderWidth"),d.bind("isEnabled").to(this,"borderStyle",Ys),d.fieldView.on("input",(()=>{this.borderWidth=d.fieldView.element.value}));let u=new Ge(i,o);return u.set({label:r("Color"),class:"ck-table-form__border-color"}),u.fieldView.bind("value").to(this,"borderColor"),u.bind("isEnabled").to(this,"borderStyle",Ys),u.fieldView.on("input",(()=>{this.borderColor=u.fieldView.value})),this.on("change:borderStyle",((h,m,g,b)=>{Ys(g)||(this.borderColor="",this.borderWidth=""),Ys(b)||(this.borderColor=t.color,this.borderWidth=t.width)})),{borderRowLabel:a,borderStyleDropdown:c,borderColorInput:u,borderWidthInput:d}}_createBackgroundFields(){let e=this.locale,t=this.t,o=new yt(e);o.text=t("Background");let i=Zs({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableCellProperties.backgroundColor,colorPickerConfig:this.options.colorPickerConfig}),r=new Ge(e,i);return r.set({label:t("Color"),class:"ck-table-cell-properties-form__background"}),r.fieldView.bind("value").to(this,"backgroundColor"),r.fieldView.on("input",(()=>{this.backgroundColor=r.fieldView.value})),{backgroundRowLabel:o,backgroundInput:r}}_createDimensionFields(){let e=this.locale,t=this.t,o=new yt(e);o.text=t("Dimensions");let i=new Ge(e,xt);i.set({label:t("Width"),class:"ck-table-form__dimensions-row__width"}),i.fieldView.bind("value").to(this,"width"),i.fieldView.on("input",(()=>{this.width=i.fieldView.element.value}));let r=new K(e);r.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"\xD7"}]});let s=new Ge(e,xt);return s.set({label:t("Height"),class:"ck-table-form__dimensions-row__height"}),s.fieldView.bind("value").to(this,"height"),s.fieldView.on("input",(()=>{this.height=s.fieldView.element.value})),{dimensionsLabel:o,widthInput:i,operatorLabel:r,heightInput:s}}_createPaddingField(){let e=this.locale,t=this.t,o=new Ge(e,xt);return o.set({label:t("Padding"),class:"ck-table-cell-properties-form__padding"}),o.fieldView.bind("value").to(this,"padding"),o.fieldView.on("input",(()=>{this.padding=o.fieldView.element.value})),o}_createAlignmentFields(){let e=this.locale,t=this.t,o=new yt(e);o.text=t("Table cell text alignment");let i=new Li(e),r=e.contentLanguageDirection==="rtl";i.set({isCompact:!0,ariaLabel:t("Horizontal text alignment toolbar")}),Hc({view:this,icons:gw,toolbar:i,labels:this._horizontalAlignmentLabels,propertyName:"horizontalAlignment",nameToValue:a=>{if(r){if(a==="left")return"right";if(a==="right")return"left"}return a},defaultValue:this.options.defaultTableCellProperties.horizontalAlignment});let s=new Li(e);return s.set({isCompact:!0,ariaLabel:t("Vertical text alignment toolbar")}),Hc({view:this,icons:gw,toolbar:s,labels:this._verticalAlignmentLabels,propertyName:"verticalAlignment",defaultValue:this.options.defaultTableCellProperties.verticalAlignment}),{horizontalAlignmentToolbar:i,verticalAlignmentToolbar:s,alignmentLabel:o}}_createActionButtons(){let e=this.locale,t=this.t,o=new ne(e),i=new ne(e),r=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.paddingInput];return o.set({label:t("Save"),icon:Y.check,class:"ck-button-save",type:"submit",withText:!0}),o.bind("isEnabled").toMany(r,"errorText",((...s)=>s.every((a=>!a)))),i.set({label:t("Cancel"),icon:Y.cancel,class:"ck-button-cancel",withText:!0}),i.delegate("execute").to(this,"cancel"),{saveButtonView:o,cancelButtonView:i}}get _horizontalAlignmentLabels(){let e=this.locale,t=this.t,o=t("Align cell text to the left"),i=t("Align cell text to the center"),r=t("Align cell text to the right"),s=t("Justify cell text");return e.uiLanguageDirection==="rtl"?{right:r,center:i,left:o,justify:s}:{left:o,center:i,right:r,justify:s}}get _verticalAlignmentLabels(){let e=this.t;return{top:e("Align cell text to the top"),middle:e("Align cell text to the middle"),bottom:e("Align cell text to the bottom")}}}function Ys(n){return n!=="none"}let pw={borderStyle:"tableCellBorderStyle",borderColor:"tableCellBorderColor",borderWidth:"tableCellBorderWidth",height:"tableCellHeight",width:"tableCellWidth",padding:"tableCellPadding",backgroundColor:"tableCellBackgroundColor",horizontalAlignment:"tableCellHorizontalAlignment",verticalAlignment:"tableCellVerticalAlignment"};class hS extends L{static get requires(){return[Xt]}static get pluginName(){return"TableCellPropertiesUI"}constructor(e){super(e),e.config.define("table.tableCellProperties",{borderColors:Gs,backgroundColors:Gs})}init(){let e=this.editor,t=e.t;this._defaultTableCellProperties=ir(e.config.get("table.tableCellProperties.defaultProperties"),{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,includePaddingProperty:!0,isRightToLeftContent:e.locale.contentLanguageDirection==="rtl"}),this._balloon=e.plugins.get(Xt),this.view=null,this._isReady=!1,e.ui.componentFactory.add("tableCellProperties",(o=>{let i=new ne(o);i.set({label:t("Cell properties"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.105 18-.17 1H2.5A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1h15A1.5 1.5 0 0 1 19 2.5v9.975l-.85-.124-.15-.302V8h-5v4h.021l-.172.351-1.916.28-.151.027c-.287.063-.54.182-.755.341L8 13v5h3.105zM2 12h5V8H2v4zm10-4H8v4h4V8zM2 2v5h5V2H2zm0 16h5v-5H2v5zM13 7h5V2h-5v5zM8 2v5h4V2H8z" opacity=".6"/><path d="m15.5 11.5 1.323 2.68 2.957.43-2.14 2.085.505 2.946L15.5 18.25l-2.645 1.39.505-2.945-2.14-2.086 2.957-.43L15.5 11.5zM13 6a1 1 0 0 1 1 1v3.172a2.047 2.047 0 0 0-.293.443l-.858 1.736-1.916.28-.151.027A1.976 1.976 0 0 0 9.315 14H7a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h6zm-1 2H8v4h4V8z"/></svg>',tooltip:!0}),this.listenTo(i,"execute",(()=>this._showView()));let r=Object.values(pw).map((s=>e.commands.get(s)));return i.bind("isEnabled").toMany(r,"isEnabled",((...s)=>s.some((a=>a)))),i}))}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(){let e=this.editor,t=e.config.get("table.tableCellProperties"),o=zn(t.borderColors),i=Ln(e.locale,o),r=zn(t.backgroundColors),s=Ln(e.locale,r),a=t.colorPicker!==!1,l=new uS(e.locale,{borderColors:i,backgroundColors:s,defaultTableCellProperties:this._defaultTableCellProperties,colorPickerConfig:!!a&&(t.colorPicker||{})}),c=e.t;l.render(),this.listenTo(l,"submit",(()=>{this._hideView()})),this.listenTo(l,"cancel",(()=>{this._undoStepBatch.operations.length&&e.execute("undo",this._undoStepBatch),this._hideView()})),l.keystrokes.set("Esc",((h,m)=>{this._hideView(),m()})),v({emitter:l,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});let d=Xb(c),u=ew(c);return l.on("change:borderStyle",this._getPropertyChangeCallback("tableCellBorderStyle")),l.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:l.borderColorInput,commandName:"tableCellBorderColor",errorText:d,validator:Ws})),l.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:l.borderWidthInput,commandName:"tableCellBorderWidth",errorText:u,validator:tw})),l.on("change:padding",this._getValidatedPropertyChangeCallback({viewField:l.paddingInput,commandName:"tableCellPadding",errorText:u,validator:nr})),l.on("change:width",this._getValidatedPropertyChangeCallback({viewField:l.widthInput,commandName:"tableCellWidth",errorText:u,validator:nr})),l.on("change:height",this._getValidatedPropertyChangeCallback({viewField:l.heightInput,commandName:"tableCellHeight",errorText:u,validator:nr})),l.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:l.backgroundInput,commandName:"tableCellBackgroundColor",errorText:d,validator:Ws})),l.on("change:horizontalAlignment",this._getPropertyChangeCallback("tableCellHorizontalAlignment")),l.on("change:verticalAlignment",this._getPropertyChangeCallback("tableCellVerticalAlignment")),l}_fillViewFormFromCommandValues(){let e=this.editor.commands,t=e.get("tableCellBorderStyle");Object.entries(pw).map((([o,i])=>{let r=this._defaultTableCellProperties[o]||"";return[o,e.get(i).value||r]})).forEach((([o,i])=>{(o!=="borderColor"&&o!=="borderWidth"||t.value!=="none")&&this.view.set(o,i)})),this._isReady=!0}_showView(){let e=this.editor;this.view||(this.view=this._createPropertiesView()),this.listenTo(e.ui,"update",(()=>{this._updateView()})),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:dw(e)}),this._undoStepBatch=e.model.createBatch(),this.view.focus()}_hideView(){let e=this.editor;this.stopListening(e.ui,"update"),this._isReady=!1,this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}_updateView(){let e=this.editor;qs(e.editing.view.document.selection)?this._isViewVisible&&lw(e,"cell"):this._hideView()}get _isViewVisible(){return!!this.view&&this._balloon.visibleView===this.view}get _isViewInBalloon(){return!!this.view&&this._balloon.hasView(this.view)}_getPropertyChangeCallback(e){return(t,o,i)=>{this._isReady&&this.editor.execute(e,{value:i,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){let{commandName:t,viewField:o,validator:i,errorText:r}=e,s=Yt((()=>{o.errorText=r}),500);return(a,l,c)=>{s.cancel(),this._isReady&&(i(c)?(this.editor.execute(t,{value:c,batch:this._undoStepBatch}),o.errorText=null):s())}}}class mo extends re{constructor(e,t,o){super(e),this.attributeName=t,this._defaultValue=o}refresh(){let e=this.editor,t=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e.model.document.selection);this.isEnabled=!!t.length,this.value=this._getSingleValue(t)}execute(e={}){let{value:t,batch:o}=e,i=this.editor.model,r=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(i.document.selection),s=this._getValueToSet(t);i.enqueueChange(o,(a=>{s?r.forEach((l=>a.setAttribute(this.attributeName,s,l))):r.forEach((l=>a.removeAttribute(this.attributeName,l)))}))}_getAttribute(e){if(!e)return;let t=e.getAttribute(this.attributeName);return t!==this._defaultValue?t:void 0}_getValueToSet(e){if(e!==this._defaultValue)return e}_getSingleValue(e){let t=this._getAttribute(e[0]);return e.every((o=>this._getAttribute(o)===t))?t:void 0}}class mS extends mo{constructor(e,t){super(e,"tableCellWidth",t)}_getValueToSet(e){if((e=ri(e,"px"))!==this._defaultValue)return e}}class gS extends L{static get pluginName(){return"TableCellWidthEditing"}static get requires(){return[$s]}init(){let e=this.editor,t=ir(e.config.get("table.tableCellProperties.defaultProperties"));Hs(e.model.schema,e.conversion,{modelAttribute:"tableCellWidth",styleName:"width",defaultValue:t.width}),e.commands.add("tableCellWidth",new mS(e,t.width))}}class pS extends mo{constructor(e,t){super(e,"tableCellPadding",t)}_getAttribute(e){if(!e)return;let t=ni(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}_getValueToSet(e){let t=ri(e,"px");if(t!==this._defaultValue)return t}}class fS extends mo{constructor(e,t){super(e,"tableCellHeight",t)}_getValueToSet(e){let t=ri(e,"px");if(t!==this._defaultValue)return t}}class kS extends mo{constructor(e,t){super(e,"tableCellBackgroundColor",t)}}class bS extends mo{constructor(e,t){super(e,"tableCellVerticalAlignment",t)}}class wS extends mo{constructor(e,t){super(e,"tableCellHorizontalAlignment",t)}}class _S extends mo{constructor(e,t){super(e,"tableCellBorderStyle",t)}_getAttribute(e){if(!e)return;let t=ni(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class AS extends mo{constructor(e,t){super(e,"tableCellBorderColor",t)}_getAttribute(e){if(!e)return;let t=ni(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class CS extends mo{constructor(e,t){super(e,"tableCellBorderWidth",t)}_getAttribute(e){if(!e)return;let t=ni(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}_getValueToSet(e){let t=ri(e,"px");if(t!==this._defaultValue)return t}}let fw=/^(top|middle|bottom)$/,kw=/^(left|center|right|justify)$/;class vS extends L{static get pluginName(){return"TableCellPropertiesEditing"}static get requires(){return[$s,gS]}init(){let e=this.editor,t=e.model.schema,o=e.conversion;e.config.define("table.tableCellProperties.defaultProperties",{});let i=ir(e.config.get("table.tableCellProperties.defaultProperties"),{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,includePaddingProperty:!0,isRightToLeftContent:e.locale.contentLanguageDirection==="rtl"});e.data.addStyleProcessorRules(Bm),(function(r,s,a){let l={width:"tableCellBorderWidth",color:"tableCellBorderColor",style:"tableCellBorderStyle"};r.extend("tableCell",{allowAttributes:Object.values(l)}),Ic(s,"td",l,a),Ic(s,"th",l,a),or(s,{modelElement:"tableCell",modelAttribute:l.style,styleName:"border-style"}),or(s,{modelElement:"tableCell",modelAttribute:l.color,styleName:"border-color"}),or(s,{modelElement:"tableCell",modelAttribute:l.width,styleName:"border-width"})})(t,o,{color:i.borderColor,style:i.borderStyle,width:i.borderWidth}),e.commands.add("tableCellBorderStyle",new _S(e,i.borderStyle)),e.commands.add("tableCellBorderColor",new AS(e,i.borderColor)),e.commands.add("tableCellBorderWidth",new CS(e,i.borderWidth)),Hs(t,o,{modelAttribute:"tableCellHeight",styleName:"height",defaultValue:i.height}),e.commands.add("tableCellHeight",new fS(e,i.height)),e.data.addStyleProcessorRules(C1),Hs(t,o,{modelAttribute:"tableCellPadding",styleName:"padding",reduceBoxSides:!0,defaultValue:i.padding}),e.commands.add("tableCellPadding",new pS(e,i.padding)),e.data.addStyleProcessorRules(Pl),Hs(t,o,{modelAttribute:"tableCellBackgroundColor",styleName:"background-color",defaultValue:i.backgroundColor}),e.commands.add("tableCellBackgroundColor",new kS(e,i.backgroundColor)),(function(r,s,a){r.extend("tableCell",{allowAttributes:["tableCellHorizontalAlignment"]}),s.for("downcast").attributeToAttribute({model:{name:"tableCell",key:"tableCellHorizontalAlignment"},view:l=>({key:"style",value:{"text-align":l}})}),s.for("upcast").attributeToAttribute({view:{name:/^(td|th)$/,styles:{"text-align":kw}},model:{key:"tableCellHorizontalAlignment",value:l=>{let c=l.getStyle("text-align");return c===a?null:c}}}).attributeToAttribute({view:{name:/^(td|th)$/,attributes:{align:kw}},model:{key:"tableCellHorizontalAlignment",value:l=>{let c=l.getAttribute("align");return c===a?null:c}}})})(t,o,i.horizontalAlignment),e.commands.add("tableCellHorizontalAlignment",new wS(e,i.horizontalAlignment)),(function(r,s,a){r.extend("tableCell",{allowAttributes:["tableCellVerticalAlignment"]}),s.for("downcast").attributeToAttribute({model:{name:"tableCell",key:"tableCellVerticalAlignment"},view:l=>({key:"style",value:{"vertical-align":l}})}),s.for("upcast").attributeToAttribute({view:{name:/^(td|th)$/,styles:{"vertical-align":fw}},model:{key:"tableCellVerticalAlignment",value:l=>{let c=l.getStyle("vertical-align");return c===a?null:c}}}).attributeToAttribute({view:{name:/^(td|th)$/,attributes:{valign:fw}},model:{key:"tableCellVerticalAlignment",value:l=>{let c=l.getAttribute("valign");return c===a?null:c}}})})(t,o,i.verticalAlignment),e.commands.add("tableCellVerticalAlignment",new bS(e,i.verticalAlignment))}}class yS extends re{refresh(){let e=this.editor.model,t=e.schema,o=e.document.selection;this.isEnabled=(function(i,r,s){let a=(function(l,c){let d=uc(l,c),u=d.start.parent;return u.isEmpty&&!u.is("element","$root")?u.parent:u})(i,s);return r.checkChild(a,"horizontalLine")})(o,t,e)}execute(){let e=this.editor.model;e.change((t=>{let o=t.createElement("horizontalLine");e.insertObject(o,null,null,{setSelection:"after"})}))}}var bw=z(2536),xS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(bw.Z,xS),bw.Z.locals;class ES extends L{static get pluginName(){return"HorizontalLineEditing"}init(){let e=this.editor,t=e.model.schema,o=e.t,i=e.conversion;t.register("horizontalLine",{inheritAllFrom:"$blockObject"}),i.for("dataDowncast").elementToElement({model:"horizontalLine",view:(r,{writer:s})=>s.createEmptyElement("hr")}),i.for("editingDowncast").elementToStructure({model:"horizontalLine",view:(r,{writer:s})=>{let a=o("Horizontal line"),l=s.createContainerElement("div",null,s.createEmptyElement("hr"));return s.addClass("ck-horizontal-line",l),s.setCustomProperty("hr",!0,l),(function(c,d,u){return d.setCustomProperty("horizontalLine",!0,c),Hi(c,d,{label:u})})(l,s,a)}}),i.for("upcast").elementToElement({view:"hr",model:"horizontalLine"}),e.commands.add("horizontalLine",new yS(e))}}class DS extends L{static get pluginName(){return"HorizontalLineUI"}init(){let e=this.editor;e.ui.componentFactory.add("horizontalLine",(()=>{let t=this._createButton(ne);return t.set({tooltip:!0}),t})),e.ui.componentFactory.add("menuBar:horizontalLine",(()=>this._createButton(Pe)))}_createButton(e){let t=this.editor,o=t.locale,i=t.commands.get("horizontalLine"),r=new e(t.locale),s=o.t;return r.set({label:s("Horizontal line"),icon:Y.horizontalLine}),r.bind("isEnabled").to(i,"isEnabled"),this.listenTo(r,"execute",(()=>{t.execute("horizontalLine"),t.editing.view.focus()})),r}}let TS=function(n,e,t,o){var i=-1,r=n==null?0:n.length;for(o;++i<r;)t=e(t,n[i],i,n);return t},SS=(function(n){return function(e){return n?.[e]}})({\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"});var IS=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,BS=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");let MS=function(n){return(n=gn(n))&&n.replace(IS,SS).replace(BS,"")};var NS=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;let PS=function(n){return n.match(NS)||[]};var LS=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;let zS=function(n){return LS.test(n)};var ww="\\ud800-\\udfff",_w="\\u2700-\\u27bf",Aw="a-z\\xdf-\\xf6\\xf8-\\xff",Cw="A-Z\\xc0-\\xd6\\xd8-\\xde",vw="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",yw="["+vw+"]",xw="\\d+",OS="["+_w+"]",Ew="["+Aw+"]",Dw="[^"+ww+vw+xw+_w+Aw+Cw+"]",Tw="(?:\\ud83c[\\udde6-\\uddff]){2}",Sw="[\\ud800-\\udbff][\\udc00-\\udfff]",Wi="["+Cw+"]",Iw="(?:"+Ew+"|"+Dw+")",RS="(?:"+Wi+"|"+Dw+")",Bw="(?:['\u2019](?:d|ll|m|re|s|t|ve))?",Mw="(?:['\u2019](?:D|LL|M|RE|S|T|VE))?",Nw="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",Pw="[\\ufe0e\\ufe0f]?",FS=Pw+Nw+("(?:\\u200d(?:"+["[^"+ww+"]",Tw,Sw].join("|")+")"+Pw+Nw+")*"),VS="(?:"+[OS,Tw,Sw].join("|")+")"+FS,jS=RegExp([Wi+"?"+Ew+"+"+Bw+"(?="+[yw,Wi,"$"].join("|")+")",RS+"+"+Mw+"(?="+[yw,Wi+Iw,"$"].join("|")+")",Wi+"?"+Iw+"+"+Bw,Wi+"+"+Mw,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",xw,VS].join("|"),"g");let HS=function(n){return n.match(jS)||[]},US=function(n,e,t){return n=gn(n),(e=e)===void 0?zS(n)?HS(n):PS(n):n.match(e)||[]};var $S=RegExp("['\u2019]","g");let qS=function(n){return function(e){return TS(US(MS(e).replace($S,"")),n,"")}},WS=function(n,e,t){var o=n.length;return t=t===void 0?o:t,!e&&t>=o?n:ih(n,e,t)};var GS=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");let Lw=function(n){return GS.test(n)},ZS=function(n){return n.split("")};var zw="\\ud800-\\udfff",KS="["+zw+"]",$c="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",qc="\\ud83c[\\udffb-\\udfff]",Ow="[^"+zw+"]",Rw="(?:\\ud83c[\\udde6-\\uddff]){2}",Fw="[\\ud800-\\udbff][\\udc00-\\udfff]",Vw="(?:"+$c+"|"+qc+")?",jw="[\\ufe0e\\ufe0f]?",YS=jw+Vw+("(?:\\u200d(?:"+[Ow,Rw,Fw].join("|")+")"+jw+Vw+")*"),QS="(?:"+[Ow+$c+"?",$c,Rw,Fw,KS].join("|")+")",JS=RegExp(qc+"(?="+qc+")|"+QS+YS,"g");let XS=function(n){return n.match(JS)||[]},eI=function(n){return Lw(n)?XS(n):ZS(n)},Hw=(function(n){return function(e){e=gn(e);var t=Lw(e)?eI(e):void 0,o=t?t[0]:e.charAt(0),i=t?WS(t,1).join(""):e.slice(1);return o[n]()+i}})("toUpperCase"),tI=qS((function(n,e,t){return n+(t?" ":"")+Hw(e)}));function ai(n,e,t,o){e&&(function(i,r,s){if(r.attributes)for(let[a]of Object.entries(r.attributes))i.removeAttribute(a,s);if(r.styles)for(let a of Object.keys(r.styles))i.removeStyle(a,s);r.classes&&i.removeClass(r.classes,s)})(n,e,o),t&&oo(n,t,o)}function oo(n,e,t){if(e.attributes)for(let[o,i]of Object.entries(e.attributes))n.setAttribute(o,i,t);e.styles&&n.setStyle(e.styles,t),e.classes&&n.addClass(e.classes,t)}function Gi(n,e,t,o,i){let r=e.getAttribute(t),s={};for(let a of["attributes","styles","classes"]){if(a!=o){r&&r[a]&&(s[a]=r[a]);continue}if(o=="classes"){let c=new Set(r&&r.classes||[]);i(c),c.size&&(s[a]=Array.from(c));continue}let l=new Map(Object.entries(r&&r[a]||{}));i(l),l.size&&(s[a]=Object.fromEntries(l))}Object.keys(s).length?e.is("documentSelection")?n.setSelectionAttribute(t,s):n.setAttribute(t,s,e):r&&(e.is("documentSelection")?n.removeSelectionAttribute(t):n.removeAttribute(t,e))}function Ot(n){return`html${e=n,tI(e).replace(/ /g,"")}Attributes`;var e}function Wc({model:n}){return(e,t)=>t.writer.createElement(n,{htmlContent:e.getCustomProperty("$rawContent")})}function oI(n,{view:e,isInline:t}){let o=n.t;return(i,{writer:r})=>{let s=o("HTML object"),a=Qs(e,i,r),l=i.getAttribute(Ot(e));return r.addClass("html-object-embed__content",a),l&&oo(r,l,a),Hi(r.createContainerElement(t?"span":"div",{class:"html-object-embed","data-html-object-embed-label":s},a),r,{label:s})}}function Qs(n,e,t){return t.createRawElement(n,null,((o,i)=>{i.setContentOf(o,e.getAttribute("htmlContent"))}))}function iI({view:n,model:e,allowEmpty:t},o){return r=>{r.on(`element:${n}`,((s,a,l)=>{let c=o.processViewAttributes(a.viewItem,l);if(c||l.consumable.test(a.viewItem,{name:!0})){if(c=c||{},l.consumable.consume(a.viewItem,{name:!0}),a.modelRange||(a=Object.assign(a,l.convertChildren(a.viewItem,a.modelCursor))),t&&a.modelRange.isCollapsed&&Object.keys(c).length){let d=l.writer.createElement("htmlEmptyElement");if(!l.safeInsert(d,a.modelCursor))return;let u=l.getSplitParts(d);return a.modelRange=l.writer.createRange(a.modelRange.start,l.writer.createPositionAfter(u[u.length-1])),l.updateConversionResult(d,a),void i(d,c,l)}for(let d of a.modelRange.getItems())i(d,c,l)}}),{priority:"low"})};function i(r,s,a){if(a.schema.checkAttribute(r,e)){let l=(function(c,d){let u=It(c),h="attributes";for(h in d)u[h]=h=="classes"?Array.from(new Set([...c[h]||[],...d[h]])):{...c[h],...d[h]};return u})(s,r.getAttribute(e)||{});a.writer.setAttribute(e,l,r)}}}function Uw({model:n,view:e},t){return(o,{writer:i,consumable:r})=>{if(!o.hasAttribute(n))return null;let s=i.createContainerElement(e),a=o.getAttribute(n);return r.consume(o,`attribute:${n}`),oo(i,a,s),s.getFillerOffset=()=>null,t?Hi(s,i):s}}function nI({priority:n,view:e}){return(t,o)=>{if(!t)return;let{writer:i}=o,r=i.createAttributeElement(e,null,{priority:n});return oo(i,t,r),r}}function rr({view:n},e){return t=>{t.on(`element:${n}`,((o,i,r)=>{if(!i.modelRange||i.modelRange.isCollapsed)return;let s=e.processViewAttributes(i.viewItem,r);s&&r.writer.setAttribute(Ot(i.viewItem.name),s,i.modelRange)}),{priority:"low"})}}function sr({view:n,model:e}){return t=>{t.on(`attribute:${Ot(n)}:${e}`,((o,i,r)=>{if(!r.consumable.consume(i.item,o.name))return;let{attributeOldValue:s,attributeNewValue:a}=i;ai(r.writer,s,a,r.mapper.toViewElement(i.item))}))}}let rI=[{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:"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:"$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:{allowChildren:["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}}],sI=[{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}}],aI=Qa((function(n,e,t,o){Vu(n,e,t,o)}));class Zi extends L{constructor(){super(...arguments),this._definitions=[]}static get pluginName(){return"DataSchema"}init(){for(let e of rI)this.registerBlockElement(e);for(let e of sI)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){let o=new Set;for(let i of this._getMatchingViewDefinitions(e)){if(t)for(let r of this._getReferences(i.model))o.add(r);o.add(i)}return o}getDefinitionsForModel(e){return this._definitions.filter((t=>t.model==e))}_getMatchingViewDefinitions(e){return this._definitions.filter((t=>t.view&&(function(o,i){return typeof o=="string"?o===i:o instanceof RegExp?o.test(i):!1})(e,t.view)))}*_getReferences(e){let t=["inheritAllFrom","inheritTypesFrom","allowWhere","allowContentOf","allowAttributesOf"],o=this._definitions.filter((i=>i.model==e));for(let{modelSchema:i}of o)if(i)for(let r of t)for(let s of ke(i[r]||[])){let a=this._definitions.filter((l=>l.model==s));for(let l of a)s!==e&&(yield*this._getReferences(l.model),yield l)}}_extendDefinition(e){let t=Array.from(this._definitions.entries()).filter((([,o])=>o.model==e.model));if(t.length!=0)for(let[o,i]of t)this._definitions[o]=aI({},i,e,((r,s)=>Array.isArray(r)?r.concat(s):void 0));else this._definitions.push(e)}}var $w=z(8468),lI={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()($w.Z,lI),$w.Z.locals;class Ue extends L{constructor(e){super(e),this._dataSchema=e.plugins.get("DataSchema"),this._allowedAttributes=new St,this._disallowedAttributes=new St,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 requires(){return[Zi,Qo]}loadAllowedConfig(e){for(let t of e){let o=t.name||/[\s\S]+/,i=Ww(t);this.allowElement(o),i.forEach((r=>this.allowAttributes(r)))}}loadDisallowedConfig(e){for(let t of e){let o=t.name||/[\s\S]+/,i=Ww(t);i.length==0?this.disallowElement(o):i.forEach((r=>this.disallowAttributes(r)))}}loadAllowedEmptyElementsConfig(e){for(let t of e)this.allowEmptyElement(t)}allowElement(e){for(let t of this._dataSchema.getDefinitionsForView(e,!0))this._addAllowedElement(t),this._coupledAttributes=null}disallowElement(e){for(let t of this._dataSchema.getDefinitionsForView(e,!1))this._disallowedElements.add(t.view)}allowEmptyElement(e){for(let 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){let{consumable:o}=t;return qw(e,this._disallowedAttributes,o),(function(i,{attributes:r,classes:s,styles:a}){return!r.length&&!s.length&&!a.length?null:{...r.length&&{attributes:cI(i,r)},...a.length&&{styles:dI(i,a)},...s.length&&{classes:s}}})(e,qw(e,this._allowedAttributes,o))}_addAllowedElement(e){if(!this._allowedElements.has(e)){if(this._allowedElements.add(e),"appliesToBlock"in e&&typeof e.appliesToBlock=="string")for(let t of this._dataSchema.getDefinitionsForModel(e.appliesToBlock))t.isBlock&&this._addAllowedElement(t);this._dataInitialized&&this.editor.data.once("set",(()=>{this._fireRegisterEvent(e)}),{priority:ge.highest+1})}}_registerElementsAfterInit(){this.editor.data.on("init",(()=>{this._dataInitialized=!0;for(let e of this._allowedElements)this._fireRegisterEvent(e)}),{priority:ge.highest+1})}_registerElementHandlers(){this.on("register",((e,t)=>{let o=this.editor.model.schema;if(t.isObject&&!o.isRegistered(t.model))this._registerObjectElement(t);else if(t.isBlock)this._registerBlockElement(t);else{if(!t.isInline)throw new y("data-filter-invalid-definition",null,t);this._registerInlineElement(t)}e.stop()}),{priority:"lowest"})}_registerCoupledAttributesPostFixer(){let e=this.editor.model,t=e.document.selection;e.document.registerPostFixer((o=>{let i=e.document.differ.getChanges(),r=!1,s=this._getCoupledAttributesMap();for(let a of i){if(a.type!="attribute"||a.attributeNewValue!==null)continue;let l=s.get(a.attributeKey);if(l)for(let{item:c}of a.range.getWalker())for(let d of l)c.hasAttribute(d)&&(o.removeAttribute(d,c),r=!0)}return r})),this.listenTo(t,"change:attribute",((o,{attributeKeys:i})=>{let r=new Set,s=this._getCoupledAttributesMap();for(let a of i){if(t.hasAttribute(a))continue;let l=s.get(a);if(l)for(let c of l)t.hasAttribute(c)&&r.add(c)}r.size!=0&&e.change((a=>{for(let l of r)a.removeSelectionAttribute(l)}))}))}_registerAssociatedHtmlAttributesPostFixer(){let e=this.editor.model;e.document.registerPostFixer((t=>{let o=e.document.differ.getChanges(),i=!1;for(let r of o)if(r.type==="insert"&&r.name!=="$text")for(let s of r.attributes.keys())s.startsWith("html")&&s.endsWith("Attributes")&&(e.schema.checkAttribute(r.name,s)||(t.removeAttribute(s,r.position.nodeAfter),i=!0));return i}))}_getCoupledAttributesMap(){if(this._coupledAttributes)return this._coupledAttributes;this._coupledAttributes=new Map;for(let e of this._allowedElements)if(e.coupledAttribute&&e.model){let 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){let t=this.editor,o=t.model.schema,i=t.conversion,{view:r,model:s}=e;o.register(s,e.modelSchema),r&&(o.extend(e.model,{allowAttributes:[Ot(r),"htmlContent"]}),t.data.registerRawContentMatcher({name:r}),i.for("upcast").elementToElement({view:r,model:Wc(e),converterPriority:ge.low+2}),i.for("upcast").add(rr(e,this)),i.for("editingDowncast").elementToStructure({model:{name:s,attributes:[Ot(r)]},view:oI(t,e)}),i.for("dataDowncast").elementToElement({model:s,view:(a,{writer:l})=>Qs(r,a,l)}),i.for("dataDowncast").add(sr(e)))}_registerBlockElement(e){let t=this.editor,o=t.model.schema,i=t.conversion,{view:r,model:s}=e;if(!o.isRegistered(e.model)){if(o.register(e.model,e.modelSchema),!r)return;i.for("upcast").elementToElement({model:s,view:r,converterPriority:ge.low+2}),i.for("downcast").elementToElement({model:s,view:r})}r&&(o.extend(e.model,{allowAttributes:Ot(r)}),i.for("upcast").add(rr(e,this)),i.for("downcast").add(sr(e)))}_registerInlineElement(e){let t=this.editor,o=t.model.schema,i=t.conversion,r=e.model;e.appliesToBlock||(o.extend("$text",{allowAttributes:r}),e.attributeProperties&&o.setAttributeProperties(r,e.attributeProperties),i.for("upcast").add(iI(e,this)),i.for("downcast").attributeToElement({model:r,view:nI(e)}),e.allowEmpty&&(o.setAttributeProperties(r,{copyFromObject:!1}),o.isRegistered("htmlEmptyElement")||o.register("htmlEmptyElement",{inheritAllFrom:"$inlineObject"}),t.data.htmlProcessor.domConverter.registerInlineObjectMatcher((s=>s.name==e.view&&s.isEmpty&&Array.from(s.getAttributeKeys()).length?{name:!0}:null)),i.for("editingDowncast").elementToElement({model:"htmlEmptyElement",view:Uw(e,!0)}),i.for("dataDowncast").elementToElement({model:"htmlEmptyElement",view:Uw(e)})))}}function qw(n,e,t){let o=e.matchAll(n)||[],i=n.document.stylesProcessor;return o.reduce(((r,{match:s})=>{for(let a of s.styles||[]){let l=i.getRelatedStyles(a).filter((c=>c.split("-").length>a.split("-").length)).sort(((c,d)=>d.split("-").length-c.split("-").length));for(let c of l)t.consume(n,{styles:[c]})&&r.styles.push(c);t.consume(n,{styles:[a]})&&r.styles.push(a)}for(let a of s.classes||[])t.consume(n,{classes:[a]})&&r.classes.push(a);for(let a of s.attributes||[])t.consume(n,{attributes:[a]})&&r.attributes.push(a);return r}),{attributes:[],classes:[],styles:[]})}function cI(n,e){let t={};for(let o of e){let i=n.getAttribute(o);i!==void 0&&Su(o)&&(t[o]=i)}return t}function dI(n,e){let t=new Lr(n.document.stylesProcessor);for(let o of e){let i=n.getStyle(o);i!==void 0&&t.set(o,i)}return Object.fromEntries(t.getStylesEntries())}function Gc(n,e){let{name:t}=n,o=n[e];return lt(o)?Object.entries(o).map((([i,r])=>({name:t,[e]:{[i]:r}}))):Array.isArray(o)?o.map((i=>({name:t,[e]:[i]}))):[n]}function Ww(n){let{name:e,attributes:t,classes:o,styles:i}=n,r=[];return t&&r.push(...Gc({name:e,attributes:t},"attributes")),o&&r.push(...Gc({name:e,classes:o},"classes")),i&&r.push(...Gc({name:e,styles:i},"styles")),r}class uI extends L{static get requires(){return[Ue]}static get pluginName(){return"CodeBlockElementSupport"}init(){if(!this.editor.plugins.has("CodeBlockEditing"))return;let e=this.editor.plugins.get(Ue);e.on("register:pre",((t,o)=>{if(o.model!=="codeBlock")return;let i=this.editor,r=i.model.schema,s=i.conversion;r.extend("codeBlock",{allowAttributes:["htmlPreAttributes","htmlContentAttributes"]}),s.for("upcast").add((function(a){return l=>{l.on("element:code",((c,d,u)=>{let h=d.viewItem,m=h.parent;function g(b,w){let A=a.processViewAttributes(b,u);A&&u.writer.setAttribute(w,A,d.modelRange)}m&&m.is("element","pre")&&(g(m,"htmlPreAttributes"),g(h,"htmlContentAttributes"))}),{priority:"low"})}})(e)),s.for("downcast").add((a=>{a.on("attribute:htmlPreAttributes:codeBlock",((l,c,d)=>{if(!d.consumable.consume(c.item,l.name))return;let{attributeOldValue:u,attributeNewValue:h}=c,m=d.mapper.toViewElement(c.item).parent;ai(d.writer,u,h,m)})),a.on("attribute:htmlContentAttributes:codeBlock",((l,c,d)=>{if(!d.consumable.consume(c.item,l.name))return;let{attributeOldValue:u,attributeNewValue:h}=c,m=d.mapper.toViewElement(c.item);ai(d.writer,u,h,m)}))})),t.stop()}))}}class hI extends L{static get requires(){return[Ue]}static get pluginName(){return"DualContentModelElementSupport"}init(){this.editor.plugins.get(Ue).on("register",((e,t)=>{let o=t,i=this.editor,r=i.model.schema,s=i.conversion;if(!o.paragraphLikeModel||r.isRegistered(o.model)||r.isRegistered(o.paragraphLikeModel))return;let a={model:o.paragraphLikeModel,view:o.view};r.register(o.model,o.modelSchema),r.register(a.model,{inheritAllFrom:"$block"}),s.for("upcast").elementToElement({view:o.view,model:(l,{writer:c})=>this._hasBlockContent(l)?c.createElement(o.model):c.createElement(a.model),converterPriority:ge.low+.5}),s.for("downcast").elementToElement({view:o.view,model:o.model}),this._addAttributeConversion(o),s.for("downcast").elementToElement({view:a.view,model:a.model}),this._addAttributeConversion(a),e.stop()}))}_hasBlockContent(e){let t=this.editor.editing.view,o=t.domConverter.blockElements;for(let i of t.createRangeIn(e).getItems())if(i.is("element")&&o.includes(i.name))return!0;return!1}_addAttributeConversion(e){let t=this.editor,o=t.conversion,i=t.plugins.get(Ue);t.model.schema.extend(e.model,{allowAttributes:Ot(e.view)}),o.for("upcast").add(rr(e,i)),o.for("downcast").add(sr(e))}}class mI extends L{static get requires(){return[Zi,Wn]}static get pluginName(){return"HeadingElementSupport"}init(){let e=this.editor;if(!e.plugins.has("HeadingEditing"))return;let t=e.config.get("heading.options");this.registerHeadingElements(e,t)}registerHeadingElements(e,t){let o=e.plugins.get(Zi),i=[];for(let r of t)"model"in r&&"view"in r&&(o.registerBlockElement({view:r.view,model:r.model}),i.push(r.model));o.extendBlockElement({model:"htmlHgroup",modelSchema:{allowChildren:i}})}}function Js(n,e,t){let o=n.createRangeOn(e);for(let{item:i}of o.getWalker())if(i.is("element",t))return i}class gI extends L{static get requires(){return[Ue]}static get pluginName(){return"ImageElementSupport"}init(){let e=this.editor;if(!e.plugins.has("ImageInlineEditing")&&!e.plugins.has("ImageBlockEditing"))return;let t=e.model.schema,o=e.conversion,i=e.plugins.get(Ue);i.on("register:figure",(()=>{o.for("upcast").add((function(r){return s=>{s.on("element:figure",((a,l,c)=>{let d=l.viewItem;if(!l.modelRange||!d.hasClass("image"))return;let u=r.processViewAttributes(d,c);u&&c.writer.setAttribute("htmlFigureAttributes",u,l.modelRange)}),{priority:"low"})}})(i))})),i.on("register:img",((r,s)=>{s.model!=="imageBlock"&&s.model!=="imageInline"||(t.isRegistered("imageBlock")&&t.extend("imageBlock",{allowAttributes:["htmlImgAttributes","htmlFigureAttributes","htmlLinkAttributes"]}),t.isRegistered("imageInline")&&t.extend("imageInline",{allowAttributes:["htmlA","htmlImgAttributes"]}),o.for("upcast").add((function(a){return l=>{l.on("element:img",((c,d,u)=>{if(!d.modelRange)return;let h=d.viewItem,m=a.processViewAttributes(h,u);m&&u.writer.setAttribute("htmlImgAttributes",m,d.modelRange)}),{priority:"low"})}})(i)),o.for("downcast").add((a=>{function l(d){a.on(`attribute:${d}:imageInline`,((u,h,m)=>{if(!m.consumable.consume(h.item,u.name))return;let{attributeOldValue:g,attributeNewValue:b}=h,w=m.mapper.toViewElement(h.item);ai(m.writer,g,b,w)}),{priority:"low"})}function c(d,u){a.on(`attribute:${u}:imageBlock`,((h,m,g)=>{if(!g.consumable.test(m.item,h.name))return;let{attributeOldValue:b,attributeNewValue:w}=m,A=g.mapper.toViewElement(m.item),S=Js(g.writer,A,d);S&&(ai(g.writer,b,w,S),g.consumable.consume(m.item,h.name))}),{priority:"low"}),d==="a"&&a.on("attribute:linkHref:imageBlock",((h,m,g)=>{if(!g.consumable.consume(m.item,"attribute:htmlLinkAttributes:imageBlock"))return;let b=g.mapper.toViewElement(m.item),w=Js(g.writer,b,"a");oo(g.writer,m.item.getAttribute("htmlLinkAttributes"),w)}),{priority:"low"})}l("htmlImgAttributes"),c("img","htmlImgAttributes"),c("figure","htmlFigureAttributes"),c("a","htmlLinkAttributes")})),e.plugins.has("LinkImage")&&o.for("upcast").add((function(a,l){let c=l.plugins.get("ImageUtils");return d=>{d.on("element:a",((u,h,m)=>{let g=h.viewItem;if(!c.findViewImgElement(g))return;let b=h.modelCursor.parent;if(!b.is("element","imageBlock"))return;let w=a.processViewAttributes(g,m);w&&m.writer.setAttribute("htmlLinkAttributes",w,b)}),{priority:"low"})}})(i,e)),r.stop())}))}}class pI extends L{static get requires(){return[Ue]}static get pluginName(){return"MediaEmbedElementSupport"}init(){let e=this.editor;if(!e.plugins.has("MediaEmbed")||e.config.get("mediaEmbed.previewsInData"))return;let t=e.model.schema,o=e.conversion,i=this.editor.plugins.get(Ue),r=this.editor.plugins.get(Zi),s=e.config.get("mediaEmbed.elementName");r.registerBlockElement({model:"media",view:s}),i.on("register:figure",(()=>{o.for("upcast").add((function(a){return l=>{l.on("element:figure",((c,d,u)=>{let h=d.viewItem;if(!d.modelRange||!h.hasClass("media"))return;let m=a.processViewAttributes(h,u);m&&u.writer.setAttribute("htmlFigureAttributes",m,d.modelRange)}),{priority:"low"})}})(i))})),i.on(`register:${s}`,((a,l)=>{l.model==="media"&&(t.extend("media",{allowAttributes:[Ot(s),"htmlFigureAttributes"]}),o.for("upcast").add((function(c,d){let u=(h,m,g)=>{function b(w,A){let S=c.processViewAttributes(w,g);S&&g.writer.setAttribute(A,S,m.modelRange)}b(m.viewItem,Ot(d))};return h=>{h.on(`element:${d}`,u,{priority:"low"})}})(i,s)),o.for("dataDowncast").add((function(c){return d=>{function u(h,m){d.on(`attribute:${m}:media`,((g,b,w)=>{if(!w.consumable.consume(b.item,g.name))return;let{attributeOldValue:A,attributeNewValue:S}=b,M=w.mapper.toViewElement(b.item),F=Js(w.writer,M,h);ai(w.writer,A,S,F)}))}u(c,Ot(c)),u("figure","htmlFigureAttributes")}})(s)),a.stop())}))}}class fI extends L{static get requires(){return[Ue]}static get pluginName(){return"ScriptElementSupport"}init(){let e=this.editor.plugins.get(Ue);e.on("register:script",((t,o)=>{let i=this.editor,r=i.model.schema,s=i.conversion;r.register("htmlScript",o.modelSchema),r.extend("htmlScript",{allowAttributes:["htmlScriptAttributes","htmlContent"],isContent:!0}),i.data.registerRawContentMatcher({name:"script"}),s.for("upcast").elementToElement({view:"script",model:Wc(o)}),s.for("upcast").add(rr(o,e)),s.for("downcast").elementToElement({model:"htmlScript",view:(a,{writer:l})=>Qs("script",a,l)}),s.for("downcast").add(sr(o)),t.stop()}))}}class kI extends L{static get requires(){return[Ue]}static get pluginName(){return"TableElementSupport"}init(){let e=this.editor;if(!e.plugins.has("TableEditing"))return;let t=e.model.schema,o=e.conversion,i=e.plugins.get(Ue),r=e.plugins.get("TableUtils");i.on("register:figure",(()=>{o.for("upcast").add((function(s){return a=>{a.on("element:figure",((l,c,d)=>{let u=c.viewItem;if(!c.modelRange||!u.hasClass("table"))return;let h=s.processViewAttributes(u,d);h&&d.writer.setAttribute("htmlFigureAttributes",h,c.modelRange)}),{priority:"low"})}})(i))})),i.on("register:table",((s,a)=>{a.model==="table"&&(t.extend("table",{allowAttributes:["htmlTableAttributes","htmlFigureAttributes","htmlTheadAttributes","htmlTbodyAttributes"]}),o.for("upcast").add((function(l){return c=>{c.on("element:table",((d,u,h)=>{if(!u.modelRange)return;let m=u.viewItem;g(m,"htmlTableAttributes");for(let b of m.getChildren())b.is("element","thead")&&g(b,"htmlTheadAttributes"),b.is("element","tbody")&&g(b,"htmlTbodyAttributes");function g(b,w){let A=l.processViewAttributes(b,h);A&&h.writer.setAttribute(w,A,u.modelRange)}}),{priority:"low"})}})(i)),o.for("downcast").add((l=>{function c(d,u){l.on(`attribute:${u}:table`,((h,m,g)=>{if(!g.consumable.test(m.item,h.name))return;let b=g.mapper.toViewElement(m.item),w=Js(g.writer,b,d);w&&(g.consumable.consume(m.item,h.name),ai(g.writer,m.attributeOldValue,m.attributeNewValue,w))}))}c("table","htmlTableAttributes"),c("figure","htmlFigureAttributes"),c("thead","htmlTheadAttributes"),c("tbody","htmlTbodyAttributes")})),e.model.document.registerPostFixer((function(l,c){return d=>{let u=l.document.differ.getChanges(),h=!1;for(let m of u){if(m.type!="attribute"||m.attributeKey!="headingRows")continue;let g=m.range.start.nodeAfter,b=g.getAttribute("htmlTheadAttributes"),w=g.getAttribute("htmlTbodyAttributes");b&&!m.attributeNewValue?(d.removeAttribute("htmlTheadAttributes",g),h=!0):w&&m.attributeNewValue==c.getRows(g)&&(d.removeAttribute("htmlTbodyAttributes",g),h=!0)}return h}})(e.model,r)),s.stop())}))}}class bI extends L{static get requires(){return[Ue]}static get pluginName(){return"StyleElementSupport"}init(){let e=this.editor.plugins.get(Ue);e.on("register:style",((t,o)=>{let i=this.editor,r=i.model.schema,s=i.conversion;r.register("htmlStyle",o.modelSchema),r.extend("htmlStyle",{allowAttributes:["htmlStyleAttributes","htmlContent"],isContent:!0}),i.data.registerRawContentMatcher({name:"style"}),s.for("upcast").elementToElement({view:"style",model:Wc(o)}),s.for("upcast").add(rr(o,e)),s.for("downcast").elementToElement({model:"htmlStyle",view:(a,{writer:l})=>Qs("style",a,l)}),s.for("downcast").add(sr(o)),t.stop()}))}}class wI extends L{static get requires(){return[Ue]}static get pluginName(){return"ListElementSupport"}init(){let e=this.editor;if(!e.plugins.has("ListEditing"))return;let t=e.model.schema,o=e.conversion,i=e.plugins.get(Ue),r=e.plugins.get("ListEditing"),s=e.plugins.get("ListUtils"),a=["ul","ol","li"];r.registerDowncastStrategy({scope:"item",attributeName:"htmlLiAttributes",setAttributeOnDowncast:oo}),r.registerDowncastStrategy({scope:"list",attributeName:"htmlUlAttributes",setAttributeOnDowncast:oo}),r.registerDowncastStrategy({scope:"list",attributeName:"htmlOlAttributes",setAttributeOnDowncast:oo}),i.on("register",((l,c)=>{if(!a.includes(c.view)||(l.stop(),t.checkAttribute("$block","htmlLiAttributes")))return;let d=a.map((u=>Ot(u)));t.extend("$listItem",{allowAttributes:d}),o.for("upcast").add((u=>{u.on("element:ul",Zc("htmlUlAttributes",i),{priority:"low"}),u.on("element:ol",Zc("htmlOlAttributes",i),{priority:"low"}),u.on("element:li",Zc("htmlLiAttributes",i),{priority:"low"})}))})),r.on("postFixer",((l,{listNodes:c,writer:d})=>{for(let{node:u,previousNodeInList:h}of c)if(h){if(h.getAttribute("listType")==u.getAttribute("listType")){let m=Gw(h.getAttribute("listType")),g=h.getAttribute(m);!Kr(u.getAttribute(m),g)&&d.model.schema.checkAttribute(u,m)&&(d.setAttribute(m,g,u),l.return=!0)}if(h.getAttribute("listItemId")==u.getAttribute("listItemId")){let m=h.getAttribute("htmlLiAttributes");!Kr(u.getAttribute("htmlLiAttributes"),m)&&d.model.schema.checkAttribute(u,"htmlLiAttributes")&&(d.setAttribute("htmlLiAttributes",m,u),l.return=!0)}}})),r.on("postFixer",((l,{listNodes:c,writer:d})=>{for(let{node:u}of c){let h=u.getAttribute("listType");!s.isNumberedListType(h)&&u.getAttribute("htmlOlAttributes")&&(d.removeAttribute("htmlOlAttributes",u),l.return=!0),s.isNumberedListType(h)&&u.getAttribute("htmlUlAttributes")&&(d.removeAttribute("htmlUlAttributes",u),l.return=!0)}}))}afterInit(){let e=this.editor;if(!e.commands.get("indentList"))return;let t=e.commands.get("indentList");this.listenTo(t,"afterExecute",((o,i)=>{e.model.change((r=>{for(let s of i){let a=Gw(s.getAttribute("listType"));e.model.schema.checkAttribute(s,a)&&r.setAttribute(a,{},s)}}))}))}}function Zc(n,e){return(t,o,i)=>{let r=o.viewItem;o.modelRange||Object.assign(o,i.convertChildren(o.viewItem,o.modelCursor));let s=e.processViewAttributes(r,i);for(let a of o.modelRange.getItems({shallow:!0}))a.hasAttribute("listItemId")&&(a.hasAttribute(n)||i.writer.model.schema.checkAttribute(a,n)&&i.writer.setAttribute(n,s||{},a))}}function Gw(n){return n==="numbered"||n=="customNumbered"?"htmlOlAttributes":"htmlUlAttributes"}class _I extends L{static get requires(){return[Ue,Zi]}static get pluginName(){return"CustomElementSupport"}init(){let e=this.editor.plugins.get(Ue),t=this.editor.plugins.get(Zi);e.on("register:$customElement",((o,i)=>{o.stop();let r=this.editor,s=r.model.schema,a=r.conversion,l=r.editing.view.domConverter.unsafeElements,c=r.data.htmlProcessor.domConverter.preElements;s.register(i.model,i.modelSchema),s.extend(i.model,{allowAttributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"],isContent:!0}),r.data.htmlProcessor.domConverter.registerRawContentMatcher({name:"template"}),a.for("upcast").elementToElement({view:/.*/,model:(d,u)=>{if(d.name=="$comment"||!(function(b){try{document.createElement(b)}catch{return!1}return!0})(d.name)||t.getDefinitionsForView(d.name).size)return null;l.includes(d.name)||l.push(d.name),c.includes(d.name)||c.push(d.name);let h=u.writer.createElement(i.model,{htmlElementName:d.name}),m=e.processViewAttributes(d,u),g;if(m&&u.writer.setAttribute("htmlCustomElementAttributes",m,h),d.is("element","template")&&d.getCustomProperty("$rawContent"))g=d.getCustomProperty("$rawContent");else{let b=new Jt(d.document).createDocumentFragment(d),w=r.data.htmlProcessor.domConverter.viewToDom(b),A=w.firstChild;for(;A.firstChild;)w.appendChild(A.firstChild);A.remove(),g=r.data.htmlProcessor.htmlWriter.getHtml(w)}u.writer.setAttribute("htmlContent",g,h);for(let{item:b}of r.editing.view.createRangeIn(d))u.consumable.consume(b,{name:!0});return h},converterPriority:"low"}),a.for("editingDowncast").elementToElement({model:{name:i.model,attributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"]},view:(d,{writer:u})=>{let h=d.getAttribute("htmlElementName"),m=u.createRawElement(h);return d.hasAttribute("htmlCustomElementAttributes")&&oo(u,d.getAttribute("htmlCustomElementAttributes"),m),m}}),a.for("dataDowncast").elementToElement({model:{name:i.model,attributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"]},view:(d,{writer:u})=>{let h=d.getAttribute("htmlElementName"),m=d.getAttribute("htmlContent"),g=u.createRawElement(h,null,((b,w)=>{w.setContentOf(b,m)}));return d.hasAttribute("htmlCustomElementAttributes")&&oo(u,d.getAttribute("htmlCustomElementAttributes"),g),g}})}))}}function*Ki(n,e,t){if(e)if(!(Symbol.iterator in e)&&e.is("documentSelection")&&e.isCollapsed)n.schema.checkAttributeInSelection(e,t)&&(yield e);else for(let o of(function(i,r,s){return!(Symbol.iterator in r)&&(r.is("node")||r.is("$text")||r.is("$textProxy"))?i.schema.checkAttribute(r,s)?[i.createRangeOn(r)]:[]:i.schema.getValidRanges(i.createSelection(r).getRanges(),s)})(n,e,t))yield*o.getItems({shallow:!0})}class AI extends re{refresh(){let e=this.editor,t=e.plugins.get("ImageUtils").getClosestSelectedImageElement(e.model.document.selection);this.isEnabled=!!t,t&&t.hasAttribute("resizedWidth")?this.value={width:t.getAttribute("resizedWidth"),height:null}:this.value=null}execute(e){let t=this.editor,o=t.model,i=t.plugins.get("ImageUtils"),r=i.getClosestSelectedImageElement(o.document.selection);this.value={width:e.width,height:null},r&&o.change((s=>{s.setAttribute("resizedWidth",e.width,r),s.removeAttribute("resizedHeight",r),i.setImageNaturalSizeAttributes(r)}))}}class Zw extends L{static get requires(){return[gt]}static get pluginName(){return"ImageResizeEditing"}constructor(e){super(e),e.config.define("image",{resizeUnit:"%",resizeOptions:[{name:"resizeImage:original",value:null,icon:"original"},{name:"resizeImage:25",value:"25",icon:"small"},{name:"resizeImage:50",value:"50",icon:"medium"},{name:"resizeImage:75",value:"75",icon:"large"}]})}init(){let e=this.editor,t=new AI(e);this._registerConverters("imageBlock"),this._registerConverters("imageInline"),e.commands.add("resizeImage",t),e.commands.add("imageResize",t)}afterInit(){this._registerSchema()}_registerSchema(){this.editor.plugins.has("ImageBlockEditing")&&this.editor.model.schema.extend("imageBlock",{allowAttributes:["resizedWidth","resizedHeight"]}),this.editor.plugins.has("ImageInlineEditing")&&this.editor.model.schema.extend("imageInline",{allowAttributes:["resizedWidth","resizedHeight"]})}_registerConverters(e){let t=this.editor,o=t.plugins.get("ImageUtils");t.conversion.for("downcast").add((i=>i.on(`attribute:resizedWidth:${e}`,((r,s,a)=>{if(!a.consumable.consume(s.item,r.name))return;let l=a.writer,c=a.mapper.toViewElement(s.item);s.attributeNewValue!==null?(l.setStyle("width",s.attributeNewValue,c),l.addClass("image_resized",c)):(l.removeStyle("width",c),l.removeClass("image_resized",c))})))),t.conversion.for("dataDowncast").attributeToAttribute({model:{name:e,key:"resizedHeight"},view:i=>({key:"style",value:{height:i}})}),t.conversion.for("editingDowncast").add((i=>i.on(`attribute:resizedHeight:${e}`,((r,s,a)=>{if(!a.consumable.consume(s.item,r.name))return;let l=a.writer,c=a.mapper.toViewElement(s.item),d=e==="imageInline"?o.findViewImgElement(c):c;s.attributeNewValue!==null?l.setStyle("height",s.attributeNewValue,d):l.removeStyle("height",d)})))),t.conversion.for("upcast").attributeToAttribute({view:{name:e==="imageBlock"?"figure":"img",styles:{width:/.+/}},model:{key:"resizedWidth",value:i=>Ss(i)?null:i.getStyle("width")}}),t.conversion.for("upcast").attributeToAttribute({view:{name:e==="imageBlock"?"figure":"img",styles:{height:/.+/}},model:{key:"resizedHeight",value:i=>Ss(i)?null:i.getStyle("height")}})}}let Kc={small:Y.objectSizeSmall,medium:Y.objectSizeMedium,large:Y.objectSizeLarge,original:Y.objectSizeFull};class CI extends L{static get requires(){return[Zw]}static get pluginName(){return"ImageResizeButtons"}constructor(e){super(e),this._resizeUnit=e.config.get("image.resizeUnit")}init(){let e=this.editor,t=e.config.get("image.resizeOptions"),o=e.commands.get("resizeImage");this.bind("isEnabled").to(o);for(let i of t)this._registerImageResizeButton(i);this._registerImageResizeDropdown(t)}_registerImageResizeButton(e){let t=this.editor,{name:o,value:i,icon:r}=e,s=i?i+this._resizeUnit:null;t.ui.componentFactory.add(o,(a=>{let l=new ne(a),c=t.commands.get("resizeImage"),d=this._getOptionLabelValue(e,!0);if(!Kc[r])throw new y("imageresizebuttons-missing-icon",t,e);return l.set({label:d,icon:Kc[r],tooltip:d,isToggleable:!0}),l.bind("isEnabled").to(this),l.bind("isOn").to(c,"value",Kw(s)),this.listenTo(l,"execute",(()=>{t.execute("resizeImage",{width:s})})),l}))}_registerImageResizeDropdown(e){let t=this.editor,o=t.t,i=e.find((s=>!s.value)),r=s=>{let a=t.commands.get("resizeImage"),l=ot(s,On),c=l.buttonView,d=o("Resize image");return c.set({tooltip:d,commandValue:i.value,icon:Kc.medium,isToggleable:!0,label:this._getOptionLabelValue(i),withText:!0,class:"ck-resize-image-button",ariaLabel:d,ariaLabelledBy:void 0}),c.bind("label").to(a,"value",(u=>u&&u.width?u.width:this._getOptionLabelValue(i))),l.bind("isEnabled").to(this),vo(l,(()=>this._getResizeDropdownListItemDefinitions(e,a)),{ariaLabel:o("Image resize list"),role:"menu"}),this.listenTo(l,"execute",(u=>{t.execute(u.source.commandName,{width:u.source.commandValue}),t.editing.view.focus()})),l};t.ui.componentFactory.add("resizeImage",r),t.ui.componentFactory.add("imageResize",r)}_getOptionLabelValue(e,t=!1){let o=this.editor.t;return e.label?e.label:t?e.value?o("Resize image to %0",e.value+this._resizeUnit):o("Resize image to the original size"):e.value?e.value+this._resizeUnit:o("Original")}_getResizeDropdownListItemDefinitions(e,t){let o=new Je;return e.map((i=>{let r=i.value?i.value+this._resizeUnit:null,s={type:"button",model:new Wo({commandName:"resizeImage",commandValue:r,label:this._getOptionLabelValue(i),role:"menuitemradio",withText:!0,icon:null})};s.model.bind("isOn").to(t,"value",Kw(r)),o.add(s)})),o}}function Kw(n){return e=>n===null&&e===n||e!==null&&e.width===n}let Yc="image_resized";class vI extends L{static get requires(){return[hc,gt]}static get pluginName(){return"ImageResizeHandles"}init(){let e=this.editor.commands.get("resizeImage");this.bind("isEnabled").to(e),this._setupResizerCreator()}_setupResizerCreator(){let e=this.editor,t=e.editing.view,o=e.plugins.get("ImageUtils");t.addObserver(kc),this.listenTo(t.document,"imageLoaded",((i,r)=>{if(!r.target.matches("figure.image.ck-widget > img,figure.image.ck-widget > picture > img,figure.image.ck-widget > a > img,figure.image.ck-widget > a > picture > img,span.image-inline.ck-widget > img,span.image-inline.ck-widget > picture > img"))return;let s=e.editing.view.domConverter,a=s.domToView(r.target),l=o.getImageWidgetFromImageView(a),c=this.editor.plugins.get(hc).getResizerByViewElement(l);if(c)return void c.redraw();let d=e.editing.mapper,u=d.toModelElement(l);c=e.plugins.get(hc).attachTo({unit:e.config.get("image.resizeUnit"),modelElement:u,viewElement:l,editor:e,getHandleHost:h=>h.querySelector("img"),getResizeHost:()=>s.mapViewToDom(d.toViewElement(u.parent)),isCentered:()=>u.getAttribute("imageStyle")=="alignCenter",onCommit(h){t.change((m=>{m.removeClass(Yc,l)})),e.execute("resizeImage",{width:h})}}),c.on("updateSize",(()=>{l.hasClass(Yc)||t.change((m=>{m.addClass(Yc,l)}));let h=u.name==="imageInline"?a:l;h.getStyle("height")&&t.change((m=>{m.removeStyle("height",h)}))})),c.bind("isEnabled").to(this)}))}}var Yw=z(1043),yI={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(Yw.Z,yI),Yw.Z.locals;class xI extends K{constructor(e){super(e),this.set("imageURLInputValue",""),this.set("isImageSelected",!1),this.set("isEnabled",!0),this.focusTracker=new Me,this.keystrokes=new Ve,this._focusables=new et,this.focusCycler=new tt({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.urlInputView=this._createUrlInputView(),this.insertButtonView=this._createInsertButton(),this.cancelButtonView=this._createCancelButton(),this._focusables.addMany([this.urlInputView,this.insertButtonView,this.cancelButtonView]),this.setTemplate({tag:"div",attributes:{class:["ck","ck-image-insert-url"]},children:[this.urlInputView,{tag:"div",attributes:{class:["ck","ck-image-insert-url__action-row"]},children:[this.insertButtonView,this.cancelButtonView]}]})}render(){super.render();for(let e of this._focusables)this.focusTracker.add(e.element);this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createUrlInputView(){let e=this.locale,t=e.t,o=new Ge(e,xt);return o.bind("label").to(this,"isImageSelected",(i=>t(i?"Update image URL":"Insert image via URL"))),o.bind("isEnabled").to(this),o.fieldView.placeholder="https://example.com/image.png",o.fieldView.bind("value").to(this,"imageURLInputValue",(i=>i||"")),o.fieldView.on("input",(()=>{this.imageURLInputValue=o.fieldView.element.value.trim()})),o}_createInsertButton(){let e=this.locale,t=e.t,o=new ne(e);return o.set({icon:Y.check,class:"ck-button-save",type:"submit",withText:!0}),o.bind("label").to(this,"isImageSelected",(i=>t(i?"Update":"Insert"))),o.bind("isEnabled").to(this,"imageURLInputValue",this,"isEnabled",((...i)=>i.every((r=>r)))),o.delegate("execute").to(this,"submit"),o}_createCancelButton(){let e=this.locale,t=e.t,o=new ne(e);return o.set({label:t("Cancel"),icon:Y.cancel,class:"ck-button-cancel",withText:!0}),o.bind("isEnabled").to(this),o.delegate("execute").to(this,"cancel"),o}focus(e){e===-1?this.focusCycler.focusLast():this.focusCycler.focusFirst()}}class li extends re{constructor(e,t){super(e),this.attributeKey=t}refresh(){let e=this.editor.model,t=e.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,this.attributeKey)}execute(e={}){let t=this.editor.model,o=t.document.selection,i=e.forceValue===void 0?!this.value:e.forceValue;t.change((r=>{if(o.isCollapsed)i?r.setSelectionAttribute(this.attributeKey,!0):r.removeSelectionAttribute(this.attributeKey);else{let s=t.schema.getValidRanges(o.getRanges(),this.attributeKey);for(let a of s)i?r.setAttribute(this.attributeKey,i,a):r.removeAttribute(this.attributeKey,a)}}))}_getValueFromFirstAllowedNode(){let e=this.editor.model,t=e.schema,o=e.document.selection;if(o.isCollapsed)return o.hasAttribute(this.attributeKey);for(let i of o.getRanges())for(let r of i.getItems())if(t.checkAttribute(r,this.attributeKey))return r.hasAttribute(this.attributeKey);return!1}}let Yi="bold";class EI extends L{static get pluginName(){return"BoldEditing"}init(){let e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:Yi}),e.model.schema.setAttributeProperties(Yi,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:Yi,view:"strong",upcastAlso:["b",o=>{let i=o.getStyle("font-weight");return i&&(i=="bold"||Number(i)>=600)?{name:!0,styles:["font-weight"]}:null}]}),e.commands.add(Yi,new li(e,Yi)),e.keystrokes.set("CTRL+B",Yi),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Bold text"),keystroke:"CTRL+B"}]})}}function ci({editor:n,commandName:e,plugin:t,icon:o,label:i,keystroke:r}){return s=>{let a=n.commands.get(e),l=new s(n.locale);return l.set({label:i,icon:o,keystroke:r,isToggleable:!0}),l.bind("isEnabled").to(a,"isEnabled"),t.listenTo(l,"execute",(()=>{n.execute(e),n.editing.view.focus()})),l}}let Xs="bold";class DI extends L{static get pluginName(){return"BoldUI"}init(){let e=this.editor,t=e.locale.t,o=e.commands.get(Xs),i=ci({editor:e,commandName:Xs,plugin:this,icon:Y.bold,label:t("Bold"),keystroke:"CTRL+B"});e.ui.componentFactory.add(Xs,(()=>{let r=i(ne);return r.set({tooltip:!0}),r.bind("isOn").to(o,"value"),r})),e.ui.componentFactory.add("menuBar:"+Xs,(()=>i(Pe)))}}class Qw extends L{static get requires(){return[EI,DI]}static get pluginName(){return"Bold"}}let di="code";class TI extends L{static get pluginName(){return"CodeEditing"}static get requires(){return[bs]}init(){let e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:di}),e.model.schema.setAttributeProperties(di,{isFormatting:!0,copyOnEnter:!1}),e.conversion.attributeToElement({model:di,view:"code",upcastAlso:{styles:{"word-wrap":"break-word"}}}),e.commands.add(di,new li(e,di)),e.plugins.get(bs).registerAttribute(di),Zp(e,di,"code","ck-code_selected"),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Move out of an inline code style"),keystroke:[["arrowleft","arrowleft"],["arrowright","arrowright"]]}]})}}var Jw=z(8180),SI={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(Jw.Z,SI),Jw.Z.locals;let ea="code";class II extends L{static get pluginName(){return"CodeUI"}init(){let e=this.editor,t=e.locale.t,o=ci({editor:e,commandName:ea,plugin:this,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m12.5 5.7 5.2 3.9v1.3l-5.6 4c-.1.2-.3.2-.5.2-.3-.1-.6-.7-.6-1l.3-.4 4.7-3.5L11.5 7l-.2-.2c-.1-.3-.1-.6 0-.8.2-.2.5-.4.8-.4a.8.8 0 0 1 .4.1zm-5.2 0L2 9.6v1.3l5.6 4c.1.2.3.2.5.2.3-.1.7-.7.6-1 0-.1 0-.3-.2-.4l-5-3.5L8.2 7l.2-.2c.1-.3.1-.6 0-.8-.2-.2-.5-.4-.8-.4a.8.8 0 0 0-.3.1z"/></svg>',label:t("Code")});e.ui.componentFactory.add(ea,(()=>{let i=o(ne),r=e.commands.get(ea);return i.set({tooltip:!0}),i.bind("isOn").to(r,"value"),i})),e.ui.componentFactory.add("menuBar:"+ea,(()=>o(Pe)))}}let Qi="italic";class BI extends L{static get pluginName(){return"ItalicEditing"}init(){let e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:Qi}),e.model.schema.setAttributeProperties(Qi,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:Qi,view:"i",upcastAlso:["em",{styles:{"font-style":"italic"}}]}),e.commands.add(Qi,new li(e,Qi)),e.keystrokes.set("CTRL+I",Qi),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Italic text"),keystroke:"CTRL+I"}]})}}let ta="italic";class MI extends L{static get pluginName(){return"ItalicUI"}init(){let e=this.editor,t=e.commands.get(ta),o=e.locale.t,i=ci({editor:e,commandName:ta,plugin:this,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m9.586 14.633.021.004c-.036.335.095.655.393.962.082.083.173.15.274.201h1.474a.6.6 0 1 1 0 1.2H5.304a.6.6 0 0 1 0-1.2h1.15c.474-.07.809-.182 1.005-.334.157-.122.291-.32.404-.597l2.416-9.55a1.053 1.053 0 0 0-.281-.823 1.12 1.12 0 0 0-.442-.296H8.15a.6.6 0 0 1 0-1.2h6.443a.6.6 0 1 1 0 1.2h-1.195c-.376.056-.65.155-.823.296-.215.175-.423.439-.623.79l-2.366 9.347z"/></svg>',keystroke:"CTRL+I",label:o("Italic")});e.ui.componentFactory.add(ta,(()=>{let r=i(ne);return r.set({tooltip:!0}),r.bind("isOn").to(t,"value"),r})),e.ui.componentFactory.add("menuBar:"+ta,(()=>i(Pe)))}}class Xw extends L{static get requires(){return[BI,MI]}static get pluginName(){return"Italic"}}let ar="strikethrough";class NI extends L{static get pluginName(){return"StrikethroughEditing"}init(){let e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:ar}),e.model.schema.setAttributeProperties(ar,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:ar,view:"s",upcastAlso:["del","strike",{styles:{"text-decoration":"line-through"}}]}),e.commands.add(ar,new li(e,ar)),e.keystrokes.set("CTRL+SHIFT+X","strikethrough"),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Strikethrough text"),keystroke:"CTRL+SHIFT+X"}]})}}let oa="strikethrough";class PI extends L{static get pluginName(){return"StrikethroughUI"}init(){let e=this.editor,t=e.locale.t,o=ci({editor:e,commandName:oa,plugin:this,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M7 16.4c-.8-.4-1.5-.9-2.2-1.5a.6.6 0 0 1-.2-.5l.3-.6h1c1 1.2 2.1 1.7 3.7 1.7 1 0 1.8-.3 2.3-.6.6-.4.6-1.2.6-1.3.2-1.2-.9-2.1-.9-2.1h2.1c.3.7.4 1.2.4 1.7v.8l-.6 1.2c-.6.8-1.1 1-1.6 1.2a6 6 0 0 1-2.4.6c-1 0-1.8-.3-2.5-.6zM6.8 9 6 8.3c-.4-.5-.5-.8-.5-1.6 0-.7.1-1.3.5-1.8.4-.6 1-1 1.6-1.3a6.3 6.3 0 0 1 4.7 0 4 4 0 0 1 1.7 1l.3.7c0 .1.2.4-.2.7-.4.2-.9.1-1 0a3 3 0 0 0-1.2-1c-.4-.2-1-.3-2-.4-.7 0-1.4.2-2 .6-.8.6-1 .8-1 1.5 0 .8.5 1 1.2 1.5.6.4 1.1.7 1.9 1H6.8z"/><path d="M3 10.5V9h14v1.5z"/></svg>',keystroke:"CTRL+SHIFT+X",label:t("Strikethrough")});e.ui.componentFactory.add(oa,(()=>{let i=o(ne),r=e.commands.get(oa);return i.set({tooltip:!0}),i.bind("isOn").to(r,"value"),i})),e.ui.componentFactory.add("menuBar:"+oa,(()=>o(Pe)))}}let lr="subscript";class LI extends L{static get pluginName(){return"SubscriptEditing"}init(){let e=this.editor;e.model.schema.extend("$text",{allowAttributes:lr}),e.model.schema.setAttributeProperties(lr,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:lr,view:"sub",upcastAlso:[{styles:{"vertical-align":"sub"}}]}),e.commands.add(lr,new li(e,lr))}}let ia="subscript";class zI extends L{static get pluginName(){return"SubscriptUI"}init(){let e=this.editor,t=e.locale.t,o=ci({editor:e,commandName:ia,plugin:this,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m7.03 10.349 3.818-3.819a.8.8 0 1 1 1.132 1.132L8.16 11.48l3.819 3.818a.8.8 0 1 1-1.132 1.132L7.03 12.61l-3.818 3.82a.8.8 0 1 1-1.132-1.132L5.9 11.48 2.08 7.662A.8.8 0 1 1 3.212 6.53l3.818 3.82zm8.147 7.829h2.549c.254 0 .447.05.58.152a.49.49 0 0 1 .201.413.54.54 0 0 1-.159.393c-.105.108-.266.162-.48.162h-3.594c-.245 0-.435-.066-.572-.197a.621.621 0 0 1-.205-.463c0-.114.044-.265.132-.453a1.62 1.62 0 0 1 .288-.444c.433-.436.824-.81 1.172-1.122.348-.312.597-.517.747-.615.267-.183.49-.368.667-.553.177-.185.312-.375.405-.57.093-.194.139-.384.139-.57a1.008 1.008 0 0 0-.554-.917 1.197 1.197 0 0 0-.56-.133c-.426 0-.761.182-1.005.546a2.332 2.332 0 0 0-.164.39 1.609 1.609 0 0 1-.258.488c-.096.114-.237.17-.423.17a.558.558 0 0 1-.405-.156.568.568 0 0 1-.161-.427c0-.218.05-.446.151-.683.101-.238.252-.453.452-.646s.454-.349.762-.467a2.998 2.998 0 0 1 1.081-.178c.498 0 .923.076 1.274.228a1.916 1.916 0 0 1 1.004 1.032 1.984 1.984 0 0 1-.156 1.794c-.2.32-.405.572-.613.754-.208.182-.558.468-1.048.857-.49.39-.826.691-1.008.906a2.703 2.703 0 0 0-.24.309z"/></svg>',label:t("Subscript")});e.ui.componentFactory.add(ia,(()=>{let i=o(ne),r=e.commands.get(ia);return i.set({tooltip:!0}),i.bind("isOn").to(r,"value"),i})),e.ui.componentFactory.add("menuBar:"+ia,(()=>o(Pe)))}}let cr="superscript";class OI extends L{static get pluginName(){return"SuperscriptEditing"}init(){let e=this.editor;e.model.schema.extend("$text",{allowAttributes:cr}),e.model.schema.setAttributeProperties(cr,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:cr,view:"sup",upcastAlso:[{styles:{"vertical-align":"super"}}]}),e.commands.add(cr,new li(e,cr))}}let na="superscript";class RI extends L{static get pluginName(){return"SuperscriptUI"}init(){let e=this.editor,t=e.locale.t,o=ci({editor:e,commandName:na,plugin:this,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M15.677 8.678h2.549c.254 0 .447.05.58.152a.49.49 0 0 1 .201.413.54.54 0 0 1-.159.393c-.105.108-.266.162-.48.162h-3.594c-.245 0-.435-.066-.572-.197a.621.621 0 0 1-.205-.463c0-.114.044-.265.132-.453a1.62 1.62 0 0 1 .288-.444c.433-.436.824-.81 1.172-1.122.348-.312.597-.517.747-.615.267-.183.49-.368.667-.553.177-.185.312-.375.405-.57.093-.194.139-.384.139-.57a1.008 1.008 0 0 0-.554-.917 1.197 1.197 0 0 0-.56-.133c-.426 0-.761.182-1.005.546a2.332 2.332 0 0 0-.164.39 1.609 1.609 0 0 1-.258.488c-.096.114-.237.17-.423.17a.558.558 0 0 1-.405-.156.568.568 0 0 1-.161-.427c0-.218.05-.446.151-.683.101-.238.252-.453.452-.646s.454-.349.762-.467a2.998 2.998 0 0 1 1.081-.178c.498 0 .923.076 1.274.228a1.916 1.916 0 0 1 1.004 1.032 1.984 1.984 0 0 1-.156 1.794c-.2.32-.405.572-.613.754-.208.182-.558.468-1.048.857-.49.39-.826.691-1.008.906a2.703 2.703 0 0 0-.24.309zM7.03 10.349l3.818-3.819a.8.8 0 1 1 1.132 1.132L8.16 11.48l3.819 3.818a.8.8 0 1 1-1.132 1.132L7.03 12.61l-3.818 3.82a.8.8 0 1 1-1.132-1.132L5.9 11.48 2.08 7.662A.8.8 0 1 1 3.212 6.53l3.818 3.82z"/></svg>',label:t("Superscript")});e.ui.componentFactory.add(na,(()=>{let i=o(ne),r=e.commands.get(na);return i.set({tooltip:!0}),i.bind("isOn").to(r,"value"),i})),e.ui.componentFactory.add("menuBar:"+na,(()=>o(Pe)))}}let dr="underline";class FI extends L{static get pluginName(){return"UnderlineEditing"}init(){let e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:dr}),e.model.schema.setAttributeProperties(dr,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:dr,view:"u",upcastAlso:{styles:{"text-decoration":"underline"}}}),e.commands.add(dr,new li(e,dr)),e.keystrokes.set("CTRL+U","underline"),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Underline text"),keystroke:"CTRL+U"}]})}}let ra="underline";class VI extends L{static get pluginName(){return"UnderlineUI"}init(){let e=this.editor,t=e.commands.get(ra),o=e.locale.t,i=ci({editor:e,commandName:ra,plugin:this,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 18v-1.5h14V18zm2.2-8V3.6c0-.4.4-.6.8-.6.3 0 .7.2.7.6v6.2c0 2 1.3 2.8 3.2 2.8 1.9 0 3.4-.9 3.4-2.9V3.6c0-.3.4-.5.8-.5.3 0 .7.2.7.5V10c0 2.7-2.2 4-4.9 4-2.6 0-4.7-1.2-4.7-4z"/></svg>',label:o("Underline"),keystroke:"CTRL+U"});e.ui.componentFactory.add(ra,(()=>{let r=i(ne);return r.set({tooltip:!0}),r.bind("isOn").to(t,"value"),r})),e.ui.componentFactory.add("menuBar:"+ra,(()=>i(Pe)))}}class jI{constructor(){this._definitions=new Set}get length(){return this._definitions.size}add(e){Array.isArray(e)?e.forEach((t=>this._definitions.add(t))):this._definitions.add(e)}getDispatcher(){return e=>{e.on("attribute:linkHref",((t,o,i)=>{if(!i.consumable.test(o.item,"attribute:linkHref")||!o.item.is("selection")&&!i.schema.isInline(o.item))return;let r=i.writer,s=r.document.selection;for(let a of this._definitions){let l=r.createAttributeElement("a",a.attributes,{priority:5});a.classes&&r.addClass(a.classes,l);for(let c in a.styles)r.setStyle(c,a.styles[c],l);r.setCustomProperty("link",!0,l),a.callback(o.attributeNewValue)?o.item.is("selection")?r.wrap(s.getFirstRange(),l):r.wrap(i.mapper.toViewRange(o.range),l):r.unwrap(i.mapper.toViewRange(o.range),l)}}),{priority:"high"})}}getDispatcherForLinkedImage(){return e=>{e.on("attribute:linkHref:imageBlock",((t,o,{writer:i,mapper:r})=>{let s=r.toViewElement(o.item),a=Array.from(s.getChildren()).find((l=>l.is("element","a")));for(let l of this._definitions){let c=Gt(l.attributes);if(l.callback(o.attributeNewValue)){for(let[d,u]of c)d==="class"?i.addClass(u,a):i.setAttribute(d,u,a);l.classes&&i.addClass(l.classes,a);for(let d in l.styles)i.setStyle(d,l.styles[d],a)}else{for(let[d,u]of c)d==="class"?i.removeClass(u,a):i.removeAttribute(d,a);l.classes&&i.removeClass(l.classes,a);for(let d in l.styles)i.removeStyle(d,a)}}}))}}}let HI=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,UI=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,$I=/^((\w+:(\/{2,})?)|(\W))/i,qI=["https?","ftps?","mailto"],sa="Ctrl+K";function e0(n,{writer:e}){let t=e.createAttributeElement("a",{href:n},{priority:5});return e.setCustomProperty("link",!0,t),t}function t0(n,e=qI){let t=String(n),o=e.join("|");return(function(i,r){return!!i.replace(HI,"").match(r)})(t,new RegExp(`${"^(?:(?:<protocols>):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))".replace("<protocols>",o)}`,"i"))?t:"#"}function Qc(n,e){return!!n&&e.checkAttribute(n.name,"linkHref")}function Jc(n,e){let t=(o=n,UI.test(o)?"mailto:":e);var o;let i=!!t&&!o0(n);return n&&i?t+n:n}function o0(n){return $I.test(n)}function i0(n){window.open(n,"_blank","noopener")}class WI extends re{constructor(){super(...arguments),this.manualDecorators=new Je,this.automaticDecorators=new jI}restoreManualDecoratorStates(){for(let e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}refresh(){let e=this.editor.model,t=e.document.selection,o=t.getSelectedElement()||Be(t.getSelectedBlocks());Qc(o,e.schema)?(this.value=o.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttribute(o,"linkHref")):(this.value=t.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref"));for(let i of this.manualDecorators)i.value=this._getDecoratorStateFromModel(i.id)}execute(e,t={}){let o=this.editor.model,i=o.document.selection,r=[],s=[];for(let a in t)t[a]?r.push(a):s.push(a);o.change((a=>{if(i.isCollapsed){let l=i.getFirstPosition();if(i.hasAttribute("linkHref")){let c=n0(i),d=_s(l,"linkHref",i.getAttribute("linkHref"),o);i.getAttribute("linkHref")===c&&(d=this._updateLinkContent(o,a,d,e)),a.setAttribute("linkHref",e,d),r.forEach((u=>{a.setAttribute(u,!0,d)})),s.forEach((u=>{a.removeAttribute(u,d)})),a.setSelection(a.createPositionAfter(d.end.nodeBefore))}else if(e!==""){let c=Gt(i.getAttributes());c.set("linkHref",e),r.forEach((u=>{c.set(u,!0)}));let{end:d}=o.insertContent(a.createText(e,c),l);a.setSelection(d)}["linkHref",...r,...s].forEach((c=>{a.removeSelectionAttribute(c)}))}else{let l=o.schema.getValidRanges(i.getRanges(),"linkHref"),c=[];for(let u of i.getSelectedBlocks())o.schema.checkAttribute(u,"linkHref")&&c.push(a.createRangeOn(u));let d=c.slice();for(let u of l)this._isRangeToUpdate(u,c)&&d.push(u);for(let u of d){let h=u;if(d.length===1){let m=n0(i);i.getAttribute("linkHref")===m&&(h=this._updateLinkContent(o,a,u,e),a.setSelection(a.createSelection(h)))}a.setAttribute("linkHref",e,h),r.forEach((m=>{a.setAttribute(m,!0,h)})),s.forEach((m=>{a.removeAttribute(m,h)}))}}}))}_getDecoratorStateFromModel(e){let t=this.editor.model,o=t.document.selection,i=o.getSelectedElement();return Qc(i,t.schema)?i.getAttribute(e):o.getAttribute(e)}_isRangeToUpdate(e,t){for(let o of t)if(o.containsRange(e))return!1;return!0}_updateLinkContent(e,t,o,i){let r=t.createText(i,{linkHref:i});return e.insertContent(r,o)}}function n0(n){if(n.isCollapsed){let e=n.getFirstPosition();return e.textNode&&e.textNode.data}{let e=Array.from(n.getFirstRange().getItems());if(e.length>1)return null;let t=e[0];return t.is("$text")||t.is("$textProxy")?t.data:null}}class GI extends re{refresh(){let e=this.editor.model,t=e.document.selection,o=t.getSelectedElement();Qc(o,e.schema)?this.isEnabled=e.schema.checkAttribute(o,"linkHref"):this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref")}execute(){let e=this.editor,t=this.editor.model,o=t.document.selection,i=e.commands.get("link");t.change((r=>{let s=o.isCollapsed?[_s(o.getFirstPosition(),"linkHref",o.getAttribute("linkHref"),t)]:t.schema.getValidRanges(o.getRanges(),"linkHref");for(let a of s)if(r.removeAttribute("linkHref",a),i)for(let l of i.manualDecorators)r.removeAttribute(l.id,a)}))}}class ZI extends we(){constructor({id:e,label:t,attributes:o,classes:i,styles:r,defaultValue:s}){super(),this.id=e,this.set("value",void 0),this.defaultValue=s,this.label=t,this.attributes=o,this.classes=i,this.styles=r}_createPattern(){return{attributes:this.attributes,classes:this.classes,styles:this.styles}}}var r0=z(399),KI={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(r0.Z,KI),r0.Z.locals;let s0="automatic",YI=/^(https?:)?\/\//;class a0 extends L{static get pluginName(){return"LinkEditing"}static get requires(){return[bs,Rp,Lt]}constructor(e){super(e),e.config.define("link",{allowCreatingEmptyLinks:!1,addTargetToExternalLinks:!1})}init(){let e=this.editor,t=this.editor.config.get("link.allowedProtocols");e.model.schema.extend("$text",{allowAttributes:"linkHref"}),e.conversion.for("dataDowncast").attributeToElement({model:"linkHref",view:e0}),e.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(i,r)=>e0(t0(i,t),r)}),e.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:i=>i.getAttribute("href")}}),e.commands.add("link",new WI(e)),e.commands.add("unlink",new GI(e));let o=(function(i,r){let s={"Open in a new tab":i("Open in a new tab"),Downloadable:i("Downloadable")};return r.forEach((a=>("label"in a&&s[a.label]&&(a.label=s[a.label]),a))),r})(e.t,(function(i){let r=[];if(i)for(let[s,a]of Object.entries(i)){let l=Object.assign({},a,{id:`link${Hw(s)}`});r.push(l)}return r})(e.config.get("link.decorators")));this._enableAutomaticDecorators(o.filter((i=>i.mode===s0))),this._enableManualDecorators(o.filter((i=>i.mode==="manual"))),e.plugins.get(bs).registerAttribute("linkHref"),Zp(e,"linkHref","a","ck-link_selected"),this._enableLinkOpen(),this._enableSelectionAttributesFixer(),this._enableClipboardIntegration()}_enableAutomaticDecorators(e){let t=this.editor,o=t.commands.get("link").automaticDecorators;t.config.get("link.addTargetToExternalLinks")&&o.add({id:"linkIsExternal",mode:s0,callback:i=>!!i&&YI.test(i),attributes:{target:"_blank",rel:"noopener noreferrer"}}),o.add(e),o.length&&t.conversion.for("downcast").add(o.getDispatcher())}_enableManualDecorators(e){if(!e.length)return;let t=this.editor,o=t.commands.get("link").manualDecorators;e.forEach((i=>{t.model.schema.extend("$text",{allowAttributes:i.id});let r=new ZI(i);o.add(r),t.conversion.for("downcast").attributeToElement({model:r.id,view:(s,{writer:a,schema:l},{item:c})=>{if((c.is("selection")||l.isInline(c))&&s){let d=a.createAttributeElement("a",r.attributes,{priority:5});r.classes&&a.addClass(r.classes,d);for(let u in r.styles)a.setStyle(u,r.styles[u],d);return a.setCustomProperty("link",!0,d),d}}}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",...r._createPattern()},model:{key:r.id}})}))}_enableLinkOpen(){let e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",((o,i)=>{if(!(k.isMac?i.domEvent.metaKey:i.domEvent.ctrlKey))return;let r=i.domTarget;if(r.tagName.toLowerCase()!="a"&&(r=r.closest("a")),!r)return;let s=r.getAttribute("href");s&&(o.stop(),i.preventDefault(),i0(s))}),{context:"$capture"}),this.listenTo(t,"keydown",((o,i)=>{let r=e.commands.get("link").value;r&&i.keyCode===me.enter&&i.altKey&&(o.stop(),i0(r))}))}_enableSelectionAttributesFixer(){let e=this.editor.model,t=e.document.selection;this.listenTo(t,"change:attribute",((o,{attributeKeys:i})=>{i.includes("linkHref")&&!t.hasAttribute("linkHref")&&e.change((r=>{var s;(function(a,l){a.removeSelectionAttribute("linkHref");for(let c of l)a.removeSelectionAttribute(c)})(r,(s=e.schema,s.getDefinition("$text").allowAttributes.filter((a=>a.startsWith("link")))))}))}))}_enableClipboardIntegration(){let e=this.editor,t=e.model,o=this.editor.config.get("link.defaultProtocol");o&&this.listenTo(e.plugins.get("ClipboardPipeline"),"contentInsertion",((i,r)=>{t.change((s=>{let a=s.createRangeIn(r.content);for(let l of a.getItems())if(l.hasAttribute("linkHref")){let c=Jc(l.getAttribute("linkHref"),o);s.setAttribute("linkHref",c,l)}}))}))}}var l0=z(4827),QI={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(l0.Z,QI),l0.Z.locals;class JI extends K{constructor(e,t){super(e),this.focusTracker=new Me,this.keystrokes=new Ve,this._focusables=new et;let o=e.t;this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(o("Save"),Y.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(o("Cancel"),Y.cancel,"ck-button-cancel","cancel"),this._manualDecoratorSwitches=this._createManualDecoratorSwitches(t),this.children=this._createFormChildren(t.manualDecorators),this._focusCycler=new tt({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});let i=["ck","ck-link-form","ck-responsive-form"];t.manualDecorators.length&&i.push("ck-link-form_layout-vertical","ck-vertical-form"),this.setTemplate({tag:"form",attributes:{class:i,tabindex:"-1"},children:this.children})}getDecoratorSwitchesState(){return Array.from(this._manualDecoratorSwitches).reduce(((e,t)=>(e[t.name]=t.isOn,e)),{})}render(){super.render(),p({view:this}),[this.urlInputView,...this._manualDecoratorSwitches,this.saveButtonView,this.cancelButtonView].forEach((e=>{this._focusables.add(e),this.focusTracker.add(e.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createUrlInput(){let e=this.locale.t,t=new Ge(this.locale,xt);return t.label=e("Link URL"),t}_createButton(e,t,o,i){let r=new ne(this.locale);return r.set({label:e,icon:t,tooltip:!0}),r.extendTemplate({attributes:{class:o}}),i&&r.delegate("execute").to(this,i),r}_createManualDecoratorSwitches(e){let t=this.createCollection();for(let o of e.manualDecorators){let i=new rs(this.locale);i.set({name:o.id,label:o.label,withText:!0}),i.bind("isOn").toMany([o,e],"value",((r,s)=>s===void 0&&r===void 0?!!o.defaultValue:!!r)),i.on("execute",(()=>{o.set("value",!i.isOn)})),t.add(i)}return t}_createFormChildren(e){let t=this.createCollection();if(t.add(this.urlInputView),e.length){let o=new K;o.setTemplate({tag:"ul",children:this._manualDecoratorSwitches.map((i=>({tag:"li",children:[i],attributes:{class:["ck","ck-list__item"]}}))),attributes:{class:["ck","ck-reset","ck-list"]}}),t.add(o)}return t.add(this.saveButtonView),t.add(this.cancelButtonView),t}}var c0=z(9465),XI={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(c0.Z,XI),c0.Z.locals;class eB extends K{constructor(e,t={}){super(e),this.focusTracker=new Me,this.keystrokes=new Ve,this._focusables=new et;let o=e.t;this.previewButtonView=this._createPreviewButton(),this.unlinkButtonView=this._createButton(o("Unlink"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.077 15 .991-1.416a.75.75 0 1 1 1.229.86l-1.148 1.64a.748.748 0 0 1-.217.206 5.251 5.251 0 0 1-8.503-5.955.741.741 0 0 1 .12-.274l1.147-1.639a.75.75 0 1 1 1.228.86L4.933 10.7l.006.003a3.75 3.75 0 0 0 6.132 4.294l.006.004zm5.494-5.335a.748.748 0 0 1-.12.274l-1.147 1.639a.75.75 0 1 1-1.228-.86l.86-1.23a3.75 3.75 0 0 0-6.144-4.301l-.86 1.229a.75.75 0 0 1-1.229-.86l1.148-1.64a.748.748 0 0 1 .217-.206 5.251 5.251 0 0 1 8.503 5.955zm-4.563-2.532a.75.75 0 0 1 .184 1.045l-3.155 4.505a.75.75 0 1 1-1.229-.86l3.155-4.506a.75.75 0 0 1 1.045-.184zm4.919 10.562-1.414 1.414a.75.75 0 1 1-1.06-1.06l1.414-1.415-1.415-1.414a.75.75 0 0 1 1.061-1.06l1.414 1.414 1.414-1.415a.75.75 0 0 1 1.061 1.061l-1.414 1.414 1.414 1.415a.75.75 0 0 1-1.06 1.06l-1.415-1.414z"/></svg>',"unlink"),this.editButtonView=this._createButton(o("Edit link"),Y.pencil,"edit"),this.set("href",void 0),this._linkConfig=t,this._focusCycler=new tt({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-link-actions","ck-responsive-form"],tabindex:"-1"},children:[this.previewButtonView,this.editButtonView,this.unlinkButtonView]})}render(){super.render(),[this.previewButtonView,this.editButtonView,this.unlinkButtonView].forEach((e=>{this._focusables.add(e),this.focusTracker.add(e.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createButton(e,t,o){let i=new ne(this.locale);return i.set({label:e,icon:t,tooltip:!0}),i.delegate("execute").to(this,o),i}_createPreviewButton(){let e=new ne(this.locale),t=this.bindTemplate,o=this.t;return e.set({withText:!0,tooltip:o("Open link in new tab")}),e.extendTemplate({attributes:{class:["ck","ck-link-actions__preview"],href:t.to("href",(i=>i&&t0(i,this._linkConfig.allowedProtocols))),target:"_blank",rel:"noopener noreferrer"}}),e.bind("label").to(this,"href",(i=>i||o("This link has no URL"))),e.bind("isEnabled").to(this,"href",(i=>!!i)),e.template.tag="a",e.template.eventListeners={},e}}let io="link-ui";class tB extends L{constructor(){super(...arguments),this.actionsView=null,this.formView=null}static get requires(){return[Xt]}static get pluginName(){return"LinkUI"}init(){let e=this.editor,t=this.editor.t;e.editing.view.addObserver(Xy),this._balloon=e.plugins.get(Xt),this._createToolbarLinkButton(),this._enableBalloonActivators(),e.conversion.for("editingDowncast").markerToHighlight({model:io,view:{classes:["ck-fake-link-selection"]}}),e.conversion.for("editingDowncast").markerToElement({model:io,view:{name:"span",classes:["ck-fake-link-selection","ck-fake-link-selection_collapsed"]}}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Create link"),keystroke:sa},{label:t("Move out of a link"),keystroke:[["arrowleft","arrowleft"],["arrowright","arrowright"]]}]})}destroy(){super.destroy(),this.formView&&this.formView.destroy(),this.actionsView&&this.actionsView.destroy()}_createViews(){this.actionsView=this._createActionsView(),this.formView=this._createFormView(),this._enableUserBalloonInteractions()}_createActionsView(){let e=this.editor,t=new eB(e.locale,e.config.get("link")),o=e.commands.get("link"),i=e.commands.get("unlink");return t.bind("href").to(o,"value"),t.editButtonView.bind("isEnabled").to(o),t.unlinkButtonView.bind("isEnabled").to(i),this.listenTo(t,"edit",(()=>{this._addFormView()})),this.listenTo(t,"unlink",(()=>{e.execute("unlink"),this._hideUI()})),t.keystrokes.set("Esc",((r,s)=>{this._hideUI(),s()})),t.keystrokes.set(sa,((r,s)=>{this._addFormView(),s()})),t}_createFormView(){let e=this.editor,t=e.commands.get("link"),o=e.config.get("link.defaultProtocol"),i=e.config.get("link.allowCreatingEmptyLinks"),r=new(T(JI))(e.locale,t);return r.urlInputView.fieldView.bind("value").to(t,"value"),r.urlInputView.bind("isEnabled").to(t,"isEnabled"),r.saveButtonView.bind("isEnabled").to(t,"isEnabled",r.urlInputView,"isEmpty",((s,a)=>s&&(i||!a))),this.listenTo(r,"submit",(()=>{let{value:s}=r.urlInputView.fieldView.element,a=Jc(s,o);e.execute("link",a,r.getDecoratorSwitchesState()),this._closeFormView()})),this.listenTo(r,"cancel",(()=>{this._closeFormView()})),r.keystrokes.set("Esc",((s,a)=>{this._closeFormView(),a()})),r}_createToolbarLinkButton(){let e=this.editor,t=e.commands.get("link");e.ui.componentFactory.add("link",(()=>{let o=this._createButton(ne);return o.set({tooltip:!0,isToggleable:!0}),o.bind("isOn").to(t,"value",(i=>!!i)),o})),e.ui.componentFactory.add("menuBar:link",(()=>this._createButton(Pe)))}_createButton(e){let t=this.editor,o=t.locale,i=t.commands.get("link"),r=new e(t.locale),s=o.t;return r.set({label:s("Link"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.077 15 .991-1.416a.75.75 0 1 1 1.229.86l-1.148 1.64a.748.748 0 0 1-.217.206 5.251 5.251 0 0 1-8.503-5.955.741.741 0 0 1 .12-.274l1.147-1.639a.75.75 0 1 1 1.228.86L4.933 10.7l.006.003a3.75 3.75 0 0 0 6.132 4.294l.006.004zm5.494-5.335a.748.748 0 0 1-.12.274l-1.147 1.639a.75.75 0 1 1-1.228-.86l.86-1.23a3.75 3.75 0 0 0-6.144-4.301l-.86 1.229a.75.75 0 0 1-1.229-.86l1.148-1.64a.748.748 0 0 1 .217-.206 5.251 5.251 0 0 1 8.503 5.955zm-4.563-2.532a.75.75 0 0 1 .184 1.045l-3.155 4.505a.75.75 0 1 1-1.229-.86l3.155-4.506a.75.75 0 0 1 1.045-.184z"/></svg>',keystroke:sa}),r.bind("isEnabled").to(i,"isEnabled"),this.listenTo(r,"execute",(()=>this._showUI(!0))),r}_enableBalloonActivators(){let e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",(()=>{this._getSelectedLinkElement()&&this._showUI()})),e.keystrokes.set(sa,((o,i)=>{i(),e.commands.get("link").isEnabled&&this._showUI(!0)}))}_enableUserBalloonInteractions(){this.editor.keystrokes.set("Tab",((e,t)=>{this._areActionsVisible&&!this.actionsView.focusTracker.isFocused&&(this.actionsView.focus(),t())}),{priority:"high"}),this.editor.keystrokes.set("Esc",((e,t)=>{this._isUIVisible&&(this._hideUI(),t())})),v({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideUI()})}_addActionsView(){this.actionsView||this._createViews(),this._areActionsInPanel||this._balloon.add({view:this.actionsView,position:this._getBalloonPositionData()})}_addFormView(){if(this.formView||this._createViews(),this._isFormInPanel)return;let e=this.editor.commands.get("link");this.formView.disableCssTransitions(),this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this.formView.urlInputView.fieldView.value=e.value||"",this._balloon.visibleView===this.formView&&this.formView.urlInputView.fieldView.select(),this.formView.enableCssTransitions()}_closeFormView(){let e=this.editor.commands.get("link");e.restoreManualDecoratorStates(),e.value!==void 0?this._removeFormView():this._hideUI()}_removeFormView(){this._isFormInPanel&&(this.formView.saveButtonView.focus(),this.formView.urlInputView.fieldView.reset(),this._balloon.remove(this.formView),this.editor.editing.view.focus(),this._hideFakeVisualSelection())}_showUI(e=!1){this.formView||this._createViews(),this._getSelectedLinkElement()?(this._areActionsVisible?this._addFormView():this._addActionsView(),e&&this._balloon.showStack("main")):(this._showFakeVisualSelection(),this._addActionsView(),e&&this._balloon.showStack("main"),this._addFormView()),this._startUpdatingUI()}_hideUI(){if(!this._isUIInPanel)return;let e=this.editor;this.stopListening(e.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),e.editing.view.focus(),this._removeFormView(),this._balloon.remove(this.actionsView),this._hideFakeVisualSelection()}_startUpdatingUI(){let e=this.editor,t=e.editing.view.document,o=this._getSelectedLinkElement(),i=s(),r=()=>{let a=this._getSelectedLinkElement(),l=s();o&&!a||!o&&l!==i?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),o=a,i=l};function s(){return t.selection.focus.getAncestors().reverse().find((a=>a.is("element")))}this.listenTo(e.ui,"update",r),this.listenTo(this._balloon,"change:visibleView",r)}get _isFormInPanel(){return!!this.formView&&this._balloon.hasView(this.formView)}get _areActionsInPanel(){return!!this.actionsView&&this._balloon.hasView(this.actionsView)}get _areActionsVisible(){return!!this.actionsView&&this._balloon.visibleView===this.actionsView}get _isUIInPanel(){return this._isFormInPanel||this._areActionsInPanel}get _isUIVisible(){let e=this._balloon.visibleView;return!!this.formView&&e==this.formView||this._areActionsVisible}_getBalloonPositionData(){let e=this.editor.editing.view,t=this.editor.model,o=e.document,i;if(t.markers.has(io)){let r=Array.from(this.editor.editing.mapper.markerNameToElements(io)),s=e.createRange(e.createPositionBefore(r[0]),e.createPositionAfter(r[r.length-1]));i=e.domConverter.viewRangeToDom(s)}else i=()=>{let r=this._getSelectedLinkElement();return r?e.domConverter.mapViewToDom(r):e.domConverter.viewRangeToDom(o.selection.getFirstRange())};return{target:i}}_getSelectedLinkElement(){let e=this.editor.editing.view,t=e.document.selection,o=t.getSelectedElement();if(t.isCollapsed||o&&He(o))return Xc(t.getFirstPosition());{let i=t.getFirstRange().getTrimmed(),r=Xc(i.start),s=Xc(i.end);return r&&r==s&&e.createRangeIn(r).getTrimmed().isEqual(i)?r:null}}_showFakeVisualSelection(){let e=this.editor.model;e.change((t=>{let o=e.document.selection.getFirstRange();if(e.markers.has(io))t.updateMarker(io,{range:o});else if(o.start.isAtEnd){let i=o.start.getLastMatchingPosition((({item:r})=>!e.schema.isContent(r)),{boundaries:o});t.addMarker(io,{usingOperation:!1,affectsData:!1,range:t.createRange(i,o.end)})}else t.addMarker(io,{usingOperation:!1,affectsData:!1,range:o})}))}_hideFakeVisualSelection(){let e=this.editor.model;e.markers.has(io)&&e.change((t=>{t.removeMarker(io)}))}}function Xc(n){return n.getAncestors().find((e=>{return(t=e).is("attributeElement")&&!!t.getCustomProperty("link");var t}))||null}let d0=new RegExp("(^|\\s)(((?:(?:(?:https?|ftp):)?\\/\\/)(?:\\S+(?::\\S*)?@)?(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(((?!www\\.)|(www\\.))(?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.)+(?:[a-z\\u00a1-\\uffff]{2,63})))(?::\\d{2,5})?(?:[/?#]\\S*)?)|((www.|(\\S+@))((?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.))+(?:[a-z\\u00a1-\\uffff]{2,63})))$","i");class u0 extends L{static get requires(){return[lo,a0]}static get pluginName(){return"AutoLink"}init(){let e=this.editor.model.document.selection;e.on("change:range",(()=>{this.isEnabled=!e.anchor.parent.is("element","codeBlock")})),this._enableTypingHandling()}afterInit(){this._enableEnterHandling(),this._enableShiftEnterHandling(),this._enablePasteLinking()}_expandLinkRange(e,t){return t.textNode&&t.textNode.hasAttribute("linkHref")?_s(t,"linkHref",t.textNode.getAttribute("linkHref"),e):null}_selectEntireLinks(e,t){let o=this.editor.model,i=o.document.selection,r=i.getFirstPosition(),s=i.getLastPosition(),a=t.getJoined(this._expandLinkRange(o,r)||t);a&&(a=a.getJoined(this._expandLinkRange(o,s)||t)),a&&(a.start.isBefore(r)||a.end.isAfter(s))&&e.setSelection(a)}_enablePasteLinking(){let e=this.editor,t=e.model,o=t.document.selection,i=e.plugins.get("ClipboardPipeline"),r=e.commands.get("link");i.on("inputTransformation",((s,a)=>{if(!this.isEnabled||!r.isEnabled||o.isCollapsed||a.method!=="paste"||o.rangeCount>1)return;let l=o.getFirstRange(),c=a.dataTransfer.getData("text/plain");if(!c)return;let d=c.match(d0);d&&d[2]===c&&(t.change((u=>{this._selectEntireLinks(u,l),r.execute(c)})),s.stop())}),{priority:"high"})}_enableTypingHandling(){let e=this.editor,t=new ac(e.model,(o=>{if(!(function(r){return r.length>4&&r[r.length-1]===" "&&r[r.length-2]!==" "})(o))return;let i=h0(o.substr(0,o.length-1));return i?{url:i}:void 0}));t.on("matched:data",((o,i)=>{let{batch:r,range:s,url:a}=i;if(!r.isTyping)return;let l=s.end.getShiftedBy(-1),c=l.getShiftedBy(-a.length),d=e.model.createRange(c,l);this._applyAutoLink(a,d)})),t.bind("isEnabled").to(this)}_enableEnterHandling(){let e=this.editor,t=e.model,o=e.commands.get("enter");o&&o.on("execute",(()=>{let i=t.document.selection.getFirstPosition();if(!i.parent.previousSibling)return;let r=t.createRangeIn(i.parent.previousSibling);this._checkAndApplyAutoLinkOnRange(r)}))}_enableShiftEnterHandling(){let e=this.editor,t=e.model,o=e.commands.get("shiftEnter");o&&o.on("execute",(()=>{let i=t.document.selection.getFirstPosition(),r=t.createRange(t.createPositionAt(i.parent,0),i.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(r)}))}_checkAndApplyAutoLinkOnRange(e){let t=this.editor.model,{text:o,range:i}=Up(e,t),r=h0(o);if(r){let s=t.createRange(i.end.getShiftedBy(-r.length),i.end);this._applyAutoLink(r,s)}}_applyAutoLink(e,t){let o=this.editor.model,i=Jc(e,this.editor.config.get("link.defaultProtocol"));this.isEnabled&&(function(r,s){return s.schema.checkAttributeInSelection(s.createSelection(r),"linkHref")})(t,o)&&o0(i)&&!(function(r){let s=r.start.nodeAfter;return!!s&&s.hasAttribute("linkHref")})(t)&&this._persistAutoLink(i,t)}_persistAutoLink(e,t){let o=this.editor.model,i=this.editor.plugins.get("Delete");o.enqueueChange((r=>{r.setAttribute("linkHref",e,t),o.enqueueChange((()=>{i.requestUndoOnBackspace()}))}))}}function h0(n){let e=d0.exec(n);return e?e[2]:null}class m0 extends L{static get requires(){return[a0,tB,u0]}static get pluginName(){return"Link"}}var g0=z(3858),oB={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(g0.Z,oB),g0.Z.locals;var p0=z(1066),iB={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(p0.Z,iB),p0.Z.locals;class nB extends re{constructor(e){super(e),this.props=this.editor.config.get("FieldExpression"),this.props&&(this.data=this.props.data,this.placeholderText=this.props.placeholderText??"Search fields",this.heading=this.props.heading??"Select field",this.groupFieldsAndExpressions=this.props.groupFieldsAndExpressions??!1,this.customExpressionCheck=this.props.customExpressionCheck,this.fieldsGroupHeading=this.props.fieldsGroupHeading??"Fields",this.expressionsGroupHeading=this.props.expressionsGroupHeading??"Expressions",this.layer=this.props.layer??null,this.mapView=this.props.mapView??null)}_cleanUp=(e,t,o,i)=>{document.body.contains(e)&&(document.body.removeChild(e),document.removeEventListener("click",o),t(!1),i.element.classList.remove("ck-on"),i.element.classList.add("ck-off"),i.element.blur())};_generatePickList=(e,t,o)=>{let i=this.editor.locale.uiLanguage,r=document.createElement("arcgis-field-pick-list");r.selectedFields=[],r.fields=this.data,r.popoverProps={refElement:o.element,popoverWidth:325,placement:"bottom-start",offsetDistance:5,triggerDisabled:!1},r.dir=i==="ar"||i==="he"?"rtl":"ltr",r.layer=this.layer,r.mapView=this.mapView,r.showFieldInfo=!(!this.layer||!this.mapView),r.showFieldName=!0,r.showDescription=!0,r.showSelectionAll=!0,r.showCancel=!0,r.showSort=!0,r.filterPlaceholderText=this.placeholderText,r.showFilterLength=5,r.multiple=!1,r.heading=this.heading,r.groupFieldsAndExpressions=this.groupFieldsAndExpressions,r.fieldsGroupHeading=this.fieldsGroupHeading,r.expressionsGroupHeading=this.expressionsGroupHeading,r.customExpressionCheck=this.customExpressionCheck;let s=a=>{let l=a.length>1?`{${a.join(", ")}}`:`{${a[0]}}`;this.editor.model.change((c=>{this.editor.execute("mention",{marker:"{",mention:l})}))};return r.addEventListener("arcgisFieldPickListDismissed",(a=>{if(!a.detail)return void this._cleanUp(r,t,e,o);let l=a.detail.selectedFields.length>0,c=a.detail.selectedFields;r.multiple&&l&&s(c),this._cleanUp(r,t,e,o)})),r.addEventListener("arcgisFieldPickListChange",(a=>{let l=a.detail.selectedFields;!r.multiple&&s(l)})),r};execute(e,t,o){let i;if(!this.props||!this.props.data||!this.props.data.length)return;let r=s=>{let a=document.getElementsByClassName("FieldExpressionButton")[0].contains(s.target),l=s.target!==i;(a||l)&&this._cleanUp(i,t,r,o)};i=this._generatePickList(r,t,o),e?(document.removeEventListener("click",r),t(!1)):(document.body.appendChild(i),setTimeout((()=>document.addEventListener("click",r)),0),t(!0))}}class rB extends L{static get pluginName(){return"FieldExpressionEditing"}constructor(e){super(e),this.editor.commands.add("toggleFieldPickList",new nB(this.editor))}}class sB extends L{static get pluginName(){return"FieldExpressionUI"}constructor(e){super(e),this.props=this.editor.config.get("FieldExpression"),this.props&&(this.label="Field Expression Pick List",this.props&&this.props.label&&(this.label=this.props.label),this.visible=!1,this.visibleHandler=t=>this.visible=t)}init(){let e=this.editor;e.ui.componentFactory.add("arcgis-field-expression",(t=>{if(!this.props||!this.props.data||!this.props.data.length)return;let o=new On(t);o.set({label:this.label,tooltip:!0,withText:!1,icon:`<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">\r
|
|
8074
|
+
`)}function Tc(n,e,t=" "){return`${t.repeat(Math.max(0,e))}${n}`}var pb=z(671),dT={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(pb.Z,dT),pb.Z.locals;let Fs="SourceEditingMode";class fb extends L{static get pluginName(){return"SourceEditing"}static get requires(){return[Pm]}constructor(e){super(e),this.set("isSourceEditingMode",!1),this._elementReplacer=new Sd,this._replacedRoots=new Map,this._dataFromRoots=new Map,e.config.define("sourceEditing.allowCollaborationFeatures",!1)}init(){this._checkCompatibility();let e=this.editor,t=e.locale.t;e.ui.componentFactory.add("sourceEditing",(()=>{let o=this._createButton(ne);return o.set({label:t("Source"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m12.5 0 5 4.5v15.003h-16V0h11zM3 1.5v3.25l-1.497 1-.003 8 1.5 1v3.254L7.685 18l-.001 1.504H17.5V8.002L16 9.428l-.004-4.22-4.222-3.692L3 1.5z"/><path d="M4.06 6.64a.75.75 0 0 1 .958 1.15l-.085.07L2.29 9.75l2.646 1.89c.302.216.4.62.232.951l-.058.095a.75.75 0 0 1-.951.232l-.095-.058-3.5-2.5V9.14l3.496-2.5zm4.194 6.22a.75.75 0 0 1-.958-1.149l.085-.07 2.643-1.89-2.646-1.89a.75.75 0 0 1-.232-.952l.058-.095a.75.75 0 0 1 .95-.232l.096.058 3.5 2.5v1.22l-3.496 2.5zm7.644-.836 2.122 2.122-5.825 5.809-2.125-.005.003-2.116zm2.539-1.847 1.414 1.414a.5.5 0 0 1 0 .707l-1.06 1.06-2.122-2.12 1.061-1.061a.5.5 0 0 1 .707 0z"/></svg>',tooltip:!0,class:"ck-source-editing-button"}),o})),e.ui.componentFactory.add("menuBar:sourceEditing",(()=>{let o=this._createButton(Pe);return o.set({label:t("Show source")}),o})),this._isAllowedToHandleSourceEditingMode()&&(this.on("change:isSourceEditingMode",((o,i,r)=>{r?(this._hideVisibleDialog(),this._showSourceEditing(),this._disableCommands()):(this._hideSourceEditing(),this._enableCommands())})),this.on("change:isEnabled",((o,i,r)=>this._handleReadOnlyMode(!r))),this.listenTo(e,"change:isReadOnly",((o,i,r)=>this._handleReadOnlyMode(r)))),e.data.on("get",(()=>{this.isSourceEditingMode&&this.updateEditorData()}),{priority:"high"})}updateEditorData(){let e=this.editor,t={};for(let[o,i]of this._replacedRoots){let r=this._dataFromRoots.get(o),s=i.dataset.value;r!==s&&(t[o]=s,this._dataFromRoots.set(o,s))}Object.keys(t).length&&e.data.set(t,{batchType:{isUndoable:!0},suppressErrorInCollaboration:!0})}_checkCompatibility(){let e=this.editor,t=e.config.get("sourceEditing.allowCollaborationFeatures");if(!t&&e.plugins.has("RealTimeCollaborativeEditing"))throw new y("source-editing-incompatible-with-real-time-collaboration",null);!t&&["CommentsEditing","TrackChangesEditing","RevisionHistory"].some((o=>e.plugins.has(o)))&&console.warn("You initialized the editor with the source editing feature and at least one of the collaboration features. Please be advised that the source editing feature may not work, and be careful when editing document source that contains markers created by the collaboration features."),e.plugins.has("RestrictedEditingModeEditing")&&console.warn("You initialized the editor with the source editing feature and restricted editing feature. Please be advised that the source editing feature may not work, and be careful when editing document source that contains markers created by the restricted editing feature.")}_showSourceEditing(){let e=this.editor,t=e.editing.view,o=e.model;o.change((i=>{i.setSelection(null),i.removeSelectionAttribute(o.document.selection.getAttributeKeys())}));for(let[i,r]of t.domRoots){let s=uT(e.data.get({rootName:i})),a=kt(r.ownerDocument,"textarea",{rows:"1","aria-label":"Source code editing area"}),l=kt(r.ownerDocument,"div",{class:"ck-source-editing-area","data-value":s},[a]);a.value=s,a.setSelectionRange(0,0),a.addEventListener("input",(()=>{l.dataset.value=a.value,e.ui.update()})),t.change((c=>{let d=t.document.getRoot(i);c.addClass("ck-hidden",d)})),e.ui.setEditableElement("sourceEditing:"+i,a),this._replacedRoots.set(i,l),this._elementReplacer.replace(r,l),this._dataFromRoots.set(i,s)}this._focusSourceEditing()}_hideSourceEditing(){let e=this.editor.editing.view;this.updateEditorData(),e.change((t=>{for(let[o]of this._replacedRoots)t.removeClass("ck-hidden",e.document.getRoot(o))})),this._elementReplacer.restore(),this._replacedRoots.clear(),this._dataFromRoots.clear(),e.focus()}_focusSourceEditing(){let e=this.editor,[t]=this._replacedRoots.values(),o=t.querySelector("textarea");e.editing.view.document.isFocused=!1,o.focus()}_disableCommands(){let e=this.editor;for(let t of e.commands.commands())t.forceDisabled(Fs);e.plugins.has("CommentsArchiveUI")&&e.plugins.get("CommentsArchiveUI").forceDisabled(Fs)}_enableCommands(){let e=this.editor;for(let t of e.commands.commands())t.clearForceDisabled(Fs);e.plugins.has("CommentsArchiveUI")&&e.plugins.get("CommentsArchiveUI").clearForceDisabled(Fs)}_handleReadOnlyMode(e){if(this.isSourceEditingMode)for(let[,t]of this._replacedRoots)t.querySelector("textarea").readOnly=e}_isAllowedToHandleSourceEditingMode(){let e=this.editor.ui.view.editable;return e&&!e.hasExternalElement}_hideVisibleDialog(){if(this.editor.plugins.has("Dialog")){let e=this.editor.plugins.get("Dialog");e.isOpen&&e.hide()}}_createButton(e){let t=this.editor,o=new e(t.locale);return o.set({withText:!0}),o.bind("isOn").to(this,"isSourceEditingMode"),o.bind("isEnabled").to(this,"isEnabled",t,"isReadOnly",t.plugins.get(Pm),"hasAny",((i,r,s)=>!!i&&!r&&!s)),this.listenTo(o,"execute",(()=>{this.isSourceEditingMode=!this.isSourceEditingMode})),o}}function uT(n){return(function(e){return e.startsWith("<")})(n)?cT(n):n}function Sc(n,e){let{modelAttribute:t,styleName:o,viewElement:i,defaultValue:r,reduceBoxSides:s=!1,shouldUpcast:a=()=>!0}=e;n.for("upcast").attributeToAttribute({view:{name:i,styles:{[o]:/[\s\S]+/}},model:{key:t,value:l=>{if(!a(l))return;let c=l.getNormalizedStyle(o),d=s?js(c):c;return r!==d?d:void 0}}})}function Ic(n,e,t,o){n.for("upcast").add((i=>i.on("element:"+e,((r,s,a)=>{if(!s.modelRange)return;let l=["border-top-width","border-top-color","border-top-style","border-bottom-width","border-bottom-color","border-bottom-style","border-right-width","border-right-color","border-right-style","border-left-width","border-left-color","border-left-style"].filter((m=>s.viewItem.hasStyle(m)));if(!l.length)return;let c={styles:l};if(!a.consumable.test(s.viewItem,c))return;let d=[...s.modelRange.getItems({shallow:!0})].pop();a.consumable.consume(s.viewItem,c);let u={style:s.viewItem.getNormalizedStyle("border-style"),color:s.viewItem.getNormalizedStyle("border-color"),width:s.viewItem.getNormalizedStyle("border-width")},h={style:js(u.style),color:js(u.color),width:js(u.width)};h.style!==o.style&&a.writer.setAttribute(t.style,h.style,d),h.color!==o.color&&a.writer.setAttribute(t.color,h.color,d),h.width!==o.width&&a.writer.setAttribute(t.width,h.width,d)}))))}function or(n,e){let{modelElement:t,modelAttribute:o,styleName:i}=e;n.for("downcast").attributeToAttribute({model:{name:t,key:o},view:r=>({key:"style",value:{[i]:r}})})}function Vs(n,e){let{modelAttribute:t,styleName:o}=e;n.for("downcast").add((i=>i.on(`attribute:${t}:table`,((r,s,a)=>{let{item:l,attributeNewValue:c}=s,{mapper:d,writer:u}=a;if(!a.consumable.consume(s.item,r.name))return;let h=[...d.toViewElement(l).getChildren()].find((m=>m.is("element","table")));c?u.setStyle(o,c,h):u.removeStyle(o,h)}))))}function js(n){if(!n)return;let e=["top","right","bottom","left"];if(!e.every((o=>n[o])))return n;let t=n.top;return e.every((o=>n[o]===t))?t:n}function Re(n,e,t,o,i=1){e!=null&&i!=null&&e>i?o.setAttribute(n,e,t):o.removeAttribute(n,t)}function ti(n,e,t={}){let o=n.createElement("tableCell",t);return n.insertElement("paragraph",o),n.insert(o,e),o}function Bc(n,e){let t=e.parent.parent,o=parseInt(t.getAttribute("headingColumns")||"0"),{column:i}=n.getCellLocation(e);return!!o&&i<o}function Hs(n,e,t){let{modelAttribute:o}=t;n.extend("tableCell",{allowAttributes:[o]}),Sc(e,{viewElement:/^(td|th)$/,...t}),or(e,{modelElement:"tableCell",...t})}function Mc(n){let e=n.getSelectedElement();return e&&e.is("element","table")?e:n.getFirstPosition().findAncestor("table")}function hT(){return n=>{n.on("element:table",((e,t,o)=>{let i=t.viewItem;if(!o.consumable.test(i,{name:!0}))return;let{rows:r,headingRows:s,headingColumns:a}=(function(d){let u,h=0,m=[],g=[],b;for(let w of Array.from(d.getChildren())){if(w.name!=="tbody"&&w.name!=="thead"&&w.name!=="tfoot")continue;w.name!=="thead"||b||(b=w);let A=Array.from(w.getChildren()).filter((S=>S.is("element","tr")));for(let S of A)if(b&&w===b||w.name==="tbody"&&Array.from(S.getChildren()).length&&Array.from(S.getChildren()).every((M=>M.is("element","th"))))h++,m.push(S);else{g.push(S);let M=mT(S);(!u||M<u)&&(u=M)}}return{headingRows:h,headingColumns:u||0,rows:[...m,...g]}})(i),l={};a&&(l.headingColumns=a),s&&(l.headingRows=s);let c=o.writer.createElement("table",l);if(o.safeInsert(c,t.modelCursor)){if(o.consumable.consume(i,{name:!0}),r.forEach((d=>o.convertItem(d,o.writer.createPositionAt(c,"end")))),o.convertChildren(i,o.writer.createPositionAt(c,"end")),c.isEmpty){let d=o.writer.createElement("tableRow");o.writer.insert(d,o.writer.createPositionAt(c,"end")),ti(o.writer,o.writer.createPositionAt(d,"end"))}o.updateConversionResult(c,t)}}))}}function kb(n){return e=>{e.on(`element:${n}`,((t,o,{writer:i})=>{if(!o.modelRange)return;let r=o.modelRange.start.nodeAfter,s=i.createPositionAt(r,0);if(o.viewItem.isEmpty)return void i.insertElement("paragraph",s);let a=Array.from(r.getChildren());if(a.every((l=>l.is("element","$marker")))){let l=i.createElement("paragraph");i.insert(l,i.createPositionAt(r,0));for(let c of a)i.move(i.createRangeOn(c),i.createPositionAt(l,"end"))}}),{priority:"low"})}}function mT(n){let e=0,t=0,o=Array.from(n.getChildren()).filter((i=>i.name==="th"||i.name==="td"));for(;t<o.length&&o[t].name==="th";){let i=o[t];e+=parseInt(i.getAttribute("colspan")||"1"),t++}return e}class Ae{constructor(e,t={}){this._jumpedToStartRow=!1,this._table=e,this._startRow=t.row!==void 0?t.row:t.startRow||0,this._endRow=t.row!==void 0?t.row:t.endRow,this._startColumn=t.column!==void 0?t.column:t.startColumn||0,this._endColumn=t.column!==void 0?t.column:t.endColumn,this._includeAllSlots=!!t.includeAllSlots,this._skipRows=new Set,this._row=0,this._rowIndex=0,this._column=0,this._cellIndex=0,this._spannedCells=new Map,this._nextCellAtColumn=-1}[Symbol.iterator](){return this}next(){this._canJumpToStartRow()&&this._jumpToNonSpannedRowClosestToStartRow();let e=this._table.getChild(this._rowIndex);if(!e||this._isOverEndRow())return{done:!0,value:void 0};if(!e.is("element","tableRow"))return this._rowIndex++,this.next();if(this._isOverEndColumn())return this._advanceToNextRow();let t=null,o=this._getSpanned();if(o)this._includeAllSlots&&!this._shouldSkipSlot()&&(t=this._formatOutValue(o.cell,o.row,o.column));else{let i=e.getChild(this._cellIndex);if(!i)return this._advanceToNextRow();let r=parseInt(i.getAttribute("colspan")||"1"),s=parseInt(i.getAttribute("rowspan")||"1");(r>1||s>1)&&this._recordSpans(i,s,r),this._shouldSkipSlot()||(t=this._formatOutValue(i)),this._nextCellAtColumn=this._column+r}return this._column++,this._column==this._nextCellAtColumn&&this._cellIndex++,t||this.next()}skipRow(e){this._skipRows.add(e)}_advanceToNextRow(){return this._row++,this._rowIndex++,this._column=0,this._cellIndex=0,this._nextCellAtColumn=-1,this.next()}_isOverEndRow(){return this._endRow!==void 0&&this._row>this._endRow}_isOverEndColumn(){return this._endColumn!==void 0&&this._column>this._endColumn}_formatOutValue(e,t=this._row,o=this._column){return{done:!1,value:new gT(this,e,t,o)}}_shouldSkipSlot(){let e=this._skipRows.has(this._row),t=this._row<this._startRow,o=this._column<this._startColumn,i=this._endColumn!==void 0&&this._column>this._endColumn;return e||t||o||i}_getSpanned(){let e=this._spannedCells.get(this._row);return e&&e.get(this._column)||null}_recordSpans(e,t,o){let i={cell:e,row:this._row,column:this._column};for(let r=this._row;r<this._row+t;r++)for(let s=this._column;s<this._column+o;s++)r==this._row&&s==this._column||this._markSpannedCell(r,s,i)}_markSpannedCell(e,t,o){this._spannedCells.has(e)||this._spannedCells.set(e,new Map),this._spannedCells.get(e).set(t,o)}_canJumpToStartRow(){return!!this._startRow&&this._startRow>0&&!this._jumpedToStartRow}_jumpToNonSpannedRowClosestToStartRow(){let e=this._getRowLength(0);for(let t=this._startRow;!this._jumpedToStartRow;t--)e===this._getRowLength(t)&&(this._row=t,this._rowIndex=t,this._jumpedToStartRow=!0)}_getRowLength(e){return[...this._table.getChild(e).getChildren()].reduce(((t,o)=>t+parseInt(o.getAttribute("colspan")||"1")),0)}}class gT{constructor(e,t,o,i){this.cell=t,this.row=e._row,this.column=e._column,this.cellAnchorRow=o,this.cellAnchorColumn=i,this._cellIndex=e._cellIndex,this._rowIndex=e._rowIndex,this._table=e._table}get isAnchor(){return this.row===this.cellAnchorRow&&this.column===this.cellAnchorColumn}get cellWidth(){return parseInt(this.cell.getAttribute("colspan")||"1")}get cellHeight(){return parseInt(this.cell.getAttribute("rowspan")||"1")}get rowIndex(){return this._rowIndex}getPositionBefore(){return this._table.root.document.model.createPositionAt(this._table.getChild(this.row),this._cellIndex)}}function bb(n,e){return(t,{writer:o})=>{let i=t.getAttribute("headingRows")||0,r=o.createContainerElement("table",null,[]),s=o.createContainerElement("figure",{class:"table"},r);i>0&&o.insert(o.createPositionAt(r,"end"),o.createContainerElement("thead",null,o.createSlot((a=>a.is("element","tableRow")&&a.index<i)))),i<n.getRows(t)&&o.insert(o.createPositionAt(r,"end"),o.createContainerElement("tbody",null,o.createSlot((a=>a.is("element","tableRow")&&a.index>=i))));for(let{positionOffset:a,filter:l}of e.additionalSlots)o.insert(o.createPositionAt(r,a),o.createSlot(l));return o.insert(o.createPositionAt(r,"after"),o.createSlot((a=>!a.is("element","tableRow")&&!e.additionalSlots.some((({filter:l})=>l(a)))))),e.asWidget?(function(a,l){return l.setCustomProperty("table",!0,a),Hi(a,l,{hasSelectionHandle:!0})})(s,o):s}}function wb(n={}){return(e,{writer:t})=>{let o=e.parent,i=o.parent,r=i.getChildIndex(o),s=new Ae(i,{row:r}),a=i.getAttribute("headingRows")||0,l=i.getAttribute("headingColumns")||0,c=null;for(let d of s)if(d.cell==e){let u=d.row<a||d.column<l?"th":"td";c=n.asWidget?af(t.createEditableElement(u),t):t.createContainerElement(u);break}return c}}function _b(n={}){return(e,{writer:t})=>{if(!e.parent.is("element","tableCell")||!Ab(e))return null;if(n.asWidget)return t.createContainerElement("span",{class:"ck-table-bogus-paragraph"});{let o=t.createContainerElement("p");return t.setCustomProperty("dataPipeline:transparentRendering",!0,o),o}}}function Ab(n){return n.parent.childCount==1&&!!n.getAttributeKeys().next().done}class pT extends re{refresh(){let e=this.editor.model,t=e.document.selection,o=e.schema;this.isEnabled=(function(i,r){let s=i.getFirstPosition().parent,a=s===s.root?s:s.parent;return r.checkChild(a,"table")})(t,o)}execute(e={}){let t=this.editor,o=t.model,i=t.plugins.get("TableUtils"),r=t.config.get("table.defaultHeadings.rows"),s=t.config.get("table.defaultHeadings.columns");e.headingRows===void 0&&r&&(e.headingRows=r),e.headingColumns===void 0&&s&&(e.headingColumns=s),o.change((a=>{let l=i.createTable(a,e);o.insertObject(l,null,null,{findOptimalPosition:"auto"}),a.setSelection(a.createPositionAt(l.getNodeByPath([0,0,0]),0))}))}}class Cb extends re{constructor(e,t={}){super(e),this.order=t.order||"below"}refresh(){let e=this.editor.model.document.selection,t=!!this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e).length;this.isEnabled=t}execute(){let e=this.editor,t=e.model.document.selection,o=e.plugins.get("TableUtils"),i=this.order==="above",r=o.getSelectionAffectedTableCells(t),s=o.getRowIndexes(r),a=i?s.first:s.last,l=r[0].findAncestor("table");o.insertRows(l,{at:i?a:a+1,copyStructureFromAbove:!i})}}class vb extends re{constructor(e,t={}){super(e),this.order=t.order||"right"}refresh(){let e=this.editor.model.document.selection,t=!!this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e).length;this.isEnabled=t}execute(){let e=this.editor,t=e.model.document.selection,o=e.plugins.get("TableUtils"),i=this.order==="left",r=o.getSelectionAffectedTableCells(t),s=o.getColumnIndexes(r),a=i?s.first:s.last,l=r[0].findAncestor("table");o.insertColumns(l,{columns:1,at:i?a:a+1})}}class yb extends re{constructor(e,t={}){super(e),this.direction=t.direction||"horizontally"}refresh(){let e=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=e.length===1}execute(){let e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection)[0];this.direction==="horizontally"?e.splitCellHorizontally(t,2):e.splitCellVertically(t,2)}}function xb(n,e,t){let{startRow:o,startColumn:i,endRow:r,endColumn:s}=e,a=t.createElement("table"),l=r-o+1;for(let d=0;d<l;d++)t.insertElement("tableRow",a,"end");let c=[...new Ae(n,{startRow:o,endRow:r,startColumn:i,endColumn:s,includeAllSlots:!0})];for(let{row:d,column:u,cell:h,isAnchor:m,cellAnchorRow:g,cellAnchorColumn:b}of c){let w=d-o,A=a.getChild(w);if(m){let S=t.cloneElement(h);t.append(S,A),Ib(S,d,u,r,s,t)}else(g<o||b<i)&&ti(t,t.createPositionAt(A,"end"))}return(function(d,u,h,m,g){let b=parseInt(u.getAttribute("headingRows")||"0");b>0&&Re("headingRows",b-h,d,g,0);let w=parseInt(u.getAttribute("headingColumns")||"0");w>0&&Re("headingColumns",w-m,d,g,0)})(a,n,o,i,t),a}function Eb(n,e,t=0){let o=[],i=new Ae(n,{startRow:t,endRow:e-1});for(let r of i){let{row:s,cellHeight:a}=r;s<e&&e<=s+a-1&&o.push(r)}return o}function Db(n,e,t){let o=n.parent,i=o.parent,r=o.index,s=e-r,a={},l=parseInt(n.getAttribute("rowspan"))-s;l>1&&(a.rowspan=l);let c=parseInt(n.getAttribute("colspan")||"1");c>1&&(a.colspan=c);let d=r+s,u=[...new Ae(i,{startRow:r,endRow:d,includeAllSlots:!0})],h,m=null;for(let g of u){let{row:b,column:w,cell:A}=g;A===n&&h===void 0&&(h=w),h!==void 0&&h===w&&b===d&&(m=ti(t,g.getPositionBefore(),a))}return Re("rowspan",s,n,t),m}function Tb(n,e){let t=[],o=new Ae(n);for(let i of o){let{column:r,cellWidth:s}=i;r<e&&e<=r+s-1&&t.push(i)}return t}function Sb(n,e,t,o){let i=t-e,r={},s=parseInt(n.getAttribute("colspan"))-i;s>1&&(r.colspan=s);let a=parseInt(n.getAttribute("rowspan")||"1");a>1&&(r.rowspan=a);let l=ti(o,o.createPositionAfter(n),r);return Re("colspan",i,n,o),l}function Ib(n,e,t,o,i,r){let s=parseInt(n.getAttribute("colspan")||"1"),a=parseInt(n.getAttribute("rowspan")||"1");t+s-1>i&&Re("colspan",i-t+1,n,r,1),e+a-1>o&&Re("rowspan",o-e+1,n,r,1)}function Nc(n,e){let t=e.getColumns(n),o=new Array(t).fill(0);for(let{column:r}of new Ae(n))o[r]++;let i=o.reduce(((r,s,a)=>s?r:[...r,a]),[]);if(i.length>0){let r=i[i.length-1];return e.removeColumns(n,{at:r}),!0}return!1}function Pc(n,e){let t=[],o=e.getRows(n);for(let i=0;i<o;i++)n.getChild(i).isEmpty&&t.push(i);if(t.length>0){let i=t[t.length-1];return e.removeRows(n,{at:i}),!0}return!1}function Lc(n,e){Nc(n,e)||Pc(n,e)}function Bb(n,e){let t=Array.from(new Ae(n,{startColumn:e.firstColumn,endColumn:e.lastColumn,row:e.lastRow}));if(t.every((({cellHeight:i})=>i===1)))return e.lastRow;let o=t[0].cellHeight-1;return e.lastRow+o}function Mb(n,e){let t=Array.from(new Ae(n,{startRow:e.firstRow,endRow:e.lastRow,column:e.lastColumn}));if(t.every((({cellWidth:i})=>i===1)))return e.lastColumn;let o=t[0].cellWidth-1;return e.lastColumn+o}class Us extends re{constructor(e,t){super(e),this.direction=t.direction,this.isHorizontal=this.direction=="right"||this.direction=="left"}refresh(){let e=this._getMergeableCell();this.value=e,this.isEnabled=!!e}execute(){let e=this.editor.model,t=e.document,o=this.editor.plugins.get("TableUtils").getTableCellsContainingSelection(t.selection)[0],i=this.value,r=this.direction;e.change((s=>{let a=r=="right"||r=="down",l=a?o:i,c=a?i:o,d=c.parent;(function(b,w,A){Nb(b)||(Nb(w)&&A.remove(A.createRangeIn(w)),A.move(A.createRangeIn(b),A.createPositionAt(w,"end"))),A.remove(b)})(c,l,s);let u=this.isHorizontal?"colspan":"rowspan",h=parseInt(o.getAttribute(u)||"1"),m=parseInt(i.getAttribute(u)||"1");s.setAttribute(u,h+m,l),s.setSelection(s.createRangeIn(l));let g=this.editor.plugins.get("TableUtils");Lc(d.findAncestor("table"),g)}))}_getMergeableCell(){let e=this.editor.model.document,t=this.editor.plugins.get("TableUtils"),o=t.getTableCellsContainingSelection(e.selection)[0];if(!o)return;let i=this.isHorizontal?(function(a,l,c){let d=a.parent,u=d.parent,h=l=="right"?a.nextSibling:a.previousSibling,m=(u.getAttribute("headingColumns")||0)>0;if(!h)return;let g=l=="right"?a:h,b=l=="right"?h:a,{column:w}=c.getCellLocation(g),{column:A}=c.getCellLocation(b),S=parseInt(g.getAttribute("colspan")||"1"),M=Bc(c,g),F=Bc(c,b);if(!(m&&M!=F))return w+S===A?h:void 0})(o,this.direction,t):(function(a,l,c){let d=a.parent,u=d.parent,h=u.getChildIndex(d);if(l=="down"&&h===c.getRows(u)-1||l=="up"&&h===0)return null;let m=parseInt(a.getAttribute("rowspan")||"1"),g=u.getAttribute("headingRows")||0,b=l=="down"&&h+m===g,w=l=="up"&&h===g;if(g&&(b||w))return null;let A=parseInt(a.getAttribute("rowspan")||"1"),S=l=="down"?h+A:h,M=[...new Ae(u,{endRow:S})],F=M.find((ae=>ae.cell===a)),G=F.column,X=M.find((({row:ae,cellHeight:De,column:$e})=>$e===G&&(l=="down"?ae===S:S===ae+De)));return X&&X.cell?X.cell:null})(o,this.direction,t);if(!i)return;let r=this.isHorizontal?"rowspan":"colspan",s=parseInt(o.getAttribute(r)||"1");return parseInt(i.getAttribute(r)||"1")===s?i:void 0}}function Nb(n){let e=n.getChild(0);return n.childCount==1&&e.is("element","paragraph")&&e.isEmpty}class fT extends re{refresh(){let e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection),o=t[0];if(o){let i=o.findAncestor("table"),r=e.getRows(i)-1,s=e.getRowIndexes(t),a=s.first===0&&s.last===r;this.isEnabled=!a}else this.isEnabled=!1}execute(){let e=this.editor.model,t=this.editor.plugins.get("TableUtils"),o=t.getSelectionAffectedTableCells(e.document.selection),i=t.getRowIndexes(o),r=o[0],s=r.findAncestor("table"),a=t.getCellLocation(r).column;e.change((l=>{let c=i.last-i.first+1;t.removeRows(s,{at:i.first,rows:c});let d=(function(u,h,m,g){let b=u.getChild(Math.min(h,g-1)),w=b.getChild(0),A=0;for(let S of b.getChildren()){if(A>m)return w;w=S,A+=parseInt(S.getAttribute("colspan")||"1")}return w})(s,i.first,a,t.getRows(s));l.setSelection(l.createPositionAt(d,0))}))}}class kT extends re{refresh(){let e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection),o=t[0];if(o){let i=o.findAncestor("table"),r=e.getColumns(i),{first:s,last:a}=e.getColumnIndexes(t);this.isEnabled=a-s<r-1}else this.isEnabled=!1}execute(){let e=this.editor.plugins.get("TableUtils"),[t,o]=(function(l,c){let d=c.getSelectionAffectedTableCells(l),u=d[0],h=d.pop(),m=[u,h];return u.isBefore(h)?m:m.reverse()})(this.editor.model.document.selection,e),i=t.parent.parent,r=[...new Ae(i)],s={first:r.find((l=>l.cell===t)).column,last:r.find((l=>l.cell===o)).column},a=(function(l,c,d,u){return parseInt(d.getAttribute("colspan")||"1")>1?d:c.previousSibling||d.nextSibling?d.nextSibling||c.previousSibling:u.first?l.reverse().find((({column:h})=>h<u.first)).cell:l.reverse().find((({column:h})=>h>u.last)).cell})(r,t,o,s);this.editor.model.change((l=>{let c=s.last-s.first+1;e.removeColumns(i,{at:s.first,columns:c}),l.setSelection(l.createPositionAt(a,0))}))}}class bT extends re{refresh(){let e=this.editor.plugins.get("TableUtils"),t=this.editor.model,o=e.getSelectionAffectedTableCells(t.document.selection),i=o.length>0;this.isEnabled=i,this.value=i&&o.every((r=>this._isInHeading(r,r.parent.parent)))}execute(e={}){if(e.forceValue===this.value)return;let t=this.editor.plugins.get("TableUtils"),o=this.editor.model,i=t.getSelectionAffectedTableCells(o.document.selection),r=i[0].findAncestor("table"),{first:s,last:a}=t.getRowIndexes(i),l=this.value?s:a+1,c=r.getAttribute("headingRows")||0;o.change((d=>{if(l){let u=Eb(r,l,l>c?c:0);for(let{cell:h}of u)Db(h,l,d)}Re("headingRows",l,r,d,0)}))}_isInHeading(e,t){let o=parseInt(t.getAttribute("headingRows")||"0");return!!o&&e.parent.index<o}}class wT extends re{refresh(){let e=this.editor.model,t=this.editor.plugins.get("TableUtils"),o=t.getSelectionAffectedTableCells(e.document.selection),i=o.length>0;this.isEnabled=i,this.value=i&&o.every((r=>Bc(t,r)))}execute(e={}){if(e.forceValue===this.value)return;let t=this.editor.plugins.get("TableUtils"),o=this.editor.model,i=t.getSelectionAffectedTableCells(o.document.selection),r=i[0].findAncestor("table"),{first:s,last:a}=t.getColumnIndexes(i),l=this.value?s:a+1;o.change((c=>{if(l){let d=Tb(r,l);for(let{cell:u,column:h}of d)Sb(u,h,l,c)}Re("headingColumns",l,r,c,0)}))}}function _T(n){if(n.is("element","tableColumnGroup"))return n;let e=n.getChildren();return Array.from(e).find((t=>t.is("element","tableColumnGroup")))}function AT(n){let e=_T(n);return e?Array.from(e.getChildren()):[]}class nt extends L{static get pluginName(){return"TableUtils"}init(){this.decorate("insertColumns"),this.decorate("insertRows")}getCellLocation(e){let t=e.parent,o=t.parent,i=o.getChildIndex(t),r=new Ae(o,{row:i});for(let{cell:s,row:a,column:l}of r)if(s===e)return{row:a,column:l}}createTable(e,t){let o=e.createElement("table"),i=t.rows||2,r=t.columns||2;return zc(e,o,0,i,r),t.headingRows&&Re("headingRows",Math.min(t.headingRows,i),o,e,0),t.headingColumns&&Re("headingColumns",Math.min(t.headingColumns,r),o,e,0),o}insertRows(e,t={}){let o=this.editor.model,i=t.at||0,r=t.rows||1,s=t.copyStructureFromAbove!==void 0,a=t.copyStructureFromAbove?i-1:i,l=this.getRows(e),c=this.getColumns(e);if(i>l)throw new y("tableutils-insertrows-insert-out-of-range",this,{options:t});o.change((d=>{let u=e.getAttribute("headingRows")||0;if(u>i&&Re("headingRows",u+r,e,d,0),!s&&(i===0||i===l))return void zc(d,e,i,r,c);let h=s?Math.max(i,a):i,m=new Ae(e,{endRow:h}),g=new Array(c).fill(1);for(let{row:b,column:w,cellHeight:A,cellWidth:S,cell:M}of m){let F=b+A-1,G=b<=a&&a<=F;b<i&&i<=F?(d.setAttribute("rowspan",A+r,M),g[w]=-S):s&&G&&(g[w]=S)}for(let b=0;b<r;b++){let w=d.createElement("tableRow");d.insert(w,e,i);for(let A=0;A<g.length;A++){let S=g[A],M=d.createPositionAt(w,"end");S>0&&ti(d,M,S>1?{colspan:S}:void 0),A+=Math.abs(S)-1}}}))}insertColumns(e,t={}){let o=this.editor.model,i=t.at||0,r=t.columns||1;o.change((s=>{let a=e.getAttribute("headingColumns");i<a&&s.setAttribute("headingColumns",a+r,e);let l=this.getColumns(e);if(i===0||l===i){for(let d of e.getChildren())d.is("element","tableRow")&&qi(r,s,s.createPositionAt(d,i?"end":0));return}let c=new Ae(e,{column:i,includeAllSlots:!0});for(let d of c){let{row:u,cell:h,cellAnchorColumn:m,cellAnchorRow:g,cellWidth:b,cellHeight:w}=d;if(m<i){s.setAttribute("colspan",b+r,h);let A=g+w-1;for(let S=u;S<=A;S++)c.skipRow(S)}else qi(r,s,d.getPositionBefore())}}))}removeRows(e,t){let o=this.editor.model,i=t.rows||1,r=this.getRows(e),s=t.at,a=s+i-1;if(a>r-1)throw new y("tableutils-removerows-row-index-out-of-range",this,{table:e,options:t});o.change((l=>{let c={first:s,last:a},{cellsToMove:d,cellsToTrim:u}=(function(h,{first:m,last:g}){let b=new Map,w=[];for(let{row:A,column:S,cellHeight:M,cell:F}of new Ae(h,{endRow:g})){let G=A+M-1;if(A>=m&&A<=g&&G>g){let X=M-(g-A+1);b.set(S,{cell:F,rowspan:X})}if(A<m&&G>=m){let X;X=G>=g?g-m+1:G-m+1,w.push({cell:F,rowspan:M-X})}}return{cellsToMove:b,cellsToTrim:w}})(e,c);d.size&&(function(h,m,g,b){let w=new Ae(h,{includeAllSlots:!0,row:m}),A=[...w],S=h.getChild(m),M;for(let{column:F,cell:G,isAnchor:X}of A)if(g.has(F)){let{cell:ae,rowspan:De}=g.get(F),$e=M?b.createPositionAfter(M):b.createPositionAt(S,0);b.move(b.createRangeOn(ae),$e),Re("rowspan",De,ae,b),M=ae}else X&&(M=G)})(e,a+1,d,l);for(let h=a;h>=s;h--)l.remove(e.getChild(h));for(let{rowspan:h,cell:m}of u)Re("rowspan",h,m,l);(function(h,{first:m,last:g},b){let w=h.getAttribute("headingRows")||0;m<w&&Re("headingRows",g<w?w-(g-m+1):m,h,b,0)})(e,c,l),Nc(e,this)||Pc(e,this)}))}removeColumns(e,t){let o=this.editor.model,i=t.at,r=t.columns||1,s=t.at+r-1;o.change((a=>{(function(c,d,u){let h=c.getAttribute("headingColumns")||0;if(h&&d.first<h){let m=Math.min(h-1,d.last)-d.first+1;u.setAttribute("headingColumns",h-m,c)}})(e,{first:i,last:s},a);let l=AT(e);for(let c=s;c>=i;c--){for(let{cell:d,column:u,cellWidth:h}of[...new Ae(e)])u<=c&&h>1&&u+h>c?Re("colspan",h-1,d,a):u===c&&a.remove(d);if(l[c]){let d=c===0?l[1]:l[c-1],u=parseFloat(l[c].getAttribute("columnWidth")),h=parseFloat(d.getAttribute("columnWidth"));a.remove(l[c]),a.setAttribute("columnWidth",u+h+"%",d)}}Pc(e,this)||Nc(e,this)}))}splitCellVertically(e,t=2){let o=this.editor.model,i=e.parent.parent,r=parseInt(e.getAttribute("rowspan")||"1"),s=parseInt(e.getAttribute("colspan")||"1");o.change((a=>{if(s>1){let{newCellsSpan:l,updatedSpan:c}=Pb(s,t);Re("colspan",c,e,a);let d={};l>1&&(d.colspan=l),r>1&&(d.rowspan=r),qi(s>t?t-1:s-1,a,a.createPositionAfter(e),d)}if(s<t){let l=t-s,c=[...new Ae(i)],{column:d}=c.find((({cell:g})=>g===e)),u=c.filter((({cell:g,cellWidth:b,column:w})=>g!==e&&w===d||w<d&&w+b>d));for(let{cell:g,cellWidth:b}of u)a.setAttribute("colspan",b+l,g);let h={};r>1&&(h.rowspan=r),qi(l,a,a.createPositionAfter(e),h);let m=i.getAttribute("headingColumns")||0;m>d&&Re("headingColumns",m+l,i,a)}}))}splitCellHorizontally(e,t=2){let o=this.editor.model,i=e.parent,r=i.parent,s=r.getChildIndex(i),a=parseInt(e.getAttribute("rowspan")||"1"),l=parseInt(e.getAttribute("colspan")||"1");o.change((c=>{if(a>1){let d=[...new Ae(r,{startRow:s,endRow:s+a-1,includeAllSlots:!0})],{newCellsSpan:u,updatedSpan:h}=Pb(a,t);Re("rowspan",h,e,c);let{column:m}=d.find((({cell:b})=>b===e)),g={};u>1&&(g.rowspan=u),l>1&&(g.colspan=l);for(let b of d){let{column:w,row:A}=b;A>=s+h&&w===m&&(A+s+h)%u==0&&qi(1,c,b.getPositionBefore(),g)}}if(a<t){let d=t-a,u=[...new Ae(r,{startRow:0,endRow:s})];for(let{cell:g,cellHeight:b,row:w}of u)if(g!==e&&w+b>s){let A=b+d;c.setAttribute("rowspan",A,g)}let h={};l>1&&(h.colspan=l),zc(c,r,s+1,d,1,h);let m=r.getAttribute("headingRows")||0;m>s&&Re("headingRows",m+d,r,c)}}))}getColumns(e){return[...e.getChild(0).getChildren()].filter((t=>t.is("element","tableCell"))).reduce(((t,o)=>t+parseInt(o.getAttribute("colspan")||"1")),0)}getRows(e){return Array.from(e.getChildren()).reduce(((t,o)=>o.is("element","tableRow")?t+1:t),0)}createTableWalker(e,t={}){return new Ae(e,t)}getSelectedTableCells(e){let t=[];for(let o of this.sortRanges(e.getRanges())){let i=o.getContainedElement();i&&i.is("element","tableCell")&&t.push(i)}return t}getTableCellsContainingSelection(e){let t=[];for(let o of e.getRanges()){let i=o.start.findAncestor("tableCell");i&&t.push(i)}return t}getSelectionAffectedTableCells(e){let t=this.getSelectedTableCells(e);return t.length?t:this.getTableCellsContainingSelection(e)}getRowIndexes(e){let t=e.map((o=>o.parent.index));return this._getFirstLastIndexesObject(t)}getColumnIndexes(e){let t=e[0].findAncestor("table"),o=[...new Ae(t)].filter((i=>e.includes(i.cell))).map((i=>i.column));return this._getFirstLastIndexesObject(o)}isSelectionRectangular(e){if(e.length<2||!this._areCellInTheSameTableSection(e))return!1;let t=new Set,o=new Set,i=0;for(let r of e){let{row:s,column:a}=this.getCellLocation(r),l=parseInt(r.getAttribute("rowspan"))||1,c=parseInt(r.getAttribute("colspan"))||1;t.add(s),o.add(a),l>1&&t.add(s+l-1),c>1&&o.add(a+c-1),i+=l*c}return(function(r,s){let a=Array.from(r.values()),l=Array.from(s.values()),c=Math.max(...a),d=Math.min(...a),u=Math.max(...l),h=Math.min(...l);return(c-d+1)*(u-h+1)})(t,o)==i}sortRanges(e){return Array.from(e).sort(CT)}_getFirstLastIndexesObject(e){let t=e.sort(((o,i)=>o-i));return{first:t[0],last:t[t.length-1]}}_areCellInTheSameTableSection(e){let t=e[0].findAncestor("table"),o=this.getRowIndexes(e),i=parseInt(t.getAttribute("headingRows"))||0;if(!this._areIndexesInSameSection(o,i))return!1;let r=this.getColumnIndexes(e),s=parseInt(t.getAttribute("headingColumns"))||0;return this._areIndexesInSameSection(r,s)}_areIndexesInSameSection({first:e,last:t},o){return e<o==t<o}}function zc(n,e,t,o,i,r={}){for(let s=0;s<o;s++){let a=n.createElement("tableRow");n.insert(a,e,t),qi(i,n,n.createPositionAt(a,"end"),r)}}function qi(n,e,t,o={}){for(let i=0;i<n;i++)ti(e,t,o)}function Pb(n,e){if(n<e)return{newCellsSpan:1,updatedSpan:1};let t=Math.floor(n/e);return{newCellsSpan:t,updatedSpan:n-t*e+t}}function CT(n,e){let t=n.start,o=e.start;return t.isBefore(o)?-1:1}class vT extends re{refresh(){let e=this.editor.plugins.get(nt),t=e.getSelectedTableCells(this.editor.model.document.selection);this.isEnabled=e.isSelectionRectangular(t)}execute(){let e=this.editor.model,t=this.editor.plugins.get(nt);e.change((o=>{let i=t.getSelectedTableCells(e.document.selection),r=i.shift(),{mergeWidth:s,mergeHeight:a}=(function(l,c,d){let u=0,h=0;for(let A of c){let{row:S,column:M}=d.getCellLocation(A);u=zb(A,M,u,"colspan"),h=zb(A,S,h,"rowspan")}let{row:m,column:g}=d.getCellLocation(l),b=u-g,w=h-m;return{mergeWidth:b,mergeHeight:w}})(r,i,t);Re("colspan",s,r,o),Re("rowspan",a,r,o);for(let l of i)yT(l,r,o);Lc(r.findAncestor("table"),t),o.setSelection(r,"in")}))}}function yT(n,e,t){Lb(n)||(Lb(e)&&t.remove(t.createRangeIn(e)),t.move(t.createRangeIn(n),t.createPositionAt(e,"end"))),t.remove(n)}function Lb(n){let e=n.getChild(0);return n.childCount==1&&e.is("element","paragraph")&&e.isEmpty}function zb(n,e,t,o){let i=parseInt(n.getAttribute(o)||"1");return Math.max(t,e+i)}class xT extends re{constructor(e){super(e),this.affectsData=!1}refresh(){let e=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=e.length>0}execute(){let e=this.editor.model,t=this.editor.plugins.get("TableUtils"),o=t.getSelectionAffectedTableCells(e.document.selection),i=t.getRowIndexes(o),r=o[0].findAncestor("table"),s=[];for(let a=i.first;a<=i.last;a++)for(let l of r.getChild(a).getChildren())s.push(e.createRangeOn(l));e.change((a=>{a.setSelection(s)}))}}class ET extends re{constructor(e){super(e),this.affectsData=!1}refresh(){let e=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=e.length>0}execute(){let e=this.editor.plugins.get("TableUtils"),t=this.editor.model,o=e.getSelectionAffectedTableCells(t.document.selection),i=o[0],r=o.pop(),s=i.findAncestor("table"),a=e.getCellLocation(i),l=e.getCellLocation(r),c=Math.min(a.column,l.column),d=Math.max(a.column,l.column),u=[];for(let h of new Ae(s,{startColumn:c,endColumn:d}))u.push(t.createRangeOn(h.cell));t.change((h=>{h.setSelection(u)}))}}function DT(n){n.document.registerPostFixer((e=>(function(t,o){let i=o.document.differ.getChanges(),r=!1,s=new Set;for(let a of i){let l=null;a.type=="insert"&&a.name=="table"&&(l=a.position.nodeAfter),a.type!="insert"&&a.type!="remove"||a.name!="tableRow"&&a.name!="tableCell"||(l=a.position.findAncestor("table")),IT(a)&&(l=a.range.start.findAncestor("table")),l&&!s.has(l)&&(r=TT(l,t)||r,r=ST(l,t)||r,s.add(l))}return r})(e,n)))}function TT(n,e){let t=!1,o=(function(i){let r=parseInt(i.getAttribute("headingRows")||"0"),s=Array.from(i.getChildren()).reduce(((l,c)=>c.is("element","tableRow")?l+1:l),0),a=[];for(let{row:l,cell:c,cellHeight:d}of new Ae(i)){if(d<2)continue;let u=l<r?r:s;if(l+d>u){let h=u-l;a.push({cell:c,rowspan:h})}}return a})(n);if(o.length){t=!0;for(let i of o)Re("rowspan",i.rowspan,i.cell,e,1)}return t}function ST(n,e){let t=!1,o=(function(a){let l=new Array(a.childCount).fill(0);for(let{rowIndex:c}of new Ae(a,{includeAllSlots:!0}))l[c]++;return l})(n),i=[];for(let[a,l]of o.entries())!l&&n.getChild(a).is("element","tableRow")&&i.push(a);if(i.length){t=!0;for(let a of i.reverse())e.remove(n.getChild(a)),o.splice(a,1)}let r=o.filter(((a,l)=>n.getChild(l).is("element","tableRow"))),s=r[0];if(!r.every((a=>a===s))){let a=r.reduce(((l,c)=>c>l?c:l),0);for(let[l,c]of r.entries()){let d=a-c;if(d){for(let u=0;u<d;u++)ti(e,e.createPositionAt(n.getChild(l),"end"));t=!0}}}return t}function IT(n){if(n.type!=="attribute")return!1;let e=n.attributeKey;return e==="headingRows"||e==="colspan"||e==="rowspan"}function BT(n){n.document.registerPostFixer((e=>(function(t,o){let i=o.document.differ.getChanges(),r=!1;for(let s of i)s.type=="insert"&&s.name=="table"&&(r=MT(s.position.nodeAfter,t)||r),s.type=="insert"&&s.name=="tableRow"&&(r=Ob(s.position.nodeAfter,t)||r),s.type=="insert"&&s.name=="tableCell"&&(r=Oc(s.position.nodeAfter,t)||r),s.type!="remove"&&s.type!="insert"||!NT(s)||(r=Oc(s.position.parent,t)||r);return r})(e,n)))}function MT(n,e){let t=!1;for(let o of n.getChildren())o.is("element","tableRow")&&(t=Ob(o,e)||t);return t}function Ob(n,e){let t=!1;for(let o of n.getChildren())t=Oc(o,e)||t;return t}function Oc(n,e){if(n.childCount==0)return e.insertElement("paragraph",n),!0;let t=Array.from(n.getChildren()).filter((o=>o.is("$text")));for(let o of t)e.wrap(e.createRangeOn(o),"paragraph");return!!t.length}function NT(n){return!!n.position.parent.is("element","tableCell")&&(n.type=="insert"&&n.name=="$text"||n.type=="remove")}function PT(n,e){if(!n.is("element","paragraph"))return!1;let t=e.toViewElement(n);return!!t&&Ab(n)!==t.is("element","span")}var Rb=z(4777),LT={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(Rb.Z,LT),Rb.Z.locals;class $s extends L{static get pluginName(){return"TableEditing"}static get requires(){return[nt]}constructor(e){super(e),this._additionalSlots=[]}init(){let e=this.editor,t=e.model,o=t.schema,i=e.conversion,r=e.plugins.get(nt);o.register("table",{inheritAllFrom:"$blockObject",allowAttributes:["headingRows","headingColumns"]}),o.register("tableRow",{allowIn:"table",isLimit:!0}),o.register("tableCell",{allowContentOf:"$container",allowIn:"tableRow",allowAttributes:["colspan","rowspan"],isLimit:!0,isSelectable:!0}),i.for("upcast").add((s=>{s.on("element:figure",((a,l,c)=>{if(!c.consumable.test(l.viewItem,{name:!0,classes:"table"}))return;let d=(function(h){for(let m of h.getChildren())if(m.is("element","table"))return m})(l.viewItem);if(!d||!c.consumable.test(d,{name:!0}))return;c.consumable.consume(l.viewItem,{name:!0,classes:"table"});let u=Be(c.convertItem(d,l.modelCursor).modelRange.getItems());u?(c.convertChildren(l.viewItem,c.writer.createPositionAt(u,"end")),c.updateConversionResult(u,l)):c.consumable.revert(l.viewItem,{name:!0,classes:"table"})}))})),i.for("upcast").add(hT()),i.for("editingDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:bb(r,{asWidget:!0,additionalSlots:this._additionalSlots})}),i.for("dataDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:bb(r,{additionalSlots:this._additionalSlots})}),i.for("upcast").elementToElement({model:"tableRow",view:"tr"}),i.for("upcast").add((s=>{s.on("element:tr",((a,l)=>{l.viewItem.isEmpty&&l.modelCursor.index==0&&a.stop()}),{priority:"high"})})),i.for("downcast").elementToElement({model:"tableRow",view:(s,{writer:a})=>s.isEmpty?a.createEmptyElement("tr"):a.createContainerElement("tr")}),i.for("upcast").elementToElement({model:"tableCell",view:"td"}),i.for("upcast").elementToElement({model:"tableCell",view:"th"}),i.for("upcast").add(kb("td")),i.for("upcast").add(kb("th")),i.for("editingDowncast").elementToElement({model:"tableCell",view:wb({asWidget:!0})}),i.for("dataDowncast").elementToElement({model:"tableCell",view:wb()}),i.for("editingDowncast").elementToElement({model:"paragraph",view:_b({asWidget:!0}),converterPriority:"high"}),i.for("dataDowncast").elementToElement({model:"paragraph",view:_b(),converterPriority:"high"}),i.for("downcast").attributeToAttribute({model:"colspan",view:"colspan"}),i.for("upcast").attributeToAttribute({model:{key:"colspan",value:Fb("colspan")},view:"colspan"}),i.for("downcast").attributeToAttribute({model:"rowspan",view:"rowspan"}),i.for("upcast").attributeToAttribute({model:{key:"rowspan",value:Fb("rowspan")},view:"rowspan"}),e.config.define("table.defaultHeadings.rows",0),e.config.define("table.defaultHeadings.columns",0),e.commands.add("insertTable",new pT(e)),e.commands.add("insertTableRowAbove",new Cb(e,{order:"above"})),e.commands.add("insertTableRowBelow",new Cb(e,{order:"below"})),e.commands.add("insertTableColumnLeft",new vb(e,{order:"left"})),e.commands.add("insertTableColumnRight",new vb(e,{order:"right"})),e.commands.add("removeTableRow",new fT(e)),e.commands.add("removeTableColumn",new kT(e)),e.commands.add("splitTableCellVertically",new yb(e,{direction:"vertically"})),e.commands.add("splitTableCellHorizontally",new yb(e,{direction:"horizontally"})),e.commands.add("mergeTableCells",new vT(e)),e.commands.add("mergeTableCellRight",new Us(e,{direction:"right"})),e.commands.add("mergeTableCellLeft",new Us(e,{direction:"left"})),e.commands.add("mergeTableCellDown",new Us(e,{direction:"down"})),e.commands.add("mergeTableCellUp",new Us(e,{direction:"up"})),e.commands.add("setTableColumnHeader",new wT(e)),e.commands.add("setTableRowHeader",new bT(e)),e.commands.add("selectTableRow",new xT(e)),e.commands.add("selectTableColumn",new ET(e)),DT(t),BT(t),this.listenTo(t.document,"change:data",(()=>{(function(s,a){let l=s.document.differ;for(let c of l.getChanges()){let d,u=!1;if(c.type=="attribute"){let b=c.range.start.nodeAfter;if(!b||!b.is("element","table")||c.attributeKey!="headingRows"&&c.attributeKey!="headingColumns")continue;d=b,u=c.attributeKey=="headingRows"}else c.name!="tableRow"&&c.name!="tableCell"||(d=c.position.findAncestor("table"),u=c.name=="tableRow");if(!d)continue;let h=d.getAttribute("headingRows")||0,m=d.getAttribute("headingColumns")||0,g=new Ae(d);for(let b of g){let w=b.row<h||b.column<m?"th":"td",A=a.mapper.toViewElement(b.cell);A&&A.is("element")&&A.name!=w&&a.reconvertItem(u?b.cell.parent:b.cell)}}})(t,e.editing),(function(s,a){let l=s.document.differ,c=new Set;for(let d of l.getChanges()){let u=d.type=="attribute"?d.range.start.parent:d.position.parent;u.is("element","tableCell")&&c.add(u)}for(let d of c.values()){let u=Array.from(d.getChildren()).filter((h=>PT(h,a.mapper)));for(let h of u)a.reconvertItem(h)}})(t,e.editing)}))}registerAdditionalSlot(e){this._additionalSlots.push(e)}}function Fb(n){return e=>{let t=parseInt(e.getAttribute(n));return Number.isNaN(t)||t<=0?null:t}}var Vb=z(7284),zT={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(Vb.Z,zT),Vb.Z.locals;class jb extends K{constructor(e){super(e);let t=this.bindTemplate;this.items=this._createGridCollection(),this.keystrokes=new Ve,this.focusTracker=new Me,this.set("rows",0),this.set("columns",0),this.bind("label").to(this,"columns",this,"rows",((o,i)=>`${i} \xD7 ${o}`)),this.setTemplate({tag:"div",attributes:{class:["ck"]},children:[{tag:"div",attributes:{class:["ck-insert-table-dropdown__grid"]},on:{"mouseover@.ck-insert-table-dropdown-grid-box":t.to("boxover")},children:this.items},{tag:"div",attributes:{class:["ck","ck-insert-table-dropdown__label"],"aria-hidden":!0},children:[{text:t.to("label")}]}],on:{mousedown:t.to((o=>{o.preventDefault()})),click:t.to((()=>{this.fire("execute")}))}}),this.on("boxover",((o,i)=>{let{row:r,column:s}=i.target.dataset;this.items.get(10*(parseInt(r,10)-1)+(parseInt(s,10)-1)).focus()})),this.focusTracker.on("change:focusedElement",((o,i,r)=>{if(!r)return;let{row:s,column:a}=r.dataset;this.set({rows:parseInt(s),columns:parseInt(a)})})),this.on("change:columns",(()=>this._highlightGridBoxes())),this.on("change:rows",(()=>this._highlightGridBoxes()))}render(){super.render(),x({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.items,numberOfColumns:10,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection});for(let e of this.items)this.focusTracker.add(e.element);this.keystrokes.listenTo(this.element)}reset(){this.set({rows:1,columns:1})}focus(){this.items.get(0).focus()}focusLast(){this.items.get(0).focus()}_highlightGridBoxes(){let e=this.rows,t=this.columns;this.items.map(((o,i)=>{let r=Math.floor(i/10)<e&&i%10<t;o.set("isOn",r)}))}_createGridButton(e,t,o,i){let r=new ne(e);return r.set({label:i,class:"ck-insert-table-dropdown-grid-box"}),r.extendTemplate({attributes:{"data-row":t,"data-column":o}}),r}_createGridCollection(){let e=[];for(let t=0;t<100;t++){let o=Math.floor(t/10),i=t%10,r=`${o+1} \xD7 ${i+1}`;e.push(this._createGridButton(this.locale,o+1,i+1,r))}return this.createCollection(e)}}class OT extends L{static get pluginName(){return"TableUI"}init(){let e=this.editor,t=this.editor.t,o=e.locale.contentLanguageDirection==="ltr";e.ui.componentFactory.add("insertTable",(i=>{let r=e.commands.get("insertTable"),s=ot(i),a;return s.bind("isEnabled").to(r),s.buttonView.set({icon:Y.table,label:t("Insert table"),tooltip:!0}),s.on("change:isOpen",(()=>{a||(a=new jb(i),s.panelView.children.add(a),a.delegate("execute").to(s),s.on("execute",(()=>{e.execute("insertTable",{rows:a.rows,columns:a.columns}),e.editing.view.focus()})))})),s})),e.ui.componentFactory.add("menuBar:insertTable",(i=>{let r=e.commands.get("insertTable"),s=new eo(i),a=new jb(i);return a.delegate("execute").to(s),s.on("change:isOpen",((l,c,d)=>{d||a.reset()})),a.on("execute",(()=>{e.execute("insertTable",{rows:a.rows,columns:a.columns}),e.editing.view.focus()})),s.buttonView.set({label:t("Table"),icon:Y.table}),s.panelView.children.add(a),s.bind("isEnabled").to(r),s})),e.ui.componentFactory.add("tableColumn",(i=>{let r=[{type:"switchbutton",model:{commandName:"setTableColumnHeader",label:t("Header column"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:o?"insertTableColumnLeft":"insertTableColumnRight",label:t("Insert column left")}},{type:"button",model:{commandName:o?"insertTableColumnRight":"insertTableColumnLeft",label:t("Insert column right")}},{type:"button",model:{commandName:"removeTableColumn",label:t("Delete column")}},{type:"button",model:{commandName:"selectTableColumn",label:t("Select column")}}];return this._prepareDropdown(t("Column"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M18 7v1H2V7h16zm0 5v1H2v-1h16z" opacity=".6"/><path d="M14 1v18a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V1a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1zm-2 1H8v4h4V2zm0 6H8v4h4V8zm0 6H8v4h4v-4z"/></svg>',r,i)})),e.ui.componentFactory.add("tableRow",(i=>{let r=[{type:"switchbutton",model:{commandName:"setTableRowHeader",label:t("Header row"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:"insertTableRowAbove",label:t("Insert row above")}},{type:"button",model:{commandName:"insertTableRowBelow",label:t("Insert row below")}},{type:"button",model:{commandName:"removeTableRow",label:t("Delete row")}},{type:"button",model:{commandName:"selectTableRow",label:t("Select row")}}];return this._prepareDropdown(t("Row"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M7 2h1v16H7V2zm5 0h1v16h-1V2z" opacity=".6"/><path d="M1 6h18a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H1a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1zm1 2v4h4V8H2zm6 0v4h4V8H8zm6 0v4h4V8h-4z"/></svg>',r,i)})),e.ui.componentFactory.add("mergeTableCells",(i=>{let r=[{type:"button",model:{commandName:"mergeTableCellUp",label:t("Merge cell up")}},{type:"button",model:{commandName:o?"mergeTableCellRight":"mergeTableCellLeft",label:t("Merge cell right")}},{type:"button",model:{commandName:"mergeTableCellDown",label:t("Merge cell down")}},{type:"button",model:{commandName:o?"mergeTableCellLeft":"mergeTableCellRight",label:t("Merge cell left")}},{type:"separator"},{type:"button",model:{commandName:"splitTableCellVertically",label:t("Split cell vertically")}},{type:"button",model:{commandName:"splitTableCellHorizontally",label:t("Split cell horizontally")}}];return this._prepareMergeSplitButtonDropdown(t("Merge cells"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M7 2h1v16H7V2zm5 0h1v7h-1V2zm6 5v1H2V7h16zM8 12v1H2v-1h6z" opacity=".6"/><path d="M7 7h12a1 1 0 0 1 1 1v11a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1zm1 2v9h10V9H8z"/></svg>',r,i)}))}_prepareDropdown(e,t,o,i){let r=this.editor,s=ot(i),a=this._fillDropdownWithListOptions(s,o);return s.buttonView.set({label:e,icon:t,tooltip:!0}),s.bind("isEnabled").toMany(a,"isEnabled",((...l)=>l.some((c=>c)))),this.listenTo(s,"execute",(l=>{r.execute(l.source.commandName),l.source instanceof rs||r.editing.view.focus()})),s}_prepareMergeSplitButtonDropdown(e,t,o,i){let r=this.editor,s=ot(i,Fn),a="mergeTableCells",l=r.commands.get(a),c=this._fillDropdownWithListOptions(s,o);return s.buttonView.set({label:e,icon:t,tooltip:!0,isEnabled:!0}),s.bind("isEnabled").toMany([l,...c],"isEnabled",((...d)=>d.some((u=>u)))),this.listenTo(s.buttonView,"execute",(()=>{r.execute(a),r.editing.view.focus()})),this.listenTo(s,"execute",(d=>{r.execute(d.source.commandName),r.editing.view.focus()})),s}_fillDropdownWithListOptions(e,t){let o=this.editor,i=[],r=new Je;for(let s of t)RT(s,o,i,r);return vo(e,r),i}}function RT(n,e,t,o){if(n.type==="button"||n.type==="switchbutton"){let i=n.model=new Wo(n.model),{commandName:r,bindIsOn:s}=n.model,a=e.commands.get(r);t.push(a),i.set({commandName:r}),i.bind("isEnabled").to(a),s&&i.bind("isOn").to(a,"value"),i.set({withText:!0})}o.add(n)}var Hb=z(5593),FT={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(Hb.Z,FT),Hb.Z.locals;class oi extends L{static get pluginName(){return"TableSelection"}static get requires(){return[nt,nt]}init(){let e=this.editor,t=e.model,o=e.editing.view;this.listenTo(t,"deleteContent",((i,r)=>this._handleDeleteContent(i,r)),{priority:"high"}),this.listenTo(o.document,"insertText",((i,r)=>this._handleInsertTextEvent(i,r)),{priority:"high"}),this._defineSelectionConverter(),this._enablePluginDisabling()}getSelectedTableCells(){let e=this.editor.plugins.get(nt),t=this.editor.model.document.selection,o=e.getSelectedTableCells(t);return o.length==0?null:o}getSelectionAsFragment(){let e=this.editor.plugins.get(nt),t=this.getSelectedTableCells();return t?this.editor.model.change((o=>{let i=o.createDocumentFragment(),{first:r,last:s}=e.getColumnIndexes(t),{first:a,last:l}=e.getRowIndexes(t),c=t[0].findAncestor("table"),d=l,u=s;if(e.isSelectionRectangular(t)){let m={firstColumn:r,lastColumn:s,firstRow:a,lastRow:l};d=Bb(c,m),u=Mb(c,m)}let h=xb(c,{startRow:a,startColumn:r,endRow:d,endColumn:u},o);return o.insert(h,i,0),i})):null}setCellSelection(e,t){let o=this._getCellsToSelect(e,t);this.editor.model.change((i=>{i.setSelection(o.cells.map((r=>i.createRangeOn(r))),{backward:o.backward})}))}getFocusCell(){let e=[...this.editor.model.document.selection.getRanges()].pop().getContainedElement();return e&&e.is("element","tableCell")?e:null}getAnchorCell(){let e=Be(this.editor.model.document.selection.getRanges()).getContainedElement();return e&&e.is("element","tableCell")?e:null}_defineSelectionConverter(){let e=this.editor,t=new Set;e.conversion.for("editingDowncast").add((o=>o.on("selection",((i,r,s)=>{let a=s.writer;(function(d){for(let u of t)d.removeClass("ck-editor__editable_selected",u);t.clear()})(a);let l=this.getSelectedTableCells();if(!l)return;for(let d of l){let u=s.mapper.toViewElement(d);a.addClass("ck-editor__editable_selected",u),t.add(u)}let c=s.mapper.toViewElement(l[l.length-1]);a.setSelection(c,0)}),{priority:"lowest"})))}_enablePluginDisabling(){let e=this.editor;this.on("change:isEnabled",(()=>{if(!this.isEnabled){let t=this.getSelectedTableCells();if(!t)return;e.model.change((o=>{let i=o.createPositionAt(t[0],0),r=e.model.schema.getNearestSelectionRange(i);o.setSelection(r)}))}}))}_handleDeleteContent(e,t){let o=this.editor.plugins.get(nt),i=t[0],r=t[1],s=this.editor.model,a=!r||r.direction=="backward",l=o.getSelectedTableCells(i);l.length&&(e.stop(),s.change((c=>{let d=l[a?l.length-1:0];s.change((h=>{for(let m of l)s.deleteContent(h.createSelection(m,"in"))}));let u=s.schema.getNearestSelectionRange(c.createPositionAt(d,0));i.is("documentSelection")?c.setSelection(u):i.setTo(u)})))}_handleInsertTextEvent(e,t){let o=this.editor,i=this.getSelectedTableCells();if(!i)return;let r=o.editing.view,s=o.editing.mapper,a=i.map((l=>r.createRangeOn(s.toViewElement(l))));t.selection=r.createSelection(a)}_getCellsToSelect(e,t){let o=this.editor.plugins.get("TableUtils"),i=o.getCellLocation(e),r=o.getCellLocation(t),s=Math.min(i.row,r.row),a=Math.max(i.row,r.row),l=Math.min(i.column,r.column),c=Math.max(i.column,r.column),d=new Array(a-s+1).fill(null).map((()=>[])),u={startRow:s,endRow:a,startColumn:l,endColumn:c};for(let{row:g,cell:b}of new Ae(e.findAncestor("table"),u))d[g-s].push(b);let h=r.row<i.row,m=r.column<i.column;return h&&d.reverse(),m&&d.forEach((g=>g.reverse())),{cells:d.flat(),backward:h||m}}}class VT extends L{static get pluginName(){return"TableClipboard"}static get requires(){return[Qn,Lt,oi,nt]}init(){let e=this.editor,t=e.editing.view.document;this.listenTo(t,"copy",((o,i)=>this._onCopyCut(o,i))),this.listenTo(t,"cut",((o,i)=>this._onCopyCut(o,i))),this.listenTo(e.model,"insertContent",((o,[i,r])=>this._onInsertContent(o,i,r)),{priority:"high"}),this.decorate("_replaceTableSlotCell")}_onCopyCut(e,t){let o=this.editor.editing.view,i=this.editor.plugins.get(oi),r=this.editor.plugins.get(Qn);i.getSelectedTableCells()&&(e.name!="cut"||this.editor.model.canEditAt(this.editor.model.document.selection))&&(t.preventDefault(),e.stop(),this.editor.model.enqueueChange({isUndoable:e.name==="cut"},(()=>{let s=r._copySelectedFragmentWithMarkers(e.name,this.editor.model.document.selection,(()=>i.getSelectionAsFragment()));o.document.fire("clipboardOutput",{dataTransfer:t.dataTransfer,content:this.editor.data.toView(s),method:e.name})})))}_onInsertContent(e,t,o){if(o&&!o.is("documentSelection"))return;let i=this.editor.model,r=this.editor.plugins.get(nt),s=this.editor.plugins.get(Qn),a=this.getTableIfOnlyTableInContent(t,i);if(!a)return;let l=r.getSelectionAffectedTableCells(i.document.selection);l.length?(e.stop(),t.is("documentFragment")?s._pasteMarkersIntoTransformedElement(t.markers,(c=>this._replaceSelectedCells(a,l,c))):this.editor.model.change((c=>{this._replaceSelectedCells(a,l,c)}))):Lc(a,r)}_replaceSelectedCells(e,t,o){let i=this.editor.plugins.get(nt),r={width:i.getColumns(e),height:i.getRows(e)},s=(function(u,h,m,g){let b=u[0].findAncestor("table"),w=g.getColumnIndexes(u),A=g.getRowIndexes(u),S={firstColumn:w.first,lastColumn:w.last,firstRow:A.first,lastRow:A.last},M=u.length===1;return M&&(S.lastRow+=h.height-1,S.lastColumn+=h.width-1,(function(F,G,X,ae){let De=ae.getColumns(F),$e=ae.getRows(F);X>De&&ae.insertColumns(F,{at:De,columns:X-De}),G>$e&&ae.insertRows(F,{at:$e,rows:G-$e})})(b,S.lastRow+1,S.lastColumn+1,g)),M||!g.isSelectionRectangular(u)?(function(F,G,X){let{firstRow:ae,lastRow:De,firstColumn:$e,lastColumn:e_}=G,t_={first:ae,last:De},o_={first:$e,last:e_};Fc(F,$e,t_,X),Fc(F,e_+1,t_,X),Rc(F,ae,o_,X),Rc(F,De+1,o_,X,ae)})(b,S,m):(S.lastRow=Bb(b,S),S.lastColumn=Mb(b,S)),S})(t,r,o,i),a=s.lastRow-s.firstRow+1,l=s.lastColumn-s.firstColumn+1;e=xb(e,{startRow:0,startColumn:0,endRow:Math.min(a,r.height)-1,endColumn:Math.min(l,r.width)-1},o);let c=t[0].findAncestor("table"),d=this._replaceSelectedCellsWithPasted(e,r,c,s,o);if(this.editor.plugins.get("TableSelection").isEnabled){let u=i.sortRanges(d.map((h=>o.createRangeOn(h))));o.setSelection(u)}else o.setSelection(d[0],0);return c}_replaceSelectedCellsWithPasted(e,t,o,i,r){let{width:s,height:a}=t,l=(function(w,A,S){let M=new Array(S).fill(null).map((()=>new Array(A).fill(null)));for(let{column:F,row:G,cell:X}of new Ae(w))M[G][F]=X;return M})(e,s,a),c=[...new Ae(o,{startRow:i.firstRow,endRow:i.lastRow,startColumn:i.firstColumn,endColumn:i.lastColumn,includeAllSlots:!0})],d=[],u;for(let w of c){let{row:A,column:S}=w;S===i.firstColumn&&(u=w.getPositionBefore());let M=A-i.firstRow,F=S-i.firstColumn,G=l[M%a][F%s],X=G?r.cloneElement(G):null,ae=this._replaceTableSlotCell(w,X,u,r);ae&&(Ib(ae,A,S,i.lastRow,i.lastColumn,r),d.push(ae),u=r.createPositionAfter(ae))}let h=parseInt(o.getAttribute("headingRows")||"0"),m=parseInt(o.getAttribute("headingColumns")||"0"),g=i.firstRow<h&&h<=i.lastRow,b=i.firstColumn<m&&m<=i.lastColumn;if(g){let w=Rc(o,h,{first:i.firstColumn,last:i.lastColumn},r,i.firstRow);d.push(...w)}if(b){let w=Fc(o,m,{first:i.firstRow,last:i.lastRow},r);d.push(...w)}return d}_replaceTableSlotCell(e,t,o,i){let{cell:r,isAnchor:s}=e;return s&&i.remove(r),t?(i.insert(t,o),t):null}getTableIfOnlyTableInContent(e,t){if(!e.is("documentFragment")&&!e.is("element"))return null;if(e.is("element","table"))return e;if(e.childCount==1&&e.getChild(0).is("element","table"))return e.getChild(0);let o=t.createRangeIn(e);for(let i of o.getItems())if(i.is("element","table")){let r=t.createRange(o.start,t.createPositionBefore(i));if(t.hasContent(r,{ignoreWhitespaces:!0}))return null;let s=t.createRange(t.createPositionAfter(i),o.end);return t.hasContent(s,{ignoreWhitespaces:!0})?null:i}return null}}function Rc(n,e,t,o,i=0){if(!(e<1))return Eb(n,e,i).filter((({column:r,cellWidth:s})=>Ub(r,s,t))).map((({cell:r})=>Db(r,e,o)))}function Fc(n,e,t,o){if(!(e<1))return Tb(n,e).filter((({row:i,cellHeight:r})=>Ub(i,r,t))).map((({cell:i,column:r})=>Sb(i,r,e,o)))}function Ub(n,e,t){let o=n+e-1,{first:i,last:r}=t;return n>=i&&n<=r||n<i&&o>=i}class jT extends L{static get pluginName(){return"TableKeyboard"}static get requires(){return[oi,nt]}init(){let e=this.editor,t=e.editing.view.document,o=e.t;this.listenTo(t,"arrowKey",((...i)=>this._onArrowKey(...i)),{context:"table"}),this.listenTo(t,"tab",((...i)=>this._handleTabOnSelectedTable(...i)),{context:"figure"}),this.listenTo(t,"tab",((...i)=>this._handleTab(...i)),{context:["th","td"]}),e.accessibility.addKeystrokeInfoGroup({id:"table",label:o("Keystrokes that can be used in a table cell"),keystrokes:[{label:o("Move the selection to the next cell"),keystroke:"Tab"},{label:o("Move the selection to the previous cell"),keystroke:"Shift+Tab"},{label:o("Insert a new table row (when in the last cell of a table)"),keystroke:"Tab"},{label:o("Navigate through the table"),keystroke:[["arrowup"],["arrowright"],["arrowdown"],["arrowleft"]]}]})}_handleTabOnSelectedTable(e,t){let o=this.editor,i=o.model.document.selection.getSelectedElement();i&&i.is("element","table")&&(t.preventDefault(),t.stopPropagation(),e.stop(),o.model.change((r=>{r.setSelection(r.createRangeIn(i.getChild(0).getChild(0)))})))}_handleTab(e,t){let o=this.editor,i=this.editor.plugins.get(nt),r=this.editor.plugins.get("TableSelection"),s=o.model.document.selection,a=!t.shiftKey,l=i.getTableCellsContainingSelection(s)[0];if(l||(l=r.getFocusCell()),!l)return;t.preventDefault(),t.stopPropagation(),e.stop();let c=l.parent,d=c.parent,u=d.getChildIndex(c),h=c.getChildIndex(l),m=h===0;if(!a&&m&&u===0)return void o.model.change((A=>{A.setSelection(A.createRangeOn(d))}));let g=h===c.childCount-1,b=u===i.getRows(d)-1;if(a&&b&&g&&(o.execute("insertTableRowBelow"),u===i.getRows(d)-1))return void o.model.change((A=>{A.setSelection(A.createRangeOn(d))}));let w;if(a&&g)w=d.getChild(u+1).getChild(0);else if(!a&&m){let A=d.getChild(u-1);w=A.getChild(A.childCount-1)}else w=c.getChild(h+(a?1:-1));o.model.change((A=>{A.setSelection(A.createRangeIn(w))}))}_onArrowKey(e,t){let o=this.editor,i=Za(t.keyCode,o.locale.contentLanguageDirection);this._handleArrowKeys(i,t.shiftKey)&&(t.preventDefault(),t.stopPropagation(),e.stop())}_handleArrowKeys(e,t){let o=this.editor.plugins.get(nt),i=this.editor.plugins.get("TableSelection"),r=this.editor.model,s=r.document.selection,a=["right","down"].includes(e),l=o.getSelectedTableCells(s);if(l.length){let d;return d=t?i.getFocusCell():a?l[l.length-1]:l[0],this._navigateFromCellInDirection(d,e,t),!0}let c=s.focus.findAncestor("tableCell");if(!c)return!1;if(!s.isCollapsed)if(t){if(s.isBackward==a&&!s.containsEntireContent(c))return!1}else{let d=s.getSelectedElement();if(!d||!r.schema.isObject(d))return!1}return!!this._isSelectionAtCellEdge(s,c,a)&&(this._navigateFromCellInDirection(c,e,t),!0)}_isSelectionAtCellEdge(e,t,o){let i=this.editor.model,r=this.editor.model.schema,s=o?e.getLastPosition():e.getFirstPosition();if(!r.getLimitElement(s).is("element","tableCell"))return i.createPositionAt(t,o?"end":0).isTouching(s);let a=i.createSelection(s);return i.modifySelection(a,{direction:o?"forward":"backward"}),s.isEqual(a.focus)}_navigateFromCellInDirection(e,t,o=!1){let i=this.editor.model,r=e.findAncestor("table"),s=[...new Ae(r,{includeAllSlots:!0})],{row:a,column:l}=s[s.length-1],c=s.find((({cell:b})=>b==e)),{row:d,column:u}=c;switch(t){case"left":u--;break;case"up":d--;break;case"right":u+=c.cellWidth;break;case"down":d+=c.cellHeight}if(d<0||d>a||u<0&&d<=0||u>l&&d>=a)return void i.change((b=>{b.setSelection(b.createRangeOn(r))}));u<0?(u=o?0:l,d--):u>l&&(u=o?l:0,d++);let h=s.find((b=>b.row==d&&b.column==u)).cell,m=["right","down"].includes(t),g=this.editor.plugins.get("TableSelection");if(o&&g.isEnabled){let b=g.getAnchorCell()||e;g.setCellSelection(b,h)}else{let b=i.createPositionAt(h,m?0:"end");i.change((w=>{w.setSelection(b)}))}}}class HT extends _o{constructor(){super(...arguments),this.domEventType=["mousemove","mouseleave"]}onDomEvent(e){this.fire(e.type,e)}}class UT extends L{static get pluginName(){return"TableMouse"}static get requires(){return[oi,nt]}init(){this.editor.editing.view.addObserver(HT),this._enableShiftClickSelection(),this._enableMouseDragSelection()}_enableShiftClickSelection(){let e=this.editor,t=e.plugins.get(nt),o=!1,i=e.plugins.get(oi);this.listenTo(e.editing.view.document,"mousedown",((r,s)=>{let a=e.model.document.selection;if(!this.isEnabled||!i.isEnabled||!s.domEvent.shiftKey)return;let l=i.getAnchorCell()||t.getTableCellsContainingSelection(a)[0];if(!l)return;let c=this._getModelTableCellFromDomEvent(s);c&&$b(l,c)&&(o=!0,i.setCellSelection(l,c),s.preventDefault())})),this.listenTo(e.editing.view.document,"mouseup",(()=>{o=!1})),this.listenTo(e.editing.view.document,"selectionChange",(r=>{o&&r.stop()}),{priority:"highest"})}_enableMouseDragSelection(){let e=this.editor,t,o,i=!1,r=!1,s=e.plugins.get(oi);this.listenTo(e.editing.view.document,"mousedown",((a,l)=>{this.isEnabled&&s.isEnabled&&(l.domEvent.shiftKey||l.domEvent.ctrlKey||l.domEvent.altKey||(t=this._getModelTableCellFromDomEvent(l)))})),this.listenTo(e.editing.view.document,"mousemove",((a,l)=>{if(!l.domEvent.buttons||!t)return;let c=this._getModelTableCellFromDomEvent(l);c&&$b(t,c)&&(o=c,i||o==t||(i=!0)),i&&(r=!0,s.setCellSelection(t,o),l.preventDefault())})),this.listenTo(e.editing.view.document,"mouseup",(()=>{i=!1,r=!1,t=null,o=null})),this.listenTo(e.editing.view.document,"selectionChange",(a=>{r&&a.stop()}),{priority:"highest"})}_getModelTableCellFromDomEvent(e){let t=e.target,o=this.editor.editing.view.createPositionAt(t,0);return this.editor.editing.mapper.toModelPosition(o).parent.findAncestor("tableCell",{includeSelf:!0})}}function $b(n,e){return n.parent.parent==e.parent.parent}var qb=z(4104),$T={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(qb.Z,$T),qb.Z.locals;class Wb extends L{static get requires(){return[$s,OT,oi,UT,jT,VT,Qo]}static get pluginName(){return"Table"}}function Gb(n){return Zb(n)||qs(n)}function Zb(n){let e=n.getSelectedElement();return e&&Kb(e)?e:null}function qs(n){let e=n.getFirstPosition();if(!e)return null;let t=e.parent;for(;t;){if(t.is("element")&&Kb(t))return t;t=t.parent}return null}function Kb(n){return!!n.getCustomProperty("table")&&He(n)}class ii extends re{constructor(e,t,o){super(e),this.attributeName=t,this._defaultValue=o}refresh(){let e=Mc(this.editor.model.document.selection);this.isEnabled=!!e,this.value=this._getValue(e)}execute(e={}){let t=this.editor.model,o=t.document.selection,{value:i,batch:r}=e,s=Mc(o),a=this._getValueToSet(i);t.enqueueChange(r,(l=>{a?l.setAttribute(this.attributeName,a,s):l.removeAttribute(this.attributeName,s)}))}_getValue(e){if(!e)return;let t=e.getAttribute(this.attributeName);return t!==this._defaultValue?t:void 0}_getValueToSet(e){if(e!==this._defaultValue)return e}}class qT extends ii{constructor(e,t){super(e,"tableBackgroundColor",t)}}function ni(n){if(!n||!xe(n))return n;let{top:e,right:t,bottom:o,left:i}=n;return e==t&&t==o&&o==i?e:void 0}function ri(n,e){let t=parseFloat(n);return Number.isNaN(t)||String(t)!==String(n)?n:`${t}${e}`}function ir(n,e={}){let t={borderStyle:"none",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",...n};return e.includeAlignmentProperty&&!t.alignment&&(t.alignment="center"),e.includePaddingProperty&&!t.padding&&(t.padding=""),e.includeVerticalAlignmentProperty&&!t.verticalAlignment&&(t.verticalAlignment="middle"),e.includeHorizontalAlignmentProperty&&!t.horizontalAlignment&&(t.horizontalAlignment=e.isRightToLeftContent?"right":"left"),t}class WT extends ii{constructor(e,t){super(e,"tableBorderColor",t)}_getValue(e){if(!e)return;let t=ni(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class GT extends ii{constructor(e,t){super(e,"tableBorderStyle",t)}_getValue(e){if(!e)return;let t=ni(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class ZT extends ii{constructor(e,t){super(e,"tableBorderWidth",t)}_getValue(e){if(!e)return;let t=ni(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}_getValueToSet(e){let t=ri(e,"px");if(t!==this._defaultValue)return t}}class KT extends ii{constructor(e,t){super(e,"tableWidth",t)}_getValueToSet(e){if((e=ri(e,"px"))!==this._defaultValue)return e}}class YT extends ii{constructor(e,t){super(e,"tableHeight",t)}_getValueToSet(e){if((e=ri(e,"px"))!==this._defaultValue)return e}}class QT extends ii{constructor(e,t){super(e,"tableAlignment",t)}}let JT=/^(left|center|right)$/,XT=/^(left|none|right)$/;class eS extends L{static get pluginName(){return"TablePropertiesEditing"}static get requires(){return[$s]}init(){let e=this.editor,t=e.model.schema,o=e.conversion;e.config.define("table.tableProperties.defaultProperties",{});let i=ir(e.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0});e.data.addStyleProcessorRules(Bm),(function(r,s,a){let l={width:"tableBorderWidth",color:"tableBorderColor",style:"tableBorderStyle"};r.extend("table",{allowAttributes:Object.values(l)}),Ic(s,"table",l,a),Vs(s,{modelAttribute:l.color,styleName:"border-color"}),Vs(s,{modelAttribute:l.style,styleName:"border-style"}),Vs(s,{modelAttribute:l.width,styleName:"border-width"})})(t,o,{color:i.borderColor,style:i.borderStyle,width:i.borderWidth}),e.commands.add("tableBorderColor",new WT(e,i.borderColor)),e.commands.add("tableBorderStyle",new GT(e,i.borderStyle)),e.commands.add("tableBorderWidth",new ZT(e,i.borderWidth)),(function(r,s,a){r.extend("table",{allowAttributes:["tableAlignment"]}),s.for("downcast").attributeToAttribute({model:{name:"table",key:"tableAlignment"},view:l=>({key:"style",value:{float:l==="center"?"none":l}}),converterPriority:"high"}),s.for("upcast").attributeToAttribute({view:{name:/^(table|figure)$/,styles:{float:XT}},model:{key:"tableAlignment",value:l=>{let c=l.getStyle("float");return c==="none"&&(c="center"),c===a?null:c}}}).attributeToAttribute({view:{attributes:{align:JT}},model:{name:"table",key:"tableAlignment",value:l=>{let c=l.getAttribute("align");return c===a?null:c}}})})(t,o,i.alignment),e.commands.add("tableAlignment",new QT(e,i.alignment)),Yb(t,o,{modelAttribute:"tableWidth",styleName:"width",defaultValue:i.width}),e.commands.add("tableWidth",new KT(e,i.width)),Yb(t,o,{modelAttribute:"tableHeight",styleName:"height",defaultValue:i.height}),e.commands.add("tableHeight",new YT(e,i.height)),e.data.addStyleProcessorRules(Pl),(function(r,s,a){let{modelAttribute:l}=a;r.extend("table",{allowAttributes:[l]}),Sc(s,{viewElement:"table",...a}),Vs(s,a)})(t,o,{modelAttribute:"tableBackgroundColor",styleName:"background-color",defaultValue:i.backgroundColor}),e.commands.add("tableBackgroundColor",new qT(e,i.backgroundColor))}}function Yb(n,e,t){let{modelAttribute:o}=t;n.extend("table",{allowAttributes:[o]}),Sc(e,{viewElement:/^(table|figure)$/,shouldUpcast:i=>!(i.name=="table"&&i.parent.name=="figure"),...t}),or(e,{modelElement:"table",...t})}var Qb=z(4082),tS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(Qb.Z,tS),Qb.Z.locals;class oS extends K{constructor(e,t){super(e),this.set("value",""),this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("isEmpty",!0),this.options=t,this.focusTracker=new Me,this._focusables=new et,this.dropdownView=this._createDropdownView(),this.inputView=this._createInputTextView(),this.keystrokes=new Ve,this._stillTyping=!1,this.focusCycler=new tt({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-input-color"]},children:[this.dropdownView,this.inputView]}),this.on("change:value",((o,i,r)=>this._setInputValue(r)))}render(){super.render(),[this.inputView,this.dropdownView.buttonView].forEach((e=>{this.focusTracker.add(e.element),this._focusables.add(e)})),this.keystrokes.listenTo(this.element)}focus(e){e===-1?this.focusCycler.focusLast():this.focusCycler.focusFirst()}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createDropdownView(){let e=this.locale,t=e.t,o=this.bindTemplate,i=this._createColorSelector(e),r=ot(e),s=new K;return s.setTemplate({tag:"span",attributes:{class:["ck","ck-input-color__button__preview"],style:{backgroundColor:o.to("value")}},children:[{tag:"span",attributes:{class:["ck","ck-input-color__button__preview__no-color-indicator",o.if("value","ck-hidden",(a=>a!=""))]}}]}),r.buttonView.extendTemplate({attributes:{class:"ck-input-color__button"}}),r.buttonView.children.add(s),r.buttonView.label=t("Color picker"),r.buttonView.tooltip=!0,r.panelPosition=e.uiLanguageDirection==="rtl"?"se":"sw",r.panelView.children.add(i),r.bind("isEnabled").to(this,"isReadOnly",(a=>!a)),r.on("change:isOpen",((a,l,c)=>{c&&(i.updateSelectedColors(),i.showColorGridsFragment())})),r}_createInputTextView(){let e=this.locale,t=new ug(e);return t.extendTemplate({on:{blur:t.bindTemplate.to("blur")}}),t.value=this.value,t.bind("isReadOnly","hasError").to(this),this.bind("isFocused","isEmpty").to(t),t.on("input",(()=>{let o=t.element.value,i=this.options.colorDefinitions.find((r=>o===r.label));this._stillTyping=!0,this.value=i&&i.color||o})),t.on("blur",(()=>{this._stillTyping=!1,this._setInputValue(t.element.value)})),t.delegate("input").to(this),t}_createColorSelector(e){let t=e.t,o=this.options.defaultColorValue||"",i=t(o?"Restore default":"Remove color"),r=new Yl(e,{colors:this.options.colorDefinitions,columns:this.options.columns,removeButtonLabel:i,colorPickerLabel:t("Color picker"),colorPickerViewConfig:this.options.colorPickerConfig!==!1&&{...this.options.colorPickerConfig,hideInput:!0}});r.appendUI(),r.on("execute",((a,l)=>{l.source!=="colorPickerSaveButton"?(this.value=l.value||o,this.fire("input"),l.source!=="colorPicker"&&(this.dropdownView.isOpen=!1)):this.dropdownView.isOpen=!1}));let s=this.value;return r.on("colorPicker:cancel",(()=>{this.value=s,this.fire("input"),this.dropdownView.isOpen=!1})),r.colorGridsFragmentView.colorPickerButtonView.on("execute",(()=>{s=this.value})),r.bind("selectedColor").to(this,"value"),r}_setInputValue(e){if(!this._stillTyping){let t=Jb(e),o=this.options.colorDefinitions.find((i=>t===Jb(i.color)));this.inputView.value=o?o.label:e||""}}}function Jb(n){return n.replace(/([(,])\s+/g,"$1").replace(/^\s+|\s+(?=[),\s]|$)/g,"").replace(/,|\s/g," ")}let Vc=n=>n==="";function jc(n){return{none:n("None"),solid:n("Solid"),dotted:n("Dotted"),dashed:n("Dashed"),double:n("Double"),groove:n("Groove"),ridge:n("Ridge"),inset:n("Inset"),outset:n("Outset")}}function Xb(n){return n('The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".')}function ew(n){return n('The value is invalid. Try "10px" or "2em" or simply "2".')}function Ws(n){return n=n.trim().toLowerCase(),Vc(n)||Tm(n)}function nr(n){return n=n.trim(),Vc(n)||iw(n)||Jr(n)||Sm(n)}function tw(n){return n=n.trim(),Vc(n)||iw(n)||Jr(n)}function ow(n,e){let t=new Je,o=jc(n.t);for(let i in o){let r={type:"button",model:new Wo({_borderStyleValue:i,label:o[i],role:"menuitemradio",withText:!0})};i==="none"?r.model.bind("isOn").to(n,"borderStyle",(s=>e==="none"?!s:s===i)):r.model.bind("isOn").to(n,"borderStyle",(s=>s===i)),t.add(r)}return t}function Hc(n){let{view:e,icons:t,toolbar:o,labels:i,propertyName:r,nameToValue:s,defaultValue:a}=n;for(let l in i){let c=new ne(e.locale);c.set({label:i[l],icon:t[l],tooltip:i[l]});let d=s?s(l):l;c.bind("isOn").to(e,r,(u=>{let h=u;return u===""&&a&&(h=a),d===h})),c.on("execute",(()=>{e[r]=d})),o.items.add(c)}}let Gs=[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}];function Zs(n){return(e,t,o)=>{let i=new oS(e.locale,{colorDefinitions:(r=n.colorConfig,r.map((s=>({color:s.model,label:s.label,options:{hasBorder:s.hasBorder}})))),columns:n.columns,defaultColorValue:n.defaultColorValue,colorPickerConfig:n.colorPickerConfig});var r;return i.inputView.set({id:t,ariaDescribedById:o}),i.bind("isReadOnly").to(e,"isEnabled",(s=>!s)),i.bind("hasError").to(e,"errorText",(s=>!!s)),i.on("input",(()=>{e.errorText=null})),e.bind("isEmpty","isFocused").to(i),i}}function iw(n){let e=parseFloat(n);return!Number.isNaN(e)&&n===String(e)}var nw=z(9865),iS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(nw.Z,iS),nw.Z.locals;class Et extends K{constructor(e,t={}){super(e);let o=this.bindTemplate;this.set("class",t.class||null),this.children=this.createCollection(),t.children&&t.children.forEach((i=>this.children.add(i))),this.set("_role",null),this.set("_ariaLabelledBy",null),t.labelView&&this.set({_role:"group",_ariaLabelledBy:t.labelView.id}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-form__row",o.to("class")],role:o.to("_role"),"aria-labelledby":o.to("_ariaLabelledBy")},children:this.children})}}var rw=z(4880),nS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(rw.Z,nS),rw.Z.locals;var sw=z(198),rS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(sw.Z,rS),sw.Z.locals;var aw=z(9221),sS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(aw.Z,sS),aw.Z.locals;let aS={left:Y.objectLeft,center:Y.objectCenter,right:Y.objectRight};class lS extends K{constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",alignment:""}),this.options=t;let{borderStyleDropdown:o,borderWidthInput:i,borderColorInput:r,borderRowLabel:s}=this._createBorderFields(),{backgroundRowLabel:a,backgroundInput:l}=this._createBackgroundFields(),{widthInput:c,operatorLabel:d,heightInput:u,dimensionsLabel:h}=this._createDimensionFields(),{alignmentToolbar:m,alignmentLabel:g}=this._createAlignmentFields();this.focusTracker=new Me,this.keystrokes=new Ve,this.children=this.createCollection(),this.borderStyleDropdown=o,this.borderWidthInput=i,this.borderColorInput=r,this.backgroundInput=l,this.widthInput=c,this.heightInput=u,this.alignmentToolbar=m;let{saveButtonView:b,cancelButtonView:w}=this._createActionButtons();this.saveButtonView=b,this.cancelButtonView=w,this._focusables=new et,this._focusCycler=new tt({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.add(new Jl(e,{label:this.t("Table properties")})),this.children.add(new Et(e,{labelView:s,children:[s,o,r,i],class:"ck-table-form__border-row"})),this.children.add(new Et(e,{labelView:a,children:[a,l],class:"ck-table-form__background-row"})),this.children.add(new Et(e,{children:[new Et(e,{labelView:h,children:[h,c,d,u],class:"ck-table-form__dimensions-row"}),new Et(e,{labelView:g,children:[g,m],class:"ck-table-properties-form__alignment-row"})]})),this.children.add(new Et(e,{children:[this.saveButtonView,this.cancelButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-properties-form"],tabindex:"-1"},children:this.children})}render(){super.render(),p({view:this}),[this.borderColorInput,this.backgroundInput].forEach((e=>{e.fieldView.focusCycler.on("forwardCycle",(t=>{this._focusCycler.focusNext(),t.stop()})),e.fieldView.focusCycler.on("backwardCycle",(t=>{this._focusCycler.focusPrevious(),t.stop()}))})),[this.borderStyleDropdown,this.borderColorInput,this.borderWidthInput,this.backgroundInput,this.widthInput,this.heightInput,this.alignmentToolbar,this.saveButtonView,this.cancelButtonView].forEach((e=>{this._focusables.add(e),this.focusTracker.add(e.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createBorderFields(){let e=this.options.defaultTableProperties,t={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},o=Zs({colorConfig:this.options.borderColors,columns:5,defaultColorValue:t.color,colorPickerConfig:this.options.colorPickerConfig}),i=this.locale,r=this.t,s=r("Style"),a=new yt(i);a.text=r("Border");let l=jc(r),c=new Ge(i,xg);c.set({label:s,class:"ck-table-form__border-style"}),c.fieldView.buttonView.set({ariaLabel:s,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:s}),c.fieldView.buttonView.bind("label").to(this,"borderStyle",(h=>l[h||"none"])),c.fieldView.on("execute",(h=>{this.borderStyle=h.source._borderStyleValue})),c.bind("isEmpty").to(this,"borderStyle",(h=>!h)),vo(c.fieldView,ow(this,t.style),{role:"menu",ariaLabel:s});let d=new Ge(i,xt);d.set({label:r("Width"),class:"ck-table-form__border-width"}),d.fieldView.bind("value").to(this,"borderWidth"),d.bind("isEnabled").to(this,"borderStyle",Ks),d.fieldView.on("input",(()=>{this.borderWidth=d.fieldView.element.value}));let u=new Ge(i,o);return u.set({label:r("Color"),class:"ck-table-form__border-color"}),u.fieldView.bind("value").to(this,"borderColor"),u.bind("isEnabled").to(this,"borderStyle",Ks),u.fieldView.on("input",(()=>{this.borderColor=u.fieldView.value})),this.on("change:borderStyle",((h,m,g,b)=>{Ks(g)||(this.borderColor="",this.borderWidth=""),Ks(b)||(this.borderColor=t.color,this.borderWidth=t.width)})),{borderRowLabel:a,borderStyleDropdown:c,borderColorInput:u,borderWidthInput:d}}_createBackgroundFields(){let e=this.locale,t=this.t,o=new yt(e);o.text=t("Background");let i=Zs({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableProperties.backgroundColor,colorPickerConfig:this.options.colorPickerConfig}),r=new Ge(e,i);return r.set({label:t("Color"),class:"ck-table-properties-form__background"}),r.fieldView.bind("value").to(this,"backgroundColor"),r.fieldView.on("input",(()=>{this.backgroundColor=r.fieldView.value})),{backgroundRowLabel:o,backgroundInput:r}}_createDimensionFields(){let e=this.locale,t=this.t,o=new yt(e);o.text=t("Dimensions");let i=new Ge(e,xt);i.set({label:t("Width"),class:"ck-table-form__dimensions-row__width"}),i.fieldView.bind("value").to(this,"width"),i.fieldView.on("input",(()=>{this.width=i.fieldView.element.value}));let r=new K(e);r.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"\xD7"}]});let s=new Ge(e,xt);return s.set({label:t("Height"),class:"ck-table-form__dimensions-row__height"}),s.fieldView.bind("value").to(this,"height"),s.fieldView.on("input",(()=>{this.height=s.fieldView.element.value})),{dimensionsLabel:o,widthInput:i,operatorLabel:r,heightInput:s}}_createAlignmentFields(){let e=this.locale,t=this.t,o=new yt(e);o.text=t("Alignment");let i=new Li(e);return i.set({isCompact:!0,ariaLabel:t("Table alignment toolbar")}),Hc({view:this,icons:aS,toolbar:i,labels:this._alignmentLabels,propertyName:"alignment",defaultValue:this.options.defaultTableProperties.alignment}),{alignmentLabel:o,alignmentToolbar:i}}_createActionButtons(){let e=this.locale,t=this.t,o=new ne(e),i=new ne(e),r=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.widthInput,this.heightInput];return o.set({label:t("Save"),icon:Y.check,class:"ck-button-save",type:"submit",withText:!0}),o.bind("isEnabled").toMany(r,"errorText",((...s)=>s.every((a=>!a)))),i.set({label:t("Cancel"),icon:Y.cancel,class:"ck-button-cancel",withText:!0}),i.delegate("execute").to(this,"cancel"),{saveButtonView:o,cancelButtonView:i}}get _alignmentLabels(){let e=this.locale,t=this.t,o=t("Align table to the left"),i=t("Center table"),r=t("Align table to the right");return e.uiLanguageDirection==="rtl"?{right:r,center:i,left:o}:{left:o,center:i,right:r}}}function Ks(n){return n!=="none"}let si=Oi.defaultPositions,Uc=[si.northArrowSouth,si.northArrowSouthWest,si.northArrowSouthEast,si.southArrowNorth,si.southArrowNorthWest,si.southArrowNorthEast,si.viewportStickyNorth];function lw(n,e){let t=n.plugins.get("ContextualBalloon"),o=n.editing.view.document.selection,i;e==="cell"?qs(o)&&(i=dw(n)):Gb(o)&&(i=cw(n)),i&&t.updatePosition(i)}function cw(n){let e=Mc(n.model.document.selection),t=n.editing.mapper.toViewElement(e);return{target:n.editing.view.domConverter.mapViewToDom(t),positions:Uc}}function dw(n){let e=n.editing.mapper,t=n.editing.view.domConverter,o=n.model.document.selection;if(o.rangeCount>1)return{target:()=>(function(s,a){let l=a.editing.mapper,c=a.editing.view.domConverter,d=Array.from(s).map((u=>{let h=uw(u.start),m=l.toViewElement(h);return new ue(c.mapViewToDom(m))}));return ue.getBoundingRect(d)})(o.getRanges(),n),positions:Uc};let i=uw(o.getFirstPosition()),r=e.toViewElement(i);return{target:t.mapViewToDom(r),positions:Uc}}function uw(n){return n.nodeAfter&&n.nodeAfter.is("element","tableCell")?n.nodeAfter:n.findAncestor("tableCell")}let hw={borderStyle:"tableBorderStyle",borderColor:"tableBorderColor",borderWidth:"tableBorderWidth",backgroundColor:"tableBackgroundColor",width:"tableWidth",height:"tableHeight",alignment:"tableAlignment"};class cS extends L{static get requires(){return[Xt]}static get pluginName(){return"TablePropertiesUI"}constructor(e){super(e),this.view=null,e.config.define("table.tableProperties",{borderColors:Gs,backgroundColors:Gs})}init(){let e=this.editor,t=e.t;this._defaultTableProperties=ir(e.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0}),this._balloon=e.plugins.get(Xt),e.ui.componentFactory.add("tableProperties",(o=>{let i=new ne(o);i.set({label:t("Table properties"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M8 2v5h4V2h1v5h5v1h-5v4h.021l-.172.351-1.916.28-.151.027c-.287.063-.54.182-.755.341L8 13v5H7v-5H2v-1h5V8H2V7h5V2h1zm4 6H8v4h4V8z" opacity=".6"/><path d="m15.5 11.5 1.323 2.68 2.957.43-2.14 2.085.505 2.946L15.5 18.25l-2.645 1.39.505-2.945-2.14-2.086 2.957-.43L15.5 11.5zM17 1a2 2 0 0 1 2 2v9.475l-.85-.124-.857-1.736a2.048 2.048 0 0 0-.292-.44L17 3H3v14h7.808l.402.392L10.935 19H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h14z"/></svg>',tooltip:!0}),this.listenTo(i,"execute",(()=>this._showView()));let r=Object.values(hw).map((s=>e.commands.get(s)));return i.bind("isEnabled").toMany(r,"isEnabled",((...s)=>s.some((a=>a)))),i}))}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(){let e=this.editor,t=e.config.get("table.tableProperties"),o=zn(t.borderColors),i=Ln(e.locale,o),r=zn(t.backgroundColors),s=Ln(e.locale,r),a=t.colorPicker!==!1,l=new lS(e.locale,{borderColors:i,backgroundColors:s,defaultTableProperties:this._defaultTableProperties,colorPickerConfig:!!a&&(t.colorPicker||{})}),c=e.t;l.render(),this.listenTo(l,"submit",(()=>{this._hideView()})),this.listenTo(l,"cancel",(()=>{this._undoStepBatch.operations.length&&e.execute("undo",this._undoStepBatch),this._hideView()})),l.keystrokes.set("Esc",((h,m)=>{this._hideView(),m()})),v({emitter:l,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});let d=Xb(c),u=ew(c);return l.on("change:borderStyle",this._getPropertyChangeCallback("tableBorderStyle")),l.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:l.borderColorInput,commandName:"tableBorderColor",errorText:d,validator:Ws})),l.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:l.borderWidthInput,commandName:"tableBorderWidth",errorText:u,validator:tw})),l.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:l.backgroundInput,commandName:"tableBackgroundColor",errorText:d,validator:Ws})),l.on("change:width",this._getValidatedPropertyChangeCallback({viewField:l.widthInput,commandName:"tableWidth",errorText:u,validator:nr})),l.on("change:height",this._getValidatedPropertyChangeCallback({viewField:l.heightInput,commandName:"tableHeight",errorText:u,validator:nr})),l.on("change:alignment",this._getPropertyChangeCallback("tableAlignment")),l}_fillViewFormFromCommandValues(){let e=this.editor.commands,t=e.get("tableBorderStyle");Object.entries(hw).map((([o,i])=>{let r=o,s=this._defaultTableProperties[r]||"";return[r,e.get(i).value||s]})).forEach((([o,i])=>{(o!=="borderColor"&&o!=="borderWidth"||t.value!=="none")&&this.view.set(o,i)})),this._isReady=!0}_showView(){let e=this.editor;this.view||(this.view=this._createPropertiesView()),this.listenTo(e.ui,"update",(()=>{this._updateView()})),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:cw(e)}),this._undoStepBatch=e.model.createBatch(),this.view.focus()}_hideView(){let e=this.editor;this.stopListening(e.ui,"update"),this._isReady=!1,this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}_updateView(){let e=this.editor;Gb(e.editing.view.document.selection)?this._isViewVisible&&lw(e,"table"):this._hideView()}get _isViewVisible(){return!!this.view&&this._balloon.visibleView===this.view}get _isViewInBalloon(){return!!this.view&&this._balloon.hasView(this.view)}_getPropertyChangeCallback(e){return(t,o,i)=>{this._isReady&&this.editor.execute(e,{value:i,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){let{commandName:t,viewField:o,validator:i,errorText:r}=e,s=Yt((()=>{o.errorText=r}),500);return(a,l,c)=>{s.cancel(),this._isReady&&(i(c)?(this.editor.execute(t,{value:c,batch:this._undoStepBatch}),o.errorText=null):s())}}}var mw=z(5737),dS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(mw.Z,dS),mw.Z.locals;let gw={left:Y.alignLeft,center:Y.alignCenter,right:Y.alignRight,justify:Y.alignJustify,top:Y.alignTop,middle:Y.alignMiddle,bottom:Y.alignBottom};class uS extends K{constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",padding:"",backgroundColor:"",width:"",height:"",horizontalAlignment:"",verticalAlignment:""}),this.options=t;let{borderStyleDropdown:o,borderWidthInput:i,borderColorInput:r,borderRowLabel:s}=this._createBorderFields(),{backgroundRowLabel:a,backgroundInput:l}=this._createBackgroundFields(),{widthInput:c,operatorLabel:d,heightInput:u,dimensionsLabel:h}=this._createDimensionFields(),{horizontalAlignmentToolbar:m,verticalAlignmentToolbar:g,alignmentLabel:b}=this._createAlignmentFields();this.focusTracker=new Me,this.keystrokes=new Ve,this.children=this.createCollection(),this.borderStyleDropdown=o,this.borderWidthInput=i,this.borderColorInput=r,this.backgroundInput=l,this.paddingInput=this._createPaddingField(),this.widthInput=c,this.heightInput=u,this.horizontalAlignmentToolbar=m,this.verticalAlignmentToolbar=g;let{saveButtonView:w,cancelButtonView:A}=this._createActionButtons();this.saveButtonView=w,this.cancelButtonView=A,this._focusables=new et,this._focusCycler=new tt({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.add(new Jl(e,{label:this.t("Cell properties")})),this.children.add(new Et(e,{labelView:s,children:[s,o,r,i],class:"ck-table-form__border-row"})),this.children.add(new Et(e,{labelView:a,children:[a,l],class:"ck-table-form__background-row"})),this.children.add(new Et(e,{children:[new Et(e,{labelView:h,children:[h,c,d,u],class:"ck-table-form__dimensions-row"}),new Et(e,{children:[this.paddingInput],class:"ck-table-cell-properties-form__padding-row"})]})),this.children.add(new Et(e,{labelView:b,children:[b,m,g],class:"ck-table-cell-properties-form__alignment-row"})),this.children.add(new Et(e,{children:[this.saveButtonView,this.cancelButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-cell-properties-form"],tabindex:"-1"},children:this.children})}render(){super.render(),p({view:this}),[this.borderColorInput,this.backgroundInput].forEach((e=>{e.fieldView.focusCycler.on("forwardCycle",(t=>{this._focusCycler.focusNext(),t.stop()})),e.fieldView.focusCycler.on("backwardCycle",(t=>{this._focusCycler.focusPrevious(),t.stop()}))})),[this.borderStyleDropdown,this.borderColorInput,this.borderWidthInput,this.backgroundInput,this.widthInput,this.heightInput,this.paddingInput,this.horizontalAlignmentToolbar,this.verticalAlignmentToolbar,this.saveButtonView,this.cancelButtonView].forEach((e=>{this._focusables.add(e),this.focusTracker.add(e.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createBorderFields(){let e=this.options.defaultTableCellProperties,t={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},o=Zs({colorConfig:this.options.borderColors,columns:5,defaultColorValue:t.color,colorPickerConfig:this.options.colorPickerConfig}),i=this.locale,r=this.t,s=r("Style"),a=new yt(i);a.text=r("Border");let l=jc(r),c=new Ge(i,xg);c.set({label:s,class:"ck-table-form__border-style"}),c.fieldView.buttonView.set({ariaLabel:s,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:s}),c.fieldView.buttonView.bind("label").to(this,"borderStyle",(h=>l[h||"none"])),c.fieldView.on("execute",(h=>{this.borderStyle=h.source._borderStyleValue})),c.bind("isEmpty").to(this,"borderStyle",(h=>!h)),vo(c.fieldView,ow(this,t.style),{role:"menu",ariaLabel:s});let d=new Ge(i,xt);d.set({label:r("Width"),class:"ck-table-form__border-width"}),d.fieldView.bind("value").to(this,"borderWidth"),d.bind("isEnabled").to(this,"borderStyle",Ys),d.fieldView.on("input",(()=>{this.borderWidth=d.fieldView.element.value}));let u=new Ge(i,o);return u.set({label:r("Color"),class:"ck-table-form__border-color"}),u.fieldView.bind("value").to(this,"borderColor"),u.bind("isEnabled").to(this,"borderStyle",Ys),u.fieldView.on("input",(()=>{this.borderColor=u.fieldView.value})),this.on("change:borderStyle",((h,m,g,b)=>{Ys(g)||(this.borderColor="",this.borderWidth=""),Ys(b)||(this.borderColor=t.color,this.borderWidth=t.width)})),{borderRowLabel:a,borderStyleDropdown:c,borderColorInput:u,borderWidthInput:d}}_createBackgroundFields(){let e=this.locale,t=this.t,o=new yt(e);o.text=t("Background");let i=Zs({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableCellProperties.backgroundColor,colorPickerConfig:this.options.colorPickerConfig}),r=new Ge(e,i);return r.set({label:t("Color"),class:"ck-table-cell-properties-form__background"}),r.fieldView.bind("value").to(this,"backgroundColor"),r.fieldView.on("input",(()=>{this.backgroundColor=r.fieldView.value})),{backgroundRowLabel:o,backgroundInput:r}}_createDimensionFields(){let e=this.locale,t=this.t,o=new yt(e);o.text=t("Dimensions");let i=new Ge(e,xt);i.set({label:t("Width"),class:"ck-table-form__dimensions-row__width"}),i.fieldView.bind("value").to(this,"width"),i.fieldView.on("input",(()=>{this.width=i.fieldView.element.value}));let r=new K(e);r.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"\xD7"}]});let s=new Ge(e,xt);return s.set({label:t("Height"),class:"ck-table-form__dimensions-row__height"}),s.fieldView.bind("value").to(this,"height"),s.fieldView.on("input",(()=>{this.height=s.fieldView.element.value})),{dimensionsLabel:o,widthInput:i,operatorLabel:r,heightInput:s}}_createPaddingField(){let e=this.locale,t=this.t,o=new Ge(e,xt);return o.set({label:t("Padding"),class:"ck-table-cell-properties-form__padding"}),o.fieldView.bind("value").to(this,"padding"),o.fieldView.on("input",(()=>{this.padding=o.fieldView.element.value})),o}_createAlignmentFields(){let e=this.locale,t=this.t,o=new yt(e);o.text=t("Table cell text alignment");let i=new Li(e),r=e.contentLanguageDirection==="rtl";i.set({isCompact:!0,ariaLabel:t("Horizontal text alignment toolbar")}),Hc({view:this,icons:gw,toolbar:i,labels:this._horizontalAlignmentLabels,propertyName:"horizontalAlignment",nameToValue:a=>{if(r){if(a==="left")return"right";if(a==="right")return"left"}return a},defaultValue:this.options.defaultTableCellProperties.horizontalAlignment});let s=new Li(e);return s.set({isCompact:!0,ariaLabel:t("Vertical text alignment toolbar")}),Hc({view:this,icons:gw,toolbar:s,labels:this._verticalAlignmentLabels,propertyName:"verticalAlignment",defaultValue:this.options.defaultTableCellProperties.verticalAlignment}),{horizontalAlignmentToolbar:i,verticalAlignmentToolbar:s,alignmentLabel:o}}_createActionButtons(){let e=this.locale,t=this.t,o=new ne(e),i=new ne(e),r=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.paddingInput];return o.set({label:t("Save"),icon:Y.check,class:"ck-button-save",type:"submit",withText:!0}),o.bind("isEnabled").toMany(r,"errorText",((...s)=>s.every((a=>!a)))),i.set({label:t("Cancel"),icon:Y.cancel,class:"ck-button-cancel",withText:!0}),i.delegate("execute").to(this,"cancel"),{saveButtonView:o,cancelButtonView:i}}get _horizontalAlignmentLabels(){let e=this.locale,t=this.t,o=t("Align cell text to the left"),i=t("Align cell text to the center"),r=t("Align cell text to the right"),s=t("Justify cell text");return e.uiLanguageDirection==="rtl"?{right:r,center:i,left:o,justify:s}:{left:o,center:i,right:r,justify:s}}get _verticalAlignmentLabels(){let e=this.t;return{top:e("Align cell text to the top"),middle:e("Align cell text to the middle"),bottom:e("Align cell text to the bottom")}}}function Ys(n){return n!=="none"}let pw={borderStyle:"tableCellBorderStyle",borderColor:"tableCellBorderColor",borderWidth:"tableCellBorderWidth",height:"tableCellHeight",width:"tableCellWidth",padding:"tableCellPadding",backgroundColor:"tableCellBackgroundColor",horizontalAlignment:"tableCellHorizontalAlignment",verticalAlignment:"tableCellVerticalAlignment"};class hS extends L{static get requires(){return[Xt]}static get pluginName(){return"TableCellPropertiesUI"}constructor(e){super(e),e.config.define("table.tableCellProperties",{borderColors:Gs,backgroundColors:Gs})}init(){let e=this.editor,t=e.t;this._defaultTableCellProperties=ir(e.config.get("table.tableCellProperties.defaultProperties"),{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,includePaddingProperty:!0,isRightToLeftContent:e.locale.contentLanguageDirection==="rtl"}),this._balloon=e.plugins.get(Xt),this.view=null,this._isReady=!1,e.ui.componentFactory.add("tableCellProperties",(o=>{let i=new ne(o);i.set({label:t("Cell properties"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.105 18-.17 1H2.5A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1h15A1.5 1.5 0 0 1 19 2.5v9.975l-.85-.124-.15-.302V8h-5v4h.021l-.172.351-1.916.28-.151.027c-.287.063-.54.182-.755.341L8 13v5h3.105zM2 12h5V8H2v4zm10-4H8v4h4V8zM2 2v5h5V2H2zm0 16h5v-5H2v5zM13 7h5V2h-5v5zM8 2v5h4V2H8z" opacity=".6"/><path d="m15.5 11.5 1.323 2.68 2.957.43-2.14 2.085.505 2.946L15.5 18.25l-2.645 1.39.505-2.945-2.14-2.086 2.957-.43L15.5 11.5zM13 6a1 1 0 0 1 1 1v3.172a2.047 2.047 0 0 0-.293.443l-.858 1.736-1.916.28-.151.027A1.976 1.976 0 0 0 9.315 14H7a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h6zm-1 2H8v4h4V8z"/></svg>',tooltip:!0}),this.listenTo(i,"execute",(()=>this._showView()));let r=Object.values(pw).map((s=>e.commands.get(s)));return i.bind("isEnabled").toMany(r,"isEnabled",((...s)=>s.some((a=>a)))),i}))}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(){let e=this.editor,t=e.config.get("table.tableCellProperties"),o=zn(t.borderColors),i=Ln(e.locale,o),r=zn(t.backgroundColors),s=Ln(e.locale,r),a=t.colorPicker!==!1,l=new uS(e.locale,{borderColors:i,backgroundColors:s,defaultTableCellProperties:this._defaultTableCellProperties,colorPickerConfig:!!a&&(t.colorPicker||{})}),c=e.t;l.render(),this.listenTo(l,"submit",(()=>{this._hideView()})),this.listenTo(l,"cancel",(()=>{this._undoStepBatch.operations.length&&e.execute("undo",this._undoStepBatch),this._hideView()})),l.keystrokes.set("Esc",((h,m)=>{this._hideView(),m()})),v({emitter:l,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});let d=Xb(c),u=ew(c);return l.on("change:borderStyle",this._getPropertyChangeCallback("tableCellBorderStyle")),l.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:l.borderColorInput,commandName:"tableCellBorderColor",errorText:d,validator:Ws})),l.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:l.borderWidthInput,commandName:"tableCellBorderWidth",errorText:u,validator:tw})),l.on("change:padding",this._getValidatedPropertyChangeCallback({viewField:l.paddingInput,commandName:"tableCellPadding",errorText:u,validator:nr})),l.on("change:width",this._getValidatedPropertyChangeCallback({viewField:l.widthInput,commandName:"tableCellWidth",errorText:u,validator:nr})),l.on("change:height",this._getValidatedPropertyChangeCallback({viewField:l.heightInput,commandName:"tableCellHeight",errorText:u,validator:nr})),l.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:l.backgroundInput,commandName:"tableCellBackgroundColor",errorText:d,validator:Ws})),l.on("change:horizontalAlignment",this._getPropertyChangeCallback("tableCellHorizontalAlignment")),l.on("change:verticalAlignment",this._getPropertyChangeCallback("tableCellVerticalAlignment")),l}_fillViewFormFromCommandValues(){let e=this.editor.commands,t=e.get("tableCellBorderStyle");Object.entries(pw).map((([o,i])=>{let r=this._defaultTableCellProperties[o]||"";return[o,e.get(i).value||r]})).forEach((([o,i])=>{(o!=="borderColor"&&o!=="borderWidth"||t.value!=="none")&&this.view.set(o,i)})),this._isReady=!0}_showView(){let e=this.editor;this.view||(this.view=this._createPropertiesView()),this.listenTo(e.ui,"update",(()=>{this._updateView()})),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:dw(e)}),this._undoStepBatch=e.model.createBatch(),this.view.focus()}_hideView(){let e=this.editor;this.stopListening(e.ui,"update"),this._isReady=!1,this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}_updateView(){let e=this.editor;qs(e.editing.view.document.selection)?this._isViewVisible&&lw(e,"cell"):this._hideView()}get _isViewVisible(){return!!this.view&&this._balloon.visibleView===this.view}get _isViewInBalloon(){return!!this.view&&this._balloon.hasView(this.view)}_getPropertyChangeCallback(e){return(t,o,i)=>{this._isReady&&this.editor.execute(e,{value:i,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){let{commandName:t,viewField:o,validator:i,errorText:r}=e,s=Yt((()=>{o.errorText=r}),500);return(a,l,c)=>{s.cancel(),this._isReady&&(i(c)?(this.editor.execute(t,{value:c,batch:this._undoStepBatch}),o.errorText=null):s())}}}class mo extends re{constructor(e,t,o){super(e),this.attributeName=t,this._defaultValue=o}refresh(){let e=this.editor,t=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e.model.document.selection);this.isEnabled=!!t.length,this.value=this._getSingleValue(t)}execute(e={}){let{value:t,batch:o}=e,i=this.editor.model,r=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(i.document.selection),s=this._getValueToSet(t);i.enqueueChange(o,(a=>{s?r.forEach((l=>a.setAttribute(this.attributeName,s,l))):r.forEach((l=>a.removeAttribute(this.attributeName,l)))}))}_getAttribute(e){if(!e)return;let t=e.getAttribute(this.attributeName);return t!==this._defaultValue?t:void 0}_getValueToSet(e){if(e!==this._defaultValue)return e}_getSingleValue(e){let t=this._getAttribute(e[0]);return e.every((o=>this._getAttribute(o)===t))?t:void 0}}class mS extends mo{constructor(e,t){super(e,"tableCellWidth",t)}_getValueToSet(e){if((e=ri(e,"px"))!==this._defaultValue)return e}}class gS extends L{static get pluginName(){return"TableCellWidthEditing"}static get requires(){return[$s]}init(){let e=this.editor,t=ir(e.config.get("table.tableCellProperties.defaultProperties"));Hs(e.model.schema,e.conversion,{modelAttribute:"tableCellWidth",styleName:"width",defaultValue:t.width}),e.commands.add("tableCellWidth",new mS(e,t.width))}}class pS extends mo{constructor(e,t){super(e,"tableCellPadding",t)}_getAttribute(e){if(!e)return;let t=ni(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}_getValueToSet(e){let t=ri(e,"px");if(t!==this._defaultValue)return t}}class fS extends mo{constructor(e,t){super(e,"tableCellHeight",t)}_getValueToSet(e){let t=ri(e,"px");if(t!==this._defaultValue)return t}}class kS extends mo{constructor(e,t){super(e,"tableCellBackgroundColor",t)}}class bS extends mo{constructor(e,t){super(e,"tableCellVerticalAlignment",t)}}class wS extends mo{constructor(e,t){super(e,"tableCellHorizontalAlignment",t)}}class _S extends mo{constructor(e,t){super(e,"tableCellBorderStyle",t)}_getAttribute(e){if(!e)return;let t=ni(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class AS extends mo{constructor(e,t){super(e,"tableCellBorderColor",t)}_getAttribute(e){if(!e)return;let t=ni(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class CS extends mo{constructor(e,t){super(e,"tableCellBorderWidth",t)}_getAttribute(e){if(!e)return;let t=ni(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}_getValueToSet(e){let t=ri(e,"px");if(t!==this._defaultValue)return t}}let fw=/^(top|middle|bottom)$/,kw=/^(left|center|right|justify)$/;class vS extends L{static get pluginName(){return"TableCellPropertiesEditing"}static get requires(){return[$s,gS]}init(){let e=this.editor,t=e.model.schema,o=e.conversion;e.config.define("table.tableCellProperties.defaultProperties",{});let i=ir(e.config.get("table.tableCellProperties.defaultProperties"),{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,includePaddingProperty:!0,isRightToLeftContent:e.locale.contentLanguageDirection==="rtl"});e.data.addStyleProcessorRules(Bm),(function(r,s,a){let l={width:"tableCellBorderWidth",color:"tableCellBorderColor",style:"tableCellBorderStyle"};r.extend("tableCell",{allowAttributes:Object.values(l)}),Ic(s,"td",l,a),Ic(s,"th",l,a),or(s,{modelElement:"tableCell",modelAttribute:l.style,styleName:"border-style"}),or(s,{modelElement:"tableCell",modelAttribute:l.color,styleName:"border-color"}),or(s,{modelElement:"tableCell",modelAttribute:l.width,styleName:"border-width"})})(t,o,{color:i.borderColor,style:i.borderStyle,width:i.borderWidth}),e.commands.add("tableCellBorderStyle",new _S(e,i.borderStyle)),e.commands.add("tableCellBorderColor",new AS(e,i.borderColor)),e.commands.add("tableCellBorderWidth",new CS(e,i.borderWidth)),Hs(t,o,{modelAttribute:"tableCellHeight",styleName:"height",defaultValue:i.height}),e.commands.add("tableCellHeight",new fS(e,i.height)),e.data.addStyleProcessorRules(C1),Hs(t,o,{modelAttribute:"tableCellPadding",styleName:"padding",reduceBoxSides:!0,defaultValue:i.padding}),e.commands.add("tableCellPadding",new pS(e,i.padding)),e.data.addStyleProcessorRules(Pl),Hs(t,o,{modelAttribute:"tableCellBackgroundColor",styleName:"background-color",defaultValue:i.backgroundColor}),e.commands.add("tableCellBackgroundColor",new kS(e,i.backgroundColor)),(function(r,s,a){r.extend("tableCell",{allowAttributes:["tableCellHorizontalAlignment"]}),s.for("downcast").attributeToAttribute({model:{name:"tableCell",key:"tableCellHorizontalAlignment"},view:l=>({key:"style",value:{"text-align":l}})}),s.for("upcast").attributeToAttribute({view:{name:/^(td|th)$/,styles:{"text-align":kw}},model:{key:"tableCellHorizontalAlignment",value:l=>{let c=l.getStyle("text-align");return c===a?null:c}}}).attributeToAttribute({view:{name:/^(td|th)$/,attributes:{align:kw}},model:{key:"tableCellHorizontalAlignment",value:l=>{let c=l.getAttribute("align");return c===a?null:c}}})})(t,o,i.horizontalAlignment),e.commands.add("tableCellHorizontalAlignment",new wS(e,i.horizontalAlignment)),(function(r,s,a){r.extend("tableCell",{allowAttributes:["tableCellVerticalAlignment"]}),s.for("downcast").attributeToAttribute({model:{name:"tableCell",key:"tableCellVerticalAlignment"},view:l=>({key:"style",value:{"vertical-align":l}})}),s.for("upcast").attributeToAttribute({view:{name:/^(td|th)$/,styles:{"vertical-align":fw}},model:{key:"tableCellVerticalAlignment",value:l=>{let c=l.getStyle("vertical-align");return c===a?null:c}}}).attributeToAttribute({view:{name:/^(td|th)$/,attributes:{valign:fw}},model:{key:"tableCellVerticalAlignment",value:l=>{let c=l.getAttribute("valign");return c===a?null:c}}})})(t,o,i.verticalAlignment),e.commands.add("tableCellVerticalAlignment",new bS(e,i.verticalAlignment))}}class yS extends re{refresh(){let e=this.editor.model,t=e.schema,o=e.document.selection;this.isEnabled=(function(i,r,s){let a=(function(l,c){let d=uc(l,c),u=d.start.parent;return u.isEmpty&&!u.is("element","$root")?u.parent:u})(i,s);return r.checkChild(a,"horizontalLine")})(o,t,e)}execute(){let e=this.editor.model;e.change((t=>{let o=t.createElement("horizontalLine");e.insertObject(o,null,null,{setSelection:"after"})}))}}var bw=z(2536),xS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(bw.Z,xS),bw.Z.locals;class ES extends L{static get pluginName(){return"HorizontalLineEditing"}init(){let e=this.editor,t=e.model.schema,o=e.t,i=e.conversion;t.register("horizontalLine",{inheritAllFrom:"$blockObject"}),i.for("dataDowncast").elementToElement({model:"horizontalLine",view:(r,{writer:s})=>s.createEmptyElement("hr")}),i.for("editingDowncast").elementToStructure({model:"horizontalLine",view:(r,{writer:s})=>{let a=o("Horizontal line"),l=s.createContainerElement("div",null,s.createEmptyElement("hr"));return s.addClass("ck-horizontal-line",l),s.setCustomProperty("hr",!0,l),(function(c,d,u){return d.setCustomProperty("horizontalLine",!0,c),Hi(c,d,{label:u})})(l,s,a)}}),i.for("upcast").elementToElement({view:"hr",model:"horizontalLine"}),e.commands.add("horizontalLine",new yS(e))}}class DS extends L{static get pluginName(){return"HorizontalLineUI"}init(){let e=this.editor;e.ui.componentFactory.add("horizontalLine",(()=>{let t=this._createButton(ne);return t.set({tooltip:!0}),t})),e.ui.componentFactory.add("menuBar:horizontalLine",(()=>this._createButton(Pe)))}_createButton(e){let t=this.editor,o=t.locale,i=t.commands.get("horizontalLine"),r=new e(t.locale),s=o.t;return r.set({label:s("Horizontal line"),icon:Y.horizontalLine}),r.bind("isEnabled").to(i,"isEnabled"),this.listenTo(r,"execute",(()=>{t.execute("horizontalLine"),t.editing.view.focus()})),r}}let TS=function(n,e,t,o){var i=-1,r=n==null?0:n.length;for(o;++i<r;)t=e(t,n[i],i,n);return t},SS=(function(n){return function(e){return n?.[e]}})({\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"});var IS=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,BS=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");let MS=function(n){return(n=gn(n))&&n.replace(IS,SS).replace(BS,"")};var NS=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;let PS=function(n){return n.match(NS)||[]};var LS=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;let zS=function(n){return LS.test(n)};var ww="\\ud800-\\udfff",_w="\\u2700-\\u27bf",Aw="a-z\\xdf-\\xf6\\xf8-\\xff",Cw="A-Z\\xc0-\\xd6\\xd8-\\xde",vw="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",yw="["+vw+"]",xw="\\d+",OS="["+_w+"]",Ew="["+Aw+"]",Dw="[^"+ww+vw+xw+_w+Aw+Cw+"]",Tw="(?:\\ud83c[\\udde6-\\uddff]){2}",Sw="[\\ud800-\\udbff][\\udc00-\\udfff]",Wi="["+Cw+"]",Iw="(?:"+Ew+"|"+Dw+")",RS="(?:"+Wi+"|"+Dw+")",Bw="(?:['\u2019](?:d|ll|m|re|s|t|ve))?",Mw="(?:['\u2019](?:D|LL|M|RE|S|T|VE))?",Nw="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",Pw="[\\ufe0e\\ufe0f]?",FS=Pw+Nw+("(?:\\u200d(?:"+["[^"+ww+"]",Tw,Sw].join("|")+")"+Pw+Nw+")*"),VS="(?:"+[OS,Tw,Sw].join("|")+")"+FS,jS=RegExp([Wi+"?"+Ew+"+"+Bw+"(?="+[yw,Wi,"$"].join("|")+")",RS+"+"+Mw+"(?="+[yw,Wi+Iw,"$"].join("|")+")",Wi+"?"+Iw+"+"+Bw,Wi+"+"+Mw,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",xw,VS].join("|"),"g");let HS=function(n){return n.match(jS)||[]},US=function(n,e,t){return n=gn(n),(e=e)===void 0?zS(n)?HS(n):PS(n):n.match(e)||[]};var $S=RegExp("['\u2019]","g");let qS=function(n){return function(e){return TS(US(MS(e).replace($S,"")),n,"")}},WS=function(n,e,t){var o=n.length;return t=t===void 0?o:t,!e&&t>=o?n:ih(n,e,t)};var GS=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");let Lw=function(n){return GS.test(n)},ZS=function(n){return n.split("")};var zw="\\ud800-\\udfff",KS="["+zw+"]",$c="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",qc="\\ud83c[\\udffb-\\udfff]",Ow="[^"+zw+"]",Rw="(?:\\ud83c[\\udde6-\\uddff]){2}",Fw="[\\ud800-\\udbff][\\udc00-\\udfff]",Vw="(?:"+$c+"|"+qc+")?",jw="[\\ufe0e\\ufe0f]?",YS=jw+Vw+("(?:\\u200d(?:"+[Ow,Rw,Fw].join("|")+")"+jw+Vw+")*"),QS="(?:"+[Ow+$c+"?",$c,Rw,Fw,KS].join("|")+")",JS=RegExp(qc+"(?="+qc+")|"+QS+YS,"g");let XS=function(n){return n.match(JS)||[]},eI=function(n){return Lw(n)?XS(n):ZS(n)},Hw=(function(n){return function(e){e=gn(e);var t=Lw(e)?eI(e):void 0,o=t?t[0]:e.charAt(0),i=t?WS(t,1).join(""):e.slice(1);return o[n]()+i}})("toUpperCase"),tI=qS((function(n,e,t){return n+(t?" ":"")+Hw(e)}));function ai(n,e,t,o){e&&(function(i,r,s){if(r.attributes)for(let[a]of Object.entries(r.attributes))i.removeAttribute(a,s);if(r.styles)for(let a of Object.keys(r.styles))i.removeStyle(a,s);r.classes&&i.removeClass(r.classes,s)})(n,e,o),t&&oo(n,t,o)}function oo(n,e,t){if(e.attributes)for(let[o,i]of Object.entries(e.attributes))n.setAttribute(o,i,t);e.styles&&n.setStyle(e.styles,t),e.classes&&n.addClass(e.classes,t)}function Gi(n,e,t,o,i){let r=e.getAttribute(t),s={};for(let a of["attributes","styles","classes"]){if(a!=o){r&&r[a]&&(s[a]=r[a]);continue}if(o=="classes"){let c=new Set(r&&r.classes||[]);i(c),c.size&&(s[a]=Array.from(c));continue}let l=new Map(Object.entries(r&&r[a]||{}));i(l),l.size&&(s[a]=Object.fromEntries(l))}Object.keys(s).length?e.is("documentSelection")?n.setSelectionAttribute(t,s):n.setAttribute(t,s,e):r&&(e.is("documentSelection")?n.removeSelectionAttribute(t):n.removeAttribute(t,e))}function Ot(n){return`html${e=n,tI(e).replace(/ /g,"")}Attributes`;var e}function Wc({model:n}){return(e,t)=>t.writer.createElement(n,{htmlContent:e.getCustomProperty("$rawContent")})}function oI(n,{view:e,isInline:t}){let o=n.t;return(i,{writer:r})=>{let s=o("HTML object"),a=Qs(e,i,r),l=i.getAttribute(Ot(e));return r.addClass("html-object-embed__content",a),l&&oo(r,l,a),Hi(r.createContainerElement(t?"span":"div",{class:"html-object-embed","data-html-object-embed-label":s},a),r,{label:s})}}function Qs(n,e,t){return t.createRawElement(n,null,((o,i)=>{i.setContentOf(o,e.getAttribute("htmlContent"))}))}function iI({view:n,model:e,allowEmpty:t},o){return r=>{r.on(`element:${n}`,((s,a,l)=>{let c=o.processViewAttributes(a.viewItem,l);if(c||l.consumable.test(a.viewItem,{name:!0})){if(c=c||{},l.consumable.consume(a.viewItem,{name:!0}),a.modelRange||(a=Object.assign(a,l.convertChildren(a.viewItem,a.modelCursor))),t&&a.modelRange.isCollapsed&&Object.keys(c).length){let d=l.writer.createElement("htmlEmptyElement");if(!l.safeInsert(d,a.modelCursor))return;let u=l.getSplitParts(d);return a.modelRange=l.writer.createRange(a.modelRange.start,l.writer.createPositionAfter(u[u.length-1])),l.updateConversionResult(d,a),void i(d,c,l)}for(let d of a.modelRange.getItems())i(d,c,l)}}),{priority:"low"})};function i(r,s,a){if(a.schema.checkAttribute(r,e)){let l=(function(c,d){let u=It(c),h="attributes";for(h in d)u[h]=h=="classes"?Array.from(new Set([...c[h]||[],...d[h]])):{...c[h],...d[h]};return u})(s,r.getAttribute(e)||{});a.writer.setAttribute(e,l,r)}}}function Uw({model:n,view:e},t){return(o,{writer:i,consumable:r})=>{if(!o.hasAttribute(n))return null;let s=i.createContainerElement(e),a=o.getAttribute(n);return r.consume(o,`attribute:${n}`),oo(i,a,s),s.getFillerOffset=()=>null,t?Hi(s,i):s}}function nI({priority:n,view:e}){return(t,o)=>{if(!t)return;let{writer:i}=o,r=i.createAttributeElement(e,null,{priority:n});return oo(i,t,r),r}}function rr({view:n},e){return t=>{t.on(`element:${n}`,((o,i,r)=>{if(!i.modelRange||i.modelRange.isCollapsed)return;let s=e.processViewAttributes(i.viewItem,r);s&&r.writer.setAttribute(Ot(i.viewItem.name),s,i.modelRange)}),{priority:"low"})}}function sr({view:n,model:e}){return t=>{t.on(`attribute:${Ot(n)}:${e}`,((o,i,r)=>{if(!r.consumable.consume(i.item,o.name))return;let{attributeOldValue:s,attributeNewValue:a}=i;ai(r.writer,s,a,r.mapper.toViewElement(i.item))}))}}let rI=[{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:"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:"$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:{allowChildren:["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}}],sI=[{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}}],aI=Qa((function(n,e,t,o){Vu(n,e,t,o)}));class Zi extends L{constructor(){super(...arguments),this._definitions=[]}static get pluginName(){return"DataSchema"}init(){for(let e of rI)this.registerBlockElement(e);for(let e of sI)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){let o=new Set;for(let i of this._getMatchingViewDefinitions(e)){if(t)for(let r of this._getReferences(i.model))o.add(r);o.add(i)}return o}getDefinitionsForModel(e){return this._definitions.filter((t=>t.model==e))}_getMatchingViewDefinitions(e){return this._definitions.filter((t=>t.view&&(function(o,i){return typeof o=="string"?o===i:o instanceof RegExp?o.test(i):!1})(e,t.view)))}*_getReferences(e){let t=["inheritAllFrom","inheritTypesFrom","allowWhere","allowContentOf","allowAttributesOf"],o=this._definitions.filter((i=>i.model==e));for(let{modelSchema:i}of o)if(i)for(let r of t)for(let s of ke(i[r]||[])){let a=this._definitions.filter((l=>l.model==s));for(let l of a)s!==e&&(yield*this._getReferences(l.model),yield l)}}_extendDefinition(e){let t=Array.from(this._definitions.entries()).filter((([,o])=>o.model==e.model));if(t.length!=0)for(let[o,i]of t)this._definitions[o]=aI({},i,e,((r,s)=>Array.isArray(r)?r.concat(s):void 0));else this._definitions.push(e)}}var $w=z(8468),lI={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()($w.Z,lI),$w.Z.locals;class Ue extends L{constructor(e){super(e),this._dataSchema=e.plugins.get("DataSchema"),this._allowedAttributes=new St,this._disallowedAttributes=new St,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 requires(){return[Zi,Qo]}loadAllowedConfig(e){for(let t of e){let o=t.name||/[\s\S]+/,i=Ww(t);this.allowElement(o),i.forEach((r=>this.allowAttributes(r)))}}loadDisallowedConfig(e){for(let t of e){let o=t.name||/[\s\S]+/,i=Ww(t);i.length==0?this.disallowElement(o):i.forEach((r=>this.disallowAttributes(r)))}}loadAllowedEmptyElementsConfig(e){for(let t of e)this.allowEmptyElement(t)}allowElement(e){for(let t of this._dataSchema.getDefinitionsForView(e,!0))this._addAllowedElement(t),this._coupledAttributes=null}disallowElement(e){for(let t of this._dataSchema.getDefinitionsForView(e,!1))this._disallowedElements.add(t.view)}allowEmptyElement(e){for(let 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){let{consumable:o}=t;return qw(e,this._disallowedAttributes,o),(function(i,{attributes:r,classes:s,styles:a}){return!r.length&&!s.length&&!a.length?null:{...r.length&&{attributes:cI(i,r)},...a.length&&{styles:dI(i,a)},...s.length&&{classes:s}}})(e,qw(e,this._allowedAttributes,o))}_addAllowedElement(e){if(!this._allowedElements.has(e)){if(this._allowedElements.add(e),"appliesToBlock"in e&&typeof e.appliesToBlock=="string")for(let t of this._dataSchema.getDefinitionsForModel(e.appliesToBlock))t.isBlock&&this._addAllowedElement(t);this._dataInitialized&&this.editor.data.once("set",(()=>{this._fireRegisterEvent(e)}),{priority:ge.highest+1})}}_registerElementsAfterInit(){this.editor.data.on("init",(()=>{this._dataInitialized=!0;for(let e of this._allowedElements)this._fireRegisterEvent(e)}),{priority:ge.highest+1})}_registerElementHandlers(){this.on("register",((e,t)=>{let o=this.editor.model.schema;if(t.isObject&&!o.isRegistered(t.model))this._registerObjectElement(t);else if(t.isBlock)this._registerBlockElement(t);else{if(!t.isInline)throw new y("data-filter-invalid-definition",null,t);this._registerInlineElement(t)}e.stop()}),{priority:"lowest"})}_registerCoupledAttributesPostFixer(){let e=this.editor.model,t=e.document.selection;e.document.registerPostFixer((o=>{let i=e.document.differ.getChanges(),r=!1,s=this._getCoupledAttributesMap();for(let a of i){if(a.type!="attribute"||a.attributeNewValue!==null)continue;let l=s.get(a.attributeKey);if(l)for(let{item:c}of a.range.getWalker())for(let d of l)c.hasAttribute(d)&&(o.removeAttribute(d,c),r=!0)}return r})),this.listenTo(t,"change:attribute",((o,{attributeKeys:i})=>{let r=new Set,s=this._getCoupledAttributesMap();for(let a of i){if(t.hasAttribute(a))continue;let l=s.get(a);if(l)for(let c of l)t.hasAttribute(c)&&r.add(c)}r.size!=0&&e.change((a=>{for(let l of r)a.removeSelectionAttribute(l)}))}))}_registerAssociatedHtmlAttributesPostFixer(){let e=this.editor.model;e.document.registerPostFixer((t=>{let o=e.document.differ.getChanges(),i=!1;for(let r of o)if(r.type==="insert"&&r.name!=="$text")for(let s of r.attributes.keys())s.startsWith("html")&&s.endsWith("Attributes")&&(e.schema.checkAttribute(r.name,s)||(t.removeAttribute(s,r.position.nodeAfter),i=!0));return i}))}_getCoupledAttributesMap(){if(this._coupledAttributes)return this._coupledAttributes;this._coupledAttributes=new Map;for(let e of this._allowedElements)if(e.coupledAttribute&&e.model){let 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){let t=this.editor,o=t.model.schema,i=t.conversion,{view:r,model:s}=e;o.register(s,e.modelSchema),r&&(o.extend(e.model,{allowAttributes:[Ot(r),"htmlContent"]}),t.data.registerRawContentMatcher({name:r}),i.for("upcast").elementToElement({view:r,model:Wc(e),converterPriority:ge.low+2}),i.for("upcast").add(rr(e,this)),i.for("editingDowncast").elementToStructure({model:{name:s,attributes:[Ot(r)]},view:oI(t,e)}),i.for("dataDowncast").elementToElement({model:s,view:(a,{writer:l})=>Qs(r,a,l)}),i.for("dataDowncast").add(sr(e)))}_registerBlockElement(e){let t=this.editor,o=t.model.schema,i=t.conversion,{view:r,model:s}=e;if(!o.isRegistered(e.model)){if(o.register(e.model,e.modelSchema),!r)return;i.for("upcast").elementToElement({model:s,view:r,converterPriority:ge.low+2}),i.for("downcast").elementToElement({model:s,view:r})}r&&(o.extend(e.model,{allowAttributes:Ot(r)}),i.for("upcast").add(rr(e,this)),i.for("downcast").add(sr(e)))}_registerInlineElement(e){let t=this.editor,o=t.model.schema,i=t.conversion,r=e.model;e.appliesToBlock||(o.extend("$text",{allowAttributes:r}),e.attributeProperties&&o.setAttributeProperties(r,e.attributeProperties),i.for("upcast").add(iI(e,this)),i.for("downcast").attributeToElement({model:r,view:nI(e)}),e.allowEmpty&&(o.setAttributeProperties(r,{copyFromObject:!1}),o.isRegistered("htmlEmptyElement")||o.register("htmlEmptyElement",{inheritAllFrom:"$inlineObject"}),t.data.htmlProcessor.domConverter.registerInlineObjectMatcher((s=>s.name==e.view&&s.isEmpty&&Array.from(s.getAttributeKeys()).length?{name:!0}:null)),i.for("editingDowncast").elementToElement({model:"htmlEmptyElement",view:Uw(e,!0)}),i.for("dataDowncast").elementToElement({model:"htmlEmptyElement",view:Uw(e)})))}}function qw(n,e,t){let o=e.matchAll(n)||[],i=n.document.stylesProcessor;return o.reduce(((r,{match:s})=>{for(let a of s.styles||[]){let l=i.getRelatedStyles(a).filter((c=>c.split("-").length>a.split("-").length)).sort(((c,d)=>d.split("-").length-c.split("-").length));for(let c of l)t.consume(n,{styles:[c]})&&r.styles.push(c);t.consume(n,{styles:[a]})&&r.styles.push(a)}for(let a of s.classes||[])t.consume(n,{classes:[a]})&&r.classes.push(a);for(let a of s.attributes||[])t.consume(n,{attributes:[a]})&&r.attributes.push(a);return r}),{attributes:[],classes:[],styles:[]})}function cI(n,e){let t={};for(let o of e){let i=n.getAttribute(o);i!==void 0&&Su(o)&&(t[o]=i)}return t}function dI(n,e){let t=new Lr(n.document.stylesProcessor);for(let o of e){let i=n.getStyle(o);i!==void 0&&t.set(o,i)}return Object.fromEntries(t.getStylesEntries())}function Gc(n,e){let{name:t}=n,o=n[e];return lt(o)?Object.entries(o).map((([i,r])=>({name:t,[e]:{[i]:r}}))):Array.isArray(o)?o.map((i=>({name:t,[e]:[i]}))):[n]}function Ww(n){let{name:e,attributes:t,classes:o,styles:i}=n,r=[];return t&&r.push(...Gc({name:e,attributes:t},"attributes")),o&&r.push(...Gc({name:e,classes:o},"classes")),i&&r.push(...Gc({name:e,styles:i},"styles")),r}class uI extends L{static get requires(){return[Ue]}static get pluginName(){return"CodeBlockElementSupport"}init(){if(!this.editor.plugins.has("CodeBlockEditing"))return;let e=this.editor.plugins.get(Ue);e.on("register:pre",((t,o)=>{if(o.model!=="codeBlock")return;let i=this.editor,r=i.model.schema,s=i.conversion;r.extend("codeBlock",{allowAttributes:["htmlPreAttributes","htmlContentAttributes"]}),s.for("upcast").add((function(a){return l=>{l.on("element:code",((c,d,u)=>{let h=d.viewItem,m=h.parent;function g(b,w){let A=a.processViewAttributes(b,u);A&&u.writer.setAttribute(w,A,d.modelRange)}m&&m.is("element","pre")&&(g(m,"htmlPreAttributes"),g(h,"htmlContentAttributes"))}),{priority:"low"})}})(e)),s.for("downcast").add((a=>{a.on("attribute:htmlPreAttributes:codeBlock",((l,c,d)=>{if(!d.consumable.consume(c.item,l.name))return;let{attributeOldValue:u,attributeNewValue:h}=c,m=d.mapper.toViewElement(c.item).parent;ai(d.writer,u,h,m)})),a.on("attribute:htmlContentAttributes:codeBlock",((l,c,d)=>{if(!d.consumable.consume(c.item,l.name))return;let{attributeOldValue:u,attributeNewValue:h}=c,m=d.mapper.toViewElement(c.item);ai(d.writer,u,h,m)}))})),t.stop()}))}}class hI extends L{static get requires(){return[Ue]}static get pluginName(){return"DualContentModelElementSupport"}init(){this.editor.plugins.get(Ue).on("register",((e,t)=>{let o=t,i=this.editor,r=i.model.schema,s=i.conversion;if(!o.paragraphLikeModel||r.isRegistered(o.model)||r.isRegistered(o.paragraphLikeModel))return;let a={model:o.paragraphLikeModel,view:o.view};r.register(o.model,o.modelSchema),r.register(a.model,{inheritAllFrom:"$block"}),s.for("upcast").elementToElement({view:o.view,model:(l,{writer:c})=>this._hasBlockContent(l)?c.createElement(o.model):c.createElement(a.model),converterPriority:ge.low+.5}),s.for("downcast").elementToElement({view:o.view,model:o.model}),this._addAttributeConversion(o),s.for("downcast").elementToElement({view:a.view,model:a.model}),this._addAttributeConversion(a),e.stop()}))}_hasBlockContent(e){let t=this.editor.editing.view,o=t.domConverter.blockElements;for(let i of t.createRangeIn(e).getItems())if(i.is("element")&&o.includes(i.name))return!0;return!1}_addAttributeConversion(e){let t=this.editor,o=t.conversion,i=t.plugins.get(Ue);t.model.schema.extend(e.model,{allowAttributes:Ot(e.view)}),o.for("upcast").add(rr(e,i)),o.for("downcast").add(sr(e))}}class mI extends L{static get requires(){return[Zi,Wn]}static get pluginName(){return"HeadingElementSupport"}init(){let e=this.editor;if(!e.plugins.has("HeadingEditing"))return;let t=e.config.get("heading.options");this.registerHeadingElements(e,t)}registerHeadingElements(e,t){let o=e.plugins.get(Zi),i=[];for(let r of t)"model"in r&&"view"in r&&(o.registerBlockElement({view:r.view,model:r.model}),i.push(r.model));o.extendBlockElement({model:"htmlHgroup",modelSchema:{allowChildren:i}})}}function Js(n,e,t){let o=n.createRangeOn(e);for(let{item:i}of o.getWalker())if(i.is("element",t))return i}class gI extends L{static get requires(){return[Ue]}static get pluginName(){return"ImageElementSupport"}init(){let e=this.editor;if(!e.plugins.has("ImageInlineEditing")&&!e.plugins.has("ImageBlockEditing"))return;let t=e.model.schema,o=e.conversion,i=e.plugins.get(Ue);i.on("register:figure",(()=>{o.for("upcast").add((function(r){return s=>{s.on("element:figure",((a,l,c)=>{let d=l.viewItem;if(!l.modelRange||!d.hasClass("image"))return;let u=r.processViewAttributes(d,c);u&&c.writer.setAttribute("htmlFigureAttributes",u,l.modelRange)}),{priority:"low"})}})(i))})),i.on("register:img",((r,s)=>{s.model!=="imageBlock"&&s.model!=="imageInline"||(t.isRegistered("imageBlock")&&t.extend("imageBlock",{allowAttributes:["htmlImgAttributes","htmlFigureAttributes","htmlLinkAttributes"]}),t.isRegistered("imageInline")&&t.extend("imageInline",{allowAttributes:["htmlA","htmlImgAttributes"]}),o.for("upcast").add((function(a){return l=>{l.on("element:img",((c,d,u)=>{if(!d.modelRange)return;let h=d.viewItem,m=a.processViewAttributes(h,u);m&&u.writer.setAttribute("htmlImgAttributes",m,d.modelRange)}),{priority:"low"})}})(i)),o.for("downcast").add((a=>{function l(d){a.on(`attribute:${d}:imageInline`,((u,h,m)=>{if(!m.consumable.consume(h.item,u.name))return;let{attributeOldValue:g,attributeNewValue:b}=h,w=m.mapper.toViewElement(h.item);ai(m.writer,g,b,w)}),{priority:"low"})}function c(d,u){a.on(`attribute:${u}:imageBlock`,((h,m,g)=>{if(!g.consumable.test(m.item,h.name))return;let{attributeOldValue:b,attributeNewValue:w}=m,A=g.mapper.toViewElement(m.item),S=Js(g.writer,A,d);S&&(ai(g.writer,b,w,S),g.consumable.consume(m.item,h.name))}),{priority:"low"}),d==="a"&&a.on("attribute:linkHref:imageBlock",((h,m,g)=>{if(!g.consumable.consume(m.item,"attribute:htmlLinkAttributes:imageBlock"))return;let b=g.mapper.toViewElement(m.item),w=Js(g.writer,b,"a");oo(g.writer,m.item.getAttribute("htmlLinkAttributes"),w)}),{priority:"low"})}l("htmlImgAttributes"),c("img","htmlImgAttributes"),c("figure","htmlFigureAttributes"),c("a","htmlLinkAttributes")})),e.plugins.has("LinkImage")&&o.for("upcast").add((function(a,l){let c=l.plugins.get("ImageUtils");return d=>{d.on("element:a",((u,h,m)=>{let g=h.viewItem;if(!c.findViewImgElement(g))return;let b=h.modelCursor.parent;if(!b.is("element","imageBlock"))return;let w=a.processViewAttributes(g,m);w&&m.writer.setAttribute("htmlLinkAttributes",w,b)}),{priority:"low"})}})(i,e)),r.stop())}))}}class pI extends L{static get requires(){return[Ue]}static get pluginName(){return"MediaEmbedElementSupport"}init(){let e=this.editor;if(!e.plugins.has("MediaEmbed")||e.config.get("mediaEmbed.previewsInData"))return;let t=e.model.schema,o=e.conversion,i=this.editor.plugins.get(Ue),r=this.editor.plugins.get(Zi),s=e.config.get("mediaEmbed.elementName");r.registerBlockElement({model:"media",view:s}),i.on("register:figure",(()=>{o.for("upcast").add((function(a){return l=>{l.on("element:figure",((c,d,u)=>{let h=d.viewItem;if(!d.modelRange||!h.hasClass("media"))return;let m=a.processViewAttributes(h,u);m&&u.writer.setAttribute("htmlFigureAttributes",m,d.modelRange)}),{priority:"low"})}})(i))})),i.on(`register:${s}`,((a,l)=>{l.model==="media"&&(t.extend("media",{allowAttributes:[Ot(s),"htmlFigureAttributes"]}),o.for("upcast").add((function(c,d){let u=(h,m,g)=>{function b(w,A){let S=c.processViewAttributes(w,g);S&&g.writer.setAttribute(A,S,m.modelRange)}b(m.viewItem,Ot(d))};return h=>{h.on(`element:${d}`,u,{priority:"low"})}})(i,s)),o.for("dataDowncast").add((function(c){return d=>{function u(h,m){d.on(`attribute:${m}:media`,((g,b,w)=>{if(!w.consumable.consume(b.item,g.name))return;let{attributeOldValue:A,attributeNewValue:S}=b,M=w.mapper.toViewElement(b.item),F=Js(w.writer,M,h);ai(w.writer,A,S,F)}))}u(c,Ot(c)),u("figure","htmlFigureAttributes")}})(s)),a.stop())}))}}class fI extends L{static get requires(){return[Ue]}static get pluginName(){return"ScriptElementSupport"}init(){let e=this.editor.plugins.get(Ue);e.on("register:script",((t,o)=>{let i=this.editor,r=i.model.schema,s=i.conversion;r.register("htmlScript",o.modelSchema),r.extend("htmlScript",{allowAttributes:["htmlScriptAttributes","htmlContent"],isContent:!0}),i.data.registerRawContentMatcher({name:"script"}),s.for("upcast").elementToElement({view:"script",model:Wc(o)}),s.for("upcast").add(rr(o,e)),s.for("downcast").elementToElement({model:"htmlScript",view:(a,{writer:l})=>Qs("script",a,l)}),s.for("downcast").add(sr(o)),t.stop()}))}}class kI extends L{static get requires(){return[Ue]}static get pluginName(){return"TableElementSupport"}init(){let e=this.editor;if(!e.plugins.has("TableEditing"))return;let t=e.model.schema,o=e.conversion,i=e.plugins.get(Ue),r=e.plugins.get("TableUtils");i.on("register:figure",(()=>{o.for("upcast").add((function(s){return a=>{a.on("element:figure",((l,c,d)=>{let u=c.viewItem;if(!c.modelRange||!u.hasClass("table"))return;let h=s.processViewAttributes(u,d);h&&d.writer.setAttribute("htmlFigureAttributes",h,c.modelRange)}),{priority:"low"})}})(i))})),i.on("register:table",((s,a)=>{a.model==="table"&&(t.extend("table",{allowAttributes:["htmlTableAttributes","htmlFigureAttributes","htmlTheadAttributes","htmlTbodyAttributes"]}),o.for("upcast").add((function(l){return c=>{c.on("element:table",((d,u,h)=>{if(!u.modelRange)return;let m=u.viewItem;g(m,"htmlTableAttributes");for(let b of m.getChildren())b.is("element","thead")&&g(b,"htmlTheadAttributes"),b.is("element","tbody")&&g(b,"htmlTbodyAttributes");function g(b,w){let A=l.processViewAttributes(b,h);A&&h.writer.setAttribute(w,A,u.modelRange)}}),{priority:"low"})}})(i)),o.for("downcast").add((l=>{function c(d,u){l.on(`attribute:${u}:table`,((h,m,g)=>{if(!g.consumable.test(m.item,h.name))return;let b=g.mapper.toViewElement(m.item),w=Js(g.writer,b,d);w&&(g.consumable.consume(m.item,h.name),ai(g.writer,m.attributeOldValue,m.attributeNewValue,w))}))}c("table","htmlTableAttributes"),c("figure","htmlFigureAttributes"),c("thead","htmlTheadAttributes"),c("tbody","htmlTbodyAttributes")})),e.model.document.registerPostFixer((function(l,c){return d=>{let u=l.document.differ.getChanges(),h=!1;for(let m of u){if(m.type!="attribute"||m.attributeKey!="headingRows")continue;let g=m.range.start.nodeAfter,b=g.getAttribute("htmlTheadAttributes"),w=g.getAttribute("htmlTbodyAttributes");b&&!m.attributeNewValue?(d.removeAttribute("htmlTheadAttributes",g),h=!0):w&&m.attributeNewValue==c.getRows(g)&&(d.removeAttribute("htmlTbodyAttributes",g),h=!0)}return h}})(e.model,r)),s.stop())}))}}class bI extends L{static get requires(){return[Ue]}static get pluginName(){return"StyleElementSupport"}init(){let e=this.editor.plugins.get(Ue);e.on("register:style",((t,o)=>{let i=this.editor,r=i.model.schema,s=i.conversion;r.register("htmlStyle",o.modelSchema),r.extend("htmlStyle",{allowAttributes:["htmlStyleAttributes","htmlContent"],isContent:!0}),i.data.registerRawContentMatcher({name:"style"}),s.for("upcast").elementToElement({view:"style",model:Wc(o)}),s.for("upcast").add(rr(o,e)),s.for("downcast").elementToElement({model:"htmlStyle",view:(a,{writer:l})=>Qs("style",a,l)}),s.for("downcast").add(sr(o)),t.stop()}))}}class wI extends L{static get requires(){return[Ue]}static get pluginName(){return"ListElementSupport"}init(){let e=this.editor;if(!e.plugins.has("ListEditing"))return;let t=e.model.schema,o=e.conversion,i=e.plugins.get(Ue),r=e.plugins.get("ListEditing"),s=e.plugins.get("ListUtils"),a=["ul","ol","li"];r.registerDowncastStrategy({scope:"item",attributeName:"htmlLiAttributes",setAttributeOnDowncast:oo}),r.registerDowncastStrategy({scope:"list",attributeName:"htmlUlAttributes",setAttributeOnDowncast:oo}),r.registerDowncastStrategy({scope:"list",attributeName:"htmlOlAttributes",setAttributeOnDowncast:oo}),i.on("register",((l,c)=>{if(!a.includes(c.view)||(l.stop(),t.checkAttribute("$block","htmlLiAttributes")))return;let d=a.map((u=>Ot(u)));t.extend("$listItem",{allowAttributes:d}),o.for("upcast").add((u=>{u.on("element:ul",Zc("htmlUlAttributes",i),{priority:"low"}),u.on("element:ol",Zc("htmlOlAttributes",i),{priority:"low"}),u.on("element:li",Zc("htmlLiAttributes",i),{priority:"low"})}))})),r.on("postFixer",((l,{listNodes:c,writer:d})=>{for(let{node:u,previousNodeInList:h}of c)if(h){if(h.getAttribute("listType")==u.getAttribute("listType")){let m=Gw(h.getAttribute("listType")),g=h.getAttribute(m);!Kr(u.getAttribute(m),g)&&d.model.schema.checkAttribute(u,m)&&(d.setAttribute(m,g,u),l.return=!0)}if(h.getAttribute("listItemId")==u.getAttribute("listItemId")){let m=h.getAttribute("htmlLiAttributes");!Kr(u.getAttribute("htmlLiAttributes"),m)&&d.model.schema.checkAttribute(u,"htmlLiAttributes")&&(d.setAttribute("htmlLiAttributes",m,u),l.return=!0)}}})),r.on("postFixer",((l,{listNodes:c,writer:d})=>{for(let{node:u}of c){let h=u.getAttribute("listType");!s.isNumberedListType(h)&&u.getAttribute("htmlOlAttributes")&&(d.removeAttribute("htmlOlAttributes",u),l.return=!0),s.isNumberedListType(h)&&u.getAttribute("htmlUlAttributes")&&(d.removeAttribute("htmlUlAttributes",u),l.return=!0)}}))}afterInit(){let e=this.editor;if(!e.commands.get("indentList"))return;let t=e.commands.get("indentList");this.listenTo(t,"afterExecute",((o,i)=>{e.model.change((r=>{for(let s of i){let a=Gw(s.getAttribute("listType"));e.model.schema.checkAttribute(s,a)&&r.setAttribute(a,{},s)}}))}))}}function Zc(n,e){return(t,o,i)=>{let r=o.viewItem;o.modelRange||Object.assign(o,i.convertChildren(o.viewItem,o.modelCursor));let s=e.processViewAttributes(r,i);for(let a of o.modelRange.getItems({shallow:!0}))a.hasAttribute("listItemId")&&(a.hasAttribute(n)||i.writer.model.schema.checkAttribute(a,n)&&i.writer.setAttribute(n,s||{},a))}}function Gw(n){return n==="numbered"||n=="customNumbered"?"htmlOlAttributes":"htmlUlAttributes"}class _I extends L{static get requires(){return[Ue,Zi]}static get pluginName(){return"CustomElementSupport"}init(){let e=this.editor.plugins.get(Ue),t=this.editor.plugins.get(Zi);e.on("register:$customElement",((o,i)=>{o.stop();let r=this.editor,s=r.model.schema,a=r.conversion,l=r.editing.view.domConverter.unsafeElements,c=r.data.htmlProcessor.domConverter.preElements;s.register(i.model,i.modelSchema),s.extend(i.model,{allowAttributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"],isContent:!0}),r.data.htmlProcessor.domConverter.registerRawContentMatcher({name:"template"}),a.for("upcast").elementToElement({view:/.*/,model:(d,u)=>{if(d.name=="$comment"||!(function(b){try{document.createElement(b)}catch{return!1}return!0})(d.name)||t.getDefinitionsForView(d.name).size)return null;l.includes(d.name)||l.push(d.name),c.includes(d.name)||c.push(d.name);let h=u.writer.createElement(i.model,{htmlElementName:d.name}),m=e.processViewAttributes(d,u),g;if(m&&u.writer.setAttribute("htmlCustomElementAttributes",m,h),d.is("element","template")&&d.getCustomProperty("$rawContent"))g=d.getCustomProperty("$rawContent");else{let b=new Jt(d.document).createDocumentFragment(d),w=r.data.htmlProcessor.domConverter.viewToDom(b),A=w.firstChild;for(;A.firstChild;)w.appendChild(A.firstChild);A.remove(),g=r.data.htmlProcessor.htmlWriter.getHtml(w)}u.writer.setAttribute("htmlContent",g,h);for(let{item:b}of r.editing.view.createRangeIn(d))u.consumable.consume(b,{name:!0});return h},converterPriority:"low"}),a.for("editingDowncast").elementToElement({model:{name:i.model,attributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"]},view:(d,{writer:u})=>{let h=d.getAttribute("htmlElementName"),m=u.createRawElement(h);return d.hasAttribute("htmlCustomElementAttributes")&&oo(u,d.getAttribute("htmlCustomElementAttributes"),m),m}}),a.for("dataDowncast").elementToElement({model:{name:i.model,attributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"]},view:(d,{writer:u})=>{let h=d.getAttribute("htmlElementName"),m=d.getAttribute("htmlContent"),g=u.createRawElement(h,null,((b,w)=>{w.setContentOf(b,m)}));return d.hasAttribute("htmlCustomElementAttributes")&&oo(u,d.getAttribute("htmlCustomElementAttributes"),g),g}})}))}}function*Ki(n,e,t){if(e)if(!(Symbol.iterator in e)&&e.is("documentSelection")&&e.isCollapsed)n.schema.checkAttributeInSelection(e,t)&&(yield e);else for(let o of(function(i,r,s){return!(Symbol.iterator in r)&&(r.is("node")||r.is("$text")||r.is("$textProxy"))?i.schema.checkAttribute(r,s)?[i.createRangeOn(r)]:[]:i.schema.getValidRanges(i.createSelection(r).getRanges(),s)})(n,e,t))yield*o.getItems({shallow:!0})}class AI extends re{refresh(){let e=this.editor,t=e.plugins.get("ImageUtils").getClosestSelectedImageElement(e.model.document.selection);this.isEnabled=!!t,t&&t.hasAttribute("resizedWidth")?this.value={width:t.getAttribute("resizedWidth"),height:null}:this.value=null}execute(e){let t=this.editor,o=t.model,i=t.plugins.get("ImageUtils"),r=i.getClosestSelectedImageElement(o.document.selection);this.value={width:e.width,height:null},r&&o.change((s=>{s.setAttribute("resizedWidth",e.width,r),s.removeAttribute("resizedHeight",r),i.setImageNaturalSizeAttributes(r)}))}}class Zw extends L{static get requires(){return[gt]}static get pluginName(){return"ImageResizeEditing"}constructor(e){super(e),e.config.define("image",{resizeUnit:"%",resizeOptions:[{name:"resizeImage:original",value:null,icon:"original"},{name:"resizeImage:25",value:"25",icon:"small"},{name:"resizeImage:50",value:"50",icon:"medium"},{name:"resizeImage:75",value:"75",icon:"large"}]})}init(){let e=this.editor,t=new AI(e);this._registerConverters("imageBlock"),this._registerConverters("imageInline"),e.commands.add("resizeImage",t),e.commands.add("imageResize",t)}afterInit(){this._registerSchema()}_registerSchema(){this.editor.plugins.has("ImageBlockEditing")&&this.editor.model.schema.extend("imageBlock",{allowAttributes:["resizedWidth","resizedHeight"]}),this.editor.plugins.has("ImageInlineEditing")&&this.editor.model.schema.extend("imageInline",{allowAttributes:["resizedWidth","resizedHeight"]})}_registerConverters(e){let t=this.editor,o=t.plugins.get("ImageUtils");t.conversion.for("downcast").add((i=>i.on(`attribute:resizedWidth:${e}`,((r,s,a)=>{if(!a.consumable.consume(s.item,r.name))return;let l=a.writer,c=a.mapper.toViewElement(s.item);s.attributeNewValue!==null?(l.setStyle("width",s.attributeNewValue,c),l.addClass("image_resized",c)):(l.removeStyle("width",c),l.removeClass("image_resized",c))})))),t.conversion.for("dataDowncast").attributeToAttribute({model:{name:e,key:"resizedHeight"},view:i=>({key:"style",value:{height:i}})}),t.conversion.for("editingDowncast").add((i=>i.on(`attribute:resizedHeight:${e}`,((r,s,a)=>{if(!a.consumable.consume(s.item,r.name))return;let l=a.writer,c=a.mapper.toViewElement(s.item),d=e==="imageInline"?o.findViewImgElement(c):c;s.attributeNewValue!==null?l.setStyle("height",s.attributeNewValue,d):l.removeStyle("height",d)})))),t.conversion.for("upcast").attributeToAttribute({view:{name:e==="imageBlock"?"figure":"img",styles:{width:/.+/}},model:{key:"resizedWidth",value:i=>Ss(i)?null:i.getStyle("width")}}),t.conversion.for("upcast").attributeToAttribute({view:{name:e==="imageBlock"?"figure":"img",styles:{height:/.+/}},model:{key:"resizedHeight",value:i=>Ss(i)?null:i.getStyle("height")}})}}let Kc={small:Y.objectSizeSmall,medium:Y.objectSizeMedium,large:Y.objectSizeLarge,original:Y.objectSizeFull};class CI extends L{static get requires(){return[Zw]}static get pluginName(){return"ImageResizeButtons"}constructor(e){super(e),this._resizeUnit=e.config.get("image.resizeUnit")}init(){let e=this.editor,t=e.config.get("image.resizeOptions"),o=e.commands.get("resizeImage");this.bind("isEnabled").to(o);for(let i of t)this._registerImageResizeButton(i);this._registerImageResizeDropdown(t)}_registerImageResizeButton(e){let t=this.editor,{name:o,value:i,icon:r}=e,s=i?i+this._resizeUnit:null;t.ui.componentFactory.add(o,(a=>{let l=new ne(a),c=t.commands.get("resizeImage"),d=this._getOptionLabelValue(e,!0);if(!Kc[r])throw new y("imageresizebuttons-missing-icon",t,e);return l.set({label:d,icon:Kc[r],tooltip:d,isToggleable:!0}),l.bind("isEnabled").to(this),l.bind("isOn").to(c,"value",Kw(s)),this.listenTo(l,"execute",(()=>{t.execute("resizeImage",{width:s})})),l}))}_registerImageResizeDropdown(e){let t=this.editor,o=t.t,i=e.find((s=>!s.value)),r=s=>{let a=t.commands.get("resizeImage"),l=ot(s,On),c=l.buttonView,d=o("Resize image");return c.set({tooltip:d,commandValue:i.value,icon:Kc.medium,isToggleable:!0,label:this._getOptionLabelValue(i),withText:!0,class:"ck-resize-image-button",ariaLabel:d,ariaLabelledBy:void 0}),c.bind("label").to(a,"value",(u=>u&&u.width?u.width:this._getOptionLabelValue(i))),l.bind("isEnabled").to(this),vo(l,(()=>this._getResizeDropdownListItemDefinitions(e,a)),{ariaLabel:o("Image resize list"),role:"menu"}),this.listenTo(l,"execute",(u=>{t.execute(u.source.commandName,{width:u.source.commandValue}),t.editing.view.focus()})),l};t.ui.componentFactory.add("resizeImage",r),t.ui.componentFactory.add("imageResize",r)}_getOptionLabelValue(e,t=!1){let o=this.editor.t;return e.label?e.label:t?e.value?o("Resize image to %0",e.value+this._resizeUnit):o("Resize image to the original size"):e.value?e.value+this._resizeUnit:o("Original")}_getResizeDropdownListItemDefinitions(e,t){let o=new Je;return e.map((i=>{let r=i.value?i.value+this._resizeUnit:null,s={type:"button",model:new Wo({commandName:"resizeImage",commandValue:r,label:this._getOptionLabelValue(i),role:"menuitemradio",withText:!0,icon:null})};s.model.bind("isOn").to(t,"value",Kw(r)),o.add(s)})),o}}function Kw(n){return e=>n===null&&e===n||e!==null&&e.width===n}let Yc="image_resized";class vI extends L{static get requires(){return[hc,gt]}static get pluginName(){return"ImageResizeHandles"}init(){let e=this.editor.commands.get("resizeImage");this.bind("isEnabled").to(e),this._setupResizerCreator()}_setupResizerCreator(){let e=this.editor,t=e.editing.view,o=e.plugins.get("ImageUtils");t.addObserver(kc),this.listenTo(t.document,"imageLoaded",((i,r)=>{if(!r.target.matches("figure.image.ck-widget > img,figure.image.ck-widget > picture > img,figure.image.ck-widget > a > img,figure.image.ck-widget > a > picture > img,span.image-inline.ck-widget > img,span.image-inline.ck-widget > picture > img"))return;let s=e.editing.view.domConverter,a=s.domToView(r.target),l=o.getImageWidgetFromImageView(a),c=this.editor.plugins.get(hc).getResizerByViewElement(l);if(c)return void c.redraw();let d=e.editing.mapper,u=d.toModelElement(l);c=e.plugins.get(hc).attachTo({unit:e.config.get("image.resizeUnit"),modelElement:u,viewElement:l,editor:e,getHandleHost:h=>h.querySelector("img"),getResizeHost:()=>s.mapViewToDom(d.toViewElement(u.parent)),isCentered:()=>u.getAttribute("imageStyle")=="alignCenter",onCommit(h){t.change((m=>{m.removeClass(Yc,l)})),e.execute("resizeImage",{width:h})}}),c.on("updateSize",(()=>{l.hasClass(Yc)||t.change((m=>{m.addClass(Yc,l)}));let h=u.name==="imageInline"?a:l;h.getStyle("height")&&t.change((m=>{m.removeStyle("height",h)}))})),c.bind("isEnabled").to(this)}))}}var Yw=z(1043),yI={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(Yw.Z,yI),Yw.Z.locals;class xI extends K{constructor(e){super(e),this.set("imageURLInputValue",""),this.set("isImageSelected",!1),this.set("isEnabled",!0),this.focusTracker=new Me,this.keystrokes=new Ve,this._focusables=new et,this.focusCycler=new tt({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.urlInputView=this._createUrlInputView(),this.insertButtonView=this._createInsertButton(),this.cancelButtonView=this._createCancelButton(),this._focusables.addMany([this.urlInputView,this.insertButtonView,this.cancelButtonView]),this.setTemplate({tag:"div",attributes:{class:["ck","ck-image-insert-url"]},children:[this.urlInputView,{tag:"div",attributes:{class:["ck","ck-image-insert-url__action-row"]},children:[this.insertButtonView,this.cancelButtonView]}]})}render(){super.render();for(let e of this._focusables)this.focusTracker.add(e.element);this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createUrlInputView(){let e=this.locale,t=e.t,o=new Ge(e,xt);return o.bind("label").to(this,"isImageSelected",(i=>t(i?"Update image URL":"Insert image via URL"))),o.bind("isEnabled").to(this),o.fieldView.placeholder="https://example.com/image.png",o.fieldView.bind("value").to(this,"imageURLInputValue",(i=>i||"")),o.fieldView.on("input",(()=>{this.imageURLInputValue=o.fieldView.element.value.trim()})),o}_createInsertButton(){let e=this.locale,t=e.t,o=new ne(e);return o.set({icon:Y.check,class:"ck-button-save",type:"submit",withText:!0}),o.bind("label").to(this,"isImageSelected",(i=>t(i?"Update":"Insert"))),o.bind("isEnabled").to(this,"imageURLInputValue",this,"isEnabled",((...i)=>i.every((r=>r)))),o.delegate("execute").to(this,"submit"),o}_createCancelButton(){let e=this.locale,t=e.t,o=new ne(e);return o.set({label:t("Cancel"),icon:Y.cancel,class:"ck-button-cancel",withText:!0}),o.bind("isEnabled").to(this),o.delegate("execute").to(this,"cancel"),o}focus(e){e===-1?this.focusCycler.focusLast():this.focusCycler.focusFirst()}}class li extends re{constructor(e,t){super(e),this.attributeKey=t}refresh(){let e=this.editor.model,t=e.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,this.attributeKey)}execute(e={}){let t=this.editor.model,o=t.document.selection,i=e.forceValue===void 0?!this.value:e.forceValue;t.change((r=>{if(o.isCollapsed)i?r.setSelectionAttribute(this.attributeKey,!0):r.removeSelectionAttribute(this.attributeKey);else{let s=t.schema.getValidRanges(o.getRanges(),this.attributeKey);for(let a of s)i?r.setAttribute(this.attributeKey,i,a):r.removeAttribute(this.attributeKey,a)}}))}_getValueFromFirstAllowedNode(){let e=this.editor.model,t=e.schema,o=e.document.selection;if(o.isCollapsed)return o.hasAttribute(this.attributeKey);for(let i of o.getRanges())for(let r of i.getItems())if(t.checkAttribute(r,this.attributeKey))return r.hasAttribute(this.attributeKey);return!1}}let Yi="bold";class EI extends L{static get pluginName(){return"BoldEditing"}init(){let e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:Yi}),e.model.schema.setAttributeProperties(Yi,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:Yi,view:"strong",upcastAlso:["b",o=>{let i=o.getStyle("font-weight");return i&&(i=="bold"||Number(i)>=600)?{name:!0,styles:["font-weight"]}:null}]}),e.commands.add(Yi,new li(e,Yi)),e.keystrokes.set("CTRL+B",Yi),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Bold text"),keystroke:"CTRL+B"}]})}}function ci({editor:n,commandName:e,plugin:t,icon:o,label:i,keystroke:r}){return s=>{let a=n.commands.get(e),l=new s(n.locale);return l.set({label:i,icon:o,keystroke:r,isToggleable:!0}),l.bind("isEnabled").to(a,"isEnabled"),t.listenTo(l,"execute",(()=>{n.execute(e),n.editing.view.focus()})),l}}let Xs="bold";class DI extends L{static get pluginName(){return"BoldUI"}init(){let e=this.editor,t=e.locale.t,o=e.commands.get(Xs),i=ci({editor:e,commandName:Xs,plugin:this,icon:Y.bold,label:t("Bold"),keystroke:"CTRL+B"});e.ui.componentFactory.add(Xs,(()=>{let r=i(ne);return r.set({tooltip:!0}),r.bind("isOn").to(o,"value"),r})),e.ui.componentFactory.add("menuBar:"+Xs,(()=>i(Pe)))}}class Qw extends L{static get requires(){return[EI,DI]}static get pluginName(){return"Bold"}}let di="code";class TI extends L{static get pluginName(){return"CodeEditing"}static get requires(){return[bs]}init(){let e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:di}),e.model.schema.setAttributeProperties(di,{isFormatting:!0,copyOnEnter:!1}),e.conversion.attributeToElement({model:di,view:"code",upcastAlso:{styles:{"word-wrap":"break-word"}}}),e.commands.add(di,new li(e,di)),e.plugins.get(bs).registerAttribute(di),Zp(e,di,"code","ck-code_selected"),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Move out of an inline code style"),keystroke:[["arrowleft","arrowleft"],["arrowright","arrowright"]]}]})}}var Jw=z(8180),SI={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(Jw.Z,SI),Jw.Z.locals;let ea="code";class II extends L{static get pluginName(){return"CodeUI"}init(){let e=this.editor,t=e.locale.t,o=ci({editor:e,commandName:ea,plugin:this,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m12.5 5.7 5.2 3.9v1.3l-5.6 4c-.1.2-.3.2-.5.2-.3-.1-.6-.7-.6-1l.3-.4 4.7-3.5L11.5 7l-.2-.2c-.1-.3-.1-.6 0-.8.2-.2.5-.4.8-.4a.8.8 0 0 1 .4.1zm-5.2 0L2 9.6v1.3l5.6 4c.1.2.3.2.5.2.3-.1.7-.7.6-1 0-.1 0-.3-.2-.4l-5-3.5L8.2 7l.2-.2c.1-.3.1-.6 0-.8-.2-.2-.5-.4-.8-.4a.8.8 0 0 0-.3.1z"/></svg>',label:t("Code")});e.ui.componentFactory.add(ea,(()=>{let i=o(ne),r=e.commands.get(ea);return i.set({tooltip:!0}),i.bind("isOn").to(r,"value"),i})),e.ui.componentFactory.add("menuBar:"+ea,(()=>o(Pe)))}}let Qi="italic";class BI extends L{static get pluginName(){return"ItalicEditing"}init(){let e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:Qi}),e.model.schema.setAttributeProperties(Qi,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:Qi,view:"i",upcastAlso:["em",{styles:{"font-style":"italic"}}]}),e.commands.add(Qi,new li(e,Qi)),e.keystrokes.set("CTRL+I",Qi),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Italic text"),keystroke:"CTRL+I"}]})}}let ta="italic";class MI extends L{static get pluginName(){return"ItalicUI"}init(){let e=this.editor,t=e.commands.get(ta),o=e.locale.t,i=ci({editor:e,commandName:ta,plugin:this,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m9.586 14.633.021.004c-.036.335.095.655.393.962.082.083.173.15.274.201h1.474a.6.6 0 1 1 0 1.2H5.304a.6.6 0 0 1 0-1.2h1.15c.474-.07.809-.182 1.005-.334.157-.122.291-.32.404-.597l2.416-9.55a1.053 1.053 0 0 0-.281-.823 1.12 1.12 0 0 0-.442-.296H8.15a.6.6 0 0 1 0-1.2h6.443a.6.6 0 1 1 0 1.2h-1.195c-.376.056-.65.155-.823.296-.215.175-.423.439-.623.79l-2.366 9.347z"/></svg>',keystroke:"CTRL+I",label:o("Italic")});e.ui.componentFactory.add(ta,(()=>{let r=i(ne);return r.set({tooltip:!0}),r.bind("isOn").to(t,"value"),r})),e.ui.componentFactory.add("menuBar:"+ta,(()=>i(Pe)))}}class Xw extends L{static get requires(){return[BI,MI]}static get pluginName(){return"Italic"}}let ar="strikethrough";class NI extends L{static get pluginName(){return"StrikethroughEditing"}init(){let e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:ar}),e.model.schema.setAttributeProperties(ar,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:ar,view:"s",upcastAlso:["del","strike",{styles:{"text-decoration":"line-through"}}]}),e.commands.add(ar,new li(e,ar)),e.keystrokes.set("CTRL+SHIFT+X","strikethrough"),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Strikethrough text"),keystroke:"CTRL+SHIFT+X"}]})}}let oa="strikethrough";class PI extends L{static get pluginName(){return"StrikethroughUI"}init(){let e=this.editor,t=e.locale.t,o=ci({editor:e,commandName:oa,plugin:this,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M7 16.4c-.8-.4-1.5-.9-2.2-1.5a.6.6 0 0 1-.2-.5l.3-.6h1c1 1.2 2.1 1.7 3.7 1.7 1 0 1.8-.3 2.3-.6.6-.4.6-1.2.6-1.3.2-1.2-.9-2.1-.9-2.1h2.1c.3.7.4 1.2.4 1.7v.8l-.6 1.2c-.6.8-1.1 1-1.6 1.2a6 6 0 0 1-2.4.6c-1 0-1.8-.3-2.5-.6zM6.8 9 6 8.3c-.4-.5-.5-.8-.5-1.6 0-.7.1-1.3.5-1.8.4-.6 1-1 1.6-1.3a6.3 6.3 0 0 1 4.7 0 4 4 0 0 1 1.7 1l.3.7c0 .1.2.4-.2.7-.4.2-.9.1-1 0a3 3 0 0 0-1.2-1c-.4-.2-1-.3-2-.4-.7 0-1.4.2-2 .6-.8.6-1 .8-1 1.5 0 .8.5 1 1.2 1.5.6.4 1.1.7 1.9 1H6.8z"/><path d="M3 10.5V9h14v1.5z"/></svg>',keystroke:"CTRL+SHIFT+X",label:t("Strikethrough")});e.ui.componentFactory.add(oa,(()=>{let i=o(ne),r=e.commands.get(oa);return i.set({tooltip:!0}),i.bind("isOn").to(r,"value"),i})),e.ui.componentFactory.add("menuBar:"+oa,(()=>o(Pe)))}}let lr="subscript";class LI extends L{static get pluginName(){return"SubscriptEditing"}init(){let e=this.editor;e.model.schema.extend("$text",{allowAttributes:lr}),e.model.schema.setAttributeProperties(lr,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:lr,view:"sub",upcastAlso:[{styles:{"vertical-align":"sub"}}]}),e.commands.add(lr,new li(e,lr))}}let ia="subscript";class zI extends L{static get pluginName(){return"SubscriptUI"}init(){let e=this.editor,t=e.locale.t,o=ci({editor:e,commandName:ia,plugin:this,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m7.03 10.349 3.818-3.819a.8.8 0 1 1 1.132 1.132L8.16 11.48l3.819 3.818a.8.8 0 1 1-1.132 1.132L7.03 12.61l-3.818 3.82a.8.8 0 1 1-1.132-1.132L5.9 11.48 2.08 7.662A.8.8 0 1 1 3.212 6.53l3.818 3.82zm8.147 7.829h2.549c.254 0 .447.05.58.152a.49.49 0 0 1 .201.413.54.54 0 0 1-.159.393c-.105.108-.266.162-.48.162h-3.594c-.245 0-.435-.066-.572-.197a.621.621 0 0 1-.205-.463c0-.114.044-.265.132-.453a1.62 1.62 0 0 1 .288-.444c.433-.436.824-.81 1.172-1.122.348-.312.597-.517.747-.615.267-.183.49-.368.667-.553.177-.185.312-.375.405-.57.093-.194.139-.384.139-.57a1.008 1.008 0 0 0-.554-.917 1.197 1.197 0 0 0-.56-.133c-.426 0-.761.182-1.005.546a2.332 2.332 0 0 0-.164.39 1.609 1.609 0 0 1-.258.488c-.096.114-.237.17-.423.17a.558.558 0 0 1-.405-.156.568.568 0 0 1-.161-.427c0-.218.05-.446.151-.683.101-.238.252-.453.452-.646s.454-.349.762-.467a2.998 2.998 0 0 1 1.081-.178c.498 0 .923.076 1.274.228a1.916 1.916 0 0 1 1.004 1.032 1.984 1.984 0 0 1-.156 1.794c-.2.32-.405.572-.613.754-.208.182-.558.468-1.048.857-.49.39-.826.691-1.008.906a2.703 2.703 0 0 0-.24.309z"/></svg>',label:t("Subscript")});e.ui.componentFactory.add(ia,(()=>{let i=o(ne),r=e.commands.get(ia);return i.set({tooltip:!0}),i.bind("isOn").to(r,"value"),i})),e.ui.componentFactory.add("menuBar:"+ia,(()=>o(Pe)))}}let cr="superscript";class OI extends L{static get pluginName(){return"SuperscriptEditing"}init(){let e=this.editor;e.model.schema.extend("$text",{allowAttributes:cr}),e.model.schema.setAttributeProperties(cr,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:cr,view:"sup",upcastAlso:[{styles:{"vertical-align":"super"}}]}),e.commands.add(cr,new li(e,cr))}}let na="superscript";class RI extends L{static get pluginName(){return"SuperscriptUI"}init(){let e=this.editor,t=e.locale.t,o=ci({editor:e,commandName:na,plugin:this,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M15.677 8.678h2.549c.254 0 .447.05.58.152a.49.49 0 0 1 .201.413.54.54 0 0 1-.159.393c-.105.108-.266.162-.48.162h-3.594c-.245 0-.435-.066-.572-.197a.621.621 0 0 1-.205-.463c0-.114.044-.265.132-.453a1.62 1.62 0 0 1 .288-.444c.433-.436.824-.81 1.172-1.122.348-.312.597-.517.747-.615.267-.183.49-.368.667-.553.177-.185.312-.375.405-.57.093-.194.139-.384.139-.57a1.008 1.008 0 0 0-.554-.917 1.197 1.197 0 0 0-.56-.133c-.426 0-.761.182-1.005.546a2.332 2.332 0 0 0-.164.39 1.609 1.609 0 0 1-.258.488c-.096.114-.237.17-.423.17a.558.558 0 0 1-.405-.156.568.568 0 0 1-.161-.427c0-.218.05-.446.151-.683.101-.238.252-.453.452-.646s.454-.349.762-.467a2.998 2.998 0 0 1 1.081-.178c.498 0 .923.076 1.274.228a1.916 1.916 0 0 1 1.004 1.032 1.984 1.984 0 0 1-.156 1.794c-.2.32-.405.572-.613.754-.208.182-.558.468-1.048.857-.49.39-.826.691-1.008.906a2.703 2.703 0 0 0-.24.309zM7.03 10.349l3.818-3.819a.8.8 0 1 1 1.132 1.132L8.16 11.48l3.819 3.818a.8.8 0 1 1-1.132 1.132L7.03 12.61l-3.818 3.82a.8.8 0 1 1-1.132-1.132L5.9 11.48 2.08 7.662A.8.8 0 1 1 3.212 6.53l3.818 3.82z"/></svg>',label:t("Superscript")});e.ui.componentFactory.add(na,(()=>{let i=o(ne),r=e.commands.get(na);return i.set({tooltip:!0}),i.bind("isOn").to(r,"value"),i})),e.ui.componentFactory.add("menuBar:"+na,(()=>o(Pe)))}}let dr="underline";class FI extends L{static get pluginName(){return"UnderlineEditing"}init(){let e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:dr}),e.model.schema.setAttributeProperties(dr,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:dr,view:"u",upcastAlso:{styles:{"text-decoration":"underline"}}}),e.commands.add(dr,new li(e,dr)),e.keystrokes.set("CTRL+U","underline"),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Underline text"),keystroke:"CTRL+U"}]})}}let ra="underline";class VI extends L{static get pluginName(){return"UnderlineUI"}init(){let e=this.editor,t=e.commands.get(ra),o=e.locale.t,i=ci({editor:e,commandName:ra,plugin:this,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 18v-1.5h14V18zm2.2-8V3.6c0-.4.4-.6.8-.6.3 0 .7.2.7.6v6.2c0 2 1.3 2.8 3.2 2.8 1.9 0 3.4-.9 3.4-2.9V3.6c0-.3.4-.5.8-.5.3 0 .7.2.7.5V10c0 2.7-2.2 4-4.9 4-2.6 0-4.7-1.2-4.7-4z"/></svg>',label:o("Underline"),keystroke:"CTRL+U"});e.ui.componentFactory.add(ra,(()=>{let r=i(ne);return r.set({tooltip:!0}),r.bind("isOn").to(t,"value"),r})),e.ui.componentFactory.add("menuBar:"+ra,(()=>i(Pe)))}}class jI{constructor(){this._definitions=new Set}get length(){return this._definitions.size}add(e){Array.isArray(e)?e.forEach((t=>this._definitions.add(t))):this._definitions.add(e)}getDispatcher(){return e=>{e.on("attribute:linkHref",((t,o,i)=>{if(!i.consumable.test(o.item,"attribute:linkHref")||!o.item.is("selection")&&!i.schema.isInline(o.item))return;let r=i.writer,s=r.document.selection;for(let a of this._definitions){let l=r.createAttributeElement("a",a.attributes,{priority:5});a.classes&&r.addClass(a.classes,l);for(let c in a.styles)r.setStyle(c,a.styles[c],l);r.setCustomProperty("link",!0,l),a.callback(o.attributeNewValue)?o.item.is("selection")?r.wrap(s.getFirstRange(),l):r.wrap(i.mapper.toViewRange(o.range),l):r.unwrap(i.mapper.toViewRange(o.range),l)}}),{priority:"high"})}}getDispatcherForLinkedImage(){return e=>{e.on("attribute:linkHref:imageBlock",((t,o,{writer:i,mapper:r})=>{let s=r.toViewElement(o.item),a=Array.from(s.getChildren()).find((l=>l.is("element","a")));for(let l of this._definitions){let c=Gt(l.attributes);if(l.callback(o.attributeNewValue)){for(let[d,u]of c)d==="class"?i.addClass(u,a):i.setAttribute(d,u,a);l.classes&&i.addClass(l.classes,a);for(let d in l.styles)i.setStyle(d,l.styles[d],a)}else{for(let[d,u]of c)d==="class"?i.removeClass(u,a):i.removeAttribute(d,a);l.classes&&i.removeClass(l.classes,a);for(let d in l.styles)i.removeStyle(d,a)}}}))}}}let HI=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,UI=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,$I=/^((\w+:(\/{2,})?)|(\W))/i,qI=["https?","ftps?","mailto"],sa="Ctrl+K";function e0(n,{writer:e}){let t=e.createAttributeElement("a",{href:n},{priority:5});return e.setCustomProperty("link",!0,t),t}function t0(n,e=qI){let t=String(n),o=e.join("|");return(function(i,r){return!!i.replace(HI,"").match(r)})(t,new RegExp(`${"^(?:(?:<protocols>):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))".replace("<protocols>",o)}`,"i"))?t:"#"}function Qc(n,e){return!!n&&e.checkAttribute(n.name,"linkHref")}function Jc(n,e){let t=(o=n,UI.test(o)?"mailto:":e);var o;let i=!!t&&!o0(n);return n&&i?t+n:n}function o0(n){return $I.test(n)}function i0(n){window.open(n,"_blank","noopener")}class WI extends re{constructor(){super(...arguments),this.manualDecorators=new Je,this.automaticDecorators=new jI}restoreManualDecoratorStates(){for(let e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}refresh(){let e=this.editor.model,t=e.document.selection,o=t.getSelectedElement()||Be(t.getSelectedBlocks());Qc(o,e.schema)?(this.value=o.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttribute(o,"linkHref")):(this.value=t.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref"));for(let i of this.manualDecorators)i.value=this._getDecoratorStateFromModel(i.id)}execute(e,t={}){let o=this.editor.model,i=o.document.selection,r=[],s=[];for(let a in t)t[a]?r.push(a):s.push(a);o.change((a=>{if(i.isCollapsed){let l=i.getFirstPosition();if(i.hasAttribute("linkHref")){let c=n0(i),d=_s(l,"linkHref",i.getAttribute("linkHref"),o);i.getAttribute("linkHref")===c&&(d=this._updateLinkContent(o,a,d,e)),a.setAttribute("linkHref",e,d),r.forEach((u=>{a.setAttribute(u,!0,d)})),s.forEach((u=>{a.removeAttribute(u,d)})),a.setSelection(a.createPositionAfter(d.end.nodeBefore))}else if(e!==""){let c=Gt(i.getAttributes());c.set("linkHref",e),r.forEach((u=>{c.set(u,!0)}));let{end:d}=o.insertContent(a.createText(e,c),l);a.setSelection(d)}["linkHref",...r,...s].forEach((c=>{a.removeSelectionAttribute(c)}))}else{let l=o.schema.getValidRanges(i.getRanges(),"linkHref"),c=[];for(let u of i.getSelectedBlocks())o.schema.checkAttribute(u,"linkHref")&&c.push(a.createRangeOn(u));let d=c.slice();for(let u of l)this._isRangeToUpdate(u,c)&&d.push(u);for(let u of d){let h=u;if(d.length===1){let m=n0(i);i.getAttribute("linkHref")===m&&(h=this._updateLinkContent(o,a,u,e),a.setSelection(a.createSelection(h)))}a.setAttribute("linkHref",e,h),r.forEach((m=>{a.setAttribute(m,!0,h)})),s.forEach((m=>{a.removeAttribute(m,h)}))}}}))}_getDecoratorStateFromModel(e){let t=this.editor.model,o=t.document.selection,i=o.getSelectedElement();return Qc(i,t.schema)?i.getAttribute(e):o.getAttribute(e)}_isRangeToUpdate(e,t){for(let o of t)if(o.containsRange(e))return!1;return!0}_updateLinkContent(e,t,o,i){let r=t.createText(i,{linkHref:i});return e.insertContent(r,o)}}function n0(n){if(n.isCollapsed){let e=n.getFirstPosition();return e.textNode&&e.textNode.data}{let e=Array.from(n.getFirstRange().getItems());if(e.length>1)return null;let t=e[0];return t.is("$text")||t.is("$textProxy")?t.data:null}}class GI extends re{refresh(){let e=this.editor.model,t=e.document.selection,o=t.getSelectedElement();Qc(o,e.schema)?this.isEnabled=e.schema.checkAttribute(o,"linkHref"):this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref")}execute(){let e=this.editor,t=this.editor.model,o=t.document.selection,i=e.commands.get("link");t.change((r=>{let s=o.isCollapsed?[_s(o.getFirstPosition(),"linkHref",o.getAttribute("linkHref"),t)]:t.schema.getValidRanges(o.getRanges(),"linkHref");for(let a of s)if(r.removeAttribute("linkHref",a),i)for(let l of i.manualDecorators)r.removeAttribute(l.id,a)}))}}class ZI extends we(){constructor({id:e,label:t,attributes:o,classes:i,styles:r,defaultValue:s}){super(),this.id=e,this.set("value",void 0),this.defaultValue=s,this.label=t,this.attributes=o,this.classes=i,this.styles=r}_createPattern(){return{attributes:this.attributes,classes:this.classes,styles:this.styles}}}var r0=z(399),KI={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(r0.Z,KI),r0.Z.locals;let s0="automatic",YI=/^(https?:)?\/\//;class a0 extends L{static get pluginName(){return"LinkEditing"}static get requires(){return[bs,Rp,Lt]}constructor(e){super(e),e.config.define("link",{allowCreatingEmptyLinks:!1,addTargetToExternalLinks:!1})}init(){let e=this.editor,t=this.editor.config.get("link.allowedProtocols");e.model.schema.extend("$text",{allowAttributes:"linkHref"}),e.conversion.for("dataDowncast").attributeToElement({model:"linkHref",view:e0}),e.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(i,r)=>e0(t0(i,t),r)}),e.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:i=>i.getAttribute("href")}}),e.commands.add("link",new WI(e)),e.commands.add("unlink",new GI(e));let o=(function(i,r){let s={"Open in a new tab":i("Open in a new tab"),Downloadable:i("Downloadable")};return r.forEach((a=>("label"in a&&s[a.label]&&(a.label=s[a.label]),a))),r})(e.t,(function(i){let r=[];if(i)for(let[s,a]of Object.entries(i)){let l=Object.assign({},a,{id:`link${Hw(s)}`});r.push(l)}return r})(e.config.get("link.decorators")));this._enableAutomaticDecorators(o.filter((i=>i.mode===s0))),this._enableManualDecorators(o.filter((i=>i.mode==="manual"))),e.plugins.get(bs).registerAttribute("linkHref"),Zp(e,"linkHref","a","ck-link_selected"),this._enableLinkOpen(),this._enableSelectionAttributesFixer(),this._enableClipboardIntegration()}_enableAutomaticDecorators(e){let t=this.editor,o=t.commands.get("link").automaticDecorators;t.config.get("link.addTargetToExternalLinks")&&o.add({id:"linkIsExternal",mode:s0,callback:i=>!!i&&YI.test(i),attributes:{target:"_blank",rel:"noopener noreferrer"}}),o.add(e),o.length&&t.conversion.for("downcast").add(o.getDispatcher())}_enableManualDecorators(e){if(!e.length)return;let t=this.editor,o=t.commands.get("link").manualDecorators;e.forEach((i=>{t.model.schema.extend("$text",{allowAttributes:i.id});let r=new ZI(i);o.add(r),t.conversion.for("downcast").attributeToElement({model:r.id,view:(s,{writer:a,schema:l},{item:c})=>{if((c.is("selection")||l.isInline(c))&&s){let d=a.createAttributeElement("a",r.attributes,{priority:5});r.classes&&a.addClass(r.classes,d);for(let u in r.styles)a.setStyle(u,r.styles[u],d);return a.setCustomProperty("link",!0,d),d}}}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",...r._createPattern()},model:{key:r.id}})}))}_enableLinkOpen(){let e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",((o,i)=>{if(!(k.isMac?i.domEvent.metaKey:i.domEvent.ctrlKey))return;let r=i.domTarget;if(r.tagName.toLowerCase()!="a"&&(r=r.closest("a")),!r)return;let s=r.getAttribute("href");s&&(o.stop(),i.preventDefault(),i0(s))}),{context:"$capture"}),this.listenTo(t,"keydown",((o,i)=>{let r=e.commands.get("link").value;r&&i.keyCode===me.enter&&i.altKey&&(o.stop(),i0(r))}))}_enableSelectionAttributesFixer(){let e=this.editor.model,t=e.document.selection;this.listenTo(t,"change:attribute",((o,{attributeKeys:i})=>{i.includes("linkHref")&&!t.hasAttribute("linkHref")&&e.change((r=>{var s;(function(a,l){a.removeSelectionAttribute("linkHref");for(let c of l)a.removeSelectionAttribute(c)})(r,(s=e.schema,s.getDefinition("$text").allowAttributes.filter((a=>a.startsWith("link")))))}))}))}_enableClipboardIntegration(){let e=this.editor,t=e.model,o=this.editor.config.get("link.defaultProtocol");o&&this.listenTo(e.plugins.get("ClipboardPipeline"),"contentInsertion",((i,r)=>{t.change((s=>{let a=s.createRangeIn(r.content);for(let l of a.getItems())if(l.hasAttribute("linkHref")){let c=Jc(l.getAttribute("linkHref"),o);s.setAttribute("linkHref",c,l)}}))}))}}var l0=z(4827),QI={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(l0.Z,QI),l0.Z.locals;class JI extends K{constructor(e,t){super(e),this.focusTracker=new Me,this.keystrokes=new Ve,this._focusables=new et;let o=e.t;this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(o("Save"),Y.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(o("Cancel"),Y.cancel,"ck-button-cancel","cancel"),this._manualDecoratorSwitches=this._createManualDecoratorSwitches(t),this.children=this._createFormChildren(t.manualDecorators),this._focusCycler=new tt({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});let i=["ck","ck-link-form","ck-responsive-form"];t.manualDecorators.length&&i.push("ck-link-form_layout-vertical","ck-vertical-form"),this.setTemplate({tag:"form",attributes:{class:i,tabindex:"-1"},children:this.children})}getDecoratorSwitchesState(){return Array.from(this._manualDecoratorSwitches).reduce(((e,t)=>(e[t.name]=t.isOn,e)),{})}render(){super.render(),p({view:this}),[this.urlInputView,...this._manualDecoratorSwitches,this.saveButtonView,this.cancelButtonView].forEach((e=>{this._focusables.add(e),this.focusTracker.add(e.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createUrlInput(){let e=this.locale.t,t=new Ge(this.locale,xt);return t.label=e("Link URL"),t}_createButton(e,t,o,i){let r=new ne(this.locale);return r.set({label:e,icon:t,tooltip:!0}),r.extendTemplate({attributes:{class:o}}),i&&r.delegate("execute").to(this,i),r}_createManualDecoratorSwitches(e){let t=this.createCollection();for(let o of e.manualDecorators){let i=new rs(this.locale);i.set({name:o.id,label:o.label,withText:!0}),i.bind("isOn").toMany([o,e],"value",((r,s)=>s===void 0&&r===void 0?!!o.defaultValue:!!r)),i.on("execute",(()=>{o.set("value",!i.isOn)})),t.add(i)}return t}_createFormChildren(e){let t=this.createCollection();if(t.add(this.urlInputView),e.length){let o=new K;o.setTemplate({tag:"ul",children:this._manualDecoratorSwitches.map((i=>({tag:"li",children:[i],attributes:{class:["ck","ck-list__item"]}}))),attributes:{class:["ck","ck-reset","ck-list"]}}),t.add(o)}return t.add(this.saveButtonView),t.add(this.cancelButtonView),t}}var c0=z(9465),XI={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(c0.Z,XI),c0.Z.locals;class eB extends K{constructor(e,t={}){super(e),this.focusTracker=new Me,this.keystrokes=new Ve,this._focusables=new et;let o=e.t;this.previewButtonView=this._createPreviewButton(),this.unlinkButtonView=this._createButton(o("Unlink"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.077 15 .991-1.416a.75.75 0 1 1 1.229.86l-1.148 1.64a.748.748 0 0 1-.217.206 5.251 5.251 0 0 1-8.503-5.955.741.741 0 0 1 .12-.274l1.147-1.639a.75.75 0 1 1 1.228.86L4.933 10.7l.006.003a3.75 3.75 0 0 0 6.132 4.294l.006.004zm5.494-5.335a.748.748 0 0 1-.12.274l-1.147 1.639a.75.75 0 1 1-1.228-.86l.86-1.23a3.75 3.75 0 0 0-6.144-4.301l-.86 1.229a.75.75 0 0 1-1.229-.86l1.148-1.64a.748.748 0 0 1 .217-.206 5.251 5.251 0 0 1 8.503 5.955zm-4.563-2.532a.75.75 0 0 1 .184 1.045l-3.155 4.505a.75.75 0 1 1-1.229-.86l3.155-4.506a.75.75 0 0 1 1.045-.184zm4.919 10.562-1.414 1.414a.75.75 0 1 1-1.06-1.06l1.414-1.415-1.415-1.414a.75.75 0 0 1 1.061-1.06l1.414 1.414 1.414-1.415a.75.75 0 0 1 1.061 1.061l-1.414 1.414 1.414 1.415a.75.75 0 0 1-1.06 1.06l-1.415-1.414z"/></svg>',"unlink"),this.editButtonView=this._createButton(o("Edit link"),Y.pencil,"edit"),this.set("href",void 0),this._linkConfig=t,this._focusCycler=new tt({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-link-actions","ck-responsive-form"],tabindex:"-1"},children:[this.previewButtonView,this.editButtonView,this.unlinkButtonView]})}render(){super.render(),[this.previewButtonView,this.editButtonView,this.unlinkButtonView].forEach((e=>{this._focusables.add(e),this.focusTracker.add(e.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createButton(e,t,o){let i=new ne(this.locale);return i.set({label:e,icon:t,tooltip:!0}),i.delegate("execute").to(this,o),i}_createPreviewButton(){let e=new ne(this.locale),t=this.bindTemplate,o=this.t;return e.set({withText:!0,tooltip:o("Open link in new tab")}),e.extendTemplate({attributes:{class:["ck","ck-link-actions__preview"],href:t.to("href",(i=>i&&t0(i,this._linkConfig.allowedProtocols))),target:"_blank",rel:"noopener noreferrer"}}),e.bind("label").to(this,"href",(i=>i||o("This link has no URL"))),e.bind("isEnabled").to(this,"href",(i=>!!i)),e.template.tag="a",e.template.eventListeners={},e}}let io="link-ui";class tB extends L{constructor(){super(...arguments),this.actionsView=null,this.formView=null}static get requires(){return[Xt]}static get pluginName(){return"LinkUI"}init(){let e=this.editor,t=this.editor.t;e.editing.view.addObserver(Xy),this._balloon=e.plugins.get(Xt),this._createToolbarLinkButton(),this._enableBalloonActivators(),e.conversion.for("editingDowncast").markerToHighlight({model:io,view:{classes:["ck-fake-link-selection"]}}),e.conversion.for("editingDowncast").markerToElement({model:io,view:{name:"span",classes:["ck-fake-link-selection","ck-fake-link-selection_collapsed"]}}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Create link"),keystroke:sa},{label:t("Move out of a link"),keystroke:[["arrowleft","arrowleft"],["arrowright","arrowright"]]}]})}destroy(){super.destroy(),this.formView&&this.formView.destroy(),this.actionsView&&this.actionsView.destroy()}_createViews(){this.actionsView=this._createActionsView(),this.formView=this._createFormView(),this._enableUserBalloonInteractions()}_createActionsView(){let e=this.editor,t=new eB(e.locale,e.config.get("link")),o=e.commands.get("link"),i=e.commands.get("unlink");return t.bind("href").to(o,"value"),t.editButtonView.bind("isEnabled").to(o),t.unlinkButtonView.bind("isEnabled").to(i),this.listenTo(t,"edit",(()=>{this._addFormView()})),this.listenTo(t,"unlink",(()=>{e.execute("unlink"),this._hideUI()})),t.keystrokes.set("Esc",((r,s)=>{this._hideUI(),s()})),t.keystrokes.set(sa,((r,s)=>{this._addFormView(),s()})),t}_createFormView(){let e=this.editor,t=e.commands.get("link"),o=e.config.get("link.defaultProtocol"),i=e.config.get("link.allowCreatingEmptyLinks"),r=new(T(JI))(e.locale,t);return r.urlInputView.fieldView.bind("value").to(t,"value"),r.urlInputView.bind("isEnabled").to(t,"isEnabled"),r.saveButtonView.bind("isEnabled").to(t,"isEnabled",r.urlInputView,"isEmpty",((s,a)=>s&&(i||!a))),this.listenTo(r,"submit",(()=>{let{value:s}=r.urlInputView.fieldView.element,a=Jc(s,o);e.execute("link",a,r.getDecoratorSwitchesState()),this._closeFormView()})),this.listenTo(r,"cancel",(()=>{this._closeFormView()})),r.keystrokes.set("Esc",((s,a)=>{this._closeFormView(),a()})),r}_createToolbarLinkButton(){let e=this.editor,t=e.commands.get("link");e.ui.componentFactory.add("link",(()=>{let o=this._createButton(ne);return o.set({tooltip:!0,isToggleable:!0}),o.bind("isOn").to(t,"value",(i=>!!i)),o})),e.ui.componentFactory.add("menuBar:link",(()=>this._createButton(Pe)))}_createButton(e){let t=this.editor,o=t.locale,i=t.commands.get("link"),r=new e(t.locale),s=o.t;return r.set({label:s("Link"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.077 15 .991-1.416a.75.75 0 1 1 1.229.86l-1.148 1.64a.748.748 0 0 1-.217.206 5.251 5.251 0 0 1-8.503-5.955.741.741 0 0 1 .12-.274l1.147-1.639a.75.75 0 1 1 1.228.86L4.933 10.7l.006.003a3.75 3.75 0 0 0 6.132 4.294l.006.004zm5.494-5.335a.748.748 0 0 1-.12.274l-1.147 1.639a.75.75 0 1 1-1.228-.86l.86-1.23a3.75 3.75 0 0 0-6.144-4.301l-.86 1.229a.75.75 0 0 1-1.229-.86l1.148-1.64a.748.748 0 0 1 .217-.206 5.251 5.251 0 0 1 8.503 5.955zm-4.563-2.532a.75.75 0 0 1 .184 1.045l-3.155 4.505a.75.75 0 1 1-1.229-.86l3.155-4.506a.75.75 0 0 1 1.045-.184z"/></svg>',keystroke:sa}),r.bind("isEnabled").to(i,"isEnabled"),this.listenTo(r,"execute",(()=>this._showUI(!0))),r}_enableBalloonActivators(){let e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",(()=>{this._getSelectedLinkElement()&&this._showUI()})),e.keystrokes.set(sa,((o,i)=>{i(),e.commands.get("link").isEnabled&&this._showUI(!0)}))}_enableUserBalloonInteractions(){this.editor.keystrokes.set("Tab",((e,t)=>{this._areActionsVisible&&!this.actionsView.focusTracker.isFocused&&(this.actionsView.focus(),t())}),{priority:"high"}),this.editor.keystrokes.set("Esc",((e,t)=>{this._isUIVisible&&(this._hideUI(),t())})),v({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideUI()})}_addActionsView(){this.actionsView||this._createViews(),this._areActionsInPanel||this._balloon.add({view:this.actionsView,position:this._getBalloonPositionData()})}_addFormView(){if(this.formView||this._createViews(),this._isFormInPanel)return;let e=this.editor.commands.get("link");this.formView.disableCssTransitions(),this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this.formView.urlInputView.fieldView.value=e.value||"",this._balloon.visibleView===this.formView&&this.formView.urlInputView.fieldView.select(),this.formView.enableCssTransitions()}_closeFormView(){let e=this.editor.commands.get("link");e.restoreManualDecoratorStates(),e.value!==void 0?this._removeFormView():this._hideUI()}_removeFormView(){this._isFormInPanel&&(this.formView.saveButtonView.focus(),this.formView.urlInputView.fieldView.reset(),this._balloon.remove(this.formView),this.editor.editing.view.focus(),this._hideFakeVisualSelection())}_showUI(e=!1){this.formView||this._createViews(),this._getSelectedLinkElement()?(this._areActionsVisible?this._addFormView():this._addActionsView(),e&&this._balloon.showStack("main")):(this._showFakeVisualSelection(),this._addActionsView(),e&&this._balloon.showStack("main"),this._addFormView()),this._startUpdatingUI()}_hideUI(){if(!this._isUIInPanel)return;let e=this.editor;this.stopListening(e.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),e.editing.view.focus(),this._removeFormView(),this._balloon.remove(this.actionsView),this._hideFakeVisualSelection()}_startUpdatingUI(){let e=this.editor,t=e.editing.view.document,o=this._getSelectedLinkElement(),i=s(),r=()=>{let a=this._getSelectedLinkElement(),l=s();o&&!a||!o&&l!==i?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),o=a,i=l};function s(){return t.selection.focus.getAncestors().reverse().find((a=>a.is("element")))}this.listenTo(e.ui,"update",r),this.listenTo(this._balloon,"change:visibleView",r)}get _isFormInPanel(){return!!this.formView&&this._balloon.hasView(this.formView)}get _areActionsInPanel(){return!!this.actionsView&&this._balloon.hasView(this.actionsView)}get _areActionsVisible(){return!!this.actionsView&&this._balloon.visibleView===this.actionsView}get _isUIInPanel(){return this._isFormInPanel||this._areActionsInPanel}get _isUIVisible(){let e=this._balloon.visibleView;return!!this.formView&&e==this.formView||this._areActionsVisible}_getBalloonPositionData(){let e=this.editor.editing.view,t=this.editor.model,o=e.document,i;if(t.markers.has(io)){let r=Array.from(this.editor.editing.mapper.markerNameToElements(io)),s=e.createRange(e.createPositionBefore(r[0]),e.createPositionAfter(r[r.length-1]));i=e.domConverter.viewRangeToDom(s)}else i=()=>{let r=this._getSelectedLinkElement();return r?e.domConverter.mapViewToDom(r):e.domConverter.viewRangeToDom(o.selection.getFirstRange())};return{target:i}}_getSelectedLinkElement(){let e=this.editor.editing.view,t=e.document.selection,o=t.getSelectedElement();if(t.isCollapsed||o&&He(o))return Xc(t.getFirstPosition());{let i=t.getFirstRange().getTrimmed(),r=Xc(i.start),s=Xc(i.end);return r&&r==s&&e.createRangeIn(r).getTrimmed().isEqual(i)?r:null}}_showFakeVisualSelection(){let e=this.editor.model;e.change((t=>{let o=e.document.selection.getFirstRange();if(e.markers.has(io))t.updateMarker(io,{range:o});else if(o.start.isAtEnd){let i=o.start.getLastMatchingPosition((({item:r})=>!e.schema.isContent(r)),{boundaries:o});t.addMarker(io,{usingOperation:!1,affectsData:!1,range:t.createRange(i,o.end)})}else t.addMarker(io,{usingOperation:!1,affectsData:!1,range:o})}))}_hideFakeVisualSelection(){let e=this.editor.model;e.markers.has(io)&&e.change((t=>{t.removeMarker(io)}))}}function Xc(n){return n.getAncestors().find((e=>{return(t=e).is("attributeElement")&&!!t.getCustomProperty("link");var t}))||null}let d0=new RegExp("(^|\\s)(((?:(?:(?:https?|ftp):)?\\/\\/)(?:\\S+(?::\\S*)?@)?(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(((?!www\\.)|(www\\.))(?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.)+(?:[a-z\\u00a1-\\uffff]{2,63})))(?::\\d{2,5})?(?:[/?#]\\S*)?)|((www.|(\\S+@))((?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.))+(?:[a-z\\u00a1-\\uffff]{2,63})))$","i");class u0 extends L{static get requires(){return[lo,a0]}static get pluginName(){return"AutoLink"}init(){let e=this.editor.model.document.selection;e.on("change:range",(()=>{this.isEnabled=!e.anchor.parent.is("element","codeBlock")})),this._enableTypingHandling()}afterInit(){this._enableEnterHandling(),this._enableShiftEnterHandling(),this._enablePasteLinking()}_expandLinkRange(e,t){return t.textNode&&t.textNode.hasAttribute("linkHref")?_s(t,"linkHref",t.textNode.getAttribute("linkHref"),e):null}_selectEntireLinks(e,t){let o=this.editor.model,i=o.document.selection,r=i.getFirstPosition(),s=i.getLastPosition(),a=t.getJoined(this._expandLinkRange(o,r)||t);a&&(a=a.getJoined(this._expandLinkRange(o,s)||t)),a&&(a.start.isBefore(r)||a.end.isAfter(s))&&e.setSelection(a)}_enablePasteLinking(){let e=this.editor,t=e.model,o=t.document.selection,i=e.plugins.get("ClipboardPipeline"),r=e.commands.get("link");i.on("inputTransformation",((s,a)=>{if(!this.isEnabled||!r.isEnabled||o.isCollapsed||a.method!=="paste"||o.rangeCount>1)return;let l=o.getFirstRange(),c=a.dataTransfer.getData("text/plain");if(!c)return;let d=c.match(d0);d&&d[2]===c&&(t.change((u=>{this._selectEntireLinks(u,l),r.execute(c)})),s.stop())}),{priority:"high"})}_enableTypingHandling(){let e=this.editor,t=new ac(e.model,(o=>{if(!(function(r){return r.length>4&&r[r.length-1]===" "&&r[r.length-2]!==" "})(o))return;let i=h0(o.substr(0,o.length-1));return i?{url:i}:void 0}));t.on("matched:data",((o,i)=>{let{batch:r,range:s,url:a}=i;if(!r.isTyping)return;let l=s.end.getShiftedBy(-1),c=l.getShiftedBy(-a.length),d=e.model.createRange(c,l);this._applyAutoLink(a,d)})),t.bind("isEnabled").to(this)}_enableEnterHandling(){let e=this.editor,t=e.model,o=e.commands.get("enter");o&&o.on("execute",(()=>{let i=t.document.selection.getFirstPosition();if(!i.parent.previousSibling)return;let r=t.createRangeIn(i.parent.previousSibling);this._checkAndApplyAutoLinkOnRange(r)}))}_enableShiftEnterHandling(){let e=this.editor,t=e.model,o=e.commands.get("shiftEnter");o&&o.on("execute",(()=>{let i=t.document.selection.getFirstPosition(),r=t.createRange(t.createPositionAt(i.parent,0),i.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(r)}))}_checkAndApplyAutoLinkOnRange(e){let t=this.editor.model,{text:o,range:i}=Up(e,t),r=h0(o);if(r){let s=t.createRange(i.end.getShiftedBy(-r.length),i.end);this._applyAutoLink(r,s)}}_applyAutoLink(e,t){let o=this.editor.model,i=Jc(e,this.editor.config.get("link.defaultProtocol"));this.isEnabled&&(function(r,s){return s.schema.checkAttributeInSelection(s.createSelection(r),"linkHref")})(t,o)&&o0(i)&&!(function(r){let s=r.start.nodeAfter;return!!s&&s.hasAttribute("linkHref")})(t)&&this._persistAutoLink(i,t)}_persistAutoLink(e,t){let o=this.editor.model,i=this.editor.plugins.get("Delete");o.enqueueChange((r=>{r.setAttribute("linkHref",e,t),o.enqueueChange((()=>{i.requestUndoOnBackspace()}))}))}}function h0(n){let e=d0.exec(n);return e?e[2]:null}class m0 extends L{static get requires(){return[a0,tB,u0]}static get pluginName(){return"Link"}}var g0=z(3858),oB={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(g0.Z,oB),g0.Z.locals;var p0=z(1066),iB={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(p0.Z,iB),p0.Z.locals;class nB extends re{constructor(e){super(e),this.props=this.editor.config.get("FieldExpression"),this.props&&(this.data=this.props.data,this.placeholderText=this.props.placeholderText??"Search fields",this.heading=this.props.heading??"Select field",this.groupFieldsAndExpressions=this.props.groupFieldsAndExpressions??!1,this.customExpressionCheck=this.props.customExpressionCheck,this.fieldsGroupHeading=this.props.fieldsGroupHeading??"Fields",this.expressionsGroupHeading=this.props.expressionsGroupHeading??"Expressions",this.layer=this.props.layer??null,this.mapView=this.props.mapView??null)}_cleanUp=(e,t,o,i)=>{document.body.contains(e)&&(document.body.removeChild(e),document.removeEventListener("click",o),t(!1),i.element.classList.remove("ck-on"),i.element.classList.add("ck-off"),i.element.blur())};_generatePickList=(e,t,o)=>{let i=this.editor.locale.uiLanguage,r=document.createElement("arcgis-field-pick-list");r.selectedFields=[],r.fields=this.data,r.popoverProps={refElement:o.element,popoverWidth:325,placement:"bottom-start",offsetDistance:5,triggerDisabled:!1},r.dir=i==="ar"||i==="he"?"rtl":"ltr",r.layer=this.layer,r.mapView=this.mapView,r.showFieldInfo=!(!this.layer||!this.mapView),r.showFieldName=!0,r.showDescription=!0,r.showSelectionAll=!0,r.showCancel=!0,r.showSort=!0,r.filterPlaceholderText=this.placeholderText,r.showFilterLength=5,r.multiple=!1,r.heading=this.heading,r.groupFieldsAndExpressions=this.groupFieldsAndExpressions,r.fieldsGroupHeading=this.fieldsGroupHeading,r.expressionsGroupHeading=this.expressionsGroupHeading,r.customExpressionCheck=this.customExpressionCheck;let s=a=>{let l=a.length>1?`{${a.join(", ")}}`:`{${a[0]}}`;this.editor.model.change((c=>{this.editor.execute("mention",{marker:"{",mention:l})}))};return r.addEventListener("arcgisClose",(a=>{if(!a.detail)return void this._cleanUp(r,t,e,o);let l=a.detail.selectedFields.length>0,c=a.detail.selectedFields;r.multiple&&l&&s(c),this._cleanUp(r,t,e,o)})),r.addEventListener("arcgisChange",(a=>{let l=a.detail.selectedFields;!r.multiple&&s(l)})),r};execute(e,t,o){let i;if(!this.props||!this.props.data||!this.props.data.length)return;let r=s=>{let a=document.getElementsByClassName("FieldExpressionButton")[0].contains(s.target),l=s.target!==i;(a||l)&&this._cleanUp(i,t,r,o)};i=this._generatePickList(r,t,o),e?(document.removeEventListener("click",r),t(!1)):(document.body.appendChild(i),setTimeout((()=>document.addEventListener("click",r)),0),t(!0))}}class rB extends L{static get pluginName(){return"FieldExpressionEditing"}constructor(e){super(e),this.editor.commands.add("toggleFieldPickList",new nB(this.editor))}}class sB extends L{static get pluginName(){return"FieldExpressionUI"}constructor(e){super(e),this.props=this.editor.config.get("FieldExpression"),this.props&&(this.label="Field Expression Pick List",this.props&&this.props.label&&(this.label=this.props.label),this.visible=!1,this.visibleHandler=t=>this.visible=t)}init(){let e=this.editor;e.ui.componentFactory.add("arcgis-field-expression",(t=>{if(!this.props||!this.props.data||!this.props.data.length)return;let o=new On(t);o.set({label:this.label,tooltip:!0,withText:!1,icon:`<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">\r
|
|
8075
8075
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M10.6634 4.5L10.664 4.5L12 4.5H12.5V5V6V6.5H12H10.6643C8.91763 6.50202 7.50213 7.91745 7.5 9.66413C7.5 9.66427 7.5 9.66441 7.5 9.66455L7.5 13.25V13.2502C7.49945 14.5157 6.93651 15.7008 5.98792 16.5C6.93651 17.2992 7.49945 18.4843 7.5 19.7498V19.75L7.5 23.3355C7.5 23.3356 7.5 23.3357 7.5 23.3359C7.50213 25.0826 8.91774 26.4981 10.6645 26.5H12H12.5V27V28V28.5H12H10.664H10.6634C7.81323 28.4963 5.50366 26.1868 5.5 23.3366L5.5 23.336L5.5 19.7505C5.5 19.7505 5.5 19.7504 5.5 19.7503C5.49853 18.508 4.49177 17.5014 3.24946 17.5H3H2.5V17V16V15.5H3H3.24946C4.49177 15.4986 5.49853 14.492 5.5 13.2497C5.5 13.2496 5.5 13.2495 5.5 13.2495L5.5 9.664L5.5 9.66336C5.50366 6.81323 7.81323 4.50366 10.6634 4.5ZM3.5 16.5097C4.60025 16.5943 5.54717 17.2263 6.06899 18.1337C5.78745 17.6429 5.37799 17.2255 4.87053 16.9333L4.11786 16.5L4.87053 16.0667C5.37799 15.7745 5.78745 15.3571 6.06899 14.8663C5.54717 15.7737 4.60025 16.4057 3.5 16.4903V16.5097ZM6.5 19.7495C6.5 19.7493 6.5 19.7492 6.5 19.749ZM20.5 4.5H21H22.336H22.3366C25.1868 4.50366 27.4963 6.81323 27.5 9.66336L27.5 9.664L27.5 13.2495C27.5 13.2496 27.5 13.2497 27.5 13.2499C27.5016 14.4921 28.5083 15.4986 29.7505 15.5H30H30.5V16V17V17.5H30H29.7505C28.5083 17.5014 27.5016 18.5079 27.5 19.7501C27.5 19.7503 27.5 19.7504 27.5 19.7505L27.5 23.336L27.5 23.3366C27.4963 26.1868 25.1868 28.4963 22.3366 28.5H22.336H21H20.5V28V27V26.5H21H22.3355C24.0823 26.4981 25.4979 25.0826 25.5 23.3359C25.5 23.3357 25.5 23.3356 25.5 23.3355L25.5 19.75V19.7498C25.5006 18.4843 26.0635 17.2992 27.0121 16.5C26.0635 15.7008 25.5006 14.5157 25.5 13.2502V13.25L25.5 9.66455C25.5 9.66441 25.5 9.66427 25.5 9.66413C25.4979 7.91745 24.0824 6.50202 22.3357 6.5H21H20.5V6V5V4.5ZM29.5 16.4903V16.5097C28.3997 16.5943 27.4528 17.2263 26.931 18.1337C27.2126 17.6429 27.622 17.2255 28.1295 16.9333L28.8821 16.5L28.1295 16.0667C27.622 15.7745 27.2126 15.3571 26.931 14.8663C27.4528 15.7737 28.3997 16.4057 29.5 16.4903ZM26.5 13.2505C26.5001 13.3138 26.5019 13.3767 26.5056 13.4391C26.5019 13.3765 26.5 13.3137 26.5 13.2505ZM26.5 19.7495C26.5 19.6863 26.5019 19.6235 26.5056 19.5609C26.5019 19.6233 26.5001 19.6862 26.5 19.7495Z" fill="black"/>\r
|
|
8076
8076
|
</svg>\r
|
|
8077
8077
|
`,class:"FieldExpressionButton"}),setTimeout((()=>{o.element.style.marginRight=0,o.element.children[2].style.width="20px",o.element.children[2].style.height="10px"}),0);let i=e.commands.get("toggleFieldPickList");return o.bind("isOn","isEnabled").to(i,"value","isEnabled"),this.listenTo(o,"change:isEnabled",(()=>{o.element.children[2].style.opacity=o.isEnabled?1:.5})),this.listenTo(o,"execute",(()=>{e.execute("toggleFieldPickList",this.visible,this.visibleHandler,o),o.element.classList.remove("ck-off"),o.element.classList.add("ck-on")})),o}))}}class f0 extends L{static get pluginName(){return"FieldExpression"}static get requires(){return[rB,sB]}}let k0=`<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">\r
|
|
@@ -8080,7 +8080,7 @@ $&
|
|
|
8080
8080
|
`;class aB extends L{static get pluginName(){return"ArcgisColorPickerUI"}constructor(e){super(e),this.props=this.editor.config.get("ArcgisColorPicker"),this.label="Font Color",this.props&&this.props.label&&(this.label=this.props.label),this.visible=!1,this.visibleHandler=t=>this.visible=t}init(){let e=this.editor;e.ui.componentFactory.add("arcgis-color-picker",(t=>{let o=new On(t);o.set({label:this.label,tooltip:!0,withText:!1,icon:k0,class:"ColorPickerButton"}),setTimeout((()=>{o.element.children[2].style.width="20px",o.element.children[2].style.height="10px"}),0);let i=e.commands.get("toggleArcgisColorPicker");o.bind("isOn","isEnabled").to(i,"value","isEnabled"),this.listenTo(o,"change:isEnabled",(()=>{o.element.children[2].style.opacity=o.isEnabled?1:.5}));let r=()=>{let s=e.model.document.selection,a=s.getAttribute("colorPicker"),l=s.getAttribute("fontColor"),c=a??l,d=!!c&&c[0]==="{";return o.set({icon:d?`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\r
|
|
8081
8081
|
<path d="M16.173 14.976H17.266L12.458 4.024H11.542L6.734 14.976H7.827L9.133 12H14.867L16.173 14.976ZM9.572 11L12 5.47L14.428 11H9.572ZM7 22H5.703C4.72123 21.9989 3.77997 21.6085 3.08575 20.9142C2.39154 20.22 2.00106 19.2788 2 18.297V15C2 13.897 1.103 13 0 13V12C1.103 12 2 11.103 2 10V6.703C2.00106 5.72123 2.39154 4.77997 3.08575 4.08575C3.77997 3.39154 4.72123 3.00106 5.703 3H7V4H5.703C4.98644 4.00106 4.29954 4.28618 3.79286 4.79286C3.28618 5.29954 3.00106 5.98644 3 6.703V10C2.99975 10.4953 2.87688 10.9828 2.64236 11.419C2.40785 11.8552 2.06898 12.2266 1.656 12.5C2.06898 12.7734 2.40785 13.1448 2.64236 13.581C2.87688 14.0172 2.99975 14.5047 3 15V18.297C3.00106 19.0136 3.28618 19.7005 3.79286 20.2071C4.29954 20.7138 4.98644 20.9989 5.703 21H7V22ZM18.297 22H17V21H18.297C19.0136 20.9989 19.7005 20.7138 20.2071 20.2071C20.7138 19.7005 20.9989 19.0136 21 18.297V15C21.0003 14.5047 21.1231 14.0172 21.3576 13.581C21.5922 13.1448 21.931 12.7734 22.344 12.5C21.931 12.2266 21.5922 11.8552 21.3576 11.419C21.1231 10.9828 21.0003 10.4953 21 10V6.703C20.9989 5.98644 20.7138 5.29954 20.2071 4.79286C19.7005 4.28618 19.0136 4.00106 18.297 4H17V3H18.297C19.2788 3.00106 20.22 3.39154 20.9142 4.08575C21.6085 4.77997 21.9989 5.72123 22 6.703V10C22 11.103 22.897 12 24 12V13C22.897 13 22 13.897 22 15V18.297C21.9989 19.2788 21.6085 20.22 20.9142 20.9142C20.22 21.6085 19.2788 21.9989 18.297 22ZM17 19H7V16H17V19Z" fill="#151515"/>\r
|
|
8082
8082
|
</svg>\r
|
|
8083
|
-
`:k0}),c};return e.editing.view.document.on("click",r),this.listenTo(o,"execute",(()=>{let s=r();e.execute("toggleArcgisColorPicker",this.visible,this.visibleHandler,s,o.element),o.element.setAttribute("data-cke-tooltip-disabled",!0),o.element.classList.remove("ck-off"),o.element.classList.add("ck-on");let a=document.querySelector(".ck.ck-balloon-panel.ck-balloon-panel_arrow_s.ck-balloon-panel_visible.ck-balloon-panel_with-arrow.ck-toolbar-container");a&&a.classList.remove("ck-balloon-panel_visible")})),o}))}}class lB extends re{constructor(e){super(e),this.props=this.editor.config.get("ArcgisColorPicker"),this.props&&(this.data=this.props.data,this.filterPlaceholder=this.props.filterPlaceholder??"Search attributes",this.enableFields=this.props.enableFields??!1,this.doneText=this.props.doneText??"Done",this.customText=this.props.customText??"Static",this.attributeText=this.props.attributeText??"Data-driven",this.storageId=this.props.storageId||"arcgis-symbol-styler-storage-colors",this._initColorPicker(),this._loadUI(),this.prevColor=null)}_initColorPicker=()=>{this.colorPicker=document.createElement("calcite-color-picker"),this.colorPicker.storageId=this.storageId,this.colorPicker.addEventListener("calciteColorPickerInput",(e=>{let t=e.target.value,o=this.editor.model.document.selection;this.editor.model.change((i=>{let r=this.editor.model.schema.getValidRanges(o.getRanges(),Do);for(let s of r)i.setAttribute(Do,t,s)}))}))};_loadUI=()=>{this.popover=document.createElement("calcite-popover"),this.divContainer=document.createElement("div"),this.panel=document.createElement("calcite-panel"),this.tabs=document.createElement("calcite-tabs"),this.tabNav=document.createElement("calcite-tab-nav"),this.customTab=document.createElement("calcite-tab"),this.customTabTitle=document.createElement("calcite-tab-title"),this.doneButton=document.createElement("calcite-button"),this.popover.placement="bottom-start",this.popover.offsetDistance=5,this.popover.focusTrapDisabled=!0,this.popover.pointerDisabled=!0,this.popover.style="--calcite-popover-z-index: 101",this.popover.autoClose=!0,this.popover.appendChild(this.divContainer),this.divContainer.appendChild(this.panel),this.panel.appendChild(this.tabs),this.panel.appendChild(this.doneButton),this.tabNav.appendChild(this.customTabTitle),this.tabs.appendChild(this.customTab),this.customTab.appendChild(this.colorPicker),this.enableFields&&(this.attributeTab=document.createElement("calcite-tab"),this.attributeTabTitle=document.createElement("calcite-tab-title"),this.attributeList=document.createElement("calcite-list"),this.tabs.appendChild(this.tabNav),this.tabs.appendChild(this.attributeTab),this.tabNav.appendChild(this.attributeTabTitle),this.attributeTab.appendChild(this.attributeList),this.attributeTabTitle.innerText=this.attributeText,this.attributeList.selectionMode="single",this.attributeList.filterEnabled=!0,this.attributeList.filterPlaceholder=this.filterPlaceholder,this.attributeTab.style.width="294px",this.attributeList.style.maxHeight="300px",this.tabs.bordered=!0,this.tabs.layout="center",this.tabNav.slot="title-group",this.data&&this.data.forEach((e=>{let{name:t,alias:o,description:i}=e,r=document.createElement("calcite-list-item");r.label=o,r.style.textAlign="start",r.description=`{${t}}`,r.id=`{${t}}`,r.value=o,r.style.whiteSpace="normal",r.addEventListener("calciteListItemSelect",(()=>{let s=this.editor.model.document.selection;this.editor.model.change((a=>{let l=this.editor.model.schema.getValidRanges(s.getRanges(),Do);for(let c of l)a.setAttribute(Do,`{${t}}`,c)}))})),this.attributeList.appendChild(r)}))),this.customTabTitle.innerText=this.customText,this.doneButton.innerText=this.doneText,this.doneButton.slot="footer",this.doneButton.appearance="outline-fill",this.customTab.selected=!0,this.colorPicker.channelsDisabled=!0,this.colorPicker.savedDisabled=!1,this.colorPicker.allowEmpty=!0,this.colorPicker.value=null,this.editor.locale.uiLanguage,this.divContainer.style.width="294px",this.colorPicker.style.width="100%",this.colorPicker.style.boxSizing="border-box",this.colorPicker.style.padding="0.5rem",this.customTab.style.width="294px",this.doneButton.style.width="100%",this.doneButton.addEventListener("click",(()=>{this.popover.open=!1}))};deselectListItems=()=>{let e=this.attributeList.querySelector("[selected]");e&&(e.selected=!1)};setPickerView=e=>{if(!this.enableFields)return void(this.customTabTitle.selected=!0);let t=e&&e[0]==="{";this.attributeTab.selected=this.attributeTabTitle.selected=t,this.customTab.selected=this.customTabTitle.selected=!t};setColorState=e=>{if(e){let t=e[0];if(t==="#")this.colorPicker.value=e,this.enableFields&&this.deselectListItems();else if(t==="{"){let o=CSS.escape(e);this.attributeList.querySelector(`#${o}`).selected=!0,this.colorPicker.value=null}}else this.colorPicker.value=null,this.enableFields&&this.deselectListItems()};execute(e,t,o,i){this.editor.model.document.selection,this.addedPopver||(this.popover.referenceElement=i,this.popover.addEventListener("calcitePopoverClose",(()=>{i.classList.remove("ck-on"),i.classList.add("ck-off"),t(!1)})),document.body.appendChild(this.popover),this.addedPopver=!0),e||(this.setPickerView(o),this.setColorState(o),window.setTimeout((()=>{this.popover.setFocus()}),100)),t(!e)}}let Do="colorPicker";class cB extends L{static get pluginName(){return"ArcgisColorPickerEditing"}constructor(e){super(e),e.model.schema.extend("$text",{allowAttributes:Do}),e.model.schema.setAttributeProperties(Do,{isFormatting:!0,copyOnEnter:!0}),e.conversion.for("downcast").attributeToElement({model:Do,view:(t,{writer:o})=>o.createAttributeElement("span",{style:`color:${t}`})}),e.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{color:/[\s\S]+/}},model:{key:Do,value:t=>t.getStyle("color").replace(/\s/g,"")}}),this.editor.commands.add("toggleArcgisColorPicker",new lB(this.editor))}}class dB extends re{constructor(e){super(e)}execute(){let e=t=>{let o=document.getElementsByClassName("ck ck-form__row ck-table-form__dimensions-row");o.length&&o[0].parentElement.remove();let i=document.getElementsByClassName("ck ck-toolbar ck-toolbar_compact");i.length>1&&i[1].remove();let r=this.editor.editing.view.getDomRoot(),s=r.querySelector(".ck.ck-widget__type-around__button.ck-widget__type-around__button_before"),a=r.querySelector(".ck.ck-widget__type-around__button.ck-widget__type-around__button_after"),l=this.editor.locale.uiLanguage;l!=="he"&&l!=="ar"||(s&&(s.style.transform="translateY(-50%) scaleX(-1)"),a&&(a.style.transform="translateY(50%) scaleX(-1)"))};document.body.addEventListener("click",e),this.editor.on("destroy",(()=>{document.body.removeEventListener("click",e)}))}}class uB extends L{static get pluginName(){return"TableModsEditing"}init(){this.editor.commands.add("TableModsCommand",new dB(this.editor))}}class hB extends L{static get pluginName(){return"TableModsUI"}constructor(e){super(e)}init(){setTimeout((()=>this.editor.execute("TableModsCommand")),0)}}class ur extends Dp{}ur.builtinPlugins=[class extends L{static get requires(){return[Z2,K2]}static get pluginName(){return"Alignment"}},class extends L{static get requires(){return[lE,dE]}static get pluginName(){return"BlockQuote"}},Qw,class extends ol{constructor(){super(...arguments),this.token=null,this._tokens=new Map}static get pluginName(){return"CloudServices"}static get requires(){return[gE]}async init(){let n=this.context.config.get("cloudServices")||{};for(let[t,o]of Object.entries(n))this[t]=o;if(!this.tokenUrl)return void(this.token=null);let e=this.context.plugins.get("CloudServicesCore");this.token=await e.createToken(this.tokenUrl).init(),this._tokens.set(this.tokenUrl,this.token)}async registerTokenUrl(n){if(this._tokens.has(n))return this.getTokenFor(n);let e=this.context.plugins.get("CloudServicesCore"),t=await e.createToken(n).init();return this._tokens.set(n,t),t}getTokenFor(n){let e=this._tokens.get(n);if(!e)throw new y("cloudservices-token-not-registered",this);return e}destroy(){super.destroy();for(let n of this._tokens.values())n.destroy()}},Sf,class extends L{static get requires(){return[d5,u5]}static get pluginName(){return"FontBackgroundColor"}},class extends L{static get requires(){return[m5,g5]}static get pluginName(){return"FontColor"}},class extends L{static get requires(){return[b5,w5]}static get pluginName(){return"FontFamily"}},class extends L{static get requires(){return[A5,v5]}static get pluginName(){return"FontSize"}normalizeSizeOptions(n){return gc(n)}},qf,class extends L{static get requires(){return[$5,W5]}static get pluginName(){return"Image"}},class extends L{static get requires(){return[Z5,K5]}static get pluginName(){return"ImageCaption"}},class extends L{static get pluginName(){return"ImageInsertViaUrlUI"}static get requires(){return[bc]}afterInit(){this._imageInsertUI=this.editor.plugins.get("ImageInsertUI"),this._imageInsertUI.registerIntegration({name:"url",observable:()=>this.editor.commands.get("insertImage"),requiresForm:!0,buttonViewCreator:n=>this._createInsertUrlButton(n),formViewCreator:n=>this._createInsertUrlView(n)})}_createInsertUrlView(n){let e=this.editor,t=e.locale,o=t.t,i=e.commands.get("replaceImageSource"),r=e.commands.get("insertImage"),s=new xI(t),a=n?null:new Xm(t,[s]);return s.bind("isImageSelected").to(this._imageInsertUI),s.bind("isEnabled").toMany([r,i],"isEnabled",((...l)=>l.some((c=>c)))),s.imageURLInputValue=i.value||"",this._imageInsertUI.dropdownView.on("change:isOpen",(()=>{this._imageInsertUI.dropdownView.isOpen&&(s.imageURLInputValue=i.value||"",a&&(a.isCollapsed=!0))}),{priority:"low"}),s.on("submit",(()=>{i.isEnabled?e.execute("replaceImageSource",{source:s.imageURLInputValue}):e.execute("insertImage",{source:s.imageURLInputValue}),this._closePanel()})),s.on("cancel",(()=>this._closePanel())),a?(a.set({isCollapsed:!0}),a.bind("label").to(this._imageInsertUI,"isImageSelected",(l=>o(l?"Update image URL":"Insert image via URL"))),a):s}_createInsertUrlButton(n){let e=n?On:ne,t=this.editor,o=new e(t.locale),i=t.locale.t;return o.set({icon:Y.imageUrl,tooltip:!0}),o.bind("label").to(this._imageInsertUI,"isImageSelected",(r=>i(r?"Update image URL":"Insert image via URL"))),o}_closePanel(){this.editor.editing.view.focus(),this._imageInsertUI.dropdownView.isOpen=!1}},class extends L{static get requires(){return[Zw,vI,CI]}static get pluginName(){return"ImageResize"}},class extends L{static get requires(){return[bk,eD]}static get pluginName(){return"ImageStyle"}},class extends L{static get requires(){return[vs,gt]}static get pluginName(){return"ImageToolbar"}afterInit(){let n=this.editor,e=n.t,t=n.plugins.get(vs),o=n.plugins.get("ImageUtils");var i;t.register("image",{ariaLabel:e("Image toolbar"),items:(i=n.config.get("image.toolbar")||[],i.map((r=>xe(r)?r.name:r))),getRelatedElement:r=>o.getClosestSelectedImageWidget(r)})}},class extends L{static get pluginName(){return"Indent"}static get requires(){return[nD,rD]}},class extends L{constructor(n){super(n),n.config.define("indentBlock",{offset:40,unit:"px"})}static get pluginName(){return"IndentBlock"}init(){let n=this.editor,e=n.config.get("indentBlock");e.classes&&e.classes.length?(this._setupConversionUsingClasses(e.classes),n.commands.add("indentBlock",new Ms(n,new Dk({direction:"forward",classes:e.classes}))),n.commands.add("outdentBlock",new Ms(n,new Dk({direction:"backward",classes:e.classes})))):(n.data.addStyleProcessorRules(A1),this._setupConversionUsingOffset(),n.commands.add("indentBlock",new Ms(n,new Ek({direction:"forward",offset:e.offset,unit:e.unit}))),n.commands.add("outdentBlock",new Ms(n,new Ek({direction:"backward",offset:e.offset,unit:e.unit}))))}afterInit(){let n=this.editor,e=n.model.schema,t=n.commands.get("indent"),o=n.commands.get("outdent"),i=n.config.get("heading.options");(i&&i.map((r=>r.model))||sD).forEach((r=>{e.isRegistered(r)&&e.extend(r,{allowAttributes:"blockIndent"})})),e.setAttributeProperties("blockIndent",{isFormatting:!0}),t.registerChildCommand(n.commands.get("indentBlock")),o.registerChildCommand(n.commands.get("outdentBlock"))}_setupConversionUsingOffset(){let n=this.editor.conversion,e=this.editor.locale.contentLanguageDirection==="rtl"?"margin-right":"margin-left";n.for("upcast").attributeToAttribute({view:{styles:{[e]:/[\s\S]+/}},model:{key:"blockIndent",value:t=>{if(!t.is("element","li"))return t.getStyle(e)}}}),n.for("downcast").attributeToAttribute({model:"blockIndent",view:t=>({key:"style",value:{[e]:t}})})}_setupConversionUsingClasses(n){let e={model:{key:"blockIndent",values:[]},view:{}};for(let t of n)e.model.values.push(t),e.view[t]={key:"class",value:[t]};this.editor.conversion.attributeToAttribute(e)}},Xw,m0,Gk,class extends L{static get requires(){return[Os,yD,AD,Qo]}static get pluginName(){return"MediaEmbed"}},db,jf,class extends L{static get pluginName(){return"PasteFromOffice"}static get requires(){return[Lt]}init(){let n=this.editor,e=n.plugins.get("ClipboardPipeline"),t=n.editing.view.document,o=[],i=this.editor.plugins.has("MultiLevelList");o.push(new eT(t,i)),o.push(new oT(t)),o.push(new nT(t)),e.on("inputTransformation",((r,s)=>{if(s._isTransformedWithPasteFromOffice||n.model.document.selection.getFirstPosition().parent.is("element","codeBlock"))return;let a=s.dataTransfer.getData("text/html"),l=o.find((c=>c.isActive(a)));l&&(s._parsedData||(s._parsedData=rT(a,t.stylesProcessor)),l.execute(s),s._isTransformedWithPasteFromOffice=!0)}),{priority:"high"})}},class extends L{static get requires(){return[lT,sT]}static get pluginName(){return"RemoveFormat"}},fb,class extends L{static get requires(){return[LI,zI]}static get pluginName(){return"Subscript"}},class extends L{static get requires(){return[OI,RI]}static get pluginName(){return"Superscript"}},Wb,class extends L{static get requires(){return[vs]}static get pluginName(){return"TableToolbar"}afterInit(){let n=this.editor,e=n.t,t=n.plugins.get(vs),o=n.config.get("table.contentToolbar"),i=n.config.get("table.tableToolbar");o&&t.register("tableContent",{ariaLabel:e("Table toolbar"),items:o,getRelatedElement:qs}),i&&t.register("table",{ariaLabel:e("Table toolbar"),items:i,getRelatedElement:Zb})}},class extends L{static get requires(){return["Delete","Input"]}static get pluginName(){return"TextTransformation"}constructor(n){super(n),n.config.define("typing",{transformations:{include:iE}})}init(){let n=this.editor.model.document.selection;n.on("change:range",(()=>{this.isEnabled=!n.anchor.parent.is("element","codeBlock")})),this._enableTransformationWatchers()}_enableTransformationWatchers(){let n=this.editor,e=n.model,t=n.plugins.get("Delete"),o=(function(r){let s=r.extra||[],a=r.remove||[],l=c=>!a.includes(c);return(function(c){let d=new Set;for(let u of c)if(typeof u=="string"&&Wp[u])for(let h of Wp[u])d.add(h);else d.add(u);return Array.from(d)})(r.include.concat(s).filter(l)).filter(l).map((c=>typeof c=="string"&&qp[c]?qp[c]:c)).filter((c=>typeof c=="object")).map((c=>({from:nE(c.from),to:rE(c.to)})))})(n.config.get("typing.transformations")),i=new ac(n.model,(r=>{for(let s of o)if(s.from.test(r))return{normalizedTransformation:s}}));i.on("matched:data",((r,s)=>{if(!s.batch.isTyping)return;let{from:a,to:l}=s.normalizedTransformation,c=a.exec(s.text),d=l(c.slice(1)),u=s.range,h=c.index;e.enqueueChange((m=>{for(let g=1;g<c.length;g++){let b=c[g],w=d[g-1];if(w==null){h+=b.length;continue}let A=u.start.getShiftedBy(h),S=e.createRange(A,A.getShiftedBy(b.length)),M=sE(A);e.insertContent(m.createText(w,M),S),h+=w.length}e.enqueueChange((()=>{t.requestUndoOnBackspace()}))}))})),i.bind("isEnabled").to(this)}},class extends L{static get requires(){return[FI,VI]}static get pluginName(){return"Underline"}},class extends L{static get pluginName(){return"TableProperties"}static get requires(){return[eS,cS]}},class extends L{static get pluginName(){return"TableCellProperties"}static get requires(){return[vS,hS]}},class extends L{static get requires(){return[ES,DS,Qo]}static get pluginName(){return"HorizontalLine"}},class extends L{static get pluginName(){return"GeneralHtmlSupport"}static get requires(){return[Ue,uI,hI,mI,gI,pI,fI,kI,bI,wI,_I]}init(){let n=this.editor,e=n.plugins.get(Ue);e.loadAllowedEmptyElementsConfig(n.config.get("htmlSupport.allowEmpty")||[]),e.loadAllowedConfig(n.config.get("htmlSupport.allow")||[]),e.loadDisallowedConfig(n.config.get("htmlSupport.disallow")||[])}getGhsAttributeNameForElement(n){let e=this.editor.plugins.get("DataSchema"),t=Array.from(e.getDefinitionsForView(n,!1)),o=t.find((i=>i.isInline&&!t[0].isObject));return o?o.model:Ot(n)}addModelHtmlClass(n,e,t){let o=this.editor.model,i=this.getGhsAttributeNameForElement(n);o.change((r=>{for(let s of Ki(o,t,i))Gi(r,s,i,"classes",(a=>{for(let l of ke(e))a.add(l)}))}))}removeModelHtmlClass(n,e,t){let o=this.editor.model,i=this.getGhsAttributeNameForElement(n);o.change((r=>{for(let s of Ki(o,t,i))Gi(r,s,i,"classes",(a=>{for(let l of ke(e))a.delete(l)}))}))}setModelHtmlAttributes(n,e,t){let o=this.editor.model,i=this.getGhsAttributeNameForElement(n);o.change((r=>{for(let s of Ki(o,t,i))Gi(r,s,i,"attributes",(a=>{for(let[l,c]of Object.entries(e))a.set(l,c)}))}))}removeModelHtmlAttributes(n,e,t){let o=this.editor.model,i=this.getGhsAttributeNameForElement(n);o.change((r=>{for(let s of Ki(o,t,i))Gi(r,s,i,"attributes",(a=>{for(let l of ke(e))a.delete(l)}))}))}setModelHtmlStyles(n,e,t){let o=this.editor.model,i=this.getGhsAttributeNameForElement(n);o.change((r=>{for(let s of Ki(o,t,i))Gi(r,s,i,"styles",(a=>{for(let[l,c]of Object.entries(e))a.set(l,c)}))}))}removeModelHtmlStyles(n,e,t){let o=this.editor.model,i=this.getGhsAttributeNameForElement(n);o.change((r=>{for(let s of Ki(o,t,i))Gi(r,s,i,"styles",(a=>{for(let l of ke(e))a.delete(l)}))}))}}],ur.builtinPlugins=[...ur.builtinPlugins,f0,class extends L{static get pluginName(){return"ArcgisColorPicker"}static get requires(){return[aB,cB]}},class extends L{static get pluginName(){return"TableMods"}static get requires(){return[uB,hB]}}];var b0={columns:10,documentColors:0,colors:[{color:"#ffffff",label:" "},{color:"#fff5ee",label:" "},{color:"#fff8dc",label:" "},{color:"#fffacd",label:" "},{color:"#ffffe0",label:" "},{color:"#98fb98",label:" "},{color:"#afeeee",label:" "},{color:"#e0ffff",label:" "},{color:"#e6e6fa",label:" "},{color:"#dda0dd",label:" "},{color:"#d3d3d3",label:" "},{color:"#ffc0cb",label:" "},{color:"#ffe4c4",label:" "},{color:"#ffe4b5",label:" "},{color:"#f0e68c",label:" "},{color:"#90ee90",label:" "},{color:"#20b2aa",label:" "},{color:"#87cefa",label:" "},{color:"#6495ed",label:" "},{color:"#ee82ee",label:" "},{color:"#c0c0c0",label:" "},{color:"#f08080",label:" "},{color:"#f4a460",label:" "},{color:"#ffa500",label:" "},{color:"#eee8aa",label:" "},{color:"#7fff00",label:" "},{color:"#48d1cc",label:" "},{color:"#87ceeb",label:" "},{color:"#7b68ee",label:" "},{color:"#da70d6",label:" "},{color:"#808080",label:" "},{color:"#ff0000",label:" "},{color:"#ff4500",label:" "},{color:"#ff8c00",label:" "},{color:"#ffff00",label:" "},{color:"#32cd32",label:" "},{color:"#8fbc8f",label:" "},{color:"#4169e1",label:" "},{color:"#6a5acd",label:" "},{color:"#ba55d3",label:" "},{color:"#696969",label:" "},{color:"#dc143c",label:" "},{color:"#d2691e",label:" "},{color:"#ff7f50",label:" "},{color:"#ffd700",label:" "},{color:"#228b22",label:" "},{color:"#2e8b57",label:" "},{color:"#0000ff",label:" "},{color:"#8a2be2",label:" "},{color:"#9932cc",label:" "},{color:"#2f4f4f",label:" "},{color:"#b22222",label:" "},{color:"#8b4513",label:" "},{color:"#a0522d",label:" "},{color:"#808000",label:" "},{color:"#008000",label:" "},{color:"#008b8b",label:" "},{color:"#0000cd",label:" "},{color:"#483d8b",label:" "},{color:"#8b008b",label:" "},{color:"#000000",label:" "},{color:"#8b0000",label:" "},{color:"#800000",label:" "},{color:"#a52a2a",label:" "},{color:"#556b2f",label:" "},{color:"#006400",label:" "},{color:"#191970",label:" "},{color:"#000080",label:" "},{color:"#4b0082",label:" "},{color:"#800080",label:" "}]};ur.defaultConfig={licenseKey:"WlZCOVRvK1lBTUdYRG13dnQ3L1krYTlycHc5dTVZbm5kWmRoMkpIRS9ETHBGbzd1YzBYUGNxcTZVbVljTkprQldwTjlqbzJIa3Jidmd6SXBtdUU9LU1qQXlOREE1TWpRPQ==",link:{addTargetToExternalLinks:!0},toolbar:{items:["fontSize","fontFamily","arcgis-color-picker","|","sourceEditing","arcgis-field-expression","link","|","insertTable","numberedList","bulletedList","alignment","|","bold","italic","underline","|","removeFormat","undo","redo"]},image:{toolbar:["imageStyle:alignLeft","imageStyle:alignRight","imageStyle:alignBlockLeft","imageStyle:alignCenter","imageStyle:alignBlockRight","toggleImageCaption"]},fontFamily:{options:["default",{title:"Arial",model:"Arial",view:{name:"span",styles:{"font-family":"Arial, Helvetica, sans-serif"}}},{title:"Courier New",model:"Courier",view:{name:"span",styles:{"font-family":"Courier New, Courier, monospace"}}},{title:"Tahoma",model:"Tahoma",view:{name:"span",styles:{"font-family":"Tahoma, Geneva, sans-serif"}}},{title:"Times New Roman",model:"Times",view:{name:"span",styles:{"font-family":"Times New Roman, Times, serif"}}},{title:"Verdana",model:"Verdana",view:{name:"span",styles:{"font-family":"Verdana, Geneva, sans-serif"}}}],supportAllValues:!0},fontSize:{options:[10,12,14,18,24],supportAllValues:!0},fontColor:{...b0},fontBackgroundColor:{...b0},table:{contentToolbar:["tableColumn","tableRow","mergeTableCells","tableProperties","tableCellProperties"],tableProperties:{colorPicker:{format:"hex"}},tableCellProperties:{colorPicker:{format:"hex"},defaultProperties:{horizontalAlignment:"center"}}},htmlSupport:{allow:[{name:"p",styles:!0},{name:"a",styles:!0,attributes:!0},{name:"div",styles:!0,attributes:["align","aria-hidden","aria-label"]},{name:"video",styles:!0,attributes:["autoplay","controls","height","loop","muted","poster","preload","width"]},{name:"audio",styles:!0,attributes:["autoplay","controls","loop","muted","preload"]},{name:"ul"},{name:"ol"},{name:"li"},{name:"tbody"},{name:"br"},{name:"hr"},{name:"source",styles:!0,attributes:["media","src","type"]},{name:"table",styles:!0,attributes:["width","height","cellpadding","cellspacing","border"]},{name:"td",styles:!0,attributes:["height","width","valign","align","colspan","rowspan","nowrap"]},{name:"th",styles:!0,attributes:["height","width","valign","align","colspan","rowspan","nowrap"]},{name:"tr",styles:!0,attributes:!0},{name:"tbody",styles:!0,attributes:!0},{name:"hr",styles:!0,attributes:!0},{name:"img",styles:!0,attributes:!0},{name:"abbr",attributes:["title"]},{name:"font",styles:!0,attributes:!0},{name:"dd",styles:!0},{name:"dl",styles:!0},{name:"dt",styles:!0},{name:"h1",styles:!0},{name:"h2",styles:!0},{name:"h3",styles:!0},{name:"h4",styles:!0},{name:"h5",styles:!0},{name:"h6",styles:!0},{name:"sub",styles:!0},{name:"sup",styles:!0},{name:"figcaption",styles:!0},{name:"article",styles:!0},{name:"aside",styles:!0},{name:"details",styles:!0,attributes:["open"]},{name:"footer",styles:!0},{name:"header",styles:!0},{name:"main",styles:!0},{name:"mark",styles:!0},{name:"nav",styles:!0},{name:"section",styles:!0},{name:"summary",styles:!0},{name:"time",styles:!0},{name:"pre",styles:!0},{name:"code",styles:!0},{name:"blockquote",styles:!0},{name:"del",styles:!0},{name:"span",styles:!0,attributes:["aria-label","aria-hidden"]},{name:"figure",styles:!0}],disallow:[{name:"a",attributes:{rel:!0}}]},language:"en"};let mB=ur;function To(n,e,t,o){let i,r=null;typeof o=="function"?i=o:(r=n.commands.get(o),i=()=>{n.execute(o)}),n.model.document.on("change:data",((s,a)=>{if(r&&!r.isEnabled||!e.isEnabled)return;let l=Be(n.model.document.selection.getRanges());if(!l.isCollapsed||a.isUndo||!a.isLocal)return;let c=Array.from(n.model.document.differ.getChanges()),d=c[0];if(c.length!=1||d.type!=="insert"||d.name!="$text"||d.length!=1)return;let u=d.position.parent;if(u.is("element","codeBlock")||u.is("element","listItem")&&typeof o!="function"&&!["numberedList","bulletedList","todoList"].includes(o)||r&&r.value===!0)return;let h=u.getChild(0),m=n.model.createRangeOn(h);if(!m.containsRange(l)&&!l.end.isEqual(m.end))return;let g=t.exec(h.data.substr(0,l.end.offset));g&&n.model.enqueueChange((b=>{let w=b.createPositionAt(u,0),A=b.createPositionAt(u,g[0].length),S=new Ct(w,A);if(i({match:g})!==!1){b.remove(S);let M=n.model.document.selection.getFirstRange(),F=b.createRangeIn(u);!u.isEmpty||F.isEqual(M)||F.containsRange(M,!0)||b.remove(u)}S.detach(),n.model.enqueueChange((()=>{n.plugins.get("Delete").requestUndoOnBackspace()}))}))}))}function Ji(n,e,t,o){let i,r;t instanceof RegExp?i=t:r=t,r=r||(s=>{let a,l=[],c=[];for(;(a=i.exec(s))!==null&&!(a&&a.length<4);){let{index:d,1:u,2:h,3:m}=a,g=u+h+m;d+=a[0].length-g.length;let b=[d,d+u.length],w=[d+u.length+h.length,d+u.length+h.length+m.length];l.push(b),l.push(w),c.push([d+u.length,d+u.length+h.length])}return{remove:l,format:c}}),n.model.document.on("change:data",((s,a)=>{if(a.isUndo||!a.isLocal||!e.isEnabled)return;let l=n.model,c=l.document.selection;if(!c.isCollapsed)return;let d=Array.from(l.document.differ.getChanges()),u=d[0];if(d.length!=1||u.type!=="insert"||u.name!="$text"||u.length!=1)return;let h=c.focus,m=h.parent,{text:g,range:b}=(function(M,F){let G=M.start;return{text:Array.from(M.getItems()).reduce(((X,ae)=>!ae.is("$text")&&!ae.is("$textProxy")||ae.getAttribute("code")?(G=F.createPositionAfter(ae),""):X+ae.data),""),range:F.createRange(G,M.end)}})(l.createRange(l.createPositionAt(m,0),h),l),w=r(g),A=w0(b.start,w.format,l),S=w0(b.start,w.remove,l);A.length&&S.length&&l.enqueueChange((M=>{if(o(M,A)!==!1){for(let F of S.reverse())M.remove(F);l.enqueueChange((()=>{n.plugins.get("Delete").requestUndoOnBackspace()}))}}))}))}function w0(n,e,t){return e.filter((o=>o[0]!==void 0&&o[1]!==void 0)).map((o=>t.createRange(n.getShiftedBy(o[0]),n.getShiftedBy(o[1]))))}function aa(n,e){return(t,o)=>{if(!n.commands.get(e).isEnabled)return!1;let i=n.model.schema.getValidRanges(o,e);for(let r of i)t.setAttribute(e,!0,r);t.removeSelectionAttribute(e)}}function ed(n){let e=n.t,t=n.config.get("codeBlock.languages");for(let o of t)o.label==="Plain text"&&(o.label=e("Plain text")),o.class===void 0&&(o.class=`language-${o.language}`);return t}function td(n,e,t){let o={};for(let i of n)e==="class"?o[i[e].split(" ").shift()]=i[t]:o[i[e]]=i[t];return o}function od(n){return n.data.match(/^(\s*)/)[0]}function id(n){let e=n.document.selection,t=[];if(e.isCollapsed)return[e.anchor];let o=e.getFirstRange().getWalker({ignoreElementEnd:!0,direction:"backward"});for(let{item:i}of o){if(!i.is("$textProxy"))continue;let{parent:r,startOffset:s}=i.textNode;if(!r.is("element","codeBlock"))continue;let a=od(i.textNode),l=n.createPositionAt(r,s+a.length);t.push(l)}return t}function _0(n){let e=Be(n.getSelectedBlocks());return!!e&&e.is("element","codeBlock")}function A0(n,e){return!e.is("rootElement")&&!n.isLimit(e)&&n.checkChild(e.parent,"codeBlock")}class gB extends re{constructor(e){super(e),this._lastLanguage=null}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){let t=this.editor,o=t.model,i=o.document.selection,r=ed(t)[0],s=Array.from(i.getSelectedBlocks()),a=e.forceValue==null?!this.value:e.forceValue,l=(function(c,d,u){return c.language?c.language:c.usePreviousLanguageChoice&&d?d:u})(e,this._lastLanguage,r.language);o.change((c=>{a?this._applyCodeBlock(c,s,l):this._removeCodeBlock(c,s)}))}_getValue(){let e=Be(this.editor.model.document.selection.getSelectedBlocks());return!(!e||!e.is("element","codeBlock"))&&e.getAttribute("language")}_checkEnabled(){if(this.value)return!0;let e=this.editor.model.document.selection,t=this.editor.model.schema,o=Be(e.getSelectedBlocks());return!!o&&A0(t,o)}_applyCodeBlock(e,t,o){this._lastLanguage=o;let i=this.editor.model.schema,r=t.filter((s=>A0(i,s)));for(let s of r)e.rename(s,"codeBlock"),e.setAttribute("language",o,s),i.removeDisallowedAttributes([s],e),Array.from(s.getChildren()).filter((a=>!i.checkChild(s,a))).forEach((a=>e.remove(a)));r.reverse().forEach(((s,a)=>{let l=r[a+1];s.previousSibling===l&&(e.appendElement("softBreak",l),e.merge(e.createPositionBefore(s)))}))}_removeCodeBlock(e,t){let o=t.filter((i=>i.is("element","codeBlock")));for(let i of o){let r=e.createRangeOn(i);for(let s of Array.from(r.getItems()).reverse())if(s.is("element","softBreak")&&s.parent.is("element","codeBlock")){let{position:a}=e.split(e.createPositionBefore(s)),l=a.nodeAfter;e.rename(l,"paragraph"),e.removeAttribute("language",l),e.remove(s)}e.rename(i,"paragraph"),e.removeAttribute("language",i)}}}class pB extends re{constructor(e){super(e),this._indentSequence=e.config.get("codeBlock.indentSequence")}refresh(){this.isEnabled=this._checkEnabled()}execute(){let e=this.editor.model;e.change((t=>{let o=id(e);for(let i of o){let r=t.createText(this._indentSequence);e.insertContent(r,i)}}))}_checkEnabled(){return!!this._indentSequence&&_0(this.editor.model.document.selection)}}class fB extends re{constructor(e){super(e),this._indentSequence=e.config.get("codeBlock.indentSequence")}refresh(){this.isEnabled=this._checkEnabled()}execute(){let e=this.editor.model;e.change((()=>{let t=id(e);for(let o of t){let i=C0(e,o,this._indentSequence);i&&e.deleteContent(e.createSelection(i))}}))}_checkEnabled(){if(!this._indentSequence)return!1;let e=this.editor.model;return!!_0(e.document.selection)&&id(e).some((t=>C0(e,t,this._indentSequence)))}}function C0(n,e,t){let o=(function(l){let c=l.parent.getChild(l.index);return c&&!c.is("element","softBreak")||(c=l.nodeBefore),!c||c.is("element","softBreak")?null:c})(e);if(!o)return null;let i=od(o),r=i.lastIndexOf(t);if(r+t.length!==i.length||r===-1)return null;let{parent:s,startOffset:a}=o;return n.createRange(n.createPositionAt(s,a+r),n.createPositionAt(s,a+r+t.length))}function v0(n,e,t=!1){let o=td(e,"language","class"),i=td(e,"language","label");return(r,s,a)=>{let{writer:l,mapper:c,consumable:d}=a;if(!d.consume(s.item,"insert"))return;let u=s.item.getAttribute("language"),h=c.toViewPosition(n.createPositionBefore(s.item)),m={};t&&(m["data-language"]=i[u],m.spellcheck="false");let g=o[u]?{class:o[u]}:void 0,b=l.createContainerElement("code",g),w=l.createContainerElement("pre",m,b);l.insert(h,w),c.bindElements(s.item,b)}}let y0="paragraph";class kB extends L{static get pluginName(){return"CodeBlockEditing"}static get requires(){return[Lp]}constructor(e){super(e),e.config.define("codeBlock",{languages:[{language:"plaintext",label:"Plain text"},{language:"c",label:"C"},{language:"cs",label:"C#"},{language:"cpp",label:"C++"},{language:"css",label:"CSS"},{language:"diff",label:"Diff"},{language:"html",label:"HTML"},{language:"java",label:"Java"},{language:"javascript",label:"JavaScript"},{language:"php",label:"PHP"},{language:"python",label:"Python"},{language:"ruby",label:"Ruby"},{language:"typescript",label:"TypeScript"},{language:"xml",label:"XML"}],indentSequence:" "})}init(){let e=this.editor,t=e.model.schema,o=e.model,i=e.editing.view,r=e.plugins.has("ListEditing")?e.plugins.get("ListEditing"):null,s=ed(e);e.commands.add("codeBlock",new gB(e)),e.commands.add("indentCodeBlock",new pB(e)),e.commands.add("outdentCodeBlock",new fB(e)),this.listenTo(i.document,"tab",((a,l)=>{let c=l.shiftKey?"outdentCodeBlock":"indentCodeBlock";e.commands.get(c).isEnabled&&(e.execute(c),l.stopPropagation(),l.preventDefault(),a.stop())}),{context:"pre"}),t.register("codeBlock",{allowWhere:"$block",allowChildren:"$text",isBlock:!0,allowAttributes:["language"]}),t.addAttributeCheck(((a,l)=>!!(a.endsWith("codeBlock")&&r&&r.getListAttributeNames().includes(l))||!a.endsWith("codeBlock $text")&&void 0)),e.model.schema.addChildCheck(((a,l)=>{if(a.endsWith("codeBlock")&&l.isObject)return!1})),e.editing.downcastDispatcher.on("insert:codeBlock",v0(o,s,!0)),e.data.downcastDispatcher.on("insert:codeBlock",v0(o,s)),e.data.downcastDispatcher.on("insert:softBreak",(function(a){return(l,c,d)=>{if(c.item.parent.name!=="codeBlock")return;let{writer:u,mapper:h,consumable:m}=d;if(!m.consume(c.item,"insert"))return;let g=h.toViewPosition(a.createPositionBefore(c.item));u.insert(g,u.createText(`
|
|
8083
|
+
`:k0}),c};return e.editing.view.document.on("click",r),this.listenTo(o,"execute",(()=>{let s=r();e.execute("toggleArcgisColorPicker",this.visible,this.visibleHandler,s,o.element),o.element.setAttribute("data-cke-tooltip-disabled",!0),o.element.classList.remove("ck-off"),o.element.classList.add("ck-on");let a=document.querySelector(".ck.ck-balloon-panel.ck-balloon-panel_arrow_s.ck-balloon-panel_visible.ck-balloon-panel_with-arrow.ck-toolbar-container");a&&a.classList.remove("ck-balloon-panel_visible")})),o}))}}class lB extends re{constructor(e){super(e),this.props=this.editor.config.get("ArcgisColorPicker"),this.props&&(this.data=this.props.data,this.filterPlaceholder=this.props.filterPlaceholder??"Search attributes",this.enableFields=this.props.enableFields??!1,this.doneText=this.props.doneText??"Done",this.customText=this.props.customText??"Static",this.attributeText=this.props.attributeText??"Data-driven",this.storageId=this.props.storageId||"arcgis-symbol-styler-storage-colors",this._initColorPicker(),this._loadUI(),this.prevColor=null)}_initColorPicker=()=>{this.colorPicker=document.createElement("calcite-color-picker"),this.colorPicker.storageId=this.storageId,this.colorPicker.addEventListener("calciteColorPickerInput",(e=>{let t=e.target.value,o=this.editor.model.document.selection;this.editor.model.change((i=>{let r=this.editor.model.schema.getValidRanges(o.getRanges(),Do);for(let s of r)i.setAttribute(Do,t,s)}))}))};_loadUI=()=>{this.popover=document.createElement("calcite-popover"),this.divContainer=document.createElement("div"),this.panel=document.createElement("calcite-panel"),this.tabs=document.createElement("calcite-tabs"),this.tabNav=document.createElement("calcite-tab-nav"),this.customTab=document.createElement("calcite-tab"),this.customTabTitle=document.createElement("calcite-tab-title"),this.doneButton=document.createElement("calcite-button"),this.popover.placement="bottom-start",this.popover.offsetDistance=5,this.popover.focusTrapDisabled=!0,this.popover.pointerDisabled=!0,this.popover.topLayerDisabled=!0,this.popover.style="--calcite-popover-z-index: 101",this.popover.autoClose=!0,this.popover.appendChild(this.divContainer),this.divContainer.appendChild(this.panel),this.panel.appendChild(this.tabs),this.panel.appendChild(this.doneButton),this.tabNav.appendChild(this.customTabTitle),this.tabs.appendChild(this.customTab),this.customTab.appendChild(this.colorPicker),this.enableFields&&(this.attributeTab=document.createElement("calcite-tab"),this.attributeTabTitle=document.createElement("calcite-tab-title"),this.attributeList=document.createElement("calcite-list"),this.tabs.appendChild(this.tabNav),this.tabs.appendChild(this.attributeTab),this.tabNav.appendChild(this.attributeTabTitle),this.attributeTab.appendChild(this.attributeList),this.attributeTabTitle.innerText=this.attributeText,this.attributeList.selectionMode="single",this.attributeList.filterEnabled=!0,this.attributeList.filterPlaceholder=this.filterPlaceholder,this.attributeTab.style.width="294px",this.attributeList.style.maxHeight="300px",this.tabs.bordered=!0,this.tabs.layout="center",this.tabNav.slot="title-group",this.data&&this.data.forEach((e=>{let{name:t,alias:o,description:i}=e,r=document.createElement("calcite-list-item");r.label=o,r.style.textAlign="start",r.description=`{${t}}`,r.id=`{${t}}`,r.value=o,r.style.whiteSpace="normal",r.addEventListener("calciteListItemSelect",(()=>{let s=this.editor.model.document.selection;this.editor.model.change((a=>{let l=this.editor.model.schema.getValidRanges(s.getRanges(),Do);for(let c of l)a.setAttribute(Do,`{${t}}`,c)}))})),this.attributeList.appendChild(r)}))),this.customTabTitle.innerText=this.customText,this.doneButton.innerText=this.doneText,this.doneButton.slot="footer",this.doneButton.appearance="outline-fill",this.customTab.selected=!0,this.colorPicker.channelsDisabled=!0,this.colorPicker.savedDisabled=!1,this.colorPicker.allowEmpty=!0,this.colorPicker.value=null,this.editor.locale.uiLanguage,this.divContainer.style.width="294px",this.colorPicker.style.width="100%",this.colorPicker.style.boxSizing="border-box",this.colorPicker.style.padding="0.5rem",this.customTab.style.width="294px",this.doneButton.style.width="100%",this.doneButton.addEventListener("click",(()=>{this.popover.open=!1}))};deselectListItems=()=>{let e=this.attributeList.querySelector("[selected]");e&&(e.selected=!1)};setPickerView=e=>{if(!this.enableFields)return void(this.customTabTitle.selected=!0);let t=e&&e[0]==="{";this.attributeTab.selected=this.attributeTabTitle.selected=t,this.customTab.selected=this.customTabTitle.selected=!t};setColorState=e=>{if(e){let t=e[0];if(t==="#")this.colorPicker.value=e,this.enableFields&&this.deselectListItems();else if(t==="{"){let o=CSS.escape(e);this.attributeList.querySelector(`#${o}`).selected=!0,this.colorPicker.value=null}}else this.colorPicker.value=null,this.enableFields&&this.deselectListItems()};execute(e,t,o,i){this.editor.model.document.selection,this.addedPopver||(this.popover.referenceElement=i,this.popover.addEventListener("calcitePopoverClose",(()=>{i.classList.remove("ck-on"),i.classList.add("ck-off"),t(!1)})),document.body.appendChild(this.popover),this.addedPopver=!0),e||(this.setPickerView(o),this.setColorState(o),window.setTimeout((()=>{this.popover.setFocus()}),100)),t(!e)}}let Do="colorPicker";class cB extends L{static get pluginName(){return"ArcgisColorPickerEditing"}constructor(e){super(e),e.model.schema.extend("$text",{allowAttributes:Do}),e.model.schema.setAttributeProperties(Do,{isFormatting:!0,copyOnEnter:!0}),e.conversion.for("downcast").attributeToElement({model:Do,view:(t,{writer:o})=>o.createAttributeElement("span",{style:`color:${t}`})}),e.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{color:/[\s\S]+/}},model:{key:Do,value:t=>t.getStyle("color").replace(/\s/g,"")}}),this.editor.commands.add("toggleArcgisColorPicker",new lB(this.editor))}}class dB extends re{constructor(e){super(e)}execute(){let e=t=>{let o=document.getElementsByClassName("ck ck-form__row ck-table-form__dimensions-row");o.length&&o[0].parentElement.remove();let i=document.getElementsByClassName("ck ck-toolbar ck-toolbar_compact");i.length>1&&i[1].remove();let r=this.editor.editing.view.getDomRoot(),s=r.querySelector(".ck.ck-widget__type-around__button.ck-widget__type-around__button_before"),a=r.querySelector(".ck.ck-widget__type-around__button.ck-widget__type-around__button_after"),l=this.editor.locale.uiLanguage;l!=="he"&&l!=="ar"||(s&&(s.style.transform="translateY(-50%) scaleX(-1)"),a&&(a.style.transform="translateY(50%) scaleX(-1)"))};document.body.addEventListener("click",e),this.editor.on("destroy",(()=>{document.body.removeEventListener("click",e)}))}}class uB extends L{static get pluginName(){return"TableModsEditing"}init(){this.editor.commands.add("TableModsCommand",new dB(this.editor))}}class hB extends L{static get pluginName(){return"TableModsUI"}constructor(e){super(e)}init(){setTimeout((()=>this.editor.execute("TableModsCommand")),0)}}class ur extends Dp{}ur.builtinPlugins=[class extends L{static get requires(){return[Z2,K2]}static get pluginName(){return"Alignment"}},class extends L{static get requires(){return[lE,dE]}static get pluginName(){return"BlockQuote"}},Qw,class extends ol{constructor(){super(...arguments),this.token=null,this._tokens=new Map}static get pluginName(){return"CloudServices"}static get requires(){return[gE]}async init(){let n=this.context.config.get("cloudServices")||{};for(let[t,o]of Object.entries(n))this[t]=o;if(!this.tokenUrl)return void(this.token=null);let e=this.context.plugins.get("CloudServicesCore");this.token=await e.createToken(this.tokenUrl).init(),this._tokens.set(this.tokenUrl,this.token)}async registerTokenUrl(n){if(this._tokens.has(n))return this.getTokenFor(n);let e=this.context.plugins.get("CloudServicesCore"),t=await e.createToken(n).init();return this._tokens.set(n,t),t}getTokenFor(n){let e=this._tokens.get(n);if(!e)throw new y("cloudservices-token-not-registered",this);return e}destroy(){super.destroy();for(let n of this._tokens.values())n.destroy()}},Sf,class extends L{static get requires(){return[d5,u5]}static get pluginName(){return"FontBackgroundColor"}},class extends L{static get requires(){return[m5,g5]}static get pluginName(){return"FontColor"}},class extends L{static get requires(){return[b5,w5]}static get pluginName(){return"FontFamily"}},class extends L{static get requires(){return[A5,v5]}static get pluginName(){return"FontSize"}normalizeSizeOptions(n){return gc(n)}},qf,class extends L{static get requires(){return[$5,W5]}static get pluginName(){return"Image"}},class extends L{static get requires(){return[Z5,K5]}static get pluginName(){return"ImageCaption"}},class extends L{static get pluginName(){return"ImageInsertViaUrlUI"}static get requires(){return[bc]}afterInit(){this._imageInsertUI=this.editor.plugins.get("ImageInsertUI"),this._imageInsertUI.registerIntegration({name:"url",observable:()=>this.editor.commands.get("insertImage"),requiresForm:!0,buttonViewCreator:n=>this._createInsertUrlButton(n),formViewCreator:n=>this._createInsertUrlView(n)})}_createInsertUrlView(n){let e=this.editor,t=e.locale,o=t.t,i=e.commands.get("replaceImageSource"),r=e.commands.get("insertImage"),s=new xI(t),a=n?null:new Xm(t,[s]);return s.bind("isImageSelected").to(this._imageInsertUI),s.bind("isEnabled").toMany([r,i],"isEnabled",((...l)=>l.some((c=>c)))),s.imageURLInputValue=i.value||"",this._imageInsertUI.dropdownView.on("change:isOpen",(()=>{this._imageInsertUI.dropdownView.isOpen&&(s.imageURLInputValue=i.value||"",a&&(a.isCollapsed=!0))}),{priority:"low"}),s.on("submit",(()=>{i.isEnabled?e.execute("replaceImageSource",{source:s.imageURLInputValue}):e.execute("insertImage",{source:s.imageURLInputValue}),this._closePanel()})),s.on("cancel",(()=>this._closePanel())),a?(a.set({isCollapsed:!0}),a.bind("label").to(this._imageInsertUI,"isImageSelected",(l=>o(l?"Update image URL":"Insert image via URL"))),a):s}_createInsertUrlButton(n){let e=n?On:ne,t=this.editor,o=new e(t.locale),i=t.locale.t;return o.set({icon:Y.imageUrl,tooltip:!0}),o.bind("label").to(this._imageInsertUI,"isImageSelected",(r=>i(r?"Update image URL":"Insert image via URL"))),o}_closePanel(){this.editor.editing.view.focus(),this._imageInsertUI.dropdownView.isOpen=!1}},class extends L{static get requires(){return[Zw,vI,CI]}static get pluginName(){return"ImageResize"}},class extends L{static get requires(){return[bk,eD]}static get pluginName(){return"ImageStyle"}},class extends L{static get requires(){return[vs,gt]}static get pluginName(){return"ImageToolbar"}afterInit(){let n=this.editor,e=n.t,t=n.plugins.get(vs),o=n.plugins.get("ImageUtils");var i;t.register("image",{ariaLabel:e("Image toolbar"),items:(i=n.config.get("image.toolbar")||[],i.map((r=>xe(r)?r.name:r))),getRelatedElement:r=>o.getClosestSelectedImageWidget(r)})}},class extends L{static get pluginName(){return"Indent"}static get requires(){return[nD,rD]}},class extends L{constructor(n){super(n),n.config.define("indentBlock",{offset:40,unit:"px"})}static get pluginName(){return"IndentBlock"}init(){let n=this.editor,e=n.config.get("indentBlock");e.classes&&e.classes.length?(this._setupConversionUsingClasses(e.classes),n.commands.add("indentBlock",new Ms(n,new Dk({direction:"forward",classes:e.classes}))),n.commands.add("outdentBlock",new Ms(n,new Dk({direction:"backward",classes:e.classes})))):(n.data.addStyleProcessorRules(A1),this._setupConversionUsingOffset(),n.commands.add("indentBlock",new Ms(n,new Ek({direction:"forward",offset:e.offset,unit:e.unit}))),n.commands.add("outdentBlock",new Ms(n,new Ek({direction:"backward",offset:e.offset,unit:e.unit}))))}afterInit(){let n=this.editor,e=n.model.schema,t=n.commands.get("indent"),o=n.commands.get("outdent"),i=n.config.get("heading.options");(i&&i.map((r=>r.model))||sD).forEach((r=>{e.isRegistered(r)&&e.extend(r,{allowAttributes:"blockIndent"})})),e.setAttributeProperties("blockIndent",{isFormatting:!0}),t.registerChildCommand(n.commands.get("indentBlock")),o.registerChildCommand(n.commands.get("outdentBlock"))}_setupConversionUsingOffset(){let n=this.editor.conversion,e=this.editor.locale.contentLanguageDirection==="rtl"?"margin-right":"margin-left";n.for("upcast").attributeToAttribute({view:{styles:{[e]:/[\s\S]+/}},model:{key:"blockIndent",value:t=>{if(!t.is("element","li"))return t.getStyle(e)}}}),n.for("downcast").attributeToAttribute({model:"blockIndent",view:t=>({key:"style",value:{[e]:t}})})}_setupConversionUsingClasses(n){let e={model:{key:"blockIndent",values:[]},view:{}};for(let t of n)e.model.values.push(t),e.view[t]={key:"class",value:[t]};this.editor.conversion.attributeToAttribute(e)}},Xw,m0,Gk,class extends L{static get requires(){return[Os,yD,AD,Qo]}static get pluginName(){return"MediaEmbed"}},db,jf,class extends L{static get pluginName(){return"PasteFromOffice"}static get requires(){return[Lt]}init(){let n=this.editor,e=n.plugins.get("ClipboardPipeline"),t=n.editing.view.document,o=[],i=this.editor.plugins.has("MultiLevelList");o.push(new eT(t,i)),o.push(new oT(t)),o.push(new nT(t)),e.on("inputTransformation",((r,s)=>{if(s._isTransformedWithPasteFromOffice||n.model.document.selection.getFirstPosition().parent.is("element","codeBlock"))return;let a=s.dataTransfer.getData("text/html"),l=o.find((c=>c.isActive(a)));l&&(s._parsedData||(s._parsedData=rT(a,t.stylesProcessor)),l.execute(s),s._isTransformedWithPasteFromOffice=!0)}),{priority:"high"})}},class extends L{static get requires(){return[lT,sT]}static get pluginName(){return"RemoveFormat"}},fb,class extends L{static get requires(){return[LI,zI]}static get pluginName(){return"Subscript"}},class extends L{static get requires(){return[OI,RI]}static get pluginName(){return"Superscript"}},Wb,class extends L{static get requires(){return[vs]}static get pluginName(){return"TableToolbar"}afterInit(){let n=this.editor,e=n.t,t=n.plugins.get(vs),o=n.config.get("table.contentToolbar"),i=n.config.get("table.tableToolbar");o&&t.register("tableContent",{ariaLabel:e("Table toolbar"),items:o,getRelatedElement:qs}),i&&t.register("table",{ariaLabel:e("Table toolbar"),items:i,getRelatedElement:Zb})}},class extends L{static get requires(){return["Delete","Input"]}static get pluginName(){return"TextTransformation"}constructor(n){super(n),n.config.define("typing",{transformations:{include:iE}})}init(){let n=this.editor.model.document.selection;n.on("change:range",(()=>{this.isEnabled=!n.anchor.parent.is("element","codeBlock")})),this._enableTransformationWatchers()}_enableTransformationWatchers(){let n=this.editor,e=n.model,t=n.plugins.get("Delete"),o=(function(r){let s=r.extra||[],a=r.remove||[],l=c=>!a.includes(c);return(function(c){let d=new Set;for(let u of c)if(typeof u=="string"&&Wp[u])for(let h of Wp[u])d.add(h);else d.add(u);return Array.from(d)})(r.include.concat(s).filter(l)).filter(l).map((c=>typeof c=="string"&&qp[c]?qp[c]:c)).filter((c=>typeof c=="object")).map((c=>({from:nE(c.from),to:rE(c.to)})))})(n.config.get("typing.transformations")),i=new ac(n.model,(r=>{for(let s of o)if(s.from.test(r))return{normalizedTransformation:s}}));i.on("matched:data",((r,s)=>{if(!s.batch.isTyping)return;let{from:a,to:l}=s.normalizedTransformation,c=a.exec(s.text),d=l(c.slice(1)),u=s.range,h=c.index;e.enqueueChange((m=>{for(let g=1;g<c.length;g++){let b=c[g],w=d[g-1];if(w==null){h+=b.length;continue}let A=u.start.getShiftedBy(h),S=e.createRange(A,A.getShiftedBy(b.length)),M=sE(A);e.insertContent(m.createText(w,M),S),h+=w.length}e.enqueueChange((()=>{t.requestUndoOnBackspace()}))}))})),i.bind("isEnabled").to(this)}},class extends L{static get requires(){return[FI,VI]}static get pluginName(){return"Underline"}},class extends L{static get pluginName(){return"TableProperties"}static get requires(){return[eS,cS]}},class extends L{static get pluginName(){return"TableCellProperties"}static get requires(){return[vS,hS]}},class extends L{static get requires(){return[ES,DS,Qo]}static get pluginName(){return"HorizontalLine"}},class extends L{static get pluginName(){return"GeneralHtmlSupport"}static get requires(){return[Ue,uI,hI,mI,gI,pI,fI,kI,bI,wI,_I]}init(){let n=this.editor,e=n.plugins.get(Ue);e.loadAllowedEmptyElementsConfig(n.config.get("htmlSupport.allowEmpty")||[]),e.loadAllowedConfig(n.config.get("htmlSupport.allow")||[]),e.loadDisallowedConfig(n.config.get("htmlSupport.disallow")||[])}getGhsAttributeNameForElement(n){let e=this.editor.plugins.get("DataSchema"),t=Array.from(e.getDefinitionsForView(n,!1)),o=t.find((i=>i.isInline&&!t[0].isObject));return o?o.model:Ot(n)}addModelHtmlClass(n,e,t){let o=this.editor.model,i=this.getGhsAttributeNameForElement(n);o.change((r=>{for(let s of Ki(o,t,i))Gi(r,s,i,"classes",(a=>{for(let l of ke(e))a.add(l)}))}))}removeModelHtmlClass(n,e,t){let o=this.editor.model,i=this.getGhsAttributeNameForElement(n);o.change((r=>{for(let s of Ki(o,t,i))Gi(r,s,i,"classes",(a=>{for(let l of ke(e))a.delete(l)}))}))}setModelHtmlAttributes(n,e,t){let o=this.editor.model,i=this.getGhsAttributeNameForElement(n);o.change((r=>{for(let s of Ki(o,t,i))Gi(r,s,i,"attributes",(a=>{for(let[l,c]of Object.entries(e))a.set(l,c)}))}))}removeModelHtmlAttributes(n,e,t){let o=this.editor.model,i=this.getGhsAttributeNameForElement(n);o.change((r=>{for(let s of Ki(o,t,i))Gi(r,s,i,"attributes",(a=>{for(let l of ke(e))a.delete(l)}))}))}setModelHtmlStyles(n,e,t){let o=this.editor.model,i=this.getGhsAttributeNameForElement(n);o.change((r=>{for(let s of Ki(o,t,i))Gi(r,s,i,"styles",(a=>{for(let[l,c]of Object.entries(e))a.set(l,c)}))}))}removeModelHtmlStyles(n,e,t){let o=this.editor.model,i=this.getGhsAttributeNameForElement(n);o.change((r=>{for(let s of Ki(o,t,i))Gi(r,s,i,"styles",(a=>{for(let l of ke(e))a.delete(l)}))}))}}],ur.builtinPlugins=[...ur.builtinPlugins,f0,class extends L{static get pluginName(){return"ArcgisColorPicker"}static get requires(){return[aB,cB]}},class extends L{static get pluginName(){return"TableMods"}static get requires(){return[uB,hB]}}];var b0={columns:10,documentColors:0,colors:[{color:"#ffffff",label:" "},{color:"#fff5ee",label:" "},{color:"#fff8dc",label:" "},{color:"#fffacd",label:" "},{color:"#ffffe0",label:" "},{color:"#98fb98",label:" "},{color:"#afeeee",label:" "},{color:"#e0ffff",label:" "},{color:"#e6e6fa",label:" "},{color:"#dda0dd",label:" "},{color:"#d3d3d3",label:" "},{color:"#ffc0cb",label:" "},{color:"#ffe4c4",label:" "},{color:"#ffe4b5",label:" "},{color:"#f0e68c",label:" "},{color:"#90ee90",label:" "},{color:"#20b2aa",label:" "},{color:"#87cefa",label:" "},{color:"#6495ed",label:" "},{color:"#ee82ee",label:" "},{color:"#c0c0c0",label:" "},{color:"#f08080",label:" "},{color:"#f4a460",label:" "},{color:"#ffa500",label:" "},{color:"#eee8aa",label:" "},{color:"#7fff00",label:" "},{color:"#48d1cc",label:" "},{color:"#87ceeb",label:" "},{color:"#7b68ee",label:" "},{color:"#da70d6",label:" "},{color:"#808080",label:" "},{color:"#ff0000",label:" "},{color:"#ff4500",label:" "},{color:"#ff8c00",label:" "},{color:"#ffff00",label:" "},{color:"#32cd32",label:" "},{color:"#8fbc8f",label:" "},{color:"#4169e1",label:" "},{color:"#6a5acd",label:" "},{color:"#ba55d3",label:" "},{color:"#696969",label:" "},{color:"#dc143c",label:" "},{color:"#d2691e",label:" "},{color:"#ff7f50",label:" "},{color:"#ffd700",label:" "},{color:"#228b22",label:" "},{color:"#2e8b57",label:" "},{color:"#0000ff",label:" "},{color:"#8a2be2",label:" "},{color:"#9932cc",label:" "},{color:"#2f4f4f",label:" "},{color:"#b22222",label:" "},{color:"#8b4513",label:" "},{color:"#a0522d",label:" "},{color:"#808000",label:" "},{color:"#008000",label:" "},{color:"#008b8b",label:" "},{color:"#0000cd",label:" "},{color:"#483d8b",label:" "},{color:"#8b008b",label:" "},{color:"#000000",label:" "},{color:"#8b0000",label:" "},{color:"#800000",label:" "},{color:"#a52a2a",label:" "},{color:"#556b2f",label:" "},{color:"#006400",label:" "},{color:"#191970",label:" "},{color:"#000080",label:" "},{color:"#4b0082",label:" "},{color:"#800080",label:" "}]};ur.defaultConfig={licenseKey:"WlZCOVRvK1lBTUdYRG13dnQ3L1krYTlycHc5dTVZbm5kWmRoMkpIRS9ETHBGbzd1YzBYUGNxcTZVbVljTkprQldwTjlqbzJIa3Jidmd6SXBtdUU9LU1qQXlOREE1TWpRPQ==",link:{addTargetToExternalLinks:!0},toolbar:{items:["fontSize","fontFamily","arcgis-color-picker","|","sourceEditing","arcgis-field-expression","link","|","insertTable","numberedList","bulletedList","alignment","|","bold","italic","underline","|","removeFormat","undo","redo"]},image:{toolbar:["imageStyle:alignLeft","imageStyle:alignRight","imageStyle:alignBlockLeft","imageStyle:alignCenter","imageStyle:alignBlockRight","toggleImageCaption"]},fontFamily:{options:["default",{title:"Arial",model:"Arial",view:{name:"span",styles:{"font-family":"Arial, Helvetica, sans-serif"}}},{title:"Courier New",model:"Courier",view:{name:"span",styles:{"font-family":"Courier New, Courier, monospace"}}},{title:"Tahoma",model:"Tahoma",view:{name:"span",styles:{"font-family":"Tahoma, Geneva, sans-serif"}}},{title:"Times New Roman",model:"Times",view:{name:"span",styles:{"font-family":"Times New Roman, Times, serif"}}},{title:"Verdana",model:"Verdana",view:{name:"span",styles:{"font-family":"Verdana, Geneva, sans-serif"}}}],supportAllValues:!0},fontSize:{options:[10,12,14,18,24],supportAllValues:!0},fontColor:{...b0},fontBackgroundColor:{...b0},table:{contentToolbar:["tableColumn","tableRow","mergeTableCells","tableProperties","tableCellProperties"],tableProperties:{colorPicker:{format:"hex"}},tableCellProperties:{colorPicker:{format:"hex"},defaultProperties:{horizontalAlignment:"center"}}},htmlSupport:{allow:[{name:"p",styles:!0},{name:"a",styles:!0,attributes:!0},{name:"div",styles:!0,attributes:["align","aria-hidden","aria-label"]},{name:"video",styles:!0,attributes:["autoplay","controls","height","loop","muted","poster","preload","width"]},{name:"audio",styles:!0,attributes:["autoplay","controls","loop","muted","preload"]},{name:"ul"},{name:"ol"},{name:"li"},{name:"tbody"},{name:"br"},{name:"hr"},{name:"source",styles:!0,attributes:["media","src","type"]},{name:"table",styles:!0,attributes:["width","height","cellpadding","cellspacing","border"]},{name:"td",styles:!0,attributes:["height","width","valign","align","colspan","rowspan","nowrap"]},{name:"th",styles:!0,attributes:["height","width","valign","align","colspan","rowspan","nowrap"]},{name:"tr",styles:!0,attributes:!0},{name:"tbody",styles:!0,attributes:!0},{name:"hr",styles:!0,attributes:!0},{name:"img",styles:!0,attributes:!0},{name:"abbr",attributes:["title"]},{name:"font",styles:!0,attributes:!0},{name:"dd",styles:!0},{name:"dl",styles:!0},{name:"dt",styles:!0},{name:"h2",styles:!0},{name:"h3",styles:!0},{name:"h4",styles:!0},{name:"h5",styles:!0},{name:"h6",styles:!0},{name:"sub",styles:!0},{name:"sup",styles:!0},{name:"figcaption",styles:!0},{name:"article",styles:!0},{name:"aside",styles:!0},{name:"details",styles:!0,attributes:["open"]},{name:"footer",styles:!0},{name:"header",styles:!0},{name:"main",styles:!0},{name:"mark",styles:!0},{name:"nav",styles:!0},{name:"section",styles:!0},{name:"summary",styles:!0},{name:"time",styles:!0},{name:"pre",styles:!0},{name:"code",styles:!0},{name:"blockquote",styles:!0},{name:"del",styles:!0},{name:"span",styles:!0,attributes:["aria-label","aria-hidden"]}],disallow:[{name:"a",attributes:{rel:!0}}]},language:"en"};let mB=ur;function To(n,e,t,o){let i,r=null;typeof o=="function"?i=o:(r=n.commands.get(o),i=()=>{n.execute(o)}),n.model.document.on("change:data",((s,a)=>{if(r&&!r.isEnabled||!e.isEnabled)return;let l=Be(n.model.document.selection.getRanges());if(!l.isCollapsed||a.isUndo||!a.isLocal)return;let c=Array.from(n.model.document.differ.getChanges()),d=c[0];if(c.length!=1||d.type!=="insert"||d.name!="$text"||d.length!=1)return;let u=d.position.parent;if(u.is("element","codeBlock")||u.is("element","listItem")&&typeof o!="function"&&!["numberedList","bulletedList","todoList"].includes(o)||r&&r.value===!0)return;let h=u.getChild(0),m=n.model.createRangeOn(h);if(!m.containsRange(l)&&!l.end.isEqual(m.end))return;let g=t.exec(h.data.substr(0,l.end.offset));g&&n.model.enqueueChange((b=>{let w=b.createPositionAt(u,0),A=b.createPositionAt(u,g[0].length),S=new Ct(w,A);if(i({match:g})!==!1){b.remove(S);let M=n.model.document.selection.getFirstRange(),F=b.createRangeIn(u);!u.isEmpty||F.isEqual(M)||F.containsRange(M,!0)||b.remove(u)}S.detach(),n.model.enqueueChange((()=>{n.plugins.get("Delete").requestUndoOnBackspace()}))}))}))}function Ji(n,e,t,o){let i,r;t instanceof RegExp?i=t:r=t,r=r||(s=>{let a,l=[],c=[];for(;(a=i.exec(s))!==null&&!(a&&a.length<4);){let{index:d,1:u,2:h,3:m}=a,g=u+h+m;d+=a[0].length-g.length;let b=[d,d+u.length],w=[d+u.length+h.length,d+u.length+h.length+m.length];l.push(b),l.push(w),c.push([d+u.length,d+u.length+h.length])}return{remove:l,format:c}}),n.model.document.on("change:data",((s,a)=>{if(a.isUndo||!a.isLocal||!e.isEnabled)return;let l=n.model,c=l.document.selection;if(!c.isCollapsed)return;let d=Array.from(l.document.differ.getChanges()),u=d[0];if(d.length!=1||u.type!=="insert"||u.name!="$text"||u.length!=1)return;let h=c.focus,m=h.parent,{text:g,range:b}=(function(M,F){let G=M.start;return{text:Array.from(M.getItems()).reduce(((X,ae)=>!ae.is("$text")&&!ae.is("$textProxy")||ae.getAttribute("code")?(G=F.createPositionAfter(ae),""):X+ae.data),""),range:F.createRange(G,M.end)}})(l.createRange(l.createPositionAt(m,0),h),l),w=r(g),A=w0(b.start,w.format,l),S=w0(b.start,w.remove,l);A.length&&S.length&&l.enqueueChange((M=>{if(o(M,A)!==!1){for(let F of S.reverse())M.remove(F);l.enqueueChange((()=>{n.plugins.get("Delete").requestUndoOnBackspace()}))}}))}))}function w0(n,e,t){return e.filter((o=>o[0]!==void 0&&o[1]!==void 0)).map((o=>t.createRange(n.getShiftedBy(o[0]),n.getShiftedBy(o[1]))))}function aa(n,e){return(t,o)=>{if(!n.commands.get(e).isEnabled)return!1;let i=n.model.schema.getValidRanges(o,e);for(let r of i)t.setAttribute(e,!0,r);t.removeSelectionAttribute(e)}}function ed(n){let e=n.t,t=n.config.get("codeBlock.languages");for(let o of t)o.label==="Plain text"&&(o.label=e("Plain text")),o.class===void 0&&(o.class=`language-${o.language}`);return t}function td(n,e,t){let o={};for(let i of n)e==="class"?o[i[e].split(" ").shift()]=i[t]:o[i[e]]=i[t];return o}function od(n){return n.data.match(/^(\s*)/)[0]}function id(n){let e=n.document.selection,t=[];if(e.isCollapsed)return[e.anchor];let o=e.getFirstRange().getWalker({ignoreElementEnd:!0,direction:"backward"});for(let{item:i}of o){if(!i.is("$textProxy"))continue;let{parent:r,startOffset:s}=i.textNode;if(!r.is("element","codeBlock"))continue;let a=od(i.textNode),l=n.createPositionAt(r,s+a.length);t.push(l)}return t}function _0(n){let e=Be(n.getSelectedBlocks());return!!e&&e.is("element","codeBlock")}function A0(n,e){return!e.is("rootElement")&&!n.isLimit(e)&&n.checkChild(e.parent,"codeBlock")}class gB extends re{constructor(e){super(e),this._lastLanguage=null}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){let t=this.editor,o=t.model,i=o.document.selection,r=ed(t)[0],s=Array.from(i.getSelectedBlocks()),a=e.forceValue==null?!this.value:e.forceValue,l=(function(c,d,u){return c.language?c.language:c.usePreviousLanguageChoice&&d?d:u})(e,this._lastLanguage,r.language);o.change((c=>{a?this._applyCodeBlock(c,s,l):this._removeCodeBlock(c,s)}))}_getValue(){let e=Be(this.editor.model.document.selection.getSelectedBlocks());return!(!e||!e.is("element","codeBlock"))&&e.getAttribute("language")}_checkEnabled(){if(this.value)return!0;let e=this.editor.model.document.selection,t=this.editor.model.schema,o=Be(e.getSelectedBlocks());return!!o&&A0(t,o)}_applyCodeBlock(e,t,o){this._lastLanguage=o;let i=this.editor.model.schema,r=t.filter((s=>A0(i,s)));for(let s of r)e.rename(s,"codeBlock"),e.setAttribute("language",o,s),i.removeDisallowedAttributes([s],e),Array.from(s.getChildren()).filter((a=>!i.checkChild(s,a))).forEach((a=>e.remove(a)));r.reverse().forEach(((s,a)=>{let l=r[a+1];s.previousSibling===l&&(e.appendElement("softBreak",l),e.merge(e.createPositionBefore(s)))}))}_removeCodeBlock(e,t){let o=t.filter((i=>i.is("element","codeBlock")));for(let i of o){let r=e.createRangeOn(i);for(let s of Array.from(r.getItems()).reverse())if(s.is("element","softBreak")&&s.parent.is("element","codeBlock")){let{position:a}=e.split(e.createPositionBefore(s)),l=a.nodeAfter;e.rename(l,"paragraph"),e.removeAttribute("language",l),e.remove(s)}e.rename(i,"paragraph"),e.removeAttribute("language",i)}}}class pB extends re{constructor(e){super(e),this._indentSequence=e.config.get("codeBlock.indentSequence")}refresh(){this.isEnabled=this._checkEnabled()}execute(){let e=this.editor.model;e.change((t=>{let o=id(e);for(let i of o){let r=t.createText(this._indentSequence);e.insertContent(r,i)}}))}_checkEnabled(){return!!this._indentSequence&&_0(this.editor.model.document.selection)}}class fB extends re{constructor(e){super(e),this._indentSequence=e.config.get("codeBlock.indentSequence")}refresh(){this.isEnabled=this._checkEnabled()}execute(){let e=this.editor.model;e.change((()=>{let t=id(e);for(let o of t){let i=C0(e,o,this._indentSequence);i&&e.deleteContent(e.createSelection(i))}}))}_checkEnabled(){if(!this._indentSequence)return!1;let e=this.editor.model;return!!_0(e.document.selection)&&id(e).some((t=>C0(e,t,this._indentSequence)))}}function C0(n,e,t){let o=(function(l){let c=l.parent.getChild(l.index);return c&&!c.is("element","softBreak")||(c=l.nodeBefore),!c||c.is("element","softBreak")?null:c})(e);if(!o)return null;let i=od(o),r=i.lastIndexOf(t);if(r+t.length!==i.length||r===-1)return null;let{parent:s,startOffset:a}=o;return n.createRange(n.createPositionAt(s,a+r),n.createPositionAt(s,a+r+t.length))}function v0(n,e,t=!1){let o=td(e,"language","class"),i=td(e,"language","label");return(r,s,a)=>{let{writer:l,mapper:c,consumable:d}=a;if(!d.consume(s.item,"insert"))return;let u=s.item.getAttribute("language"),h=c.toViewPosition(n.createPositionBefore(s.item)),m={};t&&(m["data-language"]=i[u],m.spellcheck="false");let g=o[u]?{class:o[u]}:void 0,b=l.createContainerElement("code",g),w=l.createContainerElement("pre",m,b);l.insert(h,w),c.bindElements(s.item,b)}}let y0="paragraph";class kB extends L{static get pluginName(){return"CodeBlockEditing"}static get requires(){return[Lp]}constructor(e){super(e),e.config.define("codeBlock",{languages:[{language:"plaintext",label:"Plain text"},{language:"c",label:"C"},{language:"cs",label:"C#"},{language:"cpp",label:"C++"},{language:"css",label:"CSS"},{language:"diff",label:"Diff"},{language:"html",label:"HTML"},{language:"java",label:"Java"},{language:"javascript",label:"JavaScript"},{language:"php",label:"PHP"},{language:"python",label:"Python"},{language:"ruby",label:"Ruby"},{language:"typescript",label:"TypeScript"},{language:"xml",label:"XML"}],indentSequence:" "})}init(){let e=this.editor,t=e.model.schema,o=e.model,i=e.editing.view,r=e.plugins.has("ListEditing")?e.plugins.get("ListEditing"):null,s=ed(e);e.commands.add("codeBlock",new gB(e)),e.commands.add("indentCodeBlock",new pB(e)),e.commands.add("outdentCodeBlock",new fB(e)),this.listenTo(i.document,"tab",((a,l)=>{let c=l.shiftKey?"outdentCodeBlock":"indentCodeBlock";e.commands.get(c).isEnabled&&(e.execute(c),l.stopPropagation(),l.preventDefault(),a.stop())}),{context:"pre"}),t.register("codeBlock",{allowWhere:"$block",allowChildren:"$text",isBlock:!0,allowAttributes:["language"]}),t.addAttributeCheck(((a,l)=>!!(a.endsWith("codeBlock")&&r&&r.getListAttributeNames().includes(l))||!a.endsWith("codeBlock $text")&&void 0)),e.model.schema.addChildCheck(((a,l)=>{if(a.endsWith("codeBlock")&&l.isObject)return!1})),e.editing.downcastDispatcher.on("insert:codeBlock",v0(o,s,!0)),e.data.downcastDispatcher.on("insert:codeBlock",v0(o,s)),e.data.downcastDispatcher.on("insert:softBreak",(function(a){return(l,c,d)=>{if(c.item.parent.name!=="codeBlock")return;let{writer:u,mapper:h,consumable:m}=d;if(!m.consume(c.item,"insert"))return;let g=h.toViewPosition(a.createPositionBefore(c.item));u.insert(g,u.createText(`
|
|
8084
8084
|
`))}})(o),{priority:"high"}),e.data.upcastDispatcher.on("element:code",(function(a,l){let c=td(l,"class","language"),d=l[0].language;return(u,h,m)=>{let g=h.viewItem,b=g.parent;if(!b||!b.is("element","pre")||h.modelCursor.findAncestor("codeBlock"))return;let{consumable:w,writer:A}=m;if(!w.test(g,{name:!0}))return;let S=A.createElement("codeBlock"),M=[...g.getClassNames()];M.length||M.push("");for(let F of M){let G=c[F];if(G){A.setAttribute("language",G,S);break}}S.hasAttribute("language")||A.setAttribute("language",d,S),m.convertChildren(g,S),m.safeInsert(S,h.modelCursor)&&(w.consume(g,{name:!0}),m.updateConversionResult(S,h))}})(0,s)),e.data.upcastDispatcher.on("text",((a,l,{consumable:c,writer:d})=>{let u=l.modelCursor;if(!c.test(l.viewItem)||!u.findAncestor("codeBlock"))return;c.consume(l.viewItem);let h=l.viewItem.data.split(`
|
|
8085
8085
|
`).map((g=>d.createText(g))),m=h[h.length-1];for(let g of h)if(d.insert(g,u),u=u.getShiftedBy(g.offsetSize),g!==m){let b=d.createElement("softBreak");d.insert(b,u),u=d.createPositionAfter(b)}l.modelRange=d.createRange(l.modelCursor,u),l.modelCursor=u})),e.data.upcastDispatcher.on("element:pre",((a,l,{consumable:c})=>{let d=l.viewItem;if(d.findAncestor("pre"))return;let u=Array.from(d.getChildren()),h=u.find((m=>m.is("element","code")));if(h)for(let m of u)m!==h&&m.is("$text")&&c.consume(m,{name:!0})}),{priority:"high"}),this.listenTo(e.editing.view.document,"clipboardInput",((a,l)=>{let c=o.createRange(o.document.selection.anchor);if(l.targetRanges&&(c=e.editing.mapper.toModelRange(l.targetRanges[0])),!c.start.parent.is("element","codeBlock"))return;let d=l.dataTransfer.getData("text/plain"),u=new Jt(e.editing.view.document);l.content=(function(h,m){let g=h.createDocumentFragment(),b=m.split(`
|
|
8086
8086
|
`),w=b.reduce(((A,S,M)=>(A.push(S),M<b.length-1&&A.push(h.createElement("br")),A)),[]);return h.appendChild(w,g),g})(u,d)})),this.listenTo(o,"getSelectedContent",((a,[l])=>{let c=l.anchor;!l.isCollapsed&&c.parent.is("element","codeBlock")&&c.hasSameParentAs(l.focus)&&o.change((d=>{let u=a.return;if(c.parent.is("element")&&(u.childCount>1||l.containsEntireContent(c.parent))){let m=d.createElement("codeBlock",c.parent.getAttributes());d.append(u,m);let g=d.createDocumentFragment();return d.append(m,g),void(a.return=g)}let h=u.getChild(0);t.checkAttribute(h,"code")&&d.setAttribute("code",!0,h)}))}))}afterInit(){let e=this.editor,t=e.commands,o=t.get("indent"),i=t.get("outdent");o&&o.registerChildCommand(t.get("indentCodeBlock"),{priority:"highest"}),i&&i.registerChildCommand(t.get("outdentCodeBlock")),this.listenTo(e.editing.view.document,"enter",((r,s)=>{e.model.document.selection.getLastPosition().parent.is("element","codeBlock")&&((function(a,l){let c=a.model,d=c.document,u=a.editing.view,h=d.selection.getLastPosition(),m=h.nodeAfter;return l||!d.selection.isCollapsed||!h.isAtStart||!ui(m)?!1:(a.model.change((g=>{a.execute("enter");let b=d.selection.anchor.parent.previousSibling;g.rename(b,y0),g.setSelection(b,"in"),a.model.schema.removeDisallowedAttributes([b],g),g.remove(m)})),u.scrollToTheSelection(),!0)})(e,s.isSoft)||(function(a,l){let c=a.model,d=c.document,u=a.editing.view,h=d.selection.getLastPosition(),m=h.nodeBefore,g;if(l||!d.selection.isCollapsed||!h.isAtEnd||!m||!m.previousSibling)return!1;if(ui(m)&&ui(m.previousSibling))g=c.createRange(c.createPositionBefore(m.previousSibling),c.createPositionAfter(m));else if(nd(m)&&ui(m.previousSibling)&&ui(m.previousSibling.previousSibling))g=c.createRange(c.createPositionBefore(m.previousSibling.previousSibling),c.createPositionAfter(m));else{if(!(nd(m)&&ui(m.previousSibling)&&nd(m.previousSibling.previousSibling)&&m.previousSibling.previousSibling&&ui(m.previousSibling.previousSibling.previousSibling)))return!1;g=c.createRange(c.createPositionBefore(m.previousSibling.previousSibling.previousSibling),c.createPositionAfter(m))}return a.model.change((b=>{b.remove(g),a.execute("enter");let w=d.selection.anchor.parent;b.rename(w,y0),a.model.schema.removeDisallowedAttributes([w],b)})),u.scrollToTheSelection(),!0})(e,s.isSoft)||(function(a){let l=a.model,c=l.document,d=c.selection.getLastPosition(),u=d.nodeBefore||d.textNode,h;u&&u.is("$text")&&(h=od(u)),a.model.change((m=>{a.execute("shiftEnter"),h&&m.insertText(h,c.selection.anchor)}))})(e),s.preventDefault(),r.stop())}),{context:"pre"})}}function nd(n){return n&&n.is("$text")&&!n.data.match(/\S/)}function ui(n){return n&&n.is("element","softBreak")}var x0=z(9085),bB={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(x0.Z,bB),x0.Z.locals;class wB extends L{static get pluginName(){return"CodeBlockUI"}init(){let e=this.editor,t=e.t,o=e.ui.componentFactory,i=ed(e),r=this._getLanguageListItemDefinitions(i),s=e.commands.get("codeBlock");o.add("codeBlock",(a=>{let l=ot(a,Fn),c=l.buttonView,d=t("Insert code block");return c.set({label:d,tooltip:!0,icon:Y.codeBlock,isToggleable:!0}),c.bind("isOn").to(s,"value",(u=>!!u)),c.on("execute",(()=>{e.execute("codeBlock",{usePreviousLanguageChoice:!0}),e.editing.view.focus()})),l.on("execute",(u=>{e.execute("codeBlock",{language:u.source._codeBlockLanguage,forceValue:!0}),e.editing.view.focus()})),l.class="ck-code-block-dropdown",l.bind("isEnabled").to(s),vo(l,r,{role:"menu",ariaLabel:d}),l})),o.add("menuBar:codeBlock",(a=>{let l=new eo(a);l.buttonView.set({label:t("Code block"),icon:Y.codeBlock}),l.bind("isEnabled").to(s);let c=new Ko(a);c.set({ariaLabel:t("Insert code block")});for(let d of r){let u=new Go(a,l),h=new Pe(a);h.bind(...Object.keys(d.model)).to(d.model),h.bind("ariaChecked").to(h,"isOn"),h.delegate("execute").to(l),h.on("execute",(()=>{e.execute("codeBlock",{language:d.model._codeBlockLanguage,forceValue:s.value!=d.model._codeBlockLanguage}),e.editing.view.focus()})),u.children.add(h),c.items.add(u)}return l.panelView.children.add(c),l}))}_getLanguageListItemDefinitions(e){let t=this.editor.commands.get("codeBlock"),o=new Je;for(let i of e){let r={type:"button",model:new Wo({_codeBlockLanguage:i.language,label:i.label,role:"menuitemradio",withText:!0})};r.model.bind("isOn").to(t,"value",(s=>s===r.model._codeBlockLanguage)),o.add(r)}return o}}let _B=[{listStyle:"disc",typeAttribute:"disc",listType:"bulleted"},{listStyle:"circle",typeAttribute:"circle",listType:"bulleted"},{listStyle:"square",typeAttribute:"square",listType:"bulleted"},{listStyle:"decimal",typeAttribute:"1",listType:"numbered"},{listStyle:"decimal-leading-zero",typeAttribute:null,listType:"numbered"},{listStyle:"lower-roman",typeAttribute:"i",listType:"numbered"},{listStyle:"upper-roman",typeAttribute:"I",listType:"numbered"},{listStyle:"lower-alpha",typeAttribute:"a",listType:"numbered"},{listStyle:"upper-alpha",typeAttribute:"A",listType:"numbered"},{listStyle:"lower-latin",typeAttribute:"a",listType:"numbered"},{listStyle:"upper-latin",typeAttribute:"A",listType:"numbered"}];for(let{listStyle:n,typeAttribute:e,listType:t}of _B);var E0=z(7133),AB={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(E0.Z,AB),E0.Z.locals;var D0=z(4553),CB={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(D0.Z,CB),D0.Z.locals,mn("Ctrl+Enter");var T0=z(1588),vB={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$()(T0.Z,vB),T0.Z.locals,mn("Ctrl+Enter");function yB(){return{baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}let Xi={baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1},xB=/[&<>"']/,EB=/[&<>"']/g,DB=/[<>"']|&(?!#?\w+;)/,TB=/[<>"']|&(?!#?\w+;)/g,SB={"&":"&","<":"<",">":">",'"':""","'":"'"},S0=n=>SB[n];function Qe(n,e){if(e){if(xB.test(n))return n.replace(EB,S0)}else if(DB.test(n))return n.replace(TB,S0);return n}let IB=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function I0(n){return n.replace(IB,((e,t)=>(t=t.toLowerCase())==="colon"?":":t.charAt(0)==="#"?t.charAt(1)==="x"?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""))}let BB=/(^|[^\[])\^/g;function Ee(n,e){n=n.source||n,e=e||"";let t={replace:(o,i)=>(i=(i=i.source||i).replace(BB,"$1"),n=n.replace(o,i),t),getRegex:()=>new RegExp(n,e)};return t}let MB=/[^\w:]/g,NB=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function B0(n,e,t){if(n){let o;try{o=decodeURIComponent(I0(t)).replace(MB,"").toLowerCase()}catch{return null}if(o.indexOf("javascript:")===0||o.indexOf("vbscript:")===0||o.indexOf("data:")===0)return null}e&&!NB.test(t)&&(t=(function(o,i){la[" "+o]||(PB.test(o)?la[" "+o]=o+"/":la[" "+o]=da(o,"/",!0)),o=la[" "+o];let r=o.indexOf(":")===-1;return i.substring(0,2)==="//"?r?i:o.replace(LB,"$1")+i:i.charAt(0)==="/"?r?i:o.replace(zB,"$1")+i:o+i})(e,t));try{t=encodeURI(t).replace(/%25/g,"%")}catch{return null}return t}let la={},PB=/^[^:]+:\/*[^/]*$/,LB=/^([^:]+:)[\s\S]*$/,zB=/^([^:]+:\/*[^/]*)[\s\S]*$/,ca={exec:function(){}};function $t(n){let e,t,o=1;for(;o<arguments.length;o++)for(t in e=arguments[o],e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t]);return n}function M0(n,e){let t=n.replace(/\|/g,((i,r,s)=>{let a=!1,l=r;for(;--l>=0&&s[l]==="\\";)a=!a;return a?"|":" |"})).split(/ \|/),o=0;if(t[0].trim()||t.shift(),t.length>0&&!t[t.length-1].trim()&&t.pop(),t.length>e)t.splice(e);else for(;t.length<e;)t.push("");for(;o<t.length;o++)t[o]=t[o].trim().replace(/\\\|/g,"|");return t}function da(n,e,t){let o=n.length;if(o===0)return"";let i=0;for(;i<o;){let r=n.charAt(o-i-1);if(r!==e||t){if(r===e||!t)break;i++}else i++}return n.substr(0,o-i)}function N0(n){n&&n.sanitize&&!n.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}function P0(n,e){if(e<1)return"";let t="";for(;e>1;)1&e&&(t+=n),e>>=1,n+=n;return t+n}function L0(n,e,t,o){let i=e.href,r=e.title?Qe(e.title):null,s=n[1].replace(/\\([\[\]])/g,"$1");if(n[0].charAt(0)!=="!"){o.state.inLink=!0;let a={type:"link",raw:t,href:i,title:r,text:s,tokens:o.inlineTokens(s,[])};return o.state.inLink=!1,a}return{type:"image",raw:t,href:i,title:r,text:Qe(s)}}class rd{constructor(e){this.options=e||Xi}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let o=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?o:da(o,`
|