/* Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license */ !function(){function e(e){for(var t,l=0,n=0,i=0,a=e.$.rows.length;a>i;i++){t=e.$.rows[i];for(var o,s=l=0,r=t.cells.length;r>s;s++)o=t.cells[s],l+=o.colSpan;l>n&&(n=l)}return n}function t(e){return function(){var t=this.getValue(),t=!!(CKEDITOR.dialog.validate.integer().call(this,t)&&t>0);return t||(alert(e),this.select()),t}}function l(l,a){var o=function(e){return new CKEDITOR.dom.element(e,l.document)},s=l.editable(),r=l.plugins.dialogadvtab;return{title:l.lang.table.title,minWidth:310,minHeight:CKEDITOR.env.ie?310:280,getModel:function(e){return"tableProperties"!==this.dialog.getName()?null:(e=(e=e.getSelection())&&e.getRanges()[0])?e._getTableElement({table:1}):null},onLoad:function(){var e=this,t=e.getContentElement("advanced","advStyles");t&&t.on("change",function(){var t=this.getStyle("width",""),l=e.getContentElement("info","txtWidth");l&&l.setValue(t,!0),t=this.getStyle("height",""),(l=e.getContentElement("info","txtHeight"))&&l.setValue(t,!0)})},onShow:function(){var e,t=l.getSelection(),n=t.getRanges(),i=this.getContentElement("info","txtRows"),o=this.getContentElement("info","txtCols"),s=this.getContentElement("info","txtWidth"),r=this.getContentElement("info","txtHeight");"tableProperties"==a&&((t=t.getSelectedElement())&&t.is("table")?e=t:0d;d++)for(var g=a.append(o("tr")),h=0;r>h;h++)g.append(o("td")).appendBogus();if(s=i.selHeaders,!n.$.tHead&&("row"==s||"both"==s)){for(g=n.getElementsByTag("thead").getItem(0),a=n.getElementsByTag("tbody").getItem(0),r=a.getElementsByTag("tr").getItem(0),g||(g=new CKEDITOR.dom.element("thead"),g.insertBefore(a)),d=0;ds.getSize("width")?"100%":500:0,getValue:n,validate:CKEDITOR.dialog.validate.cssLength(l.lang.common.invalidCssLength.replace("%1",l.lang.common.width)),onChange:function(){var e=this.getDialog().getContentElement("advanced","advStyles");e&&e.updateStyle("width",this.getValue())},setup:function(e){e=e.getStyle("width"),this.setValue(e)},commit:i}]},{type:"hbox",widths:["5em"],children:[{type:"text",id:"txtHeight",requiredContent:"table{height}",controlStyle:"width:5em",label:l.lang.common.height,title:l.lang.common.cssLengthTooltip,"default":"",getValue:n,validate:CKEDITOR.dialog.validate.cssLength(l.lang.common.invalidCssLength.replace("%1",l.lang.common.height)),onChange:function(){var e=this.getDialog().getContentElement("advanced","advStyles");e&&e.updateStyle("height",this.getValue())},setup:function(e){(e=e.getStyle("height"))&&this.setValue(e)},commit:i}]},{type:"html",html:" "},{type:"text",id:"txtCellSpace",requiredContent:"table[cellspacing]",controlStyle:"width:3em",label:l.lang.table.cellSpace,"default":l.filter.check("table[cellspacing]")?1:0,validate:CKEDITOR.dialog.validate.number(l.lang.table.invalidCellSpacing),setup:function(e){this.setValue(e.getAttribute("cellSpacing")||"")},commit:function(e,t){this.getValue()?t.setAttribute("cellSpacing",this.getValue()):t.removeAttribute("cellSpacing")}},{type:"text",id:"txtCellPad",requiredContent:"table[cellpadding]",controlStyle:"width:3em",label:l.lang.table.cellPad,"default":l.filter.check("table[cellpadding]")?1:0,validate:CKEDITOR.dialog.validate.number(l.lang.table.invalidCellPadding),setup:function(e){this.setValue(e.getAttribute("cellPadding")||"")},commit:function(e,t){this.getValue()?t.setAttribute("cellPadding",this.getValue()):t.removeAttribute("cellPadding")}}]}]},{type:"html",align:"right",html:""},{type:"vbox",padding:0,children:[{type:"text",id:"txtCaption",requiredContent:"caption",label:l.lang.table.caption,setup:function(e){if(this.enable(),e=e.getElementsByTag("caption"),0=0;n--)i.getItem(n).remove()}}},{type:"text",id:"txtSummary",bidi:!0,requiredContent:"table[summary]",label:l.lang.table.summary,setup:function(e){this.setValue(e.getAttribute("summary")||"")},commit:function(e,t){this.getValue()?t.setAttribute("summary",this.getValue()):t.removeAttribute("summary")}}]}]},r&&r.createAdvancedTab(l,null,"table")]}}var n=CKEDITOR.tools.cssLength,i=function(e){var t=this.id;e.info||(e.info={}),e.info[t]=this.getValue()};CKEDITOR.dialog.add("table",function(e){return l(e,"table")}),CKEDITOR.dialog.add("tableProperties",function(e){return l(e,"tableProperties")})}();