var Tr=Object.defineProperty;var Mr=(n,e,t)=>e in n?Tr(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var w=(n,e,t)=>Mr(n,typeof e!="symbol"?e+"":e,t);import{c as We,a as V,d as ts,f as Q}from"../chunks/8V7BUHOp.js";import"../chunks/Ct62Q5nz.js";import{f as Ge,p as ln,b as be,d as hn,s as $,g as N,a as dn,c as O,e as ie,r as H,t as un,n as ht,u as ei,J as Sr}from"../chunks/CwuLZfOX.js";import{s as bi}from"../chunks/CaaTB9LM.js";import{i as me}from"../chunks/ChcH33Yj.js";import{I as je,f as Ue,e as Lr,d as Dr,i as zr,r as fs}from"../chunks/_j5m0PhM.js";import{b as ps}from"../chunks/CR2j1Dvc.js";import{b as Fr}from"../chunks/Bn6k3L-0.js";import{l as $e,s as Ze,p as De}from"../chunks/CNkT2fMe.js";import{a as gs,m as ms}from"../chunks/Bv7jGDQ6.js";import{X as Hr}from"../chunks/DTy7LB_U.js";function Ar(n,e){const t=$e(e,["children","$$slots","$$events","$$legacy"]);/**
 * @license lucide-svelte v0.511.0 - ISC
 *
 * ISC License
 *
 * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 *
 */const i=[["path",{d:"M12 15V3"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}],["path",{d:"m7 10 5 5 5-5"}]];je(n,Ze({name:"download"},()=>t,{get iconNode(){return i},children:(s,r)=>{var o=We(),a=Ge(o);Ue(a,e,"default",{}),V(s,o)},$$slots:{default:!0}}))}function Or(n,e){const t=$e(e,["children","$$slots","$$events","$$legacy"]);/**
 * @license lucide-svelte v0.511.0 - ISC
 *
 * ISC License
 *
 * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 *
 */const i=[["path",{d:"M10 12.5 8 15l2 2.5"}],["path",{d:"m14 12.5 2 2.5-2 2.5"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z"}]];je(n,Ze({name:"file-code"},()=>t,{get iconNode(){return i},children:(s,r)=>{var o=We(),a=Ge(o);Ue(a,e,"default",{}),V(s,o)},$$slots:{default:!0}}))}function Pr(n,e){const t=$e(e,["children","$$slots","$$events","$$legacy"]);/**
 * @license lucide-svelte v0.511.0 - ISC
 *
 * ISC License
 *
 * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 *
 */const i=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4"}],["circle",{cx:"10",cy:"12",r:"2"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22"}]];je(n,Ze({name:"file-image"},()=>t,{get iconNode(){return i},children:(s,r)=>{var o=We(),a=Ge(o);Ue(a,e,"default",{}),V(s,o)},$$slots:{default:!0}}))}function Br(n,e){const t=$e(e,["children","$$slots","$$events","$$legacy"]);/**
 * @license lucide-svelte v0.511.0 - ISC
 *
 * ISC License
 *
 * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 *
 */const i=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4"}],["path",{d:"M8 13h2"}],["path",{d:"M14 13h2"}],["path",{d:"M8 17h2"}],["path",{d:"M14 17h2"}]];je(n,Ze({name:"file-spreadsheet"},()=>t,{get iconNode(){return i},children:(s,r)=>{var o=We(),a=Ge(o);Ue(a,e,"default",{}),V(s,o)},$$slots:{default:!0}}))}function Ir(n,e){const t=$e(e,["children","$$slots","$$events","$$legacy"]);/**
 * @license lucide-svelte v0.511.0 - ISC
 *
 * ISC License
 *
 * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 *
 */const i=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4"}],["path",{d:"M10 9H8"}],["path",{d:"M16 13H8"}],["path",{d:"M16 17H8"}]];je(n,Ze({name:"file-text"},()=>t,{get iconNode(){return i},children:(s,r)=>{var o=We(),a=Ge(o);Ue(a,e,"default",{}),V(s,o)},$$slots:{default:!0}}))}function Nr(n,e){const t=$e(e,["children","$$slots","$$events","$$legacy"]);/**
 * @license lucide-svelte v0.511.0 - ISC
 *
 * ISC License
 *
 * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 *
 */const i=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}],["circle",{cx:"9",cy:"9",r:"2"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"}]];je(n,Ze({name:"image"},()=>t,{get iconNode(){return i},children:(s,r)=>{var o=We(),a=Ge(o);Ue(a,e,"default",{}),V(s,o)},$$slots:{default:!0}}))}function Vr(n,e){const t=$e(e,["children","$$slots","$$events","$$legacy"]);/**
 * @license lucide-svelte v0.511.0 - ISC
 *
 * ISC License
 *
 * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 *
 */const i=[["path",{d:"M3 7v6h6"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"}]];je(n,Ze({name:"undo"},()=>t,{get iconNode(){return i},children:(s,r)=>{var o=We(),a=Ge(o);Ue(a,e,"default",{}),V(s,o)},$$slots:{default:!0}}))}class j{constructor(e){this.table=e}reloadData(e,t,i){return this.table.dataLoader.load(e,void 0,void 0,void 0,t,i)}langText(){return this.table.modules.localize.getText(...arguments)}langBind(){return this.table.modules.localize.bind(...arguments)}langLocale(){return this.table.modules.localize.getLocale(...arguments)}commsConnections(){return this.table.modules.comms.getConnections(...arguments)}commsSend(){return this.table.modules.comms.send(...arguments)}layoutMode(){return this.table.modules.layout.getMode()}layoutRefresh(e){return this.table.modules.layout.layout(e)}subscribe(){return this.table.eventBus.subscribe(...arguments)}unsubscribe(){return this.table.eventBus.unsubscribe(...arguments)}subscribed(e){return this.table.eventBus.subscribed(e)}subscriptionChange(){return this.table.eventBus.subscriptionChange(...arguments)}dispatch(){return this.table.eventBus.dispatch(...arguments)}chain(){return this.table.eventBus.chain(...arguments)}confirm(){return this.table.eventBus.confirm(...arguments)}dispatchExternal(){return this.table.externalEvents.dispatch(...arguments)}subscribedExternal(e){return this.table.externalEvents.subscribed(e)}subscriptionChangeExternal(){return this.table.externalEvents.subscriptionChange(...arguments)}options(e){return this.table.options[e]}setOption(e,t){return typeof t<"u"&&(this.table.options[e]=t),this.table.options[e]}deprecationCheck(e,t,i){return this.table.deprecationAdvisor.check(e,t,i)}deprecationCheckMsg(e,t){return this.table.deprecationAdvisor.checkMsg(e,t)}deprecationMsg(e){return this.table.deprecationAdvisor.msg(e)}module(e){return this.table.module(e)}}class P{static elVisible(e){return!(e.offsetWidth<=0&&e.offsetHeight<=0)}static elOffset(e){var t=e.getBoundingClientRect();return{top:t.top+window.pageYOffset-document.documentElement.clientTop,left:t.left+window.pageXOffset-document.documentElement.clientLeft}}static retrieveNestedData(e,t,i){var s=e?t.split(e):[t],r=s.length,o;for(let a=0;a<r&&(i=i[s[a]],o=i,!!i);a++);return o}static deepClone(e,t,i=[]){var s={}.__proto__,r=[].__proto__;t||(t=Object.assign(Array.isArray(e)?[]:{},e));for(var o in e){let a=e[o],l,h;a!=null&&typeof a=="object"&&(a.__proto__===s||a.__proto__===r)&&(l=i.findIndex(d=>d.subject===a),l>-1?t[o]=i[l].copy:(h=Object.assign(Array.isArray(a)?[]:{},a),i.unshift({subject:a,copy:h}),t[o]=this.deepClone(a,h,i)))}return t}}let Wr=class cn extends j{constructor(e,t,i){super(e),this.element=t,this.container=this._lookupContainer(),this.parent=i,this.reversedX=!1,this.childPopup=null,this.blurable=!1,this.blurCallback=null,this.blurEventsBound=!1,this.renderedCallback=null,this.visible=!1,this.hideable=!0,this.element.classList.add("tabulator-popup-container"),this.blurEvent=this.hide.bind(this,!1),this.escEvent=this._escapeCheck.bind(this),this.destroyBinding=this.tableDestroyed.bind(this),this.destroyed=!1}tableDestroyed(){this.destroyed=!0,this.hide(!0)}_lookupContainer(){var e=this.table.options.popupContainer;return typeof e=="string"?(e=document.querySelector(e),e||console.warn("Menu Error - no container element found matching selector:",this.table.options.popupContainer,"(defaulting to document body)")):e===!0&&(e=this.table.element),e&&!this._checkContainerIsParent(e)&&(e=!1,console.warn("Menu Error - container element does not contain this table:",this.table.options.popupContainer,"(defaulting to document body)")),e||(e=document.body),e}_checkContainerIsParent(e,t=this.table.element){return e===t?!0:t.parentNode?this._checkContainerIsParent(e,t.parentNode):!1}renderCallback(e){this.renderedCallback=e}containerEventCoords(e){var t=!(e instanceof MouseEvent),i=t?e.touches[0].pageX:e.pageX,s=t?e.touches[0].pageY:e.pageY;if(this.container!==document.body){let r=P.elOffset(this.container);i-=r.left,s-=r.top}return{x:i,y:s}}elementPositionCoords(e,t="right"){var i=P.elOffset(e),s,r,o;switch(this.container!==document.body&&(s=P.elOffset(this.container),i.left-=s.left,i.top-=s.top),t){case"right":r=i.left+e.offsetWidth,o=i.top-1;break;case"bottom":r=i.left,o=i.top+e.offsetHeight;break;case"left":r=i.left,o=i.top-1;break;case"top":r=i.left,o=i.top;break;case"center":r=i.left+e.offsetWidth/2,o=i.top+e.offsetHeight/2;break}return{x:r,y:o,offset:i}}show(e,t){var i,s,r,o,a;return this.destroyed||this.table.destroyed?this:(e instanceof HTMLElement?(r=e,a=this.elementPositionCoords(e,t),o=a.offset,i=a.x,s=a.y):typeof e=="number"?(o={top:0,left:0},i=e,s=t):(a=this.containerEventCoords(e),i=a.x,s=a.y,this.reversedX=!1),this.element.style.top=s+"px",this.element.style.left=i+"px",this.container.appendChild(this.element),typeof this.renderedCallback=="function"&&this.renderedCallback(),this._fitToScreen(i,s,r,o,t),this.visible=!0,this.subscribe("table-destroy",this.destroyBinding),this.element.addEventListener("mousedown",l=>{l.stopPropagation()}),this)}_fitToScreen(e,t,i,s,r){var o=this.container===document.body?document.documentElement.scrollTop:this.container.scrollTop;(e+this.element.offsetWidth>=this.container.offsetWidth||this.reversedX)&&(this.element.style.left="",i?this.element.style.right=this.container.offsetWidth-s.left+"px":this.element.style.right=this.container.offsetWidth-e+"px",this.reversedX=!0);let a=Math.max(this.container.offsetHeight,o?this.container.scrollHeight:0);if(t+this.element.offsetHeight>a)if(i)switch(r){case"bottom":this.element.style.top=parseInt(this.element.style.top)-this.element.offsetHeight-i.offsetHeight-1+"px";break;default:this.element.style.top=parseInt(this.element.style.top)-this.element.offsetHeight+i.offsetHeight+1+"px"}else this.element.style.height=a+"px"}isVisible(){return this.visible}hideOnBlur(e){return this.blurable=!0,this.visible&&(setTimeout(()=>{this.visible&&(this.table.rowManager.element.addEventListener("scroll",this.blurEvent),this.subscribe("cell-editing",this.blurEvent),document.body.addEventListener("click",this.blurEvent),document.body.addEventListener("contextmenu",this.blurEvent),document.body.addEventListener("mousedown",this.blurEvent),window.addEventListener("resize",this.blurEvent),document.body.addEventListener("keydown",this.escEvent),this.blurEventsBound=!0)},100),this.blurCallback=e),this}_escapeCheck(e){e.keyCode==27&&this.hide()}blockHide(){this.hideable=!1}restoreHide(){this.hideable=!0}hide(e=!1){return this.visible&&this.hideable&&(this.blurable&&this.blurEventsBound&&(document.body.removeEventListener("keydown",this.escEvent),document.body.removeEventListener("click",this.blurEvent),document.body.removeEventListener("contextmenu",this.blurEvent),document.body.removeEventListener("mousedown",this.blurEvent),window.removeEventListener("resize",this.blurEvent),this.table.rowManager.element.removeEventListener("scroll",this.blurEvent),this.unsubscribe("cell-editing",this.blurEvent),this.blurEventsBound=!1),this.childPopup&&this.childPopup.hide(),this.parent&&(this.parent.childPopup=null),this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.visible=!1,this.blurCallback&&!e&&this.blurCallback(),this.unsubscribe("table-destroy",this.destroyBinding)),this}child(e){return this.childPopup&&this.childPopup.hide(),this.childPopup=new cn(this.table,e,this),this.childPopup}};class D extends j{constructor(e,t){super(e),this._handler=null}initialize(){}registerTableOption(e,t){this.table.optionsList.register(e,t)}registerColumnOption(e,t){this.table.columnManager.optionsList.register(e,t)}registerTableFunction(e,t){typeof this.table[e]>"u"?this.table[e]=(...i)=>(this.table.initGuard(e),t(...i)):console.warn("Unable to bind table function, name already in use",e)}registerComponentFunction(e,t,i){return this.table.componentFunctionBinder.bind(e,t,i)}registerDataHandler(e,t){this.table.rowManager.registerDataPipelineHandler(e,t),this._handler=e}registerDisplayHandler(e,t){this.table.rowManager.registerDisplayPipelineHandler(e,t),this._handler=e}displayRows(e){var t=this.table.rowManager.displayRows.length-1,i;if(this._handler&&(i=this.table.rowManager.displayPipeline.findIndex(s=>s.handler===this._handler),i>-1&&(t=i)),e&&(t=t+e),this._handler)return t>-1?this.table.rowManager.getDisplayRows(t):this.activeRows()}activeRows(){return this.table.rowManager.activeRows}refreshData(e,t){t||(t=this._handler),t&&this.table.rowManager.refreshActiveData(t,!1,e)}footerAppend(e){return this.table.footerManager.append(e)}footerPrepend(e){return this.table.footerManager.prepend(e)}footerRemove(e){return this.table.footerManager.remove(e)}popup(e,t){return new Wr(this.table,e,t)}alert(e,t){return this.table.alertManager.alert(e,t)}clearAlert(){return this.table.alertManager.clear()}}var Gr={rownum:function(n,e,t,i,s,r){return r.getPosition()}};const Qe=class Qe extends D{constructor(e){super(e),this.allowedTypes=["","data","download","clipboard","print","htmlOutput"],this.registerColumnOption("accessor"),this.registerColumnOption("accessorParams"),this.registerColumnOption("accessorData"),this.registerColumnOption("accessorDataParams"),this.registerColumnOption("accessorDownload"),this.registerColumnOption("accessorDownloadParams"),this.registerColumnOption("accessorClipboard"),this.registerColumnOption("accessorClipboardParams"),this.registerColumnOption("accessorPrint"),this.registerColumnOption("accessorPrintParams"),this.registerColumnOption("accessorHtmlOutput"),this.registerColumnOption("accessorHtmlOutputParams")}initialize(){this.subscribe("column-layout",this.initializeColumn.bind(this)),this.subscribe("row-data-retrieve",this.transformRow.bind(this))}initializeColumn(e){var t=!1,i={};this.allowedTypes.forEach(s=>{var r="accessor"+(s.charAt(0).toUpperCase()+s.slice(1)),o;e.definition[r]&&(o=this.lookupAccessor(e.definition[r]),o&&(t=!0,i[r]={accessor:o,params:e.definition[r+"Params"]||{}}))}),t&&(e.modules.accessor=i)}lookupAccessor(e){var t=!1;switch(typeof e){case"string":Qe.accessors[e]?t=Qe.accessors[e]:console.warn("Accessor Error - No such accessor found, ignoring: ",e);break;case"function":t=e;break}return t}transformRow(e,t){var i="accessor"+(t.charAt(0).toUpperCase()+t.slice(1)),s=e.getComponent(),r=P.deepClone(e.data||{});return this.table.columnManager.traverse(function(o){var a,l,h,d;o.modules.accessor&&(l=o.modules.accessor[i]||o.modules.accessor.accessor||!1,l&&(a=o.getFieldValue(r),a!="undefined"&&(d=o.getComponent(),h=typeof l.params=="function"?l.params(a,r,t,d,s):l.params,o.setFieldValue(r,l.accessor(a,r,t,h,d,s)))))}),r}};w(Qe,"moduleName","accessor"),w(Qe,"accessors",Gr);let vi=Qe;var jr={method:"GET"};function wi(n,e){var t=[];if(e=e||"",Array.isArray(n))n.forEach((s,r)=>{t=t.concat(wi(s,e?e+"["+r+"]":r))});else if(typeof n=="object")for(var i in n)t=t.concat(wi(n[i],e?e+"["+i+"]":i));else t.push({key:e,value:n});return t}function Ur(n){var e=wi(n),t=[];return e.forEach(function(i){t.push(encodeURIComponent(i.key)+"="+encodeURIComponent(i.value))}),t.join("&")}function fn(n,e,t){return n&&t&&Object.keys(t).length&&(!e.method||e.method.toLowerCase()=="get")&&(e.method="get",n+=(n.includes("?")?"&":"?")+Ur(t)),n}function $r(n,e,t){var i;return new Promise((s,r)=>{if(n=this.urlGenerator.call(this.table,n,e,t),e.method.toUpperCase()!="GET")if(i=typeof this.table.options.ajaxContentType=="object"?this.table.options.ajaxContentType:this.contentTypeFormatters[this.table.options.ajaxContentType],i){for(var o in i.headers)e.headers||(e.headers={}),typeof e.headers[o]>"u"&&(e.headers[o]=i.headers[o]);e.body=i.body.call(this,n,e,t)}else console.warn("Ajax Error - Invalid ajaxContentType value:",this.table.options.ajaxContentType);n?(typeof e.headers>"u"&&(e.headers={}),typeof e.headers.Accept>"u"&&(e.headers.Accept="application/json"),typeof e.headers["X-Requested-With"]>"u"&&(e.headers["X-Requested-With"]="XMLHttpRequest"),typeof e.mode>"u"&&(e.mode="cors"),e.mode=="cors"?(typeof e.headers.Origin>"u"&&(e.headers.Origin=window.location.origin),typeof e.credentials>"u"&&(e.credentials="same-origin")):typeof e.credentials>"u"&&(e.credentials="include"),fetch(n,e).then(a=>{a.ok?a.json().then(l=>{s(l)}).catch(l=>{r(l),console.warn("Ajax Load Error - Invalid JSON returned",l)}):(console.error("Ajax Load Error - Connection Error: "+a.status,a.statusText),r(a))}).catch(a=>{console.error("Ajax Load Error - Connection Error: ",a),r(a)})):(console.warn("Ajax Load Error - No URL Set"),s([]))})}function Ci(n,e){var t=[];if(e=e||"",Array.isArray(n))n.forEach((s,r)=>{t=t.concat(Ci(s,e?e+"["+r+"]":r))});else if(typeof n=="object")for(var i in n)t=t.concat(Ci(n[i],e?e+"["+i+"]":i));else t.push({key:e,value:n});return t}var Zr={json:{headers:{"Content-Type":"application/json"},body:function(n,e,t){return JSON.stringify(t)}},form:{headers:{},body:function(n,e,t){var i=Ci(t),s=new FormData;return i.forEach(function(r){s.append(r.key,r.value)}),s}}};const se=class se extends D{constructor(e){super(e),this.config={},this.url="",this.urlGenerator=!1,this.params=!1,this.loaderPromise=!1,this.registerTableOption("ajaxURL",!1),this.registerTableOption("ajaxURLGenerator",!1),this.registerTableOption("ajaxParams",{}),this.registerTableOption("ajaxConfig","get"),this.registerTableOption("ajaxContentType","form"),this.registerTableOption("ajaxRequestFunc",!1),this.registerTableOption("ajaxRequesting",function(){}),this.registerTableOption("ajaxResponse",!1),this.contentTypeFormatters=se.contentTypeFormatters}initialize(){this.loaderPromise=this.table.options.ajaxRequestFunc||se.defaultLoaderPromise,this.urlGenerator=this.table.options.ajaxURLGenerator||se.defaultURLGenerator,this.table.options.ajaxURL&&this.setUrl(this.table.options.ajaxURL),this.setDefaultConfig(this.table.options.ajaxConfig),this.registerTableFunction("getAjaxUrl",this.getUrl.bind(this)),this.subscribe("data-loading",this.requestDataCheck.bind(this)),this.subscribe("data-params",this.requestParams.bind(this)),this.subscribe("data-load",this.requestData.bind(this))}requestParams(e,t,i,s){var r=this.table.options.ajaxParams;return r&&(typeof r=="function"&&(r=r.call(this.table)),s=Object.assign(Object.assign({},r),s)),s}requestDataCheck(e,t,i,s){return!!(!e&&this.url||typeof e=="string")}requestData(e,t,i,s,r){var o;return!r&&this.requestDataCheck(e)?(e&&this.setUrl(e),o=this.generateConfig(i),this.sendRequest(this.url,t,o)):r}setDefaultConfig(e={}){this.config=Object.assign({},se.defaultConfig),typeof e=="string"?this.config.method=e:Object.assign(this.config,e)}generateConfig(e={}){var t=Object.assign({},this.config);return typeof e=="string"?t.method=e:Object.assign(t,e),t}setUrl(e){this.url=e}getUrl(){return this.url}sendRequest(e,t,i){return this.table.options.ajaxRequesting.call(this.table,e,t)!==!1?this.loaderPromise(e,i,t).then(s=>(this.table.options.ajaxResponse&&(s=this.table.options.ajaxResponse.call(this.table,e,t,s)),s)):Promise.reject()}};w(se,"moduleName","ajax"),w(se,"defaultConfig",jr),w(se,"defaultURLGenerator",fn),w(se,"defaultLoaderPromise",$r),w(se,"contentTypeFormatters",Zr);let yi=se;var Xr={replace:function(n){return this.table.setData(n)},update:function(n){return this.table.updateOrAddData(n)},insert:function(n){return this.table.addData(n)}},Kr={table:function(n){var e=[],t=!0,i=this.table.columnManager.columns,s=[],r=[];return n=n.split(`
`),n.forEach(function(o){e.push(o.split("	"))}),e.length&&!(e.length===1&&e[0].length<2)?(e[0].forEach(function(o){var a=i.find(function(l){return o&&l.definition.title&&o.trim()&&l.definition.title.trim()===o.trim()});a?s.push(a):t=!1}),t||(t=!0,s=[],e[0].forEach(function(o){var a=i.find(function(l){return o&&l.field&&o.trim()&&l.field.trim()===o.trim()});a?s.push(a):t=!1}),t||(s=this.table.columnManager.columnsByIndex)),t&&e.shift(),e.forEach(function(o){var a={};o.forEach(function(l,h){s[h]&&(a[s[h].field]=l)}),r.push(a)}),r):!1}},Yr={copyToClipboard:["ctrl + 67","meta + 67"]},Jr={copyToClipboard:function(n){this.table.modules.edit.currentCell||this.table.modExists("clipboard",!0)&&this.table.modules.clipboard.copy(!1,!0)}},qr={keybindings:{bindings:Yr,actions:Jr}};const ve=class ve extends D{constructor(e){super(e),this.mode=!0,this.pasteParser=function(){},this.pasteAction=function(){},this.customSelection=!1,this.rowRange=!1,this.blocked=!0,this.registerTableOption("clipboard",!1),this.registerTableOption("clipboardCopyStyled",!0),this.registerTableOption("clipboardCopyConfig",!1),this.registerTableOption("clipboardCopyFormatter",!1),this.registerTableOption("clipboardCopyRowRange","active"),this.registerTableOption("clipboardPasteParser","table"),this.registerTableOption("clipboardPasteAction","insert"),this.registerColumnOption("clipboard"),this.registerColumnOption("titleClipboard")}initialize(){this.mode=this.table.options.clipboard,this.rowRange=this.table.options.clipboardCopyRowRange,(this.mode===!0||this.mode==="copy")&&this.table.element.addEventListener("copy",e=>{var t,i,s;this.blocked||(e.preventDefault(),this.customSelection?(t=this.customSelection,this.table.options.clipboardCopyFormatter&&(t=this.table.options.clipboardCopyFormatter("plain",t))):(s=this.table.modules.export.generateExportList(this.table.options.clipboardCopyConfig,this.table.options.clipboardCopyStyled,this.rowRange,"clipboard"),i=this.table.modules.export.generateHTMLTable(s),t=i?this.generatePlainContent(s):"",this.table.options.clipboardCopyFormatter&&(t=this.table.options.clipboardCopyFormatter("plain",t),i=this.table.options.clipboardCopyFormatter("html",i))),window.clipboardData&&window.clipboardData.setData?window.clipboardData.setData("Text",t):e.clipboardData&&e.clipboardData.setData?(e.clipboardData.setData("text/plain",t),i&&e.clipboardData.setData("text/html",i)):e.originalEvent&&e.originalEvent.clipboardData.setData&&(e.originalEvent.clipboardData.setData("text/plain",t),i&&e.originalEvent.clipboardData.setData("text/html",i)),this.dispatchExternal("clipboardCopied",t,i),this.reset())}),(this.mode===!0||this.mode==="paste")&&this.table.element.addEventListener("paste",e=>{this.paste(e)}),this.setPasteParser(this.table.options.clipboardPasteParser),this.setPasteAction(this.table.options.clipboardPasteAction),this.registerTableFunction("copyToClipboard",this.copy.bind(this))}reset(){this.blocked=!0,this.customSelection=!1}generatePlainContent(e){var t=[];return e.forEach(i=>{var s=[];i.columns.forEach(r=>{var o="";if(r)if(i.type==="group"&&(r.value=r.component.getKey()),r.value===null)o="";else switch(typeof r.value){case"object":o=JSON.stringify(r.value);break;case"undefined":o="";break;default:o=r.value}s.push(o)}),t.push(s.join("	"))}),t.join(`
`)}copy(e,t){var i,s;this.blocked=!1,this.customSelection=!1,(this.mode===!0||this.mode==="copy")&&(this.rowRange=e||this.table.options.clipboardCopyRowRange,typeof window.getSelection<"u"&&typeof document.createRange<"u"?(e=document.createRange(),e.selectNodeContents(this.table.element),i=window.getSelection(),i.toString()&&t&&(this.customSelection=i.toString()),i.removeAllRanges(),i.addRange(e)):typeof document.selection<"u"&&typeof document.body.createTextRange<"u"&&(s=document.body.createTextRange(),s.moveToElementText(this.table.element),s.select()),document.execCommand("copy"),i&&i.removeAllRanges())}setPasteAction(e){switch(typeof e){case"string":this.pasteAction=ve.pasteActions[e],this.pasteAction||console.warn("Clipboard Error - No such paste action found:",e);break;case"function":this.pasteAction=e;break}}setPasteParser(e){switch(typeof e){case"string":this.pasteParser=ve.pasteParsers[e],this.pasteParser||console.warn("Clipboard Error - No such paste parser found:",e);break;case"function":this.pasteParser=e;break}}paste(e){var t,i,s;this.checkPasteOrigin(e)&&(t=this.getPasteData(e),i=this.pasteParser.call(this,t),i?(e.preventDefault(),this.table.modExists("mutator")&&(i=this.mutateData(i)),s=this.pasteAction.call(this,i),this.dispatchExternal("clipboardPasted",t,i,s)):this.dispatchExternal("clipboardPasteError",t))}mutateData(e){var t=[];return Array.isArray(e)?e.forEach(i=>{t.push(this.table.modules.mutator.transformRow(i,"clipboard"))}):t=e,t}checkPasteOrigin(e){var t=!0,i=this.confirm("clipboard-paste",[e]);return(i||!["DIV","SPAN"].includes(e.target.tagName))&&(t=!1),t}getPasteData(e){var t;return window.clipboardData&&window.clipboardData.getData?t=window.clipboardData.getData("Text"):e.clipboardData&&e.clipboardData.getData?t=e.clipboardData.getData("text/plain"):e.originalEvent&&e.originalEvent.clipboardData.getData&&(t=e.originalEvent.clipboardData.getData("text/plain")),t}};w(ve,"moduleName","clipboard"),w(ve,"moduleExtensions",qr),w(ve,"pasteActions",Xr),w(ve,"pasteParsers",Kr);let Ei=ve;class Qr{constructor(e){return this._row=e,new Proxy(this,{get:function(t,i,s){return typeof t[i]<"u"?t[i]:t._row.table.componentFunctionBinder.handle("row",t._row,i)}})}getData(e){return this._row.getData(e)}getElement(){return this._row.getElement()}getTable(){return this._row.table}getCells(){var e=[];return this._row.getCells().forEach(function(t){e.push(t.getComponent())}),e}getCell(e){var t=this._row.getCell(e);return t?t.getComponent():!1}_getSelf(){return this._row}}class pn{constructor(e){return this._cell=e,new Proxy(this,{get:function(t,i,s){return typeof t[i]<"u"?t[i]:t._cell.table.componentFunctionBinder.handle("cell",t._cell,i)}})}getValue(){return this._cell.getValue()}getOldValue(){return this._cell.getOldValue()}getInitialValue(){return this._cell.initialValue}getElement(){return this._cell.getElement()}getRow(){return this._cell.row.getComponent()}getData(e){return this._cell.row.getData(e)}getType(){return"cell"}getField(){return this._cell.column.getField()}getColumn(){return this._cell.column.getComponent()}setValue(e,t){typeof t>"u"&&(t=!0),this._cell.setValue(e,t)}restoreOldValue(){this._cell.setValueActual(this._cell.getOldValue())}restoreInitialValue(){this._cell.setValueActual(this._cell.initialValue)}checkHeight(){this._cell.checkHeight()}getTable(){return this._cell.table}_getSelf(){return this._cell}}class Lt extends j{constructor(e,t){super(e.table),this.table=e.table,this.column=e,this.row=t,this.element=null,this.value=null,this.initialValue,this.oldValue=null,this.modules={},this.height=null,this.width=null,this.minWidth=null,this.component=null,this.loaded=!1,this.build()}build(){this.generateElement(),this.setWidth(),this._configureCell(),this.setValueActual(this.column.getFieldValue(this.row.data)),this.initialValue=this.value}generateElement(){this.element=document.createElement("div"),this.element.className="tabulator-cell",this.element.setAttribute("role","gridcell"),this.column.isRowHeader&&this.element.classList.add("tabulator-row-header")}_configureCell(){var e=this.element,t=this.column.getField(),i={top:"flex-start",bottom:"flex-end",middle:"center"},s={left:"flex-start",right:"flex-end",center:"center"};if(e.style.textAlign=this.column.hozAlign,this.column.vertAlign&&(e.style.display="inline-flex",e.style.alignItems=i[this.column.vertAlign]||"",this.column.hozAlign&&(e.style.justifyContent=s[this.column.hozAlign]||"")),t&&e.setAttribute("tabulator-field",t),this.column.definition.cssClass){var r=this.column.definition.cssClass.split(" ");r.forEach(o=>{e.classList.add(o)})}this.dispatch("cell-init",this),this.column.visible||this.hide()}_generateContents(){var e;switch(e=this.chain("cell-format",this,null,()=>this.element.innerHTML=this.value),typeof e){case"object":if(e instanceof Node){for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild);this.element.appendChild(e)}else this.element.innerHTML="",e!=null&&console.warn("Format Error - Formatter has returned a type of object, the only valid formatter object return is an instance of Node, the formatter returned:",e);break;case"undefined":this.element.innerHTML="";break;default:this.element.innerHTML=e}}cellRendered(){this.dispatch("cell-rendered",this)}getElement(e){return this.loaded||(this.loaded=!0,e||this.layoutElement()),this.element}getValue(){return this.value}getOldValue(){return this.oldValue}setValue(e,t,i){var s=this.setValueProcessData(e,t,i);s&&(this.dispatch("cell-value-updated",this),this.cellRendered(),this.column.definition.cellEdited&&this.column.definition.cellEdited.call(this.table,this.getComponent()),this.dispatchExternal("cellEdited",this.getComponent()),this.subscribedExternal("dataChanged")&&this.dispatchExternal("dataChanged",this.table.rowManager.getData()))}setValueProcessData(e,t,i){var s=!1;return(this.value!==e||i)&&(s=!0,t&&(e=this.chain("cell-value-changing",[this,e],null,e))),this.setValueActual(e),s&&this.dispatch("cell-value-changed",this),s}setValueActual(e){this.oldValue=this.value,this.value=e,this.dispatch("cell-value-save-before",this),this.column.setFieldValue(this.row.data,e),this.dispatch("cell-value-save-after",this),this.loaded&&this.layoutElement()}layoutElement(){this._generateContents(),this.dispatch("cell-layout",this)}setWidth(){this.width=this.column.width,this.element.style.width=this.column.widthStyled}clearWidth(){this.width="",this.element.style.width=""}getWidth(){return this.width||this.element.offsetWidth}setMinWidth(){this.minWidth=this.column.minWidth,this.element.style.minWidth=this.column.minWidthStyled}setMaxWidth(){this.maxWidth=this.column.maxWidth,this.element.style.maxWidth=this.column.maxWidthStyled}checkHeight(){this.row.reinitializeHeight()}clearHeight(){this.element.style.height="",this.height=null,this.dispatch("cell-height",this,"")}setHeight(){this.height=this.row.height,this.element.style.height=this.row.heightStyled,this.dispatch("cell-height",this,this.row.heightStyled)}getHeight(){return this.height||this.element.offsetHeight}show(){this.element.style.display=this.column.vertAlign?"inline-flex":""}hide(){this.element.style.display="none"}delete(){this.dispatch("cell-delete",this),!this.table.rowManager.redrawBlock&&this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.element=!1,this.column.deleteCell(this),this.row.deleteCell(this),this.calcs={}}getIndex(){return this.row.getCellIndex(this)}getComponent(){return this.component||(this.component=new pn(this)),this.component}}class gn{constructor(e){return this._column=e,this.type="ColumnComponent",new Proxy(this,{get:function(t,i,s){return typeof t[i]<"u"?t[i]:t._column.table.componentFunctionBinder.handle("column",t._column,i)}})}getElement(){return this._column.getElement()}getDefinition(){return this._column.getDefinition()}getField(){return this._column.getField()}getTitleDownload(){return this._column.getTitleDownload()}getCells(){var e=[];return this._column.cells.forEach(function(t){e.push(t.getComponent())}),e}isVisible(){return this._column.visible}show(){this._column.isGroup?this._column.columns.forEach(function(e){e.show()}):this._column.show()}hide(){this._column.isGroup?this._column.columns.forEach(function(e){e.hide()}):this._column.hide()}toggle(){this._column.visible?this.hide():this.show()}delete(){return this._column.delete()}getSubColumns(){var e=[];return this._column.columns.length&&this._column.columns.forEach(function(t){e.push(t.getComponent())}),e}getParentColumn(){return this._column.getParentComponent()}_getSelf(){return this._column}scrollTo(e,t){return this._column.table.columnManager.scrollToColumn(this._column,e,t)}getTable(){return this._column.table}move(e,t){var i=this._column.table.columnManager.findColumn(e);i?this._column.table.columnManager.moveColumn(this._column,i,t):console.warn("Move Error - No matching column found:",i)}getNextColumn(){var e=this._column.nextColumn();return e?e.getComponent():!1}getPrevColumn(){var e=this._column.prevColumn();return e?e.getComponent():!1}updateDefinition(e){return this._column.updateDefinition(e)}getWidth(){return this._column.getWidth()}setWidth(e){var t;return e===!0?t=this._column.reinitializeWidth(!0):t=this._column.setWidth(e),this._column.table.columnManager.rerenderColumns(!0),t}}var mn={title:void 0,field:void 0,columns:void 0,visible:void 0,hozAlign:void 0,vertAlign:void 0,width:void 0,minWidth:40,maxWidth:void 0,maxInitialWidth:void 0,cssClass:void 0,variableHeight:void 0,headerVertical:void 0,headerHozAlign:void 0,headerWordWrap:!1,editableTitle:void 0};const ze=class ze extends j{constructor(e,t,i){super(t.table),this.definition=e,this.parent=t,this.type="column",this.columns=[],this.cells=[],this.isGroup=!1,this.isRowHeader=i,this.element=this.createElement(),this.contentElement=!1,this.titleHolderElement=!1,this.titleElement=!1,this.groupElement=this.createGroupElement(),this.hozAlign="",this.vertAlign="",this.field="",this.fieldStructure="",this.getFieldValue="",this.setFieldValue="",this.titleDownload=null,this.titleFormatterRendered=!1,this.mapDefinitions(),this.setField(this.definition.field),this.modules={},this.width=null,this.widthStyled="",this.maxWidth=null,this.maxWidthStyled="",this.maxInitialWidth=null,this.minWidth=null,this.minWidthStyled="",this.widthFixed=!1,this.visible=!0,this.component=null,this.definition.columns?(this.isGroup=!0,this.definition.columns.forEach((s,r)=>{var o=new ze(s,this);this.attachColumn(o)}),this.checkColumnVisibility()):t.registerColumnField(this),this._initialize()}createElement(){var e=document.createElement("div");switch(e.classList.add("tabulator-col"),e.setAttribute("role","columnheader"),e.setAttribute("aria-sort","none"),this.isRowHeader&&e.classList.add("tabulator-row-header"),this.table.options.columnHeaderVertAlign){case"middle":e.style.justifyContent="center";break;case"bottom":e.style.justifyContent="flex-end";break}return e}createGroupElement(){var e=document.createElement("div");return e.classList.add("tabulator-col-group-cols"),e}mapDefinitions(){var e=this.table.options.columnDefaults;if(e)for(let t in e)typeof this.definition[t]>"u"&&(this.definition[t]=e[t]);this.definition=this.table.columnManager.optionsList.generate(ze.defaultOptionList,this.definition)}checkDefinition(){Object.keys(this.definition).forEach(e=>{ze.defaultOptionList.indexOf(e)===-1&&console.warn("Invalid column definition option in '"+(this.field||this.definition.title)+"' column:",e)})}setField(e){this.field=e,this.fieldStructure=e?this.table.options.nestedFieldSeparator?e.split(this.table.options.nestedFieldSeparator):[e]:[],this.getFieldValue=this.fieldStructure.length>1?this._getNestedData:this._getFlatData,this.setFieldValue=this.fieldStructure.length>1?this._setNestedData:this._setFlatData}registerColumnPosition(e){this.parent.registerColumnPosition(e)}registerColumnField(e){this.parent.registerColumnField(e)}reRegisterPosition(){this.isGroup?this.columns.forEach(function(e){e.reRegisterPosition()}):this.registerColumnPosition(this)}_initialize(){for(var e=this.definition;this.element.firstChild;)this.element.removeChild(this.element.firstChild);e.headerVertical&&(this.element.classList.add("tabulator-col-vertical"),e.headerVertical==="flip"&&this.element.classList.add("tabulator-col-vertical-flip")),this.contentElement=this._buildColumnHeaderContent(),this.element.appendChild(this.contentElement),this.isGroup?this._buildGroupHeader():this._buildColumnHeader(),this.dispatch("column-init",this)}_buildColumnHeader(){var e=this.definition;if(this.dispatch("column-layout",this),typeof e.visible<"u"&&(e.visible?this.show(!0):this.hide(!0)),e.cssClass){var t=e.cssClass.split(" ");t.forEach(i=>{this.element.classList.add(i)})}e.field&&this.element.setAttribute("tabulator-field",e.field),this.setMinWidth(parseInt(e.minWidth)),e.maxInitialWidth&&(this.maxInitialWidth=parseInt(e.maxInitialWidth)),e.maxWidth&&this.setMaxWidth(parseInt(e.maxWidth)),this.reinitializeWidth(),this.hozAlign=this.definition.hozAlign,this.vertAlign=this.definition.vertAlign,this.titleElement.style.textAlign=this.definition.headerHozAlign}_buildColumnHeaderContent(){var e=document.createElement("div");return e.classList.add("tabulator-col-content"),this.titleHolderElement=document.createElement("div"),this.titleHolderElement.classList.add("tabulator-col-title-holder"),e.appendChild(this.titleHolderElement),this.titleElement=this._buildColumnHeaderTitle(),this.titleHolderElement.appendChild(this.titleElement),e}_buildColumnHeaderTitle(){var e=this.definition,t=document.createElement("div");if(t.classList.add("tabulator-col-title"),e.headerWordWrap&&t.classList.add("tabulator-col-title-wrap"),e.editableTitle){var i=document.createElement("input");i.classList.add("tabulator-title-editor"),i.addEventListener("click",s=>{s.stopPropagation(),i.focus()}),i.addEventListener("mousedown",s=>{s.stopPropagation()}),i.addEventListener("change",()=>{e.title=i.value,this.dispatchExternal("columnTitleChanged",this.getComponent())}),t.appendChild(i),e.field?this.langBind("columns|"+e.field,s=>{i.value=s||e.title||"&nbsp;"}):i.value=e.title||"&nbsp;"}else e.field?this.langBind("columns|"+e.field,s=>{this._formatColumnHeaderTitle(t,s||e.title||"&nbsp;")}):this._formatColumnHeaderTitle(t,e.title||"&nbsp;");return t}_formatColumnHeaderTitle(e,t){var i=this.chain("column-format",[this,t,e],null,()=>t);switch(typeof i){case"object":i instanceof Node?e.appendChild(i):(e.innerHTML="",console.warn("Format Error - Title formatter has returned a type of object, the only valid formatter object return is an instance of Node, the formatter returned:",i));break;case"undefined":e.innerHTML="";break;default:e.innerHTML=i}}_buildGroupHeader(){if(this.element.classList.add("tabulator-col-group"),this.element.setAttribute("role","columngroup"),this.element.setAttribute("aria-title",this.definition.title),this.definition.cssClass){var e=this.definition.cssClass.split(" ");e.forEach(t=>{this.element.classList.add(t)})}this.titleElement.style.textAlign=this.definition.headerHozAlign,this.element.appendChild(this.groupElement)}_getFlatData(e){return e[this.field]}_getNestedData(e){var t=e,i=this.fieldStructure,s=i.length,r;for(let o=0;o<s&&(t=t[i[o]],r=t,!!t);o++);return r}_setFlatData(e,t){this.field&&(e[this.field]=t)}_setNestedData(e,t){var i=e,s=this.fieldStructure,r=s.length;for(let o=0;o<r;o++)if(o==r-1)i[s[o]]=t;else{if(!i[s[o]])if(typeof t<"u")i[s[o]]={};else break;i=i[s[o]]}}attachColumn(e){this.groupElement?(this.columns.push(e),this.groupElement.appendChild(e.getElement()),e.columnRendered()):console.warn("Column Warning - Column being attached to another column instead of column group")}verticalAlign(e,t){var i=this.parent.isGroup?this.parent.getGroupElement().clientHeight:t||this.parent.getHeadersElement().clientHeight;this.element.style.height=i+"px",this.dispatch("column-height",this,this.element.style.height),this.isGroup&&(this.groupElement.style.minHeight=i-this.contentElement.offsetHeight+"px"),this.columns.forEach(function(s){s.verticalAlign(e)})}clearVerticalAlign(){this.element.style.paddingTop="",this.element.style.height="",this.element.style.minHeight="",this.groupElement.style.minHeight="",this.columns.forEach(function(e){e.clearVerticalAlign()}),this.dispatch("column-height",this,"")}getElement(){return this.element}getGroupElement(){return this.groupElement}getField(){return this.field}getTitleDownload(){return this.titleDownload}getFirstColumn(){return this.isGroup?this.columns.length?this.columns[0].getFirstColumn():!1:this}getLastColumn(){return this.isGroup?this.columns.length?this.columns[this.columns.length-1].getLastColumn():!1:this}getColumns(e){var t=[];return e?this.columns.forEach(i=>{t.push(i),t=t.concat(i.getColumns(!0))}):t=this.columns,t}getCells(){return this.cells}getTopColumn(){return this.parent.isGroup?this.parent.getTopColumn():this}getDefinition(e){var t=[];return this.isGroup&&e&&(this.columns.forEach(function(i){t.push(i.getDefinition(!0))}),this.definition.columns=t),this.definition}checkColumnVisibility(){var e=!1;this.columns.forEach(function(t){t.visible&&(e=!0)}),e?(this.show(),this.dispatchExternal("columnVisibilityChanged",this.getComponent(),!1)):this.hide()}show(e,t){this.visible||(this.visible=!0,this.element.style.display="",this.parent.isGroup&&this.parent.checkColumnVisibility(),this.cells.forEach(function(i){i.show()}),!this.isGroup&&this.width===null&&this.reinitializeWidth(),this.table.columnManager.verticalAlignHeaders(),this.dispatch("column-show",this,t),e||this.dispatchExternal("columnVisibilityChanged",this.getComponent(),!0),this.parent.isGroup&&this.parent.matchChildWidths(),this.silent||this.table.columnManager.rerenderColumns())}hide(e,t){this.visible&&(this.visible=!1,this.element.style.display="none",this.table.columnManager.verticalAlignHeaders(),this.parent.isGroup&&this.parent.checkColumnVisibility(),this.cells.forEach(function(i){i.hide()}),this.dispatch("column-hide",this,t),e||this.dispatchExternal("columnVisibilityChanged",this.getComponent(),!1),this.parent.isGroup&&this.parent.matchChildWidths(),this.silent||this.table.columnManager.rerenderColumns())}matchChildWidths(){var e=0;this.contentElement&&this.columns.length&&(this.columns.forEach(function(t){t.visible&&(e+=t.getWidth())}),this.contentElement.style.maxWidth=e-1+"px",this.table.initialized&&(this.element.style.width=e+"px"),this.parent.isGroup&&this.parent.matchChildWidths())}removeChild(e){var t=this.columns.indexOf(e);t>-1&&this.columns.splice(t,1),this.columns.length||this.delete()}setWidth(e){this.widthFixed=!0,this.setWidthActual(e)}setWidthActual(e){isNaN(e)&&(e=Math.floor(this.table.element.clientWidth/100*parseInt(e))),e=Math.max(this.minWidth,e),this.maxWidth&&(e=Math.min(this.maxWidth,e)),this.width=e,this.widthStyled=e?e+"px":"",this.element.style.width=this.widthStyled,this.isGroup||this.cells.forEach(function(t){t.setWidth()}),this.parent.isGroup&&this.parent.matchChildWidths(),this.dispatch("column-width",this),this.subscribedExternal("columnWidth")&&this.dispatchExternal("columnWidth",this.getComponent())}checkCellHeights(){var e=[];this.cells.forEach(function(t){t.row.heightInitialized&&(t.row.getElement().offsetParent!==null?(e.push(t.row),t.row.clearCellHeight()):t.row.heightInitialized=!1)}),e.forEach(function(t){t.calcHeight()}),e.forEach(function(t){t.setCellHeight()})}getWidth(){var e=0;return this.isGroup?this.columns.forEach(function(t){t.visible&&(e+=t.getWidth())}):e=this.width,e}getLeftOffset(){var e=this.element.offsetLeft;return this.parent.isGroup&&(e+=this.parent.getLeftOffset()),e}getHeight(){return Math.ceil(this.element.getBoundingClientRect().height)}setMinWidth(e){this.maxWidth&&e>this.maxWidth&&(e=this.maxWidth,console.warn("the minWidth ("+e+"px) for column '"+this.field+"' cannot be bigger that its maxWidth ("+this.maxWidthStyled+")")),this.minWidth=e,this.minWidthStyled=e?e+"px":"",this.element.style.minWidth=this.minWidthStyled,this.cells.forEach(function(t){t.setMinWidth()})}setMaxWidth(e){this.minWidth&&e<this.minWidth&&(e=this.minWidth,console.warn("the maxWidth ("+e+"px) for column '"+this.field+"' cannot be smaller that its minWidth ("+this.minWidthStyled+")")),this.maxWidth=e,this.maxWidthStyled=e?e+"px":"",this.element.style.maxWidth=this.maxWidthStyled,this.cells.forEach(function(t){t.setMaxWidth()})}delete(){return new Promise((e,t)=>{this.isGroup&&this.columns.forEach(function(s){s.delete()}),this.dispatch("column-delete",this);var i=this.cells.length;for(let s=0;s<i;s++)this.cells[0].delete();this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.element=!1,this.contentElement=!1,this.titleElement=!1,this.groupElement=!1,this.parent.isGroup&&this.parent.removeChild(this),this.table.columnManager.deregisterColumn(this),this.table.columnManager.rerenderColumns(!0),this.dispatch("column-deleted",this),e()})}columnRendered(){this.titleFormatterRendered&&this.titleFormatterRendered(),this.dispatch("column-rendered",this)}generateCell(e){var t=new Lt(this,e);return this.cells.push(t),t}nextColumn(){var e=this.table.columnManager.findColumnIndex(this);return e>-1?this._nextVisibleColumn(e+1):!1}_nextVisibleColumn(e){var t=this.table.columnManager.getColumnByIndex(e);return!t||t.visible?t:this._nextVisibleColumn(e+1)}prevColumn(){var e=this.table.columnManager.findColumnIndex(this);return e>-1?this._prevVisibleColumn(e-1):!1}_prevVisibleColumn(e){var t=this.table.columnManager.getColumnByIndex(e);return!t||t.visible?t:this._prevVisibleColumn(e-1)}reinitializeWidth(e){this.widthFixed=!1,typeof this.definition.width<"u"&&!e&&this.setWidth(this.definition.width),this.dispatch("column-width-fit-before",this),this.fitToData(e),this.dispatch("column-width-fit-after",this)}fitToData(e){if(!this.isGroup){this.widthFixed||(this.element.style.width="",this.cells.forEach(s=>{s.clearWidth()}));var t=this.element.offsetWidth;if((!this.width||!this.widthFixed)&&(this.cells.forEach(s=>{var r=s.getWidth();r>t&&(t=r)}),t)){var i=t+1;e?this.setWidth(i):(this.maxInitialWidth&&!e&&(i=Math.min(i,this.maxInitialWidth)),this.setWidthActual(i))}}}updateDefinition(e){var t;return this.isGroup||this.parent.isGroup?(console.error("Column Update Error - The updateDefinition function is only available on ungrouped columns"),Promise.reject("Column Update Error - The updateDefinition function is only available on columns, not column groups")):(t=Object.assign({},this.getDefinition()),t=Object.assign(t,e),this.table.columnManager.addColumn(t,!1,this).then(i=>(t.field==this.field&&(this.field=!1),this.delete().then(()=>i.getComponent()))))}deleteCell(e){var t=this.cells.indexOf(e);t>-1&&this.cells.splice(t,1)}getComponent(){return this.component||(this.component=new gn(this)),this.component}getPosition(){return this.table.columnManager.getVisibleColumnsByIndex().indexOf(this)+1}getParentComponent(){return this.parent instanceof ze?this.parent.getComponent():!1}};w(ze,"defaultOptionList",mn);let Be=ze;class Zt{constructor(e){return this._row=e,new Proxy(this,{get:function(t,i,s){return typeof t[i]<"u"?t[i]:t._row.table.componentFunctionBinder.handle("row",t._row,i)}})}getData(e){return this._row.getData(e)}getElement(){return this._row.getElement()}getCells(){var e=[];return this._row.getCells().forEach(function(t){e.push(t.getComponent())}),e}getCell(e){var t=this._row.getCell(e);return t?t.getComponent():!1}getIndex(){return this._row.getData("data")[this._row.table.options.index]}getPosition(){return this._row.getPosition()}watchPosition(e){return this._row.watchPosition(e)}delete(){return this._row.delete()}scrollTo(e,t){return this._row.table.rowManager.scrollToRow(this._row,e,t)}move(e,t){this._row.moveToRow(e,t)}update(e){return this._row.updateData(e)}normalizeHeight(){this._row.normalizeHeight(!0)}_getSelf(){return this._row}reformat(){return this._row.reinitialize()}getTable(){return this._row.table}getNextRow(){var e=this._row.nextRow();return e&&e.getComponent()}getPrevRow(){var e=this._row.prevRow();return e&&e.getComponent()}}class U extends j{constructor(e,t,i="row"){super(t.table),this.parent=t,this.data={},this.type=i,this.element=!1,this.modules={},this.cells=[],this.height=0,this.heightStyled="",this.manualHeight=!1,this.outerHeight=0,this.initialized=!1,this.heightInitialized=!1,this.position=0,this.positionWatchers=[],this.component=null,this.created=!1,this.setData(e)}create(){this.created||(this.created=!0,this.generateElement())}createElement(){var e=document.createElement("div");e.classList.add("tabulator-row"),e.setAttribute("role","row"),this.element=e}getElement(){return this.create(),this.element}detachElement(){this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}generateElement(){this.createElement(),this.dispatch("row-init",this)}generateCells(){this.cells=this.table.columnManager.generateCells(this)}initialize(e,t){if(this.create(),!this.initialized||e){for(this.deleteCells();this.element.firstChild;)this.element.removeChild(this.element.firstChild);this.dispatch("row-layout-before",this),this.generateCells(),this.initialized=!0,this.table.columnManager.renderer.renderRowCells(this,t),e&&this.normalizeHeight(),this.dispatch("row-layout",this),this.table.options.rowFormatter&&this.table.options.rowFormatter(this.getComponent()),this.dispatch("row-layout-after",this)}else this.table.columnManager.renderer.rerenderRowCells(this,t)}rendered(){this.cells.forEach(e=>{e.cellRendered()})}reinitializeHeight(){this.heightInitialized=!1,this.element&&this.element.offsetParent!==null&&this.normalizeHeight(!0)}deinitialize(){this.initialized=!1}deinitializeHeight(){this.heightInitialized=!1}reinitialize(e){this.initialized=!1,this.heightInitialized=!1,this.manualHeight||(this.height=0,this.heightStyled=""),this.element&&this.element.offsetParent!==null&&this.initialize(!0),this.dispatch("row-relayout",this)}calcHeight(e){var t=0,i=0;this.table.options.rowHeight?this.height=this.table.options.rowHeight:(i=this.calcMinHeight(),t=this.calcMaxHeight(),e?this.height=Math.max(t,i):this.height=this.manualHeight?this.height:Math.max(t,i)),this.heightStyled=this.height?this.height+"px":"",this.outerHeight=this.element.offsetHeight}calcMinHeight(){return this.table.options.resizableRows?this.element.clientHeight:0}calcMaxHeight(){var e=0;return this.cells.forEach(function(t){var i=t.getHeight();i>e&&(e=i)}),e}setCellHeight(){this.cells.forEach(function(e){e.setHeight()}),this.heightInitialized=!0}clearCellHeight(){this.cells.forEach(function(e){e.clearHeight()})}normalizeHeight(e){e&&!this.table.options.rowHeight&&this.clearCellHeight(),this.calcHeight(e),this.setCellHeight()}setHeight(e,t){(this.height!=e||t)&&(this.manualHeight=!0,this.height=e,this.heightStyled=e?e+"px":"",this.setCellHeight(),this.outerHeight=this.element.offsetHeight,this.subscribedExternal("rowHeight")&&this.dispatchExternal("rowHeight",this.getComponent()))}getHeight(){return this.outerHeight}getWidth(){return this.element.offsetWidth}deleteCell(e){var t=this.cells.indexOf(e);t>-1&&this.cells.splice(t,1)}setData(e){this.data=this.chain("row-data-init-before",[this,e],void 0,e),this.dispatch("row-data-init-after",this)}updateData(e){var t=this.element&&P.elVisible(this.element),i={},s;return new Promise((r,o)=>{typeof e=="string"&&(e=JSON.parse(e)),this.dispatch("row-data-save-before",this),this.subscribed("row-data-changing")&&(i=Object.assign(i,this.data),i=Object.assign(i,e)),s=this.chain("row-data-changing",[this,i,e],null,e);for(let a in s)this.data[a]=s[a];this.dispatch("row-data-save-after",this);for(let a in e)this.table.columnManager.getColumnsByFieldRoot(a).forEach(h=>{let d=this.getCell(h.getField());if(d){let c=h.getFieldValue(s);d.getValue()!==c&&(d.setValueProcessData(c),t&&d.cellRendered())}});t?(this.normalizeHeight(!0),this.table.options.rowFormatter&&this.table.options.rowFormatter(this.getComponent())):(this.initialized=!1,this.height=0,this.heightStyled=""),this.dispatch("row-data-changed",this,t,e),this.dispatchExternal("rowUpdated",this.getComponent()),this.subscribedExternal("dataChanged")&&this.dispatchExternal("dataChanged",this.table.rowManager.getData()),r()})}getData(e){return e?this.chain("row-data-retrieve",[this,e],null,this.data):this.data}getCell(e){var t=!1;return e=this.table.columnManager.findColumn(e),!this.initialized&&this.cells.length===0&&this.generateCells(),t=this.cells.find(function(i){return i.column===e}),t}getCellIndex(e){return this.cells.findIndex(function(t){return t===e})}findCell(e){return this.cells.find(t=>t.element===e)}getCells(){return!this.initialized&&this.cells.length===0&&this.generateCells(),this.cells}nextRow(){var e=this.table.rowManager.nextDisplayRow(this,!0);return e||!1}prevRow(){var e=this.table.rowManager.prevDisplayRow(this,!0);return e||!1}moveToRow(e,t){var i=this.table.rowManager.findRow(e);i?(this.table.rowManager.moveRowActual(this,i,!t),this.table.rowManager.refreshActiveData("display",!1,!0)):console.warn("Move Error - No matching row found:",e)}delete(){return this.dispatch("row-delete",this),this.deleteActual(),Promise.resolve()}deleteActual(e){this.detachModules(),this.table.rowManager.deleteRow(this,e),this.deleteCells(),this.initialized=!1,this.heightInitialized=!1,this.element=!1,this.dispatch("row-deleted",this)}detachModules(){this.dispatch("row-deleting",this)}deleteCells(){var e=this.cells.length;for(let t=0;t<e;t++)this.cells[0].delete()}wipe(){if(this.detachModules(),this.deleteCells(),this.element){for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild);this.element.parentNode&&this.element.parentNode.removeChild(this.element)}this.element=!1,this.modules={}}isDisplayed(){return this.table.rowManager.getDisplayRows().includes(this)}getPosition(){return this.isDisplayed()?this.position:!1}setPosition(e){e!=this.position&&(this.position=e,this.positionWatchers.forEach(t=>{t(this.position)}))}watchPosition(e){this.positionWatchers.push(e),e(this.position)}getGroup(){return this.modules.group||!1}getComponent(){return this.component||(this.component=new Zt(this)),this.component}}var eo={avg:function(n,e,t){var i=0,s=typeof t.precision<"u"?t.precision:2;return n.length&&(i=n.reduce(function(r,o){return Number(r)+Number(o)}),i=i/n.length,i=s!==!1?i.toFixed(s):i),parseFloat(i).toString()},max:function(n,e,t){var i=null,s=typeof t.precision<"u"?t.precision:!1;return n.forEach(function(r){r=Number(r),(r>i||i===null)&&(i=r)}),i!==null?s!==!1?i.toFixed(s):i:""},min:function(n,e,t){var i=null,s=typeof t.precision<"u"?t.precision:!1;return n.forEach(function(r){r=Number(r),(r<i||i===null)&&(i=r)}),i!==null?s!==!1?i.toFixed(s):i:""},sum:function(n,e,t){var i=0,s=typeof t.precision<"u"?t.precision:!1;return n.length&&n.forEach(function(r){r=Number(r),i+=isNaN(r)?0:Number(r)}),s!==!1?i.toFixed(s):i},concat:function(n,e,t){var i=0;return n.length&&(i=n.reduce(function(s,r){return String(s)+String(r)})),i},count:function(n,e,t){var i=0;return n.length&&n.forEach(function(s){s&&i++}),i},unique:function(n,e,t){var i=n.filter((s,r)=>(n||s===0)&&n.indexOf(s)===r);return i.length}};const we=class we extends D{constructor(e){super(e),this.topCalcs=[],this.botCalcs=[],this.genColumn=!1,this.topElement=this.createElement(),this.botElement=this.createElement(),this.topRow=!1,this.botRow=!1,this.topInitialized=!1,this.botInitialized=!1,this.blocked=!1,this.recalcAfterBlock=!1,this.registerTableOption("columnCalcs",!0),this.registerColumnOption("topCalc"),this.registerColumnOption("topCalcParams"),this.registerColumnOption("topCalcFormatter"),this.registerColumnOption("topCalcFormatterParams"),this.registerColumnOption("bottomCalc"),this.registerColumnOption("bottomCalcParams"),this.registerColumnOption("bottomCalcFormatter"),this.registerColumnOption("bottomCalcFormatterParams")}createElement(){var e=document.createElement("div");return e.classList.add("tabulator-calcs-holder"),e}initialize(){this.genColumn=new Be({field:"value"},this),this.subscribe("cell-value-changed",this.cellValueChanged.bind(this)),this.subscribe("column-init",this.initializeColumnCheck.bind(this)),this.subscribe("row-deleted",this.rowsUpdated.bind(this)),this.subscribe("scroll-horizontal",this.scrollHorizontal.bind(this)),this.subscribe("row-added",this.rowsUpdated.bind(this)),this.subscribe("column-moved",this.recalcActiveRows.bind(this)),this.subscribe("column-add",this.recalcActiveRows.bind(this)),this.subscribe("data-refreshed",this.recalcActiveRowsRefresh.bind(this)),this.subscribe("table-redraw",this.tableRedraw.bind(this)),this.subscribe("rows-visible",this.visibleRows.bind(this)),this.subscribe("scrollbar-vertical",this.adjustForScrollbar.bind(this)),this.subscribe("redraw-blocked",this.blockRedraw.bind(this)),this.subscribe("redraw-restored",this.restoreRedraw.bind(this)),this.subscribe("table-redrawing",this.resizeHolderWidth.bind(this)),this.subscribe("column-resized",this.resizeHolderWidth.bind(this)),this.subscribe("column-show",this.resizeHolderWidth.bind(this)),this.subscribe("column-hide",this.resizeHolderWidth.bind(this)),this.registerTableFunction("getCalcResults",this.getResults.bind(this)),this.registerTableFunction("recalc",this.userRecalc.bind(this)),this.resizeHolderWidth()}resizeHolderWidth(){this.topElement.style.minWidth=this.table.columnManager.headersElement.offsetWidth+"px"}tableRedraw(e){this.recalc(this.table.rowManager.activeRows),e&&this.redraw()}blockRedraw(){this.blocked=!0,this.recalcAfterBlock=!1}restoreRedraw(){this.blocked=!1,this.recalcAfterBlock&&(this.recalcAfterBlock=!1,this.recalcActiveRowsRefresh())}userRecalc(){this.recalc(this.table.rowManager.activeRows)}blockCheck(){return this.blocked&&(this.recalcAfterBlock=!0),this.blocked}visibleRows(e,t){return this.topRow&&t.unshift(this.topRow),this.botRow&&t.push(this.botRow),t}rowsUpdated(e){this.table.options.groupBy?this.recalcRowGroup(e):this.recalcActiveRows()}recalcActiveRowsRefresh(){this.table.options.groupBy&&this.table.options.dataTreeStartExpanded&&this.table.options.dataTree?this.recalcAll():this.recalcActiveRows()}recalcActiveRows(){this.recalc(this.table.rowManager.activeRows)}cellValueChanged(e){(e.column.definition.topCalc||e.column.definition.bottomCalc)&&(this.table.options.groupBy?((this.table.options.columnCalcs=="table"||this.table.options.columnCalcs=="both")&&this.recalcActiveRows(),this.table.options.columnCalcs!="table"&&this.recalcRowGroup(e.row)):this.recalcActiveRows())}initializeColumnCheck(e){(e.definition.topCalc||e.definition.bottomCalc)&&this.initializeColumn(e)}initializeColumn(e){var t=e.definition,i={topCalcParams:t.topCalcParams||{},botCalcParams:t.bottomCalcParams||{}};if(t.topCalc){switch(typeof t.topCalc){case"string":we.calculations[t.topCalc]?i.topCalc=we.calculations[t.topCalc]:console.warn("Column Calc Error - No such calculation found, ignoring: ",t.topCalc);break;case"function":i.topCalc=t.topCalc;break}i.topCalc&&(e.modules.columnCalcs=i,this.topCalcs.push(e),this.table.options.columnCalcs!="group"&&this.initializeTopRow())}if(t.bottomCalc){switch(typeof t.bottomCalc){case"string":we.calculations[t.bottomCalc]?i.botCalc=we.calculations[t.bottomCalc]:console.warn("Column Calc Error - No such calculation found, ignoring: ",t.bottomCalc);break;case"function":i.botCalc=t.bottomCalc;break}i.botCalc&&(e.modules.columnCalcs=i,this.botCalcs.push(e),this.table.options.columnCalcs!="group"&&this.initializeBottomRow())}}registerColumnField(){}removeCalcs(){var e=!1;this.topInitialized&&(this.topInitialized=!1,this.topElement.parentNode.removeChild(this.topElement),e=!0),this.botInitialized&&(this.botInitialized=!1,this.footerRemove(this.botElement),e=!0),e&&this.table.rowManager.adjustTableSize()}reinitializeCalcs(){this.topCalcs.length&&this.initializeTopRow(),this.botCalcs.length&&this.initializeBottomRow()}initializeTopRow(){var e=document.createDocumentFragment();this.topInitialized||(e.appendChild(document.createElement("br")),e.appendChild(this.topElement),this.table.columnManager.getContentsElement().insertBefore(e,this.table.columnManager.headersElement.nextSibling),this.topInitialized=!0)}initializeBottomRow(){this.botInitialized||(this.footerPrepend(this.botElement),this.botInitialized=!0)}scrollHorizontal(e){this.botInitialized&&this.botRow&&(this.botElement.scrollLeft=e)}recalc(e){var t,i;if(!this.blockCheck()&&(this.topInitialized||this.botInitialized)){if(t=this.rowsToData(e),this.topInitialized){for(this.topRow&&this.topRow.deleteCells(),i=this.generateRow("top",t),this.topRow=i;this.topElement.firstChild;)this.topElement.removeChild(this.topElement.firstChild);this.topElement.appendChild(i.getElement()),i.initialize(!0)}if(this.botInitialized){for(this.botRow&&this.botRow.deleteCells(),i=this.generateRow("bottom",t),this.botRow=i;this.botElement.firstChild;)this.botElement.removeChild(this.botElement.firstChild);this.botElement.appendChild(i.getElement()),i.initialize(!0)}this.table.rowManager.adjustTableSize(),this.table.modExists("frozenColumns")&&this.table.modules.frozenColumns.layout()}}recalcRowGroup(e){this.recalcGroup(this.table.modules.groupRows.getRowGroup(e))}recalcAll(){if((this.topCalcs.length||this.botCalcs.length)&&(this.table.options.columnCalcs!=="group"&&this.recalcActiveRows(),this.table.options.groupBy&&this.table.options.columnCalcs!=="table")){var e=this.table.modules.groupRows.getChildGroups();e.forEach(t=>{this.recalcGroup(t)})}}recalcGroup(e){var t,i;this.blockCheck()||e&&e.calcs&&(e.calcs.bottom&&(t=this.rowsToData(e.rows),i=this.generateRowData("bottom",t),e.calcs.bottom.updateData(i),e.calcs.bottom.reinitialize()),e.calcs.top&&(t=this.rowsToData(e.rows),i=this.generateRowData("top",t),e.calcs.top.updateData(i),e.calcs.top.reinitialize()))}generateTopRow(e){return this.generateRow("top",this.rowsToData(e))}generateBottomRow(e){return this.generateRow("bottom",this.rowsToData(e))}rowsToData(e){var t=[],i=this.table.options.dataTree&&this.table.options.dataTreeChildColumnCalcs,s=this.table.modules.dataTree;return e.forEach(r=>{var o;t.push(r.getData()),i&&((o=r.modules.dataTree)!=null&&o.open)&&this.rowsToData(s.getFilteredTreeChildren(r)).forEach(a=>{t.push(r)})}),t}generateRow(e,t){var i=this.generateRowData(e,t),s;return this.table.modExists("mutator")&&this.table.modules.mutator.disable(),s=new U(i,this,"calc"),this.table.modExists("mutator")&&this.table.modules.mutator.enable(),s.getElement().classList.add("tabulator-calcs","tabulator-calcs-"+e),s.component=!1,s.getComponent=()=>(s.component||(s.component=new Qr(s)),s.component),s.generateCells=()=>{var r=[];this.table.columnManager.columnsByIndex.forEach(o=>{this.genColumn.setField(o.getField()),this.genColumn.hozAlign=o.hozAlign,o.definition[e+"CalcFormatter"]&&this.table.modExists("format")?this.genColumn.modules.format={formatter:this.table.modules.format.lookupFormatter(o.definition[e+"CalcFormatter"]),params:o.definition[e+"CalcFormatterParams"]||{}}:this.genColumn.modules.format={formatter:this.table.modules.format.lookupFormatter("plaintext"),params:{}},this.genColumn.definition.cssClass=o.definition.cssClass;var a=new Lt(this.genColumn,s);a.getElement(),a.column=o,a.setWidth(),o.cells.push(a),r.push(a),o.visible||a.hide()}),s.cells=r},s}generateRowData(e,t){var i={},s=e=="top"?this.topCalcs:this.botCalcs,r=e=="top"?"topCalc":"botCalc",o,a;return s.forEach(function(l){var h=[];l.modules.columnCalcs&&l.modules.columnCalcs[r]&&(t.forEach(function(d){h.push(l.getFieldValue(d))}),a=r+"Params",o=typeof l.modules.columnCalcs[a]=="function"?l.modules.columnCalcs[a](h,t):l.modules.columnCalcs[a],l.setFieldValue(i,l.modules.columnCalcs[r](h,t,o)))}),i}hasTopCalcs(){return!!this.topCalcs.length}hasBottomCalcs(){return!!this.botCalcs.length}redraw(){this.topRow&&this.topRow.normalizeHeight(!0),this.botRow&&this.botRow.normalizeHeight(!0)}getResults(){var e={},t;return this.table.options.groupBy&&this.table.modExists("groupRows")?(t=this.table.modules.groupRows.getGroups(!0),t.forEach(i=>{e[i.getKey()]=this.getGroupResults(i)})):e={top:this.topRow?this.topRow.getData():{},bottom:this.botRow?this.botRow.getData():{}},e}getGroupResults(e){var t=e._getSelf(),i=e.getSubGroups(),s={},r={};return i.forEach(o=>{s[o.getKey()]=this.getGroupResults(o)}),r={top:t.calcs.top?t.calcs.top.getData():{},bottom:t.calcs.bottom?t.calcs.bottom.getData():{},groups:s},r}adjustForScrollbar(e){this.botRow&&(this.table.rtl?this.botElement.style.paddingLeft=e+"px":this.botElement.style.paddingRight=e+"px")}};w(we,"moduleName","columnCalcs"),w(we,"calculations",eo);let Ri=we;class bn extends D{constructor(e){super(e),this.indent=10,this.field="",this.collapseEl=null,this.expandEl=null,this.branchEl=null,this.elementField=!1,this.startOpen=function(){},this.registerTableOption("dataTree",!1),this.registerTableOption("dataTreeFilter",!0),this.registerTableOption("dataTreeSort",!0),this.registerTableOption("dataTreeElementColumn",!1),this.registerTableOption("dataTreeBranchElement",!0),this.registerTableOption("dataTreeChildIndent",9),this.registerTableOption("dataTreeChildField","_children"),this.registerTableOption("dataTreeCollapseElement",!1),this.registerTableOption("dataTreeExpandElement",!1),this.registerTableOption("dataTreeStartExpanded",!1),this.registerTableOption("dataTreeChildColumnCalcs",!1),this.registerTableOption("dataTreeSelectPropagate",!1),this.registerComponentFunction("row","treeCollapse",this.collapseRow.bind(this)),this.registerComponentFunction("row","treeExpand",this.expandRow.bind(this)),this.registerComponentFunction("row","treeToggle",this.toggleRow.bind(this)),this.registerComponentFunction("row","getTreeParent",this.getTreeParent.bind(this)),this.registerComponentFunction("row","getTreeChildren",this.getRowChildren.bind(this)),this.registerComponentFunction("row","addTreeChild",this.addTreeChildRow.bind(this)),this.registerComponentFunction("row","isTreeExpanded",this.isRowExpanded.bind(this))}initialize(){if(this.table.options.dataTree){var e=null,t=this.table.options;switch(this.field=t.dataTreeChildField,this.indent=t.dataTreeChildIndent,this.options("movableRows")&&console.warn("The movableRows option is not available with dataTree enabled, moving of child rows could result in unpredictable behavior"),t.dataTreeBranchElement?t.dataTreeBranchElement===!0?(this.branchEl=document.createElement("div"),this.branchEl.classList.add("tabulator-data-tree-branch")):typeof t.dataTreeBranchElement=="string"?(e=document.createElement("div"),e.innerHTML=t.dataTreeBranchElement,this.branchEl=e.firstChild):this.branchEl=t.dataTreeBranchElement:(this.branchEl=document.createElement("div"),this.branchEl.classList.add("tabulator-data-tree-branch-empty")),t.dataTreeCollapseElement?typeof t.dataTreeCollapseElement=="string"?(e=document.createElement("div"),e.innerHTML=t.dataTreeCollapseElement,this.collapseEl=e.firstChild):this.collapseEl=t.dataTreeCollapseElement:(this.collapseEl=document.createElement("div"),this.collapseEl.classList.add("tabulator-data-tree-control"),this.collapseEl.tabIndex=0,this.collapseEl.innerHTML="<div class='tabulator-data-tree-control-collapse'></div>"),t.dataTreeExpandElement?typeof t.dataTreeExpandElement=="string"?(e=document.createElement("div"),e.innerHTML=t.dataTreeExpandElement,this.expandEl=e.firstChild):this.expandEl=t.dataTreeExpandElement:(this.expandEl=document.createElement("div"),this.expandEl.classList.add("tabulator-data-tree-control"),this.expandEl.tabIndex=0,this.expandEl.innerHTML="<div class='tabulator-data-tree-control-expand'></div>"),typeof t.dataTreeStartExpanded){case"boolean":this.startOpen=function(i,s){return t.dataTreeStartExpanded};break;case"function":this.startOpen=t.dataTreeStartExpanded;break;default:this.startOpen=function(i,s){return t.dataTreeStartExpanded[s]};break}this.subscribe("row-init",this.initializeRow.bind(this)),this.subscribe("row-layout-after",this.layoutRow.bind(this)),this.subscribe("row-deleting",this.rowDeleting.bind(this)),this.subscribe("row-deleted",this.rowDelete.bind(this),0),this.subscribe("row-data-changed",this.rowDataChanged.bind(this),10),this.subscribe("cell-value-updated",this.cellValueChanged.bind(this)),this.subscribe("edit-cancelled",this.cellValueChanged.bind(this)),this.subscribe("column-moving-rows",this.columnMoving.bind(this)),this.subscribe("table-built",this.initializeElementField.bind(this)),this.subscribe("table-redrawing",this.tableRedrawing.bind(this)),this.registerDisplayHandler(this.getRows.bind(this),30)}}tableRedrawing(e){var t;e&&(t=this.table.rowManager.getRows(),t.forEach(i=>{this.reinitializeRowChildren(i)}))}initializeElementField(){var e=this.table.columnManager.getFirstVisibleColumn();this.elementField=this.table.options.dataTreeElementColumn||(e?e.field:!1)}getRowChildren(e){return this.getTreeChildren(e,!0)}columnMoving(){var e=[];return this.table.rowManager.rows.forEach(t=>{e=e.concat(this.getTreeChildren(t,!1,!0))}),e}rowDataChanged(e,t,i){this.redrawNeeded(i)&&(this.initializeRow(e),t&&(this.layoutRow(e),this.refreshData(!0)))}cellValueChanged(e){var t=e.column.getField();t===this.elementField&&this.layoutRow(e.row)}initializeRow(e){var t=e.getData()[this.field],i=Array.isArray(t),s=i||!i&&typeof t=="object"&&t!==null;!s&&e.modules.dataTree&&e.modules.dataTree.branchEl&&e.modules.dataTree.branchEl.parentNode.removeChild(e.modules.dataTree.branchEl),!s&&e.modules.dataTree&&e.modules.dataTree.controlEl&&e.modules.dataTree.controlEl.parentNode.removeChild(e.modules.dataTree.controlEl),e.modules.dataTree={index:e.modules.dataTree?e.modules.dataTree.index:0,open:s?e.modules.dataTree?e.modules.dataTree.open:this.startOpen(e.getComponent(),0):!1,controlEl:e.modules.dataTree&&s?e.modules.dataTree.controlEl:!1,branchEl:e.modules.dataTree&&s?e.modules.dataTree.branchEl:!1,parent:e.modules.dataTree?e.modules.dataTree.parent:!1,children:s}}reinitializeRowChildren(e){var t=this.getTreeChildren(e,!1,!0);t.forEach(function(i){i.reinitialize(!0)})}layoutRow(e){var t=this.elementField?e.getCell(this.elementField):e.getCells()[0],i=t.getElement(),s=e.modules.dataTree;s.branchEl&&(s.branchEl.parentNode&&s.branchEl.parentNode.removeChild(s.branchEl),s.branchEl=!1),s.controlEl&&(s.controlEl.parentNode&&s.controlEl.parentNode.removeChild(s.controlEl),s.controlEl=!1),this.generateControlElement(e,i),e.getElement().classList.add("tabulator-tree-level-"+s.index),s.index&&(this.branchEl?(s.branchEl=this.branchEl.cloneNode(!0),i.insertBefore(s.branchEl,i.firstChild),this.table.rtl?s.branchEl.style.marginRight=(s.branchEl.offsetWidth+s.branchEl.style.marginLeft)*(s.index-1)+s.index*this.indent+"px":s.branchEl.style.marginLeft=(s.branchEl.offsetWidth+s.branchEl.style.marginRight)*(s.index-1)+s.index*this.indent+"px"):this.table.rtl?i.style.paddingRight=parseInt(window.getComputedStyle(i,null).getPropertyValue("padding-right"))+s.index*this.indent+"px":i.style.paddingLeft=parseInt(window.getComputedStyle(i,null).getPropertyValue("padding-left"))+s.index*this.indent+"px")}generateControlElement(e,t){var i=e.modules.dataTree,s=i.controlEl;t=t||e.getCells()[0].getElement(),i.children!==!1&&(i.open?(i.controlEl=this.collapseEl.cloneNode(!0),i.controlEl.addEventListener("click",r=>{r.stopPropagation(),this.collapseRow(e)})):(i.controlEl=this.expandEl.cloneNode(!0),i.controlEl.addEventListener("click",r=>{r.stopPropagation(),this.expandRow(e)})),i.controlEl.addEventListener("mousedown",r=>{r.stopPropagation()}),s&&s.parentNode===t?s.parentNode.replaceChild(i.controlEl,s):t.insertBefore(i.controlEl,t.firstChild))}getRows(e){var t=[];return e.forEach((i,s)=>{var r,o;t.push(i),i instanceof U&&(i.create(),r=i.modules.dataTree,!r.index&&r.children!==!1&&(o=this.getChildren(i,!1,!0),o.forEach(a=>{a.create(),t.push(a)})))}),t}getChildren(e,t,i){var s=e.modules.dataTree,r=[],o=[];return s.children!==!1&&(s.open||t)&&(Array.isArray(s.children)||(s.children=this.generateChildren(e)),this.table.modExists("filter")&&this.table.options.dataTreeFilter?r=this.table.modules.filter.filter(s.children):r=s.children,this.table.modExists("sort")&&this.table.options.dataTreeSort&&this.table.modules.sort.sort(r,i),r.forEach(a=>{o.push(a);var l=this.getChildren(a,!1,!0);l.forEach(h=>{o.push(h)})})),o}generateChildren(e){var t=[],i=e.getData()[this.field];return Array.isArray(i)||(i=[i]),i.forEach(s=>{var r=new U(s||{},this.table.rowManager);r.create(),r.modules.dataTree.index=e.modules.dataTree.index+1,r.modules.dataTree.parent=e,r.modules.dataTree.children&&(r.modules.dataTree.open=this.startOpen(r.getComponent(),r.modules.dataTree.index)),t.push(r)}),t}expandRow(e,t){var i=e.modules.dataTree;i.children!==!1&&(i.open=!0,e.reinitialize(),this.refreshData(!0),this.dispatchExternal("dataTreeRowExpanded",e.getComponent(),e.modules.dataTree.index))}collapseRow(e){var t=e.modules.dataTree;t.children!==!1&&(t.open=!1,e.reinitialize(),this.refreshData(!0),this.dispatchExternal("dataTreeRowCollapsed",e.getComponent(),e.modules.dataTree.index))}toggleRow(e){var t=e.modules.dataTree;t.children!==!1&&(t.open?this.collapseRow(e):this.expandRow(e))}isRowExpanded(e){return e.modules.dataTree.open}getTreeParent(e){return e.modules.dataTree.parent?e.modules.dataTree.parent.getComponent():!1}getTreeParentRoot(e){return e.modules.dataTree&&e.modules.dataTree.parent?this.getTreeParentRoot(e.modules.dataTree.parent):e}getFilteredTreeChildren(e){var t=e.modules.dataTree,i=[],s;return t.children&&(Array.isArray(t.children)||(t.children=this.generateChildren(e)),this.table.modExists("filter")&&this.table.options.dataTreeFilter?s=this.table.modules.filter.filter(t.children):s=t.children,s.forEach(r=>{r instanceof U&&i.push(r)})),i}rowDeleting(e){var t=e.modules.dataTree;t&&t.children&&Array.isArray(t.children)&&t.children.forEach(i=>{i instanceof U&&i.wipe()})}rowDelete(e){var t=e.modules.dataTree.parent,i;t&&(i=this.findChildIndex(e,t),i!==!1&&t.data[this.field].splice(i,1),t.data[this.field].length||delete t.data[this.field],this.initializeRow(t),this.layoutRow(t)),this.refreshData(!0)}addTreeChildRow(e,t,i,s){var r=!1;typeof t=="string"&&(t=JSON.parse(t)),Array.isArray(e.data[this.field])||(e.data[this.field]=[],e.modules.dataTree.open=this.startOpen(e.getComponent(),e.modules.dataTree.index)),typeof s<"u"&&(r=this.findChildIndex(s,e),r!==!1&&e.data[this.field].splice(i?r:r+1,0,t)),r===!1&&(i?e.data[this.field].unshift(t):e.data[this.field].push(t)),this.initializeRow(e),this.layoutRow(e),this.refreshData(!0)}findChildIndex(e,t){var i=!1;return typeof e=="object"?e instanceof U?i=e.data:e instanceof Zt?i=e._getSelf().data:typeof HTMLElement<"u"&&e instanceof HTMLElement?t.modules.dataTree&&(i=t.modules.dataTree.children.find(s=>s instanceof U?s.element===e:!1),i&&(i=i.data)):e===null&&(i=!1):typeof e>"u"?i=!1:i=t.data[this.field].find(s=>s.data[this.table.options.index]==e),i&&(Array.isArray(t.data[this.field])&&(i=t.data[this.field].indexOf(i)),i==-1&&(i=!1)),i}getTreeChildren(e,t,i){var s=e.modules.dataTree,r=[];return s&&s.children&&(Array.isArray(s.children)||(s.children=this.generateChildren(e)),s.children.forEach(o=>{o instanceof U&&(r.push(t?o.getComponent():o),i&&this.getTreeChildren(o,t,i).forEach(a=>{r.push(a)}))})),r}getChildField(){return this.field}redrawNeeded(e){return(this.field?typeof e[this.field]<"u":!1)||(this.elementField?typeof e[this.elementField]<"u":!1)}}w(bn,"moduleName","dataTree");function to(n,e={},t){var i=e.delimiter?e.delimiter:",",s=[],r=[];n.forEach(o=>{var a=[];switch(o.type){case"group":console.warn("Download Warning - CSV downloader cannot process row groups");break;case"calc":console.warn("Download Warning - CSV downloader cannot process column calculations");break;case"header":o.columns.forEach((l,h)=>{l&&l.depth===1&&(r[h]=typeof l.value>"u"||l.value===null?"":'"'+String(l.value).split('"').join('""')+'"')});break;case"row":o.columns.forEach(l=>{if(l){switch(typeof l.value){case"object":l.value=l.value!==null?JSON.stringify(l.value):"";break;case"undefined":l.value="";break}a.push('"'+String(l.value).split('"').join('""')+'"')}}),s.push(a.join(i));break}}),r.length&&s.unshift(r.join(i)),s=s.join(`
`),e.bom&&(s="\uFEFF"+s),t(s,"text/csv")}function io(n,e,t){var i=[];n.forEach(s=>{var r={};switch(s.type){case"header":break;case"group":console.warn("Download Warning - JSON downloader cannot process row groups");break;case"calc":console.warn("Download Warning - JSON downloader cannot process column calculations");break;case"row":s.columns.forEach(o=>{o&&(r[o.component.getTitleDownload()||o.component.getField()]=o.value)}),i.push(r);break}}),i=JSON.stringify(i,null,"	"),t(i,"application/json")}function so(n,e={},t){var i=[],s=[],r={},o=e.rowGroupStyles||{fontStyle:"bold",fontSize:12,cellPadding:6,fillColor:220},a=e.rowCalcStyles||{fontStyle:"bold",fontSize:10,cellPadding:4,fillColor:232},l=e.jsPDF||{},h=e.title?e.title:"",d,c;l.orientation||(l.orientation=e.orientation||"landscape"),l.unit||(l.unit="pt"),n.forEach(f=>{switch(f.type){case"header":i.push(u(f));break;case"group":s.push(u(f,o));break;case"calc":s.push(u(f,a));break;case"row":s.push(u(f));break}});function u(f,p){var m=[];return f.columns.forEach(b=>{var g;if(b){switch(typeof b.value){case"object":b.value=b.value!==null?JSON.stringify(b.value):"";break;case"undefined":b.value="";break}g={content:b.value,colSpan:b.width,rowSpan:b.height},p&&(g.styles=p),m.push(g)}}),m}d=this.dependencyRegistry.lookup("jspdf","jsPDF"),c=new d(l),e.autoTable&&(typeof e.autoTable=="function"?r=e.autoTable(c)||{}:r=e.autoTable),h&&(r.didDrawPage=function(f){c.text(h,40,30)}),r.head=i,r.body=s,c.autoTable(r),e.documentProcessing&&e.documentProcessing(c),t(c.output("arraybuffer"),"application/pdf")}function no(n,e,t){var i=this,s=e.sheetName||"Sheet1",r=this.dependencyRegistry.lookup("XLSX"),o=r.utils.book_new(),a=new j(this),l="compress"in e?e.compress:!0,h=e.writeOptions||{bookType:"xlsx",bookSST:!0,compression:l},d;h.type="binary",o.SheetNames=[],o.Sheets={};function c(){var p=[],m=[],b={},g={s:{c:0,r:0},e:{c:n[0]?n[0].columns.reduce((R,E)=>R+(E&&E.width?E.width:1),0):0,r:n.length}};return n.forEach((R,E)=>{var v=[];R.columns.forEach(function(C,k){C?(v.push(!(C.value instanceof Date)&&typeof C.value=="object"?JSON.stringify(C.value):C.value),(C.width>1||C.height>-1)&&(C.height>1||C.width>1)&&m.push({s:{r:E,c:k},e:{r:E+C.height-1,c:k+C.width-1}})):v.push("")}),p.push(v)}),r.utils.sheet_add_aoa(b,p),b["!ref"]=r.utils.encode_range(g),m.length&&(b["!merges"]=m),b}if(e.sheetOnly){t(c());return}if(e.sheets)for(var u in e.sheets)e.sheets[u]===!0?(o.SheetNames.push(u),o.Sheets[u]=c()):(o.SheetNames.push(u),a.commsSend(e.sheets[u],"download","intercept",{type:"xlsx",options:{sheetOnly:!0},active:i.active,intercept:function(p){o.Sheets[u]=p}}));else o.SheetNames.push(s),o.Sheets[s]=c();e.documentProcessing&&(o=e.documentProcessing(o));function f(p){for(var m=new ArrayBuffer(p.length),b=new Uint8Array(m),g=0;g!=p.length;++g)b[g]=p.charCodeAt(g)&255;return m}d=r.write(o,h),t(f(d),"application/octet-stream")}function ro(n,e,t){this.modExists("export",!0)&&t(this.modules.export.generateHTMLTable(n),"text/html")}function oo(n,e,t){const i=[];n.forEach(s=>{const r={};switch(s.type){case"header":break;case"group":console.warn("Download Warning - JSON downloader cannot process row groups");break;case"calc":console.warn("Download Warning - JSON downloader cannot process column calculations");break;case"row":s.columns.forEach(o=>{o&&(r[o.component.getTitleDownload()||o.component.getField()]=o.value)}),i.push(JSON.stringify(r));break}}),t(i.join(`
`),"application/x-ndjson")}var ao={csv:to,json:io,jsonLines:oo,pdf:so,xlsx:no,html:ro};const et=class et extends D{constructor(e){super(e),this.registerTableOption("downloadEncoder",function(t,i){return new Blob([t],{type:i})}),this.registerTableOption("downloadConfig",{}),this.registerTableOption("downloadRowRange","active"),this.registerColumnOption("download"),this.registerColumnOption("titleDownload")}initialize(){this.deprecatedOptionsCheck(),this.registerTableFunction("download",this.download.bind(this)),this.registerTableFunction("downloadToTab",this.downloadToTab.bind(this))}deprecatedOptionsCheck(){}downloadToTab(e,t,i,s){this.download(e,t,i,s,!0)}download(e,t,i,s,r){var o=!1;function a(h,d){r?r===!0?this.triggerDownload(h,d,e,t,!0):r(h):this.triggerDownload(h,d,e,t)}if(typeof e=="function"?o=e:et.downloaders[e]?o=et.downloaders[e]:console.warn("Download Error - No such download type found: ",e),o){var l=this.generateExportList(s);o.call(this.table,l,i||{},a.bind(this))}}generateExportList(e){var t=this.table.modules.export.generateExportList(this.table.options.downloadConfig,!1,e||this.table.options.downloadRowRange,"download"),i=this.table.options.groupHeaderDownload;return i&&!Array.isArray(i)&&(i=[i]),t.forEach(s=>{var r;s.type==="group"&&(r=s.columns[0],i&&i[s.indent]&&(r.value=i[s.indent](r.value,s.component._group.getRowCount(),s.component._group.getData(),s.component)))}),t}triggerDownload(e,t,i,s,r){var o=document.createElement("a"),a=this.table.options.downloadEncoder(e,t);a&&(r?window.open(window.URL.createObjectURL(a)):(s=s||"Tabulator."+(typeof i=="function"?"txt":i),navigator.msSaveOrOpenBlob?navigator.msSaveOrOpenBlob(a,s):(o.setAttribute("href",window.URL.createObjectURL(a)),o.setAttribute("download",s),o.style.display="none",document.body.appendChild(o),o.click(),document.body.removeChild(o))),this.dispatchExternal("downloadComplete"))}commsReceived(e,t,i){switch(t){case"intercept":this.download(i.type,"",i.options,i.active,i.intercept);break}}};w(et,"moduleName","download"),w(et,"downloaders",ao);let xi=et;function Xt(n,e){var t=e.mask,i=typeof e.maskLetterChar<"u"?e.maskLetterChar:"A",s=typeof e.maskNumberChar<"u"?e.maskNumberChar:"9",r=typeof e.maskWildcardChar<"u"?e.maskWildcardChar:"*";function o(a){var l=t[a];typeof l<"u"&&l!==r&&l!==i&&l!==s&&(n.value=n.value+""+l,o(a+1))}n.addEventListener("keydown",a=>{var l=n.value.length,h=a.key;if(a.keyCode>46&&!a.ctrlKey&&!a.metaKey){if(l>=t.length)return a.preventDefault(),a.stopPropagation(),!1;switch(t[l]){case i:if(h.toUpperCase()==h.toLowerCase())return a.preventDefault(),a.stopPropagation(),!1;break;case s:if(isNaN(h))return a.preventDefault(),a.stopPropagation(),!1;break;case r:break;default:if(h!==t[l])return a.preventDefault(),a.stopPropagation(),!1}}}),n.addEventListener("keyup",a=>{a.keyCode>46&&e.maskAutoFill&&o(n.value.length)}),n.placeholder||(n.placeholder=t),e.maskAutoFill&&o(n.value.length)}function lo(n,e,t,i,s){var r=n.getValue(),o=document.createElement("input");if(o.setAttribute("type",s.search?"search":"text"),o.style.padding="4px",o.style.width="100%",o.style.boxSizing="border-box",s.elementAttributes&&typeof s.elementAttributes=="object")for(let l in s.elementAttributes)l.charAt(0)=="+"?(l=l.slice(1),o.setAttribute(l,o.getAttribute(l)+s.elementAttributes["+"+l])):o.setAttribute(l,s.elementAttributes[l]);o.value=typeof r<"u"?r:"",e(function(){n.getType()==="cell"&&(o.focus({preventScroll:!0}),o.style.height="100%",s.selectContents&&o.select())});function a(l){(r===null||typeof r>"u")&&o.value!==""||o.value!==r?t(o.value)&&(r=o.value):i()}return o.addEventListener("change",a),o.addEventListener("blur",a),o.addEventListener("keydown",function(l){switch(l.keyCode){case 13:a();break;case 27:i();break;case 35:case 36:l.stopPropagation();break}}),s.mask&&Xt(o,s),o}function ho(n,e,t,i,s){var r=n.getValue(),o=s.verticalNavigation||"hybrid",a=String(r!==null&&typeof r<"u"?r:""),l=document.createElement("textarea"),h=0;if(l.style.display="block",l.style.padding="2px",l.style.height="100%",l.style.width="100%",l.style.boxSizing="border-box",l.style.whiteSpace="pre-wrap",l.style.resize="none",s.elementAttributes&&typeof s.elementAttributes=="object")for(let c in s.elementAttributes)c.charAt(0)=="+"?(c=c.slice(1),l.setAttribute(c,l.getAttribute(c)+s.elementAttributes["+"+c])):l.setAttribute(c,s.elementAttributes[c]);l.value=a,e(function(){n.getType()==="cell"&&(l.focus({preventScroll:!0}),l.style.height="100%",l.scrollHeight,l.style.height=l.scrollHeight+"px",n.getRow().normalizeHeight(),s.selectContents&&l.select())});function d(c){(r===null||typeof r>"u")&&l.value!==""||l.value!==r?(t(l.value)&&(r=l.value),setTimeout(function(){n.getRow().normalizeHeight()},300)):i()}return l.addEventListener("change",d),l.addEventListener("blur",d),l.addEventListener("keyup",function(){l.style.height="";var c=l.scrollHeight;l.style.height=c+"px",c!=h&&(h=c,n.getRow().normalizeHeight())}),l.addEventListener("keydown",function(c){switch(c.keyCode){case 13:c.shiftKey&&s.shiftEnterSubmit&&d();break;case 27:i();break;case 38:(o=="editor"||o=="hybrid"&&l.selectionStart)&&(c.stopImmediatePropagation(),c.stopPropagation());break;case 40:(o=="editor"||o=="hybrid"&&l.selectionStart!==l.value.length)&&(c.stopImmediatePropagation(),c.stopPropagation());break;case 35:case 36:c.stopPropagation();break}}),s.mask&&Xt(l,s),l}function uo(n,e,t,i,s){var r=n.getValue(),o=s.verticalNavigation||"editor",a=document.createElement("input");if(a.setAttribute("type","number"),typeof s.max<"u"&&a.setAttribute("max",s.max),typeof s.min<"u"&&a.setAttribute("min",s.min),typeof s.step<"u"&&a.setAttribute("step",s.step),a.style.padding="4px",a.style.width="100%",a.style.boxSizing="border-box",s.elementAttributes&&typeof s.elementAttributes=="object")for(let d in s.elementAttributes)d.charAt(0)=="+"?(d=d.slice(1),a.setAttribute(d,a.getAttribute(d)+s.elementAttributes["+"+d])):a.setAttribute(d,s.elementAttributes[d]);a.value=r;var l=function(d){h()};e(function(){n.getType()==="cell"&&(a.removeEventListener("blur",l),a.focus({preventScroll:!0}),a.style.height="100%",a.addEventListener("blur",l),s.selectContents&&a.select())});function h(){var d=a.value;!isNaN(d)&&d!==""&&(d=Number(d)),d!==r?t(d)&&(r=d):i()}return a.addEventListener("keydown",function(d){switch(d.keyCode){case 13:h();break;case 27:i();break;case 38:case 40:o=="editor"&&(d.stopImmediatePropagation(),d.stopPropagation());break;case 35:case 36:d.stopPropagation();break}}),s.mask&&Xt(a,s),a}function co(n,e,t,i,s){var r=n.getValue(),o=document.createElement("input");if(o.setAttribute("type","range"),typeof s.max<"u"&&o.setAttribute("max",s.max),typeof s.min<"u"&&o.setAttribute("min",s.min),typeof s.step<"u"&&o.setAttribute("step",s.step),o.style.padding="4px",o.style.width="100%",o.style.boxSizing="border-box",s.elementAttributes&&typeof s.elementAttributes=="object")for(let l in s.elementAttributes)l.charAt(0)=="+"?(l=l.slice(1),o.setAttribute(l,o.getAttribute(l)+s.elementAttributes["+"+l])):o.setAttribute(l,s.elementAttributes[l]);o.value=r,e(function(){n.getType()==="cell"&&(o.focus({preventScroll:!0}),o.style.height="100%")});function a(){var l=o.value;!isNaN(l)&&l!==""&&(l=Number(l)),l!=r?t(l)&&(r=l):i()}return o.addEventListener("blur",function(l){a()}),o.addEventListener("keydown",function(l){switch(l.keyCode){case 13:a();break;case 27:i();break}}),o}function fo(n,e,t,i,s){var r=s.format,o=s.verticalNavigation||"editor",a=r?window.DateTime||luxon.DateTime:null,l=n.getValue(),h=document.createElement("input");function d(u){var f;return a.isDateTime(u)?f=u:r==="iso"?f=a.fromISO(String(u)):f=a.fromFormat(String(u),r),f.toFormat("yyyy-MM-dd")}if(h.type="date",h.style.padding="4px",h.style.width="100%",h.style.boxSizing="border-box",s.max&&h.setAttribute("max",r?d(s.max):s.max),s.min&&h.setAttribute("min",r?d(s.min):s.min),s.elementAttributes&&typeof s.elementAttributes=="object")for(let u in s.elementAttributes)u.charAt(0)=="+"?(u=u.slice(1),h.setAttribute(u,h.getAttribute(u)+s.elementAttributes["+"+u])):h.setAttribute(u,s.elementAttributes[u]);l=typeof l<"u"?l:"",r&&(a?l=d(l):console.error("Editor Error - 'date' editor 'format' param is dependant on luxon.js")),h.value=l,e(function(){n.getType()==="cell"&&(h.focus({preventScroll:!0}),h.style.height="100%",s.selectContents&&h.select())});function c(){var u=h.value,f;if((l===null||typeof l>"u")&&u!==""||u!==l){if(u&&r)switch(f=a.fromFormat(String(u),"yyyy-MM-dd"),r){case!0:u=f;break;case"iso":u=f.toISO();break;default:u=f.toFormat(r)}t(u)&&(l=h.value)}else i()}return h.addEventListener("blur",function(u){(u.relatedTarget||u.rangeParent||u.explicitOriginalTarget!==h)&&c()}),h.addEventListener("keydown",function(u){switch(u.keyCode){case 13:c();break;case 27:i();break;case 35:case 36:u.stopPropagation();break;case 38:case 40:o=="editor"&&(u.stopImmediatePropagation(),u.stopPropagation());break}}),h}function po(n,e,t,i,s){var r=s.format,o=s.verticalNavigation||"editor",a=r?window.DateTime||luxon.DateTime:null,l,h=n.getValue(),d=document.createElement("input");if(d.type="time",d.style.padding="4px",d.style.width="100%",d.style.boxSizing="border-box",s.elementAttributes&&typeof s.elementAttributes=="object")for(let u in s.elementAttributes)u.charAt(0)=="+"?(u=u.slice(1),d.setAttribute(u,d.getAttribute(u)+s.elementAttributes["+"+u])):d.setAttribute(u,s.elementAttributes[u]);h=typeof h<"u"?h:"",r&&(a?(a.isDateTime(h)?l=h:r==="iso"?l=a.fromISO(String(h)):l=a.fromFormat(String(h),r),h=l.toFormat("HH:mm")):console.error("Editor Error - 'date' editor 'format' param is dependant on luxon.js")),d.value=h,e(function(){n.getType()=="cell"&&(d.focus({preventScroll:!0}),d.style.height="100%",s.selectContents&&d.select())});function c(){var u=d.value,f;if((h===null||typeof h>"u")&&u!==""||u!==h){if(u&&r)switch(f=a.fromFormat(String(u),"hh:mm"),r){case!0:u=f;break;case"iso":u=f.toISO();break;default:u=f.toFormat(r)}t(u)&&(h=d.value)}else i()}return d.addEventListener("blur",function(u){(u.relatedTarget||u.rangeParent||u.explicitOriginalTarget!==d)&&c()}),d.addEventListener("keydown",function(u){switch(u.keyCode){case 13:c();break;case 27:i();break;case 35:case 36:u.stopPropagation();break;case 38:case 40:o=="editor"&&(u.stopImmediatePropagation(),u.stopPropagation());break}}),d}function go(n,e,t,i,s){var r=s.format,o=s.verticalNavigation||"editor",a=r?this.table.dependencyRegistry.lookup(["luxon","DateTime"],"DateTime"):null,l,h=n.getValue(),d=document.createElement("input");if(d.type="datetime-local",d.style.padding="4px",d.style.width="100%",d.style.boxSizing="border-box",s.elementAttributes&&typeof s.elementAttributes=="object")for(let u in s.elementAttributes)u.charAt(0)=="+"?(u=u.slice(1),d.setAttribute(u,d.getAttribute(u)+s.elementAttributes["+"+u])):d.setAttribute(u,s.elementAttributes[u]);h=typeof h<"u"?h:"",r&&(a?(a.isDateTime(h)?l=h:r==="iso"?l=a.fromISO(String(h)):l=a.fromFormat(String(h),r),h=l.toFormat("yyyy-MM-dd")+"T"+l.toFormat("HH:mm")):console.error("Editor Error - 'date' editor 'format' param is dependant on luxon.js")),d.value=h,e(function(){n.getType()==="cell"&&(d.focus({preventScroll:!0}),d.style.height="100%",s.selectContents&&d.select())});function c(){var u=d.value,f;if((h===null||typeof h>"u")&&u!==""||u!==h){if(u&&r)switch(f=a.fromISO(String(u)),r){case!0:u=f;break;case"iso":u=f.toISO();break;default:u=f.toFormat(r)}t(u)&&(h=d.value)}else i()}return d.addEventListener("blur",function(u){(u.relatedTarget||u.rangeParent||u.explicitOriginalTarget!==d)&&c()}),d.addEventListener("keydown",function(u){switch(u.keyCode){case 13:c();break;case 27:i();break;case 35:case 36:u.stopPropagation();break;case 38:case 40:o=="editor"&&(u.stopImmediatePropagation(),u.stopPropagation());break}}),d}let mo=class{constructor(e,t,i,s,r,o){this.edit=e,this.table=e.table,this.cell=t,this.params=this._initializeParams(o),this.data=[],this.displayItems=[],this.currentItems=[],this.focusedItem=null,this.input=this._createInputElement(),this.listEl=this._createListElement(),this.initialValues=null,this.isFilter=t.getType()==="header",this.filterTimeout=null,this.filtered=!1,this.typing=!1,this.values=[],this.popup=null,this.listIteration=0,this.lastAction="",this.filterTerm="",this.blurable=!0,this.actions={success:s,cancel:r},this._deprecatedOptionsCheck(),this._initializeValue(),i(this._onRendered.bind(this))}_deprecatedOptionsCheck(){}_initializeValue(){var e=this.cell.getValue();typeof e>"u"&&typeof this.params.defaultValue<"u"&&(e=this.params.defaultValue),this.initialValues=this.params.multiselect?e:[e],this.isFilter&&(this.input.value=this.initialValues?this.initialValues.join(","):"",this.headerFilterInitialListGen())}_onRendered(){var e=this.cell.getElement();function t(i){i.stopPropagation()}this.isFilter||(this.input.style.height="100%",this.input.focus({preventScroll:!0})),e.addEventListener("click",t),setTimeout(()=>{e.removeEventListener("click",t)},1e3),this.input.addEventListener("mousedown",this._preventPopupBlur.bind(this))}_createListElement(){var e=document.createElement("div");return e.classList.add("tabulator-edit-list"),e.addEventListener("mousedown",this._preventBlur.bind(this)),e.addEventListener("keydown",this._inputKeyDown.bind(this)),e}_setListWidth(){var e=this.isFilter?this.input:this.cell.getElement();this.listEl.style.minWidth=e.offsetWidth+"px",this.params.maxWidth&&(this.params.maxWidth===!0?this.listEl.style.maxWidth=e.offsetWidth+"px":typeof this.params.maxWidth=="number"?this.listEl.style.maxWidth=this.params.maxWidth+"px":this.listEl.style.maxWidth=this.params.maxWidth)}_createInputElement(){var e=this.params.elementAttributes,t=document.createElement("input");if(t.setAttribute("type",this.params.clearable?"search":"text"),t.style.padding="4px",t.style.width="100%",t.style.boxSizing="border-box",this.params.autocomplete||(t.style.cursor="default",t.style.caretColor="transparent"),e&&typeof e=="object")for(let i in e)i.charAt(0)=="+"?(i=i.slice(1),t.setAttribute(i,t.getAttribute(i)+e["+"+i])):t.setAttribute(i,e[i]);return this.params.mask&&Xt(t,this.params),this._bindInputEvents(t),t}_initializeParams(e){var t=["values","valuesURL","valuesLookup"],i;return e=Object.assign({},e),e.verticalNavigation=e.verticalNavigation||"editor",e.placeholderLoading=typeof e.placeholderLoading>"u"?"Searching ...":e.placeholderLoading,e.placeholderEmpty=typeof e.placeholderEmpty>"u"?"No Results Found":e.placeholderEmpty,e.filterDelay=typeof e.filterDelay>"u"?300:e.filterDelay,e.emptyValue=Object.keys(e).includes("emptyValue")?e.emptyValue:"",i=Object.keys(e).filter(s=>t.includes(s)).length,i?i>1&&console.warn("list editor config error - only one of the values, valuesURL, or valuesLookup options can be set on the same editor"):console.warn("list editor config error - either the values, valuesURL, or valuesLookup option must be set"),e.autocomplete?e.multiselect&&(e.multiselect=!1,console.warn("list editor config error - multiselect option is not available when autocomplete is enabled")):(e.freetext&&(e.freetext=!1,console.warn("list editor config error - freetext option is only available when autocomplete is enabled")),e.filterFunc&&(e.filterFunc=!1,console.warn("list editor config error - filterFunc option is only available when autocomplete is enabled")),e.filterRemote&&(e.filterRemote=!1,console.warn("list editor config error - filterRemote option is only available when autocomplete is enabled")),e.mask&&(e.mask=!1,console.warn("list editor config error - mask option is only available when autocomplete is enabled")),e.allowEmpty&&(e.allowEmpty=!1,console.warn("list editor config error - allowEmpty option is only available when autocomplete is enabled")),e.listOnEmpty&&(e.listOnEmpty=!1,console.warn("list editor config error - listOnEmpty option is only available when autocomplete is enabled"))),e.filterRemote&&!(typeof e.valuesLookup=="function"||e.valuesURL)&&(e.filterRemote=!1,console.warn("list editor config error - filterRemote option should only be used when values list is populated from a remote source")),e}_bindInputEvents(e){e.addEventListener("focus",this._inputFocus.bind(this)),e.addEventListener("click",this._inputClick.bind(this)),e.addEventListener("blur",this._inputBlur.bind(this)),e.addEventListener("keydown",this._inputKeyDown.bind(this)),e.addEventListener("search",this._inputSearch.bind(this)),this.params.autocomplete&&e.addEventListener("keyup",this._inputKeyUp.bind(this))}_inputFocus(e){this.rebuildOptionsList()}_filter(){this.params.filterRemote?(clearTimeout(this.filterTimeout),this.filterTimeout=setTimeout(()=>{this.rebuildOptionsList()},this.params.filterDelay)):this._filterList()}_inputClick(e){e.stopPropagation()}_inputBlur(e){this.blurable&&(this.popup?this.popup.hide():this._resolveValue(!0))}_inputSearch(){this._clearChoices()}_inputKeyDown(e){switch(e.keyCode){case 38:this._keyUp(e);break;case 40:this._keyDown(e);break;case 37:case 39:this._keySide(e);break;case 13:this._keyEnter();break;case 27:this._keyEsc();break;case 36:case 35:this._keyHomeEnd(e);break;case 9:this._keyTab(e);break;default:this._keySelectLetter(e)}}_inputKeyUp(e){switch(e.keyCode){case 38:case 37:case 39:case 40:case 13:case 27:break;default:this._keyAutoCompLetter(e)}}_preventPopupBlur(){this.popup&&this.popup.blockHide(),setTimeout(()=>{this.popup&&this.popup.restoreHide()},10)}_preventBlur(){this.blurable=!1,setTimeout(()=>{this.blurable=!0},10)}_keyTab(e){this.params.autocomplete&&this.lastAction==="typing"?this._resolveValue(!0):this.focusedItem&&this._chooseItem(this.focusedItem,!0)}_keyUp(e){var t=this.displayItems.indexOf(this.focusedItem);(this.params.verticalNavigation=="editor"||this.params.verticalNavigation=="hybrid"&&t)&&(e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),t>0&&this._focusItem(this.displayItems[t-1]))}_keyDown(e){var t=this.displayItems.indexOf(this.focusedItem);(this.params.verticalNavigation=="editor"||this.params.verticalNavigation=="hybrid"&&t<this.displayItems.length-1)&&(e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),t<this.displayItems.length-1&&(t==-1?this._focusItem(this.displayItems[0]):this._focusItem(this.displayItems[t+1])))}_keySide(e){this.params.autocomplete||(e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault())}_keyEnter(e){this.params.autocomplete&&this.lastAction==="typing"?this._resolveValue(!0):this.focusedItem&&this._chooseItem(this.focusedItem)}_keyEsc(e){this._cancel()}_keyHomeEnd(e){this.params.autocomplete&&e.stopImmediatePropagation()}_keySelectLetter(e){this.params.autocomplete||(e.preventDefault(),e.keyCode>=38&&e.keyCode<=90&&this._scrollToValue(e.keyCode))}_keyAutoCompLetter(e){this._filter(),this.lastAction="typing",this.typing=!0}_scrollToValue(e){clearTimeout(this.filterTimeout);var t=String.fromCharCode(e).toLowerCase();this.filterTerm+=t.toLowerCase();var i=this.displayItems.find(s=>typeof s.label<"u"&&s.label.toLowerCase().startsWith(this.filterTerm));i&&this._focusItem(i),this.filterTimeout=setTimeout(()=>{this.filterTerm=""},800)}_focusItem(e){this.lastAction="focus",this.focusedItem&&this.focusedItem.element&&this.focusedItem.element.classList.remove("focused"),this.focusedItem=e,e&&e.element&&(e.element.classList.add("focused"),e.element.scrollIntoView({behavior:"smooth",block:"nearest",inline:"start"}))}headerFilterInitialListGen(){this._generateOptions(!0)}rebuildOptionsList(){this._generateOptions().then(this._sortOptions.bind(this)).then(this._buildList.bind(this)).then(this._showList.bind(this)).catch(e=>{Number.isInteger(e)||console.error("List generation error",e)})}_filterList(){this._buildList(this._filterOptions()),this._showList()}_generateOptions(e){var t=[],i=++this.listIteration;return this.filtered=!1,this.params.values?t=this.params.values:this.params.valuesURL?t=this._ajaxRequest(this.params.valuesURL,this.input.value):typeof this.params.valuesLookup=="function"?t=this.params.valuesLookup(this.cell,this.input.value):this.params.valuesLookup&&(t=this._uniqueColumnValues(this.params.valuesLookupField)),t instanceof Promise?(e||this._addPlaceholder(this.params.placeholderLoading),t.then().then(s=>this.listIteration===i?this._parseList(s):Promise.reject(i))):Promise.resolve(this._parseList(t))}_addPlaceholder(e){var t=document.createElement("div");typeof e=="function"&&(e=e(this.cell.getComponent(),this.listEl)),e&&(this._clearList(),e instanceof HTMLElement?t=e:(t.classList.add("tabulator-edit-list-placeholder"),t.innerHTML=e),this.listEl.appendChild(t),this._showList())}_ajaxRequest(e,t){var i=this.params.filterRemote?{term:t}:{};return e=fn(e,{},i),fetch(e).then(s=>s.ok?s.json().catch(r=>(console.warn("List Ajax Load Error - Invalid JSON returned",r),Promise.reject(r))):(console.error("List Ajax Load Error - Connection Error: "+s.status,s.statusText),Promise.reject(s))).catch(s=>(console.error("List Ajax Load Error - Connection Error: ",s),Promise.reject(s)))}_uniqueColumnValues(e){var t={},i=this.table.getData(this.params.valuesLookup),s;return e?s=this.table.columnManager.getColumnByField(e):s=this.cell.getColumn()._getSelf(),s?i.forEach(r=>{var o=s.getFieldValue(r);this._emptyValueCheck(o)||(this.params.multiselect&&Array.isArray(o)?o.forEach(a=>{this._emptyValueCheck(a)||(t[a]=!0)}):t[o]=!0)}):(console.warn("unable to find matching column to create select lookup list:",e),t=[]),Object.keys(t)}_emptyValueCheck(e){return e===null||typeof e>"u"||e===""}_parseList(e){var t=[];return Array.isArray(e)||(e=Object.entries(e).map(([i,s])=>({label:s,value:i}))),e.forEach(i=>{typeof i!="object"&&(i={label:i,value:i}),this._parseListItem(i,t,0)}),!this.currentItems.length&&this.params.freetext&&(this.input.value=this.initialValues,this.typing=!0,this.lastAction="typing"),this.data=t,t}_parseListItem(e,t,i){var s={};e.options?s=this._parseListGroup(e,i+1):(s={label:e.label,value:e.value,itemParams:e.itemParams,elementAttributes:e.elementAttributes,element:!1,selected:!1,visible:!0,level:i,original:e},this.initialValues&&this.initialValues.indexOf(e.value)>-1&&this._chooseItem(s,!0)),t.push(s)}_parseListGroup(e,t){var i={label:e.label,group:!0,itemParams:e.itemParams,elementAttributes:e.elementAttributes,element:!1,visible:!0,level:t,options:[],original:e};return e.options.forEach(s=>{this._parseListItem(s,i.options,t)}),i}_sortOptions(e){var t;return this.params.sort&&(t=typeof this.params.sort=="function"?this.params.sort:this._defaultSortFunction.bind(this),this._sortGroup(t,e)),e}_sortGroup(e,t){t.sort((i,s)=>e(i.label,s.label,i.value,s.value,i.original,s.original)),t.forEach(i=>{i.group&&this._sortGroup(e,i.options)})}_defaultSortFunction(e,t){var i,s,r,o,a=0,l,h=/(\d+)|(\D+)/g,d=/\d/,c=0;if(this.params.sort==="desc"&&([e,t]=[t,e]),!e&&e!==0)c=!t&&t!==0?0:-1;else if(!t&&t!==0)c=1;else{if(isFinite(e)&&isFinite(t))return e-t;if(i=String(e).toLowerCase(),s=String(t).toLowerCase(),i===s)return 0;if(!(d.test(i)&&d.test(s)))return i>s?1:-1;for(i=i.match(h),s=s.match(h),l=i.length>s.length?s.length:i.length;a<l;)if(r=i[a],o=s[a++],r!==o)return isFinite(r)&&isFinite(o)?(r.charAt(0)==="0"&&(r="."+r),o.charAt(0)==="0"&&(o="."+o),r-o):r>o?1:-1;return i.length>s.length}return c}_filterOptions(){var e=this.params.filterFunc||this._defaultFilterFunc,t=this.input.value;return t?(this.filtered=!0,this.data.forEach(i=>{this._filterItem(e,t,i)})):this.filtered=!1,this.data}_filterItem(e,t,i){var s=!1;return i.group?(i.options.forEach(r=>{this._filterItem(e,t,r)&&(s=!0)}),i.visible=s):i.visible=e(t,i.label,i.value,i.original),i.visible}_defaultFilterFunc(e,t,i,s){return e=String(e).toLowerCase(),t!==null&&typeof t<"u"&&(String(t).toLowerCase().indexOf(e)>-1||String(i).toLowerCase().indexOf(e)>-1)}_clearList(){for(;this.listEl.firstChild;)this.listEl.removeChild(this.listEl.firstChild);this.displayItems=[]}_buildList(e){this._clearList(),e.forEach(t=>{this._buildItem(t)}),this.displayItems.length||this._addPlaceholder(this.params.placeholderEmpty)}_buildItem(e){var t=e.element,i;if(!this.filtered||e.visible){if(!t){if(t=document.createElement("div"),t.tabIndex=0,i=this.params.itemFormatter?this.params.itemFormatter(e.label,e.value,e.original,t):e.label,i instanceof HTMLElement?t.appendChild(i):t.innerHTML=i,e.group?t.classList.add("tabulator-edit-list-group"):t.classList.add("tabulator-edit-list-item"),t.classList.add("tabulator-edit-list-group-level-"+e.level),e.elementAttributes&&typeof e.elementAttributes=="object")for(let s in e.elementAttributes)s.charAt(0)=="+"?(s=s.slice(1),t.setAttribute(s,this.input.getAttribute(s)+e.elementAttributes["+"+s])):t.setAttribute(s,e.elementAttributes[s]);e.group?t.addEventListener("click",this._groupClick.bind(this,e)):t.addEventListener("click",this._itemClick.bind(this,e)),t.addEventListener("mousedown",this._preventBlur.bind(this)),e.element=t}this._styleItem(e),this.listEl.appendChild(t),e.group?e.options.forEach(s=>{this._buildItem(s)}):this.displayItems.push(e)}}_showList(){var e=this.popup&&this.popup.isVisible();if(this.input.parentNode){if(this.params.autocomplete&&this.input.value===""&&!this.params.listOnEmpty){this.popup&&this.popup.hide(!0);return}this._setListWidth(),this.popup||(this.popup=this.edit.popup(this.listEl)),this.popup.show(this.cell.getElement(),"bottom"),e||setTimeout(()=>{this.popup.hideOnBlur(this._resolveValue.bind(this,!0))},10)}}_styleItem(e){e&&e.element&&(e.selected?e.element.classList.add("active"):e.element.classList.remove("active"))}_itemClick(e,t){t.stopPropagation(),this._chooseItem(e)}_groupClick(e,t){t.stopPropagation()}_cancel(){this.popup.hide(!0),this.actions.cancel()}_clearChoices(){this.typing=!0,this.currentItems.forEach(e=>{e.selected=!1,this._styleItem(e)}),this.currentItems=[],this.focusedItem=null}_chooseItem(e,t){var i;this.typing=!1,this.params.multiselect?(i=this.currentItems.indexOf(e),i>-1?(this.currentItems.splice(i,1),e.selected=!1):(this.currentItems.push(e),e.selected=!0),this.input.value=this.currentItems.map(s=>s.label).join(","),this._styleItem(e)):(this.currentItems=[e],e.selected=!0,this.input.value=e.label,this._styleItem(e),t||this._resolveValue()),this._focusItem(e)}_resolveValue(e){var t,i;if(this.popup&&this.popup.hide(!0),this.params.multiselect)t=this.currentItems.map(s=>s.value);else if(e&&this.params.autocomplete&&this.typing)if(this.params.freetext||this.params.allowEmpty&&this.input.value==="")t=this.input.value;else{this.actions.cancel();return}else this.currentItems[0]?t=this.currentItems[0].value:(i=Array.isArray(this.initialValues)?this.initialValues[0]:this.initialValues,i===null||typeof i>"u"||i===""?t=i:t=this.params.emptyValue);t===""&&(t=this.params.emptyValue),this.actions.success(t),this.isFilter&&(this.initialValues=t&&!Array.isArray(t)?[t]:t,this.currentItems=[])}};function bo(n,e,t,i,s){var r=new mo(this,n,e,t,i,s);return r.input}function vo(n,e,t,i,s){var r=this,o=n.getElement(),a=n.getValue(),l=o.getElementsByTagName("svg").length||5,h=o.getElementsByTagName("svg")[0]?o.getElementsByTagName("svg")[0].getAttribute("width"):14,d=[],c=document.createElement("div"),u=document.createElementNS("http://www.w3.org/2000/svg","svg");function f(g){d.forEach(function(R,E){E<g?(r.table.browser=="ie"?R.setAttribute("class","tabulator-star-active"):R.classList.replace("tabulator-star-inactive","tabulator-star-active"),R.innerHTML='<polygon fill="#488CE9" stroke="#014AAE" stroke-width="37.6152" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="259.216,29.942 330.27,173.919 489.16,197.007 374.185,309.08 401.33,467.31 259.216,392.612 117.104,467.31 144.25,309.08 29.274,197.007 188.165,173.919 "/>'):(r.table.browser=="ie"?R.setAttribute("class","tabulator-star-inactive"):R.classList.replace("tabulator-star-active","tabulator-star-inactive"),R.innerHTML='<polygon fill="#010155" stroke="#686868" stroke-width="37.6152" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="259.216,29.942 330.27,173.919 489.16,197.007 374.185,309.08 401.33,467.31 259.216,392.612 117.104,467.31 144.25,309.08 29.274,197.007 188.165,173.919 "/>')})}function p(g){var R=document.createElement("span"),E=u.cloneNode(!0);d.push(E),R.addEventListener("mouseenter",function(v){v.stopPropagation(),v.stopImmediatePropagation(),f(g)}),R.addEventListener("mousemove",function(v){v.stopPropagation(),v.stopImmediatePropagation()}),R.addEventListener("click",function(v){v.stopPropagation(),v.stopImmediatePropagation(),t(g),o.blur()}),R.appendChild(E),c.appendChild(R)}function m(g){a=g,f(g)}if(o.style.whiteSpace="nowrap",o.style.overflow="hidden",o.style.textOverflow="ellipsis",c.style.verticalAlign="middle",c.style.display="inline-block",c.style.padding="4px",u.setAttribute("width",h),u.setAttribute("height",h),u.setAttribute("viewBox","0 0 512 512"),u.setAttribute("xml:space","preserve"),u.style.padding="0 1px",s.elementAttributes&&typeof s.elementAttributes=="object")for(let g in s.elementAttributes)g.charAt(0)=="+"?(g=g.slice(1),c.setAttribute(g,c.getAttribute(g)+s.elementAttributes["+"+g])):c.setAttribute(g,s.elementAttributes[g]);for(var b=1;b<=l;b++)p(b);return a=Math.min(parseInt(a),l),f(a),c.addEventListener("mousemove",function(g){f(0)}),c.addEventListener("click",function(g){t(0)}),o.addEventListener("blur",function(g){i()}),o.addEventListener("keydown",function(g){switch(g.keyCode){case 39:m(a+1);break;case 37:m(a-1);break;case 13:t(a);break;case 27:i();break}}),c}function wo(n,e,t,i,s){var r=n.getElement(),o=typeof s.max>"u"?r.getElementsByTagName("div")[0]&&r.getElementsByTagName("div")[0].getAttribute("max")||100:s.max,a=typeof s.min>"u"?r.getElementsByTagName("div")[0]&&r.getElementsByTagName("div")[0].getAttribute("min")||0:s.min,l=(o-a)/100,h=n.getValue()||0,d=document.createElement("div"),c=document.createElement("div"),u,f;function p(){var m=window.getComputedStyle(r,null),b=l*Math.round(c.offsetWidth/((r.clientWidth-parseInt(m.getPropertyValue("padding-left"))-parseInt(m.getPropertyValue("padding-right")))/100))+a;t(b),r.setAttribute("aria-valuenow",b),r.setAttribute("aria-label",h)}if(d.style.position="absolute",d.style.right="0",d.style.top="0",d.style.bottom="0",d.style.width="5px",d.classList.add("tabulator-progress-handle"),c.style.display="inline-block",c.style.position="relative",c.style.height="100%",c.style.backgroundColor="#488CE9",c.style.maxWidth="100%",c.style.minWidth="0%",s.elementAttributes&&typeof s.elementAttributes=="object")for(let m in s.elementAttributes)m.charAt(0)=="+"?(m=m.slice(1),c.setAttribute(m,c.getAttribute(m)+s.elementAttributes["+"+m])):c.setAttribute(m,s.elementAttributes[m]);return r.style.padding="4px 4px",h=Math.min(parseFloat(h),o),h=Math.max(parseFloat(h),a),h=Math.round((h-a)/l),c.style.width=h+"%",r.setAttribute("aria-valuemin",a),r.setAttribute("aria-valuemax",o),c.appendChild(d),d.addEventListener("mousedown",function(m){u=m.screenX,f=c.offsetWidth}),d.addEventListener("mouseover",function(){d.style.cursor="ew-resize"}),r.addEventListener("mousemove",function(m){u&&(c.style.width=f+m.screenX-u+"px")}),r.addEventListener("mouseup",function(m){u&&(m.stopPropagation(),m.stopImmediatePropagation(),u=!1,f=!1,p())}),r.addEventListener("keydown",function(m){switch(m.keyCode){case 39:m.preventDefault(),c.style.width=c.clientWidth+r.clientWidth/100+"px";break;case 37:m.preventDefault(),c.style.width=c.clientWidth-r.clientWidth/100+"px";break;case 9:case 13:p();break;case 27:i();break}}),r.addEventListener("blur",function(){i()}),c}function Co(n,e,t,i,s){var r=n.getValue(),o=document.createElement("input"),a=s.tristate,l=typeof s.indeterminateValue>"u"?null:s.indeterminateValue,h=!1,d=Object.keys(s).includes("trueValue"),c=Object.keys(s).includes("falseValue");if(o.setAttribute("type","checkbox"),o.style.marginTop="5px",o.style.boxSizing="border-box",s.elementAttributes&&typeof s.elementAttributes=="object")for(let f in s.elementAttributes)f.charAt(0)=="+"?(f=f.slice(1),o.setAttribute(f,o.getAttribute(f)+s.elementAttributes["+"+f])):o.setAttribute(f,s.elementAttributes[f]);o.value=r,a&&(typeof r>"u"||r===l||r==="")&&(h=!0,o.indeterminate=!0),this.table.browser!="firefox"&&this.table.browser!="safari"&&e(function(){n.getType()==="cell"&&o.focus({preventScroll:!0})}),o.checked=d?r===s.trueValue:r===!0||r==="true"||r==="True"||r===1;function u(f){var p=o.checked;return d&&p?p=s.trueValue:c&&!p&&(p=s.falseValue),a?f?h?l:p:o.checked&&!h?(o.checked=!1,o.indeterminate=!0,h=!0,l):(h=!1,p):p}return o.addEventListener("change",function(f){t(u())}),o.addEventListener("blur",function(f){t(u(!0))}),o.addEventListener("keydown",function(f){f.keyCode==13&&t(u()),f.keyCode==27&&i()}),o}function yo(n,e,t,i,s){var r=n._getSelf().column,o,a,l;function h(d){var c=d.getValue(),u="input";switch(typeof c){case"number":u="number";break;case"boolean":u="tickCross";break;case"string":c.includes(`
`)&&(u="textarea");break}return u}return o=s.editorLookup?s.editorLookup(n):h(n),s.paramsLookup&&(l=typeof s.paramsLookup=="function"?s.paramsLookup(o,n):s.paramsLookup[o]),a=this.table.modules.edit.lookupEditor(o,r),a.call(this,n,e,t,i,l||{})}var Eo={input:lo,textarea:ho,number:uo,range:co,date:fo,time:po,datetime:go,list:bo,star:vo,progress:wo,tickCross:Co,adaptable:yo};const bt=class bt extends D{constructor(e){super(e),this.currentCell=!1,this.mouseClick=!1,this.recursionBlock=!1,this.invalidEdit=!1,this.editedCells=[],this.convertEmptyValues=!1,this.editors=bt.editors,this.registerTableOption("editTriggerEvent","focus"),this.registerTableOption("editorEmptyValue"),this.registerTableOption("editorEmptyValueFunc",this.emptyValueCheck.bind(this)),this.registerColumnOption("editable"),this.registerColumnOption("editor"),this.registerColumnOption("editorParams"),this.registerColumnOption("editorEmptyValue"),this.registerColumnOption("editorEmptyValueFunc"),this.registerColumnOption("cellEditing"),this.registerColumnOption("cellEdited"),this.registerColumnOption("cellEditCancelled"),this.registerTableFunction("getEditedCells",this.getEditedCells.bind(this)),this.registerTableFunction("clearCellEdited",this.clearCellEdited.bind(this)),this.registerTableFunction("navigatePrev",this.navigatePrev.bind(this)),this.registerTableFunction("navigateNext",this.navigateNext.bind(this)),this.registerTableFunction("navigateLeft",this.navigateLeft.bind(this)),this.registerTableFunction("navigateRight",this.navigateRight.bind(this)),this.registerTableFunction("navigateUp",this.navigateUp.bind(this)),this.registerTableFunction("navigateDown",this.navigateDown.bind(this)),this.registerComponentFunction("cell","isEdited",this.cellIsEdited.bind(this)),this.registerComponentFunction("cell","clearEdited",this.clearEdited.bind(this)),this.registerComponentFunction("cell","edit",this.editCell.bind(this)),this.registerComponentFunction("cell","cancelEdit",this.cellCancelEdit.bind(this)),this.registerComponentFunction("cell","navigatePrev",this.navigatePrev.bind(this)),this.registerComponentFunction("cell","navigateNext",this.navigateNext.bind(this)),this.registerComponentFunction("cell","navigateLeft",this.navigateLeft.bind(this)),this.registerComponentFunction("cell","navigateRight",this.navigateRight.bind(this)),this.registerComponentFunction("cell","navigateUp",this.navigateUp.bind(this)),this.registerComponentFunction("cell","navigateDown",this.navigateDown.bind(this))}initialize(){this.subscribe("cell-init",this.bindEditor.bind(this)),this.subscribe("cell-delete",this.clearEdited.bind(this)),this.subscribe("cell-value-changed",this.updateCellClass.bind(this)),this.subscribe("column-layout",this.initializeColumnCheck.bind(this)),this.subscribe("column-delete",this.columnDeleteCheck.bind(this)),this.subscribe("row-deleting",this.rowDeleteCheck.bind(this)),this.subscribe("row-layout",this.rowEditableCheck.bind(this)),this.subscribe("data-refreshing",this.cancelEdit.bind(this)),this.subscribe("clipboard-paste",this.pasteBlocker.bind(this)),this.subscribe("keybinding-nav-prev",this.navigatePrev.bind(this,void 0)),this.subscribe("keybinding-nav-next",this.keybindingNavigateNext.bind(this)),this.subscribe("keybinding-nav-up",this.navigateUp.bind(this,void 0)),this.subscribe("keybinding-nav-down",this.navigateDown.bind(this,void 0)),Object.keys(this.table.options).includes("editorEmptyValue")&&(this.convertEmptyValues=!0)}pasteBlocker(e){if(this.currentCell)return!0}keybindingNavigateNext(e){var t=this.currentCell,i=this.options("tabEndNewRow");t&&(this.navigateNext(t,e)||i&&(t.getElement().firstChild.blur(),this.invalidEdit||(i===!0?i=this.table.addRow({}):typeof i=="function"?i=this.table.addRow(i(t.row.getComponent())):i=this.table.addRow(Object.assign({},i)),i.then(()=>{setTimeout(()=>{t.getComponent().navigateNext()})}))))}cellIsEdited(e){return!!e.modules.edit&&e.modules.edit.edited}cellCancelEdit(e){e===this.currentCell?this.table.modules.edit.cancelEdit():console.warn("Cancel Editor Error - This cell is not currently being edited ")}updateCellClass(e){this.allowEdit(e)?e.getElement().classList.add("tabulator-editable"):e.getElement().classList.remove("tabulator-editable")}clearCellEdited(e){e||(e=this.table.modules.edit.getEditedCells()),Array.isArray(e)||(e=[e]),e.forEach(t=>{this.table.modules.edit.clearEdited(t._getSelf())})}navigatePrev(e=this.currentCell,t){var i,s;if(e){if(t&&t.preventDefault(),i=this.navigateLeft(),i)return!0;if(s=this.table.rowManager.prevDisplayRow(e.row,!0),s&&(i=this.findPrevEditableCell(s,s.cells.length),i))return i.getComponent().edit(),!0}return!1}navigateNext(e=this.currentCell,t){var i,s;if(e){if(t&&t.preventDefault(),i=this.navigateRight(),i)return!0;if(s=this.table.rowManager.nextDisplayRow(e.row,!0),s&&(i=this.findNextEditableCell(s,-1),i))return i.getComponent().edit(),!0}return!1}navigateLeft(e=this.currentCell,t){var i,s;return e&&(t&&t.preventDefault(),i=e.getIndex(),s=this.findPrevEditableCell(e.row,i),s)?(s.getComponent().edit(),!0):!1}navigateRight(e=this.currentCell,t){var i,s;return e&&(t&&t.preventDefault(),i=e.getIndex(),s=this.findNextEditableCell(e.row,i),s)?(s.getComponent().edit(),!0):!1}navigateUp(e=this.currentCell,t){var i,s;return e&&(t&&t.preventDefault(),i=e.getIndex(),s=this.table.rowManager.prevDisplayRow(e.row,!0),s)?(s.cells[i].getComponent().edit(),!0):!1}navigateDown(e=this.currentCell,t){var i,s;return e&&(t&&t.preventDefault(),i=e.getIndex(),s=this.table.rowManager.nextDisplayRow(e.row,!0),s)?(s.cells[i].getComponent().edit(),!0):!1}findNextEditableCell(e,t){var i=!1;if(t<e.cells.length-1)for(var s=t+1;s<e.cells.length;s++){let r=e.cells[s];if(r.column.modules.edit&&P.elVisible(r.getElement())&&this.allowEdit(r)){i=r;break}}return i}findPrevEditableCell(e,t){var i=!1;if(t>0)for(var s=t-1;s>=0;s--){let r=e.cells[s];if(r.column.modules.edit&&P.elVisible(r.getElement())&&this.allowEdit(r)){i=r;break}}return i}initializeColumnCheck(e){typeof e.definition.editor<"u"&&this.initializeColumn(e)}columnDeleteCheck(e){this.currentCell&&this.currentCell.column===e&&this.cancelEdit()}rowDeleteCheck(e){this.currentCell&&this.currentCell.row===e&&this.cancelEdit()}rowEditableCheck(e){e.getCells().forEach(t=>{t.column.modules.edit&&typeof t.column.modules.edit.check=="function"&&this.updateCellClass(t)})}initializeColumn(e){var t=Object.keys(e.definition).includes("editorEmptyValue"),i={editor:!1,blocked:!1,check:e.definition.editable,params:e.definition.editorParams||{},convertEmptyValues:t,editorEmptyValue:e.definition.editorEmptyValue,editorEmptyValueFunc:e.definition.editorEmptyValueFunc};i.editor=this.lookupEditor(e.definition.editor,e),i.editor&&(e.modules.edit=i)}lookupEditor(e,t){var i;switch(typeof e){case"string":this.editors[e]?i=this.editors[e]:console.warn("Editor Error - No such editor found: ",e);break;case"function":i=e;break;case"boolean":e===!0&&(typeof t.definition.formatter!="function"?this.editors[t.definition.formatter]?i=this.editors[t.definition.formatter]:i=this.editors.input:console.warn("Editor Error - Cannot auto lookup editor for a custom formatter: ",t.definition.formatter));break}return i}getCurrentCell(){return this.currentCell?this.currentCell.getComponent():!1}clearEditor(e){var t=this.currentCell,i;if(this.invalidEdit=!1,t){for(this.currentCell=!1,i=t.getElement(),this.dispatch("edit-editor-clear",t,e),i.classList.remove("tabulator-editing");i.firstChild;)i.removeChild(i.firstChild);t.row.getElement().classList.remove("tabulator-editing"),t.table.element.classList.remove("tabulator-editing")}}cancelEdit(){if(this.currentCell){var e=this.currentCell,t=this.currentCell.getComponent();this.clearEditor(!0),e.setValueActual(e.getValue()),e.cellRendered(),(e.column.definition.editor=="textarea"||e.column.definition.variableHeight)&&e.row.normalizeHeight(!0),e.column.definition.cellEditCancelled&&e.column.definition.cellEditCancelled.call(this.table,t),this.dispatch("edit-cancelled",e),this.dispatchExternal("cellEditCancelled",t)}}bindEditor(e){if(e.column.modules.edit){var t=this,i=e.getElement(!0);this.updateCellClass(e),i.setAttribute("tabindex",0),i.addEventListener("mousedown",function(s){s.button===2?s.preventDefault():t.mouseClick=!0}),this.options("editTriggerEvent")==="dblclick"&&i.addEventListener("dblclick",function(s){i.classList.contains("tabulator-editing")||(i.focus({preventScroll:!0}),t.edit(e,s,!1))}),(this.options("editTriggerEvent")==="focus"||this.options("editTriggerEvent")==="click")&&i.addEventListener("click",function(s){i.classList.contains("tabulator-editing")||(i.focus({preventScroll:!0}),t.edit(e,s,!1))}),this.options("editTriggerEvent")==="focus"&&i.addEventListener("focus",function(s){t.recursionBlock||t.edit(e,s,!1)})}}focusCellNoEvent(e,t){this.recursionBlock=!0,t&&this.table.browser==="ie"||e.getElement().focus({preventScroll:!0}),this.recursionBlock=!1}editCell(e,t){this.focusCellNoEvent(e),this.edit(e,!1,t)}focusScrollAdjust(e){if(this.table.rowManager.getRenderMode()=="virtual"){var t=this.table.rowManager.element.scrollTop,i=this.table.rowManager.element.clientHeight+this.table.rowManager.element.scrollTop,s=e.row.getElement();s.offsetTop<t?this.table.rowManager.element.scrollTop-=t-s.offsetTop:s.offsetTop+s.offsetHeight>i&&(this.table.rowManager.element.scrollTop+=s.offsetTop+s.offsetHeight-i);var r=this.table.rowManager.element.scrollLeft,o=this.table.rowManager.element.clientWidth+this.table.rowManager.element.scrollLeft,a=e.getElement();this.table.modExists("frozenColumns")&&(r+=parseInt(this.table.modules.frozenColumns.leftMargin||0),o-=parseInt(this.table.modules.frozenColumns.rightMargin||0)),this.table.options.renderHorizontal==="virtual"&&(r-=parseInt(this.table.columnManager.renderer.vDomPadLeft),o-=parseInt(this.table.columnManager.renderer.vDomPadLeft)),a.offsetLeft<r?this.table.rowManager.element.scrollLeft-=r-a.offsetLeft:a.offsetLeft+a.offsetWidth>o&&(this.table.rowManager.element.scrollLeft+=a.offsetLeft+a.offsetWidth-o)}}allowEdit(e){var t=!!e.column.modules.edit;if(e.column.modules.edit)switch(typeof e.column.modules.edit.check){case"function":e.row.initialized&&(t=e.column.modules.edit.check(e.getComponent()));break;case"string":t=!!e.row.data[e.column.modules.edit.check];break;case"boolean":t=e.column.modules.edit.check;break}return t}edit(e,t,i){var s=this,r=!0,o=function(){},a=e.getElement(),l=!1,h,d,c;if(this.currentCell){!this.invalidEdit&&this.currentCell!==e&&this.cancelEdit();return}function u(g){if(s.currentCell===e&&!l){var R=s.chain("edit-success",[e,g],!0,!0);return R===!0||s.table.options.validationMode==="highlight"?(l=!0,s.clearEditor(),e.modules.edit||(e.modules.edit={}),e.modules.edit.edited=!0,s.editedCells.indexOf(e)==-1&&s.editedCells.push(e),g=s.transformEmptyValues(g,e),e.setValue(g,!0),R===!0):(l=!0,s.invalidEdit=!0,s.focusCellNoEvent(e,!0),o(),setTimeout(()=>{l=!1},10),!1)}}function f(){s.currentCell===e&&!l&&s.cancelEdit()}function p(g){o=g}if(e.column.modules.edit.blocked)return this.mouseClick=!1,this.blur(a),!1;if(t&&t.stopPropagation(),r=this.allowEdit(e),r||i){if(s.cancelEdit(),s.currentCell=e,this.focusScrollAdjust(e),d=e.getComponent(),this.mouseClick&&(this.mouseClick=!1,e.column.definition.cellClick&&e.column.definition.cellClick.call(this.table,t,d)),e.column.definition.cellEditing&&e.column.definition.cellEditing.call(this.table,d),this.dispatch("cell-editing",e),this.dispatchExternal("cellEditing",d),c=typeof e.column.modules.edit.params=="function"?e.column.modules.edit.params(d):e.column.modules.edit.params,h=e.column.modules.edit.editor.call(s,d,p,u,f,c),this.currentCell&&h!==!1)if(h instanceof Node){for(a.classList.add("tabulator-editing"),e.row.getElement().classList.add("tabulator-editing"),e.table.element.classList.add("tabulator-editing");a.firstChild;)a.removeChild(a.firstChild);a.appendChild(h),o();for(var m=a.children,b=0;b<m.length;b++)m[b].addEventListener("click",function(g){g.stopPropagation()})}else return console.warn("Edit Error - Editor should return an instance of Node, the editor returned:",h),this.blur(a),!1;else return this.blur(a),!1;return!0}else return this.mouseClick=!1,this.blur(a),!1}emptyValueCheck(e){return e===""||e===null||typeof e>"u"}transformEmptyValues(e,t){var i=t.column.modules.edit,s=i.convertEmptyValues||this.convertEmptyValues,r;return s&&(r=i.editorEmptyValueFunc||this.options("editorEmptyValueFunc"),r&&r(e)&&(e=i.convertEmptyValues?i.editorEmptyValue:this.options("editorEmptyValue"))),e}blur(e){this.confirm("edit-blur",[e])||e.blur()}getEditedCells(){var e=[];return this.editedCells.forEach(t=>{e.push(t.getComponent())}),e}clearEdited(e){var t;e.modules.edit&&e.modules.edit.edited&&(e.modules.edit.edited=!1,this.dispatch("edit-edited-clear",e)),t=this.editedCells.indexOf(e),t>-1&&this.editedCells.splice(t,1)}};w(bt,"moduleName","edit"),w(bt,"editors",Eo);let _i=bt;class bs{constructor(e,t,i,s){this.type=e,this.columns=t,this.component=i||!1,this.indent=s||0}}class ti{constructor(e,t,i,s,r){this.value=e,this.component=t||!1,this.width=i,this.height=s,this.depth=r}}var Ro={},xo={visible:function(){return this.rowManager.getVisibleRows(!1,!0)},all:function(){return this.rowManager.rows},selected:function(){return this.modules.selectRow.selectedRows},active:function(){return this.options.pagination?this.rowManager.getDisplayRows(this.rowManager.displayRows.length-2):this.rowManager.getDisplayRows()}};const Ce=class Ce extends D{constructor(e){super(e),this.config={},this.cloneTableStyle=!0,this.colVisProp="",this.colVisPropAttach="",this.registerTableOption("htmlOutputConfig",!1),this.registerColumnOption("htmlOutput"),this.registerColumnOption("titleHtmlOutput")}initialize(){this.registerTableFunction("getHtml",this.getHtml.bind(this))}generateExportList(e,t,i,s){var r,o,a,l;return this.cloneTableStyle=t,this.config=e||{},this.colVisProp=s,this.colVisPropAttach=this.colVisProp.charAt(0).toUpperCase()+this.colVisProp.slice(1),l=Ce.columnLookups[i],l&&(a=l.call(this.table),a=a.filter(h=>this.columnVisCheck(h))),r=this.config.columnHeaders!==!1?this.headersToExportRows(this.generateColumnGroupHeaders(a)):[],a&&(a=a.map(h=>h.getComponent())),o=this.bodyToExportRows(this.rowLookup(i),a),r.concat(o)}generateTable(e,t,i,s){var r=this.generateExportList(e,t,i,s);return this.generateTableElement(r)}rowLookup(e){var t=[],i;return typeof e=="function"?e.call(this.table).forEach(s=>{s=this.table.rowManager.findRow(s),s&&t.push(s)}):(i=Ce.rowLookups[e]||Ce.rowLookups.active,t=i.call(this.table)),Object.assign([],t)}generateColumnGroupHeaders(e){var t=[];return e||(e=this.config.columnGroups!==!1?this.table.columnManager.columns:this.table.columnManager.columnsByIndex),e.forEach(i=>{var s=this.processColumnGroup(i);s&&t.push(s)}),t}processColumnGroup(e){var t=e.columns,i=0,s=e.definition["title"+this.colVisPropAttach]||e.definition.title,r={title:s,column:e,depth:1};if(t.length){if(r.subGroups=[],r.width=0,t.forEach(o=>{var a=this.processColumnGroup(o);a&&(r.width+=a.width,r.subGroups.push(a),a.depth>i&&(i=a.depth))}),r.depth+=i,!r.width)return!1}else if(this.columnVisCheck(e))r.width=1;else return!1;return r}columnVisCheck(e){var t=e.definition[this.colVisProp];return this.config.rowHeaders===!1&&e.isRowHeader?!1:(typeof t=="function"&&(t=t.call(this.table,e.getComponent())),t===!1||t===!0?t:e.visible&&e.field)}headersToExportRows(e){var t=[],i=0,s=[];function r(o,a){var l=i-a;if(typeof t[a]>"u"&&(t[a]=[]),o.height=o.subGroups?1:l-o.depth+1,t[a].push(o),o.height>1)for(let h=1;h<o.height;h++)typeof t[a+h]>"u"&&(t[a+h]=[]),t[a+h].push(!1);if(o.width>1)for(let h=1;h<o.width;h++)t[a].push(!1);o.subGroups&&o.subGroups.forEach(function(h){r(h,a+1)})}return e.forEach(function(o){o.depth>i&&(i=o.depth)}),e.forEach(function(o){r(o,0)}),t.forEach(o=>{var a=[];o.forEach(l=>{if(l){let h=typeof l.title>"u"?"":l.title;a.push(new ti(h,l.column.getComponent(),l.width,l.height,l.depth))}else a.push(null)}),s.push(new bs("header",a))}),s}bodyToExportRows(e,t=[]){var i=[];return t.length===0&&this.table.columnManager.columnsByIndex.forEach(s=>{this.columnVisCheck(s)&&t.push(s.getComponent())}),this.config.columnCalcs!==!1&&this.table.modExists("columnCalcs")&&(this.table.modules.columnCalcs.topInitialized&&e.unshift(this.table.modules.columnCalcs.topRow),this.table.modules.columnCalcs.botInitialized&&e.push(this.table.modules.columnCalcs.botRow)),e=e.filter(s=>{switch(s.type){case"group":return this.config.rowGroups!==!1;case"calc":return this.config.columnCalcs!==!1;case"row":return!(this.table.options.dataTree&&this.config.dataTree===!1&&s.modules.dataTree.parent)}return!0}),e.forEach((s,r)=>{var o=s.getData(this.colVisProp),a=[],l=0;switch(s.type){case"group":l=s.level,a.push(new ti(s.key,s.getComponent(),t.length,1));break;case"calc":case"row":t.forEach(h=>{a.push(new ti(h._column.getFieldValue(o),h,1,1))}),this.table.options.dataTree&&this.config.dataTree!==!1&&(l=s.modules.dataTree.index);break}i.push(new bs(s.type,a,s.getComponent(),l))}),i}generateTableElement(e){var t=document.createElement("table"),i=document.createElement("thead"),s=document.createElement("tbody"),r=this.lookupTableStyles(),o=this.table.options["rowFormatter"+this.colVisPropAttach],a={};return a.rowFormatter=o!==null?o:this.table.options.rowFormatter,this.table.options.dataTree&&this.config.dataTree!==!1&&this.table.modExists("columnCalcs")&&(a.treeElementField=this.table.modules.dataTree.elementField),a.groupHeader=this.table.options["groupHeader"+this.colVisPropAttach],a.groupHeader&&!Array.isArray(a.groupHeader)&&(a.groupHeader=[a.groupHeader]),t.classList.add("tabulator-print-table"),this.mapElementStyles(this.table.columnManager.getHeadersElement(),i,["border-top","border-left","border-right","border-bottom","background-color","color","font-weight","font-family","font-size"]),e.length>1e3&&console.warn("It may take a long time to render an HTML table with more than 1000 rows"),e.forEach((l,h)=>{let d;switch(l.type){case"header":i.appendChild(this.generateHeaderElement(l,a,r));break;case"group":s.appendChild(this.generateGroupElement(l,a,r));break;case"calc":s.appendChild(this.generateCalcElement(l,a,r));break;case"row":d=this.generateRowElement(l,a,r),this.mapElementStyles(h%2&&r.evenRow?r.evenRow:r.oddRow,d,["border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size","background-color"]),s.appendChild(d);break}}),i.innerHTML&&t.appendChild(i),t.appendChild(s),this.mapElementStyles(this.table.element,t,["border-top","border-left","border-right","border-bottom"]),t}lookupTableStyles(){var e={};return this.cloneTableStyle&&window.getComputedStyle&&(e.oddRow=this.table.element.querySelector(".tabulator-row-odd:not(.tabulator-group):not(.tabulator-calcs)"),e.evenRow=this.table.element.querySelector(".tabulator-row-even:not(.tabulator-group):not(.tabulator-calcs)"),e.calcRow=this.table.element.querySelector(".tabulator-row.tabulator-calcs"),e.firstRow=this.table.element.querySelector(".tabulator-row:not(.tabulator-group):not(.tabulator-calcs)"),e.firstGroup=this.table.element.getElementsByClassName("tabulator-group")[0],e.firstRow&&(e.styleCells=e.firstRow.getElementsByClassName("tabulator-cell"),e.styleRowHeader=e.firstRow.getElementsByClassName("tabulator-row-header")[0],e.firstCell=e.styleCells[0],e.lastCell=e.styleCells[e.styleCells.length-1])),e}generateHeaderElement(e,t,i){var s=document.createElement("tr");return e.columns.forEach(r=>{if(r){var o=document.createElement("th"),a=r.component._column.definition.cssClass?r.component._column.definition.cssClass.split(" "):[];o.colSpan=r.width,o.rowSpan=r.height,o.innerHTML=r.value,this.cloneTableStyle&&(o.style.boxSizing="border-box"),a.forEach(function(l){o.classList.add(l)}),this.mapElementStyles(r.component.getElement(),o,["text-align","border-left","border-right","background-color","color","font-weight","font-family","font-size"]),this.mapElementStyles(r.component._column.contentElement,o,["padding-top","padding-left","padding-right","padding-bottom"]),r.component._column.visible?this.mapElementStyles(r.component.getElement(),o,["width"]):r.component._column.definition.width&&(o.style.width=r.component._column.definition.width+"px"),r.component._column.parent&&r.component._column.parent.isGroup?this.mapElementStyles(r.component._column.parent.groupElement,o,["border-top"]):this.mapElementStyles(r.component.getElement(),o,["border-top"]),r.component._column.isGroup?this.mapElementStyles(r.component.getElement(),o,["border-bottom"]):this.mapElementStyles(this.table.columnManager.getElement(),o,["border-bottom"]),s.appendChild(o)}}),s}generateGroupElement(e,t,i){var s=document.createElement("tr"),r=document.createElement("td"),o=e.columns[0];return s.classList.add("tabulator-print-table-row"),t.groupHeader&&t.groupHeader[e.indent]?o.value=t.groupHeader[e.indent](o.value,e.component._group.getRowCount(),e.component._group.getData(),e.component):t.groupHeader!==!1&&(o.value=e.component._group.generator(o.value,e.component._group.getRowCount(),e.component._group.getData(),e.component)),r.colSpan=o.width,r.innerHTML=o.value,s.classList.add("tabulator-print-table-group"),s.classList.add("tabulator-group-level-"+e.indent),o.component.isVisible()&&s.classList.add("tabulator-group-visible"),this.mapElementStyles(i.firstGroup,s,["border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size","background-color"]),this.mapElementStyles(i.firstGroup,r,["padding-top","padding-left","padding-right","padding-bottom"]),s.appendChild(r),s}generateCalcElement(e,t,i){var s=this.generateRowElement(e,t,i);return s.classList.add("tabulator-print-table-calcs"),this.mapElementStyles(i.calcRow,s,["border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size","background-color"]),s}generateRowElement(e,t,i){var s=document.createElement("tr");if(s.classList.add("tabulator-print-table-row"),e.columns.forEach((r,o)=>{if(r){var a=document.createElement("td"),l=r.component._column,h=this.table,d=h.columnManager.findColumnIndex(l),c=r.value,u,f,p={modules:{},getValue:function(){return c},getField:function(){return l.definition.field},getElement:function(){return a},getType:function(){return"cell"},getColumn:function(){return l.getComponent()},getData:function(){return e.component.getData()},getRow:function(){return e.component},getTable:function(){return h},getComponent:function(){return p},column:l},m=l.definition.cssClass?l.definition.cssClass.split(" "):[];if(m.forEach(function(b){a.classList.add(b)}),this.table.modExists("format")&&this.config.formatCells!==!1)c=this.table.modules.format.formatExportValue(p,this.colVisProp);else switch(typeof c){case"object":c=c!==null?JSON.stringify(c):"";break;case"undefined":c="";break}c instanceof Node?a.appendChild(c):a.innerHTML=c,f=["padding-top","padding-left","padding-right","padding-bottom","border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size","text-align"],l.isRowHeader?(u=i.styleRowHeader,f.push("background-color")):u=i.styleCells&&i.styleCells[d]?i.styleCells[d]:i.firstCell,u&&(this.mapElementStyles(u,a,f),l.definition.align&&(a.style.textAlign=l.definition.align)),this.table.options.dataTree&&this.config.dataTree!==!1&&(t.treeElementField&&t.treeElementField==l.field||!t.treeElementField&&o==0)&&(e.component._row.modules.dataTree.controlEl&&a.insertBefore(e.component._row.modules.dataTree.controlEl.cloneNode(!0),a.firstChild),e.component._row.modules.dataTree.branchEl&&a.insertBefore(e.component._row.modules.dataTree.branchEl.cloneNode(!0),a.firstChild)),s.appendChild(a),p.modules.format&&p.modules.format.renderedCallback&&p.modules.format.renderedCallback()}}),t.rowFormatter&&e.type==="row"&&this.config.formatCells!==!1){let r=Object.assign(e.component);r.getElement=function(){return s},t.rowFormatter(e.component)}return s}generateHTMLTable(e){var t=document.createElement("div");return t.appendChild(this.generateTableElement(e)),t.innerHTML}getHtml(e,t,i,s){var r=this.generateExportList(i||this.table.options.htmlOutputConfig,t,e,s||"htmlOutput");return this.generateHTMLTable(r)}mapElementStyles(e,t,i){if(this.cloneTableStyle&&e&&t){var s={"background-color":"backgroundColor",color:"fontColor",width:"width","font-weight":"fontWeight","font-family":"fontFamily","font-size":"fontSize","text-align":"textAlign","border-top":"borderTop","border-left":"borderLeft","border-right":"borderRight","border-bottom":"borderBottom","padding-top":"paddingTop","padding-left":"paddingLeft","padding-right":"paddingRight","padding-bottom":"paddingBottom"};if(window.getComputedStyle){var r=window.getComputedStyle(e);i.forEach(function(o){t.style[s[o]]||(t.style[s[o]]=r.getPropertyValue(o))})}}}};w(Ce,"moduleName","export"),w(Ce,"columnLookups",Ro),w(Ce,"rowLookups",xo);let ki=Ce;var _o={"=":function(n,e,t,i){return e==n},"<":function(n,e,t,i){return e<n},"<=":function(n,e,t,i){return e<=n},">":function(n,e,t,i){return e>n},">=":function(n,e,t,i){return e>=n},"!=":function(n,e,t,i){return e!=n},regex:function(n,e,t,i){return typeof n=="string"&&(n=new RegExp(n)),n.test(e)},like:function(n,e,t,i){return n===null||typeof n>"u"?e===n:typeof e<"u"&&e!==null?String(e).toLowerCase().indexOf(n.toLowerCase())>-1:!1},keywords:function(n,e,t,i){var s=n.toLowerCase().split(typeof i.separator>"u"?" ":i.separator),r=String(e===null||typeof e>"u"?"":e).toLowerCase(),o=[];return s.forEach(a=>{r.includes(a)&&o.push(!0)}),i.matchAll?o.length===s.length:!!o.length},starts:function(n,e,t,i){return n===null||typeof n>"u"?e===n:typeof e<"u"&&e!==null?String(e).toLowerCase().startsWith(n.toLowerCase()):!1},ends:function(n,e,t,i){return n===null||typeof n>"u"?e===n:typeof e<"u"&&e!==null?String(e).toLowerCase().endsWith(n.toLowerCase()):!1},in:function(n,e,t,i){return Array.isArray(n)?n.length?n.indexOf(e)>-1:!0:(console.warn("Filter Error - filter value is not an array:",n),!1)}};const ce=class ce extends D{constructor(e){super(e),this.filterList=[],this.headerFilters={},this.headerFilterColumns=[],this.prevHeaderFilterChangeCheck="",this.prevHeaderFilterChangeCheck="{}",this.changed=!1,this.tableInitialized=!1,this.registerTableOption("filterMode","local"),this.registerTableOption("initialFilter",!1),this.registerTableOption("initialHeaderFilter",!1),this.registerTableOption("headerFilterLiveFilterDelay",300),this.registerTableOption("placeholderHeaderFilter",!1),this.registerColumnOption("headerFilter"),this.registerColumnOption("headerFilterPlaceholder"),this.registerColumnOption("headerFilterParams"),this.registerColumnOption("headerFilterEmptyCheck"),this.registerColumnOption("headerFilterFunc"),this.registerColumnOption("headerFilterFuncParams"),this.registerColumnOption("headerFilterLiveFilter"),this.registerTableFunction("searchRows",this.searchRows.bind(this)),this.registerTableFunction("searchData",this.searchData.bind(this)),this.registerTableFunction("setFilter",this.userSetFilter.bind(this)),this.registerTableFunction("refreshFilter",this.userRefreshFilter.bind(this)),this.registerTableFunction("addFilter",this.userAddFilter.bind(this)),this.registerTableFunction("getFilters",this.getFilters.bind(this)),this.registerTableFunction("setHeaderFilterFocus",this.userSetHeaderFilterFocus.bind(this)),this.registerTableFunction("getHeaderFilterValue",this.userGetHeaderFilterValue.bind(this)),this.registerTableFunction("setHeaderFilterValue",this.userSetHeaderFilterValue.bind(this)),this.registerTableFunction("getHeaderFilters",this.getHeaderFilters.bind(this)),this.registerTableFunction("removeFilter",this.userRemoveFilter.bind(this)),this.registerTableFunction("clearFilter",this.userClearFilter.bind(this)),this.registerTableFunction("clearHeaderFilter",this.userClearHeaderFilter.bind(this)),this.registerComponentFunction("column","headerFilterFocus",this.setHeaderFilterFocus.bind(this)),this.registerComponentFunction("column","reloadHeaderFilter",this.reloadHeaderFilter.bind(this)),this.registerComponentFunction("column","getHeaderFilterValue",this.getHeaderFilterValue.bind(this)),this.registerComponentFunction("column","setHeaderFilterValue",this.setHeaderFilterValue.bind(this))}initialize(){this.subscribe("column-init",this.initializeColumnHeaderFilter.bind(this)),this.subscribe("column-width-fit-before",this.hideHeaderFilterElements.bind(this)),this.subscribe("column-width-fit-after",this.showHeaderFilterElements.bind(this)),this.subscribe("table-built",this.tableBuilt.bind(this)),this.subscribe("placeholder",this.generatePlaceholder.bind(this)),this.table.options.filterMode==="remote"&&this.subscribe("data-params",this.remoteFilterParams.bind(this)),this.registerDataHandler(this.filter.bind(this),10)}tableBuilt(){this.table.options.initialFilter&&this.setFilter(this.table.options.initialFilter),this.table.options.initialHeaderFilter&&this.table.options.initialHeaderFilter.forEach(e=>{var t=this.table.columnManager.findColumn(e.field);if(t)this.setHeaderFilterValue(t,e.value);else return console.warn("Column Filter Error - No matching column found:",e.field),!1}),this.tableInitialized=!0}remoteFilterParams(e,t,i,s){return s.filter=this.getFilters(!0,!0),s}generatePlaceholder(e){if(this.table.options.placeholderHeaderFilter&&Object.keys(this.headerFilters).length)return this.table.options.placeholderHeaderFilter}userSetFilter(e,t,i,s){this.setFilter(e,t,i,s),this.refreshFilter()}userRefreshFilter(){this.refreshFilter()}userAddFilter(e,t,i,s){this.addFilter(e,t,i,s),this.refreshFilter()}userSetHeaderFilterFocus(e){var t=this.table.columnManager.findColumn(e);if(t)this.setHeaderFilterFocus(t);else return console.warn("Column Filter Focus Error - No matching column found:",e),!1}userGetHeaderFilterValue(e){var t=this.table.columnManager.findColumn(e);if(t)return this.getHeaderFilterValue(t);console.warn("Column Filter Error - No matching column found:",e)}userSetHeaderFilterValue(e,t){var i=this.table.columnManager.findColumn(e);if(i)this.setHeaderFilterValue(i,t);else return console.warn("Column Filter Error - No matching column found:",e),!1}userRemoveFilter(e,t,i){this.removeFilter(e,t,i),this.refreshFilter()}userClearFilter(e){this.clearFilter(e),this.refreshFilter()}userClearHeaderFilter(){this.clearHeaderFilter(),this.refreshFilter()}searchRows(e,t,i){return this.search("rows",e,t,i)}searchData(e,t,i){return this.search("data",e,t,i)}initializeColumnHeaderFilter(e){var t=e.definition;t.headerFilter&&this.initializeColumn(e)}initializeColumn(e,t){var i=this,s=e.getField();function r(o){var a=e.modules.filter.tagType=="input"&&e.modules.filter.attrType=="text"||e.modules.filter.tagType=="textarea"?"partial":"match",l="",h="",d;if(typeof e.modules.filter.prevSuccess>"u"||e.modules.filter.prevSuccess!==o){if(e.modules.filter.prevSuccess=o,e.modules.filter.emptyFunc(o))delete i.headerFilters[s];else{switch(e.modules.filter.value=o,typeof e.definition.headerFilterFunc){case"string":ce.filters[e.definition.headerFilterFunc]?(l=e.definition.headerFilterFunc,d=function(c){var u=e.definition.headerFilterFuncParams||{},f=e.getFieldValue(c);return u=typeof u=="function"?u(o,f,c):u,ce.filters[e.definition.headerFilterFunc](o,f,c,u)}):console.warn("Header Filter Error - Matching filter function not found: ",e.definition.headerFilterFunc);break;case"function":d=function(c){var u=e.definition.headerFilterFuncParams||{},f=e.getFieldValue(c);return u=typeof u=="function"?u(o,f,c):u,e.definition.headerFilterFunc(o,f,c,u)},l=d;break}if(!d)switch(a){case"partial":d=function(c){var u=e.getFieldValue(c);return typeof u<"u"&&u!==null?String(u).toLowerCase().indexOf(String(o).toLowerCase())>-1:!1},l="like";break;default:d=function(c){return e.getFieldValue(c)==o},l="="}i.headerFilters[s]={value:o,func:d,type:l}}e.modules.filter.value=o,h=JSON.stringify(i.headerFilters),i.prevHeaderFilterChangeCheck!==h&&(i.prevHeaderFilterChangeCheck=h,i.trackChanges(),i.refreshFilter())}return!0}e.modules.filter={success:r,attrType:!1,tagType:!1,emptyFunc:!1},this.generateHeaderFilterElement(e)}generateHeaderFilterElement(e,t,i){var s=this,r=e.modules.filter.success,o=e.getField(),a,l,h,d,c,u,f,p;e.modules.filter.value=t;function m(){}function b(g){p=g}if(e.modules.filter.headerElement&&e.modules.filter.headerElement.parentNode&&e.contentElement.removeChild(e.modules.filter.headerElement.parentNode),o){switch(e.modules.filter.emptyFunc=e.definition.headerFilterEmptyCheck||function(g){return!g&&g!==0},a=document.createElement("div"),a.classList.add("tabulator-header-filter"),typeof e.definition.headerFilter){case"string":s.table.modules.edit.editors[e.definition.headerFilter]?(l=s.table.modules.edit.editors[e.definition.headerFilter],(e.definition.headerFilter==="tick"||e.definition.headerFilter==="tickCross")&&!e.definition.headerFilterEmptyCheck&&(e.modules.filter.emptyFunc=function(g){return g!==!0&&g!==!1})):console.warn("Filter Error - Cannot build header filter, No such editor found: ",e.definition.editor);break;case"function":l=e.definition.headerFilter;break;case"boolean":e.modules.edit&&e.modules.edit.editor?l=e.modules.edit.editor:e.definition.formatter&&s.table.modules.edit.editors[e.definition.formatter]?(l=s.table.modules.edit.editors[e.definition.formatter],(e.definition.formatter==="tick"||e.definition.formatter==="tickCross")&&!e.definition.headerFilterEmptyCheck&&(e.modules.filter.emptyFunc=function(g){return g!==!0&&g!==!1})):l=s.table.modules.edit.editors.input;break}if(l){if(d={getValue:function(){return typeof t<"u"?t:""},getField:function(){return e.definition.field},getElement:function(){return a},getColumn:function(){return e.getComponent()},getTable:()=>this.table,getType:()=>"header",getRow:function(){return{normalizeHeight:function(){}}}},f=e.definition.headerFilterParams||{},f=typeof f=="function"?f.call(s.table,d):f,h=l.call(this.table.modules.edit,d,b,r,m,f),!h){console.warn("Filter Error - Cannot add filter to "+o+" column, editor returned a value of false");return}if(!(h instanceof Node)){console.warn("Filter Error - Cannot add filter to "+o+" column, editor should return an instance of Node, the editor returned:",h);return}s.langBind("headerFilters|columns|"+e.definition.field,function(g){h.setAttribute("placeholder",typeof g<"u"&&g?g:e.definition.headerFilterPlaceholder||s.langText("headerFilters|default"))}),h.addEventListener("click",function(g){g.stopPropagation(),h.focus()}),h.addEventListener("focus",g=>{var R=this.table.columnManager.contentsElement.scrollLeft,E=this.table.rowManager.element.scrollLeft;R!==E&&(this.table.rowManager.scrollHorizontal(R),this.table.columnManager.scrollHorizontal(R))}),c=!1,u=function(g){c&&clearTimeout(c),c=setTimeout(function(){r(h.value)},s.table.options.headerFilterLiveFilterDelay)},e.modules.filter.headerElement=h,e.modules.filter.attrType=h.hasAttribute("type")?h.getAttribute("type").toLowerCase():"",e.modules.filter.tagType=h.tagName.toLowerCase(),e.definition.headerFilterLiveFilter!==!1&&(e.definition.headerFilter==="autocomplete"||e.definition.headerFilter==="tickCross"||(e.definition.editor==="autocomplete"||e.definition.editor==="tickCross")&&e.definition.headerFilter===!0||(h.addEventListener("keyup",u),h.addEventListener("search",u),e.modules.filter.attrType=="number"&&h.addEventListener("change",function(g){r(h.value)}),e.modules.filter.attrType=="text"&&this.table.browser!=="ie"&&h.setAttribute("type","search")),(e.modules.filter.tagType=="input"||e.modules.filter.tagType=="select"||e.modules.filter.tagType=="textarea")&&h.addEventListener("mousedown",function(g){g.stopPropagation()})),a.appendChild(h),e.contentElement.appendChild(a),i||s.headerFilterColumns.push(e),p&&p()}}else console.warn("Filter Error - Cannot add header filter, column has no field set:",e.definition.title)}hideHeaderFilterElements(){this.headerFilterColumns.forEach(function(e){e.modules.filter&&e.modules.filter.headerElement&&(e.modules.filter.headerElement.style.display="none")})}showHeaderFilterElements(){this.headerFilterColumns.forEach(function(e){e.modules.filter&&e.modules.filter.headerElement&&(e.modules.filter.headerElement.style.display="")})}setHeaderFilterFocus(e){e.modules.filter&&e.modules.filter.headerElement?e.modules.filter.headerElement.focus():console.warn("Column Filter Focus Error - No header filter set on column:",e.getField())}getHeaderFilterValue(e){if(e.modules.filter&&e.modules.filter.headerElement)return e.modules.filter.value;console.warn("Column Filter Error - No header filter set on column:",e.getField())}setHeaderFilterValue(e,t){e&&(e.modules.filter&&e.modules.filter.headerElement?(this.generateHeaderFilterElement(e,t,!0),e.modules.filter.success(t)):console.warn("Column Filter Error - No header filter set on column:",e.getField()))}reloadHeaderFilter(e){e&&(e.modules.filter&&e.modules.filter.headerElement?this.generateHeaderFilterElement(e,e.modules.filter.value,!0):console.warn("Column Filter Error - No header filter set on column:",e.getField()))}refreshFilter(){this.tableInitialized&&(this.table.options.filterMode==="remote"?this.reloadData(null,!1,!1):this.refreshData(!0))}trackChanges(){this.changed=!0,this.dispatch("filter-changed")}hasChanged(){var e=this.changed;return this.changed=!1,e}setFilter(e,t,i,s){this.filterList=[],Array.isArray(e)||(e=[{field:e,type:t,value:i,params:s}]),this.addFilter(e)}addFilter(e,t,i,s){var r=!1;Array.isArray(e)||(e=[{field:e,type:t,value:i,params:s}]),e.forEach(o=>{o=this.findFilter(o),o&&(this.filterList.push(o),r=!0)}),r&&this.trackChanges()}findFilter(e){var t;if(Array.isArray(e))return this.findSubFilters(e);var i=!1;return typeof e.field=="function"?i=function(s){return e.field(s,e.type||{})}:ce.filters[e.type]?(t=this.table.columnManager.getColumnByField(e.field),t?i=function(s){return ce.filters[e.type](e.value,t.getFieldValue(s),s,e.params||{})}:i=function(s){return ce.filters[e.type](e.value,s[e.field],s,e.params||{})}):console.warn("Filter Error - No such filter type found, ignoring: ",e.type),e.func=i,e.func?e:!1}findSubFilters(e){var t=[];return e.forEach(i=>{i=this.findFilter(i),i&&t.push(i)}),t.length?t:!1}getFilters(e,t){var i=[];return e&&(i=this.getHeaderFilters()),t&&i.forEach(function(s){typeof s.type=="function"&&(s.type="function")}),i=i.concat(this.filtersToArray(this.filterList,t)),i}filtersToArray(e,t){var i=[];return e.forEach(s=>{var r;Array.isArray(s)?i.push(this.filtersToArray(s,t)):(r={field:s.field,type:s.type,value:s.value},t&&typeof r.type=="function"&&(r.type="function"),i.push(r))}),i}getHeaderFilters(){var e=[];for(var t in this.headerFilters)e.push({field:t,type:this.headerFilters[t].type,value:this.headerFilters[t].value});return e}removeFilter(e,t,i){Array.isArray(e)||(e=[{field:e,type:t,value:i}]),e.forEach(s=>{var r=-1;typeof s.field=="object"?r=this.filterList.findIndex(o=>s===o):r=this.filterList.findIndex(o=>s.field===o.field&&s.type===o.type&&s.value===o.value),r>-1?this.filterList.splice(r,1):console.warn("Filter Error - No matching filter type found, ignoring: ",s.type)}),this.trackChanges()}clearFilter(e){this.filterList=[],e&&this.clearHeaderFilter(),this.trackChanges()}clearHeaderFilter(){this.headerFilters={},this.prevHeaderFilterChangeCheck="{}",this.headerFilterColumns.forEach(e=>{typeof e.modules.filter.value<"u"&&delete e.modules.filter.value,e.modules.filter.prevSuccess=void 0,this.reloadHeaderFilter(e)}),this.trackChanges()}search(e,t,i,s){var r=[],o=[];return Array.isArray(t)||(t=[{field:t,type:i,value:s}]),t.forEach(a=>{a=this.findFilter(a),a&&o.push(a)}),this.table.rowManager.rows.forEach(a=>{var l=!0;o.forEach(h=>{this.filterRecurse(h,a.getData())||(l=!1)}),l&&r.push(e==="data"?a.getData("data"):a.getComponent())}),r}filter(e,t){var i=[],s=[];return this.subscribedExternal("dataFiltering")&&this.dispatchExternal("dataFiltering",this.getFilters(!0)),this.table.options.filterMode!=="remote"&&(this.filterList.length||Object.keys(this.headerFilters).length)?e.forEach(r=>{this.filterRow(r)&&i.push(r)}):i=e.slice(0),this.subscribedExternal("dataFiltered")&&(i.forEach(r=>{s.push(r.getComponent())}),this.dispatchExternal("dataFiltered",this.getFilters(!0),s)),i}filterRow(e,t){var i=!0,s=e.getData();this.filterList.forEach(o=>{this.filterRecurse(o,s)||(i=!1)});for(var r in this.headerFilters)this.headerFilters[r].func(s)||(i=!1);return i}filterRecurse(e,t){var i=!1;return Array.isArray(e)?e.forEach(s=>{this.filterRecurse(s,t)&&(i=!0)}):i=e.func(t),i}};w(ce,"moduleName","filter"),w(ce,"filters",_o);let Ti=ce;function ko(n,e,t){return this.emptyToSpace(this.sanitizeHTML(n.getValue()))}function To(n,e,t){return n.getValue()}function Mo(n,e,t){return n.getElement().style.whiteSpace="pre-wrap",this.emptyToSpace(this.sanitizeHTML(n.getValue()))}function So(n,e,t){var i=parseFloat(n.getValue()),s="",r,o,a,l,h,d=e.decimal||".",c=e.thousand||",",u=e.negativeSign||"-",f=e.symbol||"",p=!!e.symbolAfter,m=typeof e.precision<"u"?e.precision:2;if(isNaN(i))return this.emptyToSpace(this.sanitizeHTML(n.getValue()));if(i<0&&(i=Math.abs(i),s=u),r=m!==!1?i.toFixed(m):i,r=String(r).split("."),o=r[0],a=r.length>1?d+r[1]:"",e.thousand!==!1)for(l=/(\d+)(\d{3})/;l.test(o);)o=o.replace(l,"$1"+c+"$2");return h=o+a,s===!0?(h="("+h+")",p?h+f:f+h):p?s+h+f:s+f+h}function Lo(n,e,t){var i=n.getValue(),s=e.urlPrefix||"",r=e.download,o=i,a=document.createElement("a"),l;function h(d,c){var u=d.shift(),f=c[u];return d.length&&typeof f=="object"?h(d,f):f}if(e.labelField&&(l=n.getData(),o=h(e.labelField.split(this.table.options.nestedFieldSeparator),l)),e.label)switch(typeof e.label){case"string":o=e.label;break;case"function":o=e.label(n);break}if(o){if(e.urlField&&(l=n.getData(),i=P.retrieveNestedData(this.table.options.nestedFieldSeparator,e.urlField,l)),e.url)switch(typeof e.url){case"string":i=e.url;break;case"function":i=e.url(n);break}return a.setAttribute("href",s+i),e.target&&a.setAttribute("target",e.target),e.download&&(typeof r=="function"?r=r(n):r=r===!0?"":r,a.setAttribute("download",r)),a.innerHTML=this.emptyToSpace(this.sanitizeHTML(o)),a}else return"&nbsp;"}function Do(n,e,t){var i=document.createElement("img"),s=n.getValue();switch(e.urlPrefix&&(s=e.urlPrefix+n.getValue()),e.urlSuffix&&(s=s+e.urlSuffix),i.setAttribute("src",s),typeof e.height){case"number":i.style.height=e.height+"px";break;case"string":i.style.height=e.height;break}switch(typeof e.width){case"number":i.style.width=e.width+"px";break;case"string":i.style.width=e.width;break}return i.addEventListener("load",function(){n.getRow().normalizeHeight()}),i}function zo(n,e,t){var i=n.getValue(),s=n.getElement(),r=e.allowEmpty,o=e.allowTruthy,a=Object.keys(e).includes("trueValue"),l=typeof e.tickElement<"u"?e.tickElement:'<svg enable-background="new 0 0 24 24" height="14" width="14" viewBox="0 0 24 24" xml:space="preserve" ><path fill="#2DC214" clip-rule="evenodd" d="M21.652,3.211c-0.293-0.295-0.77-0.295-1.061,0L9.41,14.34  c-0.293,0.297-0.771,0.297-1.062,0L3.449,9.351C3.304,9.203,3.114,9.13,2.923,9.129C2.73,9.128,2.534,9.201,2.387,9.351  l-2.165,1.946C0.078,11.445,0,11.63,0,11.823c0,0.194,0.078,0.397,0.223,0.544l4.94,5.184c0.292,0.296,0.771,0.776,1.062,1.07  l2.124,2.141c0.292,0.293,0.769,0.293,1.062,0l14.366-14.34c0.293-0.294,0.293-0.777,0-1.071L21.652,3.211z" fill-rule="evenodd"/></svg>',h=typeof e.crossElement<"u"?e.crossElement:'<svg enable-background="new 0 0 24 24" height="14" width="14"  viewBox="0 0 24 24" xml:space="preserve" ><path fill="#CE1515" d="M22.245,4.015c0.313,0.313,0.313,0.826,0,1.139l-6.276,6.27c-0.313,0.312-0.313,0.826,0,1.14l6.273,6.272  c0.313,0.313,0.313,0.826,0,1.14l-2.285,2.277c-0.314,0.312-0.828,0.312-1.142,0l-6.271-6.271c-0.313-0.313-0.828-0.313-1.141,0  l-6.276,6.267c-0.313,0.313-0.828,0.313-1.141,0l-2.282-2.28c-0.313-0.313-0.313-0.826,0-1.14l6.278-6.269  c0.313-0.312,0.313-0.826,0-1.14L1.709,5.147c-0.314-0.313-0.314-0.827,0-1.14l2.284-2.278C4.308,1.417,4.821,1.417,5.135,1.73  L11.405,8c0.314,0.314,0.828,0.314,1.141,0.001l6.276-6.267c0.312-0.312,0.826-0.312,1.141,0L22.245,4.015z"/></svg>';return a&&i===e.trueValue||!a&&(o&&i||i===!0||i==="true"||i==="True"||i===1||i==="1")?(s.setAttribute("aria-checked",!0),l||""):r&&(i==="null"||i===""||i===null||typeof i>"u")?(s.setAttribute("aria-checked","mixed"),""):(s.setAttribute("aria-checked",!1),h||"")}function Fo(n,e,t){var i=this.table.dependencyRegistry.lookup(["luxon","DateTime"],"DateTime"),s=e.inputFormat||"yyyy-MM-dd HH:mm:ss",r=e.outputFormat||"dd/MM/yyyy HH:mm:ss",o=typeof e.invalidPlaceholder<"u"?e.invalidPlaceholder:"",a=n.getValue();if(typeof i<"u"){var l;return i.isDateTime(a)?l=a:s==="iso"?l=i.fromISO(String(a)):l=i.fromFormat(String(a),s),l.isValid?(e.timezone&&(l=l.setZone(e.timezone)),l.toFormat(r)):o===!0||!a?a:typeof o=="function"?o(a):o}else console.error("Format Error - 'datetime' formatter is dependant on luxon.js")}function Ho(n,e,t){var i=this.table.dependencyRegistry.lookup(["luxon","DateTime"],"DateTime"),s=e.inputFormat||"yyyy-MM-dd HH:mm:ss",r=typeof e.invalidPlaceholder<"u"?e.invalidPlaceholder:"",o=typeof e.suffix<"u"?e.suffix:!1,a=typeof e.unit<"u"?e.unit:"days",l=typeof e.humanize<"u"?e.humanize:!1,h=typeof e.date<"u"?e.date:i.now(),d=n.getValue();if(typeof i<"u"){var c;return i.isDateTime(d)?c=d:s==="iso"?c=i.fromISO(String(d)):c=i.fromFormat(String(d),s),c.isValid?l?c.diff(h,a).toHuman()+(o?" "+o:""):parseInt(c.diff(h,a)[a])+(o?" "+o:""):r===!0?d:typeof r=="function"?r(d):r}else console.error("Format Error - 'datetimediff' formatter is dependant on luxon.js")}function Ao(n,e,t){var i=n.getValue();return typeof e[i]>"u"?(console.warn("Missing display value for "+i),i):e[i]}function Oo(n,e,t){var i=n.getValue(),s=n.getElement(),r=e&&e.stars?e.stars:5,o=document.createElement("span"),a=document.createElementNS("http://www.w3.org/2000/svg","svg"),l='<polygon fill="#FFEA00" stroke="#C1AB60" stroke-width="37.6152" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="259.216,29.942 330.27,173.919 489.16,197.007 374.185,309.08 401.33,467.31 259.216,392.612 117.104,467.31 144.25,309.08 29.274,197.007 188.165,173.919 "/>',h='<polygon fill="#D2D2D2" stroke="#686868" stroke-width="37.6152" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="259.216,29.942 330.27,173.919 489.16,197.007 374.185,309.08 401.33,467.31 259.216,392.612 117.104,467.31 144.25,309.08 29.274,197.007 188.165,173.919 "/>';o.style.verticalAlign="middle",a.setAttribute("width","14"),a.setAttribute("height","14"),a.setAttribute("viewBox","0 0 512 512"),a.setAttribute("xml:space","preserve"),a.style.padding="0 1px",i=i&&!isNaN(i)?parseInt(i):0,i=Math.max(0,Math.min(i,r));for(var d=1;d<=r;d++){var c=a.cloneNode(!0);c.innerHTML=d<=i?l:h,o.appendChild(c)}return s.style.whiteSpace="nowrap",s.style.overflow="hidden",s.style.textOverflow="ellipsis",s.setAttribute("aria-label",i),o}function Po(n,e,t){var i=this.sanitizeHTML(n.getValue())||0,s=document.createElement("span"),r=e&&e.max?e.max:100,o=e&&e.min?e.min:0,a=e&&typeof e.color<"u"?e.color:["red","orange","green"],l="#666666",h,d;if(!(isNaN(i)||typeof n.getValue()>"u")){switch(s.classList.add("tabulator-traffic-light"),d=parseFloat(i)<=r?parseFloat(i):r,d=parseFloat(d)>=o?parseFloat(d):o,h=(r-o)/100,d=Math.round((d-o)/h),typeof a){case"string":l=a;break;case"function":l=a(i);break;case"object":if(Array.isArray(a)){var c=100/a.length,u=Math.floor(d/c);u=Math.min(u,a.length-1),u=Math.max(u,0),l=a[u];break}}return s.style.backgroundColor=l,s}}function Bo(n,e={},t){var i=this.sanitizeHTML(n.getValue())||0,s=n.getElement(),r=e.max?e.max:100,o=e.min?e.min:0,a=e.legendAlign?e.legendAlign:"center",l,h,d,c,u;switch(h=parseFloat(i)<=r?parseFloat(i):r,h=parseFloat(h)>=o?parseFloat(h):o,l=(r-o)/100,h=Math.round((h-o)/l),typeof e.color){case"string":d=e.color;break;case"function":d=e.color(i);break;case"object":if(Array.isArray(e.color)){let b=100/e.color.length,g=Math.floor(h/b);g=Math.min(g,e.color.length-1),g=Math.max(g,0),d=e.color[g];break}default:d="#2DC214"}switch(typeof e.legend){case"string":c=e.legend;break;case"function":c=e.legend(i);break;case"boolean":c=i;break;default:c=!1}switch(typeof e.legendColor){case"string":u=e.legendColor;break;case"function":u=e.legendColor(i);break;case"object":if(Array.isArray(e.legendColor)){let b=100/e.legendColor.length,g=Math.floor(h/b);g=Math.min(g,e.legendColor.length-1),g=Math.max(g,0),u=e.legendColor[g]}break;default:u="#000"}s.style.minWidth="30px",s.style.position="relative",s.setAttribute("aria-label",h);var f=document.createElement("div");f.style.display="inline-block",f.style.width=h+"%",f.style.backgroundColor=d,f.style.height="100%",f.setAttribute("data-max",r),f.setAttribute("data-min",o);var p=document.createElement("div");if(p.style.position="relative",p.style.width="100%",p.style.height="100%",c){var m=document.createElement("div");m.style.position="absolute",m.style.top=0,m.style.left=0,m.style.textAlign=a,m.style.width="100%",m.style.color=u,m.innerHTML=c}return t(function(){if(!(n instanceof pn)){var b=document.createElement("div");b.style.position="absolute",b.style.top="4px",b.style.bottom="4px",b.style.left="4px",b.style.right="4px",s.appendChild(b),s=b}s.appendChild(p),p.appendChild(f),c&&p.appendChild(m)}),""}function Io(n,e,t){return n.getElement().style.backgroundColor=this.sanitizeHTML(n.getValue()),""}function No(n,e,t){return'<svg enable-background="new 0 0 24 24" height="14" width="14" viewBox="0 0 24 24" xml:space="preserve" ><path fill="#2DC214" clip-rule="evenodd" d="M21.652,3.211c-0.293-0.295-0.77-0.295-1.061,0L9.41,14.34  c-0.293,0.297-0.771,0.297-1.062,0L3.449,9.351C3.304,9.203,3.114,9.13,2.923,9.129C2.73,9.128,2.534,9.201,2.387,9.351  l-2.165,1.946C0.078,11.445,0,11.63,0,11.823c0,0.194,0.078,0.397,0.223,0.544l4.94,5.184c0.292,0.296,0.771,0.776,1.062,1.07  l2.124,2.141c0.292,0.293,0.769,0.293,1.062,0l14.366-14.34c0.293-0.294,0.293-0.777,0-1.071L21.652,3.211z" fill-rule="evenodd"/></svg>'}function Vo(n,e,t){return'<svg enable-background="new 0 0 24 24" height="14" width="14" viewBox="0 0 24 24" xml:space="preserve" ><path fill="#CE1515" d="M22.245,4.015c0.313,0.313,0.313,0.826,0,1.139l-6.276,6.27c-0.313,0.312-0.313,0.826,0,1.14l6.273,6.272  c0.313,0.313,0.313,0.826,0,1.14l-2.285,2.277c-0.314,0.312-0.828,0.312-1.142,0l-6.271-6.271c-0.313-0.313-0.828-0.313-1.141,0  l-6.276,6.267c-0.313,0.313-0.828,0.313-1.141,0l-2.282-2.28c-0.313-0.313-0.313-0.826,0-1.14l6.278-6.269  c0.313-0.312,0.313-0.826,0-1.14L1.709,5.147c-0.314-0.313-0.314-0.827,0-1.14l2.284-2.278C4.308,1.417,4.821,1.417,5.135,1.73  L11.405,8c0.314,0.314,0.828,0.314,1.141,0.001l6.276-6.267c0.312-0.312,0.826-0.312,1.141,0L22.245,4.015z"/></svg>'}function Wo(n,e,t){var i=n.getValue(),s=e.size||15,r=s+"px",o,a,l=e.hasOwnProperty("onValue")?e.onValue:!0,h=e.hasOwnProperty("offValue")?e.offValue:!1,d=e.onTruthy?i:i===l;return o=document.createElement("div"),o.classList.add("tabulator-toggle"),d?(o.classList.add("tabulator-toggle-on"),o.style.flexDirection="row-reverse",e.onColor&&(o.style.background=e.onColor)):e.offColor&&(o.style.background=e.offColor),o.style.width=2.5*s+"px",o.style.borderRadius=r,e.clickable&&o.addEventListener("click",c=>{n.setValue(d?h:l)}),a=document.createElement("div"),a.classList.add("tabulator-toggle-switch"),a.style.height=r,a.style.width=r,a.style.borderRadius=r,o.appendChild(a),o}function Go(n,e,t){var i=document.createElement("span"),s=n.getRow(),r=n.getTable();return s.watchPosition(o=>{e.relativeToPage&&(o+=r.modules.page.getPageSize()*(r.modules.page.getPage()-1)),i.innerText=o}),i}function jo(n,e,t){return n.getElement().classList.add("tabulator-row-handle"),"<div class='tabulator-row-handle-box'><div class='tabulator-row-handle-bar'></div><div class='tabulator-row-handle-bar'></div><div class='tabulator-row-handle-bar'></div></div>"}function Uo(n,e,t){var i,s,r;function o(a){var l=a.getValue(),h="plaintext";switch(typeof l){case"boolean":h="tickCross";break;case"string":l.includes(`
`)&&(h="textarea");break}return h}return i=e.formatterLookup?e.formatterLookup(n):o(n),e.paramsLookup&&(r=typeof e.paramsLookup=="function"?e.paramsLookup(i,n):e.paramsLookup[i]),s=this.table.modules.format.lookupFormatter(i),s.call(this,n,r||{},t)}function $o(n,e,t){var i=e.delimiter||",",s=n.getValue(),r=this.table,o;return e.valueMap&&(typeof e.valueMap=="string"?o=function(a){return a.map(l=>P.retrieveNestedData(r.options.nestedFieldSeparator,e.valueMap,l))}:o=e.valueMap),Array.isArray(s)?(o&&(s=o(s)),s.join(i)):s}function Zo(n,e,t){var i=e.indent||"	",s=typeof e.multiline>"u"?!0:e.multiline,r=e.replacer||null,o=n.getValue();return s&&(n.getElement().style.whiteSpace="pre-wrap"),JSON.stringify(o,r,i)}var Xo={plaintext:ko,html:To,textarea:Mo,money:So,link:Lo,image:Do,tickCross:zo,datetime:Fo,datetimediff:Ho,lookup:Ao,star:Oo,traffic:Po,progress:Bo,color:Io,buttonTick:No,buttonCross:Vo,toggle:Wo,rownum:Go,handle:jo,adaptable:Uo,array:$o,json:Zo};const ye=class ye extends D{constructor(e){super(e),this.registerColumnOption("formatter"),this.registerColumnOption("formatterParams"),this.registerColumnOption("formatterPrint"),this.registerColumnOption("formatterPrintParams"),this.registerColumnOption("formatterClipboard"),this.registerColumnOption("formatterClipboardParams"),this.registerColumnOption("formatterHtmlOutput"),this.registerColumnOption("formatterHtmlOutputParams"),this.registerColumnOption("titleFormatter"),this.registerColumnOption("titleFormatterParams")}initialize(){this.subscribe("cell-format",this.formatValue.bind(this)),this.subscribe("cell-rendered",this.cellRendered.bind(this)),this.subscribe("column-layout",this.initializeColumn.bind(this)),this.subscribe("column-format",this.formatHeader.bind(this))}initializeColumn(e){e.modules.format=this.lookupTypeFormatter(e,""),typeof e.definition.formatterPrint<"u"&&(e.modules.format.print=this.lookupTypeFormatter(e,"Print")),typeof e.definition.formatterClipboard<"u"&&(e.modules.format.clipboard=this.lookupTypeFormatter(e,"Clipboard")),typeof e.definition.formatterHtmlOutput<"u"&&(e.modules.format.htmlOutput=this.lookupTypeFormatter(e,"HtmlOutput"))}lookupTypeFormatter(e,t){var i={params:e.definition["formatter"+t+"Params"]||{}},s=e.definition["formatter"+t];return i.formatter=this.lookupFormatter(s),i}lookupFormatter(e){var t;switch(typeof e){case"string":ye.formatters[e]?t=ye.formatters[e]:(console.warn("Formatter Error - No such formatter found: ",e),t=ye.formatters.plaintext);break;case"function":t=e;break;default:t=ye.formatters.plaintext;break}return t}cellRendered(e){e.modules.format&&e.modules.format.renderedCallback&&!e.modules.format.rendered&&(e.modules.format.renderedCallback(),e.modules.format.rendered=!0)}formatHeader(e,t,i){var s,r,o,a;return e.definition.titleFormatter?(s=this.lookupFormatter(e.definition.titleFormatter),o=l=>{e.titleFormatterRendered=l},a={getValue:function(){return t},getElement:function(){return i},getType:function(){return"header"},getColumn:function(){return e.getComponent()},getTable:()=>this.table},r=e.definition.titleFormatterParams||{},r=typeof r=="function"?r():r,s.call(this,a,r,o)):t}formatValue(e){var t=e.getComponent(),i=typeof e.column.modules.format.params=="function"?e.column.modules.format.params(t):e.column.modules.format.params;function s(r){e.modules.format||(e.modules.format={}),e.modules.format.renderedCallback=r,e.modules.format.rendered=!1}return e.column.modules.format.formatter.call(this,t,i,s)}formatExportValue(e,t){var i=e.column.modules.format[t],s;if(i){let r=function(o){e.modules.format||(e.modules.format={}),e.modules.format.renderedCallback=o,e.modules.format.rendered=!1};return s=typeof i.params=="function"?i.params(e.getComponent()):i.params,i.formatter.call(this,e.getComponent(),s,r)}else return this.formatValue(e)}sanitizeHTML(e){if(e){var t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};return String(e).replace(/[&<>"'`=/]/g,function(i){return t[i]})}else return e}emptyToSpace(e){return e===null||typeof e>"u"||e===""?"&nbsp;":e}};w(ye,"moduleName","format"),w(ye,"formatters",Xo);let Mi=ye;class vn extends D{constructor(e){super(e),this.leftColumns=[],this.rightColumns=[],this.initializationMode="left",this.active=!1,this.blocked=!0,this.registerColumnOption("frozen")}reset(){this.initializationMode="left",this.leftColumns=[],this.rightColumns=[],this.active=!1}initialize(){this.subscribe("cell-layout",this.layoutCell.bind(this)),this.subscribe("column-init",this.initializeColumn.bind(this)),this.subscribe("column-width",this.layout.bind(this)),this.subscribe("row-layout-after",this.layoutRow.bind(this)),this.subscribe("table-layout",this.layout.bind(this)),this.subscribe("columns-loading",this.reset.bind(this)),this.subscribe("column-add",this.reinitializeColumns.bind(this)),this.subscribe("column-deleted",this.reinitializeColumns.bind(this)),this.subscribe("column-hide",this.reinitializeColumns.bind(this)),this.subscribe("column-show",this.reinitializeColumns.bind(this)),this.subscribe("columns-loaded",this.reinitializeColumns.bind(this)),this.subscribe("table-redraw",this.layout.bind(this)),this.subscribe("layout-refreshing",this.blockLayout.bind(this)),this.subscribe("layout-refreshed",this.unblockLayout.bind(this)),this.subscribe("scrollbar-vertical",this.adjustForScrollbar.bind(this))}blockLayout(){this.blocked=!0}unblockLayout(){this.blocked=!1}layoutCell(e){this.layoutElement(e.element,e.column)}reinitializeColumns(){this.reset(),this.table.columnManager.columnsByIndex.forEach(e=>{this.initializeColumn(e)}),this.layout()}initializeColumn(e){var t={margin:0,edge:!1};e.isGroup||(this.frozenCheck(e)?(t.position=this.initializationMode,this.initializationMode=="left"?this.leftColumns.push(e):this.rightColumns.unshift(e),this.active=!0,e.modules.frozen=t):this.initializationMode="right")}frozenCheck(e){return e.parent.isGroup&&e.definition.frozen&&console.warn("Frozen Column Error - Parent column group must be frozen, not individual columns or sub column groups"),e.parent.isGroup?this.frozenCheck(e.parent):e.definition.frozen}layoutCalcRows(){this.table.modExists("columnCalcs")&&(this.table.modules.columnCalcs.topInitialized&&this.table.modules.columnCalcs.topRow&&this.layoutRow(this.table.modules.columnCalcs.topRow),this.table.modules.columnCalcs.botInitialized&&this.table.modules.columnCalcs.botRow&&this.layoutRow(this.table.modules.columnCalcs.botRow),this.table.modExists("groupRows")&&this.layoutGroupCalcs(this.table.modules.groupRows.getGroups()))}layoutGroupCalcs(e){e.forEach(t=>{t.calcs.top&&this.layoutRow(t.calcs.top),t.calcs.bottom&&this.layoutRow(t.calcs.bottom),t.groupList&&t.groupList.length&&this.layoutGroupCalcs(t.groupList)})}layoutColumnPosition(e){var t=[],i=0,s=0;this.leftColumns.forEach((r,o)=>{if(r.modules.frozen.marginValue=i,r.modules.frozen.margin=r.modules.frozen.marginValue+"px",r.visible&&(i+=r.getWidth()),o==this.leftColumns.length-1?r.modules.frozen.edge=!0:r.modules.frozen.edge=!1,r.parent.isGroup){var a=this.getColGroupParentElement(r);t.includes(a)||(this.layoutElement(a,r),t.push(a)),a.classList.toggle("tabulator-frozen-left",r.modules.frozen.edge&&r.modules.frozen.position==="left"),a.classList.toggle("tabulator-frozen-right",r.modules.frozen.edge&&r.modules.frozen.position==="right")}else this.layoutElement(r.getElement(),r);e&&r.cells.forEach(l=>{this.layoutElement(l.getElement(!0),r)})}),this.rightColumns.forEach((r,o)=>{r.modules.frozen.marginValue=s,r.modules.frozen.margin=r.modules.frozen.marginValue+"px",r.visible&&(s+=r.getWidth()),o==this.rightColumns.length-1?r.modules.frozen.edge=!0:r.modules.frozen.edge=!1,r.parent.isGroup?this.layoutElement(this.getColGroupParentElement(r),r):this.layoutElement(r.getElement(),r),e&&r.cells.forEach(a=>{this.layoutElement(a.getElement(!0),r)})})}getColGroupParentElement(e){return e.parent.isGroup?this.getColGroupParentElement(e.parent):e.getElement()}layout(){this.active&&!this.blocked&&(this.layoutColumnPosition(),this.reinitializeRows(),this.layoutCalcRows())}reinitializeRows(){var e=this.table.rowManager.getVisibleRows(!0),t=this.table.rowManager.getRows().filter(i=>!e.includes(i));t.forEach(i=>{i.deinitialize()}),e.forEach(i=>{i.type==="row"&&this.layoutRow(i)})}layoutRow(e){this.table.options.layout==="fitDataFill"&&this.rightColumns.length&&(this.table.rowManager.getTableElement().style.minWidth="calc(100% - "+this.rightMargin+")"),this.leftColumns.forEach(t=>{var i=e.getCell(t);i&&this.layoutElement(i.getElement(!0),t)}),this.rightColumns.forEach(t=>{var i=e.getCell(t);i&&this.layoutElement(i.getElement(!0),t)})}layoutElement(e,t){var i;t.modules.frozen&&e&&(e.style.position="sticky",this.table.rtl?i=t.modules.frozen.position==="left"?"right":"left":i=t.modules.frozen.position,e.style[i]=t.modules.frozen.margin,e.classList.add("tabulator-frozen"),e.classList.toggle("tabulator-frozen-left",t.modules.frozen.edge&&t.modules.frozen.position==="left"),e.classList.toggle("tabulator-frozen-right",t.modules.frozen.edge&&t.modules.frozen.position==="right"))}adjustForScrollbar(e){this.rightColumns.length&&(this.table.columnManager.getContentsElement().style.width="calc(100% - "+e+"px)")}getFrozenColumns(){return this.leftColumns.concat(this.rightColumns)}_calcSpace(e,t){var i=0;for(let s=0;s<t;s++)e[s].visible&&(i+=e[s].getWidth());return i}}w(vn,"moduleName","frozenColumns");class wn extends D{constructor(e){super(e),this.topElement=document.createElement("div"),this.rows=[],this.registerComponentFunction("row","freeze",this.freezeRow.bind(this)),this.registerComponentFunction("row","unfreeze",this.unfreezeRow.bind(this)),this.registerComponentFunction("row","isFrozen",this.isRowFrozen.bind(this)),this.registerTableOption("frozenRowsField","id"),this.registerTableOption("frozenRows",!1)}initialize(){var e=document.createDocumentFragment();this.rows=[],this.topElement.classList.add("tabulator-frozen-rows-holder"),e.appendChild(document.createElement("br")),e.appendChild(this.topElement),this.table.columnManager.getContentsElement().insertBefore(e,this.table.columnManager.headersElement.nextSibling),this.subscribe("row-deleting",this.detachRow.bind(this)),this.subscribe("rows-visible",this.visibleRows.bind(this)),this.registerDisplayHandler(this.getRows.bind(this),10),this.table.options.frozenRows&&(this.subscribe("data-processed",this.initializeRows.bind(this)),this.subscribe("row-added",this.initializeRow.bind(this)),this.subscribe("table-redrawing",this.resizeHolderWidth.bind(this)),this.subscribe("column-resized",this.resizeHolderWidth.bind(this)),this.subscribe("column-show",this.resizeHolderWidth.bind(this)),this.subscribe("column-hide",this.resizeHolderWidth.bind(this))),this.resizeHolderWidth()}resizeHolderWidth(){this.topElement.style.minWidth=this.table.columnManager.headersElement.offsetWidth+"px"}initializeRows(){this.table.rowManager.getRows().forEach(e=>{this.initializeRow(e)})}initializeRow(e){var t=this.table.options.frozenRows,i=typeof t;i==="number"?e.getPosition()&&e.getPosition()+this.rows.length<=t&&this.freezeRow(e):i==="function"?t.call(this.table,e.getComponent())&&this.freezeRow(e):Array.isArray(t)&&t.includes(e.data[this.options("frozenRowsField")])&&this.freezeRow(e)}isRowFrozen(e){var t=this.rows.indexOf(e);return t>-1}isFrozen(){return!!this.rows.length}visibleRows(e,t){return this.rows.forEach(i=>{t.push(i)}),t}getRows(e){var t=e.slice(0);return this.rows.forEach(function(i){var s=t.indexOf(i);s>-1&&t.splice(s,1)}),t}freezeRow(e){e.modules.frozen?console.warn("Freeze Error - Row is already frozen"):(e.modules.frozen=!0,this.topElement.appendChild(e.getElement()),e.initialize(),e.normalizeHeight(),this.rows.push(e),this.refreshData(!1,"display"),this.table.rowManager.adjustTableSize(),this.styleRows())}unfreezeRow(e){e.modules.frozen?(e.modules.frozen=!1,this.detachRow(e),this.table.rowManager.adjustTableSize(),this.refreshData(!1,"display"),this.rows.length&&this.styleRows()):console.warn("Freeze Error - Row is already unfrozen")}detachRow(e){var t=this.rows.indexOf(e);if(t>-1){var i=e.getElement();i.parentNode&&i.parentNode.removeChild(i),this.rows.splice(t,1)}}styleRows(e){this.rows.forEach((t,i)=>{this.table.rowManager.styleRow(t,i)})}}w(wn,"moduleName","frozenRows");class Ko{constructor(e){return this._group=e,this.type="GroupComponent",new Proxy(this,{get:function(t,i,s){return typeof t[i]<"u"?t[i]:t._group.groupManager.table.componentFunctionBinder.handle("group",t._group,i)}})}getKey(){return this._group.key}getField(){return this._group.field}getElement(){return this._group.element}getRows(){return this._group.getRows(!0)}getSubGroups(){return this._group.getSubGroups(!0)}getParentGroup(){return this._group.parent?this._group.parent.getComponent():!1}isVisible(){return this._group.visible}show(){this._group.show()}hide(){this._group.hide()}toggle(){this._group.toggleVisibility()}scrollTo(e,t){return this._group.groupManager.table.rowManager.scrollToRow(this._group,e,t)}_getSelf(){return this._group}getTable(){return this._group.groupManager.table}}class qe{constructor(e,t,i,s,r,o,a){this.groupManager=e,this.parent=t,this.key=s,this.level=i,this.field=r,this.hasSubGroups=i<e.groupIDLookups.length-1,this.addRow=this.hasSubGroups?this._addRowToGroup:this._addRow,this.type="group",this.old=a,this.rows=[],this.groups=[],this.groupList=[],this.generator=o,this.element=!1,this.elementContents=!1,this.height=0,this.outerHeight=0,this.initialized=!1,this.calcs={},this.initialized=!1,this.modules={},this.arrowElement=!1,this.visible=a?a.visible:typeof e.startOpen[i]<"u"?e.startOpen[i]:e.startOpen[0],this.component=null,this.createElements(),this.addBindings(),this.createValueGroups()}wipe(e){e||(this.groupList.length?this.groupList.forEach(function(t){t.wipe()}):this.rows.forEach(t=>{t.modules&&delete t.modules.group})),this.element=!1,this.arrowElement=!1,this.elementContents=!1}createElements(){var e=document.createElement("div");e.classList.add("tabulator-arrow"),this.element=document.createElement("div"),this.element.classList.add("tabulator-row"),this.element.classList.add("tabulator-group"),this.element.classList.add("tabulator-group-level-"+this.level),this.element.setAttribute("role","rowgroup"),this.arrowElement=document.createElement("div"),this.arrowElement.classList.add("tabulator-group-toggle"),this.arrowElement.appendChild(e),this.groupManager.table.options.movableRows!==!1&&this.groupManager.table.modExists("moveRow")&&this.groupManager.table.modules.moveRow.initializeGroupHeader(this)}createValueGroups(){var e=this.level+1;this.groupManager.allowedValues&&this.groupManager.allowedValues[e]&&this.groupManager.allowedValues[e].forEach(t=>{this._createGroup(t,e)})}addBindings(){var e;this.groupManager.table.options.groupToggleElement&&(e=this.groupManager.table.options.groupToggleElement=="arrow"?this.arrowElement:this.element,e.addEventListener("click",t=>{this.groupManager.table.options.groupToggleElement==="arrow"&&(t.stopPropagation(),t.stopImmediatePropagation()),setTimeout(()=>{this.toggleVisibility()})}))}_createGroup(e,t){var i=t+"_"+e,s=new qe(this.groupManager,this,t,e,this.groupManager.groupIDLookups[t].field,this.groupManager.headerGenerator[t]||this.groupManager.headerGenerator[0],this.old?this.old.groups[i]:!1);this.groups[i]=s,this.groupList.push(s)}_addRowToGroup(e){var t=this.level+1;if(this.hasSubGroups){var i=this.groupManager.groupIDLookups[t].func(e.getData()),s=t+"_"+i;this.groupManager.allowedValues&&this.groupManager.allowedValues[t]?this.groups[s]&&this.groups[s].addRow(e):(this.groups[s]||this._createGroup(i,t),this.groups[s].addRow(e))}}_addRow(e){this.rows.push(e),e.modules.group=this}insertRow(e,t,i){var s=this.conformRowData({});e.updateData(s);var r=this.rows.indexOf(t);r>-1?i?this.rows.splice(r+1,0,e):this.rows.splice(r,0,e):i?this.rows.push(e):this.rows.unshift(e),e.modules.group=this,this.groupManager.table.modExists("columnCalcs")&&this.groupManager.table.options.columnCalcs!="table"&&this.groupManager.table.modules.columnCalcs.recalcGroup(this),this.groupManager.updateGroupRows(!0)}scrollHeader(e){this.arrowElement&&(this.arrowElement.style.marginLeft=e,this.groupList.forEach(function(t){t.scrollHeader(e)}))}getRowIndex(e){}conformRowData(e){return this.field?e[this.field]=this.key:console.warn("Data Conforming Error - Cannot conform row data to match new group as groupBy is a function"),this.parent&&(e=this.parent.conformRowData(e)),e}removeRow(e){var t=this.rows.indexOf(e),i=e.getElement();t>-1&&this.rows.splice(t,1),!this.groupManager.table.options.groupValues&&!this.rows.length?(this.parent?this.parent.removeGroup(this):this.groupManager.removeGroup(this),this.groupManager.updateGroupRows(!0)):(i.parentNode&&i.parentNode.removeChild(i),this.groupManager.blockRedraw||(this.generateGroupHeaderContents(),this.groupManager.table.modExists("columnCalcs")&&this.groupManager.table.options.columnCalcs!="table"&&this.groupManager.table.modules.columnCalcs.recalcGroup(this)))}removeGroup(e){var t=e.level+"_"+e.key,i;this.groups[t]&&(delete this.groups[t],i=this.groupList.indexOf(e),i>-1&&this.groupList.splice(i,1),this.groupList.length||(this.parent?this.parent.removeGroup(this):this.groupManager.removeGroup(this)))}getHeadersAndRows(){var e=[];return e.push(this),this._visSet(),this.calcs.top&&(this.calcs.top.detachElement(),this.calcs.top.deleteCells()),this.calcs.bottom&&(this.calcs.bottom.detachElement(),this.calcs.bottom.deleteCells()),this.visible?this.groupList.length?this.groupList.forEach(function(t){e=e.concat(t.getHeadersAndRows())}):(this.groupManager.table.options.columnCalcs!="table"&&this.groupManager.table.modExists("columnCalcs")&&this.groupManager.table.modules.columnCalcs.hasTopCalcs()&&(this.calcs.top=this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows),e.push(this.calcs.top)),e=e.concat(this.rows),this.groupManager.table.options.columnCalcs!="table"&&this.groupManager.table.modExists("columnCalcs")&&this.groupManager.table.modules.columnCalcs.hasBottomCalcs()&&(this.calcs.bottom=this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows),e.push(this.calcs.bottom))):!this.groupList.length&&this.groupManager.table.options.columnCalcs!="table"&&this.groupManager.table.modExists("columnCalcs")&&(this.groupManager.table.modules.columnCalcs.hasTopCalcs()&&this.groupManager.table.options.groupClosedShowCalcs&&(this.calcs.top=this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows),e.push(this.calcs.top)),this.groupManager.table.modules.columnCalcs.hasBottomCalcs()&&this.groupManager.table.options.groupClosedShowCalcs&&(this.calcs.bottom=this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows),e.push(this.calcs.bottom))),e}getData(e,t){var i=[];return this._visSet(),(!e||e&&this.visible)&&this.rows.forEach(s=>{i.push(s.getData(t||"data"))}),i}getRowCount(){var e=0;return this.groupList.length?this.groupList.forEach(t=>{e+=t.getRowCount()}):e=this.rows.length,e}toggleVisibility(){this.visible?this.hide():this.show()}hide(){this.visible=!1,this.groupManager.table.rowManager.getRenderMode()=="basic"&&!this.groupManager.table.options.pagination?(this.element.classList.remove("tabulator-group-visible"),this.groupList.length?this.groupList.forEach(e=>{var t=e.getHeadersAndRows();t.forEach(i=>{i.detachElement()})}):this.rows.forEach(e=>{var t=e.getElement();t.parentNode.removeChild(t)}),this.groupManager.updateGroupRows(!0)):this.groupManager.updateGroupRows(!0),this.groupManager.table.externalEvents.dispatch("groupVisibilityChanged",this.getComponent(),!1)}show(){if(this.visible=!0,this.groupManager.table.rowManager.getRenderMode()=="basic"&&!this.groupManager.table.options.pagination){this.element.classList.add("tabulator-group-visible");var e=this.generateElement();this.groupList.length?this.groupList.forEach(t=>{var i=t.getHeadersAndRows();i.forEach(s=>{var r=s.getElement();e.parentNode.insertBefore(r,e.nextSibling),s.initialize(),e=r})}):this.rows.forEach(t=>{var i=t.getElement();e.parentNode.insertBefore(i,e.nextSibling),t.initialize(),e=i}),this.groupManager.updateGroupRows(!0)}else this.groupManager.updateGroupRows(!0);this.groupManager.table.externalEvents.dispatch("groupVisibilityChanged",this.getComponent(),!0)}_visSet(){var e=[];typeof this.visible=="function"&&(this.rows.forEach(function(t){e.push(t.getData())}),this.visible=this.visible(this.key,this.getRowCount(),e,this.getComponent()))}getRowGroup(e){var t=!1;return this.groupList.length?this.groupList.forEach(function(i){var s=i.getRowGroup(e);s&&(t=s)}):this.rows.find(function(i){return i===e})&&(t=this),t}getSubGroups(e){var t=[];return this.groupList.forEach(function(i){t.push(e?i.getComponent():i)}),t}getRows(e,t){var i=[];return t&&this.groupList.length?this.groupList.forEach(s=>{i=i.concat(s.getRows(e,t))}):this.rows.forEach(function(s){i.push(e?s.getComponent():s)}),i}generateGroupHeaderContents(){var e=[],t=this.getRows(!1,!0);for(t.forEach(function(i){e.push(i.getData())}),this.elementContents=this.generator(this.key,this.getRowCount(),e,this.getComponent());this.element.firstChild;)this.element.removeChild(this.element.firstChild);typeof this.elementContents=="string"?this.element.innerHTML=this.elementContents:this.element.appendChild(this.elementContents),this.element.insertBefore(this.arrowElement,this.element.firstChild)}getPath(e=[]){return e.unshift(this.key),this.parent&&this.parent.getPath(e),e}getElement(){return this.elementContents?this.element:this.generateElement()}generateElement(){this.addBindings=!1,this._visSet(),this.visible?this.element.classList.add("tabulator-group-visible"):this.element.classList.remove("tabulator-group-visible");for(var e=0;e<this.element.childNodes.length;++e)this.element.childNodes[e].parentNode.removeChild(this.element.childNodes[e]);return this.generateGroupHeaderContents(),this.element}detachElement(){this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}normalizeHeight(){this.setHeight(this.element.clientHeight)}initialize(e){(!this.initialized||e)&&(this.normalizeHeight(),this.initialized=!0)}reinitialize(){this.initialized=!1,this.height=0,P.elVisible(this.element)&&this.initialize(!0)}setHeight(e){this.height!=e&&(this.height=e,this.outerHeight=this.element.offsetHeight)}getHeight(){return this.outerHeight}getGroup(){return this}reinitializeHeight(){}calcHeight(){}setCellHeight(){}clearCellHeight(){}deinitializeHeight(){}rendered(){}getComponent(){return this.component||(this.component=new Ko(this)),this.component}}class Cn extends D{constructor(e){super(e),this.groupIDLookups=!1,this.startOpen=[function(){return!1}],this.headerGenerator=[function(){return""}],this.groupList=[],this.allowedValues=!1,this.groups={},this.displayHandler=this.getRows.bind(this),this.blockRedraw=!1,this.registerTableOption("groupBy",!1),this.registerTableOption("groupStartOpen",!0),this.registerTableOption("groupValues",!1),this.registerTableOption("groupUpdateOnCellEdit",!1),this.registerTableOption("groupHeader",!1),this.registerTableOption("groupHeaderPrint",null),this.registerTableOption("groupHeaderClipboard",null),this.registerTableOption("groupHeaderHtmlOutput",null),this.registerTableOption("groupHeaderDownload",null),this.registerTableOption("groupToggleElement","arrow"),this.registerTableOption("groupClosedShowCalcs",!1),this.registerTableFunction("setGroupBy",this.setGroupBy.bind(this)),this.registerTableFunction("setGroupValues",this.setGroupValues.bind(this)),this.registerTableFunction("setGroupStartOpen",this.setGroupStartOpen.bind(this)),this.registerTableFunction("setGroupHeader",this.setGroupHeader.bind(this)),this.registerTableFunction("getGroups",this.userGetGroups.bind(this)),this.registerTableFunction("getGroupedData",this.userGetGroupedData.bind(this)),this.registerComponentFunction("row","getGroup",this.rowGetGroup.bind(this))}initialize(){this.subscribe("table-destroy",this._blockRedrawing.bind(this)),this.subscribe("rows-wipe",this._blockRedrawing.bind(this)),this.subscribe("rows-wiped",this._restore_redrawing.bind(this)),this.table.options.groupBy&&(this.table.options.groupUpdateOnCellEdit&&(this.subscribe("cell-value-updated",this.cellUpdated.bind(this)),this.subscribe("row-data-changed",this.reassignRowToGroup.bind(this),0)),this.subscribe("table-built",this.configureGroupSetup.bind(this)),this.subscribe("row-deleting",this.rowDeleting.bind(this)),this.subscribe("row-deleted",this.rowsUpdated.bind(this)),this.subscribe("scroll-horizontal",this.scrollHeaders.bind(this)),this.subscribe("rows-wipe",this.wipe.bind(this)),this.subscribe("rows-added",this.rowsUpdated.bind(this)),this.subscribe("row-moving",this.rowMoving.bind(this)),this.subscribe("row-adding-index",this.rowAddingIndex.bind(this)),this.subscribe("rows-sample",this.rowSample.bind(this)),this.subscribe("render-virtual-fill",this.virtualRenderFill.bind(this)),this.registerDisplayHandler(this.displayHandler,20),this.initialized=!0)}_blockRedrawing(){this.blockRedraw=!0}_restore_redrawing(){this.blockRedraw=!1}configureGroupSetup(){if(this.table.options.groupBy){var e=this.table.options.groupBy,t=this.table.options.groupStartOpen,i=this.table.options.groupHeader;if(this.allowedValues=this.table.options.groupValues,Array.isArray(e)&&Array.isArray(i)&&e.length>i.length&&console.warn("Error creating group headers, groupHeader array is shorter than groupBy array"),this.headerGenerator=[function(){return""}],this.startOpen=[function(){return!1}],this.langBind("groups|item",(r,o)=>{this.headerGenerator[0]=(a,l,h)=>(typeof a>"u"?"":a)+"<span>("+l+" "+(l===1?r:o.groups.items)+")</span>"}),this.groupIDLookups=[],e)this.table.modExists("columnCalcs")&&this.table.options.columnCalcs!="table"&&this.table.options.columnCalcs!="both"&&this.table.modules.columnCalcs.removeCalcs();else if(this.table.modExists("columnCalcs")&&this.table.options.columnCalcs!="group"){var s=this.table.columnManager.getRealColumns();s.forEach(r=>{r.definition.topCalc&&this.table.modules.columnCalcs.initializeTopRow(),r.definition.bottomCalc&&this.table.modules.columnCalcs.initializeBottomRow()})}Array.isArray(e)||(e=[e]),e.forEach((r,o)=>{var a,l;typeof r=="function"?a=r:(l=this.table.columnManager.getColumnByField(r),l?a=function(h){return l.getFieldValue(h)}:a=function(h){return h[r]}),this.groupIDLookups.push({field:typeof r=="function"?!1:r,func:a,values:this.allowedValues?this.allowedValues[o]:!1})}),t&&(Array.isArray(t)||(t=[t]),t.forEach(r=>{}),this.startOpen=t),i&&(this.headerGenerator=Array.isArray(i)?i:[i])}else this.groupList=[],this.groups={}}rowSample(e,t){if(this.table.options.groupBy){var i=this.getGroups(!1)[0];t.push(i.getRows(!1)[0])}return t}virtualRenderFill(){var e=this.table.rowManager.tableElement,t=this.table.rowManager.getVisibleRows();if(this.table.options.groupBy)t=t.filter(i=>i.type!=="group"),e.style.minWidth=t.length?"":this.table.columnManager.getWidth()+"px";else return t}rowAddingIndex(e,t,i){if(this.table.options.groupBy){this.assignRowToGroup(e);var s=e.modules.group.rows;return s.length>1&&(!t||t&&s.indexOf(t)==-1?i?s[0]!==e&&(t=s[0],this.table.rowManager.moveRowInArray(e.modules.group.rows,e,t,!i)):s[s.length-1]!==e&&(t=s[s.length-1],this.table.rowManager.moveRowInArray(e.modules.group.rows,e,t,!i)):this.table.rowManager.moveRowInArray(e.modules.group.rows,e,t,!i)),t}}trackChanges(){this.dispatch("group-changed")}setGroupBy(e){this.table.options.groupBy=e,this.initialized||this.initialize(),this.configureGroupSetup(),!e&&this.table.modExists("columnCalcs")&&this.table.options.columnCalcs===!0&&this.table.modules.columnCalcs.reinitializeCalcs(),this.refreshData(),this.trackChanges()}setGroupValues(e){this.table.options.groupValues=e,this.configureGroupSetup(),this.refreshData(),this.trackChanges()}setGroupStartOpen(e){this.table.options.groupStartOpen=e,this.configureGroupSetup(),this.table.options.groupBy?(this.refreshData(),this.trackChanges()):console.warn("Grouping Update - cant refresh view, no groups have been set")}setGroupHeader(e){this.table.options.groupHeader=e,this.configureGroupSetup(),this.table.options.groupBy?(this.refreshData(),this.trackChanges()):console.warn("Grouping Update - cant refresh view, no groups have been set")}userGetGroups(e){return this.getGroups(!0)}userGetGroupedData(){return this.table.options.groupBy?this.getGroupedData():this.getData()}rowGetGroup(e){return e.modules.group?e.modules.group.getComponent():!1}rowMoving(e,t,i){if(this.table.options.groupBy){!i&&t instanceof qe&&(t=this.table.rowManager.prevDisplayRow(e)||t);var s=t instanceof qe?t:t.modules.group,r=e instanceof qe?e:e.modules.group;s===r?this.table.rowManager.moveRowInArray(s.rows,e,t,i):(r&&r.removeRow(e),s.insertRow(e,t,i))}}rowDeleting(e){this.table.options.groupBy&&e.modules.group&&e.modules.group.removeRow(e)}rowsUpdated(e){this.table.options.groupBy&&this.updateGroupRows(!0)}cellUpdated(e){this.table.options.groupBy&&this.reassignRowToGroup(e.row)}getRows(e){return this.table.options.groupBy&&this.groupIDLookups.length?(this.dispatchExternal("dataGrouping"),this.generateGroups(e),this.subscribedExternal("dataGrouped")&&this.dispatchExternal("dataGrouped",this.getGroups(!0)),this.updateGroupRows()):e.slice(0)}getGroups(e){var t=[];return this.groupList.forEach(function(i){t.push(e?i.getComponent():i)}),t}getChildGroups(e){var t=[];return e||(e=this),e.groupList.forEach(i=>{i.groupList.length?t=t.concat(this.getChildGroups(i)):t.push(i)}),t}wipe(){this.table.options.groupBy&&(this.groupList.forEach(function(e){e.wipe()}),this.groupList=[],this.groups={})}pullGroupListData(e){var t=[];return e.forEach(i=>{var s={};s.level=0,s.rowCount=0,s.headerContent="";var r=[];i.hasSubGroups?(r=this.pullGroupListData(i.groupList),s.level=i.level,s.rowCount=r.length-i.groupList.length,s.headerContent=i.generator(i.key,s.rowCount,i.rows,i),t.push(s),t=t.concat(r)):(s.level=i.level,s.headerContent=i.generator(i.key,i.rows.length,i.rows,i),s.rowCount=i.getRows().length,t.push(s),i.getRows().forEach(o=>{t.push(o.getData("data"))}))}),t}getGroupedData(){return this.pullGroupListData(this.groupList)}getRowGroup(e){var t=!1;return this.options("dataTree")&&(e=this.table.modules.dataTree.getTreeParentRoot(e)),this.groupList.forEach(i=>{var s=i.getRowGroup(e);s&&(t=s)}),t}countGroups(){return this.groupList.length}generateGroups(e){var t=this.groups;this.groups={},this.groupList=[],this.allowedValues&&this.allowedValues[0]?(this.allowedValues[0].forEach(i=>{this.createGroup(i,0,t)}),e.forEach(i=>{this.assignRowToExistingGroup(i,t)})):e.forEach(i=>{this.assignRowToGroup(i,t)}),Object.values(t).forEach(i=>{i.wipe(!0)})}createGroup(e,t,i){var s=t+"_"+e,r;i=i||[],r=new qe(this,!1,t,e,this.groupIDLookups[0].field,this.headerGenerator[0],i[s]),this.groups[s]=r,this.groupList.push(r)}assignRowToExistingGroup(e,t){var i=this.groupIDLookups[0].func(e.getData()),s="0_"+i;this.groups[s]&&this.groups[s].addRow(e)}assignRowToGroup(e,t){var i=this.groupIDLookups[0].func(e.getData()),s=!this.groups["0_"+i];return s&&this.createGroup(i,0,t),this.groups["0_"+i].addRow(e),!s}reassignRowToGroup(e){if(e.type==="row"){var t=e.modules.group,i=t.getPath(),s=this.getExpectedPath(e),r;r=i.length==s.length&&i.every((o,a)=>o===s[a]),r||(t.removeRow(e),this.assignRowToGroup(e,this.groups),this.refreshData(!0))}}getExpectedPath(e){var t=[],i=e.getData();return this.groupIDLookups.forEach(s=>{t.push(s.func(i))}),t}updateGroupRows(e){var t=[];return this.blockRedraw||(this.groupList.forEach(i=>{t=t.concat(i.getHeadersAndRows())}),e&&this.refreshData(!0)),t}scrollHeaders(e){this.table.options.groupBy&&(this.table.options.renderHorizontal==="virtual"&&(e-=this.table.columnManager.renderer.vDomPadLeft),e=e+"px",this.groupList.forEach(t=>{t.scrollHeader(e)}))}removeGroup(e){var t=e.level+"_"+e.key,i;this.groups[t]&&(delete this.groups[t],i=this.groupList.indexOf(e),i>-1&&this.groupList.splice(i,1))}checkBasicModeGroupHeaderWidth(){var e=this.table.rowManager.tableElement,t=!0;this.table.rowManager.getDisplayRows().forEach((i,s)=>{this.table.rowManager.styleRow(i,s),e.appendChild(i.getElement()),i.initialize(!0),i.type!=="group"&&(t=!1)}),t?e.style.minWidth=this.table.columnManager.getWidth()+"px":e.style.minWidth=""}}w(Cn,"moduleName","groupRows");var Yo={cellEdit:function(n){n.component.setValueProcessData(n.data.oldValue),n.component.cellRendered()},rowAdd:function(n){n.component.deleteActual(),this.table.rowManager.checkPlaceholder()},rowDelete:function(n){var e=this.table.rowManager.addRowActual(n.data.data,n.data.pos,n.data.index);this.table.options.groupBy&&this.table.modExists("groupRows")&&this.table.modules.groupRows.updateGroupRows(!0),this._rebindRow(n.component,e),this.table.rowManager.checkPlaceholder()},rowMove:function(n){var e=n.data.posFrom-n.data.posTo>0;this.table.rowManager.moveRowActual(n.component,this.table.rowManager.getRowFromPosition(n.data.posFrom),e),this.table.rowManager.regenerateRowPositions(),this.table.rowManager.reRenderInPosition()}},Jo={cellEdit:function(n){n.component.setValueProcessData(n.data.newValue),n.component.cellRendered()},rowAdd:function(n){var e=this.table.rowManager.addRowActual(n.data.data,n.data.pos,n.data.index);this.table.options.groupBy&&this.table.modExists("groupRows")&&this.table.modules.groupRows.updateGroupRows(!0),this._rebindRow(n.component,e),this.table.rowManager.checkPlaceholder()},rowDelete:function(n){n.component.deleteActual(),this.table.rowManager.checkPlaceholder()},rowMove:function(n){this.table.rowManager.moveRowActual(n.component,this.table.rowManager.getRowFromPosition(n.data.posTo),n.data.after),this.table.rowManager.regenerateRowPositions(),this.table.rowManager.reRenderInPosition()}},qo={undo:["ctrl + 90","meta + 90"],redo:["ctrl + 89","meta + 89"]},Qo={undo:function(n){var e=!1;this.table.options.history&&this.table.modExists("history")&&this.table.modExists("edit")&&(e=this.table.modules.edit.currentCell,e||(n.preventDefault(),this.table.modules.history.undo()))},redo:function(n){var e=!1;this.table.options.history&&this.table.modExists("history")&&this.table.modExists("edit")&&(e=this.table.modules.edit.currentCell,e||(n.preventDefault(),this.table.modules.history.redo()))}},ea={keybindings:{bindings:qo,actions:Qo}};const Ee=class Ee extends D{constructor(e){super(e),this.history=[],this.index=-1,this.registerTableOption("history",!1)}initialize(){this.table.options.history&&(this.subscribe("cell-value-updated",this.cellUpdated.bind(this)),this.subscribe("cell-delete",this.clearComponentHistory.bind(this)),this.subscribe("row-delete",this.rowDeleted.bind(this)),this.subscribe("rows-wipe",this.clear.bind(this)),this.subscribe("row-added",this.rowAdded.bind(this)),this.subscribe("row-move",this.rowMoved.bind(this))),this.registerTableFunction("undo",this.undo.bind(this)),this.registerTableFunction("redo",this.redo.bind(this)),this.registerTableFunction("getHistoryUndoSize",this.getHistoryUndoSize.bind(this)),this.registerTableFunction("getHistoryRedoSize",this.getHistoryRedoSize.bind(this)),this.registerTableFunction("clearHistory",this.clear.bind(this))}rowMoved(e,t,i){this.action("rowMove",e,{posFrom:e.getPosition(),posTo:t.getPosition(),to:t,after:i})}rowAdded(e,t,i,s){this.action("rowAdd",e,{data:t,pos:i,index:s})}rowDeleted(e){var t,i;this.table.options.groupBy?(i=e.getComponent().getGroup()._getSelf().rows,t=i.indexOf(e),t&&(t=i[t-1])):(t=e.table.rowManager.getRowIndex(e),t&&(t=e.table.rowManager.rows[t-1])),this.action("rowDelete",e,{data:e.getData(),pos:!t,index:t})}cellUpdated(e){this.action("cellEdit",e,{oldValue:e.oldValue,newValue:e.value})}clear(){this.history=[],this.index=-1}action(e,t,i){this.history=this.history.slice(0,this.index+1),this.history.push({type:e,component:t,data:i}),this.index++}getHistoryUndoSize(){return this.index+1}getHistoryRedoSize(){return this.history.length-(this.index+1)}clearComponentHistory(e){var t=this.history.findIndex(function(i){return i.component===e});t>-1&&(this.history.splice(t,1),t<=this.index&&this.index--,this.clearComponentHistory(e))}undo(){if(this.index>-1){let e=this.history[this.index];return Ee.undoers[e.type].call(this,e),this.index--,this.dispatchExternal("historyUndo",e.type,e.component.getComponent(),e.data),!0}else return console.warn(this.options("history")?"History Undo Error - No more history to undo":"History module not enabled"),!1}redo(){if(this.history.length-1>this.index){this.index++;let e=this.history[this.index];return Ee.redoers[e.type].call(this,e),this.dispatchExternal("historyRedo",e.type,e.component.getComponent(),e.data),!0}else return console.warn(this.options("history")?"History Redo Error - No more history to redo":"History module not enabled"),!1}_rebindRow(e,t){this.history.forEach(function(i){if(i.component instanceof U)i.component===e&&(i.component=t);else if(i.component instanceof Lt&&i.component.row===e){var s=i.component.column.getField();s&&(i.component=t.getCell(s))}})}};w(Ee,"moduleName","history"),w(Ee,"moduleExtensions",ea),w(Ee,"undoers",Yo),w(Ee,"redoers",Jo);let Si=Ee;class yn extends D{constructor(e){super(e),this.fieldIndex=[],this.hasIndex=!1}initialize(){this.tableElementCheck()}tableElementCheck(){this.table.originalElement&&this.table.originalElement.tagName==="TABLE"&&(this.table.originalElement.childNodes.length?this.parseTable():console.warn("Unable to parse data from empty table tag, Tabulator should be initialized on a div tag unless importing data from a table element."))}parseTable(){var e=this.table.originalElement,t=this.table.options,i=e.getElementsByTagName("th"),s=e.getElementsByTagName("tbody")[0],r=[];this.hasIndex=!1,this.dispatchExternal("htmlImporting"),s=s?s.getElementsByTagName("tr"):[],this._extractOptions(e,t),i.length?this._extractHeaders(i,s):this._generateBlankHeaders(i,s);for(var o=0;o<s.length;o++){var a=s[o],l=a.getElementsByTagName("td"),h={};this.hasIndex||(h[t.index]=o);for(var d=0;d<l.length;d++){var c=l[d];typeof this.fieldIndex[d]<"u"&&(h[this.fieldIndex[d]]=c.innerHTML)}r.push(h)}t.data=r,this.dispatchExternal("htmlImported")}_extractOptions(e,t,i){var s=e.attributes,r=Object.keys(i||t),o={};r.forEach(d=>{o[d.toLowerCase()]=d});for(var a in s){var l=s[a],h;l&&typeof l=="object"&&l.name&&l.name.indexOf("tabulator-")===0&&(h=l.name.replace("tabulator-",""),typeof o[h]<"u"&&(t[o[h]]=this._attribValue(l.value)))}}_attribValue(e){return e==="true"?!0:e==="false"?!1:e}_findCol(e){var t=this.table.options.columns.find(i=>i.title===e);return t||!1}_extractHeaders(e,t){for(var i=0;i<e.length;i++){var s=e[i],r=!1,o=this._findCol(s.textContent),a;o?r=!0:o={title:s.textContent.trim()},o.field||(o.field=s.textContent.trim().toLowerCase().replaceAll(" ","_")),a=s.getAttribute("width"),a&&!o.width&&(o.width=a),this._extractOptions(s,o,this.table.columnManager.optionsList.registeredDefaults),this.fieldIndex[i]=o.field,o.field==this.table.options.index&&(this.hasIndex=!0),r||this.table.options.columns.push(o)}}_generateBlankHeaders(e,t){for(var i=0;i<e.length;i++){var s=e[i],r={title:"",field:"col"+i};this.fieldIndex[i]=r.field;var o=s.getAttribute("width");o&&(r.width=o),this.table.options.columns.push(r)}}}w(yn,"moduleName","htmlTableImport");function ta(n){var e=[],t=0,i=0,s=!1;for(let r=0;r<n.length;r++){let o=n[r],a=n[r+1];if(e[t]||(e[t]=[]),e[t][i]||(e[t][i]=""),o=='"'&&s&&a=='"'){e[t][i]+=o,r++;continue}if(o=='"'){s=!s;continue}if(o==","&&!s){i++;continue}if(o=="\r"&&a==`
`&&!s){i=0,t++,r++;continue}if((o=="\r"||o==`
`)&&!s){i=0,t++;continue}e[t][i]+=o}return e}function ia(n){try{return JSON.parse(n)}catch(e){return console.warn("JSON Import Error - File contents is invalid JSON",e),Promise.reject()}}function sa(n){return n}function na(n){var e=this.dependencyRegistry.lookup("XLSX"),t=e.read(n),i=t.Sheets[t.SheetNames[0]];return e.utils.sheet_to_json(i,{header:1})}var ra={csv:ta,json:ia,array:sa,xlsx:na};const vt=class vt extends D{constructor(e){super(e),this.registerTableOption("importFormat"),this.registerTableOption("importReader","text"),this.registerTableOption("importHeaderTransform"),this.registerTableOption("importValueTransform"),this.registerTableOption("importDataValidator"),this.registerTableOption("importFileValidator")}initialize(){this.registerTableFunction("import",this.importFromFile.bind(this)),this.table.options.importFormat&&(this.subscribe("data-loading",this.loadDataCheck.bind(this),10),this.subscribe("data-load",this.loadData.bind(this),10))}loadDataCheck(e){return this.table.options.importFormat&&(typeof e=="string"||Array.isArray(e)&&e.length&&Array.isArray(e))}loadData(e,t,i,s,r){return this.importData(this.lookupImporter(),e).then(this.structureData.bind(this)).catch(o=>(console.error("Import Error:",o||"Unable to import data"),Promise.reject(o)))}lookupImporter(e){var t;return e||(e=this.table.options.importFormat),typeof e=="string"?t=vt.importers[e]:t=e,t||console.error("Import Error - Importer not found:",e),t}importFromFile(e,t,i){var s=this.lookupImporter(e);if(s)return this.pickFile(t,i).then(this.importData.bind(this,s)).then(this.structureData.bind(this)).then(this.mutateData.bind(this)).then(this.validateData.bind(this)).then(this.setData.bind(this)).catch(r=>(this.dispatch("import-error",r),this.dispatchExternal("importError",r),console.error("Import Error:",r||"Unable to import file"),this.table.dataLoader.alertError(),setTimeout(()=>{this.table.dataLoader.clearAlert()},3e3),Promise.reject(r)))}pickFile(e,t){return new Promise((i,s)=>{var r=document.createElement("input");r.type="file",r.accept=e,r.addEventListener("change",o=>{var a=r.files[0],l=new FileReader,h=this.validateFile(a);if(h===!0){switch(this.dispatch("import-importing",r.files),this.dispatchExternal("importImporting",r.files),t||this.table.options.importReader){case"buffer":l.readAsArrayBuffer(a);break;case"binary":l.readAsBinaryString(a);break;case"url":l.readAsDataURL(a);break;case"text":default:l.readAsText(a)}l.onload=d=>{i(l.result)},l.onerror=d=>{console.warn("File Load Error - Unable to read file"),s(d)}}else s(h)}),this.dispatch("import-choose"),this.dispatchExternal("importChoose"),r.click()})}importData(e,t){var i;return this.table.dataLoader.alertLoader(),new Promise((s,r)=>{setTimeout(()=>{i=e.call(this.table,t),i instanceof Promise||i?s(i):r()},10)})}structureData(e){var t=[];return Array.isArray(e)&&e.length&&Array.isArray(e[0])?(this.table.options.autoColumns?t=this.structureArrayToObject(e):t=this.structureArrayToColumns(e),t):e}mutateData(e){var t=[];return Array.isArray(e)?e.forEach(i=>{t.push(this.table.modules.mutator.transformRow(i,"import"))}):t=e,t}transformHeader(e){var t=[];if(this.table.options.importHeaderTransform)e.forEach(i=>{t.push(this.table.options.importHeaderTransform.call(this.table,i,e))});else return e;return t}transformData(e){var t=[];if(this.table.options.importValueTransform)e.forEach(i=>{t.push(this.table.options.importValueTransform.call(this.table,i,e))});else return e;return t}structureArrayToObject(e){var t=this.transformHeader(e.shift()),i=e.map(s=>{var r={};return s=this.transformData(s),t.forEach((o,a)=>{r[o]=s[a]}),r});return i}structureArrayToColumns(e){var t=[],i=this.transformHeader(e[0]),s=this.table.getColumns();return s[0]&&i[0]&&s[0].getDefinition().title===i[0]&&e.shift(),e.forEach(r=>{var o={};r=this.transformData(r),r.forEach((a,l)=>{var h=s[l];h&&(o[h.getField()]=a)}),t.push(o)}),t}validateFile(e){return this.table.options.importFileValidator?this.table.options.importFileValidator.call(this.table,e):!0}validateData(e){var t;return this.table.options.importDataValidator?(t=this.table.options.importDataValidator.call(this.table,e),t===!0?e:Promise.reject(t)):e}setData(e){return this.dispatch("import-imported",e),this.dispatchExternal("importImported",e),this.table.dataLoader.clearAlert(),this.table.setData(e)}};w(vt,"moduleName","import"),w(vt,"importers",ra);let Li=vt;class En extends D{constructor(e){super(e),this.eventMap={rowClick:"row-click",rowDblClick:"row-dblclick",rowContext:"row-contextmenu",rowMouseEnter:"row-mouseenter",rowMouseLeave:"row-mouseleave",rowMouseOver:"row-mouseover",rowMouseOut:"row-mouseout",rowMouseMove:"row-mousemove",rowMouseDown:"row-mousedown",rowMouseUp:"row-mouseup",rowTap:"row",rowDblTap:"row",rowTapHold:"row",cellClick:"cell-click",cellDblClick:"cell-dblclick",cellContext:"cell-contextmenu",cellMouseEnter:"cell-mouseenter",cellMouseLeave:"cell-mouseleave",cellMouseOver:"cell-mouseover",cellMouseOut:"cell-mouseout",cellMouseMove:"cell-mousemove",cellMouseDown:"cell-mousedown",cellMouseUp:"cell-mouseup",cellTap:"cell",cellDblTap:"cell",cellTapHold:"cell",headerClick:"column-click",headerDblClick:"column-dblclick",headerContext:"column-contextmenu",headerMouseEnter:"column-mouseenter",headerMouseLeave:"column-mouseleave",headerMouseOver:"column-mouseover",headerMouseOut:"column-mouseout",headerMouseMove:"column-mousemove",headerMouseDown:"column-mousedown",headerMouseUp:"column-mouseup",headerTap:"column",headerDblTap:"column",headerTapHold:"column",groupClick:"group-click",groupDblClick:"group-dblclick",groupContext:"group-contextmenu",groupMouseEnter:"group-mouseenter",groupMouseLeave:"group-mouseleave",groupMouseOver:"group-mouseover",groupMouseOut:"group-mouseout",groupMouseMove:"group-mousemove",groupMouseDown:"group-mousedown",groupMouseUp:"group-mouseup",groupTap:"group",groupDblTap:"group",groupTapHold:"group"},this.subscribers={},this.touchSubscribers={},this.columnSubscribers={},this.touchWatchers={row:{tap:null,tapDbl:null,tapHold:null},cell:{tap:null,tapDbl:null,tapHold:null},column:{tap:null,tapDbl:null,tapHold:null},group:{tap:null,tapDbl:null,tapHold:null}},this.registerColumnOption("headerClick"),this.registerColumnOption("headerDblClick"),this.registerColumnOption("headerContext"),this.registerColumnOption("headerMouseEnter"),this.registerColumnOption("headerMouseLeave"),this.registerColumnOption("headerMouseOver"),this.registerColumnOption("headerMouseOut"),this.registerColumnOption("headerMouseMove"),this.registerColumnOption("headerMouseDown"),this.registerColumnOption("headerMouseUp"),this.registerColumnOption("headerTap"),this.registerColumnOption("headerDblTap"),this.registerColumnOption("headerTapHold"),this.registerColumnOption("cellClick"),this.registerColumnOption("cellDblClick"),this.registerColumnOption("cellContext"),this.registerColumnOption("cellMouseEnter"),this.registerColumnOption("cellMouseLeave"),this.registerColumnOption("cellMouseOver"),this.registerColumnOption("cellMouseOut"),this.registerColumnOption("cellMouseMove"),this.registerColumnOption("cellMouseDown"),this.registerColumnOption("cellMouseUp"),this.registerColumnOption("cellTap"),this.registerColumnOption("cellDblTap"),this.registerColumnOption("cellTapHold")}initialize(){this.initializeExternalEvents(),this.subscribe("column-init",this.initializeColumn.bind(this)),this.subscribe("cell-dblclick",this.cellContentsSelectionFixer.bind(this)),this.subscribe("scroll-horizontal",this.clearTouchWatchers.bind(this)),this.subscribe("scroll-vertical",this.clearTouchWatchers.bind(this))}clearTouchWatchers(){var e=Object.values(this.touchWatchers);e.forEach(t=>{for(let i in t)t[i]=null})}cellContentsSelectionFixer(e,t){var i;if(!(this.table.modExists("edit")&&this.table.modules.edit.currentCell===t)){e.preventDefault();try{document.selection?(i=document.body.createTextRange(),i.moveToElementText(t.getElement()),i.select()):window.getSelection&&(i=document.createRange(),i.selectNode(t.getElement()),window.getSelection().removeAllRanges(),window.getSelection().addRange(i))}catch{}}}initializeExternalEvents(){for(let e in this.eventMap)this.subscriptionChangeExternal(e,this.subscriptionChanged.bind(this,e))}subscriptionChanged(e,t){t?this.subscribers[e]||(this.eventMap[e].includes("-")?(this.subscribers[e]=this.handle.bind(this,e),this.subscribe(this.eventMap[e],this.subscribers[e])):this.subscribeTouchEvents(e)):this.eventMap[e].includes("-")?this.subscribers[e]&&!this.columnSubscribers[e]&&!this.subscribedExternal(e)&&(this.unsubscribe(this.eventMap[e],this.subscribers[e]),delete this.subscribers[e]):this.unsubscribeTouchEvents(e)}subscribeTouchEvents(e){var t=this.eventMap[e];this.touchSubscribers[t+"-touchstart"]||(this.touchSubscribers[t+"-touchstart"]=this.handleTouch.bind(this,t,"start"),this.touchSubscribers[t+"-touchend"]=this.handleTouch.bind(this,t,"end"),this.subscribe(t+"-touchstart",this.touchSubscribers[t+"-touchstart"]),this.subscribe(t+"-touchend",this.touchSubscribers[t+"-touchend"])),this.subscribers[e]=!0}unsubscribeTouchEvents(e){var t=!0,i=this.eventMap[e];if(this.subscribers[e]&&!this.subscribedExternal(e)){delete this.subscribers[e];for(let s in this.eventMap)this.eventMap[s]===i&&this.subscribers[s]&&(t=!1);t&&(this.unsubscribe(i+"-touchstart",this.touchSubscribers[i+"-touchstart"]),this.unsubscribe(i+"-touchend",this.touchSubscribers[i+"-touchend"]),delete this.touchSubscribers[i+"-touchstart"],delete this.touchSubscribers[i+"-touchend"])}}initializeColumn(e){var t=e.definition;for(let i in this.eventMap)t[i]&&(this.subscriptionChanged(i,!0),this.columnSubscribers[i]||(this.columnSubscribers[i]=[]),this.columnSubscribers[i].push(e))}handle(e,t,i){this.dispatchEvent(e,t,i)}handleTouch(e,t,i,s){var r=this.touchWatchers[e];switch(e==="column"&&(e="header"),t){case"start":r.tap=!0,clearTimeout(r.tapHold),r.tapHold=setTimeout(()=>{clearTimeout(r.tapHold),r.tapHold=null,r.tap=null,clearTimeout(r.tapDbl),r.tapDbl=null,this.dispatchEvent(e+"TapHold",i,s)},1e3);break;case"end":r.tap&&(r.tap=null,this.dispatchEvent(e+"Tap",i,s)),r.tapDbl?(clearTimeout(r.tapDbl),r.tapDbl=null,this.dispatchEvent(e+"DblTap",i,s)):r.tapDbl=setTimeout(()=>{clearTimeout(r.tapDbl),r.tapDbl=null},300),clearTimeout(r.tapHold),r.tapHold=null;break}}dispatchEvent(e,t,i){var s=i.getComponent(),r;this.columnSubscribers[e]&&(i instanceof Lt?r=i.column.definition[e]:i instanceof Be&&(r=i.definition[e]),r&&r(t,s)),this.dispatchExternal(e,t,s)}}w(En,"moduleName","interaction");var oa={navPrev:"shift + 9",navNext:9,navUp:38,navDown:40,navLeft:37,navRight:39,scrollPageUp:33,scrollPageDown:34,scrollToStart:36,scrollToEnd:35},aa={keyBlock:function(n){n.stopPropagation(),n.preventDefault()},scrollPageUp:function(n){var e=this.table.rowManager,t=e.scrollTop-e.element.clientHeight;n.preventDefault(),e.displayRowsCount&&(t>=0?e.element.scrollTop=t:e.scrollToRow(e.getDisplayRows()[0])),this.table.element.focus()},scrollPageDown:function(n){var e=this.table.rowManager,t=e.scrollTop+e.element.clientHeight,i=e.element.scrollHeight;n.preventDefault(),e.displayRowsCount&&(t<=i?e.element.scrollTop=t:e.scrollToRow(e.getDisplayRows()[e.displayRowsCount-1])),this.table.element.focus()},scrollToStart:function(n){var e=this.table.rowManager;n.preventDefault(),e.displayRowsCount&&e.scrollToRow(e.getDisplayRows()[0]),this.table.element.focus()},scrollToEnd:function(n){var e=this.table.rowManager;n.preventDefault(),e.displayRowsCount&&e.scrollToRow(e.getDisplayRows()[e.displayRowsCount-1]),this.table.element.focus()},navPrev:function(n){this.dispatch("keybinding-nav-prev",n)},navNext:function(n){this.dispatch("keybinding-nav-next",n)},navLeft:function(n){this.dispatch("keybinding-nav-left",n)},navRight:function(n){this.dispatch("keybinding-nav-right",n)},navUp:function(n){this.dispatch("keybinding-nav-up",n)},navDown:function(n){this.dispatch("keybinding-nav-down",n)}};const Re=class Re extends D{constructor(e){super(e),this.watchKeys=null,this.pressedKeys=null,this.keyupBinding=!1,this.keydownBinding=!1,this.registerTableOption("keybindings",{}),this.registerTableOption("tabEndNewRow",!1)}initialize(){var e=this.table.options.keybindings,t={};this.watchKeys={},this.pressedKeys=[],e!==!1&&(Object.assign(t,Re.bindings),Object.assign(t,e),this.mapBindings(t),this.bindEvents()),this.subscribe("table-destroy",this.clearBindings.bind(this))}mapBindings(e){for(let t in e)Re.actions[t]?e[t]&&(typeof e[t]!="object"&&(e[t]=[e[t]]),e[t].forEach(i=>{var s=Array.isArray(i)?i:[i];s.forEach(r=>{this.mapBinding(t,r)})})):console.warn("Key Binding Error - no such action:",t)}mapBinding(e,t){var i={action:Re.actions[e],keys:[],ctrl:!1,shift:!1,meta:!1},s=t.toString().toLowerCase().split(" ").join("").split("+");s.forEach(r=>{switch(r){case"ctrl":i.ctrl=!0;break;case"shift":i.shift=!0;break;case"meta":i.meta=!0;break;default:r=isNaN(r)?r.toUpperCase().charCodeAt(0):parseInt(r),i.keys.push(r),this.watchKeys[r]||(this.watchKeys[r]=[]),this.watchKeys[r].push(i)}})}bindEvents(){var e=this;this.keyupBinding=function(t){var i=t.keyCode,s=e.watchKeys[i];s&&(e.pressedKeys.push(i),s.forEach(function(r){e.checkBinding(t,r)}))},this.keydownBinding=function(t){var i=t.keyCode,s=e.watchKeys[i];if(s){var r=e.pressedKeys.indexOf(i);r>-1&&e.pressedKeys.splice(r,1)}},this.table.element.addEventListener("keydown",this.keyupBinding),this.table.element.addEventListener("keyup",this.keydownBinding)}clearBindings(){this.keyupBinding&&this.table.element.removeEventListener("keydown",this.keyupBinding),this.keydownBinding&&this.table.element.removeEventListener("keyup",this.keydownBinding)}checkBinding(e,t){var i=!0;return e.ctrlKey==t.ctrl&&e.shiftKey==t.shift&&e.metaKey==t.meta?(t.keys.forEach(s=>{var r=this.pressedKeys.indexOf(s);r==-1&&(i=!1)}),i&&t.action.call(this,e),!0):!1}};w(Re,"moduleName","keybindings"),w(Re,"bindings",oa),w(Re,"actions",aa);let Di=Re;class Rn extends D{constructor(e){super(e),this.menuContainer=null,this.nestedMenuBlock=!1,this.currentComponent=null,this.rootPopup=null,this.columnSubscribers={},this.registerTableOption("rowContextMenu",!1),this.registerTableOption("rowClickMenu",!1),this.registerTableOption("rowDblClickMenu",!1),this.registerTableOption("groupContextMenu",!1),this.registerTableOption("groupClickMenu",!1),this.registerTableOption("groupDblClickMenu",!1),this.registerColumnOption("headerContextMenu"),this.registerColumnOption("headerClickMenu"),this.registerColumnOption("headerDblClickMenu"),this.registerColumnOption("headerMenu"),this.registerColumnOption("headerMenuIcon"),this.registerColumnOption("contextMenu"),this.registerColumnOption("clickMenu"),this.registerColumnOption("dblClickMenu")}initialize(){this.deprecatedOptionsCheck(),this.initializeRowWatchers(),this.initializeGroupWatchers(),this.subscribe("column-init",this.initializeColumn.bind(this))}deprecatedOptionsCheck(){}initializeRowWatchers(){this.table.options.rowContextMenu&&(this.subscribe("row-contextmenu",this.loadMenuEvent.bind(this,this.table.options.rowContextMenu)),this.table.on("rowTapHold",this.loadMenuEvent.bind(this,this.table.options.rowContextMenu))),this.table.options.rowClickMenu&&this.subscribe("row-click",this.loadMenuEvent.bind(this,this.table.options.rowClickMenu)),this.table.options.rowDblClickMenu&&this.subscribe("row-dblclick",this.loadMenuEvent.bind(this,this.table.options.rowDblClickMenu))}initializeGroupWatchers(){this.table.options.groupContextMenu&&(this.subscribe("group-contextmenu",this.loadMenuEvent.bind(this,this.table.options.groupContextMenu)),this.table.on("groupTapHold",this.loadMenuEvent.bind(this,this.table.options.groupContextMenu))),this.table.options.groupClickMenu&&this.subscribe("group-click",this.loadMenuEvent.bind(this,this.table.options.groupClickMenu)),this.table.options.groupDblClickMenu&&this.subscribe("group-dblclick",this.loadMenuEvent.bind(this,this.table.options.groupDblClickMenu))}initializeColumn(e){var t=e.definition;t.headerContextMenu&&!this.columnSubscribers.headerContextMenu&&(this.columnSubscribers.headerContextMenu=this.loadMenuTableColumnEvent.bind(this,"headerContextMenu"),this.subscribe("column-contextmenu",this.columnSubscribers.headerContextMenu),this.table.on("headerTapHold",this.loadMenuTableColumnEvent.bind(this,"headerContextMenu"))),t.headerClickMenu&&!this.columnSubscribers.headerClickMenu&&(this.columnSubscribers.headerClickMenu=this.loadMenuTableColumnEvent.bind(this,"headerClickMenu"),this.subscribe("column-click",this.columnSubscribers.headerClickMenu)),t.headerDblClickMenu&&!this.columnSubscribers.headerDblClickMenu&&(this.columnSubscribers.headerDblClickMenu=this.loadMenuTableColumnEvent.bind(this,"headerDblClickMenu"),this.subscribe("column-dblclick",this.columnSubscribers.headerDblClickMenu)),t.headerMenu&&this.initializeColumnHeaderMenu(e),t.contextMenu&&!this.columnSubscribers.contextMenu&&(this.columnSubscribers.contextMenu=this.loadMenuTableCellEvent.bind(this,"contextMenu"),this.subscribe("cell-contextmenu",this.columnSubscribers.contextMenu),this.table.on("cellTapHold",this.loadMenuTableCellEvent.bind(this,"contextMenu"))),t.clickMenu&&!this.columnSubscribers.clickMenu&&(this.columnSubscribers.clickMenu=this.loadMenuTableCellEvent.bind(this,"clickMenu"),this.subscribe("cell-click",this.columnSubscribers.clickMenu)),t.dblClickMenu&&!this.columnSubscribers.dblClickMenu&&(this.columnSubscribers.dblClickMenu=this.loadMenuTableCellEvent.bind(this,"dblClickMenu"),this.subscribe("cell-dblclick",this.columnSubscribers.dblClickMenu))}initializeColumnHeaderMenu(e){var t=e.definition.headerMenuIcon,i;i=document.createElement("span"),i.classList.add("tabulator-header-popup-button"),t?(typeof t=="function"&&(t=t(e.getComponent())),t instanceof HTMLElement?i.appendChild(t):i.innerHTML=t):i.innerHTML="&vellip;",i.addEventListener("click",s=>{s.stopPropagation(),s.preventDefault(),this.loadMenuEvent(e.definition.headerMenu,s,e)}),e.titleElement.insertBefore(i,e.titleElement.firstChild)}loadMenuTableCellEvent(e,t,i){i._cell&&(i=i._cell),i.column.definition[e]&&this.loadMenuEvent(i.column.definition[e],t,i)}loadMenuTableColumnEvent(e,t,i){i._column&&(i=i._column),i.definition[e]&&this.loadMenuEvent(i.definition[e],t,i)}loadMenuEvent(e,t,i){i._group?i=i._group:i._row&&(i=i._row),e=typeof e=="function"?e.call(this.table,t,i.getComponent()):e,this.loadMenu(t,i,e)}loadMenu(e,t,i,s,r){var o=!(e instanceof MouseEvent),a=document.createElement("div"),l;if(a.classList.add("tabulator-menu"),o||e.preventDefault(),!(!i||!i.length)){if(s)l=r.child(a);else{if(this.nestedMenuBlock){if(this.rootPopup)return}else this.nestedMenuBlock=setTimeout(()=>{this.nestedMenuBlock=!1},100);this.rootPopup&&this.rootPopup.hide(),this.rootPopup=l=this.popup(a)}i.forEach(h=>{var d=document.createElement("div"),c=h.label,u=h.disabled;h.separator?d.classList.add("tabulator-menu-separator"):(d.classList.add("tabulator-menu-item"),typeof c=="function"&&(c=c.call(this.table,t.getComponent())),c instanceof Node?d.appendChild(c):d.innerHTML=c,typeof u=="function"&&(u=u.call(this.table,t.getComponent())),u?(d.classList.add("tabulator-menu-item-disabled"),d.addEventListener("click",f=>{f.stopPropagation()})):h.menu&&h.menu.length?d.addEventListener("click",f=>{f.stopPropagation(),this.loadMenu(f,t,h.menu,d,l)}):h.action&&d.addEventListener("click",f=>{h.action(f,t.getComponent())}),h.menu&&h.menu.length&&d.classList.add("tabulator-menu-item-submenu")),a.appendChild(d)}),a.addEventListener("click",h=>{this.rootPopup&&this.rootPopup.hide()}),l.show(s||e),l===this.rootPopup&&(this.rootPopup.hideOnBlur(()=>{this.rootPopup=null,this.currentComponent&&(this.dispatch("menu-closed",i,l),this.dispatchExternal("menuClosed",this.currentComponent.getComponent()),this.currentComponent=null)}),this.currentComponent=t,this.dispatch("menu-opened",i,l),this.dispatchExternal("menuOpened",t.getComponent()))}}}w(Rn,"moduleName","menu");class xn extends D{constructor(e){super(e),this.placeholderElement=this.createPlaceholderElement(),this.hoverElement=!1,this.checkTimeout=!1,this.checkPeriod=250,this.moving=!1,this.toCol=!1,this.toColAfter=!1,this.startX=0,this.autoScrollMargin=40,this.autoScrollStep=5,this.autoScrollTimeout=!1,this.touchMove=!1,this.moveHover=this.moveHover.bind(this),this.endMove=this.endMove.bind(this),this.registerTableOption("movableColumns",!1)}createPlaceholderElement(){var e=document.createElement("div");return e.classList.add("tabulator-col"),e.classList.add("tabulator-col-placeholder"),e}initialize(){this.table.options.movableColumns&&(this.subscribe("column-init",this.initializeColumn.bind(this)),this.subscribe("alert-show",this.abortMove.bind(this)))}abortMove(){clearTimeout(this.checkTimeout)}initializeColumn(e){var t=this,i={},s;!e.modules.frozen&&!e.isGroup&&!e.isRowHeader&&(s=e.getElement(),i.mousemove=(function(r){e.parent===t.moving.parent&&((t.touchMove?r.touches[0].pageX:r.pageX)-P.elOffset(s).left+t.table.columnManager.contentsElement.scrollLeft>e.getWidth()/2?(t.toCol!==e||!t.toColAfter)&&(s.parentNode.insertBefore(t.placeholderElement,s.nextSibling),t.moveColumn(e,!0)):(t.toCol!==e||t.toColAfter)&&(s.parentNode.insertBefore(t.placeholderElement,s),t.moveColumn(e,!1)))}).bind(t),s.addEventListener("mousedown",function(r){t.touchMove=!1,r.which===1&&(t.checkTimeout=setTimeout(function(){t.startMove(r,e)},t.checkPeriod))}),s.addEventListener("mouseup",function(r){r.which===1&&t.checkTimeout&&clearTimeout(t.checkTimeout)}),t.bindTouchEvents(e)),e.modules.moveColumn=i}bindTouchEvents(e){var t=e.getElement(),i=!1,s,r,o,a,l,h;t.addEventListener("touchstart",d=>{this.checkTimeout=setTimeout(()=>{this.touchMove=!0,s=e.nextColumn(),o=s?s.getWidth()/2:0,r=e.prevColumn(),a=r?r.getWidth()/2:0,l=0,h=0,i=!1,this.startMove(d,e)},this.checkPeriod)},{passive:!0}),t.addEventListener("touchmove",d=>{var c,u;this.moving&&(this.moveHover(d),i||(i=d.touches[0].pageX),c=d.touches[0].pageX-i,c>0?s&&c-l>o&&(u=s,u!==e&&(i=d.touches[0].pageX,u.getElement().parentNode.insertBefore(this.placeholderElement,u.getElement().nextSibling),this.moveColumn(u,!0))):r&&-c-h>a&&(u=r,u!==e&&(i=d.touches[0].pageX,u.getElement().parentNode.insertBefore(this.placeholderElement,u.getElement()),this.moveColumn(u,!1))),u&&(s=u.nextColumn(),l=o,o=s?s.getWidth()/2:0,r=u.prevColumn(),h=a,a=r?r.getWidth()/2:0))},{passive:!0}),t.addEventListener("touchend",d=>{this.checkTimeout&&clearTimeout(this.checkTimeout),this.moving&&this.endMove(d)})}startMove(e,t){var i=t.getElement(),s=this.table.columnManager.getContentsElement(),r=this.table.columnManager.getHeadersElement();this.table.modules.selectRange&&this.table.modules.selectRange.columnSelection&&this.table.modules.selectRange.mousedown&&this.table.modules.selectRange.selecting==="column"||(this.moving=t,this.startX=(this.touchMove?e.touches[0].pageX:e.pageX)-P.elOffset(i).left,this.table.element.classList.add("tabulator-block-select"),this.placeholderElement.style.width=t.getWidth()+"px",this.placeholderElement.style.height=t.getHeight()+"px",i.parentNode.insertBefore(this.placeholderElement,i),i.parentNode.removeChild(i),this.hoverElement=i.cloneNode(!0),this.hoverElement.classList.add("tabulator-moving"),s.appendChild(this.hoverElement),this.hoverElement.style.left="0",this.hoverElement.style.bottom=s.clientHeight-r.offsetHeight+"px",this.touchMove||(this._bindMouseMove(),document.body.addEventListener("mousemove",this.moveHover),document.body.addEventListener("mouseup",this.endMove)),this.moveHover(e),this.dispatch("column-moving",e,this.moving))}_bindMouseMove(){this.table.columnManager.columnsByIndex.forEach(function(e){e.modules.moveColumn.mousemove&&e.getElement().addEventListener("mousemove",e.modules.moveColumn.mousemove)})}_unbindMouseMove(){this.table.columnManager.columnsByIndex.forEach(function(e){e.modules.moveColumn.mousemove&&e.getElement().removeEventListener("mousemove",e.modules.moveColumn.mousemove)})}moveColumn(e,t){var i=this.moving.getCells();this.toCol=e,this.toColAfter=t,t?e.getCells().forEach(function(s,r){var o=s.getElement(!0);o.parentNode&&i[r]&&o.parentNode.insertBefore(i[r].getElement(),o.nextSibling)}):e.getCells().forEach(function(s,r){var o=s.getElement(!0);o.parentNode&&i[r]&&o.parentNode.insertBefore(i[r].getElement(),o)})}endMove(e){(e.which===1||this.touchMove)&&(this._unbindMouseMove(),this.placeholderElement.parentNode.insertBefore(this.moving.getElement(),this.placeholderElement.nextSibling),this.placeholderElement.parentNode.removeChild(this.placeholderElement),this.hoverElement.parentNode.removeChild(this.hoverElement),this.table.element.classList.remove("tabulator-block-select"),this.toCol&&this.table.columnManager.moveColumnActual(this.moving,this.toCol,this.toColAfter),this.moving=!1,this.toCol=!1,this.toColAfter=!1,this.touchMove||(document.body.removeEventListener("mousemove",this.moveHover),document.body.removeEventListener("mouseup",this.endMove)))}moveHover(e){var t=this.table.columnManager.getContentsElement(),i=t.scrollLeft,s=(this.touchMove?e.touches[0].pageX:e.pageX)-P.elOffset(t).left+i,r;this.hoverElement.style.left=s-this.startX+"px",s-i<this.autoScrollMargin&&(this.autoScrollTimeout||(this.autoScrollTimeout=setTimeout(()=>{r=Math.max(0,i-5),this.table.rowManager.getElement().scrollLeft=r,this.autoScrollTimeout=!1},1))),i+t.clientWidth-s<this.autoScrollMargin&&(this.autoScrollTimeout||(this.autoScrollTimeout=setTimeout(()=>{r=Math.min(t.clientWidth,i+5),this.table.rowManager.getElement().scrollLeft=r,this.autoScrollTimeout=!1},1)))}}w(xn,"moduleName","moveColumn");var la={delete:function(n,e,t){n.delete()}},ha={insert:function(n,e,t){return this.table.addRow(n.getData(),void 0,e),!0},add:function(n,e,t){return this.table.addRow(n.getData()),!0},update:function(n,e,t){return e?(e.update(n.getData()),!0):!1},replace:function(n,e,t){return e?(this.table.addRow(n.getData(),void 0,e),e.delete(),!0):!1}};const Fe=class Fe extends D{constructor(e){super(e),this.placeholderElement=this.createPlaceholderElement(),this.hoverElement=!1,this.checkTimeout=!1,this.checkPeriod=150,this.moving=!1,this.toRow=!1,this.toRowAfter=!1,this.hasHandle=!1,this.startY=0,this.startX=0,this.moveHover=this.moveHover.bind(this),this.endMove=this.endMove.bind(this),this.tableRowDropEvent=!1,this.touchMove=!1,this.connection=!1,this.connectionSelectorsTables=!1,this.connectionSelectorsElements=!1,this.connectionElements=[],this.connections=[],this.connectedTable=!1,this.connectedRow=!1,this.registerTableOption("movableRows",!1),this.registerTableOption("movableRowsConnectedTables",!1),this.registerTableOption("movableRowsConnectedElements",!1),this.registerTableOption("movableRowsSender",!1),this.registerTableOption("movableRowsReceiver","insert"),this.registerColumnOption("rowHandle")}createPlaceholderElement(){var e=document.createElement("div");return e.classList.add("tabulator-row"),e.classList.add("tabulator-row-placeholder"),e}initialize(){this.table.options.movableRows&&(this.connectionSelectorsTables=this.table.options.movableRowsConnectedTables,this.connectionSelectorsElements=this.table.options.movableRowsConnectedElements,this.connection=this.connectionSelectorsTables||this.connectionSelectorsElements,this.subscribe("cell-init",this.initializeCell.bind(this)),this.subscribe("column-init",this.initializeColumn.bind(this)),this.subscribe("row-init",this.initializeRow.bind(this)))}initializeGroupHeader(e){var t=this,i={};i.mouseup=(function(s){t.tableRowDrop(s,e)}).bind(t),i.mousemove=(function(s){var r;s.pageY-P.elOffset(e.element).top+t.table.rowManager.element.scrollTop>e.getHeight()/2?(t.toRow!==e||!t.toRowAfter)&&(r=e.getElement(),r.parentNode.insertBefore(t.placeholderElement,r.nextSibling),t.moveRow(e,!0)):(t.toRow!==e||t.toRowAfter)&&(r=e.getElement(),r.previousSibling&&(r.parentNode.insertBefore(t.placeholderElement,r),t.moveRow(e,!1)))}).bind(t),e.modules.moveRow=i}initializeRow(e){var t=this,i={},s;i.mouseup=(function(r){t.tableRowDrop(r,e)}).bind(t),i.mousemove=(function(r){var o=e.getElement();r.pageY-P.elOffset(o).top+t.table.rowManager.element.scrollTop>e.getHeight()/2?(t.toRow!==e||!t.toRowAfter)&&(o.parentNode.insertBefore(t.placeholderElement,o.nextSibling),t.moveRow(e,!0)):(t.toRow!==e||t.toRowAfter)&&(o.parentNode.insertBefore(t.placeholderElement,o),t.moveRow(e,!1))}).bind(t),this.hasHandle||(s=e.getElement(),s.addEventListener("mousedown",function(r){r.which===1&&(t.checkTimeout=setTimeout(function(){t.startMove(r,e)},t.checkPeriod))}),s.addEventListener("mouseup",function(r){r.which===1&&t.checkTimeout&&clearTimeout(t.checkTimeout)}),this.bindTouchEvents(e,e.getElement())),e.modules.moveRow=i}initializeColumn(e){e.definition.rowHandle&&this.table.options.movableRows!==!1&&(this.hasHandle=!0)}initializeCell(e){if(e.column.definition.rowHandle&&this.table.options.movableRows!==!1){var t=this,i=e.getElement(!0);i.addEventListener("mousedown",function(s){s.which===1&&(t.checkTimeout=setTimeout(function(){t.startMove(s,e.row)},t.checkPeriod))}),i.addEventListener("mouseup",function(s){s.which===1&&t.checkTimeout&&clearTimeout(t.checkTimeout)}),this.bindTouchEvents(e.row,i)}}bindTouchEvents(e,t){var i=!1,s,r,o,a,l,h;t.addEventListener("touchstart",d=>{this.checkTimeout=setTimeout(()=>{this.touchMove=!0,s=e.nextRow(),o=s?s.getHeight()/2:0,r=e.prevRow(),a=r?r.getHeight()/2:0,l=0,h=0,i=!1,this.startMove(d,e)},this.checkPeriod)},{passive:!0}),this.moving,this.toRow,this.toRowAfter,t.addEventListener("touchmove",d=>{var c,u;this.moving&&(d.preventDefault(),this.moveHover(d),i||(i=d.touches[0].pageY),c=d.touches[0].pageY-i,c>0?s&&c-l>o&&(u=s,u!==e&&(i=d.touches[0].pageY,u.getElement().parentNode.insertBefore(this.placeholderElement,u.getElement().nextSibling),this.moveRow(u,!0))):r&&-c-h>a&&(u=r,u!==e&&(i=d.touches[0].pageY,u.getElement().parentNode.insertBefore(this.placeholderElement,u.getElement()),this.moveRow(u,!1))),u&&(s=u.nextRow(),l=o,o=s?s.getHeight()/2:0,r=u.prevRow(),h=a,a=r?r.getHeight()/2:0))}),t.addEventListener("touchend",d=>{this.checkTimeout&&clearTimeout(this.checkTimeout),this.moving&&(this.endMove(d),this.touchMove=!1)})}_bindMouseMove(){this.table.rowManager.getDisplayRows().forEach(e=>{(e.type==="row"||e.type==="group")&&e.modules.moveRow&&e.modules.moveRow.mousemove&&e.getElement().addEventListener("mousemove",e.modules.moveRow.mousemove)})}_unbindMouseMove(){this.table.rowManager.getDisplayRows().forEach(e=>{(e.type==="row"||e.type==="group")&&e.modules.moveRow&&e.modules.moveRow.mousemove&&e.getElement().removeEventListener("mousemove",e.modules.moveRow.mousemove)})}startMove(e,t){var i=t.getElement();this.setStartPosition(e,t),this.moving=t,this.table.element.classList.add("tabulator-block-select"),this.placeholderElement.style.width=t.getWidth()+"px",this.placeholderElement.style.height=t.getHeight()+"px",this.connection?(this.table.element.classList.add("tabulator-movingrow-sending"),this.connectToTables(t)):(i.parentNode.insertBefore(this.placeholderElement,i),i.parentNode.removeChild(i)),this.hoverElement=i.cloneNode(!0),this.hoverElement.classList.add("tabulator-moving"),this.connection?(document.body.appendChild(this.hoverElement),this.hoverElement.style.left="0",this.hoverElement.style.top="0",this.hoverElement.style.width=this.table.element.clientWidth+"px",this.hoverElement.style.whiteSpace="nowrap",this.hoverElement.style.overflow="hidden",this.hoverElement.style.pointerEvents="none"):(this.table.rowManager.getTableElement().appendChild(this.hoverElement),this.hoverElement.style.left="0",this.hoverElement.style.top="0",this._bindMouseMove()),document.body.addEventListener("mousemove",this.moveHover),document.body.addEventListener("mouseup",this.endMove),this.dispatchExternal("rowMoving",t.getComponent()),this.moveHover(e)}setStartPosition(e,t){var i=this.touchMove?e.touches[0].pageX:e.pageX,s=this.touchMove?e.touches[0].pageY:e.pageY,r,o;r=t.getElement(),this.connection?(o=r.getBoundingClientRect(),this.startX=o.left-i+window.pageXOffset,this.startY=o.top-s+window.pageYOffset):this.startY=s-r.getBoundingClientRect().top}endMove(e){(!e||e.which===1||this.touchMove)&&(this._unbindMouseMove(),this.connection||(this.placeholderElement.parentNode.insertBefore(this.moving.getElement(),this.placeholderElement.nextSibling),this.placeholderElement.parentNode.removeChild(this.placeholderElement)),this.hoverElement.parentNode.removeChild(this.hoverElement),this.table.element.classList.remove("tabulator-block-select"),this.toRow?this.table.rowManager.moveRow(this.moving,this.toRow,this.toRowAfter):this.dispatchExternal("rowMoveCancelled",this.moving.getComponent()),this.moving=!1,this.toRow=!1,this.toRowAfter=!1,document.body.removeEventListener("mousemove",this.moveHover),document.body.removeEventListener("mouseup",this.endMove),this.connection&&(this.table.element.classList.remove("tabulator-movingrow-sending"),this.disconnectFromTables()))}moveRow(e,t){this.toRow=e,this.toRowAfter=t}moveHover(e){this.connection?this.moveHoverConnections.call(this,e):this.moveHoverTable.call(this,e)}moveHoverTable(e){var t=this.table.rowManager.getElement(),i=t.scrollTop,s=(this.touchMove?e.touches[0].pageY:e.pageY)-t.getBoundingClientRect().top+i;this.hoverElement.style.top=Math.min(s-this.startY,this.table.rowManager.element.scrollHeight-this.hoverElement.offsetHeight)+"px"}moveHoverConnections(e){this.hoverElement.style.left=this.startX+(this.touchMove?e.touches[0].pageX:e.pageX)+"px",this.hoverElement.style.top=this.startY+(this.touchMove?e.touches[0].pageY:e.pageY)+"px"}elementRowDrop(e,t,i){this.dispatchExternal("movableRowsElementDrop",e,t,i?i.getComponent():!1)}connectToTables(e){var t;this.connectionSelectorsTables&&(t=this.commsConnections(this.connectionSelectorsTables),this.dispatchExternal("movableRowsSendingStart",t),this.commsSend(this.connectionSelectorsTables,"moveRow","connect",{row:e})),this.connectionSelectorsElements&&(this.connectionElements=[],Array.isArray(this.connectionSelectorsElements)||(this.connectionSelectorsElements=[this.connectionSelectorsElements]),this.connectionSelectorsElements.forEach(i=>{typeof i=="string"?this.connectionElements=this.connectionElements.concat(Array.prototype.slice.call(document.querySelectorAll(i))):this.connectionElements.push(i)}),this.connectionElements.forEach(i=>{var s=r=>{this.elementRowDrop(r,i,this.moving)};i.addEventListener("mouseup",s),i.tabulatorElementDropEvent=s,i.classList.add("tabulator-movingrow-receiving")}))}disconnectFromTables(){var e;this.connectionSelectorsTables&&(e=this.commsConnections(this.connectionSelectorsTables),this.dispatchExternal("movableRowsSendingStop",e),this.commsSend(this.connectionSelectorsTables,"moveRow","disconnect")),this.connectionElements.forEach(t=>{t.classList.remove("tabulator-movingrow-receiving"),t.removeEventListener("mouseup",t.tabulatorElementDropEvent),delete t.tabulatorElementDropEvent})}connect(e,t){return this.connectedTable?(console.warn("Move Row Error - Table cannot accept connection, already connected to table:",this.connectedTable),!1):(this.connectedTable=e,this.connectedRow=t,this.table.element.classList.add("tabulator-movingrow-receiving"),this.table.rowManager.getDisplayRows().forEach(i=>{i.type==="row"&&i.modules.moveRow&&i.modules.moveRow.mouseup&&i.getElement().addEventListener("mouseup",i.modules.moveRow.mouseup)}),this.tableRowDropEvent=this.tableRowDrop.bind(this),this.table.element.addEventListener("mouseup",this.tableRowDropEvent),this.dispatchExternal("movableRowsReceivingStart",t,e),!0)}disconnect(e){e===this.connectedTable?(this.connectedTable=!1,this.connectedRow=!1,this.table.element.classList.remove("tabulator-movingrow-receiving"),this.table.rowManager.getDisplayRows().forEach(t=>{t.type==="row"&&t.modules.moveRow&&t.modules.moveRow.mouseup&&t.getElement().removeEventListener("mouseup",t.modules.moveRow.mouseup)}),this.table.element.removeEventListener("mouseup",this.tableRowDropEvent),this.dispatchExternal("movableRowsReceivingStop",e)):console.warn("Move Row Error - trying to disconnect from non connected table")}dropComplete(e,t,i){var s=!1;if(i){switch(typeof this.table.options.movableRowsSender){case"string":s=Fe.senders[this.table.options.movableRowsSender];break;case"function":s=this.table.options.movableRowsSender;break}s?s.call(this,this.moving?this.moving.getComponent():void 0,t?t.getComponent():void 0,e):this.table.options.movableRowsSender&&console.warn("Mover Row Error - no matching sender found:",this.table.options.movableRowsSender),this.dispatchExternal("movableRowsSent",this.moving.getComponent(),t?t.getComponent():void 0,e)}else this.dispatchExternal("movableRowsSentFailed",this.moving.getComponent(),t?t.getComponent():void 0,e);this.endMove()}tableRowDrop(e,t){var i=!1,s=!1;switch(e.stopImmediatePropagation(),typeof this.table.options.movableRowsReceiver){case"string":i=Fe.receivers[this.table.options.movableRowsReceiver];break;case"function":i=this.table.options.movableRowsReceiver;break}i?s=i.call(this,this.connectedRow.getComponent(),t?t.getComponent():void 0,this.connectedTable):console.warn("Mover Row Error - no matching receiver found:",this.table.options.movableRowsReceiver),s?this.dispatchExternal("movableRowsReceived",this.connectedRow.getComponent(),t?t.getComponent():void 0,this.connectedTable):this.dispatchExternal("movableRowsReceivedFailed",this.connectedRow.getComponent(),t?t.getComponent():void 0,this.connectedTable),this.commsSend(this.connectedTable,"moveRow","dropcomplete",{row:t,success:s})}commsReceived(e,t,i){switch(t){case"connect":return this.connect(e,i.row);case"disconnect":return this.disconnect(e);case"dropcomplete":return this.dropComplete(e,i.row,i.success)}}};w(Fe,"moduleName","moveRow"),w(Fe,"senders",la),w(Fe,"receivers",ha);let zi=Fe;var da={};const tt=class tt extends D{constructor(e){super(e),this.allowedTypes=["","data","edit","clipboard","import"],this.enabled=!0,this.registerColumnOption("mutator"),this.registerColumnOption("mutatorParams"),this.registerColumnOption("mutatorData"),this.registerColumnOption("mutatorDataParams"),this.registerColumnOption("mutatorEdit"),this.registerColumnOption("mutatorEditParams"),this.registerColumnOption("mutatorClipboard"),this.registerColumnOption("mutatorClipboardParams"),this.registerColumnOption("mutatorImport"),this.registerColumnOption("mutatorImportParams"),this.registerColumnOption("mutateLink")}initialize(){this.subscribe("cell-value-changing",this.transformCell.bind(this)),this.subscribe("cell-value-changed",this.mutateLink.bind(this)),this.subscribe("column-layout",this.initializeColumn.bind(this)),this.subscribe("row-data-init-before",this.rowDataChanged.bind(this)),this.subscribe("row-data-changing",this.rowDataChanged.bind(this))}rowDataChanged(e,t,i){return this.transformRow(t,"data",i)}initializeColumn(e){var t=!1,i={};this.allowedTypes.forEach(s=>{var r="mutator"+(s.charAt(0).toUpperCase()+s.slice(1)),o;e.definition[r]&&(o=this.lookupMutator(e.definition[r]),o&&(t=!0,i[r]={mutator:o,params:e.definition[r+"Params"]||{}}))}),t&&(e.modules.mutate=i)}lookupMutator(e){var t=!1;switch(typeof e){case"string":tt.mutators[e]?t=tt.mutators[e]:console.warn("Mutator Error - No such mutator found, ignoring: ",e);break;case"function":t=e;break}return t}transformRow(e,t,i){var s="mutator"+(t.charAt(0).toUpperCase()+t.slice(1)),r;return this.enabled&&this.table.columnManager.traverse(o=>{var a,l,h;o.modules.mutate&&(a=o.modules.mutate[s]||o.modules.mutate.mutator||!1,a&&(r=o.getFieldValue(typeof i<"u"?i:e),(t=="data"&&!i||typeof r<"u")&&(h=o.getComponent(),l=typeof a.params=="function"?a.params(r,e,t,h):a.params,o.setFieldValue(e,a.mutator(r,e,t,l,h)))))}),e}transformCell(e,t){if(e.column.modules.mutate){var i=e.column.modules.mutate.mutatorEdit||e.column.modules.mutate.mutator||!1,s={};if(i)return s=Object.assign(s,e.row.getData()),e.column.setFieldValue(s,t),i.mutator(t,s,"edit",i.params,e.getComponent())}return t}mutateLink(e){var t=e.column.definition.mutateLink;t&&(Array.isArray(t)||(t=[t]),t.forEach(i=>{var s=e.row.getCell(i);s&&s.setValue(s.getValue(),!0,!0)}))}enable(){this.enabled=!0}disable(){this.enabled=!1}};w(tt,"moduleName","mutator"),w(tt,"mutators",da);let Fi=tt;function ua(n,e,t,i,s){var r=document.createElement("span"),o=document.createElement("span"),a=document.createElement("span"),l=document.createElement("span"),h=document.createElement("span"),d=document.createElement("span");return this.table.modules.localize.langBind("pagination|counter|showing",c=>{o.innerHTML=c}),this.table.modules.localize.langBind("pagination|counter|of",c=>{l.innerHTML=c}),this.table.modules.localize.langBind("pagination|counter|rows",c=>{d.innerHTML=c}),i?(a.innerHTML=" "+e+"-"+Math.min(e+n-1,i)+" ",h.innerHTML=" "+i+" ",r.appendChild(o),r.appendChild(a),r.appendChild(l),r.appendChild(h),r.appendChild(d)):(a.innerHTML=" 0 ",r.appendChild(o),r.appendChild(a),r.appendChild(d)),r}function ca(n,e,t,i,s){var r=document.createElement("span"),o=document.createElement("span"),a=document.createElement("span"),l=document.createElement("span"),h=document.createElement("span"),d=document.createElement("span");return this.table.modules.localize.langBind("pagination|counter|showing",c=>{o.innerHTML=c}),a.innerHTML=" "+t+" ",this.table.modules.localize.langBind("pagination|counter|of",c=>{l.innerHTML=c}),h.innerHTML=" "+s+" ",this.table.modules.localize.langBind("pagination|counter|pages",c=>{d.innerHTML=c}),r.appendChild(o),r.appendChild(a),r.appendChild(l),r.appendChild(h),r.appendChild(d),r}var fa={rows:ua,pages:ca};const wt=class wt extends D{constructor(e){super(e),this.mode="local",this.progressiveLoad=!1,this.element=null,this.pageCounterElement=null,this.pageCounter=null,this.size=0,this.page=1,this.count=5,this.max=1,this.remoteRowCountEstimate=null,this.initialLoad=!0,this.dataChanging=!1,this.pageSizes=[],this.registerTableOption("pagination",!1),this.registerTableOption("paginationMode","local"),this.registerTableOption("paginationSize",!1),this.registerTableOption("paginationInitialPage",1),this.registerTableOption("paginationCounter",!1),this.registerTableOption("paginationCounterElement",!1),this.registerTableOption("paginationButtonCount",5),this.registerTableOption("paginationSizeSelector",!1),this.registerTableOption("paginationElement",!1),this.registerTableOption("paginationAddRow","page"),this.registerTableOption("paginationOutOfRange",!1),this.registerTableOption("progressiveLoad",!1),this.registerTableOption("progressiveLoadDelay",0),this.registerTableOption("progressiveLoadScrollMargin",0),this.registerTableFunction("setMaxPage",this.setMaxPage.bind(this)),this.registerTableFunction("setPage",this.setPage.bind(this)),this.registerTableFunction("setPageToRow",this.userSetPageToRow.bind(this)),this.registerTableFunction("setPageSize",this.userSetPageSize.bind(this)),this.registerTableFunction("getPageSize",this.getPageSize.bind(this)),this.registerTableFunction("previousPage",this.previousPage.bind(this)),this.registerTableFunction("nextPage",this.nextPage.bind(this)),this.registerTableFunction("getPage",this.getPage.bind(this)),this.registerTableFunction("getPageMax",this.getPageMax.bind(this)),this.registerComponentFunction("row","pageTo",this.setPageToRow.bind(this))}initialize(){this.table.options.pagination?(this.subscribe("row-deleted",this.rowsUpdated.bind(this)),this.subscribe("row-added",this.rowsUpdated.bind(this)),this.subscribe("data-processed",this.initialLoadComplete.bind(this)),this.subscribe("table-built",this.calculatePageSizes.bind(this)),this.subscribe("footer-redraw",this.footerRedraw.bind(this)),this.table.options.paginationAddRow=="page"&&this.subscribe("row-adding-position",this.rowAddingPosition.bind(this)),this.table.options.paginationMode==="remote"&&(this.subscribe("data-params",this.remotePageParams.bind(this)),this.subscribe("data-loaded",this._parseRemoteData.bind(this))),this.table.options.progressiveLoad&&console.error("Progressive Load Error - Pagination and progressive load cannot be used at the same time"),this.registerDisplayHandler(this.restOnRenderBefore.bind(this),40),this.registerDisplayHandler(this.getRows.bind(this),50),this.createElements(),this.initializePageCounter(),this.initializePaginator()):this.table.options.progressiveLoad&&(this.subscribe("data-params",this.remotePageParams.bind(this)),this.subscribe("data-loaded",this._parseRemoteData.bind(this)),this.subscribe("table-built",this.calculatePageSizes.bind(this)),this.subscribe("data-processed",this.initialLoadComplete.bind(this)),this.initializeProgressive(this.table.options.progressiveLoad),this.table.options.progressiveLoad==="scroll"&&this.subscribe("scroll-vertical",this.scrollVertical.bind(this)))}rowAddingPosition(e,t){var i=this.table.rowManager,s=i.getDisplayRows(),r;return t?s.length?r=s[0]:i.activeRows.length&&(r=i.activeRows[i.activeRows.length-1],t=!1):s.length&&(r=s[s.length-1],t=!(s.length<this.size)),{index:r,top:t}}calculatePageSizes(){var e,t;this.table.options.paginationSize?this.size=this.table.options.paginationSize:(e=document.createElement("div"),e.classList.add("tabulator-row"),e.style.visibility="hidden",t=document.createElement("div"),t.classList.add("tabulator-cell"),t.innerHTML="Page Row Test",e.appendChild(t),this.table.rowManager.getTableElement().appendChild(e),this.size=Math.floor(this.table.rowManager.getElement().clientHeight/e.offsetHeight),this.table.rowManager.getTableElement().removeChild(e)),this.dispatchExternal("pageSizeChanged",this.size),this.generatePageSizeSelectList()}initialLoadComplete(){this.initialLoad=!1}remotePageParams(e,t,i,s){return this.initialLoad||(this.progressiveLoad&&!i||!this.progressiveLoad&&!this.dataChanging)&&this.reset(!0),s.page=this.page,this.size&&(s.size=this.size),s}userSetPageToRow(e){return this.table.options.pagination&&(e=this.table.rowManager.findRow(e),e)?this.setPageToRow(e):Promise.reject()}userSetPageSize(e){return this.table.options.pagination?(this.setPageSize(e),this.setPage(1)):!1}scrollVertical(e,t){var i,s,r;!t&&!this.table.dataLoader.loading&&(i=this.table.rowManager.getElement(),s=i.scrollHeight-i.clientHeight-e,r=this.table.options.progressiveLoadScrollMargin||i.clientHeight*2,s<r&&this.nextPage().catch(()=>{}))}restOnRenderBefore(e,t){return t||this.mode==="local"&&this.reset(),e}rowsUpdated(){this.refreshData(!0,"all")}createElements(){var e;this.element=document.createElement("span"),this.element.classList.add("tabulator-paginator"),this.pagesElement=document.createElement("span"),this.pagesElement.classList.add("tabulator-pages"),e=document.createElement("button"),e.classList.add("tabulator-page"),e.setAttribute("type","button"),e.setAttribute("role","button"),e.setAttribute("aria-label",""),e.setAttribute("title",""),this.firstBut=e.cloneNode(!0),this.firstBut.setAttribute("data-page","first"),this.prevBut=e.cloneNode(!0),this.prevBut.setAttribute("data-page","prev"),this.nextBut=e.cloneNode(!0),this.nextBut.setAttribute("data-page","next"),this.lastBut=e.cloneNode(!0),this.lastBut.setAttribute("data-page","last"),this.table.options.paginationSizeSelector&&(this.pageSizeSelect=document.createElement("select"),this.pageSizeSelect.classList.add("tabulator-page-size"))}generatePageSizeSelectList(){var e=[];if(this.pageSizeSelect){if(Array.isArray(this.table.options.paginationSizeSelector))e=this.table.options.paginationSizeSelector,this.pageSizes=e,this.pageSizes.indexOf(this.size)==-1&&e.unshift(this.size);else if(this.pageSizes.indexOf(this.size)==-1){e=[];for(let t=1;t<5;t++)e.push(this.size*t);this.pageSizes=e}else e=this.pageSizes;for(;this.pageSizeSelect.firstChild;)this.pageSizeSelect.removeChild(this.pageSizeSelect.firstChild);e.forEach(t=>{var i=document.createElement("option");i.value=t,t===!0?this.langBind("pagination|all",function(s){i.innerHTML=s}):i.innerHTML=t,this.pageSizeSelect.appendChild(i)}),this.pageSizeSelect.value=this.size}}initializePageCounter(){var e=this.table.options.paginationCounter,t=null;e&&(typeof e=="function"?t=e:t=wt.pageCounters[e],t?(this.pageCounter=t,this.pageCounterElement=document.createElement("span"),this.pageCounterElement.classList.add("tabulator-page-counter")):console.warn("Pagination Error - No such page counter found: ",e))}initializePaginator(e){var t,i;e||(this.langBind("pagination|first",s=>{this.firstBut.innerHTML=s}),this.langBind("pagination|first_title",s=>{this.firstBut.setAttribute("aria-label",s),this.firstBut.setAttribute("title",s)}),this.langBind("pagination|prev",s=>{this.prevBut.innerHTML=s}),this.langBind("pagination|prev_title",s=>{this.prevBut.setAttribute("aria-label",s),this.prevBut.setAttribute("title",s)}),this.langBind("pagination|next",s=>{this.nextBut.innerHTML=s}),this.langBind("pagination|next_title",s=>{this.nextBut.setAttribute("aria-label",s),this.nextBut.setAttribute("title",s)}),this.langBind("pagination|last",s=>{this.lastBut.innerHTML=s}),this.langBind("pagination|last_title",s=>{this.lastBut.setAttribute("aria-label",s),this.lastBut.setAttribute("title",s)}),this.firstBut.addEventListener("click",()=>{this.setPage(1)}),this.prevBut.addEventListener("click",()=>{this.previousPage()}),this.nextBut.addEventListener("click",()=>{this.nextPage()}),this.lastBut.addEventListener("click",()=>{this.setPage(this.max)}),this.table.options.paginationElement&&(this.element=this.table.options.paginationElement),this.pageSizeSelect&&(t=document.createElement("label"),this.langBind("pagination|page_size",s=>{this.pageSizeSelect.setAttribute("aria-label",s),this.pageSizeSelect.setAttribute("title",s),t.innerHTML=s}),this.element.appendChild(t),this.element.appendChild(this.pageSizeSelect),this.pageSizeSelect.addEventListener("change",s=>{this.setPageSize(this.pageSizeSelect.value=="true"?!0:this.pageSizeSelect.value),this.setPage(1)})),this.element.appendChild(this.firstBut),this.element.appendChild(this.prevBut),this.element.appendChild(this.pagesElement),this.element.appendChild(this.nextBut),this.element.appendChild(this.lastBut),this.table.options.paginationElement||(this.table.options.paginationCounter&&(this.table.options.paginationCounterElement?this.table.options.paginationCounterElement instanceof HTMLElement?this.table.options.paginationCounterElement.appendChild(this.pageCounterElement):typeof this.table.options.paginationCounterElement=="string"&&(i=document.querySelector(this.table.options.paginationCounterElement),i?i.appendChild(this.pageCounterElement):console.warn("Pagination Error - Unable to find element matching paginationCounterElement selector:",this.table.options.paginationCounterElement)):this.footerAppend(this.pageCounterElement)),this.footerAppend(this.element)),this.page=this.table.options.paginationInitialPage,this.count=this.table.options.paginationButtonCount),this.mode=this.table.options.paginationMode}initializeProgressive(e){this.initializePaginator(!0),this.mode="progressive_"+e,this.progressiveLoad=!0}trackChanges(){this.dispatch("page-changed")}setMaxRows(e){e?this.max=this.size===!0?1:Math.ceil(e/this.size):this.max=1,this.page>this.max&&(this.page=this.max)}reset(e){this.initialLoad||(this.mode=="local"||e)&&(this.page=1,this.trackChanges())}setMaxPage(e){e=parseInt(e),this.max=e||1,this.page>this.max&&(this.page=this.max,this.trigger())}setPage(e){switch(e){case"first":return this.setPage(1);case"prev":return this.previousPage();case"next":return this.nextPage();case"last":return this.setPage(this.max)}return e=parseInt(e),e>0&&e<=this.max||this.mode!=="local"?(this.page=e,this.trackChanges(),this.trigger()):(console.warn("Pagination Error - Requested page is out of range of 1 - "+this.max+":",e),Promise.reject())}setPageToRow(e){var t=this.displayRows(-1),i=t.indexOf(e);if(i>-1){var s=this.size===!0?1:Math.ceil((i+1)/this.size);return this.setPage(s)}else return console.warn("Pagination Error - Requested row is not visible"),Promise.reject()}setPageSize(e){e!==!0&&(e=parseInt(e)),e>0&&(this.size=e,this.dispatchExternal("pageSizeChanged",e)),this.pageSizeSelect&&this.generatePageSizeSelectList(),this.trackChanges()}_setPageCounter(e,t,i){var s;if(this.pageCounter)switch(this.mode==="remote"&&(t=this.size,i=(this.page-1)*this.size+1,e=this.remoteRowCountEstimate),s=this.pageCounter.call(this,t,i,this.page,e,this.max),typeof s){case"object":if(s instanceof Node){for(;this.pageCounterElement.firstChild;)this.pageCounterElement.removeChild(this.pageCounterElement.firstChild);this.pageCounterElement.appendChild(s)}else this.pageCounterElement.innerHTML="",s!=null&&console.warn("Page Counter Error - Page Counter has returned a type of object, the only valid page counter object return is an instance of Node, the page counter returned:",s);break;case"undefined":this.pageCounterElement.innerHTML="";break;default:this.pageCounterElement.innerHTML=s}}_setPageButtons(){let e=Math.floor((this.count-1)/2),t=Math.ceil((this.count-1)/2),i=this.max-this.page+e+1<this.count?this.max-this.count+1:Math.max(this.page-e,1),s=this.page<=t?Math.min(this.count,this.max):Math.min(this.page+t,this.max);for(;this.pagesElement.firstChild;)this.pagesElement.removeChild(this.pagesElement.firstChild);this.page==1?(this.firstBut.disabled=!0,this.prevBut.disabled=!0):(this.firstBut.disabled=!1,this.prevBut.disabled=!1),this.page==this.max?(this.lastBut.disabled=!0,this.nextBut.disabled=!0):(this.lastBut.disabled=!1,this.nextBut.disabled=!1);for(let r=i;r<=s;r++)r>0&&r<=this.max&&this.pagesElement.appendChild(this._generatePageButton(r));this.footerRedraw()}_generatePageButton(e){var t=document.createElement("button");return t.classList.add("tabulator-page"),e==this.page&&t.classList.add("active"),t.setAttribute("type","button"),t.setAttribute("role","button"),this.langBind("pagination|page_title",i=>{t.setAttribute("aria-label",i+" "+e),t.setAttribute("title",i+" "+e)}),t.setAttribute("data-page",e),t.textContent=e,t.addEventListener("click",i=>{this.setPage(e)}),t}previousPage(){return this.page>1?(this.page--,this.trackChanges(),this.trigger()):(console.warn("Pagination Error - Previous page would be less than page 1:",0),Promise.reject())}nextPage(){return this.page<this.max?(this.page++,this.trackChanges(),this.trigger()):(this.progressiveLoad||console.warn("Pagination Error - Next page would be greater than maximum page of "+this.max+":",this.max+1),Promise.reject())}getPage(){return this.page}getPageMax(){return this.max}getPageSize(e){return this.size}getMode(){return this.mode}getRows(e){var t=0,i,s,r,o,a=e.filter(l=>l.type==="row");if(this.mode=="local"){i=[],this.setMaxRows(e.length),this.size===!0?(s=0,r=e.length):(s=this.size*(this.page-1),r=s+parseInt(this.size)),this._setPageButtons();for(let l=s;l<r;l++){let h=e[l];h&&(i.push(h),h.type==="row"&&(o||(o=h),t++))}return this._setPageCounter(a.length,t,o?a.indexOf(o)+1:0),i}else return this._setPageButtons(),this._setPageCounter(a.length),e.slice(0)}trigger(){var e;switch(this.mode){case"local":return e=this.table.rowManager.scrollLeft,this.refreshData(),this.table.rowManager.scrollHorizontal(e),this.dispatchExternal("pageLoaded",this.getPage()),Promise.resolve();case"remote":return this.dataChanging=!0,this.reloadData(null).finally(()=>{this.dataChanging=!1});case"progressive_load":case"progressive_scroll":return this.reloadData(null,!0);default:return console.warn("Pagination Error - no such pagination mode:",this.mode),Promise.reject()}}_parseRemoteData(e){var t,i;if(typeof e.last_page>"u"&&console.warn("Remote Pagination Error - Server response missing '"+(this.options("dataReceiveParams").last_page||"last_page")+"' property"),e.data)if(this.max=parseInt(e.last_page)||1,this.remoteRowCountEstimate=typeof e.last_row<"u"?e.last_row:e.last_page*this.size-(this.page==e.last_page?this.size-e.data.length:0),this.progressiveLoad){switch(this.mode){case"progressive_load":this.page==1?this.table.rowManager.setData(e.data,!1,this.page==1):this.table.rowManager.addRows(e.data),this.page<this.max&&setTimeout(()=>{this.nextPage()},this.table.options.progressiveLoadDelay);break;case"progressive_scroll":e=this.page===1?e.data:this.table.rowManager.getData().concat(e.data),this.table.rowManager.setData(e,this.page!==1,this.page==1),t=this.table.options.progressiveLoadScrollMargin||this.table.rowManager.element.clientHeight*2,this.table.rowManager.element.scrollHeight<=this.table.rowManager.element.clientHeight+t&&this.page<this.max&&setTimeout(()=>{this.nextPage()});break}return!1}else{if(this.page>this.max&&(console.warn("Remote Pagination Error - Server returned last page value lower than the current page"),i=this.options("paginationOutOfRange"),i))return this.setPage(typeof i=="function"?i.call(this,this.page,this.max):i);this.dispatchExternal("pageLoaded",this.getPage())}else console.warn("Remote Pagination Error - Server response missing '"+(this.options("dataReceiveParams").data||"data")+"' property");return e.data}footerRedraw(){var e=this.table.footerManager.containerElement;Math.ceil(e.clientWidth)-e.scrollWidth<0?this.pagesElement.style.display="none":(this.pagesElement.style.display="",Math.ceil(e.clientWidth)-e.scrollWidth<0&&(this.pagesElement.style.display="none"))}};w(wt,"moduleName","page"),w(wt,"pageCounters",fa);let Hi=wt;var pa={local:function(n,e){var t=localStorage.getItem(n+"-"+e);return t?JSON.parse(t):!1},cookie:function(n,e){var t=document.cookie,i=n+"-"+e,s=t.indexOf(i+"="),r,o;return s>-1&&(t=t.slice(s),r=t.indexOf(";"),r>-1&&(t=t.slice(0,r)),o=t.replace(i+"=","")),o?JSON.parse(o):!1}},ga={local:function(n,e,t){localStorage.setItem(n+"-"+e,JSON.stringify(t))},cookie:function(n,e,t){var i=new Date;i.setDate(i.getDate()+1e4),document.cookie=n+"-"+e+"="+JSON.stringify(t)+"; expires="+i.toUTCString()}};const X=class X extends D{constructor(e){super(e),this.mode="",this.id="",this.defWatcherBlock=!1,this.config={},this.readFunc=!1,this.writeFunc=!1,this.registerTableOption("persistence",!1),this.registerTableOption("persistenceID",""),this.registerTableOption("persistenceMode",!0),this.registerTableOption("persistenceReaderFunc",!1),this.registerTableOption("persistenceWriterFunc",!1)}localStorageTest(){var e="_tabulator_test";try{return window.localStorage.setItem(e,e),window.localStorage.removeItem(e),!0}catch{return!1}}initialize(){if(this.table.options.persistence){var e=this.table.options.persistenceMode,t=this.table.options.persistenceID,i;this.mode=e!==!0?e:this.localStorageTest()?"local":"cookie",this.table.options.persistenceReaderFunc?typeof this.table.options.persistenceReaderFunc=="function"?this.readFunc=this.table.options.persistenceReaderFunc:X.readers[this.table.options.persistenceReaderFunc]?this.readFunc=X.readers[this.table.options.persistenceReaderFunc]:console.warn("Persistence Read Error - invalid reader set",this.table.options.persistenceReaderFunc):X.readers[this.mode]?this.readFunc=X.readers[this.mode]:console.warn("Persistence Read Error - invalid reader set",this.mode),this.table.options.persistenceWriterFunc?typeof this.table.options.persistenceWriterFunc=="function"?this.writeFunc=this.table.options.persistenceWriterFunc:X.writers[this.table.options.persistenceWriterFunc]?this.writeFunc=X.writers[this.table.options.persistenceWriterFunc]:console.warn("Persistence Write Error - invalid reader set",this.table.options.persistenceWriterFunc):X.writers[this.mode]?this.writeFunc=X.writers[this.mode]:console.warn("Persistence Write Error - invalid writer set",this.mode),this.id="tabulator-"+(t||this.table.element.getAttribute("id")||""),this.config={sort:this.table.options.persistence===!0||this.table.options.persistence.sort,filter:this.table.options.persistence===!0||this.table.options.persistence.filter,headerFilter:this.table.options.persistence===!0||this.table.options.persistence.headerFilter,group:this.table.options.persistence===!0||this.table.options.persistence.group,page:this.table.options.persistence===!0||this.table.options.persistence.page,columns:this.table.options.persistence===!0?["title","width","visible"]:this.table.options.persistence.columns},this.config.page&&(i=this.retrieveData("page"),i&&(typeof i.paginationSize<"u"&&(this.config.page===!0||this.config.page.size)&&(this.table.options.paginationSize=i.paginationSize),typeof i.paginationInitialPage<"u"&&(this.config.page===!0||this.config.page.page)&&(this.table.options.paginationInitialPage=i.paginationInitialPage))),this.config.group&&(i=this.retrieveData("group"),i&&(typeof i.groupBy<"u"&&(this.config.group===!0||this.config.group.groupBy)&&(this.table.options.groupBy=i.groupBy),typeof i.groupStartOpen<"u"&&(this.config.group===!0||this.config.group.groupStartOpen)&&(this.table.options.groupStartOpen=i.groupStartOpen),typeof i.groupHeader<"u"&&(this.config.group===!0||this.config.group.groupHeader)&&(this.table.options.groupHeader=i.groupHeader))),this.config.columns&&(this.table.options.columns=this.load("columns",this.table.options.columns),this.subscribe("column-init",this.initializeColumn.bind(this)),this.subscribe("column-show",this.save.bind(this,"columns")),this.subscribe("column-hide",this.save.bind(this,"columns")),this.subscribe("column-moved",this.save.bind(this,"columns"))),this.subscribe("table-built",this.tableBuilt.bind(this),0),this.subscribe("table-redraw",this.tableRedraw.bind(this)),this.subscribe("filter-changed",this.eventSave.bind(this,"filter")),this.subscribe("filter-changed",this.eventSave.bind(this,"headerFilter")),this.subscribe("sort-changed",this.eventSave.bind(this,"sort")),this.subscribe("group-changed",this.eventSave.bind(this,"group")),this.subscribe("page-changed",this.eventSave.bind(this,"page")),this.subscribe("column-resized",this.eventSave.bind(this,"columns")),this.subscribe("column-width",this.eventSave.bind(this,"columns")),this.subscribe("layout-refreshed",this.eventSave.bind(this,"columns"))}this.registerTableFunction("getColumnLayout",this.getColumnLayout.bind(this)),this.registerTableFunction("setColumnLayout",this.setColumnLayout.bind(this))}eventSave(e){this.config[e]&&this.save(e)}tableBuilt(){var e,t,i;this.config.sort&&(e=this.load("sort"),e&&(this.table.options.initialSort=e)),this.config.filter&&(t=this.load("filter"),t&&(this.table.options.initialFilter=t)),this.config.headerFilter&&(i=this.load("headerFilter"),i&&(this.table.options.initialHeaderFilter=i))}tableRedraw(e){e&&this.config.columns&&this.save("columns")}getColumnLayout(){return this.parseColumns(this.table.columnManager.getColumns())}setColumnLayout(e){return this.table.columnManager.setColumns(this.mergeDefinition(this.table.options.columns,e,!0)),!0}initializeColumn(e){var t,i;this.config.columns&&(this.defWatcherBlock=!0,t=e.getDefinition(),i=this.config.columns===!0?Object.keys(t):this.config.columns,i.forEach(s=>{var r=Object.getOwnPropertyDescriptor(t,s),o=t[s];r&&Object.defineProperty(t,s,{set:a=>{o=a,this.defWatcherBlock||this.save("columns"),r.set&&r.set(a)},get:()=>(r.get&&r.get(),o)})}),this.defWatcherBlock=!1)}load(e,t){var i=this.retrieveData(e);return t&&(i=i?this.mergeDefinition(t,i):t),i}retrieveData(e){return this.readFunc?this.readFunc(this.id,e):!1}mergeDefinition(e,t,i){var s=[];return t=t||[],t.forEach((r,o)=>{var a=this._findColumn(e,r),l;a&&(i?l=Object.keys(r):this.config.columns===!0||this.config.columns==null?(l=Object.keys(a),l.push("width")):l=this.config.columns,l.forEach(h=>{h!=="columns"&&typeof r[h]<"u"&&(a[h]=r[h])}),a.columns&&(a.columns=this.mergeDefinition(a.columns,r.columns)),s.push(a))}),e.forEach((r,o)=>{var a=this._findColumn(t,r);a||(s.length>o?s.splice(o,0,r):s.push(r))}),s}_findColumn(e,t){var i=t.columns?"group":t.field?"field":"object";return e.find(function(s){switch(i){case"group":return s.title===t.title&&s.columns.length===t.columns.length;case"field":return s.field===t.field;case"object":return s===t}})}save(e){var t={};switch(e){case"columns":t=this.parseColumns(this.table.columnManager.getColumns());break;case"filter":t=this.table.modules.filter.getFilters();break;case"headerFilter":t=this.table.modules.filter.getHeaderFilters();break;case"sort":t=this.validateSorters(this.table.modules.sort.getSort());break;case"group":t=this.getGroupConfig();break;case"page":t=this.getPageConfig();break}this.writeFunc&&this.writeFunc(this.id,e,t)}validateSorters(e){return e.forEach(function(t){t.column=t.field,delete t.field}),e}getGroupConfig(){var e={};return this.config.group&&((this.config.group===!0||this.config.group.groupBy)&&(e.groupBy=this.table.options.groupBy),(this.config.group===!0||this.config.group.groupStartOpen)&&(e.groupStartOpen=this.table.options.groupStartOpen),(this.config.group===!0||this.config.group.groupHeader)&&(e.groupHeader=this.table.options.groupHeader)),e}getPageConfig(){var e={};return this.config.page&&((this.config.page===!0||this.config.page.size)&&(e.paginationSize=this.table.modules.page.getPageSize()),(this.config.page===!0||this.config.page.page)&&(e.paginationInitialPage=this.table.modules.page.getPage())),e}parseColumns(e){var t=[],i=["headerContextMenu","headerMenu","contextMenu","clickMenu"];return e.forEach(s=>{var r={},o=s.getDefinition(),a;s.isGroup?(r.title=o.title,r.columns=this.parseColumns(s.getColumns())):(r.field=s.getField(),this.config.columns===!0||this.config.columns==null?(a=Object.keys(o),a.push("width"),a.push("visible")):a=this.config.columns,a.forEach(l=>{switch(l){case"width":r.width=s.getWidth();break;case"visible":r.visible=s.visible;break;default:typeof o[l]!="function"&&i.indexOf(l)===-1&&(r[l]=o[l])}})),t.push(r)}),t}};w(X,"moduleName","persistence"),w(X,"moduleInitOrder",-10),w(X,"readers",pa),w(X,"writers",ga);let Ai=X;class _n extends D{constructor(e){super(e),this.columnSubscribers={},this.registerTableOption("rowContextPopup",!1),this.registerTableOption("rowClickPopup",!1),this.registerTableOption("rowDblClickPopup",!1),this.registerTableOption("groupContextPopup",!1),this.registerTableOption("groupClickPopup",!1),this.registerTableOption("groupDblClickPopup",!1),this.registerColumnOption("headerContextPopup"),this.registerColumnOption("headerClickPopup"),this.registerColumnOption("headerDblClickPopup"),this.registerColumnOption("headerPopup"),this.registerColumnOption("headerPopupIcon"),this.registerColumnOption("contextPopup"),this.registerColumnOption("clickPopup"),this.registerColumnOption("dblClickPopup"),this.registerComponentFunction("cell","popup",this._componentPopupCall.bind(this)),this.registerComponentFunction("column","popup",this._componentPopupCall.bind(this)),this.registerComponentFunction("row","popup",this._componentPopupCall.bind(this)),this.registerComponentFunction("group","popup",this._componentPopupCall.bind(this))}initialize(){this.initializeRowWatchers(),this.initializeGroupWatchers(),this.subscribe("column-init",this.initializeColumn.bind(this))}_componentPopupCall(e,t,i){this.loadPopupEvent(t,null,e,i)}initializeRowWatchers(){this.table.options.rowContextPopup&&(this.subscribe("row-contextmenu",this.loadPopupEvent.bind(this,this.table.options.rowContextPopup)),this.table.on("rowTapHold",this.loadPopupEvent.bind(this,this.table.options.rowContextPopup))),this.table.options.rowClickPopup&&this.subscribe("row-click",this.loadPopupEvent.bind(this,this.table.options.rowClickPopup)),this.table.options.rowDblClickPopup&&this.subscribe("row-dblclick",this.loadPopupEvent.bind(this,this.table.options.rowDblClickPopup))}initializeGroupWatchers(){this.table.options.groupContextPopup&&(this.subscribe("group-contextmenu",this.loadPopupEvent.bind(this,this.table.options.groupContextPopup)),this.table.on("groupTapHold",this.loadPopupEvent.bind(this,this.table.options.groupContextPopup))),this.table.options.groupClickPopup&&this.subscribe("group-click",this.loadPopupEvent.bind(this,this.table.options.groupClickPopup)),this.table.options.groupDblClickPopup&&this.subscribe("group-dblclick",this.loadPopupEvent.bind(this,this.table.options.groupDblClickPopup))}initializeColumn(e){var t=e.definition;t.headerContextPopup&&!this.columnSubscribers.headerContextPopup&&(this.columnSubscribers.headerContextPopup=this.loadPopupTableColumnEvent.bind(this,"headerContextPopup"),this.subscribe("column-contextmenu",this.columnSubscribers.headerContextPopup),this.table.on("headerTapHold",this.loadPopupTableColumnEvent.bind(this,"headerContextPopup"))),t.headerClickPopup&&!this.columnSubscribers.headerClickPopup&&(this.columnSubscribers.headerClickPopup=this.loadPopupTableColumnEvent.bind(this,"headerClickPopup"),this.subscribe("column-click",this.columnSubscribers.headerClickPopup)),t.headerDblClickPopup&&!this.columnSubscribers.headerDblClickPopup&&(this.columnSubscribers.headerDblClickPopup=this.loadPopupTableColumnEvent.bind(this,"headerDblClickPopup"),this.subscribe("column-dblclick",this.columnSubscribers.headerDblClickPopup)),t.headerPopup&&this.initializeColumnHeaderPopup(e),t.contextPopup&&!this.columnSubscribers.contextPopup&&(this.columnSubscribers.contextPopup=this.loadPopupTableCellEvent.bind(this,"contextPopup"),this.subscribe("cell-contextmenu",this.columnSubscribers.contextPopup),this.table.on("cellTapHold",this.loadPopupTableCellEvent.bind(this,"contextPopup"))),t.clickPopup&&!this.columnSubscribers.clickPopup&&(this.columnSubscribers.clickPopup=this.loadPopupTableCellEvent.bind(this,"clickPopup"),this.subscribe("cell-click",this.columnSubscribers.clickPopup)),t.dblClickPopup&&!this.columnSubscribers.dblClickPopup&&(this.columnSubscribers.dblClickPopup=this.loadPopupTableCellEvent.bind(this,"dblClickPopup"),this.subscribe("cell-click",this.columnSubscribers.dblClickPopup))}initializeColumnHeaderPopup(e){var t=e.definition.headerPopupIcon,i;i=document.createElement("span"),i.classList.add("tabulator-header-popup-button"),t?(typeof t=="function"&&(t=t(e.getComponent())),t instanceof HTMLElement?i.appendChild(t):i.innerHTML=t):i.innerHTML="&vellip;",i.addEventListener("click",s=>{s.stopPropagation(),s.preventDefault(),this.loadPopupEvent(e.definition.headerPopup,s,e)}),e.titleElement.insertBefore(i,e.titleElement.firstChild)}loadPopupTableCellEvent(e,t,i){i._cell&&(i=i._cell),i.column.definition[e]&&this.loadPopupEvent(i.column.definition[e],t,i)}loadPopupTableColumnEvent(e,t,i){i._column&&(i=i._column),i.definition[e]&&this.loadPopupEvent(i.definition[e],t,i)}loadPopupEvent(e,t,i,s){var r;function o(a){r=a}i._group?i=i._group:i._row&&(i=i._row),e=typeof e=="function"?e.call(this.table,t,i.getComponent(),o):e,this.loadPopup(t,i,e,r,s)}loadPopup(e,t,i,s,r){var o=!(e instanceof MouseEvent),a,l;i instanceof HTMLElement?a=i:(a=document.createElement("div"),a.innerHTML=i),a.classList.add("tabulator-popup"),a.addEventListener("click",h=>{h.stopPropagation()}),o||e.preventDefault(),l=this.popup(a),typeof s=="function"&&l.renderCallback(s),e?l.show(e):l.show(t.getElement(),r||"center"),l.hideOnBlur(()=>{this.dispatchExternal("popupClosed",t.getComponent())}),this.dispatchExternal("popupOpened",t.getComponent())}}w(_n,"moduleName","popup");class kn extends D{constructor(e){super(e),this.element=!1,this.manualBlock=!1,this.beforeprintEventHandler=null,this.afterprintEventHandler=null,this.registerTableOption("printAsHtml",!1),this.registerTableOption("printFormatter",!1),this.registerTableOption("printHeader",!1),this.registerTableOption("printFooter",!1),this.registerTableOption("printStyled",!0),this.registerTableOption("printRowRange","visible"),this.registerTableOption("printConfig",{}),this.registerColumnOption("print"),this.registerColumnOption("titlePrint")}initialize(){this.table.options.printAsHtml&&(this.beforeprintEventHandler=this.replaceTable.bind(this),this.afterprintEventHandler=this.cleanup.bind(this),window.addEventListener("beforeprint",this.beforeprintEventHandler),window.addEventListener("afterprint",this.afterprintEventHandler),this.subscribe("table-destroy",this.destroy.bind(this))),this.registerTableFunction("print",this.printFullscreen.bind(this))}destroy(){this.table.options.printAsHtml&&(window.removeEventListener("beforeprint",this.beforeprintEventHandler),window.removeEventListener("afterprint",this.afterprintEventHandler))}replaceTable(){this.manualBlock||(this.element=document.createElement("div"),this.element.classList.add("tabulator-print-table"),this.element.appendChild(this.table.modules.export.generateTable(this.table.options.printConfig,this.table.options.printStyled,this.table.options.printRowRange,"print")),this.table.element.style.display="none",this.table.element.parentNode.insertBefore(this.element,this.table.element))}cleanup(){document.body.classList.remove("tabulator-print-fullscreen-hide"),this.element&&this.element.parentNode&&(this.element.parentNode.removeChild(this.element),this.table.element.style.display="")}printFullscreen(e,t,i){var s=window.scrollX,r=window.scrollY,o=document.createElement("div"),a=document.createElement("div"),l=this.table.modules.export.generateTable(typeof i<"u"?i:this.table.options.printConfig,typeof t<"u"?t:this.table.options.printStyled,e||this.table.options.printRowRange,"print"),h,d;this.manualBlock=!0,this.element=document.createElement("div"),this.element.classList.add("tabulator-print-fullscreen"),this.table.options.printHeader&&(o.classList.add("tabulator-print-header"),h=typeof this.table.options.printHeader=="function"?this.table.options.printHeader.call(this.table):this.table.options.printHeader,typeof h=="string"?o.innerHTML=h:o.appendChild(h),this.element.appendChild(o)),this.element.appendChild(l),this.table.options.printFooter&&(a.classList.add("tabulator-print-footer"),d=typeof this.table.options.printFooter=="function"?this.table.options.printFooter.call(this.table):this.table.options.printFooter,typeof d=="string"?a.innerHTML=d:a.appendChild(d),this.element.appendChild(a)),document.body.classList.add("tabulator-print-fullscreen-hide"),document.body.appendChild(this.element),this.table.options.printFormatter&&this.table.options.printFormatter(this.element,l),window.print(),this.cleanup(),window.scrollTo(s,r),this.manualBlock=!1}}w(kn,"moduleName","print");class Tn extends D{constructor(e){super(e),this.data=!1,this.blocked=!1,this.origFuncs={},this.currentVersion=0,this.registerTableOption("reactiveData",!1)}initialize(){this.table.options.reactiveData&&(this.subscribe("cell-value-save-before",this.block.bind(this,"cellsave")),this.subscribe("cell-value-save-after",this.unblock.bind(this,"cellsave")),this.subscribe("row-data-save-before",this.block.bind(this,"rowsave")),this.subscribe("row-data-save-after",this.unblock.bind(this,"rowsave")),this.subscribe("row-data-init-after",this.watchRow.bind(this)),this.subscribe("data-processing",this.watchData.bind(this)),this.subscribe("table-destroy",this.unwatchData.bind(this)))}watchData(e){var t=this,i;this.currentVersion++,i=this.currentVersion,this.unwatchData(),this.data=e,this.origFuncs.push=e.push,Object.defineProperty(this.data,"push",{enumerable:!1,configurable:!0,value:function(){var s=Array.from(arguments),r;return!t.blocked&&i===t.currentVersion&&(t.block("data-push"),s.forEach(o=>{t.table.rowManager.addRowActual(o,!1)}),r=t.origFuncs.push.apply(e,arguments),t.unblock("data-push")),r}}),this.origFuncs.unshift=e.unshift,Object.defineProperty(this.data,"unshift",{enumerable:!1,configurable:!0,value:function(){var s=Array.from(arguments),r;return!t.blocked&&i===t.currentVersion&&(t.block("data-unshift"),s.forEach(o=>{t.table.rowManager.addRowActual(o,!0)}),r=t.origFuncs.unshift.apply(e,arguments),t.unblock("data-unshift")),r}}),this.origFuncs.shift=e.shift,Object.defineProperty(this.data,"shift",{enumerable:!1,configurable:!0,value:function(){var s,r;return!t.blocked&&i===t.currentVersion&&(t.block("data-shift"),t.data.length&&(s=t.table.rowManager.getRowFromDataObject(t.data[0]),s&&s.deleteActual()),r=t.origFuncs.shift.call(e),t.unblock("data-shift")),r}}),this.origFuncs.pop=e.pop,Object.defineProperty(this.data,"pop",{enumerable:!1,configurable:!0,value:function(){var s,r;return!t.blocked&&i===t.currentVersion&&(t.block("data-pop"),t.data.length&&(s=t.table.rowManager.getRowFromDataObject(t.data[t.data.length-1]),s&&s.deleteActual()),r=t.origFuncs.pop.call(e),t.unblock("data-pop")),r}}),this.origFuncs.splice=e.splice,Object.defineProperty(this.data,"splice",{enumerable:!1,configurable:!0,value:function(){var s=Array.from(arguments),r=s[0]<0?e.length+s[0]:s[0],o=s[1],a=s[2]?s.slice(2):!1,l,h;if(!t.blocked&&i===t.currentVersion){if(t.block("data-splice"),a&&(l=e[r]?t.table.rowManager.getRowFromDataObject(e[r]):!1,l?a.forEach(c=>{t.table.rowManager.addRowActual(c,!0,l,!0)}):(a=a.slice().reverse(),a.forEach(c=>{t.table.rowManager.addRowActual(c,!0,!1,!0)}))),o!==0){var d=e.slice(r,typeof s[1]>"u"?s[1]:r+o);d.forEach((c,u)=>{var f=t.table.rowManager.getRowFromDataObject(c);f&&f.deleteActual(u!==d.length-1)})}(a||o!==0)&&t.table.rowManager.reRenderInPosition(),h=t.origFuncs.splice.apply(e,arguments),t.unblock("data-splice")}return h}})}unwatchData(){if(this.data!==!1)for(var e in this.origFuncs)Object.defineProperty(this.data,e,{enumerable:!0,configurable:!0,writable:!0,value:this.origFuncs.key})}watchRow(e){var t=e.getData();for(var i in t)this.watchKey(e,t,i);this.table.options.dataTree&&this.watchTreeChildren(e)}watchTreeChildren(e){var t=this,i=e.getData()[this.table.options.dataTreeChildField],s={};i&&(s.push=i.push,Object.defineProperty(i,"push",{enumerable:!1,configurable:!0,value:()=>{if(!t.blocked){t.block("tree-push");var r=s.push.apply(i,arguments);this.rebuildTree(e),t.unblock("tree-push")}return r}}),s.unshift=i.unshift,Object.defineProperty(i,"unshift",{enumerable:!1,configurable:!0,value:()=>{if(!t.blocked){t.block("tree-unshift");var r=s.unshift.apply(i,arguments);this.rebuildTree(e),t.unblock("tree-unshift")}return r}}),s.shift=i.shift,Object.defineProperty(i,"shift",{enumerable:!1,configurable:!0,value:()=>{if(!t.blocked){t.block("tree-shift");var r=s.shift.call(i);this.rebuildTree(e),t.unblock("tree-shift")}return r}}),s.pop=i.pop,Object.defineProperty(i,"pop",{enumerable:!1,configurable:!0,value:()=>{if(!t.blocked){t.block("tree-pop");var r=s.pop.call(i);this.rebuildTree(e),t.unblock("tree-pop")}return r}}),s.splice=i.splice,Object.defineProperty(i,"splice",{enumerable:!1,configurable:!0,value:()=>{if(!t.blocked){t.block("tree-splice");var r=s.splice.apply(i,arguments);this.rebuildTree(e),t.unblock("tree-splice")}return r}}))}rebuildTree(e){this.table.modules.dataTree.initializeRow(e),this.table.modules.dataTree.layoutRow(e),this.table.rowManager.refreshActiveData("tree",!1,!0)}watchKey(e,t,i){var s=this,r=Object.getOwnPropertyDescriptor(t,i),o=t[i],a=this.currentVersion;Object.defineProperty(t,i,{set:l=>{if(o=l,!s.blocked&&a===s.currentVersion){s.block("key");var h={};h[i]=l,e.updateData(h),s.unblock("key")}r.set&&r.set(l)},get:()=>(r.get&&r.get(),o)})}unwatchRow(e){var t=e.getData();for(var i in t)Object.defineProperty(t,i,{value:t[i]})}block(e){this.blocked||(this.blocked=e)}unblock(e){this.blocked===e&&(this.blocked=!1)}}w(Tn,"moduleName","reactiveData");class Mn extends D{constructor(e){super(e),this.startColumn=!1,this.startX=!1,this.startWidth=!1,this.latestX=!1,this.handle=null,this.initialNextColumn=null,this.nextColumn=null,this.initialized=!1,this.registerColumnOption("resizable",!0),this.registerTableOption("resizableColumnFit",!1),this.registerTableOption("resizableColumnGuide",!1)}initialize(){this.subscribe("column-rendered",this.layoutColumnHeader.bind(this))}initializeEventWatchers(){this.initialized||(this.subscribe("cell-rendered",this.layoutCellHandles.bind(this)),this.subscribe("cell-delete",this.deInitializeComponent.bind(this)),this.subscribe("cell-height",this.resizeHandle.bind(this)),this.subscribe("column-moved",this.columnLayoutUpdated.bind(this)),this.subscribe("column-hide",this.deInitializeColumn.bind(this)),this.subscribe("column-show",this.columnLayoutUpdated.bind(this)),this.subscribe("column-width",this.columnWidthUpdated.bind(this)),this.subscribe("column-delete",this.deInitializeComponent.bind(this)),this.subscribe("column-height",this.resizeHandle.bind(this)),this.initialized=!0)}layoutCellHandles(e){e.row.type==="row"&&(this.deInitializeComponent(e),this.initializeColumn("cell",e,e.column,e.element))}layoutColumnHeader(e){e.definition.resizable&&(this.initializeEventWatchers(),this.deInitializeComponent(e),this.initializeColumn("header",e,e,e.element))}columnLayoutUpdated(e){var t=e.prevColumn();this.reinitializeColumn(e),t&&this.reinitializeColumn(t)}columnWidthUpdated(e){e.modules.frozen&&(this.table.modules.frozenColumns.leftColumns.includes(e)?this.table.modules.frozenColumns.leftColumns.forEach(t=>{this.reinitializeColumn(t)}):this.table.modules.frozenColumns.rightColumns.includes(e)&&this.table.modules.frozenColumns.rightColumns.forEach(t=>{this.reinitializeColumn(t)}))}frozenColumnOffset(e){var t=!1;return e.modules.frozen&&(t=e.modules.frozen.marginValue,e.modules.frozen.position==="left"?t+=e.getWidth()-3:t&&(t-=3)),t!==!1?t+"px":!1}reinitializeColumn(e){var t=this.frozenColumnOffset(e);e.cells.forEach(i=>{i.modules.resize&&i.modules.resize.handleEl&&(t&&(i.modules.resize.handleEl.style[e.modules.frozen.position]=t,i.modules.resize.handleEl.style["z-index"]=11),i.element.after(i.modules.resize.handleEl))}),e.modules.resize&&e.modules.resize.handleEl&&(t&&(e.modules.resize.handleEl.style[e.modules.frozen.position]=t),e.element.after(e.modules.resize.handleEl))}initializeColumn(e,t,i,s){var r=this,o=!1,a=i.definition.resizable,l={},h=i.getLastColumn();if(e==="header"&&(o=i.definition.formatter=="textarea"||i.definition.variableHeight,l={variableHeight:o}),(a===!0||a==e)&&this._checkResizability(h)){var d=document.createElement("span");d.className="tabulator-col-resize-handle",d.addEventListener("click",function(u){u.stopPropagation()});var c=function(u){r.startColumn=i,r.initialNextColumn=r.nextColumn=h.nextColumn(),r._mouseDown(u,h,d)};d.addEventListener("mousedown",c),d.addEventListener("touchstart",c,{passive:!0}),d.addEventListener("dblclick",u=>{var f=h.getWidth();u.stopPropagation(),h.reinitializeWidth(!0),f!==h.getWidth()&&(r.dispatch("column-resized",h),r.dispatchExternal("columnResized",h.getComponent()))}),i.modules.frozen&&(d.style.position="sticky",d.style[i.modules.frozen.position]=this.frozenColumnOffset(i)),l.handleEl=d,s.parentNode&&i.visible&&s.after(d)}t.modules.resize=l}deInitializeColumn(e){this.deInitializeComponent(e),e.cells.forEach(t=>{this.deInitializeComponent(t)})}deInitializeComponent(e){var t;e.modules.resize&&(t=e.modules.resize.handleEl,t&&t.parentElement&&t.parentElement.removeChild(t))}resizeHandle(e,t){e.modules.resize&&e.modules.resize.handleEl&&(e.modules.resize.handleEl.style.height=t)}resize(e,t){var i=typeof e.clientX>"u"?e.touches[0].clientX:e.clientX,s=i-this.startX,r=i-this.latestX,o,a;if(this.latestX=i,this.table.rtl&&(s=-s,r=-r),o=t.width==t.minWidth||t.width==t.maxWidth,t.setWidth(this.startWidth+s),a=t.width==t.minWidth||t.width==t.maxWidth,r<0&&(this.nextColumn=this.initialNextColumn),this.table.options.resizableColumnFit&&this.nextColumn&&!(o&&a)){let l=this.nextColumn.getWidth();r>0&&l<=this.nextColumn.minWidth&&(this.nextColumn=this.nextColumn.nextColumn()),this.nextColumn&&this.nextColumn.setWidth(this.nextColumn.getWidth()-r)}this.table.columnManager.rerenderColumns(!0),!this.table.browserSlow&&t.modules.resize&&t.modules.resize.variableHeight&&t.checkCellHeights()}calcGuidePosition(e,t,i){var s=typeof e.clientX>"u"?e.touches[0].clientX:e.clientX,r=i.getBoundingClientRect().x-this.table.element.getBoundingClientRect().x,o=this.table.element.getBoundingClientRect().x,a=t.element.getBoundingClientRect().left-o,l=s-this.startX,h=Math.max(r+l,a+t.minWidth);return t.maxWidth&&(h=Math.min(h,a+t.maxWidth)),h}_checkResizability(e){return e.definition.resizable}_mouseDown(e,t,i){var s=this,r;this.dispatchExternal("columnResizing",t.getComponent()),s.table.options.resizableColumnGuide&&(r=document.createElement("span"),r.classList.add("tabulator-col-resize-guide"),s.table.element.appendChild(r),setTimeout(()=>{r.style.left=s.calcGuidePosition(e,t,i)+"px"})),s.table.element.classList.add("tabulator-block-select");function o(l){s.table.options.resizableColumnGuide?r.style.left=s.calcGuidePosition(l,t,i)+"px":s.resize(l,t)}function a(l){s.table.options.resizableColumnGuide&&(s.resize(l,t),r.remove()),s.startColumn.modules.edit&&(s.startColumn.modules.edit.blocked=!1),s.table.browserSlow&&t.modules.resize&&t.modules.resize.variableHeight&&t.checkCellHeights(),document.body.removeEventListener("mouseup",a),document.body.removeEventListener("mousemove",o),i.removeEventListener("touchmove",o),i.removeEventListener("touchend",a),s.table.element.classList.remove("tabulator-block-select"),s.startWidth!==t.getWidth()&&(s.table.columnManager.verticalAlignHeaders(),s.dispatch("column-resized",t),s.dispatchExternal("columnResized",t.getComponent()))}e.stopPropagation(),s.startColumn.modules.edit&&(s.startColumn.modules.edit.blocked=!0),s.startX=typeof e.clientX>"u"?e.touches[0].clientX:e.clientX,s.latestX=s.startX,s.startWidth=t.getWidth(),document.body.addEventListener("mousemove",o),document.body.addEventListener("mouseup",a),i.addEventListener("touchmove",o,{passive:!0}),i.addEventListener("touchend",a)}}w(Mn,"moduleName","resizeColumns");class Sn extends D{constructor(e){super(e),this.startColumn=!1,this.startY=!1,this.startHeight=!1,this.handle=null,this.prevHandle=null,this.registerTableOption("resizableRows",!1),this.registerTableOption("resizableRowGuide",!1)}initialize(){this.table.options.resizableRows&&this.subscribe("row-layout-after",this.initializeRow.bind(this))}initializeRow(e){var t=this,i=e.getElement(),s=document.createElement("div");s.className="tabulator-row-resize-handle";var r=document.createElement("div");r.className="tabulator-row-resize-handle prev",s.addEventListener("click",function(l){l.stopPropagation()});var o=function(l){t.startRow=e,t._mouseDown(l,e,s)};s.addEventListener("mousedown",o),s.addEventListener("touchstart",o,{passive:!0}),r.addEventListener("click",function(l){l.stopPropagation()});var a=function(l){var h=t.table.rowManager.prevDisplayRow(e);h&&(t.startRow=h,t._mouseDown(l,h,r))};r.addEventListener("mousedown",a),r.addEventListener("touchstart",a,{passive:!0}),i.appendChild(s),i.appendChild(r)}resize(e,t){t.setHeight(this.startHeight+((typeof e.screenY>"u"?e.touches[0].screenY:e.screenY)-this.startY))}calcGuidePosition(e,t,i){var s=typeof e.screenY>"u"?e.touches[0].screenY:e.screenY,r=i.getBoundingClientRect().y-this.table.element.getBoundingClientRect().y,o=this.table.element.getBoundingClientRect().y,a=t.element.getBoundingClientRect().top-o,l=s-this.startY;return Math.max(r+l,a)}_mouseDown(e,t,i){var s=this,r;s.dispatchExternal("rowResizing",t.getComponent()),s.table.options.resizableRowGuide&&(r=document.createElement("span"),r.classList.add("tabulator-row-resize-guide"),s.table.element.appendChild(r),setTimeout(()=>{r.style.top=s.calcGuidePosition(e,t,i)+"px"})),s.table.element.classList.add("tabulator-block-select");function o(l){s.table.options.resizableRowGuide?r.style.top=s.calcGuidePosition(l,t,i)+"px":s.resize(l,t)}function a(l){s.table.options.resizableRowGuide&&(s.resize(l,t),r.remove()),document.body.removeEventListener("mouseup",o),document.body.removeEventListener("mousemove",o),i.removeEventListener("touchmove",o),i.removeEventListener("touchend",a),s.table.element.classList.remove("tabulator-block-select"),s.dispatchExternal("rowResized",t.getComponent())}e.stopPropagation(),s.startY=typeof e.screenY>"u"?e.touches[0].screenY:e.screenY,s.startHeight=t.getHeight(),document.body.addEventListener("mousemove",o),document.body.addEventListener("mouseup",a),i.addEventListener("touchmove",o,{passive:!0}),i.addEventListener("touchend",a)}}w(Sn,"moduleName","resizeRows");class Ln extends D{constructor(e){super(e),this.binding=!1,this.visibilityObserver=!1,this.resizeObserver=!1,this.containerObserver=!1,this.tableHeight=0,this.tableWidth=0,this.containerHeight=0,this.containerWidth=0,this.autoResize=!1,this.visible=!1,this.initialized=!1,this.initialRedraw=!1,this.registerTableOption("autoResize",!0)}initialize(){if(this.table.options.autoResize){var e=this.table,t;this.tableHeight=e.element.clientHeight,this.tableWidth=e.element.clientWidth,e.element.parentNode&&(this.containerHeight=e.element.parentNode.clientHeight,this.containerWidth=e.element.parentNode.clientWidth),typeof IntersectionObserver<"u"&&typeof ResizeObserver<"u"&&e.rowManager.getRenderMode()==="virtual"?(this.initializeVisibilityObserver(),this.autoResize=!0,this.resizeObserver=new ResizeObserver(i=>{if(!e.browserMobile||e.browserMobile&&(!e.modules.edit||e.modules.edit&&!e.modules.edit.currentCell)){var s=Math.floor(i[0].contentRect.height),r=Math.floor(i[0].contentRect.width);(this.tableHeight!=s||this.tableWidth!=r)&&(this.tableHeight=s,this.tableWidth=r,e.element.parentNode&&(this.containerHeight=e.element.parentNode.clientHeight,this.containerWidth=e.element.parentNode.clientWidth),this.redrawTable())}}),this.resizeObserver.observe(e.element),t=window.getComputedStyle(e.element),this.table.element.parentNode&&!this.table.rowManager.fixedHeight&&(t.getPropertyValue("max-height")||t.getPropertyValue("min-height"))&&(this.containerObserver=new ResizeObserver(i=>{if(!e.browserMobile||e.browserMobile&&(!e.modules.edit||e.modules.edit&&!e.modules.edit.currentCell)){var s=Math.floor(i[0].contentRect.height),r=Math.floor(i[0].contentRect.width);(this.containerHeight!=s||this.containerWidth!=r)&&(this.containerHeight=s,this.containerWidth=r,this.tableHeight=e.element.clientHeight,this.tableWidth=e.element.clientWidth),this.redrawTable()}}),this.containerObserver.observe(this.table.element.parentNode)),this.subscribe("table-resize",this.tableResized.bind(this))):(this.binding=function(){(!e.browserMobile||e.browserMobile&&(!e.modules.edit||e.modules.edit&&!e.modules.edit.currentCell))&&(e.columnManager.rerenderColumns(!0),e.redraw())},window.addEventListener("resize",this.binding)),this.subscribe("table-destroy",this.clearBindings.bind(this))}}initializeVisibilityObserver(){this.visibilityObserver=new IntersectionObserver(e=>{this.visible=e[0].isIntersecting,this.initialized?this.visible&&(this.redrawTable(this.initialRedraw),this.initialRedraw=!1):(this.initialized=!0,this.initialRedraw=!this.visible)}),this.visibilityObserver.observe(this.table.element)}redrawTable(e){this.initialized&&this.visible&&(this.table.columnManager.rerenderColumns(!0),this.table.redraw(e))}tableResized(){this.table.rowManager.redraw()}clearBindings(){this.binding&&window.removeEventListener("resize",this.binding),this.resizeObserver&&this.resizeObserver.unobserve(this.table.element),this.visibilityObserver&&this.visibilityObserver.unobserve(this.table.element),this.containerObserver&&this.containerObserver.unobserve(this.table.element.parentNode)}}w(Ln,"moduleName","resizeTable");function ma(n,e,t){var i=document.createElement("div"),s=n.getRow()._row.modules.responsiveLayout;i.classList.add("tabulator-responsive-collapse-toggle"),i.innerHTML=`<svg class='tabulator-responsive-collapse-toggle-open' viewbox="0 0 24 24">
  <line x1="7" y1="12" x2="17" y2="12" fill="none" stroke-width="3" stroke-linecap="round" />
  <line y1="7" x1="12" y2="17" x2="12" fill="none" stroke-width="3" stroke-linecap="round" />
</svg>

<svg class='tabulator-responsive-collapse-toggle-close' viewbox="0 0 24 24">
  <line x1="7" y1="12" x2="17" y2="12"  fill="none" stroke-width="3" stroke-linecap="round" />
</svg>`,n.getElement().classList.add("tabulator-row-handle");function r(o){var a=s.element;s.open=o,a&&(s.open?(i.classList.add("open"),a.style.display=""):(i.classList.remove("open"),a.style.display="none"))}return i.addEventListener("click",function(o){o.stopImmediatePropagation(),r(!s.open),n.getTable().rowManager.adjustTableSize()}),r(s.open),i}var ba={format:{formatters:{responsiveCollapse:ma}}};class Oi extends D{constructor(e){super(e),this.columns=[],this.hiddenColumns=[],this.mode="",this.index=0,this.collapseFormatter=[],this.collapseStartOpen=!0,this.collapseHandleColumn=!1,this.registerTableOption("responsiveLayout",!1),this.registerTableOption("responsiveLayoutCollapseStartOpen",!0),this.registerTableOption("responsiveLayoutCollapseUseFormatters",!0),this.registerTableOption("responsiveLayoutCollapseFormatter",!1),this.registerColumnOption("responsive")}initialize(){this.table.options.responsiveLayout&&(this.subscribe("column-layout",this.initializeColumn.bind(this)),this.subscribe("column-show",this.updateColumnVisibility.bind(this)),this.subscribe("column-hide",this.updateColumnVisibility.bind(this)),this.subscribe("columns-loaded",this.initializeResponsivity.bind(this)),this.subscribe("column-moved",this.initializeResponsivity.bind(this)),this.subscribe("column-add",this.initializeResponsivity.bind(this)),this.subscribe("column-delete",this.initializeResponsivity.bind(this)),this.subscribe("table-redrawing",this.tableRedraw.bind(this)),this.table.options.responsiveLayout==="collapse"&&(this.subscribe("row-data-changed",this.generateCollapsedRowContent.bind(this)),this.subscribe("row-init",this.initializeRow.bind(this)),this.subscribe("row-layout",this.layoutRow.bind(this))))}tableRedraw(e){["fitColumns","fitDataStretch"].indexOf(this.layoutMode())===-1&&(e||this.update())}initializeResponsivity(){var e=[];this.mode=this.table.options.responsiveLayout,this.collapseFormatter=this.table.options.responsiveLayoutCollapseFormatter||this.formatCollapsedData,this.collapseStartOpen=this.table.options.responsiveLayoutCollapseStartOpen,this.hiddenColumns=[],this.collapseFormatter&&(this.collapseFormatter=this.collapseFormatter.bind(this.table)),this.table.columnManager.columnsByIndex.forEach((t,i)=>{t.modules.responsive&&t.modules.responsive.order&&t.modules.responsive.visible&&(t.modules.responsive.index=i,e.push(t),!t.visible&&this.mode==="collapse"&&this.hiddenColumns.push(t))}),e=e.reverse(),e=e.sort((t,i)=>{var s=i.modules.responsive.order-t.modules.responsive.order;return s||i.modules.responsive.index-t.modules.responsive.index}),this.columns=e,this.mode==="collapse"&&this.generateCollapsedContent();for(let t of this.table.columnManager.columnsByIndex)if(t.definition.formatter=="responsiveCollapse"){this.collapseHandleColumn=t;break}this.collapseHandleColumn&&(this.hiddenColumns.length?this.collapseHandleColumn.show():this.collapseHandleColumn.hide())}initializeColumn(e){var t=e.getDefinition();e.modules.responsive={order:typeof t.responsive>"u"?1:t.responsive,visible:t.visible!==!1}}initializeRow(e){var t;e.type!=="calc"&&(t=document.createElement("div"),t.classList.add("tabulator-responsive-collapse"),e.modules.responsiveLayout={element:t,open:this.collapseStartOpen},this.collapseStartOpen||(t.style.display="none"))}layoutRow(e){var t=e.getElement();e.modules.responsiveLayout&&(t.appendChild(e.modules.responsiveLayout.element),this.generateCollapsedRowContent(e))}updateColumnVisibility(e,t){!t&&e.modules.responsive&&(e.modules.responsive.visible=e.visible,this.initializeResponsivity())}hideColumn(e){var t=this.hiddenColumns.length;e.hide(!1,!0),this.mode==="collapse"&&(this.hiddenColumns.unshift(e),this.generateCollapsedContent(),this.collapseHandleColumn&&!t&&this.collapseHandleColumn.show())}showColumn(e){var t;e.show(!1,!0),e.setWidth(e.getWidth()),this.mode==="collapse"&&(t=this.hiddenColumns.indexOf(e),t>-1&&this.hiddenColumns.splice(t,1),this.generateCollapsedContent(),this.collapseHandleColumn&&!this.hiddenColumns.length&&this.collapseHandleColumn.hide())}update(){for(var e=!0;e;){let t=this.table.modules.layout.getMode()=="fitColumns"?this.table.columnManager.getFlexBaseWidth():this.table.columnManager.getWidth(),i=(this.table.options.headerVisible?this.table.columnManager.element.clientWidth:this.table.element.clientWidth)-t;if(i<0){let s=this.columns[this.index];s?(this.hideColumn(s),this.index++):e=!1}else{let s=this.columns[this.index-1];s&&i>0&&i>=s.getWidth()?(this.showColumn(s),this.index--):e=!1}this.table.rowManager.activeRowsCount||this.table.rowManager.renderEmptyScroll()}}generateCollapsedContent(){var e=this.table.rowManager.getDisplayRows();e.forEach(t=>{this.generateCollapsedRowContent(t)})}generateCollapsedRowContent(e){var t,i;if(e.modules.responsiveLayout){for(t=e.modules.responsiveLayout.element;t.firstChild;)t.removeChild(t.firstChild);i=this.collapseFormatter(this.generateCollapsedRowData(e)),i&&t.appendChild(i),e.calcHeight(!0)}}generateCollapsedRowData(e){var t=e.getData(),i=[],s;return this.hiddenColumns.forEach(r=>{var o=r.getFieldValue(t);if(r.definition.title&&r.field)if(r.modules.format&&this.table.options.responsiveLayoutCollapseUseFormatters){let a=function(l){l()};s={value:!1,data:{},getValue:function(){return o},getData:function(){return t},getType:function(){return"cell"},getElement:function(){return document.createElement("div")},getRow:function(){return e.getComponent()},getColumn:function(){return r.getComponent()},getTable:()=>this.table},i.push({field:r.field,title:r.definition.title,value:r.modules.format.formatter.call(this.table.modules.format,s,r.modules.format.params,a)})}else i.push({field:r.field,title:r.definition.title,value:o})}),i}formatCollapsedData(e){var t=document.createElement("table");return e.forEach(i=>{var s=document.createElement("tr"),r=document.createElement("td"),o=document.createElement("td"),a,l=document.createElement("strong");r.appendChild(l),this.modules.localize.bind("columns|"+i.field,function(h){l.innerHTML=h||i.title}),i.value instanceof Node?(a=document.createElement("div"),a.appendChild(i.value),o.appendChild(a)):o.innerHTML=i.value,s.appendChild(r),s.appendChild(o),t.appendChild(s)}),Object.keys(e).length?t:""}}w(Oi,"moduleName","responsiveLayout"),w(Oi,"moduleExtensions",ba);function va(n,e,t){var i=document.createElement("input"),s=!1;if(i.type="checkbox",i.setAttribute("aria-label","Select Row"),this.table.modExists("selectRow",!0))if(i.addEventListener("click",o=>{o.stopPropagation()}),typeof n.getRow=="function"){var r=n.getRow();r instanceof Zt?(i.addEventListener("change",o=>{this.table.options.selectableRowsRangeMode==="click"&&s?s=!1:r.toggleSelect()}),this.table.options.selectableRowsRangeMode==="click"&&i.addEventListener("click",o=>{s=!0,this.table.modules.selectRow.handleComplexRowClick(r._row,o)}),i.checked=r.isSelected&&r.isSelected(),this.table.modules.selectRow.registerRowSelectCheckbox(r,i)):i=""}else i.addEventListener("change",o=>{this.table.modules.selectRow.selectedRows.length?this.table.deselectRow():this.table.selectRow(e.rowRange)}),this.table.modules.selectRow.registerHeaderSelectCheckbox(i);return i}var wa={format:{formatters:{rowSelection:va}}};class Pi extends D{constructor(e){super(e),this.selecting=!1,this.lastClickedRow=!1,this.selectPrev=[],this.selectedRows=[],this.headerCheckboxElement=null,this.registerTableOption("selectableRows","highlight"),this.registerTableOption("selectableRowsRangeMode","drag"),this.registerTableOption("selectableRowsRollingSelection",!0),this.registerTableOption("selectableRowsPersistence",!0),this.registerTableOption("selectableRowsCheck",function(t,i){return!0}),this.registerTableFunction("selectRow",this.selectRows.bind(this)),this.registerTableFunction("deselectRow",this.deselectRows.bind(this)),this.registerTableFunction("toggleSelectRow",this.toggleRow.bind(this)),this.registerTableFunction("getSelectedRows",this.getSelectedRows.bind(this)),this.registerTableFunction("getSelectedData",this.getSelectedData.bind(this)),this.registerComponentFunction("row","select",this.selectRows.bind(this)),this.registerComponentFunction("row","deselect",this.deselectRows.bind(this)),this.registerComponentFunction("row","toggleSelect",this.toggleRow.bind(this)),this.registerComponentFunction("row","isSelected",this.isRowSelected.bind(this))}initialize(){this.deprecatedOptionsCheck(),this.table.options.selectableRows==="highlight"&&this.table.options.selectableRange&&(this.table.options.selectableRows=!1),this.table.options.selectableRows!==!1&&(this.subscribe("row-init",this.initializeRow.bind(this)),this.subscribe("row-deleting",this.rowDeleted.bind(this)),this.subscribe("rows-wipe",this.clearSelectionData.bind(this)),this.subscribe("rows-retrieve",this.rowRetrieve.bind(this)),this.table.options.selectableRows&&!this.table.options.selectableRowsPersistence&&this.subscribe("data-refreshing",this.deselectRows.bind(this)))}deprecatedOptionsCheck(){}rowRetrieve(e,t){return e==="selected"?this.selectedRows:t}rowDeleted(e){this._deselectRow(e,!0)}clearSelectionData(e){var t=this.selectedRows.length;this.selecting=!1,this.lastClickedRow=!1,this.selectPrev=[],this.selectedRows=[],t&&e!==!0&&this._rowSelectionChanged()}initializeRow(e){var t=this,i=t.checkRowSelectability(e),s=e.getElement(),r=function(){setTimeout(function(){t.selecting=!1},50),document.body.removeEventListener("mouseup",r)};e.modules.select={selected:!1},s.classList.toggle("tabulator-selectable",i),s.classList.toggle("tabulator-unselectable",!i),t.checkRowSelectability(e)&&t.table.options.selectableRows&&t.table.options.selectableRows!="highlight"&&(t.table.options.selectableRowsRangeMode==="click"?s.addEventListener("click",this.handleComplexRowClick.bind(this,e)):(s.addEventListener("click",function(o){(!t.table.modExists("edit")||!t.table.modules.edit.getCurrentCell())&&t.table._clearSelection(),t.selecting||t.toggleRow(e)}),s.addEventListener("mousedown",function(o){if(o.shiftKey)return t.table._clearSelection(),t.selecting=!0,t.selectPrev=[],document.body.addEventListener("mouseup",r),document.body.addEventListener("keyup",r),t.toggleRow(e),!1}),s.addEventListener("mouseenter",function(o){t.selecting&&(t.table._clearSelection(),t.toggleRow(e),t.selectPrev[1]==e&&t.toggleRow(t.selectPrev[0]))}),s.addEventListener("mouseout",function(o){t.selecting&&(t.table._clearSelection(),t.selectPrev.unshift(e))})))}handleComplexRowClick(e,t){if(t.shiftKey){this.table._clearSelection(),this.lastClickedRow=this.lastClickedRow||e;var i=this.table.rowManager.getDisplayRowIndex(this.lastClickedRow),s=this.table.rowManager.getDisplayRowIndex(e),r=i<=s?i:s,o=i>=s?i:s,a=this.table.rowManager.getDisplayRows().slice(0),l=a.splice(r,o-r+1);t.ctrlKey||t.metaKey?(l.forEach(h=>{h!==this.lastClickedRow&&(this.table.options.selectableRows!==!0&&!this.isRowSelected(e)?this.selectedRows.length<this.table.options.selectableRows&&this.toggleRow(h):this.toggleRow(h))}),this.lastClickedRow=e):(this.deselectRows(void 0,!0),this.table.options.selectableRows!==!0&&l.length>this.table.options.selectableRows&&(l=l.slice(0,this.table.options.selectableRows)),this.selectRows(l)),this.table._clearSelection()}else t.ctrlKey||t.metaKey?(this.toggleRow(e),this.lastClickedRow=e):(this.deselectRows(void 0,!0),this.selectRows(e),this.lastClickedRow=e)}checkRowSelectability(e){return e&&e.type==="row"?this.table.options.selectableRowsCheck.call(this.table,e.getComponent()):!1}toggleRow(e){this.checkRowSelectability(e)&&(e.modules.select&&e.modules.select.selected?this._deselectRow(e):this._selectRow(e))}selectRows(e){var t=[],i,s;switch(typeof e){case"undefined":i=this.table.rowManager.rows;break;case"number":i=this.table.rowManager.findRow(e);break;case"string":i=this.table.rowManager.findRow(e),i||(i=this.table.rowManager.getRows(e));break;default:i=e;break}Array.isArray(i)?i.length&&(i.forEach(r=>{s=this._selectRow(r,!0,!0),s&&t.push(s)}),this._rowSelectionChanged(!1,t)):i&&this._selectRow(i,!1,!0)}_selectRow(e,t,i){if(!isNaN(this.table.options.selectableRows)&&this.table.options.selectableRows!==!0&&!i&&this.selectedRows.length>=this.table.options.selectableRows)if(this.table.options.selectableRowsRollingSelection)this._deselectRow(this.selectedRows[0]);else return!1;var s=this.table.rowManager.findRow(e);if(s){if(this.selectedRows.indexOf(s)==-1)return s.getElement().classList.add("tabulator-selected"),s.modules.select||(s.modules.select={}),s.modules.select.selected=!0,s.modules.select.checkboxEl&&(s.modules.select.checkboxEl.checked=!0),this.selectedRows.push(s),this.table.options.dataTreeSelectPropagate&&this.childRowSelection(s,!0),this.dispatchExternal("rowSelected",s.getComponent()),this._rowSelectionChanged(t,s),s}else t||console.warn("Selection Error - No such row found, ignoring selection:"+e)}isRowSelected(e){return this.selectedRows.indexOf(e)!==-1}deselectRows(e,t){var i=[],s,r;switch(typeof e){case"undefined":s=Object.assign([],this.selectedRows);break;case"number":s=this.table.rowManager.findRow(e);break;case"string":s=this.table.rowManager.findRow(e),s||(s=this.table.rowManager.getRows(e));break;default:s=e;break}Array.isArray(s)?s.length&&(s.forEach(o=>{r=this._deselectRow(o,!0,!0),r&&i.push(r)}),this._rowSelectionChanged(t,[],i)):s&&this._deselectRow(s,t,!0)}_deselectRow(e,t){var i=this,s=i.table.rowManager.findRow(e),r,o;if(s){if(r=i.selectedRows.findIndex(function(a){return a==s}),r>-1)return o=s.getElement(),o&&o.classList.remove("tabulator-selected"),s.modules.select||(s.modules.select={}),s.modules.select.selected=!1,s.modules.select.checkboxEl&&(s.modules.select.checkboxEl.checked=!1),i.selectedRows.splice(r,1),this.table.options.dataTreeSelectPropagate&&this.childRowSelection(s,!1),this.dispatchExternal("rowDeselected",s.getComponent()),i._rowSelectionChanged(t,void 0,s),s}else t||console.warn("Deselection Error - No such row found, ignoring selection:"+e)}getSelectedData(){var e=[];return this.selectedRows.forEach(function(t){e.push(t.getData())}),e}getSelectedRows(){var e=[];return this.selectedRows.forEach(function(t){e.push(t.getComponent())}),e}_rowSelectionChanged(e,t=[],i=[]){this.headerCheckboxElement&&(this.selectedRows.length===0?(this.headerCheckboxElement.checked=!1,this.headerCheckboxElement.indeterminate=!1):this.table.rowManager.rows.length===this.selectedRows.length?(this.headerCheckboxElement.checked=!0,this.headerCheckboxElement.indeterminate=!1):(this.headerCheckboxElement.indeterminate=!0,this.headerCheckboxElement.checked=!1)),e||(Array.isArray(t)||(t=[t]),t=t.map(s=>s.getComponent()),Array.isArray(i)||(i=[i]),i=i.map(s=>s.getComponent()),this.dispatchExternal("rowSelectionChanged",this.getSelectedData(),this.getSelectedRows(),t,i))}registerRowSelectCheckbox(e,t){e._row.modules.select||(e._row.modules.select={}),e._row.modules.select.checkboxEl=t}registerHeaderSelectCheckbox(e){this.headerCheckboxElement=e}childRowSelection(e,t){var i=this.table.modules.dataTree.getChildren(e,!0,!0);if(t)for(let s of i)this._selectRow(s,!0);else for(let s of i)this._deselectRow(s,!0)}}w(Pi,"moduleName","selectRow"),w(Pi,"moduleExtensions",wa);class Ca{constructor(e){return this._range=e,new Proxy(this,{get:function(t,i,s){return typeof t[i]<"u"?t[i]:t._range.table.componentFunctionBinder.handle("range",t._range,i)}})}getElement(){return this._range.element}getData(){return this._range.getData()}getCells(){return this._range.getCells(!0,!0)}getStructuredCells(){return this._range.getStructuredCells()}getRows(){return this._range.getRows().map(e=>e.getComponent())}getColumns(){return this._range.getColumns().map(e=>e.getComponent())}getBounds(){return this._range.getBounds()}getTopEdge(){return this._range.top}getBottomEdge(){return this._range.bottom}getLeftEdge(){return this._range.left}getRightEdge(){return this._range.right}setBounds(e,t){this._range.destroyedGuard("setBounds")&&this._range.setBounds(e&&e._cell,t&&t._cell)}setStartBound(e){this._range.destroyedGuard("setStartBound")&&(this._range.setEndBound(e&&e._cell),this._range.rangeManager.layoutElement())}setEndBound(e){this._range.destroyedGuard("setEndBound")&&(this._range.setEndBound(e&&e._cell),this._range.rangeManager.layoutElement())}clearValues(){this._range.destroyedGuard("clearValues")&&this._range.clearValues()}remove(){this._range.destroyedGuard("remove")&&this._range.destroy(!0)}}class ya extends j{constructor(e,t,i,s){super(e),this.rangeManager=t,this.element=null,this.initialized=!1,this.initializing={start:!1,end:!1},this.destroyed=!1,this.top=0,this.bottom=0,this.left=0,this.right=0,this.table=e,this.start={row:0,col:0},this.end={row:0,col:0},this.rangeManager.rowHeader&&(this.left=1,this.right=1,this.start.col=1,this.end.col=1),this.initElement(),setTimeout(()=>{this.initBounds(i,s)})}initElement(){this.element=document.createElement("div"),this.element.classList.add("tabulator-range")}initBounds(e,t){this._updateMinMax(),e&&this.setBounds(e,t||e)}setStart(e,t){(this.start.row!==e||this.start.col!==t)&&(this.start.row=e,this.start.col=t,this.initializing.start=!0,this._updateMinMax())}setEnd(e,t){(this.end.row!==e||this.end.col!==t)&&(this.end.row=e,this.end.col=t,this.initializing.end=!0,this._updateMinMax())}setBounds(e,t,i){e&&this.setStartBound(e),this.setEndBound(t||e),this.rangeManager.layoutElement(i)}setStartBound(e){var t,i;e.type==="column"?this.rangeManager.columnSelection&&this.setStart(0,e.getPosition()-1):(t=e.row.position-1,i=e.column.getPosition()-1,e.column===this.rangeManager.rowHeader?this.setStart(t,1):this.setStart(t,i))}setEndBound(e){var t=this._getTableRows().length,i,s,r;e.type==="column"?this.rangeManager.columnSelection&&(this.rangeManager.selecting==="column"?this.setEnd(t-1,e.getPosition()-1):this.rangeManager.selecting==="cell"&&this.setEnd(0,e.getPosition()-1)):(i=e.row.position-1,s=e.column.getPosition()-1,r=e.column===this.rangeManager.rowHeader,this.rangeManager.selecting==="row"?this.setEnd(i,this._getTableColumns().length-1):this.rangeManager.selecting!=="row"&&r?this.setEnd(i,0):this.rangeManager.selecting==="column"?this.setEnd(t-1,s):this.setEnd(i,s))}_updateMinMax(){this.top=Math.min(this.start.row,this.end.row),this.bottom=Math.max(this.start.row,this.end.row),this.left=Math.min(this.start.col,this.end.col),this.right=Math.max(this.start.col,this.end.col),this.initialized?this.dispatchExternal("rangeChanged",this.getComponent()):this.initializing.start&&this.initializing.end&&(this.initialized=!0,this.dispatchExternal("rangeAdded",this.getComponent()))}_getTableColumns(){return this.table.columnManager.getVisibleColumnsByIndex()}_getTableRows(){return this.table.rowManager.getDisplayRows().filter(e=>e.type==="row")}layout(){var e=this.table.rowManager.renderer.vDomTop,t=this.table.rowManager.renderer.vDomBottom,i=this.table.columnManager.renderer.leftCol,s=this.table.columnManager.renderer.rightCol,r,o,a,l,h,d,c,u,f,p;this.table.options.renderHorizontal==="virtual"&&this.rangeManager.rowHeader&&(s+=1),e==null&&(e=0),t==null&&(t=1/0),i==null&&(i=0),s==null&&(s=1/0),this.overlaps(i,e,s,t)&&(r=Math.max(this.top,e),o=Math.min(this.bottom,t),a=Math.max(this.left,i),l=Math.min(this.right,s),h=this.rangeManager.getCell(r,a),d=this.rangeManager.getCell(o,l),c=h.getElement(),u=d.getElement(),f=h.row.getElement(),p=d.row.getElement(),this.element.classList.add("tabulator-range-active"),this.table.rtl?(this.element.style.right=f.offsetWidth-c.offsetLeft-c.offsetWidth+"px",this.element.style.width=c.offsetLeft+c.offsetWidth-u.offsetLeft+"px"):(this.element.style.left=f.offsetLeft+c.offsetLeft+"px",this.element.style.width=u.offsetLeft+u.offsetWidth-c.offsetLeft+"px"),this.element.style.top=f.offsetTop+"px",this.element.style.height=p.offsetTop+p.offsetHeight-f.offsetTop+"px")}atTopLeft(e){return e.row.position-1===this.top&&e.column.getPosition()-1===this.left}atBottomRight(e){return e.row.position-1===this.bottom&&e.column.getPosition()-1===this.right}occupies(e){return this.occupiesRow(e.row)&&this.occupiesColumn(e.column)}occupiesRow(e){return this.top<=e.position-1&&e.position-1<=this.bottom}occupiesColumn(e){return this.left<=e.getPosition()-1&&e.getPosition()-1<=this.right}overlaps(e,t,i,s){return!(this.left>i||e>this.right||this.top>s||t>this.bottom)}getData(){var e=[],t=this.getRows(),i=this.getColumns();return t.forEach(s=>{var r=s.getData(),o={};i.forEach(a=>{o[a.field]=r[a.field]}),e.push(o)}),e}getCells(e,t){var i=[],s=this.getRows(),r=this.getColumns();return e?i=s.map(o=>{var a=[];return o.getCells().forEach(l=>{r.includes(l.column)&&a.push(t?l.getComponent():l)}),a}):s.forEach(o=>{o.getCells().forEach(a=>{r.includes(a.column)&&i.push(t?a.getComponent():a)})}),i}getStructuredCells(){return this.getCells(!0,!0)}getRows(){return this._getTableRows().slice(this.top,this.bottom+1)}getColumns(){return this._getTableColumns().slice(this.left,this.right+1)}clearValues(){var e=this.getCells(),t=this.table.options.selectableRangeClearCellsValue;this.table.blockRedraw(),e.forEach(i=>{i.setValue(t)}),this.table.restoreRedraw()}getBounds(e){var t=this.getCells(!1,e),i={start:null,end:null};return t.length?(i.start=t[0],i.end=t[t.length-1]):console.warn("No bounds defined on range"),i}getComponent(){return this.component||(this.component=new Ca(this)),this.component}destroy(e){this.destroyed=!0,this.element.remove(),e&&this.rangeManager.rangeRemoved(this),this.initialized&&this.dispatchExternal("rangeRemoved",this.getComponent())}destroyedGuard(e){return this.destroyed&&console.warn("You cannot call the "+e+" function on a destroyed range"),!this.destroyed}}var Ea={rangeJumpUp:["ctrl + 38","meta + 38"],rangeJumpDown:["ctrl + 40","meta + 40"],rangeJumpLeft:["ctrl + 37","meta + 37"],rangeJumpRight:["ctrl + 39","meta + 39"],rangeExpandUp:"shift + 38",rangeExpandDown:"shift + 40",rangeExpandLeft:"shift + 37",rangeExpandRight:"shift + 39",rangeExpandJumpUp:["ctrl + shift + 38","meta + shift + 38"],rangeExpandJumpDown:["ctrl + shift + 40","meta + shift + 40"],rangeExpandJumpLeft:["ctrl + shift + 37","meta + shift + 37"],rangeExpandJumpRight:["ctrl + shift + 39","meta + shift + 39"]},Ra={rangeJumpLeft:function(n){this.dispatch("keybinding-nav-range",n,"left",!0,!1)},rangeJumpRight:function(n){this.dispatch("keybinding-nav-range",n,"right",!0,!1)},rangeJumpUp:function(n){this.dispatch("keybinding-nav-range",n,"up",!0,!1)},rangeJumpDown:function(n){this.dispatch("keybinding-nav-range",n,"down",!0,!1)},rangeExpandLeft:function(n){this.dispatch("keybinding-nav-range",n,"left",!1,!0)},rangeExpandRight:function(n){this.dispatch("keybinding-nav-range",n,"right",!1,!0)},rangeExpandUp:function(n){this.dispatch("keybinding-nav-range",n,"up",!1,!0)},rangeExpandDown:function(n){this.dispatch("keybinding-nav-range",n,"down",!1,!0)},rangeExpandJumpLeft:function(n){this.dispatch("keybinding-nav-range",n,"left",!0,!0)},rangeExpandJumpRight:function(n){this.dispatch("keybinding-nav-range",n,"right",!0,!0)},rangeExpandJumpUp:function(n){this.dispatch("keybinding-nav-range",n,"up",!0,!0)},rangeExpandJumpDown:function(n){this.dispatch("keybinding-nav-range",n,"down",!0,!0)}},xa={range:function(n){var e=[],t=this.table.modules.selectRange.activeRange,i=!1,s,r,o,a,l;return l=n.length,t&&(s=t.getBounds(),r=s.start,s.start===s.end&&(i=!0),r&&(e=this.table.rowManager.activeRows.slice(),o=e.indexOf(r.row),i?a=n.length:a=e.indexOf(s.end.row)-o+1,o>-1&&(this.table.blockRedraw(),e=e.slice(o,o+a),e.forEach((h,d)=>{h.updateData(n[d%l])}),this.table.restoreRedraw()))),e}},_a={range:function(n){var e=[],t=[],i=this.table.modules.selectRange.activeRange,s=!1,r,o,a,l,h;return i&&(r=i.getBounds(),o=r.start,r.start===r.end&&(s=!0),o&&(n=n.split(`
`),n.forEach(function(d){e.push(d.split("	"))}),e.length&&(l=this.table.columnManager.getVisibleColumnsByIndex(),h=l.indexOf(o.column),h>-1)))?(s?a=e[0].length:a=l.indexOf(r.end.column)-h+1,l=l.slice(h,h+a),e.forEach(d=>{var c={},u=d.length;l.forEach(function(f,p){c[f.field]=d[p%u]}),t.push(c)}),t):!1}},ka={range:function(){var n=this.modules.selectRange.selectedColumns();return this.columnManager.rowHeader&&n.unshift(this.columnManager.rowHeader),n}},Ta={range:function(){return this.modules.selectRange.selectedRows()}},Ma={keybindings:{bindings:Ea,actions:Ra},clipboard:{pasteActions:xa,pasteParsers:_a},export:{columnLookups:ka,rowLookups:Ta}};class Wt extends D{constructor(e){super(e),this.selecting="cell",this.mousedown=!1,this.ranges=[],this.overlay=null,this.rowHeader=null,this.layoutChangeTimeout=null,this.columnSelection=!1,this.rowSelection=!1,this.maxRanges=0,this.activeRange=!1,this.blockKeydown=!1,this.keyDownEvent=this._handleKeyDown.bind(this),this.mouseUpEvent=this._handleMouseUp.bind(this),this.registerTableOption("selectableRange",!1),this.registerTableOption("selectableRangeColumns",!1),this.registerTableOption("selectableRangeRows",!1),this.registerTableOption("selectableRangeClearCells",!1),this.registerTableOption("selectableRangeClearCellsValue",void 0),this.registerTableOption("selectableRangeAutoFocus",!0),this.registerTableFunction("getRangesData",this.getRangesData.bind(this)),this.registerTableFunction("getRanges",this.getRanges.bind(this)),this.registerTableFunction("addRange",this.addRangeFromComponent.bind(this)),this.registerComponentFunction("cell","getRanges",this.cellGetRanges.bind(this)),this.registerComponentFunction("row","getRanges",this.rowGetRanges.bind(this)),this.registerComponentFunction("column","getRanges",this.colGetRanges.bind(this))}initialize(){this.options("selectableRange")&&(this.options("selectableRows")?console.warn("SelectRange functionality cannot be used in conjunction with row selection"):(this.maxRanges=this.options("selectableRange"),this.initializeTable(),this.initializeWatchers()),this.options("columns").findIndex(e=>e.frozen)>0&&console.warn("Having frozen column in arbitrary position with selectRange option may result in unpredictable behavior."),this.options("columns").filter(e=>e.frozen)>1&&console.warn("Having multiple frozen columns with selectRange option may result in unpredictable behavior."))}initializeTable(){this.overlay=document.createElement("div"),this.overlay.classList.add("tabulator-range-overlay"),this.rangeContainer=document.createElement("div"),this.rangeContainer.classList.add("tabulator-range-container"),this.activeRangeCellElement=document.createElement("div"),this.activeRangeCellElement.classList.add("tabulator-range-cell-active"),this.overlay.appendChild(this.rangeContainer),this.overlay.appendChild(this.activeRangeCellElement),this.table.rowManager.element.addEventListener("keydown",this.keyDownEvent),this.resetRanges(),this.table.rowManager.element.appendChild(this.overlay),this.table.columnManager.element.setAttribute("tabindex",0),this.table.element.classList.add("tabulator-ranges")}initializeWatchers(){this.columnSelection=this.options("selectableRangeColumns"),this.rowSelection=this.options("selectableRangeRows"),this.subscribe("column-init",this.initializeColumn.bind(this)),this.subscribe("column-mousedown",this.handleColumnMouseDown.bind(this)),this.subscribe("column-mousemove",this.handleColumnMouseMove.bind(this)),this.subscribe("column-resized",this.handleColumnResized.bind(this)),this.subscribe("column-moving",this.handleColumnMoving.bind(this)),this.subscribe("column-moved",this.handleColumnMoved.bind(this)),this.subscribe("column-width",this.layoutChange.bind(this)),this.subscribe("column-height",this.layoutChange.bind(this)),this.subscribe("column-resized",this.layoutChange.bind(this)),this.subscribe("columns-loaded",this.updateHeaderColumn.bind(this)),this.subscribe("cell-height",this.layoutChange.bind(this)),this.subscribe("cell-rendered",this.renderCell.bind(this)),this.subscribe("cell-mousedown",this.handleCellMouseDown.bind(this)),this.subscribe("cell-mousemove",this.handleCellMouseMove.bind(this)),this.subscribe("cell-click",this.handleCellClick.bind(this)),this.subscribe("cell-editing",this.handleEditingCell.bind(this)),this.subscribe("page-changed",this.redraw.bind(this)),this.subscribe("scroll-vertical",this.layoutChange.bind(this)),this.subscribe("scroll-horizontal",this.layoutChange.bind(this)),this.subscribe("data-destroy",this.tableDestroyed.bind(this)),this.subscribe("data-processed",this.resetRanges.bind(this)),this.subscribe("table-layout",this.layoutElement.bind(this)),this.subscribe("table-redraw",this.redraw.bind(this)),this.subscribe("table-destroy",this.tableDestroyed.bind(this)),this.subscribe("edit-editor-clear",this.finishEditingCell.bind(this)),this.subscribe("edit-blur",this.restoreFocus.bind(this)),this.subscribe("keybinding-nav-prev",this.keyNavigate.bind(this,"left")),this.subscribe("keybinding-nav-next",this.keyNavigate.bind(this,"right")),this.subscribe("keybinding-nav-left",this.keyNavigate.bind(this,"left")),this.subscribe("keybinding-nav-right",this.keyNavigate.bind(this,"right")),this.subscribe("keybinding-nav-up",this.keyNavigate.bind(this,"up")),this.subscribe("keybinding-nav-down",this.keyNavigate.bind(this,"down")),this.subscribe("keybinding-nav-range",this.keyNavigateRange.bind(this))}initializeColumn(e){this.columnSelection&&e.definition.headerSort&&this.options("headerSortClickElement")!=="icon"&&console.warn("Using column headerSort with selectableRangeColumns option may result in unpredictable behavior. Consider using headerSortClickElement: 'icon'."),e.modules.edit}updateHeaderColumn(){var e;this.rowSelection&&(this.rowHeader=this.table.columnManager.getVisibleColumnsByIndex()[0],this.rowHeader&&(this.rowHeader.definition.cssClass=this.rowHeader.definition.cssClass+" tabulator-range-row-header",this.rowHeader.definition.headerSort&&console.warn("Using column headerSort with selectableRangeRows option may result in unpredictable behavior"),this.rowHeader.definition.editor&&console.warn("Using column editor with selectableRangeRows option may result in unpredictable behavior"))),this.table.modules.frozenColumns&&this.table.modules.frozenColumns.active&&(e=this.table.modules.frozenColumns.getFrozenColumns(),(e.length>1||e.length===1&&e[0]!==this.rowHeader)&&console.warn("Using frozen columns that are not the range header in combination with the selectRange option may result in unpredictable behavior"))}getRanges(){return this.ranges.map(e=>e.getComponent())}getRangesData(){return this.ranges.map(e=>e.getData())}addRangeFromComponent(e,t){return e=e?e._cell:null,t=t?t._cell:null,this.addRange(e,t)}cellGetRanges(e){var t=[];return e.column===this.rowHeader?t=this.ranges.filter(i=>i.occupiesRow(e.row)):t=this.ranges.filter(i=>i.occupies(e)),t.map(i=>i.getComponent())}rowGetRanges(e){var t=this.ranges.filter(i=>i.occupiesRow(e));return t.map(i=>i.getComponent())}colGetRanges(e){var t=this.ranges.filter(i=>i.occupiesColumn(e));return t.map(i=>i.getComponent())}_handleMouseUp(e){this.mousedown=!1,document.removeEventListener("mouseup",this.mouseUpEvent)}_handleKeyDown(e){if(!this.blockKeydown&&(!this.table.modules.edit||this.table.modules.edit&&!this.table.modules.edit.currentCell)){if(e.key==="Enter"){if(this.table.modules.edit&&this.table.modules.edit.currentCell)return;this.table.modules.edit.editCell(this.getActiveCell()),e.preventDefault()}(e.key==="Backspace"||e.key==="Delete")&&this.options("selectableRangeClearCells")&&this.activeRange&&this.activeRange.clearValues()}}initializeFocus(e){var t;this.restoreFocus();try{document.selection?(t=document.body.createTextRange(),t.moveToElementText(e.getElement()),t.select()):window.getSelection&&(t=document.createRange(),t.selectNode(e.getElement()),window.getSelection().removeAllRanges(),window.getSelection().addRange(t))}catch{}}restoreFocus(e){return this.table.rowManager.element.focus(),!0}handleColumnResized(e){var t;this.selecting!=="column"&&this.selecting!=="all"||(t=this.ranges.some(i=>i.occupiesColumn(e)),t&&this.ranges.forEach(i=>{var s=i.getColumns(!0);s.forEach(r=>{r!==e&&r.setWidth(e.width)})}))}handleColumnMoving(e,t){this.resetRanges().setBounds(t),this.overlay.style.visibility="hidden"}handleColumnMoved(e,t,i){this.activeRange.setBounds(e),this.layoutElement()}handleColumnMouseDown(e,t){e.button===2&&(this.selecting==="column"||this.selecting==="all")&&this.activeRange.occupiesColumn(t)||this.table.options.movableColumns&&this.selecting==="column"&&this.activeRange.occupiesColumn(t)||(this.mousedown=!0,document.addEventListener("mouseup",this.mouseUpEvent),this.newSelection(e,t))}handleColumnMouseMove(e,t){t===this.rowHeader||!this.mousedown||this.selecting==="all"||this.activeRange.setBounds(!1,t,!0)}renderCell(e){var t=e.getElement(),i=this.ranges.findIndex(s=>s.occupies(e));t.classList.toggle("tabulator-range-selected",i!==-1),t.classList.toggle("tabulator-range-only-cell-selected",this.ranges.length===1&&this.ranges[0].atTopLeft(e)&&this.ranges[0].atBottomRight(e)),t.dataset.range=i}handleCellMouseDown(e,t){e.button===2&&(this.activeRange.occupies(t)||(this.selecting==="row"||this.selecting==="all")&&this.activeRange.occupiesRow(t.row))||(this.mousedown=!0,document.addEventListener("mouseup",this.mouseUpEvent),this.newSelection(e,t))}handleCellMouseMove(e,t){!this.mousedown||this.selecting==="all"||this.activeRange.setBounds(!1,t,!0)}handleCellClick(e,t){this.initializeFocus(t)}handleEditingCell(e){this.activeRange&&this.activeRange.setBounds(e)}finishEditingCell(){this.blockKeydown=!0,this.table.rowManager.element.focus(),setTimeout(()=>{this.blockKeydown=!1},10)}keyNavigate(e,t){this.navigate(!1,!1,e),t.preventDefault()}keyNavigateRange(e,t,i,s){this.navigate(i,s,t),e.preventDefault()}navigate(e,t,i){var s=!1,r,o,a,l,h,d,c,u,f,p,m;if(this.table.modules.edit&&this.table.modules.edit.currentCell)return!1;if(this.ranges.length>1&&(this.ranges=this.ranges.filter(b=>b===this.activeRange?(b.setEnd(b.start.row,b.start.col),!0):(b.destroy(),!1))),r=this.activeRange,a={top:r.top,bottom:r.bottom,left:r.left,right:r.right},o=t?r.end:r.start,l=o.row,h=o.col,e)switch(i){case"left":h=this.findJumpCellLeft(r.start.row,o.col);break;case"right":h=this.findJumpCellRight(r.start.row,o.col);break;case"up":l=this.findJumpCellUp(o.row,r.start.col);break;case"down":l=this.findJumpCellDown(o.row,r.start.col);break}else{if(t&&(this.selecting==="row"&&(i==="left"||i==="right")||this.selecting==="column"&&(i==="up"||i==="down")))return;switch(i){case"left":h=Math.max(h-1,0);break;case"right":h=Math.min(h+1,this.getTableColumns().length-1);break;case"up":l=Math.max(l-1,0);break;case"down":l=Math.min(l+1,this.getTableRows().length-1);break}}if(this.rowHeader&&h===0&&(h=1),t||r.setStart(l,h),r.setEnd(l,h),t||(this.selecting="cell"),s=a.top!==r.top||a.bottom!==r.bottom||a.left!==r.left||a.right!==r.right,s)return d=this.getRowByRangePos(r.end.row),c=this.getColumnByRangePos(r.end.col),u=d.getElement().getBoundingClientRect(),p=c.getElement().getBoundingClientRect(),f=this.table.rowManager.getElement().getBoundingClientRect(),m=this.table.columnManager.getElement().getBoundingClientRect(),u.top>=f.top&&u.bottom<=f.bottom||(d.getElement().parentNode&&c.getElement().parentNode?this.autoScroll(r,d.getElement(),c.getElement()):d.getComponent().scrollTo(void 0,!1)),p.left>=m.left+this.getRowHeaderWidth()&&p.right<=m.right||(d.getElement().parentNode&&c.getElement().parentNode?this.autoScroll(r,d.getElement(),c.getElement()):c.getComponent().scrollTo(void 0,!1)),this.layoutElement(),!0}rangeRemoved(e){this.ranges=this.ranges.filter(t=>t!==e),this.activeRange===e&&(this.ranges.length?this.activeRange=this.ranges[this.ranges.length-1]:this.addRange()),this.layoutElement()}findJumpRow(e,t,i,s,r){return i&&(t=t.reverse()),this.findJumpItem(s,r,t,function(o){return o.getData()[e.getField()]})}findJumpCol(e,t,i,s,r){return i&&(t=t.reverse()),this.findJumpItem(s,r,t,function(o){return e.getData()[o.getField()]})}findJumpItem(e,t,i,s){var r;for(let o of i){let a=s(o);if(e){if(r=o,a)break}else if(t){if(r=o,a)break}else if(a)r=o;else break}return r}findJumpCellLeft(e,t){var i=this.getRowByRangePos(e),s=this.getTableColumns(),r=this.isEmpty(i.getData()[s[t].getField()]),o=s[t-1]?this.isEmpty(i.getData()[s[t-1].getField()]):!1,a=this.rowHeader?s.slice(1,t):s.slice(0,t),l=this.findJumpCol(i,a,!0,r,o);return l?l.getPosition()-1:t}findJumpCellRight(e,t){var i=this.getRowByRangePos(e),s=this.getTableColumns(),r=this.isEmpty(i.getData()[s[t].getField()]),o=s[t+1]?this.isEmpty(i.getData()[s[t+1].getField()]):!1,a=this.findJumpCol(i,s.slice(t+1,s.length),!1,r,o);return a?a.getPosition()-1:t}findJumpCellUp(e,t){var i=this.getColumnByRangePos(t),s=this.getTableRows(),r=this.isEmpty(s[e].getData()[i.getField()]),o=s[e-1]?this.isEmpty(s[e-1].getData()[i.getField()]):!1,a=this.findJumpRow(i,s.slice(0,e),!0,r,o);return a?a.position-1:e}findJumpCellDown(e,t){var i=this.getColumnByRangePos(t),s=this.getTableRows(),r=this.isEmpty(s[e].getData()[i.getField()]),o=s[e+1]?this.isEmpty(s[e+1].getData()[i.getField()]):!1,a=this.findJumpRow(i,s.slice(e+1,s.length),!1,r,o);return a?a.position-1:e}newSelection(e,t){var i;if(t.type==="column"){if(!this.columnSelection)return;if(t===this.rowHeader){i=this.resetRanges(),this.selecting="all";var s,r=this.getCell(-1,-1);this.rowHeader?s=this.getCell(0,1):s=this.getCell(0,0),i.setBounds(s,r);return}else this.selecting="column"}else t.column===this.rowHeader?this.selecting="row":this.selecting="cell";e.shiftKey?this.activeRange.setBounds(!1,t):e.ctrlKey?this.addRange().setBounds(t):this.resetRanges().setBounds(t)}autoScroll(e,t,i){var s=this.table.rowManager.element,r,o,a,l;typeof t>"u"&&(t=this.getRowByRangePos(e.end.row).getElement()),typeof i>"u"&&(i=this.getColumnByRangePos(e.end.col).getElement()),r={left:i.offsetLeft,right:i.offsetLeft+i.offsetWidth,top:t.offsetTop,bottom:t.offsetTop+t.offsetHeight},o={left:s.scrollLeft+this.getRowHeaderWidth(),right:Math.ceil(s.scrollLeft+s.clientWidth),top:s.scrollTop,bottom:s.scrollTop+s.offsetHeight-this.table.rowManager.scrollbarWidth},a=o.left<r.left&&r.left<o.right&&o.left<r.right&&r.right<o.right,l=o.top<r.top&&r.top<o.bottom&&o.top<r.bottom&&r.bottom<o.bottom,a||(r.left<o.left?s.scrollLeft=r.left-this.getRowHeaderWidth():r.right>o.right&&(s.scrollLeft=Math.min(r.right-s.clientWidth,r.left-this.getRowHeaderWidth()))),l||(r.top<o.top?s.scrollTop=r.top:r.bottom>o.bottom&&(s.scrollTop=r.bottom-s.clientHeight))}layoutChange(){this.overlay.style.visibility="hidden",clearTimeout(this.layoutChangeTimeout),this.layoutChangeTimeout=setTimeout(this.layoutRanges.bind(this),200)}redraw(e){e&&(this.selecting="cell",this.resetRanges(),this.layoutElement())}layoutElement(e){var t;e?t=this.table.rowManager.getVisibleRows(!0):t=this.table.rowManager.getRows(),t.forEach(i=>{i.type==="row"&&(this.layoutRow(i),i.cells.forEach(s=>this.renderCell(s)))}),this.getTableColumns().forEach(i=>{this.layoutColumn(i)}),this.layoutRanges()}layoutRow(e){var t=e.getElement(),i=!1,s=this.ranges.some(r=>r.occupiesRow(e));this.selecting==="row"?i=s:this.selecting==="all"&&(i=!0),t.classList.toggle("tabulator-range-selected",i),t.classList.toggle("tabulator-range-highlight",s)}layoutColumn(e){var t=e.getElement(),i=!1,s=this.ranges.some(r=>r.occupiesColumn(e));this.selecting==="column"?i=s:this.selecting==="all"&&(i=!0),t.classList.toggle("tabulator-range-selected",i),t.classList.toggle("tabulator-range-highlight",s)}layoutRanges(){var e,t,i;this.table.initialized&&(e=this.getActiveCell(),e&&(t=e.getElement(),i=e.row.getElement(),this.table.rtl?this.activeRangeCellElement.style.right=i.offsetWidth-t.offsetLeft-t.offsetWidth+"px":this.activeRangeCellElement.style.left=i.offsetLeft+t.offsetLeft+"px",this.activeRangeCellElement.style.top=i.offsetTop+"px",this.activeRangeCellElement.style.width=t.offsetWidth+"px",this.activeRangeCellElement.style.height=i.offsetHeight+"px",this.ranges.forEach(s=>s.layout()),this.overlay.style.visibility="visible"))}getCell(e,t){var i;return t<0&&(t=this.getTableColumns().length+t,t<0)?null:(e<0&&(e=this.getTableRows().length+e),i=this.table.rowManager.getRowFromPosition(e+1),i?i.getCells(!1,!0).filter(s=>s.column.visible)[t]:null)}getActiveCell(){return this.getCell(this.activeRange.start.row,this.activeRange.start.col)}getRowByRangePos(e){return this.getTableRows()[e]}getColumnByRangePos(e){return this.getTableColumns()[e]}getTableRows(){return this.table.rowManager.getDisplayRows().filter(e=>e.type==="row")}getTableColumns(){return this.table.columnManager.getVisibleColumnsByIndex()}addRange(e,t){var i;return this.maxRanges!==!0&&this.ranges.length>=this.maxRanges&&this.ranges.shift().destroy(),i=new ya(this.table,this,e,t),this.activeRange=i,this.ranges.push(i),this.rangeContainer.appendChild(i.element),i}resetRanges(){var e,t,i;return this.ranges.forEach(s=>s.destroy()),this.ranges=[],e=this.addRange(),this.table.rowManager.activeRows.length&&(i=this.table.rowManager.activeRows[0].cells.filter(s=>s.column.visible),t=i[this.rowHeader?1:0],t&&(e.setBounds(t),this.options("selectableRangeAutoFocus")&&this.initializeFocus(t))),e}tableDestroyed(){document.removeEventListener("mouseup",this.mouseUpEvent),this.table.rowManager.element.removeEventListener("keydown",this.keyDownEvent)}selectedRows(e){return e?this.activeRange.getRows().map(t=>t.getComponent()):this.activeRange.getRows()}selectedColumns(e){return e?this.activeRange.getColumns().map(t=>t.getComponent()):this.activeRange.getColumns()}getRowHeaderWidth(){return this.rowHeader?this.rowHeader.getElement().offsetWidth:0}isEmpty(e){return e==null||e===""}}w(Wt,"moduleName","selectRange"),w(Wt,"moduleInitOrder",1),w(Wt,"moduleExtensions",Ma);function Sa(n,e,t,i,s,r,o){var a=o.alignEmptyValues,l=o.decimalSeparator,h=o.thousandSeparator,d=0;if(n=String(n),e=String(e),h&&(n=n.split(h).join(""),e=e.split(h).join("")),l&&(n=n.split(l).join("."),e=e.split(l).join(".")),n=parseFloat(n),e=parseFloat(e),isNaN(n))d=isNaN(e)?0:-1;else if(isNaN(e))d=1;else return n-e;return(a==="top"&&r==="desc"||a==="bottom"&&r==="asc")&&(d*=-1),d}function La(n,e,t,i,s,r,o){var a=o.alignEmptyValues,l=0,h;if(!n)l=e?-1:0;else if(!e)l=1;else{switch(typeof o.locale){case"boolean":o.locale&&(h=this.langLocale());break;case"string":h=o.locale;break}return String(n).toLowerCase().localeCompare(String(e).toLowerCase(),h)}return(a==="top"&&r==="desc"||a==="bottom"&&r==="asc")&&(l*=-1),l}function is(n,e,t,i,s,r,o){var a=this.table.dependencyRegistry.lookup(["luxon","DateTime"],"DateTime"),l=o.format||"dd/MM/yyyy HH:mm:ss",h=o.alignEmptyValues,d=0;if(typeof a<"u"){if(a.isDateTime(n)||(l==="iso"?n=a.fromISO(String(n)):n=a.fromFormat(String(n),l)),a.isDateTime(e)||(l==="iso"?e=a.fromISO(String(e)):e=a.fromFormat(String(e),l)),!n.isValid)d=e.isValid?-1:0;else if(!e.isValid)d=1;else return n-e;return(h==="top"&&r==="desc"||h==="bottom"&&r==="asc")&&(d*=-1),d}else console.error("Sort Error - 'datetime' sorter is dependant on luxon.js")}function Da(n,e,t,i,s,r,o){return o.format||(o.format="dd/MM/yyyy"),is.call(this,n,e,t,i,s,r,o)}function za(n,e,t,i,s,r,o){return o.format||(o.format="HH:mm"),is.call(this,n,e,t,i,s,r,o)}function Fa(n,e,t,i,s,r,o){var a=n===!0||n==="true"||n==="True"||n===1?1:0,l=e===!0||e==="true"||e==="True"||e===1?1:0;return a-l}function Ha(n,e,t,i,s,r,o){var a=o.type||"length",l=o.alignEmptyValues,h=0,d=this.table,c;o.valueMap&&(typeof o.valueMap=="string"?c=function(f){return f.map(p=>P.retrieveNestedData(d.options.nestedFieldSeparator,o.valueMap,p))}:c=o.valueMap);function u(f){var p;switch(c&&(f=c(f)),a){case"length":p=f.length;break;case"sum":p=f.reduce(function(m,b){return m+b});break;case"max":p=Math.max.apply(null,f);break;case"min":p=Math.min.apply(null,f);break;case"avg":p=f.reduce(function(m,b){return m+b})/f.length;break;case"string":p=f.join("");break}return p}if(!Array.isArray(n))h=Array.isArray(e)?-1:0;else if(!Array.isArray(e))h=1;else return a==="string"?String(u(n)).toLowerCase().localeCompare(String(u(e)).toLowerCase()):u(e)-u(n);return(l==="top"&&r==="desc"||l==="bottom"&&r==="asc")&&(h*=-1),h}function Aa(n,e,t,i,s,r,o){var a=typeof n>"u"?0:1,l=typeof e>"u"?0:1;return a-l}function Oa(n,e,t,i,s,r,o){var a,l,h,d,c=0,u,f=/(\d+)|(\D+)/g,p=/\d/,m=o.alignEmptyValues,b=0;if(!n&&n!==0)b=!e&&e!==0?0:-1;else if(!e&&e!==0)b=1;else{if(isFinite(n)&&isFinite(e))return n-e;if(a=String(n).toLowerCase(),l=String(e).toLowerCase(),a===l)return 0;if(!(p.test(a)&&p.test(l)))return a>l?1:-1;for(a=a.match(f),l=l.match(f),u=a.length>l.length?l.length:a.length;c<u;)if(h=a[c],d=l[c++],h!==d)return isFinite(h)&&isFinite(d)?(h.charAt(0)==="0"&&(h="."+h),d.charAt(0)==="0"&&(d="."+d),h-d):h>d?1:-1;return a.length>l.length}return(m==="top"&&r==="desc"||m==="bottom"&&r==="asc")&&(b*=-1),b}var Pa={number:Sa,string:La,date:Da,time:za,datetime:is,boolean:Fa,array:Ha,exists:Aa,alphanum:Oa};const He=class He extends D{constructor(e){super(e),this.sortList=[],this.changed=!1,this.registerTableOption("sortMode","local"),this.registerTableOption("initialSort",!1),this.registerTableOption("columnHeaderSortMulti",!0),this.registerTableOption("sortOrderReverse",!1),this.registerTableOption("headerSortElement","<div class='tabulator-arrow'></div>"),this.registerTableOption("headerSortClickElement","header"),this.registerColumnOption("sorter"),this.registerColumnOption("sorterParams"),this.registerColumnOption("headerSort",!0),this.registerColumnOption("headerSortStartingDir"),this.registerColumnOption("headerSortTristate")}initialize(){this.subscribe("column-layout",this.initializeColumn.bind(this)),this.subscribe("table-built",this.tableBuilt.bind(this)),this.registerDataHandler(this.sort.bind(this),20),this.registerTableFunction("setSort",this.userSetSort.bind(this)),this.registerTableFunction("getSorters",this.getSort.bind(this)),this.registerTableFunction("clearSort",this.clearSort.bind(this)),this.table.options.sortMode==="remote"&&this.subscribe("data-params",this.remoteSortParams.bind(this))}tableBuilt(){this.table.options.initialSort&&this.setSort(this.table.options.initialSort)}remoteSortParams(e,t,i,s){var r=this.getSort();return r.forEach(o=>{delete o.column}),s.sort=r,s}userSetSort(e,t){this.setSort(e,t),this.refreshSort()}clearSort(){this.clear(),this.refreshSort()}initializeColumn(e){var t=!1,i,s;switch(typeof e.definition.sorter){case"string":He.sorters[e.definition.sorter]?t=He.sorters[e.definition.sorter]:console.warn("Sort Error - No such sorter found: ",e.definition.sorter);break;case"function":t=e.definition.sorter;break}if(e.modules.sort={sorter:t,dir:"none",params:e.definition.sorterParams||{},startingDir:e.definition.headerSortStartingDir||"asc",tristate:e.definition.headerSortTristate},e.definition.headerSort!==!1){switch(i=e.getElement(),i.classList.add("tabulator-sortable"),s=document.createElement("div"),s.classList.add("tabulator-col-sorter"),this.table.options.headerSortClickElement){case"icon":s.classList.add("tabulator-col-sorter-element");break;case"header":i.classList.add("tabulator-col-sorter-element");break;default:i.classList.add("tabulator-col-sorter-element");break}switch(this.table.options.headerSortElement){case"function":break;case"object":s.appendChild(this.table.options.headerSortElement);break;default:s.innerHTML=this.table.options.headerSortElement}e.titleHolderElement.appendChild(s),e.modules.sort.element=s,this.setColumnHeaderSortIcon(e,"none"),this.table.options.headerSortClickElement==="icon"&&s.addEventListener("mousedown",r=>{r.stopPropagation()}),(this.table.options.headerSortClickElement==="icon"?s:i).addEventListener("click",r=>{var o="",a=[],l=!1;if(e.modules.sort){if(e.modules.sort.tristate)e.modules.sort.dir=="none"?o=e.modules.sort.startingDir:e.modules.sort.dir==e.modules.sort.startingDir?o=e.modules.sort.dir=="asc"?"desc":"asc":o="none";else switch(e.modules.sort.dir){case"asc":o="desc";break;case"desc":o="asc";break;default:o=e.modules.sort.startingDir}this.table.options.columnHeaderSortMulti&&(r.shiftKey||r.ctrlKey)?(a=this.getSort(),l=a.findIndex(h=>h.field===e.getField()),l>-1?(a[l].dir=o,l=a.splice(l,1)[0],o!="none"&&a.push(l)):o!="none"&&a.push({column:e,dir:o}),this.setSort(a)):o=="none"?this.clear():this.setSort(e,o),this.refreshSort()}})}}refreshSort(){this.table.options.sortMode==="remote"?this.reloadData(null,!1,!1):this.refreshData(!0)}hasChanged(){var e=this.changed;return this.changed=!1,e}getSort(){var e=this,t=[];return e.sortList.forEach(function(i){i.column&&t.push({column:i.column.getComponent(),field:i.column.getField(),dir:i.dir})}),t}setSort(e,t){var i=this,s=[];Array.isArray(e)||(e=[{column:e,dir:t}]),e.forEach(function(r){var o;o=i.table.columnManager.findColumn(r.column),o?(r.column=o,s.push(r),i.changed=!0):console.warn("Sort Warning - Sort field does not exist and is being ignored: ",r.column)}),i.sortList=s,this.dispatch("sort-changed")}clear(){this.setSort([])}findSorter(e){var t=this.table.rowManager.activeRows[0],i="string",s,r;if(t&&(t=t.getData(),s=e.getField(),s))switch(r=e.getFieldValue(t),typeof r){case"undefined":i="string";break;case"boolean":i="boolean";break;default:!isNaN(r)&&r!==""?i="number":r.match(/((^[0-9]+[a-z]+)|(^[a-z]+[0-9]+))+$/i)&&(i="alphanum");break}return He.sorters[i]}sort(e,t){var i=this,s=this.table.options.sortOrderReverse?i.sortList.slice().reverse():i.sortList,r=[],o=[];return this.subscribedExternal("dataSorting")&&this.dispatchExternal("dataSorting",i.getSort()),t||i.clearColumnHeaders(),this.table.options.sortMode!=="remote"?(s.forEach(function(a,l){var h;a.column&&(h=a.column.modules.sort,h&&(h.sorter||(h.sorter=i.findSorter(a.column)),a.params=typeof h.params=="function"?h.params(a.column.getComponent(),a.dir):h.params,r.push(a)),t||i.setColumnHeader(a.column,a.dir))}),r.length&&i._sortItems(e,r)):t||s.forEach(function(a,l){i.setColumnHeader(a.column,a.dir)}),this.subscribedExternal("dataSorted")&&(e.forEach(a=>{o.push(a.getComponent())}),this.dispatchExternal("dataSorted",i.getSort(),o)),e}clearColumnHeaders(){this.table.columnManager.getRealColumns().forEach(e=>{e.modules.sort&&(e.modules.sort.dir="none",e.getElement().setAttribute("aria-sort","none"),this.setColumnHeaderSortIcon(e,"none"))})}setColumnHeader(e,t){e.modules.sort.dir=t,e.getElement().setAttribute("aria-sort",t==="asc"?"ascending":"descending"),this.setColumnHeaderSortIcon(e,t)}setColumnHeaderSortIcon(e,t){var i=e.modules.sort.element,s;if(e.definition.headerSort&&typeof this.table.options.headerSortElement=="function"){for(;i.firstChild;)i.removeChild(i.firstChild);s=this.table.options.headerSortElement.call(this.table,e.getComponent(),t),typeof s=="object"?i.appendChild(s):i.innerHTML=s}}_sortItems(e,t){var i=t.length-1;e.sort((s,r)=>{for(var o,a=i;a>=0;a--){let l=t[a];if(o=this._sortRow(s,r,l.column,l.dir,l.params),o!==0)break}return o})}_sortRow(e,t,i,s,r){var o,a,l=s=="asc"?e:t,h=s=="asc"?t:e;return e=i.getFieldValue(l.getData()),t=i.getFieldValue(h.getData()),e=typeof e<"u"?e:"",t=typeof t<"u"?t:"",o=l.getComponent(),a=h.getComponent(),i.modules.sort.sorter.call(this,e,t,o,a,i.getComponent(),s,r)}};w(He,"moduleName","sort"),w(He,"sorters",Pa);let Bi=He;class Ba{constructor(e,t){this.columnCount=e,this.rowCount=t,this.columnString=[],this.columns=[],this.rows=[]}genColumns(e){var t=Math.max(this.columnCount,Math.max(...e.map(i=>i.length)));this.columnString=[],this.columns=[];for(let i=1;i<=t;i++)this.incrementChar(this.columnString.length-1),this.columns.push(this.columnString.join(""));return this.columns}genRows(e){var t=Math.max(this.rowCount,e.length);this.rows=[];for(let i=1;i<=t;i++)this.rows.push(i);return this.rows}incrementChar(e){let t=this.columnString[e];t?t!=="Z"?this.columnString[e]=String.fromCharCode(this.columnString[e].charCodeAt(0)+1):(this.columnString[e]="A",e?this.incrementChar(e-1):this.columnString.push("A")):this.columnString.push("A")}setRowCount(e){this.rowCount=e}setColumnCount(e){this.columnCount=e}}class Dn{constructor(e){return this._sheet=e,new Proxy(this,{get:function(t,i,s){return typeof t[i]<"u"?t[i]:t._sheet.table.componentFunctionBinder.handle("sheet",t._sheet,i)}})}getTitle(){return this._sheet.title}getKey(){return this._sheet.key}getDefinition(){return this._sheet.getDefinition()}getData(){return this._sheet.getData()}setData(e){return this._sheet.setData(e)}clear(){return this._sheet.clear()}remove(){return this._sheet.remove()}active(){return this._sheet.active()}setTitle(e){return this._sheet.setTitle(e)}setRows(e){return this._sheet.setRows(e)}setColumns(e){return this._sheet.setColumns(e)}}class vs extends j{constructor(e,t){super(e.table),this.spreadsheetManager=e,this.definition=t,this.title=this.definition.title||"",this.key=this.definition.key||this.definition.title,this.rowCount=this.definition.rows,this.columnCount=this.definition.columns,this.data=this.definition.data||[],this.element=null,this.isActive=!1,this.grid=new Ba(this.columnCount,this.rowCount),this.defaultColumnDefinition={width:100,headerHozAlign:"center",headerSort:!1},this.columnDefinition=Object.assign(this.defaultColumnDefinition,this.options("spreadsheetColumnDefinition")),this.columnDefs=[],this.rowDefs=[],this.columnFields=[],this.columns=[],this.rows=[],this.scrollTop=null,this.scrollLeft=null,this.initialize(),this.dispatchExternal("sheetAdded",this.getComponent())}initialize(){this.initializeElement(),this.initializeColumns(),this.initializeRows()}reinitialize(){this.initializeColumns(),this.initializeRows()}initializeElement(){this.element=document.createElement("div"),this.element.classList.add("tabulator-spreadsheet-tab"),this.element.innerText=this.title,this.element.addEventListener("click",()=>{this.spreadsheetManager.loadSheet(this)})}initializeColumns(){this.grid.setColumnCount(this.columnCount),this.columnFields=this.grid.genColumns(this.data),this.columnDefs=[],this.columnFields.forEach(e=>{var t=Object.assign({},this.columnDefinition);t.field=e,t.title=e,this.columnDefs.push(t)})}initializeRows(){var e;this.grid.setRowCount(this.rowCount),e=this.grid.genRows(this.data),this.rowDefs=[],e.forEach((t,i)=>{var s={_id:t},r=this.data[i];r&&r.forEach((o,a)=>{var l=this.columnFields[a];l&&(s[l]=o)}),this.rowDefs.push(s)})}unload(){this.isActive=!1,this.scrollTop=this.table.rowManager.scrollTop,this.scrollLeft=this.table.rowManager.scrollLeft,this.data=this.getData(!0),this.element.classList.remove("tabulator-spreadsheet-tab-active")}load(){var e=!this.isActive;this.isActive=!0,this.table.blockRedraw(),this.table.setData([]),this.table.setColumns(this.columnDefs),this.table.setData(this.rowDefs),this.table.restoreRedraw(),e&&this.scrollTop!==null&&(this.table.rowManager.element.scrollLeft=this.scrollLeft,this.table.rowManager.element.scrollTop=this.scrollTop),this.element.classList.add("tabulator-spreadsheet-tab-active"),this.dispatchExternal("sheetLoaded",this.getComponent())}getComponent(){return new Dn(this)}getDefinition(){return{title:this.title,key:this.key,rows:this.rowCount,columns:this.columnCount,data:this.getData()}}getData(e){var t=[],i,s,r;return this.rowDefs.forEach(o=>{var a=[];this.columnFields.forEach(l=>{a.push(o[l])}),t.push(a)}),!e&&!this.options("spreadsheetOutputFull")&&(i=t.map(o=>o.findLastIndex(a=>typeof a<"u")+1),s=Math.max(...i),r=i.findLastIndex(o=>o>0)+1,t=t.slice(0,r),t=t.map(o=>o.slice(0,s))),t}setData(e){this.data=e,this.reinitialize(),this.dispatchExternal("sheetUpdated",this.getComponent()),this.isActive&&this.load()}clear(){this.setData([])}setTitle(e){this.title=e,this.element.innerText=e,this.dispatchExternal("sheetUpdated",this.getComponent())}setRows(e){this.rowCount=e,this.initializeRows(),this.dispatchExternal("sheetUpdated",this.getComponent()),this.isActive&&this.load()}setColumns(e){this.columnCount=e,this.reinitialize(),this.dispatchExternal("sheetUpdated",this.getComponent()),this.isActive&&this.load()}remove(){this.spreadsheetManager.removeSheet(this)}destroy(){this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.dispatchExternal("sheetRemoved",this.getComponent())}active(){this.spreadsheetManager.loadSheet(this)}}class zn extends D{constructor(e){super(e),this.sheets=[],this.element=null,this.registerTableOption("spreadsheet",!1),this.registerTableOption("spreadsheetRows",50),this.registerTableOption("spreadsheetColumns",50),this.registerTableOption("spreadsheetColumnDefinition",{}),this.registerTableOption("spreadsheetOutputFull",!1),this.registerTableOption("spreadsheetData",!1),this.registerTableOption("spreadsheetSheets",!1),this.registerTableOption("spreadsheetSheetTabs",!1),this.registerTableOption("spreadsheetSheetTabsElement",!1),this.registerTableFunction("setSheets",this.setSheets.bind(this)),this.registerTableFunction("addSheet",this.addSheet.bind(this)),this.registerTableFunction("getSheets",this.getSheets.bind(this)),this.registerTableFunction("getSheetDefinitions",this.getSheetDefinitions.bind(this)),this.registerTableFunction("setSheetData",this.setSheetData.bind(this)),this.registerTableFunction("getSheet",this.getSheet.bind(this)),this.registerTableFunction("getSheetData",this.getSheetData.bind(this)),this.registerTableFunction("clearSheet",this.clearSheet.bind(this)),this.registerTableFunction("removeSheet",this.removeSheetFunc.bind(this)),this.registerTableFunction("activeSheet",this.activeSheetFunc.bind(this))}initialize(){this.options("spreadsheet")&&(this.subscribe("table-initialized",this.tableInitialized.bind(this)),this.subscribe("data-loaded",this.loadRemoteData.bind(this)),this.table.options.index="_id",this.options("spreadsheetData")&&this.options("spreadsheetSheets")&&(console.warn("You cannot use spreadsheetData and spreadsheetSheets at the same time, ignoring spreadsheetData"),this.table.options.spreadsheetData=!1),this.compatibilityCheck(),this.options("spreadsheetSheetTabs")&&this.initializeTabset())}compatibilityCheck(){this.options("data")&&console.warn("Do not use the data option when working with spreadsheets, use either spreadsheetData or spreadsheetSheets to pass data into the table"),this.options("pagination")&&console.warn("The spreadsheet module is not compatible with the pagination module"),this.options("groupBy")&&console.warn("The spreadsheet module is not compatible with the row grouping module"),this.options("responsiveCollapse")&&console.warn("The spreadsheet module is not compatible with the responsive collapse module")}initializeTabset(){this.element=document.createElement("div"),this.element.classList.add("tabulator-spreadsheet-tabs");var e=this.options("spreadsheetSheetTabsElement");e&&!(e instanceof HTMLElement)&&(e=document.querySelector(e),e||console.warn("Unable to find element matching spreadsheetSheetTabsElement selector:",this.options("spreadsheetSheetTabsElement"))),e?e.appendChild(this.element):this.footerAppend(this.element)}tableInitialized(){this.sheets.length?this.loadSheet(this.sheets[0]):this.options("spreadsheetSheets")?this.loadSheets(this.options("spreadsheetSheets")):this.options("spreadsheetData")&&this.loadData(this.options("spreadsheetData"))}loadRemoteData(e,t,i){return console.log("data",e,t,i),Array.isArray(e)?(this.table.dataLoader.clearAlert(),this.dispatchExternal("dataLoaded",e),!e.length||Array.isArray(e[0])?this.loadData(e):this.loadSheets(e)):console.error(`Spreadsheet Loading Error - Unable to process remote data due to invalid data type 
Expecting: array 
Received: `,typeof e,`
Data:     `,e),!1}loadData(e){var t={data:e};this.loadSheet(this.newSheet(t))}destroySheets(){this.sheets.forEach(e=>{e.destroy()}),this.sheets=[],this.activeSheet=null}loadSheets(e){Array.isArray(e)||(e=[]),this.destroySheets(),e.forEach(t=>{this.newSheet(t)}),this.loadSheet(this.sheets[0])}loadSheet(e){this.activeSheet!==e&&(this.activeSheet&&this.activeSheet.unload(),this.activeSheet=e,e.load())}newSheet(e={}){var t;return e.rows||(e.rows=this.options("spreadsheetRows")),e.columns||(e.columns=this.options("spreadsheetColumns")),t=new vs(this,e),this.sheets.push(t),this.element&&this.element.appendChild(t.element),t}removeSheet(e){var t=this.sheets.indexOf(e),i;this.sheets.length>1?t>-1&&(this.sheets.splice(t,1),e.destroy(),this.activeSheet===e&&(i=this.sheets[t-1]||this.sheets[0],i?this.loadSheet(i):this.activeSheet=null)):console.warn("Unable to remove sheet, at least one sheet must be active")}lookupSheet(e){return e?e instanceof vs?e:e instanceof Dn?e._sheet:this.sheets.find(t=>t.key===e)||!1:this.activeSheet}setSheets(e){return this.loadSheets(e),this.getSheets()}addSheet(e){return this.newSheet(e).getComponent()}getSheetDefinitions(){return this.sheets.map(e=>e.getDefinition())}getSheets(){return this.sheets.map(e=>e.getComponent())}getSheet(e){var t=this.lookupSheet(e);return t?t.getComponent():!1}setSheetData(e,t){e&&!t&&(t=e,e=!1);var i=this.lookupSheet(e);return i?i.setData(t):!1}getSheetData(e){var t=this.lookupSheet(e);return t?t.getData():!1}clearSheet(e){var t=this.lookupSheet(e);return t?t.clear():!1}removeSheetFunc(e){var t=this.lookupSheet(e);t&&this.removeSheet(t)}activeSheetFunc(e){var t=this.lookupSheet(e);return t?this.loadSheet(t):!1}}w(zn,"moduleName","spreadsheet");class Fn extends D{constructor(e){super(e),this.tooltipSubscriber=null,this.headerSubscriber=null,this.timeout=null,this.popupInstance=null,this.registerTableOption("tooltipDelay",300),this.registerColumnOption("tooltip"),this.registerColumnOption("headerTooltip")}initialize(){this.deprecatedOptionsCheck(),this.subscribe("column-init",this.initializeColumn.bind(this))}deprecatedOptionsCheck(){}initializeColumn(e){e.definition.headerTooltip&&!this.headerSubscriber&&(this.headerSubscriber=!0,this.subscribe("column-mousemove",this.mousemoveCheck.bind(this,"headerTooltip")),this.subscribe("column-mouseout",this.mouseoutCheck.bind(this,"headerTooltip"))),e.definition.tooltip&&!this.tooltipSubscriber&&(this.tooltipSubscriber=!0,this.subscribe("cell-mousemove",this.mousemoveCheck.bind(this,"tooltip")),this.subscribe("cell-mouseout",this.mouseoutCheck.bind(this,"tooltip")))}mousemoveCheck(e,t,i){var s=e==="tooltip"?i.column.definition.tooltip:i.definition.headerTooltip;s&&(this.clearPopup(),this.timeout=setTimeout(this.loadTooltip.bind(this,t,i,s),this.table.options.tooltipDelay))}mouseoutCheck(e,t,i){this.popupInstance||this.clearPopup()}clearPopup(e,t,i){clearTimeout(this.timeout),this.timeout=null,this.popupInstance&&this.popupInstance.hide()}loadTooltip(e,t,i){var s,r,o;function a(l){r=l}typeof i=="function"&&(i=i(e,t.getComponent(),a)),i instanceof HTMLElement?s=i:(s=document.createElement("div"),i===!0&&(t instanceof Lt?i=t.value:t.definition.field?this.langBind("columns|"+t.definition.field,l=>{s.innerHTML=i=l||t.definition.title}):i=t.definition.title),s.innerHTML=i),(i||i===0||i===!1)&&(s.classList.add("tabulator-tooltip"),s.addEventListener("mousemove",l=>l.preventDefault()),this.popupInstance=this.popup(s),typeof r=="function"&&this.popupInstance.renderCallback(r),o=this.popupInstance.containerEventCoords(e),this.popupInstance.show(o.x+15,o.y+15).hideOnBlur(()=>{this.dispatchExternal("TooltipClosed",t.getComponent()),this.popupInstance=null}),this.dispatchExternal("TooltipOpened",t.getComponent()))}}w(Fn,"moduleName","tooltip");var Ia={integer:function(n,e,t){return e===""||e===null||typeof e>"u"?!0:(e=Number(e),!isNaN(e)&&isFinite(e)&&Math.floor(e)===e)},float:function(n,e,t){return e===""||e===null||typeof e>"u"?!0:(e=Number(e),!isNaN(e)&&isFinite(e)&&e%1!==0)},numeric:function(n,e,t){return e===""||e===null||typeof e>"u"?!0:!isNaN(e)},string:function(n,e,t){return e===""||e===null||typeof e>"u"?!0:isNaN(e)},alphanumeric:function(n,e,t){if(e===""||e===null||typeof e>"u")return!0;var i=new RegExp(/^[a-z0-9]+$/i);return i.test(e)},max:function(n,e,t){return e===""||e===null||typeof e>"u"?!0:parseFloat(e)<=t},min:function(n,e,t){return e===""||e===null||typeof e>"u"?!0:parseFloat(e)>=t},starts:function(n,e,t){return e===""||e===null||typeof e>"u"?!0:String(e).toLowerCase().startsWith(String(t).toLowerCase())},ends:function(n,e,t){return e===""||e===null||typeof e>"u"?!0:String(e).toLowerCase().endsWith(String(t).toLowerCase())},minLength:function(n,e,t){return e===""||e===null||typeof e>"u"?!0:String(e).length>=t},maxLength:function(n,e,t){return e===""||e===null||typeof e>"u"?!0:String(e).length<=t},in:function(n,e,t){return e===""||e===null||typeof e>"u"?!0:(typeof t=="string"&&(t=t.split("|")),t.indexOf(e)>-1)},regex:function(n,e,t){if(e===""||e===null||typeof e>"u")return!0;var i=new RegExp(t);return i.test(e)},unique:function(n,e,t){if(e===""||e===null||typeof e>"u")return!0;var i=!0,s=n.getData(),r=n.getColumn()._getSelf();return this.table.rowManager.rows.forEach(function(o){var a=o.getData();a!==s&&e==r.getFieldValue(a)&&(i=!1)}),i},required:function(n,e,t){return e!==""&&e!==null&&typeof e<"u"}};const Ct=class Ct extends D{constructor(e){super(e),this.invalidCells=[],this.registerTableOption("validationMode","blocking"),this.registerColumnOption("validator"),this.registerTableFunction("getInvalidCells",this.getInvalidCells.bind(this)),this.registerTableFunction("clearCellValidation",this.userClearCellValidation.bind(this)),this.registerTableFunction("validate",this.userValidate.bind(this)),this.registerComponentFunction("cell","isValid",this.cellIsValid.bind(this)),this.registerComponentFunction("cell","clearValidation",this.clearValidation.bind(this)),this.registerComponentFunction("cell","validate",this.cellValidate.bind(this)),this.registerComponentFunction("column","validate",this.columnValidate.bind(this)),this.registerComponentFunction("row","validate",this.rowValidate.bind(this))}initialize(){this.subscribe("cell-delete",this.clearValidation.bind(this)),this.subscribe("column-layout",this.initializeColumnCheck.bind(this)),this.subscribe("edit-success",this.editValidate.bind(this)),this.subscribe("edit-editor-clear",this.editorClear.bind(this)),this.subscribe("edit-edited-clear",this.editedClear.bind(this))}editValidate(e,t,i){var s=this.table.options.validationMode!=="manual"?this.validate(e.column.modules.validate,e,t):!0;return s!==!0&&setTimeout(()=>{e.getElement().classList.add("tabulator-validation-fail"),this.dispatchExternal("validationFailed",e.getComponent(),t,s)}),s}editorClear(e,t){t&&e.column.modules.validate&&this.cellValidate(e),e.getElement().classList.remove("tabulator-validation-fail")}editedClear(e){e.modules.validate&&(e.modules.validate.invalid=!1)}cellIsValid(e){return e.modules.validate&&e.modules.validate.invalid||!0}cellValidate(e){return this.validate(e.column.modules.validate,e,e.getValue())}columnValidate(e){var t=[];return e.cells.forEach(i=>{this.cellValidate(i)!==!0&&t.push(i.getComponent())}),t.length?t:!0}rowValidate(e){var t=[];return e.cells.forEach(i=>{this.cellValidate(i)!==!0&&t.push(i.getComponent())}),t.length?t:!0}userClearCellValidation(e){e||(e=this.getInvalidCells()),Array.isArray(e)||(e=[e]),e.forEach(t=>{this.clearValidation(t._getSelf())})}userValidate(e){var t=[];return this.table.rowManager.rows.forEach(i=>{i=i.getComponent();var s=i.validate();s!==!0&&(t=t.concat(s))}),t.length?t:!0}initializeColumnCheck(e){typeof e.definition.validator<"u"&&this.initializeColumn(e)}initializeColumn(e){var t=this,i=[],s;e.definition.validator&&(Array.isArray(e.definition.validator)?e.definition.validator.forEach(r=>{s=t._extractValidator(r),s&&i.push(s)}):(s=this._extractValidator(e.definition.validator),s&&i.push(s)),e.modules.validate=i.length?i:!1)}_extractValidator(e){var t,i,s;switch(typeof e){case"string":return s=e.indexOf(":"),s>-1?(t=e.substring(0,s),i=e.substring(s+1)):t=e,this._buildValidator(t,i);case"function":return this._buildValidator(e);case"object":return this._buildValidator(e.type,e.parameters)}}_buildValidator(e,t){var i=typeof e=="function"?e:Ct.validators[e];return i?{type:typeof e=="function"?"function":e,func:i,params:t}:(console.warn("Validator Setup Error - No matching validator found:",e),!1)}validate(e,t,i){var s=this,r=[],o=this.invalidCells.indexOf(t);return e&&e.forEach(a=>{a.func.call(s,t.getComponent(),i,a.params)||r.push({type:a.type,parameters:a.params})}),t.modules.validate||(t.modules.validate={}),r.length?(t.modules.validate.invalid=r,this.table.options.validationMode!=="manual"&&t.getElement().classList.add("tabulator-validation-fail"),o==-1&&this.invalidCells.push(t)):(t.modules.validate.invalid=!1,t.getElement().classList.remove("tabulator-validation-fail"),o>-1&&this.invalidCells.splice(o,1)),r.length?r:!0}getInvalidCells(){var e=[];return this.invalidCells.forEach(t=>{e.push(t.getComponent())}),e}clearValidation(e){var t;e.modules.validate&&e.modules.validate.invalid&&(e.getElement().classList.remove("tabulator-validation-fail"),e.modules.validate.invalid=!1,t=this.invalidCells.indexOf(e),t>-1&&this.invalidCells.splice(t,1))}};w(Ct,"moduleName","validate"),w(Ct,"validators",Ia);let Ii=Ct;var ii=Object.freeze({__proto__:null,AccessorModule:vi,AjaxModule:yi,ClipboardModule:Ei,ColumnCalcsModule:Ri,DataTreeModule:bn,DownloadModule:xi,EditModule:_i,ExportModule:ki,FilterModule:Ti,FormatModule:Mi,FrozenColumnsModule:vn,FrozenRowsModule:wn,GroupRowsModule:Cn,HistoryModule:Si,HtmlTableImportModule:yn,ImportModule:Li,InteractionModule:En,KeybindingsModule:Di,MenuModule:Rn,MoveColumnsModule:xn,MoveRowsModule:zi,MutatorModule:Fi,PageModule:Hi,PersistenceModule:Ai,PopupModule:_n,PrintModule:kn,ReactiveDataModule:Tn,ResizeColumnsModule:Mn,ResizeRowsModule:Sn,ResizeTableModule:Ln,ResponsiveLayoutModule:Oi,SelectRangeModule:Wt,SelectRowModule:Pi,SortModule:Bi,SpreadsheetModule:zn,TooltipModule:Fn,ValidateModule:Ii}),Na={debugEventsExternal:!1,debugEventsInternal:!1,debugInvalidOptions:!0,debugInvalidComponentFuncs:!0,debugInitialization:!0,debugDeprecation:!0,height:!1,minHeight:!1,maxHeight:!1,columnHeaderVertAlign:"top",popupContainer:!1,columns:[],columnDefaults:{},rowHeader:!1,data:!1,autoColumns:!1,autoColumnsDefinitions:!1,nestedFieldSeparator:".",footerElement:!1,index:"id",textDirection:"auto",addRowPos:"bottom",headerVisible:!0,renderVertical:"virtual",renderHorizontal:"basic",renderVerticalBuffer:0,scrollToRowPosition:"top",scrollToRowIfVisible:!0,scrollToColumnPosition:"left",scrollToColumnIfVisible:!0,rowFormatter:!1,rowFormatterPrint:null,rowFormatterClipboard:null,rowFormatterHtmlOutput:null,rowHeight:null,placeholder:!1,dataLoader:!0,dataLoaderLoading:!1,dataLoaderError:!1,dataLoaderErrorTimeout:3e3,dataSendParams:{},dataReceiveParams:{},dependencies:{}};class Hn{constructor(e,t,i={}){this.table=e,this.msgType=t,this.registeredDefaults=Object.assign({},i)}register(e,t){this.registeredDefaults[e]=t}generate(e,t={}){var i=Object.assign({},this.registeredDefaults),s=this.table.options.debugInvalidOptions||t.debugInvalidOptions===!0;Object.assign(i,e);for(let r in t)i.hasOwnProperty(r)||(s&&console.warn("Invalid "+this.msgType+" option:",r),i[r]=t.key);for(let r in i)r in t?i[r]=t[r]:Array.isArray(i[r])?i[r]=Object.assign([],i[r]):typeof i[r]=="object"&&i[r]!==null?i[r]=Object.assign({},i[r]):typeof i[r]>"u"&&delete i[r];return i}}class Kt extends j{constructor(e){super(e),this.elementVertical=e.rowManager.element,this.elementHorizontal=e.columnManager.element,this.tableElement=e.rowManager.tableElement,this.verticalFillMode="fit"}initialize(){}clearRows(){}clearColumns(){}reinitializeColumnWidths(e){}renderRows(){}renderColumns(){}rerenderRows(e){e&&e()}rerenderColumns(e,t){}renderRowCells(e){}rerenderRowCells(e,t){}scrollColumns(e,t){}scrollRows(e,t){}resize(){}scrollToRow(e){}scrollToRowNearestTop(e){}visibleRows(e){return[]}rows(){return this.table.rowManager.getDisplayRows()}styleRow(e,t){var i=e.getElement();t%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"))}clear(){this.clearRows(),this.clearColumns()}render(){this.renderRows(),this.renderColumns()}rerender(e){this.rerenderRows(),this.rerenderColumns()}scrollToRowPosition(e,t,i){var s=this.rows().indexOf(e),r=e.getElement(),o=0;return new Promise((a,l)=>{if(s>-1){if(typeof i>"u"&&(i=this.table.options.scrollToRowIfVisible),!i&&P.elVisible(r)&&(o=P.elOffset(r).top-P.elOffset(this.elementVertical).top,o>0&&o<this.elementVertical.clientHeight-r.offsetHeight))return a(),!1;switch(typeof t>"u"&&(t=this.table.options.scrollToRowPosition),t==="nearest"&&(t=this.scrollToRowNearestTop(e)?"top":"bottom"),this.scrollToRow(e),t){case"middle":case"center":this.elementVertical.scrollHeight-this.elementVertical.scrollTop==this.elementVertical.clientHeight?this.elementVertical.scrollTop=this.elementVertical.scrollTop+(r.offsetTop-this.elementVertical.scrollTop)-(this.elementVertical.scrollHeight-r.offsetTop)/2:this.elementVertical.scrollTop=this.elementVertical.scrollTop-this.elementVertical.clientHeight/2;break;case"bottom":this.elementVertical.scrollHeight-this.elementVertical.scrollTop==this.elementVertical.clientHeight?this.elementVertical.scrollTop=this.elementVertical.scrollTop-(this.elementVertical.scrollHeight-r.offsetTop)+r.offsetHeight:this.elementVertical.scrollTop=this.elementVertical.scrollTop-this.elementVertical.clientHeight+r.offsetHeight;break;case"top":this.elementVertical.scrollTop=r.offsetTop;break}a()}else console.warn("Scroll Error - Row not visible"),l("Scroll Error - Row not visible")})}}class Va extends Kt{constructor(e){super(e)}renderRowCells(e,t){const i=document.createDocumentFragment();e.cells.forEach(s=>{i.appendChild(s.getElement())}),e.element.appendChild(i),t||e.cells.forEach(s=>{s.cellRendered()})}reinitializeColumnWidths(e){e.forEach(function(t){t.reinitializeWidth()})}}class Wa extends Kt{constructor(e){super(e),this.leftCol=0,this.rightCol=0,this.scrollLeft=0,this.vDomScrollPosLeft=0,this.vDomScrollPosRight=0,this.vDomPadLeft=0,this.vDomPadRight=0,this.fitDataColAvg=0,this.windowBuffer=200,this.visibleRows=null,this.initialized=!1,this.isFitData=!1,this.columns=[]}initialize(){this.compatibilityCheck(),this.layoutCheck(),this.vertScrollListen()}compatibilityCheck(){this.options("layout")=="fitDataTable"&&console.warn("Horizontal Virtual DOM is not compatible with fitDataTable layout mode"),this.options("responsiveLayout")&&console.warn("Horizontal Virtual DOM is not compatible with responsive columns"),this.options("rtl")&&console.warn("Horizontal Virtual DOM is not currently compatible with RTL text direction")}layoutCheck(){this.isFitData=this.options("layout").startsWith("fitData")}vertScrollListen(){this.subscribe("scroll-vertical",this.clearVisRowCache.bind(this)),this.subscribe("data-refreshed",this.clearVisRowCache.bind(this))}clearVisRowCache(){this.visibleRows=null}renderColumns(e,t){this.dataChange()}scrollColumns(e,t){this.scrollLeft!=e&&(this.scrollLeft=e,this.scroll(e-(this.vDomScrollPosLeft+this.windowBuffer)))}calcWindowBuffer(){var e=this.elementVertical.clientWidth;this.table.columnManager.columnsByIndex.forEach(t=>{if(t.visible){var i=t.getWidth();i>e&&(e=i)}}),this.windowBuffer=e*2}rerenderColumns(e,t){var i={cols:this.columns,leftCol:this.leftCol,rightCol:this.rightCol},s=0;e&&!this.initialized||(this.clear(),this.calcWindowBuffer(),this.scrollLeft=this.elementVertical.scrollLeft,this.vDomScrollPosLeft=this.scrollLeft-this.windowBuffer,this.vDomScrollPosRight=this.scrollLeft+this.elementVertical.clientWidth+this.windowBuffer,this.table.columnManager.columnsByIndex.forEach(r=>{var o={},a;r.visible&&(r.modules.frozen||(a=r.getWidth(),o.leftPos=s,o.rightPos=s+a,o.width=a,this.isFitData&&(o.fitDataCheck=r.modules.vdomHoz?r.modules.vdomHoz.fitDataCheck:!0),s+a>this.vDomScrollPosLeft&&s<this.vDomScrollPosRight?(this.leftCol==-1&&(this.leftCol=this.columns.length,this.vDomPadLeft=s),this.rightCol=this.columns.length):this.leftCol!==-1&&(this.vDomPadRight+=a),this.columns.push(r),r.modules.vdomHoz=o,s+=a))}),this.tableElement.style.paddingLeft=this.vDomPadLeft+"px",this.tableElement.style.paddingRight=this.vDomPadRight+"px",this.initialized=!0,t||(!e||this.reinitChanged(i))&&this.reinitializeRows(),this.elementVertical.scrollLeft=this.scrollLeft)}renderRowCells(e){if(this.initialized)this.initializeRow(e);else{const t=document.createDocumentFragment();e.cells.forEach(i=>{t.appendChild(i.getElement())}),e.element.appendChild(t),e.cells.forEach(i=>{i.cellRendered()})}}rerenderRowCells(e,t){this.reinitializeRow(e,t)}reinitializeColumnWidths(e){for(let t=this.leftCol;t<=this.rightCol;t++){let i=this.columns[t];i&&i.reinitializeWidth()}}deinitialize(){this.initialized=!1}clear(){this.columns=[],this.leftCol=-1,this.rightCol=0,this.vDomScrollPosLeft=0,this.vDomScrollPosRight=0,this.vDomPadLeft=0,this.vDomPadRight=0}dataChange(){var e=!1,t,i;if(this.isFitData){if(this.table.columnManager.columnsByIndex.forEach(s=>{!s.definition.width&&s.visible&&(e=!0)}),e&&this.table.rowManager.getDisplayRows().length&&(this.vDomScrollPosRight=this.scrollLeft+this.elementVertical.clientWidth+this.windowBuffer,t=this.chain("rows-sample",[1],[],()=>this.table.rowManager.getDisplayRows())[0],t)){i=t.getElement(),t.generateCells(),this.tableElement.appendChild(i);for(let s=0;s<t.cells.length;s++){let r=t.cells[s];i.appendChild(r.getElement()),r.column.reinitializeWidth()}i.parentNode.removeChild(i),this.rerenderColumns(!1,!0)}}else this.options("layout")==="fitColumns"&&(this.layoutRefresh(),this.rerenderColumns(!1,!0))}reinitChanged(e){var t=!0;return e.cols.length!==this.columns.length||e.leftCol!==this.leftCol||e.rightCol!==this.rightCol?!0:(e.cols.forEach((i,s)=>{i!==this.columns[s]&&(t=!1)}),!t)}reinitializeRows(){var e=this.getVisibleRows(),t=this.table.rowManager.getRows().filter(i=>!e.includes(i));e.forEach(i=>{this.reinitializeRow(i,!0)}),t.forEach(i=>{i.deinitialize()})}getVisibleRows(){return this.visibleRows||(this.visibleRows=this.table.rowManager.getVisibleRows()),this.visibleRows}scroll(e){this.vDomScrollPosLeft+=e,this.vDomScrollPosRight+=e,Math.abs(e)>this.windowBuffer/2?this.rerenderColumns():e>0?(this.addColRight(),this.removeColLeft()):(this.addColLeft(),this.removeColRight())}colPositionAdjust(e,t,i){for(let s=e;s<t;s++){let r=this.columns[s];r.modules.vdomHoz.leftPos+=i,r.modules.vdomHoz.rightPos+=i}}addColRight(){for(var e=!1,t=!0;t;){let i=this.columns[this.rightCol+1];i&&i.modules.vdomHoz.leftPos<=this.vDomScrollPosRight?(e=!0,this.getVisibleRows().forEach(s=>{if(s.type!=="group"){var r=s.getCell(i);s.getElement().insertBefore(r.getElement(),s.getCell(this.columns[this.rightCol]).getElement().nextSibling),r.cellRendered()}}),this.fitDataColActualWidthCheck(i),this.rightCol++,this.getVisibleRows().forEach(s=>{s.type!=="group"&&(s.modules.vdomHoz.rightCol=this.rightCol)}),this.rightCol>=this.columns.length-1?this.vDomPadRight=0:this.vDomPadRight-=i.getWidth()):t=!1}e&&(this.tableElement.style.paddingRight=this.vDomPadRight+"px")}addColLeft(){for(var e=!1,t=!0;t;){let i=this.columns[this.leftCol-1];if(i)if(i.modules.vdomHoz.rightPos>=this.vDomScrollPosLeft){e=!0,this.getVisibleRows().forEach(r=>{if(r.type!=="group"){var o=r.getCell(i);r.getElement().insertBefore(o.getElement(),r.getCell(this.columns[this.leftCol]).getElement()),o.cellRendered()}}),this.leftCol--,this.getVisibleRows().forEach(r=>{r.type!=="group"&&(r.modules.vdomHoz.leftCol=this.leftCol)}),this.leftCol<=0?this.vDomPadLeft=0:this.vDomPadLeft-=i.getWidth();let s=this.fitDataColActualWidthCheck(i);s&&(this.scrollLeft=this.elementVertical.scrollLeft=this.elementVertical.scrollLeft+s,this.vDomPadRight-=s)}else t=!1;else t=!1}e&&(this.tableElement.style.paddingLeft=this.vDomPadLeft+"px")}removeColRight(){for(var e=!1,t=!0;t;){let i=this.columns[this.rightCol];i&&i.modules.vdomHoz.leftPos>this.vDomScrollPosRight?(e=!0,this.getVisibleRows().forEach(s=>{if(s.type!=="group"){var r=s.getCell(i);try{s.getElement().removeChild(r.getElement())}catch(o){console.warn("Could not removeColRight",o.message)}}}),this.vDomPadRight+=i.getWidth(),this.rightCol--,this.getVisibleRows().forEach(s=>{s.type!=="group"&&(s.modules.vdomHoz.rightCol=this.rightCol)})):t=!1}e&&(this.tableElement.style.paddingRight=this.vDomPadRight+"px")}removeColLeft(){for(var e=!1,t=!0;t;){let i=this.columns[this.leftCol];i&&i.modules.vdomHoz.rightPos<this.vDomScrollPosLeft?(e=!0,this.getVisibleRows().forEach(s=>{if(s.type!=="group"){var r=s.getCell(i);try{s.getElement().removeChild(r.getElement())}catch(o){console.warn("Could not removeColLeft",o.message)}}}),this.vDomPadLeft+=i.getWidth(),this.leftCol++,this.getVisibleRows().forEach(s=>{s.type!=="group"&&(s.modules.vdomHoz.leftCol=this.leftCol)})):t=!1}e&&(this.tableElement.style.paddingLeft=this.vDomPadLeft+"px")}fitDataColActualWidthCheck(e){var t,i;return e.modules.vdomHoz.fitDataCheck&&(e.reinitializeWidth(),t=e.getWidth(),i=t-e.modules.vdomHoz.width,i&&(e.modules.vdomHoz.rightPos+=i,e.modules.vdomHoz.width=t,this.colPositionAdjust(this.columns.indexOf(e)+1,this.columns.length,i)),e.modules.vdomHoz.fitDataCheck=!1),i}initializeRow(e){if(e.type!=="group"){e.modules.vdomHoz={leftCol:this.leftCol,rightCol:this.rightCol},this.table.modules.frozenColumns&&this.table.modules.frozenColumns.leftColumns.forEach(t=>{this.appendCell(e,t)});for(let t=this.leftCol;t<=this.rightCol;t++)this.appendCell(e,this.columns[t]);this.table.modules.frozenColumns&&this.table.modules.frozenColumns.rightColumns.forEach(t=>{this.appendCell(e,t)})}}appendCell(e,t){if(t&&t.visible){let i=e.getCell(t);e.getElement().appendChild(i.getElement()),i.cellRendered()}}reinitializeRow(e,t){if(e.type!=="group"&&(t||!e.modules.vdomHoz||e.modules.vdomHoz.leftCol!==this.leftCol||e.modules.vdomHoz.rightCol!==this.rightCol)){for(var i=e.getElement();i.firstChild;)i.removeChild(i.firstChild);this.initializeRow(e)}}}class Ga extends j{constructor(e){super(e),this.blockHozScrollEvent=!1,this.headersElement=null,this.contentsElement=null,this.rowHeader=null,this.element=null,this.columns=[],this.columnsByIndex=[],this.columnsByField={},this.scrollLeft=0,this.optionsList=new Hn(this.table,"column definition",mn),this.redrawBlock=!1,this.redrawBlockUpdate=null,this.renderer=null}initialize(){this.initializeRenderer(),this.headersElement=this.createHeadersElement(),this.contentsElement=this.createHeaderContentsElement(),this.element=this.createHeaderElement(),this.contentsElement.insertBefore(this.headersElement,this.contentsElement.firstChild),this.element.insertBefore(this.contentsElement,this.element.firstChild),this.initializeScrollWheelWatcher(),this.subscribe("scroll-horizontal",this.scrollHorizontal.bind(this)),this.subscribe("scrollbar-vertical",this.padVerticalScrollbar.bind(this))}padVerticalScrollbar(e){this.table.rtl?this.headersElement.style.marginLeft=e+"px":this.headersElement.style.marginRight=e+"px"}initializeRenderer(){var e,t={virtual:Wa,basic:Va};typeof this.table.options.renderHorizontal=="string"?e=t[this.table.options.renderHorizontal]:e=this.table.options.renderHorizontal,e?(this.renderer=new e(this.table,this.element,this.tableElement),this.renderer.initialize()):console.error("Unable to find matching renderer:",this.table.options.renderHorizontal)}createHeadersElement(){var e=document.createElement("div");return e.classList.add("tabulator-headers"),e.setAttribute("role","row"),e}createHeaderContentsElement(){var e=document.createElement("div");return e.classList.add("tabulator-header-contents"),e.setAttribute("role","rowgroup"),e}createHeaderElement(){var e=document.createElement("div");return e.classList.add("tabulator-header"),e.setAttribute("role","rowgroup"),this.table.options.headerVisible||e.classList.add("tabulator-header-hidden"),e}getElement(){return this.element}getContentsElement(){return this.contentsElement}getHeadersElement(){return this.headersElement}scrollHorizontal(e){this.contentsElement.scrollLeft=e,this.scrollLeft=e,this.renderer.scrollColumns(e)}initializeScrollWheelWatcher(){this.contentsElement.addEventListener("wheel",e=>{var t;e.deltaX&&(t=this.contentsElement.scrollLeft+e.deltaX,this.table.rowManager.scrollHorizontal(t),this.table.columnManager.scrollHorizontal(t))})}generateColumnsFromRowData(e){var t=[],i={},s=this.table.options.autoColumns==="full"?e:[e[0]],r=this.table.options.autoColumnsDefinitions;if(e&&e.length){if(s.forEach(o=>{Object.keys(o).forEach((a,l)=>{let h=o[a],d;i[a]?i[a]!==!0&&typeof h<"u"&&(i[a].sorter=this.calculateSorterFromValue(h),i[a]=!0):(d={field:a,title:a,sorter:this.calculateSorterFromValue(h)},t.splice(l,0,d),i[a]=typeof h>"u"?d:!0)})}),r)switch(typeof r){case"function":this.table.options.columns=r.call(this.table,t);break;case"object":Array.isArray(r)?t.forEach(o=>{var a=r.find(l=>l.field===o.field);a&&Object.assign(o,a)}):t.forEach(o=>{r[o.field]&&Object.assign(o,r[o.field])}),this.table.options.columns=t;break}else this.table.options.columns=t;this.setColumns(this.table.options.columns)}}calculateSorterFromValue(e){var t;switch(typeof e){case"undefined":t="string";break;case"boolean":t="boolean";break;case"number":t="number";break;case"object":Array.isArray(e)?t="array":t="string";break;default:!isNaN(e)&&e!==""?t="number":e.match(/((^[0-9]+[a-z]+)|(^[a-z]+[0-9]+))+$/i)?t="alphanum":t="string";break}return t}setColumns(e,t){for(;this.headersElement.firstChild;)this.headersElement.removeChild(this.headersElement.firstChild);this.columns=[],this.columnsByIndex=[],this.columnsByField={},this.dispatch("columns-loading"),this.dispatchExternal("columnsLoading"),this.table.options.rowHeader&&(this.rowHeader=new Be(this.table.options.rowHeader===!0?{}:this.table.options.rowHeader,this,!0),this.columns.push(this.rowHeader),this.headersElement.appendChild(this.rowHeader.getElement()),this.rowHeader.columnRendered()),e.forEach((i,s)=>{this._addColumn(i)}),this._reIndexColumns(),this.dispatch("columns-loaded"),this.subscribedExternal("columnsLoaded")&&this.dispatchExternal("columnsLoaded",this.getComponents()),this.rerenderColumns(!1,!0),this.redraw(!0)}_addColumn(e,t,i){var s=new Be(e,this),r=s.getElement(),o=i&&this.findColumnIndex(i);if(t&&this.rowHeader&&(!i||i===this.rowHeader)&&(t=!1,i=this.rowHeader,o=0),i&&o>-1){var a=i.getTopColumn(),l=this.columns.indexOf(a),h=a.getElement();t?(this.columns.splice(l,0,s),h.parentNode.insertBefore(r,h)):(this.columns.splice(l+1,0,s),h.parentNode.insertBefore(r,h.nextSibling))}else t?(this.columns.unshift(s),this.headersElement.insertBefore(s.getElement(),this.headersElement.firstChild)):(this.columns.push(s),this.headersElement.appendChild(s.getElement()));return s.columnRendered(),s}registerColumnField(e){e.definition.field&&(this.columnsByField[e.definition.field]=e)}registerColumnPosition(e){this.columnsByIndex.push(e)}_reIndexColumns(){this.columnsByIndex=[],this.columns.forEach(function(e){e.reRegisterPosition()})}verticalAlignHeaders(){var e=0;this.redrawBlock||(this.headersElement.style.height="",this.columns.forEach(t=>{t.clearVerticalAlign()}),this.columns.forEach(t=>{var i=t.getHeight();i>e&&(e=i)}),this.headersElement.style.height=e+"px",this.columns.forEach(t=>{t.verticalAlign(this.table.options.columnHeaderVertAlign,e)}),this.table.rowManager.adjustTableSize())}findColumn(e){var t;if(typeof e=="object"){if(e instanceof Be)return e;if(e instanceof gn)return e._getSelf()||!1;if(typeof HTMLElement<"u"&&e instanceof HTMLElement)return t=[],this.columns.forEach(s=>{t.push(s),t=t.concat(s.getColumns(!0))}),t.find(s=>s.element===e)||!1}else return this.columnsByField[e]||!1;return!1}getColumnByField(e){return this.columnsByField[e]}getColumnsByFieldRoot(e){var t=[];return Object.keys(this.columnsByField).forEach(i=>{var s=this.table.options.nestedFieldSeparator?i.split(this.table.options.nestedFieldSeparator)[0]:i;s===e&&t.push(this.columnsByField[i])}),t}getColumnByIndex(e){return this.columnsByIndex[e]}getFirstVisibleColumn(){var e=this.columnsByIndex.findIndex(t=>t.visible);return e>-1?this.columnsByIndex[e]:!1}getVisibleColumnsByIndex(){return this.columnsByIndex.filter(e=>e.visible)}getColumns(){return this.columns}findColumnIndex(e){return this.columnsByIndex.findIndex(t=>e===t)}getRealColumns(){return this.columnsByIndex}traverse(e){this.columnsByIndex.forEach((t,i)=>{e(t,i)})}getDefinitions(e){var t=[];return this.columnsByIndex.forEach(i=>{(!e||e&&i.visible)&&t.push(i.getDefinition())}),t}getDefinitionTree(){var e=[];return this.columns.forEach(t=>{e.push(t.getDefinition(!0))}),e}getComponents(e){var t=[],i=e?this.columns:this.columnsByIndex;return i.forEach(s=>{t.push(s.getComponent())}),t}getWidth(){var e=0;return this.columnsByIndex.forEach(t=>{t.visible&&(e+=t.getWidth())}),e}moveColumn(e,t,i){t.element.parentNode.insertBefore(e.element,t.element),i&&t.element.parentNode.insertBefore(t.element,e.element),this.moveColumnActual(e,t,i),this.verticalAlignHeaders(),this.table.rowManager.reinitialize()}moveColumnActual(e,t,i){e.parent.isGroup?this._moveColumnInArray(e.parent.columns,e,t,i):this._moveColumnInArray(this.columns,e,t,i),this._moveColumnInArray(this.columnsByIndex,e,t,i,!0),this.rerenderColumns(!0),this.dispatch("column-moved",e,t,i),this.subscribedExternal("columnMoved")&&this.dispatchExternal("columnMoved",e.getComponent(),this.table.columnManager.getComponents())}_moveColumnInArray(e,t,i,s,r){var o=e.indexOf(t),a,l=[];o>-1&&(e.splice(o,1),a=e.indexOf(i),a>-1?s&&(a=a+1):a=o,e.splice(a,0,t),r&&(l=this.chain("column-moving-rows",[t,i,s],null,[])||[],l=l.concat(this.table.rowManager.rows),l.forEach(function(h){if(h.cells.length){var d=h.cells.splice(o,1)[0];h.cells.splice(a,0,d)}})))}scrollToColumn(e,t,i){var s=0,r=e.getLeftOffset(),o=0,a=e.getElement();return new Promise((l,h)=>{if(typeof t>"u"&&(t=this.table.options.scrollToColumnPosition),typeof i>"u"&&(i=this.table.options.scrollToColumnIfVisible),e.visible){switch(t){case"middle":case"center":o=-this.element.clientWidth/2;break;case"right":o=a.clientWidth-this.headersElement.clientWidth;break}if(!i&&r>0&&r+a.offsetWidth<this.element.clientWidth)return!1;s=r+o,s=Math.max(Math.min(s,this.table.rowManager.element.scrollWidth-this.table.rowManager.element.clientWidth),0),this.table.rowManager.scrollHorizontal(s),this.scrollHorizontal(s),l()}else console.warn("Scroll Error - Column not visible"),h("Scroll Error - Column not visible")})}generateCells(e){var t=[];return this.columnsByIndex.forEach(i=>{t.push(i.generateCell(e))}),t}getFlexBaseWidth(){var e=this.table.element.clientWidth,t=0;return this.table.rowManager.element.scrollHeight>this.table.rowManager.element.clientHeight&&(e-=this.table.rowManager.element.offsetWidth-this.table.rowManager.element.clientWidth),this.columnsByIndex.forEach(function(i){var s,r,o;i.visible&&(s=i.definition.width||0,r=parseInt(i.minWidth),typeof s=="string"?s.indexOf("%")>-1?o=e/100*parseInt(s):o=parseInt(s):o=s,t+=o>r?o:r)}),t}addColumn(e,t,i){return new Promise((s,r)=>{var o=this._addColumn(e,t,i);this._reIndexColumns(),this.dispatch("column-add",e,t,i),this.layoutMode()!="fitColumns"&&o.reinitializeWidth(),this.redraw(!0),this.table.rowManager.reinitialize(),this.rerenderColumns(),s(o)})}deregisterColumn(e){var t=e.getField(),i;t&&delete this.columnsByField[t],i=this.columnsByIndex.indexOf(e),i>-1&&this.columnsByIndex.splice(i,1),i=this.columns.indexOf(e),i>-1&&this.columns.splice(i,1),this.verticalAlignHeaders(),this.redraw()}rerenderColumns(e,t){this.redrawBlock?(e===!1||e===!0&&this.redrawBlockUpdate===null)&&(this.redrawBlockUpdate=e):this.renderer.rerenderColumns(e,t)}blockRedraw(){this.redrawBlock=!0,this.redrawBlockUpdate=null}restoreRedraw(){this.redrawBlock=!1,this.verticalAlignHeaders(),this.renderer.rerenderColumns(this.redrawBlockUpdate)}redraw(e){P.elVisible(this.element)&&this.verticalAlignHeaders(),e&&(this.table.rowManager.resetScroll(),this.table.rowManager.reinitialize()),this.confirm("table-redrawing",e)||this.layoutRefresh(e),this.dispatch("table-redraw",e),this.table.footerManager.redraw()}}class ja extends Kt{constructor(e){super(e),this.verticalFillMode="fill",this.scrollTop=0,this.scrollLeft=0,this.scrollTop=0,this.scrollLeft=0}clearRows(){for(var e=this.tableElement;e.firstChild;)e.removeChild(e.firstChild);e.scrollTop=0,e.scrollLeft=0,e.style.minWidth="",e.style.minHeight="",e.style.display="",e.style.visibility=""}renderRows(){var e=this.tableElement,t=!0,i=document.createDocumentFragment(),s=this.rows();s.forEach((r,o)=>{this.styleRow(r,o),r.initialize(!1,!0),r.type!=="group"&&(t=!1),i.appendChild(r.getElement())}),e.appendChild(i),s.forEach(r=>{r.rendered(),r.heightInitialized||r.calcHeight(!0)}),s.forEach(r=>{r.heightInitialized||r.setCellHeight()}),t?e.style.minWidth=this.table.columnManager.getWidth()+"px":e.style.minWidth=""}rerenderRows(e){this.clearRows(),e&&e(),this.renderRows(),this.rows().length||this.table.rowManager.tableEmpty()}scrollToRowNearestTop(e){var t=P.elOffset(e.getElement()).top;return!(Math.abs(this.elementVertical.scrollTop-t)>Math.abs(this.elementVertical.scrollTop+this.elementVertical.clientHeight-t))}scrollToRow(e){var t=e.getElement();this.elementVertical.scrollTop=P.elOffset(t).top-P.elOffset(this.elementVertical).top+this.elementVertical.scrollTop}visibleRows(e){return this.rows()}}class Ua extends Kt{constructor(e){super(e),this.verticalFillMode="fill",this.scrollTop=0,this.scrollLeft=0,this.vDomRowHeight=20,this.vDomTop=0,this.vDomBottom=0,this.vDomScrollPosTop=0,this.vDomScrollPosBottom=0,this.vDomTopPad=0,this.vDomBottomPad=0,this.vDomMaxRenderChain=90,this.vDomWindowBuffer=0,this.vDomWindowMinTotalRows=20,this.vDomWindowMinMarginRows=5,this.vDomTopNewRows=[],this.vDomBottomNewRows=[]}clearRows(){for(var e=this.tableElement;e.firstChild;)e.removeChild(e.firstChild);e.style.paddingTop="",e.style.paddingBottom="",e.style.minHeight="",e.style.display="",e.style.visibility="",this.elementVertical.scrollTop=0,this.elementVertical.scrollLeft=0,this.scrollTop=0,this.scrollLeft=0,this.vDomTop=0,this.vDomBottom=0,this.vDomTopPad=0,this.vDomBottomPad=0,this.vDomScrollPosTop=0,this.vDomScrollPosBottom=0}renderRows(){this._virtualRenderFill()}rerenderRows(e){for(var t=this.elementVertical.scrollTop,i=!1,s=!1,r=this.table.rowManager.scrollLeft,o=this.rows(),a=this.vDomTop;a<=this.vDomBottom;a++)if(o[a]){var l=t-o[a].getElement().offsetTop;if(s===!1||Math.abs(l)<s)s=l,i=a;else break}o.forEach(h=>{h.deinitializeHeight()}),e&&e(),this.rows().length?this._virtualRenderFill(i===!1?this.rows.length-1:i,!0,s||0):(this.clear(),this.table.rowManager.tableEmpty()),this.scrollColumns(r)}scrollColumns(e){this.table.rowManager.scrollHorizontal(e)}scrollRows(e,t){var i=e-this.vDomScrollPosTop,s=e-this.vDomScrollPosBottom,r=this.vDomWindowBuffer*2,o=this.rows();if(this.scrollTop=e,-i>r||s>r){var a=this.table.rowManager.scrollLeft;this._virtualRenderFill(Math.floor(this.elementVertical.scrollTop/this.elementVertical.scrollHeight*o.length)),this.scrollColumns(a)}else t?(i<0&&this._addTopRow(o,-i),s<0&&(this.vDomScrollHeight-this.scrollTop>this.vDomWindowBuffer?this._removeBottomRow(o,-s):this.vDomScrollPosBottom=this.scrollTop)):(s>=0&&this._addBottomRow(o,s),i>=0&&(this.scrollTop>this.vDomWindowBuffer?this._removeTopRow(o,i):this.vDomScrollPosTop=this.scrollTop))}resize(){this.vDomWindowBuffer=this.table.options.renderVerticalBuffer||this.elementVertical.clientHeight}scrollToRowNearestTop(e){var t=this.rows().indexOf(e);return!(Math.abs(this.vDomTop-t)>Math.abs(this.vDomBottom-t))}scrollToRow(e){var t=this.rows().indexOf(e);t>-1&&this._virtualRenderFill(t,!0)}visibleRows(e){var t=this.elementVertical.scrollTop,i=this.elementVertical.clientHeight+t,s=!1,r=0,o=0,a=this.rows();if(e)r=this.vDomTop,o=this.vDomBottom;else for(var l=this.vDomTop;l<=this.vDomBottom;l++)if(a[l])if(s)if(i-a[l].getElement().offsetTop>=0)o=l;else break;else if(t-a[l].getElement().offsetTop>=0)r=l;else if(s=!0,i-a[l].getElement().offsetTop>=0)o=l;else break;return a.slice(r,o+1)}_virtualRenderFill(e,t,i){var s=this.tableElement,r=this.elementVertical,o=0,a=0,l=0,h=0,d=0,c=0,u=this.rows(),f=u.length,p=0,m,b,g=[],R=0,E=0,v=this.table.rowManager.fixedHeight,C=this.elementVertical.clientHeight,k=this.table.options.rowHeight,y=!0;if(e=e||0,i=i||0,!e)this.clear();else{for(;s.firstChild;)s.removeChild(s.firstChild);h=(f-e+1)*this.vDomRowHeight,h<C&&(e-=Math.ceil((C-h)/this.vDomRowHeight),e<0&&(e=0)),o=Math.min(Math.max(Math.floor(this.vDomWindowBuffer/this.vDomRowHeight),this.vDomWindowMinMarginRows),e),e-=o}if(f&&P.elVisible(this.elementVertical)){for(this.vDomTop=e,this.vDomBottom=e-1,v||this.table.options.maxHeight?(k&&(E=C/k+this.vDomWindowBuffer/k),E=Math.max(this.vDomWindowMinTotalRows,Math.ceil(E))):E=f;(E==f||a<=C+this.vDomWindowBuffer||R<this.vDomWindowMinTotalRows)&&this.vDomBottom<f-1;){for(g=[],b=document.createDocumentFragment(),c=0;c<E&&this.vDomBottom<f-1;)p=this.vDomBottom+1,m=u[p],this.styleRow(m,p),m.initialize(!1,!0),!m.heightInitialized&&!this.table.options.rowHeight&&m.clearCellHeight(),b.appendChild(m.getElement()),g.push(m),this.vDomBottom++,c++;if(!g.length)break;s.appendChild(b),g.forEach(_=>{_.rendered(),_.heightInitialized||_.calcHeight(!0)}),g.forEach(_=>{_.heightInitialized||_.setCellHeight()}),g.forEach(_=>{l=_.getHeight(),R<o?d+=l:a+=l,l>this.vDomWindowBuffer&&(this.vDomWindowBuffer=l*2),R++}),y=this.table.rowManager.adjustTableSize(),C=this.elementVertical.clientHeight,y&&(v||this.table.options.maxHeight)&&(k=a/R,E=Math.max(this.vDomWindowMinTotalRows,Math.ceil(C/k+this.vDomWindowBuffer/k)))}e?(this.vDomTopPad=t?this.vDomRowHeight*this.vDomTop+i:this.scrollTop-d,this.vDomBottomPad=this.vDomBottom==f-1?0:Math.max(this.vDomScrollHeight-this.vDomTopPad-a-d,0)):(this.vDomTopPad=0,this.vDomRowHeight=Math.floor((a+d)/R),this.vDomBottomPad=this.vDomRowHeight*(f-this.vDomBottom-1),this.vDomScrollHeight=d+a+this.vDomBottomPad-C),s.style.paddingTop=this.vDomTopPad+"px",s.style.paddingBottom=this.vDomBottomPad+"px",t&&(this.scrollTop=this.vDomTopPad+d+i-(this.elementVertical.scrollWidth>this.elementVertical.clientWidth?this.elementVertical.offsetHeight-C:0)),this.scrollTop=Math.min(this.scrollTop,this.elementVertical.scrollHeight-C),this.elementVertical.scrollWidth>this.elementVertical.clientWidth&&t&&(this.scrollTop+=this.elementVertical.offsetHeight-C),this.vDomScrollPosTop=this.scrollTop,this.vDomScrollPosBottom=this.scrollTop,r.scrollTop=this.scrollTop,this.dispatch("render-virtual-fill")}}_addTopRow(e,t){for(var i=this.tableElement,s=[],r=0,o=this.vDomTop-1,a=0,l=!0;l;)if(this.vDomTop){let h=e[o],d,c;h&&a<this.vDomMaxRenderChain?(d=h.getHeight()||this.vDomRowHeight,c=h.initialized,t>=d?(this.styleRow(h,o),i.insertBefore(h.getElement(),i.firstChild),(!h.initialized||!h.heightInitialized)&&s.push(h),h.initialize(),c||(d=h.getElement().offsetHeight,d>this.vDomWindowBuffer&&(this.vDomWindowBuffer=d*2)),t-=d,r+=d,this.vDomTop--,o--,a++):l=!1):l=!1}else l=!1;for(let h of s)h.clearCellHeight();this._quickNormalizeRowHeight(s),r&&(this.vDomTopPad-=r,this.vDomTopPad<0&&(this.vDomTopPad=o*this.vDomRowHeight),o<1&&(this.vDomTopPad=0),i.style.paddingTop=this.vDomTopPad+"px",this.vDomScrollPosTop-=r)}_removeTopRow(e,t){for(var i=[],s=0,r=0,o=!0;o;){let a=e[this.vDomTop],l;a&&r<this.vDomMaxRenderChain?(l=a.getHeight()||this.vDomRowHeight,t>=l?(this.vDomTop++,t-=l,s+=l,i.push(a),r++):o=!1):o=!1}for(let a of i){let l=a.getElement();l.parentNode&&l.parentNode.removeChild(l)}s&&(this.vDomTopPad+=s,this.tableElement.style.paddingTop=this.vDomTopPad+"px",this.vDomScrollPosTop+=this.vDomTop?s:s+this.vDomWindowBuffer)}_addBottomRow(e,t){for(var i=this.tableElement,s=[],r=0,o=this.vDomBottom+1,a=0,l=!0;l;){let h=e[o],d,c;h&&a<this.vDomMaxRenderChain?(d=h.getHeight()||this.vDomRowHeight,c=h.initialized,t>=d?(this.styleRow(h,o),i.appendChild(h.getElement()),(!h.initialized||!h.heightInitialized)&&s.push(h),h.initialize(),c||(d=h.getElement().offsetHeight,d>this.vDomWindowBuffer&&(this.vDomWindowBuffer=d*2)),t-=d,r+=d,this.vDomBottom++,o++,a++):l=!1):l=!1}for(let h of s)h.clearCellHeight();this._quickNormalizeRowHeight(s),r&&(this.vDomBottomPad-=r,(this.vDomBottomPad<0||o==e.length-1)&&(this.vDomBottomPad=0),i.style.paddingBottom=this.vDomBottomPad+"px",this.vDomScrollPosBottom+=r)}_removeBottomRow(e,t){for(var i=[],s=0,r=0,o=!0;o;){let a=e[this.vDomBottom],l;a&&r<this.vDomMaxRenderChain?(l=a.getHeight()||this.vDomRowHeight,t>=l?(this.vDomBottom--,t-=l,s+=l,i.push(a),r++):o=!1):o=!1}for(let a of i){let l=a.getElement();l.parentNode&&l.parentNode.removeChild(l)}s&&(this.vDomBottomPad+=s,this.vDomBottomPad<0&&(this.vDomBottomPad=0),this.tableElement.style.paddingBottom=this.vDomBottomPad+"px",this.vDomScrollPosBottom-=s)}_quickNormalizeRowHeight(e){for(let t of e)t.calcHeight();for(let t of e)t.setCellHeight()}}class $a extends j{constructor(e){super(e),this.element=this.createHolderElement(),this.tableElement=this.createTableElement(),this.heightFixer=this.createTableElement(),this.placeholder=null,this.placeholderContents=null,this.firstRender=!1,this.renderMode="virtual",this.fixedHeight=!1,this.rows=[],this.activeRowsPipeline=[],this.activeRows=[],this.activeRowsCount=0,this.displayRows=[],this.displayRowsCount=0,this.scrollTop=0,this.scrollLeft=0,this.redrawBlock=!1,this.redrawBlockRestoreConfig=!1,this.redrawBlockRenderInPosition=!1,this.dataPipeline=[],this.displayPipeline=[],this.scrollbarWidth=0,this.renderer=null}createHolderElement(){var e=document.createElement("div");return e.classList.add("tabulator-tableholder"),e.setAttribute("tabindex",0),e}createTableElement(){var e=document.createElement("div");return e.classList.add("tabulator-table"),e.setAttribute("role","rowgroup"),e}initializePlaceholder(){var e=this.table.options.placeholder;if(typeof e=="function"&&(e=e.call(this.table)),e=this.chain("placeholder",[e],e,e)||e,e){let t=document.createElement("div");if(t.classList.add("tabulator-placeholder"),typeof e=="string"){let i=document.createElement("div");i.classList.add("tabulator-placeholder-contents"),i.innerHTML=e,t.appendChild(i),this.placeholderContents=i}else typeof HTMLElement<"u"&&e instanceof HTMLElement?(t.appendChild(e),this.placeholderContents=e):(console.warn("Invalid placeholder provided, must be string or HTML Element",e),this.el=null);this.placeholder=t}}getElement(){return this.element}getTableElement(){return this.tableElement}initialize(){this.initializePlaceholder(),this.initializeRenderer(),this.element.appendChild(this.tableElement),this.firstRender=!0,this.element.addEventListener("scroll",()=>{var e=this.element.scrollLeft,t=this.scrollLeft>e,i=this.element.scrollTop,s=this.scrollTop>i;this.scrollLeft!=e&&(this.scrollLeft=e,this.dispatch("scroll-horizontal",e,t),this.dispatchExternal("scrollHorizontal",e,t),this._positionPlaceholder()),this.scrollTop!=i&&(this.scrollTop=i,this.renderer.scrollRows(i,s),this.dispatch("scroll-vertical",i,s),this.dispatchExternal("scrollVertical",i,s))})}findRow(e){if(typeof e=="object"){if(e instanceof U)return e;if(e instanceof Zt)return e._getSelf()||!1;if(typeof HTMLElement<"u"&&e instanceof HTMLElement)return this.rows.find(i=>i.getElement()===e)||!1;if(e===null)return!1}else return typeof e>"u"?!1:this.rows.find(i=>i.data[this.table.options.index]==e)||!1;return!1}getRowFromDataObject(e){var t=this.rows.find(i=>i.data===e);return t||!1}getRowFromPosition(e){return this.getDisplayRows().find(t=>t.type==="row"&&t.getPosition()===e&&t.isDisplayed())}scrollToRow(e,t,i){return this.renderer.scrollToRowPosition(e,t,i)}setData(e,t,i){return new Promise((s,r)=>{t&&this.getDisplayRows().length?this.table.options.pagination?this._setDataActual(e,!0):this.reRenderInPosition(()=>{this._setDataActual(e)}):(this.table.options.autoColumns&&i&&this.table.initialized&&this.table.columnManager.generateColumnsFromRowData(e),this.resetScroll(),this._setDataActual(e)),s()})}_setDataActual(e,t){this.dispatchExternal("dataProcessing",e),this._wipeElements(),Array.isArray(e)?(this.dispatch("data-processing",e),e.forEach((i,s)=>{if(i&&typeof i=="object"){var r=new U(i,this);this.rows.push(r)}else console.warn("Data Loading Warning - Invalid row data detected and ignored, expecting object but received:",i)}),this.refreshActiveData(!1,!1,t),this.dispatch("data-processed",e),this.dispatchExternal("dataProcessed",e)):console.error(`Data Loading Error - Unable to process data due to invalid data type 
Expecting: array 
Received: `,typeof e,`
Data:     `,e)}_wipeElements(){this.dispatch("rows-wipe"),this.destroy(),this.adjustTableSize(),this.dispatch("rows-wiped")}destroy(){this.rows.forEach(e=>{e.wipe()}),this.rows=[],this.activeRows=[],this.activeRowsPipeline=[],this.activeRowsCount=0,this.displayRows=[],this.displayRowsCount=0}deleteRow(e,t){var i=this.rows.indexOf(e),s=this.activeRows.indexOf(e);s>-1&&this.activeRows.splice(s,1),i>-1&&this.rows.splice(i,1),this.setActiveRows(this.activeRows),this.displayRowIterator(r=>{var o=r.indexOf(e);o>-1&&r.splice(o,1)}),t||this.reRenderInPosition(),this.regenerateRowPositions(),this.dispatchExternal("rowDeleted",e.getComponent()),this.displayRowsCount||this.tableEmpty(),this.subscribedExternal("dataChanged")&&this.dispatchExternal("dataChanged",this.getData())}addRow(e,t,i,s){var r=this.addRowActual(e,t,i,s);return r}addRows(e,t,i,s){var r=[];return new Promise((o,a)=>{t=this.findAddRowPos(t),Array.isArray(e)||(e=[e]),(typeof i>"u"&&t||typeof i<"u"&&!t)&&e.reverse(),e.forEach((l,h)=>{var d=this.addRow(l,t,i,!0);r.push(d),this.dispatch("row-added",d,l,t,i)}),this.refreshActiveData(s?"displayPipeline":!1,!1,!0),this.regenerateRowPositions(),this.displayRowsCount&&this._clearPlaceholder(),o(r)})}findAddRowPos(e){return typeof e>"u"&&(e=this.table.options.addRowPos),e==="pos"&&(e=!0),e==="bottom"&&(e=!1),e}addRowActual(e,t,i,s){var r=e instanceof U?e:new U(e||{},this),o=this.findAddRowPos(t),a=-1,l,h;return i||(h=this.chain("row-adding-position",[r,o],null,{index:i,top:o}),i=h.index,o=h.top),typeof i<"u"&&(i=this.findRow(i)),i=this.chain("row-adding-index",[r,i,o],null,i),i&&(a=this.rows.indexOf(i)),i&&a>-1?(l=this.activeRows.indexOf(i),this.displayRowIterator(function(d){var c=d.indexOf(i);c>-1&&d.splice(o?c:c+1,0,r)}),l>-1&&this.activeRows.splice(o?l:l+1,0,r),this.rows.splice(o?a:a+1,0,r)):o?(this.displayRowIterator(function(d){d.unshift(r)}),this.activeRows.unshift(r),this.rows.unshift(r)):(this.displayRowIterator(function(d){d.push(r)}),this.activeRows.push(r),this.rows.push(r)),this.setActiveRows(this.activeRows),this.dispatchExternal("rowAdded",r.getComponent()),this.subscribedExternal("dataChanged")&&this.dispatchExternal("dataChanged",this.table.rowManager.getData()),s||this.reRenderInPosition(),r}moveRow(e,t,i){this.dispatch("row-move",e,t,i),this.moveRowActual(e,t,i),this.regenerateRowPositions(),this.dispatch("row-moved",e,t,i),this.dispatchExternal("rowMoved",e.getComponent())}moveRowActual(e,t,i){this.moveRowInArray(this.rows,e,t,i),this.moveRowInArray(this.activeRows,e,t,i),this.displayRowIterator(s=>{this.moveRowInArray(s,e,t,i)}),this.dispatch("row-moving",e,t,i)}moveRowInArray(e,t,i,s){var r,o,a,l;if(t!==i&&(r=e.indexOf(t),r>-1&&(e.splice(r,1),o=e.indexOf(i),o>-1?s?e.splice(o+1,0,t):e.splice(o,0,t):e.splice(r,0,t)),e===this.getDisplayRows())){a=r<o?r:o,l=o>r?o:r+1;for(let h=a;h<=l;h++)e[h]&&this.styleRow(e[h],h)}}clearData(){this.setData([])}getRowIndex(e){return this.findRowIndex(e,this.rows)}getDisplayRowIndex(e){var t=this.getDisplayRows().indexOf(e);return t>-1?t:!1}nextDisplayRow(e,t){var i=this.getDisplayRowIndex(e),s=!1;return i!==!1&&i<this.displayRowsCount-1&&(s=this.getDisplayRows()[i+1]),s&&(!(s instanceof U)||s.type!="row")?this.nextDisplayRow(s,t):s}prevDisplayRow(e,t){var i=this.getDisplayRowIndex(e),s=!1;return i&&(s=this.getDisplayRows()[i-1]),t&&s&&(!(s instanceof U)||s.type!="row")?this.prevDisplayRow(s,t):s}findRowIndex(e,t){var i;return e=this.findRow(e),e&&(i=t.indexOf(e),i>-1)?i:!1}getData(e,t){var i=[],s=this.getRows(e);return s.forEach(function(r){r.type=="row"&&i.push(r.getData(t||"data"))}),i}getComponents(e){var t=[],i=this.getRows(e);return i.forEach(function(s){t.push(s.getComponent())}),t}getDataCount(e){var t=this.getRows(e);return t.length}scrollHorizontal(e){this.scrollLeft=e,this.element.scrollLeft=e,this.dispatch("scroll-horizontal",e)}registerDataPipelineHandler(e,t){typeof t<"u"?(this.dataPipeline.push({handler:e,priority:t}),this.dataPipeline.sort((i,s)=>i.priority-s.priority)):console.error("Data pipeline handlers must have a priority in order to be registered")}registerDisplayPipelineHandler(e,t){typeof t<"u"?(this.displayPipeline.push({handler:e,priority:t}),this.displayPipeline.sort((i,s)=>i.priority-s.priority)):console.error("Display pipeline handlers must have a priority in order to be registered")}refreshActiveData(e,t,i){var s=this.table,r="",o=0,a=["all","dataPipeline","display","displayPipeline","end"];if(!this.table.destroyed){if(typeof e=="function")if(o=this.dataPipeline.findIndex(l=>l.handler===e),o>-1)r="dataPipeline",t&&(o==this.dataPipeline.length-1?r="display":o++);else if(o=this.displayPipeline.findIndex(l=>l.handler===e),o>-1)r="displayPipeline",t&&(o==this.displayPipeline.length-1?r="end":o++);else{console.error("Unable to refresh data, invalid handler provided",e);return}else r=e||"all",o=0;if(this.redrawBlock){(!this.redrawBlockRestoreConfig||this.redrawBlockRestoreConfig&&(this.redrawBlockRestoreConfig.stage===r&&o<this.redrawBlockRestoreConfig.index||a.indexOf(r)<a.indexOf(this.redrawBlockRestoreConfig.stage)))&&(this.redrawBlockRestoreConfig={handler:e,skipStage:t,renderInPosition:i,stage:r,index:o});return}else P.elVisible(this.element)?i?this.reRenderInPosition(this.refreshPipelines.bind(this,e,r,o,i)):(this.refreshPipelines(e,r,o,i),e||this.table.columnManager.renderer.renderColumns(),this.renderTable(),s.options.layoutColumnsOnNewData&&this.table.columnManager.redraw(!0)):this.refreshPipelines(e,r,o,i),this.dispatch("data-refreshed")}}refreshPipelines(e,t,i,s){switch(this.dispatch("data-refreshing"),(!e||!this.activeRowsPipeline[0])&&(this.activeRowsPipeline[0]=this.rows.slice(0)),t){case"all":case"dataPipeline":for(let r=i;r<this.dataPipeline.length;r++){let o=this.dataPipeline[r].handler(this.activeRowsPipeline[r].slice(0));this.activeRowsPipeline[r+1]=o||this.activeRowsPipeline[r].slice(0)}this.setActiveRows(this.activeRowsPipeline[this.dataPipeline.length]);case"display":i=0,this.resetDisplayRows();case"displayPipeline":for(let r=i;r<this.displayPipeline.length;r++){let o=this.displayPipeline[r].handler((r?this.getDisplayRows(r-1):this.activeRows).slice(0),s);this.setDisplayRows(o||this.getDisplayRows(r-1).slice(0),r)}case"end":this.regenerateRowPositions()}this.getDisplayRows().length&&this._clearPlaceholder()}regenerateRowPositions(){var e=this.getDisplayRows(),t=1;e.forEach(i=>{i.type==="row"&&(i.setPosition(t),t++)})}setActiveRows(e){this.activeRows=this.activeRows=Object.assign([],e),this.activeRowsCount=this.activeRows.length}resetDisplayRows(){this.displayRows=[],this.displayRows.push(this.activeRows.slice(0)),this.displayRowsCount=this.displayRows[0].length}setDisplayRows(e,t){this.displayRows[t]=e,t==this.displayRows.length-1&&(this.displayRowsCount=this.displayRows[this.displayRows.length-1].length)}getDisplayRows(e){return typeof e>"u"?this.displayRows.length?this.displayRows[this.displayRows.length-1]:[]:this.displayRows[e]||[]}getVisibleRows(e,t){var i=Object.assign([],this.renderer.visibleRows(!t));return e&&(i=this.chain("rows-visible",[t],i,i)),i}displayRowIterator(e){this.activeRowsPipeline.forEach(e),this.displayRows.forEach(e),this.displayRowsCount=this.displayRows[this.displayRows.length-1].length}getRows(e){var t=[];switch(e){case"active":t=this.activeRows;break;case"display":t=this.table.rowManager.getDisplayRows();break;case"visible":t=this.getVisibleRows(!1,!0);break;default:t=this.chain("rows-retrieve",e,null,this.rows)||this.rows}return t}reRenderInPosition(e){this.redrawBlock?e?e():this.redrawBlockRenderInPosition=!0:(this.dispatchExternal("renderStarted"),this.renderer.rerenderRows(e),this.fixedHeight||this.adjustTableSize(),this.scrollBarCheck(),this.dispatchExternal("renderComplete"))}scrollBarCheck(){var e=0;this.element.scrollHeight>this.element.clientHeight&&(e=this.element.offsetWidth-this.element.clientWidth),e!==this.scrollbarWidth&&(this.scrollbarWidth=e,this.dispatch("scrollbar-vertical",e))}initializeRenderer(){var e,t={virtual:Ua,basic:ja};typeof this.table.options.renderVertical=="string"?e=t[this.table.options.renderVertical]:e=this.table.options.renderVertical,e?(this.renderMode=this.table.options.renderVertical,this.renderer=new e(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(e,t){var i=e.getElement();t%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(e){this.activeRows.forEach(function(t){t.normalizeHeight(e)})}adjustTableSize(){let e=this.element.clientHeight,t,i=!1;if(this.renderer.verticalFillMode==="fill"){let s=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){t=isNaN(this.table.options.minHeight)?this.table.options.minHeight:this.table.options.minHeight+"px";const r="calc(100% - "+s+"px)";this.element.style.minHeight=t||"calc(100% - "+s+"px)",this.element.style.height=r,this.element.style.maxHeight=r}else this.element.style.height="",this.element.style.height=this.table.element.clientHeight-s+"px",this.element.scrollTop=this.scrollTop;this.renderer.resize(),!this.fixedHeight&&e!=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(e){e.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(e){this.adjustTableSize(),this.table.tableWidth=this.table.element.clientWidth,e?this.renderTable():(this.reRenderInPosition(),this.scrollHorizontal(this.scrollLeft))}resetScroll(){if(this.element.scrollLeft=0,this.element.scrollTop=0,this.table.browser==="ie"){var e=document.createEvent("Event");e.initEvent("scroll",!1,!0),this.element.dispatchEvent(e)}else this.element.dispatchEvent(new Event("scroll"))}}class Za extends j{constructor(e){super(e),this.active=!1,this.element=this.createElement(),this.containerElement=this.createContainerElement(),this.external=!1}initialize(){this.initializeElement()}createElement(){var e=document.createElement("div");return e.classList.add("tabulator-footer"),e}createContainerElement(){var e=document.createElement("div");return e.classList.add("tabulator-footer-contents"),this.element.appendChild(e),e}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(e){this.activate(),this.containerElement.appendChild(e),this.table.rowManager.adjustTableSize()}prepend(e){this.activate(),this.element.insertBefore(e,this.element.firstChild),this.table.rowManager.adjustTableSize()}remove(e){e.parentNode.removeChild(e),this.deactivate()}deactivate(e){(!this.element.firstChild||e)&&(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")}}class Xa extends j{constructor(e){super(e),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 e={};this.listeners.forEach(t=>{e[t]={handler:null,components:[]}}),this.listeners=e}bindPseudoEvents(){Object.keys(this.pseudoTrackers).forEach(e=>{this.pseudoTrackers[e].subscriber=this.pseudoMouseEnter.bind(this,e),this.subscribe(e+"-mouseover",this.pseudoTrackers[e].subscriber)}),this.pseudoTracking=!0}pseudoMouseEnter(e,t,i){this.pseudoTrackers[e].target!==i&&(this.pseudoTrackers[e].target&&this.dispatch(e+"-mouseleave",t,this.pseudoTrackers[e].target),this.pseudoMouseLeave(e,t),this.pseudoTrackers[e].target=i,this.dispatch(e+"-mouseenter",t,i))}pseudoMouseLeave(e,t){var i=Object.keys(this.pseudoTrackers),s={row:["cell"],cell:["row"]};i=i.filter(r=>{var o=s[e];return r!==e&&(!o||o&&!o.includes(r))}),i.forEach(r=>{var o=this.pseudoTrackers[r].target;this.pseudoTrackers[r].target&&(this.dispatch(r+"-mouseleave",t,o),this.pseudoTrackers[r].target=null)})}bindSubscriptionWatchers(){var e=Object.keys(this.listeners),t=Object.values(this.componentMap);for(let i of t)for(let s of e){let r=i+"-"+s;this.subscriptionChange(r,this.subscriptionChanged.bind(this,i,s))}this.subscribe("table-destroy",this.clearWatchers.bind(this))}subscriptionChanged(e,t,i){var s=this.listeners[t].components,r=s.indexOf(e),o=!1;i?r===-1&&(s.push(e),o=!0):this.subscribed(e+"-"+t)||r>-1&&(s.splice(r,1),o=!0),(t==="mouseenter"||t==="mouseleave")&&!this.pseudoTracking&&this.bindPseudoEvents(),o&&this.updateEventListeners()}updateEventListeners(){for(let e in this.listeners){let t=this.listeners[e];t.components.length?t.handler||(t.handler=this.track.bind(this,e),this.el.addEventListener(e,t.handler)):t.handler&&(this.el.removeEventListener(e,t.handler),t.handler=null)}}track(e,t){var i=t.composedPath&&t.composedPath()||t.path,s=this.findTargets(i);s=this.bindComponents(e,s),this.triggerEvents(e,t,s),this.pseudoTracking&&(e=="mouseover"||e=="mouseleave")&&!Object.keys(s).length&&this.pseudoMouseLeave("none",t)}findTargets(e){var t={};let i=Object.keys(this.componentMap);for(let s of e){let r=s.classList?[...s.classList]:[];if(r.filter(l=>this.abortClasses.includes(l)).length)break;let a=r.filter(l=>i.includes(l));for(let l of a)t[this.componentMap[l]]||(t[this.componentMap[l]]=s)}return t.group&&t.group===t.row&&delete t.row,t}bindComponents(e,t){var i=Object.keys(t).reverse(),s=this.listeners[e],r={},o={},a={};for(let l of i){let h,d=t[l],c=this.previousTargets[l];if(c&&c.target===d)h=c.component;else switch(l){case"row":case"group":(s.components.includes("row")||s.components.includes("cell")||s.components.includes("group"))&&(h=this.table.rowManager.getVisibleRows(!0).find(f=>f.getElement()===d),t.row&&t.row.parentNode&&t.row.parentNode.closest(".tabulator-row")&&(t[l]=!1));break;case"column":s.components.includes("column")&&(h=this.table.columnManager.findColumn(d));break;case"cell":s.components.includes("cell")&&(r.row instanceof U?h=r.row.findCell(d):t.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}h&&(r[l]=h,a[l]={target:d,component:h})}return this.previousTargets=a,Object.keys(t).forEach(l=>{let h=r[l];o[l]=h}),o}triggerEvents(e,t,i){var s=this.listeners[e];for(let r in i)i[r]&&s.components.includes(r)&&this.dispatch(r+"-"+e,t,i[r])}clearWatchers(){for(let e in this.listeners){let t=this.listeners[e];t.handler&&(this.el.removeEventListener(e,t.handler),t.handler=null)}}}class Ka{constructor(e){this.table=e,this.bindings={}}bind(e,t,i){this.bindings[e]||(this.bindings[e]={}),this.bindings[e][t]?console.warn("Unable to bind component handler, a matching function name is already bound",e,t,i):this.bindings[e][t]=i}handle(e,t,i){if(this.bindings[e]&&this.bindings[e][i]&&typeof this.bindings[e][i].bind=="function")return this.bindings[e][i].bind(null,t);i!=="then"&&typeof i=="string"&&!i.startsWith("_")&&this.table.options.debugInvalidComponentFuncs&&console.error("The "+e+" component does not have a "+i+" function, have you checked that you have the correct Tabulator module installed?")}}class Ya extends j{constructor(e){super(e),this.requestOrder=0,this.loading=!1}initialize(){}load(e,t,i,s,r,o){var a=++this.requestOrder;if(this.table.destroyed)return Promise.resolve();if(this.dispatchExternal("dataLoading",e),e&&(e.indexOf("{")==0||e.indexOf("[")==0)&&(e=JSON.parse(e)),this.confirm("data-loading",[e,t,i,r])){this.loading=!0,r||this.alertLoader(),t=this.chain("data-params",[e,i,r],t||{},t||{}),t=this.mapParams(t,this.table.options.dataSendParams);var l=this.chain("data-load",[e,t,i,r],!1,Promise.resolve([]));return l.then(h=>{if(this.table.destroyed)console.warn("Data Load Response Blocked - Table has been destroyed");else{!Array.isArray(h)&&typeof h=="object"&&(h=this.mapParams(h,this.objectInvert(this.table.options.dataReceiveParams)));var d=this.chain("data-loaded",[h],null,h);a==this.requestOrder?(this.clearAlert(),d!==!1&&(this.dispatchExternal("dataLoaded",d),this.table.rowManager.setData(d,s,typeof o>"u"?!s:o))):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(h=>{console.error("Data Load Error: ",h),this.dispatchExternal("dataLoadError",h),r||this.alertError(),setTimeout(()=>{this.clearAlert()},this.table.options.dataLoaderErrorTimeout)}).finally(()=>{this.loading=!1})}else return this.dispatchExternal("dataLoaded",e),e||(e=[]),this.table.rowManager.setData(e,s,typeof o>"u"?!s:o),Promise.resolve()}mapParams(e,t){var i={};for(let s in e)i[t.hasOwnProperty(s)?t[s]:s]=e[s];return i}objectInvert(e){var t={};for(let i in e)t[e[i]]=i;return t}blockActiveLoad(){this.requestOrder++}alertLoader(){var e=typeof this.table.options.dataLoader=="function"?this.table.options.dataLoader():this.table.options.dataLoader;e&&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()}}class Ja{constructor(e,t,i){this.table=e,this.events={},this.optionsList=t||{},this.subscriptionNotifiers={},this.dispatch=i?this._debugDispatch.bind(this):this._dispatch.bind(this),this.debug=i}subscriptionChange(e,t){this.subscriptionNotifiers[e]||(this.subscriptionNotifiers[e]=[]),this.subscriptionNotifiers[e].push(t),this.subscribed(e)&&this._notifySubscriptionChange(e,!0)}subscribe(e,t){this.events[e]||(this.events[e]=[]),this.events[e].push(t),this._notifySubscriptionChange(e,!0)}unsubscribe(e,t){var i;if(this.events[e])if(t)if(i=this.events[e].findIndex(s=>s===t),i>-1)this.events[e].splice(i,1);else{console.warn("Cannot remove event, no matching event found:",e,t);return}else delete this.events[e];else{console.warn("Cannot remove event, no events set on:",e);return}this._notifySubscriptionChange(e,!1)}subscribed(e){return this.events[e]&&this.events[e].length}_notifySubscriptionChange(e,t){var i=this.subscriptionNotifiers[e];i&&i.forEach(s=>{s(t)})}_dispatch(){var e=Array.from(arguments),t=e.shift(),i;return this.events[t]&&this.events[t].forEach((s,r)=>{let o=s.apply(this.table,e);r||(i=o)}),i}_debugDispatch(){var e=Array.from(arguments),t=e[0];return e[0]="ExternalEvent:"+e[0],(this.debug===!0||this.debug.includes(t))&&console.log(...e),this._dispatch(...arguments)}}class qa{constructor(e){this.events={},this.subscriptionNotifiers={},this.dispatch=e?this._debugDispatch.bind(this):this._dispatch.bind(this),this.chain=e?this._debugChain.bind(this):this._chain.bind(this),this.confirm=e?this._debugConfirm.bind(this):this._confirm.bind(this),this.debug=e}subscriptionChange(e,t){this.subscriptionNotifiers[e]||(this.subscriptionNotifiers[e]=[]),this.subscriptionNotifiers[e].push(t),this.subscribed(e)&&this._notifySubscriptionChange(e,!0)}subscribe(e,t,i=1e4){this.events[e]||(this.events[e]=[]),this.events[e].push({callback:t,priority:i}),this.events[e].sort((s,r)=>s.priority-r.priority),this._notifySubscriptionChange(e,!0)}unsubscribe(e,t){var i;if(this.events[e]){if(t)if(i=this.events[e].findIndex(s=>s.callback===t),i>-1)this.events[e].splice(i,1);else{console.warn("Cannot remove event, no matching event found:",e,t);return}}else{console.warn("Cannot remove event, no events set on:",e);return}this._notifySubscriptionChange(e,!1)}subscribed(e){return this.events[e]&&this.events[e].length}_chain(e,t,i,s){var r=i;return Array.isArray(t)||(t=[t]),this.subscribed(e)?(this.events[e].forEach((o,a)=>{r=o.callback.apply(this,t.concat([r]))}),r):typeof s=="function"?s():s}_confirm(e,t){var i=!1;return Array.isArray(t)||(t=[t]),this.subscribed(e)&&this.events[e].forEach((s,r)=>{s.callback.apply(this,t)&&(i=!0)}),i}_notifySubscriptionChange(e,t){var i=this.subscriptionNotifiers[e];i&&i.forEach(s=>{s(t)})}_dispatch(){var e=Array.from(arguments),t=e.shift();this.events[t]&&this.events[t].forEach(i=>{i.callback.apply(this,e)})}_debugDispatch(){var e=Array.from(arguments),t=e[0];return e[0]="InternalEvent:"+t,(this.debug===!0||this.debug.includes(t))&&console.log(...e),this._dispatch(...arguments)}_debugChain(){var e=Array.from(arguments),t=e[0];return e[0]="InternalEvent:"+t,(this.debug===!0||this.debug.includes(t))&&console.log(...e),this._chain(...arguments)}_debugConfirm(){var e=Array.from(arguments),t=e[0];return e[0]="InternalEvent:"+t,(this.debug===!0||this.debug.includes(t))&&console.log(...e),this._confirm(...arguments)}}class Qa extends j{constructor(e){super(e)}_warnUser(){this.options("debugDeprecation")&&console.warn(...arguments)}check(e,t,i){var s="";return typeof this.options(e)<"u"?(s="Deprecated Setup Option - Use of the %c"+e+"%c option is now deprecated",t?(s=s+", Please use the %c"+t+"%c option instead",this._warnUser(s,"font-weight: bold;","font-weight: normal;","font-weight: bold;","font-weight: normal;"),i&&(this.table.options[t]=this.table.options[e])):this._warnUser(s,"font-weight: bold;","font-weight: normal;"),!1):!0}checkMsg(e,t){return typeof this.options(e)<"u"?(this._warnUser("%cDeprecated Setup Option - Use of the %c"+e+" %c option is now deprecated, "+t,"font-weight: normal;","font-weight: bold;","font-weight: normal;"),!1):!0}msg(e){this._warnUser(e)}}class el extends j{constructor(e){super(e),this.deps={},this.props={}}initialize(){this.deps=Object.assign({},this.options("dependencies"))}lookup(e,t,i){if(Array.isArray(e)){for(const r of e){var s=this.lookup(r,t,!0);if(s)break}if(s)return s;this.error(e)}else return t?this.lookupProp(e,t,i):this.lookupKey(e,i)}lookupProp(e,t,i){var s;if(this.props[e]&&this.props[e][t])return this.props[e][t];if(s=this.lookupKey(e,i),s)return this.props[e]||(this.props[e]={}),this.props[e][t]=s[t]||s,this.props[e][t]}lookupKey(e,t){var i;return this.deps[e]?i=this.deps[e]:window[e]?(this.deps[e]=window[e],i=this.deps[e]):t||this.error(e),i}error(e){console.error("Unable to find dependency",e,"Please check documentation and ensure you have imported the required library into your project")}}function tl(n,e){e&&this.table.columnManager.renderer.reinitializeColumnWidths(n),this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.update()}function ws(n,e){n.forEach(function(t){t.reinitializeWidth()}),this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.update()}function il(n,e){var t=0,i=this.table.rowManager.element.clientWidth,s=0,r=!1;n.forEach((o,a)=>{o.widthFixed||o.reinitializeWidth(),(this.table.options.responsiveLayout?o.modules.responsive.visible:o.visible)&&(r=o),o.visible&&(t+=o.getWidth())}),r?(s=i-t+r.getWidth(),this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&(r.setWidth(0),this.table.modules.responsiveLayout.update()),s>0?r.setWidth(s):r.reinitializeWidth()):this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.update()}function sl(n,e){var t=this.table.rowManager.element.getBoundingClientRect().width,i=0,s=0,r=0,o=0,a=[],l=[],h=0,d=0,c=0;function u(p){var m;return typeof p=="string"?p.indexOf("%")>-1?m=t/100*parseInt(p):m=parseInt(p):m=p,m}function f(p,m,b,g){var R=[],E=0,v=0,C=0,k=r,y=0,_=0,T=[];function x(S){return b*(S.column.definition.widthGrow||1)}function L(S){return u(S.width)-b*(S.column.definition.widthShrink||0)}return p.forEach(function(S,Se){var he=g?L(S):x(S);S.column.minWidth>=he?R.push(S):S.column.maxWidth&&S.column.maxWidth<he?(S.width=S.column.maxWidth,m-=S.column.maxWidth,k-=g?S.column.definition.widthShrink||1:S.column.definition.widthGrow||1,k&&(b=Math.floor(m/k))):(T.push(S),_+=g?S.column.definition.widthShrink||1:S.column.definition.widthGrow||1)}),R.length?(R.forEach(function(S){E+=g?S.width-S.column.minWidth:S.column.minWidth,S.width=S.column.minWidth}),v=m-E,C=_?Math.floor(v/_):v,y=f(T,v,C,g)):(y=_?m-Math.floor(m/_)*_:m,T.forEach(function(S){S.width=g?L(S):x(S)})),y}this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.update(),this.table.rowManager.element.scrollHeight>this.table.rowManager.element.clientHeight&&(t-=this.table.rowManager.element.offsetWidth-this.table.rowManager.element.clientWidth),n.forEach(function(p){var m,b,g;p.visible&&(m=p.definition.width,b=parseInt(p.minWidth),m?(g=u(m),i+=g>b?g:b,p.definition.widthShrink&&(l.push({column:p,width:g>b?g:b}),h+=p.definition.widthShrink)):(a.push({column:p,width:0}),r+=p.definition.widthGrow||1))}),s=t-i,o=Math.floor(s/r),c=f(a,s,o,!1),a.length&&c>0&&(a[a.length-1].width+=c),a.forEach(function(p){s-=p.width}),d=Math.abs(c)+s,d>0&&h&&(c=f(l,d,Math.floor(d/h),!0)),c&&l.length&&(l[l.length-1].width-=c),a.forEach(function(p){p.column.setWidth(p.width)}),l.forEach(function(p){p.column.setWidth(p.width)})}var nl={fitData:tl,fitDataFill:ws,fitDataTable:ws,fitDataStretch:il,fitColumns:sl};const it=class it extends D{constructor(e){super(e,"layout"),this.mode=null,this.registerTableOption("layout","fitData"),this.registerTableOption("layoutColumnsOnNewData",!1),this.registerColumnOption("widthGrow"),this.registerColumnOption("widthShrink")}initialize(){var e=this.table.options.layout;it.modes[e]?this.mode=e:(console.warn("Layout Error - invalid mode set, defaulting to 'fitData' : "+e),this.mode="fitData"),this.table.element.setAttribute("tabulator-layout",this.mode),this.subscribe("column-init",this.initializeColumn.bind(this))}initializeColumn(e){e.definition.widthGrow&&(e.definition.widthGrow=Number(e.definition.widthGrow)),e.definition.widthShrink&&(e.definition.widthShrink=Number(e.definition.widthShrink))}getMode(){return this.mode}layout(e){var t=this.table.columnManager.columnsByIndex.find(i=>i.definition.variableHeight||i.definition.formatter==="textarea");this.dispatch("layout-refreshing"),it.modes[this.mode].call(this,this.table.columnManager.columnsByIndex,e),t&&this.table.rowManager.normalizeHeight(!0),this.dispatch("layout-refreshed")}};w(it,"moduleName","layout"),w(it,"modes",nl);let Ni=it;var rl={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:{}}}};const yt=class yt extends D{constructor(e){super(e),this.locale="default",this.lang=!1,this.bindings={},this.langList={},this.registerTableOption("locale",!1),this.registerTableOption("langs",{})}initialize(){this.langList=P.deepClone(yt.langs),this.table.options.columnDefaults.headerFilterPlaceholder!==!1&&this.setHeaderFilterPlaceholder(this.table.options.columnDefaults.headerFilterPlaceholder);for(let e in this.table.options.langs)this.installLang(e,this.table.options.langs[e]);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(e){this.langList.default.headerFilters.default=e}installLang(e,t){this.langList[e]?this._setLangProp(this.langList[e],t):this.langList[e]=t}_setLangProp(e,t){for(let i in t)e[i]&&typeof e[i]=="object"?this._setLangProp(e[i],t[i]):e[i]=t[i]}setLocale(e){e=e||"default";function t(i,s){for(var r in i)typeof i[r]=="object"?(s[r]||(s[r]={}),t(i[r],s[r])):s[r]=i[r]}if(e===!0&&navigator.language&&(e=navigator.language.toLowerCase()),e&&!this.langList[e]){let i=e.split("-")[0];this.langList[i]?(console.warn("Localization Error - Exact matching locale not found, using closest match: ",e,i),e=i):(console.warn("Localization Error - Matching locale not found, using default: ",e),e="default")}this.locale=e,this.lang=P.deepClone(this.langList.default||{}),e!="default"&&t(this.langList[e],this.lang),this.dispatchExternal("localized",this.locale,this.lang),this._executeBindings()}getLocale(e){return this.locale}getLang(e){return e?this.langList[e]:this.lang}getText(e,t){var i=t?e+"|"+t:e,s=i.split("|"),r=this._getLangElement(s,this.locale);return r||""}_getLangElement(e,t){var i=this.lang;return e.forEach(function(s){var r;i&&(r=i[s],typeof r<"u"?i=r:i=!1)}),i}bind(e,t){this.bindings[e]||(this.bindings[e]=[]),this.bindings[e].push(t),t(this.getText(e),this.lang)}_executeBindings(){for(let e in this.bindings)this.bindings[e].forEach(t=>{t(this.getText(e),this.lang)})}};w(yt,"moduleName","localize"),w(yt,"langs",rl);let Vi=yt;class An extends D{constructor(e){super(e)}initialize(){this.registerTableFunction("tableComms",this.receive.bind(this))}getConnections(e){var t=[],i;return i=this.table.constructor.registry.lookupTable(e),i.forEach(s=>{this.table!==s&&t.push(s)}),t}send(e,t,i,s){var r=this.getConnections(e);r.forEach(o=>{o.tableComms(this.table.element,t,i,s)}),!r.length&&e&&console.warn("Table Connection Error - No tables matching selector found",e)}receive(e,t,i,s){if(this.table.modExists(t))return this.table.modules[t].commsReceived(e,i,s);console.warn("Inter-table Comms Error - no such module:",t)}}w(An,"moduleName","comms");var ol=Object.freeze({__proto__:null,CommsModule:An,LayoutModule:Ni,LocalizeModule:Vi});const Y=class Y{static findTable(e){var t=Y.registry.lookupTable(e,!0);return Array.isArray(t)&&!t.length?!1:t}};w(Y,"registry",{tables:[],register(e){Y.registry.tables.push(e)},deregister(e){var t=Y.registry.tables.indexOf(e);t>-1&&Y.registry.tables.splice(t,1)},lookupTable(e,t){var i=[],s,r;if(typeof e=="string"){if(s=document.querySelectorAll(e),s.length)for(var o=0;o<s.length;o++)r=Y.registry.matchElement(s[o]),r&&i.push(r)}else typeof HTMLElement<"u"&&e instanceof HTMLElement||e instanceof Y?(r=Y.registry.matchElement(e),r&&i.push(r)):Array.isArray(e)?e.forEach(function(a){i=i.concat(Y.registry.lookupTable(a))}):t||console.warn("Table Connection Error - Invalid Selector",e);return i},matchElement(e){return Y.registry.tables.find(function(t){return e instanceof Y?t===e:t.element===e})}});let Wi=Y;const A=class A extends Wi{constructor(){super()}static initializeModuleBinder(e){A.modulesRegistered||(A.modulesRegistered=!0,A._registerModules(ol,!0),e&&A._registerModules(e))}static _extendModule(e,t,i){if(A.moduleBindings[e]){var s=A.moduleBindings[e][t];if(s)if(typeof i=="object")for(let r in i)s[r]=i[r];else console.warn("Module Error - Invalid value type, it must be an object");else console.warn("Module Error - property does not exist:",t)}else console.warn("Module Error - module does not exist:",e)}static _registerModules(e,t){var i=Object.values(e);t&&i.forEach(s=>{s.prototype.moduleCore=!0}),A._registerModule(i)}static _registerModule(e){Array.isArray(e)||(e=[e]),e.forEach(t=>{A._registerModuleBinding(t),A._registerModuleExtensions(t)})}static _registerModuleBinding(e){e.moduleName?A.moduleBindings[e.moduleName]=e:console.error("Unable to bind module, no moduleName defined",e.moduleName)}static _registerModuleExtensions(e){var t=e.moduleExtensions;if(e.moduleExtensions)for(let i in t){let s=t[i];if(A.moduleBindings[i])for(let r in s)A._extendModule(i,r,s[r]);else{A.moduleExtensions[i]||(A.moduleExtensions[i]={});for(let r in s)A.moduleExtensions[i][r]||(A.moduleExtensions[i][r]={}),Object.assign(A.moduleExtensions[i][r],s[r])}}A._extendModuleFromQueue(e)}static _extendModuleFromQueue(e){var t=A.moduleExtensions[e.moduleName];if(t)for(let i in t)A._extendModule(e.moduleName,i,t[i])}_bindModules(){var e=[],t=[],i=[];this.modules={};for(var s in A.moduleBindings){let r=A.moduleBindings[s],o=new r(this);this.modules[s]=o,r.prototype.moduleCore?this.modulesCore.push(o):r.moduleInitOrder?r.moduleInitOrder<0?e.push(o):t.push(o):i.push(o)}e.sort((r,o)=>r.moduleInitOrder>o.moduleInitOrder?1:-1),t.sort((r,o)=>r.moduleInitOrder>o.moduleInitOrder?1:-1),this.modulesRegular=e.concat(i.concat(t))}};w(A,"moduleBindings",{}),w(A,"moduleExtensions",{}),w(A,"modulesRegistered",!1),w(A,"defaultModules",!1);let Gi=A;class al extends j{constructor(e){super(e),this.element=this._createAlertElement(),this.msgElement=this._createMsgElement(),this.type=null,this.element.appendChild(this.msgElement)}_createAlertElement(){var e=document.createElement("div");return e.classList.add("tabulator-alert"),e}_createMsgElement(){var e=document.createElement("div");return e.classList.add("tabulator-alert-msg"),e.setAttribute("role","alert"),e}_typeClass(){return"tabulator-alert-state-"+this.type}alert(e,t="msg"){if(e){for(this.clear(),this.dispatch("alert-show",t),this.type=t;this.msgElement.firstChild;)this.msgElement.removeChild(this.msgElement.firstChild);this.msgElement.classList.add(this._typeClass()),typeof e=="function"&&(e=e()),e instanceof HTMLElement?this.msgElement.appendChild(e):this.msgElement.innerHTML=e,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())}}const fe=class fe extends Gi{static extendModule(){fe.initializeModuleBinder(),fe._extendModule(...arguments)}static registerModule(){fe.initializeModuleBinder(),fe._registerModule(...arguments)}constructor(e,t,i){super(),fe.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 Ka(this),this.dataLoader=!1,this.modules={},this.modulesCore=[],this.modulesRegular=[],this.deprecationAdvisor=new Qa(this),this.optionsList=new Hn(this,"table constructor"),this.dependencyRegistry=new el(this),this.initialized=!1,this.destroyed=!1,this.initializeElement(e)&&(this.initializeCoreSystems(t),setTimeout(()=>{this._create()})),this.constructor.registry.register(this)}initializeElement(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement?(this.element=e,!0):typeof e=="string"?(this.element=document.querySelector(e),this.element?!0:(console.error("Tabulator Creation Error - no element found matching selector: ",e),!1)):(console.error("Tabulator Creation Error - Invalid element provided:",e),!1)}initializeCoreSystems(e){this.columnManager=new Ga(this),this.rowManager=new $a(this),this.footerManager=new Za(this),this.dataLoader=new Ya(this),this.alertManager=new al(this),this._bindModules(),this.options=this.optionsList.generate(fe.defaultOptions,e),this._clearObjectPointers(),this._mapDeprecatedFunctionality(),this.externalEvents=new Ja(this,this.options,this.options.debugEventsExternal),this.eventBus=new qa(this.options.debugEventsInternal),this.interactionMonitor=new Xa(this),this.dataLoader.initialize(),this.footerManager.initialize(),this.dependencyRegistry.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 e=window.getComputedStyle(this.element);switch(this.options.textDirection){case"auto":if(e.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 e=this.element,t=this.options,i;if(e.tagName==="TABLE"){this.originalElement=this.element,i=document.createElement("div");var s=e.attributes;for(var r in s)typeof s[r]=="object"&&i.setAttribute(s[r].name,s[r].value);e.parentNode.replaceChild(i,e),this.element=e=i}for(e.classList.add("tabulator"),e.setAttribute("role","grid");e.firstChild;)e.removeChild(e.firstChild);t.height&&(t.height=isNaN(t.height)?t.height:t.height+"px",e.style.height=t.height),t.minHeight!==!1&&(t.minHeight=isNaN(t.minHeight)?t.minHeight:t.minHeight+"px",e.style.minHeight=t.minHeight),t.maxHeight!==!1&&(t.maxHeight=isNaN(t.maxHeight)?t.maxHeight:t.maxHeight+"px",e.style.maxHeight=t.maxHeight)}_initializeTable(){var e=this.element,t=this.options;this.interactionMonitor.initialize(),this.columnManager.initialize(),this.rowManager.initialize(),this._detectBrowser(),this.modulesCore.forEach(i=>{i.initialize()}),e.appendChild(this.columnManager.getElement()),e.appendChild(this.rowManager.getElement()),t.footerElement&&this.footerManager.activate(),t.autoColumns&&t.data&&this.columnManager.generateColumnsFromRowData(this.options.data),this.modulesRegular.forEach(i=>{i.initialize()}),this.columnManager.setColumns(t.columns),this.eventBus.dispatch("table-built")}_loadInitialData(){return this.dataLoader.load(this.options.data).finally(()=>{this.columnManager.verticalAlignHeaders()})}destroy(){var e=this.element;for(this.destroyed=!0,this.constructor.registry.deregister(this),this.eventBus.dispatch("table-destroy"),this.rowManager.destroy();e.firstChild;)e.removeChild(e.firstChild);e.classList.remove("tabulator"),this.externalEvents.dispatch("tableDestroyed")}_detectBrowser(){var e=navigator.userAgent||navigator.vendor||window.opera;e.indexOf("Trident")>-1?(this.browser="ie",this.browserSlow=!0):e.indexOf("Edge")>-1?(this.browser="edge",this.browserSlow=!0):e.indexOf("Firefox")>-1?(this.browser="firefox",this.browserSlow=!1):e.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(e)||/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(e.slice(0,4))}initGuard(e,t){var i,s;return this.options.debugInitialization&&!this.initialized&&(e||(i=new Error().stack.split(`
`),s=i[0]=="Error"?i[2]:i[1],s[0]==" "?e=s.trim().split(" ")[1].split(".")[1]:e=s.trim().split("@")[0]),console.warn("Table Not Initialized - Calling the "+e+" function before the table is initialized may result in inconsistent behavior, Please wait for the `tableBuilt` event before calling this function."+(t?" "+t:""))),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(e,t,i){return this.initGuard(!1,"To set initial data please use the 'data' property in the table constructor."),this.dataLoader.load(e,t,i,!1)}clearData(){this.initGuard(),this.dataLoader.blockActiveLoad(),this.rowManager.clearData()}getData(e){return this.rowManager.getData(e)}getDataCount(e){return this.rowManager.getDataCount(e)}replaceData(e,t,i){return this.initGuard(),this.dataLoader.load(e,t,i,!0,!0)}updateData(e){var t=0;return this.initGuard(),new Promise((i,s)=>{this.dataLoader.blockActiveLoad(),typeof e=="string"&&(e=JSON.parse(e)),e&&e.length>0?e.forEach(r=>{var o=this.rowManager.findRow(r[this.options.index]);o?(t++,o.updateData(r).then(()=>{t--,t||i()}).catch(a=>{s("Update Error - Unable to update row",r,a)})):s("Update Error - Unable to find row",r)}):(console.warn("Update Error - No data provided"),s("Update Error - No data provided"))})}addData(e,t,i){return this.initGuard(),new Promise((s,r)=>{this.dataLoader.blockActiveLoad(),typeof e=="string"&&(e=JSON.parse(e)),e?this.rowManager.addRows(e,t,i).then(o=>{var a=[];o.forEach(function(l){a.push(l.getComponent())}),s(a)}):(console.warn("Update Error - No data provided"),r("Update Error - No data provided"))})}updateOrAddData(e){var t=[],i=0;return this.initGuard(),new Promise((s,r)=>{this.dataLoader.blockActiveLoad(),typeof e=="string"&&(e=JSON.parse(e)),e&&e.length>0?e.forEach(o=>{var a=this.rowManager.findRow(o[this.options.index]);i++,a?a.updateData(o).then(()=>{i--,t.push(a.getComponent()),i||s(t)}):this.rowManager.addRows(o).then(l=>{i--,t.push(l[0].getComponent()),i||s(t)})}):(console.warn("Update Error - No data provided"),r("Update Error - No data provided"))})}getRow(e){var t=this.rowManager.findRow(e);return t?t.getComponent():(console.warn("Find Error - No matching row found:",e),!1)}getRowFromPosition(e){var t=this.rowManager.getRowFromPosition(e);return t?t.getComponent():(console.warn("Find Error - No matching row found:",e),!1)}deleteRow(e){var t=[];this.initGuard(),Array.isArray(e)||(e=[e]);for(let i of e){let s=this.rowManager.findRow(i,!0);if(s)t.push(s);else return console.error("Delete Error - No matching row found:",i),Promise.reject("Delete Error - No matching row found")}return t.sort((i,s)=>this.rowManager.rows.indexOf(i)>this.rowManager.rows.indexOf(s)?1:-1),t.forEach(i=>{i.delete()}),this.rowManager.reRenderInPosition(),Promise.resolve()}addRow(e,t,i){return this.initGuard(),typeof e=="string"&&(e=JSON.parse(e)),this.rowManager.addRows(e,t,i,!0).then(s=>s[0].getComponent())}updateOrAddRow(e,t){var i=this.rowManager.findRow(e);return this.initGuard(),typeof t=="string"&&(t=JSON.parse(t)),i?i.updateData(t).then(()=>i.getComponent()):this.rowManager.addRows(t).then(s=>s[0].getComponent())}updateRow(e,t){var i=this.rowManager.findRow(e);return this.initGuard(),typeof t=="string"&&(t=JSON.parse(t)),i?i.updateData(t).then(()=>Promise.resolve(i.getComponent())):(console.warn("Update Error - No matching row found:",e),Promise.reject("Update Error - No matching row found"))}scrollToRow(e,t,i){var s=this.rowManager.findRow(e);return s?this.rowManager.scrollToRow(s,t,i):(console.warn("Scroll Error - No matching row found:",e),Promise.reject("Scroll Error - No matching row found"))}moveRow(e,t,i){var s=this.rowManager.findRow(e);this.initGuard(),s?s.moveToRow(t,i):console.warn("Move Error - No matching row found:",e)}getRows(e){return this.rowManager.getComponents(e)}getRowPosition(e){var t=this.rowManager.findRow(e);return t?t.getPosition():(console.warn("Position Error - No matching row found:",e),!1)}setColumns(e){this.initGuard(!1,"To set initial columns please use the 'columns' property in the table constructor"),this.columnManager.setColumns(e)}getColumns(e){return this.columnManager.getComponents(e)}getColumn(e){var t=this.columnManager.findColumn(e);return t?t.getComponent():(console.warn("Find Error - No matching column found:",e),!1)}getColumnDefinitions(){return this.columnManager.getDefinitionTree()}showColumn(e){var t=this.columnManager.findColumn(e);if(this.initGuard(),t)t.show();else return console.warn("Column Show Error - No matching column found:",e),!1}hideColumn(e){var t=this.columnManager.findColumn(e);if(this.initGuard(),t)t.hide();else return console.warn("Column Hide Error - No matching column found:",e),!1}toggleColumn(e){var t=this.columnManager.findColumn(e);if(this.initGuard(),t)t.visible?t.hide():t.show();else return console.warn("Column Visibility Toggle Error - No matching column found:",e),!1}addColumn(e,t,i){var s=this.columnManager.findColumn(i);return this.initGuard(),this.columnManager.addColumn(e,t,s).then(r=>r.getComponent())}deleteColumn(e){var t=this.columnManager.findColumn(e);return this.initGuard(),t?t.delete():(console.warn("Column Delete Error - No matching column found:",e),Promise.reject())}updateColumnDefinition(e,t){var i=this.columnManager.findColumn(e);return this.initGuard(),i?i.updateDefinition(t):(console.warn("Column Update Error - No matching column found:",e),Promise.reject())}moveColumn(e,t,i){var s=this.columnManager.findColumn(e),r=this.columnManager.findColumn(t);this.initGuard(),s?r?this.columnManager.moveColumn(s,r,i):console.warn("Move Error - No matching column found:",r):console.warn("Move Error - No matching column found:",e)}scrollToColumn(e,t,i){return new Promise((s,r)=>{var o=this.columnManager.findColumn(e);return o?this.columnManager.scrollToColumn(o,t,i):(console.warn("Scroll Error - No matching column found:",e),Promise.reject("Scroll Error - No matching column found"))})}redraw(e){this.initGuard(),this.columnManager.redraw(e),this.rowManager.redraw(e)}setHeight(e){this.options.height=isNaN(e)?e:e+"px",this.element.style.height=this.options.height,this.rowManager.initializeRenderer(),this.rowManager.redraw(!0)}on(e,t){this.externalEvents.subscribe(e,t)}off(e,t){this.externalEvents.unsubscribe(e,t)}dispatchEvent(){var e=Array.from(arguments);e.shift(),this.externalEvents.dispatch(...arguments)}alert(e,t){this.initGuard(),this.alertManager.alert(e,t)}clearAlert(){this.initGuard(),this.alertManager.clear()}modExists(e,t){return this.modules[e]?!0:(t&&console.error("Tabulator Module Not Installed: "+e),!1)}module(e){var t=this.modules[e];return t||console.error("Tabulator module not installed: "+e),t}};w(fe,"defaultOptions",Na);let ji=fe;var dt=ji;class ll extends dt{static extendModule(){dt.initializeModuleBinder(ii),dt._extendModule(...arguments)}static registerModule(){dt.initializeModuleBinder(ii),dt._registerModule(...arguments)}constructor(e,t,i){super(e,t,ii)}}var Cs=ll;/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const hl=4,ys=0,Es=1,dl=2;function ot(n){let e=n.length;for(;--e>=0;)n[e]=0}const ul=0,On=1,cl=2,fl=3,pl=258,ss=29,Dt=256,Et=Dt+1+ss,st=30,ns=19,Pn=2*Et+1,Ae=15,si=16,gl=7,rs=256,Bn=16,In=17,Nn=18,Ui=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),Gt=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),ml=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Vn=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),bl=512,pe=new Array((Et+2)*2);ot(pe);const pt=new Array(st*2);ot(pt);const Rt=new Array(bl);ot(Rt);const xt=new Array(pl-fl+1);ot(xt);const os=new Array(ss);ot(os);const jt=new Array(st);ot(jt);function ni(n,e,t,i,s){this.static_tree=n,this.extra_bits=e,this.extra_base=t,this.elems=i,this.max_length=s,this.has_stree=n&&n.length}let Wn,Gn,jn;function ri(n,e){this.dyn_tree=n,this.max_code=0,this.stat_desc=e}const Un=n=>n<256?Rt[n]:Rt[256+(n>>>7)],_t=(n,e)=>{n.pending_buf[n.pending++]=e&255,n.pending_buf[n.pending++]=e>>>8&255},K=(n,e,t)=>{n.bi_valid>si-t?(n.bi_buf|=e<<n.bi_valid&65535,_t(n,n.bi_buf),n.bi_buf=e>>si-n.bi_valid,n.bi_valid+=t-si):(n.bi_buf|=e<<n.bi_valid&65535,n.bi_valid+=t)},oe=(n,e,t)=>{K(n,t[e*2],t[e*2+1])},$n=(n,e)=>{let t=0;do t|=n&1,n>>>=1,t<<=1;while(--e>0);return t>>>1},vl=n=>{n.bi_valid===16?(_t(n,n.bi_buf),n.bi_buf=0,n.bi_valid=0):n.bi_valid>=8&&(n.pending_buf[n.pending++]=n.bi_buf&255,n.bi_buf>>=8,n.bi_valid-=8)},wl=(n,e)=>{const t=e.dyn_tree,i=e.max_code,s=e.stat_desc.static_tree,r=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,l=e.stat_desc.max_length;let h,d,c,u,f,p,m=0;for(u=0;u<=Ae;u++)n.bl_count[u]=0;for(t[n.heap[n.heap_max]*2+1]=0,h=n.heap_max+1;h<Pn;h++)d=n.heap[h],u=t[t[d*2+1]*2+1]+1,u>l&&(u=l,m++),t[d*2+1]=u,!(d>i)&&(n.bl_count[u]++,f=0,d>=a&&(f=o[d-a]),p=t[d*2],n.opt_len+=p*(u+f),r&&(n.static_len+=p*(s[d*2+1]+f)));if(m!==0){do{for(u=l-1;n.bl_count[u]===0;)u--;n.bl_count[u]--,n.bl_count[u+1]+=2,n.bl_count[l]--,m-=2}while(m>0);for(u=l;u!==0;u--)for(d=n.bl_count[u];d!==0;)c=n.heap[--h],!(c>i)&&(t[c*2+1]!==u&&(n.opt_len+=(u-t[c*2+1])*t[c*2],t[c*2+1]=u),d--)}},Zn=(n,e,t)=>{const i=new Array(Ae+1);let s=0,r,o;for(r=1;r<=Ae;r++)s=s+t[r-1]<<1,i[r]=s;for(o=0;o<=e;o++){let a=n[o*2+1];a!==0&&(n[o*2]=$n(i[a]++,a))}},Cl=()=>{let n,e,t,i,s;const r=new Array(Ae+1);for(t=0,i=0;i<ss-1;i++)for(os[i]=t,n=0;n<1<<Ui[i];n++)xt[t++]=i;for(xt[t-1]=i,s=0,i=0;i<16;i++)for(jt[i]=s,n=0;n<1<<Gt[i];n++)Rt[s++]=i;for(s>>=7;i<st;i++)for(jt[i]=s<<7,n=0;n<1<<Gt[i]-7;n++)Rt[256+s++]=i;for(e=0;e<=Ae;e++)r[e]=0;for(n=0;n<=143;)pe[n*2+1]=8,n++,r[8]++;for(;n<=255;)pe[n*2+1]=9,n++,r[9]++;for(;n<=279;)pe[n*2+1]=7,n++,r[7]++;for(;n<=287;)pe[n*2+1]=8,n++,r[8]++;for(Zn(pe,Et+1,r),n=0;n<st;n++)pt[n*2+1]=5,pt[n*2]=$n(n,5);Wn=new ni(pe,Ui,Dt+1,Et,Ae),Gn=new ni(pt,Gt,0,st,Ae),jn=new ni(new Array(0),ml,0,ns,gl)},Xn=n=>{let e;for(e=0;e<Et;e++)n.dyn_ltree[e*2]=0;for(e=0;e<st;e++)n.dyn_dtree[e*2]=0;for(e=0;e<ns;e++)n.bl_tree[e*2]=0;n.dyn_ltree[rs*2]=1,n.opt_len=n.static_len=0,n.sym_next=n.matches=0},Kn=n=>{n.bi_valid>8?_t(n,n.bi_buf):n.bi_valid>0&&(n.pending_buf[n.pending++]=n.bi_buf),n.bi_buf=0,n.bi_valid=0},Rs=(n,e,t,i)=>{const s=e*2,r=t*2;return n[s]<n[r]||n[s]===n[r]&&i[e]<=i[t]},oi=(n,e,t)=>{const i=n.heap[t];let s=t<<1;for(;s<=n.heap_len&&(s<n.heap_len&&Rs(e,n.heap[s+1],n.heap[s],n.depth)&&s++,!Rs(e,i,n.heap[s],n.depth));)n.heap[t]=n.heap[s],t=s,s<<=1;n.heap[t]=i},xs=(n,e,t)=>{let i,s,r=0,o,a;if(n.sym_next!==0)do i=n.pending_buf[n.sym_buf+r++]&255,i+=(n.pending_buf[n.sym_buf+r++]&255)<<8,s=n.pending_buf[n.sym_buf+r++],i===0?oe(n,s,e):(o=xt[s],oe(n,o+Dt+1,e),a=Ui[o],a!==0&&(s-=os[o],K(n,s,a)),i--,o=Un(i),oe(n,o,t),a=Gt[o],a!==0&&(i-=jt[o],K(n,i,a)));while(r<n.sym_next);oe(n,rs,e)},$i=(n,e)=>{const t=e.dyn_tree,i=e.stat_desc.static_tree,s=e.stat_desc.has_stree,r=e.stat_desc.elems;let o,a,l=-1,h;for(n.heap_len=0,n.heap_max=Pn,o=0;o<r;o++)t[o*2]!==0?(n.heap[++n.heap_len]=l=o,n.depth[o]=0):t[o*2+1]=0;for(;n.heap_len<2;)h=n.heap[++n.heap_len]=l<2?++l:0,t[h*2]=1,n.depth[h]=0,n.opt_len--,s&&(n.static_len-=i[h*2+1]);for(e.max_code=l,o=n.heap_len>>1;o>=1;o--)oi(n,t,o);h=r;do o=n.heap[1],n.heap[1]=n.heap[n.heap_len--],oi(n,t,1),a=n.heap[1],n.heap[--n.heap_max]=o,n.heap[--n.heap_max]=a,t[h*2]=t[o*2]+t[a*2],n.depth[h]=(n.depth[o]>=n.depth[a]?n.depth[o]:n.depth[a])+1,t[o*2+1]=t[a*2+1]=h,n.heap[1]=h++,oi(n,t,1);while(n.heap_len>=2);n.heap[--n.heap_max]=n.heap[1],wl(n,e),Zn(t,l,n.bl_count)},_s=(n,e,t)=>{let i,s=-1,r,o=e[0*2+1],a=0,l=7,h=4;for(o===0&&(l=138,h=3),e[(t+1)*2+1]=65535,i=0;i<=t;i++)r=o,o=e[(i+1)*2+1],!(++a<l&&r===o)&&(a<h?n.bl_tree[r*2]+=a:r!==0?(r!==s&&n.bl_tree[r*2]++,n.bl_tree[Bn*2]++):a<=10?n.bl_tree[In*2]++:n.bl_tree[Nn*2]++,a=0,s=r,o===0?(l=138,h=3):r===o?(l=6,h=3):(l=7,h=4))},ks=(n,e,t)=>{let i,s=-1,r,o=e[0*2+1],a=0,l=7,h=4;for(o===0&&(l=138,h=3),i=0;i<=t;i++)if(r=o,o=e[(i+1)*2+1],!(++a<l&&r===o)){if(a<h)do oe(n,r,n.bl_tree);while(--a!==0);else r!==0?(r!==s&&(oe(n,r,n.bl_tree),a--),oe(n,Bn,n.bl_tree),K(n,a-3,2)):a<=10?(oe(n,In,n.bl_tree),K(n,a-3,3)):(oe(n,Nn,n.bl_tree),K(n,a-11,7));a=0,s=r,o===0?(l=138,h=3):r===o?(l=6,h=3):(l=7,h=4)}},yl=n=>{let e;for(_s(n,n.dyn_ltree,n.l_desc.max_code),_s(n,n.dyn_dtree,n.d_desc.max_code),$i(n,n.bl_desc),e=ns-1;e>=3&&n.bl_tree[Vn[e]*2+1]===0;e--);return n.opt_len+=3*(e+1)+5+5+4,e},El=(n,e,t,i)=>{let s;for(K(n,e-257,5),K(n,t-1,5),K(n,i-4,4),s=0;s<i;s++)K(n,n.bl_tree[Vn[s]*2+1],3);ks(n,n.dyn_ltree,e-1),ks(n,n.dyn_dtree,t-1)},Rl=n=>{let e=4093624447,t;for(t=0;t<=31;t++,e>>>=1)if(e&1&&n.dyn_ltree[t*2]!==0)return ys;if(n.dyn_ltree[9*2]!==0||n.dyn_ltree[10*2]!==0||n.dyn_ltree[13*2]!==0)return Es;for(t=32;t<Dt;t++)if(n.dyn_ltree[t*2]!==0)return Es;return ys};let Ts=!1;const xl=n=>{Ts||(Cl(),Ts=!0),n.l_desc=new ri(n.dyn_ltree,Wn),n.d_desc=new ri(n.dyn_dtree,Gn),n.bl_desc=new ri(n.bl_tree,jn),n.bi_buf=0,n.bi_valid=0,Xn(n)},Yn=(n,e,t,i)=>{K(n,(ul<<1)+(i?1:0),3),Kn(n),_t(n,t),_t(n,~t),t&&n.pending_buf.set(n.window.subarray(e,e+t),n.pending),n.pending+=t},_l=n=>{K(n,On<<1,3),oe(n,rs,pe),vl(n)},kl=(n,e,t,i)=>{let s,r,o=0;n.level>0?(n.strm.data_type===dl&&(n.strm.data_type=Rl(n)),$i(n,n.l_desc),$i(n,n.d_desc),o=yl(n),s=n.opt_len+3+7>>>3,r=n.static_len+3+7>>>3,r<=s&&(s=r)):s=r=t+5,t+4<=s&&e!==-1?Yn(n,e,t,i):n.strategy===hl||r===s?(K(n,(On<<1)+(i?1:0),3),xs(n,pe,pt)):(K(n,(cl<<1)+(i?1:0),3),El(n,n.l_desc.max_code+1,n.d_desc.max_code+1,o+1),xs(n,n.dyn_ltree,n.dyn_dtree)),Xn(n),i&&Kn(n)},Tl=(n,e,t)=>(n.pending_buf[n.sym_buf+n.sym_next++]=e,n.pending_buf[n.sym_buf+n.sym_next++]=e>>8,n.pending_buf[n.sym_buf+n.sym_next++]=t,e===0?n.dyn_ltree[t*2]++:(n.matches++,e--,n.dyn_ltree[(xt[t]+Dt+1)*2]++,n.dyn_dtree[Un(e)*2]++),n.sym_next===n.sym_end);var Ml=xl,Sl=Yn,Ll=kl,Dl=Tl,zl=_l,Fl={_tr_init:Ml,_tr_stored_block:Sl,_tr_flush_block:Ll,_tr_tally:Dl,_tr_align:zl};const Hl=(n,e,t,i)=>{let s=n&65535|0,r=n>>>16&65535|0,o=0;for(;t!==0;){o=t>2e3?2e3:t,t-=o;do s=s+e[i++]|0,r=r+s|0;while(--o);s%=65521,r%=65521}return s|r<<16|0};var kt=Hl;const Al=()=>{let n,e=[];for(var t=0;t<256;t++){n=t;for(var i=0;i<8;i++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n}return e},Ol=new Uint32Array(Al()),Pl=(n,e,t,i)=>{const s=Ol,r=i+t;n^=-1;for(let o=i;o<r;o++)n=n>>>8^s[(n^e[o])&255];return n^-1};var W=Pl,Ie={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},zt={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:Bl,_tr_stored_block:Zi,_tr_flush_block:Il,_tr_tally:ke,_tr_align:Nl}=Fl,{Z_NO_FLUSH:Te,Z_PARTIAL_FLUSH:Vl,Z_FULL_FLUSH:Wl,Z_FINISH:ee,Z_BLOCK:Ms,Z_OK:G,Z_STREAM_END:Ss,Z_STREAM_ERROR:ae,Z_DATA_ERROR:Gl,Z_BUF_ERROR:ai,Z_DEFAULT_COMPRESSION:jl,Z_FILTERED:Ul,Z_HUFFMAN_ONLY:Pt,Z_RLE:$l,Z_FIXED:Zl,Z_DEFAULT_STRATEGY:Xl,Z_UNKNOWN:Kl,Z_DEFLATED:Yt}=zt,Yl=9,Jl=15,ql=8,Ql=29,eh=256,Xi=eh+1+Ql,th=30,ih=19,sh=2*Xi+1,nh=15,z=3,_e=258,le=_e+z+1,rh=32,nt=42,as=57,Ki=69,Yi=73,Ji=91,qi=103,Oe=113,ct=666,Z=1,at=2,Ne=3,lt=4,oh=3,Pe=(n,e)=>(n.msg=Ie[e],e),Ls=n=>n*2-(n>4?9:0),xe=n=>{let e=n.length;for(;--e>=0;)n[e]=0},ah=n=>{let e,t,i,s=n.w_size;e=n.hash_size,i=e;do t=n.head[--i],n.head[i]=t>=s?t-s:0;while(--e);e=s,i=e;do t=n.prev[--i],n.prev[i]=t>=s?t-s:0;while(--e)};let lh=(n,e,t)=>(e<<n.hash_shift^t)&n.hash_mask,Me=lh;const J=n=>{const e=n.state;let t=e.pending;t>n.avail_out&&(t=n.avail_out),t!==0&&(n.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+t),n.next_out),n.next_out+=t,e.pending_out+=t,n.total_out+=t,n.avail_out-=t,e.pending-=t,e.pending===0&&(e.pending_out=0))},q=(n,e)=>{Il(n,n.block_start>=0?n.block_start:-1,n.strstart-n.block_start,e),n.block_start=n.strstart,J(n.strm)},F=(n,e)=>{n.pending_buf[n.pending++]=e},ut=(n,e)=>{n.pending_buf[n.pending++]=e>>>8&255,n.pending_buf[n.pending++]=e&255},Qi=(n,e,t,i)=>{let s=n.avail_in;return s>i&&(s=i),s===0?0:(n.avail_in-=s,e.set(n.input.subarray(n.next_in,n.next_in+s),t),n.state.wrap===1?n.adler=kt(n.adler,e,s,t):n.state.wrap===2&&(n.adler=W(n.adler,e,s,t)),n.next_in+=s,n.total_in+=s,s)},Jn=(n,e)=>{let t=n.max_chain_length,i=n.strstart,s,r,o=n.prev_length,a=n.nice_match;const l=n.strstart>n.w_size-le?n.strstart-(n.w_size-le):0,h=n.window,d=n.w_mask,c=n.prev,u=n.strstart+_e;let f=h[i+o-1],p=h[i+o];n.prev_length>=n.good_match&&(t>>=2),a>n.lookahead&&(a=n.lookahead);do if(s=e,!(h[s+o]!==p||h[s+o-1]!==f||h[s]!==h[i]||h[++s]!==h[i+1])){i+=2,s++;do;while(h[++i]===h[++s]&&h[++i]===h[++s]&&h[++i]===h[++s]&&h[++i]===h[++s]&&h[++i]===h[++s]&&h[++i]===h[++s]&&h[++i]===h[++s]&&h[++i]===h[++s]&&i<u);if(r=_e-(u-i),i=u-_e,r>o){if(n.match_start=e,o=r,r>=a)break;f=h[i+o-1],p=h[i+o]}}while((e=c[e&d])>l&&--t!==0);return o<=n.lookahead?o:n.lookahead},rt=n=>{const e=n.w_size;let t,i,s;do{if(i=n.window_size-n.lookahead-n.strstart,n.strstart>=e+(e-le)&&(n.window.set(n.window.subarray(e,e+e-i),0),n.match_start-=e,n.strstart-=e,n.block_start-=e,n.insert>n.strstart&&(n.insert=n.strstart),ah(n),i+=e),n.strm.avail_in===0)break;if(t=Qi(n.strm,n.window,n.strstart+n.lookahead,i),n.lookahead+=t,n.lookahead+n.insert>=z)for(s=n.strstart-n.insert,n.ins_h=n.window[s],n.ins_h=Me(n,n.ins_h,n.window[s+1]);n.insert&&(n.ins_h=Me(n,n.ins_h,n.window[s+z-1]),n.prev[s&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=s,s++,n.insert--,!(n.lookahead+n.insert<z)););}while(n.lookahead<le&&n.strm.avail_in!==0)},qn=(n,e)=>{let t=n.pending_buf_size-5>n.w_size?n.w_size:n.pending_buf_size-5,i,s,r,o=0,a=n.strm.avail_in;do{if(i=65535,r=n.bi_valid+42>>3,n.strm.avail_out<r||(r=n.strm.avail_out-r,s=n.strstart-n.block_start,i>s+n.strm.avail_in&&(i=s+n.strm.avail_in),i>r&&(i=r),i<t&&(i===0&&e!==ee||e===Te||i!==s+n.strm.avail_in)))break;o=e===ee&&i===s+n.strm.avail_in?1:0,Zi(n,0,0,o),n.pending_buf[n.pending-4]=i,n.pending_buf[n.pending-3]=i>>8,n.pending_buf[n.pending-2]=~i,n.pending_buf[n.pending-1]=~i>>8,J(n.strm),s&&(s>i&&(s=i),n.strm.output.set(n.window.subarray(n.block_start,n.block_start+s),n.strm.next_out),n.strm.next_out+=s,n.strm.avail_out-=s,n.strm.total_out+=s,n.block_start+=s,i-=s),i&&(Qi(n.strm,n.strm.output,n.strm.next_out,i),n.strm.next_out+=i,n.strm.avail_out-=i,n.strm.total_out+=i)}while(o===0);return a-=n.strm.avail_in,a&&(a>=n.w_size?(n.matches=2,n.window.set(n.strm.input.subarray(n.strm.next_in-n.w_size,n.strm.next_in),0),n.strstart=n.w_size,n.insert=n.strstart):(n.window_size-n.strstart<=a&&(n.strstart-=n.w_size,n.window.set(n.window.subarray(n.w_size,n.w_size+n.strstart),0),n.matches<2&&n.matches++,n.insert>n.strstart&&(n.insert=n.strstart)),n.window.set(n.strm.input.subarray(n.strm.next_in-a,n.strm.next_in),n.strstart),n.strstart+=a,n.insert+=a>n.w_size-n.insert?n.w_size-n.insert:a),n.block_start=n.strstart),n.high_water<n.strstart&&(n.high_water=n.strstart),o?lt:e!==Te&&e!==ee&&n.strm.avail_in===0&&n.strstart===n.block_start?at:(r=n.window_size-n.strstart,n.strm.avail_in>r&&n.block_start>=n.w_size&&(n.block_start-=n.w_size,n.strstart-=n.w_size,n.window.set(n.window.subarray(n.w_size,n.w_size+n.strstart),0),n.matches<2&&n.matches++,r+=n.w_size,n.insert>n.strstart&&(n.insert=n.strstart)),r>n.strm.avail_in&&(r=n.strm.avail_in),r&&(Qi(n.strm,n.window,n.strstart,r),n.strstart+=r,n.insert+=r>n.w_size-n.insert?n.w_size-n.insert:r),n.high_water<n.strstart&&(n.high_water=n.strstart),r=n.bi_valid+42>>3,r=n.pending_buf_size-r>65535?65535:n.pending_buf_size-r,t=r>n.w_size?n.w_size:r,s=n.strstart-n.block_start,(s>=t||(s||e===ee)&&e!==Te&&n.strm.avail_in===0&&s<=r)&&(i=s>r?r:s,o=e===ee&&n.strm.avail_in===0&&i===s?1:0,Zi(n,n.block_start,i,o),n.block_start+=i,J(n.strm)),o?Ne:Z)},li=(n,e)=>{let t,i;for(;;){if(n.lookahead<le){if(rt(n),n.lookahead<le&&e===Te)return Z;if(n.lookahead===0)break}if(t=0,n.lookahead>=z&&(n.ins_h=Me(n,n.ins_h,n.window[n.strstart+z-1]),t=n.prev[n.strstart&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=n.strstart),t!==0&&n.strstart-t<=n.w_size-le&&(n.match_length=Jn(n,t)),n.match_length>=z)if(i=ke(n,n.strstart-n.match_start,n.match_length-z),n.lookahead-=n.match_length,n.match_length<=n.max_lazy_match&&n.lookahead>=z){n.match_length--;do n.strstart++,n.ins_h=Me(n,n.ins_h,n.window[n.strstart+z-1]),t=n.prev[n.strstart&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=n.strstart;while(--n.match_length!==0);n.strstart++}else n.strstart+=n.match_length,n.match_length=0,n.ins_h=n.window[n.strstart],n.ins_h=Me(n,n.ins_h,n.window[n.strstart+1]);else i=ke(n,0,n.window[n.strstart]),n.lookahead--,n.strstart++;if(i&&(q(n,!1),n.strm.avail_out===0))return Z}return n.insert=n.strstart<z-1?n.strstart:z-1,e===ee?(q(n,!0),n.strm.avail_out===0?Ne:lt):n.sym_next&&(q(n,!1),n.strm.avail_out===0)?Z:at},Ye=(n,e)=>{let t,i,s;for(;;){if(n.lookahead<le){if(rt(n),n.lookahead<le&&e===Te)return Z;if(n.lookahead===0)break}if(t=0,n.lookahead>=z&&(n.ins_h=Me(n,n.ins_h,n.window[n.strstart+z-1]),t=n.prev[n.strstart&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=n.strstart),n.prev_length=n.match_length,n.prev_match=n.match_start,n.match_length=z-1,t!==0&&n.prev_length<n.max_lazy_match&&n.strstart-t<=n.w_size-le&&(n.match_length=Jn(n,t),n.match_length<=5&&(n.strategy===Ul||n.match_length===z&&n.strstart-n.match_start>4096)&&(n.match_length=z-1)),n.prev_length>=z&&n.match_length<=n.prev_length){s=n.strstart+n.lookahead-z,i=ke(n,n.strstart-1-n.prev_match,n.prev_length-z),n.lookahead-=n.prev_length-1,n.prev_length-=2;do++n.strstart<=s&&(n.ins_h=Me(n,n.ins_h,n.window[n.strstart+z-1]),t=n.prev[n.strstart&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=n.strstart);while(--n.prev_length!==0);if(n.match_available=0,n.match_length=z-1,n.strstart++,i&&(q(n,!1),n.strm.avail_out===0))return Z}else if(n.match_available){if(i=ke(n,0,n.window[n.strstart-1]),i&&q(n,!1),n.strstart++,n.lookahead--,n.strm.avail_out===0)return Z}else n.match_available=1,n.strstart++,n.lookahead--}return n.match_available&&(i=ke(n,0,n.window[n.strstart-1]),n.match_available=0),n.insert=n.strstart<z-1?n.strstart:z-1,e===ee?(q(n,!0),n.strm.avail_out===0?Ne:lt):n.sym_next&&(q(n,!1),n.strm.avail_out===0)?Z:at},hh=(n,e)=>{let t,i,s,r;const o=n.window;for(;;){if(n.lookahead<=_e){if(rt(n),n.lookahead<=_e&&e===Te)return Z;if(n.lookahead===0)break}if(n.match_length=0,n.lookahead>=z&&n.strstart>0&&(s=n.strstart-1,i=o[s],i===o[++s]&&i===o[++s]&&i===o[++s])){r=n.strstart+_e;do;while(i===o[++s]&&i===o[++s]&&i===o[++s]&&i===o[++s]&&i===o[++s]&&i===o[++s]&&i===o[++s]&&i===o[++s]&&s<r);n.match_length=_e-(r-s),n.match_length>n.lookahead&&(n.match_length=n.lookahead)}if(n.match_length>=z?(t=ke(n,1,n.match_length-z),n.lookahead-=n.match_length,n.strstart+=n.match_length,n.match_length=0):(t=ke(n,0,n.window[n.strstart]),n.lookahead--,n.strstart++),t&&(q(n,!1),n.strm.avail_out===0))return Z}return n.insert=0,e===ee?(q(n,!0),n.strm.avail_out===0?Ne:lt):n.sym_next&&(q(n,!1),n.strm.avail_out===0)?Z:at},dh=(n,e)=>{let t;for(;;){if(n.lookahead===0&&(rt(n),n.lookahead===0)){if(e===Te)return Z;break}if(n.match_length=0,t=ke(n,0,n.window[n.strstart]),n.lookahead--,n.strstart++,t&&(q(n,!1),n.strm.avail_out===0))return Z}return n.insert=0,e===ee?(q(n,!0),n.strm.avail_out===0?Ne:lt):n.sym_next&&(q(n,!1),n.strm.avail_out===0)?Z:at};function re(n,e,t,i,s){this.good_length=n,this.max_lazy=e,this.nice_length=t,this.max_chain=i,this.func=s}const ft=[new re(0,0,0,0,qn),new re(4,4,8,4,li),new re(4,5,16,8,li),new re(4,6,32,32,li),new re(4,4,16,16,Ye),new re(8,16,32,32,Ye),new re(8,16,128,128,Ye),new re(8,32,128,256,Ye),new re(32,128,258,1024,Ye),new re(32,258,258,4096,Ye)],uh=n=>{n.window_size=2*n.w_size,xe(n.head),n.max_lazy_match=ft[n.level].max_lazy,n.good_match=ft[n.level].good_length,n.nice_match=ft[n.level].nice_length,n.max_chain_length=ft[n.level].max_chain,n.strstart=0,n.block_start=0,n.lookahead=0,n.insert=0,n.match_length=n.prev_length=z-1,n.match_available=0,n.ins_h=0};function ch(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Yt,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(sh*2),this.dyn_dtree=new Uint16Array((2*th+1)*2),this.bl_tree=new Uint16Array((2*ih+1)*2),xe(this.dyn_ltree),xe(this.dyn_dtree),xe(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(nh+1),this.heap=new Uint16Array(2*Xi+1),xe(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Xi+1),xe(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Ft=n=>{if(!n)return 1;const e=n.state;return!e||e.strm!==n||e.status!==nt&&e.status!==as&&e.status!==Ki&&e.status!==Yi&&e.status!==Ji&&e.status!==qi&&e.status!==Oe&&e.status!==ct?1:0},Qn=n=>{if(Ft(n))return Pe(n,ae);n.total_in=n.total_out=0,n.data_type=Kl;const e=n.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?as:e.wrap?nt:Oe,n.adler=e.wrap===2?0:1,e.last_flush=-2,Bl(e),G},er=n=>{const e=Qn(n);return e===G&&uh(n.state),e},fh=(n,e)=>Ft(n)||n.state.wrap!==2?ae:(n.state.gzhead=e,G),tr=(n,e,t,i,s,r)=>{if(!n)return ae;let o=1;if(e===jl&&(e=6),i<0?(o=0,i=-i):i>15&&(o=2,i-=16),s<1||s>Yl||t!==Yt||i<8||i>15||e<0||e>9||r<0||r>Zl||i===8&&o!==1)return Pe(n,ae);i===8&&(i=9);const a=new ch;return n.state=a,a.strm=n,a.status=nt,a.wrap=o,a.gzhead=null,a.w_bits=i,a.w_size=1<<a.w_bits,a.w_mask=a.w_size-1,a.hash_bits=s+7,a.hash_size=1<<a.hash_bits,a.hash_mask=a.hash_size-1,a.hash_shift=~~((a.hash_bits+z-1)/z),a.window=new Uint8Array(a.w_size*2),a.head=new Uint16Array(a.hash_size),a.prev=new Uint16Array(a.w_size),a.lit_bufsize=1<<s+6,a.pending_buf_size=a.lit_bufsize*4,a.pending_buf=new Uint8Array(a.pending_buf_size),a.sym_buf=a.lit_bufsize,a.sym_end=(a.lit_bufsize-1)*3,a.level=e,a.strategy=r,a.method=t,er(n)},ph=(n,e)=>tr(n,e,Yt,Jl,ql,Xl),gh=(n,e)=>{if(Ft(n)||e>Ms||e<0)return n?Pe(n,ae):ae;const t=n.state;if(!n.output||n.avail_in!==0&&!n.input||t.status===ct&&e!==ee)return Pe(n,n.avail_out===0?ai:ae);const i=t.last_flush;if(t.last_flush=e,t.pending!==0){if(J(n),n.avail_out===0)return t.last_flush=-1,G}else if(n.avail_in===0&&Ls(e)<=Ls(i)&&e!==ee)return Pe(n,ai);if(t.status===ct&&n.avail_in!==0)return Pe(n,ai);if(t.status===nt&&t.wrap===0&&(t.status=Oe),t.status===nt){let s=Yt+(t.w_bits-8<<4)<<8,r=-1;if(t.strategy>=Pt||t.level<2?r=0:t.level<6?r=1:t.level===6?r=2:r=3,s|=r<<6,t.strstart!==0&&(s|=rh),s+=31-s%31,ut(t,s),t.strstart!==0&&(ut(t,n.adler>>>16),ut(t,n.adler&65535)),n.adler=1,t.status=Oe,J(n),t.pending!==0)return t.last_flush=-1,G}if(t.status===as){if(n.adler=0,F(t,31),F(t,139),F(t,8),t.gzhead)F(t,(t.gzhead.text?1:0)+(t.gzhead.hcrc?2:0)+(t.gzhead.extra?4:0)+(t.gzhead.name?8:0)+(t.gzhead.comment?16:0)),F(t,t.gzhead.time&255),F(t,t.gzhead.time>>8&255),F(t,t.gzhead.time>>16&255),F(t,t.gzhead.time>>24&255),F(t,t.level===9?2:t.strategy>=Pt||t.level<2?4:0),F(t,t.gzhead.os&255),t.gzhead.extra&&t.gzhead.extra.length&&(F(t,t.gzhead.extra.length&255),F(t,t.gzhead.extra.length>>8&255)),t.gzhead.hcrc&&(n.adler=W(n.adler,t.pending_buf,t.pending,0)),t.gzindex=0,t.status=Ki;else if(F(t,0),F(t,0),F(t,0),F(t,0),F(t,0),F(t,t.level===9?2:t.strategy>=Pt||t.level<2?4:0),F(t,oh),t.status=Oe,J(n),t.pending!==0)return t.last_flush=-1,G}if(t.status===Ki){if(t.gzhead.extra){let s=t.pending,r=(t.gzhead.extra.length&65535)-t.gzindex;for(;t.pending+r>t.pending_buf_size;){let a=t.pending_buf_size-t.pending;if(t.pending_buf.set(t.gzhead.extra.subarray(t.gzindex,t.gzindex+a),t.pending),t.pending=t.pending_buf_size,t.gzhead.hcrc&&t.pending>s&&(n.adler=W(n.adler,t.pending_buf,t.pending-s,s)),t.gzindex+=a,J(n),t.pending!==0)return t.last_flush=-1,G;s=0,r-=a}let o=new Uint8Array(t.gzhead.extra);t.pending_buf.set(o.subarray(t.gzindex,t.gzindex+r),t.pending),t.pending+=r,t.gzhead.hcrc&&t.pending>s&&(n.adler=W(n.adler,t.pending_buf,t.pending-s,s)),t.gzindex=0}t.status=Yi}if(t.status===Yi){if(t.gzhead.name){let s=t.pending,r;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>s&&(n.adler=W(n.adler,t.pending_buf,t.pending-s,s)),J(n),t.pending!==0)return t.last_flush=-1,G;s=0}t.gzindex<t.gzhead.name.length?r=t.gzhead.name.charCodeAt(t.gzindex++)&255:r=0,F(t,r)}while(r!==0);t.gzhead.hcrc&&t.pending>s&&(n.adler=W(n.adler,t.pending_buf,t.pending-s,s)),t.gzindex=0}t.status=Ji}if(t.status===Ji){if(t.gzhead.comment){let s=t.pending,r;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>s&&(n.adler=W(n.adler,t.pending_buf,t.pending-s,s)),J(n),t.pending!==0)return t.last_flush=-1,G;s=0}t.gzindex<t.gzhead.comment.length?r=t.gzhead.comment.charCodeAt(t.gzindex++)&255:r=0,F(t,r)}while(r!==0);t.gzhead.hcrc&&t.pending>s&&(n.adler=W(n.adler,t.pending_buf,t.pending-s,s))}t.status=qi}if(t.status===qi){if(t.gzhead.hcrc){if(t.pending+2>t.pending_buf_size&&(J(n),t.pending!==0))return t.last_flush=-1,G;F(t,n.adler&255),F(t,n.adler>>8&255),n.adler=0}if(t.status=Oe,J(n),t.pending!==0)return t.last_flush=-1,G}if(n.avail_in!==0||t.lookahead!==0||e!==Te&&t.status!==ct){let s=t.level===0?qn(t,e):t.strategy===Pt?dh(t,e):t.strategy===$l?hh(t,e):ft[t.level].func(t,e);if((s===Ne||s===lt)&&(t.status=ct),s===Z||s===Ne)return n.avail_out===0&&(t.last_flush=-1),G;if(s===at&&(e===Vl?Nl(t):e!==Ms&&(Zi(t,0,0,!1),e===Wl&&(xe(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),J(n),n.avail_out===0))return t.last_flush=-1,G}return e!==ee?G:t.wrap<=0?Ss:(t.wrap===2?(F(t,n.adler&255),F(t,n.adler>>8&255),F(t,n.adler>>16&255),F(t,n.adler>>24&255),F(t,n.total_in&255),F(t,n.total_in>>8&255),F(t,n.total_in>>16&255),F(t,n.total_in>>24&255)):(ut(t,n.adler>>>16),ut(t,n.adler&65535)),J(n),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?G:Ss)},mh=n=>{if(Ft(n))return ae;const e=n.state.status;return n.state=null,e===Oe?Pe(n,Gl):G},bh=(n,e)=>{let t=e.length;if(Ft(n))return ae;const i=n.state,s=i.wrap;if(s===2||s===1&&i.status!==nt||i.lookahead)return ae;if(s===1&&(n.adler=kt(n.adler,e,t,0)),i.wrap=0,t>=i.w_size){s===0&&(xe(i.head),i.strstart=0,i.block_start=0,i.insert=0);let l=new Uint8Array(i.w_size);l.set(e.subarray(t-i.w_size,t),0),e=l,t=i.w_size}const r=n.avail_in,o=n.next_in,a=n.input;for(n.avail_in=t,n.next_in=0,n.input=e,rt(i);i.lookahead>=z;){let l=i.strstart,h=i.lookahead-(z-1);do i.ins_h=Me(i,i.ins_h,i.window[l+z-1]),i.prev[l&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=l,l++;while(--h);i.strstart=l,i.lookahead=z-1,rt(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=z-1,i.match_available=0,n.next_in=o,n.input=a,n.avail_in=r,i.wrap=s,G};var vh=ph,wh=tr,Ch=er,yh=Qn,Eh=fh,Rh=gh,xh=mh,_h=bh,kh="pako deflate (from Nodeca project)",gt={deflateInit:vh,deflateInit2:wh,deflateReset:Ch,deflateResetKeep:yh,deflateSetHeader:Eh,deflate:Rh,deflateEnd:xh,deflateSetDictionary:_h,deflateInfo:kh};const Th=(n,e)=>Object.prototype.hasOwnProperty.call(n,e);var Mh=function(n){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const t=e.shift();if(t){if(typeof t!="object")throw new TypeError(t+"must be non-object");for(const i in t)Th(t,i)&&(n[i]=t[i])}}return n},Sh=n=>{let e=0;for(let i=0,s=n.length;i<s;i++)e+=n[i].length;const t=new Uint8Array(e);for(let i=0,s=0,r=n.length;i<r;i++){let o=n[i];t.set(o,s),s+=o.length}return t},Jt={assign:Mh,flattenChunks:Sh};let ir=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{ir=!1}const Tt=new Uint8Array(256);for(let n=0;n<256;n++)Tt[n]=n>=252?6:n>=248?5:n>=240?4:n>=224?3:n>=192?2:1;Tt[254]=Tt[254]=1;var Lh=n=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(n);let e,t,i,s,r,o=n.length,a=0;for(s=0;s<o;s++)t=n.charCodeAt(s),(t&64512)===55296&&s+1<o&&(i=n.charCodeAt(s+1),(i&64512)===56320&&(t=65536+(t-55296<<10)+(i-56320),s++)),a+=t<128?1:t<2048?2:t<65536?3:4;for(e=new Uint8Array(a),r=0,s=0;r<a;s++)t=n.charCodeAt(s),(t&64512)===55296&&s+1<o&&(i=n.charCodeAt(s+1),(i&64512)===56320&&(t=65536+(t-55296<<10)+(i-56320),s++)),t<128?e[r++]=t:t<2048?(e[r++]=192|t>>>6,e[r++]=128|t&63):t<65536?(e[r++]=224|t>>>12,e[r++]=128|t>>>6&63,e[r++]=128|t&63):(e[r++]=240|t>>>18,e[r++]=128|t>>>12&63,e[r++]=128|t>>>6&63,e[r++]=128|t&63);return e};const Dh=(n,e)=>{if(e<65534&&n.subarray&&ir)return String.fromCharCode.apply(null,n.length===e?n:n.subarray(0,e));let t="";for(let i=0;i<e;i++)t+=String.fromCharCode(n[i]);return t};var zh=(n,e)=>{const t=e||n.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(n.subarray(0,e));let i,s;const r=new Array(t*2);for(s=0,i=0;i<t;){let o=n[i++];if(o<128){r[s++]=o;continue}let a=Tt[o];if(a>4){r[s++]=65533,i+=a-1;continue}for(o&=a===2?31:a===3?15:7;a>1&&i<t;)o=o<<6|n[i++]&63,a--;if(a>1){r[s++]=65533;continue}o<65536?r[s++]=o:(o-=65536,r[s++]=55296|o>>10&1023,r[s++]=56320|o&1023)}return Dh(r,s)},Fh=(n,e)=>{e=e||n.length,e>n.length&&(e=n.length);let t=e-1;for(;t>=0&&(n[t]&192)===128;)t--;return t<0||t===0?e:t+Tt[n[t]]>e?t:e},Mt={string2buf:Lh,buf2string:zh,utf8border:Fh};function Hh(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var sr=Hh;const nr=Object.prototype.toString,{Z_NO_FLUSH:Ah,Z_SYNC_FLUSH:Oh,Z_FULL_FLUSH:Ph,Z_FINISH:Bh,Z_OK:Ut,Z_STREAM_END:Ih,Z_DEFAULT_COMPRESSION:Nh,Z_DEFAULT_STRATEGY:Vh,Z_DEFLATED:Wh}=zt;function Ht(n){this.options=Jt.assign({level:Nh,method:Wh,chunkSize:16384,windowBits:15,memLevel:8,strategy:Vh},n||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new sr,this.strm.avail_out=0;let t=gt.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(t!==Ut)throw new Error(Ie[t]);if(e.header&&gt.deflateSetHeader(this.strm,e.header),e.dictionary){let i;if(typeof e.dictionary=="string"?i=Mt.string2buf(e.dictionary):nr.call(e.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(e.dictionary):i=e.dictionary,t=gt.deflateSetDictionary(this.strm,i),t!==Ut)throw new Error(Ie[t]);this._dict_set=!0}}Ht.prototype.push=function(n,e){const t=this.strm,i=this.options.chunkSize;let s,r;if(this.ended)return!1;for(e===~~e?r=e:r=e===!0?Bh:Ah,typeof n=="string"?t.input=Mt.string2buf(n):nr.call(n)==="[object ArrayBuffer]"?t.input=new Uint8Array(n):t.input=n,t.next_in=0,t.avail_in=t.input.length;;){if(t.avail_out===0&&(t.output=new Uint8Array(i),t.next_out=0,t.avail_out=i),(r===Oh||r===Ph)&&t.avail_out<=6){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(s=gt.deflate(t,r),s===Ih)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),s=gt.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===Ut;if(t.avail_out===0){this.onData(t.output);continue}if(r>0&&t.next_out>0){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(t.avail_in===0)break}return!0};Ht.prototype.onData=function(n){this.chunks.push(n)};Ht.prototype.onEnd=function(n){n===Ut&&(this.result=Jt.flattenChunks(this.chunks)),this.chunks=[],this.err=n,this.msg=this.strm.msg};function ls(n,e){const t=new Ht(e);if(t.push(n,!0),t.err)throw t.msg||Ie[t.err];return t.result}function Gh(n,e){return e=e||{},e.raw=!0,ls(n,e)}function jh(n,e){return e=e||{},e.gzip=!0,ls(n,e)}var Uh=Ht,$h=ls,Zh=Gh,Xh=jh,Kh={Deflate:Uh,deflate:$h,deflateRaw:Zh,gzip:Xh};const Bt=16209,Yh=16191;var Jh=function(e,t){let i,s,r,o,a,l,h,d,c,u,f,p,m,b,g,R,E,v,C,k,y,_,T,x;const L=e.state;i=e.next_in,T=e.input,s=i+(e.avail_in-5),r=e.next_out,x=e.output,o=r-(t-e.avail_out),a=r+(e.avail_out-257),l=L.dmax,h=L.wsize,d=L.whave,c=L.wnext,u=L.window,f=L.hold,p=L.bits,m=L.lencode,b=L.distcode,g=(1<<L.lenbits)-1,R=(1<<L.distbits)-1;e:do{p<15&&(f+=T[i++]<<p,p+=8,f+=T[i++]<<p,p+=8),E=m[f&g];t:for(;;){if(v=E>>>24,f>>>=v,p-=v,v=E>>>16&255,v===0)x[r++]=E&65535;else if(v&16){C=E&65535,v&=15,v&&(p<v&&(f+=T[i++]<<p,p+=8),C+=f&(1<<v)-1,f>>>=v,p-=v),p<15&&(f+=T[i++]<<p,p+=8,f+=T[i++]<<p,p+=8),E=b[f&R];i:for(;;){if(v=E>>>24,f>>>=v,p-=v,v=E>>>16&255,v&16){if(k=E&65535,v&=15,p<v&&(f+=T[i++]<<p,p+=8,p<v&&(f+=T[i++]<<p,p+=8)),k+=f&(1<<v)-1,k>l){e.msg="invalid distance too far back",L.mode=Bt;break e}if(f>>>=v,p-=v,v=r-o,k>v){if(v=k-v,v>d&&L.sane){e.msg="invalid distance too far back",L.mode=Bt;break e}if(y=0,_=u,c===0){if(y+=h-v,v<C){C-=v;do x[r++]=u[y++];while(--v);y=r-k,_=x}}else if(c<v){if(y+=h+c-v,v-=c,v<C){C-=v;do x[r++]=u[y++];while(--v);if(y=0,c<C){v=c,C-=v;do x[r++]=u[y++];while(--v);y=r-k,_=x}}}else if(y+=c-v,v<C){C-=v;do x[r++]=u[y++];while(--v);y=r-k,_=x}for(;C>2;)x[r++]=_[y++],x[r++]=_[y++],x[r++]=_[y++],C-=3;C&&(x[r++]=_[y++],C>1&&(x[r++]=_[y++]))}else{y=r-k;do x[r++]=x[y++],x[r++]=x[y++],x[r++]=x[y++],C-=3;while(C>2);C&&(x[r++]=x[y++],C>1&&(x[r++]=x[y++]))}}else if((v&64)===0){E=b[(E&65535)+(f&(1<<v)-1)];continue i}else{e.msg="invalid distance code",L.mode=Bt;break e}break}}else if((v&64)===0){E=m[(E&65535)+(f&(1<<v)-1)];continue t}else if(v&32){L.mode=Yh;break e}else{e.msg="invalid literal/length code",L.mode=Bt;break e}break}}while(i<s&&r<a);C=p>>3,i-=C,p-=C<<3,f&=(1<<p)-1,e.next_in=i,e.next_out=r,e.avail_in=i<s?5+(s-i):5-(i-s),e.avail_out=r<a?257+(a-r):257-(r-a),L.hold=f,L.bits=p};const Je=15,Ds=852,zs=592,Fs=0,hi=1,Hs=2,qh=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Qh=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),ed=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),td=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),id=(n,e,t,i,s,r,o,a)=>{const l=a.bits;let h=0,d=0,c=0,u=0,f=0,p=0,m=0,b=0,g=0,R=0,E,v,C,k,y,_=null,T;const x=new Uint16Array(Je+1),L=new Uint16Array(Je+1);let S=null,Se,he,Ke;for(h=0;h<=Je;h++)x[h]=0;for(d=0;d<i;d++)x[e[t+d]]++;for(f=l,u=Je;u>=1&&x[u]===0;u--);if(f>u&&(f=u),u===0)return s[r++]=1<<24|64<<16|0,s[r++]=1<<24|64<<16|0,a.bits=1,0;for(c=1;c<u&&x[c]===0;c++);for(f<c&&(f=c),b=1,h=1;h<=Je;h++)if(b<<=1,b-=x[h],b<0)return-1;if(b>0&&(n===Fs||u!==1))return-1;for(L[1]=0,h=1;h<Je;h++)L[h+1]=L[h]+x[h];for(d=0;d<i;d++)e[t+d]!==0&&(o[L[e[t+d]]++]=d);if(n===Fs?(_=S=o,T=20):n===hi?(_=qh,S=Qh,T=257):(_=ed,S=td,T=0),R=0,d=0,h=c,y=r,p=f,m=0,C=-1,g=1<<f,k=g-1,n===hi&&g>Ds||n===Hs&&g>zs)return 1;for(;;){Se=h-m,o[d]+1<T?(he=0,Ke=o[d]):o[d]>=T?(he=S[o[d]-T],Ke=_[o[d]-T]):(he=96,Ke=0),E=1<<h-m,v=1<<p,c=v;do v-=E,s[y+(R>>m)+v]=Se<<24|he<<16|Ke|0;while(v!==0);for(E=1<<h-1;R&E;)E>>=1;if(E!==0?(R&=E-1,R+=E):R=0,d++,--x[h]===0){if(h===u)break;h=e[t+o[d]]}if(h>f&&(R&k)!==C){for(m===0&&(m=f),y+=c,p=h-m,b=1<<p;p+m<u&&(b-=x[p+m],!(b<=0));)p++,b<<=1;if(g+=1<<p,n===hi&&g>Ds||n===Hs&&g>zs)return 1;C=R&k,s[C]=f<<24|p<<16|y-r|0}}return R!==0&&(s[y+R]=h-m<<24|64<<16|0),a.bits=f,0};var mt=id;const sd=0,rr=1,or=2,{Z_FINISH:As,Z_BLOCK:nd,Z_TREES:It,Z_OK:Ve,Z_STREAM_END:rd,Z_NEED_DICT:od,Z_STREAM_ERROR:te,Z_DATA_ERROR:ar,Z_MEM_ERROR:lr,Z_BUF_ERROR:ad,Z_DEFLATED:Os}=zt,qt=16180,Ps=16181,Bs=16182,Is=16183,Ns=16184,Vs=16185,Ws=16186,Gs=16187,js=16188,Us=16189,$t=16190,ue=16191,di=16192,$s=16193,ui=16194,Zs=16195,Xs=16196,Ks=16197,Ys=16198,Nt=16199,Vt=16200,Js=16201,qs=16202,Qs=16203,en=16204,tn=16205,ci=16206,sn=16207,nn=16208,B=16209,hr=16210,dr=16211,ld=852,hd=592,dd=15,ud=dd,rn=n=>(n>>>24&255)+(n>>>8&65280)+((n&65280)<<8)+((n&255)<<24);function cd(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Xe=n=>{if(!n)return 1;const e=n.state;return!e||e.strm!==n||e.mode<qt||e.mode>dr?1:0},ur=n=>{if(Xe(n))return te;const e=n.state;return n.total_in=n.total_out=e.total=0,n.msg="",e.wrap&&(n.adler=e.wrap&1),e.mode=qt,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(ld),e.distcode=e.distdyn=new Int32Array(hd),e.sane=1,e.back=-1,Ve},cr=n=>{if(Xe(n))return te;const e=n.state;return e.wsize=0,e.whave=0,e.wnext=0,ur(n)},fr=(n,e)=>{let t;if(Xe(n))return te;const i=n.state;return e<0?(t=0,e=-e):(t=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?te:(i.window!==null&&i.wbits!==e&&(i.window=null),i.wrap=t,i.wbits=e,cr(n))},pr=(n,e)=>{if(!n)return te;const t=new cd;n.state=t,t.strm=n,t.window=null,t.mode=qt;const i=fr(n,e);return i!==Ve&&(n.state=null),i},fd=n=>pr(n,ud);let on=!0,fi,pi;const pd=n=>{if(on){fi=new Int32Array(512),pi=new Int32Array(32);let e=0;for(;e<144;)n.lens[e++]=8;for(;e<256;)n.lens[e++]=9;for(;e<280;)n.lens[e++]=7;for(;e<288;)n.lens[e++]=8;for(mt(rr,n.lens,0,288,fi,0,n.work,{bits:9}),e=0;e<32;)n.lens[e++]=5;mt(or,n.lens,0,32,pi,0,n.work,{bits:5}),on=!1}n.lencode=fi,n.lenbits=9,n.distcode=pi,n.distbits=5},gr=(n,e,t,i)=>{let s;const r=n.state;return r.window===null&&(r.wsize=1<<r.wbits,r.wnext=0,r.whave=0,r.window=new Uint8Array(r.wsize)),i>=r.wsize?(r.window.set(e.subarray(t-r.wsize,t),0),r.wnext=0,r.whave=r.wsize):(s=r.wsize-r.wnext,s>i&&(s=i),r.window.set(e.subarray(t-i,t-i+s),r.wnext),i-=s,i?(r.window.set(e.subarray(t-i,t),0),r.wnext=i,r.whave=r.wsize):(r.wnext+=s,r.wnext===r.wsize&&(r.wnext=0),r.whave<r.wsize&&(r.whave+=s))),0},gd=(n,e)=>{let t,i,s,r,o,a,l,h,d,c,u,f,p,m,b=0,g,R,E,v,C,k,y,_;const T=new Uint8Array(4);let x,L;const S=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Xe(n)||!n.output||!n.input&&n.avail_in!==0)return te;t=n.state,t.mode===ue&&(t.mode=di),o=n.next_out,s=n.output,l=n.avail_out,r=n.next_in,i=n.input,a=n.avail_in,h=t.hold,d=t.bits,c=a,u=l,_=Ve;e:for(;;)switch(t.mode){case qt:if(t.wrap===0){t.mode=di;break}for(;d<16;){if(a===0)break e;a--,h+=i[r++]<<d,d+=8}if(t.wrap&2&&h===35615){t.wbits===0&&(t.wbits=15),t.check=0,T[0]=h&255,T[1]=h>>>8&255,t.check=W(t.check,T,2,0),h=0,d=0,t.mode=Ps;break}if(t.head&&(t.head.done=!1),!(t.wrap&1)||(((h&255)<<8)+(h>>8))%31){n.msg="incorrect header check",t.mode=B;break}if((h&15)!==Os){n.msg="unknown compression method",t.mode=B;break}if(h>>>=4,d-=4,y=(h&15)+8,t.wbits===0&&(t.wbits=y),y>15||y>t.wbits){n.msg="invalid window size",t.mode=B;break}t.dmax=1<<t.wbits,t.flags=0,n.adler=t.check=1,t.mode=h&512?Us:ue,h=0,d=0;break;case Ps:for(;d<16;){if(a===0)break e;a--,h+=i[r++]<<d,d+=8}if(t.flags=h,(t.flags&255)!==Os){n.msg="unknown compression method",t.mode=B;break}if(t.flags&57344){n.msg="unknown header flags set",t.mode=B;break}t.head&&(t.head.text=h>>8&1),t.flags&512&&t.wrap&4&&(T[0]=h&255,T[1]=h>>>8&255,t.check=W(t.check,T,2,0)),h=0,d=0,t.mode=Bs;case Bs:for(;d<32;){if(a===0)break e;a--,h+=i[r++]<<d,d+=8}t.head&&(t.head.time=h),t.flags&512&&t.wrap&4&&(T[0]=h&255,T[1]=h>>>8&255,T[2]=h>>>16&255,T[3]=h>>>24&255,t.check=W(t.check,T,4,0)),h=0,d=0,t.mode=Is;case Is:for(;d<16;){if(a===0)break e;a--,h+=i[r++]<<d,d+=8}t.head&&(t.head.xflags=h&255,t.head.os=h>>8),t.flags&512&&t.wrap&4&&(T[0]=h&255,T[1]=h>>>8&255,t.check=W(t.check,T,2,0)),h=0,d=0,t.mode=Ns;case Ns:if(t.flags&1024){for(;d<16;){if(a===0)break e;a--,h+=i[r++]<<d,d+=8}t.length=h,t.head&&(t.head.extra_len=h),t.flags&512&&t.wrap&4&&(T[0]=h&255,T[1]=h>>>8&255,t.check=W(t.check,T,2,0)),h=0,d=0}else t.head&&(t.head.extra=null);t.mode=Vs;case Vs:if(t.flags&1024&&(f=t.length,f>a&&(f=a),f&&(t.head&&(y=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Uint8Array(t.head.extra_len)),t.head.extra.set(i.subarray(r,r+f),y)),t.flags&512&&t.wrap&4&&(t.check=W(t.check,i,f,r)),a-=f,r+=f,t.length-=f),t.length))break e;t.length=0,t.mode=Ws;case Ws:if(t.flags&2048){if(a===0)break e;f=0;do y=i[r+f++],t.head&&y&&t.length<65536&&(t.head.name+=String.fromCharCode(y));while(y&&f<a);if(t.flags&512&&t.wrap&4&&(t.check=W(t.check,i,f,r)),a-=f,r+=f,y)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=Gs;case Gs:if(t.flags&4096){if(a===0)break e;f=0;do y=i[r+f++],t.head&&y&&t.length<65536&&(t.head.comment+=String.fromCharCode(y));while(y&&f<a);if(t.flags&512&&t.wrap&4&&(t.check=W(t.check,i,f,r)),a-=f,r+=f,y)break e}else t.head&&(t.head.comment=null);t.mode=js;case js:if(t.flags&512){for(;d<16;){if(a===0)break e;a--,h+=i[r++]<<d,d+=8}if(t.wrap&4&&h!==(t.check&65535)){n.msg="header crc mismatch",t.mode=B;break}h=0,d=0}t.head&&(t.head.hcrc=t.flags>>9&1,t.head.done=!0),n.adler=t.check=0,t.mode=ue;break;case Us:for(;d<32;){if(a===0)break e;a--,h+=i[r++]<<d,d+=8}n.adler=t.check=rn(h),h=0,d=0,t.mode=$t;case $t:if(t.havedict===0)return n.next_out=o,n.avail_out=l,n.next_in=r,n.avail_in=a,t.hold=h,t.bits=d,od;n.adler=t.check=1,t.mode=ue;case ue:if(e===nd||e===It)break e;case di:if(t.last){h>>>=d&7,d-=d&7,t.mode=ci;break}for(;d<3;){if(a===0)break e;a--,h+=i[r++]<<d,d+=8}switch(t.last=h&1,h>>>=1,d-=1,h&3){case 0:t.mode=$s;break;case 1:if(pd(t),t.mode=Nt,e===It){h>>>=2,d-=2;break e}break;case 2:t.mode=Xs;break;case 3:n.msg="invalid block type",t.mode=B}h>>>=2,d-=2;break;case $s:for(h>>>=d&7,d-=d&7;d<32;){if(a===0)break e;a--,h+=i[r++]<<d,d+=8}if((h&65535)!==(h>>>16^65535)){n.msg="invalid stored block lengths",t.mode=B;break}if(t.length=h&65535,h=0,d=0,t.mode=ui,e===It)break e;case ui:t.mode=Zs;case Zs:if(f=t.length,f){if(f>a&&(f=a),f>l&&(f=l),f===0)break e;s.set(i.subarray(r,r+f),o),a-=f,r+=f,l-=f,o+=f,t.length-=f;break}t.mode=ue;break;case Xs:for(;d<14;){if(a===0)break e;a--,h+=i[r++]<<d,d+=8}if(t.nlen=(h&31)+257,h>>>=5,d-=5,t.ndist=(h&31)+1,h>>>=5,d-=5,t.ncode=(h&15)+4,h>>>=4,d-=4,t.nlen>286||t.ndist>30){n.msg="too many length or distance symbols",t.mode=B;break}t.have=0,t.mode=Ks;case Ks:for(;t.have<t.ncode;){for(;d<3;){if(a===0)break e;a--,h+=i[r++]<<d,d+=8}t.lens[S[t.have++]]=h&7,h>>>=3,d-=3}for(;t.have<19;)t.lens[S[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,x={bits:t.lenbits},_=mt(sd,t.lens,0,19,t.lencode,0,t.work,x),t.lenbits=x.bits,_){n.msg="invalid code lengths set",t.mode=B;break}t.have=0,t.mode=Ys;case Ys:for(;t.have<t.nlen+t.ndist;){for(;b=t.lencode[h&(1<<t.lenbits)-1],g=b>>>24,R=b>>>16&255,E=b&65535,!(g<=d);){if(a===0)break e;a--,h+=i[r++]<<d,d+=8}if(E<16)h>>>=g,d-=g,t.lens[t.have++]=E;else{if(E===16){for(L=g+2;d<L;){if(a===0)break e;a--,h+=i[r++]<<d,d+=8}if(h>>>=g,d-=g,t.have===0){n.msg="invalid bit length repeat",t.mode=B;break}y=t.lens[t.have-1],f=3+(h&3),h>>>=2,d-=2}else if(E===17){for(L=g+3;d<L;){if(a===0)break e;a--,h+=i[r++]<<d,d+=8}h>>>=g,d-=g,y=0,f=3+(h&7),h>>>=3,d-=3}else{for(L=g+7;d<L;){if(a===0)break e;a--,h+=i[r++]<<d,d+=8}h>>>=g,d-=g,y=0,f=11+(h&127),h>>>=7,d-=7}if(t.have+f>t.nlen+t.ndist){n.msg="invalid bit length repeat",t.mode=B;break}for(;f--;)t.lens[t.have++]=y}}if(t.mode===B)break;if(t.lens[256]===0){n.msg="invalid code -- missing end-of-block",t.mode=B;break}if(t.lenbits=9,x={bits:t.lenbits},_=mt(rr,t.lens,0,t.nlen,t.lencode,0,t.work,x),t.lenbits=x.bits,_){n.msg="invalid literal/lengths set",t.mode=B;break}if(t.distbits=6,t.distcode=t.distdyn,x={bits:t.distbits},_=mt(or,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,x),t.distbits=x.bits,_){n.msg="invalid distances set",t.mode=B;break}if(t.mode=Nt,e===It)break e;case Nt:t.mode=Vt;case Vt:if(a>=6&&l>=258){n.next_out=o,n.avail_out=l,n.next_in=r,n.avail_in=a,t.hold=h,t.bits=d,Jh(n,u),o=n.next_out,s=n.output,l=n.avail_out,r=n.next_in,i=n.input,a=n.avail_in,h=t.hold,d=t.bits,t.mode===ue&&(t.back=-1);break}for(t.back=0;b=t.lencode[h&(1<<t.lenbits)-1],g=b>>>24,R=b>>>16&255,E=b&65535,!(g<=d);){if(a===0)break e;a--,h+=i[r++]<<d,d+=8}if(R&&(R&240)===0){for(v=g,C=R,k=E;b=t.lencode[k+((h&(1<<v+C)-1)>>v)],g=b>>>24,R=b>>>16&255,E=b&65535,!(v+g<=d);){if(a===0)break e;a--,h+=i[r++]<<d,d+=8}h>>>=v,d-=v,t.back+=v}if(h>>>=g,d-=g,t.back+=g,t.length=E,R===0){t.mode=tn;break}if(R&32){t.back=-1,t.mode=ue;break}if(R&64){n.msg="invalid literal/length code",t.mode=B;break}t.extra=R&15,t.mode=Js;case Js:if(t.extra){for(L=t.extra;d<L;){if(a===0)break e;a--,h+=i[r++]<<d,d+=8}t.length+=h&(1<<t.extra)-1,h>>>=t.extra,d-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=qs;case qs:for(;b=t.distcode[h&(1<<t.distbits)-1],g=b>>>24,R=b>>>16&255,E=b&65535,!(g<=d);){if(a===0)break e;a--,h+=i[r++]<<d,d+=8}if((R&240)===0){for(v=g,C=R,k=E;b=t.distcode[k+((h&(1<<v+C)-1)>>v)],g=b>>>24,R=b>>>16&255,E=b&65535,!(v+g<=d);){if(a===0)break e;a--,h+=i[r++]<<d,d+=8}h>>>=v,d-=v,t.back+=v}if(h>>>=g,d-=g,t.back+=g,R&64){n.msg="invalid distance code",t.mode=B;break}t.offset=E,t.extra=R&15,t.mode=Qs;case Qs:if(t.extra){for(L=t.extra;d<L;){if(a===0)break e;a--,h+=i[r++]<<d,d+=8}t.offset+=h&(1<<t.extra)-1,h>>>=t.extra,d-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){n.msg="invalid distance too far back",t.mode=B;break}t.mode=en;case en:if(l===0)break e;if(f=u-l,t.offset>f){if(f=t.offset-f,f>t.whave&&t.sane){n.msg="invalid distance too far back",t.mode=B;break}f>t.wnext?(f-=t.wnext,p=t.wsize-f):p=t.wnext-f,f>t.length&&(f=t.length),m=t.window}else m=s,p=o-t.offset,f=t.length;f>l&&(f=l),l-=f,t.length-=f;do s[o++]=m[p++];while(--f);t.length===0&&(t.mode=Vt);break;case tn:if(l===0)break e;s[o++]=t.length,l--,t.mode=Vt;break;case ci:if(t.wrap){for(;d<32;){if(a===0)break e;a--,h|=i[r++]<<d,d+=8}if(u-=l,n.total_out+=u,t.total+=u,t.wrap&4&&u&&(n.adler=t.check=t.flags?W(t.check,s,u,o-u):kt(t.check,s,u,o-u)),u=l,t.wrap&4&&(t.flags?h:rn(h))!==t.check){n.msg="incorrect data check",t.mode=B;break}h=0,d=0}t.mode=sn;case sn:if(t.wrap&&t.flags){for(;d<32;){if(a===0)break e;a--,h+=i[r++]<<d,d+=8}if(t.wrap&4&&h!==(t.total&4294967295)){n.msg="incorrect length check",t.mode=B;break}h=0,d=0}t.mode=nn;case nn:_=rd;break e;case B:_=ar;break e;case hr:return lr;case dr:default:return te}return n.next_out=o,n.avail_out=l,n.next_in=r,n.avail_in=a,t.hold=h,t.bits=d,(t.wsize||u!==n.avail_out&&t.mode<B&&(t.mode<ci||e!==As))&&gr(n,n.output,n.next_out,u-n.avail_out),c-=n.avail_in,u-=n.avail_out,n.total_in+=c,n.total_out+=u,t.total+=u,t.wrap&4&&u&&(n.adler=t.check=t.flags?W(t.check,s,u,n.next_out-u):kt(t.check,s,u,n.next_out-u)),n.data_type=t.bits+(t.last?64:0)+(t.mode===ue?128:0)+(t.mode===Nt||t.mode===ui?256:0),(c===0&&u===0||e===As)&&_===Ve&&(_=ad),_},md=n=>{if(Xe(n))return te;let e=n.state;return e.window&&(e.window=null),n.state=null,Ve},bd=(n,e)=>{if(Xe(n))return te;const t=n.state;return(t.wrap&2)===0?te:(t.head=e,e.done=!1,Ve)},vd=(n,e)=>{const t=e.length;let i,s,r;return Xe(n)||(i=n.state,i.wrap!==0&&i.mode!==$t)?te:i.mode===$t&&(s=1,s=kt(s,e,t,0),s!==i.check)?ar:(r=gr(n,e,t,t),r?(i.mode=hr,lr):(i.havedict=1,Ve))};var wd=cr,Cd=fr,yd=ur,Ed=fd,Rd=pr,xd=gd,_d=md,kd=bd,Td=vd,Md="pako inflate (from Nodeca project)",ge={inflateReset:wd,inflateReset2:Cd,inflateResetKeep:yd,inflateInit:Ed,inflateInit2:Rd,inflate:xd,inflateEnd:_d,inflateGetHeader:kd,inflateSetDictionary:Td,inflateInfo:Md};function Sd(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var Ld=Sd;const mr=Object.prototype.toString,{Z_NO_FLUSH:Dd,Z_FINISH:zd,Z_OK:St,Z_STREAM_END:gi,Z_NEED_DICT:mi,Z_STREAM_ERROR:Fd,Z_DATA_ERROR:an,Z_MEM_ERROR:Hd}=zt;function At(n){this.options=Jt.assign({chunkSize:1024*64,windowBits:15,to:""},n||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(n&&n.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15)===0&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new sr,this.strm.avail_out=0;let t=ge.inflateInit2(this.strm,e.windowBits);if(t!==St)throw new Error(Ie[t]);if(this.header=new Ld,ge.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=Mt.string2buf(e.dictionary):mr.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(t=ge.inflateSetDictionary(this.strm,e.dictionary),t!==St)))throw new Error(Ie[t])}At.prototype.push=function(n,e){const t=this.strm,i=this.options.chunkSize,s=this.options.dictionary;let r,o,a;if(this.ended)return!1;for(e===~~e?o=e:o=e===!0?zd:Dd,mr.call(n)==="[object ArrayBuffer]"?t.input=new Uint8Array(n):t.input=n,t.next_in=0,t.avail_in=t.input.length;;){for(t.avail_out===0&&(t.output=new Uint8Array(i),t.next_out=0,t.avail_out=i),r=ge.inflate(t,o),r===mi&&s&&(r=ge.inflateSetDictionary(t,s),r===St?r=ge.inflate(t,o):r===an&&(r=mi));t.avail_in>0&&r===gi&&t.state.wrap>0&&n[t.next_in]!==0;)ge.inflateReset(t),r=ge.inflate(t,o);switch(r){case Fd:case an:case mi:case Hd:return this.onEnd(r),this.ended=!0,!1}if(a=t.avail_out,t.next_out&&(t.avail_out===0||r===gi))if(this.options.to==="string"){let l=Mt.utf8border(t.output,t.next_out),h=t.next_out-l,d=Mt.buf2string(t.output,l);t.next_out=h,t.avail_out=i-h,h&&t.output.set(t.output.subarray(l,l+h),0),this.onData(d)}else this.onData(t.output.length===t.next_out?t.output:t.output.subarray(0,t.next_out));if(!(r===St&&a===0)){if(r===gi)return r=ge.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,!0;if(t.avail_in===0)break}}return!0};At.prototype.onData=function(n){this.chunks.push(n)};At.prototype.onEnd=function(n){n===St&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Jt.flattenChunks(this.chunks)),this.chunks=[],this.err=n,this.msg=this.strm.msg};function hs(n,e){const t=new At(e);if(t.push(n),t.err)throw t.msg||Ie[t.err];return t.result}function Ad(n,e){return e=e||{},e.raw=!0,hs(n,e)}var Od=At,Pd=hs,Bd=Ad,Id=hs,Nd={Inflate:Od,inflate:Pd,inflateRaw:Bd,ungzip:Id};const{Deflate:Vd,deflate:Wd,deflateRaw:Gd,gzip:jd}=Kh,{Inflate:Ud,inflate:$d,inflateRaw:Zd,ungzip:Xd}=Nd;var Kd=Vd,Yd=Wd,Jd=Gd,qd=jd,Qd=Ud,eu=$d,tu=Zd,iu=Xd,su=zt,nu={Deflate:Kd,deflate:Yd,deflateRaw:Jd,gzip:qd,Inflate:Qd,inflate:eu,inflateRaw:tu,ungzip:iu,constants:su};const es={Today:"Today",LastDay:"LastDay",ThisWeek:"ThisWeek",LastWeek:"LastWeek",ThisMonth:"ThisMonth",LastMonth:"LastMonth",ThisYear:"ThisYear",LastYear:"LastYear"};function br(n){const e=new Date;let t,i=new Date(e);switch(n){case"Today":t=new Date(e.getFullYear(),e.getMonth(),e.getDate());break;case"LastDay":t=new Date(e.getFullYear(),e.getMonth(),e.getDate()-1),i=new Date(t.getFullYear(),t.getMonth(),t.getDate(),23,59);break;case"LastWeek":const s=new Date,r=e.getDay()===0?6:e.getDay()-1;s.setDate(e.getDate()-r-7),t=new Date(s.getFullYear(),s.getMonth(),s.getDate()),i=new Date(t),i.setDate(t.getDate()+6),i.setHours(23,59);break;case"LastMonth":t=new Date(e.getFullYear(),e.getMonth()-1,1),i=new Date(e.getFullYear(),e.getMonth(),0,23,59);break;case"LastYear":t=new Date(e.getFullYear()-1,0,1),i=new Date(e.getFullYear()-1,11,31,23,59);break;case"ThisWeek":t=new Date;const o=e.getDay()===0?6:e.getDay()-1;t.setDate(e.getDate()-o),t.setHours(0,0);break;case"ThisMonth":t=new Date(e.getFullYear(),e.getMonth(),1);break;case"ThisYear":t=new Date(e.getFullYear(),0,1);break;default:throw new Error("Invalid TimeRange provided")}return{startTime:t,startTimeUtc:t.toISOString().slice(0,16),endTime:i,endTimeUtc:i.toISOString().slice(0,16)}}var ru=(n,e,t)=>e(br(N(t))),ou=Q("<option> </option>"),au=Q('<div class="flex flex-col gap-2"><div class="text-lg">Time Range</div> <select class="text-lg bg-base-300 p-1"></select></div>');function lu(n,e){ln(e,!0);let t=De(e,"timeRange",15),i=be(hn(es.Today));var s=au(),r=$(O(s),2);r.__change=[ru,t,i],Lr(r,21,()=>Object.keys(es),zr,(o,a)=>{var l=ou(),h=O(l,!0);H(l);var d={};un(()=>{bi(h,N(a)),d!==(d=N(a))&&(l.value=(l.__value=N(a))??"")}),V(o,l)}),H(r),H(s),Dr(r,()=>N(i),o=>ie(i,o)),V(n,s),dn()}ts(["change"]);var hu=Q("<li><button><!> PNG</button></li>"),du=Q("<li><button><!> PDF</button></li>"),uu=Q("<li><button><!> XLSX</button></li>"),cu=Q("<li><button><!> CSV</button></li>"),fu=Q("<li><button><!> JSON</button></li>"),pu=Q('<div class="dropdown dropdown-end" style="z-index: 50"><button class="btn btn-sm btn-secondary tooltip tooltip-bottom" data-tip="Export data"><!></button> <ul class="dropdown-content menu p-2 shadow bg-base-100 rounded-box w-40"><!> <!> <!> <!> <!></ul></div>');function gu(n,e){let t=De(e,"saveToPng",3,void 0),i=De(e,"saveToPdf",3,void 0),s=De(e,"saveToXlsx",3,void 0),r=De(e,"saveToCsv",3,void 0),o=De(e,"saveToJson",3,void 0);var a=pu(),l=O(a),h=O(l);Ar(h,{}),H(l);var d=$(l,2),c=O(d);{var u=C=>{var k=hu(),y=O(k);y.__click=function(...T){var x;(x=t())==null||x.apply(this,T)};var _=O(y);Nr(_,{}),ht(),H(y),H(k),V(C,k)};me(c,C=>{t()&&C(u)})}var f=$(c,2);{var p=C=>{var k=du(),y=O(k);y.__click=function(...T){var x;(x=i())==null||x.apply(this,T)};var _=O(y);Pr(_,{}),ht(),H(y),H(k),V(C,k)};me(f,C=>{i()&&C(p)})}var m=$(f,2);{var b=C=>{var k=uu(),y=O(k);y.__click=function(...T){var x;(x=s())==null||x.apply(this,T)};var _=O(y);Br(_,{}),ht(),H(y),H(k),V(C,k)};me(m,C=>{s()&&C(b)})}var g=$(m,2);{var R=C=>{var k=cu(),y=O(k);y.__click=function(...T){var x;(x=r())==null||x.apply(this,T)};var _=O(y);Ir(_,{}),ht(),H(y),H(k),V(C,k)};me(g,C=>{r()&&C(R)})}var E=$(g,2);{var v=C=>{var k=fu(),y=O(k);y.__click=function(...T){var x;(x=o())==null||x.apply(this,T)};var _=O(y);Or(_,{}),ht(),H(y),H(k),V(C,k)};me(E,C=>{o()&&C(v)})}H(d),H(a),V(n,a)}ts(["click"]);var mu=Q('<button class="btn btn-sm btn-secondary tooltip tooltip-bottom" data-tip="Reset Filter"><!></button>'),bu=Q('<div class="flex gap-2 py-2"><span>Value filter:</span> <input type="number" class="input input-bordered input-sm w-20" placeholder="Min"/> <input type="number" class="input input-bordered input-sm w-20" placeholder="Max"/> <!></div>'),vu=Q('<button class="btn btn-sm btn-secondary tooltip tooltip-bottom" data-tip="Reset sorting"><!></button>'),wu=Q('<div class="card bg-base-200 p-3 text-base-content"><div class="flex justify-between items-start mb-3"><div class="flex"><!></div> <div class="gap-4"><div class="text-lg"> </div> <!></div> <div class="flex flex-col items-end"><div> </div> <div class="flex flex-row gap-2 mt-2"><!> <!></div></div></div> <div></div></div>');function Cu(n,e){ln(e,!0);let t=De(e,"height",3,"1024px"),i=new gs(`${ms.getClientId()}/${e.topic}_History`),s=new gs(e.topic),r=be(""),o=be(0),a=null,l,h=be(!1);const d=e.topic.replace("/","_");Cs.extendModule("download","downloaders",{string(M){let I=M.toString();return"data:application/txt;charset=utf-8,"+encodeURIComponent(I)}});function c(){const M=Intl.NumberFormat().resolvedOptions().locale;return console.log(M),M.startsWith("no")?";":","}function u(){l.download("csv",d+".csv",{delimiter:c()})}function f(){l.download("json",d+".json")}function p(){let M="portrait";l.getColumns().length>4&&(M="landscape"),l.download("pdf",d+".pdf",{orientation:M,title:e.topic})}function m(){l.download("xlsx",d+".xlsx",{sheetName:d})}ei(()=>{if(i.value)try{let M=i.value;if(b(M)){const ne=Uint8Array.from(atob(M),de=>de.charCodeAt(0));M=nu.inflate(ne,{to:"string"})}const I=JSON.parse(M);if(!I.length)return;ie(o,I.length,!0),I.length>0?l.setData(I):l.clearData()}catch(M){console.error("Failed to parse history data:",M)}}),ei(()=>{if(s.value){let M=JSON.parse(s.value);M.unit&&ie(r,M.unit,!0)}});function b(M){try{return btoa(atob(M))===M}catch{return!1}}Sr(async()=>{a&&(l=new Cs(a,{layout:"fitColumns",height:t(),movableColumns:!0,index:"T",columns:[{title:"Time",field:"T"},{title:"Value",field:"V",formatter(M){return`${M.getValue()} ${N(r)}`}}],renderVertical:"virtual"}),l.on("dataSorted",()=>{ie(h,l.getSorters().length>0)}))});let g=be(hn(br(es.Today)));ei(()=>{const M=JSON.stringify({format:"object",startTime:N(g).startTimeUtc,endTime:N(g).endTimeUtc,gzip:!0});ms.publish(e.topic+"/History",M,!1),console.log("Sent history request:",M)});function R(){l.clearSort()}let E=be(""),v=be(""),C=be(!1);function k(){if(!l)return;const M=N(E)?parseFloat(N(E)):null,I=N(v)?parseFloat(N(v)):null;ie(C,M!==null||I!==null,!0),l.setFilter(ne=>{const de=parseFloat(ne.V);return!(M!==null&&de<M||I!==null&&de>I)})}function y(){ie(E,""),ie(v,""),ie(C,!1),l.clearFilter(!1)}var _=wu(),T=O(_),x=O(T),L=O(x);lu(L,{get timeRange(){return N(g)},set timeRange(M){ie(g,M,!0)}}),H(x);var S=$(x,2),Se=O(S),he=O(Se,!0);H(Se);var Ke=$(Se,2);{var vr=M=>{var I=bu(),ne=$(O(I),2);fs(ne),ne.__input=k;var de=$(ne,2);fs(de),de.__input=k;var xr=$(de,2);{var _r=Le=>{var Ot=mu();Ot.__click=y;var kr=O(Ot);Hr(kr,{}),H(Ot),V(Le,Ot)};me(xr,Le=>{N(C)&&Le(_r)})}H(I),ps(ne,()=>N(E),Le=>ie(E,Le)),ps(de,()=>N(v),Le=>ie(v,Le)),V(M,I)};me(Ke,M=>{N(o)&&M(vr)})}H(S);var ds=$(S,2),Qt=O(ds),wr=O(Qt);H(Qt);var us=$(Qt,2),cs=O(us);{var Cr=M=>{var I=vu();I.__click=R;var ne=O(I);Vr(ne,{}),H(I),V(M,I)};me(cs,M=>{N(h)&&M(Cr)})}var yr=$(cs,2);{var Er=M=>{gu(M,{saveToCsv:u,saveToJson:f,saveToPdf:p,saveToXlsx:m})};me(yr,M=>{N(o)&&M(Er)})}H(us),H(ds),H(T);var Rr=$(T,2);Fr(Rr,M=>a=M,()=>a),H(_),un(()=>{bi(he,e.topic),bi(wr,`${N(o)??""} Entries`)}),V(n,_),dn()}ts(["input","click"]);var yu=Q('<section><div class="container mx-auto p-4"><!></div></section>');function Au(n){var e=yu(),t=O(e),i=O(t);Cu(i,{topic:"HAN2X_70389/actPowPos"}),H(t),H(e),V(n,e)}export{Au as component};
