/* Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license */ (function(){function x(b){return CKEDITOR.env.ie?b.$.clientWidth:parseInt(b.getComputedStyle("width"),10)}function r(b,d){var a=b.getComputedStyle("border-"+d+"-width"),l={thin:"0px",medium:"1px",thick:"2px"};0>a.indexOf("px")&&(a=a in l&&"none"!=b.getComputedStyle("border-style")?l[a]:0);return parseInt(a,10)}function A(b){var d=[],a={},l="rtl"==b.getComputedStyle("direction");CKEDITOR.tools.array.forEach(b.$.rows,function(f,B){var e=-1,g=0,c=null;f?(g=new CKEDITOR.dom.element(f),c={height:g.$.offsetHeight, position:g.getDocumentPosition()}):c=void 0;for(var g=c.height,c=c.position,m=0,k=f.cells.length;m=e.x&&b<=e.x+e.width&&a>=e.y&&a<=e.y+e.height))return e= null,m=h=0,g.removeListener("mouseup",f),c.removeListener("mousedown",l),c.removeListener("mousemove",B),g.getBody().setStyle("cursor","auto"),w?c.remove():c.hide(),0;var d=b-Math.round(c.$.offsetWidth/2);if(m){if(d==n||d==D)return 1;d=Math.max(d,n);d=Math.min(d,D);h=d-y}c.setStyle("left",k(d));return 1}}function y(b){var d=b.data.getTarget();if("mouseout"==b.name){if(!d.is("table"))return;for(var a=new CKEDITOR.dom.element(b.data.$.relatedTarget||b.data.$.toElement);a&&a.$&&!a.equals(d)&&!a.is("body");)a= a.getParent();if(!a||a.equals(d))return}d.getAscendant("table",1).removeCustomData("_cke_table_pillars");b.removeListener()}var k=CKEDITOR.tools.cssLength,w=CKEDITOR.env.ie&&(CKEDITOR.env.ie7Compat||CKEDITOR.env.quirks);CKEDITOR.plugins.add("tableresize",{requires:"tabletools",init:function(b){b.on("contentDom",function(){var d,a=b.editable();a.attachListener(a.isInline()?a:b.document,"mousemove",function(a){a=a.data;var f=a.getTarget();if(f.type==CKEDITOR.NODE_ELEMENT){var k=a.getPageOffset().x, e=a.getPageOffset().y;if(d&&d.move(k,e))z(a);else if(f.is("table")||f.getAscendant({thead:1,tbody:1,tfoot:1},1))if(a=f.getAscendant("table",1),b.editable().contains(a)){(f=a.getCustomData("_cke_table_pillars"))||(a.setCustomData("_cke_table_pillars",f=A(a)),a.on("mouseout",y),a.on("mousedown",y));a:{a=f;for(var f=0,g=a.length;f=c.x&&k<=c.x+c.width&&e>=c.y&&e<=c.y+c.height){k=c;break a}}k=null}k&&(!d&&(d=new E(b)),d.attachTo(k))}}})})}})})();