PHP Classes

File: CMF/Web/scripts/tinymce/plugins/table/plugin.min.js

Recommend this page to a friend!
  Classes of Burge Lab   BurgeATS   CMF/Web/scripts/tinymce/plugins/table/plugin.min.js   Download  
File: CMF/Web/scripts/tinymce/plugins/table/plugin.min.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: BurgeATS
CRM, Ticketing system, and employee manangement
Author: By
Last change: Update of CMF/Web/scripts/tinymce/plugins/table/plugin.min.js
Date: 1 year ago
Size: 42,007 bytes
 

Contents

Class file image Download
!function(e,t){"use strict";function n(e,t){for(var n,r=[],a=0;a<e.length;++a){if(n=o[e[a]]||i(e[a]),!n)throw"module definition dependecy not found: "+e[a];r.push(n)}t.apply(null,r)}function r(e,r,i){if("string"!=typeof e)throw"invalid module definition, module id must be defined and be a string";if(r===t)throw"invalid module definition, dependencies must be specified";if(i===t)throw"invalid module definition, definition function must be specified";n(r,function(){o[e]=i.apply(null,arguments)})}function i(t){for(var n=e,r=t.split(/[.\/]/),i=0;i<r.length;++i){if(!n[r[i]])return;n=n[r[i]]}return n}var o={};r("tinymce/tableplugin/Utils",["tinymce/Env"],function(e){function t(e,t){return parseInt(e.getAttribute(t)||1,10)}function n(t){(!e.ie||e.ie>9)&&(t.innerHTML='<br data-mce-bogus="1" />')}return{getSpanVal:t,paddCell:n}}),r("tinymce/tableplugin/TableGrid",["tinymce/util/Tools","tinymce/Env","tinymce/tableplugin/Utils"],function(e,n,r){var i=e.each,o=r.getSpanVal;return function(a,s){function l(e){return e===a.getBody()}function c(){var e=0;L=[],H=0,i(["thead","tbody","tfoot"],function(t){var n=W.select("> "+t+" tr",s);i(n,function(n,r){r+=e,i(W.select("> td, > th",n),function(e,n){var i,a,s,l;if(L[r])for(;L[r][n];)n++;for(s=o(e,"rowspan"),l=o(e,"colspan"),a=r;r+s>a;a++)for(L[a]||(L[a]=[]),i=n;n+l>i;i++)L[a][i]={part:t,real:a==r&&i==n,elm:e,rowspan:s,colspan:l};H=Math.max(H,n+1)})}),e+=n.length})}function u(e,t){return e=e.cloneNode(t),e.removeAttribute("id"),e}function d(e,t){var n;return n=L[t],n?n[e]:void 0}function f(e,t,n){e&&(n=parseInt(n,10),1===n?e.removeAttribute(t,1):e.setAttribute(t,n,1))}function h(e){return e&&(W.hasClass(e.elm,"mce-item-selected")||e==F)}function m(){var e=[];return i(s.rows,function(t){i(t.cells,function(n){return W.hasClass(n,"mce-item-selected")||F&&n==F.elm?(e.push(t),!1):void 0})}),e}function p(){var e=W.createRng();l(s)||(e.setStartAfter(s),e.setEndAfter(s),z.setRng(e),W.remove(s))}function g(t){var o,s={};return a.settings.table_clone_elements!==!1&&(s=e.makeMap((a.settings.table_clone_elements||"strong em b i span font h1 h2 h3 h4 h5 h6 p div").toUpperCase(),/[ ,]/)),e.walk(t,function(e){var r;return 3==e.nodeType?(i(W.getParents(e.parentNode,null,t).reverse(),function(e){s[e.nodeName]&&(e=u(e,!1),o?r&&r.appendChild(e):o=r=e,r=e)}),r&&(r.innerHTML=n.ie&&n.ie<10?"&nbsp;":'<br data-mce-bogus="1" />'),!1):void 0},"childNodes"),t=u(t,!1),f(t,"rowSpan",1),f(t,"colSpan",1),o?t.appendChild(o):r.paddCell(t),t}function v(){var e,t=W.createRng();return i(W.select("tr",s),function(e){0===e.cells.length&&W.remove(e)}),0===W.select("tr",s).length?(t.setStartBefore(s),t.setEndBefore(s),z.setRng(t),void W.remove(s)):(i(W.select("thead,tbody,tfoot",s),function(e){0===e.rows.length&&W.remove(e)}),c(),void(I&&(e=L[Math.min(L.length-1,I.y)],e&&(z.select(e[Math.min(e.length-1,I.x)].elm,!0),z.collapse(!0)))))}function y(e,t,n,r){var i,o,a,s,l;for(i=L[t][e].elm.parentNode,a=1;n>=a;a++)if(i=W.getNext(i,"tr")){for(o=e;o>=0;o--)if(l=L[t+a][o].elm,l.parentNode==i){for(s=1;r>=s;s++)W.insertAfter(g(l),l);break}if(-1==o)for(s=1;r>=s;s++)i.insertBefore(g(i.cells[0]),i.cells[0])}}function b(){i(L,function(e,t){i(e,function(e,n){var r,i,a;if(h(e)&&(e=e.elm,r=o(e,"colspan"),i=o(e,"rowspan"),r>1||i>1)){for(f(e,"rowSpan",1),f(e,"colSpan",1),a=0;r-1>a;a++)W.insertAfter(g(e),e);y(n,t,i-1,r)}})})}function x(t,n,r){var o,a,s,l,u,m,p,g,y,x,C;if(t?(o=A(t),a=o.x,s=o.y,l=a+(n-1),u=s+(r-1)):(I=O=null,i(L,function(e,t){i(e,function(e,n){h(e)&&(I||(I={x:n,y:t}),O={x:n,y:t})})}),I&&(a=I.x,s=I.y,l=O.x,u=O.y)),g=d(a,s),y=d(l,u),g&&y&&g.part==y.part){for(b(),c(),g=d(a,s).elm,f(g,"colSpan",l-a+1),f(g,"rowSpan",u-s+1),p=s;u>=p;p++)for(m=a;l>=m;m++)L[p]&&L[p][m]&&(t=L[p][m].elm,t!=g&&(x=e.grep(t.childNodes),i(x,function(e){g.appendChild(e)}),x.length&&(x=e.grep(g.childNodes),C=0,i(x,function(e){"BR"==e.nodeName&&C++<x.length-1&&g.removeChild(e)})),W.remove(t)));v()}}function C(e){var n,r,a,s,l,c,d,m,p;if(i(L,function(t,r){return i(t,function(t){return h(t)&&(t=t.elm,l=t.parentNode,c=u(l,!1),n=r,e)?!1:void 0}),e?!n:void 0}),n!==t){for(s=0;s<L[0].length;s++)if(L[n][s]&&(r=L[n][s].elm,r!=a)){if(e){if(n>0&&L[n-1][s]&&(m=L[n-1][s].elm,p=o(m,"rowSpan"),p>1)){f(m,"rowSpan",p+1);continue}}else if(p=o(r,"rowspan"),p>1){f(r,"rowSpan",p+1);continue}d=g(r),f(d,"colSpan",r.colSpan),c.appendChild(d),a=r}c.hasChildNodes()&&(e?l.parentNode.insertBefore(c,l):W.insertAfter(c,l))}}function w(e){var t,n;i(L,function(n){return i(n,function(n,r){return h(n)&&(t=r,e)?!1:void 0}),e?!t:void 0}),i(L,function(r,i){var a,s,l;r[t]&&(a=r[t].elm,a!=n&&(l=o(a,"colspan"),s=o(a,"rowspan"),1==l?e?(a.parentNode.insertBefore(g(a),a),y(t,i,s-1,l)):(W.insertAfter(g(a),a),y(t,i,s-1,l)):f(a,"colSpan",a.colSpan+1),n=a))})}function N(t){return e.grep(E(t),h)}function E(e){var t=[];return i(e,function(e){i(e,function(e){t.push(e)})}),t}function _(){var t=[];if(l(s)){if(1==L[0].length)return;if(N(L).length==E(L).length)return}i(L,function(n){i(n,function(n,r){h(n)&&-1===e.inArray(t,r)&&(i(L,function(e){var t,n=e[r].elm;t=o(n,"colSpan"),t>1?f(n,"colSpan",t-1):W.remove(n)}),t.push(r))})}),v()}function S(){function e(e){var t,n;i(e.cells,function(e){var n=o(e,"rowSpan");n>1&&(f(e,"rowSpan",n-1),t=A(e),y(t.x,t.y,1,1))}),t=A(e.cells[0]),i(L[t.y],function(e){var t;e=e.elm,e!=n&&(t=o(e,"rowSpan"),1>=t?W.remove(e):f(e,"rowSpan",t-1),n=e)})}var t;t=m(),l(s)&&t.length==s.rows.length||(i(t.reverse(),function(t){e(t)}),v())}function k(){var e=m();if(!l(s)||e.length!=s.rows.length)return W.remove(e),v(),e}function T(){var e=m();return i(e,function(t,n){e[n]=u(t,!0)}),e}function R(e,t){var n=m(),r=n[t?0:n.length-1],o=r.cells.length;e&&(i(L,function(e){var t;return o=0,i(e,function(e){e.real&&(o+=e.colspan),e.elm.parentNode==r&&(t=1)}),t?!1:void 0}),t||e.reverse(),i(e,function(e){var n,i,a=e.cells.length;for(n=0;a>n;n++)i=e.cells[n],f(i,"colSpan",1),f(i,"rowSpan",1);for(n=a;o>n;n++)e.appendChild(g(e.cells[a-1]));for(n=o;a>n;n++)W.remove(e.cells[n]);t?r.parentNode.insertBefore(e,r):W.insertAfter(e,r)}),W.removeClass(W.select("td.mce-item-selected,th.mce-item-selected"),"mce-item-selected"))}function A(e){var t;return i(L,function(n,r){return i(n,function(n,i){return n.elm==e?(t={x:i,y:r},!1):void 0}),!t}),t}function B(e){I=A(e)}function D(){var e,t;return e=t=0,i(L,function(n,r){i(n,function(n,i){var o,a;h(n)&&(n=L[r][i],i>e&&(e=i),r>t&&(t=r),n.real&&(o=n.colspan-1,a=n.rowspan-1,o&&i+o>e&&(e=i+o),a&&r+a>t&&(t=r+a)))})}),{x:e,y:t}}function M(e){var t,n,r,i,o,a,s,l,c,u;if(O=A(e),I&&O){for(t=Math.min(I.x,O.x),n=Math.min(I.y,O.y),r=Math.max(I.x,O.x),i=Math.max(I.y,O.y),o=r,a=i,u=n;a>=u;u++)e=L[u][t],e.real||t-(e.colspan-1)<t&&(t-=e.colspan-1);for(c=t;o>=c;c++)e=L[n][c],e.real||n-(e.rowspan-1)<n&&(n-=e.rowspan-1);for(u=n;i>=u;u++)for(c=t;r>=c;c++)e=L[u][c],e.real&&(s=e.colspan-1,l=e.rowspan-1,s&&c+s>o&&(o=c+s),l&&u+l>a&&(a=u+l));for(W.removeClass(W.select("td.mce-item-selected,th.mce-item-selected"),"mce-item-selected"),u=n;a>=u;u++)for(c=t;o>=c;c++)L[u][c]&&W.addClass(L[u][c].elm,"mce-item-selected")}}function P(e,t){var n,r,i;n=A(e),r=n.y*H+n.x;do{if(r+=t,i=d(r%H,Math.floor(r/H)),!i)break;if(i.elm!=e)return z.select(i.elm,!0),W.isEmpty(i.elm)&&z.collapse(!0),!0}while(i.elm==e);return!1}var L,H,I,O,F,z=a.selection,W=z.dom;s=s||W.getParent(z.getStart(!0),"table"),c(),F=W.getParent(z.getStart(!0),"th,td"),F&&(I=A(F),O=D(),F=d(I.x,I.y)),e.extend(this,{deleteTable:p,split:b,merge:x,insertRow:C,insertCol:w,deleteCols:_,deleteRows:S,cutRows:k,copyRows:T,pasteRows:R,getPos:A,setStartCell:B,setEndCell:M,moveRelIdx:P,refresh:c})}}),r("tinymce/tableplugin/Quirks",["tinymce/util/VK","tinymce/util/Delay","tinymce/Env","tinymce/util/Tools","tinymce/tableplugin/Utils"],function(e,t,n,r,i){var o=r.each,a=i.getSpanVal;return function(s){function l(){function n(n){function r(e,t){var r=e?"previousSibling":"nextSibling",o=s.dom.getParent(t,"tr"),a=o[r];if(a)return v(s,t,a,e),n.preventDefault(),!0;var l=s.dom.getParent(o,"table"),d=o.parentNode,f=d.nodeName.toLowerCase();if("tbody"===f||f===(e?"tfoot":"thead")){var h=i(e,l,d,"tbody");if(null!==h)return c(e,h,t)}return u(e,o,r,l)}function i(e,t,n,r){var i=s.dom.select(">"+r,t),o=i.indexOf(n);if(e&&0===o||!e&&o===i.length-1)return l(e,t);if(-1===o){var a="thead"===n.tagName.toLowerCase()?0:i.length-1;return i[a]}return i[o+(e?-1:1)]}function l(e,t){var n=e?"thead":"tfoot",r=s.dom.select(">"+n,t);return 0!==r.length?r[0]:null}function c(e,t,r){var i=d(t,e);return i&&v(s,r,i,e),n.preventDefault(),!0}function u(e,t,i,o){var a=o[i];if(a)return f(a),!0;var l=s.dom.getParent(o,"td,th");if(l)return r(e,l,n);var c=d(t,!e);return f(c),n.preventDefault(),!1}function d(e,t){var n=e&&e[t?"lastChild":"firstChild"];return n&&"BR"===n.nodeName?s.dom.getParent(n,"td,th"):n}function f(e){s.selection.setCursorLocation(e,0)}function h(){return x==e.UP||x==e.DOWN}function m(e){var t=e.selection.getNode(),n=e.dom.getParent(t,"tr");return null!==n}function p(e){for(var t=0,n=e;n.previousSibling;)n=n.previousSibling,t+=a(n,"colspan");return t}function g(e,t){var n=0,r=0;return o(e.children,function(e,i){return n+=a(e,"colspan"),r=i,n>t?!1:void 0}),r}function v(e,t,n,r){var i=p(s.dom.getParent(t,"td,th")),o=g(n,i),a=n.childNodes[o],l=d(a,r);f(l||a)}function y(e){var t=s.selection.getNode(),n=s.dom.getParent(t,"td,th"),r=s.dom.getParent(e,"td,th");return n&&n!==r&&b(n,r)}function b(e,t){return s.dom.getParent(e,"TABLE")===s.dom.getParent(t,"TABLE")}var x=n.keyCode;if(h()&&m(s)){var C=s.selection.getNode();t.setEditorTimeout(s,function(){y(C)&&r(!n.shiftKey&&x===e.UP,C,n)},0)}}s.on("KeyDown",function(e){n(e)})}function c(){function e(e,t){var n,r=t.ownerDocument,i=r.createRange();return i.setStartBefore(t),i.setEnd(e.endContainer,e.endOffset),n=r.createElement("body"),n.appendChild(i.cloneContents()),0===n.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi,"-").replace(/<[^>]+>/g,"").length}s.on("KeyDown",function(t){var n,r,i=s.dom;(37==t.keyCode||38==t.keyCode)&&(n=s.selection.getRng(),r=i.getParent(n.startContainer,"table"),r&&s.getBody().firstChild==r&&e(n,r)&&(n=i.createRng(),n.setStartBefore(r),n.setEndBefore(r),s.selection.setRng(n),t.preventDefault()))})}function u(){s.on("KeyDown SetContent VisualAid",function(){var e;for(e=s.getBody().lastChild;e;e=e.previousSibling)if(3==e.nodeType){if(e.nodeValue.length>0)break}else if(1==e.nodeType&&("BR"==e.tagName||!e.getAttribute("data-mce-bogus")))break;e&&"TABLE"==e.nodeName&&(s.settings.forced_root_block?s.dom.add(s.getBody(),s.settings.forced_root_block,s.settings.forced_root_block_attrs,n.ie&&n.ie<10?"&nbsp;":'<br data-mce-bogus="1" />'):s.dom.add(s.getBody(),"br",{"data-mce-bogus":"1"}))}),s.on("PreProcess",function(e){var t=e.node.lastChild;t&&("BR"==t.nodeName||1==t.childNodes.length&&("BR"==t.firstChild.nodeName||"\xa0"==t.firstChild.nodeValue))&&t.previousSibling&&"TABLE"==t.previousSibling.nodeName&&s.dom.remove(t)})}function d(){function e(e,t,n,r){var i,o,a,s=3,l=e.dom.getParent(t.startContainer,"TABLE");return l&&(i=l.parentNode),o=t.startContainer.nodeType==s&&0===t.startOffset&&0===t.endOffset&&r&&("TR"==n.nodeName||n==i),a=("TD"==n.nodeName||"TH"==n.nodeName)&&!r,o||a}function t(){var t=s.selection.getRng(),n=s.selection.getNode(),r=s.dom.getParent(t.startContainer,"TD,TH");if(e(s,t,n,r)){r||(r=n);for(var i=r.lastChild;i.lastChild;)i=i.lastChild;3==i.nodeType&&(t.setEnd(i,i.data.length),s.selection.setRng(t))}}s.on("KeyDown",function(){t()}),s.on("MouseDown",function(e){2!=e.button&&t()})}function f(){function t(e){s.selection.select(e,!0),s.selection.collapse(!0)}function n(e){s.$(e).empty(),i.paddCell(e)}s.on("keydown",function(i){if((i.keyCode==e.DELETE||i.keyCode==e.BACKSPACE)&&!i.isDefaultPrevented()){var o,a,l,c;if(o=s.dom.getParent(s.selection.getStart(),"table")){if(a=s.dom.select("td,th",o),l=r.grep(a,function(e){return s.dom.hasClass(e,"mce-item-selected")}),0===l.length)return c=s.dom.getParent(s.selection.getStart(),"td,th"),void(s.selection.isCollapsed()&&c&&s.dom.isEmpty(c)&&(i.preventDefault(),n(c),t(c)));i.preventDefault(),s.undoManager.transact(function(){a.length==l.length?s.execCommand("mceTableDelete"):(r.each(l,n),t(l[0]))})}}})}f(),n.webkit&&(l(),d()),n.gecko&&(c(),u()),n.ie>9&&(c(),u())}}),r("tinymce/tableplugin/CellSelection",["tinymce/tableplugin/TableGrid","tinymce/dom/TreeWalker","tinymce/util/Tools"],function(e,t,n){return function(r){function i(e){r.getBody().style.webkitUserSelect="",(e||d)&&(r.dom.removeClass(r.dom.select("td.mce-item-selected,th.mce-item-selected"),"mce-item-selected"),d=!1)}function o(t){var n,i,o=t.target;if(!c&&s&&(a||o!=s)&&("TD"==o.nodeName||"TH"==o.nodeName)){i=u.getParent(o,"table"),i==l&&(a||(a=new e(r,i),a.setStartCell(s),r.getBody().style.webkitUserSelect="none"),a.setEndCell(o),d=!0),n=r.selection.getSel();try{n.removeAllRanges?n.removeAllRanges():n.empty()}catch(f){}t.preventDefault()}}var a,s,l,c,u=r.dom,d=!0;return r.on("MouseDown",function(e){2==e.button||c||(i(),s=u.getParent(e.target,"td,th"),l=u.getParent(s,"table"))}),r.on("mouseover",o),r.on("remove",function(){u.unbind(r.getDoc(),"mouseover",o)}),r.on("MouseUp",function(){function e(e,r){var o=new t(e,e);do{if(3==e.nodeType&&0!==n.trim(e.nodeValue).length)return void(r?i.setStart(e,0):i.setEnd(e,e.nodeValue.length));if("BR"==e.nodeName)return void(r?i.setStartBefore(e):i.setEndBefore(e))}while(e=r?o.next():o.prev())}var i,o,c,d,f,h=r.selection;if(s){if(a&&(r.getBody().style.webkitUserSelect=""),o=u.select("td.mce-item-selected,th.mce-item-selected"),o.length>0){i=u.createRng(),d=o[0],i.setStartBefore(d),i.setEndAfter(d),e(d,1),c=new t(d,u.getParent(o[0],"table"));do if("TD"==d.nodeName||"TH"==d.nodeName){if(!u.hasClass(d,"mce-item-selected"))break;f=d}while(d=c.next());e(f),h.setRng(i)}r.nodeChanged(),s=a=l=null}}),r.on("KeyUp Drop SetContent",function(e){i("setcontent"==e.type),s=a=l=null,c=!1}),r.on("ObjectResizeStart ObjectResized",function(e){c="objectresized"!=e.type}),{clear:i}}}),r("tinymce/tableplugin/Dialogs",["tinymce/util/Tools","tinymce/Env"],function(e,t){var n=e.each;return function(r){function i(){var e=r.settings.color_picker_callback;return e?function(){var t=this;e.call(r,function(e){t.value(e).fire("change")},t.value())}:void 0}function o(e){return{title:"Advanced",type:"form",defaults:{onchange:function(){d(e,this.parents().reverse()[0],"style"==this.name())}},items:[{label:"Style",name:"style",type:"textbox"},{type:"form",padding:0,formItemDefaults:{layout:"grid",alignH:["start","right"]},defaults:{size:7},items:[{label:"Border color",type:"colorbox",name:"borderColor",onaction:i()},{label:"Background color",type:"colorbox",name:"backgroundColor",onaction:i()}]}]}}function a(e){return e?e.replace(/px$/,""):""}function s(e){return/^[0-9]+$/.test(e)&&(e+="px"),e}function l(e){n("left center right".split(" "),function(t){r.formatter.remove("align"+t,{},e)})}function c(e){n("top middle bottom".split(" "),function(t){r.formatter.remove("valign"+t,{},e)})}function u(t,n,r){function i(t,r){return r=r||[],e.each(t,function(e){var t={text:e.text||e.title};e.menu?t.menu=i(e.menu):(t.value=e.value,n&&n(t)),r.push(t)}),r}return i(t,r||[])}function d(e,t,n){var r=t.toJSON(),i=e.parseStyle(r.style);n?(t.find("#borderColor").value(i["border-color"]||"")[0].fire("change"),t.find("#backgroundColor").value(i["background-color"]||"")[0].fire("change")):(i["border-color"]=r.borderColor,i["background-color"]=r.backgroundColor),t.find("#style").value(e.serializeStyle(e.parseStyle(e.serializeStyle(i))))}function f(e,t,n){var r=e.parseStyle(e.getAttrib(n,"style"));r["border-color"]&&(t.borderColor=r["border-color"]),r["background-color"]&&(t.backgroundColor=r["background-color"]),t.style=e.serializeStyle(r)}function h(e,t,r){var i=e.parseStyle(e.getAttrib(t,"style"));n(r,function(e){i[e.name]=e.value}),e.setAttrib(t,"style",e.serializeStyle(e.parseStyle(e.serializeStyle(i))))}var m=this;m.tableProps=function(){m.table(!0)},m.table=function(i){function c(){function n(e,t,r){if("TD"===e.tagName||"TH"===e.tagName)C.setStyle(e,t,r);else if(e.children)for(var i=0;i<e.children.length;i++)n(e.children[i],t,r)}var i;d(C,this),w=e.extend(w,this.toJSON()),w["class"]===!1&&delete w["class"],r.undoManager.transact(function(){if(p||(p=r.plugins.table.insertTable(w.cols||1,w.rows||1)),r.dom.setAttribs(p,{style:w.style,"class":w["class"]}),r.settings.table_style_by_css){if(x=[],x.push({name:"border",value:w.border}),x.push({name:"border-spacing",value:s(w.cellspacing)}),h(C,p,x),C.setAttribs(p,{"data-mce-border-color":w.borderColor,"data-mce-cell-padding":w.cellpadding,"data-mce-border":w.border}),p.children)for(var e=0;e<p.children.length;e++)n(p.children[e],"border",w.border),n(p.children[e],"padding",s(w.cellpadding))}else r.dom.setAttribs(p,{border:w.border,cellpadding:w.cellpadding,cellspacing:w.cellspacing});C.getAttrib(p,"width")&&!r.settings.table_style_by_css?C.setAttrib(p,"width",a(w.width)):C.setStyle(p,"width",s(w.width)),C.setStyle(p,"height",s(w.height)),i=C.select("caption",p)[0],i&&!w.caption&&C.remove(i),!i&&w.caption&&(i=C.create("caption"),i.innerHTML=t.ie?"\xa0":'<br data-mce-bogus="1"/>',p.insertBefore(i,p.firstChild)),l(p),w.align&&r.formatter.apply("align"+w.align,{},p),r.focus(),r.addVisual()})}function m(e,t){function n(e,n){for(var r=0;r<n.length;r++){var i=C.getStyle(n[r],t);if("undefined"==typeof e&&(e=i),e!=i)return""}return e}var i,o=r.dom.select("td,th",e);return i=n(i,o)}var p,g,v,y,b,x,C=r.dom,w={};i===!0?(p=C.getParent(r.selection.getStart(),"table"),p&&(w={width:a(C.getStyle(p,"width")||C.getAttrib(p,"width")),height:a(C.getStyle(p,"height")||C.getAttrib(p,"height")),cellspacing:a(C.getStyle(p,"border-spacing")||C.getAttrib(p,"cellspacing")),cellpadding:C.getAttrib(p,"data-mce-cell-padding")||C.getAttrib(p,"cellpadding")||m(p,"padding"),border:C.getAttrib(p,"data-mce-border")||C.getAttrib(p,"border")||m(p,"border"),borderColor:C.getAttrib(p,"data-mce-border-color"),caption:!!C.select("caption",p)[0],"class":C.getAttrib(p,"class")},n("left center right".split(" "),function(e){r.formatter.matchNode(p,"align"+e)&&(w.align=e)}))):(g={label:"Cols",name:"cols"},v={label:"Rows",name:"rows"}),r.settings.table_class_list&&(w["class"]&&(w["class"]=w["class"].replace(/\s*mce\-item\-table\s*/g,"")),y={name:"class",type:"listbox",label:"Class",values:u(r.settings.table_class_list,function(e){e.value&&(e.textStyle=function(){return r.formatter.getCssText({block:"table",classes:[e.value]})})})}),b={type:"form",layout:"flex",direction:"column",labelGapCalc:"children",padding:0,items:[{type:"form",labelGapCalc:!1,padding:0,layout:"grid",columns:2,defaults:{type:"textbox",maxWidth:50},items:r.settings.table_appearance_options!==!1?[g,v,{label:"Width",name:"width"},{label:"Height",name:"height"},{label:"Cell spacing",name:"cellspacing"},{label:"Cell padding",name:"cellpadding"},{label:"Border",name:"border"},{label:"Caption",name:"caption",type:"checkbox"}]:[g,v,{label:"Width",name:"width"},{label:"Height",name:"height"}]},{label:"Alignment",name:"align",type:"listbox",text:"None",values:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},y]},r.settings.table_advtab!==!1?(f(C,w,p),r.windowManager.open({title:"Table properties",data:w,bodyType:"tabpanel",body:[{title:"General",type:"form",items:b},o(C)],onsubmit:c})):r.windowManager.open({title:"Table properties",data:w,body:b,onsubmit:c})},m.merge=function(e,t){r.windowManager.open({title:"Merge cells",body:[{label:"Cols",name:"cols",type:"textbox",value:"1",size:10},{label:"Rows",name:"rows",type:"textbox",value:"1",size:10}],onsubmit:function(){var n=this.toJSON();r.undoManager.transact(function(){e.merge(t,n.cols,n.rows)})}})},m.cell=function(){function t(){d(p,this),h=e.extend(h,this.toJSON()),r.undoManager.transact(function(){n(g,function(e){r.dom.setAttribs(e,{scope:h.scope,style:h.style,"class":h["class"]}),r.dom.setStyles(e,{width:s(h.width),height:s(h.height)}),h.type&&e.nodeName.toLowerCase()!=h.type&&(e=p.rename(e,h.type)),l(e),h.align&&r.formatter.apply("align"+h.align,{},e),c(e),h.valign&&r.formatter.apply("valign"+h.valign,{},e)}),r.focus()})}var i,h,m,p=r.dom,g=[];if(g=r.dom.select("td.mce-item-selected,th.mce-item-selected"),i=r.dom.getParent(r.selection.getStart(),"td,th"),!g.length&&i&&g.push(i),i=i||g[0]){h={width:a(p.getStyle(i,"width")||p.getAttrib(i,"width")),height:a(p.getStyle(i,"height")||p.getAttrib(i,"height")),scope:p.getAttrib(i,"scope"),"class":p.getAttrib(i,"class")},h.type=i.nodeName.toLowerCase(),n("left center right".split(" "),function(e){r.formatter.matchNode(i,"align"+e)&&(h.align=e)}),n("top middle bottom".split(" "),function(e){r.formatter.matchNode(i,"valign"+e)&&(h.valign=e)}),r.settings.table_cell_class_list&&(m={name:"class",type:"listbox",label:"Class",values:u(r.settings.table_cell_class_list,function(e){e.value&&(e.textStyle=function(){return r.formatter.getCssText({block:"td",classes:[e.value]})})})});var v={type:"form",layout:"flex",direction:"column",labelGapCalc:"children",padding:0,items:[{type:"form",layout:"grid",columns:2,labelGapCalc:!1,padding:0,defaults:{type:"textbox",maxWidth:50},items:[{label:"Width",name:"width"},{label:"Height",name:"height"},{label:"Cell type",name:"type",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"Cell",value:"td"},{text:"Header cell",value:"th"}]},{label:"Scope",name:"scope",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"None",value:""},{text:"Row",value:"row"},{text:"Column",value:"col"},{text:"Row group",value:"rowgroup"},{text:"Column group",value:"colgroup"}]},{label:"H Align",name:"align",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},{label:"V Align",name:"valign",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"None",value:""},{text:"Top",value:"top"},{text:"Middle",value:"middle"},{text:"Bottom",value:"bottom"}]}]},m]};r.settings.table_cell_advtab!==!1?(f(p,h,i),r.windowManager.open({title:"Cell properties",bodyType:"tabpanel",data:h,body:[{title:"General",type:"form",items:v},o(p)],onsubmit:t})):r.windowManager.open({title:"Cell properties",data:h,body:v,onsubmit:t})}},m.row=function(){function t(){var t,i,o;d(v,this),p=e.extend(p,this.toJSON()),r.undoManager.transact(function(){var e=p.type;n(y,function(n){r.dom.setAttribs(n,{scope:p.scope,style:p.style,"class":p["class"]}),r.dom.setStyles(n,{height:s(p.height)}),e!=n.parentNode.nodeName.toLowerCase()&&(t=v.getParent(n,"table"),i=n.parentNode,o=v.select(e,t)[0],o||(o=v.create(e),t.firstChild?t.insertBefore(o,t.firstChild):t.appendChild(o)),o.appendChild(n),i.hasChildNodes()||v.remove(i)),l(n),p.align&&r.formatter.apply("align"+p.align,{},n)}),r.focus()})}var i,c,h,m,p,g,v=r.dom,y=[];i=r.dom.getParent(r.selection.getStart(),"table"),c=r.dom.getParent(r.selection.getStart(),"td,th"),n(i.rows,function(e){n(e.cells,function(t){return v.hasClass(t,"mce-item-selected")||t==c?(y.push(e),!1):void 0})}),h=y[0],h&&(p={height:a(v.getStyle(h,"height")||v.getAttrib(h,"height")),scope:v.getAttrib(h,"scope"),"class":v.getAttrib(h,"class")},p.type=h.parentNode.nodeName.toLowerCase(),n("left center right".split(" "),function(e){r.formatter.matchNode(h,"align"+e)&&(p.align=e)}),r.settings.table_row_class_list&&(m={name:"class",type:"listbox",label:"Class",values:u(r.settings.table_row_class_list,function(e){e.value&&(e.textStyle=function(){return r.formatter.getCssText({block:"tr",classes:[e.value]})})})}),g={type:"form",columns:2,padding:0,defaults:{type:"textbox"},items:[{type:"listbox",name:"type",label:"Row type",text:"None",maxWidth:null,values:[{text:"Header",value:"thead"},{text:"Body",value:"tbody"},{text:"Footer",value:"tfoot"}]},{type:"listbox",name:"align",label:"Alignment",text:"None",maxWidth:null,values:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},{label:"Height",name:"height"},m]},r.settings.table_row_advtab!==!1?(f(v,p,h),r.windowManager.open({title:"Row properties",data:p,bodyType:"tabpanel",body:[{title:"General",type:"form",items:g},o(v)],onsubmit:t})):r.windowManager.open({title:"Row properties",data:p,body:g,onsubmit:t}))}}}),r("tinymce/tableplugin/ResizeBars",["tinymce/util/Tools","tinymce/util/VK"],function(e,n){return function(r){function i(e,t){return{index:e,y:r.dom.getPos(t).y}}function o(e,t){return{index:e,y:r.dom.getPos(t).y+t.offsetHeight}}function a(e,t){return{index:e,x:r.dom.getPos(t).x}}function s(e,t){return{index:e,x:r.dom.getPos(t).x+t.offsetWidth}}function l(){var e=r.getBody().dir;return"rtl"===e}function c(){return r.inline}function u(){return c?r.getBody().ownerDocument.body:r.getBody()}function d(e,t){return l()?s(e,t):a(e,t)}function f(e,t){return l()?a(e,t):s(e,t)}function h(e,t){return m(e,"width")/m(t,"width")*100}function m(e,t){var n=r.dom.getStyle(e,t,!0),i=parseInt(n,10);return i}function p(e){var t=m(e,"width"),n=m(e.parentElement,"width");return t/n*100}function g(e,t){var n=m(e,"width");return t/n*100}function v(e,t){var n=m(e.parentElement,"width");return t/n*100}function y(e,t,n){for(var r=[],i=1;i<n.length;i++){var o=n[i].element;r.push(e(i-1,o))}var a=n[n.length-1];return r.push(t(n.length-1,a.element)),r}function b(){var t=r.dom.select("."+de,u());e.each(t,function(e){r.dom.remove(e)})}function x(e){b(),A(e)}function C(e,t,n,r,i,o,a,s){var l={"data-mce-bogus":"all","class":de+" "+e,unselectable:"on","data-mce-resize":!1,style:"cursor: "+t+"; margin: 0; padding: 0; position: absolute; left: "+n+"px; top: "+r+"px; height: "+i+"px; width: "+o+"px; "};return l[a]=s,l}function w(t,n,i){e.each(t,function(e){var t=i.x,o=e.y-xe/2,a=xe,s=n;r.dom.add(u(),"div",C(fe,he,t,o,a,s,me,e.index))})}function N(t,n,i){e.each(t,function(e){var t=e.x-xe/2,o=i.y,a=n,s=xe;r.dom.add(u(),"div",C(ge,ve,t,o,a,s,ye,e.index))})}function E(t){return e.map(t.rows,function(t){var n=e.map(t.cells,function(e){var t=e.hasAttribute("rowspan")?parseInt(e.getAttribute("rowspan"),10):1,n=e.hasAttribute("colspan")?parseInt(e.getAttribute("colspan"),10):1;return{element:e,rowspan:t,colspan:n}});return{element:t,cells:n}})}function _(n){function r(e,t){return e+","+t}function i(e,t){return s[r(e,t)]}function o(){var t=[];return e.each(l,function(e){t=t.concat(e.cells)}),t}function a(){return l}var s={},l=[],c=0,u=0;return e.each(n,function(n,i){var o=[];e.each(n.cells,function(e){for(var n=0;s[r(i,n)]!==t;)n++;for(var a={element:e.element,colspan:e.colspan,rowspan:e.rowspan,rowIndex:i,colIndex:n},l=0;l<e.colspan;l++)for(var d=0;d<e.rowspan;d++){var f=i+d,h=n+l;s[r(f,h)]=a,c=Math.max(c,f+1),u=Math.max(u,h+1)}o.push(a)}),l.push({element:n.element,cells:o})}),{grid:{maxRows:c,maxCols:u},getAt:i,getAllCells:o,getAllRows:a}}function S(e,t){for(var n=[],r=e;t>r;r++)n.push(r);return n}function k(e,t,n){for(var r,i=e(),o=0;o<i.length;o++)t(i[o])&&(r=i[o]);return r?r:n()}function T(t){var n=S(0,t.grid.maxCols),r=S(0,t.grid.maxRows);return e.map(n,function(e){function n(){for(var n=[],i=0;i<r.length;i++){var o=t.getAt(i,e);o&&o.colIndex===e&&n.push(o)}return n}function i(e){return 1===e.colspan}function o(){for(var n,i=0;i<r.length;i++)if(n=t.getAt(i,e))return n;return null}return k(n,i,o)})}function R(t){var n=S(0,t.grid.maxCols),r=S(0,t.grid.maxRows);return e.map(r,function(e){function r(){for(var r=[],i=0;i<n.length;i++){var o=t.getAt(e,i);o&&o.rowIndex===e&&r.push(o)}return r}function i(e){return 1===e.rowspan}function o(){return t.getAt(e,0)}return k(r,i,o)})}function A(e){var t=E(e),n=_(t),a=R(n),s=T(n),l=r.dom.getPos(e),c=a.length>0?y(i,o,a):[],u=s.length>0?y(d,f,s):[];w(c,e.offsetWidth,l),N(u,e.offsetHeight,l)}function B(e,t,n,r){if(0>t||t>=e.length-1)return"";var i=e[t];if(i)i={value:i,delta:0};else for(var o=e.slice(0,t).reverse(),a=0;a<o.length;a++)o[a]&&(i={value:o[a],delta:a+1});var s=e[t+1];if(s)s={value:s,delta:1};else for(var l=e.slice(t+1),c=0;c<l.length;c++)l[c]&&(s={value:l[c],delta:c+1});var u=s.delta-i.delta,d=Math.abs(s.value-i.value)/u;return n?d/m(r,"width")*100:d}function D(e,t){var n=r.dom.getStyle(e,t);return n||(n=r.dom.getAttrib(e,t)),n||(n=r.dom.getStyle(e,t,!0)),n}function M(e,t,n){var r=D(e,"width"),i=parseInt(r,10),o=t?h(e,n):m(e,"width");return(t&&!U(r)||!t&&!V(r))&&(i=0),!isNaN(i)&&i>0?i:o}function P(t,n,r){for(var i=T(t),o=e.map(i,function(e){return d(e.colIndex,e.element).x}),a=[],s=0;s<i.length;s++){var l=i[s].element.hasAttribute("colspan")?parseInt(i[s].element.getAttribute("colspan"),10):1,c=l>1?B(o,s):M(i[s].element,n,r);c=c?c:Ce,a.push(c)}return a}function L(e){var t=D(e,"height"),n=parseInt(t,10);return U(t)&&(n=0),!isNaN(n)&&n>0?n:m(e,"height")}function H(t){for(var n=R(t),r=e.map(n,function(e){return i(e.rowIndex,e.element).y}),o=[],a=0;a<n.length;a++){var s=n[a].element.hasAttribute("rowspan")?parseInt(n[a].element.getAttribute("rowspan"),10):1,l=s>1?B(r,a):L(n[a].element);l=l?l:we,o.push(l)}return o}function I(t,n,r,i,o){function a(t){return e.map(t,function(){return 0})}function s(){var e;if(o)e=[100-d[0]];else{var t=Math.max(i,d[0]+r);e=[t-d[0]]}return e}function l(e,t){var n,o=a(d.slice(0,e)),s=a(d.slice(t+1));if(r>=0){var l=Math.max(i,d[t]-r);n=o.concat([r,l-d[t]]).concat(s)}else{var c=Math.max(i,d[e]+r),u=d[e]-c;n=o.concat([c-d[e],u]).concat(s)}return n}function c(e,t){var n,o=a(d.slice(0,t));if(r>=0)n=o.concat([r]);else{var s=Math.max(i,d[t]+r);n=o.concat([s-d[t]])}return n}var u,d=t.slice(0);return u=0===t.length?[]:1===t.length?s():0===n?l(0,1):n>0&&n<t.length-1?l(n,n+1):n===t.length-1?c(n-1,n):[]}function O(e,t,n){for(var r=0,i=e;t>i;i++)r+=n[i];return r}function F(t,n){var r=t.getAllCells();return e.map(r,function(e){var t=O(e.colIndex,e.colIndex+e.colspan,n);return{element:e.element,width:t,colspan:e.colspan}})}function z(t,n){var r=t.getAllCells();return e.map(r,function(e){var t=O(e.rowIndex,e.rowIndex+e.rowspan,n);return{element:e.element,height:t,rowspan:e.rowspan}})}function W(t,n){var r=t.getAllRows();return e.map(r,function(e,t){return{element:e.element,height:n[t]}})}function U(e){return Ee.test(e)}function V(e){return _e.test(e)}function $(t,n,i){function o(t,n){e.each(t,function(e){r.dom.setStyle(e.element,"width",e.width+n),r.dom.setAttrib(e.element,"width",null)})}function a(){return i<u.grid.maxCols-1?p(t):p(t)+v(t,n)}function s(){return i<u.grid.maxCols-1?m(t,"width"):m(t,"width")+n}function l(e,n,o){i!=u.grid.maxCols-1&&o||(r.dom.setStyle(t,"width",e+n),r.dom.setAttrib(t,"width",null))}for(var c=E(t),u=_(c),d=U(t.width)||U(t.style.width),f=P(u,d,t),h=d?g(t,n):n,y=I(f,i,h,Ce,d,t),b=[],x=0;x<y.length;x++)b.push(y[x]+f[x]);var C=F(u,b),w=d?"%":"px",N=d?a():s();r.undoManager.transact(function(){o(C,w),l(N,w,d)})}function j(t,n,i){for(var o=E(t),a=_(o),s=H(a),l=[],c=0,u=0;u<s.length;u++)l.push(u===i?n+s[u]:s[u]),c+=c[u];var d=z(a,l),f=W(a,l);r.undoManager.transact(function(){e.each(f,function(e){r.dom.setStyle(e.element,"height",e.height+"px"),r.dom.setAttrib(e.element,"height",null)}),e.each(d,function(e){r.dom.setStyle(e.element,"height",e.height+"px"),r.dom.setAttrib(e.element,"height",null)}),r.dom.setStyle(t,"height",c+"px"),r.dom.setAttrib(t,"height",null)})}function q(){ie=setTimeout(function(){G()},200)}function Y(){clearTimeout(ie)}function X(){var e=document.createElement("div");return e.setAttribute("style","margin: 0; padding: 0; position: fixed; left: 0px; top: 0px; height: 100%; width: 100%;"),e.setAttribute("data-mce-bogus","all"),e}function K(e,t){r.dom.bind(e,"mouseup",function(){G()}),r.dom.bind(e,"mousemove",function(e){Y(),oe&&t(e)}),r.dom.bind(e,"mouseout",function(){q()})}function G(){if(r.dom.remove(ae),oe){r.dom.removeClass(se,Ne),oe=!1;var e,t;if(Q(se)){var n=parseInt(r.dom.getAttrib(se,be),10),i=r.dom.getPos(se).x;e=parseInt(r.dom.getAttrib(se,ye),10),t=l()?n-i:i-n,$(ue,t,e)}else if(Z(se)){var o=parseInt(r.dom.getAttrib(se,pe),10),a=r.dom.getPos(se).y;e=parseInt(r.dom.getAttrib(se,me),10), t=a-o,j(ue,t,e)}x(ue),r.nodeChanged()}}function J(e,t){ae=ae?ae:X(),oe=!0,r.dom.addClass(e,Ne),se=e,K(ae,t),r.dom.add(u(),ae)}function Q(e){return r.dom.hasClass(e,ge)}function Z(e){return r.dom.hasClass(e,fe)}function ee(e){le=le!==t?le:e.clientX;var n=e.clientX-le;le=e.clientX;var i=r.dom.getPos(se).x;r.dom.setStyle(se,"left",i+n+"px")}function te(e){ce=ce!==t?ce:e.clientY;var n=e.clientY-ce;ce=e.clientY;var i=r.dom.getPos(se).y;r.dom.setStyle(se,"top",i+n+"px")}function ne(e){le=t,J(e,ee)}function re(e){ce=t,J(e,te)}var ie,oe,ae,se,le,ce,ue,de="mce-resize-bar",fe="mce-resize-bar-row",he="row-resize",me="data-row",pe="data-initial-top",ge="mce-resize-bar-col",ve="col-resize",ye="data-col",be="data-initial-left",xe=4,Ce=10,we=10,Ne="mce-resize-bar-dragging",Ee=new RegExp(/(\d+(\.\d+)?%)/),_e=new RegExp(/px|em/);return r.on("init",function(){r.dom.bind(u(),"mousedown",function(e){var t=e.target;if(Q(t)){e.preventDefault();var n=r.dom.getPos(t).x;r.dom.setAttrib(t,be,n),ne(t)}else if(Z(t)){e.preventDefault();var i=r.dom.getPos(t).y;r.dom.setAttrib(t,pe,i),re(t)}})}),r.on("ObjectResized",function(t){var n=t.target;if("TABLE"===n.nodeName){var i=[];e.each(n.rows,function(t){e.each(t.cells,function(e){var t=r.dom.getStyle(e,"width",!0);i.push({cell:e,width:t})})}),e.each(i,function(e){r.dom.setStyle(e.cell,"width",e.width),r.dom.setAttrib(e.cell,"width",null)})}}),r.on("mouseover",function(e){if(!oe){var t=r.dom.getParent(e.target,"table");("table"===e.target.nodeName||t)&&(ue=t,x(t))}}),r.on("keydown",function(e){switch(e.keyCode){case n.LEFT:case n.RIGHT:case n.UP:case n.DOWN:b()}}),{adjustWidth:$,adjustHeight:j,clearBars:b,drawBars:A,determineDeltas:I,getTableGrid:_,getTableDetails:E,getWidths:P,getPixelHeights:H,isPercentageBasedSize:U,isPixelBasedSize:V,recalculateWidths:F,recalculateCellHeights:z,recalculateRowHeights:W}}}),r("tinymce/tableplugin/Plugin",["tinymce/tableplugin/TableGrid","tinymce/tableplugin/Quirks","tinymce/tableplugin/CellSelection","tinymce/tableplugin/Dialogs","tinymce/tableplugin/ResizeBars","tinymce/util/Tools","tinymce/dom/TreeWalker","tinymce/Env","tinymce/PluginManager"],function(e,t,n,r,i,o,a,s,l){function c(o){function a(e){return function(){o.execCommand(e)}}function l(e,t){var n,r,i,a;for(i='<table id="__mce"><tbody>',n=0;t>n;n++){for(i+="<tr>",r=0;e>r;r++)i+="<td>"+(s.ie&&s.ie<10?"&nbsp;":"<br>")+"</td>";i+="</tr>"}return i+="</tbody></table>",o.undoManager.transact(function(){o.insertContent(i),a=o.dom.get("__mce"),o.dom.setAttrib(a,"id",null),o.dom.setAttribs(a,o.settings.table_default_attributes||{}),o.dom.setStyles(a,o.settings.table_default_styles||{})}),a}function c(e,t){function n(){e.disabled(!o.dom.getParent(o.selection.getStart(),t)),o.selection.selectorChanged(t,function(t){e.disabled(!t)})}o.initialized?n():o.on("init",n)}function d(){c(this,"table")}function f(){c(this,"td,th")}function h(){var e="";e='<table role="grid" class="mce-grid mce-grid-border" aria-readonly="true">';for(var t=0;10>t;t++){e+="<tr>";for(var n=0;10>n;n++)e+='<td role="gridcell" tabindex="-1"><a id="mcegrid'+(10*t+n)+'" href="#" data-mce-x="'+n+'" data-mce-y="'+t+'"></a></td>';e+="</tr>"}return e+="</table>",e+='<div class="mce-text-center" role="presentation">1 x 1</div>'}function m(e,t,n){var r,i,a,s,l,c=n.getEl().getElementsByTagName("table")[0],u=n.isRtl()||"tl-tr"==n.parent().rel;for(c.nextSibling.innerHTML=e+1+" x "+(t+1),u&&(e=9-e),i=0;10>i;i++)for(r=0;10>r;r++)s=c.rows[i].childNodes[r].firstChild,l=(u?r>=e:e>=r)&&t>=i,o.dom.toggleClass(s,"mce-active",l),l&&(a=s);return a.parentNode}function p(){o.addButton("tableprops",{title:"Table properties",onclick:C.tableProps,icon:"table"}),o.addButton("tabledelete",{title:"Delete table",onclick:a("mceTableDelete")}),o.addButton("tablecellprops",{title:"Cell properties",onclick:a("mceTableCellProps")}),o.addButton("tablemergecells",{title:"Merge cells",onclick:a("mceTableMergeCells")}),o.addButton("tablesplitcells",{title:"Split cell",onclick:a("mceTableSplitCells")}),o.addButton("tableinsertrowbefore",{title:"Insert row before",onclick:a("mceTableInsertRowBefore")}),o.addButton("tableinsertrowafter",{title:"Insert row after",onclick:a("mceTableInsertRowAfter")}),o.addButton("tabledeleterow",{title:"Delete row",onclick:a("mceTableDeleteRow")}),o.addButton("tablerowprops",{title:"Row properties",onclick:a("mceTableRowProps")}),o.addButton("tablecutrow",{title:"Cut row",onclick:a("mceTableCutRow")}),o.addButton("tablecopyrow",{title:"Copy row",onclick:a("mceTableCopyRow")}),o.addButton("tablepasterowbefore",{title:"Paste row before",onclick:a("mceTablePasteRowBefore")}),o.addButton("tablepasterowafter",{title:"Paste row after",onclick:a("mceTablePasteRowAfter")}),o.addButton("tableinsertcolbefore",{title:"Insert column before",onclick:a("mceTableInsertColBefore")}),o.addButton("tableinsertcolafter",{title:"Insert column after",onclick:a("mceTableInsertColAfter")}),o.addButton("tabledeletecol",{title:"Delete column",onclick:a("mceTableDeleteCol")})}function g(e){var t=o.dom.is(e,"table")&&o.getBody().contains(e);return t}function v(){var e=o.settings.table_toolbar;""!==e&&e!==!1&&(e||(e="tableprops tabledelete | tableinsertrowbefore tableinsertrowafter tabledeleterow | tableinsertcolbefore tableinsertcolafter tabledeletecol"),o.addContextToolbar(g,e))}var y,b,x=this,C=new r(o);!o.settings.object_resizing||o.settings.table_resize_bars===!1||o.settings.object_resizing!==!0&&"table"!==o.settings.object_resizing||(b=i(o)),o.settings.table_grid===!1?o.addMenuItem("inserttable",{text:"Insert table",icon:"table",context:"table",onclick:C.table}):o.addMenuItem("inserttable",{text:"Insert table",icon:"table",context:"table",ariaHideMenu:!0,onclick:function(e){e.aria&&(this.parent().hideAll(),e.stopImmediatePropagation(),C.table())},onshow:function(){m(0,0,this.menu.items()[0])},onhide:function(){var e=this.menu.items()[0].getEl().getElementsByTagName("a");o.dom.removeClass(e,"mce-active"),o.dom.addClass(e[0],"mce-active")},menu:[{type:"container",html:h(),onPostRender:function(){this.lastX=this.lastY=0},onmousemove:function(e){var t,n,r=e.target;"A"==r.tagName.toUpperCase()&&(t=parseInt(r.getAttribute("data-mce-x"),10),n=parseInt(r.getAttribute("data-mce-y"),10),(this.isRtl()||"tl-tr"==this.parent().rel)&&(t=9-t),(t!==this.lastX||n!==this.lastY)&&(m(t,n,e.control),this.lastX=t,this.lastY=n))},onclick:function(e){var t=this;"A"==e.target.tagName.toUpperCase()&&(e.preventDefault(),e.stopPropagation(),t.parent().cancel(),o.undoManager.transact(function(){l(t.lastX+1,t.lastY+1)}),o.addVisual())}}]}),o.addMenuItem("tableprops",{text:"Table properties",context:"table",onPostRender:d,onclick:C.tableProps}),o.addMenuItem("deletetable",{text:"Delete table",context:"table",onPostRender:d,cmd:"mceTableDelete"}),o.addMenuItem("cell",{separator:"before",text:"Cell",context:"table",menu:[{text:"Cell properties",onclick:a("mceTableCellProps"),onPostRender:f},{text:"Merge cells",onclick:a("mceTableMergeCells"),onPostRender:f},{text:"Split cell",onclick:a("mceTableSplitCells"),onPostRender:f}]}),o.addMenuItem("row",{text:"Row",context:"table",menu:[{text:"Insert row before",onclick:a("mceTableInsertRowBefore"),onPostRender:f},{text:"Insert row after",onclick:a("mceTableInsertRowAfter"),onPostRender:f},{text:"Delete row",onclick:a("mceTableDeleteRow"),onPostRender:f},{text:"Row properties",onclick:a("mceTableRowProps"),onPostRender:f},{text:"-"},{text:"Cut row",onclick:a("mceTableCutRow"),onPostRender:f},{text:"Copy row",onclick:a("mceTableCopyRow"),onPostRender:f},{text:"Paste row before",onclick:a("mceTablePasteRowBefore"),onPostRender:f},{text:"Paste row after",onclick:a("mceTablePasteRowAfter"),onPostRender:f}]}),o.addMenuItem("column",{text:"Column",context:"table",menu:[{text:"Insert column before",onclick:a("mceTableInsertColBefore"),onPostRender:f},{text:"Insert column after",onclick:a("mceTableInsertColAfter"),onPostRender:f},{text:"Delete column",onclick:a("mceTableDeleteCol"),onPostRender:f}]});var w=[];u("inserttable tableprops deletetable | cell row column".split(" "),function(e){"|"==e?w.push({text:"-"}):w.push(o.menuItems[e])}),o.addButton("table",{type:"menubutton",title:"Table",menu:w}),s.isIE||o.on("click",function(e){e=e.target,"TABLE"===e.nodeName&&(o.selection.select(e),o.nodeChanged())}),x.quirks=new t(o),o.on("Init",function(){x.cellSelection=new n(o),x.resizeBars=b}),o.on("PreInit",function(){o.serializer.addAttributeFilter("data-mce-cell-padding,data-mce-border,data-mce-border-color",function(e,t){for(var n=e.length;n--;)e[n].attr(t,null)})}),u({mceTableSplitCells:function(e){e.split()},mceTableMergeCells:function(e){var t;t=o.dom.getParent(o.selection.getStart(),"th,td"),o.dom.select("td.mce-item-selected,th.mce-item-selected").length?e.merge():C.merge(e,t)},mceTableInsertRowBefore:function(e){e.insertRow(!0)},mceTableInsertRowAfter:function(e){e.insertRow()},mceTableInsertColBefore:function(e){e.insertCol(!0)},mceTableInsertColAfter:function(e){e.insertCol()},mceTableDeleteCol:function(e){e.deleteCols()},mceTableDeleteRow:function(e){e.deleteRows()},mceTableCutRow:function(e){y=e.cutRows()},mceTableCopyRow:function(e){y=e.copyRows()},mceTablePasteRowBefore:function(e){e.pasteRows(y,!0)},mceTablePasteRowAfter:function(e){e.pasteRows(y)},mceTableDelete:function(e){b&&b.clearBars(),e.deleteTable()}},function(t,n){o.addCommand(n,function(){var n=new e(o);n&&(t(n),o.execCommand("mceRepaint"),x.cellSelection.clear())})}),u({mceInsertTable:C.table,mceTableProps:function(){C.table(!0)},mceTableRowProps:C.row,mceTableCellProps:C.cell},function(e,t){o.addCommand(t,function(t,n){e(n)})}),p(),v(),o.settings.table_tab_navigation!==!1&&o.on("keydown",function(t){var n,r,i;9==t.keyCode&&(n=o.dom.getParent(o.selection.getStart(),"th,td"),n&&(t.preventDefault(),r=new e(o),i=t.shiftKey?-1:1,o.undoManager.transact(function(){!r.moveRelIdx(n,i)&&i>0&&(r.insertRow(),r.refresh(),r.moveRelIdx(n,i))})))}),x.insertTable=l}var u=o.each;l.add("table",c)})}(this);