| 12345678910 |
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("FredCollections",[],t):"object"==typeof exports?exports.FredCollections=t():e.FredCollections=t()}(this,function(){return function(e){function t(i){if(o[i])return o[i].exports;var n=o[i]={exports:{},id:i,loaded:!1};return e[i].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var o={};return t.m=e,t.c=o,t.p="",t(0)}([function(e,t,o){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=o(1),s=i(n);t.default={SidebarPlugin:s.default},e.exports=t.default},function(e,t,o){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function n(e){if(Array.isArray(e)){for(var t=0,o=Array(e.length);t<e.length;t++)o[t]=e[t];return o}return Array.from(e)}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var o=0;o<t.length;o++){var i=t[o];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,o,i){return o&&e(t.prototype,o),i&&e(t,i),t}}(),u=o(2),c=i(u),d=o(3),h=i(d),p=o(4);t.default=function(e){return function(t,o,i){var u,d,m=i.ui.els,f=m.dl,g=m.dt,b=m.div,v=m.button,y=m.form,w=m.fieldSet,E=i.ui.ins,C=E.text,x=E.select,R=E.choices,M=i.actions.pages,D=M.publishResource,L=M.unpublishResource,T=M.deleteResource,k=M.undeleteResource,S=M.createResource,z=M.getTemplates,F=i.actions.blueprints.getBlueprints,P=i.emitter,H=i.fetch;return d=u=function(t){function o(){return s(this,o),r(this,(o.__proto__||Object.getPrototypeOf(o)).apply(this,arguments))}return a(o,t),l(o,[{key:"init",value:function(){this.actions=new c.default(e,H,P)}},{key:"click",value:function(){var e=this;return this.actions.getCollections().then(function(t){return e.render(t)})}},{key:"render",value:function(e){var t=this,o=f();return e.forEach(function(e){var s=g(e.pagetitle,[],function(){i.emitter.emit("fred-loading",i.fredConfig.lng("collections.fred.loading_collection")),Promise.all([t.actions.getCollectionView(e.id),t.actions.getAuthors(e.id)]).then(function(o){t.renderModal.apply(t,[e].concat(n(o))),i.emitter.emit("fred-loading-hide")})});o.appendChild(s)}),o}},{key:"renderModal",value:function(t,o,n){var s=this,r=b(["fred--collections-filters"]),a=b(),l=(b(),[]);if(~["pagetitle","publishedon","published","pub_date","unpub_date","menuindex"].indexOf(o.sort)){var u=o.sort;~["publishedon","published","pub_date"].indexOf(u)&&(u="publishedon_combined"),l.push({column:u,dir:o.sortDir})}else l.push({column:"publishedon_combined",dir:"desc"});var c=new h.default(a,{ajaxURL:e.endpoint,ajaxParams:{action:"get-collection",collection:t.id},ajaxConfig:{credentials:"same-origin",headers:{"X-Fred-Token":i.fredConfig.jwt}},ajaxSorting:!0,columnHeaderSortMulti:!1,pagination:"remote",paginationSize:5,ajaxFiltering:!0,responsiveLayout:"hide",layout:"fitColumns",initialSort:l,columns:[{title:i.fredConfig.lng("collections.fred.pagetitle"),field:"pagetitle",responsive:0,formatter:function(e,t,o){var i=e.getRow().getData();return e.getValue()+('<br><a href="'+i.fullUrl+'">'+i.url+"</a>")}},{title:i.fredConfig.lng("collections.fred.publish"),field:"publishedon_combined",width:120,responsive:2,widthShrink:1},{title:i.fredConfig.lng("collections.fred.expires"),field:"unpub_date",width:120,responsive:4,widthShrink:1},{title:i.fredConfig.lng("collections.fred.author"),field:"fullname",headerSort:!1,width:180,responsive:3,widthShrink:1},{title:i.fredConfig.lng("collections.fred.menuindex"),field:"menuindex",width:180,responsive:3,widthShrink:1,visible:!1},{title:i.fredConfig.lng("collections.fred.actions"),headerSort:!1,formatter:function(e,t,o){var n=e.getRow().getData(),s=n.deleted?"":'<a href="'+n.fullUrl+'" class="fred--btn fred--btn-collections-icon fred--btn-collections-edit" title="'+i.fredConfig.lng("collections.fred.edit")+'"></a>',r=n.published?i.fredConfig.permission.unpublish_document?'<button data-action=\'unpublish\' class="fred--btn fred--btn-collections-icon fred--btn-collections-unpublish" title="'+i.fredConfig.lng("collections.fred.unpublish")+'"></button>':"":i.fredConfig.permission.publish_document?'<button data-action=\'publish\' class="fred--btn fred--btn-collections-icon fred--btn-collections-publish" title="'+i.fredConfig.lng("collections.fred.publish")+'"></button>':"",a=n.deleted?i.fredConfig.permission.undelete_document?'<button data-action=\'undelete\' class="fred--btn fred--btn-collections-icon fred--btn-collections-undelete" title="'+i.fredConfig.lng("collections.fred.undelete")+'"></button>':"":i.fredConfig.permission.delete_document?'<button data-action=\'delete\' class="fred--btn fred--btn-collections-icon fred--btn-collections-delete" title="'+i.fredConfig.lng("collections.fred.delete")+'"></button>':"";return s+" "+r+" "+a},align:"left",cellClick:function(e,t){if(e.target.dataset.action)switch(e.target.dataset.action){case"publish":D(t.getRow().getData().id).then(function(){c.setPage(c.getPage())});break;case"unpublish":L(t.getRow().getData().id).then(function(){c.setPage(c.getPage())});break;case"delete":T(t.getRow().getData().id).then(function(){c.setPage(c.getPage())});break;case"undelete":k(t.getRow().getData().id).then(function(){c.setPage(c.getPage())})}},width:120}]}),d={query:"",published:"-1",createdby:"-1"},m=function(e,t){d[e]=t;var o=[];for(var i in d)d.hasOwnProperty(i)&&o.push({field:i,type:"=",value:d[i]});c.setFilter(o)},f=(0,p.debounce)(200,m),g=C({name:"query",label:"collections.fred.search"},"",f),y=b(),w=x({name:"published",label:"collections.fred.published",options:{"-1":i.fredConfig.lng("collections.fred.any"),1:i.fredConfig.lng("collections.fred.published"),0:i.fredConfig.lng("collections.fred.unpublished")}},"-1",f),E=b(),R=x({name:"createdby",label:"collections.fred.author",options:n},"-1",f),M=b();if(r.appendChild(g),r.appendChild(w),r.appendChild(R),i.fredConfig.permission.new_document){var S=v("collections.fred.new_page","collections.fred.new_page",["fred--btn","fred--btn-small","fred--btn-collections-newpage","fred--btn-apply","fred--btn-wrapper"],function(){var e=s.showNewPageForm(t,o,function(){r.replaceChild(S,e),r.replaceChild(g,y),r.replaceChild(w,E),r.replaceChild(R,M)});r.replaceChild(e,S),r.replaceChild(y,g),r.replaceChild(E,w),r.replaceChild(M,R)});r.appendChild(S)}var z=b();z.appendChild(r),z.appendChild(a);var F=new i.Modal(t.pagetitle,z,null,{showCancelButton:!1,showSaveButton:!1,width:"1000px"});F.render()}},{key:"showNewPageForm",value:function(e,t,o){var n=b(),s=y(["fred--collections-createpage"]),r=w(),a={pagetitle:"",parent:e.id,blueprint:0,template:t.template,theme:i.fredConfig.config.theme},l=function(e,t){a[e]=t},u=function(e,o){"template"===e&&o.customProperties&&o.customProperties.theme&&(a.theme=o.customProperties.theme,c.choices.clearStore(),c.choices.ajax(function(e){F(!0,a.theme).then(function(i){var n=[],s=t.blueprint||o.customProperties.default_blueprint;i.forEach(function(e){var t=[];e.blueprints.forEach(function(e){var o={label:e.name,value:""+e.id};s&&e.id===s&&(o.selected=!0,a.blueprint=e.id),t.push(o)}),n.push({label:e.category,disabled:!1,choices:t})}),e(n,"value","label")}).catch(function(e){P.emit("fred-loading",e.message)})})),a[e]=o.value},c=R({name:"blueprint",label:i.fredConfig.lng("fred.fe.pages.blueprint"),choices:{removeItemButton:!0}},a.blueprint,u,function(e,t,o,i){i.passedElement.addEventListener("removeItem",function(e){var t=i.getValue(!1);void 0===t&&(a.blueprint="0")})}),d=C({name:"pagetitle",label:"fred.fe.pages.page_title"},a.pagetitle,l);r.appendChild(d);var h=R({name:"template",label:i.fredConfig.lng("fred.fe.pages.template")},a.template,u,function(e,t,o,i,n){i.ajax(function(e){z().then(function(t){var o=!1,i=null,n=!0,s=!1,r=void 0;try{for(var l,c=t.data.templates[Symbol.iterator]();!(n=(l=c.next()).done);n=!0){var d=l.value;if(parseInt(d.id)===parseInt(a.template)){d.selected=!0,i=d,o=!0;break}}}catch(e){s=!0,r=e}finally{try{!n&&c.return&&c.return()}finally{if(s)throw r}}!o&&t.data.templates[0]&&(i=t.data.templates[0],t.data.templates[0].selected=!0),u("template",i),e(t.data.templates,"value","name")}).catch(function(e){P.emit("fred-loading",e.message)})})});r.appendChild(h),r.appendChild(c);var p=v("fred.fe.pages.create_page","fred.fe.pages.create_page",["fred--btn","fred--btn-small","fred--btn-collections-newpage","fred--btn-apply"],function(){return i.fredConfig.permission.new_document?0!==!a.parent||i.fredConfig.permission.new_document_in_root?(P.emit("fred-loading",i.fredConfig.lng("fred.fe.pages.creating_page")),void S(a.parent,a.template,a.pagetitle,a.blueprint).then(function(e){location.href=e.url,P.emit("fred-loading-hide")}).catch(function(e){return e.response._fields.pagetitle&&d.onError(e.response._fields.pagetitle),P.emit("fred-loading-hide"),!1})):void alert(i.fredConfig.lng("fred.fe.permission.new_document_in_root")):void alert(i.fredConfig.lng("fred.fe.permission.new_document"))}),m=v("collections.fred.cancel","collections.fred.cancel",["fred--btn","fred--btn-small","fred--btn-collections-newpage","fred--btn-hollow"],function(){o()}),f=b("fred--btn-wrapper");return f.appendChild(p),f.appendChild(m),r.appendChild(f),s.appendChild(r),n.appendChild(s),n}}]),o}(o),u.title="collections.fred.collections",u.icon="fred--collections-sidebar",u.expandable=!0,d}},e.exports=t.default},function(e,t){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var o=0;o<t.length;o++){var i=t[o];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,o,i){return o&&e(t.prototype,o),i&&e(t,i),t}}(),n=function(){function e(t,i,n){o(this,e),this.config=t,this.fetch=i,this.emitter=n}return i(e,[{key:"getCollections",value:function(){return this.fetch(this.config.endpoint+"?action=get-collections").then(function(e){return e.json()}).then(function(e){return e.data.collections})}},{key:"getAuthors",value:function(e){return this.fetch(this.config.endpoint+"?action=get-authors&collection="+e).then(function(e){return e.json()}).then(function(e){return e.data})}},{key:"getCollectionView",value:function(e){return this.fetch(this.config.endpoint+"?action=get-collection-view&collection="+e).then(function(e){return e.json()}).then(function(e){return e.data})}}]),e}();t.default=n,e.exports=t.default},function(t,o,i){var n,s,r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(e,a){"object"===r(o)&&"undefined"!=typeof t?t.exports=a():(n=a,s="function"==typeof n?n.call(o,i,o,t):n,!(void 0!==s&&(t.exports=s)))}(this,function(){"use strict";Array.prototype.findIndex||Object.defineProperty(Array.prototype,"findIndex",{value:function(e){if(null==this)throw new TypeError('"this" is null or not defined');var t=Object(this),o=t.length>>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var i=arguments[1],n=0;n<o;){var s=t[n];if(e.call(i,s,n,t))return n;n++}return-1}}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(e){if(null==this)throw new TypeError('"this" is null or not defined');var t=Object(this),o=t.length>>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var i=arguments[1],n=0;n<o;){var s=t[n];if(e.call(i,s,n,t))return s;n++}}});var t=function(e){this.table=e,this.blockHozScrollEvent=!1,this.headersElement=this.createHeadersElement(),this.element=this.createHeaderElement(),this.rowManager=null,this.columns=[],this.columnsByIndex=[],this.columnsByField={},this.scrollLeft=0,this.scrollCount=0,this.element.insertBefore(this.headersElement,this.element.firstChild)};t.prototype.createHeadersElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-headers"),e},t.prototype.createHeaderElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-header"),e},t.prototype.initialize=function(){},t.prototype.setRowManager=function(e){this.rowManager=e},t.prototype.getElement=function(){return this.element},t.prototype.getHeadersElement=function(){return this.headersElement},t.prototype.scrollHorizontal=function(e){var t=0,o=this.element.scrollWidth-this.table.element.clientWidth;this.element.scrollLeft=e,e>o?(t=e-o,this.element.style.marginLeft=-t+"px"):this.element.style.marginLeft=0,this.scrollLeft=e,this.table.modExists("frozenColumns")&&this.table.modules.frozenColumns.scrollHorizontal()},t.prototype.generateColumnsFromRowData=function(e){var t,o,i=[];if(e&&e.length){t=e[0];for(var n in t){var s={field:n,title:n},a=t[n];switch("undefined"==typeof a?"undefined":r(a)){case"undefined":o="string";break;case"boolean":o="boolean";break;case"object":o=Array.isArray(a)?"array":"string";break;default:o=isNaN(a)||""===a?a.match(/((^[0-9]+[a-z]+)|(^[a-z]+[0-9]+))+$/i)?"alphanum":"string":"number"}s.sorter=o,i.push(s)}this.table.options.columns=i,this.setColumns(this.table.options.columns)}},t.prototype.setColumns=function(e,t){for(var o=this;o.headersElement.firstChild;)o.headersElement.removeChild(o.headersElement.firstChild);o.columns=[],o.columnsByIndex=[],o.columnsByField={},o.table.modExists("frozenColumns")&&o.table.modules.frozenColumns.reset(),e.forEach(function(e,t){o._addColumn(e)}),o._reIndexColumns(),o.table.options.responsiveLayout&&o.table.modExists("responsiveLayout",!0)&&o.table.modules.responsiveLayout.initialize(),o.redraw(!0)},t.prototype._addColumn=function(e,t,o){var n=new i(e,this),s=n.getElement(),r=o?this.findColumnIndex(o):o;if(o&&r>-1){var a=this.columns.indexOf(o.getTopColumn()),l=o.getElement();t?(this.columns.splice(a,0,n),l.parentNode.insertBefore(s,l)):(this.columns.splice(a+1,0,n),l.parentNode.insertBefore(s,l.nextSibling))}else t?(this.columns.unshift(n),this.headersElement.insertBefore(n.getElement(),this.headersElement.firstChild)):(this.columns.push(n),this.headersElement.appendChild(n.getElement()));return n},t.prototype.registerColumnField=function(e){e.definition.field&&(this.columnsByField[e.definition.field]=e)},t.prototype.registerColumnPosition=function(e){this.columnsByIndex.push(e)},t.prototype._reIndexColumns=function(){this.columnsByIndex=[],this.columns.forEach(function(e){e.reRegisterPosition()})},t.prototype._verticalAlignHeaders=function(){var e=this,t=0;e.columns.forEach(function(e){var o;e.clearVerticalAlign(),o=e.getHeight(),o>t&&(t=o)}),e.columns.forEach(function(o){o.verticalAlign(e.table.options.columnVertAlign,t)}),e.rowManager.adjustTableSize()},t.prototype.findColumn=function(e){var t=this;if("object"!=("undefined"==typeof e?"undefined":r(e)))return this.columnsByField[e]||!1;if(e instanceof i)return e;if(e instanceof o)return e._getSelf()||!1;if("undefined"!=typeof HTMLElement&&e instanceof HTMLElement){var n=t.columns.find(function(t){return t.element===e});return n||!1}return!1},t.prototype.getColumnByField=function(e){return this.columnsByField[e]},t.prototype.getColumnByIndex=function(e){return this.columnsByIndex[e]},t.prototype.getFirstVisibileColumn=function(e){var e=this.columnsByIndex.findIndex(function(e){return e.visible});return e>-1&&this.columnsByIndex[e]},t.prototype.getColumns=function(){return this.columns},t.prototype.findColumnIndex=function(e){return this.columnsByIndex.findIndex(function(t){return e===t})},t.prototype.getRealColumns=function(){return this.columnsByIndex},t.prototype.traverse=function(e){var t=this;t.columnsByIndex.forEach(function(t,o){e(t,o)})},t.prototype.getDefinitions=function(e){var t=this,o=[];return t.columnsByIndex.forEach(function(t){(!e||e&&t.visible)&&o.push(t.getDefinition())}),o},t.prototype.getDefinitionTree=function(){var e=this,t=[];return e.columns.forEach(function(e){t.push(e.getDefinition(!0))}),t},t.prototype.getComponents=function(e){var t=this,o=[],i=e?t.columns:t.columnsByIndex;return i.forEach(function(e){o.push(e.getComponent())}),o},t.prototype.getWidth=function(){var e=0;return this.columnsByIndex.forEach(function(t){t.visible&&(e+=t.getWidth())}),e},t.prototype.moveColumn=function(e,t,o){this._moveColumnInArray(this.columns,e,t,o),this._moveColumnInArray(this.columnsByIndex,e,t,o,!0),this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.initialize(),this.table.options.columnMoved&&this.table.options.columnMoved.call(this.table,e.getComponent(),this.table.columnManager.getComponents()),this.table.options.persistentLayout&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.save("columns")},t.prototype._moveColumnInArray=function(e,t,o,i,n){var s,r=e.indexOf(t);r>-1&&(e.splice(r,1),s=e.indexOf(o),s>-1?i&&(s+=1):s=r,e.splice(s,0,t),n&&this.table.rowManager.rows.forEach(function(e){if(e.cells.length){var t=e.cells.splice(r,1)[0];e.cells.splice(s,0,t)}}))},t.prototype.scrollToColumn=function(e,t,o){var i=this,n=0,s=0,r=0,a=e.getElement();return new Promise(function(l,u){if("undefined"==typeof t&&(t=i.table.options.scrollToColumnPosition),"undefined"==typeof o&&(o=i.table.options.scrollToColumnIfVisible),e.visible){switch(t){case"middle":case"center":r=-i.element.clientWidth/2;break;case"right":r=a.clientWidth-i.headersElement.clientWidth}if(!o&&(s=a.offsetLeft,s>0&&s+a.offsetWidth<i.element.clientWidth))return!1;n=a.offsetLeft+i.element.scrollLeft+r,n=Math.max(Math.min(n,i.table.rowManager.element.scrollWidth-i.table.rowManager.element.clientWidth),0),i.table.rowManager.scrollHorizontal(n),i.scrollHorizontal(n),l()}else console.warn("Scroll Error - Column not visible"),u("Scroll Error - Column not visible")})},t.prototype.generateCells=function(e){var t=this,o=[];return t.columnsByIndex.forEach(function(t){o.push(t.generateCell(e))}),o},t.prototype.getFlexBaseWidth=function(){var e=this,t=e.table.element.clientWidth,o=0;return e.rowManager.element.scrollHeight>e.rowManager.element.clientHeight&&(t-=e.rowManager.element.offsetWidth-e.rowManager.element.clientWidth),this.columnsByIndex.forEach(function(i){var n,s,r;i.visible&&(n=i.definition.width||0,s="undefined"==typeof i.minWidth?e.table.options.columnMinWidth:parseInt(i.minWidth),r="string"==typeof n?n.indexOf("%")>-1?t/100*parseInt(n):parseInt(n):n,o+=r>s?r:s)}),o},t.prototype.addColumn=function(e,t,o){var i=this._addColumn(e,t,o);this._reIndexColumns(),this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.initialize(),this.table.modExists("columnCalcs")&&this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows),this.redraw(),"fitColumns"!=this.table.modules.layout.getMode()&&i.reinitializeWidth(),this._verticalAlignHeaders(),this.table.rowManager.reinitialize()},t.prototype.deregisterColumn=function(e){var t,o=e.getField();o&&delete this.columnsByField[o],t=this.columnsByIndex.indexOf(e),t>-1&&this.columnsByIndex.splice(t,1),t=this.columns.indexOf(e),t>-1&&this.columns.splice(t,1),this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.initialize(),this.redraw()},t.prototype.redraw=function(e){e&&(d.prototype.helpers.elVisible(this.element)&&this._verticalAlignHeaders(),this.table.rowManager.resetScroll(),this.table.rowManager.reinitialize()),"fitColumns"==this.table.modules.layout.getMode()?this.table.modules.layout.layout():e?this.table.modules.layout.layout():this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.update(),this.table.modExists("frozenColumns")&&this.table.modules.frozenColumns.layout(),this.table.modExists("columnCalcs")&&this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows),e&&(this.table.options.persistentLayout&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.save("columns"),this.table.modExists("columnCalcs")&&this.table.modules.columnCalcs.redraw()),this.table.footerManager.redraw()};var o=function(e){this._column=e,this.type="ColumnComponent"};o.prototype.getElement=function(){return this._column.getElement()},o.prototype.getDefinition=function(){return this._column.getDefinition()},o.prototype.getField=function(){return this._column.getField()},o.prototype.getCells=function(){var e=[];return this._column.cells.forEach(function(t){e.push(t.getComponent())}),e},o.prototype.getVisibility=function(){return this._column.visible},o.prototype.show=function(){this._column.isGroup?this._column.columns.forEach(function(e){e.show()}):this._column.show()},o.prototype.hide=function(){this._column.isGroup?this._column.columns.forEach(function(e){e.hide()}):this._column.hide()},o.prototype.toggle=function(){this._column.visible?this.hide():this.show()},o.prototype.delete=function(){this._column.delete()},o.prototype.getSubColumns=function(){var e=[];return this._column.columns.length&&this._column.columns.forEach(function(t){e.push(t.getComponent())}),e},o.prototype.getParentColumn=function(){return this._column.parent instanceof i&&this._column.parent.getComponent()},o.prototype._getSelf=function(){return this._column},o.prototype.scrollTo=function(){return this._column.table.columnManager.scrollToColumn(this._column)},o.prototype.getTable=function(){return this._column.table},o.prototype.headerFilterFocus=function(){this._column.table.modExists("filter",!0)&&this._column.table.modules.filter.setHeaderFilterFocus(this._column)},o.prototype.reloadHeaderFilter=function(){this._column.table.modExists("filter",!0)&&this._column.table.modules.filter.reloadHeaderFilter(this._column)},o.prototype.setHeaderFilterValue=function(e){this._column.table.modExists("filter",!0)&&this._column.table.modules.filter.setHeaderFilterValue(this._column,e)},o.prototype.getNextColumn=function(){return this._column.nextColumn().getComponent()},o.prototype.getPrevColumn=function(){return this._column.prevColumn().getComponent()};var i=function e(t,o){var i=this;this.table=o.table,this.definition=t,this.parent=o,this.type="column",this.columns=[],this.cells=[],this.element=this.createElement(),this.contentElement=!1,this.groupElement=this.createGroupElement(),this.isGroup=!1,this.tooltip=!1,this.hozAlign="",this.field="",this.fieldStructure="",this.getFieldValue="",this.setFieldValue="",this.setField(this.definition.field),this.modules={},this.cellEvents={cellClick:!1,cellDblClick:!1,cellContext:!1,cellTap:!1,cellDblTap:!1,cellTapHold:!1,cellMouseEnter:!1,cellMouseLeave:!1,cellMouseOver:!1,cellMouseOut:!1,cellMouseMove:!1},this.width=null,this.widthStyled="",this.minWidth=null,this.minWidthStyled="",this.widthFixed=!1,this.visible=!0,t.columns?(this.isGroup=!0,t.columns.forEach(function(t,o){var n=new e(t,i);i.attachColumn(n)}),i.checkColumnVisibility()):o.registerColumnField(this),t.rowHandle&&this.table.options.movableRows!==!1&&this.table.modExists("moveRow")&&this.table.modules.moveRow.setHandle(!0),this._buildHeader()};i.prototype.createElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-col"),e.setAttribute("role","columnheader"),e.setAttribute("aria-sort","none"),e},i.prototype.createGroupElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-col-group-cols"),e},i.prototype.setField=function(e){this.field=e,this.fieldStructure=e?this.table.options.nestedFieldSeparator?e.split(this.table.options.nestedFieldSeparator):[e]:[],this.getFieldValue=this.fieldStructure.length>1?this._getNestedData:this._getFlatData,this.setFieldValue=this.fieldStructure.length>1?this._setNesteData:this._setFlatData},i.prototype.registerColumnPosition=function(e){this.parent.registerColumnPosition(e)},i.prototype.registerColumnField=function(e){this.parent.registerColumnField(e)},i.prototype.reRegisterPosition=function(){this.isGroup?this.columns.forEach(function(e){e.reRegisterPosition()}):this.registerColumnPosition(this)},i.prototype.setTooltip=function(){var e=this,t=e.definition,o=t.headerTooltip||t.tooltip===!1?t.headerTooltip:e.table.options.tooltipsHeader;o?o===!0?t.field?e.table.modules.localize.bind("columns|"+t.field,function(o){e.element.setAttribute("title",o||t.title)}):e.element.setAttribute("title",t.title):("function"==typeof o&&(o=o(e.getComponent()),o===!1&&(o="")),e.element.setAttribute("title",o)):e.element.setAttribute("title","")},i.prototype._buildHeader=function(){for(var e=this,t=e.definition;e.element.firstChild;)e.element.removeChild(e.element.firstChild);t.headerVertical&&(e.element.classList.add("tabulator-col-vertical"),"flip"===t.headerVertical&&e.element.classList.add("tabulator-col-vertical-flip")),e.contentElement=e._bindEvents(),e.contentElement=e._buildColumnHeaderContent(),e.element.appendChild(e.contentElement),e.isGroup?e._buildGroupHeader():e._buildColumnHeader(),e.setTooltip(),e.table.options.resizableColumns&&e.table.modExists("resizeColumns")&&e.table.modules.resizeColumns.initializeColumn("header",e,e.element),t.headerFilter&&e.table.modExists("filter")&&e.table.modExists("edit")&&("undefined"!=typeof t.headerFilterPlaceholder&&t.field&&e.table.modules.localize.setHeaderFilterColumnPlaceholder(t.field,t.headerFilterPlaceholder),e.table.modules.filter.initializeColumn(e)),e.table.modExists("frozenColumns")&&e.table.modules.frozenColumns.initializeColumn(e),e.table.options.movableColumns&&!e.isGroup&&e.table.modExists("moveColumn")&&e.table.modules.moveColumn.initializeColumn(e),(t.topCalc||t.bottomCalc)&&e.table.modExists("columnCalcs")&&e.table.modules.columnCalcs.initializeColumn(e),e.element.addEventListener("mouseenter",function(t){e.setTooltip()})},i.prototype._bindEvents=function(){var e,t,o,i=this,n=i.definition;"function"==typeof n.headerClick&&i.element.addEventListener("click",function(e){n.headerClick(e,i.getComponent())}),"function"==typeof n.headerDblClick&&i.element.addEventListener("dblclick",function(e){n.headerDblClick(e,i.getComponent())}),"function"==typeof n.headerContext&&i.element.addEventListener("contextmenu",function(e){n.headerContext(e,i.getComponent())}),"function"==typeof n.headerTap&&(o=!1,i.element.addEventListener("touchstart",function(e){o=!0}),i.element.addEventListener("touchend",function(e){o&&n.headerTap(e,i.getComponent()),o=!1})),"function"==typeof n.headerDblTap&&(e=null,i.element.addEventListener("touchend",function(t){e?(clearTimeout(e),e=null,n.headerDblTap(t,i.getComponent())):e=setTimeout(function(){clearTimeout(e),e=null},300)})),"function"==typeof n.headerTapHold&&(t=null,i.element.addEventListener("touchstart",function(e){clearTimeout(t),t=setTimeout(function(){clearTimeout(t),t=null,o=!1,n.headerTapHold(e,i.getComponent())},1e3)}),i.element.addEventListener("touchend",function(e){clearTimeout(t),t=null})),"function"==typeof n.cellClick&&(i.cellEvents.cellClick=n.cellClick),"function"==typeof n.cellDblClick&&(i.cellEvents.cellDblClick=n.cellDblClick),"function"==typeof n.cellContext&&(i.cellEvents.cellContext=n.cellContext),"function"==typeof n.cellMouseEnter&&(i.cellEvents.cellMouseEnter=n.cellMouseEnter),"function"==typeof n.cellMouseLeave&&(i.cellEvents.cellMouseLeave=n.cellMouseLeave),"function"==typeof n.cellMouseOver&&(i.cellEvents.cellMouseOver=n.cellMouseOver),"function"==typeof n.cellMouseOut&&(i.cellEvents.cellMouseOut=n.cellMouseOut),"function"==typeof n.cellMouseMove&&(i.cellEvents.cellMouseMove=n.cellMouseMove),"function"==typeof n.cellTap&&(i.cellEvents.cellTap=n.cellTap),"function"==typeof n.cellDblTap&&(i.cellEvents.cellDblTap=n.cellDblTap),"function"==typeof n.cellTapHold&&(i.cellEvents.cellTapHold=n.cellTapHold),"function"==typeof n.cellEdited&&(i.cellEvents.cellEdited=n.cellEdited),"function"==typeof n.cellEditing&&(i.cellEvents.cellEditing=n.cellEditing),"function"==typeof n.cellEditCancelled&&(i.cellEvents.cellEditCancelled=n.cellEditCancelled)},i.prototype._buildColumnHeader=function(){var e=this,t=e.definition,o=e.table;if(o.modExists("sort")&&o.modules.sort.initializeColumn(e,e.contentElement),o.modExists("format")&&o.modules.format.initializeColumn(e),"undefined"!=typeof t.editor&&o.modExists("edit")&&o.modules.edit.initializeColumn(e),"undefined"!=typeof t.validator&&o.modExists("validate")&&o.modules.validate.initializeColumn(e),o.modExists("mutator")&&o.modules.mutator.initializeColumn(e),o.modExists("accessor")&&o.modules.accessor.initializeColumn(e),r(o.options.responsiveLayout)&&o.modExists("responsiveLayout")&&o.modules.responsiveLayout.initializeColumn(e),"undefined"!=typeof t.visible&&(t.visible?e.show(!0):e.hide(!0)),t.cssClass){var i=t.cssClass.split(" ");i.forEach(function(t){e.element.classList.add(t)})}t.field&&this.element.setAttribute("tabulator-field",t.field),e.setMinWidth("undefined"==typeof t.minWidth?e.table.options.columnMinWidth:parseInt(t.minWidth)),e.reinitializeWidth(),e.tooltip=e.definition.tooltip||e.definition.tooltip===!1?e.definition.tooltip:e.table.options.tooltips,e.hozAlign="undefined"==typeof e.definition.align?"":e.definition.align},i.prototype._buildColumnHeaderContent=function(){var e=this,t=(e.definition,e.table,document.createElement("div"));return t.classList.add("tabulator-col-content"),t.appendChild(e._buildColumnHeaderTitle()),t},i.prototype._buildColumnHeaderTitle=function(){var e=this,t=e.definition,o=e.table,i=document.createElement("div");if(i.classList.add("tabulator-col-title"),t.editableTitle){var n=document.createElement("input");n.classList.add("tabulator-title-editor"),n.addEventListener("click",function(e){e.stopPropagation(),n.focus()}),n.addEventListener("change",function(){t.title=n.value,o.options.columnTitleChanged.call(e.table,e.getComponent())}),i.appendChild(n),t.field?o.modules.localize.bind("columns|"+t.field,function(e){n.value=e||t.title||" "}):n.value=t.title||" "}else t.field?o.modules.localize.bind("columns|"+t.field,function(o){e._formatColumnHeaderTitle(i,o||t.title||" ")}):e._formatColumnHeaderTitle(i,t.title||" ");return i},i.prototype._formatColumnHeaderTitle=function(e,t){var o,i,n,s;if(this.definition.titleFormatter&&this.table.modExists("format"))switch(o=this.table.modules.format.getFormatter(this.definition.titleFormatter),s={getValue:function(){return t},getElement:function(){return e}},n=this.definition.titleFormatterParams||{},n="function"==typeof n?n():n,i=o.call(this.table.modules.format,s,n),"undefined"==typeof i?"undefined":r(i)){case"object":i instanceof Node?this.element.appendChild(i):(this.element.innerHTML="",console.warn("Format Error - Title formatter has returned a type of object, the only valid formatter object return is an instance of Node, the formatter returned:",i));break;case"undefined":case"null":this.element.innerHTML="";break;default:this.element.innerHTML=i}else e.innerHTML=t},i.prototype._buildGroupHeader=function(){this.element.classList.add("tabulator-col-group"),this.element.setAttribute("role","columngroup"),this.element.setAttribute("aria-title",this.definition.title),this.element.appendChild(this.groupElement)},i.prototype._getFlatData=function(e){return e[this.field]},i.prototype._getNestedData=function(e){for(var t,o=e,i=this.fieldStructure,n=i.length,s=0;s<n&&(o=o[i[s]],t=o,o);s++);return t},i.prototype._setFlatData=function(e,t){
- this.field&&(e[this.field]=t)},i.prototype._setNesteData=function(e,t){for(var o=e,i=this.fieldStructure,n=i.length,s=0;s<n;s++)s==n-1?o[i[s]]=t:(o[i[s]]||(o[i[s]]={}),o=o[i[s]])},i.prototype.attachColumn=function(e){var t=this;t.groupElement?(t.columns.push(e),t.groupElement.appendChild(e.getElement())):console.warn("Column Warning - Column being attached to another column instead of column group")},i.prototype.verticalAlign=function(e,t){var o=this.parent.isGroup?this.parent.getGroupElement().clientHeight:t||this.parent.getHeadersElement().clientHeight;this.element.style.height=o+"px",this.isGroup&&(this.groupElement.style.minHeight=o-this.contentElement.offsetHeight+"px"),this.isGroup||"top"===e||("bottom"===e?this.element.style.paddingTop=this.element.clientHeight-this.contentElement.offsetHeight+"px":this.element.style.paddingTop=(this.element.clientHeight-this.contentElement.offsetHeight)/2+"px"),this.columns.forEach(function(t){t.verticalAlign(e)})},i.prototype.clearVerticalAlign=function(){this.element.style.paddingTop="",this.element.style.height="",this.element.style.minHeight="",this.groupElement.style.minHeight="",this.columns.forEach(function(e){e.clearVerticalAlign()})},i.prototype.getElement=function(){return this.element},i.prototype.getGroupElement=function(){return this.groupElement},i.prototype.getField=function(){return this.field},i.prototype.getFirstColumn=function(){return this.isGroup?!!this.columns.length&&this.columns[0].getFirstColumn():this},i.prototype.getLastColumn=function(){return this.isGroup?!!this.columns.length&&this.columns[this.columns.length-1].getLastColumn():this},i.prototype.getColumns=function(){return this.columns},i.prototype.getCells=function(){return this.cells},i.prototype.getTopColumn=function(){return this.parent.isGroup?this.parent.getTopColumn():this},i.prototype.getDefinition=function(e){var t=[];return this.isGroup&&e&&(this.columns.forEach(function(e){t.push(e.getDefinition(!0))}),this.definition.columns=t),this.definition},i.prototype.checkColumnVisibility=function(){var e=!1;this.columns.forEach(function(t){t.visible&&(e=!0)}),e?(this.show(),this.parent.table.options.columnVisibilityChanged.call(this.table,this.getComponent(),!1)):this.hide()},i.prototype.show=function(e,t){this.visible||(this.visible=!0,this.element.style.display="",this.parent.isGroup&&this.parent.checkColumnVisibility(),this.cells.forEach(function(e){e.show()}),this.isGroup||null!==this.width||this.reinitializeWidth(),this.table.columnManager._verticalAlignHeaders(),this.table.options.persistentLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.persistence.save("columns"),!t&&this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.updateColumnVisibility(this,this.visible),e||this.table.options.columnVisibilityChanged.call(this.table,this.getComponent(),!0),this.parent.isGroup&&this.parent.matchChildWidths())},i.prototype.hide=function(e,t){this.visible&&(this.visible=!1,this.element.style.display="none",this.table.columnManager._verticalAlignHeaders(),this.parent.isGroup&&this.parent.checkColumnVisibility(),this.cells.forEach(function(e){e.hide()}),this.table.options.persistentLayout&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.save("columns"),!t&&this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.updateColumnVisibility(this,this.visible),e||this.table.options.columnVisibilityChanged.call(this.table,this.getComponent(),!1),this.parent.isGroup&&this.parent.matchChildWidths())},i.prototype.matchChildWidths=function(){var e=0;this.contentElement&&this.columns.length&&(this.columns.forEach(function(t){t.visible&&(e+=t.getWidth())}),this.contentElement.style.maxWidth=e-1+"px")},i.prototype.setWidth=function(e){this.widthFixed=!0,this.setWidthActual(e)},i.prototype.setWidthActual=function(e){isNaN(e)&&(e=Math.floor(this.table.element.clientWidth/100*parseInt(e))),e=Math.max(this.minWidth,e),this.width=e,this.widthStyled=e?e+"px":"",this.element.style.width=this.widthStyled,this.isGroup||this.cells.forEach(function(e){e.setWidth()}),this.parent.isGroup&&this.parent.matchChildWidths(),this.table.modExists("frozenColumns")&&this.table.modules.frozenColumns.layout()},i.prototype.checkCellHeights=function(){var e=[];this.cells.forEach(function(t){t.row.heightInitialized&&(null!==t.row.getElement().offsetParent?(e.push(t.row),t.row.clearCellHeight()):t.row.heightInitialized=!1)}),e.forEach(function(e){e.calcHeight()}),e.forEach(function(e){e.setCellHeight()})},i.prototype.getWidth=function(){return this.width},i.prototype.getHeight=function(){return this.element.offsetHeight},i.prototype.setMinWidth=function(e){this.minWidth=e,this.minWidthStyled=e?e+"px":"",this.element.style.minWidth=this.minWidthStyled,this.cells.forEach(function(e){e.setMinWidth()})},i.prototype.delete=function(){this.isGroup&&this.columns.forEach(function(e){e.delete()});for(var e=this.cells.length,t=0;t<e;t++)this.cells[0].delete();this.element.parentNode.removeChild(this.element),this.table.columnManager.deregisterColumn(this)},i.prototype.generateCell=function(e){var t=this,o=new u(t,e);return this.cells.push(o),o},i.prototype.nextColumn=function(){var e=this.table.columnManager.findColumnIndex(this);return e>-1&&this.table.columnManager.getColumnByIndex(e+1)},i.prototype.prevColumn=function(){var e=this.table.columnManager.findColumnIndex(this);return e>-1&&this.table.columnManager.getColumnByIndex(e-1)},i.prototype.reinitializeWidth=function(e){this.widthFixed=!1,"undefined"==typeof this.definition.width||e||this.setWidth(this.definition.width),this.table.modExists("filter")&&this.table.modules.filter.hideHeaderFilterElements(),this.fitToData(),this.table.modExists("filter")&&this.table.modules.filter.showHeaderFilterElements()},i.prototype.fitToData=function(){var e=this;this.widthFixed||(this.element.style.width="",e.cells.forEach(function(e){e.clearWidth()}));var t=this.element.offsetWidth;e.width&&this.widthFixed||(e.cells.forEach(function(e){var o=e.getWidth();o>t&&(t=o)}),t&&e.setWidthActual(t+1))},i.prototype.deleteCell=function(e){var t=this.cells.indexOf(e);t>-1&&this.cells.splice(t,1)},i.prototype.defaultOptionList=["title","field","visible","align","width","minWidth","widthGrow","widthShrink","resizable","frozen","responsive","tooltip","cssClass","rowHandle","hideInHtml","sorter","sorterParams","formatter","formatterParams","variableHeight","editable","editor","editorParams","validator","mutator","mutatorParams","mutatorData","mutatorDataParams","mutatorEdit","mutatorEditParams","mutatorClipboard","mutatorClipboardParams","accessor","accessorParams","accessorData","accessorDataParams","accessorDownload","accessorDownloadParams","accessorClipboard","accessorClipboardParams","download","downloadTitle","topCalc","topCalcParams","topCalcFormatter","topCalcFormatterParams","bottomCalc","bottomCalcParams","bottomCalcFormatter","bottomCalcFormatterParams","cellClick","cellDblClick","cellContext","cellTap","cellDblTap","cellTapHold","cellMouseEnter","cellMouseLeave","cellMouseOver","cellMouseOut","cellMouseMove","cellEditing","cellEdited","cellEditCancelled","headerSort","headerSortStartingDir","headerSortTristate","headerClick","headerDblClick","headerContext","headerTap","headerDblTap","headerTapHold","headerTooltip","headerVertical","editableTitle","titleFormatter","titleFormatterParams","headerFilter","headerFilterPlaceholder","headerFilterParams","headerFilterEmptyCheck","headerFilterFunc","headerFilterFuncParams","headerFilterLiveFilter"],i.prototype.getComponent=function(){return new o(this)};var n=function(e){this.table=e,this.element=this.createHolderElement(),this.tableElement=this.createTableElement(),this.columnManager=null,this.height=0,this.firstRender=!1,this.renderMode="classic",this.rows=[],this.activeRows=[],this.activeRowsCount=0,this.displayRows=[],this.displayRowsCount=0,this.scrollTop=0,this.scrollLeft=0,this.vDomRowHeight=20,this.vDomTop=0,this.vDomBottom=0,this.vDomScrollPosTop=0,this.vDomScrollPosBottom=0,this.vDomTopPad=0,this.vDomBottomPad=0,this.vDomMaxRenderChain=90,this.vDomWindowBuffer=0,this.vDomWindowMinTotalRows=20,this.vDomWindowMinMarginRows=5,this.vDomTopNewRows=[],this.vDomBottomNewRows=[]};n.prototype.createHolderElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-tableHolder"),e.setAttribute("tabindex",0),e},n.prototype.createTableElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-table"),e},n.prototype.getElement=function(){return this.element},n.prototype.getTableElement=function(){return this.tableElement},n.prototype.getRowPosition=function(e,t){return t?this.activeRows.indexOf(e):this.rows.indexOf(e)},n.prototype.setColumnManager=function(e){this.columnManager=e},n.prototype.initialize=function(){var e=this;e.setRenderMode(),e.element.appendChild(e.tableElement),e.firstRender=!0,e.element.addEventListener("scroll",function(){var t=e.element.scrollLeft;e.scrollLeft!=t&&(e.columnManager.scrollHorizontal(t),e.table.options.groupBy&&e.table.modules.groupRows.scrollHeaders(t),e.table.modExists("columnCalcs")&&e.table.modules.columnCalcs.scrollHorizontal(t)),e.scrollLeft=t}),"virtual"===this.renderMode&&e.element.addEventListener("scroll",function(){var t=e.element.scrollTop,o=e.scrollTop>t;e.scrollTop!=t?(e.scrollTop=t,e.scrollVertical(o),"scroll"==e.table.options.ajaxProgressiveLoad&&e.table.modules.ajax.nextPage(e.element.scrollHeight-e.element.clientHeight-t)):e.scrollTop=t})},n.prototype.findRow=function(e){var t=this;if("object"!=("undefined"==typeof e?"undefined":r(e))){if("undefined"==typeof e||null===e)return!1;var o=t.rows.find(function(o){return o.data[t.table.options.index]==e});return o||!1}if(e instanceof a)return e;if(e instanceof s)return e._getSelf()||!1;if("undefined"!=typeof HTMLElement&&e instanceof HTMLElement){var i=t.rows.find(function(t){return t.element===e});return i||!1}return!1},n.prototype.getRowFromDataObject=function(e){var t=this.rows.find(function(t){return t.data===e});return t||!1},n.prototype.getRowFromPosition=function(e,t){return t?this.activeRows[e]:this.rows[e]},n.prototype.scrollToRow=function(e,t,o){var i,n=this,s=this.getDisplayRows().indexOf(e),r=e.getElement(),a=0;return new Promise(function(e,l){if(s>-1){if("undefined"==typeof t&&(t=n.table.options.scrollToRowPosition),"undefined"==typeof o&&(o=n.table.options.scrollToRowIfVisible),"nearest"===t)switch(n.renderMode){case"classic":i=d.prototype.helpers.elOffset(r).top,t=Math.abs(n.element.scrollTop-i)>Math.abs(n.element.scrollTop+n.element.clientHeight-i)?"bottom":"top";break;case"virtual":t=Math.abs(n.vDomTop-s)>Math.abs(n.vDomBottom-s)?"bottom":"top"}if(!o&&d.prototype.helpers.elVisible(r)&&(a=d.prototype.helpers.elOffset(r).top-d.prototype.helpers.elOffset(n.element).top,a>0&&a<n.element.clientHeight-r.offsetHeight))return!1;switch(n.renderMode){case"classic":n.element.scrollTop=d.prototype.helpers.elOffset(r).top-d.prototype.helpers.elOffset(n.element).top+n.element.scrollTop;break;case"virtual":n._virtualRenderFill(s,!0)}switch(t){case"middle":case"center":n.element.scrollTop=n.element.scrollTop-n.element.clientHeight/2;break;case"bottom":n.element.scrollTop=n.element.scrollTop-n.element.clientHeight+r.offsetHeight}e()}else console.warn("Scroll Error - Row not visible"),l("Scroll Error - Row not visible")})},n.prototype.setData=function(e,t){var o=this,i=this;return new Promise(function(n,s){t&&o.getDisplayRows().length?i.table.options.pagination?i._setDataActual(e,!0):o.reRenderInPosition(function(){i._setDataActual(e)}):(o.table.options.autoColumns&&o.table.columnManager.generateColumnsFromRowData(e),o.resetScroll(),o._setDataActual(e)),n()})},n.prototype._setDataActual=function(e,t){var o=this;o.table.options.dataLoading.call(this.table,e),this._wipeElements(),this.table.options.history&&this.table.modExists("history")&&this.table.modules.history.clear(),Array.isArray(e)?(this.table.modExists("selectRow")&&this.table.modules.selectRow.clearSelectionData(),this.table.options.reactiveData&&this.table.modExists("reactiveData",!0)&&this.table.modules.reactiveData.watchData(e),e.forEach(function(e,t){if(e&&"object"===("undefined"==typeof e?"undefined":r(e))){var i=new a(e,o);o.rows.push(i)}else console.warn("Data Loading Warning - Invalid row data detected and ignored, expecting object but received:",e)}),o.table.options.dataLoaded.call(this.table,e),o.refreshActiveData(!1,!1,t)):console.error("Data Loading Error - Unable to process data due to invalid data type \nExpecting: array \nReceived: ","undefined"==typeof e?"undefined":r(e),"\nData: ",e)},n.prototype._wipeElements=function(){this.rows.forEach(function(e){e.wipe()}),this.table.options.groupBy&&this.table.modExists("groupRows")&&this.table.modules.groupRows.wipe(),this.rows=[]},n.prototype.deleteRow=function(e,t){var o=this.rows.indexOf(e),i=this.activeRows.indexOf(e);i>-1&&this.activeRows.splice(i,1),o>-1&&this.rows.splice(o,1),this.setActiveRows(this.activeRows),this.displayRowIterator(function(t){var o=t.indexOf(e);o>-1&&t.splice(o,1)}),t||this.reRenderInPosition(),this.table.options.rowDeleted.call(this.table,e.getComponent()),this.table.options.dataEdited.call(this.table,this.getData()),this.table.options.groupBy&&this.table.modExists("groupRows")?this.table.modules.groupRows.updateGroupRows(!0):this.table.options.pagination&&this.table.modExists("page")?this.refreshActiveData(!1,!1,!0):this.table.options.pagination&&this.table.modExists("page")&&this.refreshActiveData("page")},n.prototype.addRow=function(e,t,o,i){var n=this.addRowActual(e,t,o,i);return this.table.options.history&&this.table.modExists("history")&&this.table.modules.history.action("rowAdd",n,{data:e,pos:t,index:o}),n},n.prototype.addRows=function(e,t,o){var i=this,n=this,s=0,r=[];return new Promise(function(a,l){t=i.findAddRowPos(t),Array.isArray(e)||(e=[e]),s=e.length-1,("undefined"==typeof o&&t||"undefined"!=typeof o&&!t)&&e.reverse(),e.forEach(function(e,i){var s=n.addRow(e,t,o,!0);r.push(s)}),i.table.options.groupBy&&i.table.modExists("groupRows")?i.table.modules.groupRows.updateGroupRows(!0):i.table.options.pagination&&i.table.modExists("page")?i.refreshActiveData(!1,!1,!0):i.reRenderInPosition(),i.table.modExists("columnCalcs")&&i.table.modules.columnCalcs.recalc(i.table.rowManager.activeRows),a(r)})},n.prototype.findAddRowPos=function(e){return"undefined"==typeof e&&(e=this.table.options.addRowPos),"pos"===e&&(e=!0),"bottom"===e&&(e=!1),e},n.prototype.addRowActual=function(e,t,o,i){var n,s=e instanceof a?e:new a(e||{},this),r=this.findAddRowPos(t);if(!o&&this.table.options.pagination&&"page"==this.table.options.paginationAddRow&&(n=this.getDisplayRows(),r?n.length?o=n[0]:this.activeRows.length&&(o=this.activeRows[this.activeRows.length-1],r=!1):n.length&&(o=n[n.length-1],r=!(n.length<this.table.modules.page.getPageSize()))),o&&(o=this.findRow(o)),this.table.options.groupBy&&this.table.modExists("groupRows")){this.table.modules.groupRows.assignRowToGroup(s);var l=s.getGroup().rows;l.length>1&&(!o||o&&l.indexOf(o)==-1?r?l[0]!==s&&(o=l[0],this._moveRowInArray(s.getGroup().rows,s,o,r)):l[l.length-1]!==s&&(o=l[l.length-1],this._moveRowInArray(s.getGroup().rows,s,o,r)):this._moveRowInArray(s.getGroup().rows,s,o,r))}if(o){var u=this.rows.indexOf(o),c=this.activeRows.indexOf(o);this.displayRowIterator(function(e){var t=e.indexOf(o);t>-1&&e.splice(r?t:t+1,0,s)}),c>-1&&this.activeRows.splice(r?c:c+1,0,s),u>-1&&this.rows.splice(r?u:u+1,0,s)}else r?(this.displayRowIterator(function(e){e.unshift(s)}),this.activeRows.unshift(s),this.rows.unshift(s)):(this.displayRowIterator(function(e){e.push(s)}),this.activeRows.push(s),this.rows.push(s));return this.setActiveRows(this.activeRows),this.table.options.rowAdded.call(this.table,s.getComponent()),this.table.options.dataEdited.call(this.table,this.getData()),i||this.reRenderInPosition(),s},n.prototype.moveRow=function(e,t,o){this.table.options.history&&this.table.modExists("history")&&this.table.modules.history.action("rowMove",e,{pos:this.getRowPosition(e),to:t,after:o}),this.moveRowActual(e,t,o),this.table.options.rowMoved.call(this.table,e.getComponent())},n.prototype.moveRowActual=function(e,t,o){var i=this;if(this._moveRowInArray(this.rows,e,t,o),this._moveRowInArray(this.activeRows,e,t,o),this.displayRowIterator(function(n){i._moveRowInArray(n,e,t,o)}),this.table.options.groupBy&&this.table.modExists("groupRows")){var n=t.getGroup(),s=e.getGroup();n===s?this._moveRowInArray(n.rows,e,t,o):(s&&s.removeRow(e),n.insertRow(e,t,o))}},n.prototype._moveRowInArray=function(e,t,o,i){var n,s,r,a;if(t!==o&&(n=e.indexOf(t),n>-1&&(e.splice(n,1),s=e.indexOf(o),s>-1?i?e.splice(s+1,0,t):e.splice(s,0,t):e.splice(n,0,t)),e===this.getDisplayRows())){r=n<s?n:s,a=s>n?s:n+1;for(var l=r;l<=a;l++)e[l]&&this.styleRow(e[l],l)}},n.prototype.clearData=function(){this.setData([])},n.prototype.getRowIndex=function(e){return this.findRowIndex(e,this.rows)},n.prototype.getDisplayRowIndex=function(e){var t=this.getDisplayRows().indexOf(e);return t>-1&&t},n.prototype.nextDisplayRow=function(e,t){var o=this.getDisplayRowIndex(e),i=!1;return o!==!1&&o<this.displayRowsCount-1&&(i=this.getDisplayRows()[o+1]),!i||i instanceof a&&"row"==i.type?i:this.nextDisplayRow(i,t)},n.prototype.prevDisplayRow=function(e,t){var o=this.getDisplayRowIndex(e),i=!1;return o&&(i=this.getDisplayRows()[o-1]),!i||i instanceof a&&"row"==i.type?i:this.prevDisplayRow(i,t)},n.prototype.findRowIndex=function(e,t){var o;return e=this.findRow(e),!!(e&&(o=t.indexOf(e),o>-1))&&o},n.prototype.getData=function(e,t){var o=this,i=[],n=e?o.activeRows:o.rows;return n.forEach(function(e){i.push(e.getData(t||"data"))}),i},n.prototype.getHtml=function(e){var t=this.getData(e),o=[],i="",n="",s="";return this.table.columnManager.getColumns().forEach(function(e){var t=e.getDefinition();e.visible&&!t.hideInHtml&&(i+="<th>"+(t.title||"")+"</th>",o.push(e))}),t.forEach(function(e){var t="";o.forEach(function(o){var i=o.getFieldValue(e);"undefined"!=typeof i&&null!==i||(i=":"),t+="<td>"+i+"</td>"}),n+="<tr>"+t+"</tr>"}),s="<table>\n\n\t\t\t<thead>\n\n\t\t\t<tr>"+i+"</tr>\n\n\t\t\t</thead>\n\n\t\t\t<tbody>"+n+"</tbody>\n\n\t\t\t</table>"},n.prototype.getComponents=function(e){var t=this,o=[],i=e?t.activeRows:t.rows;return i.forEach(function(e){o.push(e.getComponent())}),o},n.prototype.getDataCount=function(e){return e?this.rows.length:this.activeRows.length},n.prototype._genRemoteRequest=function(){var e=this,t=e.table,o=t.options,i={};if(t.modExists("page")){if(o.ajaxSorting){var n=e.table.modules.sort.getSort();n.forEach(function(e){delete e.column}),i[e.table.modules.page.paginationDataSentNames.sorters]=n}if(o.ajaxFiltering){var s=e.table.modules.filter.getFilters(!0,!0);i[e.table.modules.page.paginationDataSentNames.filters]=s}e.table.modules.ajax.setParams(i,!0)}t.modules.ajax.sendRequest().then(function(t){e.setData(t)}).catch(function(e){})},n.prototype.filterRefresh=function(){var e=this.table,t=e.options,o=this.scrollLeft;t.ajaxFiltering?"remote"==t.pagination&&e.modExists("page")?(e.modules.page.reset(!0),e.modules.page.setPage(1).then(function(){}).catch(function(){})):t.ajaxProgressiveLoad?e.modules.ajax.loadData().then(function(){}).catch(function(){}):this._genRemoteRequest():this.refreshActiveData("filter"),this.scrollHorizontal(o)},n.prototype.sorterRefresh=function(e){var t=this.table,o=this.table.options,i=this.scrollLeft;o.ajaxSorting?("remote"==o.pagination||o.progressiveLoad)&&t.modExists("page")?(t.modules.page.reset(!0),t.modules.page.setPage(1).then(function(){}).catch(function(){})):o.ajaxProgressiveLoad?t.modules.ajax.loadData().then(function(){}).catch(function(){}):this._genRemoteRequest():this.refreshActiveData(e?"filter":"sort"),this.scrollHorizontal(i)},n.prototype.scrollHorizontal=function(e){this.scrollLeft=e,this.element.scrollLeft=e,this.table.options.groupBy&&this.table.modules.groupRows.scrollHeaders(e),this.table.modExists("columnCalcs")&&this.table.modules.columnCalcs.scrollHorizontal(e)},n.prototype.refreshActiveData=function(e,t,o){var i,n=this,s=this.table;switch(n.table.modExists("edit")&&n.table.modules.edit.cancelEdit(),e||(e="all"),s.options.selectable&&!s.options.selectablePersistence&&s.modExists("selectRow")&&s.modules.selectRow.deselectRows(),e){case"all":case"filter":t?t=!1:s.modExists("filter")?n.setActiveRows(s.modules.filter.filter(n.rows)):n.setActiveRows(n.rows.slice(0));case"sort":t?t=!1:s.modExists("sort")&&s.modules.sort.sort(this.activeRows);case"display":this.resetDisplayRows();case"freeze":t?t=!1:this.table.modExists("frozenRows")&&s.modules.frozenRows.isFrozen()&&(s.modules.frozenRows.getDisplayIndex()||s.modules.frozenRows.setDisplayIndex(this.getNextDisplayIndex()),i=s.modules.frozenRows.getDisplayIndex(),i=n.setDisplayRows(s.modules.frozenRows.getRows(this.getDisplayRows(i-1)),i),i!==!0&&s.modules.frozenRows.setDisplayIndex(i));case"group":t?t=!1:s.options.groupBy&&s.modExists("groupRows")&&(s.modules.groupRows.getDisplayIndex()||s.modules.groupRows.setDisplayIndex(this.getNextDisplayIndex()),i=s.modules.groupRows.getDisplayIndex(),i=n.setDisplayRows(s.modules.groupRows.getRows(this.getDisplayRows(i-1)),i),i!==!0&&s.modules.groupRows.setDisplayIndex(i));case"tree":t?t=!1:s.options.dataTree&&s.modExists("dataTree")&&(s.modules.dataTree.getDisplayIndex()||s.modules.dataTree.setDisplayIndex(this.getNextDisplayIndex()),i=s.modules.dataTree.getDisplayIndex(),i=n.setDisplayRows(s.modules.dataTree.getRows(this.getDisplayRows(i-1)),i),i!==!0&&s.modules.dataTree.setDisplayIndex(i)),s.options.pagination&&s.modExists("page")&&!o&&"local"==s.modules.page.getMode()&&s.modules.page.reset();case"page":t?t=!1:s.options.pagination&&s.modExists("page")&&(s.modules.page.getDisplayIndex()||s.modules.page.setDisplayIndex(this.getNextDisplayIndex()),i=s.modules.page.getDisplayIndex(),"local"==s.modules.page.getMode()&&s.modules.page.setMaxRows(this.getDisplayRows(i-1).length),i=n.setDisplayRows(s.modules.page.getRows(this.getDisplayRows(i-1)),i),i!==!0&&s.modules.page.setDisplayIndex(i))}d.prototype.helpers.elVisible(n.element)&&(o?n.reRenderInPosition():(n.renderTable(),s.options.layoutColumnsOnNewData&&n.table.columnManager.redraw(!0))),s.modExists("columnCalcs")&&s.modules.columnCalcs.recalc(this.activeRows)},n.prototype.setActiveRows=function(e){this.activeRows=e,this.activeRowsCount=this.activeRows.length},n.prototype.resetDisplayRows=function(){this.displayRows=[],this.displayRows.push(this.activeRows.slice(0)),this.displayRowsCount=this.displayRows[0].length,this.table.modExists("frozenRows")&&this.table.modules.frozenRows.setDisplayIndex(0),this.table.options.groupBy&&this.table.modExists("groupRows")&&this.table.modules.groupRows.setDisplayIndex(0),this.table.options.pagination&&this.table.modExists("page")&&this.table.modules.page.setDisplayIndex(0)},n.prototype.getNextDisplayIndex=function(){return this.displayRows.length},n.prototype.setDisplayRows=function(e,t){var o=!0;return t&&"undefined"!=typeof this.displayRows[t]?(this.displayRows[t]=e,o=!0):(this.displayRows.push(e),o=t=this.displayRows.length-1),t==this.displayRows.length-1&&(this.displayRowsCount=this.displayRows[this.displayRows.length-1].length),o},n.prototype.getDisplayRows=function(e){return"undefined"==typeof e?this.displayRows.length?this.displayRows[this.displayRows.length-1]:[]:this.displayRows[e]||[]},n.prototype.getVisibleRows=function(e){return this.getDisplayRows().slice(this.vDomTop,this.vDomBottom+1)},n.prototype.displayRowIterator=function(e){this.displayRows.forEach(e),this.displayRowsCount=this.displayRows[this.displayRows.length-1].length},n.prototype.getRows=function(){return this.rows},n.prototype.reRenderInPosition=function(e){if("virtual"==this.getRenderMode()){for(var t=this.element.scrollTop,o=!1,i=!1,n=this.scrollLeft,s=this.getDisplayRows(),r=this.vDomTop;r<=this.vDomBottom;r++)if(s[r]){var a=t-s[r].getElement().offsetTop;if(!(i===!1||Math.abs(a)<i))break;i=a,o=r}e&&e(),this._virtualRenderFill(o===!1?this.displayRowsCount-1:o,!0,i||0),this.scrollHorizontal(n)}else this.renderTable(),e&&e()},n.prototype.setRenderMode=function(){(this.table.element.clientHeight||this.table.options.height)&&this.table.options.virtualDom?this.renderMode="virtual":this.renderMode="classic"},n.prototype.getRenderMode=function(){return this.renderMode},n.prototype.renderTable=function(){var e=this;switch(e.table.options.renderStarted.call(this.table),e.element.scrollTop=0,e.renderMode){case"classic":e._simpleRender();break;case"virtual":e._virtualRenderFill()}e.firstRender&&(e.displayRowsCount?(e.firstRender=!1,e.table.modules.layout.layout()):e.renderEmptyScroll()),e.table.modExists("frozenColumns")&&e.table.modules.frozenColumns.layout(),e.displayRowsCount||e.table.options.placeholder&&(this.renderMode&&e.table.options.placeholder.setAttribute("tabulator-render-mode",this.renderMode),e.getElement().appendChild(e.table.options.placeholder)),e.table.options.renderComplete.call(this.table)},n.prototype._simpleRender=function(){this._clearVirtualDom(),this.displayRowsCount?this.checkClassicModeGroupHeaderWidth():this.renderEmptyScroll()},n.prototype.checkClassicModeGroupHeaderWidth=function(){var e=this,t=this.tableElement,o=!0;e.getDisplayRows().forEach(function(i,n){e.styleRow(i,n),t.appendChild(i.getElement()),i.initialize(!0),"group"!==i.type&&(o=!1)}),o?t.style.minWidth=e.table.columnManager.getWidth()+"px":t.style.minWidth=""},n.prototype.renderEmptyScroll=function(){this.tableElement.style.minWidth=this.table.columnManager.getWidth()+"px",this.tableElement.style.minHeight="1px",this.tableElement.style.visibility="hidden"},n.prototype._clearVirtualDom=function(){var e=this.tableElement;for(this.table.options.placeholder&&this.table.options.placeholder.parentNode&&this.table.options.placeholder.parentNode.removeChild(this.table.options.placeholder);e.firstChild;)e.removeChild(e.firstChild);e.style.paddingTop="",e.style.paddingBottom="",e.style.minWidth="",e.style.minHeight="",e.style.visibility="",this.scrollTop=0,this.scrollLeft=0,this.vDomTop=0,this.vDomBottom=0,this.vDomTopPad=0,this.vDomBottomPad=0},n.prototype.styleRow=function(e,t){var o=e.getElement();t%2?(o.classList.add("tabulator-row-even"),o.classList.remove("tabulator-row-odd")):(o.classList.add("tabulator-row-odd"),o.classList.remove("tabulator-row-even"))},n.prototype._virtualRenderFill=function(e,t,o){var i=this,n=i.tableElement,s=i.element,r=0,a=0,l=0,u=0,c=!0,h=i.getDisplayRows();if(e=e||0,o=o||0,e){for(;n.firstChild;)n.removeChild(n.firstChild);var p=(i.displayRowsCount-e+1)*i.vDomRowHeight;p<i.height&&(e-=Math.ceil((i.height-p)/i.vDomRowHeight),e<0&&(e=0)),r=Math.min(Math.max(Math.floor(i.vDomWindowBuffer/i.vDomRowHeight),i.vDomWindowMinMarginRows),e),e-=r}else i._clearVirtualDom();if(i.displayRowsCount&&d.prototype.helpers.elVisible(i.element)){for(i.vDomTop=e,i.vDomBottom=e-1;(a<=i.height+i.vDomWindowBuffer||u<i.vDomWindowMinTotalRows)&&i.vDomBottom<i.displayRowsCount-1;){var m=i.vDomBottom+1,f=h[m],g=0;i.styleRow(f,m),n.appendChild(f.getElement()),f.initialized?f.heightInitialized||f.normalizeHeight(!0):f.initialize(!0),g=f.getHeight(),u<r?l+=g:a+=g,g>this.vDomWindowBuffer&&(this.vDomWindowBuffer=2*g),"group"!==f.type&&(c=!1),i.vDomBottom++,u++}e?(i.vDomTopPad=t?i.vDomRowHeight*this.vDomTop+o:i.scrollTop-l,i.vDomBottomPad=i.vDomBottom==i.displayRowsCount-1?0:Math.max(i.vDomScrollHeight-i.vDomTopPad-a-l,0)):(this.vDomTopPad=0,i.vDomRowHeight=Math.floor((a+l)/u),i.vDomBottomPad=i.vDomRowHeight*(i.displayRowsCount-i.vDomBottom-1),i.vDomScrollHeight=l+a+i.vDomBottomPad-i.height),n.style.paddingTop=i.vDomTopPad+"px",n.style.paddingBottom=i.vDomBottomPad+"px",t&&(this.scrollTop=i.vDomTopPad+l+o-(this.element.scrollWidth>this.element.clientWidth?this.element.offsetHeight-this.element.clientHeight:0)),this.scrollTop=Math.min(this.scrollTop,this.element.scrollHeight-this.height),this.element.scrollWidth>this.element.offsetWidth&&t&&(this.scrollTop+=this.element.offsetHeight-this.element.clientHeight),this.vDomScrollPosTop=this.scrollTop,this.vDomScrollPosBottom=this.scrollTop,s.scrollTop=this.scrollTop,n.style.minWidth=c?i.table.columnManager.getWidth()+"px":"",i.table.options.groupBy&&"fitDataFill"!=i.table.modules.layout.getMode()&&i.displayRowsCount==i.table.modules.groupRows.countGroups()&&(i.tableElement.style.minWidth=i.table.columnManager.getWidth())}else this.renderEmptyScroll()},n.prototype.scrollVertical=function(e){var t=this.scrollTop-this.vDomScrollPosTop,o=this.scrollTop-this.vDomScrollPosBottom,i=2*this.vDomWindowBuffer;if(-t>i||o>i){var n=this.scrollLeft;this._virtualRenderFill(Math.floor(this.element.scrollTop/this.element.scrollHeight*this.displayRowsCount)),this.scrollHorizontal(n)}else e?(t<0&&this._addTopRow(-t),o<0&&this.vDomScrollHeight-this.scrollTop>this.vDomWindowBuffer&&this._removeBottomRow(-o)):(t>=0&&this.scrollTop>this.vDomWindowBuffer&&this._removeTopRow(t),o>=0&&this._addBottomRow(o))},n.prototype._addTopRow=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=this.tableElement,i=this.getDisplayRows();if(this.vDomTop){var n=this.vDomTop-1,s=i[n],r=s.getHeight()||this.vDomRowHeight;e>=r&&(this.styleRow(s,n),o.insertBefore(s.getElement(),o.firstChild),s.initialized&&s.heightInitialized||(this.vDomTopNewRows.push(s),s.heightInitialized||s.clearCellHeight()),s.initialize(),this.vDomTopPad-=r,this.vDomTopPad<0&&(this.vDomTopPad=n*this.vDomRowHeight),n||(this.vDomTopPad=0),o.style.paddingTop=this.vDomTopPad+"px",this.vDomScrollPosTop-=r,this.vDomTop--),e=-(this.scrollTop-this.vDomScrollPosTop),s.getHeight()>this.vDomWindowBuffer&&(this.vDomWindowBuffer=2*s.getHeight()),t<this.vDomMaxRenderChain&&this.vDomTop&&e>=(i[this.vDomTop-1].getHeight()||this.vDomRowHeight)?this._addTopRow(e,t+1):this._quickNormalizeRowHeight(this.vDomTopNewRows)}},n.prototype._removeTopRow=function(e){var t=this.tableElement,o=this.getDisplayRows()[this.vDomTop],i=o.getHeight()||this.vDomRowHeight;if(e>=i){var n=o.getElement();n.parentNode.removeChild(n),this.vDomTopPad+=i,t.style.paddingTop=this.vDomTopPad+"px",this.vDomScrollPosTop+=this.vDomTop?i:i+this.vDomWindowBuffer,this.vDomTop++,e=this.scrollTop-this.vDomScrollPosTop,this._removeTopRow(e)}},n.prototype._addBottomRow=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=this.tableElement,i=this.getDisplayRows();if(this.vDomBottom<this.displayRowsCount-1){var n=this.vDomBottom+1,s=i[n],r=s.getHeight()||this.vDomRowHeight;e>=r&&(this.styleRow(s,n),o.appendChild(s.getElement()),s.initialized&&s.heightInitialized||(this.vDomBottomNewRows.push(s),s.heightInitialized||s.clearCellHeight()),s.initialize(),this.vDomBottomPad-=r,(this.vDomBottomPad<0||n==this.displayRowsCount-1)&&(this.vDomBottomPad=0),o.style.paddingBottom=this.vDomBottomPad+"px",this.vDomScrollPosBottom+=r,this.vDomBottom++),e=this.scrollTop-this.vDomScrollPosBottom,s.getHeight()>this.vDomWindowBuffer&&(this.vDomWindowBuffer=2*s.getHeight()),t<this.vDomMaxRenderChain&&this.vDomBottom<this.displayRowsCount-1&&e>=(i[this.vDomBottom+1].getHeight()||this.vDomRowHeight)?this._addBottomRow(e,t+1):this._quickNormalizeRowHeight(this.vDomBottomNewRows)}},n.prototype._removeBottomRow=function(e){var t=this.tableElement,o=this.getDisplayRows()[this.vDomBottom],i=o.getHeight()||this.vDomRowHeight;if(e>=i){var n=o.getElement();n.parentNode&&n.parentNode.removeChild(n),this.vDomBottomPad+=i,this.vDomBottomPad<0&&(this.vDomBottomPad=0),t.style.paddingBottom=this.vDomBottomPad+"px",this.vDomScrollPosBottom-=i,this.vDomBottom--,e=-(this.scrollTop-this.vDomScrollPosBottom),this._removeBottomRow(e)}},n.prototype._quickNormalizeRowHeight=function(e){e.forEach(function(e){e.calcHeight()}),e.forEach(function(e){e.setCellHeight()}),e.length=0},n.prototype.normalizeHeight=function(){this.activeRows.forEach(function(e){
- e.normalizeHeight()})},n.prototype.adjustTableSize=function(){if("virtual"===this.renderMode){this.height=this.element.clientHeight,this.vDomWindowBuffer=this.table.options.virtualDomBuffer||this.height;var e=this.columnManager.getElement().offsetHeight+(this.table.footerManager&&!this.table.footerManager.external?this.table.footerManager.getElement().offsetHeight:0);this.element.style.minHeight="calc(100% - "+e+"px)",this.element.style.height="calc(100% - "+e+"px)",this.element.style.maxHeight="calc(100% - "+e+"px)"}},n.prototype.reinitialize=function(){this.rows.forEach(function(e){e.reinitialize()})},n.prototype.redraw=function(e){var t=this.scrollLeft;this.adjustTableSize(),this.table.tableWidth=this.table.element.clientWidth,e?this.renderTable():("classic"==self.renderMode?self.table.options.groupBy?self.refreshActiveData("group",!1,!1):this._simpleRender():(this.reRenderInPosition(),this.scrollHorizontal(t)),this.displayRowsCount||this.table.options.placeholder&&this.getElement().appendChild(this.table.options.placeholder))},n.prototype.resetScroll=function(){if(this.element.scrollLeft=0,this.element.scrollTop=0,"ie"===this.table.browser){var e=document.createEvent("Event");e.initEvent("scroll",!1,!0),this.element.dispatchEvent(e)}else this.element.dispatchEvent(new Event("scroll"))};var s=function(e){this._row=e};s.prototype.getData=function(e){return this._row.getData(e)},s.prototype.getElement=function(){return this._row.getElement()},s.prototype.getCells=function(){var e=[];return this._row.getCells().forEach(function(t){e.push(t.getComponent())}),e},s.prototype.getCell=function(e){var t=this._row.getCell(e);return!!t&&t.getComponent()},s.prototype.getIndex=function(){return this._row.getData("data")[this._row.table.options.index]},s.prototype.getPosition=function(e){return this._row.table.rowManager.getRowPosition(this._row,e)},s.prototype.delete=function(){return this._row.delete()},s.prototype.scrollTo=function(){return this._row.table.rowManager.scrollToRow(this._row)},s.prototype.pageTo=function(){if(this._row.table.modExists("page",!0))return this._row.table.modules.page.setPageToRow(this._row)},s.prototype.move=function(e,t){this._row.moveToRow(e,t)},s.prototype.update=function(e){return this._row.updateData(e)},s.prototype.normalizeHeight=function(){this._row.normalizeHeight(!0)},s.prototype.select=function(){this._row.table.modules.selectRow.selectRows(this._row)},s.prototype.deselect=function(){this._row.table.modules.selectRow.deselectRows(this._row)},s.prototype.toggleSelect=function(){this._row.table.modules.selectRow.toggleRow(this._row)},s.prototype.isSelected=function(){return this._row.table.modules.selectRow.isRowSelected(this._row)},s.prototype._getSelf=function(){return this._row},s.prototype.freeze=function(){this._row.table.modExists("frozenRows",!0)&&this._row.table.modules.frozenRows.freezeRow(this._row)},s.prototype.unfreeze=function(){this._row.table.modExists("frozenRows",!0)&&this._row.table.modules.frozenRows.unfreezeRow(this._row)},s.prototype.treeCollapse=function(){this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.collapseRow(this._row)},s.prototype.treeExpand=function(){this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.expandRow(this._row)},s.prototype.treeToggle=function(){this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.toggleRow(this._row)},s.prototype.getTreeParent=function(){return!!this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.getTreeParent(this._row)},s.prototype.getTreeChildren=function(){return!!this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.getTreeChildren(this._row)},s.prototype.reformat=function(){return this._row.reinitialize()},s.prototype.getGroup=function(){return this._row.getGroup().getComponent()},s.prototype.getTable=function(){return this._row.table},s.prototype.getNextRow=function(){var e=this._row.nextRow();return e?e.getComponent():e},s.prototype.getPrevRow=function(){var e=this._row.prevRow();return e?e.getComponent():e};var a=function(e,t){this.table=t.table,this.parent=t,this.data={},this.type="row",this.element=this.createElement(),this.modules={},this.cells=[],this.height=0,this.heightStyled="",this.manualHeight=!1,this.outerHeight=0,this.initialized=!1,this.heightInitialized=!1,this.setData(e),this.generateElement()};a.prototype.createElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-row"),e.setAttribute("role","row"),e},a.prototype.getElement=function(){return this.element},a.prototype.detachElement=function(){this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)},a.prototype.generateElement=function(){var e,t,o,i=this;i.table.options.selectable!==!1&&i.table.modExists("selectRow")&&i.table.modules.selectRow.initializeRow(this),i.table.options.movableRows!==!1&&i.table.modExists("moveRow")&&i.table.modules.moveRow.initializeRow(this),i.table.options.dataTree!==!1&&i.table.modExists("dataTree")&&i.table.modules.dataTree.initializeRow(this),i.table.options.rowClick&&i.element.addEventListener("click",function(e){i.table.options.rowClick(e,i.getComponent())}),i.table.options.rowDblClick&&i.element.addEventListener("dblclick",function(e){i.table.options.rowDblClick(e,i.getComponent())}),i.table.options.rowContext&&i.element.addEventListener("contextmenu",function(e){i.table.options.rowContext(e,i.getComponent())}),i.table.options.rowMouseEnter&&i.element.addEventListener("mouseenter",function(e){i.table.options.rowMouseEnter(e,i.getComponent())}),i.table.options.rowMouseLeave&&i.element.addEventListener("mouseleave",function(e){i.table.options.rowMouseLeave(e,i.getComponent())}),i.table.options.rowMouseOver&&i.element.addEventListener("mouseover",function(e){i.table.options.rowMouseOver(e,i.getComponent())}),i.table.options.rowMouseOut&&i.element.addEventListener("mouseout",function(e){i.table.options.rowMouseOut(e,i.getComponent())}),i.table.options.rowMouseMove&&i.element.addEventListener("mousemove",function(e){i.table.options.rowMouseMove(e,i.getComponent())}),i.table.options.rowTap&&(o=!1,i.element.addEventListener("touchstart",function(e){o=!0}),i.element.addEventListener("touchend",function(e){o&&i.table.options.rowTap(e,i.getComponent()),o=!1})),i.table.options.rowDblTap&&(e=null,i.element.addEventListener("touchend",function(t){e?(clearTimeout(e),e=null,i.table.options.rowDblTap(t,i.getComponent())):e=setTimeout(function(){clearTimeout(e),e=null},300)})),i.table.options.rowTapHold&&(t=null,i.element.addEventListener("touchstart",function(e){clearTimeout(t),t=setTimeout(function(){clearTimeout(t),t=null,o=!1,i.table.options.rowTapHold(e,i.getComponent())},1e3)}),i.element.addEventListener("touchend",function(e){clearTimeout(t),t=null}))},a.prototype.generateCells=function(){this.cells=this.table.columnManager.generateCells(this)},a.prototype.initialize=function(e){var t=this;if(!t.initialized||e){for(t.deleteCells();t.element.firstChild;)t.element.removeChild(t.element.firstChild);this.table.modExists("frozenColumns")&&this.table.modules.frozenColumns.layoutRow(this),this.generateCells(),t.cells.forEach(function(e){t.element.appendChild(e.getElement()),e.cellRendered()}),e&&t.normalizeHeight(),t.table.options.dataTree&&t.table.modExists("dataTree")&&t.table.modules.dataTree.layoutRow(this),"collapse"===t.table.options.responsiveLayout&&t.table.modExists("responsiveLayout")&&t.table.modules.responsiveLayout.layoutRow(this),t.table.options.rowFormatter&&t.table.options.rowFormatter(t.getComponent()),t.table.options.resizableRows&&t.table.modExists("resizeRows")&&t.table.modules.resizeRows.initializeRow(t),t.initialized=!0}},a.prototype.reinitializeHeight=function(){this.heightInitialized=!1,null!==this.element.offsetParent&&this.normalizeHeight(!0)},a.prototype.reinitialize=function(){this.initialized=!1,this.heightInitialized=!1,this.manualHeight||(this.height=0,this.heightStyled=""),null!==this.element.offsetParent&&this.initialize(!0)},a.prototype.calcHeight=function(e){var t=0,o=this.table.options.resizableRows?this.element.clientHeight:0;this.cells.forEach(function(e){var o=e.getHeight();o>t&&(t=o)}),e?this.height=Math.max(t,o):this.height=this.manualHeight?this.height:Math.max(t,o),this.heightStyled=this.height?this.height+"px":"",this.outerHeight=this.element.offsetHeight},a.prototype.setCellHeight=function(){this.cells.forEach(function(e){e.setHeight()}),this.heightInitialized=!0},a.prototype.clearCellHeight=function(){this.cells.forEach(function(e){e.clearHeight()})},a.prototype.normalizeHeight=function(e){e&&this.clearCellHeight(),this.calcHeight(e),this.setCellHeight()},a.prototype.setHeight=function(e,t){(this.height!=e||t)&&(this.manualHeight=!0,this.height=e,this.heightStyled=e?e+"px":"",this.setCellHeight(),this.outerHeight=this.element.offsetHeight)},a.prototype.getHeight=function(){return this.outerHeight},a.prototype.getWidth=function(){return this.element.offsetWidth},a.prototype.deleteCell=function(e){var t=this.cells.indexOf(e);t>-1&&this.cells.splice(t,1)},a.prototype.setData=function(e){this.table.modExists("mutator")&&(e=this.table.modules.mutator.transformRow(e,"data")),this.data=e,this.table.options.reactiveData&&this.table.modExists("reactiveData",!0)&&this.table.modules.reactiveData.watchRow(this)},a.prototype.updateData=function(e){var t=this,o=this,i=d.prototype.helpers.elVisible(this.element);return new Promise(function(n,s){"string"==typeof e&&(e=JSON.parse(e)),t.table.options.reactiveData&&t.table.modExists("reactiveData",!0)&&t.table.modules.reactiveData.block(),o.table.modExists("mutator")&&(e=o.table.modules.mutator.transformRow(e,"data",!0));for(var r in e)o.data[r]=e[r];t.table.options.reactiveData&&t.table.modExists("reactiveData",!0)&&t.table.modules.reactiveData.unblock();for(var r in e){var a=t.getCell(r);a&&a.getValue()!=e[r]&&(a.setValueProcessData(e[r]),i&&a.cellRendered())}i?(o.normalizeHeight(),o.table.options.rowFormatter&&o.table.options.rowFormatter(o.getComponent())):(t.initialized=!1,t.height=0,t.heightStyled=""),o.table.options.dataTree!==!1&&o.table.modExists("dataTree")&&"undefined"!=typeof e[t.table.modules.dataTree.getChildField()]&&(t.table.modules.dataTree.initializeRow(t),t.table.rowManager.refreshActiveData("tree",!1,!0)),o.table.options.rowUpdated.call(t.table,o.getComponent()),n()})},a.prototype.getData=function(e){var t=this;return e?t.table.modExists("accessor")?t.table.modules.accessor.transformRow(t.data,e):void 0:this.data},a.prototype.getCell=function(e){var t=!1;return e=this.table.columnManager.findColumn(e),t=this.cells.find(function(t){return t.column===e})},a.prototype.getCellIndex=function(e){return this.cells.findIndex(function(t){return t===e})},a.prototype.findNextEditableCell=function(e){var t=!1;if(e<this.cells.length-1)for(var o=e+1;o<this.cells.length;o++){var i=this.cells[o];if(i.column.modules.edit&&d.prototype.helpers.elVisible(i.getElement())){var n=!0;if("function"==typeof i.column.modules.edit.check&&(n=i.column.modules.edit.check(i.getComponent())),n){t=i;break}}}return t},a.prototype.findPrevEditableCell=function(e){var t=!1;if(e>0)for(var o=e-1;o>=0;o--){var i=this.cells[o],n=!0;if(i.column.modules.edit&&d.prototype.helpers.elVisible(i.getElement())&&("function"==typeof i.column.modules.edit.check&&(n=i.column.modules.edit.check(i.getComponent())),n)){t=i;break}}return t},a.prototype.getCells=function(){return this.cells},a.prototype.nextRow=function(){var e=this.table.rowManager.nextDisplayRow(this,!0);return e||!1},a.prototype.prevRow=function(){var e=this.table.rowManager.prevDisplayRow(this,!0);return e||!1},a.prototype.moveToRow=function(e,t){var o=this.table.rowManager.findRow(e);o?(this.table.rowManager.moveRowActual(this,o,!t),this.table.rowManager.refreshActiveData("display",!1,!0)):console.warn("Move Error - No matching row found:",e)},a.prototype.delete=function(){var e=this;return new Promise(function(t,o){var i=e.table.rowManager.getRowIndex(e);e.deleteActual(),e.table.options.history&&e.table.modExists("history")&&(i&&(i=e.table.rowManager.rows[i-1]),e.table.modules.history.action("rowDelete",e,{data:e.getData(),pos:!i,index:i})),t()})},a.prototype.deleteActual=function(e){this.table.rowManager.getRowIndex(this);this.table.modExists("selectRow")&&this.table.modules.selectRow._deselectRow(this,!0),this.table.options.reactiveData&&this.table.modExists("reactiveData",!0),this.modules.group&&this.modules.group.removeRow(this),this.table.rowManager.deleteRow(this,e),this.deleteCells(),this.initialized=!1,this.heightInitialized=!1,this.table.modExists("columnCalcs")&&(this.table.options.groupBy&&this.table.modExists("groupRows")?this.table.modules.columnCalcs.recalcRowGroup(this):this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows))},a.prototype.deleteCells=function(){for(var e=this.cells.length,t=0;t<e;t++)this.cells[0].delete()},a.prototype.wipe=function(){for(this.deleteCells();this.element.firstChild;)this.element.removeChild(this.element.firstChild);this.element=!1,this.modules={},this.element.parentNode&&this.element.parentNode.removeChild(this.element)},a.prototype.getGroup=function(){return this.modules.group||!1},a.prototype.getComponent=function(){return new s(this)};var l=function(e){this._cell=e};l.prototype.getValue=function(){return this._cell.getValue()},l.prototype.getOldValue=function(){return this._cell.getOldValue()},l.prototype.getElement=function(){return this._cell.getElement()},l.prototype.getRow=function(){return this._cell.row.getComponent()},l.prototype.getData=function(){return this._cell.row.getData()},l.prototype.getField=function(){return this._cell.column.getField()},l.prototype.getColumn=function(){return this._cell.column.getComponent()},l.prototype.setValue=function(e,t){"undefined"==typeof t&&(t=!0),this._cell.setValue(e,t)},l.prototype.restoreOldValue=function(){this._cell.setValueActual(this._cell.getOldValue())},l.prototype.edit=function(e){return this._cell.edit(e)},l.prototype.cancelEdit=function(){this._cell.cancelEdit()},l.prototype.nav=function(){return this._cell.nav()},l.prototype.checkHeight=function(){this._cell.checkHeight()},l.prototype.getTable=function(){return this._cell.table},l.prototype._getSelf=function(){return this._cell};var u=function(e,t){this.table=e.table,this.column=e,this.row=t,this.element=null,this.value=null,this.oldValue=null,this.height=null,this.width=null,this.minWidth=null,this.build()};u.prototype.build=function(){this.generateElement(),this.setWidth(),this._configureCell(),this.setValueActual(this.column.getFieldValue(this.row.data))},u.prototype.generateElement=function(){this.element=document.createElement("div"),this.element.className="tabulator-cell",this.element.setAttribute("role","gridcell"),this.element=this.element},u.prototype._configureCell=function(){var e=this,t=e.column.cellEvents,o=e.element,i=this.column.getField();if(o.style.textAlign=e.column.hozAlign,i&&o.setAttribute("tabulator-field",i),e.column.definition.cssClass){var n=e.column.definition.cssClass.split(" ");n.forEach(function(e){o.classList.add(e)})}"hover"===this.table.options.tooltipGenerationMode&&o.addEventListener("mouseenter",function(t){e._generateTooltip()}),e._bindClickEvents(t),e._bindTouchEvents(t),e._bindMouseEvents(t),e.column.modules.edit&&e.table.modules.edit.bindEditor(e),e.column.definition.rowHandle&&e.table.options.movableRows!==!1&&e.table.modExists("moveRow")&&e.table.modules.moveRow.initializeCell(e),e.column.visible||e.hide()},u.prototype._bindClickEvents=function(e){var t=this,o=t.element;(e.cellClick||t.table.options.cellClick)&&o.addEventListener("click",function(o){var i=t.getComponent();e.cellClick&&e.cellClick.call(t.table,o,i),t.table.options.cellClick&&t.table.options.cellClick.call(t.table,o,i)}),(e.cellDblClick||this.table.options.cellDblClick)&&o.addEventListener("dblclick",function(o){var i=t.getComponent();e.cellDblClick&&e.cellDblClick.call(t.table,o,i),t.table.options.cellDblClick&&t.table.options.cellDblClick.call(t.table,o,i)}),(e.cellContext||this.table.options.cellContext)&&o.addEventListener("contextmenu",function(o){var i=t.getComponent();e.cellContext&&e.cellContext.call(t.table,o,i),t.table.options.cellContext&&t.table.options.cellContext.call(t.table,o,i)})},u.prototype._bindMouseEvents=function(e){var t=this,o=t.element;(e.cellMouseEnter||t.table.options.cellMouseEnter)&&o.addEventListener("mouseenter",function(o){var i=t.getComponent();e.cellMouseEnter&&e.cellMouseEnter.call(t.table,o,i),t.table.options.cellMouseEnter&&t.table.options.cellMouseEnter.call(t.table,o,i)}),(e.cellMouseLeave||t.table.options.cellMouseLeave)&&o.addEventListener("mouseleave",function(o){var i=t.getComponent();e.cellMouseLeave&&e.cellMouseLeave.call(t.table,o,i),t.table.options.cellMouseLeave&&t.table.options.cellMouseLeave.call(t.table,o,i)}),(e.cellMouseOver||t.table.options.cellMouseOver)&&o.addEventListener("mouseover",function(o){var i=t.getComponent();e.cellMouseOver&&e.cellMouseOver.call(t.table,o,i),t.table.options.cellMouseOver&&t.table.options.cellMouseOver.call(t.table,o,i)}),(e.cellMouseOut||t.table.options.cellMouseOut)&&o.addEventListener("mouseout",function(o){var i=t.getComponent();e.cellMouseOut&&e.cellMouseOut.call(t.table,o,i),t.table.options.cellMouseOut&&t.table.options.cellMouseOut.call(t.table,o,i)}),(e.cellMouseMove||t.table.options.cellMouseMove)&&o.addEventListener("mousemove",function(o){var i=t.getComponent();e.cellMouseMove&&e.cellMouseMove.call(t.table,o,i),t.table.options.cellMouseMove&&t.table.options.cellMouseMove.call(t.table,o,i)})},u.prototype._bindTouchEvents=function(e){var t,o,i,n=this,s=n.element;(e.cellTap||this.table.options.cellTap)&&(i=!1,s.addEventListener("touchstart",function(e){i=!0}),s.addEventListener("touchend",function(t){if(i){var o=n.getComponent();e.cellTap&&e.cellTap.call(n.table,t,o),n.table.options.cellTap&&n.table.options.cellTap.call(n.table,t,o)}i=!1})),(e.cellDblTap||this.table.options.cellDblTap)&&(t=null,s.addEventListener("touchend",function(o){if(t){clearTimeout(t),t=null;var i=n.getComponent();e.cellDblTap&&e.cellDblTap.call(n.table,o,i),n.table.options.cellDblTap&&n.table.options.cellDblTap.call(n.table,o,i)}else t=setTimeout(function(){clearTimeout(t),t=null},300)})),(e.cellTapHold||this.table.options.cellTapHold)&&(o=null,s.addEventListener("touchstart",function(t){clearTimeout(o),o=setTimeout(function(){clearTimeout(o),o=null,i=!1;var s=n.getComponent();e.cellTapHold&&e.cellTapHold.call(n.table,t,s),n.table.options.cellTapHold&&n.table.options.cellTapHold.call(n.table,t,s)},1e3)}),s.addEventListener("touchend",function(e){clearTimeout(o),o=null}))},u.prototype._generateContents=function(){var e;switch(e=this.table.modExists("format")?this.table.modules.format.formatValue(this):this.element.innerHTML=this.value,"undefined"==typeof e?"undefined":r(e)){case"object":if(e instanceof Node){for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild);this.element.appendChild(e)}else this.element.innerHTML="",null!=e&&console.warn("Format Error - Formatter has returned a type of object, the only valid formatter object return is an instance of Node, the formatter returned:",e);break;case"undefined":case"null":this.element.innerHTML="";break;default:this.element.innerHTML=e}},u.prototype.cellRendered=function(){this.table.modExists("format")&&this.table.modules.format.cellRendered&&this.table.modules.format.cellRendered(this)},u.prototype._generateTooltip=function(){var e=this.column.tooltip;e?(e===!0?e=this.value:"function"==typeof e&&(e=e(this.getComponent()),e===!1&&(e="")),"undefined"==typeof e&&(e=""),this.element.setAttribute("title",e)):this.element.setAttribute("title","")},u.prototype.getElement=function(){return this.element},u.prototype.getValue=function(){return this.value},u.prototype.getOldValue=function(){return this.oldValue},u.prototype.setValue=function(e,t){var o,i=this.setValueProcessData(e,t);i&&(this.table.options.history&&this.table.modExists("history")&&this.table.modules.history.action("cellEdit",this,{oldValue:this.oldValue,newValue:this.value}),o=this.getComponent(),this.column.cellEvents.cellEdited&&this.column.cellEvents.cellEdited.call(this.table,o),this.table.options.cellEdited.call(this.table,o),this.table.options.dataEdited.call(this.table,this.table.rowManager.getData()))},u.prototype.setValueProcessData=function(e,t){var o=!1;return this.value!=e&&(o=!0,t&&this.column.modules.mutate&&(e=this.table.modules.mutator.transformCell(this,e))),this.setValueActual(e),o&&this.table.modExists("columnCalcs")&&(this.column.definition.topCalc||this.column.definition.bottomCalc)&&(this.table.options.groupBy&&this.table.modExists("groupRows")?this.table.modules.columnCalcs.recalcRowGroup(this.row):this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows)),o},u.prototype.setValueActual=function(e){this.oldValue=this.value,this.value=e,this.table.options.reactiveData&&this.table.modExists("reactiveData")&&this.table.modules.reactiveData.block(),this.column.setFieldValue(this.row.data,e),this.table.options.reactiveData&&this.table.modExists("reactiveData")&&this.table.modules.reactiveData.unblock(),this._generateContents(),this._generateTooltip(),this.table.options.resizableColumns&&this.table.modExists("resizeColumns")&&this.table.modules.resizeColumns.initializeColumn("cell",this.column,this.element),this.table.modExists("frozenColumns")&&this.table.modules.frozenColumns.layoutElement(this.element,this.column)},u.prototype.setWidth=function(){this.width=this.column.width,this.element.style.width=this.column.widthStyled},u.prototype.clearWidth=function(){this.width="",this.element.style.width=""},u.prototype.getWidth=function(){return this.width||this.element.offsetWidth},u.prototype.setMinWidth=function(){this.minWidth=this.column.minWidth,this.element.style.minWidth=this.column.minWidthStyled},u.prototype.checkHeight=function(){this.row.reinitializeHeight()},u.prototype.clearHeight=function(){this.element.style.height="",this.height=null},u.prototype.setHeight=function(){this.height=this.row.height,this.element.style.height=this.row.heightStyled},u.prototype.getHeight=function(){return this.height||this.element.offsetHeight},u.prototype.show=function(){this.element.style.display=""},u.prototype.hide=function(){this.element.style.display="none"},u.prototype.edit=function(e){if(this.table.modExists("edit",!0))return this.table.modules.edit.editCell(this,e)},u.prototype.cancelEdit=function(){if(this.table.modExists("edit",!0)){var e=this.table.modules.edit.getCurrentCell();e&&e._getSelf()===this?this.table.modules.edit.cancelEdit():console.warn("Cancel Editor Error - This cell is not currently being edited ")}},u.prototype.delete=function(){this.element.parentNode.removeChild(this.element),this.element=!1,this.column.deleteCell(this),this.row.deleteCell(this),this.calcs={}},u.prototype.nav=function(){var e=this,t=!1,o=this.row.getCellIndex(this);return{next:function(){var t,o=this.right();return!!o||(t=e.table.rowManager.nextDisplayRow(e.row,!0),!(!t||!(o=t.findNextEditableCell(-1)))&&(o.edit(),!0))},prev:function(){var t,o=this.left();return!!o||(t=e.table.rowManager.prevDisplayRow(e.row,!0),!(!t||!(o=t.findPrevEditableCell(t.cells.length)))&&(o.edit(),!0))},left:function(){return t=e.row.findPrevEditableCell(o),!!t&&(t.edit(),!0)},right:function(){return t=e.row.findNextEditableCell(o),!!t&&(t.edit(),!0)},up:function(){var t=e.table.rowManager.prevDisplayRow(e.row,!0);t&&t.cells[o].edit()},down:function(){var t=e.table.rowManager.nextDisplayRow(e.row,!0);t&&t.cells[o].edit()}}},u.prototype.getIndex=function(){this.row.getCellIndex(this)},u.prototype.getComponent=function(){return new l(this)};var c=function(e){this.table=e,this.active=!1,this.element=this.createElement(),this.external=!1,this.links=[],this._initialize()};c.prototype.createElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-footer"),e},c.prototype._initialize=function(e){if(this.table.options.footerElement)switch(r(this.table.options.footerElement)){case"string":"<"===this.table.options.footerElement[0]?this.element.innerHTML=this.table.options.footerElement:(this.external=!0,this.element=document.querySelector(this.table.options.footerElement));break;default:this.element=this.table.options.footerElement}},c.prototype.getElement=function(){return this.element},c.prototype.append=function(e,t){this.activate(t),this.element.appendChild(e),this.table.rowManager.adjustTableSize()},c.prototype.prepend=function(e,t){this.activate(t),this.element.insertBefore(e,this.element.firstChild),this.table.rowManager.adjustTableSize()},c.prototype.remove=function(e){e.parentNode.removeChild(e),this.deactivate()},c.prototype.deactivate=function(e){this.element.firstChild&&!e||(this.external||this.element.parentNode.removeChild(this.element),this.active=!1)},c.prototype.activate=function(e){this.active||(this.active=!0,this.external||(this.table.element.appendChild(this.getElement()),this.table.element.style.display="")),e&&this.links.push(e)},c.prototype.redraw=function(){this.links.forEach(function(e){e.footerRedraw()})};var d=function e(t,o){this.options={},this.columnManager=null,this.rowManager=null,this.footerManager=null,this.browser="",this.browserSlow=!1,this.modules={},this.initializeElement(t),this.initializeOptions(o||{}),this._create(),e.prototype.comms.register(this)};d.prototype.defaultOptions={height:!1,layout:"fitData",layoutColumnsOnNewData:!1,columnMinWidth:40,columnVertAlign:"top",resizableColumns:!0,resizableRows:!1,autoResize:!0,columns:[],data:[],autoColumns:!1,reactiveData:!1,nestedFieldSeparator:".",tooltips:!1,tooltipsHeader:!1,tooltipGenerationMode:"load",initialSort:!1,initialFilter:!1,initialHeaderFilter:!1,columnHeaderSortMulti:!0,sortOrderReverse:!1,footerElement:!1,index:"id",keybindings:[],clipboard:!1,clipboardCopyStyled:!0,clipboardCopySelector:"active",clipboardCopyFormatter:"table",clipboardPasteParser:"table",clipboardPasteAction:"insert",clipboardCopyConfig:!1,clipboardCopied:function(){},clipboardPasted:function(){},clipboardPasteError:function(){},downloadDataFormatter:!1,downloadReady:function(e,t){return t},downloadComplete:!1,downloadConfig:!1,dataTree:!1,dataTreeElementColumn:!1,dataTreeBranchElement:!0,dataTreeChildIndent:9,dataTreeChildField:"_children",dataTreeCollapseElement:!1,dataTreeExpandElement:!1,dataTreeStartExpanded:!1,dataTreeRowExpanded:function(){},dataTreeRowCollapsed:function(){},addRowPos:"bottom",selectable:"highlight",selectableRangeMode:"drag",selectableRollingSelection:!0,selectablePersistence:!0,selectableCheck:function(e,t){return!0},headerFilterPlaceholder:!1,history:!1,locale:!1,langs:{},virtualDom:!0,virtualDomBuffer:0,persistentLayout:!1,persistentSort:!1,persistentFilter:!1,persistenceID:"",persistenceMode:!0,responsiveLayout:!1,responsiveLayoutCollapseStartOpen:!0,responsiveLayoutCollapseUseFormatters:!0,responsiveLayoutCollapseFormatter:!1,pagination:!1,paginationSize:!1,paginationButtonCount:5,paginationSizeSelector:!1,paginationElement:!1,paginationDataSent:{},paginationDataReceived:{},paginationAddRow:"page",ajaxURL:!1,ajaxURLGenerator:!1,ajaxParams:{},ajaxConfig:"get",ajaxContentType:"form",ajaxRequestFunc:!1,ajaxLoader:!0,ajaxLoaderLoading:!1,ajaxLoaderError:!1,ajaxFiltering:!1,ajaxSorting:!1,ajaxProgressiveLoad:!1,ajaxProgressiveLoadDelay:0,ajaxProgressiveLoadScrollMargin:0,groupBy:!1,groupStartOpen:!0,groupValues:!1,groupHeader:!1,movableColumns:!1,movableRows:!1,movableRowsConnectedTables:!1,movableRowsSender:!1,movableRowsReceiver:"insert",movableRowsSendingStart:function(){},movableRowsSent:function(){},movableRowsSentFailed:function(){},movableRowsSendingStop:function(){},movableRowsReceivingStart:function(){},movableRowsReceived:function(){},movableRowsReceivedFailed:function(){},movableRowsReceivingStop:function(){},scrollToRowPosition:"top",scrollToRowIfVisible:!0,scrollToColumnPosition:"left",scrollToColumnIfVisible:!0,rowFormatter:!1,placeholder:!1,tableBuilding:function(){},tableBuilt:function(){},renderStarted:function(){},renderComplete:function(){},rowClick:!1,rowDblClick:!1,rowContext:!1,rowTap:!1,rowDblTap:!1,rowTapHold:!1,rowMouseEnter:!1,rowMouseLeave:!1,rowMouseOver:!1,rowMouseOut:!1,rowMouseMove:!1,rowAdded:function(){},rowDeleted:function(){},rowMoved:function(){},rowUpdated:function(){},rowSelectionChanged:function(){},rowSelected:function(){},rowDeselected:function(){},rowResized:function(){},cellClick:!1,cellDblClick:!1,cellContext:!1,cellTap:!1,cellDblTap:!1,cellTapHold:!1,cellMouseEnter:!1,cellMouseLeave:!1,cellMouseOver:!1,cellMouseOut:!1,cellMouseMove:!1,cellEditing:function(){},cellEdited:function(){},cellEditCancelled:function(){},columnMoved:!1,columnResized:function(){},columnTitleChanged:function(){},columnVisibilityChanged:function(){},htmlImporting:function(){},htmlImported:function(){},dataLoading:function(){},dataLoaded:function(){},dataEdited:function(){},ajaxRequesting:function(){},ajaxResponse:!1,ajaxError:function(){},dataFiltering:!1,dataFiltered:!1,dataSorting:function(){},dataSorted:function(){},groupToggleElement:"arrow",groupClosedShowCalcs:!1,dataGrouping:function(){},dataGrouped:!1,groupVisibilityChanged:function(){},groupClick:!1,groupDblClick:!1,groupContext:!1,groupTap:!1,groupDblTap:!1,groupTapHold:!1,columnCalcs:!0,pageLoaded:function(){},localized:function(){},validationFailed:function(){},historyUndo:function(){},historyRedo:function(){}},d.prototype.initializeOptions=function(e){for(var t in this.defaultOptions)t in e?this.options[t]=e[t]:Array.isArray(this.defaultOptions[t])?this.options[t]=[]:"object"===r(this.defaultOptions[t])?this.options[t]={}:this.options[t]=this.defaultOptions[t]},d.prototype.initializeElement=function(e){return"undefined"!=typeof HTMLElement&&e instanceof HTMLElement?(this.element=e,!0):"string"==typeof e?(this.element=document.querySelector(e),!!this.element||(console.error("Tabulator Creation Error - no element found matching selector: ",e),!1)):(console.error("Tabulator Creation Error - Invalid element provided:",e),!1)},d.prototype._mapDepricatedFunctionality=function(){},d.prototype._create=function(){this._clearObjectPointers(),this._mapDepricatedFunctionality(),this.bindModules(),"TABLE"===this.element.tagName&&this.modExists("htmlTableImport",!0)&&this.modules.htmlTableImport.parseTable(),this.columnManager=new t(this),this.rowManager=new n(this),this.footerManager=new c(this),this.columnManager.setRowManager(this.rowManager),this.rowManager.setColumnManager(this.columnManager),this._buildElement(),this._loadInitialData()},d.prototype._clearObjectPointers=function(){this.options.columns=this.options.columns.slice(0),this.options.reactiveData||(this.options.data=this.options.data.slice(0))},d.prototype._buildElement=function(){var e=this,t=this.element,o=this.modules,i=this.options;for(i.tableBuilding.call(this),t.classList.add("tabulator"),t.setAttribute("role","grid");t.firstChild;)t.removeChild(t.firstChild);i.height&&(i.height=isNaN(i.height)?i.height:i.height+"px",t.style.height=i.height),this.columnManager.initialize(),this.rowManager.initialize(),this._detectBrowser(),this.modExists("layout",!0)&&o.layout.initialize(i.layout),i.headerFilterPlaceholder!==!1&&o.localize.setHeaderFilterPlaceholder(i.headerFilterPlaceholder);for(var n in i.langs)o.localize.installLang(n,i.langs[n]);if(o.localize.setLocale(i.locale),"string"==typeof i.placeholder){var s=document.createElement("div");s.classList.add("tabulator-placeholder");var r=document.createElement("span");r.innerHTML=i.placeholder,s.appendChild(r),i.placeholder=s}if(t.appendChild(this.columnManager.getElement()),t.appendChild(this.rowManager.getElement()),i.footerElement&&this.footerManager.activate(),(i.persistentLayout||i.persistentSort||i.persistentFilter)&&this.modExists("persistence",!0)&&o.persistence.initialize(i.persistenceMode,i.persistenceID),
- i.persistentLayout&&this.modExists("persistence",!0)&&(i.columns=o.persistence.load("columns",i.columns)),i.movableRows&&this.modExists("moveRow")&&o.moveRow.initialize(),i.autoColumns&&this.options.data&&this.columnManager.generateColumnsFromRowData(this.options.data),this.modExists("columnCalcs")&&o.columnCalcs.initialize(),this.columnManager.setColumns(i.columns),i.dataTree&&this.modExists("dataTree",!0)&&o.dataTree.initialize(),this.modExists("frozenRows")&&this.modules.frozenRows.initialize(),(i.persistentSort||i.initialSort)&&this.modExists("sort",!0)){var a=[];i.persistentSort&&this.modExists("persistence",!0)?(a=o.persistence.load("sort"),a===!1&&i.initialSort&&(a=i.initialSort)):i.initialSort&&(a=i.initialSort),o.sort.setSort(a)}if((i.persistentFilter||i.initialFilter)&&this.modExists("filter",!0)){var l=[];i.persistentFilter&&this.modExists("persistence",!0)?(l=o.persistence.load("filter"),l===!1&&i.initialFilter&&(l=i.initialFilter)):i.initialFilter&&(l=i.initialFilter),o.filter.setFilter(l)}i.initialHeaderFilter&&this.modExists("filter",!0)&&i.initialHeaderFilter.forEach(function(t){var i=e.columnManager.findColumn(t.field);return i?void o.filter.setHeaderFilterValue(i,t.value):(console.warn("Column Filter Error - No matching column found:",t.field),!1)}),this.modExists("ajax")&&o.ajax.initialize(),i.pagination&&this.modExists("page",!0)&&o.page.initialize(),i.groupBy&&this.modExists("groupRows",!0)&&o.groupRows.initialize(),this.modExists("keybindings")&&o.keybindings.initialize(),this.modExists("selectRow")&&o.selectRow.clearSelectionData(!0),i.autoResize&&this.modExists("resizeTable")&&o.resizeTable.initialize(),this.modExists("clipboard")&&o.clipboard.initialize(),i.tableBuilt.call(this)},d.prototype._loadInitialData=function(){var e=this;e.options.pagination&&e.modExists("page")?(e.modules.page.reset(!0),"local"==e.options.pagination?e.options.data.length?e.rowManager.setData(e.options.data):(e.options.ajaxURL||e.options.ajaxURLGenerator)&&e.modExists("ajax")?e.modules.ajax.loadData().then(function(){}).catch(function(){}):e.rowManager.setData(e.options.data):e.options.ajaxURL?e.modules.page.setPage(1).then(function(){}).catch(function(){}):e.rowManager.setData([])):e.options.data.length?e.rowManager.setData(e.options.data):(e.options.ajaxURL||e.options.ajaxURLGenerator)&&e.modExists("ajax")?e.modules.ajax.loadData().then(function(){}).catch(function(){}):e.rowManager.setData(e.options.data)},d.prototype.destroy=function(){var e=this.element;for(d.prototype.comms.deregister(this),this.options.reactiveData&&this.modExists("reactiveData",!0)&&this.modules.reactiveData.unwatchData(),this.rowManager.rows.forEach(function(e){e.wipe()}),this.rowManager.rows=[],this.rowManager.activeRows=[],this.rowManager.displayRows=[],this.options.autoResize&&this.modExists("resizeTable")&&this.modules.resizeTable.clearBindings(),this.modExists("keybindings")&&this.modules.keybindings.clearBindings();e.firstChild;)e.removeChild(e.firstChild);e.classList.remove("tabulator")},d.prototype._detectBrowser=function(){var e=navigator.userAgent;e.indexOf("Trident")>-1?(this.browser="ie",this.browserSlow=!0):e.indexOf("Edge")>-1?(this.browser="edge",this.browserSlow=!0):e.indexOf("Firefox")>-1?(this.browser="firefox",this.browserSlow=!1):(this.browser="other",this.browserSlow=!1)},d.prototype.setDataFromLocalFile=function(e){var t=this;return new Promise(function(o,i){var n=document.createElement("input");n.type="file",n.accept=e||".json,application/json",n.addEventListener("change",function(e){var s,r=n.files[0],a=new FileReader;a.readAsText(r),a.onload=function(e){try{s=JSON.parse(a.result)}catch(e){return console.warn("File Load Error - File contents is invalid JSON",e),void i(e)}t._setData(s).then(function(e){o(e)}).catch(function(e){o(e)})},a.onerror=function(e){console.warn("File Load Error - Unable to read file"),i()}}),n.click()})},d.prototype.setData=function(e,t,o){return this.modExists("ajax")&&this.modules.ajax.blockActiveRequest(),this._setData(e,t,o)},d.prototype._setData=function(e,t,o,i){var n=this;return"string"!=typeof e?e?n.rowManager.setData(e,i):n.modExists("ajax")&&(n.modules.ajax.getUrl||n.options.ajaxURLGenerator)?"remote"==n.options.pagination&&n.modExists("page",!0)?(n.modules.page.reset(!0),n.modules.page.setPage(1)):n.modules.ajax.loadData(i):n.rowManager.setData([],i):0==e.indexOf("{")||0==e.indexOf("[")?n.rowManager.setData(JSON.parse(e),i):n.modExists("ajax",!0)?(t&&n.modules.ajax.setParams(t),o&&n.modules.ajax.setConfig(o),n.modules.ajax.setUrl(e),"remote"==n.options.pagination&&n.modExists("page",!0)?(n.modules.page.reset(!0),n.modules.page.setPage(1)):n.modules.ajax.loadData(i)):void 0},d.prototype.clearData=function(){this.modExists("ajax")&&this.modules.ajax.blockActiveRequest(),this.rowManager.clearData()},d.prototype.getData=function(e){return this.rowManager.getData(e)},d.prototype.getDataCount=function(e){return this.rowManager.getDataCount(e)},d.prototype.searchRows=function(e,t,o){if(this.modExists("filter",!0))return this.modules.filter.search("rows",e,t,o)},d.prototype.searchData=function(e,t,o){if(this.modExists("filter",!0))return this.modules.filter.search("data",e,t,o)},d.prototype.getHtml=function(e){return this.rowManager.getHtml(e)},d.prototype.getAjaxUrl=function(){if(this.modExists("ajax",!0))return this.modules.ajax.getUrl()},d.prototype.replaceData=function(e,t,o){return this.modExists("ajax")&&this.modules.ajax.blockActiveRequest(),this._setData(e,t,o,!0)},d.prototype.updateData=function(e){var t=this,o=this,i=0;return new Promise(function(n,s){t.modExists("ajax")&&t.modules.ajax.blockActiveRequest(),"string"==typeof e&&(e=JSON.parse(e)),e?e.forEach(function(e){var t=o.rowManager.findRow(e[o.options.index]);t&&(i++,t.updateData(e).then(function(){i--,i||n()}))}):(console.warn("Update Error - No data provided"),s("Update Error - No data provided"))})},d.prototype.addData=function(e,t,o){var i=this;return new Promise(function(n,s){i.modExists("ajax")&&i.modules.ajax.blockActiveRequest(),"string"==typeof e&&(e=JSON.parse(e)),e?i.rowManager.addRows(e,t,o).then(function(e){var t=[];e.forEach(function(e){t.push(e.getComponent())}),n(t)}):(console.warn("Update Error - No data provided"),s("Update Error - No data provided"))})},d.prototype.updateOrAddData=function(e){var t=this,o=this,i=[],n=0;return new Promise(function(s,r){t.modExists("ajax")&&t.modules.ajax.blockActiveRequest(),"string"==typeof e&&(e=JSON.parse(e)),e?e.forEach(function(e){var t=o.rowManager.findRow(e[o.options.index]);n++,t?t.updateData(e).then(function(){n--,i.push(t.getComponent()),n||s(i)}):o.rowManager.addRows(e).then(function(e){n--,i.push(e[0].getComponent()),n||s(i)})}):(console.warn("Update Error - No data provided"),r("Update Error - No data provided"))})},d.prototype.getRow=function(e){var t=this.rowManager.findRow(e);return t?t.getComponent():(console.warn("Find Error - No matching row found:",e),!1)},d.prototype.getRowFromPosition=function(e,t){var o=this.rowManager.getRowFromPosition(e,t);return o?o.getComponent():(console.warn("Find Error - No matching row found:",e),!1)},d.prototype.deleteRow=function(e){var t=this;return new Promise(function(o,i){var n=t.rowManager.findRow(e);n?n.delete().then(function(){o()}).catch(function(e){i(e)}):(console.warn("Delete Error - No matching row found:",e),i("Delete Error - No matching row found"))})},d.prototype.addRow=function(e,t,o){var i=this;return new Promise(function(n,s){"string"==typeof e&&(e=JSON.parse(e)),i.rowManager.addRows(e,t,o).then(function(e){i.modExists("columnCalcs")&&i.modules.columnCalcs.recalc(i.rowManager.activeRows),n(e[0].getComponent())})})},d.prototype.updateOrAddRow=function(e,t){var o=this;return new Promise(function(i,n){var s=o.rowManager.findRow(e);"string"==typeof t&&(t=JSON.parse(t)),s?s.updateData(t).then(function(){o.modExists("columnCalcs")&&o.modules.columnCalcs.recalc(o.rowManager.activeRows),i(s.getComponent())}).catch(function(e){n(e)}):s=o.rowManager.addRows(t).then(function(e){o.modExists("columnCalcs")&&o.modules.columnCalcs.recalc(o.rowManager.activeRows),i(e[0].getComponent())}).catch(function(e){n(e)})})},d.prototype.updateRow=function(e,t){var o=this;return new Promise(function(i,n){var s=o.rowManager.findRow(e);"string"==typeof t&&(t=JSON.parse(t)),s?s.updateData(t).then(function(){i(s.getComponent())}).catch(function(e){n(e)}):(console.warn("Update Error - No matching row found:",e),n("Update Error - No matching row found"))})},d.prototype.scrollToRow=function(e,t,o){var i=this;return new Promise(function(n,s){var r=i.rowManager.findRow(e);r?i.rowManager.scrollToRow(r,t,o).then(function(){n()}).catch(function(e){s(e)}):(console.warn("Scroll Error - No matching row found:",e),s("Scroll Error - No matching row found"))})},d.prototype.moveRow=function(e,t,o){var i=this.rowManager.findRow(e);i?i.moveToRow(t,o):console.warn("Move Error - No matching row found:",e)},d.prototype.getRows=function(e){return this.rowManager.getComponents(e)},d.prototype.getRowPosition=function(e,t){var o=this.rowManager.findRow(e);return o?this.rowManager.getRowPosition(o,t):(console.warn("Position Error - No matching row found:",e),!1)},d.prototype.copyToClipboard=function(e,t,o,i){this.modExists("clipboard",!0)&&this.modules.clipboard.copy(e,t,o,i)},d.prototype.setColumns=function(e){this.columnManager.setColumns(e)},d.prototype.getColumns=function(e){return this.columnManager.getComponents(e)},d.prototype.getColumn=function(e){var t=this.columnManager.findColumn(e);return t?t.getComponent():(console.warn("Find Error - No matching column found:",e),!1)},d.prototype.getColumnDefinitions=function(){return this.columnManager.getDefinitionTree()},d.prototype.getColumnLayout=function(){if(this.modExists("persistence",!0))return this.modules.persistence.parseColumns(this.columnManager.getColumns())},d.prototype.setColumnLayout=function(e){return!!this.modExists("persistence",!0)&&(this.columnManager.setColumns(this.modules.persistence.mergeDefinition(this.options.columns,e)),!0)},d.prototype.showColumn=function(e){var t=this.columnManager.findColumn(e);return t?(t.show(),void(this.options.responsiveLayout&&this.modExists("responsiveLayout",!0)&&this.modules.responsiveLayout.update())):(console.warn("Column Show Error - No matching column found:",e),!1)},d.prototype.hideColumn=function(e){var t=this.columnManager.findColumn(e);return t?(t.hide(),void(this.options.responsiveLayout&&this.modExists("responsiveLayout",!0)&&this.modules.responsiveLayout.update())):(console.warn("Column Hide Error - No matching column found:",e),!1)},d.prototype.toggleColumn=function(e){var t=this.columnManager.findColumn(e);return t?void(t.visible?t.hide():t.show()):(console.warn("Column Visibility Toggle Error - No matching column found:",e),!1)},d.prototype.addColumn=function(e,t,o){var i=this.columnManager.findColumn(o);this.columnManager.addColumn(e,t,i)},d.prototype.deleteColumn=function(e){var t=this.columnManager.findColumn(e);return t?void t.delete():(console.warn("Column Delete Error - No matching column found:",e),!1)},d.prototype.scrollToColumn=function(e,t,o){var i=this;return new Promise(function(n,s){var r=i.columnManager.findColumn(e);r?i.columnManager.scrollToColumn(r,t,o).then(function(){n()}).catch(function(e){s(e)}):(console.warn("Scroll Error - No matching column found:",e),s("Scroll Error - No matching column found"))})},d.prototype.setLocale=function(e){this.modules.localize.setLocale(e)},d.prototype.getLocale=function(){return this.modules.localize.getLocale()},d.prototype.getLang=function(e){return this.modules.localize.getLang(e)},d.prototype.redraw=function(e){this.columnManager.redraw(e),this.rowManager.redraw(e)},d.prototype.setHeight=function(e){this.options.height=isNaN(e)?e:e+"px",this.element.style.height=this.options.height,this.rowManager.redraw()},d.prototype.setSort=function(e,t){this.modExists("sort",!0)&&(this.modules.sort.setSort(e,t),this.rowManager.sorterRefresh())},d.prototype.getSorters=function(){if(this.modExists("sort",!0))return this.modules.sort.getSort()},d.prototype.clearSort=function(){this.modExists("sort",!0)&&(this.modules.sort.clear(),this.rowManager.sorterRefresh())},d.prototype.setFilter=function(e,t,o){this.modExists("filter",!0)&&(this.modules.filter.setFilter(e,t,o),this.rowManager.filterRefresh())},d.prototype.addFilter=function(e,t,o){this.modExists("filter",!0)&&(this.modules.filter.addFilter(e,t,o),this.rowManager.filterRefresh())},d.prototype.getFilters=function(e){if(this.modExists("filter",!0))return this.modules.filter.getFilters(e)},d.prototype.setHeaderFilterFocus=function(e){if(this.modExists("filter",!0)){var t=this.columnManager.findColumn(e);if(!t)return console.warn("Column Filter Focus Error - No matching column found:",e),!1;this.modules.filter.setHeaderFilterFocus(t)}},d.prototype.setHeaderFilterValue=function(e,t){if(this.modExists("filter",!0)){var o=this.columnManager.findColumn(e);if(!o)return console.warn("Column Filter Error - No matching column found:",e),!1;this.modules.filter.setHeaderFilterValue(o,t)}},d.prototype.getHeaderFilters=function(){if(this.modExists("filter",!0))return this.modules.filter.getHeaderFilters()},d.prototype.removeFilter=function(e,t,o){this.modExists("filter",!0)&&(this.modules.filter.removeFilter(e,t,o),this.rowManager.filterRefresh())},d.prototype.clearFilter=function(e){this.modExists("filter",!0)&&(this.modules.filter.clearFilter(e),this.rowManager.filterRefresh())},d.prototype.clearHeaderFilter=function(){this.modExists("filter",!0)&&(this.modules.filter.clearHeaderFilter(),this.rowManager.filterRefresh())},d.prototype.selectRow=function(e){this.modExists("selectRow",!0)&&this.modules.selectRow.selectRows(e)},d.prototype.deselectRow=function(e){this.modExists("selectRow",!0)&&this.modules.selectRow.deselectRows(e)},d.prototype.toggleSelectRow=function(e){this.modExists("selectRow",!0)&&this.modules.selectRow.toggleRow(e)},d.prototype.getSelectedRows=function(){if(this.modExists("selectRow",!0))return this.modules.selectRow.getSelectedRows()},d.prototype.getSelectedData=function(){if(this.modExists("selectRow",!0))return this.modules.selectRow.getSelectedData()},d.prototype.setMaxPage=function(e){return!(!this.options.pagination||!this.modExists("page"))&&void this.modules.page.setMaxPage(e)},d.prototype.setPage=function(e){return this.options.pagination&&this.modExists("page")?this.modules.page.setPage(e):new Promise(function(e,t){t()})},d.prototype.setPageToRow=function(e){var t=this;return new Promise(function(o,i){t.options.pagination&&t.modExists("page")?(e=t.rowManager.findRow(e),e?t.modules.page.setPageToRow(e).then(function(){o()}).catch(function(){i()}):i()):i()})},d.prototype.setPageSize=function(e){return!(!this.options.pagination||!this.modExists("page"))&&(this.modules.page.setPageSize(e),void this.modules.page.setPage(1).then(function(){}).catch(function(){}))},d.prototype.getPageSize=function(){if(this.options.pagination&&this.modExists("page",!0))return this.modules.page.getPageSize()},d.prototype.previousPage=function(){return!(!this.options.pagination||!this.modExists("page"))&&void this.modules.page.previousPage()},d.prototype.nextPage=function(){return!(!this.options.pagination||!this.modExists("page"))&&void this.modules.page.nextPage()},d.prototype.getPage=function(){return!(!this.options.pagination||!this.modExists("page"))&&this.modules.page.getPage()},d.prototype.getPageMax=function(){return!(!this.options.pagination||!this.modExists("page"))&&this.modules.page.getPageMax()},d.prototype.setGroupBy=function(e){return!!this.modExists("groupRows",!0)&&(this.options.groupBy=e,this.modules.groupRows.initialize(),this.rowManager.refreshActiveData("display"),void 0)},d.prototype.setGroupStartOpen=function(e){return!!this.modExists("groupRows",!0)&&(this.options.groupStartOpen=e,this.modules.groupRows.initialize(),this.options.groupBy?this.rowManager.refreshActiveData("group"):console.warn("Grouping Update - cant refresh view, no groups have been set"),void 0)},d.prototype.setGroupHeader=function(e){return!!this.modExists("groupRows",!0)&&(this.options.groupHeader=e,this.modules.groupRows.initialize(),this.options.groupBy?this.rowManager.refreshActiveData("group"):console.warn("Grouping Update - cant refresh view, no groups have been set"),void 0)},d.prototype.getGroups=function(e){return!!this.modExists("groupRows",!0)&&this.modules.groupRows.getGroups(!0)},d.prototype.getGroupedData=function(){if(this.modExists("groupRows",!0))return this.options.groupBy?this.modules.groupRows.getGroupedData():this.getData()},d.prototype.getCalcResults=function(){return!!this.modExists("columnCalcs",!0)&&this.modules.columnCalcs.getResults()},d.prototype.navigatePrev=function(){var e=!1;return!(!this.modExists("edit",!0)||!(e=this.modules.edit.currentCell))&&e.nav().prev()},d.prototype.navigateNext=function(){var e=!1;return!(!this.modExists("edit",!0)||!(e=this.modules.edit.currentCell))&&e.nav().next()},d.prototype.navigateLeft=function(){var t=!1;return!(!this.modExists("edit",!0)||!(t=this.modules.edit.currentCell))&&(e.preventDefault(),t.nav().left())},d.prototype.navigateRight=function(){var t=!1;return!(!this.modExists("edit",!0)||!(t=this.modules.edit.currentCell))&&(e.preventDefault(),t.nav().right())},d.prototype.navigateUp=function(){var t=!1;return!(!this.modExists("edit",!0)||!(t=this.modules.edit.currentCell))&&(e.preventDefault(),t.nav().up())},d.prototype.navigateDown=function(){var t=!1;return!(!this.modExists("edit",!0)||!(t=this.modules.edit.currentCell))&&(e.preventDefault(),t.nav().dpwn())},d.prototype.undo=function(){return!(!this.options.history||!this.modExists("history",!0))&&this.modules.history.undo()},d.prototype.redo=function(){return!(!this.options.history||!this.modExists("history",!0))&&this.modules.history.redo()},d.prototype.getHistoryUndoSize=function(){return!(!this.options.history||!this.modExists("history",!0))&&this.modules.history.getHistoryUndoSize()},d.prototype.getHistoryRedoSize=function(){return!(!this.options.history||!this.modExists("history",!0))&&this.modules.history.getHistoryRedoSize()},d.prototype.download=function(e,t,o){this.modExists("download",!0)&&this.modules.download.download(e,t,o)},d.prototype.downloadToTab=function(e,t,o){this.modExists("download",!0)&&this.modules.download.download(e,t,o,!0)},d.prototype.tableComms=function(e,t,o,i){this.modules.comms.receive(e,t,o,i)},d.prototype.moduleBindings={},d.prototype.extendModule=function(e,t,o){if(d.prototype.moduleBindings[e]){var i=d.prototype.moduleBindings[e].prototype[t];if(i)if("object"==("undefined"==typeof o?"undefined":r(o)))for(var n in o)i[n]=o[n];else console.warn("Module Error - Invalid value type, it must be an object");else console.warn("Module Error - property does not exist:",t)}else console.warn("Module Error - module does not exist:",e)},d.prototype.registerModule=function(e,t){d.prototype.moduleBindings[e]=t},d.prototype.bindModules=function(){this.modules={};for(var e in d.prototype.moduleBindings)this.modules[e]=new d.prototype.moduleBindings[e](this)},d.prototype.modExists=function(e,t){return!!this.modules[e]||(t&&console.error("Tabulator Module Not Installed: "+e),!1)},d.prototype.helpers={elVisible:function(e){return!(e.offsetWidth<=0&&e.offsetHeight<=0)},elOffset:function(e){var t=e.getBoundingClientRect();return{top:t.top+window.pageYOffset-document.documentElement.clientTop,left:t.left+window.pageXOffset-document.documentElement.clientLeft}},deepClone:function(e){var t=Array.isArray(e)?[]:{};for(var o in e)null!=e[o]&&"object"===r(e[o])?e[o]instanceof Date?t[o]=new Date(e[o]):t[o]=this.deepClone(e[o]):t[o]=e[o];return t}},d.prototype.comms={tables:[],register:function(e){d.prototype.comms.tables.push(e)},deregister:function(e){var t=d.prototype.comms.tables.indexOf(e);t>-1&&d.prototype.comms.tables.splice(t,1)},lookupTable:function(e){var t,o,i=[];if("string"==typeof e){if(t=document.querySelectorAll(e),t.length)for(var n=0;n<t.length;n++)o=d.prototype.comms.matchElement(t[n]),o&&i.push(o)}else"undefined"!=typeof HTMLElement&&e instanceof HTMLElement||e instanceof d?(o=d.prototype.comms.matchElement(e),o&&i.push(o)):Array.isArray(e)?e.forEach(function(e){i=i.concat(d.prototype.comms.lookupTable(e))}):console.warn("Table Connection Error - Invalid Selector",e);return i},matchElement:function(e){return d.prototype.comms.tables.find(function(t){return e instanceof d?t===e:t.element===e})}};var h=function(e){this.table=e,this.mode=null};h.prototype.initialize=function(e){this.modes[e]?this.mode=e:(console.warn("Layout Error - invalid mode set, defaulting to 'fitData' : "+e),this.mode="fitData"),this.table.element.setAttribute("tabulator-layout",this.mode)},h.prototype.getMode=function(){return this.mode},h.prototype.layout=function(){this.modes[this.mode].call(this,this.table.columnManager.columnsByIndex)},h.prototype.modes={fitData:function(e){e.forEach(function(e){e.reinitializeWidth()}),this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.update()},fitDataFill:function(e){e.forEach(function(e){e.reinitializeWidth()}),this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.update()},fitColumns:function(e){function t(e){var t;return t="string"==typeof e?e.indexOf("%")>-1?n/100*parseInt(e):parseInt(e):e}function o(e,i,n,s){function r(e){return n*(e.column.definition.widthGrow||1)}function a(e){return t(e.width)-n*(e.column.definition.widthShrink||0)}var l=[],u=0,c=0,d=0,h=0,p=0,m=[];return e.forEach(function(e,t){var o=s?a(e):r(e);e.column.minWidth>=o?l.push(e):(m.push(e),p+=s?e.column.definition.widthShrink||1:e.column.definition.widthGrow||1)}),l.length?(l.forEach(function(e){u+=s?e.width-e.column.minWidth:e.column.minWidth,e.width=e.column.minWidth}),c=i-u,d=p?Math.floor(c/p):c,h=c-d*p,h+=o(m,c,d,s)):(h=p?i-Math.floor(i/p)*p:i,m.forEach(function(e){e.width=s?a(e):r(e)})),h}var i=this,n=i.table.element.clientWidth,s=0,r=0,a=0,l=0,u=[],c=[],d=0,h=0,p=0;this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.update(),this.table.rowManager.element.scrollHeight>this.table.rowManager.element.clientHeight&&(n-=this.table.rowManager.element.offsetWidth-this.table.rowManager.element.clientWidth),e.forEach(function(e){var o,i,n;e.visible&&(o=e.definition.width,i=parseInt(e.minWidth),o?(n=t(o),s+=n>i?n:i,e.definition.widthShrink&&(c.push({column:e,width:n>i?n:i}),d+=e.definition.widthShrink)):(u.push({column:e,width:0}),a+=e.definition.widthGrow||1))}),r=n-s,l=Math.floor(r/a);var p=o(u,r,l,!1);u.length&&p>0&&(u[u.length-1].width+=+p),u.forEach(function(e){r-=e.width}),h=Math.abs(p)+r,h>0&&d&&(p=o(c,h,Math.floor(h/d),!0)),c.length&&(c[c.length-1].width-=p),u.forEach(function(e){e.column.setWidth(e.width)}),c.forEach(function(e){e.column.setWidth(e.width)})}},d.prototype.registerModule("layout",h);var p=function(e){this.table=e,this.locale="default",this.lang=!1,this.bindings={}};p.prototype.setHeaderFilterPlaceholder=function(e){this.langs.default.headerFilters.default=e},p.prototype.setHeaderFilterColumnPlaceholder=function(e,t){this.langs.default.headerFilters.columns[e]=t,this.lang&&!this.lang.headerFilters.columns[e]&&(this.lang.headerFilters.columns[e]=t)},p.prototype.installLang=function(e,t){this.langs[e]?this._setLangProp(this.langs[e],t):this.langs[e]=t},p.prototype._setLangProp=function(e,t){for(var o in t)e[o]&&"object"==r(e[o])?this._setLangProp(e[o],t[o]):e[o]=t[o]},p.prototype.setLocale=function(e){function t(e,o){for(var i in e)"object"==r(e[i])?(o[i]||(o[i]={}),t(e[i],o[i])):o[i]=e[i]}var o=this;if(e=e||"default",e===!0&&navigator.language&&(e=navigator.language.toLowerCase()),e&&!o.langs[e]){var i=e.split("-")[0];o.langs[i]?(console.warn("Localization Error - Exact matching locale not found, using closest match: ",e,i),e=i):(console.warn("Localization Error - Matching locale not found, using default: ",e),e="default")}o.locale=e,o.lang=d.prototype.helpers.deepClone(o.langs.default||{}),"default"!=e&&t(o.langs[e],o.lang),o.table.options.localized.call(o.table,o.locale,o.lang),o._executeBindings()},p.prototype.getLocale=function(e){return self.locale},p.prototype.getLang=function(e){return e?this.langs[e]:this.lang},p.prototype.getText=function(e,t){var e=t?e+"|"+t:e,o=e.split("|"),i=this._getLangElement(o,this.locale);return i||""},p.prototype._getLangElement=function(e,t){var o=this,i=o.lang;return e.forEach(function(e){var t;i&&(t=i[e],i="undefined"!=typeof t&&t)}),i},p.prototype.bind=function(e,t){this.bindings[e]||(this.bindings[e]=[]),this.bindings[e].push(t),t(this.getText(e),this.lang)},p.prototype._executeBindings=function(){var e=this,t=function(t){e.bindings[t].forEach(function(o){o(e.getText(t),e.lang)})};for(var o in e.bindings)t(o)},p.prototype.langs={default:{groups:{item:"item",items:"items"},columns:{},ajax:{loading:"Loading",error:"Error"},pagination:{page_size:"Page Size",first:"First",first_title:"First Page",last:"Last",last_title:"Last Page",prev:"Prev",prev_title:"Prev Page",next:"Next",next_title:"Next Page"},headerFilters:{default:"filter column...",columns:{}}}},d.prototype.registerModule("localize",p);var m=function(e){this.table=e};m.prototype.getConnections=function(e){var t,o=this,i=[];return t=d.prototype.comms.lookupTable(e),t.forEach(function(e){o.table!==e&&i.push(e)}),i},m.prototype.send=function(e,t,o,i){var n=this,s=this.getConnections(e);s.forEach(function(e){e.tableComms(n.table.element,t,o,i)}),!s.length&&e&&console.warn("Table Connection Error - No tables matching selector found",e)},m.prototype.receive=function(e,t,o,i){return this.table.modExists(t)?this.table.modules[t].commsReceived(e,o,i):void console.warn("Inter-table Comms Error - no such module:",t)},d.prototype.registerModule("comms",m);var f=function(e){this.table=e,this.allowedTypes=["","data","download","clipboard"]};f.prototype.initializeColumn=function(e){var t=this,o=!1,i={};this.allowedTypes.forEach(function(n){var s,r="accessor"+(n.charAt(0).toUpperCase()+n.slice(1));e.definition[r]&&(s=t.lookupAccessor(e.definition[r]),s&&(o=!0,i[r]={accessor:s,params:e.definition[r+"Params"]||{}}))}),o&&(e.modules.accessor=i)},f.prototype.lookupAccessor=function(e){var t=!1;switch("undefined"==typeof e?"undefined":r(e)){case"string":this.accessors[e]?t=this.accessors[e]:console.warn("Accessor Error - No such accessor found, ignoring: ",e);break;case"function":t=e}return t},f.prototype.transformRow=function(e,t){var o=this,i="accessor"+(t.charAt(0).toUpperCase()+t.slice(1)),n=d.prototype.helpers.deepClone(e||{});return o.table.columnManager.traverse(function(e){var o,s,r,a;e.modules.accessor&&(s=e.modules.accessor[i]||e.modules.accessor.accessor||!1,s&&(o=e.getFieldValue(n),"undefined"!=o&&(a=e.getComponent(),r="function"==typeof s.params?s.params(o,n,t,a):s.params,e.setFieldValue(n,s.accessor(o,n,t,r,a)))))}),n},f.prototype.accessors={},d.prototype.registerModule("accessor",f);var g=function(e){this.table=e,this.config=!1,this.url="",this.urlGenerator=!1,this.params=!1,this.loaderElement=this.createLoaderElement(),this.msgElement=this.createMsgElement(),this.loadingElement=!1,this.errorElement=!1,this.loaderPromise=!1,this.progressiveLoad=!1,this.loading=!1,this.requestOrder=0};g.prototype.initialize=function(){var e;this.loaderElement.appendChild(this.msgElement),this.table.options.ajaxLoaderLoading&&("string"==typeof this.table.options.ajaxLoaderLoading?(e=document.createElement("template"),e.innerHTML=this.table.options.ajaxLoaderLoading.trim(),this.loadingElement=e.content.firstChild):this.loadingElement=this.table.options.ajaxLoaderLoading),this.loaderPromise=this.table.options.ajaxRequestFunc||this.defaultLoaderPromise,this.urlGenerator=this.table.options.ajaxURLGenerator||this.defaultURLGenerator,this.table.options.ajaxLoaderError&&("string"==typeof this.table.options.ajaxLoaderError?(e=document.createElement("template"),e.innerHTML=this.table.options.ajaxLoaderError.trim(),this.errorElement=e.content.firstChild):this.errorElement=this.table.options.ajaxLoaderError),this.table.options.ajaxParams&&this.setParams(this.table.options.ajaxParams),this.table.options.ajaxConfig&&this.setConfig(this.table.options.ajaxConfig),this.table.options.ajaxURL&&this.setUrl(this.table.options.ajaxURL),this.table.options.ajaxProgressiveLoad&&(this.table.options.pagination?(this.progressiveLoad=!1,console.error("Progressive Load Error - Pagination and progressive load cannot be used at the same time")):this.table.modExists("page")?(this.progressiveLoad=this.table.options.ajaxProgressiveLoad,this.table.modules.page.initializeProgressive(this.progressiveLoad)):console.error("Pagination plugin is required for progressive ajax loading"))},g.prototype.createLoaderElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-loader"),e},g.prototype.createMsgElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-loader-msg"),e.setAttribute("role","alert"),e},g.prototype.setParams=function(e,t){if(t){this.params=this.params||{};for(var o in e)this.params[o]=e[o]}else this.params=e},g.prototype.getParams=function(){return this.params||{}},g.prototype.setConfig=function(e){if(this._loadDefaultConfig(),"string"==typeof e)this.config.method=e;else for(var t in e)this.config[t]=e[t]},g.prototype._loadDefaultConfig=function(e){var t=this;if(!t.config||e){t.config={};for(var o in t.defaultConfig)t.config[o]=t.defaultConfig[o]}},g.prototype.setUrl=function(e){this.url=e},g.prototype.getUrl=function(){return this.url},g.prototype.loadData=function(e){return this.progressiveLoad?this._loadDataProgressive():this._loadDataStandard(e)},g.prototype.nextPage=function(e){var t;this.loading||(t=this.table.options.ajaxProgressiveLoadScrollMargin||2*this.table.rowManager.getElement().clientHeight,e<t&&this.table.modules.page.nextPage().then(function(){}).catch(function(){}))},g.prototype.blockActiveRequest=function(){this.requestOrder++},g.prototype._loadDataProgressive=function(){return this.table.rowManager.setData([]),this.table.modules.page.setPage(1)},g.prototype._loadDataStandard=function(e){var t=this;return new Promise(function(o,i){t.sendRequest(e).then(function(n){t.table.rowManager.setData(n,e).then(function(){o()}).catch(function(e){i(e)})}).catch(function(e){i(e)})})},g.prototype.generateParamsList=function(e,t){var o=this,i=[];if(t=t||"",Array.isArray(e))e.forEach(function(e,n){i=i.concat(o.generateParamsList(e,t?t+"["+n+"]":n))});else if("object"===("undefined"==typeof e?"undefined":r(e)))for(var n in e)i=i.concat(o.generateParamsList(e[n],t?t+"["+n+"]":n));else i.push({key:t,value:e});return i},g.prototype.serializeParams=function(e){var t=this.generateParamsList(e),o=[];return t.forEach(function(e){o.push(encodeURIComponent(e.key)+"="+encodeURIComponent(e.value))}),o.join("&")},g.prototype.sendRequest=function(e){var t,o=this,i=this,n=i.url;return i.requestOrder++,t=i.requestOrder,i._loadDefaultConfig(),new Promise(function(s,r){i.table.options.ajaxRequesting.call(o.table,i.url,i.params)!==!1?(i.loading=!0,e||i.showLoader(),o.loaderPromise(n,i.config,i.params).then(function(e){t===i.requestOrder?(i.table.options.ajaxResponse&&(e=i.table.options.ajaxResponse.call(i.table,i.url,i.params,e)),s(e)):console.warn("Ajax Response Blocked - An active ajax request was blocked by an attempt to change table data while the request was being made"),i.hideLoader(),i.loading=!1}).catch(function(e){console.error("Ajax Load Error: ",e),i.table.options.ajaxError.call(i.table,e),i.showError(),setTimeout(function(){i.hideLoader()},3e3),i.loading=!1,r()})):r()})},g.prototype.showLoader=function(){var e="function"==typeof this.table.options.ajaxLoader?this.table.options.ajaxLoader():this.table.options.ajaxLoader;if(e){for(this.hideLoader();this.msgElement.firstChild;)this.msgElement.removeChild(this.msgElement.firstChild);
- this.msgElement.classList.remove("tabulator-error"),this.msgElement.classList.add("tabulator-loading"),this.loadingElement?this.msgElement.appendChild(this.loadingElement):this.msgElement.innerHTML=this.table.modules.localize.getText("ajax|loading"),this.table.element.appendChild(this.loaderElement)}},g.prototype.showError=function(){for(this.hideLoader();this.msgElement.firstChild;)this.msgElement.removeChild(this.msgElement.firstChild);this.msgElement.classList.remove("tabulator-loading"),this.msgElement.classList.add("tabulator-error"),this.errorElement?this.msgElement.appendChild(this.errorElement):this.msgElement.innerHTML=this.table.modules.localize.getText("ajax|error"),this.table.element.appendChild(this.loaderElement)},g.prototype.hideLoader=function(){this.loaderElement.parentNode&&this.loaderElement.parentNode.removeChild(this.loaderElement)},g.prototype.defaultConfig={method:"GET"},g.prototype.defaultURLGenerator=function(e,t,o){return e&&o&&Object.keys(o).length&&(t.method&&"get"!=t.method.toLowerCase()||(t.method="get",e+="?"+this.serializeParams(o))),e},g.prototype.defaultLoaderPromise=function(e,t,o){var i,n=this;return new Promise(function(s,a){if(e=n.urlGenerator(e,t,o),"GET"!=t.method.toUpperCase())if(i="object"===r(n.table.options.ajaxContentType)?n.table.options.ajaxContentType:n.contentTypeFormatters[n.table.options.ajaxContentType]){for(var l in i.headers)t.headers||(t.headers={}),"undefined"==typeof t.headers[l]&&(t.headers[l]=i.headers[l]);t.body=i.body.call(n,e,t,o)}else console.warn("Ajax Error - Invalid ajaxContentType value:",n.table.options.ajaxContentType);e?("undefined"==typeof t.headers&&(t.headers={}),"undefined"==typeof t.headers.Accept&&(t.headers.Accept="application/json"),"undefined"==typeof t.headers["X-Requested-With"]&&(t.headers["X-Requested-With"]="XMLHttpRequest"),"undefined"==typeof t.mode&&(t.mode="cors"),"cors"==t.mode?("undefined"==typeof t.headers["Access-Control-Allow-Origin"]&&(t.headers["Access-Control-Allow-Origin"]=window.location.origin),"undefined"==typeof t.credentials&&(t.credentials="same-origin")):"undefined"==typeof t.credentials&&(t.credentials="include"),fetch(e,t).then(function(e){e.ok?e.json().then(function(e){s(e)}).catch(function(e){a(e),console.warn("Ajax Load Error - Invalid JSON returned",e)}):(console.error("Ajax Load Error - Connection Error: "+e.status,e.statusText),a(e))}).catch(function(e){console.error("Ajax Load Error - Connection Error: ",e),a(e)})):(console.warn("Ajax Load Error - No URL Set"),s([]))})},g.prototype.contentTypeFormatters={json:{headers:{"Content-Type":"application/json"},body:function(e,t,o){return JSON.stringify(o)}},form:{headers:{},body:function(e,t,o){var i=this.generateParamsList(o),n=new FormData;return i.forEach(function(e){n.append(e.key,e.value)}),n}}},d.prototype.registerModule("ajax",g);var b=function(e){this.table=e,this.topCalcs=[],this.botCalcs=[],this.genColumn=!1,this.topElement=this.createElement(),this.botElement=this.createElement(),this.topRow=!1,this.botRow=!1,this.topInitialized=!1,this.botInitialized=!1,this.initialize()};b.prototype.createElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-calcs-holder"),e},b.prototype.initialize=function(){this.genColumn=new i({field:"value"},this)},b.prototype.registerColumnField=function(){},b.prototype.initializeColumn=function(e){var t=e.definition,o={topCalcParams:t.topCalcParams||{},botCalcParams:t.bottomCalcParams||{}};if(t.topCalc){switch(r(t.topCalc)){case"string":this.calculations[t.topCalc]?o.topCalc=this.calculations[t.topCalc]:console.warn("Column Calc Error - No such calculation found, ignoring: ",t.topCalc);break;case"function":o.topCalc=t.topCalc}o.topCalc&&(e.modules.columnCalcs=o,this.topCalcs.push(e),"group"!=this.table.options.columnCalcs&&this.initializeTopRow())}if(t.bottomCalc){switch(r(t.bottomCalc)){case"string":this.calculations[t.bottomCalc]?o.botCalc=this.calculations[t.bottomCalc]:console.warn("Column Calc Error - No such calculation found, ignoring: ",t.bottomCalc);break;case"function":o.botCalc=t.bottomCalc}o.botCalc&&(e.modules.columnCalcs=o,this.botCalcs.push(e),"group"!=this.table.options.columnCalcs&&this.initializeBottomRow())}},b.prototype.removeCalcs=function(){var e=!1;this.topInitialized&&(this.topInitialized=!1,this.topElement.parentNode.removeChild(this.topElement),e=!0),this.botInitialized&&(this.botInitialized=!1,this.table.footerManager.remove(this.botElement),e=!0),e&&this.table.rowManager.adjustTableSize()},b.prototype.initializeTopRow=function(){this.topInitialized||(this.table.columnManager.getElement().insertBefore(this.topElement,this.table.columnManager.headersElement.nextSibling),this.topInitialized=!0)},b.prototype.initializeBottomRow=function(){this.botInitialized||(this.table.footerManager.prepend(this.botElement),this.botInitialized=!0)},b.prototype.scrollHorizontal=function(e){this.table.columnManager.getElement().scrollWidth-this.table.element.clientWidth;this.botInitialized&&(this.botRow.getElement().style.marginLeft=-e+"px")},b.prototype.recalc=function(e){var t,o;if(this.topInitialized||this.botInitialized){if(t=this.rowsToData(e),this.topInitialized){for(o=this.generateRow("top",this.rowsToData(e)),this.topRow=o;this.topElement.firstChild;)this.topElement.removeChild(this.topElement.firstChild);this.topElement.appendChild(o.getElement()),o.initialize(!0)}if(this.botInitialized){for(o=this.generateRow("bottom",this.rowsToData(e)),this.botRow=o;this.botElement.firstChild;)this.botElement.removeChild(this.botElement.firstChild);this.botElement.appendChild(o.getElement()),o.initialize(!0)}this.table.rowManager.adjustTableSize(),this.table.modExists("frozenColumns")&&this.table.modules.frozenColumns.layout()}},b.prototype.recalcRowGroup=function(e){this.recalcGroup(this.table.modules.groupRows.getRowGroup(e))},b.prototype.recalcGroup=function(e){var t,o;e&&e.calcs&&(e.calcs.bottom&&(t=this.rowsToData(e.rows),o=this.generateRowData("bottom",t),e.calcs.bottom.updateData(o),e.calcs.bottom.reinitialize()),e.calcs.top&&(t=this.rowsToData(e.rows),o=this.generateRowData("top",t),e.calcs.top.updateData(o),e.calcs.top.reinitialize()))},b.prototype.generateTopRow=function(e){return this.generateRow("top",this.rowsToData(e))},b.prototype.generateBottomRow=function(e){return this.generateRow("bottom",this.rowsToData(e))},b.prototype.rowsToData=function(e){var t=[];return e.forEach(function(e){t.push(e.getData())}),t},b.prototype.generateRow=function(e,t){var o,i=this,n=this.generateRowData(e,t);return i.table.modExists("mutator")&&i.table.modules.mutator.disable(),o=new a(n,this),i.table.modExists("mutator")&&i.table.modules.mutator.enable(),o.getElement().classList.add("tabulator-calcs","tabulator-calcs-"+e),o.type="calc",o.generateCells=function(){var t=[];i.table.columnManager.columnsByIndex.forEach(function(n){i.genColumn.setField(n.getField()),i.genColumn.hozAlign=n.hozAlign,n.definition[e+"CalcFormatter"]&&i.table.modExists("format")?i.genColumn.modules.format={formatter:i.table.modules.format.getFormatter(n.definition[e+"CalcFormatter"]),params:n.definition[e+"CalcFormatterParams"]}:i.genColumn.modules.format={formatter:i.table.modules.format.getFormatter("plaintext"),params:{}},i.genColumn.definition.cssClass=n.definition.cssClass;var s=new u(i.genColumn,o);s.column=n,s.setWidth(),n.cells.push(s),t.push(s),n.visible||s.hide()}),this.cells=t},o},b.prototype.generateRowData=function(e,t){var o,i,n={},s="top"==e?this.topCalcs:this.botCalcs,r="top"==e?"topCalc":"botCalc";return s.forEach(function(e){var s=[];e.modules.columnCalcs&&e.modules.columnCalcs[r]&&(t.forEach(function(t){s.push(e.getFieldValue(t))}),i=r+"Params",o="function"==typeof e.modules.columnCalcs[i]?e.modules.columnCalcs[i](value,t):e.modules.columnCalcs[i],e.setFieldValue(n,e.modules.columnCalcs[r](s,t,o)))}),n},b.prototype.hasTopCalcs=function(){return!!this.topCalcs.length},b.prototype.hasBottomCalcs=function(){return!!this.botCalcs.length},b.prototype.redraw=function(){this.topRow&&this.topRow.normalizeHeight(!0),this.botRow&&this.botRow.normalizeHeight(!0)},b.prototype.getResults=function(){var e,t=this,o={};return this.table.options.groupBy&&this.table.modExists("groupRows")?(e=this.table.modules.groupRows.getGroups(!0),e.forEach(function(e){o[e.getKey()]=t.getGroupResults(e)})):o={top:this.topRow?this.topRow.getData():{},bottom:this.botRow?this.botRow.getData():{}},o},b.prototype.getGroupResults=function(e){var t=this,o=e._getSelf(),i=e.getSubGroups(),n={},s={};return i.forEach(function(e){n[e.getKey()]=t.getGroupResults(e)}),s={top:o.calcs.top?o.calcs.top.getData():{},bottom:o.calcs.bottom?o.calcs.bottom.getData():{},groups:n}},b.prototype.calculations={avg:function(e,t,o){var i=0,n="undefined"!=typeof o.precision?o.precision:2;return e.length&&(i=e.reduce(function(e,t){return t=Number(t),e+t}),i/=e.length,i=n!==!1?i.toFixed(n):i),parseFloat(i).toString()},max:function(e,t,o){var i=null,n="undefined"!=typeof o.precision&&o.precision;return e.forEach(function(e){e=Number(e),(e>i||null===i)&&(i=e)}),null!==i?n!==!1?i.toFixed(n):i:""},min:function(e,t,o){var i=null,n="undefined"!=typeof o.precision&&o.precision;return e.forEach(function(e){e=Number(e),(e<i||null===i)&&(i=e)}),null!==i?n!==!1?i.toFixed(n):i:""},sum:function(e,t,o){var i=0,n="undefined"!=typeof o.precision&&o.precision;return e.length&&e.forEach(function(e){e=Number(e),i+=isNaN(e)?0:Number(e)}),n!==!1?i.toFixed(n):i},concat:function(e,t,o){var i=0;return e.length&&(i=e.reduce(function(e,t){return String(e)+String(t)})),i},count:function(e,t,o){var i=0;return e.length&&e.forEach(function(e){e&&i++}),i}},d.prototype.registerModule("columnCalcs",b);var v=function(e){this.table=e,this.mode=!0,this.copySelector=!1,this.copySelectorParams={},this.copyFormatter=!1,this.copyFormatterParams={},this.pasteParser=function(){},this.pasteAction=function(){},this.htmlElement=!1,this.config={},this.blocked=!0};v.prototype.initialize=function(){var e=this;this.mode=this.table.options.clipboard,this.mode!==!0&&"copy"!==this.mode||this.table.element.addEventListener("copy",function(t){var o;e.processConfig(),e.blocked||(t.preventDefault(),o=e.generateContent(),window.clipboardData&&window.clipboardData.setData?window.clipboardData.setData("Text",o):t.clipboardData&&t.clipboardData.setData?(t.clipboardData.setData("text/plain",o),e.htmlElement&&t.clipboardData.setData("text/html",e.htmlElement.outerHTML)):t.originalEvent&&t.originalEvent.clipboardData.setData&&(t.originalEvent.clipboardData.setData("text/plain",o),e.htmlElement&&t.originalEvent.clipboardData.setData("text/html",e.htmlElement.outerHTML)),e.table.options.clipboardCopied.call(this.table,o),e.reset())}),this.mode!==!0&&"paste"!==this.mode||this.table.element.addEventListener("paste",function(t){e.paste(t)}),this.setPasteParser(this.table.options.clipboardPasteParser),this.setPasteAction(this.table.options.clipboardPasteAction)},v.prototype.processConfig=function(){var e={columnHeaders:"groups",rowGroups:!0,columnCalcs:!0};if("undefined"!=typeof this.table.options.clipboardCopyHeader&&(e.columnHeaders=this.table.options.clipboardCopyHeader,console.warn("DEPRECATION WANRING - clipboardCopyHeader option has been depricated, please use the columnHeaders property on the clipboardCopyConfig option")),this.table.options.clipboardCopyConfig)for(var t in this.table.options.clipboardCopyConfig)e[t]=this.table.options.clipboardCopyConfig[t];e.rowGroups&&this.table.options.groupBy&&this.table.modExists("groupRows")&&(this.config.rowGroups=!0),e.columnHeaders?"groups"!==e.columnHeaders&&e!==!0||this.table.columnManager.columns.length==this.table.columnManager.columnsByIndex.length?this.config.columnHeaders="columns":this.config.columnHeaders="groups":this.config.columnHeaders=!1,e.columnCalcs&&this.table.modExists("columnCalcs")&&(this.config.columnCalcs=!0)},v.prototype.reset=function(){this.blocked=!1,this.originalSelectionText=""},v.prototype.setPasteAction=function(e){switch("undefined"==typeof e?"undefined":r(e)){case"string":this.pasteAction=this.pasteActions[e],this.pasteAction||console.warn("Clipboard Error - No such paste action found:",e);break;case"function":this.pasteAction=e}},v.prototype.setPasteParser=function(e){switch("undefined"==typeof e?"undefined":r(e)){case"string":this.pasteParser=this.pasteParsers[e],this.pasteParser||console.warn("Clipboard Error - No such paste parser found:",e);break;case"function":this.pasteParser=e}},v.prototype.paste=function(e){var t,o,i;this.checkPaseOrigin(e)&&(t=this.getPasteData(e),o=this.pasteParser.call(this,t),o?(e.preventDefault(),this.table.modExists("mutator")&&(o=this.mutateData(o)),i=this.pasteAction.call(this,o),this.table.options.clipboardPasted.call(this.table,t,o,i)):this.table.options.clipboardPasteError.call(this.table,t))},v.prototype.mutateData=function(e){var t=this,o=[];return Array.isArray(e)?e.forEach(function(e){o.push(t.table.modules.mutator.transformRow(e,"clipboard"))}):o=e,o},v.prototype.checkPaseOrigin=function(e){var t=!0;return("DIV"!=e.target.tagName||this.table.modules.edit.currentCell)&&(t=!1),t},v.prototype.getPasteData=function(e){var t;return window.clipboardData&&window.clipboardData.getData?t=window.clipboardData.getData("Text"):e.clipboardData&&e.clipboardData.getData?t=e.clipboardData.getData("text/plain"):e.originalEvent&&e.originalEvent.clipboardData.getData&&(t=e.originalEvent.clipboardData.getData("text/plain")),t},v.prototype.copy=function(e,t,o,i,n){var s,r;this.blocked=!1,this.mode!==!0&&"copy"!==this.mode||("undefined"!=typeof window.getSelection&&"undefined"!=typeof document.createRange?(s=document.createRange(),s.selectNodeContents(this.table.element),r=window.getSelection(),r.toString()&&n&&(e="userSelection",o="raw",t=r.toString()),r.removeAllRanges(),r.addRange(s)):"undefined"!=typeof document.selection&&"undefined"!=typeof document.body.createTextRange&&(textRange=document.body.createTextRange(),textRange.moveToElementText(this.table.element),textRange.select()),this.setSelector(e),this.copySelectorParams="undefined"!=typeof t&&null!=t?t:this.config.columnHeaders,this.setFormatter(o),this.copyFormatterParams="undefined"!=typeof i&&null!=i?i:{},document.execCommand("copy"),r&&r.removeAllRanges())},v.prototype.setSelector=function(e){switch(e=e||this.table.options.clipboardCopySelector,"undefined"==typeof e?"undefined":r(e)){case"string":this.copySelectors[e]?this.copySelector=this.copySelectors[e]:console.warn("Clipboard Error - No such selector found:",e);break;case"function":this.copySelector=e}},v.prototype.setFormatter=function(e){switch(e=e||this.table.options.clipboardCopyFormatter,"undefined"==typeof e?"undefined":r(e)){case"string":this.copyFormatters[e]?this.copyFormatter=this.copyFormatters[e]:console.warn("Clipboard Error - No such formatter found:",e);break;case"function":this.copyFormatter=e}},v.prototype.generateContent=function(){var e;return this.htmlElement=!1,e=this.copySelector.call(this,this.config,this.copySelectorParams),this.copyFormatter.call(this,e,this.config,this.copyFormatterParams)},v.prototype.generateSimpleHeaders=function(e){var t=[];return e.forEach(function(e){t.push(e.definition.title)}),t},v.prototype.generateColumnGroupHeaders=function(e){var t=this,o=[];return this.table.columnManager.columns.forEach(function(e){var i=t.processColumnGroup(e);i&&o.push(i)}),o},v.prototype.processColumnGroup=function(e){var t=this,o=e.columns,i={type:"group",title:e.definition.title,column:e};if(o.length){if(i.subGroups=[],i.width=0,o.forEach(function(e){var o=t.processColumnGroup(e);o&&(i.width+=o.width,i.subGroups.push(o))}),!i.width)return!1}else{if(!e.field||!e.visible)return!1;i.width=1}return i},v.prototype.groupHeadersToRows=function(e){function t(e,n){"undefined"==typeof i[n]&&(i[n]=[]),i[n].push(e.title),e.subGroups?e.subGroups.forEach(function(e){t(e,n+1)}):o()}function o(){var e=0;i.forEach(function(t){var o=t.length;o>e&&(e=o)}),i.forEach(function(t){var o=t.length;if(o<e)for(var i=o;i<e;i++)t.push("")})}var i=[];return e.forEach(function(e){t(e,0)}),i},v.prototype.rowsToData=function(e,t,o){var i=this.table.columnManager.columnsByIndex,n=[];return e.forEach(function(e){var t=[],o=e instanceof s?e.getData("clipboard"):e;i.forEach(function(e){var i=e.getFieldValue(o);switch("undefined"==typeof i?"undefined":r(i)){case"object":i=JSON.stringify(i);break;case"undefined":case"null":i="";break;default:i=i}t.push(i)}),n.push(t)}),n},v.prototype.buildComplexRows=function(e){var t=this,o=[],i=this.table.modules.groupRows.getGroups();return i.forEach(function(e){o.push(t.processGroupData(e))}),o},v.prototype.processGroupData=function(e){var t=this,o=e.getSubGroups(),i={type:"group",key:e.key};return o.length?(i.subGroups=[],o.forEach(function(e){i.subGroups.push(t.processGroupData(e))})):i.rows=e.getRows(!0),i},v.prototype.getCalcRow=function(e,t,o){var i=e[t];return i&&(o&&(i=i[o]),Object.keys(i).length)?this.rowsToData([i]):[]},v.prototype.buildOutput=function(e,t,o){var i,n=this,s=[],r=this.table.columnManager.columnsByIndex;return t.columnHeaders&&("groups"==t.columnHeaders?(r=this.generateColumnGroupHeaders(this.table.columnManager.columns),s=s.concat(this.groupHeadersToRows(r))):s.push(this.generateSimpleHeaders(r))),this.config.columnCalcs&&(i=this.table.getCalcResults()),this.table.options.clipboardCopyStyled&&this.generateHTML(e,r,i,t,o),t.rowGroups?e.forEach(function(e){s=s.concat(n.parseRowGroupData(e,t,o,i||{}))}):(t.columnCalcs&&(s=s.concat(this.getCalcRow(i,"top"))),s=s.concat(this.rowsToData(e,t,o)),t.columnCalcs&&(s=s.concat(this.getCalcRow(i,"bottom")))),s},v.prototype.parseRowGroupData=function(e,t,o,i){var n=this,s=[];return s.push([e.key]),e.subGroups?e.subGroups.forEach(function(r){s=s.concat(n.parseRowGroupData(r,t,o,i[e.key]?i[e.key].groups||{}:{}))}):(t.columnCalcs&&(s=s.concat(this.getCalcRow(i,e.key,"top"))),s=s.concat(this.rowsToData(e.rows,t,o)),t.columnCalcs&&(s=s.concat(this.getCalcRow(i,e.key,"bottom")))),s},v.prototype.generateHTML=function(e,t,o,i,n){function a(){var e=document.createElement("tr");t.forEach(function(t){var o=document.createElement("th");o.innerHTML=t.definition.title,x.mapElementStyles(t.getElement(),o,["border-top","border-left","border-right","border-bottom","background-color","color","font-weight","font-family","font-size"]),e.appendChild(o)}),x.mapElementStyles(x.table.columnManager.getHeadersElement(),e,["border-top","border-left","border-right","border-bottom","background-color","color","font-weight","font-family","font-size"]),x.htmlElement.appendChild(document.createElement("thead").appendChild(e))}function l(e){var t=document.createElement("thead");e.forEach(function(e){var o=document.createElement("tr");e.forEach(function(e){var t=document.createElement("th");e.width>1&&(t.colSpan=e.width),e.height>1&&(t.rowSpan=e.height),t.innerHTML=e.title,x.mapElementStyles(e.element,t,["border-top","border-left","border-right","border-bottom","background-color","color","font-weight","font-family","font-size"]),o.appendChild(t)}),x.mapElementStyles(x.table.columnManager.getHeadersElement(),o,["border-top","border-left","border-right","border-bottom","background-color","color","font-weight","font-family","font-size"]),t.appendChild(o)}),x.htmlElement.appendChild(t)}function u(e,t){"undefined"==typeof R[t]&&(R[t]=[]),R[t].push({title:e.title,width:e.width,height:1,children:!!e.subGroups,element:e.column.getElement()}),e.subGroups&&e.subGroups.forEach(function(e){u(e,t+1)})}function c(){R.forEach(function(e,t){e.forEach(function(e){e.children||(e.height=R.length-t)})})}function d(e,t,o){var i=e[t];i&&(o&&(i=i[o]),Object.keys(i).length&&h([i]))}function h(e){e.forEach(function(e,o){var i,n=document.createElement("tr"),a=v,l=!1;e instanceof s?i=e.getData("clipboard"):(i=e,l=!0),t.forEach(function(e,o){var s=document.createElement("td"),a=e.getFieldValue(i);switch("undefined"==typeof a?"undefined":r(a)){case"object":a=JSON.stringify(a);break;case"undefined":case"null":a="";break;default:a=a}s.innerHTML=a,e.definition.align&&(s.style.textAlign=e.definition.align),o<t.length-1?y&&x.mapElementStyles(y,s,["border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size"]):y&&x.mapElementStyles(y,s,["border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size"]),n.appendChild(s)}),l?a=b:(o%2||!f||(a=f),o%2&&g&&(a=g)),a&&x.mapElementStyles(a,n,["border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size","background-color"]),m.appendChild(n)})}function p(e,o){var n=document.createElement("tr"),s=document.createElement("td");s.colSpan=t.length,s.innerHTML=e.key,n.appendChild(s),m.appendChild(n),x.mapElementStyles(w,n,["border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size","background-color"]),e.subGroups?e.subGroups.forEach(function(t){p(t,o[e.key]?o[e.key].groups||{}:{})}):(i.columnCalcs&&d(o,e.key,"top"),h(e.rows),i.columnCalcs&&d(o,e.key,"bottom"))}var m,f,g,b,v,y,w,E,C,x=this,R=[];this.htmlElement=document.createElement("table"),x.mapElementStyles(this.table.element,this.htmlElement,["border-top","border-left","border-right","border-bottom"]),i.columnHeaders&&("groups"==i.columnHeaders?(t.forEach(function(e){u(e,0)}),c(),l(R)):a()),t=this.table.columnManager.columnsByIndex,m=document.createElement("tbody"),window.getComputedStyle&&(f=this.table.element.querySelector(".tabulator-row-odd:not(.tabulator-group):not(.tabulator-calcs)"),g=this.table.element.querySelector(".tabulator-row-even:not(.tabulator-group):not(.tabulator-calcs)"),b=this.table.element.querySelector(".tabulator-row.tabulator-calcs"),v=this.table.element.querySelector(".tabulator-row:not(.tabulator-group):not(.tabulator-calcs)"),w=this.table.element.getElementsByClassName("tabulator-group")[0],v&&(C=v.getElementsByClassName("tabulator-cell"),y=C[0],E=C[C.length-1])),i.rowGroups?e.forEach(function(e){p(e,o||{})}):(i.columnCalcs&&d(o,"top"),h(e),i.columnCalcs&&d(o,"bottom")),this.htmlElement.appendChild(m)},v.prototype.mapElementStyles=function(e,t,o){var i={"background-color":"backgroundColor",color:"fontColor","font-weight":"fontWeight","font-family":"fontFamily","font-size":"fontSize","border-top":"borderTop","border-left":"borderLeft","border-right":"borderRight","border-bottom":"borderBottom"};if(window.getComputedStyle){var n=window.getComputedStyle(e);o.forEach(function(e){t.style[i[e]]=n.getPropertyValue(e)})}},v.prototype.copySelectors={userSelection:function(e,t){return t},selected:function(e,t){var o=[];return this.table.modExists("selectRow",!0)&&(o=this.table.modules.selectRow.getSelectedRows()),e.rowGroups&&console.warn("Clipboard Warning - select coptSelector does not support row groups"),this.buildOutput(o,e,t)},table:function(e,t){return e.rowGroups&&console.warn("Clipboard Warning - table coptSelector does not support row groups"),this.buildOutput(this.table.rowManager.getComponents(),e,t)},active:function(e,t){var o;return o=e.rowGroups?this.buildComplexRows(e):this.table.rowManager.getComponents(!0),this.buildOutput(o,e,t)}},v.prototype.copyFormatters={raw:function(e,t){return e},table:function(e,t){var o=[];return e.forEach(function(e){e.forEach(function(e){"undefined"==typeof e&&(e=""),e="undefined"==typeof e||null===e?"":e.toString(),e.match(/\r|\n/)&&(e=e.split('"').join('""'),e='"'+e+'"')}),o.push(e.join("\t"))}),o.join("\n")}},v.prototype.pasteParsers={table:function(e){var t=[],o=!1,i=!0,n=this.table.columnManager.columns,s=[],r=[];return e=e.split("\n"),e.forEach(function(e){t.push(e.split("\t"))}),!(!t.length||1===t.length&&t[0].length<2)&&(o=!0,t[0].forEach(function(e){var t=n.find(function(t){return e&&t.definition.title&&e.trim()&&t.definition.title.trim()===e.trim()});t?s.push(t):i=!1}),i||(i=!0,s=[],t[0].forEach(function(e){var t=n.find(function(t){return e&&t.field&&e.trim()&&t.field.trim()===e.trim()});t?s.push(t):i=!1}),i||(s=this.table.columnManager.columnsByIndex)),i&&t.shift(),t.forEach(function(e){var t={};e.forEach(function(e,o){s[o]&&(t[s[o].field]=e)}),r.push(t)}),r)}},v.prototype.pasteActions={replace:function(e){return this.table.setData(e)},update:function(e){return this.table.updateOrAddData(e)},insert:function(e){return this.table.addData(e)}},d.prototype.registerModule("clipboard",v);var y=function(e){this.table=e,this.indent=10,this.field="",this.collapseEl=null,this.expandEl=null,this.branchEl=null,this.elementField=!1,this.startOpen=function(){},this.displayIndex=0};y.prototype.initialize=function(){var e=null,t=this.table.columnManager.getFirstVisibileColumn(),o=this.table.options;switch(this.field=o.dataTreeChildField,this.indent=o.dataTreeChildIndent,this.elementField=o.dataTreeElementColumn||!!t&&t.field,o.dataTreeBranchElement&&(o.dataTreeBranchElement===!0?(this.branchEl=document.createElement("div"),this.branchEl.classList.add("tabulator-data-tree-branch")):"string"==typeof o.dataTreeBranchElement?(e=document.createElement("div"),e.innerHTML=o.dataTreeBranchElement,this.branchEl=e.firstChild):this.branchEl=o.dataTreeBranchElement),o.dataTreeCollapseElement?"string"==typeof o.dataTreeCollapseElement?(e=document.createElement("div"),e.innerHTML=o.dataTreeCollapseElement,this.collapseEl=e.firstChild):this.collapseEl=o.dataTreeCollapseElement:(this.collapseEl=document.createElement("div"),this.collapseEl.classList.add("tabulator-data-tree-control"),this.collapseEl.innerHTML="<div class='tabulator-data-tree-control-collapse'></div>"),o.dataTreeExpandElement?"string"==typeof o.dataTreeExpandElement?(e=document.createElement("div"),e.innerHTML=o.dataTreeExpandElement,this.expandEl=e.firstChild):this.expandEl=o.dataTreeExpandElement:(this.expandEl=document.createElement("div"),this.expandEl.classList.add("tabulator-data-tree-control"),this.expandEl.innerHTML="<div class='tabulator-data-tree-control-expand'></div>"),r(o.dataTreeStartExpanded)){case"boolean":this.startOpen=function(e,t){return o.dataTreeStartExpanded};break;case"function":this.startOpen=o.dataTreeStartExpanded;break;default:this.startOpen=function(e,t){return o.dataTreeStartExpanded[t]}}},y.prototype.initializeRow=function(e){var t=e.getData()[this.field],o=Array.isArray(t),i=o||!o&&"object"===("undefined"==typeof t?"undefined":r(t))&&null!==t;e.modules.dataTree={index:0,open:!!i&&this.startOpen(e.getComponent(),0),controlEl:!1,branchEl:!1,parent:!1,children:i}},y.prototype.layoutRow=function(e){var t=this.elementField?e.getCell(this.elementField):e.getCells()[0],o=t.getElement(),i=e.modules.dataTree;i.branchEl&&i.branchEl.parentNode.removeChild(i.branchEl),this.generateControlElement(e,o),i.index&&(this.branchEl?(i.branchEl=this.branchEl.cloneNode(!0),o.insertBefore(i.branchEl,o.firstChild),i.branchEl.style.marginLeft=(i.branchEl.offsetWidth+i.branchEl.style.marginRight)*(i.index-1)+i.index*this.indent+"px"):o.style.paddingLeft=parseInt(window.getComputedStyle(o,null).getPropertyValue("padding-left"))+i.index*this.indent+"px")},y.prototype.generateControlElement=function(e,t){var o=this,i=e.modules.dataTree,t=t||e.getCells()[0].getElement(),n=i.controlEl;i.children!==!1&&(i.open?(i.controlEl=this.collapseEl.cloneNode(!0),i.controlEl.addEventListener("click",function(t){t.stopPropagation(),o.collapseRow(e)})):(i.controlEl=this.expandEl.cloneNode(!0),i.controlEl.addEventListener("click",function(t){t.stopPropagation(),o.expandRow(e)})),i.controlEl.addEventListener("mousedown",function(e){e.stopPropagation()}),n&&n.parentNode===t?n.parentNode.replaceChild(i.controlEl,n):t.insertBefore(i.controlEl,t.firstChild))},y.prototype.setDisplayIndex=function(e){this.displayIndex=e},y.prototype.getDisplayIndex=function(){return this.displayIndex},y.prototype.getRows=function(e){var t=this,o=[];return e.forEach(function(e,i){var n,s;o.push(e),e instanceof a&&(n=e.modules.dataTree.children,n.index||n.children===!1||(s=t.getChildren(e),s.forEach(function(e){o.push(e)})))}),o},y.prototype.getChildren=function(e){var t=this,o=e.modules.dataTree,i=[],n=[];return o.children!==!1&&o.open&&(Array.isArray(o.children)||(o.children=this.generateChildren(e)),i=this.table.modExists("filter")?this.table.modules.filter.filter(o.children):o.children,this.table.modExists("sort")&&this.table.modules.sort.sort(i),i.forEach(function(e){n.push(e);var o=t.getChildren(e);o.forEach(function(e){n.push(e)})})),n},y.prototype.generateChildren=function(e){var t=this,o=[],i=e.getData()[this.field];return Array.isArray(i)||(i=[i]),i.forEach(function(i){var n=new a(i||{},t.table.rowManager);n.modules.dataTree.index=e.modules.dataTree.index+1,n.modules.dataTree.parent=e,n.modules.dataTree.children&&(n.modules.dataTree.open=t.startOpen(n.getComponent(),n.modules.dataTree.index)),o.push(n)}),o},y.prototype.expandRow=function(e,t){var o=e.modules.dataTree;o.children!==!1&&(o.open=!0,e.reinitialize(),this.table.rowManager.refreshActiveData("tree",!1,!0),this.table.options.dataTreeRowExpanded(e.getComponent(),e.modules.dataTree.index))},y.prototype.collapseRow=function(e){var t=e.modules.dataTree;t.children!==!1&&(t.open=!1,e.reinitialize(),this.table.rowManager.refreshActiveData("tree",!1,!0),this.table.options.dataTreeRowCollapsed(e.getComponent(),e.modules.dataTree.index))},y.prototype.toggleRow=function(e){var t=e.modules.dataTree;t.children!==!1&&(t.open?this.collapseRow(e):this.expandRow(e))},y.prototype.getTreeParent=function(e){return!!e.modules.dataTree.parent&&e.modules.dataTree.parent.getComponent()},y.prototype.getTreeChildren=function(e){var t=e.modules.dataTree,o=[];return t.children&&(Array.isArray(t.children)||(t.children=this.generateChildren(e)),t.children.forEach(function(e){e instanceof a&&o.push(e.getComponent())})),o},y.prototype.checkForRestyle=function(e){e.row.cells.indexOf(e)||e.row.modules.dataTree.children!==!1&&e.row.reinitialize()},y.prototype.getChildField=function(){return this.field},d.prototype.registerModule("dataTree",y);var w=function(e){this.table=e,this.fields={},this.columnsByIndex=[],this.columnsByField={},this.config={}};w.prototype.download=function(e,t,o,i){function n(o,n){i?i===!0?s.triggerDownload(o,n,e,t,!0):i(o):s.triggerDownload(o,n,e,t)}var s=this,r=!1;this.processConfig(),"function"==typeof e?r=e:s.downloaders[e]?r=s.downloaders[e]:console.warn("Download Error - No such download type found: ",e),this.processColumns(),r&&r.call(this,s.processDefinitions(),s.processData(),o||{},n,this.config)},w.prototype.processConfig=function(){var e={columnGroups:!0,rowGroups:!0,columnCalcs:!0};if(this.table.options.downloadConfig)for(var t in this.table.options.downloadConfig)e[t]=this.table.options.downloadConfig[t];e.rowGroups&&this.table.options.groupBy&&this.table.modExists("groupRows")&&(this.config.rowGroups=!0),e.columnGroups&&this.table.columnManager.columns.length!=this.table.columnManager.columnsByIndex.length&&(this.config.columnGroups=!0),e.columnCalcs&&this.table.modExists("columnCalcs")&&(this.config.columnCalcs=!0)},w.prototype.processColumns=function(){var e=this;e.columnsByIndex=[],e.columnsByField={},e.table.columnManager.columnsByIndex.forEach(function(t){t.field&&t.definition.download!==!1&&(t.visible||!t.visible&&t.definition.download)&&(e.columnsByIndex.push(t),e.columnsByField[t.field]=t)})},w.prototype.processDefinitions=function(){var e=this,t=[];return this.config.columnGroups?e.table.columnManager.columns.forEach(function(o){var i=e.processColumnGroup(o);i&&t.push(i)}):e.columnsByIndex.forEach(function(o){o.download!==!1&&t.push(e.processDefinition(o))}),t},w.prototype.processColumnGroup=function(e){var t=this,o=e.columns,i=0,n={type:"group",title:e.definition.title,depth:1};if(o.length){if(n.subGroups=[],n.width=0,o.forEach(function(e){var o=t.processColumnGroup(e);o.depth>i&&(i=o.depth),o&&(n.width+=o.width,n.subGroups.push(o))}),n.depth+=i,!n.width)return!1}else{if(!e.field||e.definition.download===!1||!(e.visible||!e.visible&&e.definition.download))return!1;
- n.width=1,n.definition=this.processDefinition(e)}return n},w.prototype.processDefinition=function(e){var t={};for(var o in e.definition)t[o]=e.definition[o];return"undefined"!=typeof e.definition.downloadTitle&&(t.title=e.definition.downloadTitle),t},w.prototype.processData=function(){var e=this,t=this,o=[],i=[],n={};return this.config.rowGroups?(i=this.table.modules.groupRows.getGroups(),i.forEach(function(t){o.push(e.processGroupData(t))})):o=t.table.rowManager.getData(!0,"download"),this.config.columnCalcs&&(n=this.table.getCalcResults(),o={calcs:n,data:o}),"function"==typeof t.table.options.downloadDataFormatter&&(o=t.table.options.downloadDataFormatter(o)),o},w.prototype.processGroupData=function(e){var t=this,o=e.getSubGroups(),i={type:"group",key:e.key};return o.length?(i.subGroups=[],o.forEach(function(e){i.subGroups.push(t.processGroupData(e))})):i.rows=e.getData(!0,"download"),i},w.prototype.triggerDownload=function(e,t,o,i,n){var s=document.createElement("a"),r=new Blob([e],{type:t}),i=i||"Tabulator."+("function"==typeof o?"txt":o);r=this.table.options.downloadReady.call(this.table,e,r),r&&(n?window.open(window.URL.createObjectURL(r)):navigator.msSaveOrOpenBlob?navigator.msSaveOrOpenBlob(r,i):(s.setAttribute("href",window.URL.createObjectURL(r)),s.setAttribute("download",i),s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s)),this.table.options.downloadComplete&&this.table.options.downloadComplete())},w.prototype.getFieldValue=function(e,t){var o=this.columnsByField[e];return!!o&&o.getFieldValue(t)},w.prototype.commsReceived=function(e,t,o){switch(t){case"intercept":this.download(o.type,"",o.options,o.intercept)}},w.prototype.downloaders={csv:function(e,t,o,i,n){function s(){e.forEach(function(e){p.push('"'+String(e.title).split('"').join('""')+'"'),m.push(e.field)})}function a(e,t){e.subGroups?e.subGroups.forEach(function(e){a(e,t+1)}):(p.push('"'+String(e.title).split('"').join('""')+'"'),m.push(e.definition.field))}function l(e){e.forEach(function(e){var t=[];m.forEach(function(o){var i=h.getFieldValue(o,e);switch("undefined"==typeof i?"undefined":r(i)){case"object":i=JSON.stringify(i);break;case"undefined":case"null":i="";break;default:i=i}t.push('"'+String(i).split('"').join('""')+'"')}),c.push(t.join(f))})}function u(e){e.subGroups?e.subGroups.forEach(function(e){u(e)}):l(e.rows)}var c,d,h=this,p=[],m=[],f=o&&o.delimiter?o.delimiter:",";n.columnGroups?(console.warn("Download Warning - CSV downloader cannot process column groups"),e.forEach(function(e){a(e,0)})):s(),c=[p.join(f)],n.columnCalcs&&(console.warn("Download Warning - CSV downloader cannot process column calculations"),t=t.data),n.rowGroups?(console.warn("Download Warning - CSV downloader cannot process row groups"),t.forEach(function(e){u(e)})):l(t),d=c.join("\n"),o.bom&&(d="\ufeff"+d),i(d,"text/csv")},json:function(e,t,o,i,n){var s;n.columnCalcs&&(console.warn("Download Warning - CSV downloader cannot process column calculations"),t=t.data),s=JSON.stringify(t,null,"\t"),i(s,"application/json")},pdf:function(e,t,o,i,n){function s(){e.forEach(function(e){e.field&&(f.push(e.title||""),m.push(e.field))}),f=[f]}function a(e,t){var o=e.width,i=1,n={content:e.title||""};if(e.subGroups?(e.subGroups.forEach(function(e){a(e,t+1)}),i=1):(m.push(e.definition.field),i=v-t),n.rowSpan=i,f[t].push(n),o--,i>1)for(var s=t+1;s<v;s++)f[s].push("");for(var s=0;s<o;s++)f[t].push("")}function l(e){switch("undefined"==typeof e?"undefined":r(e)){case"object":e=JSON.stringify(e);break;case"undefined":case"null":e="";break;default:e=e}return e}function u(e){e.forEach(function(e){g.push(c(e))})}function c(e,t){var o=[];return m.forEach(function(i){var n=p.getFieldValue(i,e);n=l(n),t?o.push({content:n,styles:t}):o.push(n)}),o}function d(e,t){var o=[];o.push({content:l(e.key),colSpan:m.length,styles:w}),g.push(o),e.subGroups?e.subGroups.forEach(function(o){d(o,t[e.key]?t[e.key].groups||{}:{})}):(n.columnCalcs&&h(t,e.key,"top"),u(e.rows),n.columnCalcs&&h(t,e.key,"bottom"))}function h(e,t,o){var i=e[t];i&&(o&&(i=i[o]),Object.keys(i).length&&g.push(c(i,E)))}var p=this,m=[],f=[],g=[],b={},v=1,y={},w=o.rowGroupStyles||{fontStyle:"bold",fontSize:12,cellPadding:6,fillColor:220},E=o.rowCalcStyles||{fontStyle:"bold",fontSize:10,cellPadding:4,fillColor:232},C=o.jsPDF||{},x=o&&o.title?o.title:"";if(n.columnCalcs&&(b=t.calcs,t=t.data),C.orientation||(C.orientation=o.orientation||"landscape"),C.unit||(C.unit="pt"),n.columnGroups){e.forEach(function(e){e.depth>v&&(v=e.depth)});for(var R=0;R<v;R++)f.push([]);e.forEach(function(e){a(e,0)})}else s();n.rowGroups?t.forEach(function(e){d(e,b)}):(n.columnCalcs&&h(b,"top"),u(t),n.columnCalcs&&h(b,"bottom"));var M=new jsPDF(C);o&&o.autoTable&&(y="function"==typeof o.autoTable?o.autoTable(M)||{}:o.autoTable),x&&(y.addPageContent=function(e){M.text(x,40,30)}),y.head=f,y.body=g,M.autoTable(y),i(M.output("arraybuffer"),"application/pdf")},xlsx:function(e,t,o,i,n){function s(){function o(){var e={},t={s:{c:0,r:0},e:{c:w.length,r:E.length}};XLSX.utils.sheet_add_aoa(e,E),e["!ref"]=XLSX.utils.encode_range(t);var o=l();return o.length&&(e["!merges"]=o),e}function i(){e.forEach(function(e){y.push(e.title),w.push(e.field)}),E.push(y)}function s(e,t){"undefined"==typeof y[t]&&(y[t]=[]),"undefined"==typeof m[t]&&(m[t]=[]),e.width>1&&m[t].push({type:"hoz",start:y[t].length,end:y[t].length+e.width-1}),y[t].push(e.title),e.subGroups?e.subGroups.forEach(function(e){s(e,t+1)}):(w.push(e.definition.field),a(w.length-1,t),m[t].push({type:"vert",start:w.length-1}))}function a(){var e=0;y.forEach(function(t){var o=t.length;o>e&&(e=o)}),y.forEach(function(t){var o=t.length;if(o<e)for(var i=o;i<e;i++)t.push("")})}function l(){var e=[];return p.forEach(function(t){e.push({s:{r:t,c:0},e:{r:t,c:w.length-1}})}),m.forEach(function(t,o){t.forEach(function(t){"hoz"===t.type?e.push({s:{r:o,c:t.start},e:{r:o,c:t.end}}):o!=y.length-1&&e.push({s:{r:o,c:t.start},e:{r:y.length-1,c:t.start}})})}),e}function c(e){e.forEach(function(e){E.push(d(e))})}function d(e){var t=[];return w.forEach(function(o){var i=u.getFieldValue(o,e);t.push(i instanceof Date||"object"!==("undefined"==typeof i?"undefined":r(i))?i:JSON.stringify(i))}),t}function g(e,t,o){var i=e[t];i&&(o&&(i=i[o]),Object.keys(i).length&&(f.push(E.length),E.push(d(i))))}function b(e,t){var o=[];o.push(e.key),p.push(E.length),E.push(o),e.subGroups?e.subGroups.forEach(function(o){b(o,t[e.key]?t[e.key].groups||{}:{})}):(n.columnCalcs&&g(t,e.key,"top"),c(e.rows),n.columnCalcs&&g(t,e.key,"bottom"))}var v,y=[],w=[],E=[];return n.columnGroups?(e.forEach(function(e){s(e,0)}),y.forEach(function(e){E.push(e)})):i(),n.rowGroups?t.forEach(function(e){b(e,h)}):(n.columnCalcs&&g(h,"top"),c(t),n.columnCalcs&&g(h,"bottom")),v=o()}function a(e){for(var t=new ArrayBuffer(e.length),o=new Uint8Array(t),i=0;i!=e.length;++i)o[i]=255&e.charCodeAt(i);return t}var l,u=this,c=o.sheetName||"Sheet1",d={SheetNames:[],Sheets:{}},h={},p=[],m=[],f=[];if(n.columnCalcs&&(h=t.calcs,t=t.data),o.sheetOnly)return void i(s());if(o.sheets)for(var g in o.sheets)o.sheets[g]===!0?(d.SheetNames.push(g),d.Sheets[g]=s()):(d.SheetNames.push(g),this.table.modules.comms.send(o.sheets[g],"download","intercept",{type:"xlsx",options:{sheetOnly:!0},intercept:function(e){d.Sheets[g]=e}}));else d.SheetNames.push(c),d.Sheets[c]=s();l=XLSX.write(d,{bookType:"xlsx",bookSST:!0,type:"binary"}),i(a(l),"application/octet-stream")}},d.prototype.registerModule("download",w);var E=function(e){this.table=e,this.currentCell=!1,this.mouseClick=!1,this.recursionBlock=!1,this.invalidEdit=!1};E.prototype.initializeColumn=function(e){var t=this,o={editor:!1,blocked:!1,check:e.definition.editable,params:e.definition.editorParams||{}};switch(r(e.definition.editor)){case"string":"tick"===e.definition.editor&&(e.definition.editor="tickCross",console.warn("DEPRECATION WANRING - the tick editor has been depricated, please use the tickCross editor")),t.editors[e.definition.editor]?o.editor=t.editors[e.definition.editor]:console.warn("Editor Error - No such editor found: ",e.definition.editor);break;case"function":o.editor=e.definition.editor;break;case"boolean":e.definition.editor===!0&&("function"!=typeof e.definition.formatter?("tick"===e.definition.formatter&&(e.definition.formatter="tickCross",console.warn("DEPRECATION WANRING - the tick editor has been depricated, please use the tickCross editor")),t.editors[e.definition.formatter]?o.editor=t.editors[e.definition.formatter]:o.editor=t.editors.input):console.warn("Editor Error - Cannot auto lookup editor for a custom formatter: ",e.definition.formatter))}o.editor&&(e.modules.edit=o)},E.prototype.getCurrentCell=function(){return!!this.currentCell&&this.currentCell.getComponent()},E.prototype.clearEditor=function(){var e,t=this.currentCell;if(this.invalidEdit=!1,t){for(this.currentCell=!1,e=t.getElement(),e.classList.remove("tabulator-validation-fail"),e.classList.remove("tabulator-editing");e.firstChild;)e.removeChild(e.firstChild);t.row.getElement().classList.remove("tabulator-row-editing")}},E.prototype.cancelEdit=function(){if(this.currentCell){var e=this.currentCell,t=this.currentCell.getComponent();this.clearEditor(),e.setValueActual(e.getValue()),e.column.cellEvents.cellEditCancelled&&e.column.cellEvents.cellEditCancelled.call(this.table,t),this.table.options.cellEditCancelled.call(this.table,t)}},E.prototype.bindEditor=function(e){var t=this,o=e.getElement();o.setAttribute("tabindex",0),o.addEventListener("click",function(e){o.classList.contains("tabulator-editing")||o.focus()}),o.addEventListener("mousedown",function(e){t.mouseClick=!0}),o.addEventListener("focus",function(o){t.recursionBlock||t.edit(e,o,!1)})},E.prototype.focusCellNoEvent=function(e){this.recursionBlock=!0,"ie"!==this.table.browser&&e.getElement().focus(),this.recursionBlock=!1},E.prototype.editCell=function(e,t){this.focusCellNoEvent(e),this.edit(e,!1,t)},E.prototype.edit=function(e,t,o){function i(t){if(c.currentCell===e){var o=!0;e.column.modules.validate&&c.table.modExists("validate")&&(o=c.table.modules.validate.validate(e.column.modules.validate,e.getComponent(),t)),o===!0?(c.clearEditor(),e.setValue(t,!0),c.table.options.dataTree&&c.table.modExists("dataTree")&&c.table.modules.dataTree.checkForRestyle(e)):(c.invalidEdit=!0,p.classList.add("tabulator-validation-fail"),c.focusCellNoEvent(e),h(),c.table.options.validationFailed.call(c.table,e.getComponent(),t,o))}}function n(){c.currentCell===e&&(c.cancelEdit(),c.table.options.dataTree&&c.table.modExists("dataTree")&&c.table.modules.dataTree.checkForRestyle(e))}function s(e){h=e}var a,l,u,c=this,d=!0,h=function(){},p=e.getElement();if(this.currentCell)return void(this.invalidEdit||this.cancelEdit());if(e.column.modules.edit.blocked)return this.mouseClick=!1,p.blur(),!1;switch(t&&t.stopPropagation(),r(e.column.modules.edit.check)){case"function":d=e.column.modules.edit.check(e.getComponent());break;case"boolean":d=e.column.modules.edit.check}if(d||o){if(c.cancelEdit(),c.currentCell=e,l=e.getComponent(),this.mouseClick&&(this.mouseClick=!1,e.column.cellEvents.cellClick&&e.column.cellEvents.cellClick.call(this.table,t,l)),e.column.cellEvents.cellEditing&&e.column.cellEvents.cellEditing.call(this.table,l),c.table.options.cellEditing.call(this.table,l),u="function"==typeof e.column.modules.edit.params?e.column.modules.edit.params(l):e.column.modules.edit.params,a=e.column.modules.edit.editor.call(c,l,s,i,n,u),a===!1)return p.blur(),!1;if(!(a instanceof Node))return console.warn("Edit Error - Editor should return an instance of Node, the editor returned:",a),p.blur(),!1;for(p.classList.add("tabulator-editing"),e.row.getElement().classList.add("tabulator-row-editing");p.firstChild;)p.removeChild(p.firstChild);p.appendChild(a),h();for(var m=p.children,f=0;f<m.length;f++)m[f].addEventListener("click",function(e){e.stopPropagation()});return!0}return this.mouseClick=!1,p.blur(),!1},E.prototype.editors={input:function e(t,o,i,n,s){function r(t){(null===a||"undefined"==typeof a)&&""!==e.value||e.value!=a?i(e.value):n()}var a=t.getValue(),e=document.createElement("input");return e.setAttribute("type","text"),e.style.padding="4px",e.style.width="100%",e.style.boxSizing="border-box",e.value="undefined"!=typeof a?a:"",o(function(){e.focus(),e.style.height="100%"}),e.addEventListener("change",r),e.addEventListener("blur",r),e.addEventListener("keydown",function(t){switch(t.keyCode){case 13:i(e.value);break;case 27:n()}}),e},textarea:function(e,t,o,i,n){function s(t){(null===r||"undefined"==typeof r)&&""!==l.value||l.value!=r?(o(l.value),setTimeout(function(){e.getRow().normalizeHeight()},300)):i()}var r=e.getValue(),a=String(null!==r&&"undefined"!==r?r:""),l=((a.match(/(?:\r\n|\r|\n)/g)||[]).length+1,document.createElement("textarea")),u=0;return l.style.display="block",l.style.padding="2px",l.style.height="100%",l.style.width="100%",l.style.boxSizing="border-box",l.style.whiteSpace="pre-wrap",l.style.resize="none",l.value=a,t(function(){l.focus(),l.style.height="100%"}),l.addEventListener("change",s),l.addEventListener("blur",s),l.addEventListener("keyup",function(){l.style.height="";var t=l.scrollHeight;l.style.height=t+"px",t!=u&&(u=t,e.getRow().normalizeHeight())}),l.addEventListener("keydown",function(e){27==e.keyCode&&i()}),l},number:function(e,t,o,i,n){function s(){var e=a.value;isNaN(e)||""===e||(e=Number(e)),e!=r?o(e):i()}var r=e.getValue(),a=document.createElement("input");a.setAttribute("type","number"),"undefined"!=typeof n.max&&a.setAttribute("max",n.max),"undefined"!=typeof n.min&&a.setAttribute("min",n.min),"undefined"!=typeof n.step&&a.setAttribute("step",n.step),a.style.padding="4px",a.style.width="100%",a.style.boxSizing="border-box",a.value=r;var l=function(e){s()};return t(function(){a.removeEventListener("blur",l),a.focus(),a.style.height="100%",a.addEventListener("blur",l)}),a.addEventListener("keydown",function(e){switch(e.keyCode){case 13:case 9:s();break;case 27:i()}}),a},range:function(e,t,o,i,n){function s(){var e=a.value;isNaN(e)||""===e||(e=Number(e)),e!=r?o(e):i()}var r=e.getValue(),a=document.createElement("input");return a.setAttribute("type","range"),"undefined"!=typeof n.max&&a.setAttribute("max",n.max),"undefined"!=typeof n.min&&a.setAttribute("min",n.min),"undefined"!=typeof n.step&&a.setAttribute("step",n.step),a.style.padding="4px",a.style.width="100%",a.style.boxSizing="border-box",a.value=r,t(function(){a.focus(),a.style.height="100%"}),a.addEventListener("blur",function(e){s()}),a.addEventListener("keydown",function(e){switch(e.keyCode){case 13:case 9:s();break;case 27:i()}}),a},select:function(e,t,o,i,n){function s(){var t={},o=e.getColumn()._getSelf(),i=f.table.getData();return i.forEach(function(e){var i=o.getFieldValue(e);null!==i&&"undefined"!=typeof i&&""!==i&&(t[i]=!0)}),t=n.sortValuesList?"asc"==n.sortValuesList?Object.keys(t).sort():Object.keys(t).sort().reverse():Object.keys(t)}function a(t,o){function i(e){var e={label:n.listItemFormatter?n.listItemFormatter(e.value,e.label):e.label,value:e.value,element:!1};return e.value!==o&&(isNaN(parseFloat(e.value))||isNaN(parseFloat(e.value))||parseFloat(e.value)!==parseFloat(o))||u(e),s.push(e),a.push(e),e}var s=[],a=[];if("function"==typeof t&&(t=t(e)),Array.isArray(t))t.forEach(function(e){var t;"object"===("undefined"==typeof e?"undefined":r(e))?e.options?(t={label:e.label,group:!0,element:!1},a.push(t),e.options.forEach(function(e){i(e)})):i(e):(t={label:n.listItemFormatter?n.listItemFormatter(e,e):e,value:e,element:!1},t.value!==o&&(isNaN(parseFloat(t.value))||isNaN(parseFloat(t.value))||parseFloat(t.value)!==parseFloat(o))||u(t),s.push(t),a.push(t))});else for(var c in t){var d={label:n.listItemFormatter?n.listItemFormatter(c,t[c]):t[c],value:c,element:!1};d.value!==o&&(isNaN(parseFloat(d.value))||isNaN(parseFloat(d.value))||parseFloat(d.value)!==parseFloat(o))||u(d),s.push(d),a.push(d)}w=s,E=a,l()}function l(){for(;y.firstChild;)y.removeChild(y.firstChild);E.forEach(function(e){var t=e.element;t||(e.group?(t=document.createElement("div"),t.classList.add("tabulator-edit-select-list-group"),t.tabIndex=0,t.innerHTML=""===e.label?" ":e.label):(t=document.createElement("div"),t.classList.add("tabulator-edit-select-list-item"),t.tabIndex=0,t.innerHTML=""===e.label?" ":e.label,t.addEventListener("click",function(){u(e),c()}),e===C&&t.classList.add("active")),t.addEventListener("mousedown",function(){x=!1,setTimeout(function(){x=!0},10)}),e.element=t),y.appendChild(t)})}function u(e){C&&C.element&&C.element.classList.remove("active"),C=e,v.value=" "===e.label?"":e.label,e.element&&e.element.classList.add("active")}function c(){m(),b!==C.value?(b=C.value,o(C.value)):i()}function h(){m(),i()}function p(){if(!y.parentNode){n.values===!0?a(s(),b):a(n.values||[],b);var e=d.prototype.helpers.elOffset(g);y.style.minWidth=g.offsetWidth+"px",y.style.top=e.top+g.offsetHeight+"px",y.style.left=e.left+"px",document.body.appendChild(y)}}function m(){y.parentNode&&y.parentNode.removeChild(y)}var f=this,g=e.getElement(),b=e.getValue(),v=document.createElement("input"),y=document.createElement("div"),w=[],E=[],C={},x=!0;return(Array.isArray(n)||!Array.isArray(n)&&"object"===("undefined"==typeof n?"undefined":r(n))&&!n.values)&&(console.warn("DEPRECATION WANRING - values for the select editor must now be passed into the values property of the editorParams object, not as the editorParams object"),n={values:n}),v.setAttribute("type","text"),v.style.padding="4px",v.style.width="100%",v.style.boxSizing="border-box",v.readOnly=!0,v.value="undefined"!=typeof b||null===b?b:"",n.values===!0?a(s(),b):a(n.values||[],b),v.addEventListener("keydown",function(e){var t;switch(e.keyCode){case 38:e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),t=w.indexOf(C),t>0&&u(w[t-1]);break;case 40:e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),t=w.indexOf(C),t<w.length-1&&u(t==-1?w[0]:w[t+1]);break;case 37:case 39:e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault();break;case 13:c();break;case 27:h()}}),v.addEventListener("blur",function(e){x&&h()}),v.addEventListener("focus",function(e){p()}),y=document.createElement("div"),y.classList.add("tabulator-edit-select-list"),t(function(){v.style.height="100%",v.focus()}),v},autocomplete:function(e,t,o,i,n){function s(){var t={},o=e.getColumn()._getSelf(),i=f.table.getData();return i.forEach(function(e){var i=o.getFieldValue(e);null!==i&&"undefined"!=typeof i&&""!==i&&(t[i]=!0)}),t=n.sortValuesList?"asc"==n.sortValuesList?Object.keys(t).sort():Object.keys(t).sort().reverse():Object.keys(t)}function r(e,t){var o=[];if(Array.isArray(e))e.forEach(function(e){var i={title:n.listItemFormatter?n.listItemFormatter(e,e):e,value:e,element:!1};i.value!==t&&(isNaN(parseFloat(i.value))||isNaN(parseFloat(i.value))||parseFloat(i.value)!==parseFloat(t))||u(i),o.push(i)});else for(var i in e){var s={title:n.listItemFormatter?n.listItemFormatter(i,e[i]):e[i],value:i,element:!1};s.value!==t&&(isNaN(parseFloat(s.value))||isNaN(parseFloat(s.value))||parseFloat(s.value)!==parseFloat(t))||u(s),o.push(s)}n.searchFunc&&o.forEach(function(e){e.search={title:e.title,value:e.value}}),w=o}function a(e,t){var o=[],i=[],s=[];n.searchFunc?(w.forEach(function(e){i.push(e.search)}),s=n.searchFunc(e,i),s.forEach(function(e){var t=w.find(function(t){return t.search===e});t&&o.push(t)})):""===e?n.showListOnEmpty&&w.forEach(function(e){o.push(e)}):w.forEach(function(t){null===t.value&&"undefined"==typeof t.value||(String(t.value).toLowerCase().indexOf(String(e).toLowerCase())>-1||String(t.title).toLowerCase().indexOf(String(e).toLowerCase())>-1)&&o.push(t)}),E=o,l(t)}function l(e){for(var t=!1;y.firstChild;)y.removeChild(y.firstChild);E.forEach(function(o){var i=o.element;i||(i=document.createElement("div"),i.classList.add("tabulator-edit-select-list-item"),i.tabIndex=0,i.innerHTML=o.title,i.addEventListener("click",function(){u(o),c()}),i.addEventListener("mousedown",function(){R=!1,setTimeout(function(){R=!0},10)}),o.element=i,e&&o.value==b&&(v.value=o.title,o.element.classList.add("active"),t=!0),o===x&&(o.element.classList.add("active"),t=!0)),y.appendChild(i)}),t||u(!1)}function u(e,t){x&&x.element&&x.element.classList.remove("active"),x=e,e&&e.element&&e.element.classList.add("active")}function c(){m(),x?b!==x.value?(b=x.value,v.value=x.title,o(x.value)):i():n.freetext?(b=v.value,o(v.value)):n.allowEmpty&&""===v.value?(b=v.value,o(v.value)):i()}function h(){m(),i()}function p(){if(!y.parentNode){for(;y.firstChild;)y.removeChild(y.firstChild);C=n.values===!0?s():n.values||[],r(C,b);var e=d.prototype.helpers.elOffset(g);y.style.minWidth=g.offsetWidth+"px",y.style.top=e.top+g.offsetHeight+"px",y.style.left=e.left+"px",document.body.appendChild(y)}}function m(){y.parentNode&&y.parentNode.removeChild(y)}var f=this,g=e.getElement(),b=e.getValue(),v=document.createElement("input"),y=document.createElement("div"),w=[],E=[],C=[],x={},R=!0;return v.setAttribute("type","search"),v.style.padding="4px",v.style.width="100%",v.style.boxSizing="border-box",v.addEventListener("keydown",function(e){var t;switch(e.keyCode){case 38:e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),t=E.indexOf(x),u(t>0?E[t-1]:!1);break;case 40:e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),t=E.indexOf(x),t<E.length-1&&u(t==-1?E[0]:E[t+1]);break;case 37:case 39:e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault();break;case 13:c();break;case 27:h();break;case 36:case 35:e.stopImmediatePropagation()}}),v.addEventListener("keyup",function(e){switch(e.keyCode){case 38:case 37:case 39:case 40:case 13:case 27:break;default:a(v.value)}}),v.addEventListener("search",function(e){a(v.value)}),v.addEventListener("blur",function(e){R&&c()}),v.addEventListener("focus",function(e){var t="undefined"!=typeof b||null===b?b:"";p(),v.value=t,a(t,!0)}),y=document.createElement("div"),y.classList.add("tabulator-edit-select-list"),t(function(){v.style.height="100%",v.focus()}),v},star:function e(t,o,i,n,s){function r(e){m.forEach(function(t,o){o<e?("ie"==u.table.browser?t.setAttribute("class","tabulator-star-active"):t.classList.replace("tabulator-star-inactive","tabulator-star-active"),t.innerHTML='<polygon fill="#488CE9" stroke="#014AAE" stroke-width="37.6152" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="259.216,29.942 330.27,173.919 489.16,197.007 374.185,309.08 401.33,467.31 259.216,392.612 117.104,467.31 144.25,309.08 29.274,197.007 188.165,173.919 "/>'):("ie"==u.table.browser?t.setAttribute("class","tabulator-star-inactive"):t.classList.replace("tabulator-star-active","tabulator-star-inactive"),t.innerHTML='<polygon fill="#010155" stroke="#686868" stroke-width="37.6152" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="259.216,29.942 330.27,173.919 489.16,197.007 374.185,309.08 401.33,467.31 259.216,392.612 117.104,467.31 144.25,309.08 29.274,197.007 188.165,173.919 "/>')})}function a(t){var o=document.createElement("span"),n=e.cloneNode(!0);m.push(n),o.addEventListener("mouseenter",function(e){e.stopPropagation(),e.stopImmediatePropagation(),r(t)}),o.addEventListener("mousemove",function(e){e.stopPropagation(),e.stopImmediatePropagation()}),o.addEventListener("click",function(e){e.stopPropagation(),e.stopImmediatePropagation(),i(t)}),o.appendChild(n),f.appendChild(o)}function l(e){d=e,r(e)}var u=this,c=t.getElement(),d=t.getValue(),h=c.getElementsByTagName("svg").length||5,p=c.getElementsByTagName("svg")[0]?c.getElementsByTagName("svg")[0].getAttribute("width"):14,m=[],f=document.createElement("div"),e=document.createElementNS("http://www.w3.org/2000/svg","svg");c.style.whiteSpace="nowrap",c.style.overflow="hidden",c.style.textOverflow="ellipsis",f.style.verticalAlign="middle",f.style.display="inline-block",f.style.padding="4px",e.setAttribute("width",p),e.setAttribute("height",p),e.setAttribute("viewBox","0 0 512 512"),e.setAttribute("xml:space","preserve"),e.style.padding="0 1px";for(var g=1;g<=h;g++)a(g);return d=Math.min(parseInt(d),h),r(d),f.addEventListener("mousemove",function(e){r(0)}),f.addEventListener("click",function(e){i(0)}),c.addEventListener("blur",function(e){n()}),c.addEventListener("keydown",function(e){switch(e.keyCode){case 39:l(d+1);break;case 37:l(d-1);break;case 13:i(d);break;case 27:n()}}),f},progress:function(e,t,o,i,n){function s(){var e=d*Math.round(m.offsetWidth/(l.clientWidth/100))+c;o(e),l.setAttribute("aria-valuenow",e),l.setAttribute("aria-label",h)}var r,a,l=e.getElement(),u="undefined"==typeof n.max?l.getElementsByTagName("div")[0].getAttribute("max")||100:n.max,c="undefined"==typeof n.min?l.getElementsByTagName("div")[0].getAttribute("min")||0:n.min,d=(u-c)/100,h=e.getValue()||0,p=document.createElement("div"),m=document.createElement("div");return p.style.position="absolute",p.style.right="0",p.style.top="0",p.style.bottom="0",p.style.width="5px",p.classList.add("tabulator-progress-handle"),m.style.display="inline-block",m.style.position="relative",m.style.height="100%",m.style.backgroundColor="#488CE9",m.style.maxWidth="100%",m.style.minWidth="0%",l.style.padding="4px 4px",h=Math.min(parseFloat(h),u),h=Math.max(parseFloat(h),c),h=Math.round((h-c)/d),m.style.width=h+"%",l.setAttribute("aria-valuemin",c),l.setAttribute("aria-valuemax",u),m.appendChild(p),p.addEventListener("mousedown",function(e){r=e.screenX,a=m.offsetWidth}),p.addEventListener("mouseover",function(){p.style.cursor="ew-resize"}),l.addEventListener("mousemove",function(e){r&&(m.style.width=a+e.screenX-r+"px")}),l.addEventListener("mouseup",function(e){r&&(e.stopPropagation(),e.stopImmediatePropagation(),r=!1,a=!1,s())}),l.addEventListener("keydown",function(e){switch(e.keyCode){case 39:m.style.width=m.clientWidth+l.clientWidth/100+"px";break;case 37:m.style.width=m.clientWidth-l.clientWidth/100+"px";break;case 13:s();break;case 27:i()}}),l.addEventListener("blur",function(){i()}),m},tickCross:function(e,t,o,i,n){function s(e){return l?e?c?u:a.checked:a.checked&&!c?(a.checked=!1,a.indeterminate=!0,c=!0,u):(c=!1,a.checked):a.checked}var r=e.getValue(),a=document.createElement("input"),l=n.tristate,u="undefined"==typeof n.indeterminateValue?null:n.indeterminateValue,c=!1;return a.setAttribute("type","checkbox"),a.style.marginTop="5px",a.style.boxSizing="border-box",a.value=r,!l||"undefined"!=typeof r&&r!==u&&""!==r||(c=!0,a.indeterminate=!0),"firefox"!=this.table.browser&&t(function(){a.focus()}),a.checked=r===!0||"true"===r||"True"===r||1===r,a.addEventListener("change",function(e){o(s())}),a.addEventListener("blur",function(e){o(s(!0))}),a.addEventListener("keydown",function(e){13==e.keyCode&&o(s()),27==e.keyCode&&i()}),a}},d.prototype.registerModule("edit",E);var C=function(e){this.table=e,this.filterList=[],this.headerFilters={},this.headerFilterElements=[],this.headerFilterColumns=[],this.changed=!1};C.prototype.initializeColumn=function(e,t){function o(t){var o,a="input"==e.modules.filter.tagType&&"text"==e.modules.filter.attrType||"textarea"==e.modules.filter.tagType?"partial":"match",l="";if("undefined"==typeof i||i!==t){if(i=t,e.modules.filter.emptyFunc(t))delete n.headerFilters[s];else{switch(e.modules.filter.value=t,r(e.definition.headerFilterFunc)){case"string":n.filters[e.definition.headerFilterFunc]?(l=e.definition.headerFilterFunc,o=function(o){var i=e.definition.headerFilterFuncParams||{},s=e.getFieldValue(o);return i="function"==typeof i?i(t,s,o):i,n.filters[e.definition.headerFilterFunc](t,s,o,i)}):console.warn("Header Filter Error - Matching filter function not found: ",e.definition.headerFilterFunc);break;case"function":o=function(o){var i=e.definition.headerFilterFuncParams||{},n=e.getFieldValue(o);return i="function"==typeof i?i(t,n,o):i,e.definition.headerFilterFunc(t,n,o,i)},l=o}if(!o)switch(a){case"partial":o=function(o){var i=e.getFieldValue(o);return"undefined"!=typeof i&&null!==i&&String(i).toLowerCase().indexOf(String(t).toLowerCase())>-1},l="like";break;default:o=function(o){return e.getFieldValue(o)==t},l="="}n.headerFilters[s]={value:t,func:o,type:l}}n.changed=!0,n.table.rowManager.filterRefresh()}}var i,n=this,s=e.getField();e.modules.filter={success:o,attrType:!1,tagType:!1,emptyFunc:!1},this.generateHeaderFilterElement(e)},C.prototype.generateHeaderFilterElement=function(e,t){function o(){}var i,n,s,a,l,u,c,d=this,h=this,p=e.modules.filter.success,m=e.getField();if(e.modules.filter.headerElement&&e.modules.filter.headerElement.parentNode){var f=e.modules.filter.headerElement.parentNode,g=h.headerFilterElements.indexOf(f);g>=0&&h.headerFilterElements.splice(g,1);var b=h.headerFilterColumns.indexOf(b);b>=0&&h.headerFilterColumns.splice(b,1),e.contentElement.removeChild(f)}if(m){switch(e.modules.filter.emptyFunc=e.definition.headerFilterEmptyCheck||function(e){return!e&&"0"!==e},i=document.createElement("div"),i.classList.add("tabulator-header-filter"),r(e.definition.headerFilter)){case"string":h.table.modules.edit.editors[e.definition.headerFilter]?(n=h.table.modules.edit.editors[e.definition.headerFilter],"tick"!==e.definition.headerFilter&&"tickCross"!==e.definition.headerFilter||e.definition.headerFilterEmptyCheck||(e.modules.filter.emptyFunc=function(e){return e!==!0&&e!==!1})):console.warn("Filter Error - Cannot build header filter, No such editor found: ",e.definition.editor);break;case"function":n=e.definition.headerFilter;break;case"boolean":e.modules.edit&&e.modules.edit.editor?n=e.modules.edit.editor:e.definition.formatter&&h.table.modules.edit.editors[e.definition.formatter]?(n=h.table.modules.edit.editors[e.definition.formatter],"tick"!==e.definition.formatter&&"tickCross"!==e.definition.formatter||e.definition.headerFilterEmptyCheck||(e.modules.filter.emptyFunc=function(e){return e!==!0&&e!==!1})):n=h.table.modules.edit.editors.input}if(n){if(a={getValue:function(){return"undefined"!=typeof t?t:""},getField:function(){return e.definition.field},getElement:function(){return i},getColumn:function(){return e.getComponent()},getRow:function(){return{normalizeHeight:function(){}}}},c=e.definition.headerFilterParams||{},c="function"==typeof c?c.call(h.table):c,s=n.call(this.table.modules.edit,a,function(){},p,o,c),!s)return void console.warn("Filter Error - Cannot add filter to "+m+" column, editor returned a value of false");if(!(s instanceof Node))return void console.warn("Filter Error - Cannot add filter to "+m+" column, editor should return an instance of Node, the editor returned:",s);m?h.table.modules.localize.bind("headerFilters|columns|"+e.definition.field,function(e){s.setAttribute("placeholder","undefined"!=typeof e&&e?e:h.table.modules.localize.getText("headerFilters|default"))}):h.table.modules.localize.bind("headerFilters|default",function(e){s.setAttribute("placeholder","undefined"!=typeof h.column.definition.headerFilterPlaceholder&&h.column.definition.headerFilterPlaceholder?h.column.definition.headerFilterPlaceholder:e)}),s.addEventListener("click",function(e){e.stopPropagation(),s.focus()}),s.addEventListener("focus",function(e){var t=d.table.columnManager.element.scrollLeft;t!==d.table.rowManager.element.scrollLeft&&(d.table.rowManager.scrollHorizontal(t),d.table.columnManager.scrollHorizontal(t))}),l=!1,u=function(e){l&&clearTimeout(l),l=setTimeout(function(){p(s.value)},300)},e.modules.filter.headerElement=s,e.modules.filter.attrType=s.hasAttribute("type")?s.getAttribute("type").toLowerCase():"",e.modules.filter.tagType=s.tagName.toLowerCase(),e.definition.headerFilterLiveFilter!==!1&&("autocomplete"!==e.definition.headerFilter&&"tickCross"!==e.definition.headerFilter&&("autocomplete"!==e.definition.editor&&"tickCross"!==e.definition.editor||e.definition.headerFilter!==!0)&&(s.addEventListener("keyup",u),s.addEventListener("search",u),"number"==e.modules.filter.attrType&&s.addEventListener("change",function(e){p(s.value)}),"text"==e.modules.filter.attrType&&"ie"!==this.table.browser&&s.setAttribute("type","search")),
- "input"!=e.modules.filter.tagType&&"select"!=e.modules.filter.tagType&&"textarea"!=e.modules.filter.tagType||s.addEventListener("mousedown",function(e){e.stopPropagation()})),i.appendChild(s),e.contentElement.appendChild(i),h.headerFilterElements.push(s),h.headerFilterColumns.push(e)}}else console.warn("Filter Error - Cannot add header filter, column has no field set:",e.definition.title)},C.prototype.hideHeaderFilterElements=function(){this.headerFilterElements.forEach(function(e){e.style.display="none"})},C.prototype.showHeaderFilterElements=function(){this.headerFilterElements.forEach(function(e){e.style.display=""})},C.prototype.setHeaderFilterFocus=function(e){e.modules.filter&&e.modules.filter.headerElement?e.modules.filter.headerElement.focus():console.warn("Column Filter Focus Error - No header filter set on column:",e.getField())},C.prototype.setHeaderFilterValue=function(e,t){e&&(e.modules.filter&&e.modules.filter.headerElement?(this.generateHeaderFilterElement(e,t),e.modules.filter.success(t)):console.warn("Column Filter Error - No header filter set on column:",e.getField()))},C.prototype.reloadHeaderFilter=function(e){e&&(e.modules.filter&&e.modules.filter.headerElement?this.generateHeaderFilterElement(e,e.modules.filter.value):console.warn("Column Filter Error - No header filter set on column:",e.getField()))},C.prototype.hasChanged=function(){var e=this.changed;return this.changed=!1,e},C.prototype.setFilter=function(e,t,o){var i=this;i.filterList=[],Array.isArray(e)||(e=[{field:e,type:t,value:o}]),i.addFilter(e)},C.prototype.addFilter=function(e,t,o){var i=this;Array.isArray(e)||(e=[{field:e,type:t,value:o}]),e.forEach(function(e){e=i.findFilter(e),e&&(i.filterList.push(e),i.changed=!0)}),this.table.options.persistentFilter&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.save("filter")},C.prototype.findFilter=function(e){var t,o=this;if(Array.isArray(e))return this.findSubFilters(e);var i=!1;return"function"==typeof e.field?i=function(t){return e.field(t,e.type||{})}:o.filters[e.type]?(t=o.table.columnManager.getColumnByField(e.field),i=t?function(i){return o.filters[e.type](e.value,t.getFieldValue(i))}:function(t){return o.filters[e.type](e.value,t[e.field])}):console.warn("Filter Error - No such filter type found, ignoring: ",e.type),e.func=i,!!e.func&&e},C.prototype.findSubFilters=function(e){var t=this,o=[];return e.forEach(function(e){e=t.findFilter(e),e&&o.push(e)}),!!o.length&&o},C.prototype.getFilters=function(e,t){var o=this,i=[];return e&&(i=o.getHeaderFilters()),o.filterList.forEach(function(e){i.push({field:e.field,type:e.type,value:e.value})}),t&&i.forEach(function(e){"function"==typeof e.type&&(e.type="function")}),i},C.prototype.getHeaderFilters=function(){var e=[];for(var t in this.headerFilters)e.push({field:t,type:this.headerFilters[t].type,value:this.headerFilters[t].value});return e},C.prototype.removeFilter=function(e,t,o){var i=this;Array.isArray(e)||(e=[{field:e,type:t,value:o}]),e.forEach(function(e){var t=-1;t="object"==r(e.field)?i.filterList.findIndex(function(t){return e===t}):i.filterList.findIndex(function(t){return e.field===t.field&&e.type===t.type&&e.value===t.value}),t>-1?(i.filterList.splice(t,1),i.changed=!0):console.warn("Filter Error - No matching filter type found, ignoring: ",e.type)}),this.table.options.persistentFilter&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.save("filter")},C.prototype.clearFilter=function(e){this.filterList=[],e&&this.clearHeaderFilter(),this.changed=!0,this.table.options.persistentFilter&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.save("filter")},C.prototype.clearHeaderFilter=function(){var e=this;this.headerFilters={},this.headerFilterColumns.forEach(function(t){t.modules.filter.value=null,e.reloadHeaderFilter(t)}),this.changed=!0},C.prototype.search=function(e,t,o,i){var n=this,s=[],r=[];return Array.isArray(t)||(t=[{field:t,type:o,value:i}]),t.forEach(function(e){e=n.findFilter(e),e&&r.push(e)}),this.table.rowManager.rows.forEach(function(t){var o=!0;r.forEach(function(e){n.filterRecurse(e,t.getData())||(o=!1)}),o&&s.push("data"===e?t.getData("data"):t.getComponent())}),s},C.prototype.filter=function(e,t){var o=this,i=[],n=[];return o.table.options.dataFiltering&&o.table.options.dataFiltering.call(o.table,o.getFilters()),o.table.options.ajaxFiltering||!o.filterList.length&&!Object.keys(o.headerFilters).length?i=e.slice(0):e.forEach(function(e){o.filterRow(e)&&i.push(e)}),o.table.options.dataFiltered&&(i.forEach(function(e){n.push(e.getComponent())}),o.table.options.dataFiltered.call(o.table,o.getFilters(),n)),i},C.prototype.filterRow=function(e,t){var o=this,i=!0,n=e.getData();o.filterList.forEach(function(e){o.filterRecurse(e,n)||(i=!1)});for(var s in o.headerFilters)o.headerFilters[s].func(n)||(i=!1);return i},C.prototype.filterRecurse=function(e,t){var o=this,i=!1;return Array.isArray(e)?e.forEach(function(e){o.filterRecurse(e,t)&&(i=!0)}):i=e.func(t),i},C.prototype.filters={"=":function(e,t,o,i){return t==e},"<":function(e,t,o,i){return t<e},"<=":function(e,t,o,i){return t<=e},">":function(e,t,o,i){return t>e},">=":function(e,t,o,i){return t>=e},"!=":function(e,t,o,i){return t!=e},regex:function(e,t,o,i){return"string"==typeof e&&(e=new RegExp(e)),e.test(t)},like:function(e,t,o,i){return null===e||"undefined"==typeof e?t===e:"undefined"!=typeof t&&null!==t&&String(t).toLowerCase().indexOf(e.toLowerCase())>-1},in:function(e,t,o,i){return Array.isArray(e)?e.indexOf(t)>-1:(console.warn("Filter Error - filter value is not an array:",e),!1)}},d.prototype.registerModule("filter",C);var x=function(e){this.table=e};x.prototype.initializeColumn=function(e){var t=this,o={params:e.definition.formatterParams||{}};switch(r(e.definition.formatter)){case"string":"tick"===e.definition.formatter&&(e.definition.formatter="tickCross","undefined"==typeof o.params.crossElement&&(o.params.crossElement=!1),console.warn("DEPRECATION WANRING - the tick formatter has been depricated, please use the tickCross formatter with the crossElement param set to false")),t.formatters[e.definition.formatter]?o.formatter=t.formatters[e.definition.formatter]:(console.warn("Formatter Error - No such formatter found: ",e.definition.formatter),o.formatter=t.formatters.plaintext);break;case"function":o.formatter=e.definition.formatter;break;default:o.formatter=t.formatters.plaintext}e.modules.format=o},x.prototype.cellRendered=function(e){e.column.modules.format.renderedCallback&&e.column.modules.format.renderedCallback()},x.prototype.formatValue=function(e){function t(t){e.column.modules.format.renderedCallback=t}var o=e.getComponent(),i="function"==typeof e.column.modules.format.params?e.column.modules.format.params(o):e.column.modules.format.params;return e.column.modules.format.formatter.call(this,o,i,t)},x.prototype.sanitizeHTML=function(e){if(e){var t={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};return String(e).replace(/[&<>"'`=\/]/g,function(e){return t[e]})}return e},x.prototype.emptyToSpace=function(e){return null===e||"undefined"==typeof e?" ":e},x.prototype.getFormatter=function(e){var e;switch("undefined"==typeof e?"undefined":r(e)){case"string":this.formatters[e]?e=this.formatters[e]:(console.warn("Formatter Error - No such formatter found: ",e),e=this.formatters.plaintext);break;case"function":e=e;break;default:e=this.formatters.plaintext}return e},x.prototype.formatters={plaintext:function(e,t,o){return this.emptyToSpace(this.sanitizeHTML(e.getValue()))},html:function(e,t,o){return e.getValue()},textarea:function(e,t,o){return e.getElement().style.whiteSpace="pre-wrap",this.emptyToSpace(this.sanitizeHTML(e.getValue()))},money:function(e,t,o){var i,n,s,r,a=parseFloat(e.getValue()),l=t.decimal||".",u=t.thousand||",",c=t.symbol||"",d=!!t.symbolAfter,h="undefined"!=typeof t.precision?t.precision:2;if(isNaN(a))return this.emptyToSpace(this.sanitizeHTML(e.getValue()));for(i=h!==!1?a.toFixed(h):a,i=String(i).split("."),n=i[0],s=i.length>1?l+i[1]:"",r=/(\d+)(\d{3})/;r.test(n);)n=n.replace(r,"$1"+u+"$2");return d?n+s+c:c+n+s},link:function(e,t,o){var i,n=e.getValue(),s=t.urlPrefix||"",a=this.emptyToSpace(n),l=document.createElement("a");if(t.labelField&&(i=e.getData(),a=i[t.labelField]),t.label)switch(r(t.label)){case"string":a=t.label;break;case"function":a=t.label(e)}if(t.urlField&&(i=e.getData(),n=i[t.urlField]),t.url)switch(r(t.url)){case"string":n=t.url;break;case"function":n=t.url(e)}return l.setAttribute("href",s+n),t.target&&l.setAttribute("target",t.target),l.innerHTML=this.emptyToSpace(this.sanitizeHTML(a)),l},image:function(e,t,o){var i=document.createElement("img");switch(i.setAttribute("src",e.getValue()),r(t.height)){case"number":i.style.height=t.height+"px";break;case"string":i.style.height=t.height}switch(r(t.width)){case"number":i.style.width=t.width+"px";break;case"string":i.style.width=t.width}return i.addEventListener("load",function(){e.getRow().normalizeHeight()}),i},tickCross:function(e,t,o){var i=e.getValue(),n=e.getElement(),s=t.allowEmpty,r=t.allowTruthy,a="undefined"!=typeof t.tickElement?t.tickElement:'<svg enable-background="new 0 0 24 24" height="14" width="14" viewBox="0 0 24 24" xml:space="preserve" ><path fill="#2DC214" clip-rule="evenodd" d="M21.652,3.211c-0.293-0.295-0.77-0.295-1.061,0L9.41,14.34 c-0.293,0.297-0.771,0.297-1.062,0L3.449,9.351C3.304,9.203,3.114,9.13,2.923,9.129C2.73,9.128,2.534,9.201,2.387,9.351 l-2.165,1.946C0.078,11.445,0,11.63,0,11.823c0,0.194,0.078,0.397,0.223,0.544l4.94,5.184c0.292,0.296,0.771,0.776,1.062,1.07 l2.124,2.141c0.292,0.293,0.769,0.293,1.062,0l14.366-14.34c0.293-0.294,0.293-0.777,0-1.071L21.652,3.211z" fill-rule="evenodd"/></svg>',l="undefined"!=typeof t.crossElement?t.crossElement:'<svg enable-background="new 0 0 24 24" height="14" width="14" viewBox="0 0 24 24" xml:space="preserve" ><path fill="#CE1515" d="M22.245,4.015c0.313,0.313,0.313,0.826,0,1.139l-6.276,6.27c-0.313,0.312-0.313,0.826,0,1.14l6.273,6.272 c0.313,0.313,0.313,0.826,0,1.14l-2.285,2.277c-0.314,0.312-0.828,0.312-1.142,0l-6.271-6.271c-0.313-0.313-0.828-0.313-1.141,0 l-6.276,6.267c-0.313,0.313-0.828,0.313-1.141,0l-2.282-2.28c-0.313-0.313-0.313-0.826,0-1.14l6.278-6.269 c0.313-0.312,0.313-0.826,0-1.14L1.709,5.147c-0.314-0.313-0.314-0.827,0-1.14l2.284-2.278C4.308,1.417,4.821,1.417,5.135,1.73 L11.405,8c0.314,0.314,0.828,0.314,1.141,0.001l6.276-6.267c0.312-0.312,0.826-0.312,1.141,0L22.245,4.015z"/></svg>';return r&&i||i===!0||"true"===i||"True"===i||1===i||"1"===i?(n.setAttribute("aria-checked",!0),a||""):!s||"null"!==i&&""!==i&&null!==i&&"undefined"!=typeof i?(n.setAttribute("aria-checked",!1),l||""):(n.setAttribute("aria-checked","mixed"),"")},datetime:function(e,t,o){var i=t.inputFormat||"YYYY-MM-DD hh:mm:ss",n=t.outputFormat||"DD/MM/YYYY hh:mm:ss",s="undefined"!=typeof t.invalidPlaceholder?t.invalidPlaceholder:"",r=e.getValue(),a=moment(r,i);return a.isValid()?a.format(n):s===!0?r:"function"==typeof s?s(r):s},datetimediff:function(e,t,o){var i=t.inputFormat||"YYYY-MM-DD hh:mm:ss",n="undefined"!=typeof t.invalidPlaceholder?t.invalidPlaceholder:"",s="undefined"!=typeof t.suffix&&t.suffix,r="undefined"!=typeof t.unit?t.unit:void 0,a="undefined"!=typeof t.humanize&&t.humanize,l="undefined"!=typeof t.date?t.date:moment(),u=e.getValue(),c=moment(u,i);return c.isValid()?a?moment.duration(c.diff(l)).humanize(s):c.diff(l,r)+(s?" "+s:""):n===!0?u:"function"==typeof n?n(u):n},lookup:function(e,t,o){var i=e.getValue();return"undefined"==typeof t[i]?(console.warn("Missing display value for "+i),i):t[i]},star:function e(t,o,i){var n=t.getValue(),s=t.getElement(),r=o&&o.stars?o.stars:5,a=document.createElement("span"),e=document.createElementNS("http://www.w3.org/2000/svg","svg"),l='<polygon fill="#FFEA00" stroke="#C1AB60" stroke-width="37.6152" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="259.216,29.942 330.27,173.919 489.16,197.007 374.185,309.08 401.33,467.31 259.216,392.612 117.104,467.31 144.25,309.08 29.274,197.007 188.165,173.919 "/>',u='<polygon fill="#D2D2D2" stroke="#686868" stroke-width="37.6152" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="259.216,29.942 330.27,173.919 489.16,197.007 374.185,309.08 401.33,467.31 259.216,392.612 117.104,467.31 144.25,309.08 29.274,197.007 188.165,173.919 "/>';a.style.verticalAlign="middle",e.setAttribute("width","14"),e.setAttribute("height","14"),e.setAttribute("viewBox","0 0 512 512"),e.setAttribute("xml:space","preserve"),e.style.padding="0 1px",n=parseInt(n)<r?parseInt(n):r;for(var c=1;c<=r;c++){var d=e.cloneNode(!0);d.innerHTML=c<=n?l:u,a.appendChild(d)}return s.style.whiteSpace="nowrap",s.style.overflow="hidden",s.style.textOverflow="ellipsis",s.setAttribute("aria-label",n),a},traffic:function(e,t,o){var i,n,s=this.sanitizeHTML(e.getValue())||0,a=document.createElement("span"),l=t&&t.max?t.max:100,u=t&&t.min?t.min:0,c=t&&"undefined"!=typeof t.color?t.color:["red","orange","green"],d="#666666";if(!isNaN(s)&&"undefined"!=typeof e.getValue()){switch(a.classList.add("tabulator-traffic-light"),n=parseFloat(s)<=l?parseFloat(s):l,n=parseFloat(n)>=u?parseFloat(n):u,i=(l-u)/100,n=Math.round((n-u)/i),"undefined"==typeof c?"undefined":r(c)){case"string":d=c;break;case"function":d=c(s);break;case"object":if(Array.isArray(c)){var h=100/c.length,p=Math.floor(n/h);p=Math.min(p,c.length-1),p=Math.max(p,0),d=c[p];break}}return a.style.backgroundColor=d,a}},progress:function(e,t,o){var i,n,s,a,l,u=this.sanitizeHTML(e.getValue())||0,c=e.getElement(),d=t&&t.max?t.max:100,h=t&&t.min?t.min:0,p=t&&t.legendAlign?t.legendAlign:"center";switch(n=parseFloat(u)<=d?parseFloat(u):d,n=parseFloat(n)>=h?parseFloat(n):h,i=(d-h)/100,n=Math.round((n-h)/i),r(t.color)){case"string":s=t.color;break;case"function":s=t.color(u);break;case"object":if(Array.isArray(t.color)){var m=100/t.color.length,f=Math.floor(n/m);f=Math.min(f,t.color.length-1),f=Math.max(f,0),s=t.color[f];break}default:s="#2DC214"}switch(r(t.legend)){case"string":a=t.legend;break;case"function":a=t.legend(u);break;case"boolean":a=u;break;default:a=!1}switch(r(t.legendColor)){case"string":l=t.legendColor;break;case"function":l=t.legendColor(u);break;case"object":if(Array.isArray(t.legendColor)){var m=100/t.legendColor.length,f=Math.floor(n/m);f=Math.min(f,t.legendColor.length-1),f=Math.max(f,0),l=t.legendColor[f]}break;default:l="#000"}return c.style.minWidth="30px",c.style.position="relative",c.setAttribute("aria-label",n),"<div style='position:realtive; height:100%;' data-max='"+d+"' data-min='"+h+"'><div style='position:relative; height:100%; width:calc("+n+"%); background-color:"+s+"; display:inline-block;'></div></div>"+(a?"<div style='position:absolute; top:4px; left:0; text-align:"+p+"; width:100%; color:"+l+";'>"+a+"</div>":"")},color:function(e,t,o){return e.getElement().style.backgroundColor=this.sanitizeHTML(e.getValue()),""},buttonTick:function(e,t,o){return'<svg enable-background="new 0 0 24 24" height="14" width="14" viewBox="0 0 24 24" xml:space="preserve" ><path fill="#2DC214" clip-rule="evenodd" d="M21.652,3.211c-0.293-0.295-0.77-0.295-1.061,0L9.41,14.34 c-0.293,0.297-0.771,0.297-1.062,0L3.449,9.351C3.304,9.203,3.114,9.13,2.923,9.129C2.73,9.128,2.534,9.201,2.387,9.351 l-2.165,1.946C0.078,11.445,0,11.63,0,11.823c0,0.194,0.078,0.397,0.223,0.544l4.94,5.184c0.292,0.296,0.771,0.776,1.062,1.07 l2.124,2.141c0.292,0.293,0.769,0.293,1.062,0l14.366-14.34c0.293-0.294,0.293-0.777,0-1.071L21.652,3.211z" fill-rule="evenodd"/></svg>'},buttonCross:function(e,t,o){return'<svg enable-background="new 0 0 24 24" height="14" width="14" viewBox="0 0 24 24" xml:space="preserve" ><path fill="#CE1515" d="M22.245,4.015c0.313,0.313,0.313,0.826,0,1.139l-6.276,6.27c-0.313,0.312-0.313,0.826,0,1.14l6.273,6.272 c0.313,0.313,0.313,0.826,0,1.14l-2.285,2.277c-0.314,0.312-0.828,0.312-1.142,0l-6.271-6.271c-0.313-0.313-0.828-0.313-1.141,0 l-6.276,6.267c-0.313,0.313-0.828,0.313-1.141,0l-2.282-2.28c-0.313-0.313-0.313-0.826,0-1.14l6.278-6.269 c0.313-0.312,0.313-0.826,0-1.14L1.709,5.147c-0.314-0.313-0.314-0.827,0-1.14l2.284-2.278C4.308,1.417,4.821,1.417,5.135,1.73 L11.405,8c0.314,0.314,0.828,0.314,1.141,0.001l6.276-6.267c0.312-0.312,0.826-0.312,1.141,0L22.245,4.015z"/></svg>'},rownum:function(e,t,o){return this.table.rowManager.activeRows.indexOf(e.getRow()._getSelf())+1},handle:function(e,t,o){return e.getElement().classList.add("tabulator-row-handle"),"<div class='tabulator-row-handle-box'><div class='tabulator-row-handle-bar'></div><div class='tabulator-row-handle-bar'></div><div class='tabulator-row-handle-bar'></div></div>"},responsiveCollapse:function(e,t,o){function i(t){var o=e.getRow().getElement().getElementsByClassName("tabulator-responsive-collapse")[0];s=t,s?(r.classList.add("open"),o&&(o.style.display="")):(r.classList.remove("open"),o&&(o.style.display="none"))}var n=this,s=!1,r=document.createElement("div");return r.classList.add("tabulator-responsive-collapse-toggle"),r.innerHTML="<span class='tabulator-responsive-collapse-toggle-open'>+</span><span class='tabulator-responsive-collapse-toggle-close'>-</span>",e.getElement().classList.add("tabulator-row-handle"),n.table.options.responsiveLayoutCollapseStartOpen&&(s=!0),r.addEventListener("click",function(e){e.stopImmediatePropagation(),i(!s)}),i(s),r}},d.prototype.registerModule("format",x);var R=function(e){this.table=e,this.leftColumns=[],this.rightColumns=[],this.leftMargin=0,this.rightMargin=0,this.rightPadding=0,this.initializationMode="left",this.active=!1,this.scrollEndTimer=!1};R.prototype.reset=function(){this.initializationMode="left",this.leftColumns=[],this.rightColumns=[],this.leftMargin=0,this.rightMargin=0,this.rightMargin=0,this.active=!1,this.table.columnManager.headersElement.style.marginLeft=0,this.table.columnManager.element.style.paddingRight=0},R.prototype.initializeColumn=function(e){var t={margin:0,edge:!1};e.definition.frozen?e.parent.isGroup?console.warn("Frozen Column Error - Grouped columns cannot be frozen"):e.isGroup?console.warn("Frozen Column Error - Column Groups cannot be frozen"):(t.position=this.initializationMode,"left"==this.initializationMode?this.leftColumns.push(e):this.rightColumns.unshift(e),this.active=!0,e.modules.frozen=t):this.initializationMode="right"},R.prototype.scrollHorizontal=function(){var e,t=this;this.active&&(clearTimeout(this.scrollEndTimer),this.scrollEndTimer=setTimeout(function(){t.layout()},100),e=this.table.rowManager.getVisibleRows(),this.calcMargins(),this.layoutColumnPosition(),this.layoutCalcRows(),e.forEach(function(e){t.layoutRow(e)}),this.table.rowManager.tableElement.style.marginRight=this.rightMargin)},R.prototype.calcMargins=function(){this.leftMargin=this._calcSpace(this.leftColumns,this.leftColumns.length)+"px",this.table.columnManager.headersElement.style.marginLeft=this.leftMargin,this.rightMargin=this._calcSpace(this.rightColumns,this.rightColumns.length)+"px",this.table.columnManager.element.style.paddingRight=this.rightMargin,this.rightPadding=this.table.rowManager.element.clientWidth+this.table.columnManager.scrollLeft},R.prototype.layoutCalcRows=function(){this.table.modExists("columnCalcs")&&(this.table.modules.columnCalcs.topInitialized&&this.table.modules.columnCalcs.topRow&&this.layoutRow(this.table.modules.columnCalcs.topRow),this.table.modules.columnCalcs.botInitialized&&this.table.modules.columnCalcs.botRow&&this.layoutRow(this.table.modules.columnCalcs.botRow))},R.prototype.layoutColumnPosition=function(e){var t=this;this.leftColumns.forEach(function(o,i){o.modules.frozen.margin=t._calcSpace(t.leftColumns,i)+t.table.columnManager.scrollLeft+"px",i==t.leftColumns.length-1?o.modules.frozen.edge=!0:o.modules.frozen.edge=!1,t.layoutElement(o.getElement(),o),e&&o.cells.forEach(function(e){t.layoutElement(e.getElement(),o)})}),this.rightColumns.forEach(function(o,i){o.modules.frozen.margin=t.rightPadding-t._calcSpace(t.rightColumns,i+1)+"px",i==t.rightColumns.length-1?o.modules.frozen.edge=!0:o.modules.frozen.edge=!1,t.layoutElement(o.getElement(),o),e&&o.cells.forEach(function(e){t.layoutElement(e.getElement(),o)})})},R.prototype.layout=function(){var e=this;e.active&&(this.calcMargins(),e.table.rowManager.getDisplayRows().forEach(function(t){e.layoutRow(t)}),this.layoutCalcRows(),this.layoutColumnPosition(!0),this.table.rowManager.tableElement.style.marginRight=this.rightMargin)},R.prototype.layoutRow=function(e){var t=this,o=e.getElement();o.style.paddingLeft=this.leftMargin,this.leftColumns.forEach(function(o){var i=e.getCell(o);i&&t.layoutElement(i.getElement(),o)}),this.rightColumns.forEach(function(o){var i=e.getCell(o);i&&t.layoutElement(i.getElement(),o)})},R.prototype.layoutElement=function(e,t){t.modules.frozen&&(e.style.position="absolute",e.style.left=t.modules.frozen.margin,e.classList.add("tabulator-frozen"),t.modules.frozen.edge&&e.classList.add("tabulator-frozen-"+t.modules.frozen.position))},R.prototype._calcSpace=function(e,t){for(var o=0,i=0;i<t;i++)e[i].visible&&(o+=e[i].getWidth());return o},d.prototype.registerModule("frozenColumns",R);var M=function(e){this.table=e,this.topElement=document.createElement("div"),this.rows=[],this.displayIndex=0};M.prototype.initialize=function(){this.rows=[],this.topElement.classList.add("tabulator-frozen-rows-holder"),this.table.columnManager.getElement().insertBefore(this.topElement,this.table.columnManager.headersElement.nextSibling)},M.prototype.setDisplayIndex=function(e){this.displayIndex=e},M.prototype.getDisplayIndex=function(){return this.displayIndex},M.prototype.isFrozen=function(){return!!this.rows.length},M.prototype.getRows=function(e){var t=e.slice(0);return this.rows.forEach(function(e){var o=t.indexOf(e);o>-1&&t.splice(o,1)}),t},M.prototype.freezeRow=function(e){e.modules.frozen?console.warn("Freeze Error - Row is already frozen"):(e.modules.frozen=!0,this.topElement.appendChild(e.getElement()),e.initialize(),e.normalizeHeight(),this.table.rowManager.adjustTableSize(),this.rows.push(e),this.table.rowManager.refreshActiveData("display"),this.styleRows())},M.prototype.unfreezeRow=function(e){var t=this.rows.indexOf(e);if(e.modules.frozen){e.modules.frozen=!1;var o=e.getElement();o.parentNode.removeChild(o),this.table.rowManager.adjustTableSize(),this.rows.splice(t,1),this.table.rowManager.refreshActiveData("display"),this.rows.length&&this.styleRows()}else console.warn("Freeze Error - Row is already unfrozen")},M.prototype.styleRows=function(e){var t=this;this.rows.forEach(function(e,o){t.table.rowManager.styleRow(e,o)})},d.prototype.registerModule("frozenRows",M);var D=function(e){this._group=e,this.type="GroupComponent"};D.prototype.getKey=function(){return this._group.key},D.prototype.getElement=function(){return this._group.element},D.prototype.getRows=function(){return this._group.getRows(!0)},D.prototype.getSubGroups=function(){return this._group.getSubGroups(!0)},D.prototype.getParentGroup=function(){return!!this._group.parent&&this._group.parent.getComponent()},D.prototype.getVisibility=function(){return this._group.visible},D.prototype.show=function(){this._group.show()},D.prototype.hide=function(){this._group.hide()},D.prototype.toggle=function(){this._group.toggleVisibility()},D.prototype._getSelf=function(){return this._group},D.prototype.getTable=function(){return this._group.groupManager.table};var L=function(e,t,o,i,n,s,r){this.groupManager=e,this.parent=t,this.key=i,this.level=o,this.field=n,this.hasSubGroups=o<e.groupIDLookups.length-1,this.addRow=this.hasSubGroups?this._addRowToGroup:this._addRow,this.type="group",this.old=r,this.rows=[],this.groups=[],this.groupList=[],this.generator=s,this.elementContents=!1,this.height=0,this.outerHeight=0,this.initialized=!1,this.calcs={},this.initialized=!1,this.modules={},this.arrowElement=!1,this.visible=r?r.visible:"undefined"!=typeof e.startOpen[o]?e.startOpen[o]:e.startOpen[0],this.createElements(),this.addBindings(),this.createValueGroups()};L.prototype.wipe=function(){this.groupList.length?this.groupList.forEach(function(e){e.wipe()}):(this.element=!1,this.arrowElement=!1,this.elementContents=!1)},L.prototype.createElements=function(){this.element=document.createElement("div"),this.element.classList.add("tabulator-row"),this.element.classList.add("tabulator-group"),this.element.classList.add("tabulator-group-level-"+this.level),this.element.setAttribute("role","rowgroup"),this.arrowElement=document.createElement("div"),this.arrowElement.classList.add("tabulator-arrow"),this.groupManager.table.options.movableRows!==!1&&this.groupManager.table.modExists("moveRow")&&this.groupManager.table.modules.moveRow.initializeGroupHeader(this)},L.prototype.createValueGroups=function(){var e=this,t=this.level+1;this.groupManager.allowedValues&&this.groupManager.allowedValues[t]&&this.groupManager.allowedValues[t].forEach(function(o){e._createGroup(o,t)})},L.prototype.addBindings=function(){var e,t,o,i,n=this;n.groupManager.table.options.groupClick&&n.element.addEventListener("click",function(e){n.groupManager.table.options.groupClick(e,n.getComponent())}),n.groupManager.table.options.groupDblClick&&n.element.addEventListener("dblclick",function(e){n.groupManager.table.options.groupDblClick(e,n.getComponent())}),n.groupManager.table.options.groupContext&&n.element.addEventListener("contextmenu",function(e){n.groupManager.table.options.groupContext(e,n.getComponent())}),n.groupManager.table.options.groupTap&&(o=!1,n.element.addEventListener("touchstart",function(e){o=!0}),n.element.addEventListener("touchend",function(e){o&&n.groupManager.table.options.groupTap(e,n.getComponent()),o=!1})),n.groupManager.table.options.groupDblTap&&(e=null,n.element.addEventListener("touchend",function(t){e?(clearTimeout(e),e=null,n.groupManager.table.options.groupDblTap(t,n.getComponent())):e=setTimeout(function(){clearTimeout(e),e=null},300)})),n.groupManager.table.options.groupTapHold&&(t=null,n.element.addEventListener("touchstart",function(e){clearTimeout(t),t=setTimeout(function(){clearTimeout(t),t=null,o=!1,n.groupManager.table.options.groupTapHold(e,n.getComponent())},1e3)}),n.element.addEventListener("touchend",function(e){clearTimeout(t),t=null})),n.groupManager.table.options.groupToggleElement&&(i="arrow"==n.groupManager.table.options.groupToggleElement?n.arrowElement:n.element,i.addEventListener("click",function(e){e.stopPropagation(),e.stopImmediatePropagation(),n.toggleVisibility()}))},L.prototype._createGroup=function(e,t){var o=t+"_"+e,i=new L(this.groupManager,this,t,e,this.groupManager.groupIDLookups[t].field,this.groupManager.headerGenerator[t]||this.groupManager.headerGenerator[0],!!this.old&&this.old.groups[o]);this.groups[o]=i,this.groupList.push(i)},L.prototype._addRowToGroup=function(e){var t=this.level+1;if(this.hasSubGroups){var o=this.groupManager.groupIDLookups[t].func(e.getData()),i=t+"_"+o;this.groupManager.allowedValues&&this.groupManager.allowedValues[t]?this.groups[i]&&this.groups[i].addRow(e):(this.groups[i]||this._createGroup(o,t),this.groups[i].addRow(e))}},L.prototype._addRow=function(e){this.rows.push(e),e.modules.group=this},L.prototype.insertRow=function(e,t,o){var i=this.conformRowData({});e.updateData(i);var n=this.rows.indexOf(t);n>-1?o?this.rows.splice(n+1,0,e):this.rows.splice(n,0,e):o?this.rows.push(e):this.rows.unshift(e),e.modules.group=this,this.generateGroupHeaderContents(),this.groupManager.table.modExists("columnCalcs")&&"table"!=this.groupManager.table.options.columnCalcs&&this.groupManager.table.modules.columnCalcs.recalcGroup(this),this.groupManager.updateGroupRows(!0)},L.prototype.scrollHeader=function(e){this.arrowElement.style.marginLeft=e,this.groupList.forEach(function(t){t.scrollHeader(e)})},L.prototype.getRowIndex=function(e){},L.prototype.conformRowData=function(e){return this.field?e[this.field]=this.key:console.warn("Data Conforming Error - Cannot conform row data to match new group as groupBy is a function"),this.parent&&(e=this.parent.conformRowData(e)),e},L.prototype.removeRow=function(e){var t=this.rows.indexOf(e),o=e.getElement();t>-1&&this.rows.splice(t,1),this.groupManager.table.options.groupValues||this.rows.length?(o.parentNode&&o.parentNode.removeChild(o),this.generateGroupHeaderContents(),this.groupManager.table.modExists("columnCalcs")&&"table"!=this.groupManager.table.options.columnCalcs&&this.groupManager.table.modules.columnCalcs.recalcGroup(this)):(this.parent?this.parent.removeGroup(this):this.groupManager.removeGroup(this),this.groupManager.updateGroupRows(!0))},L.prototype.removeGroup=function(e){var t,o=e.level+"_"+e.key;this.groups[o]&&(delete this.groups[o],t=this.groupList.indexOf(e),t>-1&&this.groupList.splice(t,1),this.groupList.length||(this.parent?this.parent.removeGroup(this):this.groupManager.removeGroup(this)))},L.prototype.getHeadersAndRows=function(e){var t=[];return t.push(this),this._visSet(),this.visible?this.groupList.length?this.groupList.forEach(function(o){t=t.concat(o.getHeadersAndRows(e))}):(!e&&"table"!=this.groupManager.table.options.columnCalcs&&this.groupManager.table.modExists("columnCalcs")&&this.groupManager.table.modules.columnCalcs.hasTopCalcs()&&(this.calcs.top&&this.calcs.top.detachElement(),this.calcs.top=this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows),t.push(this.calcs.top)),t=t.concat(this.rows),!e&&"table"!=this.groupManager.table.options.columnCalcs&&this.groupManager.table.modExists("columnCalcs")&&this.groupManager.table.modules.columnCalcs.hasBottomCalcs()&&(this.calcs.bottom&&this.calcs.bottom.detachElement(),this.calcs.bottom=this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows),t.push(this.calcs.bottom))):!this.groupList.length&&"table"!=this.groupManager.table.options.columnCalcs&&this.groupManager.table.options.groupClosedShowCalcs&&this.groupManager.table.modExists("columnCalcs")&&(!e&&this.groupManager.table.modules.columnCalcs.hasTopCalcs()&&(this.calcs.top&&this.calcs.top.detachElement(),this.calcs.top=this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows),t.push(this.calcs.top)),!e&&this.groupManager.table.modules.columnCalcs.hasBottomCalcs()&&(this.calcs.bottom&&this.calcs.bottom.detachElement(),this.calcs.bottom=this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows),t.push(this.calcs.bottom))),t},L.prototype.getData=function(e,t){var o=[];return this._visSet(),(!e||e&&this.visible)&&this.rows.forEach(function(e){o.push(e.getData(t||"data"))}),o},L.prototype.getRowCount=function(){var e=0;return this.groupList.length?this.groupList.forEach(function(t){e+=t.getRowCount()}):e=this.rows.length,e},L.prototype.toggleVisibility=function(){this.visible?this.hide():this.show()},L.prototype.hide=function(){this.visible=!1,"classic"!=this.groupManager.table.rowManager.getRenderMode()||this.groupManager.table.options.pagination?this.groupManager.updateGroupRows(!0):(this.element.classList.remove("tabulator-group-visible"),this.groupList.length?this.groupList.forEach(function(e){var t=e.getHeadersAndRows();t.forEach(function(e){e.detachElement()})}):this.rows.forEach(function(e){var t=e.getElement();t.parentNode.removeChild(t)}),this.groupManager.table.rowManager.setDisplayRows(this.groupManager.updateGroupRows(),this.groupManager.getDisplayIndex()),this.groupManager.table.rowManager.checkClassicModeGroupHeaderWidth()),this.groupManager.table.options.groupVisibilityChanged.call(this.table,this.getComponent(),!1)},L.prototype.show=function(){var e=this;if(e.visible=!0,"classic"!=this.groupManager.table.rowManager.getRenderMode()||this.groupManager.table.options.pagination)this.groupManager.updateGroupRows(!0);else{this.element.classList.add("tabulator-group-visible");var t=e.getElement();this.groupList.length?this.groupList.forEach(function(e){var o=e.getHeadersAndRows();o.forEach(function(e){var o=e.getElement();t.parentNode.insertBefore(o,t.nextSibling),e.initialize(),t=o})}):e.rows.forEach(function(e){var o=e.getElement();
- t.parentNode.insertBefore(o,t.nextSibling),e.initialize(),t=o}),this.groupManager.table.rowManager.setDisplayRows(this.groupManager.updateGroupRows(),this.groupManager.getDisplayIndex()),this.groupManager.table.rowManager.checkClassicModeGroupHeaderWidth()}this.groupManager.table.options.groupVisibilityChanged.call(this.table,this.getComponent(),!0)},L.prototype._visSet=function(){var e=[];"function"==typeof this.visible&&(this.rows.forEach(function(t){e.push(t.getData())}),this.visible=this.visible(this.key,this.getRowCount(),e,this.getComponent()))},L.prototype.getRowGroup=function(e){var t=!1;return this.groupList.length?this.groupList.forEach(function(o){var i=o.getRowGroup(e);i&&(t=i)}):this.rows.find(function(t){return t===e})&&(t=this),t},L.prototype.getSubGroups=function(e){var t=[];return this.groupList.forEach(function(o){t.push(e?o.getComponent():o)}),t},L.prototype.getRows=function(e){var t=[];return this.rows.forEach(function(o){t.push(e?o.getComponent():o)}),t},L.prototype.generateGroupHeaderContents=function(){var e=[];for(this.rows.forEach(function(t){e.push(t.getData())}),this.elementContents=this.generator(this.key,this.getRowCount(),e,this.getComponent());this.element.firstChild;)this.element.removeChild(this.element.firstChild);"string"==typeof this.elementContents?this.element.innerHTML=this.elementContents:this.element.appendChild(this.elementContents),this.element.insertBefore(this.arrowElement,this.element.firstChild)},L.prototype.getElement=function(){this.addBindingsd=!1,this._visSet(),this.visible?this.element.classList.add("tabulator-group-visible"):this.element.classList.remove("tabulator-group-visible");for(var e=0;e<this.element.childNodes.length;++e)this.element.childNodes[e].parentNode.removeChild(this.element.childNodes[e]);return this.generateGroupHeaderContents(),this.element},L.prototype.detachElement=function(){this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)},L.prototype.normalizeHeight=function(){this.setHeight(this.element.clientHeight)},L.prototype.initialize=function(e){this.initialized&&!e||(this.normalizeHeight(),this.initialized=!0)},L.prototype.reinitialize=function(){this.initialized=!1,this.height=0,d.prototype.helpers.elVisible(this.element)&&this.initialize(!0)},L.prototype.setHeight=function(e){this.height!=e&&(this.height=e,this.outerHeight=this.element.offsetHeight)},L.prototype.getHeight=function(){return this.outerHeight},L.prototype.getGroup=function(){return this},L.prototype.reinitializeHeight=function(){},L.prototype.calcHeight=function(){},L.prototype.setCellHeight=function(){},L.prototype.clearCellHeight=function(){},L.prototype.getComponent=function(){return new D(this)};var T=function(e){this.table=e,this.groupIDLookups=!1,this.startOpen=[function(){return!1}],this.headerGenerator=[function(){return""}],this.groupList=[],this.allowedValues=!1,this.groups={},this.displayIndex=0};T.prototype.initialize=function(){var e=this,t=e.table.options.groupBy,o=e.table.options.groupStartOpen,i=e.table.options.groupHeader;if(this.allowedValues=e.table.options.groupValues,e.headerGenerator=[function(){return""}],this.startOpen=[function(){return!1}],e.table.modules.localize.bind("groups|item",function(t,o){e.headerGenerator[0]=function(e,i,n){return("undefined"==typeof e?"":e)+"<span>("+i+" "+(1===i?t:o.groups.items)+")</span>"}}),this.groupIDLookups=[],Array.isArray(t)||t)this.table.modExists("columnCalcs")&&"table"!=this.table.options.columnCalcs&&"both"!=this.table.options.columnCalcs&&this.table.modules.columnCalcs.removeCalcs();else if(this.table.modExists("columnCalcs")&&"group"!=this.table.options.columnCalcs){var n=this.table.columnManager.getRealColumns();n.forEach(function(t){t.definition.topCalc&&e.table.modules.columnCalcs.initializeTopRow(),t.definition.bottomCalc&&e.table.modules.columnCalcs.initializeBottomRow()})}Array.isArray(t)||(t=[t]),t.forEach(function(t,o){var i,n;"function"==typeof t?i=t:(n=e.table.columnManager.getColumnByField(t),i=n?function(e){return n.getFieldValue(e)}:function(e){return e[t]}),e.groupIDLookups.push({field:"function"!=typeof t&&t,func:i,values:!!e.allowedValues&&e.allowedValues[o]})}),o&&(Array.isArray(o)||(o=[o]),o.forEach(function(e){e="function"==typeof e?e:function(){return!0}}),e.startOpen=o),i&&(e.headerGenerator=Array.isArray(i)?i:[i]),this.initialized=!0},T.prototype.setDisplayIndex=function(e){this.displayIndex=e},T.prototype.getDisplayIndex=function(){return this.displayIndex},T.prototype.getRows=function(e){return this.groupIDLookups.length?(this.table.options.dataGrouping.call(this.table),this.generateGroups(e),this.table.options.dataGrouped&&this.table.options.dataGrouped.call(this.table,this.getGroups(!0)),this.updateGroupRows()):e.slice(0)},T.prototype.getGroups=function(e){var t=[];return this.groupList.forEach(function(o){t.push(e?o.getComponent():o)}),t},T.prototype.wipe=function(){this.groupList.forEach(function(e){e.wipe()})},T.prototype.pullGroupListData=function(e){var t=this,o=[];return e.forEach(function(e){var i={};i.level=0,i.rowCount=0,i.headerContent="";var n=[];e.hasSubGroups?(n=t.pullGroupListData(e.groupList),i.level=e.level,i.rowCount=n.length-e.groupList.length,i.headerContent=e.generator(e.key,i.rowCount,e.rows,e),o.push(i),o=o.concat(n)):(i.level=e.level,i.headerContent=e.generator(e.key,e.rows.length,e.rows,e),i.rowCount=e.getRows().length,o.push(i),e.getRows().forEach(function(e){o.push(e.getData("data"))}))}),o},T.prototype.getGroupedData=function(){return this.pullGroupListData(this.groupList)},T.prototype.getRowGroup=function(e){var t=!1;return this.groupList.forEach(function(o){var i=o.getRowGroup(e);i&&(t=i)}),t},T.prototype.countGroups=function(){return this.groupList.length},T.prototype.generateGroups=function(e){var t=this,o=t.groups;t.groups={},t.groupList=[],this.allowedValues&&this.allowedValues[0]?(this.allowedValues[0].forEach(function(e){t.createGroup(e,0,o)}),e.forEach(function(e){t.assignRowToExistingGroup(e,o)})):e.forEach(function(e){t.assignRowToGroup(e,o)})},T.prototype.createGroup=function(e,t,o){var i,n=t+"_"+e;o=o||[],i=new L(this,!1,t,e,this.groupIDLookups[0].field,this.headerGenerator[0],o[n]),this.groups[n]=i,this.groupList.push(i)},T.prototype.assignRowToGroup=function(e,t){var o=this.groupIDLookups[0].func(e.getData()),i="0_"+o;this.groups[i]||this.createGroup(o,0,t),this.groups[i].addRow(e)},T.prototype.assignRowToExistingGroup=function(e,t){var o=this.groupIDLookups[0].func(e.getData()),i="0_"+o;this.groups[i]&&this.groups[i].addRow(e)},T.prototype.assignRowToGroup=function(e,t){var o=this.groupIDLookups[0].func(e.getData()),i=!this.groups["0_"+o];return i&&this.createGroup(o,0,t),this.groups["0_"+o].addRow(e),!i},T.prototype.updateGroupRows=function(e){var t=this,o=[];if(t.groupList.forEach(function(e){o=o.concat(e.getHeadersAndRows())}),e){var i=t.table.rowManager.setDisplayRows(o,this.getDisplayIndex());i!==!0&&this.setDisplayIndex(i),t.table.rowManager.refreshActiveData("group",!0,!0)}return o},T.prototype.scrollHeaders=function(e){e+="px",this.groupList.forEach(function(t){t.scrollHeader(e)})},T.prototype.removeGroup=function(e){var t,o=e.level+"_"+e.key;this.groups[o]&&(delete this.groups[o],t=this.groupList.indexOf(e),t>-1&&this.groupList.splice(t,1))},d.prototype.registerModule("groupRows",T);var k=function(e){this.table=e,this.history=[],this.index=-1};k.prototype.clear=function(){this.history=[],this.index=-1},k.prototype.action=function(e,t,o){this.history=this.history.slice(0,this.index+1),this.history.push({type:e,component:t,data:o}),this.index++},k.prototype.getHistoryUndoSize=function(){return this.index+1},k.prototype.getHistoryRedoSize=function(){return this.history.length-(this.index+1)},k.prototype.undo=function(){if(this.index>-1){var e=this.history[this.index];return this.undoers[e.type].call(this,e),this.index--,this.table.options.historyUndo.call(this.table,e.type,e.component.getComponent(),e.data),!0}return console.warn("History Undo Error - No more history to undo"),!1},k.prototype.redo=function(){if(this.history.length-1>this.index){this.index++;var e=this.history[this.index];return this.redoers[e.type].call(this,e),this.table.options.historyRedo.call(this.table,e.type,e.component.getComponent(),e.data),!0}return console.warn("History Redo Error - No more history to redo"),!1},k.prototype.undoers={cellEdit:function(e){e.component.setValueProcessData(e.data.oldValue)},rowAdd:function(e){e.component.deleteActual()},rowDelete:function(e){var t=this.table.rowManager.addRowActual(e.data.data,e.data.pos,e.data.index);this._rebindRow(e.component,t)},rowMove:function(e){this.table.rowManager.moveRowActual(e.component,this.table.rowManager.rows[e.data.pos],!1),this.table.rowManager.redraw()}},k.prototype.redoers={cellEdit:function(e){e.component.setValueProcessData(e.data.newValue)},rowAdd:function(e){var t=this.table.rowManager.addRowActual(e.data.data,e.data.pos,e.data.index);this._rebindRow(e.component,t)},rowDelete:function(e){e.component.deleteActual()},rowMove:function(e){this.table.rowManager.moveRowActual(e.component,this.table.rowManager.rows[e.data.pos],!1),this.table.rowManager.redraw()}},k.prototype._rebindRow=function(e,t){this.history.forEach(function(o){if(o.component instanceof a)o.component===e&&(o.component=t);else if(o.component instanceof u&&o.component.row===e){var i=o.component.column.getField();i&&(o.component=t.getCell(i))}})},d.prototype.registerModule("history",k);var S=function(e){this.table=e,this.fieldIndex=[],this.hasIndex=!1};S.prototype.parseTable=function(){var e=this,t=e.table.element,o=e.table.options,i=(o.columns,t.getElementsByTagName("th")),n=t.getElementsByTagName("tbody")[0],s=[];e.hasIndex=!1,e.table.options.htmlImporting.call(this.table),n=n?n.getElementsByTagName("tr"):[],e._extractOptions(t,o),i.length?e._extractHeaders(i,n):e._generateBlankHeaders(i,n);for(var a=0;a<n.length;a++){var l=n[a],u=l.getElementsByTagName("td"),c={};e.hasIndex||(c[o.index]=a);for(var d=0;d<u.length;d++){var h=u[d];"undefined"!=typeof this.fieldIndex[d]&&(c[this.fieldIndex[d]]=h.innerHTML)}s.push(c)}var p=document.createElement("div"),m=t.attributes;for(var d in m)"object"==r(m[d])&&p.setAttribute(m[d].name,m[d].value);t.parentNode.replaceChild(p,t),o.data=s,e.table.options.htmlImported.call(this.table),this.table.element=p},S.prototype._extractOptions=function(e,t,o){var i=e.attributes,n=o?Object.assign([],o):Object.keys(t),s={};n.forEach(function(e){s[e.toLowerCase()]=e});for(var a in i){var l,u=i[a];u&&"object"==("undefined"==typeof u?"undefined":r(u))&&u.name&&0===u.name.indexOf("tabulator-")&&(l=u.name.replace("tabulator-",""),"undefined"!=typeof s[l]&&(t[s[l]]=this._attribValue(u.value)))}},S.prototype._attribValue=function(e){return"true"===e||"false"!==e&&e},S.prototype._findCol=function(e){var t=this.table.options.columns.find(function(t){return t.title===e});return t||!1},S.prototype._extractHeaders=function(e,t){for(var o=0;o<e.length;o++){var n,s,a=e[o],l=!1,u=this._findCol(a.textContent);u?l=!0:u={title:a.textContent.trim()},u.field||(u.field=a.textContent.trim().toLowerCase().replace(" ","_")),n=a.getAttribute("width"),n&&!u.width&&(u.width=n),s=a.attributes,this._extractOptions(a,u,i.prototype.defaultOptionList);for(var c in s){var d,h=s[c];h&&"object"==("undefined"==typeof h?"undefined":r(h))&&h.name&&0===h.name.indexOf("tabulator-")&&(d=h.name.replace("tabulator-",""),u[d]=this._attribValue(h.value))}this.fieldIndex[o]=u.field,u.field==this.table.options.index&&(this.hasIndex=!0),l||this.table.options.columns.push(u)}},S.prototype._generateBlankHeaders=function(e,t){for(var o=0;o<e.length;o++){var i=e[o],n={title:"",field:"col"+o};this.fieldIndex[o]=n.field;var s=i.getAttribute("width");s&&(n.width=s),this.table.options.columns.push(n)}},d.prototype.registerModule("htmlTableImport",S);var z=function(e){this.table=e,this.watchKeys=null,this.pressedKeys=null,this.keyupBinding=!1,this.keydownBinding=!1};z.prototype.initialize=function(){var e=this.table.options.keybindings,t={};if(this.watchKeys={},this.pressedKeys=[],e!==!1){for(var o in this.bindings)t[o]=this.bindings[o];if(Object.keys(e).length)for(var i in e)t[i]=e[i];this.mapBindings(t),this.bindEvents()}},z.prototype.mapBindings=function(e){var t=this,o=this,i=function(i){t.actions[i]?e[i]&&("object"!==r(e[i])&&(e[i]=[e[i]]),e[i].forEach(function(e){o.mapBinding(i,e)})):console.warn("Key Binding Error - no such action:",i)};for(var n in e)i(n)},z.prototype.mapBinding=function(e,t){var o=this,i={action:this.actions[e],keys:[],ctrl:!1,shift:!1},n=t.toString().toLowerCase().split(" ").join("").split("+");n.forEach(function(e){switch(e){case"ctrl":i.ctrl=!0;break;case"shift":i.shift=!0;break;default:e=parseInt(e),i.keys.push(e),o.watchKeys[e]||(o.watchKeys[e]=[]),o.watchKeys[e].push(i)}})},z.prototype.bindEvents=function(){var e=this;this.keyupBinding=function(t){var o=t.keyCode,i=e.watchKeys[o];i&&(e.pressedKeys.push(o),i.forEach(function(o){e.checkBinding(t,o)}))},this.keydownBinding=function(t){var o=t.keyCode,i=e.watchKeys[o];if(i){var n=e.pressedKeys.indexOf(o);n>-1&&e.pressedKeys.splice(n,1)}},this.table.element.addEventListener("keydown",this.keyupBinding),this.table.element.addEventListener("keyup",this.keydownBinding)},z.prototype.clearBindings=function(){this.keyupBinding&&this.table.element.removeEventListener("keydown",this.keyupBinding),this.keydownBinding&&this.table.element.removeEventListener("keyup",this.keydownBinding)},z.prototype.checkBinding=function(e,t){var o=this,i=!0;return e.ctrlKey==t.ctrl&&e.shiftKey==t.shift&&(t.keys.forEach(function(e){var t=o.pressedKeys.indexOf(e);t==-1&&(i=!1)}),i&&t.action.call(o,e),!0)},z.prototype.bindings={navPrev:"shift + 9",navNext:9,navUp:38,navDown:40,scrollPageUp:33,scrollPageDown:34,scrollToStart:36,scrollToEnd:35,undo:"ctrl + 90",redo:"ctrl + 89",copyToClipboard:"ctrl + 67"},z.prototype.actions={keyBlock:function(e){e.stopPropagation(),e.preventDefault()},scrollPageUp:function(e){var t=this.table.rowManager,o=t.scrollTop-t.height;t.element.scrollHeight;e.preventDefault(),t.displayRowsCount&&(o>=0?t.element.scrollTop=o:t.scrollToRow(t.getDisplayRows()[0])),this.table.element.focus()},scrollPageDown:function(e){var t=this.table.rowManager,o=t.scrollTop+t.height,i=t.element.scrollHeight;e.preventDefault(),t.displayRowsCount&&(o<=i?t.element.scrollTop=o:t.scrollToRow(t.getDisplayRows()[t.displayRowsCount-1])),this.table.element.focus()},scrollToStart:function(e){var t=this.table.rowManager;e.preventDefault(),t.displayRowsCount&&t.scrollToRow(t.getDisplayRows()[0]),this.table.element.focus()},scrollToEnd:function(e){var t=this.table.rowManager;e.preventDefault(),t.displayRowsCount&&t.scrollToRow(t.getDisplayRows()[t.displayRowsCount-1]),this.table.element.focus()},navPrev:function(e){var t=!1;this.table.modExists("edit")&&(t=this.table.modules.edit.currentCell,t&&(e.preventDefault(),t.nav().prev()))},navNext:function(e){var t=!1;this.table.modExists("edit")&&(t=this.table.modules.edit.currentCell,t&&(e.preventDefault(),t.nav().next()))},navLeft:function(e){var t=!1;this.table.modExists("edit")&&(t=this.table.modules.edit.currentCell,t&&(e.preventDefault(),t.nav().left()))},navRight:function(e){var t=!1;this.table.modExists("edit")&&(t=this.table.modules.edit.currentCell,t&&(e.preventDefault(),t.nav().right()))},navUp:function(e){var t=!1;this.table.modExists("edit")&&(t=this.table.modules.edit.currentCell,t&&(e.preventDefault(),t.nav().up()))},navDown:function(e){var t=!1;this.table.modExists("edit")&&(t=this.table.modules.edit.currentCell,t&&(e.preventDefault(),t.nav().down()))},undo:function(e){var t=!1;this.table.options.history&&this.table.modExists("history")&&this.table.modExists("edit")&&(t=this.table.modules.edit.currentCell,t||(e.preventDefault(),this.table.modules.history.undo()))},redo:function(e){var t=!1;this.table.options.history&&this.table.modExists("history")&&this.table.modExists("edit")&&(t=this.table.modules.edit.currentCell,t||(e.preventDefault(),this.table.modules.history.redo()))},copyToClipboard:function(e){this.table.modules.edit.currentCell||this.table.modExists("clipboard",!0)&&this.table.modules.clipboard.copy(this.table.options.selectable&&"highlight"!=this.table.options.selectable?"selected":"active",null,null,null,!0)}},d.prototype.registerModule("keybindings",z);var F=function(e){this.table=e,this.placeholderElement=this.createPlaceholderElement(),this.hoverElement=!1,this.checkTimeout=!1,this.checkPeriod=250,this.moving=!1,this.toCol=!1,this.toColAfter=!1,this.startX=0,this.autoScrollMargin=40,this.autoScrollStep=5,this.autoScrollTimeout=!1,this.touchMove=!1,this.moveHover=this.moveHover.bind(this),this.endMove=this.endMove.bind(this)};F.prototype.createPlaceholderElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-col"),e.classList.add("tabulator-col-placeholder"),e},F.prototype.initializeColumn=function(e){var t,o=this,i={};e.modules.frozen||(t=e.getElement(),i.mousemove=function(i){e.parent===o.moving.parent&&((o.touchMove?i.touches[0].pageX:i.pageX)-d.prototype.helpers.elOffset(t).left+o.table.columnManager.element.scrollLeft>e.getWidth()/2?o.toCol===e&&o.toColAfter||(t.parentNode.insertBefore(o.placeholderElement,t.nextSibling),o.moveColumn(e,!0)):(o.toCol!==e||o.toColAfter)&&(t.parentNode.insertBefore(o.placeholderElement,t),o.moveColumn(e,!1)))}.bind(o),t.addEventListener("mousedown",function(t){o.touchMove=!1,1===t.which&&(o.checkTimeout=setTimeout(function(){o.startMove(t,e)},o.checkPeriod))}),t.addEventListener("mouseup",function(e){1===e.which&&o.checkTimeout&&clearTimeout(o.checkTimeout)}),o.bindTouchEvents(e)),e.modules.moveColumn=i},F.prototype.bindTouchEvents=function(e){var t,o,i,n,s,r,a,l=this,u=e.getElement(),c=!1;u.addEventListener("touchstart",function(u){l.checkTimeout=setTimeout(function(){l.touchMove=!0,t=e,o=e.nextColumn(),n=o?o.getWidth()/2:0,i=e.prevColumn(),s=i?i.getWidth()/2:0,r=0,a=0,c=!1,l.startMove(u,e)},l.checkPeriod)}),u.addEventListener("touchmove",function(u){var d,h;l.moving&&(l.moveHover(u),c||(c=u.touches[0].pageX),d=u.touches[0].pageX-c,d>0?o&&d-r>n&&(h=o,h!==e&&(c=u.touches[0].pageX,h.getElement().parentNode.insertBefore(l.placeholderElement,h.getElement().nextSibling),l.moveColumn(h,!0))):i&&-d-a>s&&(h=i,h!==e&&(c=u.touches[0].pageX,h.getElement().parentNode.insertBefore(l.placeholderElement,h.getElement()),l.moveColumn(h,!1))),h&&(t=h,o=h.nextColumn(),r=n,n=o?o.getWidth()/2:0,i=h.prevColumn(),a=s,s=i?i.getWidth()/2:0))}),u.addEventListener("touchend",function(e){l.checkTimeout&&clearTimeout(l.checkTimeout),l.moving&&l.endMove(e)})},F.prototype.startMove=function(e,t){var o=t.getElement();this.moving=t,this.startX=(this.touchMove?e.touches[0].pageX:e.pageX)-d.prototype.helpers.elOffset(o).left,this.table.element.classList.add("tabulator-block-select"),this.placeholderElement.style.width=t.getWidth()+"px",this.placeholderElement.style.height=t.getHeight()+"px",o.parentNode.insertBefore(this.placeholderElement,o),o.parentNode.removeChild(o),this.hoverElement=o.cloneNode(!0),this.hoverElement.classList.add("tabulator-moving"),this.table.columnManager.getElement().appendChild(this.hoverElement),this.hoverElement.style.left="0",this.hoverElement.style.bottom="0",this.touchMove||(this._bindMouseMove(),document.body.addEventListener("mousemove",this.moveHover),document.body.addEventListener("mouseup",this.endMove)),this.moveHover(e)},F.prototype._bindMouseMove=function(){this.table.columnManager.columnsByIndex.forEach(function(e){e.modules.moveColumn.mousemove&&e.getElement().addEventListener("mousemove",e.modules.moveColumn.mousemove)})},F.prototype._unbindMouseMove=function(){this.table.columnManager.columnsByIndex.forEach(function(e){e.modules.moveColumn.mousemove&&e.getElement().removeEventListener("mousemove",e.modules.moveColumn.mousemove)})},F.prototype.moveColumn=function(e,t){var o=this.moving.getCells();this.toCol=e,this.toColAfter=t,t?e.getCells().forEach(function(e,t){var i=e.getElement();i.parentNode.insertBefore(o[t].getElement(),i.nextSibling)}):e.getCells().forEach(function(e,t){var i=e.getElement();i.parentNode.insertBefore(o[t].getElement(),i)})},F.prototype.endMove=function(e){(1===e.which||this.touchMove)&&(this._unbindMouseMove(),this.placeholderElement.parentNode.insertBefore(this.moving.getElement(),this.placeholderElement.nextSibling),this.placeholderElement.parentNode.removeChild(this.placeholderElement),this.hoverElement.parentNode.removeChild(this.hoverElement),this.table.element.classList.remove("tabulator-block-select"),this.toCol&&this.table.columnManager.moveColumn(this.moving,this.toCol,this.toColAfter),this.moving=!1,this.toCol=!1,this.toColAfter=!1,this.touchMove||(document.body.removeEventListener("mousemove",this.moveHover),document.body.removeEventListener("mouseup",this.endMove)))},F.prototype.moveHover=function(e){var t,o=this,i=o.table.columnManager.getElement(),n=i.scrollLeft,s=(o.touchMove?e.touches[0].pageX:e.pageX)-d.prototype.helpers.elOffset(i).left+n;o.hoverElement.style.left=s-o.startX+"px",s-n<o.autoScrollMargin&&(o.autoScrollTimeout||(o.autoScrollTimeout=setTimeout(function(){t=Math.max(0,n-5),o.table.rowManager.getElement().scrollLeft=t,o.autoScrollTimeout=!1},1))),n+i.clientWidth-s<o.autoScrollMargin&&(o.autoScrollTimeout||(o.autoScrollTimeout=setTimeout(function(){t=Math.min(i.clientWidth,n+5),o.table.rowManager.getElement().scrollLeft=t,o.autoScrollTimeout=!1},1)))},d.prototype.registerModule("moveColumn",F);var P=function(e){this.table=e,this.placeholderElement=this.createPlaceholderElement(),this.hoverElement=!1,this.checkTimeout=!1,this.checkPeriod=150,this.moving=!1,this.toRow=!1,this.toRowAfter=!1,this.hasHandle=!1,this.startY=0,this.startX=0,this.moveHover=this.moveHover.bind(this),this.endMove=this.endMove.bind(this),this.tableRowDropEvent=!1,this.touchMove=!1,this.connection=!1,this.connections=[],this.connectedTable=!1,this.connectedRow=!1};P.prototype.createPlaceholderElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-row"),e.classList.add("tabulator-row-placeholder"),e},P.prototype.initialize=function(e){this.connection=this.table.options.movableRowsConnectedTables},P.prototype.setHandle=function(e){this.hasHandle=e},P.prototype.initializeGroupHeader=function(e){var t=this,o={};o.mouseup=function(e){t.tableRowDrop(e,row)}.bind(t),o.mousemove=function(o){if(o.pageY-d.prototype.helpers.elOffset(e.element).top+t.table.rowManager.element.scrollTop>e.getHeight()/2){if(t.toRow!==e||!t.toRowAfter){var i=e.getElement();i.parentNode.insertBefore(t.placeholderElement,i.nextSibling),t.moveRow(e,!0)}}else if(t.toRow!==e||t.toRowAfter){var i=e.getElement();i.previousSibling&&(i.parentNode.insertBefore(t.placeholderElement,i),t.moveRow(e,!1))}}.bind(t),e.modules.moveRow=o},P.prototype.initializeRow=function(e){var t,o=this,i={};i.mouseup=function(t){o.tableRowDrop(t,e)}.bind(o),i.mousemove=function(t){if(t.pageY-d.prototype.helpers.elOffset(e.element).top+o.table.rowManager.element.scrollTop>e.getHeight()/2){if(o.toRow!==e||!o.toRowAfter){var i=e.getElement();i.parentNode.insertBefore(o.placeholderElement,i.nextSibling),o.moveRow(e,!0)}}else if(o.toRow!==e||o.toRowAfter){var i=e.getElement();i.parentNode.insertBefore(o.placeholderElement,i),o.moveRow(e,!1)}}.bind(o),this.hasHandle||(t=e.getElement(),t.addEventListener("mousedown",function(t){1===t.which&&(o.checkTimeout=setTimeout(function(){o.startMove(t,e)},o.checkPeriod))}),t.addEventListener("mouseup",function(e){1===e.which&&o.checkTimeout&&clearTimeout(o.checkTimeout)}),this.bindTouchEvents(e,e.getElement())),e.modules.moveRow=i},P.prototype.initializeCell=function(e){var t=this,o=e.getElement();o.addEventListener("mousedown",function(o){1===o.which&&(t.checkTimeout=setTimeout(function(){t.startMove(o,e.row)},t.checkPeriod))}),o.addEventListener("mouseup",function(e){1===e.which&&t.checkTimeout&&clearTimeout(t.checkTimeout)}),this.bindTouchEvents(e.row,e.getElement())},P.prototype.bindTouchEvents=function(e,t){var o,i,n,s,r,a,l,u=this,c=!1;t.addEventListener("touchstart",function(t){u.checkTimeout=setTimeout(function(){u.touchMove=!0,o=e,i=e.nextRow(),s=i?i.getHeight()/2:0,n=e.prevRow(),r=n?n.getHeight()/2:0,a=0,l=0,c=!1,u.startMove(t,e)},u.checkPeriod)}),this.moving,this.toRow,this.toRowAfter,t.addEventListener("touchmove",function(t){var d,h;u.moving&&(t.preventDefault(),u.moveHover(t),c||(c=t.touches[0].pageY),d=t.touches[0].pageY-c,d>0?i&&d-a>s&&(h=i,h!==e&&(c=t.touches[0].pageY,h.getElement().parentNode.insertBefore(u.placeholderElement,h.getElement().nextSibling),u.moveRow(h,!0))):n&&-d-l>r&&(h=n,h!==e&&(c=t.touches[0].pageY,h.getElement().parentNode.insertBefore(u.placeholderElement,h.getElement()),u.moveRow(h,!1))),h&&(o=h,i=h.nextRow(),a=s,s=i?i.getHeight()/2:0,n=h.prevRow(),l=r,r=n?n.getHeight()/2:0))}),t.addEventListener("touchend",function(e){u.checkTimeout&&clearTimeout(u.checkTimeout),u.moving&&(u.endMove(e),u.touchMove=!1)})},P.prototype._bindMouseMove=function(){var e=this;e.table.rowManager.getDisplayRows().forEach(function(e){"row"!==e.type&&"group"!==e.type||!e.modules.moveRow.mousemove||e.getElement().addEventListener("mousemove",e.modules.moveRow.mousemove)})},P.prototype._unbindMouseMove=function(){var e=this;e.table.rowManager.getDisplayRows().forEach(function(e){"row"!==e.type&&"group"!==e.type||!e.modules.moveRow.mousemove||e.getElement().removeEventListener("mousemove",e.modules.moveRow.mousemove)})},P.prototype.startMove=function(e,t){var o=t.getElement();this.setStartPosition(e,t),this.moving=t,this.table.element.classList.add("tabulator-block-select"),this.placeholderElement.style.width=t.getWidth()+"px",this.placeholderElement.style.height=t.getHeight()+"px",this.connection?(this.table.element.classList.add("tabulator-movingrow-sending"),this.connectToTables(t)):(o.parentNode.insertBefore(this.placeholderElement,o),o.parentNode.removeChild(o)),this.hoverElement=o.cloneNode(!0),this.hoverElement.classList.add("tabulator-moving"),this.connection?(document.body.appendChild(this.hoverElement),this.hoverElement.style.left="0",this.hoverElement.style.top="0",this.hoverElement.style.width=this.table.element.clientWidth+"px",this.hoverElement.style.whiteSpace="nowrap",this.hoverElement.style.overflow="hidden",this.hoverElement.style.pointerEvents="none"):(this.table.rowManager.getTableElement().appendChild(this.hoverElement),this.hoverElement.style.left="0",this.hoverElement.style.top="0",this._bindMouseMove()),document.body.addEventListener("mousemove",this.moveHover),document.body.addEventListener("mouseup",this.endMove),this.moveHover(e)},P.prototype.setStartPosition=function(e,t){var o,i,n=this.touchMove?e.touches[0].pageX:e.pageX,s=this.touchMove?e.touches[0].pageY:e.pageY;o=t.getElement(),this.connection?(i=o.getBoundingClientRect(),this.startX=i.left-n+window.pageXOffset,this.startY=i.top-s+window.pageYOffset):this.startY=s-o.getBoundingClientRect().top},P.prototype.endMove=function(e){e&&1!==e.which&&!this.touchMove||(this._unbindMouseMove(),this.connection||(this.placeholderElement.parentNode.insertBefore(this.moving.getElement(),this.placeholderElement.nextSibling),this.placeholderElement.parentNode.removeChild(this.placeholderElement)),this.hoverElement.parentNode.removeChild(this.hoverElement),this.table.element.classList.remove("tabulator-block-select"),this.toRow&&this.table.rowManager.moveRow(this.moving,this.toRow,this.toRowAfter),this.moving=!1,this.toRow=!1,this.toRowAfter=!1,document.body.removeEventListener("mousemove",this.moveHover),document.body.removeEventListener("mouseup",this.endMove),this.connection&&(this.table.element.classList.remove("tabulator-movingrow-sending"),this.disconnectFromTables()))},P.prototype.moveRow=function(e,t){this.toRow=e,this.toRowAfter=t},P.prototype.moveHover=function(e){this.connection?this.moveHoverConnections.call(this,e):this.moveHoverTable.call(this,e)},P.prototype.moveHoverTable=function(e){var t=this.table.rowManager.getElement(),o=t.scrollTop,i=(this.touchMove?e.touches[0].pageY:e.pageY)-t.getBoundingClientRect().top+o;this.hoverElement.style.top=i-this.startY+"px"},P.prototype.moveHoverConnections=function(e){this.hoverElement.style.left=this.startX+(this.touchMove?e.touches[0].pageX:e.pageX)+"px",this.hoverElement.style.top=this.startY+(this.touchMove?e.touches[0].pageY:e.pageY)+"px"},P.prototype.connectToTables=function(e){var t=this.table.modules.comms.getConnections(this.connection);this.table.options.movableRowsSendingStart.call(this.table,t),this.table.modules.comms.send(this.connection,"moveRow","connect",{row:e})},P.prototype.disconnectFromTables=function(){var e=this.table.modules.comms.getConnections(this.connection);this.table.options.movableRowsSendingStop.call(this.table,e),this.table.modules.comms.send(this.connection,"moveRow","disconnect")},P.prototype.connect=function(e,t){var o=this;return this.connectedTable?(console.warn("Move Row Error - Table cannot accept connection, already connected to table:",this.connectedTable),!1):(this.connectedTable=e,this.connectedRow=t,this.table.element.classList.add("tabulator-movingrow-receiving"),o.table.rowManager.getDisplayRows().forEach(function(e){"row"===e.type&&e.modules.moveRow&&e.modules.moveRow.mouseup&&e.getElement().addEventListener("mouseup",e.modules.moveRow.mouseup)}),o.tableRowDropEvent=o.tableRowDrop.bind(o),o.table.element.addEventListener("mouseup",o.tableRowDropEvent),this.table.options.movableRowsReceivingStart.call(this.table,t,e),!0)},P.prototype.disconnect=function(e){var t=this;e===this.connectedTable?(this.connectedTable=!1,this.connectedRow=!1,this.table.element.classList.remove("tabulator-movingrow-receiving"),t.table.rowManager.getDisplayRows().forEach(function(e){"row"===e.type&&e.modules.moveRow&&e.modules.moveRow.mouseup&&e.getElement().removeEventListener("mouseup",e.modules.moveRow.mouseup)}),t.table.element.removeEventListener("mouseup",t.tableRowDropEvent),this.table.options.movableRowsReceivingStop.call(this.table,e)):console.warn("Move Row Error - trying to disconnect from non connected table")},P.prototype.dropComplete=function(e,t,o){var i=!1;if(o){switch(r(this.table.options.movableRowsSender)){case"string":i=this.senders[this.table.options.movableRowsSender];break;case"function":i=this.table.options.movableRowsSender}i?i.call(this,this.moving.getComponent(),t?t.getComponent():void 0,e):this.table.options.movableRowsSender&&console.warn("Mover Row Error - no matching sender found:",this.table.options.movableRowsSender),this.table.options.movableRowsSent.call(this.table,this.moving.getComponent(),t?t.getComponent():void 0,e)}else this.table.options.movableRowsSentFailed.call(this.table,this.moving.getComponent(),t?t.getComponent():void 0,e);this.endMove()},P.prototype.tableRowDrop=function(e,t){var o=!1,i=!1;switch(e.stopImmediatePropagation(),r(this.table.options.movableRowsReceiver)){case"string":o=this.receivers[this.table.options.movableRowsReceiver];break;case"function":o=this.table.options.movableRowsReceiver}o?i=o.call(this,this.connectedRow.getComponent(),t?t.getComponent():void 0,this.connectedTable):console.warn("Mover Row Error - no matching receiver found:",this.table.options.movableRowsReceiver),i?this.table.options.movableRowsReceived.call(this.table,this.connectedRow.getComponent(),t?t.getComponent():void 0,this.connectedTable):this.table.options.movableRowsReceivedFailed.call(this.table,this.connectedRow.getComponent(),t?t.getComponent():void 0,this.connectedTable),this.table.modules.comms.send(this.connectedTable,"moveRow","dropcomplete",{row:t,success:i})},P.prototype.receivers={insert:function(e,t,o){return this.table.addRow(e.getData(),void 0,t),!0},add:function(e,t,o){return this.table.addRow(e.getData()),!0},update:function(e,t,o){return!!t&&(t.update(e.getData()),!0)},replace:function(e,t,o){return!!t&&(this.table.addRow(e.getData(),void 0,t),t.delete(),!0)}},P.prototype.senders={
- delete:function(e,t,o){e.delete()}},P.prototype.commsReceived=function(e,t,o){switch(t){case"connect":return this.connect(e,o.row);case"disconnect":return this.disconnect(e);case"dropcomplete":return this.dropComplete(e,o.row,o.success)}},d.prototype.registerModule("moveRow",P);var H=function(e){this.table=e,this.allowedTypes=["","data","edit","clipboard"],this.enabled=!0};H.prototype.initializeColumn=function(e){var t=this,o=!1,i={};this.allowedTypes.forEach(function(n){var s,r="mutator"+(n.charAt(0).toUpperCase()+n.slice(1));e.definition[r]&&(s=t.lookupMutator(e.definition[r]),s&&(o=!0,i[r]={mutator:s,params:e.definition[r+"Params"]||{}}))}),o&&(e.modules.mutate=i)},H.prototype.lookupMutator=function(e){var t=!1;switch("undefined"==typeof e?"undefined":r(e)){case"string":this.mutators[e]?t=this.mutators[e]:console.warn("Mutator Error - No such mutator found, ignoring: ",e);break;case"function":t=e}return t},H.prototype.transformRow=function(e,t,o){var i,n=this,s="mutator"+(t.charAt(0).toUpperCase()+t.slice(1));return this.enabled&&n.table.columnManager.traverse(function(n){var r,a,l;n.modules.mutate&&(r=n.modules.mutate[s]||n.modules.mutate.mutator||!1,r&&(i=n.getFieldValue(e),(!o||o&&"undefined"!=typeof i)&&(l=n.getComponent(),a="function"==typeof r.params?r.params(i,e,t,l):r.params,n.setFieldValue(e,r.mutator(i,e,t,a,l)))))}),e},H.prototype.transformCell=function(e,t){var o=e.column.modules.mutate.mutatorEdit||e.column.modules.mutate.mutator||!1;return o?o.mutator(t,e.row.getData(),"edit",o.params,e.getComponent()):t},H.prototype.enable=function(){this.enabled=!0},H.prototype.disable=function(){this.enabled=!1},H.prototype.mutators={},d.prototype.registerModule("mutator",H);var _=function(e){this.table=e,this.mode="local",this.progressiveLoad=!1,this.size=0,this.page=1,this.count=5,this.max=1,this.displayIndex=0,this.pageSizes=[],this.createElements()};_.prototype.createElements=function(){var e;this.element=document.createElement("span"),this.element.classList.add("tabulator-paginator"),this.pagesElement=document.createElement("span"),this.pagesElement.classList.add("tabulator-pages"),e=document.createElement("button"),e.classList.add("tabulator-page"),e.setAttribute("type","button"),e.setAttribute("role","button"),e.setAttribute("aria-label",""),e.setAttribute("title",""),this.firstBut=e.cloneNode(!0),this.firstBut.setAttribute("data-page","first"),this.prevBut=e.cloneNode(!0),this.prevBut.setAttribute("data-page","prev"),this.nextBut=e.cloneNode(!0),this.nextBut.setAttribute("data-page","next"),this.lastBut=e.cloneNode(!0),this.lastBut.setAttribute("data-page","last"),this.table.options.paginationSizeSelector&&(this.pageSizeSelect=document.createElement("select"),this.pageSizeSelect.classList.add("tabulator-page-size"))},_.prototype.generatePageSizeSelectList=function(){var e=this,t=[];if(this.pageSizeSelect){if(Array.isArray(this.table.options.paginationSizeSelector))t=this.table.options.paginationSizeSelector,this.pageSizes=t,this.pageSizes.indexOf(this.size)==-1&&t.unshift(this.size);else if(this.pageSizes.indexOf(this.size)==-1){t=[];for(var o=1;o<5;o++)t.push(this.size*o);this.pageSizes=t}else t=this.pageSizes;for(;this.pageSizeSelect.firstChild;)this.pageSizeSelect.removeChild(this.pageSizeSelect.firstChild);t.forEach(function(t){var o=document.createElement("option");o.value=t,o.innerHTML=t,e.pageSizeSelect.appendChild(o)}),this.pageSizeSelect.value=this.size}},_.prototype.initialize=function(e){var t,o=this;for(var i in o.table.options.paginationDataSent)o.paginationDataSentNames[i]=o.table.options.paginationDataSent[i];for(var n in o.table.options.paginationDataReceived)o.paginationDataReceivedNames[n]=o.table.options.paginationDataReceived[n];o.table.modules.localize.bind("pagination|first",function(e){o.firstBut.innerHTML=e}),o.table.modules.localize.bind("pagination|first_title",function(e){o.firstBut.setAttribute("aria-label",e),o.firstBut.setAttribute("title",e)}),o.table.modules.localize.bind("pagination|prev",function(e){o.prevBut.innerHTML=e}),o.table.modules.localize.bind("pagination|prev_title",function(e){o.prevBut.setAttribute("aria-label",e),o.prevBut.setAttribute("title",e)}),o.table.modules.localize.bind("pagination|next",function(e){o.nextBut.innerHTML=e}),o.table.modules.localize.bind("pagination|next_title",function(e){o.nextBut.setAttribute("aria-label",e),o.nextBut.setAttribute("title",e)}),o.table.modules.localize.bind("pagination|last",function(e){o.lastBut.innerHTML=e}),o.table.modules.localize.bind("pagination|last_title",function(e){o.lastBut.setAttribute("aria-label",e),o.lastBut.setAttribute("title",e)}),o.firstBut.addEventListener("click",function(){o.setPage(1)}),o.prevBut.addEventListener("click",function(){o.previousPage()}),o.nextBut.addEventListener("click",function(){o.nextPage().then(function(){}).catch(function(){})}),o.lastBut.addEventListener("click",function(){o.setPage(o.max)}),o.table.options.paginationElement&&(o.element=o.table.options.paginationElement),this.pageSizeSelect&&(t=document.createElement("label"),o.table.modules.localize.bind("pagination|page_size",function(e){o.pageSizeSelect.setAttribute("aria-label",e),o.pageSizeSelect.setAttribute("title",e),t.innerHTML=e}),o.element.appendChild(t),o.element.appendChild(o.pageSizeSelect),o.pageSizeSelect.addEventListener("change",function(e){o.setPageSize(o.pageSizeSelect.value),o.setPage(1).then(function(){}).catch(function(){})})),o.element.appendChild(o.firstBut),o.element.appendChild(o.prevBut),o.element.appendChild(o.pagesElement),o.element.appendChild(o.nextBut),o.element.appendChild(o.lastBut),o.table.options.paginationElement||e||o.table.footerManager.append(o.element,o),o.mode=o.table.options.pagination,o.size=o.table.options.paginationSize||Math.floor(o.table.rowManager.getElement().clientHeight/24),o.count=o.table.options.paginationButtonCount,o.generatePageSizeSelectList()},_.prototype.initializeProgressive=function(e){this.initialize(!0),this.mode="progressive_"+e,this.progressiveLoad=!0},_.prototype.setDisplayIndex=function(e){this.displayIndex=e},_.prototype.getDisplayIndex=function(){return this.displayIndex},_.prototype.setMaxRows=function(e){e?this.max=Math.ceil(e/this.size):this.max=1,this.page>this.max&&(this.page=this.max)},_.prototype.reset=function(e){return("local"==this.mode||e)&&(this.page=1),!0},_.prototype.setMaxPage=function(e){e=parseInt(e),this.max=e||1,this.page>this.max&&(this.page=this.max,this.trigger())},_.prototype.setPage=function(e){var t=this;return new Promise(function(o,i){e=parseInt(e),e>0&&e<=t.max?(t.page=e,t.trigger().then(function(){o()}).catch(function(){i()})):(console.warn("Pagination Error - Requested page is out of range of 1 - "+t.max+":",e),i())})},_.prototype.setPageToRow=function(e){var t=this;return new Promise(function(o,i){var n=t.table.rowManager.getDisplayRows(t.displayIndex-1),s=n.indexOf(e);if(s>-1){var r=Math.ceil((s+1)/t.size);t.setPage(r).then(function(){o()}).catch(function(){i()})}else console.warn("Pagination Error - Requested row is not visible"),i()})},_.prototype.setPageSize=function(e){e=parseInt(e),e>0&&(this.size=e),this.pageSizeSelect&&this.generatePageSizeSelectList()},_.prototype._setPageButtons=function(){for(var e=this,t=Math.floor((this.count-1)/2),o=Math.ceil((this.count-1)/2),i=this.max-this.page+t+1<this.count?this.max-this.count+1:Math.max(this.page-t,1),n=this.page<=o?Math.min(this.count,this.max):Math.min(this.page+o,this.max);e.pagesElement.firstChild;)e.pagesElement.removeChild(e.pagesElement.firstChild);1==e.page?(e.firstBut.disabled=!0,e.prevBut.disabled=!0):(e.firstBut.disabled=!1,e.prevBut.disabled=!1),e.page==e.max?(e.lastBut.disabled=!0,e.nextBut.disabled=!0):(e.lastBut.disabled=!1,e.nextBut.disabled=!1);for(var s=i;s<=n;s++)s>0&&s<=e.max&&e.pagesElement.appendChild(e._generatePageButton(s));this.footerRedraw()},_.prototype._generatePageButton=function(e){var t=this,o=document.createElement("button");return o.classList.add("tabulator-page"),e==t.page&&o.classList.add("active"),o.setAttribute("type","button"),o.setAttribute("role","button"),o.setAttribute("aria-label","Show Page "+e),o.setAttribute("title","Show Page "+e),o.setAttribute("data-page",e),o.textContent=e,o.addEventListener("click",function(o){t.setPage(e)}),o},_.prototype.previousPage=function(){var e=this;return new Promise(function(t,o){e.page>1?(e.page--,e.trigger().then(function(){t()}).catch(function(){o()})):(console.warn("Pagination Error - Previous page would be less than page 1:",0),o())})},_.prototype.nextPage=function(){var e=this;return new Promise(function(t,o){e.page<e.max?(e.page++,e.trigger().then(function(){t()}).catch(function(){o()})):(e.progressiveLoad||console.warn("Pagination Error - Next page would be greater than maximum page of "+e.max+":",e.max+1),o())})},_.prototype.getPage=function(){return this.page},_.prototype.getPageMax=function(){return this.max},_.prototype.getPageSize=function(e){return this.size},_.prototype.getMode=function(){return this.mode},_.prototype.getRows=function(e){var t,o,i;if("local"==this.mode){t=[],o=this.size*(this.page-1),i=o+parseInt(this.size),this._setPageButtons();for(var n=o;n<i;n++)e[n]&&t.push(e[n]);return t}return this._setPageButtons(),e.slice(0)},_.prototype.trigger=function(){var e,t=this;return new Promise(function(o,i){switch(t.mode){case"local":e=t.table.rowManager.scrollLeft,t.table.rowManager.refreshActiveData("page"),t.table.rowManager.scrollHorizontal(e),t.table.options.pageLoaded.call(t.table,t.getPage()),o();break;case"remote":case"progressive_load":case"progressive_scroll":t.table.modules.ajax.blockActiveRequest(),t._getRemotePage().then(function(){o()}).catch(function(){i()});break;default:console.warn("Pagination Error - no such pagination mode:",t.mode),i()}})},_.prototype._getRemotePage=function(){var e,t,o=this,i=this;return new Promise(function(n,s){if(i.table.modExists("ajax",!0)||s(),e=d.prototype.helpers.deepClone(i.table.modules.ajax.getParams()||{}),t=i.table.modules.ajax.getParams(),t[o.paginationDataSentNames.page]=i.page,o.size&&(t[o.paginationDataSentNames.size]=o.size),o.table.options.ajaxSorting&&o.table.modExists("sort")){var r=i.table.modules.sort.getSort();r.forEach(function(e){delete e.column}),t[o.paginationDataSentNames.sorters]=r}if(o.table.options.ajaxFiltering&&o.table.modExists("filter")){var a=i.table.modules.filter.getFilters(!0,!0);t[o.paginationDataSentNames.filters]=a}i.table.modules.ajax.setParams(t),i.table.modules.ajax.sendRequest(o.progressiveLoad).then(function(e){i._parseRemoteData(e),n()}).catch(function(e){s()}),i.table.modules.ajax.setParams(e)})},_.prototype._parseRemoteData=function(e){var t,e,o,i=this;if("undefined"==typeof e[this.paginationDataReceivedNames.last_page]&&console.warn("Remote Pagination Error - Server response missing '"+this.paginationDataReceivedNames.last_page+"' property"),e[this.paginationDataReceivedNames.data])if(this.max=parseInt(e[this.paginationDataReceivedNames.last_page])||1,this.progressiveLoad)switch(this.mode){case"progressive_load":this.table.rowManager.addRows(e[this.paginationDataReceivedNames.data]),this.page<this.max&&setTimeout(function(){i.nextPage().then(function(){}).catch(function(){})},i.table.options.ajaxProgressiveLoadDelay);break;case"progressive_scroll":e=this.table.rowManager.getData().concat(e[this.paginationDataReceivedNames.data]),this.table.rowManager.setData(e,!0),o=this.table.options.ajaxProgressiveLoadScrollMargin||2*this.table.rowManager.element.clientHeight,i.table.rowManager.element.scrollHeight<=i.table.rowManager.element.clientHeight+o&&i.nextPage().then(function(){}).catch(function(){})}else t=this.table.rowManager.scrollLeft,this.table.rowManager.setData(e[this.paginationDataReceivedNames.data]),this.table.rowManager.scrollHorizontal(t),this.table.columnManager.scrollHorizontal(t),this.table.options.pageLoaded.call(this.table,this.getPage());else console.warn("Remote Pagination Error - Server response missing '"+this.paginationDataReceivedNames.data+"' property")},_.prototype.footerRedraw=function(){var e=this.table.footerManager.element;Math.ceil(e.clientWidth)-e.scrollWidth<0?this.pagesElement.style.display="none":(this.pagesElement.style.display="",Math.ceil(e.clientWidth)-e.scrollWidth<0&&(this.pagesElement.style.display="none"))},_.prototype.paginationDataSentNames={page:"page",size:"size",sorters:"sorters",filters:"filters"},_.prototype.paginationDataReceivedNames={current_page:"current_page",last_page:"last_page",data:"data"},d.prototype.registerModule("page",_);var A=function(e){this.table=e,this.mode="",this.id="",this.persistProps=["field","width","visible"]};A.prototype.initialize=function(e,t){this.mode=e!==!0?e:"undefined"!=typeof window.localStorage?"local":"cookie",this.id="tabulator-"+(t||this.table.element.getAttribute("id")||"")},A.prototype.load=function(e,t){var o=this.retreiveData(e);return t&&(o=o?this.mergeDefinition(t,o):t),o},A.prototype.retreiveData=function(e){var t="",o=this.id+("columns"===e?"":"-"+e);switch(this.mode){case"local":t=localStorage.getItem(o);break;case"cookie":var i=document.cookie,n=i.indexOf(o+"="),s=void 0;n>-1&&(i=i.substr(n),s=i.indexOf(";"),s>-1&&(i=i.substr(0,s)),t=i.replace(o+"=",""));break;default:console.warn("Persistance Load Error - invalid mode selected",this.mode)}return!!t&&JSON.parse(t)},A.prototype.mergeDefinition=function(e,t){var o=this,i=[];return t=t||[],t.forEach(function(t,n){var s=o._findColumn(e,t);s&&(s.width=t.width,s.visible=t.visible,s.columns&&(s.columns=o.mergeDefinition(s.columns,t.columns)),i.push(s))}),e.forEach(function(e,n){var s=o._findColumn(t,e);s||(i.length>n?i.splice(n,0,e):i.push(e))}),i},A.prototype._findColumn=function(e,t){var o=t.columns?"group":t.field?"field":"object";return e.find(function(e){switch(o){case"group":return e.title===t.title&&e.columns.length===t.columns.length;case"field":return e.field===t.field;case"object":return e===t}})},A.prototype.save=function(e){var t={};switch(e){case"columns":t=this.parseColumns(this.table.columnManager.getColumns());break;case"filter":t=this.table.modules.filter.getFilters();break;case"sort":t=this.validateSorters(this.table.modules.sort.getSort())}var o=this.id+("columns"===e?"":"-"+e);this.saveData(o,t)},A.prototype.validateSorters=function(e){return e.forEach(function(e){e.column=e.field,delete e.field}),e},A.prototype.saveData=function(e,t){switch(t=JSON.stringify(t),this.mode){case"local":localStorage.setItem(e,t);break;case"cookie":var o=new Date;o.setDate(o.getDate()+1e4),document.cookie=e+"="+t+"; expires="+o.toUTCString();break;default:console.warn("Persistance Save Error - invalid mode selected",this.mode)}},A.prototype.parseColumns=function(e){var t=this,o=[];return e.forEach(function(e){var i={};e.isGroup?(i.title=e.getDefinition().title,i.columns=t.parseColumns(e.getColumns())):(i.title=e.getDefinition().title,i.field=e.getField(),i.width=e.getWidth(),i.visible=e.visible),o.push(i)}),o},d.prototype.registerModule("persistence",A);var N=function(e){this.table=e,this.data=!1,this.blocked=!1,this.origFuncs={},this.currentVersion=0};N.prototype.watchData=function(e){var t,o=this;this.currentVersion++,t=this.currentVersion,o.unwatchData(),o.data=e,o.origFuncs.push=e.push,Object.defineProperty(o.data,"push",{enumerable:!1,configurable:!0,value:function(){var i=Array.from(arguments);return o.blocked||t!==o.currentVersion||i.forEach(function(e){o.table.rowManager.addRowActual(e,!1)}),o.origFuncs.push.apply(e,arguments)}}),o.origFuncs.unshift=e.unshift,Object.defineProperty(o.data,"unshift",{enumerable:!1,configurable:!0,value:function(){var i=Array.from(arguments);return o.blocked||t!==o.currentVersion||i.forEach(function(e){o.table.rowManager.addRowActual(e,!0)}),o.origFuncs.unshift.apply(e,arguments)}}),o.origFuncs.shift=e.shift,Object.defineProperty(o.data,"shift",{enumerable:!1,configurable:!0,value:function(){var i;return o.blocked||t!==o.currentVersion||o.data.length&&(i=o.table.rowManager.getRowFromDataObject(o.data[0]),i&&i.deleteActual()),o.origFuncs.shift.call(e)}}),o.origFuncs.pop=e.pop,Object.defineProperty(o.data,"pop",{enumerable:!1,configurable:!0,value:function(){var i;return o.blocked||t!==o.currentVersion||o.data.length&&(i=o.table.rowManager.getRowFromDataObject(o.data[o.data.length-1]),i&&i.deleteActual()),o.origFuncs.pop.call(e)}}),o.origFuncs.splice=e.splice,Object.defineProperty(o.data,"splice",{enumerable:!1,configurable:!0,value:function(){var i,n=Array.from(arguments),s=n[0]<0?e.length+n[0]:n[0],r=n[1],a=!!n[2]&&n.slice(2);if(!o.blocked&&t===o.currentVersion){if(a&&(i=!!e[s]&&o.table.rowManager.getRowFromDataObject(e[s]),i?a.forEach(function(e){o.table.rowManager.addRowActual(e,!0,i,!0)}):(a=a.slice().reverse(),a.forEach(function(e){o.table.rowManager.addRowActual(e,!0,!1,!0)}))),0!==r){var l=e.slice(s,"undefined"==typeof n[1]?n[1]:s+r);l.forEach(function(e,t){var i=o.table.rowManager.getRowFromDataObject(e);i&&i.deleteActual(t!==l.length-1)})}(a||0!==r)&&o.table.rowManager.reRenderInPosition()}return o.origFuncs.splice.apply(e,arguments)}})},N.prototype.unwatchData=function(){if(this.data!==!1)for(var e in this.origFuncs)Object.defineProperty(this.data,e,{enumerable:!0,configurable:!0,writable:!0,value:this.origFuncs.key})},N.prototype.watchRow=function(e){var t=e.getData();this.blocked=!0;for(var o in t)this.watchKey(e,t,o);this.blocked=!1},N.prototype.watchKey=function(e,t,o){var i=this,n=Object.getOwnPropertyDescriptor(t,o),s=t[o],r=this.currentVersion;Object.defineProperty(t,o,{set:function(t){if(s=t,!i.blocked&&r===i.currentVersion){var a={};a[o]=t,e.updateData(a)}n.set&&n.set(t)},get:function(){return n.get&&n.get(),s}})},N.prototype.unwatchRow=function(e){var t=e.getData();for(var o in t)Object.defineProperty(t,o,{value:t[o]})},N.prototype.block=function(){this.blocked=!0},N.prototype.unblock=function(){this.blocked=!1},d.prototype.registerModule("reactiveData",N);var B=function(e){this.table=e,this.startColumn=!1,this.startX=!1,this.startWidth=!1,this.handle=null,this.prevHandle=null};B.prototype.initializeColumn=function(e,t,o){var i=this,n=!1,s=this.table.options.resizableColumns;if("header"===e&&(n="textarea"==t.definition.formatter||t.definition.variableHeight,t.modules.resize={variableHeight:n}),s===!0||s==e){var r=document.createElement("div");r.className="tabulator-col-resize-handle";var a=document.createElement("div");a.className="tabulator-col-resize-handle prev",r.addEventListener("click",function(e){e.stopPropagation()});var l=function(e){var o=t.getLastColumn();o&&i._checkResizability(o)&&(i.startColumn=t,i._mouseDown(e,o,r))};r.addEventListener("mousedown",l),r.addEventListener("touchstart",l),r.addEventListener("dblclick",function(e){var o=t.getLastColumn();o&&i._checkResizability(o)&&o.reinitializeWidth(!0)}),a.addEventListener("click",function(e){e.stopPropagation()});var u=function(e){var o,n,s;o=t.getFirstColumn(),o&&(n=i.table.columnManager.findColumnIndex(o),s=n>0&&i.table.columnManager.getColumnByIndex(n-1),s&&i._checkResizability(s)&&(i.startColumn=t,i._mouseDown(e,s,a)))};a.addEventListener("mousedown",u),a.addEventListener("touchstart",u),a.addEventListener("dblclick",function(e){var o,n,s;o=t.getFirstColumn(),o&&(n=i.table.columnManager.findColumnIndex(o),s=n>0&&i.table.columnManager.getColumnByIndex(n-1),s&&i._checkResizability(s)&&s.reinitializeWidth(!0))}),o.appendChild(r),o.appendChild(a)}},B.prototype._checkResizability=function(e){return"undefined"!=typeof e.definition.resizable?e.definition.resizable:this.table.options.resizableColumns},B.prototype._mouseDown=function(e,t,o){function i(e){t.setWidth(s.startWidth+(("undefined"==typeof e.screenX?e.touches[0].screenX:e.screenX)-s.startX)),!s.table.browserSlow&&t.modules.resize&&t.modules.resize.variableHeight&&t.checkCellHeights()}function n(e){s.startColumn.modules.edit&&(s.startColumn.modules.edit.blocked=!1),s.table.browserSlow&&t.modules.resize&&t.modules.resize.variableHeight&&t.checkCellHeights(),document.body.removeEventListener("mouseup",n),document.body.removeEventListener("mousemove",i),o.removeEventListener("touchmove",i),o.removeEventListener("touchend",n),s.table.element.classList.remove("tabulator-block-select"),s.table.options.persistentLayout&&s.table.modExists("persistence",!0)&&s.table.modules.persistence.save("columns"),s.table.options.columnResized.call(s.table,t.getComponent())}var s=this;s.table.element.classList.add("tabulator-block-select"),e.stopPropagation(),s.startColumn.modules.edit&&(s.startColumn.modules.edit.blocked=!0),s.startX="undefined"==typeof e.screenX?e.touches[0].screenX:e.screenX,s.startWidth=t.getWidth(),document.body.addEventListener("mousemove",i),document.body.addEventListener("mouseup",n),o.addEventListener("touchmove",i),o.addEventListener("touchend",n)},d.prototype.registerModule("resizeColumns",B);var I=function(e){this.table=e,this.startColumn=!1,this.startY=!1,this.startHeight=!1,this.handle=null,this.prevHandle=null};I.prototype.initializeRow=function(e){var t=this,o=e.getElement(),i=document.createElement("div");i.className="tabulator-row-resize-handle";var n=document.createElement("div");n.className="tabulator-row-resize-handle prev",i.addEventListener("click",function(e){e.stopPropagation()});var s=function(o){t.startRow=e,t._mouseDown(o,e,i)};i.addEventListener("mousedown",s),i.addEventListener("touchstart",s),n.addEventListener("click",function(e){e.stopPropagation()});var r=function(o){var i=t.table.rowManager.prevDisplayRow(e);i&&(t.startRow=i,t._mouseDown(o,i,n))};n.addEventListener("mousedown",r),n.addEventListener("touchstart",r),o.appendChild(i),o.appendChild(n)},I.prototype._mouseDown=function(e,t,o){function i(e){t.setHeight(s.startHeight+(("undefined"==typeof e.screenY?e.touches[0].screenY:e.screenY)-s.startY))}function n(e){document.body.removeEventListener("mouseup",i),document.body.removeEventListener("mousemove",i),o.removeEventListener("touchmove",i),o.removeEventListener("touchend",n),s.table.element.classList.remove("tabulator-block-select"),s.table.options.rowResized.call(this.table,t.getComponent())}var s=this;s.table.element.classList.add("tabulator-block-select"),e.stopPropagation(),s.startY="undefined"==typeof e.screenY?e.touches[0].screenY:e.screenY,s.startHeight=t.getHeight(),document.body.addEventListener("mousemove",i),document.body.addEventListener("mouseup",n),o.addEventListener("touchmove",i),o.addEventListener("touchend",n)},d.prototype.registerModule("resizeRows",I);var j=function(e){this.table=e,this.binding=!1,this.observer=!1};j.prototype.initialize=function(e){var t=this.table;"undefined"!=typeof ResizeObserver&&"virtual"===t.rowManager.getRenderMode()?(this.observer=new ResizeObserver(function(e){t.redraw()}),this.observer.observe(t.element)):(this.binding=function(){t.redraw()},window.addEventListener("resize",this.binding))},j.prototype.clearBindings=function(e){this.binding&&window.removeEventListener("resize",this.binding),this.observer&&this.observer.unobserve(this.table.element)},d.prototype.registerModule("resizeTable",j);var O=function(e){this.table=e,this.columns=[],this.hiddenColumns=[],this.mode="",this.index=0,this.collapseFormatter=[],this.collapseStartOpen=!0};O.prototype.initialize=function(){var e=this,t=[];this.mode=this.table.options.responsiveLayout,this.collapseFormatter=this.table.options.responsiveLayoutCollapseFormatter||this.formatCollapsedData,this.collapseStartOpen=this.table.options.responsiveLayoutCollapseStartOpen,this.hiddenColumns=[],this.table.columnManager.columnsByIndex.forEach(function(o,i){o.modules.responsive&&o.modules.responsive.order&&o.modules.responsive.visible&&(o.modules.responsive.index=i,t.push(o),o.visible||"collapse"!==e.mode||e.hiddenColumns.push(o))}),t=t.reverse(),t=t.sort(function(e,t){var o=t.modules.responsive.order-e.modules.responsive.order;return o||t.modules.responsive.index-e.modules.responsive.index}),this.columns=t,"collapse"===this.mode&&this.generateCollapsedContent()},O.prototype.initializeColumn=function(e){var t=e.getDefinition();e.modules.responsive={order:"undefined"==typeof t.responsive?1:t.responsive,visible:t.visible!==!1}},O.prototype.layoutRow=function(e){var t=e.getElement(),o=document.createElement("div");o.classList.add("tabulator-responsive-collapse"),t.classList.contains("tabulator-calcs")||(e.modules.responsiveLayout={element:o},this.collapseStartOpen||(o.style.display="none"),t.appendChild(o),this.generateCollapsedRowContent(e))},O.prototype.updateColumnVisibility=function(e,t){e.modules.responsive&&(e.modules.responsive.visible=t,this.initialize())},O.prototype.hideColumn=function(e){e.hide(!1,!0),"collapse"===this.mode&&(this.hiddenColumns.unshift(e),this.generateCollapsedContent())},O.prototype.showColumn=function(e){var t;e.show(!1,!0),e.setWidth(e.getWidth()),"collapse"===this.mode&&(t=this.hiddenColumns.indexOf(e),t>-1&&this.hiddenColumns.splice(t,1),this.generateCollapsedContent())},O.prototype.update=function(){for(var e=this,t=!0;t;){var o="fitColumns"==e.table.modules.layout.getMode()?e.table.columnManager.getFlexBaseWidth():e.table.columnManager.getWidth(),i=e.table.columnManager.element.clientWidth-o;if(i<0){var n=e.columns[e.index];n?(e.hideColumn(n),e.index++):t=!1}else{var s=e.columns[e.index-1];s&&i>0&&i>=s.getWidth()?(e.showColumn(s),e.index--):t=!1}e.table.rowManager.activeRowsCount||e.table.rowManager.renderEmptyScroll()}},O.prototype.generateCollapsedContent=function(){var e=this,t=this.table.rowManager.getDisplayRows();t.forEach(function(t){e.generateCollapsedRowContent(t)})},O.prototype.generateCollapsedRowContent=function(e){var t,o;if(e.modules.responsiveLayout){for(t=e.modules.responsiveLayout.element;t.firstChild;)t.removeChild(t.firstChild);o=this.collapseFormatter(this.generateCollapsedRowData(e)),o&&t.appendChild(o)}},O.prototype.generateCollapsedRowData=function(e){var t,o=this,i=e.getData(),n=[];return this.hiddenColumns.forEach(function(s){var r=s.getFieldValue(i);s.definition.title&&s.field&&(s.modules.format&&o.table.options.responsiveLayoutCollapseUseFormatters?(t={value:!1,data:{},getValue:function(){return r},getData:function(){return i},getElement:function(){return document.createElement("div")},getRow:function(){return e.getComponent()},getColumn:function(){return s.getComponent()}},n.push({title:s.definition.title,value:s.modules.format.formatter.call(o.table.modules.format,t,s.modules.format.params)})):n.push({title:s.definition.title,value:r}))}),n},O.prototype.formatCollapsedData=function(e){var t=document.createElement("table"),o="";return e.forEach(function(e){var t=document.createElement("div");e.value instanceof Node&&(t.appendChild(e.value),e.value=t.innerHTML),o+="<tr><td><strong>"+e.title+"</strong></td><td>"+e.value+"</td></tr>"}),t.innerHTML=o,Object.keys(e).length?t:""},d.prototype.registerModule("responsiveLayout",O);var G=function(e){this.table=e,this.selecting=!1,this.lastClickedRow=!1,this.selectPrev=[],this.selectedRows=[]};G.prototype.clearSelectionData=function(e){this.selecting=!1,this.lastClickedRow=!1,this.selectPrev=[],this.selectedRows=[],e||this._rowSelectionChanged()},G.prototype.initializeRow=function(e){var t=this,o=e.getElement(),i=function e(){setTimeout(function(){t.selecting=!1},50),document.body.removeEventListener("mouseup",e)};e.modules.select={selected:!1},t.table.options.selectableCheck.call(this.table,e.getComponent())?(o.classList.add("tabulator-selectable"),o.classList.remove("tabulator-unselectable"),t.table.options.selectable&&"highlight"!=t.table.options.selectable&&(t.table.options.selectableRangeMode&&"click"===t.table.options.selectableRangeMode?o.addEventListener("click",function(o){if(o.shiftKey){t.lastClickedRow=t.lastClickedRow||e;var i=t.table.rowManager.getDisplayRowIndex(t.lastClickedRow),n=t.table.rowManager.getDisplayRowIndex(e),s=i<=n?i:n,r=i>=n?i:n,a=t.table.rowManager.getDisplayRows().slice(0),l=a.splice(s,r-s+1);o.ctrlKey?(l.forEach(function(e){e!==t.lastClickedRow&&t.toggleRow(e)}),t.lastClickedRow=e):(t.deselectRows(),t.selectRows(l))}else o.ctrlKey?(t.toggleRow(e),t.lastClickedRow=e):(t.deselectRows(),t.selectRows(e),t.lastClickedRow=e)}):(o.addEventListener("click",function(o){t.selecting||t.toggleRow(e)}),o.addEventListener("mousedown",function(o){if(o.shiftKey)return t.selecting=!0,t.selectPrev=[],document.body.addEventListener("mouseup",i),document.body.addEventListener("keyup",i),t.toggleRow(e),!1}),o.addEventListener("mouseenter",function(o){t.selecting&&(t.toggleRow(e),t.selectPrev[1]==e&&t.toggleRow(t.selectPrev[0]))}),o.addEventListener("mouseout",function(o){t.selecting&&t.selectPrev.unshift(e)})))):(o.classList.add("tabulator-unselectable"),o.classList.remove("tabulator-selectable"))},G.prototype.toggleRow=function(e){this.table.options.selectableCheck.call(this.table,e.getComponent())&&(e.modules.select&&e.modules.select.selected?this._deselectRow(e):this._selectRow(e))},G.prototype.selectRows=function(e){var t=this;switch("undefined"==typeof e?"undefined":r(e)){case"undefined":t.table.rowManager.rows.forEach(function(e){t._selectRow(e,!0,!0)}),t._rowSelectionChanged();break;case"boolean":e===!0&&(t.table.rowManager.activeRows.forEach(function(e){t._selectRow(e,!0,!0)}),t._rowSelectionChanged());break;default:Array.isArray(e)?(e.forEach(function(e){t._selectRow(e,!0,!0)}),t._rowSelectionChanged()):t._selectRow(e,!1,!0)}},G.prototype._selectRow=function(e,t,o){if(!isNaN(this.table.options.selectable)&&this.table.options.selectable!==!0&&!o&&this.selectedRows.length>=this.table.options.selectable){if(!this.table.options.selectableRollingSelection)return!1;this._deselectRow(this.selectedRows[0])}var i=this.table.rowManager.findRow(e);i?this.selectedRows.indexOf(i)==-1&&(i.modules.select||(i.modules.select={}),i.modules.select.selected=!0,i.getElement().classList.add("tabulator-selected"),this.selectedRows.push(i),t||(this.table.options.rowSelected.call(this.table,i.getComponent()),this._rowSelectionChanged())):t||console.warn("Selection Error - No such row found, ignoring selection:"+e)},G.prototype.isRowSelected=function(e){return this.selectedRows.indexOf(e)!==-1},G.prototype.deselectRows=function(e){var t,o=this;if("undefined"==typeof e){t=o.selectedRows.length;for(var i=0;i<t;i++)o._deselectRow(o.selectedRows[0],!0);o._rowSelectionChanged()}else Array.isArray(e)?(e.forEach(function(e){o._deselectRow(e,!0)}),o._rowSelectionChanged()):o._deselectRow(e)},G.prototype._deselectRow=function(e,t){var o,i=this,n=i.table.rowManager.findRow(e);n?(o=i.selectedRows.findIndex(function(e){return e==n}),o>-1&&(n.modules.select||(n.modules.select={}),n.modules.select.selected=!1,n.getElement().classList.remove("tabulator-selected"),i.selectedRows.splice(o,1),t||(i.table.options.rowDeselected.call(this.table,n.getComponent()),i._rowSelectionChanged()))):t||console.warn("Deselection Error - No such row found, ignoring selection:"+e)},G.prototype.getSelectedData=function(){var e=[];return this.selectedRows.forEach(function(t){e.push(t.getData())}),e},G.prototype.getSelectedRows=function(){var e=[];return this.selectedRows.forEach(function(t){e.push(t.getComponent())}),e},G.prototype._rowSelectionChanged=function(){this.table.options.rowSelectionChanged.call(this.table,this.getSelectedData(),this.getSelectedRows())},d.prototype.registerModule("selectRow",G);var V=function(e){this.table=e,this.sortList=[],this.changed=!1};V.prototype.initializeColumn=function(e,t){var o,i,n=this,s=!1;switch(r(e.definition.sorter)){case"string":n.sorters[e.definition.sorter]?s=n.sorters[e.definition.sorter]:console.warn("Sort Error - No such sorter found: ",e.definition.sorter);break;case"function":s=e.definition.sorter}e.modules.sort={sorter:s,dir:"none",params:e.definition.sorterParams||{},startingDir:e.definition.headerSortStartingDir||"asc",tristate:e.definition.headerSortTristate},e.definition.headerSort!==!1&&(o=e.getElement(),o.classList.add("tabulator-sortable"),i=document.createElement("div"),i.classList.add("tabulator-arrow"),t.appendChild(i),
- o.addEventListener("click",function(t){var o="",i=[],s=!1;if(e.modules.sort){if(e.modules.sort.tristate)o="none"==e.modules.sort.dir?e.modules.sort.startingDir:e.modules.sort.dir==e.modules.sort.startingDir?"asc"==e.modules.sort.dir?"desc":"asc":"none";else switch(e.modules.sort.dir){case"asc":o="desc";break;case"desc":o="asc";break;default:o=e.modules.sort.startingDir}n.table.options.columnHeaderSortMulti&&(t.shiftKey||t.ctrlKey)?(i=n.getSort(),s=i.findIndex(function(t){return t.field===e.getField()}),s>-1?(i[s].dir=o,s!=i.length-1&&(s=i.splice(s,1)[0],"none"!=o&&i.push(s))):"none"!=o&&i.push({column:e,dir:o}),n.setSort(i)):"none"==o?n.clear():n.setSort(e,o),n.table.rowManager.sorterRefresh(!n.sortList.length)}}))},V.prototype.hasChanged=function(){var e=this.changed;return this.changed=!1,e},V.prototype.getSort=function(){var e=this,t=[];return e.sortList.forEach(function(e){e.column&&t.push({column:e.column.getComponent(),field:e.column.getField(),dir:e.dir})}),t},V.prototype.setSort=function(e,t){var o=this,i=[];Array.isArray(e)||(e=[{column:e,dir:t}]),e.forEach(function(e){var t;t=o.table.columnManager.findColumn(e.column),t?(e.column=t,i.push(e),o.changed=!0):console.warn("Sort Warning - Sort field does not exist and is being ignored: ",e.column)}),o.sortList=i,this.table.options.persistentSort&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.save("sort")},V.prototype.clear=function(){this.setSort([])},V.prototype.findSorter=function(e){var t,o,i=this.table.rowManager.activeRows[0],n="string";if(i&&(i=i.getData(),t=e.getField()))switch(o=e.getFieldValue(i),"undefined"==typeof o?"undefined":r(o)){case"undefined":n="string";break;case"boolean":n="boolean";break;default:isNaN(o)||""===o?o.match(/((^[0-9]+[a-z]+)|(^[a-z]+[0-9]+))+$/i)&&(n="alphanum"):n="number"}return this.sorters[n]},V.prototype.sort=function(e){var t,o=this;t=this.table.options.sortOrderReverse?o.sortList.slice().reverse():o.sortList,o.table.options.dataSorting&&o.table.options.dataSorting.call(o.table,o.getSort()),o.clearColumnHeaders(),o.table.options.ajaxSorting?t.forEach(function(e,t){o.setColumnHeader(e.column,e.dir)}):t.forEach(function(i,n){i.column&&i.column.modules.sort&&(i.column.modules.sort.sorter||(i.column.modules.sort.sorter=o.findSorter(i.column)),o._sortItem(e,i.column,i.dir,t,n)),o.setColumnHeader(i.column,i.dir)}),o.table.options.dataSorted&&o.table.options.dataSorted.call(o.table,o.getSort(),o.table.rowManager.getComponents(!0))},V.prototype.clearColumnHeaders=function(){this.table.columnManager.getRealColumns().forEach(function(e){e.modules.sort&&(e.modules.sort.dir="none",e.getElement().setAttribute("aria-sort","none"))})},V.prototype.setColumnHeader=function(e,t){e.modules.sort.dir=t,e.getElement().setAttribute("aria-sort",t)},V.prototype._sortItem=function(e,t,o,i,n){var s=this,r="function"==typeof t.modules.sort.params?t.modules.sort.params(t.getComponent(),o):t.modules.sort.params;e.sort(function(e,a){var l=s._sortRow(e,a,t,o,r);if(0===l&&n)for(var u=n-1;u>=0&&(l=s._sortRow(e,a,i[u].column,i[u].dir,r),0===l);u--);return l})},V.prototype._sortRow=function(e,t,o,i,n){var s,r,a="asc"==i?e:t,l="asc"==i?t:e;return e=o.getFieldValue(a.getData()),t=o.getFieldValue(l.getData()),e="undefined"!=typeof e?e:"",t="undefined"!=typeof t?t:"",s=a.getComponent(),r=l.getComponent(),o.modules.sort.sorter.call(this,e,t,s,r,o.getComponent(),i,n)},V.prototype.sorters={number:function(e,t,o,i,n,s,r){var a=r.alignEmptyValues,l=r.decimalSeparator||".",u=r.thousandSeparator||",",c=0;if(e=parseFloat(String(e).split(u).join("").split(l).join(".")),t=parseFloat(String(t).split(u).join("").split(l).join(".")),isNaN(e))c=isNaN(t)?0:-1;else{if(!isNaN(t))return e-t;c=1}return("top"===a&&"desc"===s||"bottom"===a&&"asc"===s)&&(c*=-1),c},string:function(e,t,o,i,n,s,a){var l,u=a.alignEmptyValues,c=0;if(e){if(t){switch(r(a.locale)){case"boolean":a.locale&&(l=this.table.modules.localize.getLocale());break;case"string":l=a.locale}return String(e).toLowerCase().localeCompare(String(t).toLowerCase(),l)}c=1}else c=t?-1:0;return("top"===u&&"desc"===s||"bottom"===u&&"asc"===s)&&(c*=-1),c},date:function(e,t,o,i,n,s,r){return r.format||(r.format="DD/MM/YYYY"),this.sorters.datetime.call(this,e,t,o,i,n,s,r)},time:function(e,t,o,i,n,s,r){return r.format||(r.format="hh:mm"),this.sorters.datetime.call(this,e,t,o,i,n,s,r)},datetime:function(e,t,o,i,n,s,r){var a=r.format||"DD/MM/YYYY hh:mm:ss",l=r.alignEmptyValues,u=0;if("undefined"!=typeof moment){if(e=moment(e,a),t=moment(t,a),e.isValid()){if(t.isValid())return e-t;u=1}else u=t.isValid()?-1:0;return("top"===l&&"desc"===s||"bottom"===l&&"asc"===s)&&(u*=-1),u}console.error("Sort Error - 'datetime' sorter is dependant on moment.js")},boolean:function(e,t,o,i,n,s,r){var a=e===!0||"true"===e||"True"===e||1===e?1:0,l=t===!0||"true"===t||"True"===t||1===t?1:0;return a-l},array:function(e,t,o,i,n,s,r){function a(e){switch(c){case"length":return e.length;case"sum":return e.reduce(function(e,t){return e+t});case"max":return Math.max.apply(null,e);case"min":return Math.min.apply(null,e);case"avg":return e.reduce(function(e,t){return e+t})/e.length}}var l=0,u=0,c=r.type||"length",d=r.alignEmptyValues,h=0;if(Array.isArray(e)){if(Array.isArray(t))return l=e?a(e):0,u=t?a(t):0,l-u;d=1}else d=Array.isArray(t)?-1:0;return("top"===d&&"desc"===s||"bottom"===d&&"asc"===s)&&(h*=-1),h},exists:function(e,t,o,i,n,s,r){var a="undefined"==typeof e?0:1,l="undefined"==typeof t?0:1;return a-l},alphanum:function(e,t,o,i,n,s,r){var a,l,u,c,d,h=0,p=/(\d+)|(\D+)/g,m=/\d/,f=r.alignEmptyValues,g=0;if(e||0===e){if(t||0===t){if(isFinite(e)&&isFinite(t))return e-t;if(a=String(e).toLowerCase(),l=String(t).toLowerCase(),a===l)return 0;if(!m.test(a)||!m.test(l))return a>l?1:-1;for(a=a.match(p),l=l.match(p),d=a.length>l.length?l.length:a.length;h<d;)if(u=a[h],c=l[h++],u!==c)return isFinite(u)&&isFinite(c)?("0"===u.charAt(0)&&(u="."+u),"0"===c.charAt(0)&&(c="."+c),u-c):u>c?1:-1;return a.length>l.length}g=1}else g=t||0===t?-1:0;return("top"===f&&"desc"===s||"bottom"===f&&"asc"===s)&&(g*=-1),g}},d.prototype.registerModule("sort",V);var W=function(e){this.table=e};return W.prototype.initializeColumn=function(e){var t,o=this,i=[];e.definition.validator&&(Array.isArray(e.definition.validator)?e.definition.validator.forEach(function(e){t=o._extractValidator(e),t&&i.push(t)}):(t=this._extractValidator(e.definition.validator),t&&i.push(t)),e.modules.validate=!!i.length&&i)},W.prototype._extractValidator=function(e){var t,o,i;switch("undefined"==typeof e?"undefined":r(e)){case"string":return t=e.split(":",2),o=t.shift(),i=t[0],this._buildValidator(o,i);case"function":return this._buildValidator(e);case"object":return this._buildValidator(e.type,e.parameters)}},W.prototype._buildValidator=function(e,t){var o="function"==typeof e?e:this.validators[e];return o?{type:"function"==typeof e?"function":e,func:o,params:t}:(console.warn("Validator Setup Error - No matching validator found:",e),!1)},W.prototype.validate=function(e,t,o){var i=this,n=[];return e&&e.forEach(function(e){e.func.call(i,t,o,e.params)||n.push({type:e.type,parameters:e.params})}),!n.length||n},W.prototype.validators={integer:function(e,t,o){return""===t||null===t||"undefined"==typeof t||(t=Number(t),"number"==typeof t&&isFinite(t)&&Math.floor(t)===t)},float:function(e,t,o){return""===t||null===t||"undefined"==typeof t||(t=Number(t),"number"==typeof t&&isFinite(t)&&t%1!==0)},numeric:function(e,t,o){return""===t||null===t||"undefined"==typeof t||!isNaN(t)},string:function(e,t,o){return""===t||null===t||"undefined"==typeof t||isNaN(t)},max:function(e,t,o){return""===t||null===t||"undefined"==typeof t||parseFloat(t)<=o},min:function(e,t,o){return""===t||null===t||"undefined"==typeof t||parseFloat(t)>=o},minLength:function(e,t,o){return""===t||null===t||"undefined"==typeof t||String(t).length>=o},maxLength:function(e,t,o){return""===t||null===t||"undefined"==typeof t||String(t).length<=o},in:function(e,t,o){return""===t||null===t||"undefined"==typeof t||("string"==typeof o&&(o=o.split("|")),""===t||o.indexOf(t)>-1)},regex:function(e,t,o){if(""===t||null===t||"undefined"==typeof t)return!0;var i=new RegExp(o);return i.test(t)},unique:function e(t,o,i){if(""===o||null===o||"undefined"==typeof o)return!0;var e=!0,n=t.getData(),s=t.getColumn()._getSelf();return this.table.rowManager.rows.forEach(function(t){var i=t.getData();i!==n&&o==s.getFieldValue(i)&&(e=!1)}),e},required:function(e,t,o){return""!==t&null!==t&&"undefined"!=typeof t}},d.prototype.registerModule("validate",W),d})},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.debounce=function(e,t){var o=void 0;return function(){for(var i=arguments.length,n=Array(i),s=0;s<i;s++)n[s]=arguments[s];o&&clearTimeout(o),o=setTimeout(function(){t.apply(void 0,n),o=null},e)}}}])});
|