From c780280ea210e9c49f5536dd0f514082e9929752 Mon Sep 17 00:00:00 2001 From: lyret Date: Tue, 9 Jul 2024 08:09:07 +0000 Subject: [PATCH] deploy: 0e6494e040d3e6cabf3d9c18b7e3ca5932fc9bd0 --- bundle.js | 2 +- stats.html | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/bundle.js b/bundle.js index e136d35..e088a1e 100644 --- a/bundle.js +++ b/bundle.js @@ -66,7 +66,7 @@ Please get in contact with the sound lead.`,_.style.marginBottom="7px",_.style.m Expecting: array Received: `,typeof t,` Data: `,t)}_wipeElements(){this.dispatch("rows-wipe"),this.destroy(),this.adjustTableSize(),this.dispatch("rows-wiped")}destroy(){this.rows.forEach(t=>{t.wipe()}),this.rows=[],this.activeRows=[],this.activeRowsPipeline=[],this.activeRowsCount=0,this.displayRows=[],this.displayRowsCount=0}deleteRow(t,n){var i=this.rows.indexOf(t),r=this.activeRows.indexOf(t);r>-1&&this.activeRows.splice(r,1),i>-1&&this.rows.splice(i,1),this.setActiveRows(this.activeRows),this.displayRowIterator(o=>{var a=o.indexOf(t);a>-1&&o.splice(a,1)}),n||this.reRenderInPosition(),this.regenerateRowPositions(),this.dispatchExternal("rowDeleted",t.getComponent()),this.displayRowsCount||this.tableEmpty(),this.subscribedExternal("dataChanged")&&this.dispatchExternal("dataChanged",this.getData())}addRow(t,n,i,r){var o=this.addRowActual(t,n,i,r);return o}addRows(t,n,i,r){var o=[];return new Promise((a,s)=>{n=this.findAddRowPos(n),Array.isArray(t)||(t=[t]),(typeof i>"u"&&n||typeof i<"u"&&!n)&&t.reverse(),t.forEach((u,f)=>{var c=this.addRow(u,n,i,!0);o.push(c),this.dispatch("row-added",c,u,n,i)}),this.refreshActiveData(r?"displayPipeline":!1,!1,!0),this.regenerateRowPositions(),this.displayRowsCount&&this._clearPlaceholder(),a(o)})}findAddRowPos(t){return typeof t>"u"&&(t=this.table.options.addRowPos),t==="pos"&&(t=!0),t==="bottom"&&(t=!1),t}addRowActual(t,n,i,r){var o=t instanceof Io?t:new Io(t||{},this),a=this.findAddRowPos(n),s=-1,u,f;return i||(f=this.chain("row-adding-position",[o,a],null,{index:i,top:a}),i=f.index,a=f.top),typeof i<"u"&&(i=this.findRow(i)),i=this.chain("row-adding-index",[o,i,a],null,i),i&&(s=this.rows.indexOf(i)),i&&s>-1?(u=this.activeRows.indexOf(i),this.displayRowIterator(function(c){var d=c.indexOf(i);d>-1&&c.splice(a?d:d+1,0,o)}),u>-1&&this.activeRows.splice(a?u:u+1,0,o),this.rows.splice(a?s:s+1,0,o)):a?(this.displayRowIterator(function(c){c.unshift(o)}),this.activeRows.unshift(o),this.rows.unshift(o)):(this.displayRowIterator(function(c){c.push(o)}),this.activeRows.push(o),this.rows.push(o)),this.setActiveRows(this.activeRows),this.dispatchExternal("rowAdded",o.getComponent()),this.subscribedExternal("dataChanged")&&this.dispatchExternal("dataChanged",this.table.rowManager.getData()),r||this.reRenderInPosition(),o}moveRow(t,n,i){this.dispatch("row-move",t,n,i),this.moveRowActual(t,n,i),this.regenerateRowPositions(),this.dispatch("row-moved",t,n,i),this.dispatchExternal("rowMoved",t.getComponent())}moveRowActual(t,n,i){this.moveRowInArray(this.rows,t,n,i),this.moveRowInArray(this.activeRows,t,n,i),this.displayRowIterator(r=>{this.moveRowInArray(r,t,n,i)}),this.dispatch("row-moving",t,n,i)}moveRowInArray(t,n,i,r){var o,a,s,u;if(n!==i&&(o=t.indexOf(n),o>-1&&(t.splice(o,1),a=t.indexOf(i),a>-1?r?t.splice(a+1,0,n):t.splice(a,0,n):t.splice(o,0,n)),t===this.getDisplayRows())){s=oo?a:o+1;for(let f=s;f<=u;f++)t[f]&&this.styleRow(t[f],f)}}clearData(){this.setData([])}getRowIndex(t){return this.findRowIndex(t,this.rows)}getDisplayRowIndex(t){var n=this.getDisplayRows().indexOf(t);return n>-1?n:!1}nextDisplayRow(t,n){var i=this.getDisplayRowIndex(t),r=!1;return i!==!1&&i-1)?i:!1}getData(t,n){var i=[],r=this.getRows(t);return r.forEach(function(o){o.type=="row"&&i.push(o.getData(n||"data"))}),i}getComponents(t){var n=[],i=this.getRows(t);return i.forEach(function(r){n.push(r.getComponent())}),n}getDataCount(t){var n=this.getRows(t);return n.length}scrollHorizontal(t){this.scrollLeft=t,this.element.scrollLeft=t,this.dispatch("scroll-horizontal",t)}registerDataPipelineHandler(t,n){typeof n<"u"?(this.dataPipeline.push({handler:t,priority:n}),this.dataPipeline.sort((i,r)=>i.priority-r.priority)):console.error("Data pipeline handlers must have a priority in order to be registered")}registerDisplayPipelineHandler(t,n){typeof n<"u"?(this.displayPipeline.push({handler:t,priority:n}),this.displayPipeline.sort((i,r)=>i.priority-r.priority)):console.error("Display pipeline handlers must have a priority in order to be registered")}refreshActiveData(t,n,i){var r=this.table,o="",a=0,s=["all","dataPipeline","display","displayPipeline","end"];if(!this.table.destroyed){if(typeof t=="function")if(a=this.dataPipeline.findIndex(u=>u.handler===t),a>-1)o="dataPipeline",n&&(a==this.dataPipeline.length-1?o="display":a++);else if(a=this.displayPipeline.findIndex(u=>u.handler===t),a>-1)o="displayPipeline",n&&(a==this.displayPipeline.length-1?o="end":a++);else{console.error("Unable to refresh data, invalid handler provided",t);return}else o=t||"all",a=0;if(this.redrawBlock){(!this.redrawBlockRestoreConfig||this.redrawBlockRestoreConfig&&(this.redrawBlockRestoreConfig.stage===o&&a{i.type==="row"&&(i.setPosition(n),n++)})}setActiveRows(t){this.activeRows=this.activeRows=Object.assign([],t),this.activeRowsCount=this.activeRows.length}resetDisplayRows(){this.displayRows=[],this.displayRows.push(this.activeRows.slice(0)),this.displayRowsCount=this.displayRows[0].length}setDisplayRows(t,n){this.displayRows[n]=t,n==this.displayRows.length-1&&(this.displayRowsCount=this.displayRows[this.displayRows.length-1].length)}getDisplayRows(t){return typeof t>"u"?this.displayRows.length?this.displayRows[this.displayRows.length-1]:[]:this.displayRows[t]||[]}getVisibleRows(t,n){var i=Object.assign([],this.renderer.visibleRows(!n));return t&&(i=this.chain("rows-visible",[n],i,i)),i}displayRowIterator(t){this.activeRowsPipeline.forEach(t),this.displayRows.forEach(t),this.displayRowsCount=this.displayRows[this.displayRows.length-1].length}getRows(t){var n=[];switch(t){case"active":n=this.activeRows;break;case"display":n=this.table.rowManager.getDisplayRows();break;case"visible":n=this.getVisibleRows(!1,!0);break;default:n=this.chain("rows-retrieve",t,null,this.rows)||this.rows}return n}reRenderInPosition(t){this.redrawBlock?t?t():this.redrawBlockRenderInPosition=!0:(this.dispatchExternal("renderStarted"),this.renderer.rerenderRows(t),this.fixedHeight||this.adjustTableSize(),this.scrollBarCheck(),this.dispatchExternal("renderComplete"))}scrollBarCheck(){var t=0;this.element.scrollHeight>this.element.clientHeight&&(t=this.element.offsetWidth-this.element.clientWidth),t!==this.scrollbarWidth&&(this.scrollbarWidth=t,this.dispatch("scrollbar-vertical",t))}initializeRenderer(){var t,n={virtual:zf,basic:Ff};typeof this.table.options.renderVertical=="string"?t=n[this.table.options.renderVertical]:t=this.table.options.renderVertical,t?(this.renderMode=this.table.options.renderVertical,this.renderer=new t(this.table,this.element,this.tableElement),this.renderer.initialize(),(this.table.element.clientHeight||this.table.options.height)&&!(this.table.options.minHeight&&this.table.options.maxHeight)?this.fixedHeight=!0:this.fixedHeight=!1):console.error("Unable to find matching renderer:",this.table.options.renderVertical)}getRenderMode(){return this.renderMode}renderTable(){this.dispatchExternal("renderStarted"),this.element.scrollTop=0,this._clearTable(),this.displayRowsCount?(this.renderer.renderRows(),this.firstRender&&(this.firstRender=!1,this.fixedHeight||this.adjustTableSize(),this.layoutRefresh(!0))):this.renderEmptyScroll(),this.fixedHeight||this.adjustTableSize(),this.dispatch("table-layout"),this.displayRowsCount||this._showPlaceholder(),this.scrollBarCheck(),this.dispatchExternal("renderComplete")}renderEmptyScroll(){this.placeholder?this.tableElement.style.display="none":this.tableElement.style.minWidth=this.table.columnManager.getWidth()+"px"}_clearTable(){this._clearPlaceholder(),this.scrollTop=0,this.scrollLeft=0,this.renderer.clearRows()}tableEmpty(){this.renderEmptyScroll(),this._showPlaceholder()}checkPlaceholder(){this.displayRowsCount?this._clearPlaceholder():this.tableEmpty()}_showPlaceholder(){this.placeholder&&(this.placeholder&&this.placeholder.parentNode&&this.placeholder.parentNode.removeChild(this.placeholder),this.initializePlaceholder(),this.placeholder.setAttribute("tabulator-render-mode",this.renderMode),this.getElement().appendChild(this.placeholder),this._positionPlaceholder(),this.adjustTableSize())}_clearPlaceholder(){this.placeholder&&this.placeholder.parentNode&&this.placeholder.parentNode.removeChild(this.placeholder),this.tableElement.style.minWidth="",this.tableElement.style.display=""}_positionPlaceholder(){this.placeholder&&this.placeholder.parentNode&&(this.placeholder.style.width=this.table.columnManager.getWidth()+"px",this.placeholderContents.style.width=this.table.rowManager.element.clientWidth+"px",this.placeholderContents.style.marginLeft=this.scrollLeft+"px")}styleRow(t,n){var i=t.getElement();n%2?(i.classList.add("tabulator-row-even"),i.classList.remove("tabulator-row-odd")):(i.classList.add("tabulator-row-odd"),i.classList.remove("tabulator-row-even"))}normalizeHeight(){this.activeRows.forEach(function(t){t.normalizeHeight()})}adjustTableSize(){let t=this.element.clientHeight,n,i=!1;if(this.renderer.verticalFillMode==="fill"){let r=Math.floor(this.table.columnManager.getElement().getBoundingClientRect().height+(this.table.footerManager&&this.table.footerManager.active&&!this.table.footerManager.external?this.table.footerManager.getElement().getBoundingClientRect().height:0));if(this.fixedHeight){n=isNaN(this.table.options.minHeight)?this.table.options.minHeight:this.table.options.minHeight+"px";let o="calc(100% - "+r+"px)";this.element.style.minHeight=n||"calc(100% - "+r+"px)",this.element.style.height=o,this.element.style.maxHeight=o}else this.element.style.height="",this.element.style.height=this.table.element.clientHeight-r+"px",this.element.scrollTop=this.scrollTop;this.renderer.resize(),!this.fixedHeight&&t!=this.element.clientHeight&&(i=!0,this.subscribed("table-resize")?this.dispatch("table-resize"):this.redraw()),this.scrollBarCheck()}return this._positionPlaceholder(),i}reinitialize(){this.rows.forEach(function(t){t.reinitialize(!0)})}blockRedraw(){this.redrawBlock=!0,this.redrawBlockRestoreConfig=!1}restoreRedraw(){this.redrawBlock=!1,this.redrawBlockRestoreConfig?(this.refreshActiveData(this.redrawBlockRestoreConfig.handler,this.redrawBlockRestoreConfig.skipStage,this.redrawBlockRestoreConfig.renderInPosition),this.redrawBlockRestoreConfig=!1):this.redrawBlockRenderInPosition&&this.reRenderInPosition(),this.redrawBlockRenderInPosition=!1}redraw(t){this.adjustTableSize(),this.table.tableWidth=this.table.element.clientWidth,t?this.renderTable():(this.reRenderInPosition(),this.scrollHorizontal(this.scrollLeft))}resetScroll(){if(this.element.scrollLeft=0,this.element.scrollTop=0,this.table.browser==="ie"){var t=document.createEvent("Event");t.initEvent("scroll",!1,!0),this.element.dispatchEvent(t)}else this.element.dispatchEvent(new Event("scroll"))}},Hf=class extends cs{constructor(t){super(t),this.active=!1,this.element=this.createElement(),this.containerElement=this.createContainerElement(),this.external=!1}initialize(){this.initializeElement()}createElement(){var t=document.createElement("div");return t.classList.add("tabulator-footer"),t}createContainerElement(){var t=document.createElement("div");return t.classList.add("tabulator-footer-contents"),this.element.appendChild(t),t}initializeElement(){if(this.table.options.footerElement)switch(typeof this.table.options.footerElement){case"string":this.table.options.footerElement[0]==="<"?this.containerElement.innerHTML=this.table.options.footerElement:(this.external=!0,this.containerElement=document.querySelector(this.table.options.footerElement));break;default:this.element=this.table.options.footerElement;break}}getElement(){return this.element}append(t){this.activate(),this.containerElement.appendChild(t),this.table.rowManager.adjustTableSize()}prepend(t){this.activate(),this.element.insertBefore(t,this.element.firstChild),this.table.rowManager.adjustTableSize()}remove(t){t.parentNode.removeChild(t),this.deactivate()}deactivate(t){(!this.element.firstChild||t)&&(this.external||this.element.parentNode.removeChild(this.element),this.active=!1)}activate(){this.active||(this.active=!0,this.external||(this.table.element.appendChild(this.getElement()),this.table.element.style.display=""))}redraw(){this.dispatch("footer-redraw")}},Gf=class extends cs{constructor(t){super(t),this.el=null,this.abortClasses=["tabulator-headers","tabulator-table"],this.previousTargets={},this.listeners=["click","dblclick","contextmenu","mouseenter","mouseleave","mouseover","mouseout","mousemove","mouseup","mousedown","touchstart","touchend"],this.componentMap={"tabulator-cell":"cell","tabulator-row":"row","tabulator-group":"group","tabulator-col":"column"},this.pseudoTrackers={row:{subscriber:null,target:null},cell:{subscriber:null,target:null},group:{subscriber:null,target:null},column:{subscriber:null,target:null}},this.pseudoTracking=!1}initialize(){this.el=this.table.element,this.buildListenerMap(),this.bindSubscriptionWatchers()}buildListenerMap(){var t={};this.listeners.forEach(n=>{t[n]={handler:null,components:[]}}),this.listeners=t}bindPseudoEvents(){Object.keys(this.pseudoTrackers).forEach(t=>{this.pseudoTrackers[t].subscriber=this.pseudoMouseEnter.bind(this,t),this.subscribe(t+"-mouseover",this.pseudoTrackers[t].subscriber)}),this.pseudoTracking=!0}pseudoMouseEnter(t,n,i){this.pseudoTrackers[t].target!==i&&(this.pseudoTrackers[t].target&&this.dispatch(t+"-mouseleave",n,this.pseudoTrackers[t].target),this.pseudoMouseLeave(t,n),this.pseudoTrackers[t].target=i,this.dispatch(t+"-mouseenter",n,i))}pseudoMouseLeave(t,n){var i=Object.keys(this.pseudoTrackers),r={row:["cell"],cell:["row"]};i=i.filter(o=>{var a=r[t];return o!==t&&(!a||a&&!a.includes(o))}),i.forEach(o=>{var a=this.pseudoTrackers[o].target;this.pseudoTrackers[o].target&&(this.dispatch(o+"-mouseleave",n,a),this.pseudoTrackers[o].target=null)})}bindSubscriptionWatchers(){var t=Object.keys(this.listeners),n=Object.values(this.componentMap);for(let i of n)for(let r of t){let o=i+"-"+r;this.subscriptionChange(o,this.subscriptionChanged.bind(this,i,r))}this.subscribe("table-destroy",this.clearWatchers.bind(this))}subscriptionChanged(t,n,i){var r=this.listeners[n].components,o=r.indexOf(t),a=!1;i?o===-1&&(r.push(t),a=!0):this.subscribed(t+"-"+n)||o>-1&&(r.splice(o,1),a=!0),(n==="mouseenter"||n==="mouseleave")&&!this.pseudoTracking&&this.bindPseudoEvents(),a&&this.updateEventListeners()}updateEventListeners(){for(let t in this.listeners){let n=this.listeners[t];n.components.length?n.handler||(n.handler=this.track.bind(this,t),this.el.addEventListener(t,n.handler)):n.handler&&(this.el.removeEventListener(t,n.handler),n.handler=null)}}track(t,n){var i=n.composedPath&&n.composedPath()||n.path,r=this.findTargets(i);r=this.bindComponents(t,r),this.triggerEvents(t,n,r),this.pseudoTracking&&(t=="mouseover"||t=="mouseleave")&&!Object.keys(r).length&&this.pseudoMouseLeave("none",n)}findTargets(t){var n={};let i=Object.keys(this.componentMap);for(let r of t){let o=r.classList?[...r.classList]:[];if(o.filter(u=>this.abortClasses.includes(u)).length)break;let s=o.filter(u=>i.includes(u));for(let u of s)n[this.componentMap[u]]||(n[this.componentMap[u]]=r)}return n.group&&n.group===n.row&&delete n.row,n}bindComponents(t,n){var i=Object.keys(n).reverse(),r=this.listeners[t],o={},a={};for(let s of i){let u,f=n[s],c=this.previousTargets[s];if(c&&c.target===f)u=c.component;else switch(s){case"row":case"group":(r.components.includes("row")||r.components.includes("cell")||r.components.includes("group"))&&(u=this.table.rowManager.getVisibleRows(!0).find(m=>m.getElement()===f),n.row&&n.row.parentNode&&n.row.parentNode.closest(".tabulator-row")&&(n[s]=!1));break;case"column":r.components.includes("column")&&(u=this.table.columnManager.findColumn(f));break;case"cell":r.components.includes("cell")&&(o.row instanceof Io?u=o.row.findCell(f):n.row&&console.warn("Event Target Lookup Error - The row this cell is attached to cannot be found, has the table been reinitialized without being destroyed first?"));break}u&&(o[s]=u,a[s]={target:f,component:u})}return this.previousTargets=a,o}triggerEvents(t,n,i){var r=this.listeners[t];for(let o in i)i[o]&&r.components.includes(o)&&this.dispatch(o+"-"+t,n,i[o])}clearWatchers(){for(let t in this.listeners){let n=this.listeners[t];n.handler&&(this.el.removeEventListener(t,n.handler),n.handler=null)}}},Uf=class{constructor(t){this.table=t,this.bindings={}}bind(t,n,i){this.bindings[t]||(this.bindings[t]={}),this.bindings[t][n]?console.warn("Unable to bind component handler, a matching function name is already bound",t,n,i):this.bindings[t][n]=i}handle(t,n,i){if(this.bindings[t]&&this.bindings[t][i]&&typeof this.bindings[t][i].bind=="function")return this.bindings[t][i].bind(null,n);i!=="then"&&typeof i=="string"&&!i.startsWith("_")&&this.table.options.debugInvalidComponentFuncs&&console.error("The "+t+" component does not have a "+i+" function, have you checked that you have the correct Tabulator module installed?")}},Vf=class extends cs{constructor(t){super(t),this.requestOrder=0,this.loading=!1}initialize(){}load(t,n,i,r,o,a){var s=++this.requestOrder;if(this.table.destroyed)return Promise.resolve();if(this.dispatchExternal("dataLoading",t),t&&(t.indexOf("{")==0||t.indexOf("[")==0)&&(t=JSON.parse(t)),this.confirm("data-loading",[t,n,i,o])){this.loading=!0,o||this.alertLoader(),n=this.chain("data-params",[t,i,o],n||{},n||{}),n=this.mapParams(n,this.table.options.dataSendParams);var u=this.chain("data-load",[t,n,i,o],!1,Promise.resolve([]));return u.then(f=>{if(this.table.destroyed)console.warn("Data Load Response Blocked - Table has been destroyed");else{!Array.isArray(f)&&typeof f=="object"&&(f=this.mapParams(f,this.objectInvert(this.table.options.dataReceiveParams)));var c=this.chain("data-loaded",[f],null,f);s==this.requestOrder?(this.clearAlert(),c!==!1&&(this.dispatchExternal("dataLoaded",c),this.table.rowManager.setData(c,r,typeof a>"u"?!r:a))):console.warn("Data Load Response Blocked - An active data load request was blocked by an attempt to change table data while the request was being made")}}).catch(f=>{console.error("Data Load Error: ",f),this.dispatchExternal("dataLoadError",f),o||this.alertError(),setTimeout(()=>{this.clearAlert()},this.table.options.dataLoaderErrorTimeout)}).finally(()=>{this.loading=!1})}else return this.dispatchExternal("dataLoaded",t),t||(t=[]),this.table.rowManager.setData(t,r,typeof a>"u"?!r:a),Promise.resolve()}mapParams(t,n){var i={};for(let r in t)i[n.hasOwnProperty(r)?n[r]:r]=t[r];return i}objectInvert(t){var n={};for(let i in t)n[t[i]]=i;return n}blockActiveLoad(){this.requestOrder++}alertLoader(){var t=typeof this.table.options.dataLoader=="function"?this.table.options.dataLoader():this.table.options.dataLoader;t&&this.table.alertManager.alert(this.table.options.dataLoaderLoading||this.langText("data|loading"))}alertError(){this.table.alertManager.alert(this.table.options.dataLoaderError||this.langText("data|error"),"error")}clearAlert(){this.table.alertManager.clear()}},qf=class{constructor(t,n,i){this.table=t,this.events={},this.optionsList=n||{},this.subscriptionNotifiers={},this.dispatch=i?this._debugDispatch.bind(this):this._dispatch.bind(this),this.debug=i}subscriptionChange(t,n){this.subscriptionNotifiers[t]||(this.subscriptionNotifiers[t]=[]),this.subscriptionNotifiers[t].push(n),this.subscribed(t)&&this._notifySubscriptionChange(t,!0)}subscribe(t,n){this.events[t]||(this.events[t]=[]),this.events[t].push(n),this._notifySubscriptionChange(t,!0)}unsubscribe(t,n){var i;if(this.events[t])if(n)if(i=this.events[t].findIndex(r=>r===n),i>-1)this.events[t].splice(i,1);else{console.warn("Cannot remove event, no matching event found:",t,n);return}else delete this.events[t];else{console.warn("Cannot remove event, no events set on:",t);return}this._notifySubscriptionChange(t,!1)}subscribed(t){return this.events[t]&&this.events[t].length}_notifySubscriptionChange(t,n){var i=this.subscriptionNotifiers[t];i&&i.forEach(r=>{r(n)})}_dispatch(){var t=Array.from(arguments),n=t.shift(),i;return this.events[n]&&this.events[n].forEach((r,o)=>{let a=r.apply(this.table,t);o||(i=a)}),i}_debugDispatch(){var t=Array.from(arguments),n=t[0];return t[0]="ExternalEvent:"+t[0],(this.debug===!0||this.debug.includes(n))&&console.log(...t),this._dispatch(...arguments)}},Wf=class{constructor(t){this.events={},this.subscriptionNotifiers={},this.dispatch=t?this._debugDispatch.bind(this):this._dispatch.bind(this),this.chain=t?this._debugChain.bind(this):this._chain.bind(this),this.confirm=t?this._debugConfirm.bind(this):this._confirm.bind(this),this.debug=t}subscriptionChange(t,n){this.subscriptionNotifiers[t]||(this.subscriptionNotifiers[t]=[]),this.subscriptionNotifiers[t].push(n),this.subscribed(t)&&this._notifySubscriptionChange(t,!0)}subscribe(t,n,i=1e4){this.events[t]||(this.events[t]=[]),this.events[t].push({callback:n,priority:i}),this.events[t].sort((r,o)=>r.priority-o.priority),this._notifySubscriptionChange(t,!0)}unsubscribe(t,n){var i;if(this.events[t]){if(n)if(i=this.events[t].findIndex(r=>r.callback===n),i>-1)this.events[t].splice(i,1);else{console.warn("Cannot remove event, no matching event found:",t,n);return}}else{console.warn("Cannot remove event, no events set on:",t);return}this._notifySubscriptionChange(t,!1)}subscribed(t){return this.events[t]&&this.events[t].length}_chain(t,n,i,r){var o=i;return Array.isArray(n)||(n=[n]),this.subscribed(t)?(this.events[t].forEach((a,s)=>{o=a.callback.apply(this,n.concat([o]))}),o):typeof r=="function"?r():r}_confirm(t,n){var i=!1;return Array.isArray(n)||(n=[n]),this.subscribed(t)&&this.events[t].forEach((r,o)=>{r.callback.apply(this,n)&&(i=!0)}),i}_notifySubscriptionChange(t,n){var i=this.subscriptionNotifiers[t];i&&i.forEach(r=>{r(n)})}_dispatch(){var t=Array.from(arguments),n=t.shift();this.events[n]&&this.events[n].forEach(i=>{i.callback.apply(this,t)})}_debugDispatch(){var t=Array.from(arguments),n=t[0];return t[0]="InternalEvent:"+n,(this.debug===!0||this.debug.includes(n))&&console.log(...t),this._dispatch(...arguments)}_debugChain(){var t=Array.from(arguments),n=t[0];return t[0]="InternalEvent:"+n,(this.debug===!0||this.debug.includes(n))&&console.log(...t),this._chain(...arguments)}_debugConfirm(){var t=Array.from(arguments),n=t[0];return t[0]="InternalEvent:"+n,(this.debug===!0||this.debug.includes(n))&&console.log(...t),this._confirm(...arguments)}},Xf=class extends cs{constructor(t){super(t)}_warnUser(){this.options("debugDeprecation")&&console.warn(...arguments)}check(t,n,i){var r="";return typeof this.options(t)<"u"?(r="Deprecated Setup Option - Use of the %c"+t+"%c option is now deprecated",n?(r=r+", Please use the %c"+n+"%c option instead",this._warnUser(r,"font-weight: bold;","font-weight: normal;","font-weight: bold;","font-weight: normal;"),i&&(this.table.options[n]=this.table.options[t])):this._warnUser(r,"font-weight: bold;","font-weight: normal;"),!1):!0}checkMsg(t,n){return typeof this.options(t)<"u"?(this._warnUser("%cDeprecated Setup Option - Use of the %c"+t+" %c option is now deprecated, "+n,"font-weight: normal;","font-weight: bold;","font-weight: normal;"),!1):!0}msg(t){this._warnUser(t)}};function Gw(e,t){t&&this.table.columnManager.renderer.reinitializeColumnWidths(e),this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.update()}function B0(e,t){e.forEach(function(n){n.reinitializeWidth()}),this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.update()}function Uw(e,t){var n=0,i=this.table.rowManager.element.clientWidth,r=0,o=!1;e.forEach((a,s)=>{a.widthFixed||a.reinitializeWidth(),(this.table.options.responsiveLayout?a.modules.responsive.visible:a.visible)&&(o=a),a.visible&&(n+=a.getWidth())}),o?(r=i-n+o.getWidth(),this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&(o.setWidth(0),this.table.modules.responsiveLayout.update()),r>0?o.setWidth(r):o.reinitializeWidth()):this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.update()}function Vw(e,t){var n=this.table.rowManager.element.getBoundingClientRect().width,i=0,r=0,o=0,a=0,s=[],u=[],f=0,c=0,d=0;function m(p){var _;return typeof p=="string"?p.indexOf("%")>-1?_=n/100*parseInt(p):_=parseInt(p):_=p,_}function v(p,_,y,x){var S=[],O=0,B=0,U=0,z=o,q=0,G=0,tt=[];function K(N){return y*(N.column.definition.widthGrow||1)}function D(N){return m(N.width)-y*(N.column.definition.widthShrink||0)}return p.forEach(function(N,Z){var w=x?D(N):K(N);N.column.minWidth>=w?S.push(N):N.column.maxWidth&&N.column.maxWidththis.table.rowManager.element.clientHeight&&(n-=this.table.rowManager.element.offsetWidth-this.table.rowManager.element.clientWidth),e.forEach(function(p){var _,y,x;p.visible&&(_=p.definition.width,y=parseInt(p.minWidth),_?(x=m(_),i+=x>y?x:y,p.definition.widthShrink&&(u.push({column:p,width:x>y?x:y}),f+=p.definition.widthShrink)):(s.push({column:p,width:0}),o+=p.definition.widthGrow||1))}),r=n-i,a=Math.floor(r/o),d=v(s,r,a,!1),s.length&&d>0&&(s[s.length-1].width+=d),s.forEach(function(p){r-=p.width}),c=Math.abs(d)+r,c>0&&f&&(d=v(u,c,Math.floor(c/f),!0)),d&&u.length&&(u[u.length-1].width-=d),s.forEach(function(p){p.column.setWidth(p.width)}),u.forEach(function(p){p.column.setWidth(p.width)})}var qw={fitData:Gw,fitDataFill:B0,fitDataTable:B0,fitDataStretch:Uw,fitColumns:Vw},$f=class e extends Vl{static moduleName="layout";static modes=qw;constructor(t){super(t,"layout"),this.mode=null,this.registerTableOption("layout","fitData"),this.registerTableOption("layoutColumnsOnNewData",!1),this.registerColumnOption("widthGrow"),this.registerColumnOption("widthShrink")}initialize(){var t=this.table.options.layout;e.modes[t]?this.mode=t:(console.warn("Layout Error - invalid mode set, defaulting to 'fitData' : "+t),this.mode="fitData"),this.table.element.setAttribute("tabulator-layout",this.mode),this.subscribe("column-init",this.initializeColumn.bind(this))}initializeColumn(t){t.definition.widthGrow&&(t.definition.widthGrow=Number(t.definition.widthGrow)),t.definition.widthShrink&&(t.definition.widthShrink=Number(t.definition.widthShrink))}getMode(){return this.mode}layout(t){this.dispatch("layout-refreshing"),e.modes[this.mode].call(this,this.table.columnManager.columnsByIndex,t),this.dispatch("layout-refreshed")}},Ww={default:{groups:{item:"item",items:"items"},columns:{},data:{loading:"Loading",error:"Error"},pagination:{page_size:"Page Size",page_title:"Show Page",first:"First",first_title:"First Page",last:"Last",last_title:"Last Page",prev:"Prev",prev_title:"Prev Page",next:"Next",next_title:"Next Page",all:"All",counter:{showing:"Showing",of:"of",rows:"rows",pages:"pages"}},headerFilters:{default:"filter column...",columns:{}}}},Yf=class e extends Vl{static moduleName="localize";static langs=Ww;constructor(t){super(t),this.locale="default",this.lang=!1,this.bindings={},this.langList={},this.registerTableOption("locale",!1),this.registerTableOption("langs",{})}initialize(){this.langList=Yn.deepClone(e.langs),this.table.options.columnDefaults.headerFilterPlaceholder!==!1&&this.setHeaderFilterPlaceholder(this.table.options.columnDefaults.headerFilterPlaceholder);for(let t in this.table.options.langs)this.installLang(t,this.table.options.langs[t]);this.setLocale(this.table.options.locale),this.registerTableFunction("setLocale",this.setLocale.bind(this)),this.registerTableFunction("getLocale",this.getLocale.bind(this)),this.registerTableFunction("getLang",this.getLang.bind(this))}setHeaderFilterPlaceholder(t){this.langList.default.headerFilters.default=t}installLang(t,n){this.langList[t]?this._setLangProp(this.langList[t],n):this.langList[t]=n}_setLangProp(t,n){for(let i in n)t[i]&&typeof t[i]=="object"?this._setLangProp(t[i],n[i]):t[i]=n[i]}setLocale(t){t=t||"default";function n(i,r){for(var o in i)typeof i[o]=="object"?(r[o]||(r[o]={}),n(i[o],r[o])):r[o]=i[o]}if(t===!0&&navigator.language&&(t=navigator.language.toLowerCase()),t&&!this.langList[t]){let i=t.split("-")[0];this.langList[i]?(console.warn("Localization Error - Exact matching locale not found, using closest match: ",t,i),t=i):(console.warn("Localization Error - Matching locale not found, using default: ",t),t="default")}this.locale=t,this.lang=Yn.deepClone(this.langList.default||{}),t!="default"&&n(this.langList[t],this.lang),this.dispatchExternal("localized",this.locale,this.lang),this._executeBindings()}getLocale(t){return this.locale}getLang(t){return t?this.langList[t]:this.lang}getText(t,n){var i=n?t+"|"+n:t,r=i.split("|"),o=this._getLangElement(r,this.locale);return o||""}_getLangElement(t,n){var i=this.lang;return t.forEach(function(r){var o;i&&(o=i[r],typeof o<"u"?i=o:i=!1)}),i}bind(t,n){this.bindings[t]||(this.bindings[t]=[]),this.bindings[t].push(n),n(this.getText(t),this.lang)}_executeBindings(){for(let t in this.bindings)this.bindings[t].forEach(n=>{n(this.getText(t),this.lang)})}},Zf=class extends Vl{static moduleName="comms";constructor(t){super(t)}initialize(){this.registerTableFunction("tableComms",this.receive.bind(this))}getConnections(t){var n=[],i;return i=this.table.constructor.registry.lookupTable(t),i.forEach(r=>{this.table!==r&&n.push(r)}),n}send(t,n,i,r){var o=this.getConnections(t);o.forEach(a=>{a.tableComms(this.table.element,n,i,r)}),!o.length&&t&&console.warn("Table Connection Error - No tables matching selector found",t)}receive(t,n,i,r){if(this.table.modExists(n))return this.table.modules[n].commsReceived(t,i,r);console.warn("Inter-table Comms Error - no such module:",n)}},Xw=Object.freeze({__proto__:null,CommsModule:Zf,LayoutModule:$f,LocalizeModule:Yf}),Kf=class e{static registry={tables:[],register(t){e.registry.tables.push(t)},deregister(t){var n=e.registry.tables.indexOf(t);n>-1&&e.registry.tables.splice(n,1)},lookupTable(t,n){var i=[],r,o;if(typeof t=="string"){if(r=document.querySelectorAll(t),r.length)for(var a=0;a{r.prototype.moduleCore=!0}),e._registerModule(i)}static _registerModule(t){Array.isArray(t)||(t=[t]),t.forEach(n=>{e._registerModuleBinding(n),e._registerModuleExtensions(n)})}static _registerModuleBinding(t){t.moduleName?e.moduleBindings[t.moduleName]=t:console.error("Unable to bind module, no moduleName defined",t.moduleName)}static _registerModuleExtensions(t){var n=t.moduleExtensions;if(t.moduleExtensions)for(let i in n){let r=n[i];if(e.moduleBindings[i])for(let o in r)e._extendModule(i,o,r[o]);else{e.moduleExtensions[i]||(e.moduleExtensions[i]={});for(let o in r)e.moduleExtensions[i][o]||(e.moduleExtensions[i][o]={}),Object.assign(e.moduleExtensions[i][o],r[o])}}e._extendModuleFromQueue(t)}static _extendModuleFromQueue(t){var n=e.moduleExtensions[t.moduleName];if(n)for(let i in n)e._extendModule(t.moduleName,i,n[i])}_bindModules(){var t=[],n=[],i=[];this.modules={};for(var r in e.moduleBindings){let o=e.moduleBindings[r],a=new o(this);this.modules[r]=a,o.prototype.moduleCore?this.modulesCore.push(a):o.moduleInitOrder?o.moduleInitOrder<0?t.push(a):n.push(a):i.push(a)}t.sort((o,a)=>o.moduleInitOrder>a.moduleInitOrder?1:-1),n.sort((o,a)=>o.moduleInitOrder>a.moduleInitOrder?1:-1),this.modulesRegular=t.concat(i.concat(n))}},Qf=class extends cs{constructor(t){super(t),this.element=this._createAlertElement(),this.msgElement=this._createMsgElement(),this.type=null,this.element.appendChild(this.msgElement)}_createAlertElement(){var t=document.createElement("div");return t.classList.add("tabulator-alert"),t}_createMsgElement(){var t=document.createElement("div");return t.classList.add("tabulator-alert-msg"),t.setAttribute("role","alert"),t}_typeClass(){return"tabulator-alert-state-"+this.type}alert(t,n="msg"){if(t){for(this.clear(),this.dispatch("alert-show",n),this.type=n;this.msgElement.firstChild;)this.msgElement.removeChild(this.msgElement.firstChild);this.msgElement.classList.add(this._typeClass()),typeof t=="function"&&(t=t()),t instanceof HTMLElement?this.msgElement.appendChild(t):this.msgElement.innerHTML=t,this.table.element.appendChild(this.element)}}clear(){this.dispatch("alert-hide",this.type),this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.msgElement.classList.remove(this._typeClass())}},td=class e extends Jf{static defaultOptions=Hw;static extendModule(){e.initializeModuleBinder(),e._extendModule(...arguments)}static registerModule(){e.initializeModuleBinder(),e._registerModule(...arguments)}constructor(t,n,i){super(),e.initializeModuleBinder(i),this.options={},this.columnManager=null,this.rowManager=null,this.footerManager=null,this.alertManager=null,this.vdomHoz=null,this.externalEvents=null,this.eventBus=null,this.interactionMonitor=!1,this.browser="",this.browserSlow=!1,this.browserMobile=!1,this.rtl=!1,this.originalElement=null,this.componentFunctionBinder=new Uf(this),this.dataLoader=!1,this.modules={},this.modulesCore=[],this.modulesRegular=[],this.deprecationAdvisor=new Xf(this),this.optionsList=new dh(this,"table constructor"),this.initialized=!1,this.destroyed=!1,this.initializeElement(t)&&(this.initializeCoreSystems(n),setTimeout(()=>{this._create()})),this.constructor.registry.register(this)}initializeElement(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement?(this.element=t,!0):typeof t=="string"?(this.element=document.querySelector(t),this.element?!0:(console.error("Tabulator Creation Error - no element found matching selector: ",t),!1)):(console.error("Tabulator Creation Error - Invalid element provided:",t),!1)}initializeCoreSystems(t){this.columnManager=new Bf(this),this.rowManager=new jf(this),this.footerManager=new Hf(this),this.dataLoader=new Vf(this),this.alertManager=new Qf(this),this._bindModules(),this.options=this.optionsList.generate(e.defaultOptions,t),this._clearObjectPointers(),this._mapDeprecatedFunctionality(),this.externalEvents=new qf(this,this.options,this.options.debugEventsExternal),this.eventBus=new Wf(this.options.debugEventsInternal),this.interactionMonitor=new Gf(this),this.dataLoader.initialize(),this.footerManager.initialize()}_mapDeprecatedFunctionality(){}_clearSelection(){this.element.classList.add("tabulator-block-select"),window.getSelection?window.getSelection().empty?window.getSelection().empty():window.getSelection().removeAllRanges&&window.getSelection().removeAllRanges():document.selection&&document.selection.empty(),this.element.classList.remove("tabulator-block-select")}_create(){this.externalEvents.dispatch("tableBuilding"),this.eventBus.dispatch("table-building"),this._rtlCheck(),this._buildElement(),this._initializeTable(),this.initialized=!0,this._loadInitialData().finally(()=>{this.eventBus.dispatch("table-initialized"),this.externalEvents.dispatch("tableBuilt")})}_rtlCheck(){var t=window.getComputedStyle(this.element);switch(this.options.textDirection){case"auto":if(t.direction!=="rtl")break;case"rtl":this.element.classList.add("tabulator-rtl"),this.rtl=!0;break;case"ltr":this.element.classList.add("tabulator-ltr");default:this.rtl=!1}}_clearObjectPointers(){this.options.columns=this.options.columns.slice(0),Array.isArray(this.options.data)&&!this.options.reactiveData&&(this.options.data=this.options.data.slice(0))}_buildElement(){var t=this.element,n=this.options,i;if(t.tagName==="TABLE"){this.originalElement=this.element,i=document.createElement("div");var r=t.attributes;for(var o in r)typeof r[o]=="object"&&i.setAttribute(r[o].name,r[o].value);t.parentNode.replaceChild(i,t),this.element=t=i}for(t.classList.add("tabulator"),t.setAttribute("role","grid");t.firstChild;)t.removeChild(t.firstChild);n.height&&(n.height=isNaN(n.height)?n.height:n.height+"px",t.style.height=n.height),n.minHeight!==!1&&(n.minHeight=isNaN(n.minHeight)?n.minHeight:n.minHeight+"px",t.style.minHeight=n.minHeight),n.maxHeight!==!1&&(n.maxHeight=isNaN(n.maxHeight)?n.maxHeight:n.maxHeight+"px",t.style.maxHeight=n.maxHeight)}_initializeTable(){var t=this.element,n=this.options;this.interactionMonitor.initialize(),this.columnManager.initialize(),this.rowManager.initialize(),this._detectBrowser(),this.modulesCore.forEach(i=>{i.initialize()}),t.appendChild(this.columnManager.getElement()),t.appendChild(this.rowManager.getElement()),n.footerElement&&this.footerManager.activate(),n.autoColumns&&n.data&&this.columnManager.generateColumnsFromRowData(this.options.data),this.modulesRegular.forEach(i=>{i.initialize()}),this.columnManager.setColumns(n.columns),this.eventBus.dispatch("table-built")}_loadInitialData(){return this.dataLoader.load(this.options.data).finally(()=>{this.columnManager.verticalAlignHeaders()})}destroy(){var t=this.element;for(this.destroyed=!0,this.constructor.registry.deregister(this),this.eventBus.dispatch("table-destroy"),this.rowManager.destroy();t.firstChild;)t.removeChild(t.firstChild);t.classList.remove("tabulator"),this.externalEvents.dispatch("tableDestroyed")}_detectBrowser(){var t=navigator.userAgent||navigator.vendor||window.opera;t.indexOf("Trident")>-1?(this.browser="ie",this.browserSlow=!0):t.indexOf("Edge")>-1?(this.browser="edge",this.browserSlow=!0):t.indexOf("Firefox")>-1?(this.browser="firefox",this.browserSlow=!1):t.indexOf("Mac OS")>-1?(this.browser="safari",this.browserSlow=!1):(this.browser="other",this.browserSlow=!1),this.browserMobile=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(t.slice(0,4))}initGuard(t,n){var i,r;return this.options.debugInitialization&&!this.initialized&&(t||(i=new Error().stack.split(` -`),r=i[0]=="Error"?i[2]:i[1],r[0]==" "?t=r.trim().split(" ")[1].split(".")[1]:t=r.trim().split("@")[0]),console.warn("Table Not Initialized - Calling the "+t+" function before the table is initialized may result in inconsistent behavior, Please wait for the `tableBuilt` event before calling this function."+(n?" "+n:""))),this.initialized}blockRedraw(){this.initGuard(),this.eventBus.dispatch("redraw-blocking"),this.rowManager.blockRedraw(),this.columnManager.blockRedraw(),this.eventBus.dispatch("redraw-blocked")}restoreRedraw(){this.initGuard(),this.eventBus.dispatch("redraw-restoring"),this.rowManager.restoreRedraw(),this.columnManager.restoreRedraw(),this.eventBus.dispatch("redraw-restored")}setData(t,n,i){return this.initGuard(!1,"To set initial data please use the 'data' property in the table constructor."),this.dataLoader.load(t,n,i,!1)}clearData(){this.initGuard(),this.dataLoader.blockActiveLoad(),this.rowManager.clearData()}getData(t){return this.rowManager.getData(t)}getDataCount(t){return this.rowManager.getDataCount(t)}replaceData(t,n,i){return this.initGuard(),this.dataLoader.load(t,n,i,!0,!0)}updateData(t){var n=0;return this.initGuard(),new Promise((i,r)=>{this.dataLoader.blockActiveLoad(),typeof t=="string"&&(t=JSON.parse(t)),t&&t.length>0?t.forEach(o=>{var a=this.rowManager.findRow(o[this.options.index]);a?(n++,a.updateData(o).then(()=>{n--,n||i()}).catch(s=>{r("Update Error - Unable to update row",o,s)})):r("Update Error - Unable to find row",o)}):(console.warn("Update Error - No data provided"),r("Update Error - No data provided"))})}addData(t,n,i){return this.initGuard(),new Promise((r,o)=>{this.dataLoader.blockActiveLoad(),typeof t=="string"&&(t=JSON.parse(t)),t?this.rowManager.addRows(t,n,i).then(a=>{var s=[];a.forEach(function(u){s.push(u.getComponent())}),r(s)}):(console.warn("Update Error - No data provided"),o("Update Error - No data provided"))})}updateOrAddData(t){var n=[],i=0;return this.initGuard(),new Promise((r,o)=>{this.dataLoader.blockActiveLoad(),typeof t=="string"&&(t=JSON.parse(t)),t&&t.length>0?t.forEach(a=>{var s=this.rowManager.findRow(a[this.options.index]);i++,s?s.updateData(a).then(()=>{i--,n.push(s.getComponent()),i||r(n)}):this.rowManager.addRows(a).then(u=>{i--,n.push(u[0].getComponent()),i||r(n)})}):(console.warn("Update Error - No data provided"),o("Update Error - No data provided"))})}getRow(t){var n=this.rowManager.findRow(t);return n?n.getComponent():(console.warn("Find Error - No matching row found:",t),!1)}getRowFromPosition(t){var n=this.rowManager.getRowFromPosition(t);return n?n.getComponent():(console.warn("Find Error - No matching row found:",t),!1)}deleteRow(t){var n=[];this.initGuard(),Array.isArray(t)||(t=[t]);for(let i of t){let r=this.rowManager.findRow(i,!0);if(r)n.push(r);else return console.error("Delete Error - No matching row found:",i),Promise.reject("Delete Error - No matching row found")}return n.sort((i,r)=>this.rowManager.rows.indexOf(i)>this.rowManager.rows.indexOf(r)?1:-1),n.forEach(i=>{i.delete()}),this.rowManager.reRenderInPosition(),Promise.resolve()}addRow(t,n,i){return this.initGuard(),typeof t=="string"&&(t=JSON.parse(t)),this.rowManager.addRows(t,n,i,!0).then(r=>r[0].getComponent())}updateOrAddRow(t,n){var i=this.rowManager.findRow(t);return this.initGuard(),typeof n=="string"&&(n=JSON.parse(n)),i?i.updateData(n).then(()=>i.getComponent()):this.rowManager.addRows(n).then(r=>r[0].getComponent())}updateRow(t,n){var i=this.rowManager.findRow(t);return this.initGuard(),typeof n=="string"&&(n=JSON.parse(n)),i?i.updateData(n).then(()=>Promise.resolve(i.getComponent())):(console.warn("Update Error - No matching row found:",t),Promise.reject("Update Error - No matching row found"))}scrollToRow(t,n,i){var r=this.rowManager.findRow(t);return r?this.rowManager.scrollToRow(r,n,i):(console.warn("Scroll Error - No matching row found:",t),Promise.reject("Scroll Error - No matching row found"))}moveRow(t,n,i){var r=this.rowManager.findRow(t);this.initGuard(),r?r.moveToRow(n,i):console.warn("Move Error - No matching row found:",t)}getRows(t){return this.rowManager.getComponents(t)}getRowPosition(t){var n=this.rowManager.findRow(t);return n?n.getPosition():(console.warn("Position Error - No matching row found:",t),!1)}setColumns(t){this.initGuard(!1,"To set initial columns please use the 'columns' property in the table constructor"),this.columnManager.setColumns(t)}getColumns(t){return this.columnManager.getComponents(t)}getColumn(t){var n=this.columnManager.findColumn(t);return n?n.getComponent():(console.warn("Find Error - No matching column found:",t),!1)}getColumnDefinitions(){return this.columnManager.getDefinitionTree()}showColumn(t){var n=this.columnManager.findColumn(t);if(this.initGuard(),n)n.show();else return console.warn("Column Show Error - No matching column found:",t),!1}hideColumn(t){var n=this.columnManager.findColumn(t);if(this.initGuard(),n)n.hide();else return console.warn("Column Hide Error - No matching column found:",t),!1}toggleColumn(t){var n=this.columnManager.findColumn(t);if(this.initGuard(),n)n.visible?n.hide():n.show();else return console.warn("Column Visibility Toggle Error - No matching column found:",t),!1}addColumn(t,n,i){var r=this.columnManager.findColumn(i);return this.initGuard(),this.columnManager.addColumn(t,n,r).then(o=>o.getComponent())}deleteColumn(t){var n=this.columnManager.findColumn(t);return this.initGuard(),n?n.delete():(console.warn("Column Delete Error - No matching column found:",t),Promise.reject())}updateColumnDefinition(t,n){var i=this.columnManager.findColumn(t);return this.initGuard(),i?i.updateDefinition(n):(console.warn("Column Update Error - No matching column found:",t),Promise.reject())}moveColumn(t,n,i){var r=this.columnManager.findColumn(t),o=this.columnManager.findColumn(n);this.initGuard(),r?o?this.columnManager.moveColumn(r,o,i):console.warn("Move Error - No matching column found:",o):console.warn("Move Error - No matching column found:",t)}scrollToColumn(t,n,i){return new Promise((r,o)=>{var a=this.columnManager.findColumn(t);return a?this.columnManager.scrollToColumn(a,n,i):(console.warn("Scroll Error - No matching column found:",t),Promise.reject("Scroll Error - No matching column found"))})}redraw(t){this.initGuard(),this.columnManager.redraw(t),this.rowManager.redraw(t)}setHeight(t){this.options.height=isNaN(t)?t:t+"px",this.element.style.height=this.options.height,this.rowManager.initializeRenderer(),this.rowManager.redraw(!0)}on(t,n){this.externalEvents.subscribe(t,n)}off(t,n){this.externalEvents.unsubscribe(t,n)}dispatchEvent(){var t=Array.from(arguments);t.shift(),this.externalEvents.dispatch(...arguments)}alert(t,n){this.initGuard(),this.alertManager.alert(t,n)}clearAlert(){this.initGuard(),this.alertManager.clear()}modExists(t,n){return this.modules[t]?!0:(n&&console.error("Tabulator Module Not Installed: "+t),!1)}module(t){var n=this.modules[t];return n||console.error("Tabulator module not installed: "+t),n}},j0=td;var U0=hr(G0()),V0=async()=>{let i=await(await fetch("https://placement.freaks.se/api/v1/mapentities")).json(),r=[],o=i.length,a=0,s=0,u=0;for(let p of i){let{properties:_}=JSON.parse(p.geoJson),y={name:String(_.name),additionalSqm:Number(_.additionalSqm),amplifiedSound:Number(_.amplifiedSound),color:String(_.color),contactInfo:String(_.contactInfo),description:String(_.description),nrOfPeople:Number(_.nrOfPeople),nrOfVechiles:Number(_.nrOfVechiles),powerNeed:Number(_.powerNeed),revision:Number(p.revision)};a+=+y.nrOfPeople,s+=y.nrOfVechiles,u+=y.powerNeed,r.push(y)}console.log({totalNrOfEntries:o,totalNrOfPeople:a,totalNrOfVechiles:s,totalPowerNeed:u}),new j0("#stats",{data:r,autoColumns:!0});let f=new U0.default.Workbook;f.creator="Borderland Community Cocreators";let c=f.addWorksheet("Camps");c.columns=[{header:"Name",key:"name"},{header:"Revision",key:"revision"},{header:"AdditionalSqm",key:"additionalSqm"},{header:"AmplifiedSound",key:"amplifiedSound"},{header:"Color",key:"color"},{header:"ContactInfo",key:"contactInfo"},{header:"Description",key:"description"},{header:"NrOfPeople",key:"nrOfPeople"},{header:"NrOfVechiles",key:"nrOfVechiles"},{header:"PowerNeed",key:"powerNeed"}],r.forEach(p=>c.addRow(p));let d=await f.xlsx.writeBuffer(),m=URL.createObjectURL(new Blob([d],{type:"application/xlsx"})),v=document.createElement("a");v.classList.add("button"),v.innerHTML="Download XLSX File",v.href=m,document.querySelector("#header").appendChild(v)};async function $w(){try{await D0()}catch(e){console.error(e)}localStorage.getItem("hasSeenPlacementWelcome")||ao({file:"welcome",position:"bottom",onClose:()=>{localStorage.setItem("hasSeenPlacementWelcome","true")}})}window.indexMain=$w;async function Yw(){await V0()}window.statsMain=Yw;})(); +`),r=i[0]=="Error"?i[2]:i[1],r[0]==" "?t=r.trim().split(" ")[1].split(".")[1]:t=r.trim().split("@")[0]),console.warn("Table Not Initialized - Calling the "+t+" function before the table is initialized may result in inconsistent behavior, Please wait for the `tableBuilt` event before calling this function."+(n?" "+n:""))),this.initialized}blockRedraw(){this.initGuard(),this.eventBus.dispatch("redraw-blocking"),this.rowManager.blockRedraw(),this.columnManager.blockRedraw(),this.eventBus.dispatch("redraw-blocked")}restoreRedraw(){this.initGuard(),this.eventBus.dispatch("redraw-restoring"),this.rowManager.restoreRedraw(),this.columnManager.restoreRedraw(),this.eventBus.dispatch("redraw-restored")}setData(t,n,i){return this.initGuard(!1,"To set initial data please use the 'data' property in the table constructor."),this.dataLoader.load(t,n,i,!1)}clearData(){this.initGuard(),this.dataLoader.blockActiveLoad(),this.rowManager.clearData()}getData(t){return this.rowManager.getData(t)}getDataCount(t){return this.rowManager.getDataCount(t)}replaceData(t,n,i){return this.initGuard(),this.dataLoader.load(t,n,i,!0,!0)}updateData(t){var n=0;return this.initGuard(),new Promise((i,r)=>{this.dataLoader.blockActiveLoad(),typeof t=="string"&&(t=JSON.parse(t)),t&&t.length>0?t.forEach(o=>{var a=this.rowManager.findRow(o[this.options.index]);a?(n++,a.updateData(o).then(()=>{n--,n||i()}).catch(s=>{r("Update Error - Unable to update row",o,s)})):r("Update Error - Unable to find row",o)}):(console.warn("Update Error - No data provided"),r("Update Error - No data provided"))})}addData(t,n,i){return this.initGuard(),new Promise((r,o)=>{this.dataLoader.blockActiveLoad(),typeof t=="string"&&(t=JSON.parse(t)),t?this.rowManager.addRows(t,n,i).then(a=>{var s=[];a.forEach(function(u){s.push(u.getComponent())}),r(s)}):(console.warn("Update Error - No data provided"),o("Update Error - No data provided"))})}updateOrAddData(t){var n=[],i=0;return this.initGuard(),new Promise((r,o)=>{this.dataLoader.blockActiveLoad(),typeof t=="string"&&(t=JSON.parse(t)),t&&t.length>0?t.forEach(a=>{var s=this.rowManager.findRow(a[this.options.index]);i++,s?s.updateData(a).then(()=>{i--,n.push(s.getComponent()),i||r(n)}):this.rowManager.addRows(a).then(u=>{i--,n.push(u[0].getComponent()),i||r(n)})}):(console.warn("Update Error - No data provided"),o("Update Error - No data provided"))})}getRow(t){var n=this.rowManager.findRow(t);return n?n.getComponent():(console.warn("Find Error - No matching row found:",t),!1)}getRowFromPosition(t){var n=this.rowManager.getRowFromPosition(t);return n?n.getComponent():(console.warn("Find Error - No matching row found:",t),!1)}deleteRow(t){var n=[];this.initGuard(),Array.isArray(t)||(t=[t]);for(let i of t){let r=this.rowManager.findRow(i,!0);if(r)n.push(r);else return console.error("Delete Error - No matching row found:",i),Promise.reject("Delete Error - No matching row found")}return n.sort((i,r)=>this.rowManager.rows.indexOf(i)>this.rowManager.rows.indexOf(r)?1:-1),n.forEach(i=>{i.delete()}),this.rowManager.reRenderInPosition(),Promise.resolve()}addRow(t,n,i){return this.initGuard(),typeof t=="string"&&(t=JSON.parse(t)),this.rowManager.addRows(t,n,i,!0).then(r=>r[0].getComponent())}updateOrAddRow(t,n){var i=this.rowManager.findRow(t);return this.initGuard(),typeof n=="string"&&(n=JSON.parse(n)),i?i.updateData(n).then(()=>i.getComponent()):this.rowManager.addRows(n).then(r=>r[0].getComponent())}updateRow(t,n){var i=this.rowManager.findRow(t);return this.initGuard(),typeof n=="string"&&(n=JSON.parse(n)),i?i.updateData(n).then(()=>Promise.resolve(i.getComponent())):(console.warn("Update Error - No matching row found:",t),Promise.reject("Update Error - No matching row found"))}scrollToRow(t,n,i){var r=this.rowManager.findRow(t);return r?this.rowManager.scrollToRow(r,n,i):(console.warn("Scroll Error - No matching row found:",t),Promise.reject("Scroll Error - No matching row found"))}moveRow(t,n,i){var r=this.rowManager.findRow(t);this.initGuard(),r?r.moveToRow(n,i):console.warn("Move Error - No matching row found:",t)}getRows(t){return this.rowManager.getComponents(t)}getRowPosition(t){var n=this.rowManager.findRow(t);return n?n.getPosition():(console.warn("Position Error - No matching row found:",t),!1)}setColumns(t){this.initGuard(!1,"To set initial columns please use the 'columns' property in the table constructor"),this.columnManager.setColumns(t)}getColumns(t){return this.columnManager.getComponents(t)}getColumn(t){var n=this.columnManager.findColumn(t);return n?n.getComponent():(console.warn("Find Error - No matching column found:",t),!1)}getColumnDefinitions(){return this.columnManager.getDefinitionTree()}showColumn(t){var n=this.columnManager.findColumn(t);if(this.initGuard(),n)n.show();else return console.warn("Column Show Error - No matching column found:",t),!1}hideColumn(t){var n=this.columnManager.findColumn(t);if(this.initGuard(),n)n.hide();else return console.warn("Column Hide Error - No matching column found:",t),!1}toggleColumn(t){var n=this.columnManager.findColumn(t);if(this.initGuard(),n)n.visible?n.hide():n.show();else return console.warn("Column Visibility Toggle Error - No matching column found:",t),!1}addColumn(t,n,i){var r=this.columnManager.findColumn(i);return this.initGuard(),this.columnManager.addColumn(t,n,r).then(o=>o.getComponent())}deleteColumn(t){var n=this.columnManager.findColumn(t);return this.initGuard(),n?n.delete():(console.warn("Column Delete Error - No matching column found:",t),Promise.reject())}updateColumnDefinition(t,n){var i=this.columnManager.findColumn(t);return this.initGuard(),i?i.updateDefinition(n):(console.warn("Column Update Error - No matching column found:",t),Promise.reject())}moveColumn(t,n,i){var r=this.columnManager.findColumn(t),o=this.columnManager.findColumn(n);this.initGuard(),r?o?this.columnManager.moveColumn(r,o,i):console.warn("Move Error - No matching column found:",o):console.warn("Move Error - No matching column found:",t)}scrollToColumn(t,n,i){return new Promise((r,o)=>{var a=this.columnManager.findColumn(t);return a?this.columnManager.scrollToColumn(a,n,i):(console.warn("Scroll Error - No matching column found:",t),Promise.reject("Scroll Error - No matching column found"))})}redraw(t){this.initGuard(),this.columnManager.redraw(t),this.rowManager.redraw(t)}setHeight(t){this.options.height=isNaN(t)?t:t+"px",this.element.style.height=this.options.height,this.rowManager.initializeRenderer(),this.rowManager.redraw(!0)}on(t,n){this.externalEvents.subscribe(t,n)}off(t,n){this.externalEvents.unsubscribe(t,n)}dispatchEvent(){var t=Array.from(arguments);t.shift(),this.externalEvents.dispatch(...arguments)}alert(t,n){this.initGuard(),this.alertManager.alert(t,n)}clearAlert(){this.initGuard(),this.alertManager.clear()}modExists(t,n){return this.modules[t]?!0:(n&&console.error("Tabulator Module Not Installed: "+t),!1)}module(t){var n=this.modules[t];return n||console.error("Tabulator module not installed: "+t),n}},j0=td;var U0=hr(G0()),V0=async()=>{let i=await(await fetch("https://placement.freaks.se/api/v1/mapentities")).json(),r=[],o=i.length,a={totalNrOfPeople:0,totalNrOfVechiles:0,totalPowerNeed:0};for(let _ of i){let{properties:y}=JSON.parse(_.geoJson),x={name:String(y.name),additionalSqm:Number(y.additionalSqm),amplifiedSound:Number(y.amplifiedSound),color:String(y.color),contactInfo:String(y.contactInfo),description:String(y.description),nrOfPeople:Number(y.nrOfPeople),nrOfVechiles:Number(y.nrOfVechiles),powerNeed:Number(y.powerNeed),revision:Number(_.revision)};a.totalNrOfPeople+=+x.nrOfPeople,a.totalNrOfVechiles+=x.nrOfVechiles,a.totalPowerNeed+=x.powerNeed,r.push(x)}new j0("#stats",{data:r,autoColumns:!0});let s=new U0.default.Workbook;s.creator="Borderland Community Cocreators";let u=s.addWorksheet("Camps");u.columns=[{header:"Name",key:"name"},{header:"Revision",key:"revision"},{header:"AdditionalSqm",key:"additionalSqm"},{header:"AmplifiedSound",key:"amplifiedSound"},{header:"Color",key:"color"},{header:"ContactInfo",key:"contactInfo"},{header:"Description",key:"description"},{header:"NrOfPeople",key:"nrOfPeople"},{header:"NrOfVechiles",key:"nrOfVechiles"},{header:"PowerNeed",key:"powerNeed"}],r.forEach(_=>u.addRow(_));let f=document.createElement("h1");f.innerHTML="All camps and statistics",document.querySelector("#header").appendChild(f);let c=document.createElement("ul");for(let[_,y]of Object.entries(a)){let x=document.createElement("li");x.innerHTML=`${_}: ${y}`,c.appendChild(x)}document.querySelector("#header").appendChild(c);let d=await s.xlsx.writeBuffer(),m=URL.createObjectURL(new Blob([d],{type:"application/xlsx"})),v=document.createElement("a");v.href=m;let p=document.createElement("sl-button");p.innerHTML="Download XLSX File",p.setAttribute("variant","primary"),v.appendChild(p),document.querySelector("#header").appendChild(v)};async function $w(){try{await D0()}catch(e){console.error(e)}localStorage.getItem("hasSeenPlacementWelcome")||ao({file:"welcome",position:"bottom",onClose:()=>{localStorage.setItem("hasSeenPlacementWelcome","true")}})}window.indexMain=$w;async function Yw(){await V0()}window.statsMain=Yw;})(); /*! Bundled license information: leaflet/dist/leaflet-src.js: diff --git a/stats.html b/stats.html index f4726e3..a81504c 100644 --- a/stats.html +++ b/stats.html @@ -40,6 +40,12 @@ --sl-color-primary-900: #20b2aa; --sl-color-primary-950: #20b2aa; } + body { + padding: 20px; + } + #header { + margin-bottom: 20px; + }