From 671b2b89f24192559a201f49efbf03170e6e3ac9 Mon Sep 17 00:00:00 2001 From: Marcin Warpechowski Date: Tue, 1 Oct 2013 13:46:21 +0200 Subject: [PATCH] angular-ui-handsontable 0.3.17 --- CHANGELOG.md | 8 +++ bower.json | 2 +- dist/angular-ui-handsontable.full.css | 8 +-- dist/angular-ui-handsontable.full.js | 65 +++++++++++++---------- dist/angular-ui-handsontable.full.min.css | 4 +- dist/angular-ui-handsontable.full.min.js | 18 +++---- package.json | 2 +- 7 files changed, 62 insertions(+), 45 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d9eabb69..d2ba41df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## 0.3.17 (Oct 1, 2013) + +Upgrade Handsontable to 0.9.19 (see [changelog](https://github.com/warpech/jquery-handsontable/blob/master/CHANGELOG.md)) + +Includes: +- improved native vertical scrollbar (use directive `scrollbarModelV="'native'"`) +- new plugin hook `afterRenderer` + ## 0.3.16 (Aug 22, 2013) Upgrade Handsontable to 0.9.14 (see [changelog](https://github.com/warpech/jquery-handsontable/blob/master/CHANGELOG.md)) diff --git a/bower.json b/bower.json index 849b91e3..c0a7ec40 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "ng-datagrid", - "version": "0.3.16", + "version": "0.3.17", "devDependencies": { "handsontable": "~0.9.11" }, diff --git a/dist/angular-ui-handsontable.full.css b/dist/angular-ui-handsontable.full.css index ac754f90..42ffb19c 100644 --- a/dist/angular-ui-handsontable.full.css +++ b/dist/angular-ui-handsontable.full.css @@ -1,18 +1,18 @@ /** - * angular-ui-handsontable 0.3.16 + * angular-ui-handsontable 0.3.17 * - * Date: Tue Sep 17 2013 13:59:25 GMT+0200 (Central European Daylight Time) + * Date: Tue Oct 01 2013 13:44:26 GMT+0200 (Central European Daylight Time) */ /** - * Handsontable 0.9.17 + * Handsontable 0.9.19 * Handsontable is a simple jQuery plugin for editable tables with basic copy-paste compatibility with Excel and Google Docs * * Copyright 2012, Marcin Warpechowski * Licensed under the MIT license. * http://handsontable.com/ * - * Date: Tue Sep 17 2013 13:58:44 GMT+0200 (Central European Daylight Time) + * Date: Tue Oct 01 2013 13:17:18 GMT+0200 (Central European Daylight Time) */ .handsontable { diff --git a/dist/angular-ui-handsontable.full.js b/dist/angular-ui-handsontable.full.js index 161c7ba0..798c461e 100644 --- a/dist/angular-ui-handsontable.full.js +++ b/dist/angular-ui-handsontable.full.js @@ -1,7 +1,7 @@ /** - * angular-ui-handsontable 0.3.16 + * angular-ui-handsontable 0.3.17 * - * Date: Tue Sep 17 2013 13:59:25 GMT+0200 (Central European Daylight Time) + * Date: Tue Oct 01 2013 13:44:26 GMT+0200 (Central European Daylight Time) */ /** @@ -428,14 +428,14 @@ angular.module('uiHandsontable', []) return directiveDefinitionObject; }); /** - * Handsontable 0.9.17 + * Handsontable 0.9.19 * Handsontable is a simple jQuery plugin for editable tables with basic copy-paste compatibility with Excel and Google Docs * * Copyright 2012, Marcin Warpechowski * Licensed under the MIT license. * http://handsontable.com/ * - * Date: Tue Sep 17 2013 13:58:44 GMT+0200 (Central European Daylight Time) + * Date: Tue Oct 01 2013 13:17:18 GMT+0200 (Central European Daylight Time) */ /*jslint white: true, browser: true, plusplus: true, indent: 4, maxerr: 50 */ @@ -2356,13 +2356,11 @@ Handsontable.Core = function (rootElement, userSettings) { * @public */ this.render = function () { - instance.PluginHooks.run('beforeRenderMethod'); if (instance.view) { instance.forceFullRender = true; //used when data was changed instance.parseSettingsFromDOM(); selection.refreshBorders(null, true); } - instance.PluginHooks.run('afterRenderMethod'); }; /** @@ -3176,7 +3174,7 @@ Handsontable.Core = function (rootElement, userSettings) { /** * Handsontable version */ - this.version = '0.9.17'; //inserted by grunt from package.json + this.version = '0.9.19'; //inserted by grunt from package.json }; var DefaultSettings = function () { @@ -3616,16 +3614,16 @@ Handsontable.TableView.prototype.getHeight = function () { }; Handsontable.TableView.prototype.beforeRender = function (force) { - if (force) { - this.instance.PluginHooks.run('beforeRender'); + if (force) { //force = did Walkontable decide to do full render + this.instance.PluginHooks.run('beforeRender', this.instance.forceFullRender); //this.instance.forceFullRender = did Handsontable request full render? this.wt.update('width', this.getWidth()); this.wt.update('height', this.getHeight()); } }; Handsontable.TableView.prototype.onDraw = function(force){ - if (force) { - this.instance.PluginHooks.run('afterRender'); + if (force) { //force = did Walkontable decide to do full render + this.instance.PluginHooks.run('afterRender', this.instance.forceFullRender); //this.instance.forceFullRender = did Handsontable request full render? } }; @@ -3640,7 +3638,14 @@ Handsontable.TableView.prototype.applyCellTypeMethod = function (methodName, td, , cellProperties = this.instance.getCellMeta(row, col) , method = Handsontable.helper.getCellMethod(methodName, cellProperties[methodName]); //methodName is 'renderer' or 'editor' - return method(this.instance, td, row, col, prop, this.instance.getDataAtRowProp(row, prop), cellProperties); + var value = this.instance.getDataAtRowProp(row, prop); + var res = method(this.instance, td, row, col, prop, value, cellProperties); + + if (methodName === 'renderer') { + this.instance.PluginHooks.run('afterRenderer', td, row, col, prop, value, cellProperties); + } + + return res; }; /** @@ -3723,6 +3728,13 @@ Handsontable.TableView.prototype.maximumVisibleElementHeight = function (top) { return rootHeight - top; }; +/** + * DOM helper optimized for maximum performance + * It is recommended for Handsontable plugins and renderers, because it is much faster than jQuery + * @type {WalkonableDom} + */ +Handsontable.Dom = new WalkontableDom(); + /** * Returns true if keyCode represents a printable character * @param {Number} keyCode @@ -5292,6 +5304,7 @@ Handsontable.PluginHookClass = (function () { afterLoadData : [], afterUpdateSettings: [], afterRender : [], + afterRenderer : [], afterChange : [], afterValidate: [], afterGetCellMeta: [], @@ -5485,19 +5498,13 @@ Handsontable.PluginHooks = new Handsontable.PluginHookClass(); }; } - instance.addHook('beforeRender', htAutoColumnSize.performScheduledDetermine); - instance.addHook('beforeRenderMethod', htAutoColumnSize.scheduleDetermine); - instance.addHook('beforeChange', htAutoColumnSize.scheduleDetermine); - instance.addHook('afterUpdateSettings', htAutoColumnSize.scheduleDetermine); + instance.addHook('beforeRender', htAutoColumnSize.determineIfChanged); instance.addHook('afterGetColWidth', htAutoColumnSize.getColWidth); instance.addHook('afterDestroy', htAutoColumnSize.afterDestroy); instance.determineColumnWidth = plugin.determineColumnWidth; } else { - instance.removeHook('beforeRender', htAutoColumnSize.performScheduledDetermine); - instance.removeHook('beforeRenderMethod', htAutoColumnSize.scheduleDetermine); - instance.removeHook('beforeChange', htAutoColumnSize.scheduleDetermine); - instance.removeHook('afterUpdateSettings', htAutoColumnSize.scheduleDetermine); + instance.removeHook('beforeRender', htAutoColumnSize.determineIfChanged); instance.removeHook('afterGetColWidth', htAutoColumnSize.getColWidth); instance.removeHook('afterDestroy', htAutoColumnSize.afterDestroy); @@ -5509,14 +5516,9 @@ Handsontable.PluginHooks = new Handsontable.PluginHookClass(); }; - this.scheduleDetermine = function () { - this.autoColumnSizeTmp.determineBeforeNextRender = true; - }; - - this.performScheduledDetermine = function () { - if (this.autoColumnSizeTmp.determineBeforeNextRender) { + this.determineIfChanged = function (force) { + if (force) { htAutoColumnSize.determineColumnsWidth.apply(this, arguments); - this.autoColumnSizeTmp.determineBeforeNextRender = false; } }; @@ -6142,6 +6144,12 @@ Handsontable.PluginHooks.add('afterGetColHeader', htSortColumn.getColHeader); function destroyContextMenu() { var id = this.rootElement[0].id; $.contextMenu('destroy', "#" + id + ' table, #' + id + ' div'); + + /* + * There is a bug in $.contextMenu: 'destroy' does not remove layer when selector is provided. When the below line + * is removed, running the context menu tests in Jasmine will produce invisible layers that are never removed from DOM + */ + $(document.querySelectorAll('#context-menu-layer')).remove(); } Handsontable.PluginHooks.add('afterInit', init); @@ -6267,6 +6275,7 @@ function HandsontableManualColumnMove() { var mover = e.currentTarget; var TH = instance.view.wt.wtDom.closest(mover, 'TH'); startCol = instance.view.wt.wtDom.index(TH) + instance.colOffset(); + endCol = startCol; pressed = true; startX = e.pageX; @@ -8490,7 +8499,7 @@ WalkontableCellStrategy.prototype.countVisible = function () { }; WalkontableCellStrategy.prototype.isLastIncomplete = function () { - return this.remainingSize > 0; + return this.remainingSize >= 0; }; /** * WalkontableClassNameList diff --git a/dist/angular-ui-handsontable.full.min.css b/dist/angular-ui-handsontable.full.min.css index bc29e94f..bf38aee6 100644 --- a/dist/angular-ui-handsontable.full.min.css +++ b/dist/angular-ui-handsontable.full.min.css @@ -1,7 +1,7 @@ /** - * angular-ui-handsontable 0.3.16 + * angular-ui-handsontable 0.3.17 * - * Date: Tue Sep 17 2013 13:47:12 GMT+0200 (Central European Daylight Time) + * Date: Tue Oct 01 2013 13:44:44 GMT+0200 (Central European Daylight Time) */ diff --git a/dist/angular-ui-handsontable.full.min.js b/dist/angular-ui-handsontable.full.min.js index 73204c30..6d0e0868 100644 --- a/dist/angular-ui-handsontable.full.min.js +++ b/dist/angular-ui-handsontable.full.min.js @@ -1,13 +1,13 @@ /** - * angular-ui-handsontable 0.3.16 + * angular-ui-handsontable 0.3.17 * - * Date: Tue Sep 17 2013 13:59:25 GMT+0200 (Central European Daylight Time) + * Date: Tue Oct 01 2013 13:44:26 GMT+0200 (Central European Daylight Time) */ -document.all&&!document.addEventListener&&(document.createElement("ui-handsontable"),document.createElement("datacolumn"),document.createElement("optionlist")),angular.module("uiHandsontable",[]).factory("getHandsontableSettings",function(){return function(t){var e=t.data("uiDatagrid");return e||(e={settings:{columns:[],colHeaders:!0,outsideClickDeselects:!0,autoComplete:[]},$container:$('
')},t.data("uiDatagrid",e)),e}}).factory("getDatacolumnSettings",function(){return function(t){var e=t.data("uiDatagridDatacolumn");return e||(e={},t.data("uiDatagridDatacolumn",e)),e}}).directive("uiHandsontable",function(t,e,o){for(var n=["data","width","height","rowHeaders","colHeaders","colWidths","columns","cells","dataSchema","contextMenu","onSelection","onSelectionByProp","onBeforeChange","onChange","onCopyLimit","startRows","startCols","minRows","minCols","maxRows","maxCols","minSpareRows","minSpareCols","multiSelect","fillHandle","undo","outsideClickDeselects","enterBeginsEditing","enterMoves","tabMoves","autoWrapRow","autoWrapCol","copyRowsLimit","copyColsLimit","currentRowClassName","currentColClassName","asyncRendering","stretchH","columnSorting","manualColumnMove","manualColumnResize","fragmentSelection","scrollbarModelV","scrollbarModelH"],i={selectedIndex:"=selectedindex"},s=0,r=n.length;r>s;s++)i[n[s]]="="+n[s].toLowerCase();var a={restrict:"EA",scope:i,priority:490,compile:function(i,s){var r,a,l,c=function(e,o,n){var i=o.optionList,s=i.match(/^\s*(.+)\s+in\s+(.*)\s*$/);if(!s)throw Error("Expected datarows in form of '_item_ in _collection_' but got '"+i+"'.");var r,a,l,c=s[1],u=s[2],h=e.$new();n.$container.on("blur","textarea",function(){l&&l()}),o.source=function(t,i){l&&l();var s=function(){var t=n.$container.data("handsontable"),o=t.getSelected()[0];return h[n.lhs]=e.$parent.$eval(n.rhs)[o],h.$eval(u)};r=s(),h.$$phase||h.$apply(),i(r),a.$apply(),l=e.$parent.$watch(s,function(e,n){e!==n&&setTimeout(function(){o.source(t,i)},0)}),o.saveOnBlur||(h.$eval(o.value+' = "'+$.trim(t).replace(/"/g,'"')+'"'),h.$apply())},o.sorter=function(t){return t},o.highlighter=function(e){var n,i=h.$new();return i[c]=e,a=i,o.transclude?o.transclude(i,function(t){n=t[0]}):n=t(""+o.optionTemplate+"")(i),n},o.onSelect=function(t,e,n,i,s){h[c]=r[s],h.$eval(o.clickrow),h.$apply()}},u=s.datarows;if(u&&(r=u.match(/^\s*(.+)\s+in\s+(.*)\s*$/)),!r)throw Error("Expected datarows in form of '_item_ in _collection_' but got '"+u+"'.");return a=r[1],l=r[2],function(t,i,s){var r,u,h=o(i);h.lhs=a,h.rhs=l,h.settings=angular.extend(h.settings,t.$parent.$eval(s.uiHandsontable||s.settings));for(r in n)n.hasOwnProperty(r)&&t[n[r]]!==void 0&&(h.settings[n[r]]=t[n[r]]);$(i).append(h.$container);var d=t.$parent.$eval(l);if(d!==void 0&&(h.settings.data=d),h.settings.columns){var p=RegExp("^("+a+"\\.)");for(r=0,u=h.settings.columns.length;u>r;r++)h.settings.columns[r].data=h.settings.columns[r].value.replace(p,""),"autocomplete"===h.settings.columns[r].type&&c(t,h.settings.columns[r],h)}h.settings.afterChange=function(){e.$$phase||t.$apply()},h.settings.afterSelectionByProp=function(e,o,n,i){t.$emit("datagridSelection",h.$container,e,o,n,i)},h.$container.handsontable(h.settings);var f=0;for(t.$watch(function(){if(t.$parent.$eval(l)!==h.$container.handsontable("getData"))return!0;var e=h.$container.data("handsontable"),o=e.countRows();if(f!==o)return f=o;for(var n="",i=e.countCols(),s=e.rowOffset(),r=s+e.countVisibleRows();r>s;s++)for(var a=0;i>a;a++)n+=e.getDataAtCell(s,a);return n},function(e,o){1==e?h.$container.handsontable("loadData",t.$parent.$eval(l)):e!==o&&h.$container.handsontable("render")},!1),r=0,u=n.length;u>r;r++)(function(e){t.$watch(e,function(o,n){if(o!==n){if("columns"===e)for(var i=RegExp("^("+a+"\\.)"),s=0,r=o.length;r>s;s++)o[s].data=o[s].value.replace(i,""),"autocomplete"===o[s].type&&c(t,o[s],h);var l={};l[e]=o,h.$container.handsontable("updateSettings",l)}},!0)})(n[r])}}};return a}).directive("datacolumn",function(t,e){var o={restrict:"E",priority:500,compile:function(o,n){return function(o,i,s){var r,a=t(i.parent()),l=e(i),c=o.$parent.$eval(s.title),u=o.$parent.$eval(s.width),h=o.$parent.$eval(s.type),d=s.options,p=[];for(r in s)n.hasOwnProperty(r)&&p.push(r);l.value=s.value,l.source=null,l.saveOnBlur=-1!==$.inArray("saveonblur",p),l.strict=-1!==$.inArray("strict",p);var f=o.$new(),m=o.$parent.$eval(d)||{};switch(m.value=s.value,m.type=h,m.title=c,m.width=u,h){case"autocomplete":for(r in l)l.hasOwnProperty(r)&&(m[r]=l[r]);break;case"checkbox":s.checkedtemplate!==void 0&&(m.checkedTemplate=o.$parent.$eval(s.checkedtemplate)),s.uncheckedtemplate!==void 0&&(m.uncheckedTemplate=o.$parent.$eval(s.uncheckedtemplate))}s.readonly!==void 0&&(m.readOnly=!0);for(r in s)s.hasOwnProperty(r)&&"$"!==r.charAt(0)&&m[r]===void 0&&(m[r]=f.$eval(s[r]));a.settings.columns.push(m)}}};return o}).directive("optionlist",function(t){var e={restrict:"E",transclude:"element",priority:510,compile:function(e,o,n){return function(e,o,i){var s=t(o.parent());s.optionList=i.datarows,s.clickrow=i.clickrow,s.transclude=n}}};return e}).directive("selectedindex",function(t){var e={restrict:"A",priority:491,compile:function(){return function(e,o){var n,i,s,r=t(o).$container;t(o).settings.afterSelection=function(t,o){n=!0,i=t,s=o,e.$$phase||void 0===e.selectedIndex||e.selectedIndex==t||e.$apply(function(){e.selectedIndex=t})},t(o).settings.afterDeselect=function(){n=!1,i=null,e.$$phase||void 0===e.selectedIndex||null==e.selectedIndex||e.$apply(function(){e.selectedIndex=null})},e.$watch("selectedIndex",function(t){var e=parseInt(t,10);if(t!==void 0&&null!==t&&e!==i){var o=s||0;r.handsontable("selectCell",e,o,e,o,!0)}},!1)}}};return e});var Handsontable={extension:{},helper:{}};(function(t,e,o){"use strict";function n(t){this.instance=t,this.createElements(),this.bindEvents()}function i(t){this.instance=t,this.createElements(),this.bindEvents(),this.emptyStringLabel="   "}function s(t,e,n,i){o.helper.stringify(t.getDataAtRowProp(e,n))===o.helper.stringify(i.checkedTemplate)?t.setDataAtRowProp(e,n,i.uncheckedTemplate):t.setDataAtRowProp(e,n,i.checkedTemplate)}function r(e){if(!t.datepicker)throw Error("jQuery UI Datepicker dependency not found. Did you forget to include jquery-ui.custom.js or its substitute?");this.isCellEdited=!1,this.instance=e;var o=this;this.createElements(),this.bindEvents(),this.instance.addHook("afterDestroy",function(){o.destroyElements()})}function a(t){this.instance=t,this.createElements(),this.bindEvents()}function l(){function t(){var t=this;t.registerTimeout("enableObserveChanges",function(){t.updateSettings({observeChanges:!0})},0)}function e(t){return function(e,o){return e[1]===o[1]?0:null===e[1]?1:null===o[1]?-1:e[1]o[1]?t?1:-1:0}}function o(t){return function(e,o){if(e[1]===o[1])return 0;if(null===e[1])return 1;if(null===o[1])return-1;var n=new Date(e[1]),i=new Date(o[1]);return i>n?t?-1:1:n>i?t?1:-1:0}}function n(t){return t.sortColumn!==void 0}var i=this;this.init=function(e){var o,n,s=this,l=s.getSettings().columnSorting;if(s.sortingEnabled=!!l,s.sortingEnabled){s.sortIndex=[];var c=r.call(s);c!==void 0?(o=c.sortColumn,n=c.sortOrder):(o=l.column,n=l.sortOrder),i.sortByColumn.call(s,o,n),s.sort=function(){var t=Array.prototype.slice.call(arguments);return i.sortByColumn.apply(s,t)},s.getSettings().observeChanges===void 0&&t.call(s),"afterInit"==e&&(a.call(s),s.addHook("afterCreateRow",i.afterCreateRow),s.addHook("afterRemoveRow",i.afterRemoveRow))}else delete s.sort},this.setSortingColumn=function(t,e){var o=this;return t===void 0?(delete o.sortColumn,delete o.sortOrder,void 0):(o.sortOrder=o.sortColumn===t&&e===void 0?!o.sortOrder:e!==void 0?e:!0,o.sortColumn=t,void 0)},this.sortByColumn=function(t,e){var o=this;i.setSortingColumn.call(o,t,e),o.PluginHooks.run("beforeColumnSort",o.sortColumn,o.sortOrder),i.sort.call(o),o.render(),s.call(o),o.PluginHooks.run("afterColumnSort",o.sortColumn,o.sortOrder)};var s=function(){var t=this,e={};t.sortColumn!==void 0&&(e.sortColumn=t.sortColumn),t.sortOrder!==void 0&&(e.sortOrder=t.sortOrder),(e.hasOwnProperty("sortColumn")||e.hasOwnProperty("sortOrder"))&&t.PluginHooks.run("persistentStateSave","columnSorting",e)},r=function(){var t=this,e={};return t.PluginHooks.run("persistentStateLoad","columnSorting",e),e.value},a=function(){function t(){var t=o.view.TBODY.querySelector("tr").querySelectorAll("th");return t.length}function e(e){var n=o.view.wt.wtDom.closest(e,"TH");return o.view.wt.wtDom.index(n)-t()}var o=this;o.rootElement.on("click.handsontable",".columnSorting",function(t){if(o.view.wt.wtDom.hasClass(t.target,"columnSorting")){var n=e(t.target);i.sortByColumn.call(o,n)}})};this.sort=function(){var t=this;if(void 0!==t.sortOrder){t.sortingEnabled=!1,t.sortIndex.length=0;for(var n=this.colOffset(),i=0,s=this.countRows()-t.getSettings().minSpareRows;s>i;i++)this.sortIndex.push([i,t.getDataAtCell(i,this.sortColumn+n)]);var r,a=t.getCellMeta(0,t.sortColumn);switch(a.type){case"date":r=o;break;default:r=e}this.sortIndex.sort(r(t.sortOrder));for(var i=this.sortIndex.length;t.countRows()>i;i++)this.sortIndex.push([i,t.getDataAtCell(i,this.sortColumn+n)]);t.sortingEnabled=!0}},this.translateRow=function(t){var e=this;return e.sortingEnabled&&e.sortIndex&&e.sortIndex.length?e.sortIndex[t][0]:t},this.onBeforeGetSet=function(t){var e=this;t.row=i.translateRow.call(e,t.row)},this.untranslateRow=function(t){if(sortingEnabled&&this.sortIndex&&this.sortIndex.length)for(var e=0;this.sortIndex.length>e;e++)if(this.sortIndex[e][0]==t)return e},this.getColHeader=function(t,e){this.getSettings().columnSorting&&this.view.wt.wtDom.addClass(e.querySelector(".colHeader"),"columnSorting")},this.afterCreateRow=function(t){var e=this;if(n(e)){e.sortIndex.splice(t,0,[t,e.getData()[t][this.sortColumn+e.colOffset()]]);for(var o=0;e.sortIndex.length>o;o++)o!=t&&e.sortIndex[o][0]>=t&&(e.sortIndex[o][0]+=1);s.call(e)}},this.afterRemoveRow=function(t,e){var o=this;if(n(o)){o.sortIndex.splice(t,e);for(var i=0;o.sortIndex.length>i;i++)o.sortIndex[i][0]>t&&(o.sortIndex[i][0]-=e);s.call(o)}},this.afterChangeSort=function(t){var e=this,o=!1,n={};if(t){for(var s=0;t.length>s;s++)if(t[s][1]==e.sortColumn){o=!0,n.row=i.translateRow.call(e,t[s][0]),n.col=t[s][1];break}o&&setTimeout(function(){i.sort.call(e),e.render(),e.selectCell(i.untranslateRow.call(e,n.row),n.col)},0)}}}function c(){var e,o,n,i,s,r=document.createElement("DIV"),a=r.style;r.className="ghost",a.position="absolute",a.top="25px",a.left=0,a.width="10px",a.height="10px",a.backgroundColor="#CCC",a.opacity=.7;var l=function(){var t=this;t.PluginHooks.run("persistentStateSave","manualColumnPositions",t.manualColumnPositions)},c=function(){var t=this,e={};return t.PluginHooks.run("persistentStateLoad","manualColumnPositions",e),e.value},u=function(){var c=this;c.rootElement.on("mousemove.manualColumnMove",function(t){e&&(a.left=s+t.pageX-i+6+"px","none"===a.display&&(a.display="block"))}),c.rootElement.on("mouseup.manualColumnMove",function(){e&&(n>o&&n--,c.getSettings().rowHeaders&&(o--,n--),c.manualColumnPositions.splice(n,0,c.manualColumnPositions.splice(o,1)[0]),t(".manualColumnMover.active").removeClass("active"),e=!1,c.forceFullRender=!0,c.view.render(),a.display="none",l.call(c),c.PluginHooks.run("afterColumnMove",o,n))}),c.rootElement.on("mousedown.manualColumnMove",".manualColumnMover",function(t){var n=t.currentTarget,l=c.view.wt.wtDom.closest(n,"TH");o=c.view.wt.wtDom.index(l)+c.colOffset(),e=!0,i=t.pageX;var u=c.$table[0];u.parentNode.appendChild(r),a.width=c.view.wt.wtDom.outerWidth(l)+"px",a.height=c.view.wt.wtDom.outerHeight(u)+"px",s=parseInt(c.view.wt.wtDom.offset(l).left-c.view.wt.wtDom.offset(u).left,10),a.left=s+6+"px"}),c.rootElement.on("mouseenter.manualColumnMove","td, th",function(){if(e){var t=c.view.THEAD.querySelector(".manualColumnMover.active");t&&c.view.wt.wtDom.removeClass(t,"active"),n=c.view.wt.wtDom.index(this)+c.colOffset();var o=c.view.THEAD.querySelectorAll("th"),i=o[n].querySelector(".manualColumnMover");c.view.wt.wtDom.addClass(i,"active")}}),c.addHook("afterDestroy",h)},h=function(){var t=this;t.rootElement.off("mouseup.manualColumnMove"),t.rootElement.off("mousemove.manualColumnMove"),t.rootElement.off("mousedown.manualColumnMove"),t.rootElement.off("mouseenter.manualColumnMove")};this.beforeInit=function(){this.manualColumnPositions=[]},this.init=function(t){var e=this,o=!!this.getSettings().manualColumnMove;if(o){var n=this.getSettings().manualColumnMove,i=c.call(e);this.manualColumnPositions=i!==void 0?i:n instanceof Array?n:[],e.forceFullRender=!0,"afterInit"==t&&(u.call(this),this.manualColumnPositions.length>0&&(this.forceFullRender=!0,this.render()))}else h.call(this),this.manualColumnPositions=[]},this.modifyCol=function(t){return this.getSettings().manualColumnMove?(this.manualColumnPositions[t]===void 0&&(this.manualColumnPositions[t]=t),this.manualColumnPositions[t]):t},this.getColHeader=function(t,e){if(this.getSettings().manualColumnMove){var o=document.createElement("DIV");o.className="manualColumnMover",e.firstChild.appendChild(o)}}}function u(){function e(t){a=this,i=t;var e=this.view.wt.wtTable.getCoords(t)[1];if(e>=0){s=e;var o=this.view.wt.wtDom.offset(this.rootElement[0]).left,n=this.view.wt.wtDom.offset(t).left;h=n-o-6,this.view.wt.wtDom.getComputedStyle(t),d.style.left=h+parseInt(this.view.wt.wtDom.outerWidth(t),10)+"px",this.rootElement[0].appendChild(d)}}function o(){var t=this;2*parseInt(this.view.wt.wtDom.getComputedStyle(i).borderWidth,10),u=parseInt(this.view.wt.wtDom.outerWidth(i),10),t.view.wt.wtDom.addClass(d,"active"),m.height=t.view.wt.wtDom.outerHeight(t.$table[0])+"px",n=t}var n,i,s,r,a,l,c,u,h,d=document.createElement("DIV"),p=document.createElement("DIV"),f=document.createElement("DIV"),m=f.style;d.className="manualColumnResizer",p.className="manualColumnResizerHandle",d.appendChild(p),f.className="manualColumnResizerLine",d.appendChild(f);var g=t(document);g.mousemove(function(t){n&&(r=u+(t.pageX-c),l=b(s,r),d.style.left=h+r+"px")}),g.mouseup(function(){n&&(a.view.wt.wtDom.removeClass(d,"active"),n=!1,l!=u&&(a.forceFullRender=!0,a.view.render(),v.call(a),a.PluginHooks.run("afterColumnResize",s,l)),e.call(a,i))});var v=function(){var t=this;t.PluginHooks.run("persistentStateSave","manualColumnWidths",t.manualColumnWidths)},w=function(){var t=this,e={};return t.PluginHooks.run("persistentStateLoad","manualColumnWidths",e),e.value},y=function(){var t=this,i=0,r=null;this.rootElement.on("mouseenter.handsontable","th",function(o){n||e.call(t,o.currentTarget)}),this.rootElement.on("mousedown.handsontable",".manualColumnResizer",function(){null==r&&(r=setTimeout(function(){i>=2&&(l=t.determineColumnWidth.call(t,s),b(s,l),t.forceFullRender=!0,t.view.render(),t.PluginHooks.run("afterColumnResize",s,l)),i=0,r=null},500)),i++}),this.rootElement.on("mousedown.handsontable",".manualColumnResizer",function(e){c=e.pageX,o.call(t),l=u})};this.beforeInit=function(){this.manualColumnWidths=[]},this.init=function(t){var e=this,o=!!this.getSettings().manualColumnResize;if(o){var n=this.getSettings().manualColumnResize,i=w.call(e);this.manualColumnWidths=i!==void 0?i:n instanceof Array?n:[],"afterInit"==t&&(y.call(this),e.forceFullRender=!0,e.render())}};var b=function(t,e){return e=Math.max(e,20),t=a.PluginHooks.execute("modifyCol",t),a.manualColumnWidths[t]=e,e};this.getColWidth=function(t,e){this.getSettings().manualColumnResize&&this.manualColumnWidths[t]&&(e.width=this.manualColumnWidths[t])}}function h(t){var o,n=function(){e.localStorage[t+"__"+"persistentStateKeys"]=JSON.stringify(o)},i=function(){var n=e.localStorage[t+"__"+"persistentStateKeys"],i="string"==typeof n?JSON.parse(n):void 0;o=i?i:[]},s=function(){o=[],n()};i(),this.saveValue=function(i,s){e.localStorage[t+"_"+i]=JSON.stringify(s),-1==o.indexOf(i)&&(o.push(i),n())},this.loadValue=function(o,n){o=o!==void 0?o:n;var i=e.localStorage[t+"_"+o];return i===void 0?void 0:JSON.parse(i)},this.reset=function(o){e.localStorage.removeItem(t+"_"+o)},this.resetAll=function(){for(var n=0;o.length>n;n++)e.localStorage.removeItem(t+"_"+o[n]);s()}}function d(){var t,e,o=this;this.copyCallbacks=[],this.cutCallbacks=[],this.pasteCallbacks=[];var n=document.documentElement;e=document.body,document.getElementById("CopyPasteDiv")?(this.elDiv=document.getElementById("CopyPasteDiv"),this.elTextarea=this.elDiv.firstChild):(this.elDiv=document.createElement("DIV"),this.elDiv.id="CopyPasteDiv",t=this.elDiv.style,t.position="fixed",t.top=0,t.left=0,e.appendChild(this.elDiv),this.elTextarea=document.createElement("TEXTAREA"),this.elTextarea.className="copyPaste",t=this.elTextarea.style,t.width="1px",t.height="1px",this.elDiv.appendChild(this.elTextarea),t.opacity!==void 0&&(t.opacity=0)),this._bindEvent(n,"keydown",function(t){var e=!1;if(t.metaKey?e=!0:t.ctrlKey&&-1===navigator.userAgent.indexOf("Mac")&&(e=!0),e){if(document.activeElement!==o.elTextarea&&(""!=o.getSelectionText()||-1!=["INPUT","SELECT","TEXTAREA"].indexOf(document.activeElement.nodeName)))return;o.selectNodeText(o.elTextarea),setTimeout(function(){o.selectNodeText(o.elTextarea)},0)}!e||67!==t.keyCode&&86!==t.keyCode&&88!==t.keyCode||(88===t.keyCode?setTimeout(function(){o.triggerCut(t)},0):86===t.keyCode&&setTimeout(function(){o.triggerPaste(t)},0))})}function p(e,o){var n;this.instance=e,this.settings=o,this.wtDom=this.instance.wtDom,this.main=document.createElement("div"),n=this.main.style,n.position="absolute",n.top=0,n.left=0;for(var i=0;5>i;i++){var s=document.createElement("DIV");s.className="wtBorder "+(o.className||""),n=s.style,n.backgroundColor=o.border.color,n.height=o.border.width+"px",n.width=o.border.width+"px",this.main.appendChild(s)}this.top=this.main.childNodes[0],this.left=this.main.childNodes[1],this.bottom=this.main.childNodes[2],this.right=this.main.childNodes[3],this.topStyle=this.top.style,this.leftStyle=this.left.style,this.bottomStyle=this.bottom.style,this.rightStyle=this.right.style,this.corner=this.main.childNodes[4],this.corner.className+=" corner",this.cornerStyle=this.corner.style,this.cornerStyle.width="5px",this.cornerStyle.height="5px",this.cornerStyle.border="2px solid #FFF",this.disappear(),e.wtTable.bordersHolder||(e.wtTable.bordersHolder=document.createElement("div"),e.wtTable.bordersHolder.className="htBorders",e.wtTable.hider.appendChild(e.wtTable.bordersHolder)),e.wtTable.bordersHolder.appendChild(this.main);var r=!1,a=t(document.body);a.on("mousedown.walkontable."+e.guid,function(){r=!0}),a.on("mouseup.walkontable."+e.guid,function(){r=!1}),t(this.main.childNodes).on("mouseenter",function(o){if(r&&e.getSetting("hideBorderOnMouseDownOver")){o.preventDefault(),o.stopImmediatePropagation();var n=this.getBoundingClientRect(),i=t(this);i.hide();var s=function(t){return t.clientYMath.ceil(n.top+n.height)?!0:t.clientXMath.ceil(n.left+n.width)?!0:void 0};a.on("mousemove.border."+e.guid,function(t){s(t)&&(a.off("mousemove.border."+e.guid),i.show())})}})}function f(){this.offset=0,this.total=0,this.fixedCount=0}function m(){}function g(){this.cache=[]}function v(){this.countTH=0}function w(t,e,o){var n,i=0;for(this.containerSizeFn=t,this.cellSizesSum=0,this.cellSizes=[],this.cellStretch=[],this.cellCount=0,this.remainingSize=0,this.strategy=o;;){if(n=e(i),void 0===n)break;if(this.cellSizesSum>=this.getContainerSize(this.cellSizesSum+n))break;this.cellSizes.push(n),this.cellSizesSum+=n,this.cellCount++,i++}var s=this.getContainerSize(this.cellSizesSum);this.remainingSize=this.cellSizesSum-s}function y(t){var n=this,i=[];if(this.guid="wt_"+(e.Handsontable?o.helper.randomString():""),this.wtSettings=new H(this,t),this.wtDom=new b,this.wtTable=new A(this),this.wtScroll=new x(this),this.wtViewport=new P(this),this.wtScrollbars=new k(this),this.wtWheel=new M(this),this.wtEvent=new C(this),this.wtTable.THEAD.childNodes.length&&this.wtTable.THEAD.childNodes[0].childNodes.length){for(var s=0,r=this.wtTable.THEAD.childNodes[0].childNodes.length;r>s;s++)i.push(this.wtTable.THEAD.childNodes[0].childNodes[s].innerHTML);this.getSetting("columnHeaders").length||this.update("columnHeaders",[function(t,e){n.wtDom.fastInnerText(e,i[t])}])}this.selections={};var a=this.getSetting("selections");if(a)for(var l in a)a.hasOwnProperty(l)&&(this.selections[l]=new D(this,a[l]));this.drawn=!1,this.drawInterrupted=!1,e.Handsontable&&o.PluginHooks.add("beforeChange",function(){n.rowHeightCache&&(n.rowHeightCache.length=0)})}function b(){}function C(e){var o=this;this.instance=e,this.wtDom=this.instance.wtDom;var n=[null,null,null,null];this.instance.dblClickTimeout=null;var i,s=function(t){var e=o.parentCell(t.target);e.TD&&"TD"===e.TD.nodeName?o.instance.hasSetting("onCellMouseDown")&&o.instance.getSetting("onCellMouseDown",t,e.coords,e.TD):o.wtDom.hasClass(t.target,"corner")&&o.instance.getSetting("onCellCornerMouseDown",t,t.target),2!==t.button&&(e.TD&&"TD"===e.TD.nodeName?(n.shift(),n.push(e.TD)):o.wtDom.hasClass(t.target,"corner")&&(n.shift(),n.push(t.target)))},r=function(t){if(o.instance.hasSetting("onCellMouseOver")){var e=o.instance.wtTable.TABLE,n=o.wtDom.closest(t.target,["TD","TH"],e);n&&n!==i&&o.wtDom.isChildOf(n,e)&&(i=n,"TD"===n.nodeName&&o.instance.getSetting("onCellMouseOver",t,o.instance.wtTable.getCoords(n),n))}},a=function(t){if(2!==t.button){var e=o.parentCell(t.target);e.TD&&"TD"===e.TD.nodeName?(n.shift(),n.push(e.TD)):(n.shift(),n.push(t.target)),null!==n[3]&&n[3]===n[2]&&(o.instance.dblClickTimeout&&n[2]===n[1]&&n[1]===n[0]?(e.TD?o.instance.getSetting("onCellDblClick",t,e.coords,e.TD):o.wtDom.hasClass(t.target,"corner")&&o.instance.getSetting("onCellCornerDblClick",t,e.coords,e.TD),clearTimeout(o.instance.dblClickTimeout),o.instance.dblClickTimeout=null):(clearTimeout(o.instance.dblClickTimeout),o.instance.dblClickTimeout=setTimeout(function(){o.instance.dblClickTimeout=null},500)))}};t(this.instance.wtTable.holder).on("mousedown",s),t(this.instance.wtTable.TABLE).on("mouseover",r),t(this.instance.wtTable.holder).on("mouseup",a)}function S(){}function T(t,e){this.containerSizeFn=t,this.sizeAtIndex=e,this.cellSizesSum=0,this.cellSizes=[],this.cellCount=0,this.remainingSize=-1/0}function x(t){this.instance=t}function E(){}function R(){this.lastWindowScrollPosition=0/0,this.maxOuts=10}function k(t){switch("native"===t.getSetting("scrollbarModelV")&&t.update("scrollbarModelH","none"),t.getSetting("scrollbarModelV")){case"dragdealer":this.vertical=new F(t);break;case"native":this.vertical=new U(t)}switch(t.getSetting("scrollbarModelH")){case"dragdealer":this.horizontal=new j(t);break;case"native":this.horizontal=new Y(t)}}function D(t,e){this.instance=t,this.settings=e,this.selected=[],e.border&&(this.border=new p(t,e))}function H(t,e){var o=this;this.instance=t,this.defaults={table:void 0,scrollH:"auto",scrollV:"auto",scrollbarModelH:"dragdealer",scrollbarModelV:"dragdealer",stretchH:"hybrid",currentRowClassName:null,currentColumnClassName:null,data:void 0,offsetRow:0,offsetColumn:0,fixedColumnsLeft:0,fixedRowsTop:0,rowHeaders:function(){return[]},columnHeaders:function(){return[]},totalRows:void 0,totalColumns:void 0,width:null,height:null,cellRenderer:function(t,e,n){var i=o.getSetting("data",t,e);o.instance.wtDom.fastInnerText(n,void 0===i||null===i?"":i)},columnWidth:50,selections:null,hideBorderOnMouseDownOver:!1,onCellMouseDown:null,onCellMouseOver:null,onCellDblClick:null,onCellCornerMouseDown:null,onCellCornerDblClick:null,beforeDraw:null,onDraw:null,scrollbarWidth:10,scrollbarHeight:10},this.settings={};for(var n in this.defaults)if(this.defaults.hasOwnProperty(n))if(void 0!==e[n])this.settings[n]=e[n];else{if(void 0===this.defaults[n])throw Error('A required setting "'+n+'" was not provided');this.settings[n]=this.defaults[n]}}function A(t){this.instance=t,this.TABLE=this.instance.getSetting("table"),this.wtDom=this.instance.wtDom,this.wtDom.removeTextNodes(this.TABLE);var e=this.TABLE.parentNode;if(!e||1!==e.nodeType||!this.wtDom.hasClass(e,"wtHolder")){var o=document.createElement("DIV");o.className="wtSpreader",e&&e.insertBefore(o,this.TABLE),o.appendChild(this.TABLE)}if(this.spreader=this.TABLE.parentNode,e=this.spreader.parentNode,!e||1!==e.nodeType||!this.wtDom.hasClass(e,"wtHolder")){var n=document.createElement("DIV");n.className="wtHider",e&&e.insertBefore(n,this.spreader),n.appendChild(this.spreader)}if(this.hider=this.spreader.parentNode,this.hiderStyle=this.hider.style,this.hiderStyle.position="relative",e=this.hider.parentNode,!e||1!==e.nodeType||!this.wtDom.hasClass(e,"wtHolder")){var i=document.createElement("DIV");i.style.position="relative",i.className="wtHolder",e&&e.insertBefore(i,this.hider),i.appendChild(this.hider)}if(this.holder=this.hider.parentNode,this.TBODY=this.TABLE.getElementsByTagName("TBODY")[0],this.TBODY||(this.TBODY=document.createElement("TBODY"),this.TABLE.appendChild(this.TBODY)),this.THEAD=this.TABLE.getElementsByTagName("THEAD")[0],this.THEAD||(this.THEAD=document.createElement("THEAD"),this.TABLE.insertBefore(this.THEAD,this.TBODY)),this.COLGROUP=this.TABLE.getElementsByTagName("COLGROUP")[0],this.COLGROUP||(this.COLGROUP=document.createElement("COLGROUP"),this.TABLE.insertBefore(this.COLGROUP,this.THEAD)),this.instance.getSetting("columnHeaders").length&&!this.THEAD.childNodes.length){var s=document.createElement("TR");this.THEAD.appendChild(s)}this.colgroupChildrenLength=this.COLGROUP.childNodes.length,this.theadChildrenLength=this.THEAD.firstChild?this.THEAD.firstChild.childNodes.length:0,this.tbodyChildrenLength=this.TBODY.childNodes.length,this.oldCellCache=new g,this.currentCellCache=new g,this.rowFilter=new S,this.columnFilter=new v,this.verticalRenderReverse=!1,("native"===this.instance.getSetting("scrollbarModelV")||"native"===this.instance.getSetting("scrollbarModelH"))&&(this.instance.isNativeScroll=!0)}function P(o){if(this.instance=o,this.resetSettings(),this.instance.isNativeScroll){var n=this;n.clientHeight=document.documentElement.clientHeight,t(e).on("resize",function(){n.clientHeight=document.documentElement.clientHeight})}}function M(e){e.isNativeScroll||t(e.wtTable.spreader).on("mousewheel",function(t,o,n,i){n||i||!o||(i=o),(n||i)&&(i>0&&0===e.getSetting("offsetRow")||0>i&&e.wtTable.isLastRowFullyVisible()||0>n&&0===e.getSetting("offsetColumn")||n>0&&e.wtTable.isLastColumnFullyVisible()||(clearTimeout(e.wheelTimeout),e.wheelTimeout=setTimeout(function(){i?e.wtScrollbars.vertical.visible&&e.scrollVertical(-Math.ceil(i)).draw():n&&e.wtScrollbars.horizontal.visible&&e.scrollHorizontal(Math.ceil(n)).draw()},0),t.preventDefault()))})}o.activeGuid=null,o.Core=function(n,i){function s(){var t=!1;return{validatorsInQueue:0,addValidatorToQueue:function(){this.validatorsInQueue++,t=!1},removeValidatorFormQueue:function(){this.validatorsInQueue=0>this.validatorsInQueue-1?0:this.validatorsInQueue-1,this.checkIfQueueIsEmpty()},onQueueEmpty:function(){},checkIfQueueIsEmpty:function(){0==this.validatorsInQueue&&0==t&&(t=!0,this.onQueueEmpty())}}}function r(e,o,n){function i(){var i;e.length&&(i=g.PluginHooks.execute("beforeChange",e,o),"function"==typeof i?t.when(result).then(function(){n()}):i===!1&&e.splice(0,e.length)),"function"!=typeof i&&n()}var r=new s;r.onQueueEmpty=i;for(var a=e.length-1;a>=0;a--)if(null===e[a])e.splice(a,1);else{var l=h.propToCol(e[a][1]),c=g.runHooksAndReturn("modifyCol",l),u=g.getCellMeta(e[a][0],c);"number"===u.dataType&&"string"==typeof e[a][3]&&e[a][3].length>0&&/^-?[\d\s]*\.?\d*$/.test(e[a][3])&&(e[a][3]=numeral().unformat(e[a][3]||"0")),u.validator&&(r.addValidatorToQueue(),g.validateCell(e[a][3],u,function(t,o){return function(n){if("boolean"!=typeof n)throw Error("Validation error: result is not boolean");n===!1&&o.allowInvalid===!1&&(e.splice(t,1),--t),r.removeValidatorFormQueue()}}(a,u),o))}r.checkIfQueueIsEmpty()}function a(t,e){var o=t.length-1;if(!(0>o)){for(;o>=0;o--)if(null!==t[o]){if(u.settings.minSpareRows)for(;t[o][0]>g.countRows()-1;)h.createRow();if("array"===u.dataType&&u.settings.minSpareCols)for(;h.propToCol(t[o][1])>g.countCols()-1;)h.createCol();h.set(t[o][0],t[o][1],t[o][3])}else t.splice(o,1);g.forceFullRender=!0,d.adjustRowsAndCols(),p.refreshBorders(null,!0),g.PluginHooks.run("afterChange",t,e||"edit")}}function l(e,o,n){return"object"==typeof e?e:t.isPlainObject(n)?n:[[e,o,n]]}function c(t){if(t.hasOwnProperty("type")){var e,n;if("object"==typeof t.type)e=t.type;else if("string"==typeof t.type&&(e=o.cellTypes[t.type],void 0===e))throw Error('You declared cell type "'+t.type+'" as a string that is not mapped to a known object. Cell type must be an object or a string mapped to an object in Handsontable.cellTypes');for(n in e)e.hasOwnProperty(n)&&!t.hasOwnProperty(n)&&(t[n]=e[n])}}var u,h,d,p,f,m,g=this,v=function(){};o.helper.inherit(v,O),o.helper.extend(v.prototype,o.TextCell),c(i),o.helper.extend(v.prototype,i),this.rootElement=n;var w=t(document.documentElement),y=t(document.body);this.guid="ht_"+o.helper.randomString(),this.rootElement[0].id||(this.rootElement[0].id=this.guid),u={cellSettings:[],columnSettings:[],columnsSettingConflicts:["data","width"],settings:new v,settingsFromDOM:{},selStart:new o.SelectionPoint,selEnd:new o.SelectionPoint,editProxy:!1,isPopulated:null,scrollable:null,extensions:{},colToProp:null,propToCol:null,dataSchema:null,dataType:"array",firstRun:!0},h={recursiveDuckSchema:function(e){var o;if(t.isPlainObject(e)){o={};for(var n in e)e.hasOwnProperty(n)&&(o[n]=t.isPlainObject(e[n])?h.recursiveDuckSchema(e[n]):null)}else o=[];return o},recursiveDuckColumns:function(e,o,n){var i,s;if(o===void 0&&(o=0,n=""),t.isPlainObject(e))for(s in e)e.hasOwnProperty(s)&&(null===e[s]?(i=n+s,u.colToProp.push(i),u.propToCol[i]=o,o++):o=h.recursiveDuckColumns(e[s],o,s+"."));return o},createMap:function(){if(h.getSchema()===void 0)throw Error("trying to create `columns` definition but you didnt' provide `schema` nor `data`");var t,e,o=h.getSchema();if(u.colToProp=[],u.propToCol={},u.settings.columns)for(t=0,e=u.settings.columns.length;e>t;t++)u.colToProp[t]=u.settings.columns[t].data,u.propToCol[u.settings.columns[t].data]=t;else h.recursiveDuckColumns(o)},colToProp:function(t){return t=o.PluginHooks.execute(g,"modifyCol",t),u.colToProp&&u.colToProp[t]!==void 0?u.colToProp[t]:t},propToCol:function(t){var e;return e=u.propToCol[t]!==void 0?u.propToCol[t]:t,e=o.PluginHooks.execute(g,"modifyCol",e)},getSchema:function(){return u.settings.dataSchema?"function"==typeof u.settings.dataSchema?u.settings.dataSchema():u.settings.dataSchema:u.duckDataSchema},createRow:function(e,o){var n,i,s=g.countCols(),r=0;for(o||(o=1),("number"!=typeof e||e>=g.countRows())&&(e=g.countRows()),i=e;o>r&&g.countRows()a;a++)n.push(null)}else n="function"===u.dataType?u.settings.dataSchema(e):t.extend(!0,{},h.getSchema());e===g.countRows()?v.prototype.data.push(n):v.prototype.data.splice(e,0,n),r++,i++}return g.PluginHooks.run("afterCreateRow",e,r),g.forceFullRender=!0,r},createCol:function(t,e){if("object"===u.dataType||u.settings.columns)throw Error("Cannot create new column. When data source in an object, you can only have as much columns as defined in first data row, data schema or in the 'columns' setting");var n,i,s=g.countRows(),r=v.prototype.data,a=0;for(e||(e=1),i=t;e>a&&g.countCols()=g.countCols()){for(var l=0;s>l;l++)r[l]===void 0&&(r[l]=[]),r[l].push(null);u.columnSettings.push(n)}else{for(var l=0;s>l;l++)r[l].splice(i,0,null);u.columnSettings.splice(i,0,n)}a++,i++}return g.PluginHooks.run("afterCreateCol",t,a),g.forceFullRender=!0,a},removeRow:function(t,e){e||(e=1),"number"!=typeof t&&(t=-e),t=(g.countRows()+t)%g.countRows();var o=this.physicalRowsToLogical(t,e);g.PluginHooks.run("beforeRemoveRow",t,e);var n=v.prototype.data.filter(function(t,e){return-1==o.indexOf(e) -});v.prototype.data.length=0,Array.prototype.push.apply(v.prototype.data,n),g.PluginHooks.run("afterRemoveRow",t,e),g.forceFullRender=!0},removeCol:function(t,e){if("object"===u.dataType||u.settings.columns)throw Error("cannot remove column with object data source or columns option specified");e||(e=1),"number"!=typeof t&&(t=-e),t=(g.countCols()+t)%g.countCols(),g.PluginHooks.run("beforeRemoveCol",t,e);for(var o=v.prototype.data,n=0,i=g.countRows();i>n;n++)o[n].splice(t,e);u.columnSettings.splice(t,e),g.PluginHooks.run("afterRemoveCol",t,e),g.forceFullRender=!0},spliceCol:function(t,e,n){var i=arguments.length>=4?[].slice.call(arguments,3):[],s=g.getDataAtCol(t),r=s.slice(e,e+n),a=s.slice(e+n);o.helper.extendArray(i,a);for(var l=0;n>l;)i.push(null),l++;return o.helper.to2dArray(i),g.populateFromArray(e,t,i,null,null,"spliceCol"),r},spliceRow:function(t,e,n){var i=arguments.length>=4?[].slice.call(arguments,3):[],s=g.getDataAtRow(t),r=s.slice(e,e+n),a=s.slice(e+n);o.helper.extendArray(i,a);for(var l=0;n>l;)i.push(null),l++;return g.populateFromArray(t,e,[i],null,null,"spliceRow"),r},getVars:{},get:function(t,e){if(h.getVars.row=t,h.getVars.prop=e,g.PluginHooks.run("beforeGet",h.getVars),"string"==typeof h.getVars.prop&&h.getVars.prop.indexOf(".")>-1){var o=h.getVars.prop.split("."),n=u.settings.data[h.getVars.row];if(!n)return null;for(var i=0,s=o.length;s>i;i++)if(n=n[o[i]],n===void 0)return null;return n}return"function"==typeof h.getVars.prop?h.getVars.prop(u.settings.data.slice(h.getVars.row,h.getVars.row+1)[0]):u.settings.data[h.getVars.row]?u.settings.data[h.getVars.row][h.getVars.prop]:null},setVars:{},set:function(t,e,o,n){if(h.setVars.row=t,h.setVars.prop=e,h.setVars.value=o,g.PluginHooks.run("beforeSet",h.setVars,n||"datamapGet"),"string"==typeof h.setVars.prop&&h.setVars.prop.indexOf(".")>-1){for(var i=h.setVars.prop.split("."),s=u.settings.data[h.setVars.row],r=0,a=i.length-1;a>r;r++)s=s[i[r]];s[i[r]]=h.setVars.value}else"function"==typeof h.setVars.prop?h.setVars.prop(u.settings.data.slice(h.setVars.row,h.setVars.row+1)[0],h.setVars.value):u.settings.data[h.setVars.row][h.setVars.prop]=h.setVars.value},physicalRowsToLogical:function(t,e){for(var o=(v.prototype.data.length+t)%v.prototype.data.length,n=[],i=e;v.prototype.data.length>o&&i;)this.get(o,0),n.push(this.getVars.row),i--,o++;return n},clear:function(){for(var t=0;g.countRows()>t;t++)for(var e=0;g.countCols()>e;e++)h.set(t,h.colToProp(e),"")},getAll:function(){return u.settings.data},getRange:function(t,e){var o,n,i,s,r,a=[];for(n=Math.max(t.row,e.row),s=Math.max(t.col,e.col),o=Math.min(t.row,e.row);n>=o;o++){for(r=[],i=Math.min(t.col,e.col);s>=i;i++)r.push(h.get(o,h.colToProp(i)));a.push(r)}return a},getText:function(t,e){return SheetClip.stringify(h.getRange(t,e))}},d={alter:function(e,n,i,s,r){var a,l;switch(a=t.extend(!0,[],h.getAll()),i=i||1,e){case"insert_row":l=h.createRow(n,i),l&&(u.selStart.exists()&&u.selStart.row()>=n?(u.selStart.row(u.selStart.row()+l),p.transformEnd(l,0)):p.refreshBorders());break;case"insert_col":if(l=h.createCol(n,i)){if(o.helper.isArray(g.getSettings().colHeaders)){var c=[n,0];c.length+=l,Array.prototype.splice.apply(g.getSettings().colHeaders,c)}u.selStart.exists()&&u.selStart.col()>=n?(u.selStart.col(u.selStart.col()+l),p.transformEnd(0,l)):p.refreshBorders()}break;case"remove_row":h.removeRow(n,i),u.cellSettings.splice(n,i),d.adjustRowsAndCols(),p.refreshBorders();break;case"remove_col":h.removeCol(n,i);for(var f=0,m=h.getAll().length;m>f;f++)f in u.cellSettings&&u.cellSettings[f].splice(n,i);o.helper.isArray(g.getSettings().colHeaders)&&(n===void 0&&(n=-1),g.getSettings().colHeaders.splice(n,i)),u.columnSettings.splice(n,i),d.adjustRowsAndCols(),p.refreshBorders();break;default:throw Error('There is no such action "'+e+'"')}r||d.adjustRowsAndCols()},adjustRowsAndCols:function(){var t,e,o,n=g.countEmptyRows(!0);if(e=g.countRows(),u.settings.minRows>e)for(t=0;u.settings.minRows-e>t;t++)h.createRow();if(u.settings.minSpareRows>n)for(;u.settings.minSpareRows>n&&g.countRows()o)for(;u.settings.minSpareCols>o&&g.countCols()u.settings.minRows&&u.settings.minSpareRows&&n>u.settings.minSpareRows;n--)h.removeRow();if(u.settings.enterBeginsEditing&&!u.settings.columns)for(;(u.settings.minCols||u.settings.minSpareCols)&&g.countCols()>u.settings.minCols&&u.settings.minSpareCols&&o>u.settings.minSpareCols;o--)h.removeCol();var i=g.countRows(),s=g.countCols();if((0===i||0===s)&&p.deselect(),u.selStart.exists()){var r,a=u.selStart.row(),l=u.selStart.col(),c=u.selEnd.row(),d=u.selEnd.col();a>i-1?(a=i-1,r=!0,c>a&&(c=a)):c>i-1&&(c=i-1,r=!0,a>c&&(a=c)),l>s-1?(l=s-1,r=!0,d>l&&(d=l)):d>s-1&&(d=s-1,r=!0,l>d&&(l=d)),r&&g.selectCell(a,l,c,d)}},populateFromArray:function(t,e,n,i,s){var r,a,l,c,h=[],d={};if(a=e.length,0===a)return!1;var p,f,m,v;switch(s){case"shift_down":for(p=n?n.col-t.col+1:0,f=n?n.row-t.row+1:0,e=o.helper.translateRowsToColumns(e),l=0,c=e.length,m=Math.max(c,p);m>l;l++)if(c>l){for(r=0,a=e[l].length;f-a>r;r++)e[l].push(e[l][r%a]);e[l].unshift(t.col+l,t.row,0),g.spliceCol.apply(g,e[l])}else e[l%c][0]=t.col+l,g.spliceCol.apply(g,e[l%c]);break;case"shift_right":for(p=n?n.col-t.col+1:0,f=n?n.row-t.row+1:0,r=0,a=e.length,v=Math.max(a,f);v>r;r++)if(a>r){for(l=0,c=e[r].length;p-c>l;l++)e[r].push(e[r][l%c]);e[r].unshift(t.row+r,t.col,0),g.spliceRow.apply(g,e[r])}else e[r%a][0]=t.row+r,g.spliceRow.apply(g,e[r%a]);break;case"overwrite":default:for(d.row=t.row,d.col=t.col,r=0;a>r&&!(n&&d.row>n.row||!u.settings.minSpareRows&&d.row>g.countRows()-1||d.row>=u.settings.maxRows);r++){for(d.col=t.col,c=e[r]?e[r].length:0,l=0;c>l&&!(n&&d.col>n.col||!u.settings.minSpareCols&&d.col>g.countCols()-1||d.col>=u.settings.maxCols);l++)g.getCellMeta(d.row,d.col).readOnly||h.push([d.row,d.col,e[r][l]]),d.col++,n&&l===c-1&&(l=-1);d.row++,n&&r===a-1&&(r=-1)}g.setDataAtCell(h,null,null,i||"populateFromArray")}},getCornerCoords:function(e){function o(e,o,n){function i(t){return t[n]}return Array.prototype.map?e.apply(Math,o.map(i)):e.apply(Math,t.map(o,i))}return{TL:{row:o(Math.min,e,"row"),col:o(Math.min,e,"col")},BR:{row:o(Math.max,e,"row"),col:o(Math.max,e,"col")}}},getCellsAtCoords:function(t,e){var o,n,i=d.getCornerCoords([t,e]),s=[];for(o=i.TL.row;i.BR.row>=o;o++)for(n=i.TL.col;i.BR.col>=n;n++)s.push(g.view.getCellAtCoords({row:o,col:n}));return s}},this.selection=p={inProgress:!1,begin:function(){g.selection.inProgress=!0},finish:function(){var t=g.getSelected();g.PluginHooks.run("afterSelectionEnd",t[0],t[1],t[2],t[3]),g.PluginHooks.run("afterSelectionEndByProp",t[0],g.colToProp(t[1]),t[2],g.colToProp(t[3])),g.selection.inProgress=!1},isInProgress:function(){return g.selection.inProgress},setRangeStart:function(t){u.selStart.coords(t),p.setRangeEnd(t)},setRangeEnd:function(t,e){g.selection.begin(),u.selEnd.coords(t),u.settings.multiSelect||u.selStart.coords(t),g.view.wt.selections.current.clear(),g.view.wt.selections.current.add(u.selStart.arr()),g.view.wt.selections.area.clear(),p.isMultiple()&&(g.view.wt.selections.area.add(u.selStart.arr()),g.view.wt.selections.area.add(u.selEnd.arr())),(u.settings.currentRowClassName||u.settings.currentColClassName)&&(g.view.wt.selections.highlight.clear(),g.view.wt.selections.highlight.add(u.selStart.arr()),g.view.wt.selections.highlight.add(u.selEnd.arr())),g.PluginHooks.run("afterSelection",u.selStart.row(),u.selStart.col(),u.selEnd.row(),u.selEnd.col()),g.PluginHooks.run("afterSelectionByProp",u.selStart.row(),h.colToProp(u.selStart.col()),u.selEnd.row(),h.colToProp(u.selEnd.col())),e!==!1&&g.view.scrollViewport(t),p.refreshBorders()},refreshBorders:function(t,e){e||f.destroy(t),g.view.render(),p.isSelected()&&!e&&f.prepare()},isMultiple:function(){return!(u.selEnd.col()===u.selStart.col()&&u.selEnd.row()===u.selStart.row())},transformStart:function(t,e,o){u.selStart.row()+t>g.countRows()-1?o&&u.settings.minSpareRows>0?g.alter("insert_row",g.countRows()):u.settings.autoWrapCol&&(t=1-g.countRows(),e=u.selStart.col()+e==g.countCols()-1?1-g.countCols():1):u.settings.autoWrapCol&&0>u.selStart.row()+t&&u.selStart.col()+e>=0&&(t=g.countRows()-1,e=0==u.selStart.col()+e?g.countCols()-1:-1),u.selStart.col()+e>g.countCols()-1?o&&u.settings.minSpareCols>0?g.alter("insert_col",g.countCols()):u.settings.autoWrapRow&&(t=u.selStart.row()+t==g.countRows()-1?1-g.countRows():1,e=1-g.countCols()):u.settings.autoWrapRow&&0>u.selStart.col()+e&&u.selStart.row()+t>=0&&(t=0==u.selStart.row()+t?g.countRows()-1:-1,e=g.countCols()-1);var n=g.countRows(),i=g.countCols(),s={row:u.selStart.row()+t,col:u.selStart.col()+e};0>s.row?s.row=0:s.row>0&&s.row>=n&&(s.row=n-1),0>s.col?s.col=0:s.col>0&&s.col>=i&&(s.col=i-1),p.setRangeStart(s)},transformEnd:function(t,e){if(u.selEnd.exists()){var o=g.countRows(),n=g.countCols(),i={row:u.selEnd.row()+t,col:u.selEnd.col()+e};0>i.row?i.row=0:i.row>0&&i.row>=o&&(i.row=o-1),0>i.col?i.col=0:i.col>0&&i.col>=n&&(i.col=n-1),p.setRangeEnd(i)}},isSelected:function(){return u.selEnd.exists()},inInSelection:function(t){if(!p.isSelected())return!1;var e=d.getCornerCoords([u.selStart.coords(),u.selEnd.coords()]);return e.TL.row<=t.row&&e.BR.row>=t.row&&e.TL.col<=t.col&&e.BR.col>=t.col},deselect:function(){p.isSelected()&&(g.selection.inProgress=!1,u.selEnd=new o.SelectionPoint,g.view.wt.selections.current.clear(),g.view.wt.selections.area.clear(),f.destroy(),p.refreshBorders(),g.PluginHooks.run("afterDeselect"))},selectAll:function(){u.settings.multiSelect&&(p.setRangeStart({row:0,col:0}),p.setRangeEnd({row:g.countRows()-1,col:g.countCols()-1},!1))},empty:function(){if(p.isSelected()){var t,e,o=d.getCornerCoords([u.selStart.coords(),u.selEnd.coords()]),n=[];for(t=o.TL.row;o.BR.row>=t;t++)for(e=o.TL.col;o.BR.col>=e;e++)g.getCellMeta(t,e).readOnly||n.push([t,e,""]);g.setDataAtCell(n)}}},this.autofill=m={handle:null,init:function(){m.handle?m.handle.disabled=!1:m.handle={}},disable:function(){m.handle.disabled=!0},selectAdjacent:function(){var t,e,o,n,i;t=p.isMultiple()?g.view.wt.selections.area.getCorners():g.view.wt.selections.current.getCorners(),e=h.getAll();t:for(o=t[2]+1;g.countRows()>o;o++){for(i=t[1];t[3]>=i;i++)if(e[o][i])break t;(e[o][t[1]-1]||e[o][t[3]+1])&&(n=o)}n&&(g.view.wt.selections.fill.clear(),g.view.wt.selections.fill.add([t[0],t[1]]),g.view.wt.selections.fill.add([n,t[3]]),m.apply())},apply:function(){var t,e,o,n,i;m.handle.isDragged=0,t=g.view.wt.selections.fill.getCorners(),t&&(g.view.wt.selections.fill.clear(),e=p.isMultiple()?g.view.wt.selections.area.getCorners():g.view.wt.selections.current.getCorners(),t[0]===e[0]&&t[1]e[3]?(o={row:t[0],col:e[3]+1},n={row:t[2],col:t[3]}):t[0]e[2]&&t[1]===e[1]&&(o={row:e[2]+1,col:t[1]},n={row:t[2],col:t[3]}),o&&(i=SheetClip.parse(h.getText(u.selStart.coords(),u.selEnd.coords())),g.PluginHooks.run("beforeAutofill",o,n,i),d.populateFromArray(o,i,n,"autofill"),p.setRangeStart({row:t[0],col:t[1]}),p.setRangeEnd({row:t[2],col:t[3]})))},showBorder:function(t){t.row=t[0],t.col=t[1];var e=d.getCornerCoords([u.selStart.coords(),u.selEnd.coords()]);if("horizontal"!==u.settings.fillHandle&&(e.BR.rowt.row))t=[t.row,e.BR.col];else{if("vertical"===u.settings.fillHandle)return;t=[e.BR.row,t.col]}g.view.wt.selections.fill.clear(),g.view.wt.selections.fill.add([u.selStart.coords().row,u.selStart.coords().col]),g.view.wt.selections.fill.add([u.selEnd.coords().row,u.selEnd.coords().col]),g.view.wt.selections.fill.add(t),g.view.render()}},f={init:function(){function t(t){if(g.isListening()&&(u.settings.beforeOnKeyDown&&u.settings.beforeOnKeyDown.call(g,t),!Array.prototype.filter.call(document.body.querySelectorAll(".context-menu-list"),g.view.wt.wtDom.isVisible).length)){if(17===t.keyCode||224===t.keyCode||91===t.keyCode||93===t.keyCode)return f.setCopyableText(),void 0;if(u.lastKeyCode=t.keyCode,p.isSelected()){var e=(t.ctrlKey||t.metaKey)&&!t.altKey;o.helper.isPrintableChar(t.keyCode)&&e&&65===t.keyCode&&(p.selectAll(),f.setCopyableText(),t.preventDefault(),t.stopImmediatePropagation());var n=t.shiftKey?p.setRangeEnd:p.setRangeStart;if(g.PluginHooks.run("beforeKeyDown",t),!t.isImmediatePropagationStopped())switch(t.keyCode){case 38:t.shiftKey?p.transformEnd(-1,0):p.transformStart(-1,0),t.preventDefault(),t.stopPropagation();break;case 9:var i="function"==typeof u.settings.tabMoves?u.settings.tabMoves(t):u.settings.tabMoves;t.shiftKey?p.transformStart(-i.row,-i.col):p.transformStart(i.row,i.col,!0),t.preventDefault(),t.stopPropagation();break;case 39:t.shiftKey?p.transformEnd(0,1):p.transformStart(0,1),t.preventDefault(),t.stopPropagation();break;case 37:t.shiftKey?p.transformEnd(0,-1):p.transformStart(0,-1),t.preventDefault(),t.stopPropagation();break;case 8:case 46:p.empty(t),t.preventDefault();break;case 40:t.shiftKey?p.transformEnd(1,0):p.transformStart(1,0),t.preventDefault(),t.stopPropagation();break;case 113:t.preventDefault();break;case 13:var s="function"==typeof u.settings.enterMoves?u.settings.enterMoves(t):u.settings.enterMoves;t.shiftKey?p.transformStart(-s.row,-s.col):p.transformStart(s.row,s.col,!0),t.preventDefault();break;case 36:t.ctrlKey||t.metaKey?n({row:0,col:u.selStart.col()}):n({row:u.selStart.row(),col:0}),t.preventDefault(),t.stopPropagation();break;case 35:t.ctrlKey||t.metaKey?n({row:g.countRows()-1,col:u.selStart.col()}):n({row:u.selStart.row(),col:g.countCols()-1}),t.preventDefault(),t.stopPropagation();break;case 33:p.transformStart(-g.countVisibleRows(),0),g.view.wt.scrollVertical(-g.countVisibleRows()),g.view.render(),t.preventDefault(),t.stopPropagation();break;case 34:p.transformStart(g.countVisibleRows(),0),g.view.wt.scrollVertical(g.countVisibleRows()),g.view.render(),t.preventDefault(),t.stopPropagation();break;default:}}}}u.onCut=function(){g.isListening()&&p.empty()},u.onPaste=function(t){if(g.isListening()&&p.isSelected()){var e=t.replace(/^[\r\n]*/g,"").replace(/[\r\n]*$/g,""),o=SheetClip.parse(e),n=d.getCornerCoords([u.selStart.coords(),u.selEnd.coords()]),i=n.TL,s={row:Math.max(n.BR.row,o.length-1+n.TL.row),col:Math.max(n.BR.col,o[0].length-1+n.TL.col)};g.PluginHooks.once("afterChange",function(t){t&&t.length&&g.selectCell(i.row,i.col,s.row,s.col)}),d.populateFromArray(i,o,s,"paste",u.settings.pasteMode)}},g.copyPaste=z.getInstance(),g.copyPaste.onCut(u.onCut),g.copyPaste.onPaste(u.onPaste),w.on("keydown.handsontable."+g.guid,t)},destroy:function(t){if("function"==typeof u.editorDestroyer){var e=u.editorDestroyer;u.editorDestroyer=null,e(t)}},setCopyableText:function(){var t=Math.min(u.selStart.row(),u.selEnd.row()),e=Math.min(u.selStart.col(),u.selEnd.col()),o=Math.max(u.selStart.row(),u.selEnd.row()),n=Math.max(u.selStart.col(),u.selEnd.col()),i=Math.min(o,t+u.settings.copyRowsLimit-1),s=Math.min(n,e+u.settings.copyColsLimit-1);g.copyPaste.copyable(h.getText({row:t,col:e},{row:i,col:s})),(o!==i||n!==s)&&g.PluginHooks.run("afterCopyLimit",o-t+1,n-e+1,u.settings.copyRowsLimit,u.settings.copyColsLimit)},prepare:function(){if(!g.getCellMeta(u.selStart.row(),u.selStart.col()).readOnly){var t=g.view.getCellAtCoords(u.selStart.coords());u.editorDestroyer=g.view.applyCellTypeMethod("editor",t,u.selStart.row(),u.selStart.col())}}},this.init=function(){g.PluginHooks.run("beforeInit"),f.init(),this.updateSettings(u.settings,!0),this.parseSettingsFromDOM(),this.view=new o.TableView(this),this.forceFullRender=!0,this.view.render(),"object"==typeof u.firstRun&&(g.PluginHooks.run("afterChange",u.firstRun[0],u.firstRun[1]),u.firstRun=!1),g.PluginHooks.run("afterInit")},this.validateCell=function(t,e,o,n){var i=e.validator;"[object RegExp]"===Object.prototype.toString.call(i)&&(i=function(t){return function(e,o){o(t.test(e))}}(i)),"function"==typeof i?(t=g.PluginHooks.execute("beforeValidate",t,e.row,e.prop,n),i.call(e,t,function(i){e.valid=i,i=g.PluginHooks.execute("afterValidate",i,t,e.row,e.prop,n),o(i)})):(e.valid=!0,o(!0))},this.setDataAtCell=function(t,e,o,n){var i,s,c,u=l(t,e,o),d=[];for(i=0,s=u.length;s>i;i++){if("object"!=typeof u[i])throw Error("Method `setDataAtCell` accepts row number or changes array of arrays as its first parameter");if("number"!=typeof u[i][1])throw Error("Method `setDataAtCell` accepts row and column number as its parameters. If you want to use object property name, use method `setDataAtRowProp`");c=h.colToProp(u[i][1]),d.push([u[i][0],c,h.get(u[i][0],c),u[i][2]])}n||"object"!=typeof t||(n=e),r(d,n,function(){a(d,n)})},this.setDataAtRowProp=function(t,e,o,n){var i,s,c=l(t,e,o),u=[];for(i=0,s=c.length;s>i;i++)u.push([c[i][0],c[i][1],h.get(c[i][0],c[i][1]),c[i][2]]);n||"object"!=typeof t||(n=e),r(u,n,function(){a(u,n)})},this.listen=function(){o.activeGuid=g.guid,document.activeElement&&document.activeElement!==document.body?document.activeElement.blur():document.activeElement||document.body.focus()},this.unlisten=function(){o.activeGuid=null},this.isListening=function(){return o.activeGuid===g.guid},this.destroyEditor=function(t){p.refreshBorders(t)},this.populateFromArray=function(t,e,o,n,i,s,r){if("object"!=typeof o)throw Error("populateFromArray parameter `input` must be an array");return d.populateFromArray({row:t,col:e},o,"number"==typeof n?{row:n,col:i}:null,s,r)},this.spliceCol=function(){return h.spliceCol.apply(null,arguments)},this.spliceRow=function(){return h.spliceRow.apply(null,arguments)},this.getCornerCoords=function(t){return d.getCornerCoords(t)},this.getSelected=function(){return p.isSelected()?[u.selStart.row(),u.selStart.col(),u.selEnd.row(),u.selEnd.col()]:void 0},this.parseSettingsFromDOM=function(){var t=this.rootElement.css("overflow");if("scroll"===t||"auto"===t?(this.rootElement[0].style.overflow="visible",u.settingsFromDOM.overflow=t):(void 0===u.settings.width||void 0===u.settings.height)&&(u.settingsFromDOM.overflow="auto"),u.settingsFromDOM.width=void 0===u.settings.width?this.rootElement.width():void 0,u.settingsFromDOM.height=void 0,void 0===u.settings.height&&("scroll"===u.settingsFromDOM.overflow||"auto"===u.settingsFromDOM.overflow)){var o=this.rootElement[0].cloneNode(!1),n=this.rootElement[0].parentNode;if(n){o.removeAttribute("id"),n.appendChild(o);var i=parseInt(e.getComputedStyle(o,null).getPropertyValue("height"),10);isNaN(i)&&o.currentStyle&&(i=parseInt(o.currentStyle.height,10)),i>0&&(u.settingsFromDOM.height=i),n.removeChild(o)}}},this.render=function(){g.PluginHooks.run("beforeRenderMethod"),g.view&&(g.forceFullRender=!0,g.parseSettingsFromDOM(),p.refreshBorders(null,!0)),g.PluginHooks.run("afterRenderMethod")},this.loadData=function(e){if(!e.push||!e.splice)throw Error("loadData only accepts array of objects or array of arrays ("+typeof e+" given)");u.isPopulated=!1,v.prototype.data=e,u.dataType=u.settings.dataSchema instanceof Array||e[0]instanceof Array?"array":t.isFunction(u.settings.dataSchema)?"function":"object",u.duckDataSchema=e[0]?h.recursiveDuckSchema(e[0]):{},h.createMap(),d.adjustRowsAndCols(),g.PluginHooks.run("afterLoadData"),u.firstRun?u.firstRun=[null,"loadData"]:(g.PluginHooks.run("afterChange",null,"loadData"),g.render()),u.isPopulated=!0},this.getData=function(t,e,o,n){return t===void 0?h.getAll():h.getRange({row:t,col:e},{row:o,col:n})},this.updateSettings=function(t,e){var n,i,s,r,a;if(t.rows!==void 0)throw Error("'rows' setting is no longer supported. do you mean startRows, minRows or maxRows?");if(t.cols!==void 0)throw Error("'cols' setting is no longer supported. do you mean startCols, minCols or maxCols?");for(n in t)"data"!==n&&(void 0!==g.PluginHooks.hooks.persistent[n]||void 0!==g.PluginHooks.legacy[n]?g.PluginHooks.add(n,t[n]):(!e&&t.hasOwnProperty(n)&&(v.prototype[n]=t[n]),o.extension[n]&&(u.extensions[n]=new o.extension[n](g,t[n]))));if(void 0===t.data&&void 0===u.settings.data){var l,f=[];for(i=0,s=u.settings.startRows;s>i;i++){for(l=[],r=0,a=u.settings.startCols;a>r;r++)l.push(null);f.push(l)}g.loadData(f)}else void 0!==t.data?g.loadData(t.data):void 0!==t.columns&&h.createMap();if(a=g.countCols(),u.cellSettings.length=0,a>0){var w,y;for(n=0;a>n;n++)u.columnSettings[n]=o.helper.columnFactory(v,u.columnsSettingConflicts),w=u.columnSettings[n].prototype,v.prototype.columns&&(y=v.prototype.columns[n],c(y),o.helper.extend(w,y))}t.fillHandle!==void 0&&(m.handle&&t.fillHandle===!1?m.disable():m.handle||t.fillHandle===!1||m.init()),e||g.PluginHooks.run("afterUpdateSettings"),d.adjustRowsAndCols(),g.view&&(g.forceFullRender=!0,p.refreshBorders(null,!0))},this.getSettings=function(){return u.settings},this.getSettingsFromDOM=function(){return u.settingsFromDOM},this.clear=function(){p.selectAll(),p.empty()},this.alter=function(t,e,o,n,i){d.alter(t,e,o,n,i)},this.getCell=function(t,e){return g.view.getCellAtCoords({row:t,col:e})},this.colToProp=function(t){return h.colToProp(t)},this.propToCol=function(t){return h.propToCol(t)},this.getDataAtCell=function(t,e){return h.get(t,h.colToProp(e))},this.getDataAtRowProp=function(t,e){return h.get(t,e)},this.getDataAtCol=function(t){return[].concat.apply([],h.getRange({row:0,col:t},{row:u.settings.data.length-1,col:t}))},this.getDataAtProp=function(t){return[].concat.apply([],h.getRange({row:0,col:h.propToCol(t)},{row:u.settings.data.length-1,col:h.propToCol(t)}))},this.getDataAtRow=function(t){return u.settings.data[t]},this.getCellMeta=function(t,e){function n(t){var e={row:t};return g.PluginHooks.execute("beforeGet",e),e.row}function i(t){return o.PluginHooks.execute(g,"modifyCol",t)}var s,r=h.colToProp(e);if(t=n(t),e=i(e),u.columnSettings[e]===void 0&&(u.columnSettings[e]=o.helper.columnFactory(v,u.columnsSettingConflicts)),u.cellSettings[t]||(u.cellSettings[t]=[]),u.cellSettings[t][e]||(u.cellSettings[t][e]=new u.columnSettings[e]),s=u.cellSettings[t][e],s.row=t,s.col=e,s.prop=r,s.instance=g,g.PluginHooks.run("beforeGetCellMeta",t,e,s),c(s),s.cells){var a=s.cells.call(s,t,e,r);a&&(c(a),o.helper.extend(s,a))}return g.PluginHooks.run("afterGetCellMeta",t,e,s),s},this.validateCells=function(t){var e=new s;e.onQueueEmpty=t;for(var o=g.countRows()-1;o>=0;){for(var n=g.countCols()-1;n>=0;)e.addValidatorToQueue(),g.validateCell(g.getDataAtCell(o,n),g.getCellMeta(o,n),function(){e.removeValidatorFormQueue()},"validateCells"),n--;o--}e.checkIfQueueIsEmpty()},this.getRowHeader=function(t){if(void 0===t){for(var e=[],o=0,n=g.countRows();n>o;o++)e.push(g.getRowHeader(o));return e}return"[object Array]"===Object.prototype.toString.call(u.settings.rowHeaders)&&void 0!==u.settings.rowHeaders[t]?u.settings.rowHeaders[t]:"function"==typeof u.settings.rowHeaders?u.settings.rowHeaders(t):u.settings.rowHeaders&&"string"!=typeof u.settings.rowHeaders&&"number"!=typeof u.settings.rowHeaders?t+1:u.settings.rowHeaders},this.getColHeader=function(t){if(void 0===t){for(var e=[],n=0,i=g.countCols();i>n;n++)e.push(g.getColHeader(n));return e}return t=o.PluginHooks.execute(g,"modifyCol",t),u.settings.columns&&u.settings.columns[t]&&u.settings.columns[t].title?u.settings.columns[t].title:"[object Array]"===Object.prototype.toString.call(u.settings.colHeaders)&&void 0!==u.settings.colHeaders[t]?u.settings.colHeaders[t]:"function"==typeof u.settings.colHeaders?u.settings.colHeaders(t):u.settings.colHeaders&&"string"!=typeof u.settings.colHeaders&&"number"!=typeof u.settings.colHeaders?o.helper.spreadsheetColumnLabel(t):u.settings.colHeaders},this._getColWidthFromSettings=function(t){var e=g.getCellMeta(0,t),o=e.width;if((void 0===o||o===u.settings.width)&&(o=e.colWidths),void 0!==o){switch(typeof o){case"object":o=o[t];break;case"function":o=o(t)}"string"==typeof o&&(o=parseInt(o,10))}return o},this.getColWidth=function(t){t=o.PluginHooks.execute(g,"modifyCol",t);var e={width:g._getColWidthFromSettings(t)};return e.width||(e.width=50),g.PluginHooks.run("afterGetColWidth",t,e),e.width},this.countRows=function(){return u.settings.data.length},this.countCols=function(){return"object"===u.dataType||"function"===u.dataType?u.settings.columns&&u.settings.columns.length?u.settings.columns.length:u.colToProp.length:"array"===u.dataType?u.settings.columns&&u.settings.columns.length?u.settings.columns.length:u.settings.data&&u.settings.data[0]&&u.settings.data[0].length?u.settings.data[0].length:0:void 0},this.rowOffset=function(){return g.view.wt.getSetting("offsetRow")},this.colOffset=function(){return g.view.wt.getSetting("offsetColumn")},this.countVisibleRows=function(){return g.view.wt.drawn?g.view.wt.wtTable.rowStrategy.countVisible():-1},this.countVisibleCols=function(){return g.view.wt.drawn?g.view.wt.wtTable.columnStrategy.countVisible():-1},this.countEmptyRows=function(t){for(var e=g.countRows()-1,o=0;e>=0;){if(h.get(e,0),g.isEmptyRow(h.getVars.row))o++;else if(t)break;e--}return o},this.countEmptyCols=function(t){if(1>g.countRows())return 0;for(var e=g.countCols()-1,o=0;e>=0;){if(g.isEmptyCol(e))o++;else if(t)break;e--}return o},this.isEmptyRow=function(t){if(u.settings.isEmptyRow)return u.settings.isEmptyRow.call(g,t);for(var e,o=0,n=g.countCols();n>o;o++)if(e=g.getDataAtCell(t,o),""!==e&&null!==e&&e!==void 0)return!1;return!0},this.isEmptyCol=function(t){if(u.settings.isEmptyCol)return u.settings.isEmptyCol.call(g,t);for(var e,o=0,n=g.countRows();n>o;o++)if(e=g.getDataAtCell(o,t),""!==e&&null!==e&&e!==void 0)return!1;return!0},this.selectCell=function(t,e,o,n,i){if("number"!=typeof t||0>t||t>=g.countRows())return!1;if("number"!=typeof e||0>e||e>=g.countCols())return!1;if(o!==void 0){if("number"!=typeof o||0>o||o>=g.countRows())return!1;if("number"!=typeof n||0>n||n>=g.countCols())return!1}return u.selStart.coords({row:t,col:e}),document.activeElement&&document.activeElement!==document.documentElement&&document.activeElement!==document.body&&document.activeElement.blur(),g.listen(),o===void 0?p.setRangeEnd({row:t,col:e},i):p.setRangeEnd({row:o,col:n},i),g.selection.finish(),!0},this.selectCellByProp=function(){return arguments[1]=h.propToCol(arguments[1]),arguments[3]!==void 0&&(arguments[3]=h.propToCol(arguments[3])),g.selectCell.apply(g,arguments)},this.deselectCell=function(){p.deselect()},this.destroy=function(){g.clearTimeouts(),g.view&&g.view.wt.destroy(),g.rootElement.empty(),g.rootElement.removeData("handsontable"),g.rootElement.off(".handsontable"),t(e).off("."+g.guid),w.off("."+g.guid),y.off("."+g.guid),g.copyPaste.removeCallback(u.onCut),g.copyPaste.removeCallback(u.onPaste),g.PluginHooks.run("afterDestroy")},this.getInstance=function(){return g.rootElement.data("handsontable")},function(){g.PluginHooks=new o.PluginHookClass;var t=g.PluginHooks.run,e=g.PluginHooks.execute;g.PluginHooks.run=function(e,n,i,s,r,a){t.call(this,g,e,n,i,s,r,a),o.PluginHooks.run(g,e,n,i,s,r,a)},g.PluginHooks.execute=function(t,n,i,s,r,a){var l=o.PluginHooks.execute(g,t,n,i,s,r,a),c=e.call(this,g,t,l,i,s,r,a);return c===void 0?l:c},g.addHook=function(){g.PluginHooks.add.apply(g.PluginHooks,arguments)},g.addHookOnce=function(){g.PluginHooks.once.apply(g.PluginHooks,arguments)},g.removeHook=function(){g.PluginHooks.remove.apply(g.PluginHooks,arguments)},g.runHooks=function(){g.PluginHooks.run.apply(g.PluginHooks,arguments)},g.runHooksAndReturn=function(){return g.PluginHooks.execute.apply(g.PluginHooks,arguments)}}(),this.timeouts={},this.registerTimeout=function(t,e,o){clearTimeout(this.timeouts[t]),this.timeouts[t]=setTimeout(e,o||0)},this.clearTimeouts=function(){for(var t in this.timeouts)this.timeouts.hasOwnProperty(t)&&clearTimeout(this.timeouts[t])},this.version="0.9.17"};var O=function(){};O.prototype={data:void 0,width:void 0,height:void 0,startRows:5,startCols:5,minRows:0,minCols:0,maxRows:1/0,maxCols:1/0,minSpareRows:0,minSpareCols:0,multiSelect:!0,fillHandle:!0,fixedRowsTop:0,fixedColumnsLeft:0,outsideClickDeselects:!0,enterBeginsEditing:!0,enterMoves:{row:1,col:0},tabMoves:{row:0,col:1},autoWrapRow:!1,autoWrapCol:!1,copyRowsLimit:1e3,copyColsLimit:1e3,pasteMode:"overwrite",currentRowClassName:void 0,currentColClassName:void 0,stretchH:"hybrid",isEmptyRow:void 0,isEmptyCol:void 0,observeDOMVisibility:!0,allowInvalid:!0,invalidCellClassName:"htInvalid",fragmentSelection:!1,readOnly:!1,scrollbarModelV:"dragdealer",scrollbarModelH:"dragdealer"},t.fn.handsontable=function(t){var e,n,i,s,r,a=this.first(),l=a.data("handsontable");if("string"!=typeof t)return r=t||{},l?l.updateSettings(r):(l=new o.Core(a,r),a.data("handsontable",l),l.init()),a;if(i=[],arguments.length>1)for(e=1,n=arguments.length;n>e;e++)i.push(arguments[e]);if(l){if(void 0===l[t])throw Error("Handsontable do not provide action: "+t);s=l[t].apply(l,i)}return s},o.TableView=function(n){var i=this,s=t(e),r=t(document.documentElement);this.instance=n,this.settings=n.getSettings(),this.settingsFromDOM=n.getSettingsFromDOM(),n.rootElement.data("originalStyle",n.rootElement[0].getAttribute("style")),n.rootElement.addClass("handsontable");var a=document.createElement("TABLE");a.className="htCore",this.THEAD=document.createElement("THEAD"),a.appendChild(this.THEAD),this.TBODY=document.createElement("TBODY"),a.appendChild(this.TBODY),n.$table=t(a),n.rootElement.prepend(n.$table),n.rootElement.on("mousedown.handsontable",function(t){i.isTextSelectionAllowed(t.target)||(t.preventDefault(),u())}),r.on("keyup."+n.guid,function(t){n.selection.isInProgress()&&!t.shiftKey&&n.selection.finish()});var l,c;r.on("mouseup."+n.guid,function(t){n.selection.isInProgress()&&1===t.which&&n.selection.finish(),l=!1,clearInterval(c),c=null,n.autofill.handle&&n.autofill.handle.isDragged&&(n.autofill.handle.isDragged>1&&n.autofill.apply(),n.autofill.handle.isDragged=0),o.helper.isOutsideInput(document.activeElement)&&n.unlisten()}),r.on("mousedown."+n.guid,function(e){var o=e.target;if(o!==i.wt.wtTable.spreader)for(;o!==document.documentElement;){if(null===o)return;if(o===n.rootElement[0]||"X-HANDSONTABLE"===o.nodeName||"context-menu-layer"===o.id||t(o).is(".context-menu-list")||t(o).is(".typeahead li"))return;o=o.parentNode}i.settings.outsideClickDeselects?n.deselectCell():n.destroyEditor()}),n.rootElement.on("mousedown.handsontable",".dragdealer",function(){n.destroyEditor()}),n.$table.on("selectstart",function(t){i.settings.fragmentSelection||t.preventDefault()}),n.$table.on("mouseenter",function(){c&&(clearInterval(c),c=null)}),n.$table.on("mouseleave",function(t){if(l||n.autofill.handle&&n.autofill.handle.isDragged){var e,o,s=1,r=i.wt.wtDom.offset(a),u=r.top+s,h=r.left+s,d=i.containerWidth-i.wt.getSetting("scrollbarWidth")-2*s,p=i.containerHeight-i.wt.getSetting("scrollbarHeight")-2*s,f=0,m=0;u>t.pageY?(f=-1,e="scrollVertical"):t.pageY>=u+p?(f=1,e="scrollVertical"):h>t.pageX?(m=-1,e="scrollHorizontal"):t.pageX>=h+d&&(m=1,e="scrollHorizontal"),e&&(o=function(){(l||n.autofill.handle&&n.autofill.handle.isDragged)&&i.wt[e](f+m).draw()},o(),c=setInterval(o,100))}});var u=function(){e.getSelection?e.getSelection().empty?e.getSelection().empty():e.getSelection().removeAllRanges&&e.getSelection().removeAllRanges():document.selection&&document.selection.empty()},h={table:a,stretchH:this.settings.stretchH,data:n.getDataAtCell,totalRows:n.countRows,totalColumns:n.countCols,scrollbarModelV:this.settings.scrollbarModelV,scrollbarModelH:this.settings.scrollbarModelH,offsetRow:0,offsetColumn:0,width:this.getWidth(),height:this.getHeight(),fixedColumnsLeft:function(){return i.settings.fixedColumnsLeft},fixedRowsTop:function(){return i.settings.fixedRowsTop},rowHeaders:function(){return i.settings.rowHeaders?[function(t,e){i.appendRowHeader(t,e)}]:[]},columnHeaders:function(){return i.settings.colHeaders?[function(t,e){i.appendColHeader(t,e)}]:[]},columnWidth:n.getColWidth,cellRenderer:function(t,e,o){i.applyCellTypeMethod("renderer",o,t,e)},selections:{current:{className:"current",border:{width:2,color:"#5292F7",style:"solid",cornerVisible:function(){return i.settings.fillHandle&&!i.isCellEdited()&&!n.selection.isMultiple() -}}},area:{className:"area",border:{width:1,color:"#89AFF9",style:"solid",cornerVisible:function(){return i.settings.fillHandle&&!i.isCellEdited()&&n.selection.isMultiple()}}},highlight:{highlightRowClassName:i.settings.currentRowClassName,highlightColumnClassName:i.settings.currentColClassName},fill:{className:"fill",border:{width:1,color:"red",style:"solid"}}},hideBorderOnMouseDownOver:function(){return i.settings.fragmentSelection},onCellMouseDown:function(t,e,o){n.listen(),l=!0;var s={row:e[0],col:e[1]};2===t.button&&n.selection.inInSelection(s)||(t.shiftKey?n.selection.setRangeEnd(s):n.selection.setRangeStart(s)),i.settings.afterOnCellMouseDown&&i.settings.afterOnCellMouseDown.call(n,t,e,o)},onCellMouseOver:function(t,e){var o={row:e[0],col:e[1]};l?n.selection.setRangeEnd(o):n.autofill.handle&&n.autofill.handle.isDragged&&(n.autofill.handle.isDragged++,n.autofill.showBorder(e))},onCellCornerMouseDown:function(t){n.autofill.handle.isDragged=1,t.preventDefault()},onCellCornerDblClick:function(){n.autofill.selectAdjacent()},beforeDraw:function(t){i.beforeRender(t)},onDraw:function(t){i.onDraw(t)}};n.PluginHooks.run("beforeInitWalkontable",h),this.wt=new y(h),s.on("resize."+n.guid,function(){n.registerTimeout("resizeTimeout",function(){n.parseSettingsFromDOM();var t=i.getWidth(),e=i.getHeight();(h.width!==t||h.height!==e)&&(n.forceFullRender=!0,i.render(),h.width=t,h.height=e)},60)}),t(i.wt.wtTable.spreader).on("mousedown.handsontable, contextmenu.handsontable",function(t){t.target===i.wt.wtTable.spreader&&3===t.which&&t.stopPropagation()}),r.on("click."+n.guid,function(){i.settings.observeDOMVisibility&&i.wt.drawInterrupted&&(i.instance.forceFullRender=!0,i.render())})},o.TableView.prototype.isTextSelectionAllowed=function(t){return"TEXTAREA"===t.nodeName?!0:this.settings.fragmentSelection&&this.wt.wtDom.isChildOf(t,this.TBODY)?!0:!1},o.TableView.prototype.isCellEdited=function(){return document.activeElement!==document.body},o.TableView.prototype.getWidth=function(){var t=void 0!==this.settings.width?this.settings.width:this.settingsFromDOM.width;return"function"==typeof t?t():t},o.TableView.prototype.getHeight=function(){var t=void 0!==this.settings.height?this.settings.height:this.settingsFromDOM.height;return"function"==typeof t?t():t},o.TableView.prototype.beforeRender=function(t){t&&(this.instance.PluginHooks.run("beforeRender"),this.wt.update("width",this.getWidth()),this.wt.update("height",this.getHeight()))},o.TableView.prototype.onDraw=function(t){t&&this.instance.PluginHooks.run("afterRender")},o.TableView.prototype.render=function(){this.wt.draw(!this.instance.forceFullRender),this.instance.forceFullRender=!1,this.instance.rootElement.triggerHandler("render.handsontable")},o.TableView.prototype.applyCellTypeMethod=function(t,e,n,i){var s=this.instance.colToProp(i),r=this.instance.getCellMeta(n,i),a=o.helper.getCellMethod(t,r[t]);return a(this.instance,e,n,i,s,this.instance.getDataAtRowProp(n,s),r)},o.TableView.prototype.getCellAtCoords=function(t){var e=this.wt.wtTable.getCell([t.row,t.col]);return 0>e?null:e},o.TableView.prototype.scrollViewport=function(t){this.wt.scrollViewport([t.row,t.col])},o.TableView.prototype.appendRowHeader=function(t,e){t>-1?this.wt.wtDom.fastInnerHTML(e,this.instance.getRowHeader(t)):this.wt.wtDom.empty(e)},o.TableView.prototype.appendColHeader=function(t,e){var o=document.createElement("DIV"),n=document.createElement("SPAN");for(o.className="relative",n.className="colHeader",this.wt.wtDom.fastInnerHTML(n,this.instance.getColHeader(t)),o.appendChild(n);e.firstChild;)e.removeChild(e.firstChild);e.appendChild(o),this.instance.PluginHooks.run("afterGetColHeader",t,e)},o.TableView.prototype.maximumVisibleElementWidth=function(t){var e=this.wt.wtViewport.getWorkspaceWidth();return e-t},o.TableView.prototype.maximumVisibleElementHeight=function(t){var e=this.wt.wtViewport.getWorkspaceHeight();return this.wt.isNativeScroll?e:e-t},o.helper.isPrintableChar=function(t){return 32==t||t>=48&&57>=t||t>=96&&111>=t||t>=186&&192>=t||t>=219&&222>=t||t>=226||t>=65&&90>=t},o.helper.stringify=function(t){switch(typeof t){case"string":case"number":return t+"";case"object":return null===t?"":""+t;case"undefined":return"";default:return""+t}},o.helper.spreadsheetColumnLabel=function(t){for(var e,o=t+1,n="";o>0;)e=(o-1)%26,n=String.fromCharCode(65+e)+n,o=parseInt((o-e)/26,10);return n},o.helper.isNumeric=function(t){var e=typeof t;return"number"==e?!isNaN(t)&&isFinite(t):"string"==e?t.length?1==t.length?/\d/.test(t):/^\s*[+-]?\s*(?:(?:\d+(?:\.\d+)?(?:e[+-]?\d+)?)|(?:0x[a-f\d]+))\s*$/i.test(t):!1:"object"==e?!(!t||"number"!=typeof t.valueOf()||t instanceof Date):!1},o.helper.isDescendant=function(t,e){for(var o=e.parentNode;null!=o;){if(o==t)return!0;o=o.parentNode}return!1},o.helper.randomString=function(){function t(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return t()+t()+t()+t()},o.helper.inherit=function(t,e){function o(){}return o.prototype=e.prototype,t.prototype=new o,t.prototype.constructor=t,t},o.helper.extend=function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])},o.helper.columnFactory=function(t,e){var o=0,n=e.length,i=function(){};for(i.prototype=new t;n>o;o++)i.prototype[e[o]]=void 0;return i},o.helper.translateRowsToColumns=function(t){var e,o,n,i,s=[],r=0;for(e=0,o=t.length;o>e;e++)for(n=0,i=t[e].length;i>n;n++)n==r&&(s.push([]),r++),s[n].push(t[e][n]);return s},o.helper.to2dArray=function(t){for(var e=0,o=t.length;o>e;)t[e]=[t[e]],e++},o.helper.extendArray=function(t,e){for(var o=0,n=e.length;n>o;)t.push(e[o]),o++},o.helper.getCellMethod=function(t,e){if("string"==typeof e){var n=o.cellLookup[t][e];if(void 0===n)throw Error("You declared cell "+t+' "'+e+'" as a string that is not mapped to a known function. Cell '+t+" must be a function or a string mapped to a function in Handsontable.cellLookup."+t+" lookup object");return n}return e},o.helper.isOutsideInput=function(t){var e=["INPUT","SELECT","TEXTAREA"];return e.indexOf(t.nodeName)>-1&&-1==t.className.indexOf("handsontableInput")},o.helper.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"==Object.prototype.toString.call(t)},o.SelectionPoint=function(){this._row=null,this._col=null},o.SelectionPoint.prototype.exists=function(){return null!==this._row},o.SelectionPoint.prototype.row=function(t){return void 0!==t&&(this._row=t),this._row},o.SelectionPoint.prototype.col=function(t){return void 0!==t&&(this._col=t),this._col},o.SelectionPoint.prototype.coords=function(t){return void 0!==t&&(this._row=t.row,this._col=t.col),{row:this._row,col:this._col}},o.SelectionPoint.prototype.arr=function(t){return void 0!==t&&(this._row=t[0],this._col=t[1]),[this._row,this._col]},o.TextRenderer=function(t,e,n,i,s,r,a){var l=o.helper.stringify(r);t.view.wt.wtDom.fastInnerText(e,l),a.readOnly&&t.view.wt.wtDom.addClass(e,"htDimmed"),a.valid===!1&&a.invalidCellClassName&&t.view.wt.wtDom.addClass(e,a.invalidCellClassName)};var I=document.createElement("DIV");I.className="htAutocomplete";var $=document.createElement("DIV");$.className="htAutocompleteArrow",$.appendChild(document.createTextNode("▼")),o.AutocompleteRenderer=function(t,e,n,i,s,r,a){var l=I.cloneNode(!1),c=$.cloneNode(!0);t.acArrowListener||(t.acArrowListener=function(){t.view.wt.getSetting("onCellDblClick")},t.rootElement.on("mouseup",".htAutocompleteArrow",t.acArrowListener)),o.TextRenderer(t,l,n,i,s,r,a),l.firstChild||l.appendChild(document.createTextNode(" ")),l.appendChild(c),t.view.wt.wtDom.empty(e),e.appendChild(l)};var N=document.createElement("INPUT");N.className="htCheckboxRendererInput",N.type="checkbox",N.setAttribute("autocomplete","off"),o.CheckboxRenderer=function(e,n,i,s,r,a,l){l.checkedTemplate===void 0&&(l.checkedTemplate=!0),l.uncheckedTemplate===void 0&&(l.uncheckedTemplate=!1),e.view.wt.wtDom.empty(n);var c=N.cloneNode(!1);a===l.checkedTemplate||a===o.helper.stringify(l.checkedTemplate)?(c.checked=!0,n.appendChild(c)):a===l.uncheckedTemplate||a===o.helper.stringify(l.uncheckedTemplate)?n.appendChild(c):null===a?(c.className+=" noValue",n.appendChild(c)):e.view.wt.wtDom.fastInnerText(n,"#bad value#");var u=t(c);return l.readOnly?u.on("click",function(t){t.preventDefault()}):(u.on("mousedown",function(t){t.stopPropagation()}),u.on("mouseup",function(t){t.stopPropagation()}),u.on("change",function(){this.checked?e.setDataAtRowProp(i,r,l.checkedTemplate):e.setDataAtRowProp(i,r,l.uncheckedTemplate)})),e.CheckboxRenderer&&e.CheckboxRenderer.beforeKeyDownHookBound||(e.CheckboxRenderer={beforeKeyDownHookBound:!0},e.addHook("beforeKeyDown",function(o){if(32==o.keyCode){o.stopImmediatePropagation(),o.preventDefault();for(var n,i,s,r=e.getSelected(),a={row:Math.min(r[0],r[2]),col:Math.min(r[1],r[3])},l={row:Math.max(r[0],r[2]),col:Math.max(r[1],r[3])},c=a.row;l.row>=c;c++)for(var u=l.col;l.col>=u;u++)if(n=e.getCell(c,u),s=e.getCellMeta(c,u),i=n.querySelectorAll("input[type=checkbox]"),i.length>0&&!s.readOnly)for(var h=0,d=i.length;d>h;h++)i[h].checked=!i[h].checked,t(i[h]).trigger("change")}})),n},o.NumericRenderer=function(t,e,n,i,s,r,a){o.helper.isNumeric(r)&&(a.language!==void 0&&numeral.language(a.language),r=numeral(r).format(a.format||"0"),t.view.wt.wtDom.addClass(e,"htNumeric")),o.TextRenderer(t,e,n,i,s,r,a)},function(){o.PasswordRenderer=function(t,e,n,i,s,r,a){o.TextRenderer.apply(this,arguments),r=e.innerHTML;var l,c=a.hashLength||r.length,u=a.hashSymbol||"*";for(l="";c>l.split(u).length-1;l+=u);t.view.wt.wtDom.fastInnerHTML(e,l)}}(o),n.prototype.createElements=function(){this.STATE_VIRGIN="STATE_VIRGIN",this.STATE_EDITING="STATE_EDITING",this.STATE_WAITING="STATE_WAITING",this.STATE_FINISHED="STATE_FINISHED",this.state=this.STATE_VIRGIN,this.waitingEvent=null,this.wtDom=new b,this.TEXTAREA=document.createElement("TEXTAREA"),this.TEXTAREA.className="handsontableInput",this.textareaStyle=this.TEXTAREA.style,this.textareaStyle.width=0,this.textareaStyle.height=0,this.$textarea=t(this.TEXTAREA),this.TEXTAREA_PARENT=document.createElement("DIV"),this.TEXTAREA_PARENT.className="handsontableInputHolder",this.textareaParentStyle=this.TEXTAREA_PARENT.style,this.textareaParentStyle.top=0,this.textareaParentStyle.left=0,this.textareaParentStyle.display="none",this.$body=t(document.body),this.TEXTAREA_PARENT.appendChild(this.TEXTAREA),this.instance.rootElement[0].appendChild(this.TEXTAREA_PARENT);var e=this;o.PluginHooks.add("afterRender",function(){e.instance.registerTimeout("refresh_editor_dimensions",function(){e.refreshDimensions()},0)})},n.prototype.bindEvents=function(){var t=this;this.$textarea.off(".editor").on("keydown.editor",function(e){if(t.state===t.STATE_WAITING?e.stopImmediatePropagation():t.waitingEvent=null,t.state===t.STATE_EDITING){var o=(e.ctrlKey||e.metaKey)&&!e.altKey;if(17===e.keyCode||224===e.keyCode||91===e.keyCode||93===e.keyCode)return e.stopImmediatePropagation(),void 0;switch(e.keyCode){case 38:t.finishEditing(!1);break;case 40:t.finishEditing(!1);break;case 9:t.finishEditing(!1),e.preventDefault();break;case 39:t.wtDom.getCaretPosition(t.TEXTAREA)===t.TEXTAREA.value.length?t.finishEditing(!1):e.stopImmediatePropagation();break;case 37:0===t.wtDom.getCaretPosition(t.TEXTAREA)?t.finishEditing(!1):e.stopImmediatePropagation();break;case 27:t.instance.destroyEditor(!0),e.stopImmediatePropagation();break;case 13:var n=t.instance.getSelected(),i=!(n[0]===n[2]&&n[1]===n[3]);e.ctrlKey&&!i||e.altKey?(t.TEXTAREA.value=t.TEXTAREA.value+"\n",t.TEXTAREA.focus(),e.stopImmediatePropagation()):t.finishEditing(!1,o),e.preventDefault();break;default:e.stopImmediatePropagation()}t.state===t.STATE_FINISHED||e.isImmediatePropagationStopped()||(t.waitingEvent=e,e.stopImmediatePropagation(),e.preventDefault())}})},n.prototype.bindTemporaryEvents=function(t,e,n,i,s,r){function a(){l.TEXTAREA.value=l.originalValue,l.instance.destroyEditor(),l.beginEditing(e,n,i,!0)}var l=this;this.state=this.STATE_VIRGIN,this.instance.view.wt.update("onCellDblClick",a),this.TD=t,this.row=e,this.col=n,this.prop=i,this.originalValue=s,this.cellProperties=r,this.beforeKeyDownHook=function c(t){if(l.state===l.STATE_VIRGIN){var s=(t.ctrlKey||t.metaKey)&&!t.altKey;if(o.helper.isPrintableChar(t.keyCode))s||(l.beginEditing(e,n,i),t.stopImmediatePropagation());else if(113===t.keyCode)l.beginEditing(e,n,i,!0),t.stopImmediatePropagation(),t.preventDefault();else if(13===t.keyCode&&l.instance.getSettings().enterBeginsEditing){var r=l.instance.getSelected(),a=!(r[0]===r[2]&&r[1]===r[3]);s&&!a||t.altKey?l.beginEditing(e,n,i,!0,"\n"):l.beginEditing(e,n,i,!0),t.preventDefault(),t.stopImmediatePropagation()}else-1==[9,33,34,35,36,37,38,39,40].indexOf(t.keyCode)&&l.instance.addHookOnce("beforeKeyDown",c)}},l.instance.addHookOnce("beforeKeyDown",this.beforeKeyDownHook)},n.prototype.unbindTemporaryEvents=function(){this.instance.removeHook("beforeKeyDown",this.beforeKeyDownHook),this.instance.view.wt.update("onCellDblClick",null)},n.prototype.beginEditing=function(t,e,n,i,s){if(this.state===this.STATE_VIRGIN){this.state=this.STATE_EDITING,this.row=t,this.col=e,this.prop=n;var r={row:t,col:e};this.instance.view.scrollViewport(r),this.instance.view.render(),this.$textarea.on("cut.editor",function(t){t.stopPropagation()}),this.$textarea.on("paste.editor",function(t){t.stopPropagation()}),this.TEXTAREA.value=i?o.helper.stringify(this.originalValue)+(s||""):"",this.refreshDimensions(),this.TEXTAREA.focus(),this.wtDom.setCaretPosition(this.TEXTAREA,this.TEXTAREA.value.length),this.instance.view.render()}},n.prototype.refreshDimensions=function(){if(this.state===this.STATE_EDITING){this.TD=this.instance.getCell(this.row,this.col);var e=t(this.TD),o=this.wtDom.offset(this.TD),n=this.wtDom.offset(this.instance.rootElement[0]),i=this.instance.rootElement.scrollTop(),s=this.instance.rootElement.scrollLeft(),r=o.top-n.top+i-1,a=o.left-n.left+s-1,l=this.instance.getSettings(),c=l.rowHeaders===!1?0:1,u=l.colHeaders===!1?0:1;0>r&&(r=0),0>a&&(a=0),c>0&&parseInt(e.css("border-top-width"),10)>0&&(r+=1),u>0&&parseInt(e.css("border-left-width"),10)>0&&(a+=1),t.browser.msie&&7>=parseInt(t.browser.version,10)&&(r-=1),this.textareaParentStyle.top=r+"px",this.textareaParentStyle.left=a+"px";var h=e.width(),d=this.instance.view.maximumVisibleElementWidth(a)-10,p=e.outerHeight()-4,f=this.instance.view.maximumVisibleElementHeight(r)-5;parseInt(e.css("border-top-width"),10)>0&&(p-=1),parseInt(e.css("border-left-width"),10)>0&&c>0&&(h-=1),this.$textarea.autoResize({minHeight:Math.min(p,f),maxHeight:f,minWidth:Math.min(h,d),maxWidth:d,animate:!1,extraSpace:0}),this.textareaParentStyle.display="block"}},n.prototype.saveValue=function(t,e){if(e){var o=this.instance.getSelected();this.instance.populateFromArray(o[0],o[1],t,o[2],o[3],"edit")}else this.instance.populateFromArray(this.row,this.col,t,null,null,"edit")},n.prototype.finishEditing=function(e,o){var n=!1;if(this.state!=this.STATE_WAITING&&this.state!=this.STATE_FINISHED){if(this.state==this.STATE_EDITING){var i;if(i=e?[[this.originalValue]]:[[t.trim(this.TEXTAREA.value)]],n=this.instance.getCellMeta(this.row,this.col).validator){this.state=this.STATE_WAITING;var s=this;this.instance.addHookOnce("afterValidate",function(t){s.state=s.STATE_FINISHED,s.discardEditor(t)})}this.saveValue(i,o)}n||(this.state=this.STATE_FINISHED,this.discardEditor())}},n.prototype.discardEditor=function(e){if(this.state===this.STATE_FINISHED)if(e===!1&&this.cellProperties.allowInvalid!==!0)this.state=this.STATE_EDITING,this.instance.view.wt.wtDom.isVisible(this.TEXTAREA)&&(this.TEXTAREA.focus(),this.wtDom.setCaretPosition(this.TEXTAREA,this.TEXTAREA.value.length));else if(this.state=this.STATE_FINISHED,document.activeElement===this.TEXTAREA&&this.instance.listen(),this.unbindTemporaryEvents(),this.textareaParentStyle.display="none",this.waitingEvent){var o=t.Event(this.waitingEvent.type);o.keyCode=this.waitingEvent.keyCode,this.waitingEvent=null,t(document.activeElement).trigger(o)}},o.TextEditor=function(t,e,o,i,s,r,a){return t.textEditor||(t.textEditor=new n(t)),(t.textEditor.state===t.textEditor.STATE_VIRGIN||t.textEditor.state===t.textEditor.STATE_FINISHED)&&t.textEditor.bindTemporaryEvents(e,o,i,s,r,a),function(e){t.textEditor.finishEditing(e)}},o.helper.inherit(i,n),i.prototype.createElements=function(){n.prototype.createElements.call(this),this.$textarea.typeahead(),this.typeahead=this.$textarea.data("typeahead"),this.typeahead._render=this.typeahead.render,this.typeahead.minLength=0,this.typeahead.lookup=function(){var e;return this.query=this.$element.val(),e=t.isFunction(this.source)?this.source(this.query,t.proxy(this.process,this)):this.source,e?this.process(e):this},this.typeahead.matcher=function(){return!0};var e=this.typeahead.process,o=this;this.typeahead.process=function(n){for(var i=!1,s=0,r=n.length;r>s;s++)""===n[s]&&(i||(n=t.extend([],n),i=!0),n[s]=o.emptyStringLabel);return e.call(this,n)}},i.prototype.bindEvents=function(){var t=this;this.$textarea.off("keydown").off("keyup").off("keypress"),this.$textarea.off(".acEditor").on("keydown.acEditor",function(e){switch(e.keyCode){case 38:t.typeahead.prev(),e.stopImmediatePropagation();break;case 40:t.typeahead.next(),e.stopImmediatePropagation();break;case 13:e.preventDefault()}}),this.$textarea.on("keyup.acEditor",function(e){(o.helper.isPrintableChar(e.keyCode)||113===e.keyCode||13===e.keyCode||8===e.keyCode||46===e.keyCode)&&t.typeahead.lookup()}),this.typeahead.$menu.on("mouseleave",function(){t.typeahead.$menu.find(".active").removeClass("active")}),n.prototype.bindEvents.call(this)},i.prototype.bindTemporaryEvents=function(t,e,o,i,s,r){var a,l,c=this;this.typeahead._valueSelected=!1,this.typeahead.select=function(){var t=this.$menu[0].querySelector(".active"),n=t.getAttribute("data-value");return n===c.emptyStringLabel&&(n=""),"function"==typeof r.onSelect?r.onSelect(e,o,i,n,c.instance.view.wt.wtDom.index(t)):c.TEXTAREA.value=n,this._valueSelected=!0,this.hide(),c.finishEditing(),this},this.typeahead.render=function(t){if(c.typeahead._render.call(this,t),!r.strict){var e=this.$menu[0].querySelector(".active");e&&c.instance.view.wt.wtDom.removeClass(e,"active")}return this};for(a in r)if("options"===a)for(l in r.options)this.typeahead.options[l]=r.options[l];else this.typeahead[a]=r[a];n.prototype.bindTemporaryEvents.call(this,t,e,o,i,s,r)},i.prototype.beginEditing=function(){n.prototype.beginEditing.apply(this,arguments);var t=this;this.instance.registerTimeout("IE9_align_fix",function(){t.typeahead.lookup()},1)},i.prototype.finishEditing=function(t,e){t||this.isMenuExpanded()&&(this.typeahead.$menu[0].querySelector(".active")?(this.typeahead.select(),this.state=this.STATE_FINISHED):this.cellProperties.strict&&(this.state=this.STATE_FINISHED)),n.prototype.finishEditing.call(this,t,e)},i.prototype.isMenuExpanded=function(){return this.instance.view.wt.wtDom.isVisible(this.typeahead.$menu[0])?this.typeahead:!1},o.AutocompleteEditor=function(t,e,o,n,s,r,a){return t.autocompleteEditor||(t.autocompleteEditor=new i(t)),t.autocompleteEditor.bindTemporaryEvents(e,o,n,s,r,a),function(e){t.autocompleteEditor.finishEditing(e)}},o.CheckboxEditor=function(t,e,n,i,r,a,l){return l===void 0&&(l={}),l.checkedTemplate===void 0&&(l.checkedTemplate=!0),l.uncheckedTemplate===void 0&&(l.uncheckedTemplate=!1),t.$table.on("keydown.editor",function(e){var i=(e.ctrlKey||e.metaKey)&&!e.altKey;!i&&o.helper.isPrintableChar(e.keyCode)&&(s(t,n,r,l),e.stopImmediatePropagation(),e.preventDefault())}),t.view.wt.update("onCellDblClick",function(){s(t,n,r,l)}),function(){t.$table.off(".editor"),t.view.wt.update("onCellDblClick",null)}},o.helper.inherit(r,n),r.prototype.createElements=function(){n.prototype.createElements.call(this),this.datePicker=document.createElement("DIV"),this.instance.view.wt.wtDom.addClass(this.datePicker,"htDatepickerHolder"),this.datePickerStyle=this.datePicker.style,this.datePickerStyle.position="absolute",this.datePickerStyle.top=0,this.datePickerStyle.left=0,this.datePickerStyle.zIndex=99,document.body.appendChild(this.datePicker),this.$datePicker=t(this.datePicker);var e=this,o={dateFormat:"yy-mm-dd",showButtonPanel:!0,changeMonth:!0,changeYear:!0,altField:this.$textarea,onSelect:function(){e.finishEditing(!1)}};this.$datePicker.datepicker(o),this.$datePicker.on("mousedown",function(t){t.stopPropagation()}),this.hideDatepicker()},r.prototype.destroyElements=function(){this.$datePicker.datepicker("destroy"),this.$datePicker.remove()},r.prototype.beginEditing=function(t,e,o,i,s){n.prototype.beginEditing.call(this,t,e,o,i,s),this.showDatepicker()},r.prototype.finishEditing=function(t,e){this.hideDatepicker(),n.prototype.finishEditing.call(this,t,e)},r.prototype.showDatepicker=function(){var e=t(this.instance.dateEditor.TD),o=e.offset();this.datePickerStyle.top=o.top+e.height()+"px",this.datePickerStyle.left=o.left+"px";var n={defaultDate:this.originalValue||void 0};t.extend(n,this.cellProperties),this.$datePicker.datepicker("option",n),this.originalValue&&this.$datePicker.datepicker("setDate",this.originalValue),this.datePickerStyle.display="block"},r.prototype.hideDatepicker=function(){this.datePickerStyle.display="none"},o.DateEditor=function(t,e,o,n,i,s,a){return t.dateEditor||(t.dateEditor=new r(t)),t.dateEditor.bindTemporaryEvents(e,o,n,i,s,a),function(e){t.dateEditor.finishEditing(e)}},o.helper.inherit(a,n),a.prototype.createElements=function(){n.prototype.createElements.call(this);var e=document.createElement("DIV");e.className="handsontableEditor",this.TEXTAREA_PARENT.appendChild(e),this.$htContainer=t(e)},a.prototype.bindTemporaryEvents=function(e,o,i,s,r,a){var l=this,c={colHeaders:!0,cells:function(){return{readOnly:!0}},fillHandle:!1,width:2e3,afterOnCellMouseDown:function(){var t=this.getSelected();l.TEXTAREA.value=this.getDataAtCell(t[0],t[1]),l.instance.destroyEditor()},beforeOnKeyDown:function(t){switch(t.keyCode){case 27:l.instance.destroyEditor(!0);break;case 13:var e=this.getSelected();l.TEXTAREA.value=this.getDataAtCell(e[0],e[1]),l.instance.destroyEditor()}}};a.handsontable&&(c=t.extend(c,a.handsontable)),this.$htContainer.handsontable(c),n.prototype.bindTemporaryEvents.call(this,e,o,i,s,r,a)},a.prototype.beginEditing=function(t,e,o,i,s){var r=this.instance.getSettings().onBeginEditing;r&&r()===!1||(n.prototype.beginEditing.call(this,t,e,o,i,s),this.$htContainer.handsontable("render"),this.$htContainer.handsontable("selectCell",0,0))},a.prototype.finishEditing=function(t,e){this.$htContainer.handsontable("isListening")&&this.instance.listen(),this.$htContainer.handsontable("destroy"),n.prototype.finishEditing.call(this,t,e)},o.HandsontableEditor=function(t,e,o,n,i,s,r){return t.handsontableEditor||(t.handsontableEditor=new a(t)),t.handsontableEditor.bindTemporaryEvents(e,o,n,i,s,r),t.registerEditor=t.handsontableEditor,function(e){t.handsontableEditor.finishEditing(e)}},function(e){function o(t){n.call(this,t)}e.helper.inherit(o,n),o.prototype.createElements=function(){this.STATE_VIRGIN="STATE_VIRGIN",this.STATE_EDITING="STATE_EDITING",this.STATE_WAITING="STATE_WAITING",this.STATE_FINISHED="STATE_FINISHED",this.state=this.STATE_VIRGIN,this.waitingEvent=null,this.wtDom=new b,this.TEXTAREA=document.createElement("input"),this.TEXTAREA.setAttribute("type","password"),this.TEXTAREA.className="handsontableInput",this.textareaStyle=this.TEXTAREA.style,this.textareaStyle.width=0,this.textareaStyle.height=0,this.$textarea=t(this.TEXTAREA),this.TEXTAREA_PARENT=document.createElement("DIV"),this.TEXTAREA_PARENT.className="handsontableInputHolder",this.textareaParentStyle=this.TEXTAREA_PARENT.style,this.textareaParentStyle.top=0,this.textareaParentStyle.left=0,this.textareaParentStyle.display="none",this.$body=t(document.body),this.TEXTAREA_PARENT.appendChild(this.TEXTAREA),this.instance.rootElement[0].appendChild(this.TEXTAREA_PARENT)},e.PasswordEditor=function(t,e,n,i,s,r,a){return t.passwordEditor||(t.passwordEditor=new o(t)),(t.passwordEditor.state===t.passwordEditor.STATE_VIRGIN||t.passwordEditor.state===t.passwordEditor.STATE_FINISHED)&&t.passwordEditor.bindTemporaryEvents(e,n,i,s,r,a),function(e){t.passwordEditor.finishEditing(e)}}}(o),o.NumericValidator=function(t,e){e(/^-?\d*\.?\d*$/.test(t))};var V=function(t,e){var o=t,n="string"==typeof o?o.toLowerCase():null;return function(t){for(var i=!1,s=0,r=t.length;r>s;s++){if(o===t[s]){i=!0;break}if(n===t[s].toLowerCase()){i=!0;break}}e(i)}};o.AutocompleteValidator=function(e,o){this.strict&&this.source?t.isFunction(this.source)?this.source(e,V(e,o)):V(e,o)(this.source):o(!0)},o.AutocompleteCell={editor:o.AutocompleteEditor,renderer:o.AutocompleteRenderer,validator:o.AutocompleteValidator},o.CheckboxCell={editor:o.CheckboxEditor,renderer:o.CheckboxRenderer},o.TextCell={editor:o.TextEditor,renderer:o.TextRenderer},o.NumericCell={editor:o.TextEditor,renderer:o.NumericRenderer,validator:o.NumericValidator,dataType:"number"},o.DateCell={editor:o.DateEditor,renderer:o.AutocompleteRenderer},o.HandsontableCell={editor:o.HandsontableEditor,renderer:o.AutocompleteRenderer},o.PasswordCell={editor:o.PasswordEditor,renderer:o.PasswordRenderer},o.cellTypes={text:o.TextCell,date:o.DateCell,numeric:o.NumericCell,checkbox:o.CheckboxCell,autocomplete:o.AutocompleteCell,handsontable:o.HandsontableCell,password:o.PasswordCell},o.cellLookup={renderer:{text:o.TextRenderer,numeric:o.NumericRenderer,checkbox:o.CheckboxRenderer,autocomplete:o.AutocompleteRenderer,password:o.PasswordRenderer},editor:{text:o.TextEditor,date:o.DateEditor,checkbox:o.CheckboxEditor,autocomplete:o.AutocompleteEditor,handsontable:o.HandsontableEditor,password:o.PasswordEditor},validator:{numeric:o.NumericValidator,autocomplete:o.AutocompleteValidator}},o.PluginHookClass=function(){function t(){this.hooks={once:e(),persistent:e()},this.legacy=o}var e=function(){return{beforeInitWalkontable:[],beforeInit:[],beforeRender:[],beforeChange:[],beforeRemoveCol:[],beforeRemoveRow:[],beforeValidate:[],beforeGet:[],beforeSet:[],beforeGetCellMeta:[],beforeAutofill:[],beforeKeyDown:[],afterInit:[],afterLoadData:[],afterUpdateSettings:[],afterRender:[],afterChange:[],afterValidate:[],afterGetCellMeta:[],afterGetColHeader:[],afterGetColWidth:[],afterDestroy:[],afterRemoveRow:[],afterCreateRow:[],afterRemoveCol:[],afterCreateCol:[],afterColumnResize:[],afterColumnMove:[],afterDeselect:[],afterSelection:[],afterSelectionByProp:[],afterSelectionEnd:[],afterSelectionEndByProp:[],afterCopyLimit:[],modifyCol:[]}},o={onBeforeChange:"beforeChange",onChange:"afterChange",onCreateRow:"afterCreateRow",onCreateCol:"afterCreateCol",onSelection:"afterSelection",onCopyLimit:"afterCopyLimit",onSelectionEnd:"afterSelectionEnd",onSelectionByProp:"afterSelectionByProp",onSelectionEndByProp:"afterSelectionEndByProp"},n=function(t){return function(e,n){if(e in o&&(e=o[e]),this.hooks[t][e]===void 0&&(this.hooks[t][e]=[]),n instanceof Array)for(var i=0,s=n.length;s>i;i++)this.hooks[t][e].push(n[i]);else this.hooks[t][e].push(n);return this}};return t.prototype.add=n("persistent"),t.prototype.once=n("once"),t.prototype.remove=function(t,e){var n,i,s,r,a,l=!1,c=["persistent","once"];t in o&&(t=o[t]);for(i=0,s=c.length;s>i;i++)if(n=c[i],this.hooks[n][t]!==void 0)for(r=0,a=this.hooks[n][t].length;a>r;r++)if(this.hooks[n][t][r]==e){this.hooks[n][t].splice(r,1),l=!0;break}return l},t.prototype.run=function(t,e,n,i,s,r,a){var l,c,u,h,d,p=["persistent","once"];e in o&&(e=o[e]);for(c=0,u=p.length;u>c;c++)if(l=p[c],this.hooks[l][e]!==void 0)for(h=0,d=this.hooks[l][e].length;d>h;h++)this.hooks[l][e][h].call(t,n,i,s,r,a),"once"===l&&(this.hooks[l][e].splice(h,1),d--,h--)},t.prototype.execute=function(t,e,n,i,s,r,a){var l,c,u,h,d,p,f=["persistent","once"];e in o&&(e=o[e]);for(c=0,u=f.length;u>c;c++)if(l=f[c],this.hooks[l][e]!==void 0)for(h=0,d=this.hooks[l][e].length;d>h;h++)p=this.hooks[l][e][h].call(t,n,i,s,r,a),void 0!==p&&(n=p),"once"===l&&(this.hooks[l][e].splice(h,1),d--,h--);return n},t}(),o.PluginHooks=new o.PluginHookClass,function(t){function e(){function e(t){var e=document,o=this;o.table=e.createElement("table"),o.theadTh=e.createElement("th"),o.table.appendChild(e.createElement("thead")).appendChild(e.createElement("tr")).appendChild(o.theadTh),o.tableStyle=o.table.style,o.tableStyle.tableLayout="auto",o.tableStyle.width="auto",o.tbody=e.createElement("tbody"),o.table.appendChild(o.tbody),o.container=e.createElement("div"),o.container.className=t.rootElement[0].className+" hidden",o.containerStyle=o.container.style,o.container.appendChild(o.table)}var n=this,i=5;this.beforeInit=function(){var t=this;t.autoColumnWidths=[],t.getSettings().autoColumnSize!==!1?(t.autoColumnSizeTmp||(t.autoColumnSizeTmp={table:null,tableStyle:null,theadTh:null,tbody:null,container:null,containerStyle:null,determineBeforeNextRender:!0}),t.addHook("beforeRender",o.performScheduledDetermine),t.addHook("beforeRenderMethod",o.scheduleDetermine),t.addHook("beforeChange",o.scheduleDetermine),t.addHook("afterUpdateSettings",o.scheduleDetermine),t.addHook("afterGetColWidth",o.getColWidth),t.addHook("afterDestroy",o.afterDestroy),t.determineColumnWidth=n.determineColumnWidth):(t.removeHook("beforeRender",o.performScheduledDetermine),t.removeHook("beforeRenderMethod",o.scheduleDetermine),t.removeHook("beforeChange",o.scheduleDetermine),t.removeHook("afterUpdateSettings",o.scheduleDetermine),t.removeHook("afterGetColWidth",o.getColWidth),t.removeHook("afterDestroy",o.afterDestroy),delete t.determineColumnWidth,n.afterDestroy.call(t))},this.scheduleDetermine=function(){this.autoColumnSizeTmp.determineBeforeNextRender=!0},this.performScheduledDetermine=function(){this.autoColumnSizeTmp.determineBeforeNextRender&&(o.determineColumnsWidth.apply(this,arguments),this.autoColumnSizeTmp.determineBeforeNextRender=!1)},this.determineColumnWidth=function(o){var n=this,s=n.autoColumnSizeTmp;s.container||e.call(s,n),s.container.className=n.rootElement[0].className+" htAutoColumnSize",s.table.className=n.$table[0].className;for(var r=n.countRows(),a={},l=0,c=0;r>c;c++){var u=t.helper.stringify(n.getDataAtCell(c,o)),h=u.length;h>l&&(l=h),a[h]||(a[h]={needed:i,strings:[]}),a[h].needed&&(a[h].strings.push({value:u,row:c}),a[h].needed--)}var d=n.getSettings();d.colHeaders&&n.view.appendColHeader(o,s.theadTh),n.view.wt.wtDom.empty(s.tbody);var p=n.getCellMeta(0,o),f=t.helper.getCellMethod("renderer",p.renderer);for(var m in a)if(a.hasOwnProperty(m))for(var g=0,v=a[m].strings.length;v>g;g++){var w=document.createElement("tr"),y=document.createElement("td");f(n,y,a[m].strings[g].row,o,n.colToProp(o),a[m].strings[g].value,p),c++,w.appendChild(y),s.tbody.appendChild(w)}var b=n.rootElement[0].parentNode;b.appendChild(s.container);var C=n.view.wt.wtDom.outerWidth(s.table);b.removeChild(s.container);var S=n.view.wt.wtViewport.getViewportWidth()-2;return C>S&&(C=S),C},this.determineColumnsWidth=function(){var t=this,e=this.getSettings();if(e.autoColumnSize||!e.colWidths)for(var o=this.countCols(),i=0;o>i;i++)t._getColWidthFromSettings(i)||(this.autoColumnWidths[i]=n.determineColumnWidth.call(t,i))},this.getColWidth=function(t,e){this.autoColumnWidths[t]&&this.autoColumnWidths[t]>e.width&&(e.width=this.autoColumnWidths[t])},this.afterDestroy=function(){var t=this;t.autoColumnSizeTmp&&t.autoColumnSizeTmp.container&&t.autoColumnSizeTmp.container.parentNode&&t.autoColumnSizeTmp.container.parentNode.removeChild(t.autoColumnSizeTmp.container)}}var o=new e;t.PluginHooks.add("beforeInit",o.beforeInit),t.PluginHooks.add("afterUpdateSettings",o.beforeInit)}(o);var L=new l;o.PluginHooks.add("afterInit",function(){L.init.call(this,"afterInit")}),o.PluginHooks.add("afterUpdateSettings",function(){L.init.call(this,"afterUpdateSettings")}),o.PluginHooks.add("beforeGet",L.onBeforeGetSet),o.PluginHooks.add("beforeSet",L.onBeforeGetSet),o.PluginHooks.add("afterGetColHeader",L.getColHeader),function(e){function o(){var t=this,e=!!t.getSettings().contextMenu;e?n.call(t):i.call(t)}function n(){function o(t){var o=r.getSelected();if(o){var n={start:new e.SelectionPoint,end:new e.SelectionPoint}; -switch(n.start.row(Math.min(o[0],o[2])),n.start.col(Math.min(o[1],o[3])),n.end.row(Math.max(o[0],o[2])),n.end.col(Math.max(o[1],o[3])),t){case"row_above":r.alter("insert_row",n.start.row());break;case"row_below":r.alter("insert_row",n.end.row()+1);break;case"col_left":r.alter("insert_col",n.start.col());break;case"col_right":r.alter("insert_col",n.end.col()+1);break;case"remove_row":r.alter(t,n.start.row(),n.end.row()-n.start.row()+1);break;case"remove_col":r.alter(t,n.start.col(),n.end.col()-n.start.col()+1);break;case"undo":r.undo();break;case"redo":r.redo()}}}function n(t){return r.countRows()>=r.getSettings().maxRows&&("row_above"===t||"row_below"===t)?!0:r.countCols()>=r.getSettings().maxCols&&("col_left"===t||"col_right"===t)?!0:!1}var i,s,r=this,a=r.rootElement[0].id,l={row_above:{name:"Insert row above",disabled:n},row_below:{name:"Insert row below",disabled:n},hsep1:"---------",col_left:{name:"Insert column on the left",disabled:n},col_right:{name:"Insert column on the right",disabled:n},hsep2:"---------",remove_row:{name:"Remove row",disabled:n},remove_col:{name:"Remove column",disabled:n},hsep3:"---------",undo:{name:"Undo",disabled:function(){return!r.undoRedo||!r.isUndoAvailable()}},redo:{name:"Redo",disabled:function(){return!r.undoRedo||!r.isRedoAvailable()}}},c={selector:"#"+a+" table, #"+a+" div",trigger:"right",callback:o},u={},h=r.getSettings();if(h.contextMenu===!0)u.items=l;else if("[object Array]"===Object.prototype.toString.apply(h.contextMenu))for(u.items={},i=0,s=h.contextMenu.length;s>i;i++){var d=h.contextMenu[i];if(l[d]===void 0)throw Error('Context menu key "'+d+'" is not recognised');u.items[d]=l[d]}else if("[object Object]"===Object.prototype.toString.apply(h.contextMenu)){if(u=h.contextMenu,u.items)for(i in u.items)u.items.hasOwnProperty(i)&&l[i]&&(u.items[i]="string"==typeof u.items[i]?l[i]:t.extend(!0,l[i],u.items[i]));else u.items=l;if(u.callback){var p=c.callback,f=u.callback;u.callback=function(t,e){p(t,e),f(t,e)}}}if(!a)throw Error("Handsontable container must have an id");t.contextMenu(t.extend(!0,c,u))}function i(){var e=this.rootElement[0].id;t.contextMenu("destroy","#"+e+" table, #"+e+" div")}e.PluginHooks.add("afterInit",o),e.PluginHooks.add("afterUpdateSettings",o),e.PluginHooks.add("afterDestroy",i)}(o),o.PluginHooks.add("beforeGetCellMeta",function(t,e,n){var i,s,r,a=this.getSettings(),l=this.getData();if(n.isWritable=!n.readOnly,a.autoComplete)for(i=0,s=a.autoComplete.length;s>i;i++)if(a.autoComplete[i].match(t,e,l)){n.type===void 0?n.type=o.AutocompleteCell:(n.type.renderer===void 0&&(n.type.renderer=o.AutocompleteCell.renderer),n.type.editor===void 0&&(n.type.editor=o.AutocompleteCell.editor));for(r in a.autoComplete[i])a.autoComplete[i].hasOwnProperty(r)&&"match"!==r&&n[i]===void 0&&(n[r]="source"===r?a.autoComplete[i][r](t,e):a.autoComplete[i][r]);break}});var _=new c;o.PluginHooks.add("beforeInit",_.beforeInit),o.PluginHooks.add("afterInit",function(){_.init.call(this,"afterInit")}),o.PluginHooks.add("afterUpdateSettings",function(){_.init.call(this,"afterUpdateSettings")}),o.PluginHooks.add("afterGetColHeader",_.getColHeader),o.PluginHooks.add("modifyCol",_.modifyCol);var B=new u;o.PluginHooks.add("beforeInit",B.beforeInit),o.PluginHooks.add("afterInit",function(){B.init.call(this,"afterInit")}),o.PluginHooks.add("afterUpdateSettings",function(){B.init.call(this,"afterUpdateSettings")}),o.PluginHooks.add("afterGetColWidth",B.getColWidth),function(){function t(){var t=this,o=t.getSettings().observeChanges;!t.observer&&o?(e.call(t),r.call(t)):o||i.call(t)}function e(){var t=this;t.observeChangesActive=!0,t.pauseObservingChanges=function(){t.observeChangesActive=!1},t.resumeObservingChanges=function(){t.observeChangesActive=!0},t.observer=W.observe(t.getData(),function(e){t.observeChangesActive&&(n.call(t,e),t.render()),t.runHooks("afterChangesObserved")})}function n(t){function e(t){var e;return e=n(t),e=o(e)}function o(t){var e=[];return t.filter(function(t){var o=i(t.path);if(-1!=["add","remove"].indexOf(t.op)&&!isNaN(o.col)){if(-1!=e.indexOf(o.col))return!1;e.push(o.col)}return!0})}function n(t){return t.filter(function(t){return!/[/]length/gi.test(t.path)})}function i(t){var e=t.match(/^\/(\d+)\/?(.*)?$/);return{row:parseInt(e[1],10),col:/^\d*$/.test(e[2])?parseInt(e[2],10):e[2]}}for(var s=this,r=e(t),a=0,l=r.length;l>a;a++){var c=r[a],u=i(c.path);switch(c.op){case"add":isNaN(u.col)?s.runHooks("afterCreateRow",u.row):s.runHooks("afterCreateCol",u.col);break;case"remove":isNaN(u.col)?s.runHooks("afterRemoveRow",u.row,1):s.runHooks("afterRemoveCol",u.col,1);break;case"replace":s.runHooks("afterChange",[u.row,u.col,null,c.value],"external")}}}function i(){var t=this;t.observer&&(s.call(t),a.call(t))}function s(){var t=this;W.unobserve(t.getData(),t.observer),delete t.observeChangesActive,delete t.pauseObservingChanges,delete t.resumeObservingChanges}function r(){var t=this;t.addHook("afterDestroy",i),t.addHook("afterCreateRow",l),t.addHook("afterRemoveRow",l),t.addHook("afterCreateCol",l),t.addHook("afterRemoveCol",l),t.addHook("afterChange",function(t,e){"loadData"!=e&&l.call(this)})}function a(){var t=this;t.removeHook("afterDestroy",i),t.removeHook("afterCreateRow",l),t.removeHook("afterRemoveRow",l),t.removeHook("afterCreateCol",l),t.removeHook("afterRemoveCol",l),t.removeHook("afterChange",l)}function l(){var t=this;t.pauseObservingChanges(),t.addHookOnce("afterChangesObserved",function(){t.resumeObservingChanges()})}o.PluginHooks.add("afterLoadData",t),o.PluginHooks.add("afterUpdateSettings",t)}(),function(t){function e(){function e(){var t=this;for(var e in s)s.hasOwnProperty(e)&&!n.call(t,e)&&t.PluginHooks.add(e,s[e])}function o(){var t=this;for(var e in s)s.hasOwnProperty(e)&&n.call(t,e)&&t.PluginHooks.remove(e,s[e])}function n(t){var e=this;return e.PluginHooks.hooks.persistent.hasOwnProperty(t)}var i=this;this.init=function(){var n=this,s=n.getSettings().persistentState;return i.enabled=!!s,i.enabled?(n.storage||(n.storage=new t(n.rootElement[0].id)),n.resetState=i.resetValue,e.call(n),void 0):(o.call(n),void 0)},this.saveValue=function(t,e){var o=this;o.storage.saveValue(t,e)},this.loadValue=function(t,e){var o=this;e.value=o.storage.loadValue(t)},this.resetValue=function(t){var e=this;t!==void 0?e.storage.reset(t):e.storage.resetAll()};var s={persistentStateSave:i.saveValue,persistentStateLoad:i.loadValue,persistentStateReset:i.resetValue}}var n=new e;o.PluginHooks.add("beforeInit",n.init),o.PluginHooks.add("afterUpdateSettings",n.init)}(h),function(e){e.UndoRedo=function(t){var o=this;this.instance=t,this.doneActions=[],this.undoneActions=[],this.ignoreNewActions=!1,t.addHook("afterChange",function(t){if(t){var n=new e.UndoRedo.ChangeAction(t);o.done(n)}}),t.addHook("afterCreateRow",function(t,n){var i=new e.UndoRedo.CreateRowAction(t,n);o.done(i)}),t.addHook("beforeRemoveRow",function(t,n){var i=o.instance.getData();t=(i.length+t)%i.length;var s=i.slice(t,t+n),r=new e.UndoRedo.RemoveRowAction(t,s);o.done(r)}),t.addHook("afterCreateCol",function(t,n){var i=new e.UndoRedo.CreateColumnAction(t,n);o.done(i)}),t.addHook("beforeRemoveCol",function(n,i){var s=o.instance.getData();n=(o.instance.countCols()+n)%o.instance.countCols();for(var r=[],a=0,l=s.length;l>a;a++)r[a]=s[a].slice(n,n+i);var c;e.helper.isArray(t.getSettings().colHeaders)&&(c=t.getSettings().colHeaders.slice(n,n+r.length));var u=new e.UndoRedo.RemoveColumnAction(n,r,c);o.done(u)})},e.UndoRedo.prototype.done=function(t){this.ignoreNewActions||(this.doneActions.push(t),this.undoneActions.length=0)},e.UndoRedo.prototype.undo=function(){if(this.isUndoAvailable()){var t=this.doneActions.pop();this.ignoreNewActions=!0,t.undo(this.instance),this.ignoreNewActions=!1,this.undoneActions.push(t)}},e.UndoRedo.prototype.redo=function(){if(this.isRedoAvailable()){var t=this.undoneActions.pop();this.ignoreNewActions=!0,t.redo(this.instance),this.ignoreNewActions=!0,this.doneActions.push(t)}},e.UndoRedo.prototype.isUndoAvailable=function(){return this.doneActions.length>0},e.UndoRedo.prototype.isRedoAvailable=function(){return this.undoneActions.length>0},e.UndoRedo.prototype.clear=function(){this.doneActions.length=0,this.undoneActions.length=0},e.UndoRedo.Action=function(){},e.UndoRedo.Action.prototype.undo=function(){},e.UndoRedo.Action.prototype.redo=function(){},e.UndoRedo.ChangeAction=function(t){this.changes=t},e.helper.inherit(e.UndoRedo.ChangeAction,e.UndoRedo.Action),e.UndoRedo.ChangeAction.prototype.undo=function(e){for(var o=t.extend(!0,[],this.changes),n=0,i=o.length;i>n;n++)o[n].splice(3,1);e.setDataAtRowProp(o,null,null,"undo")},e.UndoRedo.ChangeAction.prototype.redo=function(e){for(var o=t.extend(!0,[],this.changes),n=0,i=o.length;i>n;n++)o[n].splice(2,1);e.setDataAtRowProp(o,null,null,"redo")},e.UndoRedo.CreateRowAction=function(t,e){this.index=t,this.amount=e},e.helper.inherit(e.UndoRedo.CreateRowAction,e.UndoRedo.Action),e.UndoRedo.CreateRowAction.prototype.undo=function(t){t.alter("remove_row",this.index,this.amount)},e.UndoRedo.CreateRowAction.prototype.redo=function(t){t.alter("insert_row",this.index+1,this.amount)},e.UndoRedo.RemoveRowAction=function(t,e){this.index=t,this.data=e},e.helper.inherit(e.UndoRedo.RemoveRowAction,e.UndoRedo.Action),e.UndoRedo.RemoveRowAction.prototype.undo=function(t){var e=[this.index,0];Array.prototype.push.apply(e,this.data),Array.prototype.splice.apply(t.getData(),e),t.render()},e.UndoRedo.RemoveRowAction.prototype.redo=function(t){t.alter("remove_row",this.index,this.data.length)},e.UndoRedo.CreateColumnAction=function(t,e){this.index=t,this.amount=e},e.helper.inherit(e.UndoRedo.CreateColumnAction,e.UndoRedo.Action),e.UndoRedo.CreateColumnAction.prototype.undo=function(t){t.alter("remove_col",this.index,this.amount)},e.UndoRedo.CreateColumnAction.prototype.redo=function(t){t.alter("insert_col",this.index+1,this.amount)},e.UndoRedo.RemoveColumnAction=function(t,e,o){this.index=t,this.data=e,this.amount=this.data[0].length,this.headers=o},e.helper.inherit(e.UndoRedo.RemoveColumnAction,e.UndoRedo.Action),e.UndoRedo.RemoveColumnAction.prototype.undo=function(t){for(var e,o,n=0,i=t.getData().length;i>n;n++)e=t.getDataAtRow(n),o=[this.index,0],Array.prototype.push.apply(o,this.data[n]),Array.prototype.splice.apply(e,o);this.headers!==void 0&&(o=[this.index,0],Array.prototype.push.apply(o,this.headers),Array.prototype.splice.apply(t.getSettings().colHeaders,o)),t.render()},e.UndoRedo.RemoveColumnAction.prototype.redo=function(t){t.alter("remove_col",this.index,this.amount)}}(o),function(t){function e(){var e=this,r=e.getSettings().undo===void 0||e.getSettings().undo;r?e.undoRedo||(e.undoRedo=new t.UndoRedo(e),i(e),e.addHook("beforeKeyDown",o),e.addHook("afterChange",n)):e.undoRedo&&(delete e.undoRedo,s(e),e.removeHook("beforeKeyDown",o),e.removeHook("afterChange",n))}function o(t){var e=this,o=(t.ctrlKey||t.metaKey)&&!t.altKey;o&&(89===t.keyCode||t.shiftKey&&90===t.keyCode?(e.undoRedo.redo(),t.stopImmediatePropagation()):90===t.keyCode&&(e.undoRedo.undo(),t.stopImmediatePropagation()))}function n(t,e){var o=this;return"loadData"==e?o.undoRedo.clear():void 0}function i(t){t.undo=function(){return t.undoRedo.undo()},t.redo=function(){return t.undoRedo.redo()},t.isUndoAvailable=function(){return t.undoRedo.isUndoAvailable()},t.isRedoAvailable=function(){return t.undoRedo.isRedoAvailable()},t.clearUndo=function(){return t.undoRedo.clear()}}function s(t){delete t.undo,delete t.redo,delete t.isUndoAvailable,delete t.isRedoAvailable,delete t.clearUndo}t.PluginHooks.add("afterInit",e),t.PluginHooks.add("afterUpdateSettings",e)}(o),function(t){function e(n){return this.filter(e.resizableFilterSelector).each(function(){new o(t(this),n)}),this}function o(o,n){this.clones||(this.config=t.extend({},e.defaults,n),this.el=o,this.nodeName=o[0].nodeName.toLowerCase(),this.previousScrollTop=null,"original"===n.maxWidth&&(n.maxWidth=o.width()),"original"===n.minWidth&&(n.minWidth=o.width()),"original"===n.maxHeight&&(n.maxHeight=o.height()),"original"===n.minHeight&&(n.minHeight=o.height()),"textarea"===this.nodeName&&o.css({resize:"none",overflowY:"none"}),o.data("AutoResizer",this),this.createClone(),this.injectClone(),this.bind())}e.defaults={onResize:function(){},animate:{duration:200,complete:function(){}},extraSpace:50,minHeight:"original",maxHeight:500,minWidth:"original",maxWidth:500},e.cloneCSSProperties=["lineHeight","textDecoration","letterSpacing","fontSize","fontFamily","fontStyle","fontWeight","textTransform","textAlign","direction","wordSpacing","fontSizeAdjust","padding"],e.cloneCSSValues={position:"absolute",top:-9999,left:-9999,opacity:0,overflow:"hidden",overflowX:"hidden",overflowY:"hidden",border:"1px solid black",padding:"0.49em"},e.resizableFilterSelector="textarea,input:not(input[type]),input[type=text],input[type=password]",e.AutoResizer=o,t.fn.autoResize=e,o.prototype={bind:function(){var e=t.proxy(function(){return this.check(),!0},this);this.unbind(),this.el.bind("keyup.autoResize",e).bind("change.autoResize",e),this.check(null,!0)},unbind:function(){this.el.unbind(".autoResize")},createClone:function(){var o=this.el,n=this,i=this.config;this.clones=t(),("original"!==i.minHeight||"original"!==i.maxHeight)&&(this.hClone=o.clone().height("auto"),this.clones=this.clones.add(this.hClone)),("original"!==i.minWidth||"original"!==i.maxWidth)&&(this.wClone=t("
").width("auto").css({whiteSpace:"nowrap","float":"left"}),this.clones=this.clones.add(this.wClone)),t.each(e.cloneCSSProperties,function(t,e){n.clones.css(e,o.css(e))}),this.clones.removeAttr("name").removeAttr("id").attr("tabIndex",-1).css(e.cloneCSSValues).css("overflowY","scroll")},check:function(t,e){var o=this.config,n=this.wClone,i=this.hClone,s=this.el,r=s.val();if(n){n.text(r);var a=n.outerWidth(),l=a+o.extraSpace>=o.minWidth?a+o.extraSpace:o.minWidth,c=s.width();l=Math.min(l,o.maxWidth),(c>l&&l>=o.minWidth||l>=o.minWidth&&o.maxWidth>=l)&&(o.onResize.call(s),s.scrollLeft(0),o.animate&&!e?s.stop(1,1).animate({width:l},o.animate):s.width(l))}if(i){l&&i.width(l),i.height(0).val(r).scrollTop(1e4);var u=i[0].scrollTop+o.extraSpace;if(this.previousScrollTop===u)return;this.previousScrollTop=u,u>=o.maxHeight&&(u=o.maxHeight),o.minHeight>u&&(u=o.minHeight),u==o.maxHeight&&l==o.maxWidth?s.css("overflowY","scroll"):s.css("overflowY","hidden"),o.onResize.call(s),o.animate&&!e?s.stop(1,1).animate({height:u},o.animate):s.height(u)}},destroy:function(){this.unbind(),this.el.removeData("AutoResizer"),this.clones.remove(),delete this.el,delete this.hClone,delete this.wClone,delete this.clones},injectClone:function(){(e.cloneContainer||(e.cloneContainer=t("").appendTo("body"))).empty().append(this.clones)}}}(jQuery),function(t){function e(t){return t.split('"').length-1}t.SheetClip={parse:function(t){var o,n,i,s,r,a,l,c=[],u=0;for(i=t.split("\n"),i.length>1&&""===i[i.length-1]&&i.pop(),o=0,n=i.length;n>o;o+=1){for(i[o]=i[o].split(" "),s=0,r=i[o].length;r>s;s+=1)c[u]||(c[u]=[]),a&&0===s?(l=c[u].length-1,c[u][l]=c[u][l]+"\n"+i[o][0],a&&1&e(i[o][0])&&(a=!1,c[u][l]=c[u][l].substring(0,c[u][l].length-1).replace(/""/g,'"'))):s===r-1&&0===i[o][s].indexOf('"')?(c[u].push(i[o][s].substring(1).replace(/""/g,'"')),a=!0):(c[u].push(i[o][s].replace(/""/g,'"')),a=!1);a||(u+=1)}return c},stringify:function(t){var e,o,n,i,s,r="";for(e=0,o=t.length;o>e;e+=1){for(n=0,i=t[e].length;i>n;n+=1)n>0&&(r+=" "),s=t[e][n],r+="string"==typeof s?s.indexOf("\n")>-1?'"'+s.replace(/"/g,'""')+'"':s:null===s||void 0===s?"":s;r+="\n"}return r}}}(e);var z=function(){var t;return{getInstance:function(){return t||(t=new d),t}}}();d.prototype.selectNodeText=function(t){t.select()},d.prototype.getSelectionText=function(){var t="";return e.getSelection?t=""+e.getSelection():document.selection&&"Control"!=document.selection.type&&(t=document.selection.createRange().text),t},d.prototype.copyable=function(t){if("string"!=typeof t&&void 0===t.toString)throw Error("copyable requires string parameter");this.elTextarea.value=t},d.prototype.onCut=function(t){this.cutCallbacks.push(t)},d.prototype.onPaste=function(t){this.pasteCallbacks.push(t)},d.prototype.removeCallback=function(t){var e,o;for(e=0,o=this.copyCallbacks.length;o>e;e++)if(this.copyCallbacks[e]===t)return this.copyCallbacks.splice(e,1),!0;for(e=0,o=this.cutCallbacks.length;o>e;e++)if(this.cutCallbacks[e]===t)return this.cutCallbacks.splice(e,1),!0;for(e=0,o=this.pasteCallbacks.length;o>e;e++)if(this.pasteCallbacks[e]===t)return this.pasteCallbacks.splice(e,1),!0;return!1},d.prototype.triggerCut=function(t){var e=this;e.cutCallbacks&&setTimeout(function(){for(var o=0,n=e.cutCallbacks.length;n>o;o++)e.cutCallbacks[o](t)},50)},d.prototype.triggerPaste=function(t,e){var o=this;o.pasteCallbacks&&setTimeout(function(){for(var n=(e||o.elTextarea.value).replace(/\n$/,""),i=0,s=o.pasteCallbacks.length;s>i;i++)o.pasteCallbacks[i](n,t)},50)},d.prototype._bindEvent=function(){return e.jQuery?function(e,o,n){t(e).on(o+".copypaste",n)}:function(t,e,o){t.addEventListener(e,o,!1)}}();var W;(function(t){function o(t,e){for(var n in e)if(e.hasOwnProperty(n)){var i=e[n];i instanceof Object&&(Object.unobserve(i,t),i.____Path=e.____Path+"/"+n,o(t,i))}}function n(t,e){delete e.____Path,Object.observe(e,t);for(var o in e)if(e.hasOwnProperty(o)){var i=e[o];i instanceof Object&&n(t,i)}}function i(t,e){Object.observe?(Object.unobserve(t,e),o(e,t)):clearTimeout(e.next)}function s(t,i){var s,l=[],c=t;if(Object.observe)s=function(t){if(!c.___Path){Object.unobserve(c,s),c.____Path="",o(s,c);for(var e=0,r=t.length;r>e;)"____Path"!=t[e].name&&d[t[e].type].call(t[e],l,t[e].object.____Path),e++;n(s,c)}i&&i(l),s.patches=l,l=[]};else{s={};for(var u,h=0,f=p.length;f>h;h++)if(p[h].obj===t){u=p[h];break}if(u||(u={obj:t},p.push(u)),u.value=JSON.parse(JSON.stringify(t)),i){s.callback=i,s.next=null;var m=this.intervals||[100,1e3,1e4,6e4],g=0,v=function(){a(s)},w=function(){clearTimeout(s.next),s.next=setTimeout(function(){v(),g=0,s.next=setTimeout(y,m[g++])},0)},y=function(){v(),g==m.length&&(g=m.length-1),s.next=setTimeout(y,m[g++])};e!==void 0&&(e.addEventListener?(e.addEventListener("mousedown",w),e.addEventListener("mouseup",w),e.addEventListener("keydown",w)):(e.attachEvent("onmousedown",w),e.attachEvent("onmouseup",w),e.attachEvent("onkeydown",w))),s.next=setTimeout(y,m[g++])}}return s.patches=l,s.object=t,r(s,t,l)}function r(t,e,o){if(Object.observe){Object.observe(e,t);for(var n in e)if(e.hasOwnProperty(n)){var i=e[n];i&&"object"==typeof i&&r(t,i,o)}}return t}function a(t){if(Object.observe)Object.deliverChangeRecords(t);else{for(var e,o=0,n=p.length;n>o;o++)if(p[o].obj===t.object){e=p[o];break}l(e.value,t.object,t.patches,"")}var i=t.patches;return i.length>0&&(t.patches=[],t.callback&&t.callback(i)),i}function l(t,e,o,n){for(var i=f(e),s=f(t),r=!1,a=!1,c=0;s.length>c;c++){var u=s[c],h=t[u];if(e.hasOwnProperty(u)){var d=e[u];h instanceof Object?l(h,d,o,n+"/"+u):h!=d&&(r=!0,o.push({op:"replace",path:n+"/"+u,value:d}),t[u]=d)}else o.push({op:"remove",path:n+"/"+u}),delete t[u],a=!0}if(a||i.length!=s.length)for(var c=0;i.length>c;c++){var u=i[c];t.hasOwnProperty(u)||(o.push({op:"add",path:n+"/"+u,value:e[u]}),t[u]=JSON.parse(JSON.stringify(e[u])))}}function c(t,e){for(var o,n=!1,i=0,s=e.length;s>i;){o=e[i];for(var r=o.path.split("/"),a=t,l=1,c=r.length;;)if(m(a)){var d=parseInt(r[l],10);if(l++,l>=c){n=h[o.op].call(o,a,d,t);break}a=a[d]}else{var p=r[l];if(-1!=p.indexOf("~")&&(p=p.replace("~1","/").replace("~0","~")),l++,l>=c){n=u[o.op].call(o,a,p,t);break}a=a[p]}i++}return n}var u={add:function(t,e){return t[e]=this.value,!0},remove:function(t,e){return delete t[e],!0},replace:function(t,e){return t[e]=this.value,!0},move:function(t,e,o){var n={op:"_get",path:this.from};return c(o,[n]),c(o,[{op:"remove",path:this.from}]),c(o,[{op:"add",path:this.path,value:n.value}]),!0},copy:function(t,e,o){var n={op:"_get",path:this.from};return c(o,[n]),c(o,[{op:"add",path:this.path,value:n.value}]),!0},test:function(t,e){return JSON.stringify(t[e])===JSON.stringify(this.value)},_get:function(t,e){this.value=t[e]}},h={add:function(t,e){t.splice(e,0,this.value)},remove:function(t,e){t.splice(e,1)},replace:function(t,e){t[e]=this.value},move:u.move,copy:u.copy,test:u.test,_get:u._get},d={"new":function(t,e){var o={op:"add",path:e+"/"+this.name,value:this.object[this.name]};t.push(o)},deleted:function(t,e){var o={op:"remove",path:e+"/"+this.name};t.push(o)},updated:function(t,e){var o={op:"replace",path:e+"/"+this.name,value:this.object[this.name]};t.push(o)}},p=[];t.intervals,t.unobserve=i,t.observe=s,t.generate=a;var f;f=Object.keys?Object.keys:function(t){var e=[];for(var o in t)t.hasOwnProperty(o)&&e.push(o);return e};var m;m=Array.isArray?Array.isArray:function(t){return t.push&&"number"==typeof t.length},t.apply=c})(W||(W={})),"undefined"!=typeof exports&&(exports.apply=W.apply,exports.observe=W.observe,exports.unobserve=W.unobserve,exports.generate=W.generate),p.prototype.appear=function(t){var e,o,n,i,s,r,a,l,c,u,h,d;if(!this.disabled){var p,f,m,g,v,w,y,b=this.instance,C=!1,S=!1,T=!1,x=!1;for(b.wtTable.isRowInViewport(t[0])||(C=!0),b.wtTable.isRowInViewport(t[2])||(T=!0),w=b.wtTable.rowStrategy.countVisible(),v=0;w>v;v++)if(y=b.wtTable.rowFilter.visibleToSource(v),y>=t[0]&&t[2]>=y){p=y;break}for(v=w-1;v>=0;v--)if(y=b.wtTable.rowFilter.visibleToSource(v),y>=t[0]&&t[2]>=y){m=y;break}if(C&&T)S=!0,x=!0;else{for(b.wtTable.isColumnInViewport(t[1])||(S=!0),b.wtTable.isColumnInViewport(t[3])||(x=!0),w=b.wtTable.columnStrategy.countVisible(),v=0;w>v;v++)if(y=b.wtTable.columnFilter.visibleToSource(v),y>=t[1]&&t[3]>=y){f=y;break}for(v=w-1;v>=0;v--)if(y=b.wtTable.columnFilter.visibleToSource(v),y>=t[1]&&t[3]>=y){g=y;break}}if(void 0===p||void 0===f)return this.disappear(),void 0;e=p!==m||f!==g,o=b.wtTable.getCell([p,f]),n=e?b.wtTable.getCell([m,g]):o,i=this.wtDom.offset(o),s=e?this.wtDom.offset(n):i,r=this.wtDom.offset(b.wtTable.TABLE),l=i.top,h=s.top+this.wtDom.outerHeight(n)-l,u=i.left,d=s.left+this.wtDom.outerWidth(n)-u,a=l-r.top-1,c=u-r.left-1;var E=this.wtDom.getComputedStyle(o);parseInt(E.borderTopWidth,10)>0&&(a+=1,h-=1),parseInt(E.borderLeftWidth,10)>0&&(c+=1,d-=1),C?this.topStyle.display="none":(this.topStyle.top=a+"px",this.topStyle.left=c+"px",this.topStyle.width=d+"px",this.topStyle.display="block"),S?this.leftStyle.display="none":(this.leftStyle.top=a+"px",this.leftStyle.left=c+"px",this.leftStyle.height=h+"px",this.leftStyle.display="block");var R=Math.floor(this.settings.border.width/2);T?this.bottomStyle.display="none":(this.bottomStyle.top=a+h-R+"px",this.bottomStyle.left=c+"px",this.bottomStyle.width=d+"px",this.bottomStyle.display="block"),x?this.rightStyle.display="none":(this.rightStyle.top=a+"px",this.rightStyle.left=c+d-R+"px",this.rightStyle.height=h+1+"px",this.rightStyle.display="block"),T||x||!this.hasSetting(this.settings.border.cornerVisible)?this.cornerStyle.display="none":(this.cornerStyle.top=a+h-4+"px",this.cornerStyle.left=c+d-4+"px",this.cornerStyle.display="block")}},p.prototype.disappear=function(){this.topStyle.display="none",this.leftStyle.display="none",this.bottomStyle.display="none",this.rightStyle.display="none",this.cornerStyle.display="none"},p.prototype.hasSetting=function(t){return"function"==typeof t?t():!!t},f.prototype.source=function(t){return t},f.prototype.offsetted=function(t){return t+this.offset},f.prototype.unOffsetted=function(t){return t-this.offset},f.prototype.fixed=function(t){return this.fixedCount>t?t-this.offset:t},f.prototype.unFixed=function(t){return this.fixedCount>t?t+this.offset:t},f.prototype.visibleToSource=function(t){return this.source(this.offsetted(this.fixed(t)))},f.prototype.sourceToVisible=function(t){return this.source(this.unOffsetted(this.unFixed(t)))},m.prototype.getSize=function(t){return this.cellSizes[t]},m.prototype.getContainerSize=function(t){return"function"==typeof this.containerSizeFn?this.containerSizeFn(t):this.containerSizeFn},m.prototype.countVisible=function(){return this.cellCount},m.prototype.isLastIncomplete=function(){return this.remainingSize>0},g.prototype.add=function(t,e,o){this.cache[t]||(this.cache[t]=[]),this.cache[t][e]||(this.cache[t][e]=[]),this.cache[t][e][o]=!0},g.prototype.test=function(t,e,o){return this.cache[t]&&this.cache[t][e]&&this.cache[t][e][o]},v.prototype=new f,v.prototype.readSettings=function(t){this.offset=t.wtSettings.settings.offsetColumn,this.total=t.getSetting("totalColumns"),this.fixedCount=t.getSetting("fixedColumnsLeft"),this.countTH=t.getSetting("rowHeaders").length},v.prototype.offsettedTH=function(t){return t-this.countTH},v.prototype.unOffsettedTH=function(t){return t+this.countTH},v.prototype.visibleRowHeadedColumnToSourceColumn=function(t){return this.visibleToSource(this.offsettedTH(t))},v.prototype.sourceColumnToVisibleRowHeadedColumn=function(t){return this.unOffsettedTH(this.sourceToVisible(t))},w.prototype=new m,w.prototype.getSize=function(t){return this.cellSizes[t]+(this.cellStretch[t]||0)},w.prototype.stretch=function(){var t=this.getContainerSize(this.cellSizesSum),e=0;if(this.remainingSize=this.cellSizesSum-t,this.cellStretch.length=0,"all"===this.strategy){if(0>this.remainingSize){for(var o,n=t/this.cellSizesSum;this.cellCount-1>e;)o=Math.floor(n*this.cellSizes[e]),this.remainingSize+=o-this.cellSizes[e],this.cellStretch[e]=o-this.cellSizes[e],e++;this.cellStretch[this.cellCount-1]=-this.remainingSize,this.remainingSize=0}}else"last"===this.strategy&&0>this.remainingSize&&(this.cellStretch[this.cellCount-1]=-this.remainingSize,this.remainingSize=0)},y.prototype.draw=function(t){return this.drawInterrupted=!1,t||this.wtDom.isVisible(this.wtTable.TABLE)?(this.getSetting("beforeDraw",!t),t=t&&this.getSetting("offsetRow")===this.lastOffsetRow&&this.getSetting("offsetColumn")===this.lastOffsetColumn,this.drawn&&(this.scrollVertical(0),this.scrollHorizontal(0)),this.lastOffsetRow=this.getSetting("offsetRow"),this.lastOffsetColumn=this.getSetting("offsetColumn"),this.wtTable.draw(t),this.getSetting("onDraw",!t),this):(this.drawInterrupted=!0,void 0)},y.prototype.update=function(t,e){return this.wtSettings.update(t,e)},y.prototype.scrollVertical=function(t){return this.wtScroll.scrollVertical(t)},y.prototype.scrollHorizontal=function(t){return this.wtScroll.scrollHorizontal(t)},y.prototype.scrollViewport=function(t){return this.wtScroll.scrollViewport(t),this},y.prototype.getViewport=function(){return[this.wtTable.rowFilter.visibleToSource(0),this.wtTable.columnFilter.visibleToSource(0),this.wtTable.getLastVisibleRow(),this.wtTable.getLastVisibleColumn()]},y.prototype.getSetting=function(t,e,o,n){return this.wtSettings.getSetting(t,e,o,n)},y.prototype.hasSetting=function(t){return this.wtSettings.has(t)},y.prototype.destroy=function(){t(document.body).off("."+this.guid),this.wtScrollbars.destroy(),clearTimeout(this.wheelTimeout),clearTimeout(this.dblClickTimeout)},b.prototype.closest=function(t,e,o){for(;null!=t&&t!==o;){if(1===t.nodeType&&e.indexOf(t.nodeName)>-1)return t;t=t.parentNode}return null},b.prototype.isChildOf=function(t,e){for(var o=t.parentNode;null!=o;){if(o==e)return!0;o=o.parentNode}return!1},b.prototype.index=function(t){for(var e=0;t=t.previousSibling;)++e;return e},document.documentElement.classList?(b.prototype.hasClass=function(t,e){return t.classList.contains(e)},b.prototype.addClass=function(t,e){t.classList.add(e)},b.prototype.removeClass=function(t,e){t.classList.remove(e)}):(b.prototype.hasClass=function(t,e){return t.className.match(RegExp("(\\s|^)"+e+"(\\s|$)"))},b.prototype.addClass=function(t,e){this.hasClass(t,e)||(t.className+=" "+e)},b.prototype.removeClass=function(t,e){if(this.hasClass(t,e)){var o=RegExp("(\\s|^)"+e+"(\\s|$)");t.className=t.className.replace(o," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}}),b.prototype.removeTextNodes=function(t,e){if(3===t.nodeType)e.removeChild(t);else if(["TABLE","THEAD","TBODY","TFOOT","TR"].indexOf(t.nodeName)>-1)for(var o=t.childNodes,n=o.length-1;n>=0;n--)this.removeTextNodes(o[n],t)},b.prototype.empty=function(t){for(var e;e=t.lastChild;)t.removeChild(e)},b.prototype.HTML_CHARACTERS=/(<(.*)>|&(.*);)/,b.prototype.fastInnerHTML=function(t,e){this.HTML_CHARACTERS.test(e)?t.innerHTML=e:this.fastInnerText(t,e)},b.prototype.fastInnerText=document.createTextNode("test").textContent?function(t,e){var o=t.firstChild;o&&3===o.nodeType&&null===o.nextSibling?o.textContent=e:(this.empty(t),t.appendChild(document.createTextNode(e)))}:function(t,e){var o=t.firstChild;o&&3===o.nodeType&&null===o.nextSibling?o.data=e:(this.empty(t),t.appendChild(document.createTextNode(e)))},b.prototype.isVisible=function(t){try{if(!t.offsetParent)return!1}catch(e){return!1}if(t.offsetWidth>0)return!0;for(var o=t;o!==document.documentElement;){if(null===o)return!1;if(11===o.nodeType)return!0;if("none"===o.style.display)return!1;o=o.parentNode}return!0},b.prototype.offset=function(t){if(this.hasCaptionProblem()&&t.firstChild&&"CAPTION"===t.firstChild.nodeName){var o=t.getBoundingClientRect();return{top:o.top+(e.pageYOffset||document.documentElement.scrollTop)-(document.documentElement.clientTop||0),left:o.left+(e.pageXOffset||document.documentElement.scrollLeft)-(document.documentElement.clientLeft||0)}}for(var n=t.offsetLeft,i=t.offsetTop,s=t;(t=t.offsetParent)&&t!==document.body;)n+=t.offsetLeft,i+=t.offsetTop,s=t;return s&&"fixed"===s.style.position&&(n+=e.pageXOffset||document.documentElement.scrollLeft,i+=e.pageYOffset||document.documentElement.scrollTop),{left:n,top:i}},b.prototype.getComputedStyle=function(t){return t.currentStyle||document.defaultView.getComputedStyle(t)},b.prototype.outerWidth=function(t){return t.offsetWidth},b.prototype.outerHeight=function(t){return this.hasCaptionProblem()&&t.firstChild&&"CAPTION"===t.firstChild.nodeName?t.offsetHeight+t.firstChild.offsetHeight:t.offsetHeight},function(){function t(){var t=document.createElement("TABLE");t.style.borderSpacing=0,t.style.borderWidth=0,t.style.padding=0;var o=document.createElement("TBODY");t.appendChild(o),o.appendChild(document.createElement("TR")),o.firstChild.appendChild(document.createElement("TD")),o.firstChild.firstChild.innerHTML="t
t";var n=document.createElement("CAPTION");n.innerHTML="c
c
c
c",n.style.padding=0,n.style.margin=0,t.insertBefore(n,o),document.body.appendChild(t),e=t.offsetHeight<2*t.lastChild.offsetHeight,document.body.removeChild(t)}var e;b.prototype.hasCaptionProblem=function(){return void 0===e&&t(),e},b.prototype.getCaretPosition=function(t){if(t.selectionStart)return t.selectionStart;if(document.selection){t.focus();var e=document.selection.createRange();if(null==e)return 0;var o=t.createTextRange(),n=o.duplicate();return o.moveToBookmark(e.getBookmark()),n.setEndPoint("EndToStart",o),n.text.length}return 0},b.prototype.setCaretPosition=function(t,e){if(t.setSelectionRange)t.focus(),t.setSelectionRange(e,e);else if(t.createTextRange){var o=t.createTextRange();o.collapse(!0),o.moveEnd("character",e),o.moveStart("character",e),o.select()}}}(),C.prototype.parentCell=function(t){var e={},o=this.instance.wtTable.TABLE,n=this.wtDom.closest(t,["TD","TH"],o);return n&&this.wtDom.isChildOf(n,o)?(e.coords=this.instance.wtTable.getCoords(n),e.TD=n):this.wtDom.hasClass(t,"wtBorder")&&this.wtDom.hasClass(t,"current")&&!this.wtDom.hasClass(t,"corner")&&(e.coords=this.instance.selections.current.selected[0],e.TD=this.instance.wtTable.getCell(e.coords)),e},Array.prototype.indexOf||(Array.prototype.indexOf=function(t){var e=this.length>>>0,o=Number(arguments[1])||0;for(o=0>o?Math.ceil(o):Math.floor(o),0>o&&(o+=e);e>o;o++)if(o in this&&this[o]===t)return o;return-1}),e.requestAnimFrame=function(){return e.requestAnimationFrame||e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame||e.msRequestAnimationFrame||function(t){return e.setTimeout(t,1e3/60)}}(),e.cancelRequestAnimFrame=function(){return e.cancelAnimationFrame||e.webkitCancelRequestAnimationFrame||e.mozCancelRequestAnimationFrame||e.oCancelRequestAnimationFrame||e.msCancelRequestAnimationFrame||clearTimeout -}(),e.getComputedStyle||function(){var t,o={getPropertyValue:function(e){return"float"==e&&(e="styleFloat"),t.currentStyle[e.toUpperCase()]||null}};e.getComputedStyle=function(e){return t=e,o}}(),S.prototype=new f,S.prototype.readSettings=function(t){this.offset=t.wtSettings.settings.offsetRow,this.total=t.getSetting("totalRows"),this.fixedCount=t.getSetting("fixedRowsTop")},T.prototype=new m,T.prototype.add=function(t,e,o){if(!this.isLastIncomplete()){var n=this.sizeAtIndex(t,e);if(void 0===n)return!1;var i=this.getContainerSize(this.cellSizesSum+n);return o?this.cellSizes.unshift(n):this.cellSizes.push(n),this.cellSizesSum+=n,this.cellCount++,this.remainingSize=this.cellSizesSum-i,o&&this.isLastIncomplete()?!1:!0}return!1},T.prototype.remove=function(){var t=this.cellSizes.pop();this.cellSizesSum-=t,this.cellCount--,this.remainingSize-=t},T.prototype.removeOutstanding=function(){for(;this.cellCount>0&&this.cellSizes[this.cellCount-1]0?this.scrollLogicVertical(t,n,s,i,r,function(t){return i>t-n&&t-n>=0?o.getSetting("rowHeight",t-n):o.getSetting("rowHeight",t)},function(t){o.wtTable.verticalRenderReverse=t}):0,e!==n&&this.instance.wtScrollbars.vertical.scrollTo(e),o},x.prototype.scrollHorizontal=function(t){if(!this.instance.drawn)throw Error("scrollHorizontal can only be called after table was drawn to DOM");var e,o=this.instance,n=o.getSetting("offsetColumn"),i=o.getSetting("fixedColumnsLeft"),s=o.getSetting("totalColumns"),r=o.wtViewport.getViewportWidth();return e=s>0?this.scrollLogicHorizontal(t,n,s,i,r,function(t){return i>t-n&&t-n>=0?o.getSetting("columnWidth",t-n):o.getSetting("columnWidth",t)}):0,e!==n&&this.instance.wtScrollbars.horizontal.scrollTo(e),o},x.prototype.scrollLogicVertical=function(t,e,o,n,i,s,r){var a=e+t;return a>=o-n&&(a=o-n-1,r(!0)),0>a&&(a=0),a},x.prototype.scrollLogicHorizontal=function(t,e,o,n,i,s){var r,a=e+t,l=0;if(a>n){for(a>=o-n&&(a=o-n-1),r=a;i>l&&o>r;)l+=s(r),r++;if(i>l)for(;a>0&&(l+=s(a-1),i>l);)a--}else 0>a&&(a=0);return a},x.prototype.scrollViewport=function(t){var o=this.instance.getSetting("offsetRow"),n=(this.instance.getSetting("offsetColumn"),this.instance.wtTable.getLastVisibleRow()),i=this.instance.getSetting("totalRows"),s=this.instance.getSetting("totalColumns"),r=this.instance.getSetting("fixedRowsTop"),a=this.instance.getSetting("fixedColumnsLeft");if(this.instance.isNativeScroll){var l=this.instance.wtTable.getCell(t);if("object"==typeof l){var c=b.prototype.offset(l),u=b.prototype.outerHeight(l),h=e.scrollY,d=document.documentElement.clientHeight;return d>u&&(h>c.top?l.scrollIntoView(!0):c.top+u>h+d&&l.scrollIntoView(!1)),void 0}}if(0>t[0]||t[0]>i-1)throw Error("row "+t[0]+" does not exist");if(0>t[1]||t[1]>s-1)throw Error("column "+t[1]+" does not exist");if(t[0]>n?(this.scrollVertical(t[0]-r-o),this.instance.wtTable.verticalRenderReverse=!0):t[0]===n&&this.instance.wtTable.rowStrategy.isLastIncomplete()?(this.scrollVertical(t[0]-r-o),this.instance.wtTable.verticalRenderReverse=!0):o>t[0]-r?this.scrollVertical(t[0]-r-o):this.scrollVertical(0),this.instance.wtTable.isColumnBeforeViewport(t[1]))this.instance.wtScrollbars.horizontal.scrollTo(t[1]-a);else if(this.instance.wtTable.isColumnAfterViewport(t[1])||this.instance.wtTable.getLastVisibleColumn()===t[1]&&!this.instance.wtTable.isLastColumnFullyVisible()){for(var p=0,f=0;a>f;f++)p+=this.instance.getSetting("columnWidth",f);var m=t[1];p+=this.instance.getSetting("columnWidth",m);var g=this.instance.wtViewport.getViewportWidth();if(g>p)for(var v=this.instance.getSetting("columnWidth",m-1);g>p+v&&m>=a;)m--,p+=v;this.instance.wtScrollbars.horizontal.scrollTo(m-a)}return this.instance},E.prototype.init=function(){var e=this;this.$table=t(this.instance.wtTable.TABLE),this.slider=document.createElement("DIV"),this.sliderStyle=this.slider.style,this.sliderStyle.position="absolute",this.sliderStyle.top="0",this.sliderStyle.left="0",this.sliderStyle.display="none",this.slider.className="dragdealer "+this.type,this.handle=document.createElement("DIV"),this.handleStyle=this.handle.style,this.handle.className="handle",this.slider.appendChild(this.handle),this.container=this.instance.wtTable.holder,this.container.appendChild(this.slider);var o=!0;this.dragTimeout=null;var n,i=function(){e.onScroll(n)};this.dragdealer=new q(this.slider,{vertical:"vertical"===this.type,horizontal:"horizontal"===this.type,slide:!1,speed:100,animationCallback:function(t,s){return o?(o=!1,void 0):(e.skipRefresh=!0,n="vertical"===e.type?s:t,null===e.dragTimeout&&(e.dragTimeout=setInterval(i,100),i()),void 0)},callback:function(t,o){e.skipRefresh=!1,clearInterval(e.dragTimeout),e.dragTimeout=null,n="vertical"===e.type?o:t,e.onScroll(n)}}),this.skipRefresh=!1},E.prototype.onScroll=function(t){if(this.instance.drawn&&(this.readSettings(),this.total>this.visibleCount)){var e=Math.round(this.handlePosition*this.total/this.sliderSize);1===t?"vertical"===this.type?this.instance.scrollVertical(1/0).draw():this.instance.scrollHorizontal(1/0).draw():e!==this.offset?"vertical"===this.type?this.instance.scrollVertical(e-this.offset).draw():this.instance.scrollHorizontal(e-this.offset).draw():this.refresh()}},E.prototype.getHandleSizeRatio=function(t,e){return!e||t>e||t==e?1:1/e},E.prototype.prepare=function(){if(!this.skipRefresh){var t=this.getHandleSizeRatio(this.visibleCount,this.total);this.visible=(1===t||isNaN(t))&&"auto"===this.scrollMode||"none"===this.scrollMode?!1:!0}},E.prototype.refresh=function(){if(!this.skipRefresh){if(!this.visible)return this.sliderStyle.display="none",void 0;var t,e,o,n,i=this.visibleCount,s=this.instance.wtViewport.getWorkspaceWidth(),r=this.instance.wtViewport.getWorkspaceHeight();1/0===s&&(s=this.instance.wtViewport.getWorkspaceActualWidth()),1/0===r&&(r=this.instance.wtViewport.getWorkspaceActualHeight()),"vertical"===this.type?(this.instance.wtTable.rowStrategy.isLastIncomplete()&&i--,e=r-2,this.sliderStyle.top=this.instance.wtDom.offset(this.$table[0]).top-this.instance.wtDom.offset(this.container).top+"px",this.sliderStyle.left=s-1+"px",this.sliderStyle.height=Math.max(e,0)+"px"):(e=s-2,this.sliderStyle.left=this.instance.wtDom.offset(this.$table[0]).left-this.instance.wtDom.offset(this.container).left+"px",this.sliderStyle.top=r-1+"px",this.sliderStyle.width=Math.max(e,0)+"px"),t=this.getHandleSizeRatio(i,this.total),o=Math.round(e*t),10>o&&(o=15),n=Math.floor(e*(this.offset/this.total)),o+n>e&&(n=e-o),"vertical"===this.type?(this.handleStyle.height=o+"px",this.handleStyle.top=n+"px"):(this.handleStyle.width=o+"px",this.handleStyle.left=n+"px"),this.sliderStyle.display="block"}},E.prototype.destroy=function(){clearInterval(this.dragdealer.interval)};var F=function(t){this.instance=t,this.type="vertical",this.init()};F.prototype=new E,F.prototype.scrollTo=function(t){this.instance.update("offsetRow",t)},F.prototype.readSettings=function(){this.scrollMode=this.instance.getSetting("scrollV"),this.offset=this.instance.getSetting("offsetRow"),this.total=this.instance.getSetting("totalRows"),this.visibleCount=this.instance.wtTable.rowStrategy.countVisible(),this.visibleCount>1&&this.instance.wtTable.rowStrategy.isLastIncomplete()&&this.visibleCount--,this.handlePosition=parseInt(this.handleStyle.top,10),this.sliderSize=parseInt(this.sliderStyle.height,10),this.fixedCount=this.instance.getSetting("fixedRowsTop")};var j=function(t){this.instance=t,this.type="horizontal",this.init()};j.prototype=new E,j.prototype.scrollTo=function(t){this.instance.update("offsetColumn",t)},j.prototype.readSettings=function(){this.scrollMode=this.instance.getSetting("scrollH"),this.offset=this.instance.getSetting("offsetColumn"),this.total=this.instance.getSetting("totalColumns"),this.visibleCount=this.instance.wtTable.columnStrategy.countVisible(),this.visibleCount>1&&this.instance.wtTable.columnStrategy.isLastIncomplete()&&this.visibleCount--,this.handlePosition=parseInt(this.handleStyle.left,10),this.sliderSize=parseInt(this.sliderStyle.width,10),this.fixedCount=this.instance.getSetting("fixedColumnsLeft")},j.prototype.getHandleSizeRatio=function(t,e){return!e||t>e||t==e?1:t/e},R.prototype.init=function(){this.TABLE=this.instance.wtTable.TABLE,this.fixed=this.instance.wtTable.hider,this.fixedContainer=this.instance.wtTable.holder,this.fixed.style.position="absolute",this.fixed.style.left="0",this.$scrollHandler=t(e);var o=this;this.$scrollHandler.on("scroll.walkontable",function(){return o.instance.wtTable.holder.parentNode?(o.onScroll(),void 0):(o.destroy(),void 0)}),this.readSettings()},R.prototype.onScroll=function(t){if(this.readSettings(),t&&(this.windowScrollPosition=t),this.windowScrollPosition!==this.lastWindowScrollPosition){this.lastWindowScrollPosition=this.windowScrollPosition;var e,o=0;if(e=this.windowScrollPosition-this.tableParentOffset,X=0,e>0){for(var n,i=0,s=0;this.total>s&&(n=this.instance.getSetting("rowHeight",s),i+=n,!(i>e));s++);this.offset>0&&(X=i-e),o=s,o=Math.min(o,this.total)}this.curOuts=o>this.maxOuts?this.maxOuts:o,o-=this.curOuts,this.instance.update("offsetRow",o),this.readSettings(),this.instance.draw()}},R.prototype.prepare=function(){},R.prototype.availableSize=function(){var t;return t=this.windowScrollPosition>this.tableParentOffset?this.instance.wtTable.getLastVisibleRow()===this.total-1?this.instance.wtDom.outerHeight(this.TABLE):this.windowSize:this.windowSize-(this.tableParentOffset-this.windowScrollPosition)},R.prototype.refresh=function(){var t=this.getLastCell();this.measureBefore=this.sumCellSizes(0,this.offset),this.measureInside=this.getTableSize(),this.measureAfter=-1===t?0:this.sumCellSizes(t,this.total-t),this.applyToDOM()},R.prototype.destroy=function(){this.$scrollHandler.off("scroll.walkontable")};var U=function(t){this.instance=t,this.type="vertical",this.cellSize=23,this.init();var e=this;m.prototype.isLastIncomplete=function(){return this.remainingSize>e.sumCellSizes(e.offset,e.offset+e.curOuts+1)}};U.prototype=new R,U.prototype.getLastCell=function(){return this.instance.getSetting("offsetRow")+this.instance.wtTable.tbodyChildrenLength-1},U.prototype.getTableSize=function(){return this.instance.wtDom.outerHeight(this.TABLE)};var X=0;U.prototype.sumCellSizes=function(t,e){for(var o=0;e>t;)o+=this.instance.getSetting("rowHeight",t),t++;return o},U.prototype.applyToDOM=function(){var t=this.instance.wtViewport.getColumnHeaderHeight();this.fixedContainer.style.height=t+this.sumCellSizes(0,this.total)+"px",this.fixed.style.top=this.measureBefore+"px",this.fixed.style.bottom=""},U.prototype.scrollTo=function(t){var e=this.tableParentOffset+t*this.cellSize;this.$scrollHandler.scrollTop(e),this.onScroll(e)},U.prototype.readSettings=function(){var t=this.instance.wtDom.offset(this.fixedContainer);this.tableParentOffset=t.top,this.tableParentOtherOffset=t.left,this.windowSize=this.$scrollHandler.height(),this.windowScrollPosition=this.$scrollHandler.scrollTop(),this.offset=this.instance.getSetting("offsetRow"),this.total=this.instance.getSetting("totalRows")};var Y=function(t){this.instance=t,this.type="horizontal",this.cellSize=50,this.init()};Y.prototype=new R,Y.prototype.getLastCell=function(){return this.instance.wtTable.getLastVisibleColumn()},Y.prototype.getTableSize=function(){return this.instance.wtDom.outerWidth(this.TABLE)},Y.prototype.applyToDOM=function(){this.fixedContainer.style.paddingLeft=this.measureBefore+"px",this.fixedContainer.style.paddingRight=this.measureAfter+"px"},Y.prototype.scrollTo=function(t){this.$scrollHandler.scrollLeft(this.tableParentOffset+t*this.cellSize)},Y.prototype.readSettings=function(){var t=this.instance.wtDom.offset(this.fixedContainer);this.tableParentOffset=t.left,this.tableParentOtherOffset=t.top,this.windowSize=this.$scrollHandler.width(),this.windowScrollPosition=this.$scrollHandler.scrollLeft(),this.offset=this.instance.getSetting("offsetColumn"),this.total=this.instance.getSetting("totalColumns")},k.prototype.destroy=function(){this.vertical&&this.vertical.destroy(),this.horizontal&&this.horizontal.destroy()},k.prototype.refresh=function(){this.horizontal&&this.horizontal.readSettings(),this.vertical&&this.vertical.readSettings(),this.horizontal&&this.horizontal.prepare(),this.vertical&&this.vertical.prepare(),this.horizontal&&this.horizontal.refresh(),this.vertical&&this.vertical.refresh()},D.prototype.add=function(t){this.selected.push(t)},D.prototype.clear=function(){this.selected.length=0},D.prototype.getCorners=function(){var t,e,o,n,i,s=this.selected.length;if(s>0&&(t=o=this.selected[0][0],e=n=this.selected[0][1],s>1))for(i=1;s>i;i++)t>this.selected[i][0]?t=this.selected[i][0]:this.selected[i][0]>o&&(o=this.selected[i][0]),e>this.selected[i][1]?e=this.selected[i][1]:this.selected[i][1]>n&&(n=this.selected[i][1]);return[t,e,o,n]},D.prototype.draw=function(){var t,e,o,n,i,s=this.instance.wtTable.rowStrategy.countVisible(),r=this.instance.wtTable.columnStrategy.countVisible();if(this.selected.length){for(t=this.getCorners(),e=0;s>e;e++)for(o=0;r>o;o++)n=this.instance.wtTable.rowFilter.visibleToSource(e),i=this.instance.wtTable.columnFilter.visibleToSource(o),n>=t[0]&&t[2]>=n&&i>=t[1]&&t[3]>=i?this.instance.wtTable.currentCellCache.add(e,o,this.settings.className):n>=t[0]&&t[2]>=n?this.instance.wtTable.currentCellCache.add(e,o,this.settings.highlightRowClassName):i>=t[1]&&t[3]>=i&&this.instance.wtTable.currentCellCache.add(e,o,this.settings.highlightColumnClassName);this.border&&this.border.appear(t)}else this.border&&this.border.disappear()},H.prototype.update=function(t,e){if(void 0===e)for(var o in t)t.hasOwnProperty(o)&&(this.settings[o]=t[o]);else this.settings[t]=e;return this.instance},H.prototype.getSetting=function(t,e,o,n){return this[t]?this[t](e,o,n):this._getSetting(t,e,o,n)},H.prototype._getSetting=function(t,e,o,n){return"function"==typeof this.settings[t]?this.settings[t](e,o,n):void 0!==e&&"[object Array]"===Object.prototype.toString.call(this.settings[t])?this.settings[t][e]:this.settings[t]},H.prototype.has=function(t){return!!this.settings[t]},H.prototype.rowHeight=function(t,e){if(this.instance.rowHeightCache||(this.instance.rowHeightCache=[]),void 0===this.instance.rowHeightCache[t]){var o=23;return e&&(o=this.instance.wtDom.outerHeight(e),this.instance.rowHeightCache[t]=o),o}return this.instance.rowHeightCache[t]},A.prototype.refreshHiderDimensions=function(){var t=this.instance.wtViewport.getWorkspaceHeight(),e=this.instance.wtViewport.getWorkspaceWidth(),o=this.spreader.style;1/0===t&&1/0===e||this.instance.isNativeScroll?(o.position="relative",o.width="auto",o.height="auto"):(1/0===t&&(t=this.instance.wtViewport.getWorkspaceActualHeight()),1/0===e&&(e=this.instance.wtViewport.getWorkspaceActualWidth()),this.hiderStyle.overflow="hidden",o.position="absolute",o.top="0",o.left="0","dragdealer"===this.instance.getSetting("scrollbarModelV")&&(o.height="4000px"),"dragdealer"===this.instance.getSetting("scrollbarModelH")&&(o.width="4000px"),0>t&&(t=0),this.hiderStyle.height=t+"px",this.hiderStyle.width=e+"px")},A.prototype.refreshStretching=function(){var t=this.instance,e=t.getSetting("stretchH"),o=t.getSetting("totalRows"),n=t.getSetting("totalColumns"),i=t.getSetting("offsetColumn"),s=function(t){return r.instance.wtViewport.getViewportWidth(t)},r=this,a=function(e){var o=r.columnFilter.visibleToSource(e);return n>o?t.getSetting("columnWidth",o):void 0};"hybrid"===e&&(e=i>0?"last":"none");var l=function(t){return r.instance.isNativeScroll?2*r.instance.wtViewport.getViewportHeight(t):r.instance.wtViewport.getViewportHeight(t)},c=function(t,e){var n=r.rowFilter.visibleToSource(t);return o>n?r.verticalRenderReverse&&0===t?r.instance.getSetting("rowHeight",n,e)-1:r.instance.getSetting("rowHeight",n,e):void 0};this.columnStrategy=new w(s,a,e),this.rowStrategy=new T(l,c)},A.prototype.adjustAvailableNodes=function(){for(var t,e,o,n,i=this.instance.getSetting("rowHeaders"),s=i.length,r=this.instance.getSetting("columnHeaders");s>this.colgroupChildrenLength;)this.COLGROUP.appendChild(document.createElement("COL")),this.colgroupChildrenLength++;for(this.refreshStretching(),t=this.columnStrategy.cellCount;t+s>this.colgroupChildrenLength;)this.COLGROUP.appendChild(document.createElement("COL")),this.colgroupChildrenLength++;for(;this.colgroupChildrenLength>t+s;)this.COLGROUP.removeChild(this.COLGROUP.lastChild),this.colgroupChildrenLength--;if(e=this.THEAD.firstChild,r.length){for(e||(e=document.createElement("TR"),this.THEAD.appendChild(e)),this.theadChildrenLength=e.childNodes.length;t+s>this.theadChildrenLength;)e.appendChild(document.createElement("TH")),this.theadChildrenLength++;for(;this.theadChildrenLength>t+s;)e.removeChild(e.lastChild),this.theadChildrenLength--}else e&&this.wtDom.empty(e);for(n=0;this.colgroupChildrenLength>n;n++)s>n?this.wtDom.addClass(this.COLGROUP.childNodes[n],"rowHeader"):this.wtDom.removeClass(this.COLGROUP.childNodes[n],"rowHeader");if(r.length&&(e=this.THEAD.firstChild,s))for(o=e.firstChild,n=0;s>n;n++)i[n](-s+n,o),o=o.nextSibling;for(n=0;t>n;n++)r.length&&r[0](this.columnFilter.visibleToSource(n),e.childNodes[s+n])},A.prototype.adjustColumns=function(t,e){for(var o=t.childNodes.length;e>o;){var n=document.createElement("TD");t.appendChild(n),o++}for(;o>e;)t.removeChild(t.lastChild),o--},A.prototype.draw=function(t){return this.instance.isNativeScroll&&(this.verticalRenderReverse=!1),this.rowFilter.readSettings(this.instance),this.columnFilter.readSettings(this.instance),t?this.instance.wtScrollbars.refresh():(this.tableOffset=this.wtDom.offset(this.TABLE),this._doDraw()),this.refreshPositions(t),this.instance.drawn=!0,this},A.prototype._doDraw=function(){var t,e,o,n,i,s,r,a,l,c,u=0,h=this.instance.getSetting("offsetRow"),d=this.instance.getSetting("totalRows"),p=this.instance.getSetting("totalColumns"),f=this.instance.getSetting("rowHeaders"),m=f.length,g=!1;this.verticalRenderReverse&&(l=h),this.instance.wtViewport.resetSettings();var v=!1;if(this.verticalRenderReverse&&(h===d-this.rowFilter.fixedCount-1?v=!0:(this.instance.update("offsetRow",h+1),this.rowFilter.readSettings(this.instance))),p>0){t=this.rowFilter.visibleToSource(u);for(var w=!0;d>t&&t>=0;){if(u>1e3)throw Error("Security brake: Too much TRs. Please define height for your table, which will enforce scrollbars.");if(u>=this.tbodyChildrenLength||this.verticalRenderReverse&&u>=this.rowFilter.fixedCount){for(i=document.createElement("TR"),e=0;m>e;e++)i.appendChild(document.createElement("TH"));this.verticalRenderReverse&&u>=this.rowFilter.fixedCount?this.TBODY.insertBefore(i,this.TBODY.childNodes[this.rowFilter.fixedCount]||this.TBODY.firstChild):this.TBODY.appendChild(i),this.tbodyChildrenLength++}else i=0===u?this.TBODY.firstChild:i.nextSibling;for(r=i.firstChild,e=0;m>e;e++)"TD"==r.nodeName&&(s=r,r=document.createElement("TH"),i.insertBefore(r,s),i.removeChild(s)),f[e](t,r),r=r.nextSibling;if(w)for(w=!1,this.adjustAvailableNodes(),g=!0,n=this.columnStrategy.cellCount,this.adjustColumns(i,n+m),a=this.instance.wtViewport.getWorkspaceWidth(),this.columnStrategy.stretch(),e=0;n>e;e++)this.COLGROUP.childNodes[e+m].style.width=this.columnStrategy.getSize(e)+"px";else this.adjustColumns(i,n+m);for(e=0;n>e;e++)o=this.columnFilter.visibleToSource(e),s=0===e?i.childNodes[this.columnFilter.sourceColumnToVisibleRowHeadedColumn(o)]:s.nextSibling,"TH"==s.nodeName&&(r=s,s=document.createElement("TD"),i.insertBefore(s,r),i.removeChild(r)),s.className="",s.removeAttribute("style"),this.instance.getSetting("cellRenderer",t,o,s),s.setAttribute("data-row",t),s.setAttribute("data-column",o);if(h=this.instance.getSetting("offsetRow"),this.verticalRenderReverse&&v){if(-this.wtDom.outerHeight(i.firstChild)=this.rowFilter.fixedCount){if(0===h)break;this.instance.update("offsetRow",h-1),this.rowFilter.readSettings(this.instance)}else u++;t=this.rowFilter.visibleToSource(u)}}for(g||this.adjustAvailableNodes(),u=this.rowStrategy.countVisible();this.tbodyChildrenLength>u;)this.TBODY.removeChild(this.TBODY.lastChild),this.tbodyChildrenLength--;if(this.instance.wtScrollbars.refresh(),a!==this.instance.wtViewport.getWorkspaceWidth())for(this.columnStrategy.stretch(),e=0;this.columnStrategy.cellCount>e;e++)this.COLGROUP.childNodes[e+m].style.width=this.columnStrategy.getSize(e)+"px";this.verticalRenderReverse=!1},A.prototype.refreshPositions=function(t){this.refreshHiderDimensions(),this.refreshSelections(t)},A.prototype.refreshSelections=function(t){var e,o,n,i,s,r,a=[],l=this.rowStrategy.countVisible(),c=this.columnStrategy.countVisible();if(this.oldCellCache=this.currentCellCache,this.currentCellCache=new g,this.instance.selections)for(o in this.instance.selections)this.instance.selections.hasOwnProperty(o)&&(this.instance.selections[o].draw(),this.instance.selections[o].settings.className&&a.push(this.instance.selections[o].settings.className),this.instance.selections[o].settings.highlightRowClassName&&a.push(this.instance.selections[o].settings.highlightRowClassName),this.instance.selections[o].settings.highlightColumnClassName&&a.push(this.instance.selections[o].settings.highlightColumnClassName));for(r=a.length,e=0;l>e;e++)for(n=0;c>n;n++)for(o=this.rowFilter.visibleToSource(e),i=this.columnFilter.visibleToSource(n),s=0;r>s;s++)this.currentCellCache.test(e,n,a[s])?this.wtDom.addClass(this.getCell([o,i]),a[s]):t&&this.oldCellCache.test(e,n,a[s])&&this.wtDom.removeClass(this.getCell([o,i]),a[s])},A.prototype.getCell=function(t){return this.instance.isNativeScroll?this.instance.wtTable.TBODY.querySelectorAll('[data-row="'+t[0]+'"][data-column="'+t[1]+'"]')[0]:this.isRowBeforeViewport(t[0])?-1:this.isRowAfterViewport(t[0])?-2:this.isColumnBeforeViewport(t[1])?-3:this.isColumnAfterViewport(t[1])?-4:this.TBODY.childNodes[this.rowFilter.sourceToVisible(t[0])].childNodes[this.columnFilter.sourceColumnToVisibleRowHeadedColumn(t[1])]},A.prototype.getCoords=function(t){return[this.rowFilter.visibleToSource(this.wtDom.index(t.parentNode)),this.columnFilter.visibleRowHeadedColumnToSourceColumn(t.cellIndex)]},A.prototype.getLastVisibleRow=function(){return this.rowFilter.visibleToSource(this.rowStrategy.cellCount-1)},A.prototype.getLastVisibleColumn=function(){return this.columnFilter.visibleToSource(this.columnStrategy.cellCount-1)},A.prototype.isRowBeforeViewport=function(t){return this.rowFilter.sourceToVisible(t)=this.rowFilter.fixedCount},A.prototype.isRowAfterViewport=function(t){return t>this.getLastVisibleRow()},A.prototype.isColumnBeforeViewport=function(t){return this.columnFilter.sourceToVisible(t)=this.columnFilter.fixedCount},A.prototype.isColumnAfterViewport=function(t){return t>this.getLastVisibleColumn()},A.prototype.isRowInViewport=function(t){return this.instance.isNativeScroll?!!this.instance.wtTable.TBODY.querySelectorAll('[data-row="'+t+'"]')[0]:!this.isRowBeforeViewport(t)&&!this.isRowAfterViewport(t)},A.prototype.isColumnInViewport=function(t){return this.instance.isNativeScroll?!!this.instance.wtTable.TBODY.querySelectorAll('[data-column="'+t+'"]')[0]:!this.isColumnBeforeViewport(t)&&!this.isColumnAfterViewport(t)},A.prototype.isLastRowFullyVisible=function(){return this.getLastVisibleRow()===this.instance.getSetting("totalRows")-1&&!this.rowStrategy.isLastIncomplete()},A.prototype.isLastColumnFullyVisible=function(){return this.getLastVisibleColumn()===this.instance.getSetting("totalColumns")-1&&!this.columnStrategy.isLastIncomplete()},P.prototype.getWorkspaceHeight=function(t){if(this.instance.isNativeScroll)return this.clientHeight;var e=this.instance.getSetting("height");return(1/0===e||void 0===e||null===e||1>e)&&(e=this.instance.wtScrollbars.vertical instanceof R?this.instance.wtScrollbars.vertical.availableSize():1/0),1/0!==e&&(t>=e?e-=this.instance.getSetting("scrollbarHeight"):this.instance.wtScrollbars.horizontal.visible&&(e-=this.instance.getSetting("scrollbarHeight"))),e},P.prototype.getWorkspaceWidth=function(t){var e=this.instance.getSetting("width");return(1/0===e||void 0===e||null===e||1>e)&&(e=this.instance.wtScrollbars.horizontal instanceof R?this.instance.wtScrollbars.horizontal.availableSize():1/0),1/0!==e&&(t>=e?e-=this.instance.getSetting("scrollbarWidth"):this.instance.wtScrollbars.vertical.visible&&(e-=this.instance.getSetting("scrollbarWidth"))),e},P.prototype.getWorkspaceActualHeight=function(){return this.instance.wtDom.outerHeight(this.instance.wtTable.TABLE)},P.prototype.getWorkspaceActualWidth=function(){return this.instance.wtDom.outerWidth(this.instance.wtTable.TABLE)||this.instance.wtDom.outerWidth(this.instance.wtTable.TBODY)||this.instance.wtDom.outerWidth(this.instance.wtTable.THEAD)},P.prototype.getColumnHeaderHeight=function(){if(isNaN(this.columnHeaderHeight)){var t=this.instance.wtDom.offset(this.instance.wtTable.TBODY),e=this.instance.wtTable.tableOffset;this.columnHeaderHeight=t.top-e.top}return this.columnHeaderHeight},P.prototype.getViewportHeight=function(t){var e=this.getWorkspaceHeight(t);if(1/0===e)return e;var o=this.getColumnHeaderHeight();return o>0?e-o:e},P.prototype.getRowHeaderHeight=function(){if(isNaN(this.rowHeaderWidth)){var t=this.instance.wtTable.TBODY?this.instance.wtTable.TBODY.firstChild:null;if(t){var e=t.firstChild;for(this.rowHeaderWidth=0;e&&"TH"===e.nodeName;)this.rowHeaderWidth+=this.instance.wtDom.outerWidth(e),e=e.nextSibling}}return this.rowHeaderWidth},P.prototype.getViewportWidth=function(t){var e=this.getWorkspaceWidth(t);if(1/0===e)return e;var o=this.getRowHeaderHeight();return o>0?e-o:e},P.prototype.resetSettings=function(){this.rowHeaderWidth=0/0,this.columnHeaderHeight=0/0};var G={x:0,y:0,init:function(){this.setEvent("mouse"),this.setEvent("touch")},setEvent:function(t){var e=document["on"+t+"move"]||function(){};document["on"+t+"move"]=function(t){e(t),G.refresh(t)}},refresh:function(t){t||(t=e.event),"mousemove"==t.type?this.set(t):t.touches&&this.set(t.touches[0])},set:function(t){t.pageX||t.pageY?(this.x=t.pageX,this.y=t.pageY):(t.clientX||t.clientY)&&(this.x=t.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,this.y=t.clientY+document.body.scrollTop+document.documentElement.scrollTop)}};G.init();var K={get:function(t){var e=0,o=0;if(t.offsetParent)do o+=t.offsetLeft,e+=t.offsetTop;while(t=t.offsetParent);return[o,e]}},q=function(t,e){if("string"==typeof t&&(t=document.getElementById(t)),t){var o=t.getElementsByTagName("div")[0];o&&-1!=o.className.search(/(^|\s)handle(\s|$)/)&&(this.init(t,o,e||{}),this.setup())}};q.prototype={init:function(t,e,o){this.wrapper=t,this.handle=e,this.options=o,this.disabled=this.getOption("disabled",!1),this.horizontal=this.getOption("horizontal",!0),this.vertical=this.getOption("vertical",!1),this.slide=this.getOption("slide",!0),this.steps=this.getOption("steps",0),this.snap=this.getOption("snap",!1),this.loose=this.getOption("loose",!1),this.speed=this.getOption("speed",10)/100,this.xPrecision=this.getOption("xPrecision",0),this.yPrecision=this.getOption("yPrecision",0),this.callback=o.callback||null,this.animationCallback=o.animationCallback||null,this.bounds={left:o.left||0,right:-(o.right||0),top:o.top||0,bottom:-(o.bottom||0),x0:0,x1:0,xRange:0,y0:0,y1:0,yRange:0},this.value={prev:[-1,-1],current:[o.x||0,o.y||0],target:[o.x||0,o.y||0]},this.offset={wrapper:[0,0],mouse:[0,0],prev:[-999999,-999999],current:[0,0],target:[0,0]},this.change=[0,0],this.activity=!1,this.dragging=!1,this.tapping=!1},getOption:function(t,e){return void 0!==this.options[t]?this.options[t]:e},setup:function(){this.setWrapperOffset(),this.setBoundsPadding(),this.setBounds(),this.setSteps(),this.addListeners()},setWrapperOffset:function(){this.offset.wrapper=K.get(this.wrapper)},setBoundsPadding:function(){this.bounds.left||this.bounds.right||(this.bounds.left=K.get(this.handle)[0]-this.offset.wrapper[0],this.bounds.right=-this.bounds.left),this.bounds.top||this.bounds.bottom||(this.bounds.top=K.get(this.handle)[1]-this.offset.wrapper[1],this.bounds.bottom=-this.bounds.top)},setBounds:function(){this.bounds.x0=this.bounds.left,this.bounds.x1=this.wrapper.offsetWidth+this.bounds.right,this.bounds.xRange=this.bounds.x1-this.bounds.x0-this.handle.offsetWidth,this.bounds.y0=this.bounds.top,this.bounds.y1=this.wrapper.offsetHeight+this.bounds.bottom,this.bounds.yRange=this.bounds.y1-this.bounds.y0-this.handle.offsetHeight,this.bounds.xStep=1/(this.xPrecision||Math.max(this.wrapper.offsetWidth,this.handle.offsetWidth)),this.bounds.yStep=1/(this.yPrecision||Math.max(this.wrapper.offsetHeight,this.handle.offsetHeight))},setSteps:function(){if(this.steps>1){this.stepRatios=[];for(var t=0;this.steps-1>=t;t++)this.stepRatios[t]=t/(this.steps-1)}},addListeners:function(){var t=this;this.wrapper.onselectstart=function(){return!1},this.handle.onmousedown=this.handle.ontouchstart=function(e){t.handleDownHandler(e)},this.wrapper.onmousedown=this.wrapper.ontouchstart=function(e){t.wrapperDownHandler(e)};var o=document.onmouseup||function(){};document.onmouseup=function(e){o(e),t.documentUpHandler(e)};var n=document.ontouchend||function(){};document.ontouchend=function(e){n(e),t.documentUpHandler(e)};var i=e.onresize||function(){};e.onresize=function(e){i(e),t.documentResizeHandler(e)},this.wrapper.onmousemove=function(){t.activity=!0},this.wrapper.onclick=function(){return!t.activity},this.interval=setInterval(function(){t.animate()},25),t.animate(!1,!0)},handleDownHandler:function(t){this.activity=!1,G.refresh(t),this.preventDefaults(t,!0),this.startDrag()},wrapperDownHandler:function(t){G.refresh(t),this.preventDefaults(t,!0),this.startTap()},documentUpHandler:function(){this.stopDrag(),this.stopTap()},documentResizeHandler:function(){this.setWrapperOffset(),this.setBounds(),this.update()},enable:function(){this.disabled=!1,this.handle.className=this.handle.className.replace(/\s?disabled/g,"")},disable:function(){this.disabled=!0,this.handle.className+=" disabled"},setStep:function(t,e,o){this.setValue(this.steps&&t>1?(t-1)/(this.steps-1):0,this.steps&&e>1?(e-1)/(this.steps-1):0,o)},setValue:function(t,e,o){this.setTargetValue([t,e||0]),o&&this.groupCopy(this.value.current,this.value.target)},startTap:function(t){this.disabled||(this.tapping=!0,this.setWrapperOffset(),this.setBounds(),void 0===t&&(t=[G.x-this.offset.wrapper[0]-this.handle.offsetWidth/2,G.y-this.offset.wrapper[1]-this.handle.offsetHeight/2]),this.setTargetOffset(t))},stopTap:function(){!this.disabled&&this.tapping&&(this.tapping=!1,this.setTargetValue(this.value.current),this.result())},startDrag:function(){this.disabled||(this.setWrapperOffset(),this.setBounds(),this.offset.mouse=[G.x-K.get(this.handle)[0],G.y-K.get(this.handle)[1]],this.dragging=!0)},stopDrag:function(){if(!this.disabled&&this.dragging){this.dragging=!1;var t=this.groupClone(this.value.current);if(this.slide){var e=this.change;t[0]+=4*e[0],t[1]+=4*e[1]}this.setTargetValue(t),this.result()}},feedback:function(){var t=this.value.current;this.snap&&this.steps>1&&(t=this.getClosestSteps(t)),this.groupCompare(t,this.value.prev)||("function"==typeof this.animationCallback&&this.animationCallback(t[0],t[1]),this.groupCopy(this.value.prev,t)) -},result:function(){"function"==typeof this.callback&&this.callback(this.value.target[0],this.value.target[1])},animate:function(t,e){if(!t||this.dragging){if(this.dragging){var o=this.groupClone(this.value.target),n=[G.x-this.offset.wrapper[0]-this.offset.mouse[0],G.y-this.offset.wrapper[1]-this.offset.mouse[1]];this.setTargetOffset(n,this.loose),this.change=[this.value.target[0]-o[0],this.value.target[1]-o[1]]}(this.dragging||e)&&this.groupCopy(this.value.current,this.value.target),(this.dragging||this.glide()||e)&&(this.update(),this.feedback())}},glide:function(){var t=[this.value.target[0]-this.value.current[0],this.value.target[1]-this.value.current[1]];return t[0]||t[1]?(Math.abs(t[0])>this.bounds.xStep||Math.abs(t[1])>this.bounds.yStep?(this.value.current[0]+=t[0]*this.speed,this.value.current[1]+=t[1]*this.speed):this.groupCopy(this.value.current,this.value.target),!0):!1},update:function(){this.offset.current=this.snap?this.getOffsetsByRatios(this.getClosestSteps(this.value.current)):this.getOffsetsByRatios(this.value.current),this.show()},show:function(){this.groupCompare(this.offset.current,this.offset.prev)||(this.horizontal&&(this.handle.style.left=this.offset.current[0]+""+"px"),this.vertical&&(this.handle.style.top=this.offset.current[1]+""+"px"),this.groupCopy(this.offset.prev,this.offset.current))},setTargetValue:function(t,e){var o=e?this.getLooseValue(t):this.getProperValue(t);this.groupCopy(this.value.target,o),this.offset.target=this.getOffsetsByRatios(o)},setTargetOffset:function(t,e){var o=this.getRatiosByOffsets(t),n=e?this.getLooseValue(o):this.getProperValue(o);this.groupCopy(this.value.target,n),this.offset.target=this.getOffsetsByRatios(n)},getLooseValue:function(t){var e=this.getProperValue(t);return[e[0]+(t[0]-e[0])/4,e[1]+(t[1]-e[1])/4]},getProperValue:function(t){var e=this.groupClone(t);return e[0]=Math.max(e[0],0),e[1]=Math.max(e[1],0),e[0]=Math.min(e[0],1),e[1]=Math.min(e[1],1),(!this.dragging&&!this.tapping||this.snap)&&this.steps>1&&(e=this.getClosestSteps(e)),e},getRatiosByOffsets:function(t){return[this.getRatioByOffset(t[0],this.bounds.xRange,this.bounds.x0),this.getRatioByOffset(t[1],this.bounds.yRange,this.bounds.y0)]},getRatioByOffset:function(t,e,o){return e?(t-o)/e:0},getOffsetsByRatios:function(t){return[this.getOffsetByRatio(t[0],this.bounds.xRange,this.bounds.x0),this.getOffsetByRatio(t[1],this.bounds.yRange,this.bounds.y0)]},getOffsetByRatio:function(t,e,o){return Math.round(t*e)+o},getClosestSteps:function(t){return[this.getClosestStep(t[0]),this.getClosestStep(t[1])]},getClosestStep:function(t){for(var e=0,o=1,n=0;this.steps-1>=n;n++)o>Math.abs(this.stepRatios[n]-t)&&(o=Math.abs(this.stepRatios[n]-t),e=n);return this.stepRatios[e]},groupCompare:function(t,e){return t[0]==e[0]&&t[1]==e[1]},groupCopy:function(t,e){t[0]=e[0],t[1]=e[1]},groupClone:function(t){return[t[0],t[1]]},preventDefaults:function(t,o){t||(t=e.event),t.preventDefault&&t.preventDefault(),t.returnValue=!1,o&&document.selection&&document.selection.empty()},cancelEvent:function(t){t||(t=e.event),t.stopPropagation&&t.stopPropagation(),t.cancelBubble=!0}},jQuery.browser||function(){var t,e;jQuery.uaMatch=function(t){t=t.toLowerCase();var e=/(chrome)[ \/]([\w.]+)/.exec(t)||/(webkit)[ \/]([\w.]+)/.exec(t)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(t)||/(msie) ([\w.]+)/.exec(t)||0>t.indexOf("compatible")&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(t)||[];return{browser:e[1]||"",version:e[2]||"0"}},t=jQuery.uaMatch(navigator.userAgent),e={},t.browser&&(e[t.browser]=!0,e.version=t.version),e.chrome?e.webkit=!0:e.webkit&&(e.safari=!0),jQuery.browser=e}(),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports?module.exports=t:t(jQuery)}(function(t){function o(o){var s,r=o||e.event,a=[].slice.call(arguments,1),l=0,c=0,u=0,h=0,d=0;return o=t.event.fix(r),o.type="mousewheel",r.wheelDelta&&(l=r.wheelDelta),r.detail&&(l=-1*r.detail),r.deltaY&&(u=-1*r.deltaY,l=u),r.deltaX&&(c=r.deltaX,l=-1*c),void 0!==r.wheelDeltaY&&(u=r.wheelDeltaY),void 0!==r.wheelDeltaX&&(c=-1*r.wheelDeltaX),h=Math.abs(l),(!n||n>h)&&(n=h),d=Math.max(Math.abs(u),Math.abs(c)),(!i||i>d)&&(i=d),s=l>0?"floor":"ceil",l=Math[s](l/n),c=Math[s](c/i),u=Math[s](u/i),a.unshift(o,l,c,u),(t.event.dispatch||t.event.handle).apply(this,a)}var n,i,s=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],r="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"];if(t.event.fixHooks)for(var a=s.length;a;)t.event.fixHooks[s[--a]]=t.event.mouseHooks;t.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var t=r.length;t;)this.addEventListener(r[--t],o,!1);else this.onmousewheel=o},teardown:function(){if(this.removeEventListener)for(var t=r.length;t;)this.removeEventListener(r[--t],o,!1);else this.onmousewheel=null}},t.fn.extend({mousewheel:function(t){return t?this.bind("mousewheel",t):this.trigger("mousewheel")},unmousewheel:function(t){return this.unbind("mousewheel",t)}})}),Array.prototype.filter||(Array.prototype.filter=function(t,e){function o(t){return/NodeList/i.test(t.item)}function n(t){for(var e=[],o=0,n=t.length;n>o;o++)e[o]=t[o];return e}if(this===void 0||null===this)throw new TypeError;if("function"!=typeof t)throw new TypeError;e=e||this,o(e)&&(e=n(e));var i,s,r=e.length,a=[];for(i=0;r>i;i+=1)e.hasOwnProperty(i)&&(s=e[i],t.call(e,s,i,e)&&a.push(s));return a})})(jQuery,window,Handsontable),!function(t){"use strict";var e=function(e,o){this.$element=t(e),this.options=t.extend({},t.fn.typeahead.defaults,o),this.matcher=this.options.matcher||this.matcher,this.sorter=this.options.sorter||this.sorter,this.highlighter=this.options.highlighter||this.highlighter,this.updater=this.options.updater||this.updater,this.source=this.options.source,this.$menu=t(this.options.menu),this.shown=!1,this.listen()};e.prototype={constructor:e,select:function(){var t=this.$menu.find(".active").attr("data-value");return this.$element.val(this.updater(t)).change(),this.hide()},updater:function(t){return t},show:function(){var e=t.extend({},this.$element.position(),{height:this.$element[0].offsetHeight});return this.$menu.insertAfter(this.$element).css({top:e.top+e.height,left:e.left}).show(),this.shown=!0,this},hide:function(){return this.$menu.hide(),this.shown=!1,this},lookup:function(){var e;return this.query=this.$element.val(),!this.query||this.query.length"+e+""})},render:function(e){var o=this;return e=t(e).map(function(e,n){return e=t(o.options.item).attr("data-value",n),e.find("a").html(o.highlighter(n)),e[0]}),e.first().addClass("active"),this.$menu.html(e),this},next:function(){var e=this.$menu.find(".active").removeClass("active"),o=e.next();o.length||(o=t(this.$menu.find("li")[0])),o.addClass("active")},prev:function(){var t=this.$menu.find(".active").removeClass("active"),e=t.prev();e.length||(e=this.$menu.find("li").last()),e.addClass("active")},listen:function(){this.$element.on("focus",t.proxy(this.focus,this)).on("blur",t.proxy(this.blur,this)).on("keypress",t.proxy(this.keypress,this)).on("keyup",t.proxy(this.keyup,this)),this.eventSupported("keydown")&&this.$element.on("keydown",t.proxy(this.keydown,this)),this.$menu.on("click",t.proxy(this.click,this)).on("mouseenter","li",t.proxy(this.mouseenter,this)).on("mouseleave","li",t.proxy(this.mouseleave,this))},eventSupported:function(t){var e=t in this.$element;return e||(this.$element.setAttribute(t,"return;"),e="function"==typeof this.$element[t]),e},move:function(t){if(this.shown){switch(t.keyCode){case 9:case 13:case 27:t.preventDefault();break;case 38:t.preventDefault(),this.prev();break;case 40:t.preventDefault(),this.next()}t.stopPropagation()}},keydown:function(e){this.suppressKeyPressRepeat=~t.inArray(e.keyCode,[40,38,9,13,27]),this.move(e)},keypress:function(t){this.suppressKeyPressRepeat||this.move(t)},keyup:function(t){switch(t.keyCode){case 40:case 38:case 16:case 17:case 18:break;case 9:case 13:if(!this.shown)return;this.select();break;case 27:if(!this.shown)return;this.hide();break;default:this.lookup()}t.stopPropagation(),t.preventDefault()},focus:function(){this.focused=!0},blur:function(){this.focused=!1,!this.mousedover&&this.shown&&this.hide()},click:function(t){t.stopPropagation(),t.preventDefault(),this.select(),this.$element.focus()},mouseenter:function(e){this.mousedover=!0,this.$menu.find(".active").removeClass("active"),t(e.currentTarget).addClass("active")},mouseleave:function(){this.mousedover=!1,!this.focused&&this.shown&&this.hide()}};var o=t.fn.typeahead;t.fn.typeahead=function(o){return this.each(function(){var n=t(this),i=n.data("typeahead"),s="object"==typeof o&&o;i||n.data("typeahead",i=new e(this,s)),"string"==typeof o&&i[o]()})},t.fn.typeahead.defaults={source:[],items:8,menu:'',item:'
  • ',minLength:1},t.fn.typeahead.Constructor=e,t.fn.typeahead.noConflict=function(){return t.fn.typeahead=o,this},t(document).on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(){var e=t(this);e.data("typeahead")||e.typeahead(e.data())})}(window.jQuery),function(){function t(t){this._n=t}function e(t,e,o){var n,i=Math.pow(10,e);if(n=(Math.round(t*i)/i).toFixed(e),o){var s=RegExp("0{1,"+o+"}$");n=n.replace(s,"")}return n}function o(t,e){var o;return o=e.indexOf("$")>-1?i(t,e):e.indexOf("%")>-1?s(t,e):e.indexOf(":")>-1?r(t,e):l(t,e)}function n(t,e){if(e.indexOf(":")>-1)t._n=a(e);else if(e===f)t._n=0;else{var o=e;"."!==d[p].delimiters.decimal&&(e=e.replace(/\./g,"").replace(d[p].delimiters.decimal,"."));for(var n=RegExp(d[p].abbreviations.thousand+"(?:\\)|(\\"+d[p].currency.symbol+")?(?:\\))?)?$"),i=RegExp(d[p].abbreviations.million+"(?:\\)|(\\"+d[p].currency.symbol+")?(?:\\))?)?$"),s=RegExp(d[p].abbreviations.billion+"(?:\\)|(\\"+d[p].currency.symbol+")?(?:\\))?)?$"),r=RegExp(d[p].abbreviations.trillion+"(?:\\)|(\\"+d[p].currency.symbol+")?(?:\\))?)?$"),l=["KB","MB","GB","TB","PB","EB","ZB","YB"],c=!1,u=0;l.length>=u&&!(c=e.indexOf(l[u])>-1?Math.pow(1024,u+1):!1);u++);t._n=(c?c:1)*(o.match(n)?Math.pow(10,3):1)*(o.match(i)?Math.pow(10,6):1)*(o.match(s)?Math.pow(10,9):1)*(o.match(r)?Math.pow(10,12):1)*(e.indexOf("%")>-1?.01:1)*Number((e.indexOf("(")>-1?"-":"")+e.replace(/[^0-9\.-]+/g,"")),t._n=c?Math.ceil(t._n):t._n}return t._n}function i(t,e){var n=1>=e.indexOf("$")?!0:!1,i="";e.indexOf(" $")>-1?(i=" ",e=e.replace(" $","")):e.indexOf("$ ")>-1?(i=" ",e=e.replace("$ ","")):e=e.replace("$","");var s=o(t,e);return n?s.indexOf("(")>-1||s.indexOf("-")>-1?(s=s.split(""),s.splice(1,0,d[p].currency.symbol+i),s=s.join("")):s=d[p].currency.symbol+i+s:s.indexOf(")")>-1?(s=s.split(""),s.splice(-1,0,i+d[p].currency.symbol),s=s.join("")):s=s+i+d[p].currency.symbol,s}function s(t,e){var n="";e.indexOf(" %")>-1?(n=" ",e=e.replace(" %","")):e=e.replace("%",""),t._n=100*t._n;var i=o(t,e);return i.indexOf(")")>-1?(i=i.split(""),i.splice(-1,0,n+"%"),i=i.join("")):i=i+n+"%",i}function r(t){var e=Math.floor(t._n/60/60),o=Math.floor((t._n-60*60*e)/60),n=Math.round(t._n-60*60*e-60*o);return e+":"+(10>o?"0"+o:o)+":"+(10>n?"0"+n:n)}function a(t){var e=t.split(":"),o=0;return 3===e.length?(o+=60*60*Number(e[0]),o+=60*Number(e[1]),o+=Number(e[2])):2===e.lenght&&(o+=60*Number(e[0]),o+=Number(e[1])),Number(o)}function l(t,o){var n=!1,i=!1,s="",r="",a="",l=Math.abs(t._n);if(0===t._n&&null!==f)return f;if(o.indexOf("(")>-1&&(n=!0,o=o.slice(1,-1)),o.indexOf("a")>-1&&(o.indexOf(" a")>-1?(s=" ",o=o.replace(" a","")):o=o.replace("a",""),l>=Math.pow(10,12)?(s+=d[p].abbreviations.trillion,t._n=t._n/Math.pow(10,12)):Math.pow(10,12)>l&&l>=Math.pow(10,9)?(s+=d[p].abbreviations.billion,t._n=t._n/Math.pow(10,9)):Math.pow(10,9)>l&&l>=Math.pow(10,6)?(s+=d[p].abbreviations.million,t._n=t._n/Math.pow(10,6)):Math.pow(10,6)>l&&l>=Math.pow(10,3)&&(s+=d[p].abbreviations.thousand,t._n=t._n/Math.pow(10,3))),o.indexOf("b")>-1){o.indexOf(" b")>-1?(r=" ",o=o.replace(" b","")):o=o.replace("b","");for(var c,u,h=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],m=0;h.length>=m;m++)if(c=Math.pow(1024,m),u=Math.pow(1024,m+1),t._n>=c&&u>t._n){r+=h[m],c>0&&(t._n=t._n/c);break}}o.indexOf("o")>-1&&(o.indexOf(" o")>-1?(a=" ",o=o.replace(" o","")):o=o.replace("o",""),a+=d[p].ordinal(t._n)),o.indexOf("[.]")>-1&&(i=!0,o=o.replace("[.]","."));var g=(""+t._n).split(".")[0],v=o.split(".")[1],w=o.indexOf(","),y="",b=!1;return v?(v.indexOf("[")>-1?(v=v.replace("]",""),v=v.split("["),y=e(t._n,v[0].length+v[1].length,v[1].length)):y=e(t._n,v.length),g=y.split(".")[0],y=y.split(".")[1].length?d[p].delimiters.decimal+y.split(".")[1]:"",i&&0===Number(y)&&(y="")):g=e(t._n,null),g.indexOf("-")>-1&&(g=g.slice(1),b=!0),w>-1&&(g=(""+g).replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+d[p].delimiters.thousands)),0===o.indexOf(".")&&(g=""),(n&&b?"(":"")+(!n&&b?"-":"")+g+y+(a?a:"")+(s?s:"")+(r?r:"")+(n&&b?")":"")}function c(t,e){d[t]=e}var u,h="1.4.7",d={},p="en",f=null,m="undefined"!=typeof module&&module.exports;u=function(e){return u.isNumeral(e)?e=e.value():Number(e)||(e=0),new t(Number(e))},u.version=h,u.isNumeral=function(e){return e instanceof t},u.language=function(t,e){return t?(t&&!e&&(p=t),(e||!d[t])&&c(t,e),u):p},u.language("en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(t){var e=t%10;return 1===~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th"},currency:{symbol:"$"}}),u.zeroFormat=function(t){f="string"==typeof t?t:null},u.fn=t.prototype={clone:function(){return u(this)},format:function(t){return o(this,t?t:u.defaultFormat)},unformat:function(t){return n(this,t?t:u.defaultFormat)},value:function(){return this._n},valueOf:function(){return this._n},set:function(t){return this._n=Number(t),this},add:function(t){return this._n=this._n+Number(t),this},subtract:function(t){return this._n=this._n-Number(t),this},multiply:function(t){return this._n=this._n*Number(t),this},divide:function(t){return this._n=this._n/Number(t),this},difference:function(t){var e=this._n-Number(t);return 0>e&&(e=-e),e}},m&&(module.exports=u),"undefined"==typeof ender&&(this.numeral=u),"function"==typeof define&&define.amd&&define([],function(){return u})}.call(this),function(t,e){function o(t){for(var e,o=t.split(/\s+/),n=[],i=0;e=o[i];i++)e=e[0].toUpperCase(),n.push(e);return n}function n(e){return e.id&&t('label[for="'+e.id+'"]').val()||e.name}function i(o,s,r){return r||(r=0),s.each(function(){var s,a,l=t(this),c=this,u=this.nodeName.toLowerCase();switch("label"==u&&l.find("input, textarea, select").length&&(s=l.text(),l=l.children().first(),c=l.get(0),u=c.nodeName.toLowerCase()),u){case"menu":a={name:l.attr("label"),items:{}},r=i(a.items,l.children(),r);break;case"a":case"button":a={name:l.text(),disabled:!!l.attr("disabled"),callback:function(){return function(){l.click()}}()};break;case"menuitem":case"command":switch(l.attr("type")){case e:case"command":case"menuitem":a={name:l.attr("label"),disabled:!!l.attr("disabled"),callback:function(){return function(){l.click()}}()};break;case"checkbox":a={type:"checkbox",disabled:!!l.attr("disabled"),name:l.attr("label"),selected:!!l.attr("checked")};break;case"radio":a={type:"radio",disabled:!!l.attr("disabled"),name:l.attr("label"),radio:l.attr("radiogroup"),value:l.attr("id"),selected:!!l.attr("checked")};break;default:a=e}break;case"hr":a="-------";break;case"input":switch(l.attr("type")){case"text":a={type:"text",name:s||n(c),disabled:!!l.attr("disabled"),value:l.val()};break;case"checkbox":a={type:"checkbox",name:s||n(c),disabled:!!l.attr("disabled"),selected:!!l.attr("checked")};break;case"radio":a={type:"radio",name:s||n(c),disabled:!!l.attr("disabled"),radio:!!l.attr("name"),value:l.val(),selected:!!l.attr("checked")};break;default:a=e}break;case"select":a={type:"select",name:s||n(c),disabled:!!l.attr("disabled"),selected:l.val(),options:{}},l.children().each(function(){a.options[this.value]=t(this).text()});break;case"textarea":a={type:"textarea",name:s||n(c),disabled:!!l.attr("disabled"),value:l.val()};break;case"label":break;default:a={type:"html",html:l.clone(!0)}}a&&(r++,o["key"+r]=a)}),r}if(t.support.htmlMenuitem="HTMLMenuItemElement"in window,t.support.htmlCommand="HTMLCommandElement"in window,t.support.eventSelectstart="onselectstart"in document.documentElement,!t.ui||!t.ui.widget){var s=t.cleanData;t.cleanData=function(e){for(var o,n=0;null!=(o=e[n]);n++)try{t(o).triggerHandler("remove")}catch(i){}s(e)}}var r=null,a=!1,l=t(window),c=0,u={},h={},d={},p={selector:null,appendTo:null,trigger:"right",autoHide:!1,delay:200,reposition:!0,determinePosition:function(e){if(t.ui&&t.ui.position)e.css("display","block").position({my:"center top",at:"center bottom",of:this,offset:"0 5",collision:"fit"}).css("display","none");else{var o=this.offset();o.top+=this.outerHeight(),o.left+=this.outerWidth()/2-e.outerWidth()/2,e.css(o)}},position:function(t,o,n){var i;if(!o&&!n)return t.determinePosition.call(this,t.$menu),e;i="maintain"===o&&"maintain"===n?t.$menu.position():{top:n,left:o};var s=l.scrollTop()+l.height(),r=l.scrollLeft()+l.width(),a=t.$menu.height(),c=t.$menu.width();i.top+a>s&&(i.top-=a),i.left+c>r&&(i.left-=c),t.$menu.css(i)},positionSubmenu:function(e){if(t.ui&&t.ui.position)e.css("display","block").position({my:"left top",at:"right top",of:this,collision:"flipfit fit"}).css("display","");else{var o={top:0,left:this.outerWidth()};e.css(o)}},zIndex:1,animation:{duration:50,show:"slideDown",hide:"slideUp"},events:{show:t.noop,hide:t.noop},callback:null,items:{}},f={timer:null,pageX:null,pageY:null},m=function(t){for(var e=0,o=t;;)if(e=Math.max(e,parseInt(o.css("z-index"),10)||0),o=o.parent(),!o||!o.length||"html body".indexOf(o.prop("nodeName").toLowerCase())>-1)break;return e},g={abortevent:function(t){t.preventDefault(),t.stopImmediatePropagation()},contextmenu:function(e){var o=t(this);if(e.preventDefault(),e.stopImmediatePropagation(),!("right"!=e.data.trigger&&e.originalEvent||o.hasClass("context-menu-active")||o.hasClass("context-menu-disabled"))){if(r=o,e.data.build){var n=e.data.build(r,e);if(n===!1)return;if(e.data=t.extend(!0,{},p,e.data,n||{}),!e.data.items||t.isEmptyObject(e.data.items))throw window.console&&(console.error||console.log)("No items specified to show in contextMenu"),Error("No Items sepcified");e.data.$trigger=r,v.create(e.data)}v.show.call(o,e.data,e.pageX,e.pageY)}},click:function(e){e.preventDefault(),e.stopImmediatePropagation(),t(this).trigger(t.Event("contextmenu",{data:e.data,pageX:e.pageX,pageY:e.pageY}))},mousedown:function(e){var o=t(this);r&&r.length&&!r.is(o)&&r.data("contextMenu").$menu.trigger("contextmenu:hide"),2==e.button&&(r=o.data("contextMenuActive",!0))},mouseup:function(e){var o=t(this);o.data("contextMenuActive")&&r&&r.length&&r.is(o)&&!o.hasClass("context-menu-disabled")&&(e.preventDefault(),e.stopImmediatePropagation(),r=o,o.trigger(t.Event("contextmenu",{data:e.data,pageX:e.pageX,pageY:e.pageY}))),o.removeData("contextMenuActive")},mouseenter:function(e){var o=t(this),n=t(e.relatedTarget),i=t(document);n.is(".context-menu-list")||n.closest(".context-menu-list").length||r&&r.length||(f.pageX=e.pageX,f.pageY=e.pageY,f.data=e.data,i.on("mousemove.contextMenuShow",g.mousemove),f.timer=setTimeout(function(){f.timer=null,i.off("mousemove.contextMenuShow"),r=o,o.trigger(t.Event("contextmenu",{data:f.data,pageX:f.pageX,pageY:f.pageY}))},e.data.delay))},mousemove:function(t){f.pageX=t.pageX,f.pageY=t.pageY},mouseleave:function(e){var o=t(e.relatedTarget);if(!o.is(".context-menu-list")&&!o.closest(".context-menu-list").length){try{clearTimeout(f.timer)}catch(e){}f.timer=null}},layerClick:function(o){var n,i,s=t(this),r=s.data("contextMenuRoot"),a=o.button,c=o.pageX,u=o.pageY;o.preventDefault(),o.stopImmediatePropagation(),setTimeout(function(){var s,h="left"==r.trigger&&0===a||"right"==r.trigger&&2===a;if(document.elementFromPoint&&(r.$layer.hide(),n=document.elementFromPoint(c-l.scrollLeft(),u-l.scrollTop()),r.$layer.show()),r.reposition&&h)if(document.elementFromPoint){if(r.$trigger.is(n)||r.$trigger.has(n).length)return r.position.call(r.$trigger,r,c,u),e}else if(i=r.$trigger.offset(),s=t(window),i.top+=s.scrollTop(),i.top<=o.pageY&&(i.left+=s.scrollLeft(),i.left<=o.pageX&&(i.bottom=i.top+r.$trigger.outerHeight(),i.bottom>=o.pageY&&(i.right=i.left+r.$trigger.outerWidth(),i.right>=o.pageX))))return r.position.call(r.$trigger,r,c,u),e;n&&h&&r.$trigger.one("contextmenu:hidden",function(){t(n).contextMenu({x:c,y:u})}),r.$menu.trigger("contextmenu:hide")},50)},keyStop:function(t,e){e.isInput||t.preventDefault(),t.stopPropagation()},key:function(t){var o=r.data("contextMenu")||{};switch(t.keyCode){case 9:case 38:if(g.keyStop(t,o),o.isInput){if(9==t.keyCode&&t.shiftKey)return t.preventDefault(),o.$selected&&o.$selected.find("input, textarea, select").blur(),o.$menu.trigger("prevcommand"),e;if(38==t.keyCode&&"checkbox"==o.$selected.find("input, textarea, select").prop("type"))return t.preventDefault(),e}else if(9!=t.keyCode||t.shiftKey)return o.$menu.trigger("prevcommand"),e;case 40:if(g.keyStop(t,o),!o.isInput)return o.$menu.trigger("nextcommand"),e;if(9==t.keyCode)return t.preventDefault(),o.$selected&&o.$selected.find("input, textarea, select").blur(),o.$menu.trigger("nextcommand"),e;if(40==t.keyCode&&"checkbox"==o.$selected.find("input, textarea, select").prop("type"))return t.preventDefault(),e;break;case 37:if(g.keyStop(t,o),o.isInput||!o.$selected||!o.$selected.length)break;if(!o.$selected.parent().hasClass("context-menu-root")){var n=o.$selected.parent().parent();return o.$selected.trigger("contextmenu:blur"),o.$selected=n,e}break;case 39:if(g.keyStop(t,o),o.isInput||!o.$selected||!o.$selected.length)break;var i=o.$selected.data("contextMenu")||{};if(i.$menu&&o.$selected.hasClass("context-menu-submenu"))return o.$selected=null,i.$selected=null,i.$menu.trigger("nextcommand"),e;break;case 35:case 36:return o.$selected&&o.$selected.find("input, textarea, select").length?e:((o.$selected&&o.$selected.parent()||o.$menu).children(":not(.disabled, .not-selectable)")[36==t.keyCode?"first":"last"]().trigger("contextmenu:focus"),t.preventDefault(),e);case 13:if(g.keyStop(t,o),o.isInput){if(o.$selected&&!o.$selected.is("textarea, select"))return t.preventDefault(),e;break}return o.$selected&&o.$selected.trigger("mouseup"),e;case 32:case 33:case 34:return g.keyStop(t,o),e;case 27:return g.keyStop(t,o),o.$menu.trigger("contextmenu:hide"),e;default:var s=String.fromCharCode(t.keyCode).toUpperCase();if(o.accesskeys[s])return o.accesskeys[s].$node.trigger(o.accesskeys[s].$menu?"contextmenu:focus":"mouseup"),e}t.stopPropagation(),o.$selected&&o.$selected.trigger(t)},prevItem:function(e){e.stopPropagation();var o=t(this).data("contextMenu")||{};if(o.$selected){var n=o.$selected;o=o.$selected.parent().data("contextMenu")||{},o.$selected=n}for(var i=o.$menu.children(),s=o.$selected&&o.$selected.prev().length?o.$selected.prev():i.last(),r=s;s.hasClass("disabled")||s.hasClass("not-selectable");)if(s=s.prev().length?s.prev():i.last(),s.is(r))return;o.$selected&&g.itemMouseleave.call(o.$selected.get(0),e),g.itemMouseenter.call(s.get(0),e);var a=s.find("input, textarea, select");a.length&&a.focus()},nextItem:function(e){e.stopPropagation();var o=t(this).data("contextMenu")||{};if(o.$selected){var n=o.$selected;o=o.$selected.parent().data("contextMenu")||{},o.$selected=n}for(var i=o.$menu.children(),s=o.$selected&&o.$selected.next().length?o.$selected.next():i.first(),r=s;s.hasClass("disabled")||s.hasClass("not-selectable");)if(s=s.next().length?s.next():i.first(),s.is(r))return;o.$selected&&g.itemMouseleave.call(o.$selected.get(0),e),g.itemMouseenter.call(s.get(0),e);var a=s.find("input, textarea, select");a.length&&a.focus()},focusInput:function(){var e=t(this).closest(".context-menu-item"),o=e.data(),n=o.contextMenu,i=o.contextMenuRoot;i.$selected=n.$selected=e,i.isInput=n.isInput=!0},blurInput:function(){var e=t(this).closest(".context-menu-item"),o=e.data(),n=o.contextMenu,i=o.contextMenuRoot;i.isInput=n.isInput=!1},menuMouseenter:function(){var e=t(this).data().contextMenuRoot;e.hovering=!0},menuMouseleave:function(e){var o=t(this).data().contextMenuRoot;o.$layer&&o.$layer.is(e.relatedTarget)&&(o.hovering=!1)},itemMouseenter:function(o){var n=t(this),i=n.data(),s=i.contextMenu,r=i.contextMenuRoot;return r.hovering=!0,o&&r.$layer&&r.$layer.is(o.relatedTarget)&&(o.preventDefault(),o.stopImmediatePropagation()),(s.$menu?s:r).$menu.children(".hover").trigger("contextmenu:blur"),n.hasClass("disabled")||n.hasClass("not-selectable")?(s.$selected=null,e):(n.trigger("contextmenu:focus"),e)},itemMouseleave:function(o){var n=t(this),i=n.data(),s=i.contextMenu,r=i.contextMenuRoot;return r!==s&&r.$layer&&r.$layer.is(o.relatedTarget)?(r.$selected&&r.$selected.trigger("contextmenu:blur"),o.preventDefault(),o.stopImmediatePropagation(),r.$selected=s.$selected=s.$node,e):(n.trigger("contextmenu:blur"),e)},itemClick:function(e){var o,n=t(this),i=n.data(),s=i.contextMenu,r=i.contextMenuRoot,a=i.contextMenuKey;if(s.items[a]&&!n.is(".disabled, .context-menu-submenu, .context-menu-separator, .not-selectable")){if(e.preventDefault(),e.stopImmediatePropagation(),t.isFunction(r.callbacks[a])&&Object.prototype.hasOwnProperty.call(r.callbacks,a))o=r.callbacks[a];else{if(!t.isFunction(r.callback))return;o=r.callback}o.call(r.$trigger,a,r)!==!1?r.$menu.trigger("contextmenu:hide"):r.$menu.parent().length&&v.update.call(r.$trigger,r)}},inputClick:function(t){t.stopImmediatePropagation()},hideMenu:function(e,o){var n=t(this).data("contextMenuRoot");v.hide.call(n.$trigger,n,o&&o.force)},focusItem:function(e){e.stopPropagation();var o=t(this),n=o.data(),i=n.contextMenu,s=n.contextMenuRoot;o.addClass("hover").siblings(".hover").trigger("contextmenu:blur"),i.$selected=s.$selected=o,i.$node&&s.positionSubmenu.call(i.$node,i.$menu)},blurItem:function(e){e.stopPropagation();var o=t(this),n=o.data(),i=n.contextMenu;n.contextMenuRoot,o.removeClass("hover"),i.$selected=null}},v={show:function(o,n,i){var s=t(this),a={};return t("#context-menu-layer").trigger("mousedown"),o.$trigger=s,o.events.show.call(s,o)===!1?(r=null,e):(v.update.call(s,o),o.position.call(s,o,n,i),o.zIndex&&(a.zIndex=m(s)+o.zIndex),v.layer.call(o.$menu,o,a.zIndex),o.$menu.find("ul").css("zIndex",a.zIndex+1),o.$menu.css(a)[o.animation.show](o.animation.duration,function(){s.trigger("contextmenu:visible")}),s.data("contextMenu",o).addClass("context-menu-active"),t(document).off("keydown.contextMenu").on("keydown.contextMenu",g.key),o.autoHide&&t(document).on("mousemove.contextMenuAutoHide",function(t){var e=s.offset();e.right=e.left+s.outerWidth(),e.bottom=e.top+s.outerHeight(),!o.$layer||o.hovering||t.pageX>=e.left&&t.pageX<=e.right&&t.pageY>=e.top&&t.pageY<=e.bottom||o.$menu.trigger("contextmenu:hide")}),e)},hide:function(o,n){var i=t(this);if(o||(o=i.data("contextMenu")||{}),n||!o.events||o.events.hide.call(i,o)!==!1){if(i.removeData("contextMenu").removeClass("context-menu-active"),o.$layer){setTimeout(function(t){return function(){t.remove()}}(o.$layer),10);try{delete o.$layer}catch(s){o.$layer=null}}r=null,o.$menu.find(".hover").trigger("contextmenu:blur"),o.$selected=null,t(document).off(".contextMenuAutoHide").off("keydown.contextMenu"),o.$menu&&o.$menu[o.animation.hide](o.animation.duration,function(){o.build&&(o.$menu.remove(),t.each(o,function(t){switch(t){case"ns":case"selector":case"build":case"trigger":return!0;default:o[t]=e;try{delete o[t]}catch(n){}return!0}})),setTimeout(function(){i.trigger("contextmenu:hidden")},10)})}},create:function(n,i){i===e&&(i=n),n.$menu=t('
      ').addClass(n.className||"").data({contextMenu:n,contextMenuRoot:i}),t.each(["callbacks","commands","inputs"],function(t,e){n[e]={},i[e]||(i[e]={})}),i.accesskeys||(i.accesskeys={}),t.each(n.items,function(e,s){var r=t('
    • ').addClass(s.className||""),a=null,l=null;if(r.on("click",t.noop),s.$node=r.data({contextMenu:n,contextMenuRoot:i,contextMenuKey:e}),s.accesskey)for(var c,u=o(s.accesskey),h=0;c=u[h];h++)if(!i.accesskeys[c]){i.accesskeys[c]=s,s._name=s.name.replace(RegExp("("+c+")","i"),'$1');break}if("string"==typeof s)r.addClass("context-menu-separator not-selectable");else if(s.type&&d[s.type])d[s.type].call(r,s,n,i),t.each([n,i],function(o,n){n.commands[e]=s,t.isFunction(s.callback)&&(n.callbacks[e]=s.callback)});else{switch("html"==s.type?r.addClass("context-menu-html not-selectable"):s.type?(a=t("").appendTo(r),t("").html(s._name||s.name).appendTo(a),r.addClass("context-menu-input"),n.hasTypes=!0,t.each([n,i],function(t,o){o.commands[e]=s,o.inputs[e]=s})):s.items&&(s.type="sub"),s.type){case"text":l=t('').attr("name","context-menu-input-"+e).val(s.value||"").appendTo(a);break;case"textarea":l=t('').attr("name","context-menu-input-"+e).val(s.value||"").appendTo(a),s.height&&l.height(s.height);break;case"checkbox":l=t('').attr("name","context-menu-input-"+e).val(s.value||"").prop("checked",!!s.selected).prependTo(a);break;case"radio":l=t('').attr("name","context-menu-input-"+s.radio).val(s.value||"").prop("checked",!!s.selected).prependTo(a);break;case"select":l=t('').attr("name","context-menu-input-"+e).val(s.value||"").appendTo(a);break;case"textarea":l=t('').attr("name","context-menu-input-"+e).val(s.value||"").appendTo(a),s.height&&l.height(s.height);break;case"checkbox":l=t('').attr("name","context-menu-input-"+e).val(s.value||"").prop("checked",!!s.selected).prependTo(a);break;case"radio":l=t('').attr("name","context-menu-input-"+s.radio).val(s.value||"").prop("checked",!!s.selected).prependTo(a);break;case"select":l=t('