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