/*! Copyright 2010-2019 SpryMedia Ltd. This source file is free software, available under the following license: MIT license - http://datatables.net/license/mit This source file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details. For details please refer to: http://www.datatables.net ColReorder 1.5.2 ©2010-2019 SpryMedia Ltd - datatables.net/license */ (function(d){"function"===typeof define&&define.amd?define(["jquery","datatables.net"],function(t){return d(t,window,document)}):"object"===typeof exports?module.exports=function(t,r){t||(t=window);r&&r.fn.dataTable||(r=require("datatables.net")(t,r).$);return d(r,t,t.document)}:d(jQuery,window,document)})(function(d,t,r,w){function v(a){for(var b=[],c=0,d=a.length;cb||b>=n)this.oApi._fnLog(a,1,"ColReorder 'from' index is out of bounds: "+b);else if(0>c||c>=n)this.oApi._fnLog(a,1,"ColReorder 'to' index is out of bounds: "+ c);else{var l=[];var e=0;for(f=n;ethis.s.fixed-1&&gMath.pow(Math.pow(this._fnCursorPosition(a, "pageX")-this.s.mouse.startX,2)+Math.pow(this._fnCursorPosition(a,"pageY")-this.s.mouse.startY,2),.5))return;this._fnCreateDragNode()}this.dom.drag.css({left:this._fnCursorPosition(a,"pageX")-this.s.mouse.offsetX,top:this._fnCursorPosition(a,"pageY")-this.s.mouse.offsetY});var c=this.s.mouse.toIndex;a=this._fnCursorPosition(a,"pageX");for(var d=function(a){for(;0<=a;){a--;if(0>=a)return null;if(b.s.aoTargets[a+1].x!==b.s.aoTargets[a].x)return b.s.aoTargets[a]}},h=function(){for(var a=0;aq){l=n;break}}l?(this.dom.pointer.css("left",l.x),this.s.mouse.toIndex=l.to):(this.dom.pointer.css("left",f().x),this.s.mouse.toIndex=f().to);this.s.init.bRealtime&& c!==this.s.mouse.toIndex&&(this.s.dt.oInstance.fnColReorder(this.s.mouse.fromIndex,this.s.mouse.toIndex),this.s.mouse.fromIndex=this.s.mouse.toIndex,""===this.s.dt.oScroll.sX&&""===this.s.dt.oScroll.sY||this.s.dt.oInstance.fnAdjustColumnSizing(!1),this._fnRegions())},_fnMouseUp:function(a){d(r).off(".ColReorder");null!==this.dom.drag&&(this.dom.drag.remove(),this.dom.pointer.remove(),this.dom.drag=null,this.dom.pointer=null,this.s.dt.oInstance.fnColReorder(this.s.mouse.fromIndex,this.s.mouse.toIndex, !0),this._fnSetColumnIndexes(),""===this.s.dt.oScroll.sX&&""===this.s.dt.oScroll.sY||this.s.dt.oInstance.fnAdjustColumnSizing(!1),this.s.dt.oInstance.oApi._fnSaveState(this.s.dt),null!==this.s.reorderCallback&&this.s.reorderCallback.call(this))},_fnRegions:function(){var a=this.s.dt.aoColumns,b=this._fnIsLtr();this.s.aoTargets.splice(0,this.s.aoTargets.length);var c=d(this.s.dt.nTable).offset().left,g=[];d.each(a,function(a,f){if(f.bVisible&&"none"!==f.nTh.style.display){f=d(f.nTh);var h=f.offset().left; b&&(h+=f.outerWidth());g.push({index:a,bound:h});c=h}else g.push({index:a,bound:c})});var h=g[0];a=d(a[h.index].nTh).outerWidth();this.s.aoTargets.push({to:0,x:h.bound-a});for(h=0;h").addClass("DTCR_pointer").css({position:"absolute",top:a?d("div.dataTables_scroll",this.s.dt.nTableWrapper).offset().top: d(this.s.dt.nTable).offset().top,height:a?d("div.dataTables_scroll",this.s.dt.nTableWrapper).height():d(this.s.dt.nTable).height()}).appendTo("body")},_fnSetColumnIndexes:function(){d.each(this.s.dt.aoColumns,function(a,b){d(b.nTh).attr("data-column-index",a)})},_fnCursorPosition:function(a,b){return-1!==a.type.indexOf("touch")?a.originalEvent.touches[0][b]:a[b]},_fnIsLtr:function(){return"rtl"!==d(this.s.dt.nTable).css("direction")}});k.defaults={aiOrder:null,bEnable:!0,bRealtime:!0,iFixedColumnsLeft:0, iFixedColumnsRight:0,fnReorderCallback:null};k.version="1.5.2";d.fn.dataTable.ColReorder=k;d.fn.DataTable.ColReorder=k;"function"==typeof d.fn.dataTable&&"function"==typeof d.fn.dataTableExt.fnVersionCheck&&d.fn.dataTableExt.fnVersionCheck("1.10.8")?d.fn.dataTableExt.aoFeatures.push({fnInit:function(a){var b=a.oInstance;a._colReorder?b.oApi._fnLog(a,1,"ColReorder attempted to initialise twice. Ignoring second"):(b=a.oInit,new k(a,b.colReorder||b.oColReorder||{}));return null},cFeature:"R",sFeature:"ColReorder"}): alert("Warning: ColReorder requires DataTables 1.10.8 or greater - www.datatables.net/download");d(r).on("preInit.dt.colReorder",function(a,b){if("dt"===a.namespace){a=b.oInit.colReorder;var c=y.defaults.colReorder;if(a||c)c=d.extend({},a,c),!1!==a&&new k(b,c)}});d.fn.dataTable.Api.register("colReorder.reset()",function(){return this.iterator("table",function(a){a._colReorder.fnReset()})});d.fn.dataTable.Api.register("colReorder.order()",function(a,b){return a?this.iterator("table",function(c){c._colReorder.fnOrder(a, b)}):this.context.length?this.context[0]._colReorder.fnOrder():null});d.fn.dataTable.Api.register("colReorder.transpose()",function(a,b){return this.context.length&&this.context[0]._colReorder?this.context[0]._colReorder.fnTranspose(a,b):a});d.fn.dataTable.Api.register("colReorder.move()",function(a,b,c,d){this.context.length&&(this.context[0]._colReorder.s.dt.oInstance.fnColReorder(a,b,c,d),this.context[0]._colReorder._fnSetColumnIndexes());return this});d.fn.dataTable.Api.register("colReorder.enable()", function(a){return this.iterator("table",function(b){b._colReorder&&b._colReorder.fnEnable(a)})});d.fn.dataTable.Api.register("colReorder.disable()",function(){return this.iterator("table",function(a){a._colReorder&&a._colReorder.fnDisable()})});return k});