/* Core */
(function(e){function t(){var e=false;var t=false;this.stopPropagation=function(){e=true};this.isPropagationStopped=function(){return e};this.stopImmediatePropagation=function(){t=true};this.isImmediatePropagationStopped=function(){return t}}function n(){var e=[];this.subscribe=function(t){e.push(t)};this.unsubscribe=function(t){for(var n=e.length-1;n>=0;n--){if(e[n]===t){e.splice(n,1)}}};this.notify=function(n,r,i){r=r||new t;i=i||this;var s;for(var o=0;o<e.length&&!(r.isPropagationStopped()||r.isImmediatePropagationStopped());o++){s=e[o].call(i,r,n)}return s}}function r(){var e=[];this.subscribe=function(t,n){e.push({event:t,handler:n});t.subscribe(n);return this};this.unsubscribe=function(t,n){var r=e.length;while(r--){if(e[r].event===t&&e[r].handler===n){e.splice(r,1);t.unsubscribe(n);return}}return this};this.unsubscribeAll=function(){var t=e.length;while(t--){e[t].event.unsubscribe(e[t].handler)}e=[];return this}}function i(e,t,n,r){if(n===undefined&&r===undefined){n=e;r=t}this.fromRow=Math.min(e,n);this.fromCell=Math.min(t,r);this.toRow=Math.max(e,n);this.toCell=Math.max(t,r);this.isSingleRow=function(){return this.fromRow==this.toRow};this.isSingleCell=function(){return this.fromRow==this.toRow&&this.fromCell==this.toCell};this.contains=function(e,t){return e>=this.fromRow&&e<=this.toRow&&t>=this.fromCell&&t<=this.toCell};this.toString=function(){if(this.isSingleCell()){return"("+this.fromRow+":"+this.fromCell+")"}else{return"("+this.fromRow+":"+this.fromCell+" - "+this.toRow+":"+this.toCell+")"}}}function s(){this.__nonDataRow=true}function o(){this.__group=true;this.level=0;this.count=0;this.value=null;this.title=null;this.collapsed=false;this.totals=null;this.rows=[];this.groups=null;this.groupingKey=null}function u(){this.__groupTotals=true;this.group=null;this.initialized=false}function a(){var e=null;this.isActive=function(t){return t?e===t:e!==null};this.activate=function(t){if(t===e){return}if(e!==null){throw"SlickGrid.EditorLock.activate: an editController is still active, can't activate another editController"}if(!t.commitCurrentEdit){throw"SlickGrid.EditorLock.activate: editController must implement .commitCurrentEdit()"}if(!t.cancelCurrentEdit){throw"SlickGrid.EditorLock.activate: editController must implement .cancelCurrentEdit()"}e=t};this.deactivate=function(t){if(e!==t){throw"SlickGrid.EditorLock.deactivate: specified editController is not the currently active one"}e=null};this.commitCurrentEdit=function(){return e?e.commitCurrentEdit():true};this.cancelCurrentEdit=function(){return e?e.cancelCurrentEdit():true}}e.extend(true,window,{Slick:{Event:n,EventData:t,EventHandler:r,Range:i,NonDataRow:s,Group:o,GroupTotals:u,EditorLock:a,GlobalEditorLock:new a}});o.prototype=new s;o.prototype.equals=function(e){return this.value===e.value&&this.count===e.count&&this.collapsed===e.collapsed&&this.title===e.title};u.prototype=new s})(jQuery)

/**
 * @license
 * (c) 2009-2013 Michael Leibman
 * michael{dot}leibman{at}gmail{dot}com
 * http://github.com/mleibman/slickgrid
 *
 * Distributed under MIT license.
 * All rights reserved.
 *
 * SlickGrid v2.2
 *
 * NOTES:
 *     Cell/row DOM manipulations are done directly bypassing jQuery's DOM manipulation methods.
 *     This increases the speed dramatically, but can only be done safely because there are no event handlers
 *     or data associated with any cell/row DOM nodes.  Cell editors must make sure they implement .destroy()
 *     and do proper cleanup.
 */

if(typeof jQuery==="undefined"){throw"SlickGrid requires jquery module to be loaded"}if(!jQuery.fn.drag){throw"SlickGrid requires jquery.event.drag module to be loaded"}if(typeof Slick==="undefined"){throw"slick.core.js not loaded"}(function($){function SlickGrid(container,data,columns,options){function init(){$container=$(container);if($container.length<1){throw new Error("SlickGrid requires a valid container, "+container+" does not exist in the DOM.")}maxSupportedCssHeight=maxSupportedCssHeight||getMaxSupportedCssHeight();scrollbarDimensions=scrollbarDimensions||measureScrollbar();options=$.extend({},defaults,options);validateAndEnforceOptions();columnDefaults.width=options.defaultColumnWidth;columnsById={};for(var e=0;e<columns.length;e++){var t=columns[e]=$.extend({},columnDefaults,columns[e]);columnsById[t.id]=e;if(t.minWidth&&t.width<t.minWidth){t.width=t.minWidth}if(t.maxWidth&&t.width>t.maxWidth){t.width=t.maxWidth}}if(options.enableColumnReorder&&!$.fn.sortable){throw new Error("SlickGrid's 'enableColumnReorder = true' option requires jquery-ui.sortable module to be loaded")}editController={commitCurrentEdit:commitCurrentEdit,cancelCurrentEdit:cancelCurrentEdit};$container.empty().css("overflow","hidden").css("outline",0).addClass(uid).addClass("ui-widget");if(!/relative|absolute|fixed/.test($container.css("position"))){$container.css("position","relative")}$focusSink=$("<div tabIndex='0' hideFocus style='position:fixed;width:0;height:0;top:0;left:0;outline:0;'></div>").appendTo($container);$headerScroller=$("<div class='slick-header ui-state-default' style='overflow:hidden;position:relative;' />").appendTo($container);$headers=$("<div class='slick-header-columns' style='left:-1000px' />").appendTo($headerScroller);$headers.width(getHeadersWidth());$headerRowScroller=$("<div class='slick-headerrow ui-state-default' style='overflow:hidden;position:relative;' />").appendTo($container);$headerRow=$("<div class='slick-headerrow-columns' />").appendTo($headerRowScroller);$headerRowSpacer=$("<div style='display:block;height:1px;position:absolute;top:0;left:0;'></div>").css("width",getCanvasWidth()+scrollbarDimensions.width+"px").appendTo($headerRowScroller);$topPanelScroller=$("<div class='slick-top-panel-scroller ui-state-default' style='overflow:hidden;position:relative;' />").appendTo($container);$topPanel=$("<div class='slick-top-panel' style='width:10000px' />").appendTo($topPanelScroller);if(!options.showTopPanel){$topPanelScroller.hide()}if(!options.showHeaderRow){$headerRowScroller.hide()}$viewport=$("<div class='slick-viewport' style='width:100%;overflow:auto;outline:0;position:relative;;'>").appendTo($container);$viewport.css("overflow-y",options.autoHeight?"hidden":"auto");$canvas=$("<div class='grid-canvas' />").appendTo($viewport);$focusSink2=$focusSink.clone().appendTo($container);if(!options.explicitInitialization){finishInitialization()}}function finishInitialization(){if(!initialized){initialized=true;viewportW=parseFloat($.css($container[0],"width",true));measureCellPaddingAndBorder();disableSelection($headers);if(!options.enableTextSelectionOnCells){$viewport.bind("selectstart.ui",function(e){return $(e.target).is("input,textarea")})}updateColumnCaches();createColumnHeaders();setupColumnSort();createCssRules();resizeCanvas();bindAncestorScrollEvents();$container.bind("resize.slickgrid",resizeCanvas);$viewport.bind("scroll",handleScroll);$headerScroller.bind("contextmenu",handleHeaderContextMenu).bind("click",handleHeaderClick).delegate(".slick-header-column","mouseenter",handleHeaderMouseEnter).delegate(".slick-header-column","mouseleave",handleHeaderMouseLeave);$headerRowScroller.bind("scroll",handleHeaderRowScroll);$focusSink.add($focusSink2).bind("keydown",handleKeyDown);$canvas.bind("keydown",handleKeyDown).bind("click",handleClick).bind("dblclick",handleDblClick).bind("contextmenu",handleContextMenu).bind("draginit",handleDragInit).bind("dragstart",{distance:3},handleDragStart).bind("drag",handleDrag).bind("dragend",handleDragEnd).delegate(".slick-cell","mouseenter",handleMouseEnter).delegate(".slick-cell","mouseleave",handleMouseLeave);if(navigator.userAgent.toLowerCase().match(/webkit/)&&navigator.userAgent.toLowerCase().match(/macintosh/)){$canvas.bind("mousewheel",handleMouseWheel)}}}function registerPlugin(e){plugins.unshift(e);e.init(self)}function unregisterPlugin(e){for(var t=plugins.length;t>=0;t--){if(plugins[t]===e){if(plugins[t].destroy){plugins[t].destroy()}plugins.splice(t,1);break}}}function setSelectionModel(e){if(selectionModel){selectionModel.onSelectedRangesChanged.unsubscribe(handleSelectedRangesChanged);if(selectionModel.destroy){selectionModel.destroy()}}selectionModel=e;if(selectionModel){selectionModel.init(self);selectionModel.onSelectedRangesChanged.subscribe(handleSelectedRangesChanged)}}function getSelectionModel(){return selectionModel}function getCanvasNode(){return $canvas[0]}function measureScrollbar(){var e=$("<div style='position:absolute; top:-10000px; left:-10000px; width:100px; height:100px; overflow:scroll;'></div>").appendTo("body");var t={width:e.width()-e[0].clientWidth,height:e.height()-e[0].clientHeight};e.remove();return t}function getHeadersWidth(){var e=0;for(var t=0,n=columns.length;t<n;t++){var r=columns[t].width;e+=r}e+=scrollbarDimensions.width;return Math.max(e,viewportW)+1e3}function getCanvasWidth(){var e=viewportHasVScroll?viewportW-scrollbarDimensions.width:viewportW;var t=0;var n=columns.length;while(n--){t+=columns[n].width}return options.fullWidthRows?Math.max(t,e):t}function updateCanvasWidth(e){var t=canvasWidth;canvasWidth=getCanvasWidth();if(canvasWidth!=t){$canvas.width(canvasWidth);$headerRow.width(canvasWidth);$headers.width(getHeadersWidth());viewportHasHScroll=canvasWidth>viewportW-scrollbarDimensions.width}$headerRowSpacer.width(canvasWidth+(viewportHasVScroll?scrollbarDimensions.width:0));if(canvasWidth!=t||e){applyColumnWidths()}}function disableSelection(e){if(e&&e.jquery){e.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})}}function getMaxSupportedCssHeight(){var e=1e6;var t=navigator.userAgent.toLowerCase().match(/firefox/)?6e6:1e9;var n=$("<div style='display:none' />").appendTo(document.body);while(true){var r=e*2;n.css("height",r);if(r>t||n.height()!==r){break}else{e=r}}n.remove();return e}function bindAncestorScrollEvents(){var e=$canvas[0];while((e=e.parentNode)!=document.body&&e!=null){if(e==$viewport[0]||e.scrollWidth!=e.clientWidth||e.scrollHeight!=e.clientHeight){var t=$(e);if(!$boundAncestors){$boundAncestors=t}else{$boundAncestors=$boundAncestors.add(t)}t.bind("scroll."+uid,handleActiveCellPositionChange)}}}function unbindAncestorScrollEvents(){if(!$boundAncestors){return}$boundAncestors.unbind("scroll."+uid);$boundAncestors=null}function updateColumnHeader(e,t,n){if(!initialized){return}var r=getColumnIndex(e);if(r==null){return}var i=columns[r];var s=$headers.children().eq(r);if(s){if(t!==undefined){columns[r].name=t}if(n!==undefined){columns[r].toolTip=n}trigger(self.onBeforeHeaderCellDestroy,{node:s[0],column:i});s.attr("title",n||"").children().eq(0).html(t);trigger(self.onHeaderCellRendered,{node:s[0],column:i})}}function getHeaderRow(){return $headerRow[0]}function getHeaderRowColumn(e){var t=getColumnIndex(e);var n=$headerRow.children().eq(t);return n&&n[0]}function createColumnHeaders(){function e(){$(this).addClass("ui-state-hover")}function t(){$(this).removeClass("ui-state-hover")}$headers.find(".slick-header-column").each(function(){var e=$(this).data("column");if(e){trigger(self.onBeforeHeaderCellDestroy,{node:this,column:e})}});$headers.empty();$headers.width(getHeadersWidth());$headerRow.find(".slick-headerrow-column").each(function(){var e=$(this).data("column");if(e){trigger(self.onBeforeHeaderRowCellDestroy,{node:this,column:e})}});$headerRow.empty();for(var n=0;n<columns.length;n++){var r=columns[n];var i=$("<div class='ui-state-default slick-header-column' />").html("<span class='slick-column-name'>"+r.name+"</span>").width(r.width-headerColumnWidthDiff).attr("id",""+uid+r.id).attr("title",r.toolTip||"").data("column",r).addClass(r.headerCssClass||"").appendTo($headers);if(options.enableColumnReorder||r.sortable){i.on("mouseenter",e).on("mouseleave",t)}if(r.sortable){i.addClass("slick-header-sortable");i.append("<span class='slick-sort-indicator' />")}trigger(self.onHeaderCellRendered,{node:i[0],column:r});if(options.showHeaderRow){var s=$("<div class='ui-state-default slick-headerrow-column l"+n+" r"+n+"'></div>").data("column",r).appendTo($headerRow);trigger(self.onHeaderRowCellRendered,{node:s[0],column:r})}}setSortColumns(sortColumns);setupColumnResize();if(options.enableColumnReorder){setupColumnReorder()}}function setupColumnSort(){$headers.click(function(e){e.metaKey=e.metaKey||e.ctrlKey;if($(e.target).hasClass("slick-resizable-handle")){return}var t=$(e.target).closest(".slick-header-column");if(!t.length){return}var n=t.data("column");if(n.sortable){if(!getEditorLock().commitCurrentEdit()){return}var r=null;var i=0;for(;i<sortColumns.length;i++){if(sortColumns[i].columnId==n.id){r=sortColumns[i];r.sortAsc=!r.sortAsc;break}}if(e.metaKey&&options.multiColumnSort){if(r){sortColumns.splice(i,1)}}else{if(!e.shiftKey&&!e.metaKey||!options.multiColumnSort){sortColumns=[]}if(!r){r={columnId:n.id,sortAsc:n.defaultSortAsc};sortColumns.push(r)}else if(sortColumns.length==0){sortColumns.push(r)}}setSortColumns(sortColumns);if(!options.multiColumnSort){trigger(self.onSort,{multiColumnSort:false,sortCol:n,sortAsc:r.sortAsc},e)}else{trigger(self.onSort,{multiColumnSort:true,sortCols:$.map(sortColumns,function(e){return{sortCol:columns[getColumnIndex(e.columnId)],sortAsc:e.sortAsc}})},e)}}})}function setupColumnReorder(){$headers.filter(":ui-sortable").sortable("destroy");$headers.sortable({containment:"parent",distance:3,axis:"x",cursor:"default",tolerance:"intersection",helper:"clone",placeholder:"slick-sortable-placeholder ui-state-default slick-header-column",start:function(e,t){t.placeholder.width(t.helper.outerWidth()-headerColumnWidthDiff);$(t.helper).addClass("slick-header-column-active")},beforeStop:function(e,t){$(t.helper).removeClass("slick-header-column-active")},stop:function(e){if(!getEditorLock().commitCurrentEdit()){$(this).sortable("cancel");return}var t=$headers.sortable("toArray");var n=[];for(var r=0;r<t.length;r++){n.push(columns[getColumnIndex(t[r].replace(uid,""))])}setColumns(n);trigger(self.onColumnsReordered,{});e.stopPropagation();setupColumnResize()}})}function setupColumnResize(){var e,t,n,r,i,s,o,u,a;i=$headers.children();i.find(".slick-resizable-handle").remove();i.each(function(e,t){if(columns[e].resizable){if(u===undefined){u=e}a=e}});if(u===undefined){return}i.each(function(f,l){if(f<u||options.forceFitColumns&&f>=a){return}e=$(l);$("<div class='slick-resizable-handle' />").appendTo(l).bind("dragstart",function(e,u){if(!getEditorLock().commitCurrentEdit()){return false}r=e.pageX;$(this).parent().addClass("slick-header-column-active");var a=null,l=null;i.each(function(e,t){columns[e].previousWidth=$(t).outerWidth()});if(options.forceFitColumns){a=0;l=0;for(t=f+1;t<i.length;t++){n=columns[t];if(n.resizable){if(l!==null){if(n.maxWidth){l+=n.maxWidth-n.previousWidth}else{l=null}}a+=n.previousWidth-Math.max(n.minWidth||0,absoluteColumnMinWidth)}}}var h=0,p=0;for(t=0;t<=f;t++){n=columns[t];if(n.resizable){if(p!==null){if(n.maxWidth){p+=n.maxWidth-n.previousWidth}else{p=null}}h+=n.previousWidth-Math.max(n.minWidth||0,absoluteColumnMinWidth)}}if(a===null){a=1e5}if(h===null){h=1e5}if(l===null){l=1e5}if(p===null){p=1e5}o=r+Math.min(a,p);s=r-Math.min(h,l)}).bind("drag",function(e,u){var a,l=Math.min(o,Math.max(s,e.pageX))-r,h;if(l<0){h=l;for(t=f;t>=0;t--){n=columns[t];if(n.resizable){a=Math.max(n.minWidth||0,absoluteColumnMinWidth);if(h&&n.previousWidth+h<a){h+=n.previousWidth-a;n.width=a}else{n.width=n.previousWidth+h;h=0}}}if(options.forceFitColumns){h=-l;for(t=f+1;t<i.length;t++){n=columns[t];if(n.resizable){if(h&&n.maxWidth&&n.maxWidth-n.previousWidth<h){h-=n.maxWidth-n.previousWidth;n.width=n.maxWidth}else{n.width=n.previousWidth+h;h=0}}}}}else{h=l;for(t=f;t>=0;t--){n=columns[t];if(n.resizable){if(h&&n.maxWidth&&n.maxWidth-n.previousWidth<h){h-=n.maxWidth-n.previousWidth;n.width=n.maxWidth}else{n.width=n.previousWidth+h;h=0}}}if(options.forceFitColumns){h=-l;for(t=f+1;t<i.length;t++){n=columns[t];if(n.resizable){a=Math.max(n.minWidth||0,absoluteColumnMinWidth);if(h&&n.previousWidth+h<a){h+=n.previousWidth-a;n.width=a}else{n.width=n.previousWidth+h;h=0}}}}}applyColumnHeaderWidths();if(options.syncColumnCellResize){applyColumnWidths()}}).bind("dragend",function(e,r){var s;$(this).parent().removeClass("slick-header-column-active");for(t=0;t<i.length;t++){n=columns[t];s=$(i[t]).outerWidth();if(n.previousWidth!==s&&n.rerenderOnResize){invalidateAllRows()}}updateCanvasWidth(true);render();trigger(self.onColumnsResized,{})})})}function getVBoxDelta(e){var t=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"];var n=0;$.each(t,function(t,r){n+=parseFloat(e.css(r))||0});return n}function measureCellPaddingAndBorder(){var e;var t=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"];var n=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"];e=$("<div class='ui-state-default slick-header-column' style='visibility:hidden'>-</div>").appendTo($headers);headerColumnWidthDiff=headerColumnHeightDiff=0;if(e.css("box-sizing")!="border-box"&&e.css("-moz-box-sizing")!="border-box"&&e.css("-webkit-box-sizing")!="border-box"){$.each(t,function(t,n){headerColumnWidthDiff+=parseFloat(e.css(n))||0});$.each(n,function(t,n){headerColumnHeightDiff+=parseFloat(e.css(n))||0})}e.remove();var r=$("<div class='slick-row' />").appendTo($canvas);e=$("<div class='slick-cell' id='' style='visibility:hidden'>-</div>").appendTo(r);cellWidthDiff=cellHeightDiff=0;if(e.css("box-sizing")!="border-box"&&e.css("-moz-box-sizing")!="border-box"&&e.css("-webkit-box-sizing")!="border-box"){$.each(t,function(t,n){cellWidthDiff+=parseFloat(e.css(n))||0});$.each(n,function(t,n){cellHeightDiff+=parseFloat(e.css(n))||0})}r.remove();absoluteColumnMinWidth=Math.max(headerColumnWidthDiff,cellWidthDiff)}function createCssRules(){$style=$("<style type='text/css' rel='stylesheet' />").appendTo($("head"));var e=options.rowHeight-cellHeightDiff;var t=["."+uid+" .slick-header-column { left: 1000px; }","."+uid+" .slick-top-panel { height:"+options.topPanelHeight+"px; }","."+uid+" .slick-headerrow-columns { height:"+options.headerRowHeight+"px; }","."+uid+" .slick-cell { height:"+e+"px; }","."+uid+" .slick-row { height:"+options.rowHeight+"px; }"];for(var n=0;n<columns.length;n++){t.push("."+uid+" .l"+n+" { }");t.push("."+uid+" .r"+n+" { }")}if($style[0].styleSheet){$style[0].styleSheet.cssText=t.join(" ")}else{$style[0].appendChild(document.createTextNode(t.join(" ")))}}function getColumnCssRules(e){if(!stylesheet){var t=document.styleSheets;for(var n=0;n<t.length;n++){if((t[n].ownerNode||t[n].owningElement)==$style[0]){stylesheet=t[n];break}}if(!stylesheet){throw new Error("Cannot find stylesheet.")}columnCssRulesL=[];columnCssRulesR=[];var r=stylesheet.cssRules||stylesheet.rules;var i,s;for(var n=0;n<r.length;n++){var o=r[n].selectorText;if(i=/\.l\d+/.exec(o)){s=parseInt(i[0].substr(2,i[0].length-2),10);columnCssRulesL[s]=r[n]}else if(i=/\.r\d+/.exec(o)){s=parseInt(i[0].substr(2,i[0].length-2),10);columnCssRulesR[s]=r[n]}}}return{left:columnCssRulesL[e],right:columnCssRulesR[e]}}function removeCssRules(){$style.remove();stylesheet=null}function destroy(){getEditorLock().cancelCurrentEdit();trigger(self.onBeforeDestroy,{});var e=plugins.length;while(e--){unregisterPlugin(plugins[e])}if(options.enableColumnReorder){$headers.filter(":ui-sortable").sortable("destroy")}unbindAncestorScrollEvents();$container.unbind(".slickgrid");removeCssRules();$canvas.unbind("draginit dragstart dragend drag");$container.empty().removeClass(uid)}function trigger(e,t,n){n=n||new Slick.EventData;t=t||{};t.grid=self;return e.notify(t,n,self)}function getEditorLock(){return options.editorLock}function getEditController(){return editController}function getColumnIndex(e){return columnsById[e]}function autosizeColumns(){var e,t,n=[],r=0,i=0,s,o=viewportHasVScroll?viewportW-scrollbarDimensions.width:viewportW;for(e=0;e<columns.length;e++){t=columns[e];n.push(t.width);i+=t.width;if(t.resizable){r+=t.width-Math.max(t.minWidth,absoluteColumnMinWidth)}}s=i;while(i>o&&r){var u=(i-o)/r;for(e=0;e<columns.length&&i>o;e++){t=columns[e];var a=n[e];if(!t.resizable||a<=t.minWidth||a<=absoluteColumnMinWidth){continue}var f=Math.max(t.minWidth,absoluteColumnMinWidth);var l=Math.floor(u*(a-f))||1;l=Math.min(l,a-f);i-=l;r-=l;n[e]-=l}if(s<=i){break}s=i}s=i;while(i<o){var c=o/i;for(e=0;e<columns.length&&i<o;e++){t=columns[e];var h=n[e];var p;if(!t.resizable||t.maxWidth<=h){p=0}else{p=Math.min(Math.floor(c*h)-h,t.maxWidth-h||1e6)||1}i+=p;n[e]+=p}if(s>=i){break}s=i}var d=false;for(e=0;e<columns.length;e++){if(columns[e].rerenderOnResize&&columns[e].width!=n[e]){d=true}columns[e].width=n[e]}applyColumnHeaderWidths();updateCanvasWidth(true);if(d){invalidateAllRows();render()}}function applyColumnHeaderWidths(){if(!initialized){return}var e;for(var t=0,n=$headers.children(),r=n.length;t<r;t++){e=$(n[t]);if(e.width()!==columns[t].width-headerColumnWidthDiff){e.width(columns[t].width-headerColumnWidthDiff)}}updateColumnCaches()}function applyColumnWidths(){var e=0,t,n;for(var r=0;r<columns.length;r++){t=columns[r].width;n=getColumnCssRules(r);n.left.style.left=e+"px";n.right.style.right=canvasWidth-e-t+"px";e+=columns[r].width}}function setSortColumn(e,t){setSortColumns([{columnId:e,sortAsc:t}])}function setSortColumns(e){sortColumns=e;var t=$headers.children();t.removeClass("slick-header-column-sorted").find(".slick-sort-indicator").removeClass("slick-sort-indicator-asc slick-sort-indicator-desc");$.each(sortColumns,function(e,n){if(n.sortAsc==null){n.sortAsc=true}var r=getColumnIndex(n.columnId);if(r!=null){t.eq(r).addClass("slick-header-column-sorted").find(".slick-sort-indicator").addClass(n.sortAsc?"slick-sort-indicator-asc":"slick-sort-indicator-desc")}})}function getSortColumns(){return sortColumns}function handleSelectedRangesChanged(e,t){selectedRows=[];var n={};for(var r=0;r<t.length;r++){for(var i=t[r].fromRow;i<=t[r].toRow;i++){if(!n[i]){selectedRows.push(i);n[i]={}}for(var s=t[r].fromCell;s<=t[r].toCell;s++){if(canCellBeSelected(i,s)){n[i][columns[s].id]=options.selectedCellCssClass}}}}setCellCssStyles(options.selectedCellCssClass,n);trigger(self.onSelectedRowsChanged,{rows:getSelectedRows()},e)}function getColumns(){return columns}function updateColumnCaches(){columnPosLeft=[];columnPosRight=[];var e=0;for(var t=0,n=columns.length;t<n;t++){columnPosLeft[t]=e;columnPosRight[t]=e+columns[t].width;e+=columns[t].width}}function setColumns(e){columns=e;columnsById={};for(var t=0;t<columns.length;t++){var n=columns[t]=$.extend({},columnDefaults,columns[t]);columnsById[n.id]=t;if(n.minWidth&&n.width<n.minWidth){n.width=n.minWidth}if(n.maxWidth&&n.width>n.maxWidth){n.width=n.maxWidth}}updateColumnCaches();if(initialized){invalidateAllRows();createColumnHeaders();removeCssRules();createCssRules();resizeCanvas();applyColumnWidths();handleScroll()}}function getOptions(){return options}function setOptions(e){if(!getEditorLock().commitCurrentEdit()){return}makeActiveCellNormal();if(options.enableAddRow!==e.enableAddRow){invalidateRow(getDataLength())}options=$.extend(options,e);validateAndEnforceOptions();$viewport.css("overflow-y",options.autoHeight?"hidden":"auto");render()}function validateAndEnforceOptions(){if(options.autoHeight){options.leaveSpaceForNewRows=false}}function setData(e,t){data=e;invalidateAllRows();updateRowCount();if(t){scrollTo(0)}}function getData(){return data}function getDataLength(){if(data.getLength){return data.getLength()}else{return data.length}}function getDataLengthIncludingAddNew(){return getDataLength()+(options.enableAddRow?1:0)}function getDataItem(e){if(data.getItem){return data.getItem(e)}else{return data[e]}}function getTopPanel(){return $topPanel[0]}function setTopPanelVisibility(e){if(options.showTopPanel!=e){options.showTopPanel=e;if(e){$topPanelScroller.slideDown("fast",resizeCanvas)}else{$topPanelScroller.slideUp("fast",resizeCanvas)}}}function setHeaderRowVisibility(e){if(options.showHeaderRow!=e){options.showHeaderRow=e;if(e){$headerRowScroller.slideDown("fast",resizeCanvas)}else{$headerRowScroller.slideUp("fast",resizeCanvas)}}}function getContainerNode(){return $container.get(0)}function getRowTop(e){return options.rowHeight*e-offset}function getRowFromPosition(e){return Math.floor((e+offset)/options.rowHeight)}function scrollTo(e){e=Math.max(e,0);e=Math.min(e,th-viewportH+(viewportHasHScroll?scrollbarDimensions.height:0));var t=offset;page=Math.min(n-1,Math.floor(e/ph));offset=Math.round(page*cj);var r=e-offset;if(offset!=t){var i=getVisibleRange(r);cleanupRows(i);updateRowPositions()}if(prevScrollTop!=r){vScrollDir=prevScrollTop+t<r+offset?1:-1;$viewport[0].scrollTop=lastRenderedScrollTop=scrollTop=prevScrollTop=r;trigger(self.onViewportChanged,{})}}function defaultFormatter(e,t,n,r,i){if(n==null){return""}else{return(n+"").replace(/&/g,"&").replace(/</g,"&lt;").replace(/>/g,"&gt;")}}function getFormatter(e,t){var n=data.getItemMetadata&&data.getItemMetadata(e);var r=n&&n.columns&&(n.columns[t.id]||n.columns[getColumnIndex(t.id)]);return r&&r.formatter||n&&n.formatter||t.formatter||options.formatterFactory&&options.formatterFactory.getFormatter(t)||options.defaultFormatter}function getEditor(e,t){var n=columns[t];var r=data.getItemMetadata&&data.getItemMetadata(e);var i=r&&r.columns;if(i&&i[n.id]&&i[n.id].editor!==undefined){return i[n.id].editor}if(i&&i[t]&&i[t].editor!==undefined){return i[t].editor}return n.editor||options.editorFactory&&options.editorFactory.getEditor(n)}function getDataItemValueForColumn(e,t){if(options.dataItemColumnValueExtractor){return options.dataItemColumnValueExtractor(e,t)}return e[t.field]}function appendRowHtml(e,t,n,r){var i=getDataItem(t);var s=t<r&&!i;var o="slick-row"+(s?" loading":"")+(t===activeRow?" active":"")+(t%2==1?" odd":" even");if(!i){o+=" "+options.addNewRowCssClass}var u=data.getItemMetadata&&data.getItemMetadata(t);if(u&&u.cssClasses){o+=" "+u.cssClasses}e.push("<div class='ui-widget-content "+o+"' style='top:"+getRowTop(t)+"px'>");var a,f;for(var l=0,c=columns.length;l<c;l++){f=columns[l];a=1;if(u&&u.columns){var h=u.columns[f.id]||u.columns[l];a=h&&h.colspan||1;if(a==="*"){a=c-l}}if(columnPosRight[Math.min(c-1,l+a-1)]>n.leftPx){if(columnPosLeft[l]>n.rightPx){break}appendCellHtml(e,t,l,a,i)}if(a>1){l+=a-1}}e.push("</div>")}function appendCellHtml(e,t,n,r,i){var s=columns[n];var o="slick-cell l"+n+" r"+Math.min(columns.length-1,n+r-1)+(s.cssClass?" "+s.cssClass:"");if(t===activeRow&&n===activeCell){o+=" active"}for(var u in cellCssClasses){if(cellCssClasses[u][t]&&cellCssClasses[u][t][s.id]){o+=" "+cellCssClasses[u][t][s.id]}}e.push("<div class='"+o+"'>");if(i){var a=getDataItemValueForColumn(i,s);e.push(getFormatter(t,s)(t,n,a,s,i))}e.push("</div>");rowsCache[t].cellRenderQueue.push(n);rowsCache[t].cellColSpans[n]=r}function cleanupRows(e){for(var t in rowsCache){if((t=parseInt(t,10))!==activeRow&&(t<e.top||t>e.bottom)){removeRowFromCache(t)}}}function invalidate(){updateRowCount();invalidateAllRows();render()}function invalidateAllRows(){if(currentEditor){makeActiveCellNormal()}for(var e in rowsCache){removeRowFromCache(e)}}function removeRowFromCache(e){var t=rowsCache[e];if(!t){return}if(rowNodeFromLastMouseWheelEvent==t.rowNode){t.rowNode.style.display="none";zombieRowNodeFromLastMouseWheelEvent=rowNodeFromLastMouseWheelEvent}else{$canvas[0].removeChild(t.rowNode)}delete rowsCache[e];delete postProcessedRows[e];renderedRows--;counter_rows_removed++}function invalidateRows(e){var t,n;if(!e||!e.length){return}vScrollDir=0;for(t=0,n=e.length;t<n;t++){if(currentEditor&&activeRow===e[t]){makeActiveCellNormal()}if(rowsCache[e[t]]){removeRowFromCache(e[t])}}}function invalidateRow(e){invalidateRows([e])}function updateCell(e,t){var n=getCellNode(e,t);if(!n){return}var r=columns[t],i=getDataItem(e);if(currentEditor&&activeRow===e&&activeCell===t){currentEditor.loadValue(i)}else{n.innerHTML=i?getFormatter(e,r)(e,t,getDataItemValueForColumn(i,r),r,i):"";invalidatePostProcessingResults(e)}}function updateRow(e){var t=rowsCache[e];if(!t){return}ensureCellNodesInRowsCache(e);var n=getDataItem(e);for(var r in t.cellNodesByColumnIdx){if(!t.cellNodesByColumnIdx.hasOwnProperty(r)){continue}r=r|0;var i=columns[r],s=t.cellNodesByColumnIdx[r];if(e===activeRow&&r===activeCell&&currentEditor){currentEditor.loadValue(n)}else if(n){s.innerHTML=getFormatter(e,i)(e,r,getDataItemValueForColumn(n,i),i,n)}else{s.innerHTML=""}}invalidatePostProcessingResults(e)}function getViewportHeight(){return parseFloat($.css($container[0],"height",true))-parseFloat($.css($container[0],"paddingTop",true))-parseFloat($.css($container[0],"paddingBottom",true))-parseFloat($.css($headerScroller[0],"height"))-getVBoxDelta($headerScroller)-(options.showTopPanel?options.topPanelHeight+getVBoxDelta($topPanelScroller):0)-(options.showHeaderRow?options.headerRowHeight+getVBoxDelta($headerRowScroller):0)}function resizeCanvas(){if(!initialized){return}if(options.autoHeight){viewportH=options.rowHeight*getDataLengthIncludingAddNew()}else{viewportH=getViewportHeight()}numVisibleRows=Math.ceil(viewportH/options.rowHeight);viewportW=parseFloat($.css($container[0],"width",true));if(!options.autoHeight){$viewport.height(viewportH)}if(options.forceFitColumns){autosizeColumns()}updateRowCount();handleScroll();lastRenderedScrollLeft=-1;render()}function updateRowCount(){if(!initialized){return}var e=getDataLengthIncludingAddNew();var t=e+(options.leaveSpaceForNewRows?numVisibleRows-1:0);var r=viewportHasVScroll;viewportHasVScroll=!options.autoHeight&&t*options.rowHeight>viewportH;makeActiveCellNormal();var i=e-1;for(var s in rowsCache){if(s>=i){removeRowFromCache(s)}}if(activeCellNode&&activeRow>i){resetActiveCell()}var o=h;th=Math.max(options.rowHeight*t,viewportH-scrollbarDimensions.height);if(th<maxSupportedCssHeight){h=ph=th;n=1;cj=0}else{h=maxSupportedCssHeight;ph=h/100;n=Math.floor(th/ph);cj=(th-h)/(n-1)}if(h!==o){$canvas.css("height",h);scrollTop=$viewport[0].scrollTop}var u=scrollTop+offset<=th-viewportH;if(th==0||scrollTop==0){page=offset=0}else if(u){scrollTo(scrollTop+offset)}else{scrollTo(th-viewportH)}if(h!=o&&options.autoHeight){resizeCanvas()}if(options.forceFitColumns&&r!=viewportHasVScroll){autosizeColumns()}updateCanvasWidth(false)}function getVisibleRange(e,t){if(e==null){e=scrollTop}if(t==null){t=scrollLeft}return{top:getRowFromPosition(e),bottom:getRowFromPosition(e+viewportH)+1,leftPx:t,rightPx:t+viewportW}}function getRenderedRange(e,t){var n=getVisibleRange(e,t);var r=Math.round(viewportH/options.rowHeight);var i=3;if(vScrollDir==-1){n.top-=r;n.bottom+=i}else if(vScrollDir==1){n.top-=i;n.bottom+=r}else{n.top-=i;n.bottom+=i}n.top=Math.max(0,n.top);n.bottom=Math.min(getDataLengthIncludingAddNew()-1,n.bottom);n.leftPx-=viewportW;n.rightPx+=viewportW;n.leftPx=Math.max(0,n.leftPx);n.rightPx=Math.min(canvasWidth,n.rightPx);return n}function ensureCellNodesInRowsCache(e){var t=rowsCache[e];if(t){if(t.cellRenderQueue.length){var n=t.rowNode.lastChild;while(t.cellRenderQueue.length){var r=t.cellRenderQueue.pop();t.cellNodesByColumnIdx[r]=n;n=n.previousSibling}}}}function cleanUpCells(e,t){var n=0;var r=rowsCache[t];var i=[];for(var s in r.cellNodesByColumnIdx){if(!r.cellNodesByColumnIdx.hasOwnProperty(s)){continue}s=s|0;var o=r.cellColSpans[s];if(columnPosLeft[s]>e.rightPx||columnPosRight[Math.min(columns.length-1,s+o-1)]<e.leftPx){if(!(t==activeRow&&s==activeCell)){i.push(s)}}}var u;while((u=i.pop())!=null){r.rowNode.removeChild(r.cellNodesByColumnIdx[u]);delete r.cellColSpans[u];delete r.cellNodesByColumnIdx[u];if(postProcessedRows[t]){delete postProcessedRows[t][u]}n++}}function cleanUpAndRenderCells(e){var t;var n=[];var r=[];var i;var s=0;var o;for(var u=e.top,a=e.bottom;u<=a;u++){t=rowsCache[u];if(!t){continue}ensureCellNodesInRowsCache(u);cleanUpCells(e,u);i=0;var f=data.getItemMetadata&&data.getItemMetadata(u);f=f&&f.columns;var l=getDataItem(u);for(var c=0,h=columns.length;c<h;c++){if(columnPosLeft[c]>e.rightPx){break}if((o=t.cellColSpans[c])!=null){c+=o>1?o-1:0;continue}o=1;if(f){var p=f[columns[c].id]||f[c];o=p&&p.colspan||1;if(o==="*"){o=h-c}}if(columnPosRight[Math.min(h-1,c+o-1)]>e.leftPx){appendCellHtml(n,u,c,o,l);i++}c+=o>1?o-1:0}if(i){s+=i;r.push(u)}}if(!n.length){return}var d=document.createElement("div");d.innerHTML=n.join("");var v;var m;while((v=r.pop())!=null){t=rowsCache[v];var g;while((g=t.cellRenderQueue.pop())!=null){m=d.lastChild;t.rowNode.appendChild(m);t.cellNodesByColumnIdx[g]=m}}}function renderRows(e){var t=$canvas[0],n=[],r=[],i=false,s=getDataLength();for(var o=e.top,u=e.bottom;o<=u;o++){if(rowsCache[o]){continue}renderedRows++;r.push(o);rowsCache[o]={rowNode:null,cellColSpans:[],cellNodesByColumnIdx:[],cellRenderQueue:[]};appendRowHtml(n,o,e,s);if(activeCellNode&&activeRow===o){i=true}counter_rows_rendered++}if(!r.length){return}var a=document.createElement("div");a.innerHTML=n.join("");for(var o=0,u=r.length;o<u;o++){rowsCache[r[o]].rowNode=t.appendChild(a.firstChild)}if(i){activeCellNode=getCellNode(activeRow,activeCell)}}function startPostProcessing(){if(!options.enableAsyncPostRender){return}clearTimeout(h_postrender);h_postrender=setTimeout(asyncPostProcessRows,options.asyncPostRenderDelay)}function invalidatePostProcessingResults(e){delete postProcessedRows[e];postProcessFromRow=Math.min(postProcessFromRow,e);postProcessToRow=Math.max(postProcessToRow,e);startPostProcessing()}function updateRowPositions(){for(var e in rowsCache){rowsCache[e].rowNode.style.top=getRowTop(e)+"px"}}function render(){if(!initialized){return}var e=getVisibleRange();var t=getRenderedRange();cleanupRows(t);if(lastRenderedScrollLeft!=scrollLeft){cleanUpAndRenderCells(t)}renderRows(t);postProcessFromRow=e.top;postProcessToRow=Math.min(getDataLengthIncludingAddNew()-1,e.bottom);startPostProcessing();lastRenderedScrollTop=scrollTop;lastRenderedScrollLeft=scrollLeft;h_render=null}function handleHeaderRowScroll(){var e=$headerRowScroller[0].scrollLeft;if(e!=$viewport[0].scrollLeft){$viewport[0].scrollLeft=e}}function handleScroll(){scrollTop=$viewport[0].scrollTop;scrollLeft=$viewport[0].scrollLeft;var e=Math.abs(scrollTop-prevScrollTop);var t=Math.abs(scrollLeft-prevScrollLeft);if(t){prevScrollLeft=scrollLeft;$headerScroller[0].scrollLeft=scrollLeft;$topPanelScroller[0].scrollLeft=scrollLeft;$headerRowScroller[0].scrollLeft=scrollLeft}if(e){vScrollDir=prevScrollTop<scrollTop?1:-1;prevScrollTop=scrollTop;if(e<viewportH){scrollTo(scrollTop+offset)}else{var r=offset;if(h==viewportH){page=0}else{page=Math.min(n-1,Math.floor(scrollTop*((th-viewportH)/(h-viewportH))*(1/ph)))}offset=Math.round(page*cj);if(r!=offset){invalidateAllRows()}}}if(t||e){if(h_render){clearTimeout(h_render)}if(Math.abs(lastRenderedScrollTop-scrollTop)>20||Math.abs(lastRenderedScrollLeft-scrollLeft)>20){if(options.forceSyncScrolling||Math.abs(lastRenderedScrollTop-scrollTop)<viewportH&&Math.abs(lastRenderedScrollLeft-scrollLeft)<viewportW){render()}else{h_render=setTimeout(render,50)}trigger(self.onViewportChanged,{})}}trigger(self.onScroll,{scrollLeft:scrollLeft,scrollTop:scrollTop})}function asyncPostProcessRows(){var e=getDataLength();while(postProcessFromRow<=postProcessToRow){var t=vScrollDir>=0?postProcessFromRow++:postProcessToRow--;var n=rowsCache[t];if(!n||t>=e){continue}if(!postProcessedRows[t]){postProcessedRows[t]={}}ensureCellNodesInRowsCache(t);for(var r in n.cellNodesByColumnIdx){if(!n.cellNodesByColumnIdx.hasOwnProperty(r)){continue}r=r|0;var i=columns[r];if(i.asyncPostRender&&!postProcessedRows[t][r]){var s=n.cellNodesByColumnIdx[r];if(s){i.asyncPostRender(s,t,getDataItem(t),i)}postProcessedRows[t][r]=true}}h_postrender=setTimeout(asyncPostProcessRows,options.asyncPostRenderDelay);return}}function updateCellCssStylesOnRenderedRows(e,t){var n,r,i,s;for(var o in rowsCache){s=t&&t[o];i=e&&e[o];if(s){for(r in s){if(!i||s[r]!=i[r]){n=getCellNode(o,getColumnIndex(r));if(n){$(n).removeClass(s[r])}}}}if(i){for(r in i){if(!s||s[r]!=i[r]){n=getCellNode(o,getColumnIndex(r));if(n){$(n).addClass(i[r])}}}}}}function addCellCssStyles(e,t){if(cellCssClasses[e]){throw"addCellCssStyles: cell CSS hash with key '"+e+"' already exists."}cellCssClasses[e]=t;updateCellCssStylesOnRenderedRows(t,null);trigger(self.onCellCssStylesChanged,{key:e,hash:t})}function removeCellCssStyles(e){if(!cellCssClasses[e]){return}updateCellCssStylesOnRenderedRows(null,cellCssClasses[e]);delete cellCssClasses[e];trigger(self.onCellCssStylesChanged,{key:e,hash:null})}function setCellCssStyles(e,t){var n=cellCssClasses[e];cellCssClasses[e]=t;updateCellCssStylesOnRenderedRows(t,n);trigger(self.onCellCssStylesChanged,{key:e,hash:t})}function getCellCssStyles(e){return cellCssClasses[e]}function flashCell(e,t,n){n=n||100;if(rowsCache[e]){var r=$(getCellNode(e,t));function i(e){if(!e){return}setTimeout(function(){r.queue(function(){r.toggleClass(options.cellFlashingCssClass).dequeue();i(e-1)})},n)}i(4)}}function handleMouseWheel(e){var t=$(e.target).closest(".slick-row")[0];if(t!=rowNodeFromLastMouseWheelEvent){if(zombieRowNodeFromLastMouseWheelEvent&&zombieRowNodeFromLastMouseWheelEvent!=t){$canvas[0].removeChild(zombieRowNodeFromLastMouseWheelEvent);zombieRowNodeFromLastMouseWheelEvent=null}rowNodeFromLastMouseWheelEvent=t}}function handleDragInit(e,t){var n=getCellFromEvent(e);if(!n||!cellExists(n.row,n.cell)){return false}var r=trigger(self.onDragInit,t,e);if(e.isImmediatePropagationStopped()){return r}return false}function handleDragStart(e,t){var n=getCellFromEvent(e);if(!n||!cellExists(n.row,n.cell)){return false}var r=trigger(self.onDragStart,t,e);if(e.isImmediatePropagationStopped()){return r}return false}function handleDrag(e,t){return trigger(self.onDrag,t,e)}function handleDragEnd(e,t){trigger(self.onDragEnd,t,e)}function handleKeyDown(e){trigger(self.onKeyDown,{row:activeRow,cell:activeCell},e);var t=e.isImmediatePropagationStopped();if(!t){if(!e.shiftKey&&!e.altKey&&!e.ctrlKey){if(e.which==27){if(!getEditorLock().isActive()){return}cancelEditAndSetFocus()}else if(e.which==34){navigatePageDown();t=true}else if(e.which==33){navigatePageUp();t=true}else if(e.which==37){t=navigateLeft()}else if(e.which==39){t=navigateRight()}else if(e.which==38){t=navigateUp()}else if(e.which==40){t=navigateDown()}else if(e.which==9){t=navigateNext()}else if(e.which==13){if(options.editable){if(currentEditor){if(activeRow===getDataLength()){navigateDown()}else{commitEditAndSetFocus()}}else{if(getEditorLock().commitCurrentEdit()){makeActiveCellEditable()}}}t=true}}else if(e.which==9&&e.shiftKey&&!e.ctrlKey&&!e.altKey){t=navigatePrev()}}if(t){e.stopPropagation();e.preventDefault();try{e.originalEvent.keyCode=0}catch(n){}}}function handleClick(e){if(!currentEditor){if(e.target!=document.activeElement||$(e.target).hasClass("slick-cell")){setFocus()}}var t=getCellFromEvent(e);if(!t||currentEditor!==null&&activeRow==t.row&&activeCell==t.cell){return}trigger(self.onClick,{row:t.row,cell:t.cell},e);if(e.isImmediatePropagationStopped()){return}if((activeCell!=t.cell||activeRow!=t.row)&&canCellBeActive(t.row,t.cell)){if(!getEditorLock().isActive()||getEditorLock().commitCurrentEdit()){scrollRowIntoView(t.row,false);setActiveCellInternal(getCellNode(t.row,t.cell))}}}function handleContextMenu(e){var t=$(e.target).closest(".slick-cell",$canvas);if(t.length===0){return}if(activeCellNode===t[0]&&currentEditor!==null){return}trigger(self.onContextMenu,{},e)}function handleDblClick(e){var t=getCellFromEvent(e);if(!t||currentEditor!==null&&activeRow==t.row&&activeCell==t.cell){return}trigger(self.onDblClick,{row:t.row,cell:t.cell},e);if(e.isImmediatePropagationStopped()){return}if(options.editable){gotoCell(t.row,t.cell,true)}}function handleHeaderMouseEnter(e){trigger(self.onHeaderMouseEnter,{column:$(this).data("column")},e)}function handleHeaderMouseLeave(e){trigger(self.onHeaderMouseLeave,{column:$(this).data("column")},e)}function handleHeaderContextMenu(e){var t=$(e.target).closest(".slick-header-column",".slick-header-columns");var n=t&&t.data("column");trigger(self.onHeaderContextMenu,{column:n},e)}function handleHeaderClick(e){var t=$(e.target).closest(".slick-header-column",".slick-header-columns");var n=t&&t.data("column");if(n){trigger(self.onHeaderClick,{column:n},e)}}function handleMouseEnter(e){trigger(self.onMouseEnter,{},e)}function handleMouseLeave(e){trigger(self.onMouseLeave,{},e)}function cellExists(e,t){return!(e<0||e>=getDataLength()||t<0||t>=columns.length)}function getCellFromPoint(e,t){var n=getRowFromPosition(t);var r=0;var i=0;for(var s=0;s<columns.length&&i<e;s++){i+=columns[s].width;r++}if(r<0){r=0}return{row:n,cell:r-1}}function getCellFromNode(e){var t=/l\d+/.exec(e.className);if(!t){throw"getCellFromNode: cannot get cell - "+e.className}return parseInt(t[0].substr(1,t[0].length-1),10)}function getRowFromNode(e){for(var t in rowsCache){if(rowsCache[t].rowNode===e){return t|0}}return null}function getCellFromEvent(e){var t=$(e.target).closest(".slick-cell",$canvas);if(!t.length){return null}var n=getRowFromNode(t[0].parentNode);var r=getCellFromNode(t[0]);if(n==null||r==null){return null}else{return{row:n,cell:r}}}function getCellNodeBox(e,t){if(!cellExists(e,t)){return null}var n=getRowTop(e);var r=n+options.rowHeight-1;var i=0;for(var s=0;s<t;s++){i+=columns[s].width}var o=i+columns[t].width;return{top:n,left:i,bottom:r,right:o}}function resetActiveCell(){setActiveCellInternal(null,false)}function setFocus(){if(tabbingDirection==-1){$focusSink[0].focus()}else{$focusSink2[0].focus()}}function scrollCellIntoView(e,t,n){scrollRowIntoView(e,n);var r=getColspan(e,t);var i=columnPosLeft[t],s=columnPosRight[t+(r>1?r-1:0)],o=scrollLeft+viewportW;if(i<scrollLeft){$viewport.scrollLeft(i);handleScroll();render()}else if(s>o){$viewport.scrollLeft(Math.min(i,s-$viewport[0].clientWidth));handleScroll();render()}}function setActiveCellInternal(e,t){if(activeCellNode!==null){makeActiveCellNormal();$(activeCellNode).removeClass("active");if(rowsCache[activeRow]){$(rowsCache[activeRow].rowNode).removeClass("active")}}var n=activeCellNode!==e;activeCellNode=e;if(activeCellNode!=null){activeRow=getRowFromNode(activeCellNode.parentNode);activeCell=activePosX=getCellFromNode(activeCellNode);if(t==null){t=activeRow==getDataLength()||options.autoEdit}$(activeCellNode).addClass("active");$(rowsCache[activeRow].rowNode).addClass("active");if(options.editable&&t&&isCellPotentiallyEditable(activeRow,activeCell)){clearTimeout(h_editorLoader);if(options.asyncEditorLoading){h_editorLoader=setTimeout(function(){makeActiveCellEditable()},options.asyncEditorLoadDelay)}else{makeActiveCellEditable()}}}else{activeRow=activeCell=null}if(n){trigger(self.onActiveCellChanged,getActiveCell())}}function clearTextSelection(){if(document.selection&&document.selection.empty){try{document.selection.empty()}catch(e){}}else if(window.getSelection){var t=window.getSelection();if(t&&t.removeAllRanges){t.removeAllRanges()}}}function isCellPotentiallyEditable(e,t){var n=getDataLength();if(e<n&&!getDataItem(e)){return false}if(columns[t].cannotTriggerInsert&&e>=n){return false}if(!getEditor(e,t)){return false}return true}function makeActiveCellNormal(){if(!currentEditor){return}trigger(self.onBeforeCellEditorDestroy,{editor:currentEditor});currentEditor.destroy();currentEditor=null;if(activeCellNode){var e=getDataItem(activeRow);$(activeCellNode).removeClass("editable invalid");if(e){var t=columns[activeCell];var n=getFormatter(activeRow,t);activeCellNode.innerHTML=n(activeRow,activeCell,getDataItemValueForColumn(e,t),t,e);invalidatePostProcessingResults(activeRow)}}if(navigator.userAgent.toLowerCase().match(/msie/)){clearTextSelection()}getEditorLock().deactivate(editController)}function makeActiveCellEditable(e){if(!activeCellNode){return}if(!options.editable){throw"Grid : makeActiveCellEditable : should never get called when options.editable is false"}clearTimeout(h_editorLoader);if(!isCellPotentiallyEditable(activeRow,activeCell)){return}var t=columns[activeCell];var n=getDataItem(activeRow);if(trigger(self.onBeforeEditCell,{row:activeRow,cell:activeCell,item:n,column:t})===false){setFocus();return}getEditorLock().activate(editController);$(activeCellNode).addClass("editable");if(!e){activeCellNode.innerHTML=""}currentEditor=new(e||getEditor(activeRow,activeCell))({grid:self,gridPosition:absBox($container[0]),position:absBox(activeCellNode),container:activeCellNode,column:t,item:n||{},commitChanges:commitEditAndSetFocus,cancelChanges:cancelEditAndSetFocus});if(n){currentEditor.loadValue(n)}serializedEditorValue=currentEditor.serializeValue();if(currentEditor.position){handleActiveCellPositionChange()}}function commitEditAndSetFocus(){if(getEditorLock().commitCurrentEdit()){setFocus();if(options.autoEdit){navigateDown()}}}function cancelEditAndSetFocus(){if(getEditorLock().cancelCurrentEdit()){setFocus()}}function absBox(e){var t={top:e.offsetTop,left:e.offsetLeft,bottom:0,right:0,width:$(e).outerWidth(),height:$(e).outerHeight(),visible:true};t.bottom=t.top+t.height;t.right=t.left+t.width;var n=e.offsetParent;while((e=e.parentNode)!=document.body){if(t.visible&&e.scrollHeight!=e.offsetHeight&&$(e).css("overflowY")!="visible"){t.visible=t.bottom>e.scrollTop&&t.top<e.scrollTop+e.clientHeight}if(t.visible&&e.scrollWidth!=e.offsetWidth&&$(e).css("overflowX")!="visible"){t.visible=t.right>e.scrollLeft&&t.left<e.scrollLeft+e.clientWidth}t.left-=e.scrollLeft;t.top-=e.scrollTop;if(e===n){t.left+=e.offsetLeft;t.top+=e.offsetTop;n=e.offsetParent}t.bottom=t.top+t.height;t.right=t.left+t.width}return t}function getActiveCellPosition(){return absBox(activeCellNode)}function getGridPosition(){return absBox($container[0])}function handleActiveCellPositionChange(){if(!activeCellNode){return}trigger(self.onActiveCellPositionChanged,{});if(currentEditor){var e=getActiveCellPosition();if(currentEditor.show&&currentEditor.hide){if(!e.visible){currentEditor.hide()}else{currentEditor.show()}}if(currentEditor.position){currentEditor.position(e)}}}function getCellEditor(){return currentEditor}function getActiveCell(){if(!activeCellNode){return null}else{return{row:activeRow,cell:activeCell}}}function getActiveCellNode(){return activeCellNode}function scrollRowIntoView(e,t){var n=e*options.rowHeight;var r=(e+1)*options.rowHeight-viewportH+(viewportHasHScroll?scrollbarDimensions.height:0);if((e+1)*options.rowHeight>scrollTop+viewportH+offset){scrollTo(t?n:r);render()}else if(e*options.rowHeight<scrollTop+offset){scrollTo(t?r:n);render()}}function scrollRowToTop(e){scrollTo(e*options.rowHeight);render()}function scrollPage(e){var t=e*numVisibleRows;scrollTo((getRowFromPosition(scrollTop)+t)*options.rowHeight);render();if(options.enableCellNavigation&&activeRow!=null){var n=activeRow+t;var r=getDataLengthIncludingAddNew();if(n>=r){n=r-1}if(n<0){n=0}var i=0,s=null;var o=activePosX;while(i<=activePosX){if(canCellBeActive(n,i)){s=i}i+=getColspan(n,i)}if(s!==null){setActiveCellInternal(getCellNode(n,s));activePosX=o}else{resetActiveCell()}}}function navigatePageDown(){scrollPage(1)}function navigatePageUp(){scrollPage(-1)}function getColspan(e,t){var n=data.getItemMetadata&&data.getItemMetadata(e);if(!n||!n.columns){return 1}var r=n.columns[columns[t].id]||n.columns[t];var i=r&&r.colspan;if(i==="*"){i=columns.length-t}else{i=i||1}return i}function findFirstFocusableCell(e){var t=0;while(t<columns.length){if(canCellBeActive(e,t)){return t}t+=getColspan(e,t)}return null}function findLastFocusableCell(e){var t=0;var n=null;while(t<columns.length){if(canCellBeActive(e,t)){n=t}t+=getColspan(e,t)}return n}function gotoRight(e,t,n){if(t>=columns.length){return null}do{t+=getColspan(e,t)}while(t<columns.length&&!canCellBeActive(e,t));if(t<columns.length){return{row:e,cell:t,posX:t}}return null}function gotoLeft(e,t,n){if(t<=0){return null}var r=findFirstFocusableCell(e);if(r===null||r>=t){return null}var i={row:e,cell:r,posX:r};var s;while(true){s=gotoRight(i.row,i.cell,i.posX);if(!s){return null}if(s.cell>=t){return i}i=s}}function gotoDown(e,t,n){var r;var i=getDataLengthIncludingAddNew();while(true){if(++e>=i){return null}r=t=0;while(t<=n){r=t;t+=getColspan(e,t)}if(canCellBeActive(e,r)){return{row:e,cell:r,posX:n}}}}function gotoUp(e,t,n){var r;while(true){if(--e<0){return null}r=t=0;while(t<=n){r=t;t+=getColspan(e,t)}if(canCellBeActive(e,r)){return{row:e,cell:r,posX:n}}}}function gotoNext(e,t,n){if(e==null&&t==null){e=t=n=0;if(canCellBeActive(e,t)){return{row:e,cell:t,posX:t}}}var r=gotoRight(e,t,n);if(r){return r}var i=null;var s=getDataLengthIncludingAddNew();while(++e<s){i=findFirstFocusableCell(e);if(i!==null){return{row:e,cell:i,posX:i}}}return null}function gotoPrev(e,t,n){if(e==null&&t==null){e=getDataLengthIncludingAddNew()-1;t=n=columns.length-1;if(canCellBeActive(e,t)){return{row:e,cell:t,posX:t}}}var r;var i;while(!r){r=gotoLeft(e,t,n);if(r){break}if(--e<0){return null}t=0;i=findLastFocusableCell(e);if(i!==null){r={row:e,cell:i,posX:i}}}return r}function navigateRight(){return navigate("right")}function navigateLeft(){return navigate("left")}function navigateDown(){return navigate("down")}function navigateUp(){return navigate("up")}function navigateNext(){return navigate("next")}function navigatePrev(){return navigate("prev")}function navigate(e){if(!options.enableCellNavigation){return false}if(!activeCellNode&&e!="prev"&&e!="next"){return false}if(!getEditorLock().commitCurrentEdit()){return true}setFocus();var t={up:-1,down:1,left:-1,right:1,prev:-1,next:1};tabbingDirection=t[e];var n={up:gotoUp,down:gotoDown,left:gotoLeft,right:gotoRight,prev:gotoPrev,next:gotoNext};var r=n[e];var i=r(activeRow,activeCell,activePosX);if(i){var s=i.row==getDataLength();scrollCellIntoView(i.row,i.cell,!s);setActiveCellInternal(getCellNode(i.row,i.cell));activePosX=i.posX;return true}else{setActiveCellInternal(getCellNode(activeRow,activeCell));return false}}function getCellNode(e,t){if(rowsCache[e]){ensureCellNodesInRowsCache(e);return rowsCache[e].cellNodesByColumnIdx[t]}return null}function setActiveCell(e,t){if(!initialized){return}if(e>getDataLength()||e<0||t>=columns.length||t<0){return}if(!options.enableCellNavigation){return}scrollCellIntoView(e,t,false);setActiveCellInternal(getCellNode(e,t),false)}function canCellBeActive(e,t){if(!options.enableCellNavigation||e>=getDataLengthIncludingAddNew()||e<0||t>=columns.length||t<0){return false}var n=data.getItemMetadata&&data.getItemMetadata(e);if(n&&typeof n.focusable==="boolean"){return n.focusable}var r=n&&n.columns;if(r&&r[columns[t].id]&&typeof r[columns[t].id].focusable==="boolean"){return r[columns[t].id].focusable}if(r&&r[t]&&typeof r[t].focusable==="boolean"){return r[t].focusable}return columns[t].focusable}function canCellBeSelected(e,t){if(e>=getDataLength()||e<0||t>=columns.length||t<0){return false}var n=data.getItemMetadata&&data.getItemMetadata(e);if(n&&typeof n.selectable==="boolean"){return n.selectable}var r=n&&n.columns&&(n.columns[columns[t].id]||n.columns[t]);if(r&&typeof r.selectable==="boolean"){return r.selectable}return columns[t].selectable}function gotoCell(e,t,n){if(!initialized){return}if(!canCellBeActive(e,t)){return}if(!getEditorLock().commitCurrentEdit()){return}scrollCellIntoView(e,t,false);var r=getCellNode(e,t);setActiveCellInternal(r,n||e===getDataLength()||options.autoEdit);if(!currentEditor){setFocus()}}function commitCurrentEdit(){var e=getDataItem(activeRow);var t=columns[activeCell];if(currentEditor){if(currentEditor.isValueChanged()){var n=currentEditor.validate();if(n.valid){if(activeRow<getDataLength()){var r={row:activeRow,cell:activeCell,editor:currentEditor,serializedValue:currentEditor.serializeValue(),prevSerializedValue:serializedEditorValue,execute:function(){this.editor.applyValue(e,this.serializedValue);updateRow(this.row);trigger(self.onCellChange,{row:activeRow,cell:activeCell,item:e})},undo:function(){this.editor.applyValue(e,this.prevSerializedValue);updateRow(this.row);trigger(self.onCellChange,{row:activeRow,cell:activeCell,item:e})}};if(options.editCommandHandler){makeActiveCellNormal();options.editCommandHandler(e,t,r)}else{r.execute();makeActiveCellNormal()}}else{var i={};currentEditor.applyValue(i,currentEditor.serializeValue());makeActiveCellNormal();trigger(self.onAddNewRow,{item:i,column:t})}return!getEditorLock().isActive()}else{$(activeCellNode).removeClass("invalid");$(activeCellNode).width();$(activeCellNode).addClass("invalid");trigger(self.onValidationError,{editor:currentEditor,cellNode:activeCellNode,validationResults:n,row:activeRow,cell:activeCell,column:t});currentEditor.focus();return false}}makeActiveCellNormal()}return true}function cancelCurrentEdit(){makeActiveCellNormal();return true}function rowsToRanges(e){var t=[];var n=columns.length-1;for(var r=0;r<e.length;r++){t.push(new Slick.Range(e[r],0,e[r],n))}return t}function getSelectedRows(){if(!selectionModel){throw"Selection model is not set"}return selectedRows}function setSelectedRows(e){if(!selectionModel){throw"Selection model is not set"}selectionModel.setSelectedRanges(rowsToRanges(e))}var defaults={explicitInitialization:false,rowHeight:25,defaultColumnWidth:80,enableAddRow:false,leaveSpaceForNewRows:false,editable:false,autoEdit:true,enableCellNavigation:true,enableColumnReorder:true,asyncEditorLoading:false,asyncEditorLoadDelay:100,forceFitColumns:false,enableAsyncPostRender:false,asyncPostRenderDelay:50,autoHeight:false,editorLock:Slick.GlobalEditorLock,showHeaderRow:false,headerRowHeight:25,showTopPanel:false,topPanelHeight:25,formatterFactory:null,editorFactory:null,cellFlashingCssClass:"flashing",selectedCellCssClass:"selected",multiSelect:true,enableTextSelectionOnCells:false,dataItemColumnValueExtractor:null,fullWidthRows:false,multiColumnSort:false,defaultFormatter:defaultFormatter,forceSyncScrolling:false,addNewRowCssClass:"new-row"};var columnDefaults={name:"",resizable:true,sortable:false,minWidth:30,rerenderOnResize:false,headerCssClass:null,defaultSortAsc:true,focusable:true,selectable:true};var th;var h;var ph;var n;var cj;var page=0;var offset=0;var vScrollDir=1;var initialized=false;var $container;var uid="slickgrid_"+Math.round(1e6*Math.random());var self=this;var $focusSink,$focusSink2;var $headerScroller;var $headers;var $headerRow,$headerRowScroller,$headerRowSpacer;var $topPanelScroller;var $topPanel;var $viewport;var $canvas;var $style;var $boundAncestors;var stylesheet,columnCssRulesL,columnCssRulesR;var viewportH,viewportW;var canvasWidth;var viewportHasHScroll,viewportHasVScroll;var headerColumnWidthDiff=0,headerColumnHeightDiff=0,cellWidthDiff=0,cellHeightDiff=0;var absoluteColumnMinWidth;var tabbingDirection=1;var activePosX;var activeRow,activeCell;var activeCellNode=null;var currentEditor=null;var serializedEditorValue;var editController;var rowsCache={};var renderedRows=0;var numVisibleRows;var prevScrollTop=0;var scrollTop=0;var lastRenderedScrollTop=0;var lastRenderedScrollLeft=0;var prevScrollLeft=0;var scrollLeft=0;var selectionModel;var selectedRows=[];var plugins=[];var cellCssClasses={};var columnsById={};var sortColumns=[];var columnPosLeft=[];var columnPosRight=[];var h_editorLoader=null;var h_render=null;var h_postrender=null;var postProcessedRows={};var postProcessToRow=null;var postProcessFromRow=null;var counter_rows_rendered=0;var counter_rows_removed=0;var rowNodeFromLastMouseWheelEvent;var zombieRowNodeFromLastMouseWheelEvent;this.debug=function(){var e="";e+="\n"+"counter_rows_rendered:  "+counter_rows_rendered;e+="\n"+"counter_rows_removed:  "+counter_rows_removed;e+="\n"+"renderedRows:  "+renderedRows;e+="\n"+"numVisibleRows:  "+numVisibleRows;e+="\n"+"maxSupportedCssHeight:  "+maxSupportedCssHeight;e+="\n"+"n(umber of pages):  "+n;e+="\n"+"(current) page:  "+page;e+="\n"+"page height (ph):  "+ph;e+="\n"+"vScrollDir:  "+vScrollDir;alert(e)};this.eval=function(expr){return eval(expr)};$.extend(this,{slickGridVersion:"2.1",onScroll:new Slick.Event,onSort:new Slick.Event,onHeaderMouseEnter:new Slick.Event,onHeaderMouseLeave:new Slick.Event,onHeaderContextMenu:new Slick.Event,onHeaderClick:new Slick.Event,onHeaderCellRendered:new Slick.Event,onBeforeHeaderCellDestroy:new Slick.Event,onHeaderRowCellRendered:new Slick.Event,onBeforeHeaderRowCellDestroy:new Slick.Event,onMouseEnter:new Slick.Event,onMouseLeave:new Slick.Event,onClick:new Slick.Event,onDblClick:new Slick.Event,onContextMenu:new Slick.Event,onKeyDown:new Slick.Event,onAddNewRow:new Slick.Event,onValidationError:new Slick.Event,onViewportChanged:new Slick.Event,onColumnsReordered:new Slick.Event,onColumnsResized:new Slick.Event,onCellChange:new Slick.Event,onBeforeEditCell:new Slick.Event,onBeforeCellEditorDestroy:new Slick.Event,onBeforeDestroy:new Slick.Event,onActiveCellChanged:new Slick.Event,onActiveCellPositionChanged:new Slick.Event,onDragInit:new Slick.Event,onDragStart:new Slick.Event,onDrag:new Slick.Event,onDragEnd:new Slick.Event,onSelectedRowsChanged:new Slick.Event,onCellCssStylesChanged:new Slick.Event,registerPlugin:registerPlugin,unregisterPlugin:unregisterPlugin,getColumns:getColumns,setColumns:setColumns,getColumnIndex:getColumnIndex,updateColumnHeader:updateColumnHeader,setSortColumn:setSortColumn,setSortColumns:setSortColumns,getSortColumns:getSortColumns,autosizeColumns:autosizeColumns,getOptions:getOptions,setOptions:setOptions,getData:getData,getDataLength:getDataLength,getDataItem:getDataItem,setData:setData,getSelectionModel:getSelectionModel,setSelectionModel:setSelectionModel,getSelectedRows:getSelectedRows,setSelectedRows:setSelectedRows,getContainerNode:getContainerNode,render:render,invalidate:invalidate,invalidateRow:invalidateRow,invalidateRows:invalidateRows,invalidateAllRows:invalidateAllRows,updateCell:updateCell,updateRow:updateRow,getViewport:getVisibleRange,getRenderedRange:getRenderedRange,resizeCanvas:resizeCanvas,updateRowCount:updateRowCount,scrollRowIntoView:scrollRowIntoView,scrollRowToTop:scrollRowToTop,scrollCellIntoView:scrollCellIntoView,getCanvasNode:getCanvasNode,focus:setFocus,getCellFromPoint:getCellFromPoint,getCellFromEvent:getCellFromEvent,getActiveCell:getActiveCell,setActiveCell:setActiveCell,getActiveCellNode:getActiveCellNode,getActiveCellPosition:getActiveCellPosition,resetActiveCell:resetActiveCell,editActiveCell:makeActiveCellEditable,getCellEditor:getCellEditor,getCellNode:getCellNode,getCellNodeBox:getCellNodeBox,canCellBeSelected:canCellBeSelected,canCellBeActive:canCellBeActive,navigatePrev:navigatePrev,navigateNext:navigateNext,navigateUp:navigateUp,navigateDown:navigateDown,navigateLeft:navigateLeft,navigateRight:navigateRight,navigatePageUp:navigatePageUp,navigatePageDown:navigatePageDown,gotoCell:gotoCell,getTopPanel:getTopPanel,setTopPanelVisibility:setTopPanelVisibility,setHeaderRowVisibility:setHeaderRowVisibility,getHeaderRow:getHeaderRow,getHeaderRowColumn:getHeaderRowColumn,getGridPosition:getGridPosition,flashCell:flashCell,addCellCssStyles:addCellCssStyles,setCellCssStyles:setCellCssStyles,removeCellCssStyles:removeCellCssStyles,getCellCssStyles:getCellCssStyles,init:finishInitialization,destroy:destroy,getEditorLock:getEditorLock,getEditController:getEditController});init()}$.extend(true,window,{Slick:{Grid:SlickGrid}});var scrollbarDimensions;var maxSupportedCssHeight})(jQuery)
