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