/** * Minified by jsDelivr using Terser v5.3.5. * Original file: /npm/simple-datatables@3.0.2/dist/umd/simple-datatables.js * * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files */ !function(a){"object"==typeof exports&&"undefined"!=typeof module?module.exports=a():"function"==typeof define&&define.amd?define([],a):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).simpleDatatables=a()}(function(){return(function d(e,f,b){function c(a,k){if(!f[a]){if(!e[a]){var i="function"==typeof require&&require;if(!k&&i)return i(a,!0);if(g)return g(a,!0);var j=new Error("Cannot find module '"+a+"'");throw j.code="MODULE_NOT_FOUND",j}var h=f[a]={exports:{}};e[a][0].call(h.exports,function(b){return c(e[a][1][b]||b)},h,h.exports,d,e,f,b)}return f[a].exports}for(var g="function"==typeof require&&require,a=0;a=c?a:""+Array(c+1-b.length).join(d)+a},(b={})[o="en"]=m,c=function(a){return a instanceof v},d=function(a,d,e){var c;if(!a)return o;if("string"==typeof a)b[a]&&(c=a),d&&(b[a]=d,c=a);else{var f=a.name;b[f]=a,c=f}return!e&&c&&(o=c),c|| !e&&o},a=function(a,d){if(c(a))return a.clone();var b="object"==typeof d?d:{};return b.date=a,b.args=arguments,new v(b)},(e={s:n,z:function(c){var a=-c.utcOffset(),b=Math.abs(a);return(a<=0?"+":"-")+n(Math.floor(b/60),2,"0")+":"+n(b%60,2,"0")},m:function g(a,b){if(a.date() -1){b=a>12;break}}else b=c===(d?"pm":"PM");return b},m={A:[c=/\d*[^\s\d-:/()]+/,function(a){this.afternoon=l(a,!1)}],a:[c,function(a){this.afternoon=l(a,!0)}],S:[/\d/,function(a){this.milliseconds=100*+a}],SS:[d=/\d\d/,function(a){this.milliseconds=10*+a}],SSS:[/\d{3}/,function(a){this.milliseconds=+a}],s:[b=/\d\d?/,(a=function(a){return function(b){this[a]=+b}})("seconds")],ss:[b,a("seconds")],m:[b,a("minutes")],mm:[b,a("minutes")],H:[b,a("hours")],h:[b,a("hours")],HH:[b,a("hours")],hh:[b,a("hours")],D:[b,a("day")],DD:[d,a("day")],Do:[c,function(b){var c=j.ordinal,d=b.match(/\d+/);if(this.day=d[0],c)for(var a=1;a<=31;a+=1)c(a).replace(/\[|\]/g,"")===b&&(this.day=a)}],M:[b,a("month")],MM:[d,a("month")],MMM:[c,function(b){var c=k("months"),a=(k("monthsShort")||c.map(function(a){return a.substr(0,3)})).indexOf(b)+1;if(a<1)throw new Error;this.month=a%12||a}],MMMM:[c,function(b){var a=k("months").indexOf(b)+1;if(a<1)throw new Error;this.month=a%12||a}],Y:[/[+-]?\d+/,a("year")],YY:[d,function(a){a=+a,this.year=a+(a>68?1900:2e3)}],YYYY:[/\d{4}/,a("year")],Z:e,ZZ:e},n=function(q,r,s){try{var a=(function(d){for(var c=(d=h(d,j&&j.formats)).match(i),g=c.length,a=0;a0?b-1:e.getMonth());var k=u||0,l=v||0,n=w||0,o=x||0;return p?new Date(Date.UTC(g,c,f,k,l,n,o+60*p.offset*1e3)):s?new Date(Date.UTC(g,c,f,k,l,n,o)):new Date(g,c,f,k,l,n,o)}catch(y){return new Date("")}},function(d,b,c){c.p.customParseFormat=!0;var a=b.prototype,e=a.parse;a.parse=function(f){var i=f.date,k=f.utc,a=f.args;this.$u=k;var b=a[1];if("string"==typeof b){var l=!0===a[2],m=!0===a[3],p=l||m,d=a[2];m&&(d=a[2]),j=this.$locale(),!l&&d&&(j=c.Ls[d]),this.$d=n(i,b,k),this.init(),d&& !0!==d&&(this.$L=this.locale(d).$L),p&&i!==this.format(b)&&(this.$d=new Date("")),j={}}else if(b instanceof Array)for(var o=b.length,g=1;g<=o;g+=1){a[1]=b[g-1];var h=c.apply(this,a);if(h.isValid()){this.$d=h.$d,this.$L=h.$L,this.init();break}g===o&&(this.$d=new Date(""))}else e.call(this,f)}})});d.extend(e),c.parseDate=(b,c)=>{let a=!1;if(c)switch(c){case"ISO_8601":a=b;break;case"RFC_2822":a=d(b,"ddd, MM MMM YYYY HH:mm:ss ZZ").format("YYYYMMDD");break;case"MYSQL":a=d(b,"YYYY-MM-DD hh:mm:ss").format("YYYYMMDD");break;case"UNIX":a=d(b).unix();break;default:a=d(b,c).format("YYYYMMDD")}return a}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(c,d,a){"use strict";Object.defineProperty(a,"__esModule",{value:!0});let e=a=>"[object Object]"===Object.prototype.toString.call(a),f=(d,a)=>{let c=document.createElement(d);if(a&&"object"==typeof a)for(let b in a)"html"===b?c.innerHTML=a[b]:c.setAttribute(b,a[b]);return c},g=a=>{a instanceof NodeList?a.forEach(a=>g(a)):a.innerHTML=""},h=(a,b,c)=>f("li",{class:a,html:`${c}`}),i=(a,c)=>{let d,e;1===c?(d=0,e=a.length):-1===c&&(d=a.length-1,e=-1);for(let f=!0;f;){f=!1;for(let b=d;b!=e;b+=c)if(a[b+c]&&a[b].value>a[b+c].value){let g=a[b],h=a[b+c],i=g;a[b]=h,a[b+c]=i,f=!0}}return a};class j{constructor(a,b){return this.dt=a,this.rows=b,this}build(b){let c=f("tr"),a=this.dt.headings;return a.length||(a=b.map(()=>"")),a.forEach((e,a)=>{let d=f("td");b[a]&&b[a].length||(b[a]=""),d.innerHTML=b[a],d.data=b[a],c.appendChild(d)}),c}render(a){return a}add(a){if(Array.isArray(a)){let b=this.dt;Array.isArray(a[0])?a.forEach(a=>{b.data.push(this.build(a))}):b.data.push(this.build(a)),b.data.length&&(b.hasRows=!0),this.update(),b.columns().rebuild()}}remove(a){let b=this.dt;Array.isArray(a)?(a.sort((a,b)=>b-a),a.forEach(a=>{b.data.splice(a,1)})):"all"==a?b.data=[]:b.data.splice(a,1),b.data.length||(b.hasRows=!1),this.update(),b.columns().rebuild()}update(){this.dt.data.forEach((a,b)=>{a.dataIndex=b})}}class k{constructor(a){return this.dt=a,this}swap(b){if(b.length&&2===b.length){let a=[];this.dt.headings.forEach((c,b)=>{a.push(b)});let c=b[0],d=b[1],e=a[d];a[d]=a[c],a[c]=e,this.order(a)}}order(c){let d,e,f,g,h,i,j,b=[[],[],[],[]],a=this.dt;c.forEach((c,f)=>{i="false"!==(h=a.headings[c]).getAttribute("data-sortable"),d=h.cloneNode(!0),d.originalCellIndex=f,d.sortable=i,b[0].push(d),a.hiddenColumns.includes(c)||((e=h.cloneNode(!0)).originalCellIndex=f,e.sortable=i,b[1].push(e))}),a.data.forEach((d,e)=>{f=d.cloneNode(!1),g=d.cloneNode(!1),f.dataIndex=g.dataIndex=e,null!==d.searchIndex&& void 0!==d.searchIndex&&(f.searchIndex=g.searchIndex=d.searchIndex),c.forEach(b=>{(j=d.cells[b].cloneNode(!0)).data=d.cells[b].data,f.appendChild(j),a.hiddenColumns.includes(b)||((j=d.cells[b].cloneNode(!0)).data=d.cells[b].data,g.appendChild(j))}),b[2].push(f),b[3].push(g)}),a.headings=b[0],a.activeHeadings=b[1],a.data=b[2],a.activeRows=b[3],a.update()}hide(a){if(a.length){let b=this.dt;a.forEach(a=>{b.hiddenColumns.includes(a)||b.hiddenColumns.push(a)}),this.rebuild()}}show(a){if(a.length){let b,c=this.dt;a.forEach(a=>{(b=c.hiddenColumns.indexOf(a))> -1&&c.hiddenColumns.splice(b,1)}),this.rebuild()}}visible(a){let b,c=this.dt;return isNaN(a=a||c.headings.map(a=>a.originalCellIndex))?Array.isArray(a)&&(b=[],a.forEach(a=>{b.push(!c.hiddenColumns.includes(a))})):b=!c.hiddenColumns.includes(a),b}add(a){let c,b=document.createElement("th");if(!this.dt.headings.length)return this.dt.insert({headings:[a.heading],data:a.data.map(a=>[a])}),void this.rebuild();this.dt.hiddenHeader?b.innerHTML="":a.heading.nodeName?b.appendChild(a.heading):b.innerHTML=a.heading,this.dt.headings.push(b),this.dt.data.forEach((d,b)=>{a.data[b]&&(c=document.createElement("td"),a.data[b].nodeName?c.appendChild(a.data[b]):c.innerHTML=a.data[b],c.data=c.innerHTML,a.render&&(c.innerHTML=a.render.call(this,c.data,c,d)),d.appendChild(c))}),a.type&&b.setAttribute("data-type",a.type),a.format&&b.setAttribute("data-format",a.format),a.hasOwnProperty("sortable")&&(b.sortable=a.sortable,b.setAttribute("data-sortable",!0===a.sortable?"true":"false")),this.rebuild(),this.dt.renderHeader()}remove(a){Array.isArray(a)?(a.sort((a,b)=>b-a),a.forEach(a=>this.remove(a))):(this.dt.headings.splice(a,1),this.dt.data.forEach(b=>{b.removeChild(b.cells[a])})),this.rebuild()}filter(b,c,d,e){let a=this.dt;if(a.filterState||(a.filterState={originalData:a.data}),!a.filterState[b]){let h=[...e,()=>!0],f;a.filterState[b]=(f=0,()=>h[(f++)%h.length])}let i=a.filterState[b](),g=Array.from(a.filterState.originalData).filter(d=>{let a=d.cells[b],c=a.hasAttribute("data-content")?a.getAttribute("data-content"):a.innerText;return"function"==typeof i?i(c):c===i});a.data=g,this.rebuild(),a.update(),d||a.emit("datatable.sort",b,c)}sort(b,f,g){let a=this.dt;if(a.hasHeadings&&(b<0||b>a.headings.length))return!1;let d=a.options.filters&&a.options.filters[a.headings[b].textContent];if(d&&0!==d.length)return void this.filter(b,f,g,d);a.sorting=!0,g||a.emit("datatable.sorting",b,f);let k=a.data,l=[],m=[],n=0,o=0,e=a.headings[b],h=[];if("date"===e.getAttribute("data-type")){let j=!1;e.hasAttribute("data-format")&&(j=e.getAttribute("data-format")),h.push(Promise.resolve().then(function(){return c("./date-cd1c23ce.js")}).then(({parseDate:a})=>b=>a(b,j)))}Promise.all(h).then(h=>{let p=h[0],c,d;Array.from(k).forEach(c=>{let d=c.cells[b],a=d.hasAttribute("data-content")?d.getAttribute("data-content"):d.innerText,e;parseFloat(e=p?p(a):"string"==typeof a?a.replace(/(\$|,|\s|%)/g,""):a)==e?m[o++]={value:Number(e),row:c}:l[n++]={value:"string"==typeof a?a.toLowerCase():a,row:c}}),f||(f=e.classList.contains("asc")?"desc":"asc"),"desc"==f?(c=i(l,-1),d=i(m,-1),e.classList.remove("asc"),e.classList.add("desc")):(c=i(m,1),d=i(l,1),e.classList.remove("desc"),e.classList.add("asc")),a.lastTh&&e!=a.lastTh&&(a.lastTh.classList.remove("desc"),a.lastTh.classList.remove("asc")),a.lastTh=e,k=c.concat(d),a.data=[];let j=[];k.forEach((b,c)=>{a.data.push(b.row),null!==b.row.searchIndex&& void 0!==b.row.searchIndex&&j.push(c)}),a.searchData=j,this.rebuild(),a.update(),g||a.emit("datatable.sort",b,f)})}rebuild(){let c,d,e,f,a=this.dt,b=[];a.activeRows=[],a.activeHeadings=[],a.headings.forEach((b,c)=>{b.originalCellIndex=c,b.sortable="false"!==b.getAttribute("data-sortable"),a.hiddenColumns.includes(c)||a.activeHeadings.push(b)}),a.data.forEach((g,h)=>{c=g.cloneNode(!1),d=g.cloneNode(!1),c.dataIndex=d.dataIndex=h,null!==g.searchIndex&& void 0!==g.searchIndex&&(c.searchIndex=d.searchIndex=g.searchIndex),Array.from(g.cells).forEach(b=>{(e=b.cloneNode(!0)).data=b.data,c.appendChild(e),a.hiddenColumns.includes(e.cellIndex)||((f=e.cloneNode(!0)).data=e.data,d.appendChild(f))}),b.push(c),a.activeRows.push(d)}),a.data=b,a.update()}}let l=function(a){let b=!1,c=!1;if((a=a||this.options.data).headings){b=f("thead");let d=f("tr");a.headings.forEach(a=>{let b=f("th",{html:a});d.appendChild(b)}),b.appendChild(d)}a.data&&a.data.length&&(c=f("tbody"),a.data.forEach(b=>{if(a.headings&&a.headings.length!==b.length)throw new Error("The number of rows do not match the number of headings.");let d=f("tr");b.forEach(a=>{let b=f("td",{html:a});d.appendChild(b)}),c.appendChild(d)})),b&&(null!==this.table.tHead&&this.table.removeChild(this.table.tHead),this.table.appendChild(b)),c&&(this.table.tBodies.length&&this.table.removeChild(this.table.tBodies[0]),this.table.appendChild(c))},m={sortable:!0,searchable:!0,paging:!0,perPage:10,perPageSelect:[5,10,15,20,25],nextPrev:!0,firstLast:!1,prevText:"‹",nextText:"›",firstText:"«",lastText:"»",ellipsisText:"…",ascText:"\u25B4",descText:"\u25BE",truncatePager:!0,pagerDelta:2,scrollY:"",fixedColumns:!0,fixedHeight:!1,header:!0,hiddenHeader:!1,footer:!1,labels:{placeholder:"Search...",perPage:"{select} entries per page",noRows:"No entries found",info:"Showing {start} to {end} of {rows} entries"},layout:{top:"{select}{search}",bottom:"{info}{pager}"}};class b{constructor(a,b={}){if(this.initialized=!1,this.options={...m,...b,layout:{...m.layout,...b.layout},labels:{...m.labels,...b.labels}},"string"==typeof a&&(a=document.querySelector(a)),this.initialLayout=a.innerHTML,this.initialSortable=this.options.sortable,this.options.header||(this.options.sortable=!1),null!==a.tHead||this.options.data&&(!this.options.data||this.options.data.headings)||(this.options.sortable=!1),a.tBodies.length&&!a.tBodies[0].rows.length&&this.options.data&&!this.options.data.data)throw new Error("You seem to be using the data option, but you've not defined any rows.");this.table=a,this.listeners={onResize:a=>this.onResize(a)},this.init()}static extend(c,a){"function"==typeof a?b.prototype[c]=a:b[c]=a}init(a){if(this.initialized||this.table.classList.contains("dataTable-table"))return!1;Object.assign(this.options,a||{}),this.currentPage=1,this.onFirstPage=!0,this.hiddenColumns=[],this.columnRenderers=[],this.selectedColumns=[],this.render(),setTimeout(()=>{this.emit("datatable.init"),this.initialized=!0,this.options.plugins&&Object.entries(this.options.plugins).forEach(([a,b])=>{this[a]&&"function"==typeof this[a]&&(this[a]=this[a](b,{createElement:f}),b.enabled&&this[a].init&&"function"==typeof this[a].init&&this[a].init())})},10)}render(d){if(d){switch(d){case"page":this.renderPage();break;case"pager":this.renderPager();break;case"header":this.renderHeader()}return!1}let a=this.options,b="";if(a.data&&l.call(this),this.body=this.table.tBodies[0],this.head=this.table.tHead,this.foot=this.table.tFoot,this.body||(this.body=f("tbody"),this.table.appendChild(this.body)),this.hasRows=this.body.rows.length>0,!this.head){let e=f("thead"),h=f("tr");this.hasRows&&(Array.from(this.body.rows[0].cells).forEach(()=>{h.appendChild(f("th"))}),e.appendChild(h)),this.head=e,this.table.insertBefore(this.head,this.body),this.hiddenHeader=a.hiddenHeader}if(this.headings=[],this.hasHeadings=this.head.rows.length>0,this.hasHeadings&&(this.header=this.head.rows[0],this.headings=[].slice.call(this.header.cells)),a.header||this.head&&this.table.removeChild(this.table.tHead),a.footer?this.head&&!this.foot&&(this.foot=f("tfoot",{html:this.head.innerHTML}),this.table.appendChild(this.foot)):this.foot&&this.table.removeChild(this.table.tFoot),this.wrapper=f("div",{class:"dataTable-wrapper dataTable-loading"}),b+="
",b+=a.layout.top,b+="
",a.scrollY.length?b+=`
`:b+="
",b+="
",b+=a.layout.bottom,b+="
",b=b.replace("{info}",a.paging?"
":""),a.paging&&a.perPageSelect){let c="
";let i=f("select",{class:"dataTable-selector"});a.perPageSelect.forEach(b=>{let c=b===a.perPage,d=new Option(b,b,c,c);i.add(d)}),c=c.replace("{select}",i.outerHTML),b=b.replace("{select}",c)}else b=b.replace("{select}","");if(a.searchable){let j=``;b=b.replace("{search}",j)}else b=b.replace("{search}","");this.hasHeadings&&this.render("header"),this.table.classList.add("dataTable-table");let g=f("nav",{class:"dataTable-pagination"}),k=f("ul",{class:"dataTable-pagination-list"});g.appendChild(k),b=b.replace(/\{pager\}/g,g.outerHTML),this.wrapper.innerHTML=b,this.container=this.wrapper.querySelector(".dataTable-container"),this.pagers=this.wrapper.querySelectorAll(".dataTable-pagination-list"),this.label=this.wrapper.querySelector(".dataTable-info"),this.table.parentNode.replaceChild(this.wrapper,this.table),this.container.appendChild(this.table),this.rect=this.table.getBoundingClientRect(),this.data=Array.from(this.body.rows),this.activeRows=this.data.slice(),this.activeHeadings=this.headings.slice(),this.update(),this.setColumns(),this.fixHeight(),this.fixColumns(),a.header||this.wrapper.classList.add("no-header"),a.footer||this.wrapper.classList.add("no-footer"),a.sortable&&this.wrapper.classList.add("sortable"),a.searchable&&this.wrapper.classList.add("searchable"),a.fixedHeight&&this.wrapper.classList.add("fixed-height"),a.fixedColumns&&this.wrapper.classList.add("fixed-columns"),this.bindEvents()}renderPage(){if(this.hasHeadings&&(g(this.header),this.activeHeadings.forEach(a=>this.header.appendChild(a))),this.hasRows&&this.totalPages){this.currentPage>this.totalPages&&(this.currentPage=1);let e=this.currentPage-1,f=document.createDocumentFragment();this.pages[e].forEach(a=>f.appendChild(this.rows().render(a))),this.clear(f),this.onFirstPage=1===this.currentPage,this.onLastPage=this.currentPage===this.lastPage}else this.setMessage(this.options.labels.noRows);let a,c=0,b=0,d=0;if(this.totalPages&&(d=(b=(c=this.currentPage-1)*this.options.perPage)+this.pages[c].length,b+=1,a=this.searching?this.searchData.length:this.data.length),this.label&&this.options.labels.info.length){let h=this.options.labels.info.replace("{start}",b).replace("{end}",d).replace("{page}",this.currentPage).replace("{pages}",this.totalPages).replace("{rows}",a);this.label.innerHTML=a?h:""}1==this.currentPage&&this.fixHeight()}renderPager(){if(g(this.pagers),this.totalPages>1){let a="pager",b=document.createDocumentFragment(),d=this.onFirstPage?1:this.currentPage-1,e=this.onLastPage?this.totalPages:this.currentPage+1;this.options.firstLast&&b.appendChild(h(a,1,this.options.firstText)),this.options.nextPrev&&b.appendChild(h(a,d,this.options.prevText));let c=this.links;this.options.truncatePager&&(c=((k,c,d,b,m)=>{let n,e=2*(b=b||2),g=c-b,h=c+b,i=[],l=[];c<4-b+e?h=3+e:c>d-(3-b+e)&&(g=d-(2+e));for(let a=1;a<=d;a++)if(1==a||a==d||a>=g&&a<=h){let j=k[a-1];j.classList.remove("active"),i.push(j)}return i.forEach(a=>{let c=a.children[0].getAttribute("data-page");if(n){let b=n.children[0].getAttribute("data-page");if(c-b==2)l.push(k[b]);else if(c-b!=1){let d=f("li",{class:"ellipsis",html:`${m}`});l.push(d)}}l.push(a),n=a}),l})(this.links,this.currentPage,this.pages.length,this.options.pagerDelta,this.options.ellipsisText)),this.links[this.currentPage-1].classList.add("active"),c.forEach(a=>{a.classList.remove("active"),b.appendChild(a)}),this.links[this.currentPage-1].classList.add("active"),this.options.nextPrev&&b.appendChild(h(a,e,this.options.nextText)),this.options.firstLast&&b.appendChild(h(a,this.totalPages,this.options.lastText)),this.pagers.forEach(a=>{a.appendChild(b.cloneNode(!0))})}}renderHeader(){this.labels=[],this.headings&&this.headings.length&&this.headings.forEach((a,b)=>{if(this.labels[b]=a.textContent,a.firstElementChild&&a.firstElementChild.classList.contains("dataTable-sorter")&&(a.innerHTML=a.firstElementChild.innerHTML),a.sortable="false"!==a.getAttribute("data-sortable"),a.originalCellIndex=b,this.options.sortable&&a.sortable){let c=f("a",{href:"#",class:"dataTable-sorter",html:a.innerHTML});a.innerHTML="",a.setAttribute("data-sortable",""),a.appendChild(c)}}),this.fixColumns()}bindEvents(){let a=this.options;if(a.perPageSelect){let b=this.wrapper.querySelector(".dataTable-selector");b&&b.addEventListener("change",()=>{a.perPage=parseInt(b.value,10),this.update(),this.fixHeight(),this.emit("datatable.perpage",a.perPage)},!1)}a.searchable&&(this.input=this.wrapper.querySelector(".dataTable-input"),this.input&&this.input.addEventListener("keyup",()=>this.search(this.input.value),!1)),this.wrapper.addEventListener("click",c=>{let b=c.target.closest("a");b&&"a"===b.nodeName.toLowerCase()&&(b.hasAttribute("data-page")?(this.page(b.getAttribute("data-page")),c.preventDefault()):a.sortable&&b.classList.contains("dataTable-sorter")&&"false"!=b.parentNode.getAttribute("data-sortable")&&(this.columns().sort(this.headings.indexOf(b.parentNode)),c.preventDefault()))},!1),window.addEventListener("resize",this.listeners.onResize)}onResize(){this.rect=this.container.getBoundingClientRect(),this.rect.width&&this.fixColumns()}setColumns(a){a||this.data.forEach(a=>{Array.from(a.cells).forEach(a=>{a.data=a.innerHTML})}),this.options.columns&&this.headings.length&&this.options.columns.forEach(a=>{Array.isArray(a.select)||(a.select=[a.select]),a.hasOwnProperty("render")&&"function"==typeof a.render&&(this.selectedColumns=this.selectedColumns.concat(a.select),this.columnRenderers.push({columns:a.select,renderer:a.render})),a.select.forEach(c=>{let b=this.headings[c];a.type&&b.setAttribute("data-type",a.type),a.format&&b.setAttribute("data-format",a.format),a.hasOwnProperty("sortable")&&b.setAttribute("data-sortable",a.sortable),a.hasOwnProperty("hidden")&& !1!==a.hidden&&this.columns().hide([c]),a.hasOwnProperty("sort")&&1===a.select.length&&this.columns().sort(a.select[0],a.sort,!0)})}),this.hasRows&&(this.data.forEach((a,b)=>{a.dataIndex=b,Array.from(a.cells).forEach(a=>{a.data=a.innerHTML})}),this.selectedColumns.length&&this.data.forEach(a=>{Array.from(a.cells).forEach((c,b)=>{this.selectedColumns.includes(b)&&this.columnRenderers.forEach(d=>{d.columns.includes(b)&&(c.innerHTML=d.renderer.call(this,c.data,c,a))})})}),this.columns().rebuild()),this.render("header")}destroy(){this.table.innerHTML=this.initialLayout,this.table.classList.remove("dataTable-table"),this.wrapper.parentNode.replaceChild(this.table,this.wrapper),this.initialized=!1,window.removeEventListener("resize",this.listeners.onResize)}update(){this.wrapper.classList.remove("dataTable-empty"),this.paginate(this),this.render("page"),this.links=[];let a=this.pages.length;for(;a--;){let b=a+1;this.links[a]=h(0===a?"active":"",b,b)}this.sorting=!1,this.render("pager"),this.rows().update(),this.emit("datatable.update")}paginate(){let b=this.options.perPage,a=this.activeRows;return this.searching&&(a=[],this.searchData.forEach(b=>a.push(this.activeRows[b]))),this.options.paging?this.pages=a.map((d,c)=>c%b==0?a.slice(c,c+b):null).filter(a=>a):this.pages=[a],this.totalPages=this.lastPage=this.pages.length,this.totalPages}fixColumns(){if((this.options.scrollY.length||this.options.fixedColumns)&&this.activeHeadings&&this.activeHeadings.length){let c,a=!1;if(this.columnWidths=[],this.table.tHead){if(this.options.scrollY.length&&((a=f("thead")).appendChild(f("tr")),a.style.height="0px",this.headerTable&&(this.table.tHead=this.headerTable.tHead)),this.activeHeadings.forEach(a=>{a.style.width=""}),this.activeHeadings.forEach((c,g)=>{let d=c.offsetWidth,e=d/this.rect.width*100;if(c.style.width=e+"%",this.columnWidths[g]=d,this.options.scrollY.length){let b=f("th");a.firstElementChild.appendChild(b),b.style.width=e+"%",b.style.paddingTop="0",b.style.paddingBottom="0",b.style.border="0"}}),this.options.scrollY.length){let b=this.table.parentElement;if(!this.headerTable){this.headerTable=f("table",{class:"dataTable-table"});let d=f("div",{class:"dataTable-headercontainer"});d.appendChild(this.headerTable),b.parentElement.insertBefore(d,b)}let e=this.table.tHead;this.table.replaceChild(a,e),this.headerTable.tHead=e,this.headerTable.parentElement.style.paddingRight=this.headerTable.clientWidth-this.table.clientWidth+parseInt(this.headerTable.parentElement.style.paddingRight||"0",10)+"px",b.scrollHeight>b.clientHeight&&(b.style.overflowY="scroll")}}else{c=[],a=f("thead");let g=f("tr");Array.from(this.table.tBodies[0].rows[0].cells).forEach(()=>{let a=f("th");g.appendChild(a),c.push(a)}),a.appendChild(g),this.table.insertBefore(a,this.body);let h=[];c.forEach((b,c)=>{let a=b.offsetWidth,d=a/this.rect.width*100;h.push(d),this.columnWidths[c]=a}),this.data.forEach(a=>{Array.from(a.cells).forEach((a,b)=>{this.columns(a.cellIndex).visible()&&(a.style.width=h[b]+"%")})}),this.table.removeChild(a)}}}fixHeight(){this.options.fixedHeight&&(this.container.style.height=null,this.rect=this.container.getBoundingClientRect(),this.container.style.height=this.rect.height+"px")}search(a){return!!this.hasRows&&(a=a.toLowerCase(),this.currentPage=1,this.searching=!0,this.searchData=[],a.length?(this.clear(),this.data.forEach((b,c)=>{let d=this.searchData.includes(b);a.split(" ").reduce((e,f)=>{let d=!1,a=null;for(let c=0;cthis.pages.length||a<0)&&(this.render("page"),this.render("pager"),void this.emit("datatable.page",a)))}sortColumn(a,b){this.columns().sort(a,b)}insert(a){let b=[];if(e(a)){if(a.headings&&!this.hasHeadings&&!this.hasRows){let c=f("tr");a.headings.forEach(a=>{let b=f("th",{html:a});c.appendChild(b)}),this.head.appendChild(c),this.header=c,this.headings=[].slice.call(c.cells),this.hasHeadings=!0,this.options.sortable=this.initialSortable,this.render("header"),this.activeHeadings=this.headings.slice()}a.data&&Array.isArray(a.data)&&(b=a.data)}else Array.isArray(a)&&a.forEach(a=>{let c=[];Object.entries(a).forEach(([b,d])=>{let a=this.labels.indexOf(b);a> -1&&(c[a]=d)}),b.push(c)});b.length&&(this.rows().add(b),this.hasRows=!0),this.update(),this.setColumns(),this.fixColumns()}refresh(){this.options.searchable&&(this.input.value="",this.searching=!1),this.currentPage=1,this.onFirstPage=!0,this.update(),this.emit("datatable.refresh")}clear(a){this.body&&g(this.body);let b=this.body;this.body||(b=this.table),a&&("string"==typeof a&&(document.createDocumentFragment().innerHTML=a),b.appendChild(a))}export(k){if(!this.hasHeadings&&!this.hasRows)return!1;let g=this.activeHeadings,f=[],j=[],c,d,a,i;if(!e(k))return!1;let b={download:!0,skipColumn:[],lineDelimiter:"\n",columnDelimiter:",",tableName:"myTable",replacer:null,space:4,...k};if(b.type){if("txt"!==b.type&&"csv"!==b.type||(f[0]=this.header),b.selection){if(isNaN(b.selection)){if(Array.isArray(b.selection))for(c=0;c{b.data[e]=[];let c=d.split(a.columnDelimiter);c.length&&c.forEach(a=>{b.data[e].push(a)})}))}else if("json"===a.type){let f=(b=>{let a=!1;try{a=JSON.parse(b)}catch(c){return!1}return!(null===a|| !Array.isArray(a)&&!e(a))&&a})(a.data);f&&(b={headings:[],data:[]},f.forEach((a,c)=>{b.data[c]=[],Object.entries(a).forEach(([a,d])=>{b.headings.includes(a)||b.headings.push(a),b.data[c].push(d)})}))}e(a.data)&&(b=a.data),b&&this.insert(b)}return!1}print(){let d=this.activeHeadings,e=this.activeRows,a=f("table"),b=f("thead"),g=f("tbody"),h=f("tr");d.forEach(a=>{h.appendChild(f("th",{html:a.textContent}))}),b.appendChild(h),e.forEach(a=>{let b=f("tr");Array.from(a.cells).forEach(a=>{b.appendChild(f("td",{html:a.textContent}))}),g.appendChild(b)}),a.appendChild(b),a.appendChild(g);let c=window.open();c.document.body.appendChild(a),c.print()}setMessage(b){let a=1;this.hasRows?a=this.data[0].cells.length:this.activeHeadings.length&&(a=this.activeHeadings.length),this.wrapper.classList.add("dataTable-empty"),this.label&&(this.label.innerHTML=""),this.totalPages=0,this.render("pager"),this.clear(f("tr",{html:`${b}`}))}columns(a){return new k(this,a)}rows(a){return new j(this,a)}on(a,b){this.events=this.events||{},this.events[a]=this.events[a]||[],this.events[a].push(b)}off(a,b){this.events=this.events||{},a in this.events!=0&&this.events[a].splice(this.events[a].indexOf(b),1)}emit(a){if(this.events=this.events||{},a in this.events!=0)for(let b=0;b