var DataTable=function(t,e){"use strict";function n(t,e){return"string"==typeof t?(e||document).querySelector(t):t||null}function i(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function o(t){var e=j.call(t,O),n=t[O];try{t[O]=void 0}catch(t){}var i=W.call(t);return e?t[O]=n:delete t[O],i}function s(t){return A.call(t)}function r(t){return null==t?void 0===t?D:B:N&&N in Object(t)?z(t):F(t)}function l(t){return null!=t&&"object"==typeof t}function c(t){return"symbol"==typeof t||q(t)&&V(t)==P}function a(t){if("number"==typeof t)return t;if(K(t))return X;if(v(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=v(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(U,"");var n=G.test(t);return n||J.test(t)?Q(t.slice(2),n?2:8):Z.test(t)?X:+t}function h(t,e,n){function i(e){var n=d,i=f;return d=f=void 0,b=e,m=t.apply(i,n)}function o(t){return b=t,p=setTimeout(l,e),C?i(t):m}function s(t){var n=t-b,i=e-(t-w);return y?nt(i,g-n):i}function r(t){var n=t-w,i=t-b;return void 0===w||n>=e||n<0||y&&i>=g}function l(){var t=k();if(r(t))return c(t);p=setTimeout(l,s(t))}function c(t){return p=void 0,x&&d?i(t):(d=f=void 0,m)}function a(){void 0!==p&&clearTimeout(p),b=0,d=w=f=p=void 0}function h(){return void 0===p?m:c(k())}function u(){var t=k(),n=r(t);if(d=arguments,f=this,w=t,n){if(void 0===p)return o(w);if(y)return p=setTimeout(l,e),i(w)}return void 0===p&&(p=setTimeout(l,e)),m}var d,f,g,m,p,w,b=0,C=!1,y=!1,x=!0;if("function"!=typeof t)throw new TypeError(tt);return e=Y(e)||0,v(n)&&(C=!!n.leading,g=(y="maxWait"in n)?et(Y(n.maxWait)||0,e):g,x="trailing"in n?!!n.trailing:x),u.cancel=a,u.flush=h,u}function u(t,e,n){var i=!0,o=!0;if("function"!=typeof t)throw new TypeError(ot);return v(n)&&(i="leading"in n?!!n.leading:i,o="trailing"in n?!!n.trailing:o),it(t,e,{leading:i,maxWait:e,trailing:o})}function d(t){return t.replace(/([A-Z])/g,t=>`-${t[0].toLowerCase()}`)}function f(t){return Object.keys(t).map(e=>{const n=d(e);const i=t[e];if(void 0===i)return"";return`data-${n}="${i}" `}).join("").trim()}function g(t){var e=document.createElement("textarea");e.style.position="fixed",e.style.top=0,e.style.left=0,e.style.width="2em",e.style.height="2em",e.style.padding=0,e.style.border="none",e.style.outline="none",e.style.boxShadow="none",e.style.background="transparent",e.value=t,document.body.appendChild(e),e.select();try{document.execCommand("copy")}catch(t){console.log("Oops, unable to copy")}document.body.removeChild(e)}function m(t){return!isNaN(t)}function p(t,e=null){return(...n)=>new Promise(i=>{const o=()=>{const o=t.apply(e,n);i(o)};setTimeout(o)})}function w(t,e,n){const i=n.reduce((t,n)=>{t[n]={get(){return e[n]}};return t},{});Object.defineProperties(t,i)}function b(t){return void 0!==t||null!==t}function C(t){return!b(t)}function y(t){return!isNaN(t)}function x(t){return Array.isArray(t)?t:[t]}t=t&&t.hasOwnProperty("default")?t.default:t,e=e&&e.hasOwnProperty("default")?e.default:e,n.each=((t,e)=>"string"==typeof t?Array.from((e||document).querySelectorAll(t)):t||null),n.create=((t,e)=>{let i=document.createElement(t);for(let t in e){let o=e[t];if("inside"===t)n(o).appendChild(i);else if("around"===t){let t=n(o);t.parentNode.insertBefore(i,t),i.appendChild(t)}else"styles"===t?"object"==typeof o&&Object.keys(o).map(t=>{i.style[t]=o[t]}):t in i?i[t]=o:i.setAttribute(t,o)}return i}),n.on=((t,e,i,o)=>{o?n.delegate(t,e,i,o):(o=i,n.bind(t,e,o))}),n.off=((t,e,n)=>{t.removeEventListener(e,n)}),n.bind=((t,e,n)=>{e.split(/\s+/).forEach(function(e){t.addEventListener(e,n)})}),n.delegate=((t,e,n,i)=>{t.addEventListener(e,function(t){const e=t.target.closest(n);e&&(t.delegatedTarget=e,i.call(this,t,e))})}),n.unbind=((t,e)=>{if(t)for(let n in e){let i=e[n];n.split(/\s+/).forEach(function(e){t.removeEventListener(e,i)})}}),n.fire=((t,e,n)=>{let i=document.createEvent("HTMLEvents");i.initEvent(e,!0,!0);for(let t in n)i[t]=n[t];return t.dispatchEvent(i)}),n.data=((t,e)=>{if(!e)return t.dataset;for(const n in e)t.dataset[n]=e[n]}),n.style=((t,e)=>{if("string"==typeof e)return n.getStyle(t,e);Array.isArray(t)||(t=[t]);t.map(t=>{for(const n in e)t.style[n]=e[n]})}),n.removeStyle=((t,e)=>{Array.isArray(t)||(t=[t]);Array.isArray(e)||(e=[e]);t.map(t=>{for(const n of e)t.style[n]=""})}),n.getStyle=((t,e)=>{let n=getComputedStyle(t)[e];["width","height"].includes(e)&&(n=parseFloat(n));return n}),n.closest=((t,e)=>{if(!e)return null;if(e.matches(t))return e;return n.closest(t,e.parentNode)}),n.inViewport=((t,e)=>{const{top:top,left:left,bottom:bottom,right:right}=t.getBoundingClientRect();const{top:pTop,left:pLeft,bottom:pBottom,right:pRight}=e.getBoundingClientRect();return top>=pTop&&left>=pLeft&&bottom<=pBottom&&right<=pRight}),n.scrollTop=function(t,e){requestAnimationFrame(()=>{t.scrollTop=e})},n.scrollbarWidth=function(){const t=document.createElement("div");n.style(t,{width:"100px",height:"100px",overflow:"scroll",position:"absolute",top:"-9999px"}),document.body.appendChild(t);const e=t.offsetWidth-t.clientWidth;return document.body.removeChild(t),e};var v=i,I="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},R="object"==typeof I&&I&&I.Object===Object&&I,S=Object.freeze({default:R,__moduleExports:R}),_=S&&R||S,E="object"==typeof self&&self&&self.Object===Object&&self,$=_||E||Function("return this")(),T=Object.freeze({default:$,__moduleExports:$}),M=T&&$||T,k=function(){return M.Date.now()},H=M.Symbol,L=Object.prototype,j=L.hasOwnProperty,W=L.toString,O=H?H.toStringTag:void 0,z=o,A=Object.prototype.toString,F=s,B="[object Null]",D="[object Undefined]",N=H?H.toStringTag:void 0,V=r,q=l,P="[object Symbol]",K=c,X=NaN,U=/^\s+|\s+$/g,Z=/^[-+]0x[0-9a-f]+$/i,G=/^0b[01]+$/i,J=/^0o[0-7]+$/i,Q=parseInt,Y=a,tt="Expected a function",et=Math.max,nt=Math.min,it=h,ot="Expected a function";let st=u,rt=it;class lt{constructor(t){this.options=t,this.sortRows=p(this.sortRows,this),this.switchColumn=p(this.switchColumn,this),this.removeColumn=p(this.removeColumn,this),this.filterRows=p(this.filterRows,this)}init(t,e){t||(t=this.options.data),e&&(this.options.columns=e),this.data=t,this.rowCount=0,this.columns=[],this.rows=[],this.prepareColumns(),this.prepareRows(),this.prepareTreeRows(),this.prepareRowView(),this.prepareNumericColumns()}get currentSort(){return this.columns.find(t=>"none"!==t.sortOrder)||{colIndex:-1,sortOrder:"none"}}prepareColumns(){this.columns=[],this.validateColumns(),this.prepareDefaultColumns(),this.prepareHeader()}prepareDefaultColumns(){if(this.options.checkboxColumn&&!this.hasColumnById("_checkbox")){const t={id:"_checkbox",content:this.getCheckboxHTML(),editable:!1,resizable:!1,sortable:!1,focusable:!1,dropdown:!1,width:32};this.columns.push(t)}if(this.options.serialNoColumn&&!this.hasColumnById("_rowIndex")){let t={id:"_rowIndex",content:"",align:"center",editable:!1,resizable:!1,focusable:!1,dropdown:!1};this.columns.push(t)}}prepareHeader(){let t=this.columns.concat(this.options.columns);const e={isHeader:1,editable:!0,sortable:!0,resizable:!0,focusable:!0,dropdown:!0,width:null,format:t=>{if(null===t||void 0===t)return"";return t+""}};this.columns=t.map((t,e)=>this.prepareCell(t,e)).map(t=>Object.assign({},e,t)).map(t=>{t.content=t.content||t.name||"";t.id=t.id||t.content;return t})}prepareCell(t,e){const n={content:"",sortOrder:"none",colIndex:e,column:this.columns[e]};return null!==t&&"object"==typeof t?Object.assign(n,t):n.content=t,n}prepareNumericColumns(){const t=this.getRow(0);t&&(this.columns=this.columns.map((e,n)=>{const i=t[n].content;!e.align&&i&&m(i)&&(e.align="right");return e}))}prepareRows(){this.validateData(this.data),this.rows=this.data.map((t,e)=>{const n=this._getNextRowCount();let i=[];let o={rowIndex:n};if(Array.isArray(t))for(this.options.checkboxColumn&&i.push(this.getCheckboxHTML()),this.options.serialNoColumn&&i.push(n+1+""),i=i.concat(t);i.length{if(y(t.meta.indent)){const n=this.getRow(e+1);t.meta.isLeaf=!n||C(n.meta.indent)||n.meta.indent<=t.meta.indent}})}prepareRowView(){this.rowViewOrder=this.rows.map(t=>t.meta.rowIndex)}prepareRow(t,e){const n={rowIndex:e.rowIndex,indent:e.indent};return t=t.map((t,e)=>this.prepareCell(t,e)).map(t=>Object.assign({},n,t)),t.meta=e,t}validateColumns(){const t=this.options.columns;if(!Array.isArray(t))throw new ct("`columns` must be an array");t.forEach((t,e)=>{if("string"!=typeof t&&"object"!=typeof t)throw new ct(`column "${e}" must be a string or an object`)})}validateData(t){if(Array.isArray(t)&&(0===t.length||Array.isArray(t[0])||"object"==typeof t[0]))return!0;throw new ct("`data` must be an array of arrays or objects")}appendRows(t){this.validateData(t),this.rows.push(...this.prepareRows(t))}sortRows(t,e="none"){t=+t,this.getColumns().map(n=>{n.colIndex===t?n.sortOrder=e:n.sortOrder="none"}),this._sortRows(t,e)}_sortRows(t,e){if(this.currentSort.colIndex===t&&("asc"===this.currentSort.sortOrder&&"desc"===e||"desc"===this.currentSort.sortOrder&&"asc"===e))return this.reverseArray(this.rowViewOrder),void(this.currentSort.sortOrder=e);if(this.rowViewOrder.sort((n,i)=>{const o=n;const s=i;const r=this.getCell(t,n).content;const l=this.getCell(t,i).content;if("none"===e)return o-s;if("asc"===e){if(rl)return 1;if(r===l)return 0}else if("desc"===e){if(rl)return-1;if(r===l)return 0}return 0}),this.hasColumnById("_rowIndex")){const t=this.getColumnIndexById("_rowIndex");this.rows.forEach((e,n)=>{const i=this.rowViewOrder.indexOf(n);const o=e[t];o.content=i+1+""})}}reverseArray(t){let e=null,n=null;for(e=0,n=t.length-1;e{const i=Object.assign({},n[t],{colIndex:e});const o=Object.assign({},n[e],{colIndex:t});n[e]=i;n[t]=o})}removeColumn(t){t=+t;const e=e=>e.colIndex!==t,n=(t,e)=>Object.assign({},t,{colIndex:e});this.columns=this.columns.filter(e).map(n),this.rows.forEach(e=>{e.splice(t,1);e.forEach((t,e)=>{t.colIndex=e})})}updateRow(t,e){if(t.lengtht[0].rowIndex===e);return this.rows[i]=n,n}updateCell(t,e,n){let i;"object"==typeof t&&(t=(i=t).colIndex,e=i.rowIndex,n=i),i=this.getCell(t,e);for(let t in n){const e=n[t];void 0!==e&&(i[t]=e)}return i}updateColumn(t,e){const n=this.getColumn(t);for(let t in e){const i=e[t];void 0!==i&&(n[t]=i)}return n}filterRows(t,e){let n=[],i=[];return this.rows.map(t=>t[e]).forEach(e=>{const o=String(e.content||"").toLowerCase();const s=(t||"").toLowerCase();!s||o.includes(s)?i.push(e.rowIndex):n.push(e.rowIndex)}),this._filteredRows=i,{rowsToHide:n,rowsToShow:i}}getFilteredRowIndices(){return this._filteredRows||this.rows.map(t=>t.meta.rowIndex)}getRowCount(){return this.rowCount}_getNextRowCount(){const t=this.rowCount;return this.rowCount++,t}getRows(t,e){return this.rows.slice(t,e)}getRowsForView(t,e){return this.rowViewOrder.map(t=>this.rows[t]).slice(t,e)}getColumns(t){let e=this.columns;return t&&(e=e.slice(this.getStandardColumnCount())),e}getStandardColumnCount(){return this.options.checkboxColumn&&this.options.serialNoColumn?2:this.options.checkboxColumn||this.options.serialNoColumn?1:0}getColumnCount(t){let e=this.columns.length;return t&&(e-=this.getStandardColumnCount()),e}getColumn(t){return(t=+t)<0&&(t=this.columns.length+t),this.columns.find(e=>e.colIndex===t)}getColumnById(t){return this.columns.find(e=>e.id===t)}getRow(t){return t=+t,this.rows[t]}getCell(t,e){return e=+e,t=+t,this.getRow(e)[t]}getChildren(t){t=+t;const e=this.getRow(t).meta.indent,n=[];for(let i=t+1;ie&&n.push(i),t.meta.indent===e))break}return n}getImmediateChildren(t){t=+t;const e=this.getRow(t).meta.indent,n=[],i=e+1;for(let o=t+1;oi)&&(t.meta.indent===i&&n.push(o),t.meta.indent===e))break}return n}get(){return{columns:this.columns,rows:this.rows}}getData(t){return this.data[t]}hasColumn(t){return Boolean(this.columns.find(e=>e.content===t))}hasColumnById(t){return Boolean(this.columns.find(e=>e.id===t))}getColumnIndex(t){return this.columns.findIndex(e=>e.content===t)}getColumnIndexById(t){return this.columns.findIndex(e=>e.id===t)}getCheckboxHTML(){return''}}class ct extends TypeError{}class at{constructor(t){this.instance=t,w(this,this.instance,["wrapper","options","style","bodyScrollable","columnmanager","rowmanager","datamanager","keyboard"]),this.bindEvents()}bindEvents(){this.bindFocusCell(),this.bindEditCell(),this.bindKeyboardSelection(),this.bindCopyCellContents(),this.bindMouseEvents(),this.bindTreeEvents()}bindFocusCell(){this.bindKeyboardNav()}bindEditCell(){this.$editingCell=null,n.on(this.bodyScrollable,"dblclick",".dt-cell",(t,e)=>{this.activateEditing(e)}),this.keyboard.on("enter",()=>{this.$focusedCell&&!this.$editingCell?this.activateEditing(this.$focusedCell):this.$editingCell&&(this.submitEditing(),this.deactivateEditing())})}bindKeyboardNav(){const t=t=>{if(!this.$focusedCell||this.$editingCell)return!1;let e=this.$focusedCell;"left"===t||"shift+tab"===t?e=this.getLeftCell$(e):"right"===t||"tab"===t?e=this.getRightCell$(e):"up"===t?e=this.getAboveCell$(e):"down"===t&&(e=this.getBelowCell$(e));this.focusCell(e);return!0},e=t=>{if(!this.$focusedCell||this.$editingCell)return!1;let e=this.$focusedCell;const{rowIndex:rowIndex,colIndex:colIndex}=n.data(e);"left"===t?e=this.getLeftMostCell$(rowIndex):"right"===t?e=this.getRightMostCell$(rowIndex):"up"===t?e=this.getTopMostCell$(colIndex):"down"===t&&(e=this.getBottomMostCell$(colIndex));this.focusCell(e);return!0};["left","right","up","down","tab","shift+tab"].map(e=>this.keyboard.on(e,()=>t(e))),["left","right","up","down"].map(t=>this.keyboard.on(`ctrl+${t}`,()=>e(t))),this.keyboard.on("esc",()=>{this.deactivateEditing();this.columnmanager.toggleFilter(!1)}),this.options.inlineFilters&&this.keyboard.on("ctrl+f",t=>{const e=n.closest(".dt-cell",t.target);const{colIndex:colIndex}=n.data(e);this.activateFilter(colIndex);return!0})}bindKeyboardSelection(){const t=t=>{let e=this.getSelectionCursor();"left"===t?e=this.getLeftCell$(e):"right"===t?e=this.getRightCell$(e):"up"===t?e=this.getAboveCell$(e):"down"===t&&(e=this.getBelowCell$(e));return e};["left","right","up","down"].map(e=>this.keyboard.on(`shift+${e}`,()=>this.selectArea(t(e))))}bindCopyCellContents(){this.keyboard.on("ctrl+c",()=>{const t=this.copyCellContents(this.$focusedCell,this.$selectionCursor);const e=`${t} cell${t>1?"s":""} copied`;t&&this.instance.showToastMessage(e,2)}),this.options.pasteFromClipboard&&this.keyboard.on("ctrl+v",t=>{this.instance.pasteTarget.focus();setTimeout(()=>{const t=this.instance.pasteTarget.value;this.instance.pasteTarget.value="";this.pasteContentInCell(t)},10);return!1})}bindMouseEvents(){let t=null;n.on(this.bodyScrollable,"mousedown",".dt-cell",e=>{t=!0;this.focusCell(n(e.delegatedTarget))}),n.on(this.bodyScrollable,"mouseup",()=>{t=!1});const e=e=>{if(!t)return;this.selectArea(n(e.delegatedTarget))};n.on(this.bodyScrollable,"mousemove",".dt-cell",st(e,50))}bindTreeEvents(){n.on(this.bodyScrollable,"click",".dt-tree-node__toggle",(t,e)=>{const i=n.closest(".dt-cell",e);const{rowIndex:rowIndex}=n.data(i);i.classList.contains("dt-cell--tree-close")?this.rowmanager.openSingleNode(rowIndex):this.rowmanager.closeSingleNode(rowIndex)})}focusCell(t,{skipClearSelection:skipClearSelection=0}={}){if(t&&t!==this.$editingCell){const{colIndex:colIndex,isHeader:isHeader}=n.data(t);isHeader||!1!==this.columnmanager.getColumn(colIndex).focusable&&(this.scrollToCell(t),this.deactivateEditing(),skipClearSelection||this.clearSelection(),this.$focusedCell&&this.$focusedCell.classList.remove("dt-cell--focus"),this.$focusedCell=t,t.classList.add("dt-cell--focus"),t.focus(),this.highlightRowColumnHeader(t))}}highlightRowColumnHeader(t){const{colIndex:colIndex,rowIndex:rowIndex}=n.data(t),e=`.dt-cell--header-${colIndex}`,i=`.dt-cell--${this.datamanager.getColumnIndexById("_rowIndex")}-${rowIndex}`;this.lastHeaders&&this.lastHeaders.forEach(t=>t.classList.remove("dt-cell--highlight"));const o=n(e,this.wrapper),s=n(i,this.wrapper);this.lastHeaders=[o,s],this.lastHeaders.forEach(t=>t.classList.add("dt-cell--highlight"))}selectAreaOnClusterChanged(){if(this.$focusedCell&&this.$selectionCursor){const{colIndex:colIndex,rowIndex:rowIndex}=n.data(this.$selectionCursor),t=this.getCell$(colIndex,rowIndex);if(t&&t!==this.$selectionCursor){const e=n.data(this.$focusedCell);this.$focusedCell=this.getCell$(e.colIndex,e.rowIndex),this.selectArea(t)}}}focusCellOnClusterChanged(){if(this.$focusedCell){const{colIndex:colIndex,rowIndex:rowIndex}=n.data(this.$focusedCell),t=this.getCell$(colIndex,rowIndex);t&&this.focusCell(t,{skipClearSelection:1})}}selectArea(t){this.$focusedCell&&this._selectArea(this.$focusedCell,t)&&(this.$selectionCursor=t)}_selectArea(t,e){if(t===e)return!1;const n=this.getCellsInRange(t,e);return!!n&&(this.clearSelection(),this._selectedCells=n.map(t=>this.getCell$(...t)),requestAnimationFrame(()=>{this._selectedCells.map(t=>t.classList.add("dt-cell--highlight"))}),!0)}getCellsInRange(t,e){let i,o,s,r;if("number"==typeof t)[i,o,s,r]=arguments;else if("object"==typeof t){if(!t||!e)return!1;const l=n.data(t),c=n.data(e);i=+l.colIndex,o=+l.rowIndex,s=+c.colIndex,r=+c.rowIndex}if(o>r&&([o,r]=[r,o]),i>s&&([i,s]=[s,i]),this.isStandardCell(i)||this.isStandardCell(s))return!1;const l=[];let c=i,a=o;const h=[];for(;a<=r;)h.push(a),a+=1;return h.map(t=>{for(;c<=s;)l.push([c,t]),c++;c=i}),l}clearSelection(){(this._selectedCells||[]).forEach(t=>t.classList.remove("dt-cell--highlight")),this._selectedCells=[],this.$selectionCursor=null}getSelectionCursor(){return this.$selectionCursor||this.$focusedCell}activateEditing(t){this.focusCell(t);const{rowIndex:rowIndex,colIndex:colIndex}=n.data(t),e=this.columnmanager.getColumn(colIndex);if(!e||!1!==e.editable&&!1!==e.focusable){const i=this.getCell(colIndex,rowIndex);if(!i||!1!==i.editable){if(this.$editingCell){const{_rowIndex:_rowIndex,_colIndex:_colIndex}=n.data(this.$editingCell);if(rowIndex===_rowIndex&&colIndex===_colIndex)return}this.$editingCell=t,t.classList.add("dt-cell--editing");const o=n(".dt-cell__edit",t);o.innerHTML="";const s=this.getEditor(colIndex,rowIndex,i.content,o);s&&(this.currentCellEditor=s,s.initValue(i.content,rowIndex,e))}}}deactivateEditing(){this.$focusedCell&&this.$focusedCell.focus(),this.$editingCell&&(this.$editingCell.classList.remove("dt-cell--editing"),this.$editingCell=null)}getEditor(t,e,n,i){const o=this.datamanager.getColumn(t),s=this.datamanager.getRow(e),r=this.datamanager.getData(e);let l=this.options.getEditor?this.options.getEditor(t,e,n,i,o,s,r):this.getDefaultEditor(i);return!1!==l&&(void 0===l&&(l=this.getDefaultEditor(i)),l)}getDefaultEditor(t){const e=n.create("input",{class:"dt-input",type:"text",inside:t});return{initValue(t){e.focus(),e.value=t},getValue(){return e.value},setValue(t){e.value=t}}}submitEditing(){if(this.$editingCell){const t=this.$editingCell,{rowIndex:rowIndex,colIndex:colIndex}=n.data(t),e=this.datamanager.getColumn(colIndex);if(t){const n=this.currentCellEditor;if(n){let i=n.getValue();i.then||(i=Promise.resolve(i)),i.then(i=>{const o=n.setValue(i,rowIndex,e);const s=this.getCell(colIndex,rowIndex).content;this.updateCell(colIndex,rowIndex,i);t.focus();o&&o.then&&o.catch(t=>{console.log(t);this.updateCell(colIndex,rowIndex,s)})})}}this.currentCellEditor=null}}copyCellContents(t,e){if(!e&&t){const{colIndex:colIndex,rowIndex:rowIndex}=n.data(t),e=this.getCell(colIndex,rowIndex);return g(e.content),1}const i=this.getCellsInRange(t,e);if(!i)return 0;const o=i.map(t=>this.getCell(...t)).reduce((t,e)=>{const n=e.rowIndex;t[n]=t[n]||[];t[n].push(e.content);return t},[]);return g(o.map(t=>t.join("\t")).join("\n")),o.reduce((t,e)=>t+e.length,0)}pasteContentInCell(t){if(this.$focusedCell){const e=t.split("\n").map(t=>t.split("\t")).filter(t=>t.length&&t.every(t=>t));let{colIndex:colIndex,rowIndex:rowIndex}=n.data(this.$focusedCell),i={colIndex:+colIndex,rowIndex:+rowIndex};e.forEach((t,e)=>{let n=e+i.rowIndex;t.forEach((t,e)=>{let o=e+i.colIndex;this.updateCell(o,n,t)})})}}activateFilter(t){this.columnmanager.toggleFilter(),this.columnmanager.focusFilter(t),this.columnmanager.isFilterShown||this.$focusedCell.focus()}updateCell(t,e,n){const i=this.datamanager.updateCell(t,e,{content:n});this.refreshCell(i)}refreshCell(t){n(this.selector(t.colIndex,t.rowIndex),this.bodyScrollable).innerHTML=this.getCellContent(t)}toggleTreeButton(t,e){const n=this.columnmanager.getFirstColumnIndex(),i=this.getCell$(n,t);i&&i.classList[e?"remove":"add"]("dt-cell--tree-close")}isStandardCell(t){return t\n ${this.getCellContent(t)}\n \n `}getCellContent(t){const{isHeader:isHeader,isFilter:isFilter,colIndex:colIndex}=t,e=!isHeader&&!1!==t.editable?this.getEditCellHTML(colIndex):"",n=isHeader&&!1!==t.sortable?`\n ${this.options.sortIndicator[t.sortOrder]}\n `:"",i=isHeader&&!1!==t.resizable?'':"",o=isHeader&&!1!==t.dropdown?this.columnmanager.getDropdownHTML():"",s=t.format||t.column&&t.column.format||null;let r;if(isHeader||isFilter||!s)r=t.content;else{const e=this.datamanager.getRow(t.rowIndex),n=this.datamanager.getData(t.rowIndex);r=s(t.content,e,t.column,n)}if(this.options.treeView&&!isHeader&&!isFilter&&void 0!==t.indent){const e=this.datamanager.getRow(t.rowIndex+1),n=e&&e.meta.indent>t.indent,i=this.datamanager.getColumnIndexById("_rowIndex")+1;if(i===t.colIndex){const e=1.5*((t.indent||0)+1),i=n?``:"";r=`\n ${i}${r}`}}return`\n
\n ${r}\n ${n}\n ${i}\n ${o}\n
\n ${e}\n `}getEditCellHTML(t){return`
`}selector(t,e){return`.dt-cell--${t}-${e}`}}class ht{constructor(t){this.instance=t,w(this,this.instance,["options","fireEvent","header","datamanager","style","wrapper","rowmanager","bodyScrollable"]),this.bindEvents()}renderHeader(){this.header.innerHTML="",this.refreshHeader()}refreshHeader(){const t=this.datamanager.getColumns();n("thead",this.header).innerHTML=this.getHeaderHTML(t),this.$filterRow=n(".dt-row[data-is-filter]",this.header),this.$filterRow&&n.style(this.$filterRow,{display:"none"}),this.$columnMap=[],this.bindMoveColumn()}getHeaderHTML(t){let e=this.rowmanager.getRowHTML(t,{isHeader:1});return this.options.inlineFilters&&(e+=this.rowmanager.getRowHTML(t,{isFilter:1})),e}bindEvents(){this.bindDropdown(),this.bindResizeColumn(),this.bindFilter()}bindDropdown(){function t(t){e&&e.classList.remove(i),e=null}let e,i="dt-dropdown--active";n.on(this.header,"click",".dt-dropdown__toggle",(o,s)=>{const r=n.closest(".dt-dropdown",s);r.classList.contains(i)?t():(t(),r.classList.add(i),e=r)}),n.on(document.body,"click",e=>{if(e.target.matches(".dt-dropdown__toggle"))return;t()});const o=this.options.headerDropdown;n.on(this.header,"click",".dt-dropdown__list-item",(t,e)=>{const i=n.closest(".dt-cell",e);const{index:index}=n.data(e);const{colIndex:colIndex}=n.data(i);let s=o[index].action;s&&s.call(this.instance,this.getColumn(colIndex))})}bindResizeColumn(){let t,e,i,o=!1;n.on(this.header,"mousedown",".dt-cell .dt-cell__resize-handle",(s,r)=>{document.body.classList.add("dt-resize");const l=r.parentNode.parentNode;t=l;const{colIndex:colIndex}=n.data(t);const c=this.getColumn(colIndex);if(c&&!1===c.resizable)return;o=!0;e=n.style(n(".dt-cell__content",t),"width");i=s.pageX}),n.on(document.body,"mouseup",e=>{document.body.classList.remove("dt-resize");if(!t)return;o=!1;const{colIndex:colIndex}=n.data(t);this.setColumnWidth(colIndex);this.style.setBodyStyle();t=null}),n.on(document.body,"mousemove",s=>{if(!o)return;const r=e+(s.pageX-i);const{colIndex:colIndex}=n.data(t);if(this.getColumnMinWidth(colIndex)>r)return;this.datamanager.updateColumn(colIndex,{width:r});this.setColumnHeaderWidth(colIndex)})}bindMoveColumn(){const e=n(".dt-row",this.header);this.sortable=t.create(e,{onEnd:t=>{const{oldIndex:oldIndex,newIndex:newIndex}=t;const e=t.item;const{colIndex:colIndex}=n.data(e);if(+colIndex===newIndex)return;this.switchColumn(oldIndex,newIndex)},preventOnFilter:!1,filter:".dt-cell__resize-handle, .dt-dropdown",chosenClass:"dt-cell--dragging",animation:150})}sortColumn(t,e){this.instance.freeze(),this.sortRows(t,e).then(()=>{this.refreshHeader();return this.rowmanager.refreshRows()}).then(()=>this.instance.unfreeze()).then(()=>{this.fireEvent("onSortColumn",this.getColumn(t))})}removeColumn(t){const e=this.getColumn(t);this.instance.freeze(),this.datamanager.removeColumn(t).then(()=>{this.refreshHeader();return this.rowmanager.refreshRows()}).then(()=>this.instance.unfreeze()).then(()=>{this.fireEvent("onRemoveColumn",e)})}switchColumn(t,e){this.instance.freeze(),this.datamanager.switchColumn(t,e).then(()=>{this.refreshHeader();return this.rowmanager.refreshRows()}).then(()=>{this.setColumnWidth(t);this.setColumnWidth(e);this.instance.unfreeze()}).then(()=>{this.fireEvent("onSwitchColumn",this.getColumn(t),this.getColumn(e))})}toggleFilter(t){let e;(e=void 0===t?!this.isFilterShown:t)?n.style(this.$filterRow,{display:""}):n.style(this.$filterRow,{display:"none"}),this.isFilterShown=e,this.style.setBodyStyle()}focusFilter(t){this.isFilterShown&&n(`[data-col-index="${t}"] .dt-filter`,this.$filterRow).focus()}bindFilter(){if(this.options.inlineFilters){const t=t=>{const e=n.closest(".dt-cell",t.target);const{colIndex:colIndex}=n.data(e);const i=t.target.value;this.datamanager.filterRows(i,colIndex).then(({rowsToHide:rowsToHide,rowsToShow:rowsToShow})=>{this.rowmanager.hideRows(rowsToHide);this.rowmanager.showRows(rowsToShow)})};n.on(this.header,"keydown",".dt-filter",rt(t,300))}}sortRows(t,e){return this.datamanager.sortRows(t,e)}getColumn(t){return this.datamanager.getColumn(t)}getColumns(){return this.datamanager.getColumns()}setColumnWidth(t,e){t=+t;let n=e||this.getColumn(t).width;const i=[`.dt-cell__content--col-${t}`,`.dt-cell__edit--col-${t}`].join(", "),o={width:n+"px"};this.style.setStyle(i,o)}setColumnHeaderWidth(t){t=+t,this.$columnMap=this.$columnMap||[];const e=`.dt-cell__content--header-${t}`,{width:width}=this.getColumn(t);let n=this.$columnMap[t];n||(n=this.header.querySelector(e),this.$columnMap[t]=n),n.style.width=width+"px"}getColumnMinWidth(t){return t=+t,this.getColumn(t).minWidth||24}getFirstColumnIndex(){return this.datamanager.getColumnIndexById("_rowIndex")+1}getHeaderCell$(t){return n(`.dt-cell--header-${t}`,this.header)}getLastColumnIndex(){return this.datamanager.getColumnCount()-1}getDropdownHTML(){const{dropdownButton:dropdownButton,headerDropdown:dropdownItems}=this.options;return`\n
\n
${dropdownButton}
\n
\n ${dropdownItems.map((t,e)=>`\n
${t.label}
\n `).join("")}\n
\n
\n `}}class ut{constructor(t){this.instance=t,w(this,this.instance,["options","fireEvent","wrapper","bodyScrollable","bodyRenderer"]),this.bindEvents(),this.refreshRows=p(this.refreshRows,this)}get datamanager(){return this.instance.datamanager}get cellmanager(){return this.instance.cellmanager}bindEvents(){this.bindCheckbox()}bindCheckbox(){this.options.checkboxColumn&&(this.checkMap=[],n.on(this.wrapper,"click",'.dt-cell[data-col-index="0"] [type="checkbox"]',(t,e)=>{const i=e.closest(".dt-cell");const{rowIndex:rowIndex,isHeader:isHeader}=n.data(i);const o=e.checked;isHeader?this.checkAll(o):this.checkRow(rowIndex,o)}))}refreshRows(){this.instance.renderBody(),this.instance.setDimensions()}refreshRow(t,e){this.datamanager.updateRow(t,e).forEach(t=>{this.cellmanager.refreshCell(t)})}getCheckedRows(){if(!this.checkMap)return[];let t=[];for(let e in this.checkMap){const n=this.checkMap[e];1===n&&t.push(e)}return t}highlightCheckedRows(){this.getCheckedRows().map(t=>this.checkRow(t,!0))}checkRow(t,e){const i=e?1:0,o=t=>`.dt-cell[data-row-index="${t}"][data-col-index="0"] [type="checkbox"]`;this.checkMap[t]=i,n.each(o(t),this.bodyScrollable).map(t=>{t.checked=e}),this.highlightRow(t,e),this.showCheckStatus(),this.fireEvent("onCheckRow",this.datamanager.getRow(t))}checkAll(t){const e=t?1:0;this.checkMap=t?Array.from(Array(this.getTotalRows())).map(t=>e):[],n.each('.dt-cell[data-col-index="0"] [type="checkbox"]',this.bodyScrollable).map(e=>{e.checked=t}),this.highlightAll(t),this.showCheckStatus()}showCheckStatus(){if(this.options.checkedRowStatus){const t=this.getCheckedRows().length;t>0?this.bodyRenderer.showToastMessage(`${t} row${t>1?"s":""} selected`):this.bodyRenderer.clearToastMessage()}}highlightRow(t,e=!0){const n=this.getRow$(t);if(n){if(!e&&this.bodyScrollable.classList.contains("dt-scrollable--highlight-all"))return void n.classList.add("dt-row--unhighlight");e&&n.classList.contains("dt-row--unhighlight")&&n.classList.remove("dt-row--unhighlight"),this._highlightedRows=this._highlightedRows||{},e?(n.classList.add("dt-row--highlight"),this._highlightedRows[t]=n):(n.classList.remove("dt-row--highlight"),delete this._highlightedRows[t])}}highlightAll(t=!0){if(t)this.bodyScrollable.classList.add("dt-scrollable--highlight-all");else{this.bodyScrollable.classList.remove("dt-scrollable--highlight-all");for(const t in this._highlightedRows){const e=this._highlightedRows[t];e.classList.remove("dt-row--highlight")}this._highlightedRows={}}}hideRows(t){(t=x(t)).map(t=>{const e=this.getRow$(t);e.classList.add("dt-row--hide")})}showRows(t){(t=x(t)).map(t=>{const e=this.getRow$(t);e.classList.remove("dt-row--hide")})}openSingleNode(t){const e=this.datamanager.getImmediateChildren(t);this.showRows(e),this.cellmanager.toggleTreeButton(t,!0)}closeSingleNode(t){this.datamanager.getImmediateChildren(t).forEach(t=>{const e=this.datamanager.getRow(t);e.meta.isLeaf?(this.hideRows(t),this.cellmanager.toggleTreeButton(t,!1)):(this.closeSingleNode(t),this.hideRows(t))}),this.cellmanager.toggleTreeButton(t,!1)}getRow$(t){return n(this.selector(t),this.bodyScrollable)}getTotalRows(){return this.datamanager.getRowCount()}getFirstRowIndex(){return 0}getLastRowIndex(){return this.datamanager.getRowCount()-1}scrollToRow(t){t=+t,this._lastScrollTo=this._lastScrollTo||0;const e=this.getRow$(t);if(!n.inViewport(e,this.bodyScrollable)){const{height:height}=e.getBoundingClientRect(),{top:top,bottom:bottom}=this.bodyScrollable.getBoundingClientRect(),i=Math.floor((bottom-top)/height);let o=0;o=t>this._lastScrollTo?height*(t+1-i):height*(t+1-1),this._lastScrollTo=t,n.scrollTop(this.bodyScrollable,o)}}getRowHTML(t,e){const n=f(e);return e.isFilter&&(t=t.map(t=>Object.assign({},t,{content:this.getFilterInput({colIndex:t.colIndex}),isFilter:1,isHeader:void 0,editable:!1}))),`\n \n ${t.map(t=>this.cellmanager.getCellHTML(t)).join("")}\n \n `}getFilterInput(t){return``}selector(t){return`.dt-row[data-row-index="${t}"]`}}class dt{constructor(t){this.instance=t,this.options=t.options,this.datamanager=t.datamanager,this.rowmanager=t.rowmanager,this.cellmanager=t.cellmanager,this.bodyScrollable=t.bodyScrollable,this.log=t.log,this.appendRemainingData=p(this.appendRemainingData,this)}render(){this.options.clusterize?this.renderBodyWithClusterize():this.renderBodyHTML()}renderBodyHTML(){const t=this.datamanager.getRowsForView();this.bodyScrollable.innerHTML=this.getBodyHTML(t),this.instance.setDimensions(),this.restoreState()}renderBodyWithClusterize(){const t=this.datamanager.getRowsForView(0,20);let i=this.getDataForClusterize(t);0===i.length&&(i=[this.getNoDataHTML()]),this.clusterize?this.clusterize.update(i):(this.bodyScrollable.innerHTML=this.getBodyHTML([]),this.clusterize=new e({rows:i,scrollElem:this.bodyScrollable,contentElem:n("tbody",this.bodyScrollable),callbacks:{clusterChanged:()=>this.restoreState()},show_no_data_row:!1}),this.instance.setDimensions()),this.appendRemainingData()}restoreState(){this.rowmanager.highlightCheckedRows(),this.cellmanager.selectAreaOnClusterChanged(),this.cellmanager.focusCellOnClusterChanged()}appendRemainingData(){const t=this.datamanager.getRowsForView(20),e=this.getDataForClusterize(t);this.clusterize.append(e)}showToastMessage(t,e){this.instance.toastMessage.innerHTML=this.getToastMessageHTML(t),e&&setTimeout(()=>{this.clearToastMessage()},1e3*e)}clearToastMessage(){this.instance.toastMessage.innerHTML=""}getDataForClusterize(t){return t.map(t=>this.rowmanager.getRowHTML(t,t.meta))}getBodyHTML(t){return`\n \n \n ${t.map(t=>this.rowmanager.getRowHTML(t,t.meta)).join("")}\n \n
\n `}getNoDataHTML(){return`
${this.options.noDataMessage}
`}getToastMessageHTML(t){return`${t}`}}class ft{constructor(t){this.instance=t,w(this,this.instance,["options","datamanager","columnmanager","header","bodyScrollable","datatableWrapper","getColumn"]),this.scopeClass="dt-instance-"+t.constructor.instances,t.datatableWrapper.classList.add(this.scopeClass);const e=document.createElement("style");t.wrapper.insertBefore(e,t.datatableWrapper),this.styleEl=e,this.bindResizeWindow()}get stylesheet(){return this.styleEl.sheet}bindResizeWindow(){"fluid"===this.options.layout&&n.on(window,"resize",st(()=>{this.distributeRemainingWidth();this.refreshColumnWidth();this.compensateScrollbarWidth();this.setBodyStyle()},300))}destroy(){this.styleEl.remove()}setStyle(t,e){if(t.includes(","))return void t.split(",").map(t=>t.trim()).forEach(t=>{this.setStyle(t,e)});this._styleRulesMap=this._styleRulesMap||{};const n=this._getPrefixedSelector(t);if(this._styleRulesMap[n]){const t=Array.from(this.stylesheet.cssRules).findIndex(t=>t.selectorText===n);this.stylesheet.deleteRule(t),e=Object.assign({},this._styleRulesMap[n],e)}const i=this._getRuleString(e),o=`${n} { ${i} }`;this._styleRulesMap[n]=e,this.stylesheet.insertRule(o)}_getPrefixedSelector(t){return`.${this.scopeClass} ${t}`}_getRuleString(t){return Object.keys(t).map(e=>{let n=e;e.includes("-")||(n=d(e));return`${n}:${t[e]};`}).join("")}setDimensions(){this.setHeaderStyle(),this.setupMinWidth(),this.setupNaturalColumnWidth(),this.setupColumnWidth(),this.distributeRemainingWidth(),this.setColumnStyle(),this.compensateScrollbarWidth(),this.setDefaultCellHeight(),this.setBodyStyle()}setHeaderStyle(){"fluid"===this.options.layout&&n.style(this.header,{width:0}),n.style(this.header,{margin:0})}setupMinWidth(){n.each(".dt-cell[data-is-header]",this.header).map(t=>{const{colIndex:colIndex}=n.data(t);const e=this.getColumn(colIndex);if(!e.minWidth){const i=n.style(n(".dt-cell__content",t),"width");e.minWidth=i}})}setupNaturalColumnWidth(){n(".dt-row")&&n.each('.dt-row[data-row-index="0"] .dt-cell',this.bodyScrollable).map(t=>{const{colIndex:colIndex}=n.data(t);const e=this.datamanager.getColumn(colIndex);let i=n.style(n(".dt-cell__content",t),"width");"_rowIndex"===e.id&&(i=this.getRowIndexColumnWidth(i),e.width=i);e.naturalWidth=i})}setupColumnWidth(){if("ratio"===this.options.layout){let t=n.style(this.datatableWrapper,"width");if(this.options.serialNoColumn){const e=this.datamanager.getColumnById("_rowIndex");t=t-e.width-1}if(this.options.checkboxColumn){const e=this.datamanager.getColumnById("_checkbox");t=t-e.width-1}const e=this.datamanager.getColumns().map(t=>{if("_rowIndex"===t.id||"_checkbox"===t.id)return 0;t.width||(t.width=1);t.ratioWidth=parseInt(t.width,10);return t.ratioWidth}).reduce((t,e)=>t+e),i=t/e;this.datamanager.getColumns().map(t=>{if("_rowIndex"===t.id||"_checkbox"===t.id)return;t.width=Math.floor(i*t.ratioWidth)-1})}else this.datamanager.getColumns().map(t=>{t.width||(t.width=t.naturalWidth);t.width{const t=n.scrollbarWidth();const e=this.datamanager.getColumn(-1);const i=e.width-t;this.columnmanager.setColumnWidth(e.colIndex,i)})}distributeRemainingWidth(){if("fluid"===this.options.layout){const t=n.style(this.instance.datatableWrapper,"width"),e=n.style(this.header,"width"),i=this.datamanager.getColumns().filter(t=>t.resizable),o=(t-e)/i.length;i.map(t=>{const e=n.style(this.getColumnHeaderElement(t.colIndex),"width");let i=Math.floor(e+o)-2;this.datamanager.updateColumn(t.colIndex,{width:i})})}}setDefaultCellHeight(){if(!this.options.dynamicRowHeight&&!this.__cellHeightSet){const t=n(".dt-cell[data-is-header]",this.instance.header);if(t){const e=this.options.cellHeight||n.style(t,"height");e&&(this.setCellHeight(e),this.__cellHeightSet=!0)}}}setCellHeight(t){this.setStyle(".dt-cell__content, .dt-cell__edit",{height:t+"px"})}setColumnStyle(){this.datamanager.getColumns().map(t=>{t.align||(t.align="left");["left","center","right"].includes(t.align)||(t.align="left");this.setStyle(`.dt-cell--col-${t.colIndex}`,{"text-align":t.align});this.columnmanager.setColumnHeaderWidth(t.colIndex);this.columnmanager.setColumnWidth(t.colIndex)}),this.setBodyStyle()}refreshColumnWidth(){this.datamanager.getColumns().map(t=>{this.columnmanager.setColumnHeaderWidth(t.colIndex);this.columnmanager.setColumnWidth(t.colIndex)})}setBodyStyle(){requestAnimationFrame(()=>{const t=n.style(this.header,"width");n.style(this.bodyScrollable,{width:t+"px"});const e=n(".dt-body",this.bodyScrollable);e&&n.style(e,{height:"0px"});n.style(this.bodyScrollable,{marginTop:n.style(this.header,"height")+"px"});n.style(n("table",this.bodyScrollable),{margin:0,width:"100%"})})}getColumnHeaderElement(t){return t=+t,t<0?null:n(`.dt-cell[data-col-index="${t}"]`,this.header)}getRowIndexColumnWidth(t){this._rowIndexColumnWidthMap=this._rowIndexColumnWidthMap||{};const e=(this.datamanager.getRowCount()+"").length;return this._rowIndexColumnWidthMap[e]||(this._rowIndexColumnWidthMap[e]=t+8*(e-1)),this._rowIndexColumnWidthMap[e]}}const gt={13:"enter",91:"meta",16:"shift",17:"ctrl",18:"alt",37:"left",38:"up",39:"right",40:"down",9:"tab",27:"esc",67:"c",70:"f",86:"v"};class mt{constructor(t){this.listeners={},n.on(t,"keydown",this.handler.bind(this))}handler(t){let e=gt[t.keyCode];t.shiftKey&&"shift"!==e&&(e="shift+"+e),(t.ctrlKey&&"ctrl"!==e||t.metaKey&&"meta"!==e)&&(e="ctrl+"+e);const n=this.listeners[e];if(n&&n.length>0)for(let e of n){const n=e(t);void 0!==n&&!0!==n||t.preventDefault()}}on(t,e){t.split(",").map(t=>t.trim()).map(t=>{this.listeners[t]=this.listeners[t]||[];this.listeners[t].push(e)})}}var pt={columns:[],data:[],dropdownButton:"▼",headerDropdown:[{label:"Sort Ascending",action:function(t){this.sortColumn(t.colIndex,"asc")}},{label:"Sort Descending",action:function(t){this.sortColumn(t.colIndex,"desc")}},{label:"Reset sorting",action:function(t){this.sortColumn(t.colIndex,"none")}},{label:"Remove column",action:function(t){this.removeColumn(t.colIndex)}}],events:{onRemoveColumn(t){},onSwitchColumn(t,e){},onSortColumn(t){},onCheckRow(t){}},sortIndicator:{asc:"↑",desc:"↓",none:""},freezeMessage:"",getEditor:null,serialNoColumn:!0,checkboxColumn:!1,clusterize:!0,logs:!1,layout:"fixed",noDataMessage:"No Data",cellHeight:null,inlineFilters:!1,treeView:!1,checkedRowStatus:!0,dynamicRowHeight:!1,pasteFromClipboard:!1};class wt{constructor(t,e){if(wt.instances++,"string"==typeof t&&(t=document.querySelector(t)),this.wrapper=t,!(this.wrapper instanceof HTMLElement))throw new Error("Invalid argument given for `wrapper`");this.buildOptions(e),this.prepare(),this.style=new ft(this),this.keyboard=new mt(this.wrapper),this.datamanager=new lt(this.options),this.rowmanager=new ut(this),this.columnmanager=new ht(this),this.cellmanager=new at(this),this.bodyRenderer=new dt(this),this.options.data&&this.refresh()}buildOptions(t){this.options=this.options||{},this.options=Object.assign({},pt,this.options||{},t),t.headerDropdown=t.headerDropdown||[],this.options.headerDropdown=[...pt.headerDropdown,...t.headerDropdown],this.events=Object.assign({},pt.events,this.options.events||{},t.events||{}),this.fireEvent=this.fireEvent.bind(this)}prepare(){this.prepareDom(),this.unfreeze()}prepareDom(){this.wrapper.innerHTML=`\n
\n \n
\n
\n
\n
\n \n ${this.options.freezeMessage}\n \n
\n
\n \n
\n `,this.datatableWrapper=n(".datatable",this.wrapper),this.header=n(".dt-header",this.wrapper),this.bodyScrollable=n(".dt-scrollable",this.wrapper),this.freezeContainer=n(".dt-freeze",this.wrapper),this.toastMessage=n(".dt-toast",this.wrapper),this.pasteTarget=n(".dt-paste-target",this.wrapper)}refresh(t,e){this.datamanager.init(t,e),this.render(),this.setDimensions()}destroy(){this.wrapper.innerHTML="",this.style.destroy()}appendRows(t){this.datamanager.appendRows(t),this.rowmanager.refreshRows()}refreshRow(t,e){this.rowmanager.refreshRow(t,e)}render(){this.renderHeader(),this.renderBody()}renderHeader(){this.columnmanager.renderHeader()}renderBody(){this.bodyRenderer.render()}setDimensions(){this.style.setDimensions()}showToastMessage(t,e){this.bodyRenderer.showToastMessage(t,e)}clearToastMessage(){this.bodyRenderer.clearToastMessage()}getColumn(t){return this.datamanager.getColumn(t)}getColumns(){return this.datamanager.getColumns()}getRows(){return this.datamanager.getRows()}getCell(t,e){return this.datamanager.getCell(t,e)}getColumnHeaderElement(t){return this.columnmanager.getColumnHeaderElement(t)}getViewportHeight(){return this.viewportHeight||(this.viewportHeight=n.style(this.bodyScrollable,"height")),this.viewportHeight}sortColumn(t,e){this.columnmanager.sortColumn(t,e)}removeColumn(t){this.columnmanager.removeColumn(t)}scrollToLastColumn(){this.datatableWrapper.scrollLeft=9999}freeze(){n.style(this.freezeContainer,{display:""})}unfreeze(){n.style(this.freezeContainer,{display:"none"})}updateOptions(t){this.buildOptions(t)}fireEvent(t,...e){this.events[t].apply(this,e)}log(){this.options.logs&&console.log.apply(console,arguments)}}wt.instances=0;var bt={name:"frappe-datatable",version:"0.0.8",description:"A modern datatable library for the web",main:"dist/frappe-datatable.cjs.js",scripts:{start:"yarn run dev",build:"rollup -c",production:"rollup -c --production","build:docs":"rollup -c --docs",dev:"rollup -c -w","cy:server":"http-server -p 8989","cy:open":"cypress open","cy:run":"cypress run",test:"start-server-and-test cy:server http://localhost:8989 cy:run"},devDependencies:{chai:"3.5.0",cypress:"3.0.1",deepmerge:"^2.0.1","eslint-config-airbnb":"^16.1.0","eslint-config-airbnb-base":"^12.1.0","eslint-plugin-import":"^2.11.0","http-server":"^0.11.1",mocha:"3.3.0","postcss-cssnext":"^3.1.0","postcss-nested":"^3.0.0",rollup:"^0.59.4","rollup-plugin-commonjs":"^8.3.0","rollup-plugin-eslint":"^4.0.0","rollup-plugin-json":"^2.3.0","rollup-plugin-node-resolve":"^3.0.3","rollup-plugin-postcss":"^1.2.8","rollup-plugin-uglify-es":"^0.0.1","start-server-and-test":"^1.4.1"},repository:{type:"git",url:"https://github.com/frappe/datatable.git"},keywords:["datatable","data","grid","table"],author:"Faris Ansari",license:"MIT",bugs:{url:"https://github.com/frappe/datatable/issues"},homepage:"https://frappe.github.io/datatable",dependencies:{"clusterize.js":"^0.18.0",lodash:"^4.17.5",sortablejs:"^1.7.0"}};return wt.__version__=bt.version,wt}(Sortable,Clusterize);