simple-table-core 3.0.0 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/src/core/rendering/RenderOrchestrator.d.ts +6 -0
- package/dist/cjs/src/utils/horizontalScrollbarRenderer.d.ts +5 -0
- package/dist/cjs/stories/tests/13-ColumnResizeTests.stories.d.ts +12 -0
- package/dist/index.es.js +1 -1
- package/dist/src/core/rendering/RenderOrchestrator.d.ts +6 -0
- package/dist/src/utils/horizontalScrollbarRenderer.d.ts +5 -0
- package/dist/stories/tests/13-ColumnResizeTests.stories.d.ts +12 -0
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const t={rowHeight:32,headerHeight:32,footerHeight:49,rowSeparatorWidth:1,borderWidth:1,pinnedBorderWidth:1,nestedGridBorderWidth:2,nestedGridPaddingTop:8,nestedGridPaddingBottom:8,nestedGridPaddingLeft:8,nestedGridPaddingRight:8,nestedGridMaxHeight:400,selectionColumnWidth:42},e=150,n=["lineAreaChart","barChart"],o=40,s=(t,e,n)=>e&&n?480>t?.25:768>t?.3:.4:(t=>480>t?.4:768>t?.5:.6)(t),i="parentExpanded",r=(t,e)=>{if(!t.children||0===t.children.length)return[e];const n=[],o=(t,e)=>{if(!t.children||0===t.children.length)return n.push(e),e+1;let s=e;for(const e of t.children)s=o(e,s);return s};return o(t,e),n},l=t=>t.flatMap(t=>{const e=[t];return t.children&&t.children.length>0&&e.push(...l(t.children)),e}),a=(t=0)=>t?t+1:0,d=t=>{var e;return!(!(null===(e=t.children)||void 0===e?void 0:e.length)||!t.collapsible)},c=({accessor:t,rowId:e})=>`${e}-${t}`,h=({calculatedHeight:t,customHeight:e,customTheme:n})=>e?("string"==typeof e?parseFloat(e):e)+n.nestedGridPaddingTop+n.nestedGridPaddingBottom:t,u=t=>{const e=t.match(/^(.+?)\[(\d+)\]$/);return e?{key:e[1],index:parseInt(e[2],10)}:{key:t,index:null}},p=(t,e)=>{const n=e+"";return n.includes(".")||n.includes("[")?n.split(".").reduce((t,e)=>{if(null==t)return;const{key:n,index:o}=u(e);let s=t[n];return null!==o&&Array.isArray(s)&&(s=s[o]),s},t):t[e]},f=(t,e,n)=>{const o=e+"";if(!o.includes(".")&&!o.includes("["))return void(t[e]=n);const s=o.split(".");let i=t;for(let t=0;s.length-1>t;t++){const{key:e,index:n}=u(s[t]);if(null==i[e]){const n=u(s[t+1]);i[e]=null!==n.index?[]:{}}if(i=i[e],null!==n){if(!Array.isArray(i))throw Error(`Expected array at ${s.slice(0,t+1).join(".")}, but found ${typeof i}`);for(;n>=i.length;)i.push(null);null==i[n]&&(i[n]={}),i=i[n]}}const{key:r,index:l}=u(s[s.length-1]);if(null!==l){for(Array.isArray(i[r])||(i[r]=[]);l>=i[r].length;)i[r].push(null);i[r][l]=n}else i[r]=n},w=t=>Array.isArray(t)&&t.length>0&&"object"==typeof t[0]&&null!==t[0],v=t=>{const{getRowId:e,rowPath:n}=t,o=[...n];if(e){const n=e({row:t.row,depth:t.depth,index:t.index,rowPath:t.rowPath,rowIndexPath:t.rowIndexPath,groupingKey:t.groupingKey});o.push(n)}return o},m=t=>t.join("-"),g=(t,e,n,o,s)=>{const i=t+"",r=o.has(i)&&o.get(i)===e,l=s.has(i)&&s.get(i)===e;return n.has(e)?!l:r},x=(t,e)=>{if(t.hide)return[];if(!t.children||0===t.children.length)return[t];if(e&&e.has(t.accessor)){const n=t.children.filter(t=>{const e=t.showWhen||i;return"parentCollapsed"===e||"always"===e});return t.singleRowChildren?0===n.length?[t]:[t,...n.flatMap(t=>x(t,e))]:0===n.length?[t]:n.flatMap(t=>x(t,e))}const n=t.children.filter(t=>{const e=t.showWhen||i;return"parentExpanded"===e||"always"===e});return t.singleRowChildren?[t,...n.flatMap(t=>x(t,e))]:n.flatMap(t=>x(t,e))};function b(t){if(t.hide)return null;if("number"==typeof t.width)return{type:"px",value:t.width};if("string"!=typeof t.width)return null;const e=t.width.trim();return e.endsWith("px")?{type:"px",value:parseFloat(e)||0}:e.endsWith("fr")?{type:"fr",value:parseFloat(e)||1}:e.endsWith("%")?{type:"pct",value:parseFloat(e)||0}:null}function y(t){const e=[],n=t=>{t.hide||(t.children&&0!==t.children.length?t.children.forEach(n):e.push(t))};return t.forEach(n),e}function R(t,n){const o=t.map(t=>b(t)),s=o.reduce((t,e)=>"px"===(null==e?void 0:e.type)?t+e.value:t,0),i=o.reduce((t,e)=>"pct"===(null==e?void 0:e.type)?t+e.value:t,0),r=n*(i/100),l=o.reduce((t,e)=>"fr"===(null==e?void 0:e.type)?t+e.value:t,0),a=l>0?Math.max(0,n-s-r)/l:150,d=new Map;return t.forEach((t,s)=>{const i=o[s];if(i)if("px"===i.type)d.set(t.accessor,i.value);else if("fr"===i.type){const e=i.value*a,n="number"==typeof t.minWidth?t.minWidth:"string"==typeof t.minWidth&&parseFloat(t.minWidth+"")||0;d.set(t.accessor,n>0?Math.max(e,n):e)}else d.set(t.accessor,"pct"===i.type?n*i.value/100:e);else d.set(t.accessor,e)}),d}function C(t,e){const n="object"==typeof e&&null!=e?e.containerWidth:void 0;let o,s="number"==typeof e?e:void 0;if(null!=n&&n>0){const e=y(t);o=R(e,n)}else{const e=y(t),n=e.map(t=>b(t));let i=s;if(null==i||0>=i){const t=n.reduce((t,e)=>"px"===(null==e?void 0:e.type)?t+e.value:t,0),e=n.filter(t=>"fr"===(null==t?void 0:t.type)).length;i=t+(e>0?150*e:0)+(n.filter(t=>"pct"===(null==t?void 0:t.type)).length>0?160:0),i=Math.max(i,800)}o=R(e,i)}return t.map(function t(e){const n=Object.assign({},e);if(e.children&&e.children.length>0)return n.children=e.children.map(t),n;const s=o.get(e.accessor);return null!=s&&(n.width=s),n})}const S=t=>{if(t.hide)return 0;if("number"==typeof t.width)return t.width;if("string"==typeof t.width&&t.width.endsWith("px"))return parseFloat(t.width);{const n=document.getElementById(c({accessor:t.accessor,rowId:"header"}));return(null==n?void 0:n.offsetWidth)||e}},I=t=>{var n;const o=t.width;"string"==typeof o&&o.includes("fr")&&(t.width=(null===(n=document.getElementById(c({accessor:t.accessor,rowId:"header"})))||void 0===n?void 0:n.offsetWidth)||e),t.children&&t.children.length>0&&t.children.forEach(t=>{I(t)})},H=t=>"number"==typeof t.minWidth?t.minWidth:o,M=(t,e)=>{const n=[];return t.forEach(t=>{t.hide||n.push(...x(t,e))}),n},k=(t,s)=>{const{rows:i,header:r,maxWidth:l=500,sampleSize:a=50,styleRoot:d}=s||{},h=null!=d?d:document,u=document.getElementById(c({accessor:t,rowId:"header"}));if(!u)return e;const f=window.getComputedStyle(u),w=parseFloat(f.paddingLeft)||0,v=parseFloat(f.paddingRight)||0,m=parseFloat(f.gap)||0;let g=w+v;const x=u.querySelector(".st-header-label");if(x){const t=x.querySelector(".st-header-label-text");if(t){const e=document.createElement("span");e.style.visibility="hidden",e.style.position="absolute",e.style.whiteSpace="nowrap",e.style.width="auto";const n=window.getComputedStyle(t);e.style.font=n.font,e.style.fontSize=n.fontSize,e.style.fontWeight=n.fontWeight,e.style.fontFamily=n.fontFamily,e.style.letterSpacing=n.letterSpacing,e.style.padding=n.padding,e.textContent=t.textContent,document.body.appendChild(e);const o=e.offsetWidth;document.body.removeChild(e),g+=o}}const b=Array.from(u.children);let y=1;for(let t=0;b.length>t;t++){const e=b[t];if(e.classList.contains("st-header-label"))continue;if(e.classList.contains("st-sr-only"))continue;const n=window.getComputedStyle(e);"none"!==n.display&&(g+=(e.offsetWidth||0)+(parseFloat(n.marginLeft)||0)+(parseFloat(n.marginRight)||0),y++)}m>0&&y>1&&(g+=m*(y-1));let R=0;const C=r&&r.type&&n.includes(r.type);if(i&&i.length>0&&!C){const e=Math.min(i.length,a),n=document.createElement("div");n.style.visibility="hidden",n.style.position="absolute",n.style.whiteSpace="nowrap",n.style.width="auto";let o=0,s=0;const l=h.querySelector(".st-cell-content");if(l){const t=window.getComputedStyle(l);n.style.font=t.font,n.style.fontSize=t.fontSize,n.style.fontFamily=t.fontFamily,o=parseFloat(t.paddingLeft)||0,s=parseFloat(t.paddingRight)||0}document.body.appendChild(n);for(let l=0;e>l;l++){const e=i[l];let a;a=(null==r?void 0:r.valueGetter)?r.valueGetter({accessor:t,row:e,rowIndex:l}):p(e,t);let d=a;(null==r?void 0:r.valueFormatter)&&null!=a&&(d=r.valueFormatter({accessor:t,colIndex:0,row:e,rowIndex:l,value:a})),n.textContent=null!=d?d+"":"";const c=n.offsetWidth+o+s;c>R&&(R=c)}document.body.removeChild(n)}let S=Math.max(g,R);return C&&(S=Math.max(S,150)),S>l&&(S=l),Math.max(S+2,o)};class E{constructor(t){this.previousValue=t}update(t){const e=this.previousValue;return JSON.stringify(e)!==JSON.stringify(t)&&(this.previousValue=t),e}get(){return this.previousValue}set(t){this.previousValue=t}}const O=(t,e)=>{const n=[];return t.forEach(t=>{t.hide||(t.children&&t.children.length>0?n.push(...O(t.children,null!=e?e:t.pinned)):n.push(t))}),n},T=(t,e)=>e>=t.reduce((t,e)=>t+H(e),0),A=(t,e)=>{const n=new Map,o=t.reduce((t,e)=>t+("number"==typeof e.width?e.width:"string"==typeof e.width&&e.width.endsWith("px")?parseFloat(e.width):150),0);if(0===o)return n;const s=e/o;if(s>=1&&.01>s-1)return n;let i=0;return t.forEach((o,r)=>{const l="number"==typeof o.width?o.width:"string"==typeof o.width&&o.width.endsWith("px")?parseFloat(o.width):150;let a;r===t.length-1?a=e-i:(a=Math.round(l*s),i+=a),n.set(o.accessor,a)}),n},W=(t,e)=>{const{autoExpandColumns:n,containerWidth:o,pinnedLeftWidth:s,pinnedRightWidth:i,isResizing:r}=e;if(!n||0===o||r)return t;const l=Math.max(0,o-s-i),a=t.filter(t=>"left"===t.pinned),d=t.filter(t=>"right"===t.pinned),c=t.filter(t=>!t.pinned),h=O(a,"left"),u=O(d,"right"),p=O(c,void 0),f=h.length>0&&T(h,s),w=u.length>0&&T(u,i),v=p.length>0&&l>0&&T(p,l),m=new Map;if(f&&A(h,s).forEach((t,e)=>m.set(e,t)),w&&A(u,i).forEach((t,e)=>m.set(e,t)),v&&A(p,l).forEach((t,e)=>m.set(e,t)),0===m.size)return t;const g=(t,e)=>{var n;if(t.hide)return t;const o=null!=e?e:t.pinned,s=null===(n=t.children)||void 0===n?void 0:n.map(t=>g(t,o));if(!t.children||0===t.children.length){const e=m.get(t.accessor);return Object.assign(Object.assign({},t),void 0!==e?{width:e,children:s}:{children:s})}return Object.assign(Object.assign({},t),{children:s})};return t.map(t=>g(t,t.pinned))};class P{constructor(t,e){var n;this.config=t,this.onHeadersUpdate=e,this.isResizingTracker=new E(null!==(n=t.isResizing)&&void 0!==n&&n),this.containerWidthTracker=new E(t.containerWidth)}updateConfig(t){var e;this.config=Object.assign(Object.assign({},this.config),t);const n=null!==(e=this.config.isResizing)&&void 0!==e&&e,o=this.config.containerWidth,s=this.isResizingTracker.get();this.isResizingTracker.set(n);const i=this.containerWidthTracker.get();this.containerWidthTracker.set(o),s&&!n&&this.config.autoExpandColumns&&this.triggerAutoScale(),Math.abs(o-i)>10&&!n&&this.config.autoExpandColumns&&this.triggerAutoScale()}triggerAutoScale(){this.onHeadersUpdate&&this.onHeadersUpdate(this.config)}applyAutoScale(t){return W(t,this.config)}setHeaders(t,e){const n="function"==typeof t?t(e):t;return this.applyAutoScale(n)}destroy(){this.onHeadersUpdate=()=>{}}}class ${constructor(t){this.subscribers=new Set,this.resizeObserver=null,this.rafId=null,this.initialNotifyPending=!1,this.config=t;const e=this.calculateMaxHeaderDepth(),n=this.calculateHeaderHeight(e),o=this.calculateContentHeight();this.state={containerWidth:0,calculatedHeaderHeight:n,maxHeaderDepth:e,contentHeight:o},t.containerElement&&this.observeContainer(t.containerElement)}getHeaderDepth(t){var e,n;return t.singleRowChildren&&(null===(e=t.children)||void 0===e?void 0:e.length)?1:(null===(n=t.children)||void 0===n?void 0:n.length)?1+Math.max(...t.children.map(t=>this.getHeaderDepth(t))):1}calculateMaxHeaderDepth(){let t=0;return this.config.effectiveHeaders.forEach(e=>{const n=this.getHeaderDepth(e);t=Math.max(t,n)}),t}calculateHeaderHeight(t){var e;let n=1;if("undefined"!=typeof window){const t=document.documentElement,e=getComputedStyle(t).getPropertyValue("--st-border-width").trim();if(e){const t=parseFloat(e);isNaN(t)||(n=t)}}return t*(null!==(e=this.config.headerHeight)&&void 0!==e?e:this.config.rowHeight)+n}convertHeightToPixels(t){var e;const n=this.config.containerElement||document.querySelector(".simple-table-root");if("string"==typeof t){if(t.endsWith("px"))return parseInt(t,10);if(t.endsWith("vh"))return window.innerHeight*parseInt(t,10)/100;if(t.endsWith("%")){const o=null===(e=null==n?void 0:n.parentElement)||void 0===e?void 0:e.clientHeight;return!o||50>o?0:o*parseInt(t,10)/100}return window.innerHeight}return t}calculateContentHeight(){const{height:t,maxHeight:e,rowHeight:n,totalRowCount:o,headerHeight:s,footerHeight:i}=this.config;if(e){const t=this.convertHeightToPixels(e);if(0===t)return;const r=s||n;if(t>=r+o*n+(i||0)||20>o)return;return Math.max(0,t-r)}if(!t)return;const r=this.convertHeightToPixels(t);return 0!==r?Math.max(0,r-n):void 0}observeContainer(t){this.resizeObserver=new ResizeObserver(()=>{null!==this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=requestAnimationFrame(()=>{this.rafId=null;const e=t.clientWidth,n=e!==this.state.containerWidth;n&&(this.state=Object.assign(Object.assign({},this.state),{containerWidth:e})),(n||this.initialNotifyPending)&&(this.initialNotifyPending=!1,this.notifySubscribers())})}),this.resizeObserver.observe(t),this.applyContainerWidthSync(t)}applyContainerWidthSync(t){const e=t.clientWidth;e>0&&e!==this.state.containerWidth&&(this.state=Object.assign(Object.assign({},this.state),{containerWidth:e}),this.initialNotifyPending=!0)}updateConfig(t){const e=this.config.effectiveHeaders,n=this.config.containerElement;this.config=Object.assign(Object.assign({},this.config),t);let o=!1;if(t.effectiveHeaders&&t.effectiveHeaders!==e){const t=this.calculateMaxHeaderDepth(),e=this.calculateHeaderHeight(t);this.state=Object.assign(Object.assign({},this.state),{maxHeaderDepth:t,calculatedHeaderHeight:e}),o=!0}if(t.height||t.maxHeight||void 0!==t.totalRowCount){const t=this.calculateContentHeight();this.state=Object.assign(Object.assign({},this.state),{contentHeight:t}),o=!0}if(t.containerElement&&t.containerElement!==n&&(this.resizeObserver&&n&&this.resizeObserver.unobserve(n),this.observeContainer(t.containerElement),o=!0),void 0!==t.rowHeight||void 0!==t.headerHeight||void 0!==t.footerHeight){const t=this.calculateHeaderHeight(this.state.maxHeaderDepth),e=this.calculateContentHeight();this.state=Object.assign(Object.assign({},this.state),{calculatedHeaderHeight:t,contentHeight:e}),o=!0}o&&this.notifySubscribers()}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}notifySubscribers(){this.subscribers.forEach(t=>t(this.state))}getState(){return this.state}getContainerWidth(){return this.state.containerWidth}getCalculatedHeaderHeight(){return this.state.calculatedHeaderHeight}getMaxHeaderDepth(){return this.state.maxHeaderDepth}getContentHeight(){return this.state.contentHeight}destroy(){null!==this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.subscribers.clear()}}class D{constructor(t){this.subscribers=new Set,this.lastScrollTop=0,this.scrollTimeoutId=null,this.config=t,this.state={scrollTop:0,scrollLeft:0,scrollDirection:"none",isScrolling:!1}}updateConfig(t){this.config=Object.assign(Object.assign({},this.config),t)}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}notifySubscribers(){this.subscribers.forEach(t=>t(this.state))}handleScroll(t,e,n,o){const s=t>this.lastScrollTop?"down":this.lastScrollTop>t?"up":"none";this.lastScrollTop=t,this.state={scrollTop:t,scrollLeft:e,scrollDirection:s,isScrolling:!0},null!==this.scrollTimeoutId&&clearTimeout(this.scrollTimeoutId),this.scrollTimeoutId=window.setTimeout(()=>{this.state=Object.assign(Object.assign({},this.state),{isScrolling:!1}),this.notifySubscribers()},150),this.config.onLoadMore&&this.config.infiniteScrollThreshold&&this.config.infiniteScrollThreshold>o-(t+n)&&this.config.onLoadMore(),this.notifySubscribers()}setScrolling(t){this.state=Object.assign(Object.assign({},this.state),{isScrolling:t}),this.notifySubscribers()}getState(){return this.state}getScrollTop(){return this.state.scrollTop}getScrollLeft(){return this.state.scrollLeft}getScrollDirection(){return this.state.scrollDirection}isScrolling(){return this.state.isScrolling}destroy(){null!==this.scrollTimeoutId&&(clearTimeout(this.scrollTimeoutId),this.scrollTimeoutId=null),this.subscribers.clear()}}class F{constructor(t={}){this.scrollLeftBySection={"pinned-left":0,main:0,"pinned-right":0},this.panesBySection=new Map([["pinned-left",new Set],["main",new Set],["pinned-right",new Set]]),this.scrollHandlers=new WeakMap,this.isSyncing=!1,this.lastMainVirtualizationScrollLeft=null,this.config=t}updateConfig(t){this.config=Object.assign(Object.assign({},this.config),t)}registerPane(t,e,n){var o;const s=this.panesBySection.get(t);if(Array.from(s).find(t=>t.element===e))return;const i=Array.from(s).find(t=>t.role===n);i&&(this.removeScrollListener(i.element),s.delete(i)),s.add({element:e,role:n}),this.addScrollListener(t,e);const r=null!==(o=this.scrollLeftBySection[t])&&void 0!==o?o:0;e.scrollLeft!==r&&(this.isSyncing=!0,e.scrollLeft=r,this.isSyncing=!1)}unregisterPane(t,e){const n=this.panesBySection.get(t);if(!n)return;this.removeScrollListener(e);const o=Array.from(n).find(t=>t.element===e);o&&n.delete(o)}unregisterSection(t){const e=this.panesBySection.get(t);e&&(e.forEach(({element:t})=>this.removeScrollListener(t)),e.clear())}setSectionScrollLeft(t,e){this.scrollLeftBySection[t]=e;const n=this.panesBySection.get(t);n&&(n.forEach(({element:t})=>{t.scrollLeft!==e&&(t.scrollLeft=e)}),"main"===t&&this.config.onMainSectionScrollLeft&&(this.lastMainVirtualizationScrollLeft=e,this.config.onMainSectionScrollLeft(e)))}getSectionScrollLeft(t){var e;return null!==(e=this.scrollLeftBySection[t])&&void 0!==e?e:0}restoreAll(){["pinned-left","main","pinned-right"].forEach(t=>{var e;const n=null!==(e=this.scrollLeftBySection[t])&&void 0!==e?e:0;this.isSyncing=!0,this.setSectionScrollLeft(t,n),this.isSyncing=!1})}addScrollListener(t,e){this.removeScrollListener(e);const n=()=>{if(this.isSyncing)return;const n=e.scrollLeft;this.scrollLeftBySection[t]=n,this.isSyncing=!0;const o=this.panesBySection.get(t);o&&o.forEach(({element:t})=>{t!==e&&t.scrollLeft!==n&&(t.scrollLeft=n)}),"main"!==t||!this.config.onMainSectionScrollLeft||null!==this.lastMainVirtualizationScrollLeft&&20>Math.abs(n-this.lastMainVirtualizationScrollLeft)||(this.lastMainVirtualizationScrollLeft=n,this.config.onMainSectionScrollLeft(n)),this.isSyncing=!1};this.scrollHandlers.set(e,n),e.addEventListener("scroll",n,{passive:!0})}removeScrollListener(t){const e=this.scrollHandlers.get(t);e&&(t.removeEventListener("scroll",e),this.scrollHandlers.delete(t))}destroy(){["pinned-left","main","pinned-right"].forEach(t=>this.unregisterSection(t))}}const L={string:(t,e,n)=>{if(t===e)return 0;const o=t.localeCompare(e);return"asc"===n?o:-o},number:(t,e,n)=>{if(t===e)return 0;const o=t-e;return"asc"===n?o:-o},boolean:(t,e,n)=>{if(t===e)return 0;const o=t===e?0:t?-1:1;return"asc"===n?o:-o},date:(t,e,n)=>{const o=new Date(t),s=new Date(e);if(o.getTime()===s.getTime())return 0;const i=o.getTime()-s.getTime();return"asc"===n?i:-i},enum:(t,e,n)=>L.string(t,e,n),default:(t,e,n)=>t===e?0:null==t?"asc"===n?-1:1:null==e?"asc"===n?1:-1:"string"==typeof t&&"string"==typeof e?L.string(t,e,n):"number"==typeof t&&"number"==typeof e?L.number(t,e,n):"boolean"==typeof t&&"boolean"==typeof e?L.boolean(t,e,n):L.string(t+"",e+"",n)},j=({headers:t,rows:e,sortColumn:n})=>(({rows:t,sortColumn:e,headers:n})=>{const o=(t,e)=>{for(const n of t){if(n.accessor===e)return n;if(n.children&&n.children.length>0){const t=o(n.children,e);if(t)return t}}},s=o(n,e.key.accessor),i=(null==s?void 0:s.type)||"string",r=e.direction,l=e.key.accessor;return[...t].sort((e,n)=>{let o,a;if(null==s?void 0:s.valueGetter){const i=t.indexOf(e),r=t.indexOf(n);o=s.valueGetter({accessor:l,row:e,rowIndex:i}),a=s.valueGetter({accessor:l,row:n,rowIndex:r})}else o=p(e,l),a=p(n,l);return(null==s?void 0:s.comparator)?s.comparator({rowA:e,rowB:n,valueA:o,valueB:a,direction:r}):((t,e,n="string",o)=>{if(null==t||""===t)return"asc"===o?-1:1;if(null==e||""===e)return"asc"===o?1:-1;if("number"===n){const n=t=>{var e;if("number"==typeof t)return t;const n=t+"";if("string"==typeof n){const t=n.replace(/[$,]/g,"").match(/^([-+]?\d*\.?\d+)([TBMKtbmk])?/);if(t){let n=parseFloat(t[1]);const o=null===(e=t[2])||void 0===e?void 0:e.toUpperCase();return"T"===o?n*=1e12:"B"===o?n*=1e9:"M"===o?n*=1e6:"K"===o&&(n*=1e3),n}}return parseFloat(n)||0},s=n(t),i=n(e);return L.number(s,i,o)}return"date"===n?L.date(t+"",e+"",o):"boolean"===n?L.boolean(!!t,!!e,o):"enum"===n?L.enum(t+"",e+"",o):L.string(t+"",e+"",o)})(o,a,i,r)})})({rows:e,sortColumn:n,headers:t}),B=t=>{const{rows:e=[],headers:n=[],rowGrouping:o,rowManager:s}=t;if(s)return s.getAggregatedRows();if(!o||0===o.length)return e;const i=(t=>l(t).filter(t=>t.aggregation))(n);if(0===i.length)return e;const r=JSON.parse(JSON.stringify(e)),a=(t,e=0)=>t.map(t=>{const n=o[e],s=o[e+1],r=t[n];if(r&&w(r)){const o=a(r,e+1),l=Object.assign({},t);return l[n]=o,i.forEach(t=>{const e=((t,e,n,o)=>{const s=[],i=t=>{t.forEach(t=>{const n=o?t[o]:void 0;if(o&&n&&w(n))i(n);else{const n=p(t,e);null!=n&&s.push(n)}})};if(i(t),0===s.length)return;if("custom"===n.type&&n.customFn)return n.customFn(s);const r=n.parseValue?s.map(n.parseValue).filter(t=>!isNaN(t)):s.map(t=>"number"==typeof t?t:"string"==typeof t?parseFloat(t):NaN).filter(t=>!isNaN(t));if(0===r.length)return"count"===n.type?s.length:void 0;let l;switch(n.type){case"sum":l=r.reduce((t,e)=>t+e,0);break;case"average":l=r.reduce((t,e)=>t+e,0)/r.length;break;case"count":l=s.length;break;case"min":l=Math.min(...r);break;case"max":l=Math.max(...r);break;default:return}return n.formatResult?n.formatResult(l):l})(o,t.accessor,t.aggregation,s);void 0!==e&&f(l,t.accessor,e)}),l}return t});return a(r)};class N{constructor(t){this.subscribers=new Set,this.headerLookup=new Map,this.config=t,this.updateHeaderLookup();const e=this.getInitialSort(),n=this.computeSortedRows(t.tableRows,e);this.state={sort:e,sortedRows:n}}updateHeaderLookup(){const t=l(this.config.headers);this.headerLookup=new Map,t.forEach(t=>{this.headerLookup.set(t.accessor,t)})}getInitialSort(){if(!this.config.initialSortColumn)return null;const t=this.headerLookup.get(this.config.initialSortColumn);return t?{key:t,direction:this.config.initialSortDirection||"asc"}:null}sortNestedRows({groupingKeys:t,headers:e,rows:n,sortColumn:o}){const s=j({headers:e,rows:n,sortColumn:o});return t&&0!==t.length?s.map(n=>{const s=t[0],i=n[s];if(w(i)){const r=this.sortNestedRows({rows:i,sortColumn:o,headers:e,groupingKeys:t.slice(1)});return Object.assign(Object.assign({},n),{[s]:r})}return n}):s}computeSortedRows(t,e){if(this.config.externalSortHandling)return t;const n=B({rows:t,headers:this.config.headers,rowGrouping:this.config.rowGrouping});return e?this.config.rowGrouping&&this.config.rowGrouping.length>0?this.sortNestedRows({groupingKeys:this.config.rowGrouping,headers:this.config.headers,rows:n,sortColumn:e}):j({headers:this.config.headers,rows:n,sortColumn:e}):n}updateConfig(t){const e=this.config.headers;this.config=Object.assign(Object.assign({},this.config),t),t.headers&&t.headers!==e&&this.updateHeaderLookup();const n=this.computeSortedRows(this.config.tableRows,this.state.sort);n!==this.state.sortedRows&&(this.state=Object.assign(Object.assign({},this.state),{sortedRows:n}),this.notifySubscribers())}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}notifySubscribers(){this.subscribers.forEach(t=>t(this.state))}updateSort(t){var e,n,o,s;if(!t)return this.state=Object.assign(Object.assign({},this.state),{sort:null,sortedRows:this.config.tableRows}),null===(n=(e=this.config).onSortChange)||void 0===n||n.call(e,null),void this.notifySubscribers();const{accessor:i,direction:r}=t,l=this.headerLookup.get(i);if(!l)return;let a=null;if(r)a={key:l,direction:r};else{const t=l.sortingOrder||["asc","desc",null];let e=-1;this.state.sort&&this.state.sort.key.accessor===i&&(e=t.indexOf(this.state.sort.direction));const n=t[(e+1)%t.length];a=null===n?null:{key:l,direction:n}}const d=this.computeSortedRows(this.config.tableRows,a);this.state={sort:a,sortedRows:d},null===(s=(o=this.config).onSortChange)||void 0===s||s.call(o,a),this.config.announce&&this.config.announce(a?`Sorted by ${l.label}, ${"asc"===a.direction?"ascending":"descending"}`:"Sort removed from "+l.label),this.notifySubscribers()}computeSortedRowsPreview(t){const e=n=>{for(const o of n){if(o.accessor===t)return o;if(o.children&&o.children.length>0){const t=e(o.children);if(t)return t}}},n=e(this.config.headers);if(!n)return this.config.tableRows;let o=null;const s=n.sortingOrder||["asc","desc",null];let i=-1;this.state.sort&&this.state.sort.key.accessor===t&&(i=s.indexOf(this.state.sort.direction));const r=s[(i+1)%s.length];return o=null===r?null:{key:n,direction:r},this.computeSortedRows(this.config.tableRows,o)}getState(){return this.state}getSortColumn(){return this.state.sort}getSortedRows(){return this.state.sortedRows}destroy(){this.subscribers.clear()}}const z=t=>{if(!t)return new Date;if(/^\d{4}-\d{2}-\d{2}$/.test(t)){const[e,n,o]=t.split("-").map(Number);return new Date(e,n-1,o,12,0,0)}const e=new Date(t);return isNaN(e.getTime())?new Date:new Date(e.getFullYear(),e.getMonth(),e.getDate(),12,0,0)},V=t=>new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0),q=t=>{if(!t)return new Date;if("string"==typeof t)return z(t);if("number"==typeof t){const e=new Date(t);return isNaN(e.getTime())?new Date:V(e)}return t instanceof Date?V(t):new Date};class G{constructor(t){this.subscribers=new Set,this.headerLookup=new Map,this.config=t,this.updateHeaderLookup();const e={},n=this.computeFilteredRows(t.rows,e);this.state={filters:e,filteredRows:n}}updateHeaderLookup(){const t=l(this.config.headers);this.headerLookup=new Map,t.forEach(t=>{this.headerLookup.set(t.accessor,t)})}computeFilteredRows(t,e){return this.config.externalFilterHandling?t:e&&0!==Object.keys(e).length?t.filter(t=>Object.values(e).every(e=>{try{return((t,e)=>{const{operator:n,value:o,values:s}=e;if(null==t)return"isEmpty"===n;if("isEmpty"===n)return!t||""===(t+"").trim();if("isNotEmpty"===n)return t&&""!==(t+"").trim();if("string"==typeof t||"contains"===n||"notContains"===n||"startsWith"===n||"endsWith"===n){const e=(t+"").toLowerCase(),s=o?(o+"").toLowerCase():"";switch(n){case"equals":return e===s;case"notEquals":return e!==s;case"contains":return e.includes(s);case"notContains":return!e.includes(s);case"startsWith":return e.startsWith(s);case"endsWith":return e.endsWith(s)}}if("number"==typeof t||!isNaN(+t)){const e=+t,i=+o;switch(n){case"equals":return e===i;case"notEquals":return e!==i;case"greaterThan":return e>i;case"lessThan":return i>e;case"greaterThanOrEqual":return e>=i;case"lessThanOrEqual":return i>=e;case"between":if(s&&2===s.length){const[t,n]=s.map(Number);return e>=t&&n>=e}return!1;case"notBetween":if(s&&2===s.length){const[t,n]=s.map(Number);return t>e||e>n}return!0}}if(t instanceof Date||!isNaN(Date.parse(t))){const e=q(t),i=q((o||"")+""),r=V(e),l=V(i);switch(n){case"equals":return r.getTime()===l.getTime();case"notEquals":return r.getTime()!==l.getTime();case"before":return l>r;case"after":return r>l;case"between":if(s&&2===s.length){const[t,e]=s.map(t=>V(q((t||"")+"")));return r>=t&&e>=r}return!1;case"notBetween":if(s&&2===s.length){const[t,e]=s.map(t=>V(q((t||"")+"")));return t>r||r>e}return!0}}if("boolean"==typeof t&&"equals"===n)return t===!!o;if(Array.isArray(t)){const e=t.map(t=>"object"==typeof t&&null!==t?JSON.stringify(t):t+"").join(", ");t=e}if("in"===n||"notIn"===n){if(s&&Array.isArray(s)){const e=s.includes(t+"");return"in"===n?e:!e}return!1}const i=(t+"").toLowerCase(),r=o?(o+"").toLowerCase():"";switch(n){case"equals":return i===r;case"notEquals":return i!==r;default:return!0}})(p(t,e.accessor),e)}catch(t){return console.warn(`Filter error for accessor ${e.accessor}:`,t),!0}})):t}updateConfig(t){const e=this.config.headers;this.config=Object.assign(Object.assign({},this.config),t),t.headers&&t.headers!==e&&this.updateHeaderLookup();const n=this.computeFilteredRows(this.config.rows,this.state.filters);n!==this.state.filteredRows&&(this.state=Object.assign(Object.assign({},this.state),{filteredRows:n}),this.notifySubscribers())}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}notifySubscribers(){this.subscribers.forEach(t=>t(this.state))}updateFilter(t){var e,n;const o=Object.assign(Object.assign({},this.state.filters),{[t.accessor]:t}),s=this.computeFilteredRows(this.config.rows,o);if(this.state={filters:o,filteredRows:s},null===(n=(e=this.config).onFilterChange)||void 0===n||n.call(e,o),this.config.announce){const e=this.headerLookup.get(t.accessor);e&&this.config.announce("Filter applied to "+e.label)}this.notifySubscribers()}clearFilter(t){var e,n;const o=Object.assign({},this.state.filters);delete o[t];const s=this.computeFilteredRows(this.config.rows,o);if(this.state={filters:o,filteredRows:s},null===(n=(e=this.config).onFilterChange)||void 0===n||n.call(e,o),this.config.announce){const e=this.headerLookup.get(t);e&&this.config.announce("Filter removed from "+e.label)}this.notifySubscribers()}clearAllFilters(){var t,e;this.state={filters:{},filteredRows:this.config.rows},null===(e=(t=this.config).onFilterChange)||void 0===e||e.call(t,{}),this.config.announce&&this.config.announce("All filters cleared"),this.notifySubscribers()}computeFilteredRowsPreview(t){const e=Object.assign(Object.assign({},this.state.filters),{[t.accessor]:t});return this.computeFilteredRows(this.config.rows,e)}getState(){return this.state}getFilters(){return this.state.filters}getFilteredRows(){return this.state.filteredRows}destroy(){this.subscribers.clear()}}const U=(t,e)=>{const{rowTopPositions:n}=e;if(0===n.length)return 0;if(0>=t)return 0;if(t>=e.totalHeight)return n.length-1;let o=0,s=n.length-1;for(;s>o;){const e=Math.floor((o+s+1)/2);n[e]>t?s=e-1:o=e}return o},K=(t,e)=>{if(!e||0===e.length)return 0;let n=0,o=0,s=e.length;for(;s>o;){const n=Math.floor((o+s)/2);t>e[n][0]?o=n+1:s=n}for(let t=0;o>t;t++)n+=e[t][1];return n},J=({bufferRowCount:t,contentHeight:e,rowHeight:n,scrollTop:o,tableRows:s,scrollDirection:i="none",heightMap:r})=>{const l=n+1;if(!r){const n=t*l;let r=n,a=n;"down"===i?(r=Math.max(l,.1*n),a=.9*n):"up"===i&&(r=.9*n,a=Math.max(l,.1*n));const d=o+e+a,c=Math.max(0,Math.floor(Math.max(0,o-r)/l)),h=Math.min(s.length,Math.ceil(d/l)),u=o+e,p=Math.max(0,Math.ceil(o/l)),f=Math.min(s.length,Math.floor(u/l)),w=o+e,v=Math.max(0,Math.floor(o/l)),m=Math.min(s.length,Math.ceil(w/l));return{rendered:{startIndex:c,endIndex:h,rows:s.slice(c,h)},fullyVisible:{startIndex:p,endIndex:f,rows:s.slice(p,f)},partiallyVisible:{startIndex:v,endIndex:m,rows:s.slice(v,m)}}}const{rowTopPositions:a}=r,d=t*l;let c=d,h=d;"down"===i?(c=Math.max(l,.1*d),h=.9*d):"up"===i&&(c=.9*d,h=Math.max(l,.1*d));const u=o+e+h,p=U(Math.max(0,o-c),r);let f=U(u,r)+1;f=Math.min(s.length,f);const w=o,v=o+e;let m=U(w,r);w>a[m]&&(m=Math.min(m+1,s.length));let g=U(v,r);g=Math.min(s.length,g);const x=o+e,b=U(o,r);let y=U(x,r)+1;return y=Math.min(s.length,y),{rendered:{startIndex:p,endIndex:f,rows:s.slice(p,f)},fullyVisible:{startIndex:m,endIndex:g,rows:s.slice(m,g)},partiallyVisible:{startIndex:b,endIndex:y,rows:s.slice(b,y)}}},Y=({position:t,rowHeight:e,heightOffsets:n,customTheme:o})=>t*(e+o.rowSeparatorWidth)-o.rowSeparatorWidth+K(t,n),_=({position:t,rowHeight:e,heightOffsets:n,customTheme:o})=>t*(e+o.rowSeparatorWidth)+K(t,n),X=(t,e)=>{var n,o;const s=t.position,i=e[s+1];return null!==(o=null===(n=null==i?void 0:i.parentIndices)||void 0===n?void 0:n.includes(s))&&void 0!==o&&o},Q=new Map,Z=({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:o,partiallyVisibleRowIndex:s,recursionDepth:i,stickyParents:r,rowGrouping:l})=>{let a=o[s];if(!a||i>10)return{stickyParents:r,regularRows:e};let d=0;if(a.parentIndices&&a.parentIndices.length>0){for(const e of a.parentIndices){const o=t[e];if(o){const e=n.some(t=>t.position===o.position);if(a.rowIndexPath&&a.rowIndexPath.length>0){const e=t[a.parentIndices[a.parentIndices.length-1]],n=e.row[l[e.depth]];if(r.length>=(Array.isArray(n)?n:[]).length-a.rowIndexPath[a.rowIndexPath.length-1])break}e||r.some(t=>m(t.rowId)===m(o.rowId))||(r.push(o),d++)}}if(r.length>0){X(a,t)&&(r.push(a),d++);const e=o[s+=d];e&&(a=e)}}else if(X(a,t))return r.push(a),s++,Z({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:o,partiallyVisibleRowIndex:s,recursionDepth:i+1,stickyParents:r,rowGrouping:l});return X(a,t)?Z({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:o,partiallyVisibleRowIndex:s,recursionDepth:i+1,stickyParents:r,rowGrouping:l}):{stickyParents:r,regularRows:e}},tt=(t,e,n)=>{const o=t.getBoundingClientRect(),s=e.getBoundingClientRect(),i=10;if(s.top+i>o.top?e.scrollTop-=s.top-o.top+i:o.bottom>s.bottom-i&&(e.scrollTop+=o.bottom-s.bottom+i),n){const t=n.getBoundingClientRect();t.left+i>o.left?n.scrollLeft-=t.left-o.left+i:o.right>t.right-i&&(n.scrollLeft+=o.right-t.right+i)}},et=(t,e,n,o)=>{const s=document.querySelector(".st-body-container"),i=document.querySelector(".st-body-main");if(!s)return;const r=o?o.findIndex(e=>m(e.rowId)===t.rowId+""):-1,l=0>r?t.rowIndex:r,a=e+n.rowSeparatorWidth,d=s.querySelector(`.st-cell[data-row-id="${t.rowId}"][data-col-index="${t.colIndex}"]`);if(d&&o){const t=((t,e,n,o)=>{const s=J({bufferRowCount:0,contentHeight:e.clientHeight,rowHeight:n,scrollTop:e.scrollTop,tableRows:o,scrollDirection:"none"}),{startIndex:i,endIndex:r}=s.fullyVisible;return t>=i&&r>t})(l,s,e,o);if(t)return void tt(d,s,i)}if(!d)return s.scrollTop=Math.max(0,l*a-s.clientHeight/3),void setTimeout(()=>{const e=s.querySelector(`.st-cell[data-row-id="${t.rowId}"][data-col-index="${t.colIndex}"]`);e&&tt(e,s,i)},100);tt(d,s,i)},nt=({rowIndex:t,colIndex:e,rowId:n})=>`${t}-${e}-${n}`;function ot(t,e,n,o){const s=new Set,i=new Map;n.forEach((t,e)=>{const n=m(t.rowId);i.set(n,e)});const r=i.get(t.rowId+""),l=i.get(e.rowId+""),a=void 0!==r?r:t.rowIndex,d=void 0!==l?l:e.rowIndex,c=Math.min(a,d),h=Math.max(a,d),u=Math.min(t.colIndex,e.colIndex),p=Math.max(t.colIndex,e.colIndex);for(let t=c;h>=t;t++)for(let e=u;p>=e;e++)if(t>=0&&n.length>t){if(o&&0===e)continue;const i=m(n[t].rowId);s.add(nt({colIndex:e,rowIndex:t,rowId:i}))}return s}function st(t,e){var n,o,s;const i=document.querySelector(".st-body-container");if(!i)return null;const r=i.getBoundingClientRect(),l=Math.max(r.left,Math.min(r.right,t)),a=Math.max(r.top,Math.min(r.bottom,e)),d=document.querySelectorAll(".st-cell[data-row-index][data-col-index][data-row-id]:not(.st-selection-cell)");if(0===d.length)return null;const c=new Map;for(let t=0;d.length>t;t++){const e=d[t],o=e.getAttribute("data-row-id"),s=null!==(n=null!=o?o:e.getAttribute("data-row-index"))&&void 0!==n?n:"";if(!s)continue;let i=c.get(s);i||(i=[],c.set(s,i)),i.push(e)}const h=[];c.forEach((t,e)=>{const n=t[0].getBoundingClientRect();h.push({key:e,top:n.top,bottom:n.bottom})}),h.sort((t,e)=>t.top-e.top);let u=null,p=1/0;for(let t=0;h.length>t;t++){const{key:e,top:n,bottom:o}=h[t];if(a>=n&&o>=a){u=e,p=0;break}const s=Math.abs(a-(n+o)/2);p>s&&(p=s,u=e)}if(null===u)return null;const f=c.get(u);if(!f||0===f.length)return null;let w=null,v=1/0;for(let t=0;f.length>t;t++){const e=f[t],n=parseInt(null!==(o=e.getAttribute("data-row-index"))&&void 0!==o?o:"-1",10),i=parseInt(null!==(s=e.getAttribute("data-col-index"))&&void 0!==s?s:"-1",10),r=e.getAttribute("data-row-id");if(0>n||0>i||null==r||""===r)continue;const d=e.getBoundingClientRect(),c=Math.sqrt((d.left+d.width/2-l)**2+(d.top+d.height/2-a)**2);v>c&&(v=c,w=e)}if(null!==w){const t=parseInt(w.getAttribute("data-row-index")||"-1",10),e=parseInt(w.getAttribute("data-col-index")||"-1",10),n=w.getAttribute("data-row-id");if(t>=0&&e>=0&&null!==n)return{rowIndex:t,colIndex:e,rowId:n}}return null}class it{constructor(t){this.selectedCells=new Set,this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.initialFocusedCell=null,this.copyFlashCells=new Set,this.warningFlashCells=new Set,this.isSelecting=!1,this.startCell=null,this.keydownHandler=null,this.currentMouseX=null,this.currentMouseY=null,this.scrollAnimationFrame=null,this.lastSelectionUpdate=0,this.selectionThrottleMs=16,this.globalMouseMoveHandler=null,this.globalMouseUpHandler=null,this.columnsWithSelectedCells=new Set,this.rowsWithSelectedCells=new Set,this.leafHeaders=[],this.rowIdToTableIndex=new Map,this.selectedByRowIdColIndex=new Set,this.fullTableSelected=!1,this.config=t,this.updateDerivedState(),this.setupKeyboardNavigation()}updateConfig(t,e){this.config=Object.assign(Object.assign({},this.config),t),(null==e?void 0:e.positionOnlyBody)?this.updateRowIdAndSelectionLookupOnly():this.updateDerivedState()}updateDerivedState(){if(this.leafHeaders=this.config.headers.flatMap(t=>x(t,this.config.collapsedHeaders)),this.rowIdToTableIndex.clear(),this.config.tableRows.forEach((t,e)=>{this.rowIdToTableIndex.set(m(t.rowId),e)}),this.fullTableSelected){this.selectedByRowIdColIndex.clear(),this.columnsWithSelectedCells=new Set;const t=this.leafHeaders.length,e=this.config.enableRowSelection?1:0;for(let n=0;t>n;n++)this.columnsWithSelectedCells.add(n+e);return this.rowsWithSelectedCells=new Set,void this.config.tableRows.forEach(t=>{this.rowsWithSelectedCells.add(m(t.rowId))})}this.selectedByRowIdColIndex.clear(),this.columnsWithSelectedCells=new Set,this.rowsWithSelectedCells=new Set,this.selectedCells.forEach(t=>{const e=t.split("-");if(e.length>=3){const t=parseInt(e[1],10),n=e.slice(2).join("-");isNaN(t)||(this.selectedByRowIdColIndex.add(`${n}\t${t}`),this.columnsWithSelectedCells.add(t),this.rowsWithSelectedCells.add(n))}}),this.selectedColumns.forEach(t=>{this.columnsWithSelectedCells.add(t),this.config.tableRows.forEach(e=>{this.selectedByRowIdColIndex.add(`${m(e.rowId)}\t${t}`),this.rowsWithSelectedCells.add(m(e.rowId))})})}updateRowIdAndSelectionLookupOnly(){this.rowIdToTableIndex.clear(),this.config.tableRows.forEach((t,e)=>{this.rowIdToTableIndex.set(m(t.rowId),e)}),this.fullTableSelected||(this.selectedByRowIdColIndex.clear(),this.selectedCells.forEach(t=>{const e=t.split("-");if(e.length>=3){const t=parseInt(e[1],10),n=e.slice(2).join("-");isNaN(t)||this.selectedByRowIdColIndex.add(`${n}\t${t}`)}}),this.selectedColumns.forEach(t=>{this.config.tableRows.forEach(e=>{this.selectedByRowIdColIndex.add(`${m(e.rowId)}\t${t}`)})}))}setupKeyboardNavigation(){this.keydownHandler=this.handleKeyDown.bind(this),document.addEventListener("keydown",this.keydownHandler)}destroy(){this.keydownHandler&&(document.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=null),this.globalMouseMoveHandler&&(document.removeEventListener("mousemove",this.globalMouseMoveHandler),this.globalMouseMoveHandler=null),this.globalMouseUpHandler&&(document.removeEventListener("mouseup",this.globalMouseUpHandler),this.globalMouseUpHandler=null),null!==this.scrollAnimationFrame&&(cancelAnimationFrame(this.scrollAnimationFrame),this.scrollAnimationFrame=null)}handleKeyDown(t){if(!this.config.selectableCells)return;if(!this.initialFocusedCell)return;const e=document.activeElement;if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||"true"===(null==e?void 0:e.getAttribute("contenteditable")))){if((t.ctrlKey||t.metaKey)&&"a"===t.key)return t.preventDefault(),void this.selectAll();if(0!==this.selectedCells.size||this.fullTableSelected){if(!t.ctrlKey&&!t.metaKey||"c"!==t.key)return(t.ctrlKey||t.metaKey)&&"v"===t.key?(t.preventDefault(),void this.pasteFromClipboard()):"Delete"===t.key||"Backspace"===t.key?(t.preventDefault(),void this.deleteSelectedCells()):void("Escape"!==t.key?this.handleNavigationKeys(t):this.clearSelection());this.copyToClipboard()}}}handleNavigationKeys(t){if(!this.initialFocusedCell)return;let{rowIndex:e,colIndex:n,rowId:o}=this.initialFocusedCell;const s=this.config.tableRows[e];if((s?m(s.rowId):null)!==o){const t=this.config.tableRows.findIndex(t=>m(t.rowId)===o);if(-1===t)return;e=t}"ArrowUp"===t.key?(t.preventDefault(),this.handleArrowUp(t,e,n)):"ArrowDown"===t.key?(t.preventDefault(),this.handleArrowDown(t,e,n)):"ArrowLeft"===t.key||"Tab"===t.key&&t.shiftKey?(t.preventDefault(),this.handleArrowLeft(t,e,n)):"ArrowRight"===t.key||"Tab"===t.key?(t.preventDefault(),this.handleArrowRight(t,e,n)):"Home"===t.key?(t.preventDefault(),this.handleHome(t,e,n)):"End"===t.key?(t.preventDefault(),this.handleEnd(t,e,n)):"PageUp"===t.key?(t.preventDefault(),this.handlePageUp(t,e,n)):"PageDown"===t.key&&(t.preventDefault(),this.handlePageDown(t,e,n))}findEdgeInDirection(t,e,n){return function(t,e,n,o,s,i){let r=o,l=s;return"up"===i?r=0:"down"===i?r=t-1:"left"===i?l=n?1:0:"right"===i&&(l=n?e:e-1),{rowIndex:r,colIndex:l}}(this.config.tableRows.length,this.leafHeaders.length,!!this.config.enableRowSelection,t,e,n)}handleArrowUp(t,e,n){if(t.shiftKey){this.startCell||(this.startCell=this.initialFocusedCell);let o=e-1;if((t.ctrlKey||t.metaKey)&&(o=this.findEdgeInDirection(e,n,"up").rowIndex),o>=0){const t=m(this.config.tableRows[o].rowId);this.selectCellRange(this.startCell,{rowIndex:o,colIndex:n,rowId:t})}}else if(e>0){let o=e-1;(t.ctrlKey||t.metaKey)&&(o=this.findEdgeInDirection(e,n,"up").rowIndex);const s=m(this.config.tableRows[o].rowId);this.selectSingleCell({rowIndex:o,colIndex:n,rowId:s}),this.startCell=null}}handleArrowDown(t,e,n){if(t.shiftKey){this.startCell||(this.startCell=this.initialFocusedCell);let o=e+1;if((t.ctrlKey||t.metaKey)&&(o=this.findEdgeInDirection(e,n,"down").rowIndex),this.config.tableRows.length>o){const t=m(this.config.tableRows[o].rowId);this.selectCellRange(this.startCell,{rowIndex:o,colIndex:n,rowId:t})}}else if(this.config.tableRows.length-1>e){let o=e+1;(t.ctrlKey||t.metaKey)&&(o=this.findEdgeInDirection(e,n,"down").rowIndex);const s=m(this.config.tableRows[o].rowId);this.selectSingleCell({rowIndex:o,colIndex:n,rowId:s}),this.startCell=null}}handleArrowLeft(t,e,n){if(t.shiftKey&&"ArrowLeft"===t.key){this.startCell||(this.startCell=this.initialFocusedCell);let o=n-1;if(t.ctrlKey||t.metaKey)o=this.findEdgeInDirection(e,n,"left").colIndex;else if(this.config.enableRowSelection&&0===o)return;if(o>=0){const t=m(this.config.tableRows[e].rowId);this.selectCellRange(this.startCell,{rowIndex:e,colIndex:o,rowId:t})}}else if(n>0){let o=n-1;if((t.ctrlKey||t.metaKey)&&"ArrowLeft"===t.key)o=this.findEdgeInDirection(e,n,"left").colIndex;else if(this.config.enableRowSelection&&0===o)return;if(o>=0){const t=m(this.config.tableRows[e].rowId);this.selectSingleCell({rowIndex:e,colIndex:o,rowId:t}),this.startCell=null}}}handleArrowRight(t,e,n){const o=this.config.enableRowSelection?this.leafHeaders.length:this.leafHeaders.length-1;if(t.shiftKey&&"ArrowRight"===t.key){this.startCell||(this.startCell=this.initialFocusedCell);let s=n+1;if((t.ctrlKey||t.metaKey)&&(s=this.findEdgeInDirection(e,n,"right").colIndex),o>=s){const t=m(this.config.tableRows[e].rowId);this.selectCellRange(this.startCell,{rowIndex:e,colIndex:s,rowId:t})}}else if(o>n){let s=n+1;if((t.ctrlKey||t.metaKey)&&"ArrowRight"===t.key&&(s=this.findEdgeInDirection(e,n,"right").colIndex),o>=s){const t=m(this.config.tableRows[e].rowId);this.selectSingleCell({rowIndex:e,colIndex:s,rowId:t}),this.startCell=null}}}handleHome(t,e,n){if(t.shiftKey){this.startCell||(this.startCell=this.initialFocusedCell);let n=e;const o=this.config.enableRowSelection?1:0;(t.ctrlKey||t.metaKey)&&(n=0);const s=m(this.config.tableRows[n].rowId);this.selectCellRange(this.startCell,{rowIndex:n,colIndex:o,rowId:s})}else{let n=e;const o=this.config.enableRowSelection?1:0;(t.ctrlKey||t.metaKey)&&(n=0);const s=m(this.config.tableRows[n].rowId);this.selectSingleCell({rowIndex:n,colIndex:o,rowId:s}),this.startCell=null}}handleEnd(t,e,n){if(t.shiftKey){this.startCell||(this.startCell=this.initialFocusedCell);let n=e;const o=this.config.enableRowSelection?this.leafHeaders.length:this.leafHeaders.length-1;(t.ctrlKey||t.metaKey)&&(n=this.config.tableRows.length-1);const s=m(this.config.tableRows[n].rowId);this.selectCellRange(this.startCell,{rowIndex:n,colIndex:o,rowId:s})}else{let n=e;const o=this.config.enableRowSelection?this.leafHeaders.length:this.leafHeaders.length-1;(t.ctrlKey||t.metaKey)&&(n=this.config.tableRows.length-1);const s=m(this.config.tableRows[n].rowId);this.selectSingleCell({rowIndex:n,colIndex:o,rowId:s}),this.startCell=null}}handlePageUp(t,e,n){let o=Math.max(0,e-10);if(t.shiftKey){this.startCell||(this.startCell=this.initialFocusedCell);const t=m(this.config.tableRows[o].rowId);this.selectCellRange(this.startCell,{rowIndex:o,colIndex:n,rowId:t})}else{const t=m(this.config.tableRows[o].rowId);this.selectSingleCell({rowIndex:o,colIndex:n,rowId:t}),this.startCell=null}}handlePageDown(t,e,n){let o=Math.min(this.config.tableRows.length-1,e+10);if(t.shiftKey){this.startCell||(this.startCell=this.initialFocusedCell);const t=m(this.config.tableRows[o].rowId);this.selectCellRange(this.startCell,{rowIndex:o,colIndex:n,rowId:t})}else{const t=m(this.config.tableRows[o].rowId);this.selectSingleCell({rowIndex:o,colIndex:n,rowId:t}),this.startCell=null}}copyToClipboard(){const t=this.fullTableSelected?this.buildFullTableSelectedSet():this.selectedCells;if(0===t.size)return;const e=((t,e,n,o=!1)=>{const s=this.leafHeaders.filter(t=>!t.hide&&!t.excludeFromRender),i=new Map,r=new Map;s.forEach((t,e)=>{i.set(e,t.accessor),r.set(e,t)});const l=Array.from(t).reduce((t,e)=>{var o;const[s,l]=e.split("-").map(Number);t[s]||(t[s]=[]);const a=i.get(l),d=r.get(l);if(a&&(null===(o=n[s])||void 0===o?void 0:o.row)){const e=n[s].row,o=p(e,a);if(!1!==(null==d?void 0:d.useFormattedValueForClipboard)&&(null==d?void 0:d.valueFormatter)){const n=d.valueFormatter({accessor:a,colIndex:l,row:e,rowIndex:s,value:o});t[s][l]=n}else t[s][l]=!d||"lineAreaChart"!==d.type&&"barChart"!==d.type?o:Array.isArray(o)?o.join(", "):""}else t[s][l]="";return t},{}),a=new Set;o&&Array.from(t).forEach(t=>{const[,e]=t.split("-").map(Number);a.add(e)});let d="";o&&a.size>0&&(d=Array.from(a).sort((t,e)=>t-e).map(t=>{var e;const n=r.get(t);return null!==(e=null==n?void 0:n.label)&&void 0!==e?e:""}).join("\t"));const c=Object.values(l).map(t=>Object.values(t).join("\t")).join("\n");return o&&d?`${d}\n${c}`:c})(t,0,this.config.tableRows,this.config.copyHeadersToClipboard);navigator.clipboard.writeText(e),this.copyFlashCells=new Set(t),this.updateCellFlashClasses(),setTimeout(()=>{this.copyFlashCells=new Set,this.updateCellFlashClasses()},800)}async pasteFromClipboard(){if(this.initialFocusedCell)try{const t=await navigator.clipboard.readText();if(!t)return;const{updatedCells:e,warningCells:n}=((t,e,n,o,s,i)=>{const r=new Set,l=new Set,a=t.split("\n").filter(t=>t.length>0);if(0===a.length)return{updatedCells:r,warningCells:l};const d=n.filter(t=>!t.hide&&!t.excludeFromRender),c=o.findIndex(t=>m(t.rowId)===e.rowId+""),h=0>c?e.rowIndex:c,u=e.colIndex;return a.forEach((t,e)=>{t.split("\t").forEach((t,n)=>{const a=h+e,c=u+n;if(a>=o.length||c>=d.length)return;const p=o[a],w=d[c],v=m(p.rowId);if(!(null==w?void 0:w.isEditable))return void l.add(`${a}-${c}-${v}`);let g=t;if("number"===w.type){const e=+t;isNaN(e)||(g=e)}else if("boolean"===w.type)g="true"===t.toLowerCase()||"1"===t;else if("date"===w.type){const e=new Date(t);isNaN(e.getTime())||(g=e)}else"lineAreaChart"!==w.type&&"barChart"!==w.type||(g=t.split(",").map(t=>{const e=+t.trim();return isNaN(e)?0:e}));if(f(p.row,w.accessor,g),i){const t=i.get(`${v}-${w.accessor}`);t&&t.updateContent(g)}null==s||s({accessor:w.accessor,newValue:g,row:p.row,rowIndex:a}),r.add(`${a}-${c}-${v}`)})}),{updatedCells:r,warningCells:l}})(t,this.initialFocusedCell,this.leafHeaders,this.config.tableRows,this.config.onCellEdit,this.config.cellRegistry);e.size>0&&(this.copyFlashCells=e,this.updateCellFlashClasses(),setTimeout(()=>{this.copyFlashCells=new Set,this.updateCellFlashClasses()},800)),n.size>0&&(this.warningFlashCells=n,this.updateCellFlashClasses(),setTimeout(()=>{this.warningFlashCells=new Set,this.updateCellFlashClasses()},800))}catch(t){console.warn("Failed to paste from clipboard:",t)}}deleteSelectedCells(){const t=this.fullTableSelected?this.buildFullTableSelectedSet():this.selectedCells;if(0===t.size)return;const{deletedCells:e,warningCells:n}=((t,e,n,o,s)=>{const i=new Set,r=new Set,l=e.filter(t=>!t.hide&&!t.excludeFromRender),a=new Map;return l.forEach((t,e)=>{a.set(e,t.accessor)}),Array.from(t).forEach(t=>{const[e,a]=t.split("-").map(Number);if(e>=n.length||a>=l.length)return;const d=n[e],c=l[a],h=m(d.rowId);if(!(null==c?void 0:c.isEditable))return void r.add(t);let u=null;if(u="string"===c.type?"":"number"===c.type?null:"boolean"!==c.type&&("date"===c.type?null:"lineAreaChart"===c.type||"barChart"===c.type||Array.isArray(p(d.row,c.accessor))?[]:""),f(d.row,c.accessor,u),s){const t=s.get(`${h}-${c.accessor}`);t&&t.updateContent(u)}null==o||o({accessor:c.accessor,newValue:u,row:d.row,rowIndex:e}),i.add(t)}),{deletedCells:i,warningCells:r}})(t,this.leafHeaders,this.config.tableRows,this.config.onCellEdit,this.config.cellRegistry);e.size>0&&(this.copyFlashCells=e,this.updateCellFlashClasses(),setTimeout(()=>{this.copyFlashCells=new Set,this.updateCellFlashClasses()},800)),n.size>0&&(this.warningFlashCells=n,this.updateCellFlashClasses(),setTimeout(()=>{this.warningFlashCells=new Set,this.updateCellFlashClasses()},800))}selectAll(){this.fullTableSelected=!0,this.selectedCells=new Set,this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.updateDerivedState(),this.updateAllCellClasses()}buildFullTableSelectedSet(){const t=new Set;for(let e=0;this.config.tableRows.length>e;e++)for(let n=0;this.leafHeaders.length>n;n++){const o=this.config.enableRowSelection?n+1:n,s=m(this.config.tableRows[e].rowId);t.add(`${e}-${o}-${s}`)}return t}clearSelection(){this.fullTableSelected=!1,this.selectedCells=new Set,this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.startCell=null,this.updateDerivedState(),this.updateAllCellClasses()}setSelectedCells(t){this.fullTableSelected=!1,this.selectedCells=t,this.updateDerivedState(),this.updateAllCellClasses()}setSelectedColumns(t){this.fullTableSelected=!1,this.selectedColumns=t,this.updateDerivedState(),this.updateAllCellClasses()}updateCellFlashClasses(){requestAnimationFrame(()=>{document.querySelectorAll(".st-cell[data-row-index][data-col-index][data-row-id]").forEach(t=>{if(!(t instanceof HTMLElement))return;const e=parseInt(t.getAttribute("data-row-index")||"-1",10),n=parseInt(t.getAttribute("data-col-index")||"-1",10),o=t.getAttribute("data-row-id");if(0>e||0>n||!o)return;const s=nt({rowIndex:e,colIndex:n,rowId:o}),i=this.isInitialFocusedCell({rowIndex:e,colIndex:n,rowId:o});this.copyFlashCells.has(s)?t.classList.add(i?"st-cell-copy-flash-first":"st-cell-copy-flash"):t.classList.remove("st-cell-copy-flash-first","st-cell-copy-flash"),this.warningFlashCells.has(s)?t.classList.add(i?"st-cell-warning-flash-first":"st-cell-warning-flash"):t.classList.remove("st-cell-warning-flash-first","st-cell-warning-flash")})})}syncHeaderSelectionClasses(){var t;if(!this.config.selectableColumns&&!this.config.selectableCells)return;const e=(null!==(t=this.config.tableRoot)&&void 0!==t?t:document).querySelectorAll(".st-header-cell"),n=new Map;for(const t of l(this.config.headers))n.set(t.accessor+"",t);for(let t=0;e.length>t;t++){const o=e[t];if(!(o instanceof HTMLElement))continue;const s=o.getAttribute("data-accessor"),i=o.getAttribute("aria-colindex");if(!s||!i)continue;const l=parseInt(i,10)-1;if(0>l||Number.isNaN(l))continue;const a=n.get(s);if(!a)continue;if(a.isSelectionColumn&&this.config.enableRowSelection){for(const t of it.HEADER_SELECTION_CLASSES)o.classList.remove(t);continue}const d=r(a,l),c=d.some(t=>this.selectedColumns.has(t)),h=!c&&d.some(t=>this.columnsWithSelectedCells.has(t));if(c)o.classList.add("st-header-selected"),o.classList.remove("st-header-has-highlighted-cell");else if(h)o.classList.add("st-header-has-highlighted-cell"),o.classList.remove("st-header-selected");else for(const t of it.HEADER_SELECTION_CLASSES)o.classList.remove(t)}}clearHeaderSelectionHighlightClasses(){var t;if(!this.config.selectableColumns&&!this.config.selectableCells)return;const e=(null!==(t=this.config.tableRoot)&&void 0!==t?t:document).querySelectorAll(".st-header-cell");for(let t=0;e.length>t;t++){const n=e[t];if(n instanceof HTMLElement)for(const t of it.HEADER_SELECTION_CLASSES)n.classList.remove(t)}}syncAllCellClasses(){var t;const e=(null!==(t=this.config.tableRoot)&&void 0!==t?t:document).querySelectorAll(".st-cell[data-row-index][data-col-index][data-row-id]");if(this.fullTableSelected||0!==this.selectedCells.size||0!==this.selectedColumns.size){for(let t=0;e.length>t;t++){const n=e[t];if(!(n instanceof HTMLElement))continue;const o=parseInt(n.getAttribute("data-row-index")||"-1",10),s=parseInt(n.getAttribute("data-col-index")||"-1",10),i=n.getAttribute("data-row-id");if(0>o||0>s||!i)continue;const r={rowIndex:o,colIndex:s,rowId:i},l=this.isSelected(r),a=this.selectedColumns.has(s),d=l&&!a,c=this.isInitialFocusedCell(r),h=this.getBorderClass(r),u=new Set;d&&(u.add(c?"st-cell-selected-first":"st-cell-selected"),h.split(" ").filter(Boolean).forEach(t=>u.add(t))),a&&u.add(c?"st-cell-column-selected-first":"st-cell-column-selected");for(const t of it.SELECTION_CLASSES){const e=u.has(t),o=n.classList.contains(t);e&&!o?n.classList.add(t):!e&&o&&n.classList.remove(t)}const p=c?"0":"-1";if(n.getAttribute("tabindex")!==p&&n.setAttribute("tabindex",p),c&&document.activeElement!==n){const t=document.activeElement;t&&n.contains(t)||n.focus({preventScroll:!0})}}this.syncHeaderSelectionClasses()}else{for(let t=0;e.length>t;t++){const n=e[t];if(n instanceof HTMLElement){for(const t of it.SELECTION_CLASSES)n.classList.contains(t)&&n.classList.remove(t);"-1"!==n.getAttribute("tabindex")&&n.setAttribute("tabindex","-1")}}this.clearHeaderSelectionHighlightClasses()}}updateAllCellClasses(){this.isSelecting||this.fullTableSelected?this.syncAllCellClasses():requestAnimationFrame(()=>this.syncAllCellClasses())}isSelected({colIndex:t,rowIndex:e,rowId:n}){if(this.fullTableSelected)return!0;const o=n+"";if(this.selectedByRowIdColIndex.has(`${o}\t${t}`))return!0;const s=this.rowIdToTableIndex.get(o);if(void 0!==s){const e=nt({rowIndex:s,colIndex:t,rowId:o});if(this.selectedCells.has(e))return!0}const i=nt({colIndex:t,rowIndex:e,rowId:n});return this.selectedCells.has(i)}getBorderClass({colIndex:t,rowIndex:e,rowId:n}){var o;if(this.isSelecting)return"";const s=null!==(o=this.rowIdToTableIndex.get(n+""))&&void 0!==o?o:e;if(this.fullTableSelected){const e=this.config.enableRowSelection?1:0,n=this.config.enableRowSelection?this.leafHeaders.length:this.leafHeaders.length-1,o=[];return 0===s&&o.push("st-selected-top-border"),s===this.config.tableRows.length-1&&o.push("st-selected-bottom-border"),t===e&&o.push("st-selected-left-border"),t===n&&o.push("st-selected-right-border"),o.join(" ")}const i=[],r=this.config.tableRows[s-1],l=r?m(r.rowId):null,a=this.config.tableRows[s+1],d=a?m(a.rowId):null,c=null!==l&&this.isSelected({colIndex:t,rowIndex:s-1,rowId:l}),h=null!==d&&this.isSelected({colIndex:t,rowIndex:s+1,rowId:d}),u=this.isSelected({colIndex:t-1,rowIndex:s,rowId:n}),p=this.isSelected({colIndex:t+1,rowIndex:s,rowId:n});return(!l||!c||this.selectedColumns.has(t)&&0===s)&&i.push("st-selected-top-border"),(!d||!h||this.selectedColumns.has(t)&&s===this.config.tableRows.length-1)&&i.push("st-selected-bottom-border"),u||i.push("st-selected-left-border"),p||i.push("st-selected-right-border"),i.join(" ")}isInitialFocusedCell({colIndex:t,rowId:e}){return!!this.initialFocusedCell&&t===this.initialFocusedCell.colIndex&&e+""==this.initialFocusedCell.rowId+""}isCopyFlashing({colIndex:t,rowIndex:e,rowId:n}){const o=nt({colIndex:t,rowIndex:e,rowId:n});return this.copyFlashCells.has(o)}isWarningFlashing({colIndex:t,rowIndex:e,rowId:n}){const o=nt({colIndex:t,rowIndex:e,rowId:n});return this.warningFlashCells.has(o)}getColumnsWithSelectedCells(){return this.columnsWithSelectedCells}getRowsWithSelectedCells(){return this.rowsWithSelectedCells}getSelectedCells(){return this.fullTableSelected?this.buildFullTableSelectedSet():this.selectedCells}getSelectedColumns(){return this.selectedColumns}getLastSelectedColumnIndex(){return this.lastSelectedColumnIndex}getStartCell(){return this.startCell}setInitialFocusedCell(t){this.initialFocusedCell=t,this.updateDerivedState(),this.updateAllCellClasses()}selectSingleCell(t){if(t.rowIndex>=0&&this.config.tableRows.length>t.rowIndex&&t.colIndex>=0&&(this.config.enableRowSelection?this.leafHeaders.length:this.leafHeaders.length-1)>=t.colIndex){this.fullTableSelected=!1;const e=nt(t);this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.selectedCells=new Set([e]),this.initialFocusedCell=t,this.updateDerivedState(),this.updateAllCellClasses(),setTimeout(()=>et(t,this.config.rowHeight,this.config.customTheme,this.config.tableRows),0)}}selectCellRange(t,e){this.fullTableSelected=!1;const n=ot(t,e,this.config.tableRows,!!this.config.enableRowSelection);this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.selectedCells=n,this.initialFocusedCell=e,this.updateDerivedState(),this.updateAllCellClasses(),setTimeout(()=>et(e,this.config.rowHeight,this.config.customTheme,this.config.tableRows),0)}selectColumns(t,e=!1){this.fullTableSelected=!1,this.selectedCells=new Set,this.initialFocusedCell=null;const n=new Set(e?this.selectedColumns:[]);t.forEach(t=>n.add(t)),this.selectedColumns=n,t.length>0&&(this.lastSelectedColumnIndex=t[t.length-1]),this.updateDerivedState(),this.updateAllCellClasses()}updateSelectionRange(t,e){this.fullTableSelected=!1;const n=ot(t,e,this.config.tableRows,!!this.config.enableRowSelection);this.selectedCells.size===n.size&&Array.from(n).every(t=>this.selectedCells.has(t))||(this.selectedCells=n,this.updateDerivedState(),this.updateAllCellClasses())}calculateNearestCell(t,e){return st(t,e)}getCellFromMousePosition(t,e){return function(t,e){const n=document.elementFromPoint(t,e);if(!n)return null;const o=n.closest(".st-cell");if(o instanceof HTMLElement){const t=parseInt(o.getAttribute("data-row-index")||"-1",10),e=parseInt(o.getAttribute("data-col-index")||"-1",10),n=o.getAttribute("data-row-id");if(t>=0&&e>=0&&null!==n)return{rowIndex:t,colIndex:e,rowId:n}}return st(t,e)}(t,e)}handleAutoScroll(t,e){var n;!function(t,e,n=document){const o=n.querySelector(".st-body-container");if(!o)return;const s=o.getBoundingClientRect(),i=Math.max(0,o.scrollHeight-o.clientHeight);s.top+50>e?o.scrollTop=Math.max(0,o.scrollTop-10*Math.min(3,1+Math.max(0,s.top-e)/100)):e>s.bottom-50&&(o.scrollTop=Math.min(i,o.scrollTop+10*Math.min(3,1+Math.max(0,e-s.bottom)/100)));const r=n.querySelector(".st-body-main");if(r){const e=Math.max(0,r.scrollWidth-r.clientWidth);s.left+50>t?r.scrollLeft=Math.max(0,r.scrollLeft-10*Math.min(3,1+Math.max(0,s.left-t)/100)):t>s.right-50&&(r.scrollLeft=Math.min(e,r.scrollLeft+10*Math.min(3,1+Math.max(0,t-s.right)/100)))}}(t,e,null!==(n=this.config.tableRoot)&&void 0!==n?n:document)}continuousScroll(){if(this.isSelecting&&this.startCell){if(null!==this.currentMouseX&&null!==this.currentMouseY){this.handleAutoScroll(this.currentMouseX,this.currentMouseY);const t=Date.now();if(t-this.lastSelectionUpdate>=this.selectionThrottleMs){const e=this.getCellFromMousePosition(this.currentMouseX,this.currentMouseY);e&&(this.updateSelectionRange(this.startCell,e),this.lastSelectionUpdate=t)}}this.scrollAnimationFrame=requestAnimationFrame(()=>this.continuousScroll())}else null!==this.scrollAnimationFrame&&(cancelAnimationFrame(this.scrollAnimationFrame),this.scrollAnimationFrame=null)}handleMouseDown({colIndex:t,rowIndex:e,rowId:n}){this.config.selectableCells&&(this.fullTableSelected=!1,this.isSelecting=!0,this.startCell={rowIndex:e,colIndex:t,rowId:n},setTimeout(()=>{this.selectedColumns=new Set,this.lastSelectedColumnIndex=null;const o=nt({colIndex:t,rowIndex:e,rowId:n});this.selectedCells=new Set([o]),this.initialFocusedCell={rowIndex:e,colIndex:t,rowId:n},this.updateDerivedState(),this.updateAllCellClasses()},0),this.currentMouseX=null,this.currentMouseY=null,this.lastSelectionUpdate=0,this.globalMouseMoveHandler=t=>{this.isSelecting&&this.startCell&&(this.currentMouseX=t.clientX,this.currentMouseY=t.clientY)},this.globalMouseUpHandler=()=>{var t,e;this.isSelecting=!1,null!==this.scrollAnimationFrame&&(cancelAnimationFrame(this.scrollAnimationFrame),this.scrollAnimationFrame=null),this.globalMouseMoveHandler&&(document.removeEventListener("mousemove",this.globalMouseMoveHandler),this.globalMouseMoveHandler=null),this.globalMouseUpHandler&&(document.removeEventListener("mouseup",this.globalMouseUpHandler),this.globalMouseUpHandler=null),null===(e=(t=this.config).onSelectionDragEnd)||void 0===e||e.call(t),this.syncAllCellClasses(),requestAnimationFrame(()=>this.syncAllCellClasses())},document.addEventListener("mousemove",this.globalMouseMoveHandler),document.addEventListener("mouseup",this.globalMouseUpHandler),this.scrollAnimationFrame=requestAnimationFrame(()=>this.continuousScroll()))}handleMouseOver({colIndex:t,rowIndex:e,rowId:n}){this.config.selectableCells&&this.isSelecting&&this.startCell&&this.updateSelectionRange(this.startCell,{colIndex:t,rowIndex:e,rowId:n})}}it.SELECTION_CLASSES=["st-cell-selected","st-cell-selected-first","st-cell-column-selected","st-cell-column-selected-first","st-selected-top-border","st-selected-bottom-border","st-selected-left-border","st-selected-right-border"],it.HEADER_SELECTION_CLASSES=["st-header-selected","st-header-has-highlighted-cell"];const rt=(t,e)=>t.filter(t=>!(!t||!t.rowId)&&e.has(m(t.rowId))).map(t=>t.row);class lt{constructor(t){this.subscribers=new Set,this.config=t,this.state={selectedRows:new Set,selectedRowCount:0,selectedRowsData:[]}}updateConfig(t){this.config=Object.assign(Object.assign({},this.config),t),t.tableRows&&this.updateDerivedState()}updateDerivedState(){var t;this.state=Object.assign(Object.assign({},this.state),{selectedRowCount:(t=this.state.selectedRows,t.size),selectedRowsData:rt(this.config.tableRows,this.state.selectedRows)})}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}notifySubscribers(){this.subscribers.forEach(t=>t(this.state))}isRowSelected(t){return!!this.config.enableRowSelection&&(t=>this.state.selectedRows.has(t))(t)}areAllRowsSelected(){return!!this.config.enableRowSelection&&(e=this.state.selectedRows,0!==(t=this.config.tableRows).length&&t.filter(t=>t&&t.rowId).every(t=>e.has(m(t.rowId))));var t,e}getSelectedRows(){return this.state.selectedRows}getSelectedRowCount(){return this.state.selectedRowCount}getSelectedRowsData(){return this.state.selectedRowsData}setSelectedRows(t){this.state=Object.assign(Object.assign({},this.state),{selectedRows:t}),this.updateDerivedState(),this.notifySubscribers()}handleRowSelect(t,e){if(!this.config.enableRowSelection)return;const n=(t=>{const e=new Set(this.state.selectedRows);return e.has(t)?e.delete(t):e.add(t),e})(t);if(this.state=Object.assign(Object.assign({},this.state),{selectedRows:n}),this.updateDerivedState(),this.config.onRowSelectionChange){const o=this.config.tableRows.find(e=>m(e.rowId)===t);o&&this.config.onRowSelectionChange({row:o.row,isSelected:e,selectedRows:n})}this.notifySubscribers()}handleSelectAll(t){if(!this.config.enableRowSelection)return;let e;t?(e=new Set(this.config.tableRows.filter(t=>t&&t.rowId).map(t=>m(t.rowId))),this.config.onRowSelectionChange&&this.config.tableRows.forEach(t=>this.config.onRowSelectionChange({row:t.row,isSelected:!0,selectedRows:e}))):(e=new Set,this.config.onRowSelectionChange&&this.state.selectedRows.forEach(t=>{const n=this.config.tableRows.find(e=>m(e.rowId)===t);n&&this.config.onRowSelectionChange({row:n.row,isSelected:!1,selectedRows:e})})),this.state=Object.assign(Object.assign({},this.state),{selectedRows:e}),this.updateDerivedState(),this.notifySubscribers()}handleToggleRow(t){if(!this.config.enableRowSelection)return;const e=this.isRowSelected(t);this.handleRowSelect(t,!e)}clearSelection(){if(this.config.enableRowSelection){if(this.config.onRowSelectionChange){const t=new Set;this.state.selectedRows.forEach(e=>{const n=this.config.tableRows.find(t=>m(t.rowId)===e);n&&this.config.onRowSelectionChange({row:n.row,isSelected:!1,selectedRows:t})})}this.state=Object.assign(Object.assign({},this.state),{selectedRows:new Set}),this.updateDerivedState(),this.notifySubscribers()}}getState(){return this.state}destroy(){this.subscribers.clear()}}class at{constructor(){this.callbacks=new Set,this.isListening=!1,this.handleResize=()=>{this.callbacks.forEach(t=>t())}}addCallback(t){return this.callbacks.add(t),this.isListening||this.startListening(),()=>{this.callbacks.delete(t),0===this.callbacks.size&&this.stopListening()}}startListening(){this.isListening||(window.addEventListener("resize",this.handleResize),this.isListening=!0)}stopListening(){this.isListening&&(window.removeEventListener("resize",this.handleResize),this.isListening=!1)}destroy(){this.stopListening(),this.callbacks.clear()}}class dt{constructor(t){this.isListening=!1,this.handleClickOutside=t=>{var e,n,o,s,i,r;const l=t.target;if(!l.closest(".editable-cell-input")||!l.closest(".st-header-cell")){if(this.config.activeHeaderDropdown&&this.config.setActiveHeaderDropdown){const t=l.closest(".st-dropdown-content")||l.closest(".dropdown-content");l.closest(".st-header-cell")||t||this.config.setActiveHeaderDropdown(null)}if(!(l.closest(".st-cell")||this.config.selectableColumns&&(l.classList.contains("st-header-cell")||l.classList.contains("st-header-label")||l.classList.contains("st-header-label-text")))){const t=null!==(o=null===(n=(e=this.config).getSelectedCells)||void 0===n?void 0:n.call(e))&&void 0!==o?o:this.config.selectedCells,l=null!==(r=null===(i=(s=this.config).getSelectedColumns)||void 0===i?void 0:i.call(s))&&void 0!==r?r:this.config.selectedColumns;(t.size>0||l.size>0)&&(this.config.onClearSelection?this.config.onClearSelection():(this.config.setSelectedCells(new Set),this.config.setSelectedColumns(new Set),this.config.startCell&&(this.config.startCell.current=null)))}}},this.config=t}updateConfig(t){this.config=Object.assign(Object.assign({},this.config),t)}startListening(){this.isListening||(document.addEventListener("mousedown",this.handleClickOutside),this.isListening=!0)}stopListening(){this.isListening&&(document.removeEventListener("mousedown",this.handleClickOutside),this.isListening=!1)}destroy(){this.stopListening()}}class ct{constructor(t){this.isMainSectionScrollable=!1,this.headerContainer=null,this.mainSection=null,this.scrollbarWidth=0,this.resizeObserver=null,this.observers=new Set,this.rafId=null,this.headerContainer=t.headerContainer||null,this.mainSection=t.mainSection||null,this.scrollbarWidth=t.scrollbarWidth,this.mainSection&&this.headerContainer&&this.initialize()}initialize(){this.mainSection&&this.headerContainer&&(this.checkScrollability(),this.resizeObserver=new ResizeObserver(()=>{null!==this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=requestAnimationFrame(()=>{this.rafId=null,this.checkScrollability()})}),this.resizeObserver.observe(this.mainSection))}checkScrollability(){if(this.mainSection){const t=this.mainSection.scrollHeight>this.mainSection.clientHeight;t!==this.isMainSectionScrollable&&(this.isMainSectionScrollable=t,this.updateHeaderPadding(),this.notifyObservers())}}updateHeaderPadding(){this.headerContainer&&(this.isMainSectionScrollable?(this.headerContainer.classList.add("st-header-scroll-padding"),this.headerContainer.style.setProperty("--st-after-width",this.scrollbarWidth+"px")):this.headerContainer.classList.remove("st-header-scroll-padding"))}setScrollbarWidth(t){this.scrollbarWidth=t,this.updateHeaderPadding()}setHeaderContainer(t){this.headerContainer&&this.headerContainer.classList.remove("st-header-scroll-padding"),this.headerContainer=t,this.updateHeaderPadding()}setMainSection(t){this.resizeObserver&&this.mainSection&&this.resizeObserver.unobserve(this.mainSection),this.mainSection=t,this.mainSection&&this.headerContainer&&this.initialize()}getIsMainSectionScrollable(){return this.isMainSectionScrollable}subscribe(t){return this.observers.add(t),()=>{this.observers.delete(t)}}notifyObservers(){this.observers.forEach(t=>t(this.isMainSectionScrollable))}destroy(){null!==this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.resizeObserver&&this.mainSection&&(this.resizeObserver.unobserve(this.mainSection),this.resizeObserver=null),this.headerContainer&&this.headerContainer.classList.remove("st-header-scroll-padding"),this.observers.clear()}}const ht=(t,e)=>{if(!e||0===e.length)return new Set;if(t){const t=Array.from({length:e.length},(t,e)=>e);return new Set(t)}return new Set};class ut{constructor(t,e){this.observers=new Set,this.expandedDepths=ht(t,e)}updateRowGrouping(t){if(!t||0===t.length)return void this.setExpandedDepths(new Set);const e=t.length,n=Array.from(this.expandedDepths).filter(t=>e>t);this.setExpandedDepths(new Set(n))}getExpandedDepths(){return this.expandedDepths}setExpandedDepths(t){this.expandedDepths=t,this.notifyObservers()}subscribe(t){return this.observers.add(t),()=>{this.observers.delete(t)}}notifyObservers(){this.observers.forEach(t=>t(this.expandedDepths))}expandAll(){const t=new Set;for(let e=0;10>e;e++)t.add(e);this.setExpandedDepths(t)}collapseAll(){this.setExpandedDepths(new Set)}expandDepth(t){const e=new Set(this.expandedDepths);e.add(t),this.setExpandedDepths(e)}collapseDepth(t){const e=new Set(this.expandedDepths);e.delete(t),this.setExpandedDepths(e)}toggleDepth(t){this.expandedDepths.has(t)?this.collapseDepth(t):this.expandDepth(t)}destroy(){this.observers.clear()}}class pt{constructor(){this.announcement="",this.timeoutId=null,this.observers=new Set}announce(t){this.announcement=t,this.notifyObservers(),this.timeoutId&&clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.announcement="",this.notifyObservers()},1e3)}getAnnouncement(){return this.announcement}subscribe(t){return this.observers.add(t),()=>{this.observers.delete(t)}}notifyObservers(){this.observers.forEach(t=>t(this.announcement))}destroy(){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null),this.observers.clear(),this.announcement=""}}function ft(t){return t?t.offsetWidth-t.clientWidth:0}const wt=t=>{if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map(wt);const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=wt(t[n]));return e},vt=(t,e)=>t.filter(t=>t.pinned===e).some(t=>!t.hide&&!t.excludeFromRender),mt=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("width","24"),e.setAttribute("height","24"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"),n.setAttribute("fill","inherit"),e.appendChild(n),e},gt=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("width","24"),e.setAttribute("height","24"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z"),n.setAttribute("fill","inherit"),e.appendChild(n),e},xt=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false"),e.setAttribute("role","img"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("viewBox","0 0 320 512"),e.setAttribute("height","1em"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M298 177.5c3.8-8.8 2-19-4.6-26l-116-144C172.9 2.7 166.6 0 160 0s-12.9 2.7-17.4 7.5l-116 144c-6.6 7-8.4 17.2-4.6 26S34.4 192 44 192l72 0 0 288c0 17.7 14.3 32 32 32l24 0c17.7 0 32-14.3 32-32l0-288 72 0c9.6 0 18.2-5.7 22-14.5z"),n.setAttribute("fill","inherit"),e.appendChild(n),e},bt=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false"),e.setAttribute("role","img"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("viewBox","0 0 320 512"),e.setAttribute("height","1em"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M22 334.5c-3.8 8.8-2 19 4.6 26l116 144c4.5 4.8 10.8 7.5 17.4 7.5s12.9-2.7 17.4-7.5l116-144c6.6-7 8.4-17.2 4.6-26s-12.5-14.5-22-14.5l-72 0 0-288c0-17.7-14.3-32-32-32L148 0C130.3 0 116 14.3 116 32l0 288-72 0c-9.6 0-18.2 5.7-22 14.5z"),n.setAttribute("fill","inherit"),e.appendChild(n),e},yt=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");return e.setAttribute("aria-hidden","true"),e.setAttribute("role","img"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("viewBox","0 0 16 10"),e.setAttribute("width","16px"),e.setAttribute("height","10px"),t&&e.setAttribute("class",t),[{cx:"3",cy:"3"},{cx:"8",cy:"3"},{cx:"13",cy:"3"},{cx:"3",cy:"7"},{cx:"8",cy:"7"},{cx:"13",cy:"7"}].forEach(({cx:t,cy:n})=>{const o=document.createElementNS("http://www.w3.org/2000/svg","circle");o.setAttribute("cx",t),o.setAttribute("cy",n),o.setAttribute("r","1.5"),o.setAttribute("fill","currentColor"),e.appendChild(o)}),e},Rt=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("aria-hidden","true"),e.setAttribute("role","img"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("viewBox","0 0 512 512"),e.setAttribute("height","1em"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M3.9 54.9C10.5 40.9 24.5 32 40 32l432 0c15.5 0 29.5 8.9 36.1 22.9s4.6 30.5-5.2 42.5L320 320.9 320 448c0 12.1-6.8 23.2-17.7 28.6s-23.8 4.3-33.5-3l-64-48c-8.1-6-12.8-15.5-12.8-25.6l0-79.1L9 97.3C-.7 85.4-2.8 68.8 3.9 54.9z"),n.setAttribute("fill","inherit"),e.appendChild(n),e};function Ct(t){return{pinnedLeft:t.filter(t=>"left"===t.pinned),unpinned:t.filter(t=>!t.pinned),pinnedRight:t.filter(t=>"right"===t.pinned)}}function St(t,e){return!0===t.isEssential||e.has(t.accessor+"")}function It(t,e){let n=!1;for(const o of t){if(o.isSelectionColumn||o.excludeFromRender)continue;const t=St(o,e);if(t&&n)return!1;t||(n=!0)}return!0}function Ht(t,e){var n;const{pinnedLeft:o,unpinned:s,pinnedRight:i}=Ct(t);if(!It(o,e))return!1;if(!It(s,e))return!1;if(!It(i,e))return!1;for(const o of t)if((null===(n=o.children)||void 0===n?void 0:n.length)&&!Mt(o.children,e))return!1;return!0}function Mt(t,e){var n;if(!It(t,e))return!1;for(const o of t)if((null===(n=o.children)||void 0===n?void 0:n.length)&&!Mt(o.children,e))return!1;return!0}function kt(t){const{pinnedLeft:e,unpinned:n,pinnedRight:o}=Ct(t);return{left:e.map(t=>t.accessor),main:n.map(t=>t.accessor),right:o.map(t=>t.accessor)}}function Et(t,e,n){return[...t.filter(t=>St(e.get(t+""),n)),...t.filter(t=>!St(e.get(t+""),n))]}function Ot(t,e,n){const o=new Set(t.map(t=>t.accessor+"")),s=[...e.left,...e.main,...e.right];if(s.length!==o.size)return null;for(const t of s)if(!o.has(t+""))return null;const i=new Map(t.map(t=>[t.accessor+"",t])),r=Et(e.left,i,n),l=Et(e.main,i,n),a=Et(e.right,i,n),d=(t,e)=>{const n=Object.assign({},t);return"left"===e?n.pinned="left":"right"===e?n.pinned="right":delete n.pinned,n};return[...r.map(t=>d(i.get(t+""),"left")),...l.map(t=>d(i.get(t+""),void 0)),...a.map(t=>d(i.get(t+""),"right"))]}function Tt(t,e,n,o){const s=e+"",i=kt(t),r=i.left.filter(t=>t+""!==s),l=i.main.filter(t=>t+""!==s),a=i.right.filter(t=>t+""!==s),d=t.find(t=>t.accessor+""===s);return d&&(!St(d,o)||"main"!==n||"left"!==d.pinned&&"right"!==d.pinned)?("left"===n?r.push(e):"right"===n?a.push(e):"left"===d.pinned?l.unshift(e):l.push(e),Ot(t,{left:r,main:l,right:a},o)):null}class At{static resolveIcons(t){var e,n,o,s,i,r,l,a,d,c,h,u,p,f,w,v,m,g;const x={drag:yt("st-drag-icon"),expand:gt("st-expand-icon"),filter:Rt("st-header-icon"),headerCollapse:gt("st-header-icon"),headerExpand:mt("st-header-icon"),next:gt("st-next-prev-icon"),prev:mt("st-next-prev-icon"),sortDown:bt("st-header-icon"),sortUp:xt("st-header-icon")};return{drag:null!==(n=null===(e=t.icons)||void 0===e?void 0:e.drag)&&void 0!==n?n:x.drag,expand:null!==(s=null===(o=t.icons)||void 0===o?void 0:o.expand)&&void 0!==s?s:x.expand,filter:null!==(r=null===(i=t.icons)||void 0===i?void 0:i.filter)&&void 0!==r?r:x.filter,headerCollapse:null!==(a=null===(l=t.icons)||void 0===l?void 0:l.headerCollapse)&&void 0!==a?a:x.headerCollapse,headerExpand:null!==(c=null===(d=t.icons)||void 0===d?void 0:d.headerExpand)&&void 0!==c?c:x.headerExpand,next:null!==(u=null===(h=t.icons)||void 0===h?void 0:h.next)&&void 0!==u?u:x.next,prev:null!==(f=null===(p=t.icons)||void 0===p?void 0:p.prev)&&void 0!==f?f:x.prev,sortDown:null!==(v=null===(w=t.icons)||void 0===w?void 0:w.sortDown)&&void 0!==v?v:x.sortDown,sortUp:null!==(g=null===(m=t.icons)||void 0===m?void 0:m.sortUp)&&void 0!==g?g:x.sortUp}}static mergeCustomTheme(e){return Object.assign(Object.assign({},t),e.customTheme)}static mergeColumnEditorConfig(t){var e,n,o,s,i,r,l,a,d,c,h;return{text:null!==(n=null===(e=t.columnEditorConfig)||void 0===e?void 0:e.text)&&void 0!==n?n:"Columns",searchEnabled:null===(s=null===(o=t.columnEditorConfig)||void 0===o?void 0:o.searchEnabled)||void 0===s||s,searchPlaceholder:null!==(r=null===(i=t.columnEditorConfig)||void 0===i?void 0:i.searchPlaceholder)&&void 0!==r?r:"Search columns...",allowColumnPinning:null===(a=null===(l=t.columnEditorConfig)||void 0===l?void 0:l.allowColumnPinning)||void 0===a||a,searchFunction:null===(d=t.columnEditorConfig)||void 0===d?void 0:d.searchFunction,rowRenderer:null===(c=t.columnEditorConfig)||void 0===c?void 0:c.rowRenderer,customRenderer:null===(h=t.columnEditorConfig)||void 0===h?void 0:h.customRenderer}}static buildEssentialAccessors(t){return function(t){const e=new Set,n=t=>{var o;for(const s of t)s.isEssential&&e.add(s.accessor+""),(null===(o=s.children)||void 0===o?void 0:o.length)&&n(s.children)};return n(t),e}(t)}static getInitialCollapsedHeaders(t){const e=new Set,n=t=>{t.forEach(t=>{t.collapseDefault&&t.collapsible&&e.add(t.accessor),t.children&&n(t.children)})};return n(t),e}static getInitialExpandedDepths(t){var e;return ht(null===(e=t.expandAll)||void 0===e||e,t.rowGrouping)}}class Wt{constructor(){this.elements=null,this.refs={mainBodyRef:{current:null},pinnedLeftRef:{current:null},pinnedRightRef:{current:null},mainHeaderRef:{current:null},pinnedLeftHeaderRef:{current:null},pinnedRightHeaderRef:{current:null},headerContainerRef:{current:null},tableBodyContainerRef:{current:null},horizontalScrollbarRef:{current:null}}}createDOMStructure(t,e){var n,o,s;const i=null!==(n=e.theme)&&void 0!==n?n:"modern-light",r=null!==(o=e.className)&&void 0!==o?o:"",l=null!==(s=e.columnBorders)&&void 0!==s&&s,a=document.createElement("div");a.className=`simple-table-root st-wrapper theme-${i} ${r} ${l?"st-column-borders":""}`,a.setAttribute("role","grid");const d=document.createElement("div");d.className="st-wrapper-container";const c=document.createElement("div");c.className="st-content-wrapper";const h=document.createElement("div");h.className="st-content",h.style.width=e.editColumns?"calc(100% - 29.5px)":"100%";const u=document.createElement("div");u.className="st-header-container",this.refs.headerContainerRef.current=u;const p=document.createElement("div");p.className="st-body-container",this.refs.tableBodyContainerRef.current=p;const f=document.createElement("div");f.id="st-footer-container";const w=document.createElement("div");return w.setAttribute("aria-live","polite"),w.setAttribute("aria-atomic","true"),w.className="st-sr-only",h.appendChild(u),h.appendChild(p),c.appendChild(h),d.appendChild(c),d.appendChild(f),a.appendChild(d),a.appendChild(w),t.appendChild(a),this.elements={rootElement:a,wrapperContainer:d,contentWrapper:c,content:h,headerContainer:u,bodyContainer:p,footerContainer:f,ariaLiveRegion:w},this.elements}updateTheme(t){if(!this.elements)return;const e=this.elements.rootElement,n=e.className.replace(/\btheme-\S+/g,"").trim();e.className=`${n} theme-${t}`}getElements(){return this.elements}getRefs(){return this.refs}destroy(t){var e;(null===(e=this.elements)||void 0===e?void 0:e.rootElement)&&t.contains(this.elements.rootElement)&&t.removeChild(this.elements.rootElement),this.elements=null}}const Pt=new WeakMap;let $t=0,Dt=Date.now(),Ft={screenX:0,screenY:0},Lt=null;const jt=t=>{Dt=t},Bt=new WeakMap,Nt=t=>(Bt.has(t)||Bt.set(t,new Map),Bt.get(t)),zt=new WeakMap,Vt=t=>(zt.has(t)||zt.set(t,new Map),zt.get(t)),qt=(t,e)=>{const n=Date.now();0!==$t&&e>n-$t||($t=n,t())},Gt=(t,e,n,o)=>{t.addEventListener(e,n,o),Pt.has(t)||Pt.set(t,[]),Pt.get(t).push({event:e,handler:n,options:o})},Ut=t=>{const e=t.closest(".simple-table-root");null==e||e.querySelectorAll(".st-tooltip").forEach(t=>t.remove())},Kt=t=>{if($t=0,t){const e=Nt(t);e.forEach(t=>{t.remove()}),e.clear(),Vt(t).clear(),Ut(t)}},Jt={equals:"Equals",notEquals:"Not equals",contains:"Contains",notContains:"Does not contain",startsWith:"Starts with",endsWith:"Ends with",greaterThan:"Greater than",lessThan:"Less than",greaterThanOrEqual:"Greater than or equal",lessThanOrEqual:"Less than or equal",between:"Between",notBetween:"Not between",before:"Before",after:"After",in:"Is one of",notIn:"Is not one of",isEmpty:"Is empty",isNotEmpty:"Is not empty"},Yt=t=>{switch(t){case"string":return["equals","notEquals","contains","notContains","startsWith","endsWith","isEmpty","isNotEmpty"];case"number":return["equals","notEquals","greaterThan","lessThan","greaterThanOrEqual","lessThanOrEqual","between","notBetween","isEmpty","isNotEmpty"];case"boolean":return["equals","isEmpty","isNotEmpty"];case"date":return["equals","notEquals","before","after","between","notBetween","isEmpty","isNotEmpty"];case"enum":return["in","notIn","isEmpty","isNotEmpty"];default:return["equals","notEquals","isEmpty","isNotEmpty"]}},_t=t=>!["between","notBetween","in","notIn","isEmpty","isNotEmpty"].includes(t),Xt=t=>["between","notBetween","in","notIn"].includes(t),Qt=t=>["isEmpty","isNotEmpty"].includes(t),Zt=t=>{var e;return null!==(e=null==t?void 0:t.closest(".simple-table-root"))&&void 0!==e?e:null},te=t=>{var e,n,o;let{children:s,containerRef:i,mainBodyRef:r,anchorElement:l,onClose:a,open:d,overflow:c="auto",width:h,maxWidth:u,positioning:p="fixed",allowDescendantOverflow:f=!1}=t,w=f;const v="st-dropdown-content--allow-descendant-overflow",m=document.createElement("div");m.className="st-dropdown-content",w&&m.classList.add(v),m.style.position=p,m.style.overflow=w?"visible":c,h&&(m.style.width=h+"px"),u&&(m.style.maxWidth=u+"px"),m.addEventListener("click",t=>t.stopPropagation()),m.addEventListener("mousedown",t=>t.stopPropagation()),m.addEventListener("touchstart",t=>t.stopPropagation()),m.appendChild(s);let g=l;if("fixed"===p){const t=null!==(o=null!==(n=null!==(e=Zt(g))&&void 0!==e?e:Zt(null!=r?r:null))&&void 0!==n?n:Zt(null!=i?i:null))&&void 0!==o?o:document.querySelector(".simple-table-root");(null!=t?t:document.body).appendChild(m)}const x=t=>{d&&m&&!m.contains(t.target)&&(C(!1),null==a||a())},b=t=>{const e=t.target;if(!m.contains(e)&&!(null==g?void 0:g.contains(e))){if("absolute"===p){const t=m.parentElement;if(null==t?void 0:t.contains(e))return}C(!1),null==a||a()}},y=t=>{"Escape"===t.key&&d&&(C(!1),null==a||a())},R=t=>{"Enter"===t.key&&b(t)},C=t=>{d=t,d?(m.style.display="flex",(()=>{if(!d)return;if("absolute"===p&&!m.parentElement)return;if("fixed"===p&&!m.parentElement)return;m.style.visibility="hidden";const t=g||m.parentElement;t&&requestAnimationFrame(()=>{const e=t.getBoundingClientRect(),n=m.offsetHeight,o=h||m.offsetWidth;let s;s=i?i.getBoundingClientRect():r?r.getBoundingClientRect():{top:0,right:window.innerWidth,bottom:window.innerHeight,left:0,width:window.innerWidth,height:window.innerHeight,x:0,y:0,toJSON:()=>{}};const l=s.bottom-e.bottom,a=e.top-s.top;let d="bottom";(n>l&&a>=n||n>l&&a>l)&&(d="top");let c="left";if(o>s.right-e.right+e.width&&(c="right"),"fixed"===p)"bottom"===d?(m.style.top=e.bottom+4+"px",m.style.bottom="auto"):(m.style.bottom=window.innerHeight-e.top+4+"px",m.style.top="auto"),"left"===c?(m.style.left=e.left+"px",m.style.right="auto"):(m.style.right=window.innerWidth-e.right+"px",m.style.left="auto");else{const t=m.parentElement;if(!t)return;const n=t.getBoundingClientRect();"bottom"===d?(m.style.top=e.bottom-n.top+4+"px",m.style.bottom="auto"):(m.style.bottom=n.bottom-e.top+4+"px",m.style.top="auto"),"left"===c?(m.style.left=e.left-n.left+"px",m.style.right="auto"):(m.style.right=n.right-e.right+"px",m.style.left="auto")}m.className=`st-dropdown-content st-dropdown-${d}-${c}${w?" "+v:""}`,m.style.visibility="visible"})})(),window.addEventListener("scroll",x,!0),document.addEventListener("mousedown",b,!0),document.addEventListener("keydown",R,!0),document.addEventListener("keydown",y)):(m.style.display="none",window.removeEventListener("scroll",x,!0),document.removeEventListener("mousedown",b,!0),document.removeEventListener("keydown",R,!0),document.removeEventListener("keydown",y))};return d?C(!0):m.style.display="none",{element:m,update:t=>{void 0!==t.anchorElement&&(g=t.anchorElement),void 0!==t.open&&C(t.open),void 0!==t.children&&(m.innerHTML="",m.appendChild(t.children)),void 0!==t.width&&(h=t.width,m.style.width=h?h+"px":"auto"),void 0!==t.maxWidth&&(u=t.maxWidth,m.style.maxWidth=u?u+"px":""),void 0!==t.overflow&&(c=t.overflow,m.style.overflow=w?"visible":c),void 0!==t.allowDescendantOverflow&&(w=t.allowDescendantOverflow,m.classList.toggle(v,w),m.style.overflow=w?"visible":c)},destroy:()=>{C(!1),m.remove()},setOpen:C}},ee=t=>{let{value:e,onChange:n,options:o,placeholder:s="Select...",className:i="",disabled:r=!1,containerRef:l,mainBodyRef:a}=t,d=!1,c=-1;const h=document.createElement("div");h.className=`st-custom-select ${i} ${r?"st-custom-select-disabled":""}`.trim();const u=document.createElement("button");u.type="button",u.className="st-custom-select-trigger",u.disabled=r,u.setAttribute("aria-haspopup","listbox"),u.setAttribute("aria-expanded","false"),u.setAttribute("aria-labelledby","select-label");const p=document.createElement("span");p.className="st-custom-select-value";const f=o.find(t=>t.value===e);p.textContent=f?f.label:s;const w=document.createElement("template");w.innerHTML='<svg\n class="st-custom-select-arrow"\n width="12"\n height="12"\n viewBox="0 0 12 12"\n fill="none"\n xmlns="http://www.w3.org/2000/svg"\n>\n <path\n d="M3 4.5L6 7.5L9 4.5"\n stroke="currentColor"\n stroke-width="1.5"\n stroke-linecap="round"\n stroke-linejoin="round"\n />\n</svg>';const v=w.content.firstElementChild;u.appendChild(p),u.appendChild(v),h.appendChild(u);const m=document.createElement("div");m.className="st-custom-select-options",m.setAttribute("role","listbox");const g=()=>{m.innerHTML="",o.forEach((t,n)=>{const o=document.createElement("div");o.className=`st-custom-select-option ${t.value===e?"st-custom-select-option-selected":""} ${n===c?"st-custom-select-option-focused":""}`.trim(),o.setAttribute("role","option"),o.setAttribute("aria-selected",""+(t.value===e)),o.setAttribute("tabindex","0"),o.textContent=t.label,o.addEventListener("click",()=>y(t.value)),o.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),y(t.value))}),m.appendChild(o)})};g();const x=te({children:m,containerRef:l,mainBodyRef:a,anchorElement:u,onClose:()=>{S(!1)},open:d,overflow:"auto",positioning:"absolute"});h.appendChild(x.element);const b=t=>{e=t;const n=o.find(t=>t.value===e);p.textContent=n?n.label:s},y=t=>{b(t),n(t),S(!1),c=-1,g()},R=()=>{if(!r){if(S(!d),d)c=-1;else{const t=o.findIndex(t=>t.value===e);c=0>t?0:t}g()}},C=t=>{if(d)switch(t.key){case"ArrowDown":t.preventDefault(),c=o.length-1>c?c+1:0,g();break;case"ArrowUp":t.preventDefault(),c=c>0?c-1:o.length-1,g();break;case"Enter":if(t.preventDefault(),c>=0){const t=o[c].value;b(t),n(t),S(!1),c=-1,g()}break;case"Escape":t.preventDefault(),S(!1),c=-1,g()}},S=t=>{d=t,u.setAttribute("aria-expanded",""+d),d?(h.classList.add("st-custom-select-open"),document.addEventListener("keydown",C)):(h.classList.remove("st-custom-select-open"),document.removeEventListener("keydown",C)),x.setOpen(d)};return u.addEventListener("click",R),{element:h,update:t=>{if(void 0!==t.value){e=t.value;const n=o.find(t=>t.value===e);p.textContent=n?n.label:s,g()}void 0!==t.options&&(o=t.options,g()),void 0!==t.disabled&&(r=t.disabled,u.disabled=r,r?h.classList.add("st-custom-select-disabled"):h.classList.remove("st-custom-select-disabled")),void 0!==t.onChange&&(n=t.onChange)},destroy:()=>{u.removeEventListener("click",R),document.removeEventListener("keydown",C),x.destroy(),h.remove()},setOpen:S}},ne=t=>{let{type:e="text",value:n,onChange:o,onEnter:s,placeholder:i="",autoFocus:r=!1,min:l,max:a,step:d}=t;const c=document.createElement("input");c.className="st-filter-input",c.type=e,c.value=n,c.placeholder=i,void 0!==l&&(c.min=l),void 0!==a&&(c.max=a),void 0!==d&&(c.step=d),r&&setTimeout(()=>c.focus(),0);const h=t=>{o(t.target.value)},u=t=>{"Enter"===t.key&&s&&(t.preventDefault(),s())};return c.addEventListener("input",h),c.addEventListener("keydown",u),{element:c,update:t=>{void 0!==t.value&&(n=t.value,c.value=n),void 0!==t.type&&(e=t.type,c.type=e),void 0!==t.placeholder&&(i=t.placeholder,c.placeholder=i),void 0!==t.min&&(l=t.min,c.min=l),void 0!==t.max&&(a=t.max,c.max=a),void 0!==t.step&&(d=t.step,c.step=d),void 0!==t.onChange&&(o=t.onChange),void 0!==t.onEnter&&(s=t.onEnter)},destroy:()=>{c.removeEventListener("input",h),c.removeEventListener("keydown",u),c.remove()}}},oe=t=>{let{onApply:e,onClear:n,canApply:o,showClear:s}=t;const i=document.createElement("div");i.className="st-filter-actions";const r=document.createElement("button");r.type="button",r.tabIndex=0,r.textContent="Apply";const l=()=>{r.disabled=!o,r.className=("st-filter-button st-filter-button-apply"+(o?"":" st-filter-button-disabled")).trim()};l();const a=()=>{e()};r.addEventListener("click",a),i.appendChild(r);let d=null;const c=()=>{null==n||n()},h=()=>{const t=s&&!!n;t&&!d?(d=document.createElement("button"),d.type="button",d.tabIndex=0,d.className="st-filter-button st-filter-button-clear",d.textContent="Clear",d.addEventListener("click",c),i.appendChild(d)):!t&&d&&(d.removeEventListener("click",c),d.remove(),d=null)};return h(),{element:i,update:t=>{void 0!==t.canApply&&(o=t.canApply,l()),void 0!==t.showClear&&(s=t.showClear,h()),void 0!==t.onApply&&(e=t.onApply),void 0!==t.onClear&&(n=t.onClear,h())},destroy:()=>{r.removeEventListener("click",a),d&&d.removeEventListener("click",c),i.remove()}}},se=t=>{let{onChange:e,onClose:n,value:o}=t,s=o||new Date,i="days";const r=document.createElement("div");r.className="st-datepicker";const l=(t,e)=>new Date(t,e+1,0).getDate(),a=()=>{s=new Date(s.getFullYear(),s.getMonth()-1,1),f()},d=()=>{s=new Date(s.getFullYear(),s.getMonth()+1,1),f()},c=t=>{s=new Date(t,s.getMonth(),1),i="months",f()},h=t=>{const o=s.getFullYear(),i=s.getMonth(),r=new Date(o,i,t,12,0,0);s=r,e(r),null==n||n()},u=t=>{const o=new Date(s.getFullYear(),s.getMonth()-1,t,12,0,0);s=o,e(o),null==n||n()},p=t=>{const o=new Date(s.getFullYear(),s.getMonth()+1,t,12,0,0);s=o,e(o),null==n||n()},f=()=>{r.innerHTML="";const t=document.createElement("div");if(t.className="st-datepicker-header","days"===i){const e=document.createElement("button");e.className="st-datepicker-nav-btn",e.innerHTML='<svg viewBox="0 0 24 24" width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n <path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z" />\n</svg>',e.addEventListener("click",a);const n=document.createElement("div");n.className="st-datepicker-header-label",n.textContent=`${w=s,w.toLocaleString("default",{month:"long"})} ${s.getFullYear()}`,n.addEventListener("click",()=>{i="months",f()});const o=document.createElement("button");o.className="st-datepicker-nav-btn",o.innerHTML='<svg viewBox="0 0 24 24" width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n <path d="M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z" />\n</svg>',o.addEventListener("click",d),t.appendChild(e),t.appendChild(n),t.appendChild(o)}else if("months"===i){const e=document.createElement("div");e.className="st-datepicker-header-label",e.textContent=""+s.getFullYear(),e.addEventListener("click",()=>{i="years",f()}),t.appendChild(e)}else{const e=document.createElement("div");e.className="st-datepicker-header-label",e.textContent="Select Year",t.appendChild(e)}var w;r.appendChild(t);const v=document.createElement("div");var m;v.className=`st-datepicker-grid st-datepicker-${i}-grid`,"days"===i?(t=>{const e=s.getFullYear(),n=s.getMonth(),i=l(e,n),r=((t,e)=>new Date(t,e,1).getDay())(e,n),a=l(e,n-1);["Su","Mo","Tu","We","Th","Fr","Sa"].forEach(e=>{const n=document.createElement("div");n.className="st-datepicker-weekday",n.textContent=e,t.appendChild(n)});for(let e=0;r>e;e++){const n=a-r+e+1,o=document.createElement("div");o.className="st-datepicker-day other-month",o.textContent=""+n,o.addEventListener("click",()=>u(n)),t.appendChild(o)}for(let s=1;i>=s;s++){const i=s===(new Date).getDate()&&n===(new Date).getMonth()&&e===(new Date).getFullYear(),r=new Date(o),l=s===r.getDate()&&n===r.getMonth()&&e===r.getFullYear(),a=document.createElement("div");a.className=`st-datepicker-day ${i?"today":""} ${l?"selected":""}`.trim(),a.textContent=""+s,a.addEventListener("click",()=>h(s)),t.appendChild(a)}const d=35-(r+i);for(let e=1;d>=e;e++){const n=document.createElement("div");n.className="st-datepicker-day other-month",n.textContent=""+e,n.addEventListener("click",()=>p(e)),t.appendChild(n)}})(v):"months"===i?(m=v,Array.from({length:12},(t,e)=>new Date(2e3,e,1).toLocaleString("default",{month:"short"})).forEach((t,e)=>{const n=e===s.getMonth(),o=document.createElement("div");o.className=("st-datepicker-month "+(n?"selected":"")).trim(),o.textContent=t,o.addEventListener("click",()=>(t=>{s=new Date(s.getFullYear(),t,1),i="days",f()})(e)),m.appendChild(o)})):(t=>{const e=s.getFullYear(),n=e-6;for(let o=n;n+12>o;o++){const n=o===e,s=document.createElement("div");s.className=("st-datepicker-year "+(n?"selected":"")).trim(),s.textContent=""+o,s.addEventListener("click",()=>c(o)),t.appendChild(s)}})(v),r.appendChild(v);const g=document.createElement("div");g.className="st-datepicker-footer";const x=document.createElement("button");x.className="st-datepicker-today-btn",x.textContent="Today",x.addEventListener("click",()=>{const t=new Date,o=new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0);s=o,e(o),null==n||n()}),g.appendChild(x),r.appendChild(g)};return f(),{element:r,update:t=>{void 0!==t.value&&(o=t.value,s=o||new Date,f()),void 0!==t.onChange&&(e=t.onChange),void 0!==t.onClose&&(n=t.onClose)},destroy:()=>{r.remove()}}},ie=()=>{const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("aria-hidden","true"),t.setAttribute("role","img"),t.setAttribute("xmlns","http://www.w3.org/2000/svg"),t.setAttribute("viewBox","0 0 448 512"),t.setAttribute("class","st-checkbox-checkmark"),t.style.height="10px";const e=document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttribute("d","M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"),t.appendChild(e),t},re=(t,e)=>{const n=t.querySelector(".st-checkbox-input"),o=t.querySelector(".st-checkbox-custom");n&&o&&n.checked!==e&&(n.checked=e,n.setAttribute("aria-checked",e+""),o.className="st-checkbox-custom "+(e?"st-checked":""),o.setAttribute("aria-hidden","true"),o.innerHTML="",e&&o.appendChild(ie()))},le=({checked:t,onChange:e,ariaLabel:n})=>{const o=document.createElement("label");o.className="st-checkbox-label";const s=document.createElement("input");s.type="checkbox",s.checked=t,s.className="st-checkbox-input",n&&s.setAttribute("aria-label",n),s.setAttribute("aria-checked",""+t);const i=document.createElement("span");i.className="st-checkbox-custom "+(t?"st-checked":""),i.setAttribute("aria-hidden","true"),t&&i.appendChild(ie());const r=()=>{const t=s.checked;s.setAttribute("aria-checked",""+t),t?(i.classList.add("st-checked"),i.appendChild(ie())):(i.classList.remove("st-checked"),i.innerHTML=""),e(t)};return s.addEventListener("change",r),s.addEventListener("keydown",t=>{" "===t.key&&t.stopPropagation()}),o.addEventListener("mousedown",t=>{t.stopPropagation()}),o.addEventListener("dragstart",t=>{t.preventDefault(),t.stopPropagation()}),o.appendChild(s),o.appendChild(i),{element:o,update:t=>{s.checked!==t&&(s.checked=t,s.setAttribute("aria-checked",""+t),t?(i.classList.add("st-checked"),i.innerHTML="",i.appendChild(ie())):(i.classList.remove("st-checked"),i.innerHTML=""))},destroy:()=>{s.removeEventListener("change",r)}}},ae=t=>{const{header:e}=t;switch(e.type){case"string":default:return(t=>{let{header:e,currentFilter:n,onApplyFilter:o,onClearFilter:s,containerRef:i,mainBodyRef:r}=t,l=(null==n?void 0:n.operator)||"contains",a=((null==n?void 0:n.value)||"")+"";const d=Yt("string"),c=document.createElement("div");c.className="st-filter-container";const h=document.createElement("div");h.className="st-filter-section";const u=ee({value:l,onChange:t=>{l=t,g()},options:d.map(t=>({value:t,label:Jt[t]})),containerRef:i,mainBodyRef:r});h.appendChild(u.element),c.appendChild(h);let p=null,f=null,w=null;const v=()=>{const t=Object.assign({accessor:e.accessor,operator:l},_t(l)&&{value:a});o(t)},m=()=>Qt(l)||""!==a.trim(),g=()=>{p&&(p.remove(),p=null),f&&(f.destroy(),f=null),_t(l)&&(p=document.createElement("div"),p.className="st-filter-section",f=ne({type:"text",value:a,onChange:t=>{a=t,w&&w.update({canApply:m()})},onEnter:v,placeholder:"Filter...",autoFocus:!0}),p.appendChild(f.element),c.insertBefore(p,c.lastChild)),w&&w.update({canApply:m()})};return w=oe({onApply:v,onClear:s,canApply:m(),showClear:!!n}),c.appendChild(w.element),g(),{element:c,update:t=>{void 0!==t.currentFilter&&(n=t.currentFilter,l=(null==n?void 0:n.operator)||"contains",a=((null==n?void 0:n.value)||"")+"",u.update({value:l}),f&&f.update({value:a}),w&&w.update({showClear:!!n,canApply:m()}),g())},destroy:()=>{u.destroy(),f&&f.destroy(),w&&w.destroy(),c.remove()}}})(t);case"number":return(t=>{var e,n;let{header:o,currentFilter:s,onApplyFilter:i,onClearFilter:r,containerRef:l,mainBodyRef:a}=t,d=(null==s?void 0:s.operator)||"equals",c=((null==s?void 0:s.value)||"")+"",h=((null===(e=null==s?void 0:s.values)||void 0===e?void 0:e[0])||"")+"",u=((null===(n=null==s?void 0:s.values)||void 0===n?void 0:n[1])||"")+"";const p=Yt("number"),f=document.createElement("div");f.className="st-filter-container";const w=document.createElement("div");w.className="st-filter-section";const v=ee({value:d,onChange:t=>{d=t,S()},options:p.map(t=>({value:t,label:Jt[t]})),containerRef:l,mainBodyRef:a});w.appendChild(v.element),f.appendChild(w);let m=null,g=null,x=null,b=null,y=null;const R=()=>{const t={accessor:o.accessor,operator:d};_t(d)?t.value=parseFloat(c):Xt(d)&&(t.values=[parseFloat(h),parseFloat(u)]),i(t)},C=()=>!!Qt(d)||(_t(d)?""!==c.trim():!!Xt(d)&&""!==h.trim()&&""!==u.trim()),S=()=>{m&&(m.remove(),m=null),g&&(g.destroy(),g=null),x&&(x.destroy(),x=null),b&&(b.destroy(),b=null),_t(d)?(m=document.createElement("div"),m.className="st-filter-section",g=ne({type:"number",value:c,onChange:t=>{c=t,y&&y.update({canApply:C()})},onEnter:R,placeholder:"Enter number...",autoFocus:!0}),m.appendChild(g.element),f.insertBefore(m,f.lastChild)):Xt(d)&&(m=document.createElement("div"),m.className="st-filter-section",x=ne({type:"number",value:h,onChange:t=>{h=t,y&&y.update({canApply:C()})},onEnter:R,placeholder:"From...",autoFocus:!0}),x.element.classList.add("st-filter-input-range-from"),b=ne({type:"number",value:u,onChange:t=>{u=t,y&&y.update({canApply:C()})},onEnter:R,placeholder:"To..."}),m.appendChild(x.element),m.appendChild(b.element),f.insertBefore(m,f.lastChild)),y&&y.update({canApply:C()})};return y=oe({onApply:R,onClear:r,canApply:C(),showClear:!!s}),f.appendChild(y.element),S(),{element:f,update:t=>{var e,n;void 0!==t.currentFilter&&(s=t.currentFilter,d=(null==s?void 0:s.operator)||"equals",c=((null==s?void 0:s.value)||"")+"",h=((null===(e=null==s?void 0:s.values)||void 0===e?void 0:e[0])||"")+"",u=((null===(n=null==s?void 0:s.values)||void 0===n?void 0:n[1])||"")+"",v.update({value:d}),g&&g.update({value:c}),x&&x.update({value:h}),b&&b.update({value:u}),y&&y.update({showClear:!!s,canApply:C()}),S())},destroy:()=>{v.destroy(),g&&g.destroy(),x&&x.destroy(),b&&b.destroy(),y&&y.destroy(),f.remove()}}})(t);case"boolean":return(t=>{let{header:e,currentFilter:n,onApplyFilter:o,onClearFilter:s,containerRef:i,mainBodyRef:r}=t,l=(null==n?void 0:n.operator)||"equals",a=void 0!==(null==n?void 0:n.value)?n.value+"":"true";const d=Yt("boolean"),c=document.createElement("div");c.className="st-filter-container";const h=document.createElement("div");h.className="st-filter-section";const u=ee({value:l,onChange:t=>{l=t,g()},options:d.map(t=>({value:t,label:Jt[t]})),containerRef:i,mainBodyRef:r});h.appendChild(u.element),c.appendChild(h);let p=null,f=null,w=null;const v=()=>Qt(l)||""!==a,m=[{value:"true",label:"True"},{value:"false",label:"False"}],g=()=>{p&&(p.remove(),p=null),f&&(f.destroy(),f=null),_t(l)&&(p=document.createElement("div"),p.className="st-filter-section",f=ee({value:a,onChange:t=>{a=t,w&&w.update({canApply:v()})},options:m,containerRef:i,mainBodyRef:r}),p.appendChild(f.element),c.insertBefore(p,c.lastChild)),w&&w.update({canApply:v()})};return w=oe({onApply:()=>{const t={accessor:e.accessor,operator:l};_t(l)&&(t.value="true"===a),o(t)},onClear:s,canApply:v(),showClear:!!n}),c.appendChild(w.element),g(),{element:c,update:t=>{void 0!==t.currentFilter&&(n=t.currentFilter,l=(null==n?void 0:n.operator)||"equals",a=void 0!==(null==n?void 0:n.value)?n.value+"":"true",u.update({value:l}),f&&f.update({value:a}),w&&w.update({showClear:!!n,canApply:v()}),g())},destroy:()=>{u.destroy(),f&&f.destroy(),w&&w.destroy(),c.remove()}}})(t);case"date":return(t=>{var e,n;let{header:o,currentFilter:s,onApplyFilter:i,onClearFilter:r,containerRef:l,mainBodyRef:a}=t,d=(null==s?void 0:s.operator)||"equals",c=(null==s?void 0:s.value)?s.value+"":"",h=(null===(e=null==s?void 0:s.values)||void 0===e?void 0:e[0])?s.values[0]+"":"",u=((null===(n=null==s?void 0:s.values)||void 0===n?void 0:n[1])||"")+"";const p=Yt("date"),f=document.createElement("div");f.className="st-filter-container";const w=document.createElement("div");w.className="st-filter-section";const v=ee({value:d,onChange:t=>{d=t,T()},options:p.map(t=>({value:t,label:Jt[t]})),containerRef:l,mainBodyRef:a});w.appendChild(v.element),f.appendChild(w);let m=null,g=null,x=null,b=null,y=null,R=null,C=null,S=null,I=null,H=null,M=null;const k=()=>!!Qt(d)||(_t(d)?""!==c.trim():!!Xt(d)&&""!==h.trim()&&""!==u.trim()),E=t=>{if(!t)return"";const e=q(t);return isNaN(e.getTime())?"":e.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})},O=(t,e,n,o=!1)=>{const s=document.createElement("div");s.className="st-date-input-container",s.style.position="relative";const i=document.createElement("input");i.type="text",i.className="st-filter-input",i.value=E(t),i.placeholder=n,i.readOnly=!0,i.style.cursor="pointer",o&&setTimeout(()=>i.focus(),0);let r=!1;const d=t?q(t):new Date,c=se({value:d,onChange:t=>{const n=t.toISOString().split("T")[0];e(n),i.value=E(n),h.setOpen(!1),r=!1},onClose:()=>{h.setOpen(!1),r=!1}}),h=te({children:c.element,containerRef:l,mainBodyRef:a,anchorElement:i,onClose:()=>{r=!1},open:!1,overflow:"hidden",positioning:"absolute",width:240});s.appendChild(i),s.appendChild(h.element);const u=()=>{r=!r,h.setOpen(r)},p=t=>{"Enter"===t.key||" "===t.key?(t.preventDefault(),r=!r,h.setOpen(r)):"Escape"===t.key&&(r=!1,h.setOpen(!1))};return i.addEventListener("click",u),i.addEventListener("keydown",p),{container:s,input:i,picker:c,dropdown:h,destroy:()=>{i.removeEventListener("click",u),i.removeEventListener("keydown",p),c.destroy(),h.destroy(),s.remove()}}},T=()=>{if(m&&(m.remove(),m=null),g&&(g=null),x&&(x=null),b&&(b=null),y&&(y.destroy(),y=null),R&&(R.destroy(),R=null),C&&(C.destroy(),C=null),S&&(S.destroy(),S=null),I&&(I.destroy(),I=null),H&&(H.destroy(),H=null),_t(d)){m=document.createElement("div"),m.className="st-filter-section";const t=O(c,t=>{c=t,M&&M.update({canApply:k()})},"Select date...",!0);g=t.container,y=t.picker,S=t.dropdown,m.appendChild(g),f.insertBefore(m,f.lastChild)}else if(Xt(d)){m=document.createElement("div"),m.className="st-filter-section";const t=O(h,t=>{h=t,M&&M.update({canApply:k()})},"From date...",!0);t.input.classList.add("st-filter-input-range-from");const e=O(u,t=>{u=t,M&&M.update({canApply:k()})},"To date...",!1);x=t.container,R=t.picker,I=t.dropdown,b=e.container,C=e.picker,H=e.dropdown,m.appendChild(x),m.appendChild(b),f.insertBefore(m,f.lastChild)}M&&M.update({canApply:k()})};return M=oe({onApply:()=>{const t={accessor:o.accessor,operator:d};_t(d)?t.value=c:Xt(d)&&(t.values=[h,u]),i(t)},onClear:r,canApply:k(),showClear:!!s}),f.appendChild(M.element),T(),{element:f,update:t=>{var e,n;void 0!==t.currentFilter&&(s=t.currentFilter,d=(null==s?void 0:s.operator)||"equals",c=(null==s?void 0:s.value)?s.value+"":"",h=(null===(e=null==s?void 0:s.values)||void 0===e?void 0:e[0])?s.values[0]+"":"",u=((null===(n=null==s?void 0:s.values)||void 0===n?void 0:n[1])||"")+"",v.update({value:d}),M&&M.update({showClear:!!s,canApply:k()}),T())},destroy:()=>{v.destroy(),y&&y.destroy(),R&&R.destroy(),C&&C.destroy(),S&&S.destroy(),I&&I.destroy(),H&&H.destroy(),M&&M.destroy(),f.remove()}}})(t);case"enum":return(t=>{let{header:e,currentFilter:n,onApplyFilter:o,onClearFilter:s}=t;const i=e.enumOptions||[],r=i.map(t=>t.value);let l=(null==n?void 0:n.values)?n.values.map(String):r,a="";const d=document.createElement("div");d.className="st-filter-container";const c=document.createElement("div");c.className="st-filter-section";const h=document.createElement("div");h.className="st-enum-filter-options";const u=document.createElement("div");u.className="st-enum-select-all";const p=le({checked:l.length===r.length,onChange:t=>{l=t?[...r]:[],x(),y&&y.update({canApply:b()})}}),f=document.createElement("span");f.className="st-enum-option-label st-enum-select-all-label",f.textContent="Select All",p.element.appendChild(f),u.appendChild(p.element),h.appendChild(u);let w=null,v=null;i.length>10&&(w=document.createElement("div"),w.className="st-enum-search",v=ne({type:"text",value:a,onChange:t=>{a=t,x()},placeholder:"Search..."}),w.appendChild(v.element),h.appendChild(w));const m=document.createElement("div");h.appendChild(m);const g=[],x=()=>{m.innerHTML="",g.forEach(t=>t.checkbox.destroy()),g.length=0;const t=a?i.filter(t=>t.label.toLowerCase().includes(a.toLowerCase())):i;if(a&&0===t.length){const t=document.createElement("div");t.className="st-enum-no-results",t.textContent="No matching options",m.appendChild(t)}else t.forEach(t=>{const e=le({checked:l.includes(t.value),onChange:()=>{l=l.includes(t.value)?l.filter(e=>e!==t.value):[...l,t.value];const e=l.length===r.length;p.element.querySelector("input").checked=e,y&&y.update({canApply:b()})}}),n=document.createElement("span");n.className="st-enum-option-label",n.textContent=t.label,e.element.appendChild(n),m.appendChild(e.element),g.push({container:e.element,checkbox:e,value:t.value})});const e=l.length===r.length;p.element.querySelector("input").checked=e};x(),c.appendChild(h),d.appendChild(c);const b=()=>0!==l.length&&l.length!==r.length,y=oe({onApply:()=>{l.length!==r.length?o({accessor:e.accessor,operator:"in",values:l}):s()},onClear:s,canApply:b(),showClear:!!n});return d.appendChild(y.element),{element:d,update:t=>{void 0!==t.currentFilter&&(n=t.currentFilter,l=(null==n?void 0:n.values)?n.values.map(String):r,a="",v&&v.update({value:a}),x(),y&&y.update({showClear:!!n,canApply:b()}))},destroy:()=>{p.destroy(),v&&v.destroy(),g.forEach(t=>t.checkbox.destroy()),y&&y.destroy(),d.remove()}}})(t)}},de=new WeakMap,ce=(t,e,n,o)=>{t.addEventListener(e,n,o),de.has(t)||de.set(t,[]),de.get(t).push({event:e,handler:n,options:o})},he=new WeakMap,ue=t=>(he.has(t)||he.set(t,new Map),he.get(t)),pe=(t,e,n)=>{var o,s;const i=t.querySelector(".st-expand-icon-container");if(!(i&&i instanceof HTMLElement))return;if(i.classList.contains("expanded")===e)return;const r=null!==(o=null==n?void 0:n.ariaLabelWhenExpanded)&&void 0!==o?o:"Collapse row",l=null!==(s=null==n?void 0:n.ariaLabelWhenCollapsed)&&void 0!==s?s:"Expand row";requestAnimationFrame(()=>{requestAnimationFrame(()=>{i.classList.toggle("expanded",e),i.classList.toggle("collapsed",!e),i.setAttribute("aria-label",e?r:l),(null==n?void 0:n.syncAriaExpanded)&&i.setAttribute("aria-expanded",e+"")})})},fe=(t,e,n=[])=>{for(let o=0;t.length>o;o++){const s=t[o];if(s.accessor===e)return[...n,o];if(s.children&&s.children.length>0){const t=fe(s.children,e,[...n,o]);if(t)return t}}return null},we=t=>"left"===t.pinned?"left":"right"===t.pinned?"right":"main";function ve(t,e,n){const o=wt(t);let s=!1;function i(t,e){let n,o=t;for(let t=0;e.length-1>t;t++)o=o[e[t]].children;return n=o[e[e.length-1]],n}function r(t,e,n){let o=t;for(let t=0;e.length-1>t;t++){if(!o[e[t]].children){s=!0;break}o=o[e[t]].children}o[e[e.length-1]]=n}const l=i(o,e);return r(o,e,i(o,n)),r(o,n,l),{newHeaders:o,emergencyBreak:s}}const me=({headers:t,containerWidth:e,collapsedHeaders:n})=>{let o=0,i=0,r=0;t.forEach(t=>{if(t.hide)return;const e=x(t,n).reduce((t,e)=>t+S(e),0);"left"===t.pinned?o+=e:"right"===t.pinned?i+=e:r+=e});const l=o,d=i;if(e&&e>0){const t=e*s(e,o>0,i>0);o>t&&(o=t),i>t&&(i=t)}return{leftWidth:a(o),rightWidth:a(i),mainWidth:r,leftContentWidth:l,rightContentWidth:d}},ge=(t,e)=>{if(t.pinned)return t.pinned;const n=((t,e)=>{const n=l(t);for(const t of n)if(t.children&&t.children.length>0&&t.children.some(t=>t.accessor===e))return t;return null})(e,t.accessor);return n?ge(n,e):void 0},xe=(t,e,n)=>{var o;const s=[],r=[],l=[];t.forEach(e=>{if(e.hide)return;const n=ge(e,t);"left"===n?s.push(e):"right"===n?l.push(e):r.push(e)});const a=(t,o,s)=>{var r,l;const d=o;if(t.children&&t.children.length>0){const l=null==e?void 0:e.has(t.accessor),c=t.children.filter(t=>{if(t.hide)return!1;const e=t.showWhen||i;return l?"parentCollapsed"===e||"always"===e:"parentExpanded"===e||"always"===e});if(t.singleRowChildren){const e=null!==(r=null==n?void 0:n.get(t.accessor))&&void 0!==r?r:"number"==typeof t.width?t.width:S(t);return s.set(t.accessor,{left:d,width:e}),o=d+e,c.forEach(t=>{o=a(t,o,s)}),o}c.forEach(t=>{o=a(t,o,s)}),s.set(t.accessor,{left:d,width:o-d})}else{const e=null!==(l=null==n?void 0:n.get(t.accessor))&&void 0!==l?l:"number"==typeof t.width?t.width:S(t);s.set(t.accessor,{left:o,width:e}),o+=e}return o},d=t=>{const e=new Map;let n=0;return t.forEach(t=>{n=a(t,n,e)}),e},h=d(s),u=d(r),p=d(l),f=new Map;h.forEach((t,e)=>f.set(e,t)),u.forEach((t,e)=>f.set(e,t)),p.forEach((t,e)=>f.set(e,t)),f.forEach((t,e)=>{const{left:n,width:o}=t,s=c({accessor:e,rowId:"header"}),i=document.getElementById(s);h.has(e),p.has(e),i&&(i.style.left=n+"px",i.style.width=o+"px"),document.querySelectorAll(`[id$="-${e}"]`).forEach(t=>{t instanceof HTMLElement&&!t.id.endsWith("-header")&&(t.style.left=n+"px",t.style.width=o+"px")})});const w=document.querySelector(".st-body-container"),v=null!==(o=null==w?void 0:w.clientWidth)&&void 0!==o?o:0,{leftWidth:m,rightWidth:g}=me({headers:t,containerWidth:v>0?v:void 0,collapsedHeaders:e});if(m>0){const t=document.querySelector(".st-header-pinned-left"),e=document.querySelector(".st-body-pinned-left");t&&(t.style.width=m+"px"),e&&(e.style.width=m+"px")}if(g>0){const t=document.querySelector(".st-header-pinned-right"),e=document.querySelector(".st-body-pinned-right");t&&(t.style.width=g+"px"),e&&(e.style.width=g+"px")}},be=({columnsToShrink:t,totalCompensation:e,initialWidthsMap:n})=>{if(0>e){const o=Math.abs(e),s=t.reduce((t,e)=>t+(n.get(e.accessor)||100),0);if(0===s)return;return void t.forEach((e,i)=>{const r=n.get(e.accessor)||100;let l=o*(r/s);if(i===t.length-1){const e=t.slice(0,i).reduce((t,e)=>{const o=n.get(e.accessor)||100;return t+(("number"==typeof e.width?e.width:100)-o)},0);l=o-e}e.width=r+l})}let s=e;for(;s>.5;){const e=o,i=t.map(t=>{const o=n.get(t.accessor)||100;return{column:t,headroom:Math.max(0,o-e),initialWidth:o,minWidth:e}}).filter(t=>t.headroom>0);if(0>=i.length)break;{const t=i.reduce((t,e)=>t+e.headroom,0);let e=0;const n=s;i.forEach((o,s)=>{let r=n*(o.headroom/t);r=Math.min(r,o.headroom),s===i.length-1&&(r=Math.min(n-e,o.headroom)),o.column.width=o.initialWidth-r,e+=r}),s-=e}}},ye=({childrenToResize:t=[],collapsedHeaders:e,containerWidth:n,delta:i,headers:r,initialWidthsMap:l,isParentResize:a=!1,resizedHeader:d,reverse:c,rootPinned:h,sectionHeaders:u,sectionWidth:p,startWidth:f})=>{let w=i;if(h&&n>0){const t=((t,e,n)=>t*s(t,e,n))(n,r.some(t=>"left"===t.pinned&&!t.hide),r.some(t=>"right"===t.pinned&&!t.hide)),e=Array.from(l.values()).reduce((t,e)=>t+e,0);i>0&&e+i>t&&(w=Math.max(0,t-e))}if(i=w,a&&t.length>1){const n=M(u,e),s=n.findIndex(e=>e.accessor===t[0].accessor),r=n.findIndex(e=>e.accessor===t[t.length-1].accessor);if(-1===s||-1===r)return;const a=0===s,d=r===n.length-1;let w;w="left"===h&&d||"right"===h&&a?[]:a?n.slice(r+1):d||c?n.slice(0,s):n.slice(r+1);const v=Array.from(l.values()).reduce((t,e)=>t+e,0);if(i>0){let e=i,n=!1;if(w.length>0&&v+i>(p>0?Math.max(p,v):v+Math.abs(i)+1)){n=!0;const t=w.reduce((t,e)=>{const n=l.get(e.accessor)||100;return t+Math.max(0,n-o)},0);e=Math.min(i,t)}const s=(f+e)/t.reduce((t,e)=>t+(l.get(e.accessor)||100),0);t.forEach(t=>{const e=l.get(t.accessor)||100;t.width=Math.max(e*s,40)}),n&&e>0&&w.length>0&&be({columnsToShrink:w,totalCompensation:e,initialWidthsMap:l})}else{const e=t.reduce((t,e)=>t+(l.get(e.accessor)||100),0),n=Math.max(f+i,o*t.length),s=n/e;t.forEach(t=>{const e=l.get(t.accessor)||100;t.width=Math.max(e*s,40)});const r=f-n;r>0&&w.length>0&&be({columnsToShrink:w,totalCompensation:-r,initialWidthsMap:l})}return}const v=M(u,e),m=v.findIndex(t=>t.accessor===d.accessor);if(-1===m)return;const g=0===m,x=m===v.length-1;let b;if(b="left"===h&&x||"right"===h&&g?[]:g?v.slice(m+1):x||c?v.slice(0,m):v.slice(m+1),0===b.length)return void(d.width=Math.max(f+i,o));const y=Array.from(l.values()).reduce((t,e)=>t+e,0);if(i>0){if((p>0?Math.max(p,y):y+Math.abs(i)+1)>=y+i)return void(d.width=f+i);const t=b.reduce((t,e)=>{const n=l.get(e.accessor)||100;return t+Math.max(0,n-o)},0),e=Math.min(i,t);d.width=f+e,e>0&&be({columnsToShrink:b,totalCompensation:e,initialWidthsMap:l})}else{const t=Math.max(f+i,40),e=f-t;d.width=t,e>0&&be({columnsToShrink:b,totalCompensation:-e,initialWidthsMap:l})}},Re=(t,e)=>{if(t>0)return t;const n=null==e?void 0:e.current;if(!n)return 0;const o=n.closest(".simple-table-root"),s=null==o?void 0:o.querySelector(".st-body-container");return s instanceof HTMLElement?s.clientWidth:n.clientWidth},Ce=({autoExpandColumns:t,collapsedHeaders:e,containerWidth:n,event:o,header:i,headers:r,mainBodyRef:l,onColumnWidthChange:a,reverse:d=!1,setHeaders:c,setIsResizing:h,startWidth:u})=>{o.preventDefault();const p="clientX"in o?o.clientX:o.touches[0].clientX,f="touches"in o;if(!i||i.hide)return;const w=Re(n,l);h(!0);const v=ge(i,r),m=H(i);let g;if(i.children&&i.children.length>0){const t=x(i,e);g=t.length>0?t:[i]}else g=[i];const b=new Map;let y=0,R=0;if(t){const t=r.filter(t=>t.pinned===v);if(M(t,e).forEach(t=>{const e=S(t);b.set(t.accessor,e)}),w>0){const{leftWidth:t,rightWidth:n,mainWidth:o}=me({headers:r,containerWidth:w,collapsedHeaders:e});y="left"===v?t:"right"===v?n:o,R=w-t-n}}let C=!1;const k=new Map;let E=[];if(t&&v&&w>0){const t=M(r.filter(t=>t.pinned===v),e);if(t.length>0){let n=!1;if(g.length>1){const e=t.findIndex(t=>t.accessor===g[0].accessor),o=t.findIndex(t=>t.accessor===g[g.length-1].accessor);n="left"===v&&o===t.length-1||"right"===v&&0===e}else{const e=g[0]||i,o=t.findIndex(t=>t.accessor===e.accessor);n="left"===v&&o===t.length-1||"right"===v&&0===o}if(n){C=!0;const t=r.filter(t=>!t.pinned);E=M(t,e),E.forEach(t=>{k.set(t.accessor,S(t))})}}}const O=(n,o=!1)=>{const l="right"===v?p-n:n-p;if(t){const t=r.filter(t=>t.pinned===v);if(ye({childrenToResize:g,collapsedHeaders:e,containerWidth:w,delta:l,headers:r,initialWidthsMap:b,isParentResize:g.length>1,resizedHeader:g.length>0?g[g.length-1]:i,reverse:d,rootPinned:v,sectionHeaders:t,sectionWidth:y,startWidth:u}),C&&E.length>0){const t=g.reduce((t,e)=>{const n=b.get(e.accessor)||0;return t+(("number"==typeof e.width?e.width:n)-n)},0),e=Math.max(0,R-t),n=Array.from(k.values()).reduce((t,e)=>t+e,0);if(e>0&&n>0){const t=e/n;let o=0;E.forEach((n,s)=>{const i=k.get(n.accessor)||100;s===E.length-1?n.width=e-o:(n.width=Math.round(i*t),o+=n.width)})}}}else{const t=(({header:t,headers:e,collapsedHeaders:n})=>{const o=document.querySelector(".st-body-container");if(!o||0===o.clientWidth)return 1e3;const i=o.clientWidth;if(!t.pinned)return 1/0;const r=e.some(t=>"left"===t.pinned&&!t.hide),l=e.some(t=>"right"===t.pinned&&!t.hide),a=i*s(i,r,l)-e.filter(e=>e.pinned===t.pinned&&e.accessor!==t.accessor).reduce((t,e)=>e.hide?t:t+x(e,n).reduce((t,e)=>t+S(e),0),0),d=H(t);return d>a?(console.warn(`Header ${t.accessor} exceeds pinned section width limit`),d):a})({header:i,headers:r,collapsedHeaders:e});g.length>1?(({delta:t,leafHeaders:e,minWidth:n,startWidth:o,maxWidth:s})=>{const i=e.reduce((t,e)=>Math.min(t,H(e)),40),r=e.reduce((t,e)=>t+("number"==typeof e.width?e.width:150),0),l=Math.max(Math.min(o+t,s),i)-r;e.forEach(t=>{const e="number"==typeof t.width?t.width:150;t.width=Math.max(e+l*(e/r),n)})})({delta:l,leafHeaders:g,minWidth:m,startWidth:u,maxWidth:t}):g[0].width=Math.max(Math.min(u+l,t),m),r.forEach(t=>{I(t)})}if(o){const t=[...r];c(t);const n=new Map;g.forEach(t=>{"number"==typeof t.width&&n.set(t.accessor,t.width)}),C&&E.forEach(t=>{"number"==typeof t.width&&n.set(t.accessor,t.width)}),xe(r,e,n)}else xe(r,e)};let T=null,A=null,W=p;const P=t=>{W=t,A=t,null===T&&(T=requestAnimationFrame(()=>{null!==A&&(O(A,!1),A=null),T=null}))};if(f){const t=t=>{P(t.touches[0].clientX)},e=()=>{document.removeEventListener("touchmove",t),document.removeEventListener("touchend",e),null!==T&&(cancelAnimationFrame(T),T=null),O(W,!0),h(!1),a&&a([...r])};document.addEventListener("touchmove",t),document.addEventListener("touchend",e)}else{const t=t=>{P(t.clientX)},e=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",e),null!==T&&(cancelAnimationFrame(T),T=null),O(W,!0),h(!1),a&&a([...r])};document.addEventListener("mousemove",t),document.addEventListener("mouseup",e)}},Se=t=>{var e,n;const o=null===(e=t.mainBodyRef)||void 0===e?void 0:e.current;return o?null!==(n=o.closest(".simple-table-root"))&&void 0!==n?n:o:null},Ie=(t,n,o)=>{const{columnResizing:s}=n;if(!s||t.isSelectionColumn&&n.enableRowSelection||o)return null;const i=document.createElement("div");i.className="st-header-resize-handle-container",i.setAttribute("role","separator"),i.setAttribute("aria-label",`Resize ${t.label} column`),i.setAttribute("aria-orientation","vertical");const r=document.createElement("div");r.className="st-header-resize-handle",i.appendChild(r);const l=t=>({rows:n.rows,header:t,maxWidth:500,sampleSize:50,styleRoot:Se(n)});let a=0;const d=()=>{const e=Date.now();120>e-a||(a=e,(()=>{const e=document.getElementById(c({accessor:t.accessor,rowId:"header"}));if(n.autoExpandColumns){(({header:t,headers:e,collapsedHeaders:n,containerWidth:o,mainBodyRef:s,reverse:i,headerCellElement:r,getTargetLeafWidth:l})=>{var a;if(!t||t.hide)return;const d=Re(o,s),c=ge(t,e);let h;if(t.children&&t.children.length>0){const e=x(t,n);h=e.length>0?e:[t]}else h=[t];const u=new Map;let p=0,f=0;const w=e.filter(t=>t.pinned===c);if(M(w,n).forEach(t=>{const e=S(t);u.set(t.accessor,e)}),d>0){const{leftWidth:t,rightWidth:o,mainWidth:s}=me({headers:e,containerWidth:d,collapsedHeaders:n});p="left"===c?t:"right"===c?o:s,f=d-t-o}let v=!1;const m=new Map;let g=[];if(c&&d>0){const o=M(e.filter(t=>t.pinned===c),n);if(o.length>0){let s=!1;if(h.length>1){const t=o.findIndex(t=>t.accessor===h[0].accessor),e=o.findIndex(t=>t.accessor===h[h.length-1].accessor);s="left"===c&&e===o.length-1||"right"===c&&0===t}else{const e=h[0]||t,n=o.findIndex(t=>t.accessor===e.accessor);s="left"===c&&n===o.length-1||"right"===c&&0===n}if(s){v=!0;const t=e.filter(t=>!t.pinned);g=M(t,n),g.forEach(t=>{m.set(t.accessor,S(t))})}}}const b=h.reduce((t,e)=>t+l(e),0),y=null!==(a=null==r?void 0:r.offsetWidth)&&void 0!==a?a:h.reduce((t,e)=>t+S(e),0);if(ye({childrenToResize:h,collapsedHeaders:n,containerWidth:d,delta:b-y,headers:e,initialWidthsMap:u,isParentResize:h.length>1,resizedHeader:h.length>0?h[h.length-1]:t,reverse:i,rootPinned:c,sectionHeaders:w,sectionWidth:p,startWidth:y}),v&&g.length>0){const t=h.reduce((t,e)=>{const n=u.get(e.accessor)||0;return t+(("number"==typeof e.width?e.width:n)-n)},0),e=Math.max(0,f-t),n=Array.from(m.values()).reduce((t,e)=>t+e,0);if(e>0&&n>0){const t=e/n;let o=0;g.forEach((n,s)=>{const i=m.get(n.accessor)||100;s===g.length-1?n.width=e-o:(n.width=Math.round(i*t),o+=n.width)})}}const R=new Map;h.forEach(t=>{"number"==typeof t.width&&R.set(t.accessor,t.width)}),v&&g.forEach(t=>{"number"==typeof t.width&&R.set(t.accessor,t.width)}),xe(e,n,R)})({header:t,headers:n.headers,collapsedHeaders:n.collapsedHeaders,containerWidth:n.containerWidth,mainBodyRef:n.mainBodyRef,reverse:n.reverse,headerCellElement:e,getTargetLeafWidth:t=>k(t.accessor,l(t))});const o=[...n.headers];return n.setHeaders(o),void(n.onColumnWidthChange&&n.onColumnWidthChange(o))}const o=k(t.accessor,l(t)),s=fe(n.headers,t.accessor);if(!s)return;const i=((t,e)=>{let n=t;for(let t=0;e.length-1>t;t++)n=n[e[t]].children;return n})(n.headers,s),r=s[s.length-1],a=i.map((t,e)=>e===r?Object.assign(Object.assign({},t),{width:o}):t),d=((t,e,n)=>{if(1===e.length)return n;let o=t;for(let t=0;e.length-2>t;t++)o=o[e[t]].children;return o[e[e.length-2]].children=n,t})(n.headers,s,a);d.forEach(t=>I(t));const h=a[r],u=new Map;h&&"number"==typeof h.width&&u.set(h.accessor+"",h.width),xe(d,n.collapsedHeaders,u),n.setHeaders(d),n.onColumnWidthChange&&n.onColumnWidthChange(d)})())};return Gt(i,"mousedown",o=>{var s;if(o.detail>=2)return o.preventDefault(),void d();const i=null===(s=document.getElementById(c({accessor:t.accessor,rowId:"header"})))||void 0===s?void 0:s.offsetWidth;qt(()=>{Ce({autoExpandColumns:n.autoExpandColumns,collapsedHeaders:n.collapsedHeaders,containerWidth:n.containerWidth,event:o,forceUpdate:n.forceUpdate,header:t,headers:n.headers,mainBodyRef:n.mainBodyRef,onColumnWidthChange:n.onColumnWidthChange,pinnedLeftRef:n.pinnedLeftRef,pinnedRightRef:n.pinnedRightRef,reverse:n.reverse,setHeaders:n.setHeaders,setIsResizing:n.setIsResizing,startWidth:null!=i?i:e})},10)}),Gt(i,"touchstart",o=>{var s;const i=o,r=null===(s=document.getElementById(c({accessor:t.accessor,rowId:"header"})))||void 0===s?void 0:s.offsetWidth;qt(()=>{Ce({autoExpandColumns:n.autoExpandColumns,collapsedHeaders:n.collapsedHeaders,containerWidth:n.containerWidth,event:i,forceUpdate:n.forceUpdate,header:t,headers:n.headers,mainBodyRef:n.mainBodyRef,onColumnWidthChange:n.onColumnWidthChange,pinnedLeftRef:n.pinnedLeftRef,pinnedRightRef:n.pinnedRightRef,reverse:n.reverse,setHeaders:n.setHeaders,setIsResizing:n.setIsResizing,startWidth:null!=r?r:e})},10)}),Gt(i,"dblclick",d),i},He=(t,e,n)=>{const o=document.createElement("input");return o.type="text",o.className="st-header-edit-input",o.value=t.label||"",Gt(o,"blur",()=>{const s=o.value;s!==t.label&&(n=>{const o=e.headers.map(e=>e.accessor===t.accessor?Object.assign(Object.assign({},e),{label:n}):e);e.setHeaders(o),e.onHeaderEdit&&e.onHeaderEdit(t,n)})(s);const i=n.parentElement;if(i){const o=Me(t,e,s);i.replaceChild(o,n)}if(e.headerRegistry&&!t.isSelectionColumn){const n=e.headerRegistry.get(t.accessor+"");n&&n.setEditing(!1)}}),Gt(o,"keydown",e=>{"Enter"===e.key?(e.preventDefault(),o.blur()):"Escape"===e.key&&(e.preventDefault(),o.value=t.label||"",o.blur())}),setTimeout(()=>o.focus(),0),o},Me=(t,e,n)=>{const o=t.isSelectionColumn&&e.enableRowSelection,s=void 0!==n?n:t.label||"",i=document.createElement("span");if(i.className="st-header-label-text "+("right"===t.align?"right-aligned":"center"===t.align?"center-aligned":"left-aligned"),o){const t=(t=>{const e=!!t.areAllRowsSelected&&t.areAllRowsSelected();return le({checked:e,onChange:e=>{var n;null===(n=t.handleSelectAll)||void 0===n||n.call(t,e)},ariaLabel:"Select all rows"}).element})(e);i.appendChild(t)}else i.textContent=s;if(t.tooltip&&!o){let e=null,n=null;const o=()=>{n=setTimeout(()=>{if(!i.isConnected)return;const n=i.getBoundingClientRect();if(n.width>0&&n.height>0){e=document.createElement("div"),e.className="st-tooltip",e.textContent=t.tooltip||"",e.style.position="fixed",e.style.zIndex="10000";const o=200,s=40;let r=n.left+n.width/2-o/2,l=n.bottom+8;8>r?r=8:r+o>window.innerWidth-8&&(r=window.innerWidth-o-8),l+s>window.innerHeight-8&&(l=n.top-s-8),e.style.top=l+"px",e.style.left=r+"px",(i.closest(".simple-table-root")||document.body).appendChild(e)}},500)},s=()=>{var t;n&&(clearTimeout(n),n=null),e&&(null===(t=e.parentElement)||void 0===t||t.removeChild(e),e=null)};Gt(i,"mouseenter",o),Gt(i,"mouseleave",s)}return i},ke=(t,e,n,o)=>{const{columnReordering:s,draggedHeaderRef:i,hoveredHeaderRef:r,headers:l}=o;!s||n.disableReorder||n.isSelectionColumn&&o.enableRowSelection||(t.setAttribute("draggable","true"),Gt(t,"dragstart",t=>{i.current=n,jt(Date.now()),e.classList.add("st-dragging")}),Gt(t,"dragend",t=>{t.preventDefault(),i.current=null,r.current=null,e.classList.remove("st-dragging"),setTimeout(()=>{o.setHeaders(t=>[...t]),o.onColumnOrderChange&&o.onColumnOrderChange(wt(o.getHeaders()))},10)}),Gt(e,"dragover",t=>{const e=t;e.preventDefault(),l&&i.current&&qt(()=>{const{screenX:t,screenY:s}=e,a=Math.sqrt(Math.pow(t-Ft.screenX,2)+Math.pow(s-Ft.screenY,2));r.current=n;const d=i.current;if(!d)return;let c,h=!1;if(we(d)!==we(n)){const t=function({headers:t,draggedHeader:e,hoveredHeader:n}){const o=wt(t);let s=!1;try{const t=we(n),i=o.findIndex(t=>t.accessor===e.accessor),r=o.findIndex(t=>t.accessor===n.accessor);if(-1===i||-1===r)return s=!0,{newHeaders:o,emergencyBreak:s};const[l]=o.splice(i,1),a=((t,e)=>{const n=Object.assign({},t);return"left"===e?n.pinned="left":"right"===e?n.pinned="right":delete n.pinned,n})(l,t);o.splice(r,0,a)}catch(t){console.error("Error in insertHeaderAcrossSections:",t),s=!0}return{newHeaders:o,emergencyBreak:s}}({headers:l,draggedHeader:d,hoveredHeader:n});c=t.newHeaders,h=t.emergencyBreak}else{const t=fe(l,d.accessor),e=fe(l,n.accessor);if(!t||!e)return;const o=t.length,s=e.length;let i=e;if(o!==s){const t=s-o;t>0&&(i=e.slice(0,-t))}if((u=t).length!==(p=i).length||1!==u.length&&!u.slice(0,-1).every((t,e)=>t===p[e]))return;const r=ve(l,t,i);c=r.newHeaders,h=r.emergencyBreak}var u,p;if(n.accessor===d.accessor||10>a||JSON.stringify(c)===JSON.stringify(l)||h)return;const f=o.essentialAccessors;if(f&&f.size>0&&!Ht(c,f))return;const w=Date.now();JSON.stringify(c)===JSON.stringify(Lt)&&(1500>w-Dt||40>a)||(jt(w),Ft={screenX:t,screenY:s},(t=>{Lt=t})(l),o.onTableHeaderDragEnd(c))},50)}),Gt(document.documentElement,"dragover",t=>{t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="move")}))},Ee=(t,e,n)=>{var o,s;const{header:l,colIndex:a,parentHeader:d}=t,{collapsedHeaders:c,columnBorders:h,columnReordering:u,enableHeaderEditing:p,selectedColumns:f,columnsWithSelectedCells:w,draggedHeaderRef:v,hoveredHeaderRef:m}=e,g=l.isSelectionColumn&&e.enableRowSelection,x=!!(null==l?void 0:l.isSortable),b=c.has(l.accessor),y=!(!l.children||0===l.children.length)&&(!b||l.children.some(t=>{const e=t.showWhen||i;return"parentCollapsed"===e||"always"===e})),R=null==d?void 0:d.singleRowChildren,C=y&&!l.singleRowChildren,S=!!h&&(l.children&&0!==l.children.length?r(l,a).includes(e.lastHeaderIndex):a===e.lastHeaderIndex),I=!(!e.selectableColumns||g)&&r(l,a).some(t=>f.has(t)),H=!g&&r(l,a).some(t=>w.has(t));return["st-header-cell",l.accessor===(null===(o=m.current)||void 0===o?void 0:o.accessor)?"st-hovered":"",(null===(s=v.current)||void 0===s?void 0:s.accessor)===l.accessor?"st-dragging":"",x?"clickable":"",u&&!x?"columnReordering":"",C?"parent":"",R?"st-sub-header":"",S?"st-last-column":"",p&&!g?"st-header-editable":"",I?"st-header-selected":"",H&&!I?"st-header-has-highlighted-cell":"",n?"st-no-resize":""].filter(Boolean).join(" ")},Oe=(t,e,n)=>{var o;const{header:s,colIndex:i}=t,{reverse:l}=e,a=s.isSelectionColumn&&e.enableRowSelection,h=Ee(t,e,n),u=document.createElement("div");u.className=h,u.id=c({accessor:s.accessor,rowId:"header"}),u.setAttribute("data-accessor",s.accessor+""),u.setAttribute("role","columnheader"),u.setAttribute("aria-colindex",i+1+""),s.isSortable&&((null===(o=e.sort)||void 0===o?void 0:o.key.accessor)===s.accessor?u.setAttribute("aria-sort","asc"===e.sort.direction?"ascending":"descending"):u.setAttribute("aria-sort","none"));const p=((t,e)=>{const n=[];return t.type&&"other"!==t.type&&n.push(t.type+" column"),t.isSortable&&n.push("sortable"),e&&n.push("filterable"),t.tooltip&&n.push(t.tooltip),n.join(", ")})(s,!!s.filterable);if(p){const t="header-desc-"+s.accessor;u.setAttribute("aria-describedby",t);const e=document.createElement("span");e.id=t,e.className="st-sr-only",e.textContent=p,u.appendChild(e)}u.style.position="absolute",u.style.left=t.left+"px",u.style.top=t.top+"px",u.style.width=t.width+"px",u.style.height=t.height+"px";const f=((t,e)=>{const{sort:n,icons:o}=e;if(!n||n.key.accessor!==t.accessor)return null;const s=document.createElement("div");s.className="st-icon-container",s.setAttribute("role","button"),s.setAttribute("tabindex","0"),s.setAttribute("aria-label",`Sort ${t.label} ${"asc"===n.direction?"descending":"ascending"}`);const i="asc"===n.direction?o.sortUp:o.sortDown;return i&&("string"==typeof i?s.innerHTML=i:(i instanceof HTMLElement||i instanceof SVGSVGElement)&&s.appendChild(i.cloneNode(!0))),Gt(s,"click",n=>{n.stopPropagation(),e.onSort(t.accessor)}),Gt(s,"keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),e.onSort(t.accessor))}),s})(s,e),w=((t,e)=>{const{filters:n,handleApplyFilter:o,handleClearFilter:s,icons:i}=e;if(!t.filterable)return null;const r=n[t.accessor],l=document.createElement("div");l.className="st-icon-container",l.setAttribute("role","button"),l.setAttribute("tabindex","0"),l.setAttribute("aria-label","Filter "+t.label),l.setAttribute("aria-expanded","false"),l.setAttribute("aria-haspopup","dialog");const a=i.filter;let d=null;if(a)if("string"==typeof a)l.innerHTML=a,d=l.querySelector("svg");else if(a instanceof HTMLElement||a instanceof SVGSVGElement){const t=a.cloneNode(!0);l.appendChild(t),d=t}d&&(d.style.fill=r?"var(--st-button-active-background-color)":"var(--st-header-icon-color)");let c=!1,h=null,u=null;const p=n=>{if(n.stopPropagation(),c=!c,l.setAttribute("aria-expanded",c+""),c){const n=t=>{o(t),c=!1,l.setAttribute("aria-expanded","false"),u&&(u.destroy(),u=null),h&&(h.destroy(),h=null),d&&(d.style.fill="var(--st-button-active-background-color)")},i=()=>{s(t.accessor),c=!1,l.setAttribute("aria-expanded","false"),u&&(u.destroy(),u=null),h&&(h.destroy(),h=null),d&&(d.style.fill="var(--st-header-icon-color)")},a=e.mainBodyRef.current||void 0;h=ae({header:t,currentFilter:r,onApplyFilter:n,onClearFilter:i,containerRef:a,mainBodyRef:a}),u=te({children:h.element,containerRef:a,mainBodyRef:a,anchorElement:l,onClose:()=>{c=!1,l.setAttribute("aria-expanded","false"),h&&(h.destroy(),h=null)},open:!0,positioning:"fixed",maxWidth:280,allowDescendantOverflow:!0})}else u&&(u.destroy(),u=null),h&&(h.destroy(),h=null)};return Gt(l,"click",p),Gt(l,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),p(t))}),l})(s,e),v=((t,e)=>{var n,o;const{icons:s}=e;if(!d(t)||t.isSelectionColumn&&e.enableRowSelection)return null;const i=(null!==(o=null===(n=e.getCollapsedHeaders)||void 0===n?void 0:n.call(e))&&void 0!==o?o:e.collapsedHeaders).has(t.accessor),r=document.createElement("div");r.className="st-icon-container st-collapsible-header-icon st-expand-icon-container "+(i?"collapsed":"expanded"),r.setAttribute("role","button"),r.setAttribute("tabindex","0"),r.setAttribute("aria-label",`${i?"Expand":"Collapse"} ${t.label} column`),r.setAttribute("aria-expanded",!i+"");const l=s.expand;l&&("string"==typeof l?r.innerHTML=l:(l instanceof HTMLElement||l instanceof SVGSVGElement)&&r.appendChild(l.cloneNode(!0)));const a=n=>{var o,s;n.stopPropagation();const i=(null!==(s=null===(o=e.getCollapsedHeaders)||void 0===o?void 0:o.call(e))&&void 0!==s?s:e.collapsedHeaders).has(t.accessor);e.setCollapsedHeaders(e=>{const n=new Set(e);return i?n.delete(t.accessor):n.add(t.accessor),n})};return Gt(r,"click",a),Gt(r,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),a(t))}),r})(s,e);if(l){const t=Ie(s,e,n);t&&u.appendChild(t)}s.headerRenderer||"right"!==s.align||(v&&u.appendChild(v),w&&u.appendChild(w),f&&u.appendChild(f));const m=document.createElement("div");if(m.className="st-header-label",s.headerRenderer){const t=Me(s,e),n=s.headerRenderer({accessor:s.accessor,colIndex:i,header:s,components:{sortIcon:f||void 0,filterIcon:w||void 0,collapseIcon:v||void 0,labelContent:t}});n instanceof HTMLElement?m.appendChild(n):m.appendChild(t)}else{const t=Me(s,e);m.appendChild(t)}if(Gt(m,"click",t=>{a||((t,e,n,o)=>{if(!e.isSelectionColumn){if(o.selectableColumns){const s=r(e,n),i=s.some(t=>o.selectedColumns.has(t));if(o.enableHeaderEditing&&i&&!t.shiftKey){const t=document.getElementById(c({accessor:e.accessor,rowId:"header"}));if(t){const n=t.querySelector(".st-header-label");if(n){const t=n.querySelector(".st-header-label-text");if(t){t.innerHTML="";const n=He(e,o,t);if(t.appendChild(n),o.headerRegistry&&!e.isSelectionColumn){const t=o.headerRegistry.get(e.accessor+"");t&&t.setEditing(!0)}}}}return}t.shiftKey&&o.selectColumns?o.setSelectedColumns(t=>{if(0===t.size)return new Set(s);const e=s[0],n=Array.from(t).sort((t,e)=>t-e);let o=n[0],i=Math.abs(e-o);n.forEach(t=>{const n=Math.abs(e-t);i>n&&(i=n,o=t)});const r=[...((t,e)=>{const n=Math.min(t,e);return Array.from({length:Math.max(t,e)-n+1},(t,e)=>n+e)})(o,e),...s];return new Set([...Array.from(t),...r])}):o.selectColumns&&o.selectColumns(s),o.setSelectedCells(new Set),o.setInitialFocusedCell(null)}o.onColumnSelect&&o.onColumnSelect(e),!o.selectableColumns&&e.isSortable&&o.onSort(e.accessor)}})(t,s,i,e)}),Gt(m,"dblclick",t=>{a||((t,e,n)=>{e.isSelectionColumn||n.selectableColumns&&e.isSortable&&n.onSort(e.accessor)})(0,s,e)}),ke(m,u,s,e),u.appendChild(m),s.headerRenderer||"right"===s.align||(v&&u.appendChild(v),w&&u.appendChild(w),f&&u.appendChild(f)),!l){const t=Ie(s,e,n);t&&u.appendChild(t)}return e.headerRegistry&&!s.isSelectionColumn&&e.headerRegistry.set(s.accessor+"",{setEditing:t=>{if(t){const t=m.querySelector(".st-header-label-text");if(t){t.innerHTML="";const n=He(s,e,t);t.appendChild(n)}}}}),u},Te=(t,e,n,o=0)=>{var s,i;const r=n.pinned?n.containerWidth:null!==(s=n.mainSectionContainerWidth)&&void 0!==s?s:n.containerWidth||(null===(i=t.parentElement)||void 0===i?void 0:i.clientWidth)||t.clientWidth||0,l=n.pinned?e:((t,e,n,o=100)=>{if(0===t.length)return[];const s=e-o,i=e+n+o;return t.filter(t=>t.left+t.width>=s&&i>=t.left)})(e,o,r),a=(t=>0===t.length?-1:Math.max(...t.map(t=>t.colIndex)))(e),h=Nt(t),u=new Set(l.map(t=>c({accessor:t.header.accessor,rowId:"header"}))),p=Vt(t);let f=!1;h.forEach((t,e)=>{u.has(e)||(p.delete(e),t.remove(),h.delete(e),f=!0)}),f&&Ut(t);const w=document.createDocumentFragment(),v=[];l.forEach(t=>{const e=c({accessor:t.header.accessor,rowId:"header"}),o=!(!n.autoExpandColumns||n.pinned||t.colIndex!==a);if(h.has(e)){const s=h.get(e),i=p.get(e);(!i||i.left!==t.left||i.top!==t.top||i.width!==t.width||i.height!==t.height)&&(s.style.left=t.left+"px",s.style.top=t.top+"px",s.style.width=t.width+"px",s.style.height=t.height+"px",p.set(e,{left:t.left,top:t.top,width:t.width,height:t.height})),t.header.isSelectionColumn&&n.enableRowSelection&&"function"==typeof n.areAllRowsSelected&&((t,e)=>{re(t,e)})(s,n.areAllRowsSelected());const r=Ee(t,n,o);s.className!==r&&(s.className=r),d(t.header)&&((t,e,n)=>{pe(t,!e,{ariaLabelWhenExpanded:n?`Collapse ${n} column`:"Collapse column",ariaLabelWhenCollapsed:n?`Expand ${n} column`:"Expand column",syncAriaExpanded:!0})})(s,n.collapsedHeaders.has(t.header.accessor),t.header.label)}else v.push({cell:t,cellId:e,isLastMainAutoExpandColumn:o})}),v.forEach(({cell:t,cellId:e,isLastMainAutoExpandColumn:o})=>{const s=Oe(t,n,o);w.appendChild(s),h.set(e,s),p.set(e,{left:t.left,top:t.top,width:t.width,height:t.height})}),w.childNodes.length>0&&t.appendChild(w),n.pinned||(t.dataset.lastScrollLeft=o+"")},Ae=(t,e,n)=>{var o;const s=document.createElement("div");s.className="st-dropdown-content",s.style.position=n.positioning||"fixed",s.style.zIndex="1000",s.style.visibility="hidden",s.style.overflow=null!==(o=n.overflow)&&void 0!==o?o:"auto",n.width&&(s.style.width=n.width+"px"),n.maxHeight&&(s.style.maxHeight=n.maxHeight+"px"),s.appendChild(e);const i=t.closest(".simple-table-root")||document.querySelector(".simple-table-root");"fixed"===n.positioning?i?i.appendChild(s):document.body.appendChild(s):t.appendChild(s),requestAnimationFrame(()=>{const{position:e,placement:o}=((t,e,n)=>{const o=t.getBoundingClientRect(),s=window.innerHeight,i=window.innerWidth,r=s-o.bottom,l=i-o.left;let a="bottom";e.offsetHeight>r&&o.top>r&&(a="top");let d="left";(n.width||e.offsetWidth)>l&&o.right>l&&(d="right");const c={};return"fixed"===n.positioning?("bottom"===a?c.top=o.bottom+4:c.bottom=s-o.top+4,"left"===d?c.left=o.left:c.right=i-o.right):("bottom"===a?c.top=o.height+4:c.bottom=o.height+4,"left"===d?c.left=0:c.right=0),{position:c,placement:`${a}-${d}`}})(t,s,n);s.className="st-dropdown-content st-dropdown-"+o,Object.entries(e).forEach(([t,e])=>{void 0!==e&&(s.style[t]=e+"px")}),s.style.visibility="visible"});const r=e=>{const n=e.target;s.contains(n)||t.contains(n)||d()},l=t=>{"Escape"===t.key&&(t.preventDefault(),d())},a=t=>{s.contains(t.target)||d()},d=()=>{s.remove(),document.removeEventListener("mousedown",r,!0),document.removeEventListener("keydown",l,!0),window.removeEventListener("scroll",a,!0),n.onClose()};return setTimeout(()=>{document.addEventListener("mousedown",r,!0),document.addEventListener("keydown",l,!0),window.addEventListener("scroll",a,!0)},0),ce(s,"mousedown",t=>{t.stopPropagation()}),s},We=(t,e)=>new Date(t,e+1,0).getDate(),Pe=["January","February","March","April","May","June","July","August","September","October","November","December"],$e=["Su","Mo","Tu","We","Th","Fr","Sa"],De=(t,e,n)=>{const{header:o,row:s}=t,i=p(s,o.accessor);return"boolean"===o.type?((t,e,n,o)=>{const{header:s,row:i,rowIndex:r}=t;let l;const a=document.createElement("div");a.className="st-dropdown-item "+(!0===n?"selected":""),a.textContent="True",a.setAttribute("role","option"),a.setAttribute("aria-selected",(!0===n)+""),a.setAttribute("aria-disabled","false");const d=document.createElement("div");d.className="st-dropdown-item "+(!1===n?"selected":""),d.textContent="False",d.setAttribute("role","option"),d.setAttribute("aria-selected",(!1===n)+""),d.setAttribute("aria-disabled","false");const h=t=>{f(i,s.accessor,t),e.onCellEdit&&e.onCellEdit({accessor:s.accessor,newValue:t,row:i,rowIndex:r}),l.remove(),o()};ce(a,"click",()=>h(!0)),ce(d,"click",()=>h(!1));const u=t=>{const e=t;"ArrowDown"===e.key||"ArrowUp"===e.key?(e.preventDefault(),document.activeElement===a?d.focus():a.focus()):"Enter"===e.key&&(e.preventDefault(),document.activeElement===a?h(!0):document.activeElement===d&&h(!1))};a.setAttribute("tabindex","0"),d.setAttribute("tabindex","0"),ce(a,"keydown",u),ce(d,"keydown",u);const p=document.createDocumentFragment();p.appendChild(a),p.appendChild(d);const w=c({accessor:s.accessor,rowId:t.rowId}),v=document.getElementById(w);return l=Ae(v||document.body,p,{width:120,positioning:"fixed",onClose:o}),l})(t,e,!!i,n):"enum"===o.type?((t,e,n,o)=>{const{header:s,row:i,rowIndex:r}=t,l=s.enumOptions||[];let a;const d=t=>{f(i,s.accessor,t),e.onCellEdit&&e.onCellEdit({accessor:s.accessor,newValue:t,row:i,rowIndex:r}),a.remove(),o()},h=[];l.forEach((t,e)=>{const o=document.createElement("div");o.className="st-dropdown-item "+(n===t.value?"selected":""),o.textContent=t.label,o.setAttribute("role","option"),o.setAttribute("aria-selected",(n===t.value)+""),o.setAttribute("aria-disabled","false"),o.setAttribute("tabindex","0"),o.dataset.value=t.value,ce(o,"click",()=>d(t.value)),h.push(o)});const u=t=>{const e=t,n=h.findIndex(t=>t===document.activeElement);if("ArrowDown"===e.key)e.preventDefault(),h[(n+1)%h.length].focus();else if("ArrowUp"===e.key)e.preventDefault(),h[(n-1+h.length)%h.length].focus();else if("Enter"===e.key){e.preventDefault();const t=document.activeElement.dataset.value;t&&d(t)}};h.forEach(t=>{ce(t,"keydown",u)});const p=document.createElement("div");p.className="st-enum-dropdown-content",h.forEach(t=>p.appendChild(t));const w=c({accessor:s.accessor,rowId:t.rowId}),v=document.getElementById(w);return a=Ae(v||document.body,p,{width:150,maxHeight:300,positioning:"fixed",onClose:o}),setTimeout(()=>{const t=l.findIndex(t=>t.value===n);t>=0&&h[t]?(h[t].focus(),h[t].scrollIntoView({block:"nearest"})):h.length>0&&h[0].focus()},0),a})(t,e,(i||"")+"",n):"date"===o.type?((t,e,n,o)=>{var s,i;const{header:r,row:l,rowIndex:a}=t;let d,h;try{h=n?z(n+""):new Date}catch(t){h=new Date}let u=h.getFullYear(),p=h.getMonth();const w=document.createElement("div");w.className="st-datepicker";const v=document.createElement("div");v.className="st-datepicker-header";const m=document.createElement("button");m.className="st-datepicker-nav-btn",m.setAttribute("aria-label","Previous month");const g=null!==(s=e.icons.prev)&&void 0!==s?s:mt("st-next-prev-icon");"string"==typeof g?m.innerHTML=g:m.appendChild(g.cloneNode(!0));const x=document.createElement("div");x.className="st-datepicker-header-label",x.setAttribute("aria-hidden","true");const b=document.createElement("button");b.className="st-datepicker-nav-btn",b.setAttribute("aria-label","Next month");const y=null!==(i=e.icons.next)&&void 0!==i?i:gt("st-next-prev-icon");"string"==typeof y?b.innerHTML=y:b.appendChild(y.cloneNode(!0)),v.appendChild(m),v.appendChild(x),v.appendChild(b);const R=document.createElement("div");R.className="st-datepicker-grid st-datepicker-days-grid",$e.forEach(t=>{const e=document.createElement("div");e.className="st-datepicker-weekday",e.textContent=t,R.appendChild(e)});const C=document.createElement("div");C.className="st-datepicker-footer";const S=document.createElement("button");S.className="st-datepicker-today-btn",S.textContent="Today",ce(S,"click",()=>{const t=new Date,e=new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0);I(e)}),C.appendChild(S),w.appendChild(v),w.appendChild(R),w.appendChild(C);const I=t=>{const n=t.toISOString().split("T")[0];f(l,r.accessor,n),e.onCellEdit&&e.onCellEdit({accessor:r.accessor,newValue:n,row:l,rowIndex:a}),d.remove(),o()},H=()=>{var t,e,n;for(x.textContent=`${Pe[p]} ${u}`;R.children.length>7;)null===(t=R.lastElementChild)||void 0===t||t.remove();const o=We(u,p),s=new Date(u,p,1).getDay(),i=We(u,p-1),r=new Date;for(let t=0;s>t;t++){const n=i-s+t+1,o=new Date(u,p-1,n),r=document.createElement("div");r.className="st-datepicker-day other-month",r.textContent=n+"",r.setAttribute("tabindex","0"),r.setAttribute("role","button"),r.setAttribute("aria-label",`${null!==(e=Pe[p-1])&&void 0!==e?e:Pe[11]} ${n}, ${o.getFullYear()}`),ce(r,"click",()=>I(o)),ce(r,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),I(o))}),R.appendChild(r)}const l=h.getFullYear()===u&&h.getMonth()===p;for(let t=1;o>=t;t++){const e=document.createElement("div");e.className="st-datepicker-day",e.textContent=t+"",e.setAttribute("tabindex","0"),e.setAttribute("role","button"),e.setAttribute("aria-label",`${Pe[p]} ${t}, ${u}`),r.getFullYear()===u&&r.getMonth()===p&&r.getDate()===t&&e.classList.add("today"),l&&h.getDate()===t&&e.classList.add("selected");const n=new Date(u,p,t);ce(e,"click",()=>I(n)),ce(e,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),I(n))}),R.appendChild(e)}const a=s+o,d=Math.max(35,7*Math.ceil(a/7))-a;for(let t=1;d>=t;t++){const e=new Date(u,p+1,t),o=document.createElement("div");o.className="st-datepicker-day other-month",o.textContent=t+"",o.setAttribute("tabindex","0"),o.setAttribute("role","button"),o.setAttribute("aria-label",`${null!==(n=Pe[p+1])&&void 0!==n?n:Pe[0]} ${t}, ${e.getFullYear()}`),ce(o,"click",()=>I(e)),ce(o,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),I(e))}),R.appendChild(o)}};ce(m,"click",()=>{p--,0>p&&(p=11,u--),H()}),ce(b,"click",()=>{p++,p>11&&(p=0,u++),H()}),H();const M=c({accessor:r.accessor,rowId:t.rowId}),k=document.getElementById(M);return d=Ae(k||document.body,w,{width:240,overflow:"hidden",positioning:"fixed",onClose:o}),d})(t,e,i,n):((t,e,n,o)=>{const{header:s,row:i,rowIndex:r}=t,l=document.createElement("input");l.className="editable-cell-input","number"===s.type?(l.type="text",l.inputMode="decimal"):l.type="text",l.value=null!=n?n+"":"",l.setAttribute("autofocus","true"),setTimeout(()=>{l.focus(),l.select()},0);let a=!0;if("number"===s.type){const t=()=>{const t=l.value;/^-?\d*\.?\d*$/.test(t)||(l.value=t.slice(0,-1))};ce(l,"input",t)}return ce(l,"blur",t=>{if(!a)return void o();let n=l.value;if("number"===s.type){const t=parseFloat(l.value);n=isNaN(t)?0:t}f(i,s.accessor,n),e.onCellEdit&&e.onCellEdit({accessor:s.accessor,newValue:n,row:i,rowIndex:r}),o()}),ce(l,"keydown",t=>{const e=t;e.stopPropagation(),"Enter"===e.key?(a=!0,l.blur()):"Escape"===e.key&&(a=!1,l.blur())}),ce(l,"mousedown",t=>{t.stopPropagation()}),l})(t,e,i,n)},Fe=(t,e,n,o,s)=>{if(e.valueFormatter){const i=e.valueFormatter({accessor:e.accessor,colIndex:n,row:o,rowIndex:s,value:t});return"object"==typeof i&&null!==i?t+"":i+""}return"boolean"==typeof t?t?"True":"False":Array.isArray(t)?0===t.length?"[]":t.map(t=>"object"==typeof t&&null!==t?JSON.stringify(t):t+"").join(", "):"date"===e.type&&null!=t&&("string"==typeof t||"number"==typeof t||"object"==typeof t&&t instanceof Date)?q(t).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):null==t?"":t+""},Le=(t,e,n)=>{var o;const{header:s,row:i,rowIndex:r,colIndex:l,depth:a,rowId:d}=t,c=p(i,s.accessor),h=s.isSelectionColumn&&e.enableRowSelection;if(e.isLoading||t.tableRow.isLoadingSkeleton){const t=document.createElement("div");return t.className="st-loading-skeleton",void n.appendChild(t)}if(h){const o=document.createElement("div");o.className="st-selection-cell-content";const s=document.createElement("div");s.className="st-selection-control";const i=!!e.isRowSelected&&e.isRowSelected(d+""),r=((t,e,n)=>le({checked:n,onChange:n=>{var o;null===(o=e.handleRowSelect)||void 0===o||o.call(e,t.rowId+"",n)},ariaLabel:"Select row "+(t.displayRowNumber+1)}).element)(t,e,i);s.appendChild(r),o.appendChild(s);const l=((t,e)=>{if(!e.rowButtons||0===e.rowButtons.length)return null;const n=document.createElement("div");n.className="st-row-buttons",n.setAttribute("role","group"),n.setAttribute("aria-label","Actions for row "+(t.displayRowNumber+1));const o={row:t.row,rowIndex:t.displayRowNumber};return e.rowButtons.forEach((t,e)=>{try{const e=t(o);if(!e)return;const s=document.createElement("span");s.className="st-row-button",s.appendChild(e),n.appendChild(s)}catch(t){console.error("Error rendering row button:",t)}}),n})(t,e);return l&&o.appendChild(l),void n.appendChild(o)}const u=e.rowGrouping&&e.rowGrouping[a],f=!!u&&((t,e)=>!!e&&w(t[e]))(i,u),v=e.rowGrouping&&e.rowGrouping.length>a,m=!e.canExpandRowGroup||e.canExpandRowGroup(i);if(s.expandable&&(f&&v&&m||s.nestedTable||e.onRowGroupExpand&&v&&m)){const o=new Set(e.expandedDepths),s=((t,e,n)=>{const o=document.createElement("div");o.className="st-icon-container st-expand-icon-container "+(n?"expanded":"collapsed"),o.setAttribute("role","button"),o.setAttribute("aria-label",n?"Collapse row":"Expand row"),o.setAttribute("tabindex","0");const s=e.icons.expand;s&&("string"==typeof s?o.innerHTML=s:(s instanceof HTMLElement||s instanceof SVGSVGElement)&&o.appendChild(s.cloneNode(!0)));const i=n=>{n.stopPropagation();const{rowId:o,depth:s}=t,i=new Set(e.expandedDepths),r=e.getExpandedRows?e.getExpandedRows():e.expandedRows,l=e.getCollapsedRows?e.getCollapsedRows():e.collapsedRows,a=g(o,s,i,r,l),d=!a;if(a?(e.setCollapsedRows(t=>{const e=new Map(t);return e.set(o,s),e}),e.setExpandedRows(t=>{const e=new Map(t);return e.delete(o),e}),e.setRowStateMap(t=>{const e=new Map(t);return e.delete(o),e})):(e.setExpandedRows(t=>{const e=new Map(t);return e.set(o,s),e}),e.setCollapsedRows(t=>{const e=new Map(t);return e.delete(o),e})),e.onRowGroupExpand&&t.tableRow.rowIndexPath&&e.rowGrouping){const n=t.header.pinned,i=t=>{setTimeout(()=>{e.setRowStateMap(e=>{const s=new Map(e),i=s.get(o)||{};return s.set(o,Object.assign(Object.assign({},i),{loading:t,triggerSection:n})),s})},0)},r=t=>{e.setRowStateMap(e=>{const s=new Map(e),i=s.get(o)||{};return s.set(o,Object.assign(Object.assign({},i),{error:t,loading:!1,triggerSection:n})),s})},l=(t,s)=>{e.setRowStateMap(e=>{const s=new Map(e),i=s.get(o)||{};return s.set(o,Object.assign(Object.assign({},i),{isEmpty:t,loading:!1,triggerSection:n})),s})};e.onRowGroupExpand({row:t.row,depth:s,event:{stopPropagation:()=>{},preventDefault:()=>{}},groupingKey:e.rowGrouping[s],isExpanded:d,rowIndexPath:t.tableRow.rowIndexPath,rowIdPath:t.tableRow.rowPath,groupingKeys:e.rowGrouping,setLoading:i,setError:r,setEmpty:l})}};return ce(o,"click",i),ce(o,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),i(t))}),o})(t,e,g(d,a,o,e.expandedRows,e.collapsedRows));n.appendChild(s)}if("lineAreaChart"===s.type&&Array.isArray(c)){const t=c.filter(t=>"number"==typeof t);if(t.length>0){const e=(t=>{let{data:e,width:n="100%",height:o=30,color:s,fillColor:i,fillOpacity:r=.25,strokeWidth:l=1.5,className:a="",min:d,max:c}=t;if(!e||0===e.length)return null;const h=void 0!==d?d:Math.min(...e),u=(void 0!==c?c:Math.max(...e))-h||1,p=o,f=document.createElementNS("http://www.w3.org/2000/svg","svg");f.setAttribute("width",n+""),f.setAttribute("height",o+""),f.setAttribute("viewBox","0 0 100 "+p),f.setAttribute("preserveAspectRatio","none"),f.setAttribute("class",("st-line-area-chart "+a).trim()),f.setAttribute("shape-rendering","geometricPrecision"),f.style.display="block";const w=()=>{f.innerHTML="";const t=e.map((t,n)=>({x:n/(e.length-1)*100,y:p-(t-h)/u*p})).map((t,e)=>`${0===e?"M":"L"} ${t.x},${t.y}`).join(" "),n=`\n ${t}\n L 100,${p}\n L 0,${p}\n Z\n `,o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",n),o.setAttribute("fill",i||"var(--st-chart-fill-color)"),o.setAttribute("fill-opacity",r+""),o.setAttribute("stroke","none");const a=document.createElementNS("http://www.w3.org/2000/svg","path");a.setAttribute("d",t),a.setAttribute("fill","none"),a.setAttribute("stroke",s||"var(--st-chart-color)"),a.setAttribute("stroke-width",l+""),a.setAttribute("stroke-linecap","round"),a.setAttribute("stroke-linejoin","round"),f.appendChild(o),f.appendChild(a)};return w(),{element:f,update:t=>{void 0===t.data||(e=t.data,e&&0!==e.length)?(void 0!==t.width&&(n=t.width,f.setAttribute("width",n+"")),void 0!==t.height&&(o=t.height,f.setAttribute("height",o+"")),void 0!==t.color&&(s=t.color),void 0!==t.fillColor&&(i=t.fillColor),void 0!==t.fillOpacity&&(r=t.fillOpacity),void 0!==t.strokeWidth&&(l=t.strokeWidth),void 0!==t.className&&(a=t.className,f.setAttribute("class",("st-line-area-chart "+a).trim())),void 0!==t.min&&(d=t.min),void 0!==t.max&&(c=t.max),w()):f.innerHTML=""},destroy:()=>{f.remove()}}})(Object.assign({data:t,width:"100%",height:30},s.chartOptions));return void((null==e?void 0:e.element)&&n.appendChild(e.element))}}else if("barChart"===s.type&&Array.isArray(c)){const t=c.filter(t=>"number"==typeof t);if(t.length>0){const e=(t=>{let{data:e,width:n="100%",height:o=30,color:s,gap:i=2,className:r="",min:l,max:a}=t;if(!e||0===e.length)return null;const d=void 0!==l?l:Math.min(...e),c=void 0!==a?a:Math.max(...e),h=c-d||1,u=o,p=(100-i*(e.length-1))/e.length,f=0>d,w=f?u*(c/h):u,v=document.createElementNS("http://www.w3.org/2000/svg","svg");v.setAttribute("width",n+""),v.setAttribute("height",o+""),v.setAttribute("viewBox","0 0 100 "+u),v.setAttribute("preserveAspectRatio","none"),v.setAttribute("class",("st-bar-chart "+r).trim()),v.setAttribute("shape-rendering","crispEdges"),v.style.display="block";const m=()=>{v.innerHTML="",e.forEach((t,e)=>{const n=e*(p+i),o=(t-d)/h*u;let r=u-o,l=o;f&&(0>t?(l=Math.abs(t)/h*u,r=w):(l=t/h*u,r=w-l));const a=document.createElementNS("http://www.w3.org/2000/svg","rect");a.setAttribute("x",n+""),a.setAttribute("y",r+""),a.setAttribute("width",p+""),a.setAttribute("height",l+""),a.setAttribute("fill",s||"var(--st-chart-color)"),a.setAttribute("rx","0.5"),v.appendChild(a)})};return m(),{element:v,update:t=>{void 0===t.data||(e=t.data,e&&0!==e.length)?(void 0!==t.width&&(n=t.width,v.setAttribute("width",n+"")),void 0!==t.height&&(o=t.height,v.setAttribute("height",o+"")),void 0!==t.color&&(s=t.color),void 0!==t.gap&&(i=t.gap),void 0!==t.className&&(r=t.className,v.setAttribute("class",("st-bar-chart "+r).trim())),void 0!==t.min&&(l=t.min),void 0!==t.max&&(a=t.max),m()):v.innerHTML=""},destroy:()=>{v.remove()}}})(Object.assign({data:t,width:"100%",height:30},s.chartOptions));return void((null==e?void 0:e.element)&&n.appendChild(e.element))}}if(s.cellRenderer){try{const a=s.cellRenderer({accessor:s.accessor,colIndex:l,row:i,rowIndex:t.tableRow.absoluteRowIndex||r,rowPath:t.tableRow.rowPath,theme:e.theme,value:c,formattedValue:null===(o=s.valueFormatter)||void 0===o?void 0:o.call(s,{accessor:s.accessor,colIndex:l,row:i,rowIndex:r,value:c})});if("string"==typeof a||"number"==typeof a){const t=document.createTextNode(a+"");n.appendChild(t)}else if(a instanceof Node)n.appendChild(a);else if(null!=a&&"object"==typeof a){const t=Fe(c,s,l,i,r);if(null!==t){const e=document.createTextNode(t);n.appendChild(e)}}}catch(t){console.error("Error rendering cell:",t);const e=Fe(c,s,l,i,r);if(null!==e){const t=document.createTextNode(e);n.appendChild(t)}}return}const x=Fe(c,s,l,i,r);if(null!==x){const t=document.createTextNode(x);n.appendChild(t)}},je=new Map,Be=new WeakMap;let Ne=null;const ze=(t,e)=>{const n=je.get(t);n&&n.forEach(t=>{e?t.classList.add("st-row-hovered"):t.classList.remove("st-row-hovered")})},Ve=(t,e)=>{var n;const{header:o,rowIndex:s,colIndex:i,rowId:r,depth:l,isOdd:a}=t,d=o.isSelectionColumn&&e.enableRowSelection,c=!!(null==o?void 0:o.isEditable)||!(!e.onCellClick||d),h={rowIndex:s,colIndex:i,rowId:r},u=e.getBorderClass(h),p=e.isSelected(h),f=e.isInitialFocusedCell(h),w=e.isCopyFlashing(h),v=e.isWarningFlashing(h),m=e.selectedColumns.has(i),g=p&&!m,x=d&&e.rowsWithSelectedCells.has(r+""),b=(()=>{var t,n,s;if(!e.columnBorders)return!1;const i=e.headers.filter(t=>"left"===t.pinned),r=e.headers.filter(t=>!t.pinned),l=e.headers.filter(t=>"right"===t.pinned);return"left"===o.pinned?(null===(t=i[i.length-1])||void 0===t?void 0:t.accessor)===o.accessor:"right"===o.pinned?(null===(n=l[l.length-1])||void 0===n?void 0:n.accessor)===o.accessor:(null===(s=r[r.length-1])||void 0===s?void 0:s.accessor)===o.accessor})();return["st-cell",l>0&&o.expandable?"st-cell-depth-"+l:"",g?f?"st-cell-selected-first "+u:"st-cell-selected "+u:"",m?f?"st-cell-column-selected-first":"st-cell-column-selected":"",c?"clickable":"",w?f?"st-cell-copy-flash-first":"st-cell-copy-flash":"",v?f?"st-cell-warning-flash-first":"st-cell-warning-flash":"",e.useOddColumnBackground?i%2==0?"even-column":"odd-column":"",d?"st-selection-cell":"",x?"st-selection-has-highlighted-cell":"",b?"st-last-column":"","",e.useOddEvenRowBackground?a?"st-cell-even-row":"st-cell-odd-row":"",(null===(n=e.isRowSelected)||void 0===n?void 0:n.call(e,r))?"st-cell-selected-row":""].filter(Boolean).join(" ")},qe=(t,e)=>{var n;const{header:o,row:s,rowIndex:i,colIndex:r,rowId:l}=t,a=o.isSelectionColumn&&e.enableRowSelection,d={rowIndex:i,colIndex:r,rowId:l},h=e.isInitialFocusedCell(d),u=Ve(t,e),w=document.createElement("div");w.className=u,w.id=c({accessor:o.accessor,rowId:l}),w.setAttribute("role","gridcell"),w.setAttribute("tabindex",h?"0":"-1");const v=null!==(n=e.maxHeaderDepth)&&void 0!==n?n:1;w.setAttribute("aria-rowindex",t.tableRow.position+v+1+""),w.setAttribute("aria-colindex",r+1+""),w.setAttribute("data-row-index",i+""),w.setAttribute("data-col-index",r+""),w.setAttribute("data-row-id",l+""),w.setAttribute("data-accessor",o.accessor+""),w.style.position="absolute",w.style.left=t.left+"px",w.style.top=t.top+"px",w.style.width=t.width+"px",w.style.height=t.height+"px";let m=!1;const g="boolean"===o.type||"date"===o.type||"enum"===o.type,x=()=>{if(m&&!g){w.innerHTML="",w.setAttribute("tabindex","-1");const n=De(t,e,()=>{m=!1,w.setAttribute("tabindex",h?"0":"-1"),x(),b()});if(n){const t=document.createElement("div");t.className="st-cell-editing",t.appendChild(n),w.appendChild(t)}}else if(m&&g)De(t,e,()=>{m=!1,x(),b()});else{w.innerHTML="";const n=document.createElement("span");n.className="st-cell-content "+("right"===o.align?"right-aligned":"center"===o.align?"center-aligned":"left-aligned"),Le(t,e,n),w.appendChild(n)}};x();const b=()=>{e.cellRegistry&&!a&&e.cellRegistry.set(`${l}-${o.accessor}`,{updateContent:t=>{m||(f(s,o.accessor,t),x(),e.cellUpdateFlash&&(w.classList.add(h?"st-cell-updating-first":"st-cell-updating"),setTimeout(()=>{w.classList.remove("st-cell-updating-first","st-cell-updating")},800)))}})};if(b(),!m&&!a){const t=()=>{e.handleMouseOver(d)};ce(w,"mousedown",t=>{t.preventDefault(),t.target.closest(".st-expand-icon-container")||e.handleMouseDown(d)}),ce(w,"mouseover",t)}if(ce(w,"keydown",t=>{m||a||"F2"!==t.key&&"Enter"!==t.key||!o.isEditable||m||(t.preventDefault(),m=!0,x())}),ce(w,"dblclick",t=>{!o.isEditable||a||m||(m=!0,x())}),Be.set(w,{current:s}),e.onCellClick&&!a){const t=t=>{var n,l,a;if(t.target.closest(".st-expand-icon-container"))return;const d=null!==(l=null===(n=Be.get(w))||void 0===n?void 0:n.current)&&void 0!==l?l:s,c=p(d,o.accessor);null===(a=e.onCellClick)||void 0===a||a.call(e,{accessor:o.accessor,colIndex:r,row:d,rowIndex:i,value:c})};ce(w,"click",t)}if(e.useHoverRowBackground){((t,e)=>{je.has(t)||je.set(t,new Set),je.get(t).add(e)})(i,w);const t=()=>{ze(i,!1),Ne===i&&(Ne=null)};ce(w,"mouseenter",()=>{null!==Ne&&Ne!==i&&ze(Ne,!1),ze(i,!0),Ne=i}),ce(w,"mouseleave",t)}return w},Ge=(t,e)=>{t.style.left="0",t.style.width="number"!=typeof e||0>e?"100%":e+"px"},Ue=e=>{const{position:n,rowHeight:o,displayStrongBorder:s,heightOffsets:i,customTheme:r=t,isSticky:l=!1,sectionWidthPx:a}=e,d=document.createElement("div");d.className="st-row-separator "+(s?"st-last-group-row":"");const c=l?n:Y({position:n,rowHeight:o,heightOffsets:i,customTheme:r});Ge(d,a),l?(d.style.position="absolute",d.style.top="0",d.style.transform=`translateY(${c}px)`):d.style.transform=`translate3d(0, ${c}px, 0)`;const h=document.createElement("div");h.style.width="100%",d.appendChild(h);let u=null;return d.addEventListener("mousedown",t=>{t.preventDefault();const e=d.style.pointerEvents;d.style.pointerEvents="none";const n=document.elementFromPoint(t.clientX,t.clientY);if(d.style.pointerEvents=e,!n)return;const o=n.closest(".st-cell");if(o instanceof HTMLElement){u=o;const e=o.getBoundingClientRect(),n=new MouseEvent("mousedown",{bubbles:!0,cancelable:!0,view:window,button:0,clientX:t.clientX,clientY:e.top+e.height/2});o.dispatchEvent(n)}}),d.addEventListener("mouseup",t=>{if(u){const e=u.getBoundingClientRect(),n=new MouseEvent("mouseup",{bubbles:!0,cancelable:!0,view:window,button:0,clientX:t.clientX,clientY:e.top+e.height/2});u.dispatchEvent(n),u=null}}),d},Ke=new WeakMap,Je=new WeakMap,Ye=t=>(Je.has(t)||Je.set(t,new Map),Je.get(t)),_e=(e,n,o,s=0,i,r)=>{var l,a,d,h,u;const p=o.pinned?null!==(a=null!==(l=o.containerWidth)&&void 0!==l?l:e.clientWidth)&&void 0!==a?a:0:null!==(u=null!==(h=null!==(d=o.mainSectionContainerWidth)&&void 0!==d?d:o.containerWidth)&&void 0!==h?h:e.clientWidth)&&void 0!==u?u:0,f=o.pinned?n:((t,e,n,o=100)=>{if(0===t.length)return[];const s=e-o,i=e+n+o;return t.filter(t=>t.left+t.width>=s&&i>=t.left)})(n,s,p),w=ue(e),v=(t=>(Ke.has(t)||Ke.set(t,new Map),Ke.get(t)))(e),m=new Set(f.map(t=>c({accessor:t.header.accessor,rowId:t.rowId}))),x=(null==i?void 0:i.length)?new Set(i.map(t=>t.position)):new Set(f.map(t=>t.rowIndex));if(w.forEach((t,e)=>{if(!m.has(e)){const n=parseInt(t.getAttribute("data-row-index")||"-1",10);0>n||((t,e)=>{const n=je.get(t);n&&(n.delete(e),0===n.size&&je.delete(t))})(n,t),t.remove(),w.delete(e)}}),!r){const t=Ye(e);v.forEach((e,n)=>{x.has(n)||(e.remove(),v.delete(n),t.delete(n))})}const b=document.createDocumentFragment(),y=[];f.forEach(t=>{var e,n,s,i;const l=c({accessor:t.header.accessor,rowId:t.rowId});if(w.has(l)){const a=w.get(l);if(r)((t,e)=>{t.style.left=e.left+"px",t.style.top=e.top+"px",t.style.width=e.width+"px",t.style.height=e.height+"px"})(a,t);else{if(((t,e,n)=>{var o;const{rowIndex:s,colIndex:i,rowId:r}=e,l={rowIndex:s,colIndex:i,rowId:r};t.className=Ve(e,n);const a=n.isInitialFocusedCell(l);t.setAttribute("tabindex",a?"0":"-1"),t.style.left=e.left+"px",t.style.top=e.top+"px",t.style.width=e.width+"px",t.style.height=e.height+"px",t.setAttribute("data-row-index",s+""),t.setAttribute("data-col-index",i+"");const d=null!==(o=n.maxHeaderDepth)&&void 0!==o?o:1;t.setAttribute("aria-rowindex",e.tableRow.position+d+1+""),t.setAttribute("aria-colindex",i+1+""),t.setAttribute("data-row-id",r+""),t.setAttribute("data-accessor",e.header.accessor+"");const c=Be.get(t);if(c&&(c.current=e.row),!e.header.expandable){const o=t.querySelector(".st-cell-content");o&&(o.innerHTML="",Le(e,n,o))}})(a,t,o),t.header.isSelectionColumn&&o.enableRowSelection&&o.isRowSelected){const e=o.isRowSelected(t.rowId);re(a,e)}if(t.header.expandable){const r=new Set(o.expandedDepths),l=null!==(n=null===(e=o.getExpandedRows)||void 0===e?void 0:e.call(o))&&void 0!==n?n:o.expandedRows,d=null!==(i=null===(s=o.getCollapsedRows)||void 0===s?void 0:s.call(o))&&void 0!==i?i:o.collapsedRows,c=g(t.rowId,t.depth,r,l,d);pe(a,c)}}}else y.push({cell:t,cellId:l})}),y.forEach(({cell:t,cellId:e})=>{const n=qe(t,o);b.appendChild(n),w.set(e,n)}),b.childNodes.length>0&&e.appendChild(b),r||((e,n,o,s,i)=>{const r=Ye(e),l=(()=>{var t,n,s,i,r;const l=o.pinned?null!==(n=null!==(t=o.containerWidth)&&void 0!==t?t:e.clientWidth)&&void 0!==n?n:0:null!==(r=null!==(i=null!==(s=o.mainSectionContainerWidth)&&void 0!==s?s:o.containerWidth)&&void 0!==i?i:e.clientWidth)&&void 0!==r?r:0;return l>0?l:void 0})();let a=[];if(i&&i.length>0)a=i.map((t,e)=>({rowIndex:t.position,position:t.position,displayStrongBorder:e>0&&i[e-1].isLastGroupRow}));else if(n.length>0){const t=[];let e,o=-1,s=null;n.forEach(n=>{n.rowIndex!==o&&(s&&o>0&&t.push({rowIndex:o,firstCell:s,prevCell:e}),e=s||void 0,o=n.rowIndex,s=n)}),s&&o>0&&t.push({rowIndex:o,firstCell:s,prevCell:e}),a=t.map(({rowIndex:t,firstCell:e,prevCell:n})=>{var o,s;return{rowIndex:t,position:e.tableRow.position,displayStrongBorder:null!==(s=null===(o=null==n?void 0:n.tableRow)||void 0===o?void 0:o.isLastGroupRow)&&void 0!==s&&s}})}0!==a.length&&a.forEach(({rowIndex:n,position:i,displayStrongBorder:a})=>{var d;const c=r.get(n);if(s.has(n)){const e=s.get(n);if(!c||c.position!==i||c.displayStrongBorder!==a||c.sectionWidthPx!==l){if(Ge(e,l),(null==c?void 0:c.displayStrongBorder)!==a&&(a?e.classList.add("st-last-group-row"):e.classList.remove("st-last-group-row")),!c||c.position!==i){const n=Y({position:i,rowHeight:o.rowHeight,heightOffsets:o.heightOffsets,customTheme:null!==(d=o.customTheme)&&void 0!==d?d:t});e.style.transform=`translate3d(0, ${n}px, 0)`}r.set(n,{position:i,displayStrongBorder:a,sectionWidthPx:l})}}else{const t=Ue({position:i,rowHeight:o.rowHeight,displayStrongBorder:a,heightOffsets:o.heightOffsets,customTheme:o.customTheme,isSticky:!1,sectionWidthPx:l});e.appendChild(t),s.set(n,t),r.set(n,{position:i,displayStrongBorder:a,sectionWidthPx:l})}})})(e,f,o,v,i)};function Xe(t,e){return t?"string"==typeof t?t:t instanceof HTMLElement?t.cloneNode(!0):"function"==typeof t?t(e):null:null}class Qe{constructor(){this.headerSections=new Map,this.bodySections=new Map,this.bodyCellsCache=new Map,this.headerCellsCache=new Map,this.contextCache=new Map,this.nextColIndexMap=new Map,this.stateRowsMap=new Map,this.nestedGridRowsMap=new Map}renderHeaderSection(t){const{headers:e,collapsedHeaders:n,pinned:o,maxHeaderDepth:s,headerHeight:i,context:r,sectionWidth:l,startColIndex:a=0}=t,d=o||"main";let c=this.headerSections.get(d);c||(c=document.createElement("div"),c.className="left"===o?"st-header-pinned-left":"right"===o?"st-header-pinned-right":"st-header-main",c.setAttribute("role","rowgroup"),this.headerSections.set(d,c));const h=e.filter(t=>"left"===o?"left"===t.pinned:"right"===o?"right"===t.pinned:!t.pinned);if(0===h.length)return c.style.display="none",c;c.style.display="",c.style.cssText=`\n position: relative;\n ${void 0!==l?`width: ${l}px;`:""}\n height: ${s*i}px;\n `;const u=this.getCachedHeaderCells(d,h,n,s,i,a),p=u.length>0?Math.max(...u.map(t=>t.colIndex))+1:a;this.nextColIndexMap.set(d,p);const f=this.getCachedContext("header-"+d,r,o),w=c.scrollLeft;return Te(c,u,f,w),o||w===c.scrollLeft||(c.scrollLeft=w),!o&&c&&(c.__renderHeaderCells=t=>{c&&Te(c,u,f,t)}),c}renderBodySection(e){var n,o;const{headers:s,rows:i,collapsedHeaders:r,pinned:l,context:a,sectionWidth:d,rowHeight:c,heightOffsets:h,totalRowCount:u,startColIndex:p=0,positionOnly:f=!1,fullTableRows:w,renderedStartIndex:v,renderedEndIndex:m}=e,g=l||"main";let x=this.bodySections.get(g);x||(x=document.createElement("div"),x.className="left"===l?"st-body-pinned-left":"right"===l?"st-body-pinned-right":"st-body-main",x.setAttribute("role","rowgroup"),this.bodySections.set(g,x));const b=s.filter(t=>"left"===l?"left"===t.pinned:"right"===l?"right"===t.pinned:!t.pinned);if(0===b.length)return x.style.display="none",x;x.style.display="";const y=((t,e,n,o)=>t*(e+o.rowSeparatorWidth)-o.rowSeparatorWidth+((null==n?void 0:n.reduce((t,[e,n])=>t+n,0))||0))(void 0!==u?u:i.length,c,h,null!==(n=a.customTheme)&&void 0!==n?n:t);x.style.cssText=`\n position: relative;\n ${void 0!==d?`width: ${d}px;`:""}\n ${l?"":"flex-grow: 1;"}\n height: ${y}px;\n `;const R=this.getCachedBodyCells(g,b,i,r,c,h,null!==(o=a.customTheme)&&void 0!==o?o:t,p,w,v,m),C=R.length>0?Math.max(...R.map(t=>t.colIndex))+1:p;this.nextColIndexMap.set(g,C);const S=this.getCachedContext("body-"+g,a,l);return _e(x,R,S,x.scrollLeft,i,f),this.renderNestedGridRows(x,g,i,l,S),l||this.renderStateRows(x,g,i,S),!l&&x&&(x.__renderBodyCells=t=>{x&&_e(x,R,S,t,i,!0)}),x}renderNestedGridRows(t,e,n,o,s){var i;const r=n.filter(t=>t.nestedTable),l=new Set(r.map(t=>t.position));let a=this.nestedGridRowsMap.get(e);a||(a=new Map,this.nestedGridRowsMap.set(e,a)),a.forEach((t,e)=>{var n;l.has(e)||(null===(n=t.cleanup)||void 0===n||n.call(t),t.element.remove(),a.delete(e))});const d={rowHeight:s.rowHeight,heightOffsets:s.heightOffsets,customTheme:null!==(i=s.customTheme)&&void 0!==i?i:{},theme:s.theme,rowGrouping:s.rowGrouping,depth:0,loadingStateRenderer:s.loadingStateRenderer,errorStateRenderer:s.errorStateRenderer,emptyStateRenderer:s.emptyStateRenderer,icons:s.icons};r.forEach(e=>{var n;const i=e.position;if(!a.get(i))if(o){const o=function(t,e){const{nestedTable:n}=t;if(!n)throw Error("createNestedGridSpacer called without tableRow.nestedTable");const o=t.nestedTable.expandableHeader.nestedTable,s=h({calculatedHeight:n.calculatedHeight,customHeight:null==o?void 0:o.height,customTheme:e.customTheme}),i=_({position:t.position,rowHeight:e.rowHeight,heightOffsets:e.heightOffsets,customTheme:e.customTheme}),r=document.createElement("div");return r.className="st-row st-nested-grid-spacer",r.dataset.index=t.position+"",r.style.position="absolute",r.style.left="0",r.style.right="0",r.style.transform=`translate3d(0, ${i}px, 0)`,r.style.height=s+"px",r.style.pointerEvents="none",r}(e,{rowHeight:s.rowHeight,heightOffsets:s.heightOffsets,customTheme:null!==(n=s.customTheme)&&void 0!==n?n:{}});t.appendChild(o),a.set(i,{element:o})}else{d.depth=e.depth>0?e.depth-1:0;const{element:n,cleanup:o}=function(t,e){const{nestedTable:n}=t;if(!n)throw Error("createNestedGridRow called without tableRow.nestedTable");const{rowHeight:o,heightOffsets:s,customTheme:i,theme:r,rowGrouping:l,depth:a,loadingStateRenderer:d,errorStateRenderer:c,emptyStateRenderer:u,icons:f}=e,{parentRow:w,expandableHeader:v,childAccessor:m,calculatedHeight:g}=n,x=v.nestedTable;if(!x)throw Error("createNestedGridRow: expandableHeader.nestedTable is missing");const b=p(w,m),y=Array.isArray(b)?b:[],R=l&&l[a+1]?l.slice(a+1):void 0,C=x.customTheme?Object.assign(Object.assign({},i),x.customTheme):i,S=(({calculatedHeight:t,customHeight:e,customTheme:n})=>e?"string"==typeof e?e:e+"px":t-n.nestedGridPaddingTop-n.nestedGridPaddingBottom+"px")({calculatedHeight:g,customHeight:x.height,customTheme:i}),I=h({calculatedHeight:g,customHeight:x.height,customTheme:i}),H=_({position:t.position,rowHeight:o,heightOffsets:s,customTheme:i}),M=document.createElement("div");M.className="st-row st-nested-grid-row",M.dataset.index=t.position+"",M.style.position="absolute",M.style.left="0",M.style.right="0",M.style.transform=`translate3d(0, ${H}px, 0)`,M.style.height=I+"px",M.style.paddingTop=i.nestedGridPaddingTop+"px",M.style.paddingBottom=i.nestedGridPaddingBottom+"px",M.style.paddingLeft=i.nestedGridPaddingLeft+"px",M.style.paddingRight=i.nestedGridPaddingRight+"px",M.style.boxSizing="border-box";const k=document.createElement("div");k.style.height="100%",k.style.width="100%",M.appendChild(k);const E=Object.assign(Object.assign({},x),{defaultHeaders:x.defaultHeaders,rows:y,theme:r,customTheme:C,height:S,rowGrouping:R,loadingStateRenderer:d,errorStateRenderer:c,emptyStateRenderer:u,icons:f}),O=new gn(k,E);O.mount();const T=()=>{O.destroy()};return M.__nestedTableCleanup=T,{element:M,cleanup:T}}(e,d);t.appendChild(n),a.set(i,{element:n,cleanup:o})}})}renderStateRows(t,e,n,o){var s;const i=n.filter(t=>t.stateIndicator),r=new Set(i.map(t=>t.position));let l=this.stateRowsMap.get(e);l||(l=new Map,this.stateRowsMap.set(e,l)),l.forEach((t,e)=>{r.has(e)||(t.remove(),l.delete(e))});const a={index:0,rowHeight:o.rowHeight,heightOffsets:o.heightOffsets,customTheme:null!==(s=o.customTheme)&&void 0!==s?s:{},loadingStateRenderer:o.loadingStateRenderer,errorStateRenderer:o.errorStateRenderer,emptyStateRenderer:o.emptyStateRenderer};i.forEach((e,n)=>{var s,i;const r=e.position,d=l.get(r);if(d){const t=_({position:r,rowHeight:o.rowHeight,heightOffsets:o.heightOffsets,customTheme:null!==(s=o.customTheme)&&void 0!==s?s:{}});return void(d.style.transform=`translate3d(0, ${t}px, 0)`)}const c=((t,e)=>{const{position:n,stateIndicator:o}=t;if(!o)throw Error("createStateRow called without stateIndicator");const s=document.createElement("div");s.className="st-row st-state-row",s.dataset.index=e.index+"",s.style.width="100%",s.style.transform=`translate3d(0, ${_({position:n,rowHeight:e.rowHeight,heightOffsets:e.heightOffsets,customTheme:e.customTheme})}px, 0)`,s.style.height=e.rowHeight+"px";const i=document.createElement("div");i.className="st-cell st-state-row-cell",i.style.width="100%",i.style.padding="0";let r=null;return o.state.loading&&e.loadingStateRenderer?r=Xe(e.loadingStateRenderer,{parentRow:o.parentRow}):o.state.error&&e.errorStateRenderer?r=Xe(e.errorStateRenderer,{error:o.state.error,parentRow:o.parentRow}):o.state.isEmpty&&e.emptyStateRenderer&&(r=Xe(e.emptyStateRenderer,{message:o.state.emptyMessage,parentRow:o.parentRow})),r&&("string"==typeof r?i.textContent=r:r instanceof HTMLElement&&i.appendChild(r)),s.appendChild(i),s})(e,Object.assign(Object.assign({},a),{index:n})),h=_({position:r,rowHeight:o.rowHeight,heightOffsets:o.heightOffsets,customTheme:null!==(i=o.customTheme)&&void 0!==i?i:{}});c.style.position="absolute",c.style.transform=`translate3d(0, ${h}px, 0)`,c.style.width="100%",t.appendChild(c),l.set(r,c)})}calculateAbsoluteHeaderCells(t,e,n,o,s=0){const i=[];let r=s,l=0;const a=(t,s,d)=>{if(t.hide||t.excludeFromRender)return 0;const c=e.has(t.accessor);if(t.children&&t.children.length>0){const e=t.children.filter(t=>{const e=t.showWhen||"parentExpanded";return c?"parentCollapsed"===e||"always"===e:"parentExpanded"===e||"always"===e});if(t.singleRowChildren){const c="number"==typeof t.width?t.width:150;i.push({header:t,left:l,top:s*o,width:c,height:(n-s)*o,colIndex:r,parentHeader:d}),r++,l+=c;let h=0;return e.forEach(e=>{h+=a(e,s,t)}),c+h}if(0===e.length){const e="number"==typeof t.width?t.width:150;return i.push({header:t,left:l,top:s*o,width:e,height:(n-s)*o,colIndex:r,parentHeader:d}),r++,l+=e,e}const h=l,u=r;let p=0;return e.forEach(e=>{p+=a(e,s+1,t)}),i.push({header:t,left:h,top:s*o,width:p,height:o,colIndex:u,parentHeader:d}),p}{const e="number"==typeof t.width?t.width:150;return i.push({header:t,left:l,top:s*o,width:e,height:(n-s)*o,colIndex:r,parentHeader:d}),r++,l+=e,e}};return t.forEach(t=>a(t,0)),i}calculateAbsoluteBodyCells(t,e,n,o,s,i,r=0){const l=[],a=e.filter(t=>!t.nestedTable&&!t.stateIndicator),d=this.getLeafHeaders(t,n),c=new Map;let h=0;return d.forEach(t=>{const e="number"==typeof t.width?t.width:150;c.set(t.accessor,{left:h,width:e}),h+=e}),a.forEach((t,e)=>{const n=i?_({position:t.position,rowHeight:o,heightOffsets:s,customTheme:i}):e*o;d.forEach((s,i)=>{var a,d;const h=c.get(s.accessor);l.push({header:s,row:t.row,rowIndex:e,colIndex:r+i,rowId:m(t.rowId),displayRowNumber:t.displayPosition,depth:t.depth,isOdd:e%2==1,tableRow:t,left:null!==(a=null==h?void 0:h.left)&&void 0!==a?a:0,top:n,width:null!==(d=null==h?void 0:h.width)&&void 0!==d?d:150,height:o})})}),l}getLeafHeaders(t,e){const n=[],o=t=>{if(t.hide||t.excludeFromRender)return;const s=e.has(t.accessor);if(t.children&&t.children.length>0){const e=t.children.filter(t=>{const e=t.showWhen||"parentExpanded";return s?"parentCollapsed"===e||"always"===e:"parentExpanded"===e||"always"===e});t.singleRowChildren&&n.push(t),e.length>0?e.forEach(t=>o(t)):t.singleRowChildren||n.push(t)}else n.push(t)};return t.forEach(t=>o(t)),n}createHeadersHash(t){const e=t=>{let n=`${t.accessor}:${t.width}:${t.pinned||""}:${t.hide||""}`;return t.children&&t.children.length>0&&(n+=`:children[${t.children.map(e).join(",")}]`),n};return t.map(e).join("|")}createHeightOffsetsHash(t){return t&&0!==t.length?t.map(([t,e])=>`${t}:${e}`).join("|"):""}createContextHash(t){let e=["columnBorders","enableRowSelection","cellUpdateFlash","useOddColumnBackground","useHoverRowBackground","useOddEvenRowBackground","rowHeight","containerWidth"].map(e=>`${e}:${t[e]}`).join("|");if(e+=t.sort?`|sort:${t.sort.key.accessor}-${t.sort.direction}`:"|sort:none",e+=t.filters&&Object.keys(t.filters).length>0?"|filters:"+JSON.stringify(t.filters):"|filters:none",t.expandedRows&&(e+="|expandedRows:"+t.expandedRows.size),t.collapsedRows&&(e+="|collapsedRows:"+t.collapsedRows.size),t.expandedDepths&&(e+="|expandedDepths:"+(Array.isArray(t.expandedDepths)?t.expandedDepths.length:t.expandedDepths.size)),null!=t.collapsedHeaders){const n=t.collapsedHeaders.size;e+=`|collapsedHeaders:${n}:${0===n?"":Array.from(t.collapsedHeaders).sort().join(",")}`}return void 0!==t.selectedRowCount&&(e+="|selectedRowCount:"+t.selectedRowCount),t.selectedColumns&&void 0!==t.selectedColumns.size&&(e+="|selectedColumns:"+Array.from(t.selectedColumns).sort((t,e)=>t-e).join(",")),t.columnsWithSelectedCells&&void 0!==t.columnsWithSelectedCells.size&&(e+="|columnsWithSelectedCells:"+Array.from(t.columnsWithSelectedCells).sort((t,e)=>t-e).join(",")),t.rowsWithSelectedCells&&void 0!==t.rowsWithSelectedCells.size&&(e+="|rowsWithSelectedCells:"+Array.from(t.rowsWithSelectedCells).sort().join(",")),e}getCachedBodyCells(t,e,n,o,s,i,r,l=0,a,d,c){const h=this.createHeadersHash(e),u=this.createHeightOffsetsHash(i),p=null!=a&&null!=d&&null!=c,f=this.bodyCellsCache.get(t);if(f&&f.deps.headersHash===h&&f.deps.collapsedHeadersSize===o.size&&f.deps.rowHeight===s&&f.deps.heightOffsetsHash===u&&(p?f.deps.fullTableRowsRef===a&&f.deps.renderedStartIndex===d&&f.deps.renderedEndIndex===c:f.deps.rowsRef===n))return f.cells;const w=p?a.slice(d,c):n,v=this.calculateAbsoluteBodyCells(e,w,o,s,i,r,l);return this.bodyCellsCache.set(t,{cells:v,deps:Object.assign({headersHash:h,rowsRef:w,collapsedHeadersSize:o.size,rowHeight:s,heightOffsetsHash:u},p&&{fullTableRowsRef:a,renderedStartIndex:d,renderedEndIndex:c})}),v}getCachedHeaderCells(t,e,n,o,s,i=0){const r=this.headerCellsCache.get(t),l=this.createHeadersHash(e);if(r&&r.deps.headersHash===l&&r.deps.collapsedHeadersSize===n.size&&r.deps.maxDepth===o&&r.deps.headerHeight===s)return r.cells;const a=this.calculateAbsoluteHeaderCells(e,n,o,s,i);return this.headerCellsCache.set(t,{cells:a,deps:{headersHash:l,collapsedHeadersSize:n.size,maxDepth:o,headerHeight:s}}),a}getCachedContext(t,e,n){const o=this.contextCache.get(t),s=this.createContextHash(e);if(o&&o.deps.contextHash===s)return o.context;const i=Object.assign(Object.assign({},e),{pinned:n});return this.contextCache.set(t,{context:i,deps:{contextHash:s}}),i}invalidateCache(t){t&&"all"!==t?"body"===t?this.bodyCellsCache.clear():"header"===t?(this.headerCellsCache.clear(),this.headerSections.forEach(t=>{Kt(t)})):"context"===t&&(this.contextCache.clear(),this.headerSections.forEach(t=>{Kt(t)})):(this.bodyCellsCache.clear(),this.headerCellsCache.clear(),this.contextCache.clear(),this.bodySections.forEach(t=>{(t=>{if(t){const e=ue(t);e.forEach(t=>{t.remove()}),e.clear()}})(t)}),this.headerSections.forEach(t=>{Kt(t)}))}getNextColIndex(t){var e;return null!==(e=this.nextColIndexMap.get(t))&&void 0!==e?e:0}cleanup(){this.headerSections.clear(),this.bodySections.clear(),this.bodyCellsCache.clear(),this.headerCellsCache.clear(),this.contextCache.clear(),this.nextColIndexMap.clear()}}const Ze=(t,e)=>{"string"==typeof e?t.innerHTML=e:(t.innerHTML="",t.appendChild(e.cloneNode(!0)))},tn=(t,e,n=new Set)=>{for(const o of t)if(!n.has(o.accessor)&&(n.add(o.accessor),o.children&&o.children.length>0)){const t=o.children.some(t=>t.accessor===e);let s=!1;if(!t)for(const t of o.children)if(tn([t],e,n),!1===t.hide){s=!0;break}(t||s)&&(o.hide=!1)}},en=t=>t.every(t=>t.hide),nn=t=>{t.forEach(t=>{t.children&&t.children.length>0&&(nn(t.children),en(t.children)&&(t.hide=!0))})},on=(t,e)=>{const n=e.toLowerCase();return!!t.label.toLowerCase().includes(n)||!(!t.children||0>=t.children.length)&&t.children.some(t=>on(t,e))},sn=(t,e,n)=>{if(!e.trim())return t;const o=n||on;return t.filter(t=>!t.isSelectionColumn&&!t.excludeFromRender&&o(t,e))};function rn(t,e,n,o){e&&t.appendChild(e),t.appendChild(n),o&&t.appendChild(o)}function ln(t,e,n,o,s,i,r){const l=e({headers:n,searchSection:o,listSection:s,resetSection:i,resetColumns:r});if(l instanceof HTMLElement)t.appendChild(l);else if("string"==typeof l){const e=document.createElement("div");e.innerHTML=l,t.appendChild(e)}}const an=t=>{let e=t,{headers:n,open:o,searchEnabled:s,searchPlaceholder:i,searchFunction:r,columnEditorConfig:l,essentialAccessors:a,setHeaders:d,onColumnVisibilityChange:c,onColumnOrderChange:h,resetColumns:u}=e,p="",f=null,w=null,v=!1;const m=new Set,g=t=>{t.forEach(t=>{t.children&&t.children.length>0&&(m.add(t.accessor),g(t.children))})};g(n);let x=m;const b=document.createElement("div");b.className="st-column-editor-popout "+(o?"open":"");const y=document.createElement("div");y.className="st-column-editor-popout-content",y.addEventListener("click",t=>t.stopPropagation());let R=null,C=null;if(s){const t=function(t){const e=document.createElement("div");e.className="st-column-editor-search-wrapper";const n=document.createElement("div");n.className="st-column-editor-search";const o=document.createElement("input");return o.type="text",o.value="",o.placeholder=t,o.className="st-filter-input",o.addEventListener("click",t=>t.stopPropagation()),o.addEventListener("input",t=>{p=t.target.value,W()}),n.appendChild(o),e.appendChild(n),{wrapper:e,input:o}}(i);C=t.wrapper,R=t.input}const S=document.createElement("div");S.className="st-column-editor-lists";let I=null;u&&(I=function(t){const e=document.createElement("div");e.className="st-column-editor-footer";const n=document.createElement("button");return n.type="button",n.className="st-column-editor-reset-btn",n.textContent="Reset columns",n.addEventListener("click",e=>{e.stopPropagation(),t()}),e.appendChild(n),e}(u));let H=l.customRenderer;H?ln(y,H,n,C,S,I,u):rn(y,C,S,I),b.appendChild(y);const M=t=>{f=t,null!==t?v=!0:(v=!1,W())},k=()=>{w=null},E=t=>{w=t,v?T():W()},O=t=>{const e=x;x=t,W(e)},T=()=>{S.querySelectorAll(".st-column-editor-drag-separator").forEach((t,e)=>{const n=t;n.style.opacity=0===e?-1===w?"1":"0":w===e-1?"1":"0"})},A=(t,e,o,i,u)=>{if(0===t.length)return;const v=t.filter(t=>!t.isSelectionColumn&&!t.excludeFromRender);if(0===(s?sn(v,p,r):v).length)return;if(o){const t=document.createElement("div");t.className="st-column-editor-section-label",t.textContent=o,i.appendChild(t)}const m=document.createElement("div");m.className="st-column-editor-list st-column-editor-list-section",i.appendChild(m);const g=((t,e)=>{const n=s?sn(t,p,r):t,o=[],i=s&&p.trim().length>0,l=({headers:t,depth:n=0,parent:s=null,currentPath:r=[]})=>{t.forEach((t,a)=>{if(t.isSelectionColumn||t.excludeFromRender)return;const d=[...r,a];o.push({header:t,visualIndex:o.length,depth:n,parent:s,indexPath:d,panelSection:e});const c=t.children&&t.children.length>0,h=i||x.has(t.accessor);c&&h&&t.children&&l({headers:t.children,depth:n+1,parent:t,currentPath:d})})};return l({headers:n,depth:0,parent:null,currentPath:[]}),o})(t,e),b=(t=>t.some(t=>t.children&&t.children.length>0))(t);g.forEach(t=>{var o;const i=(t=>{var e;const{allHeaders:n,clearHoverSeparator:o,depth:s,doesAnyHeaderHaveChildren:i,draggingRow:r,getDraggingRow:l,getHoveredSeparatorIndex:a,expandedHeaders:d,flattenedHeaders:c,forceExpanded:h,header:u,hoveredSeparatorIndex:p,panelSection:f,rowIndex:w,setDraggingRow:v,setExpandedHeaders:m,setHoveredSeparatorIndex:g,headers:x,setHeaders:b,onColumnVisibilityChange:y,onColumnOrderChange:R,previousExpandedHeaders:C}=t,S=null!==(e=t.essentialAccessors)&&void 0!==e?e:new Set,I=!1!==t.columnEditorConfig.allowColumnPinning,H=St(u,S),M=!H,k=document.createDocumentFragment(),E=16*s+"px",O=u.children&&u.children.length>0,T=!(u.hide||O&&u.children&&en(u.children)),A=d.has(u.accessor),W=h||A;let P;if(0===w){const t=document.createElement("div");t.className="st-column-editor-drag-separator",t.style.opacity=-1===p?"1":"0",k.appendChild(t)}const $=document.createElement("div");$.className="st-header-checkbox-item",$.style.paddingLeft=E,$.draggable=!0;const D=t=>!(S.size>0&&!Ht(t,S)||(null==R||R(t),b(t),0)),F=t=>{if(t.stopPropagation(),h)return;const e=new Set(d);A?e.delete(u.accessor):e.add(u.accessor),m(e)};let L;if($.addEventListener("dragstart",t=>{t.dataTransfer&&(t.dataTransfer.effectAllowed="move"),null==o||o(),v(c[w])}),$.addEventListener("dragenter",t=>{t.preventDefault()}),$.addEventListener("dragover",t=>{t.preventDefault();const e=l?l():r;if(e&&e.panelSection===f){const n=t.currentTarget.getBoundingClientRect(),o=(({flattenedHeaders:t,draggingRow:e,hoveredRowIndex:n,isTopHalfOfRow:o})=>{var s,i;const r=t[n];if(r.depth===e.depth)return(null===(s=r.parent)||void 0===s?void 0:s.accessor)!==(null===(i=e.parent)||void 0===i?void 0:i.accessor)?null:o||r.header.children?n-1:n;if(r.depth>e.depth){let s=r,i=n;for(;s.parent&&s.depth>e.depth;){const e=s.parent.accessor,n=t.findIndex(t=>t.header.accessor===e);if(-1===n)break;s=t[n],i=n}const l=i;let a=i;for(let e=i+1;t.length>e&&t[e].depth>s.depth;e++)a=e;const d=a-l+1,c=n-l;let h=d/2>c;return d%2==1&&c===Math.floor(d/2)&&(h=o),h?i-1:a}return null})({flattenedHeaders:c,draggingRow:e,hoveredRowIndex:w,isTopHalfOfRow:n.top+n.height/2>t.clientY});g(o)}}),$.addEventListener("dragend",()=>{const t=l?l():r,e=a?a():p,n=()=>{v(null),g(null)};if(!t||null===e||t.panelSection!==f)return void n();let o,s=c[e>t.visualIndex?e:e+1];if(s){if(s.depth>t.depth&&s.parent){const t=c.findIndex(t=>t.header.accessor===s.parent.accessor);-1!==t&&(s=c[t])}if(t.header.accessor!==s.header.accessor)if(t.indexPath.length!==s.indexPath.length||1!==t.indexPath.length&&!t.indexPath.slice(0,-1).every((t,e)=>t===s.indexPath[e]))n();else{if(1===t.indexPath.length){const{newHeaders:e,emergencyBreak:i}=ve(x,t.indexPath,s.indexPath);if(i)return void n();o=e}else{const{newHeaders:e,emergencyBreak:i}=ve(x,t.indexPath,s.indexPath);if(i)return void n();o=e}D(o),n()}else n()}else n()}),i){const e=document.createElement("div");if(e.className="st-header-icon-container",O){const t=void 0!==C?h||C.has(u.accessor):W,n=!h&&void 0!==C&&t!==W,o=n?t:W,s=document.createElement("div");s.className="st-collapsible-header-icon st-expand-icon-container "+(o?"expanded":"collapsed"),s.setAttribute("role","button"),s.setAttribute("tabindex","0"),s.setAttribute("aria-expanded",o+""),s.setAttribute("aria-label",o?`Collapse ${u.label} column`:`Expand ${u.label} column`),s.appendChild(gt("st-expand-icon")),s.addEventListener("click",F),s.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),F(t))}),e.appendChild(s),L=s,n&&(P=()=>{pe($,W,{ariaLabelWhenExpanded:`Collapse ${u.label} column`,ariaLabelWhenCollapsed:`Expand ${u.label} column`,syncAriaExpanded:!0})})}t.columnEditorConfig.rowRenderer||$.appendChild(e)}const j=le({checked:T,onChange:t=>{if(!M)return;u.hide=!t,t?(tn(n,u.accessor),O&&u.children&&u.children.length>0&&u.children.every(t=>!0===t.hide)&&u.children[0]&&(u.children[0].hide=!1,tn(n,u.children[0].accessor))):nn(n);const e=[...x];if(b(wt(e)),y){const t=(t=>{const e={},n=t=>{e[t.accessor]=!t.hide,t.children&&t.children.length>0&&t.children.forEach(n)};return t.forEach(n),e})(e);y(t)}}});M||(j.element.classList.add("st-checkbox-disabled"),j.element.style.pointerEvents="none");const B=document.createElement("div");B.className="st-drag-icon-container",B.innerHTML='<svg\n aria-hidden="true"\n role="img"\n xmlns="http://www.w3.org/2000/svg"\n viewBox="0 0 16 10"\n style="height: 10px; width: 16px;"\n>\n <circle cx="3" cy="3" r="1.5" fill="currentColor" />\n <circle cx="8" cy="3" r="1.5" fill="currentColor" />\n <circle cx="13" cy="3" r="1.5" fill="currentColor" />\n <circle cx="3" cy="7" r="1.5" fill="currentColor" />\n <circle cx="8" cy="7" r="1.5" fill="currentColor" />\n <circle cx="13" cy="7" r="1.5" fill="currentColor" />\n</svg>';const N=document.createElement("div");N.className="st-column-label-container",N.textContent=u.label;const z="left"===u.pinned||"right"===u.pinned?u.pinned:null,V=!!z&&!H,q=!z&&"main"===f,G=!z&&"main"===f,U=()=>{const t=Tt(x,u.accessor,"left",S);t&&D(t)},K=()=>{const t=Tt(x,u.accessor,"right",S);t&&D(t)},J=()=>{const t=Tt(x,u.accessor,"main",S);t&&D(t)},{rowRenderer:Y}=t.columnEditorConfig;if(Y){const t=Y({accessor:u.accessor,header:u,components:{expandIcon:L,checkbox:j.element,dragIcon:B,labelContent:N},panelSection:f,isEssential:H,canToggleVisibility:M,allowColumnPinning:I,pinControl:I&&0===s?{pinnedSide:z,canPinLeft:q,canPinRight:G,canUnpin:V,pinLeft:U,pinRight:K,unpin:J}:void 0});t instanceof HTMLElement?$.appendChild(t):"string"==typeof t&&($.innerHTML=t)}else if($.appendChild(j.element),$.appendChild(B),$.appendChild(N),I&&0===s){const t=document.createElement("div");if(t.className="st-column-pin-side-group",t.addEventListener("mousedown",t=>{t.stopPropagation()}),t.addEventListener("dragstart",t=>{t.preventDefault(),t.stopPropagation()}),z){const e=document.createElement("div"),n=H;e.className="st-column-pin-btn st-column-pin-side st-column-pin-pinned-active"+(n?" st-column-pin-pinned-essential":""),e.textContent="left"===z?"L":"R",e.title=n?"Essential column — cannot be unpinned":"Unpin column",V&&e.addEventListener("click",t=>{t.stopPropagation(),J()}),t.appendChild(e)}else{if(q){const e=document.createElement("button");e.type="button",e.className="st-column-pin-btn st-column-pin-side st-column-pin-side-option",e.textContent="L",e.title="Pin column to left",e.addEventListener("click",t=>{t.stopPropagation(),U()}),t.appendChild(e)}if(G){const e=document.createElement("button");e.type="button",e.className="st-column-pin-btn st-column-pin-side st-column-pin-side-option",e.textContent="R",e.title="Pin column to right",e.addEventListener("click",t=>{t.stopPropagation(),K()}),t.appendChild(e)}}$.appendChild(t)}k.appendChild($);const _=document.createElement("div");return _.className="st-column-editor-drag-separator",_.style.opacity=p===w?"1":"0",k.appendChild(_),{fragment:k,scheduleExpandIconAnimation:P}})({allHeaders:n,clearHoverSeparator:k,depth:t.depth,doesAnyHeaderHaveChildren:b,draggingRow:f,getDraggingRow:()=>f,getHoveredSeparatorIndex:()=>w,expandedHeaders:x,flattenedHeaders:g,forceExpanded:s&&p.trim().length>0,header:t.header,hoveredSeparatorIndex:w,panelSection:e,rowIndex:t.visualIndex,setDraggingRow:M,setExpandedHeaders:O,setHoveredSeparatorIndex:E,columnEditorConfig:l,essentialAccessors:null!=a?a:new Set,headers:n,setHeaders:d,onColumnVisibilityChange:c,onColumnOrderChange:h,previousExpandedHeaders:u});m.appendChild(i.fragment),null===(o=i.scheduleExpandIconAnimation)||void 0===o||o.call(i)})},W=t=>{S.innerHTML="";const e=!1!==l.allowColumnPinning,{pinnedLeft:o,unpinned:s,pinnedRight:i}=Ct(n);if(e)A(o,"left","Pinned Left",S,t),A(s,"main","Main",S,t),A(i,"right","Pinned Right",S,t);else{const e=[...o,...s,...i];A(e,"main",null,S,t)}};return W(),{element:b,update:t=>{void 0!==t.headers&&(n=t.headers),void 0!==t.searchEnabled&&(s=t.searchEnabled),void 0!==t.searchPlaceholder&&(i=t.searchPlaceholder),void 0!==t.searchFunction&&(r=t.searchFunction),void 0!==t.essentialAccessors&&(a=t.essentialAccessors),void 0!==t.setHeaders&&(d=t.setHeaders),void 0!==t.onColumnVisibilityChange&&(c=t.onColumnVisibilityChange),void 0!==t.onColumnOrderChange&&(h=t.onColumnOrderChange),void 0!==t.resetColumns&&(u=t.resetColumns);let e=!1;if(void 0!==t.columnEditorConfig){const n=t.columnEditorConfig.customRenderer;n!==H&&(H=n,e=!0),l=t.columnEditorConfig}void 0!==t.open&&(o=t.open,o?b.classList.add("open"):b.classList.remove("open")),R&&void 0!==t.searchPlaceholder&&(R.placeholder=t.searchPlaceholder),e&&(y.innerHTML="",H?ln(y,H,n,C,S,I,u):rn(y,C,S,I)),W()},destroy:()=>{R&&(R.removeEventListener("input",()=>{}),R.removeEventListener("click",()=>{})),b.removeEventListener("click",()=>{}),b.remove()}}},dn=(t,e)=>{if(e){const n=t.querySelector(".st-horizontal-scrollbar-left"),o=t.querySelector(".st-horizontal-scrollbar-middle"),s=t.querySelector(".st-horizontal-scrollbar-right");n instanceof HTMLElement&&e.unregisterPane("pinned-left",n),o instanceof HTMLElement&&e.unregisterPane("main",o),s instanceof HTMLElement&&e.unregisterPane("pinned-right",s)}t.remove()},cn=t=>{const{sectionHeaders:e,stickyParents:n,stickyHeight:o,offsetStartIndex:s,treeTransitionOffset:i,rowHeight:r,heightOffsets:l,customTheme:a,cellRenderContext:d,collapsedHeaders:c,pinned:h,width:u,scrollSyncGroup:p,sectionScrollController:f}=t,w=document.createElement("div");w.className=h?"st-sticky-section-"+h:"st-sticky-section-main",w.style.position="relative",w.style.height=o+"px",h&&u?(w.style.width=u+"px",w.style.flexGrow="0",w.style.flexShrink="0"):w.style.flexGrow="1";const v=((t,e)=>{const n=[],o=t=>{if(t.hide||t.excludeFromRender)return;const s=e.has(t.accessor);if(t.children&&t.children.length>0){const e=t.children.filter(t=>{const e=t.showWhen||"parentExpanded";return s?"parentCollapsed"===e||"always"===e:"parentExpanded"===e||"always"===e});t.singleRowChildren&&n.push(t),e.length>0?e.forEach(t=>o(t)):t.singleRowChildren||n.push(t)}else n.push(t)};return t.forEach(t=>o(t)),n})(e,c),g=new Map;let x=0;v.forEach(t=>{const e="number"==typeof t.width?t.width:150;g.set(t.accessor,{left:x,width:e}),x+=e});const b=h&&"number"==typeof u?u:"number"==typeof d.mainSectionContainerWidth?d.mainSectionContainerWidth:void 0;return n.forEach((t,e)=>{const o=-1!==s&&e>=s,c=o?i:0,h=e*(r+1)+c,u=o?e:n.length-e,p=document.createElement("div");p.className="st-row st-sticky-parent",p.style.position="absolute",p.style.top="0px",p.style.left="0",p.style.right="0",p.style.height=r+"px",p.style.transform=`translateY(${h}px)`,p.style.zIndex=u+"",p.setAttribute("data-index",t.position+""),v.forEach((e,n)=>{var o,s;const i=g.get(e.accessor),l={header:e,row:t.row,rowIndex:t.position,colIndex:n,rowId:m(t.rowId),displayRowNumber:t.displayPosition,depth:t.depth,isOdd:t.position%2==1,tableRow:t,left:null!==(o=null==i?void 0:i.left)&&void 0!==o?o:0,top:0,width:null!==(s=null==i?void 0:i.width)&&void 0!==s?s:150,height:r},a=qe(l,d);p.appendChild(a)}),w.appendChild(p);const f=Ue({position:(e+1)*(r+1)-1+c,rowHeight:r,displayStrongBorder:!1,heightOffsets:l,customTheme:a,isSticky:!0,sectionWidthPx:b});w.appendChild(f)}),f&&p&&f.registerPane("pinned-left"===p?"pinned-left":"pinned-right"===p?"pinned-right":"main",w,"sticky"),w},hn=(t,e)=>{if(e){const n=t.querySelector(".st-sticky-section-left"),o=t.querySelector(".st-sticky-section-main"),s=t.querySelector(".st-sticky-section-right");n instanceof HTMLElement&&e.unregisterPane("pinned-left",n),o instanceof HTMLElement&&e.unregisterPane("main",o),s instanceof HTMLElement&&e.unregisterPane("pinned-right",s)}t.remove()};class un{constructor(){this.footerInstance=null,this.columnEditorInstance=null,this.horizontalScrollbarRef={current:null},this.scrollbarTimeoutId=null,this.stickyParentsContainer=null,this.sectionScrollController=null,this.renderScheduled=!1,this.pendingRenderCallback=null,this.sectionRenderer=new Qe}scheduleRender(t){this.renderScheduled||(this.renderScheduled=!0,this.pendingRenderCallback=t,queueMicrotask(()=>{this.renderScheduled=!1,this.pendingRenderCallback&&(this.pendingRenderCallback(),this.pendingRenderCallback=null)}))}invalidateCache(t){this.sectionRenderer.invalidateCache(t)}renderHeader(t,e,n,o){var s,i,r,l,a,d,c,h,u,p,f,w;if(!t||o.config.hideHeader)return;t.style.height=e+"px";const v=vt(o.effectiveHeaders,"left")||vt(o.effectiveHeaders,void 0)||vt(o.effectiveHeaders,"right");t.style.minHeight=v?"":e+"px",t.setAttribute("aria-rowcount",1+o.localRows.length+""),t.setAttribute("aria-colcount",o.effectiveHeaders.length+"");const m=null!==(i=null===(s=o.dimensionManager)||void 0===s?void 0:s.getState())&&void 0!==i?i:{containerWidth:0,calculatedHeaderHeight:o.customTheme.headerHeight,maxHeaderDepth:1},{mainWidth:g,leftWidth:x,rightWidth:b}=me({headers:o.effectiveHeaders,containerWidth:m.containerWidth,collapsedHeaders:o.collapsedHeaders}),y=null===(r=o.sortManager)||void 0===r?void 0:r.getState(),R=null===(l=o.filterManager)||void 0===l?void 0:l.getState(),C=null!==(d=null===(a=o.rowSelectionManager)||void 0===a?void 0:a.getSelectedRowCount())&&void 0!==d?d:0,S={reverse:!1,collapsedHeaders:o.collapsedHeaders,getCollapsedHeaders:o.getCollapsedHeaders,columnBorders:null!==(c=o.config.columnBorders)&&void 0!==c&&c,columnReordering:null!==(h=o.config.columnReordering)&&void 0!==h&&h,columnResizing:null!==(u=o.config.columnResizing)&&void 0!==u&&u,containerWidth:m.containerWidth,mainSectionContainerWidth:g,enableHeaderEditing:o.config.enableHeaderEditing,enableRowSelection:o.config.enableRowSelection,selectedRowCount:C,filters:null!==(p=null==R?void 0:R.filters)&&void 0!==p?p:{},icons:o.resolvedIcons,selectedColumns:o.config.selectableColumns&&o.selectionManager?o.selectionManager.getSelectedColumns():new Set,columnsWithSelectedCells:o.selectionManager&&(o.config.selectableCells||o.config.selectableColumns)?o.selectionManager.getColumnsWithSelectedCells():new Set,sort:null!==(f=null==y?void 0:y.sort)&&void 0!==f?f:null,autoExpandColumns:null!==(w=o.config.autoExpandColumns)&&void 0!==w&&w,essentialAccessors:o.essentialAccessors,selectableColumns:o.config.selectableColumns,headers:o.effectiveHeaders,rows:o.localRows,headerHeight:o.customTheme.headerHeight,lastHeaderIndex:o.effectiveHeaders.length-1,onSort:t=>{o.sortManager&&o.sortManager.updateSort({accessor:t})},handleApplyFilter:t=>{o.filterManager&&o.filterManager.updateFilter(t)},handleClearFilter:t=>{o.filterManager&&o.filterManager.clearFilter(t)},getHeaders:()=>o.getHeaders(),handleSelectAll:t=>{var e;null===(e=o.rowSelectionManager)||void 0===e||e.handleSelectAll(t)},setCollapsedHeaders:t=>{o.setCollapsedHeaders("function"==typeof t?t(o.collapsedHeaders):t),o.onRender()},setHeaders:t=>{o.setHeaders("function"==typeof t?t(o.getHeaders()):t),o.onRender()},setIsResizing:t=>{o.setIsResizing("function"==typeof t?t(o.isResizing):t)},onColumnWidthChange:o.config.onColumnWidthChange,onColumnOrderChange:o.config.onColumnOrderChange,onTableHeaderDragEnd:t=>{o.setHeaders(t),o.onRender()},onHeaderEdit:o.config.onHeaderEdit,onColumnSelect:o.config.onColumnSelect,selectColumns:o.selectionManager&&o.config.selectableColumns?(t,e)=>{o.selectionManager.selectColumns(t,e),o.onRender()}:t=>{},setSelectedColumns:o.selectionManager&&o.config.selectableColumns?t=>{const e=o.selectionManager.getSelectedColumns(),n="function"==typeof t?t(e):t;o.selectionManager.setSelectedColumns(n),o.onRender()}:t=>{},setSelectedCells:o.selectionManager?t=>{var e;const n=o.selectionManager.getSelectedCells(),s="function"==typeof t?t(n):t;o.selectionManager.setSelectedCells(s instanceof Set?s:new Set),null===(e=o.onRender)||void 0===e||e.call(o)}:t=>{},setInitialFocusedCell:o.selectionManager?t=>{var e;o.selectionManager.setInitialFocusedCell(null!=t?t:null),null===(e=o.onRender)||void 0===e||e.call(o)}:t=>{},areAllRowsSelected:()=>{var t,e;return null!==(e=null===(t=o.rowSelectionManager)||void 0===t?void 0:t.areAllRowsSelected())&&void 0!==e&&e},draggedHeaderRef:o.draggedHeaderRef,hoveredHeaderRef:o.hoveredHeaderRef,headerRegistry:o.headerRegistry,forceUpdate:()=>o.onRender(),mainBodyRef:o.mainBodyRef,pinnedLeftRef:o.pinnedLeftRef,pinnedRightRef:o.pinnedRightRef},I=o.effectiveHeaders.filter(t=>"left"===t.pinned),H=o.effectiveHeaders.filter(t=>!t.pinned),M=o.effectiveHeaders.filter(t=>"right"===t.pinned);let k=0;const E=[];if(I.length>0){const e=this.sectionRenderer.renderHeaderSection({headers:o.effectiveHeaders,collapsedHeaders:o.collapsedHeaders,pinned:"left",maxHeaderDepth:n,headerHeight:o.customTheme.headerHeight,context:S,sectionWidth:x,startColIndex:k});o.pinnedLeftHeaderRef.current=e,E.push(e),t.appendChild(e),k=this.sectionRenderer.getNextColIndex("left")}if(H.length>0){const e=this.sectionRenderer.renderHeaderSection({headers:o.effectiveHeaders,collapsedHeaders:o.collapsedHeaders,maxHeaderDepth:n,headerHeight:o.customTheme.headerHeight,context:S,sectionWidth:g,startColIndex:k});o.mainHeaderRef.current=e,E.push(e),t.appendChild(e),k=this.sectionRenderer.getNextColIndex("main")}if(M.length>0){const e=this.sectionRenderer.renderHeaderSection({headers:o.effectiveHeaders,collapsedHeaders:o.collapsedHeaders,pinned:"right",maxHeaderDepth:n,headerHeight:o.customTheme.headerHeight,context:S,sectionWidth:b,startColIndex:k});o.pinnedRightHeaderRef.current=e,E.push(e),t.appendChild(e)}Array.from(t.children).forEach(t=>{E.includes(t)||t.remove()})}renderBody(t,e,n){var o,s,i,r,l,a,d,c,h,u,p,f,w,v,m,g,x,b,y,R;if(!t)return;if(vt(n.effectiveHeaders,"left")||vt(n.effectiveHeaders,void 0)||vt(n.effectiveHeaders,"right"))t.style.minHeight="";else{const n=null!==(s=null===(o=null==e?void 0:e.heightMap)||void 0===o?void 0:o.totalHeight)&&void 0!==s?s:0;t.style.minHeight=n+"px"}const C=e.rowsToRender||e.currentTableRows,S=!n.internalIsLoading&&0===e.currentTableRows.length;if(n.selectionManager&&e.currentTableRows&&n.selectionManager.updateConfig({tableRows:e.currentTableRows,headers:n.effectiveHeaders,collapsedHeaders:n.collapsedHeaders,selectableColumns:null!==(i=n.config.selectableColumns)&&void 0!==i&&i},{positionOnlyBody:n.positionOnlyBody}),S){t.innerHTML="";const e=document.createElement("div");return e.className="st-empty-state-wrapper","string"==typeof n.config.tableEmptyStateRenderer?e.textContent=n.config.tableEmptyStateRenderer:n.config.tableEmptyStateRenderer instanceof HTMLElement?e.appendChild(n.config.tableEmptyStateRenderer.cloneNode(!0)):e.innerHTML="<div class='st-empty-state'>No rows to display</div>",void t.appendChild(e)}const I=null!==(l=null===(r=n.dimensionManager)||void 0===r?void 0:r.getState())&&void 0!==l?l:{containerWidth:0,calculatedHeaderHeight:n.customTheme.headerHeight,maxHeaderDepth:1},{mainWidth:H,leftWidth:M,rightWidth:k}=me({headers:n.effectiveHeaders,containerWidth:I.containerWidth,collapsedHeaders:n.collapsedHeaders}),E=null!==(d=null===(a=n.rowSelectionManager)||void 0===a?void 0:a.getSelectedRowCount())&&void 0!==d?d:0,O=null!==(c=I.maxHeaderDepth)&&void 0!==c?c:1,T={collapsedHeaders:n.collapsedHeaders,collapsedRows:n.getCollapsedRows(),expandedRows:n.getExpandedRows(),expandedDepths:Array.from(n.expandedDepths),selectedColumns:null!==(u=null===(h=n.selectionManager)||void 0===h?void 0:h.getSelectedColumns())&&void 0!==u?u:new Set,rowsWithSelectedCells:null!==(f=null===(p=n.selectionManager)||void 0===p?void 0:p.getRowsWithSelectedCells())&&void 0!==f?f:new Set,columnBorders:null!==(w=n.config.columnBorders)&&void 0!==w&&w,enableRowSelection:n.config.enableRowSelection,selectedRowCount:E,cellUpdateFlash:n.config.cellUpdateFlash,useOddColumnBackground:n.config.useOddColumnBackground,useHoverRowBackground:n.config.useHoverRowBackground,useOddEvenRowBackground:n.config.useOddEvenRowBackground,rowGrouping:n.config.rowGrouping,headers:n.effectiveHeaders,rowHeight:n.customTheme.rowHeight,maxHeaderDepth:O,heightOffsets:e.paginatedHeightOffsets,customTheme:n.customTheme,containerWidth:I.containerWidth,mainSectionContainerWidth:H,onCellEdit:n.config.onCellEdit,onCellClick:n.config.onCellClick,onRowGroupExpand:n.config.onRowGroupExpand,handleRowSelect:(t,e)=>{var o;null===(o=n.rowSelectionManager)||void 0===o||o.handleRowSelect(t,e)},cellRegistry:n.cellRegistry,getCollapsedRows:()=>n.getCollapsedRows(),getExpandedRows:()=>n.getExpandedRows(),setCollapsedRows:t=>{n.setCollapsedRows("function"==typeof t?t(n.getCollapsedRows()):t),this.scheduleRender(n.onRender)},setExpandedRows:t=>{n.setExpandedRows("function"==typeof t?t(n.getExpandedRows()):t),this.scheduleRender(n.onRender)},setRowStateMap:t=>{n.setRowStateMap("function"==typeof t?t(n.getRowStateMap()):t),this.scheduleRender(n.onRender)},icons:n.resolvedIcons,theme:null!==(v=n.config.theme)&&void 0!==v?v:"modern-light",rowButtons:n.config.rowButtons,loadingStateRenderer:n.config.loadingStateRenderer,errorStateRenderer:n.config.errorStateRenderer,emptyStateRenderer:n.config.emptyStateRenderer,getBorderClass:t=>{var e;return(null===(e=n.selectionManager)||void 0===e?void 0:e.getBorderClass(t))||""},isSelected:t=>{var e;return(null===(e=n.selectionManager)||void 0===e?void 0:e.isSelected(t))||!1},isInitialFocusedCell:t=>{var e;return(null===(e=n.selectionManager)||void 0===e?void 0:e.isInitialFocusedCell(t))||!1},isCopyFlashing:t=>{var e;return(null===(e=n.selectionManager)||void 0===e?void 0:e.isCopyFlashing(t))||!1},isWarningFlashing:t=>{var e;return(null===(e=n.selectionManager)||void 0===e?void 0:e.isWarningFlashing(t))||!1},handleMouseDown:t=>{var e;return null===(e=n.selectionManager)||void 0===e?void 0:e.handleMouseDown(t)},handleMouseOver:t=>{var e;return null===(e=n.selectionManager)||void 0===e?void 0:e.handleMouseOver(t)},isRowSelected:t=>{var e,o;return null!==(o=null===(e=n.rowSelectionManager)||void 0===e?void 0:e.isRowSelected(t))&&void 0!==o&&o},canExpandRowGroup:n.config.canExpandRowGroup,isLoading:n.internalIsLoading},A=n.effectiveHeaders.filter(t=>"left"===t.pinned),W=n.effectiveHeaders.filter(t=>!t.pinned),P=n.effectiveHeaders.filter(t=>"right"===t.pinned);let $=0;const D=[];if(A.length>0){const o=this.sectionRenderer.renderBodySection({headers:n.effectiveHeaders,rows:C,collapsedHeaders:n.collapsedHeaders,pinned:"left",context:T,sectionWidth:M,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,totalRowCount:e.currentTableRows.length,startColIndex:$,positionOnly:n.positionOnlyBody,fullTableRows:e.currentTableRows,renderedStartIndex:e.renderedStartIndex,renderedEndIndex:e.renderedEndIndex});n.pinnedLeftRef.current=o,D.push(o),t.appendChild(o),$=this.sectionRenderer.getNextColIndex("left")}if(W.length>0){const o=this.sectionRenderer.renderBodySection({headers:n.effectiveHeaders,rows:C,collapsedHeaders:n.collapsedHeaders,context:T,sectionWidth:H,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,totalRowCount:e.currentTableRows.length,startColIndex:$,positionOnly:n.positionOnlyBody,fullTableRows:e.currentTableRows,renderedStartIndex:e.renderedStartIndex,renderedEndIndex:e.renderedEndIndex});n.mainBodyRef.current=o,D.push(o),t.appendChild(o),$=this.sectionRenderer.getNextColIndex("main")}if(P.length>0){const o=this.sectionRenderer.renderBodySection({headers:n.effectiveHeaders,rows:C,collapsedHeaders:n.collapsedHeaders,pinned:"right",context:T,sectionWidth:k,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,totalRowCount:e.currentTableRows.length,startColIndex:$,positionOnly:n.positionOnlyBody,fullTableRows:e.currentTableRows,renderedStartIndex:e.renderedStartIndex,renderedEndIndex:e.renderedEndIndex});n.pinnedRightRef.current=o,D.push(o),t.appendChild(o)}if(n.config.enableStickyParents&&e.stickyParents&&e.stickyParents.length>0){this.stickyParentsContainer&&(hn(this.stickyParentsContainer,null!==(m=n.sectionScrollController)&&void 0!==m?m:null),this.stickyParentsContainer=null);const o=null!==(x=null===(g=n.mainBodyRef.current)||void 0===g?void 0:g.scrollTop)&&void 0!==x?x:0;this.stickyParentsContainer=((t,e)=>{const{stickyParents:n}=t;if(0===n.length)return null;const{treeTransitionOffset:o,offsetStartIndex:s}=((t,e,n,o,s,i)=>{var r,l;if(0===t.length)return{treeTransitionOffset:0,offsetStartIndex:-1};const a=e[0];if(!a)return{treeTransitionOffset:0,offsetStartIndex:-1};let d;if((null==a?void 0:a.parentIndices)&&a.parentIndices.length>0)for(let e=a.parentIndices.length-1;e>=0;e--){const n=a.parentIndices[e];if(t.some(t=>t.position===n)){d=n;break}}const c=void 0!==d?t.findIndex(t=>t.position===d):-1;let h=-1;for(let e=0;t.length>e;e++){const n=t[e],o=t[e+1];if(!o)break;if(o.depth===n.depth){h=e;break}if(n.depth>o.depth){h=t.findIndex(t=>t.depth===n.depth);break}}if(-1===h)return{treeTransitionOffset:0,offsetStartIndex:c};const u=null===(r=t[h])||void 0===r?void 0:r.position;if(void 0===u)return{treeTransitionOffset:0,offsetStartIndex:c};let p=0;for(const t of e){if(!(null===(l=t.parentIndices)||void 0===l?void 0:l.includes(u)))break;p++}if(0===p)return{treeTransitionOffset:0,offsetStartIndex:c};const f=e[0];let w;return w=n?n.rowTopPositions[f.position]:f.position*(o+s.rowSeparatorWidth),{treeTransitionOffset:-((h+1-p)*o+Math.max(0,i-w)),offsetStartIndex:c}})(n,t.partiallyVisibleRows,t.heightMap,e.rowHeight,e.customTheme,t.scrollTop),i=n.length>0?n.length*(e.rowHeight+1)+o:0,r=`calc(100% - ${t.scrollbarWidth}px - ${e.editColumns?"29.5px":"0px"})`,l=document.createElement("div");l.className="st-sticky-top",l.style.height=i+"px",l.style.width=r,l.style.top=t.calculatedHeaderHeight+"px";const a=e.headers.filter(t=>!t.pinned),d=e.sectionScrollController;if(t.pinnedLeftColumns.length>0){const r=cn({sectionHeaders:t.pinnedLeftColumns,stickyParents:n,stickyHeight:i,offsetStartIndex:s,treeTransitionOffset:o,rowHeight:e.rowHeight,heightOffsets:e.heightOffsets,customTheme:e.customTheme,cellRenderContext:e.cellRenderContext,collapsedHeaders:e.collapsedHeaders,pinned:"left",width:t.pinnedLeftWidth,scrollSyncGroup:"pinned-left",sectionScrollController:d});l.appendChild(r)}const c=cn({cellRenderContext:e.cellRenderContext,collapsedHeaders:e.collapsedHeaders,customTheme:e.customTheme,heightOffsets:e.heightOffsets,offsetStartIndex:s,rowHeight:e.rowHeight,scrollSyncGroup:"default",sectionHeaders:a,stickyHeight:i,stickyParents:n,treeTransitionOffset:o,sectionScrollController:d});if(l.appendChild(c),t.pinnedRightColumns.length>0){const r=cn({sectionHeaders:t.pinnedRightColumns,stickyParents:n,stickyHeight:i,offsetStartIndex:s,treeTransitionOffset:o,rowHeight:e.rowHeight,heightOffsets:e.heightOffsets,customTheme:e.customTheme,cellRenderContext:e.cellRenderContext,collapsedHeaders:e.collapsedHeaders,pinned:"right",width:t.pinnedRightWidth,scrollSyncGroup:"pinned-right",sectionScrollController:d});l.appendChild(r)}return l})({calculatedHeaderHeight:I.calculatedHeaderHeight,heightMap:e.heightMap,partiallyVisibleRows:e.partiallyVisibleRows||[],pinnedLeftColumns:A,pinnedLeftWidth:M,pinnedRightColumns:P,pinnedRightWidth:k,scrollTop:o,scrollbarWidth:n.mainBodyRef.current?n.mainBodyRef.current.offsetWidth-n.mainBodyRef.current.clientWidth:0,stickyParents:e.stickyParents},{collapsedHeaders:n.collapsedHeaders,customTheme:n.customTheme,editColumns:null!==(b=n.config.editColumns)&&void 0!==b&&b,headers:n.effectiveHeaders,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,cellRenderContext:T,sectionScrollController:null!==(y=n.sectionScrollController)&&void 0!==y?y:null}),this.stickyParentsContainer&&(D.push(this.stickyParentsContainer),t.contains(this.stickyParentsContainer)||t.appendChild(this.stickyParentsContainer))}else this.stickyParentsContainer&&(hn(this.stickyParentsContainer,null!==(R=n.sectionScrollController)&&void 0!==R?R:null),this.stickyParentsContainer=null);Array.from(t.children).forEach(t=>{D.includes(t)||t.remove()})}renderFooter(t,e,n,o,s){var i,r,l,a,d,c,h,u,p,f,w;if(!t)return;const v=!!s.config.footerRenderer;if(!v&&(!s.config.shouldPaginate||s.config.hideFooter))return void(t.innerHTML="");const m=null!==(i=s.config.rowsPerPage)&&void 0!==i?i:10,g=Math.ceil(e/m);if(v){const i=(n-1)*m+1,a=s.config.footerRenderer({currentPage:n,endRow:Math.min(n*m,e),hasNextPage:g>n,hasPrevPage:n>1,nextIcon:null===(r=s.resolvedIcons)||void 0===r?void 0:r.next,onNextPage:async()=>{g>n&&(o(n+1),s.config.onNextPage&&await s.config.onNextPage(n+1))},onPageChange:o,onPrevPage:()=>{n>1&&o(n-1)},prevIcon:null===(l=s.resolvedIcons)||void 0===l?void 0:l.prev,rowsPerPage:m,startRow:i,totalPages:g,totalRows:e});return t.innerHTML="",a instanceof HTMLElement?t.appendChild(a):"string"==typeof a&&(t.innerHTML=a),void(this.footerInstance=null)}if(this.footerInstance)this.footerInstance.update({currentPage:n,hideFooter:null!==(a=s.config.hideFooter)&&void 0!==a&&a,onPageChange:o,onNextPage:s.config.onNextPage,onUserPageChange:s.config.onPageChange,rowsPerPage:m,shouldPaginate:null!==(d=s.config.shouldPaginate)&&void 0!==d&&d,totalPages:g,totalRows:e,prevIcon:null===(c=s.resolvedIcons)||void 0===c?void 0:c.prev,nextIcon:null===(h=s.resolvedIcons)||void 0===h?void 0:h.next});else{t.innerHTML="";const i=(t=>{let{currentPage:e,hideFooter:n,onPageChange:o,onNextPage:s,onUserPageChange:i,rowsPerPage:r,shouldPaginate:l,totalPages:a,totalRows:d,prevIcon:c,nextIcon:h}=t,u=!0;if(n||!l)return{element:document.createElement("div"),update:()=>{},destroy:()=>{}};const p=document.createElement("div");p.className="st-footer";const f=()=>{p.innerHTML="";const t=e>1,n=a>e,l=e===a,w=Math.min((e-1)*r+1,d),v=Math.min(e*r,d),m=!t,g=!n&&!s||!u&&l,x=document.createElement("div");x.className="st-footer-info";const b=document.createElement("span");b.className="st-footer-results-text",b.textContent=`Showing ${w} to ${v} of ${d.toLocaleString()} results`,x.appendChild(b),p.appendChild(x);const y=document.createElement("div");y.className="st-footer-pagination";const R=((t,e)=>{if(15>=e)return Array.from({length:e},(t,e)=>e+1);const n=[];let o,s;if(t>8)if(e-7>t){const e=7;o=t-e,s=t+(15-e-1)}else o=Math.max(1,e-15+1),s=e;else o=1,s=14;o>2?(n.push(1),n.push(-1)):2===o&&n.push(1);for(let t=o;s>=t;t++)n.push(t);return e-1>s?(n.push(-2),n.push(e)):s===e-1&&n.push(e),n})(e,a),C=[];R.forEach((t,n)=>{if(0>t){const t=document.createElement("span");t.className="st-page-ellipsis",t.textContent="...",y.appendChild(t)}else{const s=document.createElement("button"),r=n>0&&0>R[n-1];s.className=["st-page-btn",e===t?"active":""].filter(Boolean).join(" "),s.textContent=""+t,s.setAttribute("aria-label","Go to page "+t),e===t&&s.setAttribute("aria-current","page"),s.addEventListener("click",()=>(async t=>{1>t||t>a||(o(t),i&&await i(t))})(t)),y.appendChild(s),C.push({button:s,page:t,afterEllipsis:r})}}),C.forEach((t,n)=>{const{button:o,page:s,afterEllipsis:i}=t,r=n+1,l=e===s,a=o.previousElementSibling,d=o.nextElementSibling,c=null!==a&&a.classList.contains("st-page-btn")&&a.classList.contains("active")||null!==d&&d.classList.contains("st-page-btn")&&d.classList.contains("active");r>9&&!(l||i||c)&&o.classList.add("st-page-btn--compact-hidden")});const S=document.createElement("button");S.className="st-next-prev-btn "+(m?"disabled":""),S.disabled=m,S.setAttribute("aria-label","Go to previous page"),c?Ze(S,c):S.innerHTML='<svg\n class="st-next-prev-icon"\n viewBox="0 0 24 24"\n width="24"\n height="24"\n xmlns="http://www.w3.org/2000/svg"\n>\n <path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z" />\n</svg>',S.addEventListener("click",async()=>{const t=e-1;1>t||(o(t),i&&await i(t))}),y.appendChild(S);const I=document.createElement("button");I.className="st-next-prev-btn "+(g?"disabled":""),I.disabled=g,I.setAttribute("aria-label","Go to next page"),h?Ze(I,h):I.innerHTML='<svg\n class="st-next-prev-icon"\n viewBox="0 0 24 24"\n width="24"\n height="24"\n xmlns="http://www.w3.org/2000/svg"\n>\n <path d="M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z" />\n</svg>',I.addEventListener("click",async()=>{const t=e+1;if(s&&e===a&&!await s(e))return u=!1,void f();t>a&&!s||(o(t),i&&await i(t))}),y.appendChild(I),p.appendChild(y)};return f(),{element:p,update:t=>{void 0!==t.currentPage&&(e=t.currentPage),void 0!==t.hideFooter&&(n=t.hideFooter),void 0!==t.onPageChange&&(o=t.onPageChange),void 0!==t.onNextPage&&(s=t.onNextPage),void 0!==t.onUserPageChange&&(i=t.onUserPageChange),void 0!==t.rowsPerPage&&(r=t.rowsPerPage),void 0!==t.shouldPaginate&&(l=t.shouldPaginate),void 0!==t.totalPages&&(a=t.totalPages),void 0!==t.totalRows&&(d=t.totalRows),void 0!==t.prevIcon&&(c=t.prevIcon),void 0!==t.nextIcon&&(h=t.nextIcon),n||!l?p.style.display="none":(p.style.display="flex",f())},destroy:()=>{p.remove()}}})({currentPage:n,hideFooter:null!==(u=s.config.hideFooter)&&void 0!==u&&u,onPageChange:o,onNextPage:s.config.onNextPage,onUserPageChange:s.config.onPageChange,rowsPerPage:m,shouldPaginate:null!==(p=s.config.shouldPaginate)&&void 0!==p&&p,totalPages:g,totalRows:e,prevIcon:null===(f=s.resolvedIcons)||void 0===f?void 0:f.prev,nextIcon:null===(w=s.resolvedIcons)||void 0===w?void 0:w.next});this.footerInstance=i,t.appendChild(i.element)}}renderColumnEditor(t,e,n,o,s){if(!t)return;if(!s.config.editColumns)return void(this.columnEditorInstance&&(this.columnEditorInstance.destroy(),this.columnEditorInstance=null));const i=()=>{const t=s.config.defaultHeaders;if(t){const e=t.map(t=>Object.assign({},t));s.setHeaders(e),s.onRender()}};if(this.columnEditorInstance)this.columnEditorInstance.update({columnEditorText:o.text,editColumns:s.config.editColumns,headers:s.headers,open:e,searchEnabled:o.searchEnabled,searchPlaceholder:o.searchPlaceholder,searchFunction:o.searchFunction,columnEditorConfig:o,essentialAccessors:s.essentialAccessors,setHeaders:t=>{s.setHeaders(t),this.columnEditorInstance&&this.columnEditorInstance.update({headers:t}),s.onRender()},onColumnVisibilityChange:s.config.onColumnVisibilityChange,onColumnOrderChange:s.config.onColumnOrderChange,resetColumns:i,setOpen:n});else{const r=(t=>{let{columnEditorText:e,editColumns:n,headers:o,open:s,searchEnabled:i,searchPlaceholder:r,searchFunction:l,columnEditorConfig:a,essentialAccessors:d,resetColumns:c,setHeaders:h,onColumnVisibilityChange:u,onColumnOrderChange:p,setOpen:f}=t;if(!n)return{element:document.createElement("div"),update:()=>{},destroy:()=>{}};const w=document.createElement("div");w.className="st-column-editor "+(s?"open":""),w.style.width="29.5px";const v=t=>{f(!s)},m=document.createElement("div");m.className="st-column-editor-text",m.textContent=e,w.addEventListener("click",v),w.appendChild(m);const g=an({headers:o,open:s,searchEnabled:i,searchPlaceholder:r,searchFunction:l,columnEditorConfig:a,essentialAccessors:d,resetColumns:c,setHeaders:h,onColumnVisibilityChange:u,onColumnOrderChange:p});w.appendChild(g.element);const x={update:t=>{void 0!==t.open&&(s=t.open,t.open?w.classList.add("open"):w.classList.remove("open")),void 0!==t.setOpen&&(f=t.setOpen),void 0!==t.columnEditorText&&(m.textContent=t.columnEditorText),void 0!==t.essentialAccessors&&(d=t.essentialAccessors),void 0!==t.resetColumns&&(c=t.resetColumns),g.update({headers:t.headers,open:t.open,searchEnabled:t.searchEnabled,searchPlaceholder:t.searchPlaceholder,searchFunction:t.searchFunction,columnEditorConfig:t.columnEditorConfig,essentialAccessors:t.essentialAccessors,resetColumns:t.resetColumns,setHeaders:t.setHeaders,onColumnVisibilityChange:t.onColumnVisibilityChange,onColumnOrderChange:t.onColumnOrderChange})},destroy:()=>{w.removeEventListener("click",v),g.destroy(),w.remove()}};return w.__columnEditor=x,Object.assign({element:w},x)})({columnEditorText:o.text,editColumns:s.config.editColumns,headers:s.headers,open:e,searchEnabled:o.searchEnabled,searchPlaceholder:o.searchPlaceholder,searchFunction:o.searchFunction,columnEditorConfig:o,essentialAccessors:s.essentialAccessors,setHeaders:t=>{s.setHeaders(t),this.columnEditorInstance&&this.columnEditorInstance.update({headers:t}),s.onRender()},onColumnVisibilityChange:s.config.onColumnVisibilityChange,onColumnOrderChange:s.config.onColumnOrderChange,resetColumns:i,setOpen:n});this.columnEditorInstance=r,t.appendChild(r.element)}}renderHorizontalScrollbar(t,e,n,o,s,i,r,l){if(t&&l.mainBodyRef.current&&r)return l.mainBodyRef.current.scrollWidth-l.mainBodyRef.current.clientWidth>1?void(this.horizontalScrollbarRef.current&&t.contains(this.horizontalScrollbarRef.current)||(null!==this.scrollbarTimeoutId&&(clearTimeout(this.scrollbarTimeoutId),this.scrollbarTimeoutId=null),this.scrollbarTimeoutId=window.setTimeout(()=>{var a,d;if(!l.mainBodyRef.current||!r||!t)return;if(this.horizontalScrollbarRef.current&&t.contains(this.horizontalScrollbarRef.current))return void(this.scrollbarTimeoutId=null);this.sectionScrollController=null!==(a=l.sectionScrollController)&&void 0!==a?a:null;const c=(t=>{const{mainBodyRef:e,mainBodyWidth:n,pinnedLeftWidth:o,pinnedRightWidth:s,pinnedLeftContentWidth:i,pinnedRightContentWidth:r,tableBodyContainerRef:l,editColumns:a,sectionScrollController:d}=t;if(1>=e.scrollWidth-e.clientWidth)return null;const c=a?29.5:0,h=(a?s+1:s)+(l.scrollHeight>l.clientHeight?l.offsetWidth-l.clientWidth:0),u=document.createElement("div");if(u.className="st-horizontal-scrollbar-container",o>0){const t=document.createElement("div");t.className="st-horizontal-scrollbar-left",t.style.width=o+"px";const e=document.createElement("div");e.style.width=i+"px",t.appendChild(e),u.appendChild(t),null==d||d.registerPane("pinned-left",t,"scrollbar")}if(n>0){const t=document.createElement("div");t.className="st-horizontal-scrollbar-middle";const e=document.createElement("div");e.style.width=n+"px",t.appendChild(e),u.appendChild(t),null==d||d.registerPane("main",t,"scrollbar")}if(s>0){const t=document.createElement("div");t.className="st-horizontal-scrollbar-right",t.style.width=h+"px";const e=document.createElement("div");e.style.width=r+"px",t.appendChild(e),u.appendChild(t),null==d||d.registerPane("pinned-right",t,"scrollbar")}if(c>0){const t=document.createElement("div");t.style.width=c-1.5+"px",t.style.height="100%",t.style.flexShrink="0",u.appendChild(t)}return u})({mainBodyRef:l.mainBodyRef.current,mainBodyWidth:e,pinnedLeftWidth:n,pinnedRightWidth:o,pinnedLeftContentWidth:s,pinnedRightContentWidth:i,tableBodyContainerRef:r,editColumns:null!==(d=l.config.editColumns)&&void 0!==d&&d,sectionScrollController:this.sectionScrollController});if(c){const e=t.querySelector(".st-content-wrapper");e&&e.nextSibling?t.insertBefore(c,e.nextSibling):t.appendChild(c),this.horizontalScrollbarRef.current=c}this.scrollbarTimeoutId=null},1))):(this.horizontalScrollbarRef.current&&(dn(this.horizontalScrollbarRef.current,l.sectionScrollController),this.horizontalScrollbarRef.current=null),void(null!==this.scrollbarTimeoutId&&(clearTimeout(this.scrollbarTimeoutId),this.scrollbarTimeoutId=null)))}cleanup(){var t,e;this.sectionRenderer.cleanup(),null===(t=this.footerInstance)||void 0===t||t.destroy(),null===(e=this.columnEditorInstance)||void 0===e||e.destroy(),null!==this.scrollbarTimeoutId&&(clearTimeout(this.scrollbarTimeoutId),this.scrollbarTimeoutId=null),this.horizontalScrollbarRef.current&&(dn(this.horizontalScrollbarRef.current,this.sectionScrollController),this.horizontalScrollbarRef.current=null),this.stickyParentsContainer&&(hn(this.stickyParentsContainer,this.sectionScrollController),this.stickyParentsContainer=null),this.sectionScrollController=null}}function pn(t){const{rows:e=[],rowGrouping:n=[],getRowId:o,expandedRows:s=new Map,collapsedRows:i=new Map,expandedDepths:r=new Set,rowStateMap:l=new Map,hasLoadingRenderer:a=!1,hasErrorRenderer:d=!1,hasEmptyRenderer:c=!1,headers:u=[],rowHeight:p=40,headerHeight:f=40,customTheme:x}=t;if(!n||0===n.length){const t=e.map((t,e)=>{const n=[e],s=[e];return{row:t,depth:0,displayPosition:e,groupingKey:void 0,position:e,rowId:v({row:t,getRowId:o,depth:0,index:e,rowPath:n,rowIndexPath:s,groupingKey:void 0}),rowPath:n,rowIndexPath:s,absoluteRowIndex:e,isLastGroupRow:!1}});return{flattenedRows:t,heightOffsets:[],paginatableRows:t,parentEndPositions:e.map((t,e)=>e+1)}}const b=[],y=[],R=[],C=[];let S=0;const I=(t,e,H=[],M=[],k=[])=>{t.forEach((t,E)=>{var O,T;const A=n[e],W=b.length,P=[...H,E],$=[...M,E],D=v({row:t,getRowId:o,depth:e,index:E,rowPath:P,rowIndexPath:$,groupingKey:A}),F=b.length,L={row:t,depth:e,displayPosition:S,groupingKey:A,position:W,isLastGroupRow:!1,rowId:D,rowPath:P,rowIndexPath:$,absoluteRowIndex:W,parentIndices:k.length>0?[...k]:void 0};b.push(L),y.push(L),S++;const j=m(D);if(g(j,e,r,s,i)&&n.length>e){const n=null==l?void 0:l.get(j),o=((t,e)=>{const n=t[e];return w(n)?n:[]})(t,A),s=u.find(t=>t.expandable&&t.nestedTable);if((null==s?void 0:s.nestedTable)&&o.length>0){const n=b.length,i=(null===(O=s.nestedTable.customTheme)||void 0===O?void 0:O.rowHeight)||p,r=(null===(T=s.nestedTable.customTheme)||void 0===T?void 0:T.headerHeight)||f,l=(({childRowCount:t,rowHeight:e,headerHeight:n,customTheme:o})=>Math.min(n+o.rowSeparatorWidth+t*(e+o.rowSeparatorWidth)+o.nestedGridPaddingTop+o.nestedGridPaddingBottom+o.nestedGridBorderWidth,o.nestedGridMaxHeight+o.nestedGridPaddingTop+o.nestedGridPaddingBottom+o.nestedGridBorderWidth))({childRowCount:o.length,rowHeight:i,headerHeight:r,customTheme:x}),a=h({calculatedHeight:l,customHeight:s.nestedTable.height,customTheme:x});R.push([n,a-p]);const d=[...P,A];b.push({row:{},depth:e+1,displayPosition:S-1,groupingKey:A,position:n,isLastGroupRow:!1,rowId:d,rowPath:d,rowIndexPath:$,nestedTable:{parentRow:t,expandableHeader:s,childAccessor:A,calculatedHeight:a},absoluteRowIndex:n})}else if(n&&(n.loading||n.error||n.isEmpty)){if(n.loading&&a||n.error&&d||n.isEmpty&&c){const o=b.length,s=[...P,A];b.push({row:{},depth:e+1,displayPosition:S-1,groupingKey:A,position:o,isLastGroupRow:!1,rowId:s,rowPath:s,rowIndexPath:$,stateIndicator:{parentRowId:j,parentRow:t,state:n},absoluteRowIndex:o,parentIndices:[...k,F]})}else if(n.loading&&!a){const t=b.length,n=[...P,A,"loading-skeleton"];b.push({row:{},depth:e+1,displayPosition:S-1,groupingKey:A,position:t,isLastGroupRow:!1,rowId:n,rowPath:n,rowIndexPath:$,isLoadingSkeleton:!0,absoluteRowIndex:t,parentIndices:[...k,F]})}}else if(o.length>0){const t=[...P,A],n=[...$];I(o,e+1,t,n,[...k,F])}}0===e&&C.push(b.length)})};return I(e,0,[],[],[]),C.forEach((t,e)=>{const n=t-1;n>=0&&b.length>n&&(b[n].isLastGroupRow=!0)}),{flattenedRows:b,heightOffsets:R,paginatableRows:y,parentEndPositions:C}}const fn=t=>{var e;const n=document.querySelector(".simple-table-root");if("string"==typeof t){if(t.endsWith("px"))return parseInt(t,10);if(t.endsWith("vh"))return window.innerHeight*parseInt(t,10)/100;if(t.endsWith("%")){const o=null===(e=null==n?void 0:n.parentElement)||void 0===e?void 0:e.clientHeight;return!o||50>o?0:o*parseInt(t,10)/100}return window.innerHeight}return t};class wn{constructor(){this.lastHeadersRef=null,this.lastRowsRef=null,this.flattenedRowsCache=null,this.lastProcessedResult=null,this.tableRenderer=new un}getCachedFlattenResult(){var t,e;return null!==(e=null===(t=this.flattenedRowsCache)||void 0===t?void 0:t.flattenResult)&&void 0!==e?e:null}getLastProcessedResult(){return this.lastProcessedResult}invalidateCache(t){this.tableRenderer.invalidateCache(t),t&&"all"!==t&&"body"!==t||(this.flattenedRowsCache=null,this.lastProcessedResult=null)}computeEffectiveHeaders(t,e,n,o){var s;let i=[...t];return e.enableRowSelection&&!(null===(s=null==t?void 0:t[0])||void 0===s?void 0:s.isSelectionColumn)&&(i=[{accessor:"__row_selection__",label:"",width:n.selectionColumnWidth,isEditable:!1,type:"boolean",pinned:"left",isSelectionColumn:!0,isSortable:!1,filterable:!1,align:"center"},...i]),null!=o&&o>0?C(i,{containerWidth:o}):C(i)}render(t,e,n,o,s){var i,r,l,a,d,c,h,u,f,w,v,m,g,x,b,y,R,C,S,I,H,M,k;if(this.lastHeadersRef!==n.headers&&(this.invalidateCache("header"),this.invalidateCache("context"),this.lastHeadersRef=n.headers),!n.dimensionManager)return;const E=null!==(c=null!==(l=null===(r=null===(i=n.mainBodyRef)||void 0===i?void 0:i.current)||void 0===r?void 0:r.scrollLeft)&&void 0!==l?l:null===(d=null===(a=n.mainHeaderRef)||void 0===a?void 0:a.current)||void 0===d?void 0:d.scrollLeft)&&void 0!==c?c:0,O=n.dimensionManager.getState(),{containerWidth:T,calculatedHeaderHeight:A,maxHeaderDepth:P}=O;let $=this.computeEffectiveHeaders(n.headers,n.config,n.customTheme,T);const{leftWidth:D,rightWidth:F}=me({headers:$,containerWidth:T,collapsedHeaders:n.collapsedHeaders});n.config.autoExpandColumns&&T>0&&($=W($,{autoExpandColumns:!0,containerWidth:T,pinnedLeftWidth:D,pinnedRightWidth:F,mainBodyRef:null!==(h=n.mainBodyRef)&&void 0!==h?h:{current:null},isResizing:null!==(u=n.isResizing)&&void 0!==u&&u}));const{mainWidth:L,leftWidth:j,rightWidth:N,leftContentWidth:z,rightContentWidth:V}=me({headers:$,containerWidth:T,collapsedHeaders:n.collapsedHeaders}),q=T-j-N,G=t=>"number"==typeof t?t+"px":t,U=t.rootElement.style;if(n.config.maxHeight){const t=G(n.config.maxHeight);U.maxHeight=t,U.height=void 0===O.contentHeight?"auto":t}else U.removeProperty("max-height"),n.config.height?U.height=G(n.config.height):U.removeProperty("height");const{customTheme:K}=n;U.setProperty("--st-main-section-width",q+"px"),U.setProperty("--st-scrollbar-width",o.scrollbarWidth+"px"),U.setProperty("--st-editor-width",(n.config.editColumns?29.5:0)+"px"),U.setProperty("--st-border-width",K.borderWidth+"px"),U.setProperty("--st-footer-height",K.footerHeight+"px");const Y=null!==(f=n.config.columnResizing)&&void 0!==f&&f;t.content.className="st-content "+(Y?"st-resizeable":"st-not-resizeable"),t.content.style.width=n.config.editColumns?"calc(100% - 29.5px)":"100%";let _=n.localRows;if(n.sortManager?_=n.sortManager.getSortedRows():n.filterManager&&(_=n.filterManager.getFilteredRows()),this.lastRowsRef!==_&&(this.invalidateCache("body"),this.invalidateCache("context"),this.lastRowsRef=_),n.internalIsLoading&&0===_.length){let t=n.config.shouldPaginate&&null!==(w=n.config.rowsPerPage)&&void 0!==w?w:10;o.isMainSectionScrollable&&(t+=1),_=Array.from({length:t},()=>({}))}const X=null===(v=n.sortManager)||void 0===v?void 0:v.getState(),tt=null===(m=n.filterManager)||void 0===m?void 0:m.getState(),et=(null==X?void 0:X.sort)?`${X.sort.key.accessor}-${X.sort.direction}`:"none",nt=JSON.stringify((null==tt?void 0:tt.filters)||{}),ot=n.config.quickFilter,st=ot?`${null!==(g=ot.text)&&void 0!==g?g:""}|${null!==(x=ot.mode)&&void 0!==x?x:"simple"}`:"";let it,rt,lt;this.flattenedRowsCache&&this.flattenedRowsCache.deps.rowsRef===_&&this.flattenedRowsCache.deps.quickFilterKey===st&&this.flattenedRowsCache.deps.expandedRowsSize===n.expandedRows.size&&this.flattenedRowsCache.deps.collapsedRowsSize===n.collapsedRows.size&&this.flattenedRowsCache.deps.expandedDepthsSize===n.expandedDepths.size&&this.flattenedRowsCache.deps.rowStateMapSize===n.rowStateMap.size&&this.flattenedRowsCache.deps.sortKey===et&&this.flattenedRowsCache.deps.filterKey===nt&&this.flattenedRowsCache?(it=this.flattenedRowsCache.aggregatedRows,rt=this.flattenedRowsCache.quickFilteredRows,lt=this.flattenedRowsCache.flattenResult):(it=n.sortManager?_:B({rows:_,headers:n.headers,rowGrouping:n.config.rowGrouping}),rt=(({rows:t,headers:e,quickFilter:n})=>{if(!n||!n.text||""===n.text.trim())return t;const{text:o,columns:s,caseSensitive:i=!1,mode:r="simple",useFormattedValue:l=!0}=n,a=e.filter(t=>!t.hide&&!t.excludeFromRender&&(s&&s.length>0?s.includes(t.accessor):!1!==t.quickFilterable)),d="smart"===r?(t=>{const e=[];let n=0;for(;t.length>n;){for(;t.length>n&&/\s/.test(t[n]);)n++;if(n>=t.length)break;if("-"===t[n]){n++;const o=n;for(;t.length>n&&!/\s/.test(t[n]);)n++;const s=t.substring(o,n);s&&e.push({type:"negation",value:s});continue}if('"'===t[n]){n++;const o=n;for(;t.length>n&&'"'!==t[n];)n++;const s=t.substring(o,n);s&&e.push({type:"phrase",value:s}),t.length>n&&'"'===t[n]&&n++;continue}const o=n;for(;t.length>n&&!/[\s:]/.test(t[n]);)n++;const s=t.substring(o,n);if(t.length>n&&":"===t[n]){n++;const o=n;for(;t.length>n&&!/\s/.test(t[n]);)n++;const i=t.substring(o,n);i&&e.push({type:"columnSpecific",value:i,column:s});continue}s&&e.push({type:"word",value:s})}return e})(o):null;return t.filter(t=>{if("smart"===r&&d){const e=new Set,n=new Map;d.forEach((t,e)=>{"columnSpecific"===t.type&&t.column&&(n.has(t.column)||n.set(t.column,[]),n.get(t.column).push(e))});const o=[];a.forEach(s=>{try{let r;if(s.quickFilterGetter)r=s.quickFilterGetter({row:t,accessor:s.accessor});else{const e=p(t,s.accessor);if(l&&s.valueFormatter){const n=s.valueFormatter({accessor:s.accessor,colIndex:0,row:t,rowIndex:0,value:e});r=Array.isArray(n)?n.join(" "):n+""}else r=null==e?"":Array.isArray(e)?e.join(" "):e+""}o.push(r);const a=n.get(s.accessor);a&&a.forEach(t=>{const n=d[t],o=i?r:r.toLowerCase(),s=i?n.value:n.value.toLowerCase();o.includes(s)&&e.add(t)})}catch(t){console.warn(`Quick filter error for column ${s.accessor}:`,t)}});const s=i?o.join(" "):o.join(" ").toLowerCase();return d.forEach((t,n)=>{if("columnSpecific"===t.type)return;const o=i?t.value:t.value.toLowerCase();switch(t.type){case"word":case"phrase":s.includes(o)&&e.add(n);break;case"negation":s.includes(o)||e.add(n)}}),e.size===d.length}return a.some(e=>{try{let n;if(e.quickFilterGetter)n=e.quickFilterGetter({row:t,accessor:e.accessor});else{const o=p(t,e.accessor);if(l&&e.valueFormatter){const s=e.valueFormatter({accessor:e.accessor,colIndex:0,row:t,rowIndex:0,value:o});n=Array.isArray(s)?s.join(" "):s+""}else n=null==o?"":Array.isArray(o)?o.join(" "):o+""}return((t,e,n)=>{if(!e)return!0;const o=n?t:t.toLowerCase(),s=n?e:e.toLowerCase();return o.includes(s)})(n,o,i)}catch(t){return console.warn(`Quick filter error for column ${e.accessor}:`,t),!1}})})})({rows:it,headers:$,quickFilter:n.config.quickFilter}),lt=pn({rows:rt,rowGrouping:n.config.rowGrouping,getRowId:n.config.getRowId,expandedRows:n.expandedRows,collapsedRows:n.collapsedRows,expandedDepths:n.expandedDepths,rowStateMap:n.rowStateMap,hasLoadingRenderer:!!n.config.loadingStateRenderer,hasErrorRenderer:!!n.config.errorStateRenderer,hasEmptyRenderer:!!n.config.emptyStateRenderer,headers:$,rowHeight:n.customTheme.rowHeight,headerHeight:n.customTheme.headerHeight,customTheme:n.customTheme}),this.flattenedRowsCache={aggregatedRows:it,quickFilteredRows:rt,flattenResult:lt,deps:{rowsRef:_,quickFilterKey:st,expandedRowsSize:n.expandedRows.size,collapsedRowsSize:n.collapsedRows.size,expandedDepthsSize:n.expandedDepths.size,rowStateMapSize:n.rowStateMap.size,sortKey:et,filterKey:nt}});const at=(({height:t,maxHeight:e,rowHeight:n,totalRowCount:o,headerHeight:s,footerHeight:i})=>{if(e){const t=fn(e);if(0===t)return;const r=s||n;if(t>=r+o*n+(i||0)||20>o)return;return Math.max(0,t-r)}if(!t)return;const r=fn(t);return 0!==r?Math.max(0,r-n):void 0})({height:n.config.height,maxHeight:n.config.maxHeight,rowHeight:n.customTheme.rowHeight,shouldPaginate:null!==(b=n.config.shouldPaginate)&&void 0!==b&&b,rowsPerPage:null!==(y=n.config.rowsPerPage)&&void 0!==y?y:10,totalRowCount:null!==(R=n.config.totalRowCount)&&void 0!==R?R:lt.paginatableRows.length,headerHeight:A,footerHeight:!n.config.shouldPaginate&&!n.config.footerRenderer||n.config.hideFooter?void 0:n.customTheme.footerHeight}),dt=function(t){const{contentHeight:e,currentPage:n,customTheme:o,enableStickyParents:s,flattenedRows:i,heightOffsets:r,parentEndPositions:l,rowHeight:a,rowsPerPage:d,scrollDirection:c="none",scrollTop:h,serverSidePagination:u,shouldPaginate:p,rowGrouping:f}=t,w=(t=>Math.ceil(800/(t+1)))(a),v=function(t,e,n,o,s,i){if(!s||i)return t.map((t,e)=>Object.assign(Object.assign({},t),{position:e,absoluteRowIndex:e}));const r=(n-1)*o,l=n*o,a=0===r?0:e[r-1];return t.slice(a,l>e.length?t.length:e[l-1]).map((t,e)=>{const n=t.nestedTable?t.absoluteRowIndex:s&&!i?a+e:e;return Object.assign(Object.assign({},t),{position:e,absoluteRowIndex:n})})}(i,l,n,d,p,u),m=r&&0!==r.length&&p&&!u?(()=>{const t=new Map;return v.forEach(e=>{e.nestedTable&&t.set(e.absoluteRowIndex,e.position)}),r.filter(([e])=>t.has(e)).map(([e,n])=>[t.get(e),n])})():r,g=m&&m.length>0?((t,e,n,o)=>{const s=e+o.rowSeparatorWidth,i=Array(t),r=new Map;n&&n.forEach(([t,e])=>{r.set(t,e)});let l=0;for(let e=0;t>e;e++){i[e]=l,l+=s;const t=r.get(e);void 0!==t&&(l+=t)}return{rowTopPositions:i,totalHeight:l-o.rowSeparatorWidth}})(v.length,a,m,o):void 0;let x,b=0,y=v.length;if(void 0===e)x=v;else{const t=J({bufferRowCount:w,contentHeight:e,tableRows:v,rowHeight:a,scrollTop:h,scrollDirection:c,heightMap:g});x=t.rendered.rows,b=t.rendered.startIndex,y=t.rendered.endIndex}const{stickyParents:R,regularRows:C,partiallyVisibleRows:S}=s&&void 0!==e?(()=>{const t=J({bufferRowCount:w,contentHeight:e,tableRows:v,rowHeight:a,scrollTop:h,scrollDirection:c,heightMap:g}),n=f?((t,e,n,o,s)=>{var i,r,l,a,d,c;const h=null!==(r=null===(i=o[0])||void 0===i?void 0:i.position)&&void 0!==r?r:-1,u=null!==(a=null===(l=e[0])||void 0===l?void 0:l.position)&&void 0!==a?a:-1,p=null!==(c=null===(d=e[e.length-1])||void 0===d?void 0:d.position)&&void 0!==c?c:-1,f=`${h}:${u}:${p}:${s.join(",")}`,w=Q.get(f);if(w&&w.firstVisiblePosition===h&&w.renderedStartPosition===u&&w.renderedEndPosition===p)return w.result;const v=Z({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:o,partiallyVisibleRowIndex:0,recursionDepth:0,stickyParents:[],rowGrouping:s});if(Q.set(f,{result:v,firstVisiblePosition:h,renderedStartPosition:u,renderedEndPosition:p}),Q.size>50){const t=Q.keys().next().value;void 0!==t&&Q.delete(t)}return v})(v,t.rendered.rows,t.fullyVisible.rows,t.partiallyVisible.rows,f):{stickyParents:[],regularRows:t.rendered.rows,partiallyVisibleRows:[]};return Object.assign(Object.assign({},n),{partiallyVisibleRows:t.partiallyVisible.rows})})():{stickyParents:[],regularRows:x,partiallyVisibleRows:[]};return{currentTableRows:v,rowsToRender:x,renderedStartIndex:b,renderedEndIndex:y,stickyParents:R,regularRows:C,partiallyVisibleRows:S,paginatedHeightOffsets:m,heightMap:g}}({flattenedRows:lt.flattenedRows,paginatableRows:lt.paginatableRows,parentEndPositions:lt.parentEndPositions,currentPage:o.currentPage,rowsPerPage:null!==(C=n.config.rowsPerPage)&&void 0!==C?C:10,shouldPaginate:null!==(S=n.config.shouldPaginate)&&void 0!==S&&S,serverSidePagination:null!==(I=n.config.serverSidePagination)&&void 0!==I&&I,contentHeight:at,rowHeight:n.customTheme.rowHeight,scrollTop:o.scrollTop,scrollDirection:o.scrollDirection,heightOffsets:lt.heightOffsets,customTheme:n.customTheme,enableStickyParents:null!==(H=n.config.enableStickyParents)&&void 0!==H&&H,rowGrouping:n.config.rowGrouping});this.lastProcessedResult=dt,null===(M=n.rowSelectionManager)||void 0===M||M.updateConfig({tableRows:dt.currentTableRows}),this.renderHeader(t.headerContainer,A,P,$,n),this.renderBody(t.bodyContainer,dt,$,n),this.registerSectionPanes(n);const ct=n.sectionScrollController;ct&&(ct.setSectionScrollLeft("main",E),null!=n.pinnedLeftRef.current&&ct.setSectionScrollLeft("pinned-left",n.pinnedLeftRef.current.scrollLeft),null!=n.pinnedRightRef.current&&ct.setSectionScrollLeft("pinned-right",n.pinnedRightRef.current.scrollLeft),ct.restoreAll()),this.renderFooter(t.footerContainer,null!==(k=n.config.totalRowCount)&&void 0!==k?k:lt.paginatableRows.length,o.currentPage,$,n),this.renderColumnEditor(t.contentWrapper,o.columnEditorOpen,s,$,n),this.renderHorizontalScrollbar(t.wrapperContainer,L,j,N,z,V,e.tableBodyContainerRef.current,$,n)}renderHeader(t,e,n,o,s){if(s.config.hideHeader)return;const i=this.buildRendererDeps(o,s);this.tableRenderer.renderHeader(t,e,n,i)}renderBody(t,e,n,o){const s=this.buildRendererDeps(n,o);this.tableRenderer.renderBody(t,e,s)}renderFooter(t,e,n,o,s){const i=this.buildRendererDeps(o,s);this.tableRenderer.renderFooter(t,e,n,t=>{s.setCurrentPage(t),s.onRender()},i)}renderColumnEditor(t,e,n,o,s){const i=this.buildRendererDeps(o,s);this.tableRenderer.renderColumnEditor(t,e,t=>{s.setColumnEditorOpen(t),s.onRender()},n,i)}renderHorizontalScrollbar(t,e,n,o,s,i,r,l,a){if(!a.mainBodyRef.current||!r)return;const d=this.buildRendererDeps(l,a);this.tableRenderer.renderHorizontalScrollbar(t,e,n,o,s,i,r,d)}registerSectionPanes(t){const e=t.sectionScrollController;e&&(t.pinnedLeftHeaderRef.current&&e.registerPane("pinned-left",t.pinnedLeftHeaderRef.current,"header"),t.pinnedLeftRef.current&&e.registerPane("pinned-left",t.pinnedLeftRef.current,"body"),t.mainHeaderRef.current&&e.registerPane("main",t.mainHeaderRef.current,"header"),t.mainBodyRef.current&&e.registerPane("main",t.mainBodyRef.current,"body"),t.pinnedRightHeaderRef.current&&e.registerPane("pinned-right",t.pinnedRightHeaderRef.current,"header"),t.pinnedRightRef.current&&e.registerPane("pinned-right",t.pinnedRightRef.current,"body"))}buildRendererDeps(t,e){return{config:e.config,customTheme:e.customTheme,resolvedIcons:e.resolvedIcons,effectiveHeaders:t,headers:e.headers,localRows:e.localRows,collapsedHeaders:e.collapsedHeaders,collapsedRows:e.collapsedRows,expandedRows:e.expandedRows,expandedDepths:e.expandedDepths,isResizing:e.isResizing,internalIsLoading:e.internalIsLoading,cellRegistry:e.cellRegistry,headerRegistry:e.headerRegistry,draggedHeaderRef:e.draggedHeaderRef,hoveredHeaderRef:e.hoveredHeaderRef,mainBodyRef:e.mainBodyRef,pinnedLeftRef:e.pinnedLeftRef,pinnedRightRef:e.pinnedRightRef,mainHeaderRef:e.mainHeaderRef,pinnedLeftHeaderRef:e.pinnedLeftHeaderRef,pinnedRightHeaderRef:e.pinnedRightHeaderRef,dimensionManager:e.dimensionManager,sectionScrollController:e.sectionScrollController,sortManager:e.sortManager,filterManager:e.filterManager,selectionManager:e.selectionManager,rowSelectionManager:e.rowSelectionManager,rowStateMap:e.rowStateMap,onRender:e.onRender,setIsResizing:e.setIsResizing,setHeaders:e.setHeaders,setCollapsedHeaders:e.setCollapsedHeaders,setCollapsedRows:e.setCollapsedRows,setExpandedRows:e.setExpandedRows,setRowStateMap:e.setRowStateMap,getCollapsedRows:e.getCollapsedRows,getCollapsedHeaders:e.getCollapsedHeaders,getExpandedRows:e.getExpandedRows,getHeaders:e.getHeaders,getRowStateMap:e.getRowStateMap,positionOnlyBody:e.positionOnlyBody,essentialAccessors:e.essentialAccessors}}cleanup(){this.tableRenderer.cleanup()}}const vn=t=>{if(null==t)return"";const e=t+"";return e.includes(",")||e.includes('"')||e.includes("\n")||e.includes("\r")?`"${e.replace(/"/g,'""')}"`:e};class mn{static createAPI(t){const e=()=>{var e;return(null===(e=t.getCachedFlattenResult)||void 0===e?void 0:e.call(t))||pn({rows:t.localRows,rowGrouping:t.config.rowGrouping,getRowId:t.config.getRowId,expandedRows:t.expandedRows,collapsedRows:t.collapsedRows,expandedDepths:t.expandedDepths,rowStateMap:t.rowStateMap,hasLoadingRenderer:!!t.config.loadingStateRenderer,hasErrorRenderer:!!t.config.errorStateRenderer,hasEmptyRenderer:!!t.config.emptyStateRenderer,headers:t.effectiveHeaders,rowHeight:t.customTheme.rowHeight,headerHeight:t.customTheme.headerHeight,customTheme:t.customTheme})};return{updateData:e=>{var n;const{rowIndex:o,accessor:s,newValue:i}=e;if(o>=0&&t.localRows.length>o){t.localRows[o][s]=i;const e=[o],r=`${(t.config.getRowId?[o,t.config.getRowId({row:t.localRows[o],depth:0,index:o,rowPath:e,rowIndexPath:e})]:[o]).join("-")}-${s}`,l=null===(n=t.cellRegistry)||void 0===n?void 0:n.get(r);l?l.updateContent(i):t.onRender()}},setHeaderRename:e=>{const n=t.headerRegistry.get(e.accessor);n&&n.setEditing(!0)},getVisibleRows:()=>{var n;const o=null===(n=t.getCachedProcessedResult)||void 0===n?void 0:n.call(t);return o?o.rowsToRender:e().flattenedRows},getAllRows:()=>e().flattenedRows,getHeaders:()=>t.effectiveHeaders,exportToCSV:n=>{var o;((t,e,n,o=!0)=>{((t,e="table-export.csv")=>{const n=new Blob([t],{type:"text/csv;charset=utf-8;"}),o=document.createElement("a"),s=URL.createObjectURL(n);o.setAttribute("href",s),o.setAttribute("download",e),o.style.visibility="hidden",document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(s)})(((t,e,n=!0)=>{const o=(t=>{const e=[],n=t=>{for(const o of t)o.hide||o.isSelectionColumn||o.excludeFromCsv||(o.children&&o.children.length>0?(o.singleRowChildren&&e.push(o),n(o.children)):e.push(o))};return n(t),e})(e),s=o.map(t=>vn(t.label)).join(","),i=t.map((t,e)=>{const n=t.row;return o.map((t,o)=>{const s=p(n,t.accessor);if(t.exportValueGetter){const i=t.valueFormatter?t.valueFormatter({accessor:t.accessor,colIndex:o,row:n,rowIndex:e,value:s}):void 0,r=t.exportValueGetter({accessor:t.accessor,colIndex:o,row:n,rowIndex:e,value:s,formattedValue:i});return vn(r)}if(!1!==t.useFormattedValueForCSV&&t.valueFormatter){const i=t.valueFormatter({accessor:t.accessor,colIndex:o,row:n,rowIndex:e,value:s});return vn(i)}return vn(s)}).join(",")});return(n?[s,...i]:i).join("\n")})(t,e,o),n)})(e().flattenedRows,t.effectiveHeaders,null==n?void 0:n.filename,null===(o=t.config.includeHeadersInCSVExport)||void 0===o||o)},getSortState:()=>{var e,n;return null!==(n=null===(e=t.sortManager)||void 0===e?void 0:e.getSortColumn())&&void 0!==n?n:null},applySortState:async e=>{t.sortManager&&t.sortManager.updateSort(e)},getPinnedState:()=>kt(t.headers),applyPinnedState:async e=>{const n=Ot(t.headers,e,t.essentialAccessors);n&&(t.setHeaders(n),t.onRender())},resetColumns:()=>{t.setHeaders(wt(t.config.defaultHeaders)),t.onRender()},getFilterState:()=>{var e,n;return null!==(n=null===(e=t.filterManager)||void 0===e?void 0:e.getFilters())&&void 0!==n?n:{}},applyFilter:async e=>{t.filterManager&&t.filterManager.updateFilter(e)},clearFilter:async e=>{t.filterManager&&t.filterManager.clearFilter(e)},clearAllFilters:async()=>{t.filterManager&&t.filterManager.clearAllFilters()},getCurrentPage:()=>t.getCurrentPage(),getTotalPages:()=>{var n,o;const s=null!==(n=t.config.totalRowCount)&&void 0!==n?n:e().paginatableRows.length;return Math.ceil(s/(null!==(o=t.config.rowsPerPage)&&void 0!==o?o:10))},setPage:async n=>{var o,s;const i=null!==(o=t.config.totalRowCount)&&void 0!==o?o:e().paginatableRows.length,r=null!==(s=t.config.rowsPerPage)&&void 0!==s?s:10;1>n||n>Math.ceil(i/r)||(t.setCurrentPage(n),t.onRender(),t.config.onPageChange&&await t.config.onPageChange(n))},expandAll:()=>{var e;null===(e=t.expandedDepthsManager)||void 0===e||e.expandAll()},collapseAll:()=>{var e;null===(e=t.expandedDepthsManager)||void 0===e||e.collapseAll()},expandDepth:e=>{var n;null===(n=t.expandedDepthsManager)||void 0===n||n.expandDepth(e)},collapseDepth:e=>{var n;null===(n=t.expandedDepthsManager)||void 0===n||n.collapseDepth(e)},toggleDepth:e=>{var n;null===(n=t.expandedDepthsManager)||void 0===n||n.toggleDepth(e)},setExpandedDepths:e=>{t.expandedDepths=e,t.onRender()},getExpandedDepths:()=>{var e,n;return null!==(n=null===(e=t.expandedDepthsManager)||void 0===e?void 0:e.getExpandedDepths())&&void 0!==n?n:t.expandedDepths},getGroupingProperty:e=>{var n;return null===(n=t.config.rowGrouping)||void 0===n?void 0:n[e]},getGroupingDepth:e=>{var n,o;return null!==(o=null===(n=t.config.rowGrouping)||void 0===n?void 0:n.indexOf(e))&&void 0!==o?o:-1},toggleColumnEditor:e=>{t.config.editColumns&&(t.setColumnEditorOpen(void 0!==e?e:!t.columnEditorOpen),t.onRender())},applyColumnVisibility:async e=>{const n=o=>o.map(o=>{const s=o.accessor+"";let i=s in e?!e[s]:o.hide;return St(o,t.essentialAccessors)&&(i=!1),Object.assign(Object.assign({},o),{hide:i,children:o.children?n(o.children):o.children})});t.setHeaders(n(t.headers)),t.onRender(),t.config.onColumnVisibilityChange&&t.config.onColumnVisibilityChange(e)},setQuickFilter:e=>{var n;(null===(n=t.config.quickFilter)||void 0===n?void 0:n.onChange)&&t.config.quickFilter.onChange(e)},getSelectedCells:()=>{var e;return(null===(e=t.selectionManager)||void 0===e?void 0:e.getSelectedCells())||new Set},clearSelection:()=>{var e;null===(e=t.selectionManager)||void 0===e||e.clearSelection()},selectCell:e=>{var n;null===(n=t.selectionManager)||void 0===n||n.selectSingleCell(e)},selectCellRange:(e,n)=>{var o;null===(o=t.selectionManager)||void 0===o||o.selectCellRange(e,n)}}}}class gn{constructor(t,e){var n,o;this.draggedHeaderRef={current:null},this.hoveredHeaderRef={current:null},this.localRows=[],this.headers=[],this.essentialAccessors=new Set,this.currentPage=1,this.scrollTop=0,this.scrollDirection="none",this.isResizing=!1,this.isScrolling=!1,this._positionOnlyBody=!1,this.firstRenderDone=!1,this.internalIsLoading=!1,this.scrollbarWidth=0,this.isMainSectionScrollable=!1,this.columnEditorOpen=!1,this.collapsedHeaders=new Set,this.expandedDepths=new Set,this.expandedRows=new Map,this.collapsedRows=new Map,this.rowStateMap=new Map,this.announcement="",this.cellRegistry=new Map,this.headerRegistry=new Map,this.rowIndexMap=new Map,this.autoScaleManager=null,this.dimensionManager=null,this.scrollManager=null,this.sectionScrollController=null,this.sortManager=null,this.filterManager=null,this.selectionManager=null,this.rowSelectionManager=null,this.windowResizeManager=null,this.handleOutsideClickManager=null,this.scrollbarVisibilityManager=null,this.expandedDepthsManager=null,this.ariaAnnouncementManager=null,this.mounted=!1,this.scrollRafId=null,this.scrollEndTimeoutId=null,this.lastScrollTop=0,this.isUpdating=!1,this.container=t,this.config=e,this.customTheme=At.mergeCustomTheme(e),this.mergedColumnEditorConfig=At.mergeColumnEditorConfig(e),this.resolvedIcons=At.resolveIcons(e),this.localRows=[...e.rows],this.headers=[...e.defaultHeaders],this.essentialAccessors=At.buildEssentialAccessors(this.headers),this.columnEditorOpen=null!==(n=e.editColumnsInitOpen)&&void 0!==n&&n,this.internalIsLoading=null!==(o=e.isLoading)&&void 0!==o&&o,this.collapsedHeaders=At.getInitialCollapsedHeaders(e.defaultHeaders),this.expandedDepths=At.getInitialExpandedDepths(e),this.domManager=new Wt,this.renderOrchestrator=new wn,this.rebuildRowIndexMap(),this.initializeManagers()}rebuildRowIndexMap(){this.rowIndexMap.clear(),this.localRows.forEach((t,e)=>{const n=v({row:t,getRowId:this.config.getRowId,depth:0,index:e,rowPath:[e],rowIndexPath:[e]}),o=m(n);this.rowIndexMap.set(o,e)})}initializeManagers(){var t,e,n;this.ariaAnnouncementManager=new pt,this.ariaAnnouncementManager.subscribe(t=>{this.announcement=t,this.updateAriaLiveRegion()}),this.expandedDepthsManager=new ut(null===(t=this.config.expandAll)||void 0===t||t,this.config.rowGrouping),this.expandedDepthsManager.subscribe(t=>{this.expandedDepths=t,this.render("expandedDepthsManager")});const o=t=>{this.ariaAnnouncementManager&&this.ariaAnnouncementManager.announce(t)};this.sortManager=new N({headers:this.headers,tableRows:this.localRows,externalSortHandling:this.config.externalSortHandling||!1,onSortChange:this.config.onSortChange,rowGrouping:this.config.rowGrouping,initialSortColumn:this.config.initialSortColumn,initialSortDirection:this.config.initialSortDirection,announce:o}),this.sortManager.subscribe(t=>{this.render("sortManager")}),this.filterManager=new G({rows:this.localRows,headers:this.headers,externalFilterHandling:this.config.externalFilterHandling||!1,onFilterChange:this.config.onFilterChange,announce:o}),this.filterManager.subscribe(t=>{this.sortManager&&this.sortManager.updateConfig({tableRows:t.filteredRows}),this.render("filterManager")}),this.selectionManager=new it({selectableCells:null!==(e=this.config.selectableCells)&&void 0!==e&&e,selectableColumns:null!==(n=this.config.selectableColumns)&&void 0!==n&&n,headers:this.headers,tableRows:[],onCellEdit:this.config.onCellEdit,cellRegistry:this.cellRegistry,collapsedHeaders:this.collapsedHeaders,rowHeight:this.customTheme.rowHeight,enableRowSelection:this.config.enableRowSelection,copyHeadersToClipboard:this.config.copyHeadersToClipboard,customTheme:this.customTheme,tableRoot:this.container,onSelectionDragEnd:()=>{this.renderOrchestrator.invalidateCache("context"),this.renderOrchestrator.invalidateCache("body"),this.render("selectionDragEnd")}})}mount(){this.mounted?console.warn("SimpleTableVanilla: Table is already mounted"):(this.domManager.createDOMStructure(this.container,this.config),this.mounted=!0,this.setupManagers())}setupManagers(){var t;const e=this.domManager.getRefs(),n=this.domManager.getElements();if(!e.tableBodyContainerRef.current||!n)return;this.scrollbarWidth=ft(e.tableBodyContainerRef.current);const o=this.renderOrchestrator.computeEffectiveHeaders(this.headers,this.config,this.customTheme);this.dimensionManager=new $({effectiveHeaders:o,headerHeight:this.customTheme.headerHeight,rowHeight:this.customTheme.rowHeight,height:this.config.height,maxHeight:this.config.maxHeight,totalRowCount:this.localRows.length,footerHeight:!this.config.shouldPaginate&&!this.config.footerRenderer||this.config.hideFooter?void 0:this.customTheme.footerHeight,containerElement:e.tableBodyContainerRef.current}),this.dimensionManager.subscribe(()=>{this.render("dimensionManager"),this.firstRenderDone||(this.firstRenderDone=!0,this.config.onGridReady&&this.config.onGridReady())}),this.scrollManager=new D({onLoadMore:this.config.onLoadMore,infiniteScrollThreshold:200}),this.scrollManager.subscribe(()=>{this.render("scrollManager")}),this.sectionScrollController=new F({onMainSectionScrollLeft:t=>{var e,n;const o=this.domManager.getRefs(),s=o.mainHeaderRef.current,i=o.mainBodyRef.current;null===(e=null==s?void 0:s.__renderHeaderCells)||void 0===e||e.call(s,t),null===(n=null==i?void 0:i.__renderBodyCells)||void 0===n||n.call(i,t)}}),this.config.autoExpandColumns&&(this.autoScaleManager=new P({autoExpandColumns:this.config.autoExpandColumns,containerWidth:this.dimensionManager.getState().containerWidth,pinnedLeftWidth:0,pinnedRightWidth:0,mainBodyRef:e.mainBodyRef,isResizing:this.isResizing},()=>{this.render("autoScaleManager")})),e.headerContainerRef.current&&e.tableBodyContainerRef.current&&(this.scrollbarVisibilityManager=new ct({headerContainer:e.headerContainerRef.current,mainSection:e.tableBodyContainerRef.current,scrollbarWidth:this.scrollbarWidth}),this.scrollbarVisibilityManager.subscribe(t=>{this.isMainSectionScrollable=t,this.render("scrollbarVisibilityManager")})),this.windowResizeManager=new at,this.windowResizeManager.addCallback(()=>{var t;if(e.tableBodyContainerRef.current){const n=ft(e.tableBodyContainerRef.current);this.scrollbarWidth=n,null===(t=this.scrollbarVisibilityManager)||void 0===t||t.setScrollbarWidth(n)}this.render("scrollbarWidth-change")}),this.config.enableRowSelection&&(this.rowSelectionManager=new lt({tableRows:[],onRowSelectionChange:this.config.onRowSelectionChange,enableRowSelection:!0}),this.rowSelectionManager.subscribe(()=>{this.render("rowSelectionManager")})),this.selectionManager&&(this.handleOutsideClickManager=new dt({selectableColumns:null!==(t=this.config.selectableColumns)&&void 0!==t&&t,selectedCells:new Set,selectedColumns:new Set,setSelectedCells:t=>this.selectionManager.setSelectedCells(t),setSelectedColumns:t=>this.selectionManager.setSelectedColumns(t),getSelectedCells:()=>this.selectionManager.getSelectedCells(),getSelectedColumns:()=>this.selectionManager.getSelectedColumns(),onClearSelection:()=>this.selectionManager.clearSelection()}),this.handleOutsideClickManager.startListening()),this.setupEventListeners()}setupEventListeners(){const t=this.domManager.getElements();(null==t?void 0:t.bodyContainer)&&(t.bodyContainer.addEventListener("scroll",this.handleScroll.bind(this)),t.bodyContainer.addEventListener("mouseleave",()=>{this.clearHoveredRows()}))}handleScroll(t){const e=t.currentTarget,n=e.scrollTop;this.isScrolling=!0,null!==this.scrollEndTimeoutId&&clearTimeout(this.scrollEndTimeoutId),this.scrollEndTimeoutId=window.setTimeout(()=>{this.isScrolling=!1,this.scrollEndTimeoutId=null,this.render("scroll-end")},150),null!==this.scrollRafId&&cancelAnimationFrame(this.scrollRafId),this.scrollRafId=requestAnimationFrame(()=>{const t=n>this.lastScrollTop?"down":this.lastScrollTop>n?"up":"none";this.scrollTop=n,this.scrollDirection=t,this.lastScrollTop=n,this.scrollManager&&this.scrollManager.handleScroll(n,e.scrollLeft,e.clientHeight,e.scrollHeight),this.render("scroll-raf"),this.scrollRafId=null})}clearHoveredRows(){document.querySelectorAll(".st-row.hovered").forEach(t=>{t.classList.remove("hovered")})}updateAriaLiveRegion(){const t=this.domManager.getElements();(null==t?void 0:t.ariaLiveRegion)&&(t.ariaLiveRegion.textContent=this.announcement)}getRenderContext(){const t=this.domManager.getRefs();return{config:this.config,customTheme:this.customTheme,resolvedIcons:this.resolvedIcons,effectiveHeaders:[],essentialAccessors:this.essentialAccessors,headers:this.headers,localRows:this.localRows,collapsedHeaders:this.collapsedHeaders,collapsedRows:this.collapsedRows,expandedRows:this.expandedRows,expandedDepths:this.expandedDepths,isResizing:this.isResizing,internalIsLoading:this.internalIsLoading,cellRegistry:this.cellRegistry,headerRegistry:this.headerRegistry,draggedHeaderRef:this.draggedHeaderRef,hoveredHeaderRef:this.hoveredHeaderRef,mainBodyRef:t.mainBodyRef,pinnedLeftRef:t.pinnedLeftRef,pinnedRightRef:t.pinnedRightRef,mainHeaderRef:t.mainHeaderRef,pinnedLeftHeaderRef:t.pinnedLeftHeaderRef,pinnedRightHeaderRef:t.pinnedRightHeaderRef,dimensionManager:this.dimensionManager,scrollManager:this.scrollManager,sectionScrollController:this.sectionScrollController,sortManager:this.sortManager,filterManager:this.filterManager,selectionManager:this.selectionManager,rowSelectionManager:this.rowSelectionManager,rowStateMap:this.rowStateMap,positionOnlyBody:this._positionOnlyBody,onRender:()=>this.render("resizeHandler-onRender"),setIsResizing:t=>{var e,n,o,s,i,r,l,a;if(this.isResizing=t,this.autoScaleManager&&!1===t){const t=this.domManager.getRefs(),d=null!==(a=null!==(r=null!==(o=null===(n=null===(e=t.tableBodyContainerRef)||void 0===e?void 0:e.current)||void 0===n?void 0:n.clientWidth)&&void 0!==o?o:null===(i=null===(s=t.mainBodyRef)||void 0===s?void 0:s.current)||void 0===i?void 0:i.clientWidth)&&void 0!==r?r:null===(l=this.dimensionManager)||void 0===l?void 0:l.getState().containerWidth)&&void 0!==a?a:0;this.autoScaleManager.updateConfig({isResizing:!1,containerWidth:d})}},setHeaders:t=>{this.headers=wt(t),this.renderOrchestrator.invalidateCache("header")},setCollapsedHeaders:t=>{this.collapsedHeaders=t},setCollapsedRows:t=>{this.collapsedRows="function"==typeof t?t(this.collapsedRows):t,this.render("expansion")},setExpandedRows:t=>{this.expandedRows="function"==typeof t?t(this.expandedRows):t,this.render("expansion")},setRowStateMap:t=>{this.rowStateMap="function"==typeof t?t(this.rowStateMap):t,this.render("rowStateMap")},getCollapsedRows:()=>this.collapsedRows,getCollapsedHeaders:()=>this.collapsedHeaders,getExpandedRows:()=>this.expandedRows,getHeaders:()=>this.headers,getRowStateMap:()=>this.rowStateMap,setColumnEditorOpen:t=>{this.columnEditorOpen=t},setCurrentPage:t=>{this.currentPage=t}}}getRenderState(){return{currentPage:this.currentPage,scrollTop:this.scrollTop,scrollDirection:this.scrollDirection,scrollbarWidth:this.scrollbarWidth,isMainSectionScrollable:this.isMainSectionScrollable,columnEditorOpen:this.columnEditorOpen}}render(t){if(!this.mounted)return;if(this.isUpdating&&"update"!==t)return;this._positionOnlyBody="scroll-raf"===t&&!0===this.isScrolling;const e=this.domManager.getElements(),n=this.domManager.getRefs();e&&this.renderOrchestrator.render(e,n,this.getRenderContext(),this.getRenderState(),this.mergedColumnEditorConfig)}update(e){var n,o,s;if(this.isUpdating=!0,this.config=Object.assign(Object.assign({},this.config),e),void 0!==e.rows&&(this.localRows=[...e.rows],this.rebuildRowIndexMap(),this.filterManager&&this.filterManager.updateConfig({rows:this.localRows}),this.sortManager&&this.sortManager.updateConfig({tableRows:this.localRows})),void 0!==e.defaultHeaders&&(this.headers=[...e.defaultHeaders],this.essentialAccessors=At.buildEssentialAccessors(this.headers),this.filterManager&&this.filterManager.updateConfig({headers:this.headers}),this.sortManager&&this.sortManager.updateConfig({headers:this.headers}),this.selectionManager&&this.selectionManager.updateConfig({headers:this.headers})),void 0!==e.isLoading&&(this.internalIsLoading=e.isLoading),void 0!==e.theme&&this.domManager.updateTheme(e.theme),void 0!==e.customTheme){const e=this.customTheme;this.customTheme=At.mergeCustomTheme(this.config),function(e,n){for(const o of Object.keys(t))if(e[o]!==n[o])return!1;return!0}(e,this.customTheme)||(this.selectionManager&&this.selectionManager.updateConfig({customTheme:this.customTheme,rowHeight:this.customTheme.rowHeight}),null===(n=this.dimensionManager)||void 0===n||n.updateConfig({headerHeight:this.customTheme.headerHeight,rowHeight:this.customTheme.rowHeight,footerHeight:!this.config.shouldPaginate&&!this.config.footerRenderer||this.config.hideFooter?void 0:this.customTheme.footerHeight}),this.config.shouldPaginate&&e.rowHeight!==this.customTheme.rowHeight&&(this.currentPage=1),this.renderOrchestrator.invalidateCache("all"))}void 0===e.selectableColumns&&void 0===e.selectableCells||!this.selectionManager||this.selectionManager.updateConfig({selectableColumns:null!==(o=this.config.selectableColumns)&&void 0!==o&&o,selectableCells:null!==(s=this.config.selectableCells)&&void 0!==s&&s}),this.isUpdating=!1,this.render("update")}updateConfig(t){this.update(t)}destroy(){var t,e,n,o,s,i,r,l,a,d,c,h,u;this.mounted=!1,this.firstRenderDone=!1,null!==this.scrollRafId&&(cancelAnimationFrame(this.scrollRafId),this.scrollRafId=null),null!==this.scrollEndTimeoutId&&(clearTimeout(this.scrollEndTimeoutId),this.scrollEndTimeoutId=null),null===(t=this.dimensionManager)||void 0===t||t.destroy(),null===(e=this.scrollManager)||void 0===e||e.destroy(),null===(n=this.sectionScrollController)||void 0===n||n.destroy(),null===(o=this.sortManager)||void 0===o||o.destroy(),null===(s=this.filterManager)||void 0===s||s.destroy(),null===(i=this.rowSelectionManager)||void 0===i||i.destroy(),null===(r=this.selectionManager)||void 0===r||r.destroy(),null===(l=this.autoScaleManager)||void 0===l||l.destroy(),null===(a=this.windowResizeManager)||void 0===a||a.destroy(),null===(d=this.handleOutsideClickManager)||void 0===d||d.destroy(),null===(c=this.scrollbarVisibilityManager)||void 0===c||c.destroy(),null===(h=this.expandedDepthsManager)||void 0===h||h.destroy(),null===(u=this.ariaAnnouncementManager)||void 0===u||u.destroy(),this.renderOrchestrator.cleanup(),this.domManager.destroy(this.container)}getAPI(){const t=this.renderOrchestrator.computeEffectiveHeaders(this.headers,this.config,this.customTheme),e=this;return mn.createAPI({config:this.config,localRows:this.localRows,effectiveHeaders:t,get headers(){return e.headers},essentialAccessors:this.essentialAccessors,customTheme:this.customTheme,currentPage:this.currentPage,getCurrentPage:()=>this.currentPage,expandedRows:this.expandedRows,collapsedRows:this.collapsedRows,expandedDepths:this.expandedDepths,rowStateMap:this.rowStateMap,headerRegistry:this.headerRegistry,cellRegistry:this.cellRegistry,columnEditorOpen:this.columnEditorOpen,getCachedFlattenResult:()=>this.renderOrchestrator.getCachedFlattenResult(),getCachedProcessedResult:()=>this.renderOrchestrator.getLastProcessedResult(),expandedDepthsManager:this.expandedDepthsManager,selectionManager:this.selectionManager,sortManager:this.sortManager,filterManager:this.filterManager,onRender:()=>this.render("columnEditor-onRender"),setHeaders:t=>{this.headers=wt(t),this.renderOrchestrator.invalidateCache("header")},setCurrentPage:t=>{this.currentPage=t},setColumnEditorOpen:t=>{this.columnEditorOpen=t,this.render("columnEditor-toggle")}})}}exports.SimpleTableVanilla=gn,exports.asRows=function(t){return t};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const t={rowHeight:32,headerHeight:32,footerHeight:49,rowSeparatorWidth:1,borderWidth:1,pinnedBorderWidth:1,nestedGridBorderWidth:2,nestedGridPaddingTop:8,nestedGridPaddingBottom:8,nestedGridPaddingLeft:8,nestedGridPaddingRight:8,nestedGridMaxHeight:400,selectionColumnWidth:42},e=29.5,n=150,o=["lineAreaChart","barChart"],i=40,s=(t,e,n)=>e&&n?480>t?.25:768>t?.3:.4:(t=>480>t?.4:768>t?.5:.6)(t),r="parentExpanded",l=(t,e)=>{if(!t.children||0===t.children.length)return[e];const n=[],o=(t,e)=>{if(!t.children||0===t.children.length)return n.push(e),e+1;let i=e;for(const e of t.children)i=o(e,i);return i};return o(t,e),n},d=t=>t.flatMap(t=>{const e=[t];return t.children&&t.children.length>0&&e.push(...d(t.children)),e}),a=(t=0)=>t?t+1:0,c=t=>{var e;return!(!(null===(e=t.children)||void 0===e?void 0:e.length)||!t.collapsible)},h=({accessor:t,rowId:e})=>`${e}-${t}`,u=({calculatedHeight:t,customHeight:e,customTheme:n})=>e?("string"==typeof e?parseFloat(e):e)+n.nestedGridPaddingTop+n.nestedGridPaddingBottom:t,p=t=>{const e=t.match(/^(.+?)\[(\d+)\]$/);return e?{key:e[1],index:parseInt(e[2],10)}:{key:t,index:null}},f=(t,e)=>{const n=e+"";return n.includes(".")||n.includes("[")?n.split(".").reduce((t,e)=>{if(null==t)return;const{key:n,index:o}=p(e);let i=t[n];return null!==o&&Array.isArray(i)&&(i=i[o]),i},t):t[e]},w=(t,e,n)=>{const o=e+"";if(!o.includes(".")&&!o.includes("["))return void(t[e]=n);const i=o.split(".");let s=t;for(let t=0;i.length-1>t;t++){const{key:e,index:n}=p(i[t]);if(null==s[e]){const n=p(i[t+1]);s[e]=null!==n.index?[]:{}}if(s=s[e],null!==n){if(!Array.isArray(s))throw Error(`Expected array at ${i.slice(0,t+1).join(".")}, but found ${typeof s}`);for(;n>=s.length;)s.push(null);null==s[n]&&(s[n]={}),s=s[n]}}const{key:r,index:l}=p(i[i.length-1]);if(null!==l){for(Array.isArray(s[r])||(s[r]=[]);l>=s[r].length;)s[r].push(null);s[r][l]=n}else s[r]=n},v=t=>Array.isArray(t)&&t.length>0&&"object"==typeof t[0]&&null!==t[0],m=t=>{const{getRowId:e,rowPath:n}=t,o=[...n];if(e){const n=e({row:t.row,depth:t.depth,index:t.index,rowPath:t.rowPath,rowIndexPath:t.rowIndexPath,groupingKey:t.groupingKey});o.push(n)}return o},g=t=>t.join("-"),b=(t,e,n,o,i)=>{const s=t+"",r=o.has(s)&&o.get(s)===e,l=i.has(s)&&i.get(s)===e;return n.has(e)?!l:r},x=(t,e)=>{if(t.hide)return[];if(!t.children||0===t.children.length)return[t];if(e&&e.has(t.accessor)){const n=t.children.filter(t=>{const e=t.showWhen||r;return"parentCollapsed"===e||"always"===e});return t.singleRowChildren?0===n.length?[t]:[t,...n.flatMap(t=>x(t,e))]:0===n.length?[t]:n.flatMap(t=>x(t,e))}const n=t.children.filter(t=>{const e=t.showWhen||r;return"parentExpanded"===e||"always"===e});return t.singleRowChildren?[t,...n.flatMap(t=>x(t,e))]:n.flatMap(t=>x(t,e))};function y(t){if(t.hide)return null;if("number"==typeof t.width)return{type:"px",value:t.width};if("string"!=typeof t.width)return null;const e=t.width.trim();return e.endsWith("px")?{type:"px",value:parseFloat(e)||0}:e.endsWith("fr")?{type:"fr",value:parseFloat(e)||1}:e.endsWith("%")?{type:"pct",value:parseFloat(e)||0}:null}function R(t){const e=[],n=t=>{t.hide||(t.children&&0!==t.children.length?t.children.forEach(n):e.push(t))};return t.forEach(n),e}function C(t,e){const o=t.map(t=>y(t)),i=o.reduce((t,e)=>"px"===(null==e?void 0:e.type)?t+e.value:t,0),s=o.reduce((t,e)=>"pct"===(null==e?void 0:e.type)?t+e.value:t,0),r=e*(s/100),l=o.reduce((t,e)=>"fr"===(null==e?void 0:e.type)?t+e.value:t,0),d=l>0?Math.max(0,e-i-r)/l:150,a=new Map;return t.forEach((t,i)=>{const s=o[i];if(s)if("px"===s.type)a.set(t.accessor,s.value);else if("fr"===s.type){const e=s.value*d,n="number"==typeof t.minWidth?t.minWidth:"string"==typeof t.minWidth&&parseFloat(t.minWidth+"")||0;a.set(t.accessor,n>0?Math.max(e,n):e)}else a.set(t.accessor,"pct"===s.type?e*s.value/100:n);else a.set(t.accessor,n)}),a}function S(t,e){const n="object"==typeof e&&null!=e?e.containerWidth:void 0;let o,i="number"==typeof e?e:void 0;if(null!=n&&n>0){const e=R(t);o=C(e,n)}else{const e=R(t),n=e.map(t=>y(t));let s=i;if(null==s||0>=s){const t=n.reduce((t,e)=>"px"===(null==e?void 0:e.type)?t+e.value:t,0),e=n.filter(t=>"fr"===(null==t?void 0:t.type)).length;s=t+(e>0?150*e:0)+(n.filter(t=>"pct"===(null==t?void 0:t.type)).length>0?160:0),s=Math.max(s,800)}o=C(e,s)}return t.map(function t(e){const n=Object.assign({},e);if(e.children&&e.children.length>0)return n.children=e.children.map(t),n;const i=o.get(e.accessor);return null!=i&&(n.width=i),n})}const I=t=>{if(t.hide)return 0;if("number"==typeof t.width)return t.width;if("string"==typeof t.width&&t.width.endsWith("px"))return parseFloat(t.width);{const e=document.getElementById(h({accessor:t.accessor,rowId:"header"}));return(null==e?void 0:e.offsetWidth)||n}},H=t=>{var e;const o=t.width;"string"==typeof o&&o.includes("fr")&&(t.width=(null===(e=document.getElementById(h({accessor:t.accessor,rowId:"header"})))||void 0===e?void 0:e.offsetWidth)||n),t.children&&t.children.length>0&&t.children.forEach(t=>{H(t)})},M=t=>"number"==typeof t.minWidth?t.minWidth:i,k=(t,e)=>{const n=[];return t.forEach(t=>{t.hide||n.push(...x(t,e))}),n},E=(t,e)=>{const{rows:s,header:r,maxWidth:l=500,sampleSize:d=50,styleRoot:a}=e||{},c=null!=a?a:document,u=document.getElementById(h({accessor:t,rowId:"header"}));if(!u)return n;const p=window.getComputedStyle(u),w=parseFloat(p.paddingLeft)||0,v=parseFloat(p.paddingRight)||0,m=parseFloat(p.gap)||0;let g=w+v;const b=u.querySelector(".st-header-label");if(b){const t=b.querySelector(".st-header-label-text");if(t){const e=document.createElement("span");e.style.visibility="hidden",e.style.position="absolute",e.style.whiteSpace="nowrap",e.style.width="auto";const n=window.getComputedStyle(t);e.style.font=n.font,e.style.fontSize=n.fontSize,e.style.fontWeight=n.fontWeight,e.style.fontFamily=n.fontFamily,e.style.letterSpacing=n.letterSpacing,e.style.padding=n.padding,e.textContent=t.textContent,document.body.appendChild(e);const o=e.offsetWidth;document.body.removeChild(e),g+=o}}const x=Array.from(u.children);let y=1;for(let t=0;x.length>t;t++){const e=x[t];if(e.classList.contains("st-header-label"))continue;if(e.classList.contains("st-sr-only"))continue;const n=window.getComputedStyle(e);"none"!==n.display&&(g+=(e.offsetWidth||0)+(parseFloat(n.marginLeft)||0)+(parseFloat(n.marginRight)||0),y++)}m>0&&y>1&&(g+=m*(y-1));let R=0;const C=r&&r.type&&o.includes(r.type);if(s&&s.length>0&&!C){const e=Math.min(s.length,d),n=document.createElement("div");n.style.visibility="hidden",n.style.position="absolute",n.style.whiteSpace="nowrap",n.style.width="auto";let o=0,i=0;const l=c.querySelector(".st-cell-content");if(l){const t=window.getComputedStyle(l);n.style.font=t.font,n.style.fontSize=t.fontSize,n.style.fontFamily=t.fontFamily,o=parseFloat(t.paddingLeft)||0,i=parseFloat(t.paddingRight)||0}document.body.appendChild(n);for(let l=0;e>l;l++){const e=s[l];let d;d=(null==r?void 0:r.valueGetter)?r.valueGetter({accessor:t,row:e,rowIndex:l}):f(e,t);let a=d;(null==r?void 0:r.valueFormatter)&&null!=d&&(a=r.valueFormatter({accessor:t,colIndex:0,row:e,rowIndex:l,value:d})),n.textContent=null!=a?a+"":"";const c=n.offsetWidth+o+i;c>R&&(R=c)}document.body.removeChild(n)}let S=Math.max(g,R);return C&&(S=Math.max(S,150)),S>l&&(S=l),Math.max(S+2,i)};class O{constructor(t){this.previousValue=t}update(t){const e=this.previousValue;return JSON.stringify(e)!==JSON.stringify(t)&&(this.previousValue=t),e}get(){return this.previousValue}set(t){this.previousValue=t}}const T=(t,e)=>{const n=[];return t.forEach(t=>{t.hide||(t.children&&t.children.length>0?n.push(...T(t.children,null!=e?e:t.pinned)):n.push(t))}),n},A=(t,e)=>e>=t.reduce((t,e)=>t+M(e),0),W=(t,e)=>{const n=new Map,o=t.reduce((t,e)=>t+("number"==typeof e.width?e.width:"string"==typeof e.width&&e.width.endsWith("px")?parseFloat(e.width):150),0);if(0===o)return n;const i=e/o;if(i>=1&&.01>i-1)return n;let s=0;return t.forEach((o,r)=>{const l="number"==typeof o.width?o.width:"string"==typeof o.width&&o.width.endsWith("px")?parseFloat(o.width):150;let d;r===t.length-1?d=e-s:(d=Math.round(l*i),s+=d),n.set(o.accessor,d)}),n},P=(t,e)=>{const{autoExpandColumns:n,containerWidth:o,pinnedLeftWidth:i,pinnedRightWidth:s,isResizing:r}=e;if(!n||0===o||r)return t;const l=Math.max(0,o-i-s),d=t.filter(t=>"left"===t.pinned),a=t.filter(t=>"right"===t.pinned),c=t.filter(t=>!t.pinned),h=T(d,"left"),u=T(a,"right"),p=T(c,void 0),f=h.length>0&&A(h,i),w=u.length>0&&A(u,s),v=p.length>0&&l>0&&A(p,l),m=new Map;if(f&&W(h,i).forEach((t,e)=>m.set(e,t)),w&&W(u,s).forEach((t,e)=>m.set(e,t)),v&&W(p,l).forEach((t,e)=>m.set(e,t)),0===m.size)return t;const g=(t,e)=>{var n;if(t.hide)return t;const o=null!=e?e:t.pinned,i=null===(n=t.children)||void 0===n?void 0:n.map(t=>g(t,o));if(!t.children||0===t.children.length){const e=m.get(t.accessor);return Object.assign(Object.assign({},t),void 0!==e?{width:e,children:i}:{children:i})}return Object.assign(Object.assign({},t),{children:i})};return t.map(t=>g(t,t.pinned))};class L{constructor(t,e){var n;this.config=t,this.onHeadersUpdate=e,this.isResizingTracker=new O(null!==(n=t.isResizing)&&void 0!==n&&n),this.containerWidthTracker=new O(t.containerWidth)}updateConfig(t){var e;this.config=Object.assign(Object.assign({},this.config),t);const n=null!==(e=this.config.isResizing)&&void 0!==e&&e,o=this.config.containerWidth,i=this.isResizingTracker.get();this.isResizingTracker.set(n);const s=this.containerWidthTracker.get();this.containerWidthTracker.set(o),i&&!n&&this.config.autoExpandColumns&&this.triggerAutoScale(),Math.abs(o-s)>10&&!n&&this.config.autoExpandColumns&&this.triggerAutoScale()}triggerAutoScale(){this.onHeadersUpdate&&this.onHeadersUpdate(this.config)}applyAutoScale(t){return P(t,this.config)}setHeaders(t,e){const n="function"==typeof t?t(e):t;return this.applyAutoScale(n)}destroy(){this.onHeadersUpdate=()=>{}}}class ${constructor(t){this.subscribers=new Set,this.resizeObserver=null,this.rafId=null,this.initialNotifyPending=!1,this.config=t;const e=this.calculateMaxHeaderDepth(),n=this.calculateHeaderHeight(e),o=this.calculateContentHeight();this.state={containerWidth:0,calculatedHeaderHeight:n,maxHeaderDepth:e,contentHeight:o},t.containerElement&&this.observeContainer(t.containerElement)}getHeaderDepth(t){var e,n;return t.singleRowChildren&&(null===(e=t.children)||void 0===e?void 0:e.length)?1:(null===(n=t.children)||void 0===n?void 0:n.length)?1+Math.max(...t.children.map(t=>this.getHeaderDepth(t))):1}calculateMaxHeaderDepth(){let t=0;return this.config.effectiveHeaders.forEach(e=>{const n=this.getHeaderDepth(e);t=Math.max(t,n)}),t}calculateHeaderHeight(t){var e;let n=1;if("undefined"!=typeof window){const t=document.documentElement,e=getComputedStyle(t).getPropertyValue("--st-border-width").trim();if(e){const t=parseFloat(e);isNaN(t)||(n=t)}}return t*(null!==(e=this.config.headerHeight)&&void 0!==e?e:this.config.rowHeight)+n}convertHeightToPixels(t){var e;const n=this.config.containerElement||document.querySelector(".simple-table-root");if("string"==typeof t){if(t.endsWith("px"))return parseInt(t,10);if(t.endsWith("vh"))return window.innerHeight*parseInt(t,10)/100;if(t.endsWith("%")){const o=null===(e=null==n?void 0:n.parentElement)||void 0===e?void 0:e.clientHeight;return!o||50>o?0:o*parseInt(t,10)/100}return window.innerHeight}return t}calculateContentHeight(){const{height:t,maxHeight:e,rowHeight:n,totalRowCount:o,headerHeight:i,footerHeight:s}=this.config;if(e){const t=this.convertHeightToPixels(e);if(0===t)return;const r=i||n;if(t>=r+o*n+(s||0)||20>o)return;return Math.max(0,t-r)}if(!t)return;const r=this.convertHeightToPixels(t);return 0!==r?Math.max(0,r-n):void 0}observeContainer(t){this.resizeObserver=new ResizeObserver(()=>{null!==this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=requestAnimationFrame(()=>{this.rafId=null;const e=t.clientWidth,n=e!==this.state.containerWidth;n&&(this.state=Object.assign(Object.assign({},this.state),{containerWidth:e})),(n||this.initialNotifyPending)&&(this.initialNotifyPending=!1,this.notifySubscribers())})}),this.resizeObserver.observe(t),this.applyContainerWidthSync(t)}applyContainerWidthSync(t){const e=t.clientWidth;e>0&&e!==this.state.containerWidth&&(this.state=Object.assign(Object.assign({},this.state),{containerWidth:e}),this.initialNotifyPending=!0)}updateConfig(t){const e=this.config.effectiveHeaders,n=this.config.containerElement;this.config=Object.assign(Object.assign({},this.config),t);let o=!1;if(t.effectiveHeaders&&t.effectiveHeaders!==e){const t=this.calculateMaxHeaderDepth(),e=this.calculateHeaderHeight(t);this.state=Object.assign(Object.assign({},this.state),{maxHeaderDepth:t,calculatedHeaderHeight:e}),o=!0}if(t.height||t.maxHeight||void 0!==t.totalRowCount){const t=this.calculateContentHeight();this.state=Object.assign(Object.assign({},this.state),{contentHeight:t}),o=!0}if(t.containerElement&&t.containerElement!==n&&(this.resizeObserver&&n&&this.resizeObserver.unobserve(n),this.observeContainer(t.containerElement),o=!0),void 0!==t.rowHeight||void 0!==t.headerHeight||void 0!==t.footerHeight){const t=this.calculateHeaderHeight(this.state.maxHeaderDepth),e=this.calculateContentHeight();this.state=Object.assign(Object.assign({},this.state),{calculatedHeaderHeight:t,contentHeight:e}),o=!0}o&&this.notifySubscribers()}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}notifySubscribers(){this.subscribers.forEach(t=>t(this.state))}getState(){return this.state}getContainerWidth(){return this.state.containerWidth}getCalculatedHeaderHeight(){return this.state.calculatedHeaderHeight}getMaxHeaderDepth(){return this.state.maxHeaderDepth}getContentHeight(){return this.state.contentHeight}destroy(){null!==this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.subscribers.clear()}}class D{constructor(t){this.subscribers=new Set,this.lastScrollTop=0,this.scrollTimeoutId=null,this.config=t,this.state={scrollTop:0,scrollLeft:0,scrollDirection:"none",isScrolling:!1}}updateConfig(t){this.config=Object.assign(Object.assign({},this.config),t)}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}notifySubscribers(){this.subscribers.forEach(t=>t(this.state))}handleScroll(t,e,n,o){const i=t>this.lastScrollTop?"down":this.lastScrollTop>t?"up":"none";this.lastScrollTop=t,this.state={scrollTop:t,scrollLeft:e,scrollDirection:i,isScrolling:!0},null!==this.scrollTimeoutId&&clearTimeout(this.scrollTimeoutId),this.scrollTimeoutId=window.setTimeout(()=>{this.state=Object.assign(Object.assign({},this.state),{isScrolling:!1}),this.notifySubscribers()},150),this.config.onLoadMore&&this.config.infiniteScrollThreshold&&this.config.infiniteScrollThreshold>o-(t+n)&&this.config.onLoadMore(),this.notifySubscribers()}setScrolling(t){this.state=Object.assign(Object.assign({},this.state),{isScrolling:t}),this.notifySubscribers()}getState(){return this.state}getScrollTop(){return this.state.scrollTop}getScrollLeft(){return this.state.scrollLeft}getScrollDirection(){return this.state.scrollDirection}isScrolling(){return this.state.isScrolling}destroy(){null!==this.scrollTimeoutId&&(clearTimeout(this.scrollTimeoutId),this.scrollTimeoutId=null),this.subscribers.clear()}}class F{constructor(t={}){this.scrollLeftBySection={"pinned-left":0,main:0,"pinned-right":0},this.panesBySection=new Map([["pinned-left",new Set],["main",new Set],["pinned-right",new Set]]),this.scrollHandlers=new WeakMap,this.isSyncing=!1,this.lastMainVirtualizationScrollLeft=null,this.config=t}updateConfig(t){this.config=Object.assign(Object.assign({},this.config),t)}registerPane(t,e,n){var o;const i=this.panesBySection.get(t);if(Array.from(i).find(t=>t.element===e))return;const s=Array.from(i).find(t=>t.role===n);s&&(this.removeScrollListener(s.element),i.delete(s)),i.add({element:e,role:n}),this.addScrollListener(t,e);const r=null!==(o=this.scrollLeftBySection[t])&&void 0!==o?o:0;e.scrollLeft!==r&&(this.isSyncing=!0,e.scrollLeft=r,this.isSyncing=!1)}unregisterPane(t,e){const n=this.panesBySection.get(t);if(!n)return;this.removeScrollListener(e);const o=Array.from(n).find(t=>t.element===e);o&&n.delete(o)}unregisterSection(t){const e=this.panesBySection.get(t);e&&(e.forEach(({element:t})=>this.removeScrollListener(t)),e.clear())}setSectionScrollLeft(t,e){this.scrollLeftBySection[t]=e;const n=this.panesBySection.get(t);n&&(n.forEach(({element:t})=>{t.scrollLeft!==e&&(t.scrollLeft=e)}),"main"===t&&this.config.onMainSectionScrollLeft&&(this.lastMainVirtualizationScrollLeft=e,this.config.onMainSectionScrollLeft(e)))}getSectionScrollLeft(t){var e;return null!==(e=this.scrollLeftBySection[t])&&void 0!==e?e:0}restoreAll(){["pinned-left","main","pinned-right"].forEach(t=>{var e;const n=null!==(e=this.scrollLeftBySection[t])&&void 0!==e?e:0;this.isSyncing=!0,this.setSectionScrollLeft(t,n),this.isSyncing=!1})}addScrollListener(t,e){this.removeScrollListener(e);const n=()=>{if(this.isSyncing)return;const n=e.scrollLeft;this.scrollLeftBySection[t]=n,this.isSyncing=!0;const o=this.panesBySection.get(t);o&&o.forEach(({element:t})=>{t!==e&&t.scrollLeft!==n&&(t.scrollLeft=n)}),"main"!==t||!this.config.onMainSectionScrollLeft||null!==this.lastMainVirtualizationScrollLeft&&20>Math.abs(n-this.lastMainVirtualizationScrollLeft)||(this.lastMainVirtualizationScrollLeft=n,this.config.onMainSectionScrollLeft(n)),this.isSyncing=!1};this.scrollHandlers.set(e,n),e.addEventListener("scroll",n,{passive:!0})}removeScrollListener(t){const e=this.scrollHandlers.get(t);e&&(t.removeEventListener("scroll",e),this.scrollHandlers.delete(t))}destroy(){["pinned-left","main","pinned-right"].forEach(t=>this.unregisterSection(t))}}const j={string:(t,e,n)=>{if(t===e)return 0;const o=t.localeCompare(e);return"asc"===n?o:-o},number:(t,e,n)=>{if(t===e)return 0;const o=t-e;return"asc"===n?o:-o},boolean:(t,e,n)=>{if(t===e)return 0;const o=t===e?0:t?-1:1;return"asc"===n?o:-o},date:(t,e,n)=>{const o=new Date(t),i=new Date(e);if(o.getTime()===i.getTime())return 0;const s=o.getTime()-i.getTime();return"asc"===n?s:-s},enum:(t,e,n)=>j.string(t,e,n),default:(t,e,n)=>t===e?0:null==t?"asc"===n?-1:1:null==e?"asc"===n?1:-1:"string"==typeof t&&"string"==typeof e?j.string(t,e,n):"number"==typeof t&&"number"==typeof e?j.number(t,e,n):"boolean"==typeof t&&"boolean"==typeof e?j.boolean(t,e,n):j.string(t+"",e+"",n)},B=({headers:t,rows:e,sortColumn:n})=>(({rows:t,sortColumn:e,headers:n})=>{const o=(t,e)=>{for(const n of t){if(n.accessor===e)return n;if(n.children&&n.children.length>0){const t=o(n.children,e);if(t)return t}}},i=o(n,e.key.accessor),s=(null==i?void 0:i.type)||"string",r=e.direction,l=e.key.accessor;return[...t].sort((e,n)=>{let o,d;if(null==i?void 0:i.valueGetter){const s=t.indexOf(e),r=t.indexOf(n);o=i.valueGetter({accessor:l,row:e,rowIndex:s}),d=i.valueGetter({accessor:l,row:n,rowIndex:r})}else o=f(e,l),d=f(n,l);return(null==i?void 0:i.comparator)?i.comparator({rowA:e,rowB:n,valueA:o,valueB:d,direction:r}):((t,e,n="string",o)=>{if(null==t||""===t)return"asc"===o?-1:1;if(null==e||""===e)return"asc"===o?1:-1;if("number"===n){const n=t=>{var e;if("number"==typeof t)return t;const n=t+"";if("string"==typeof n){const t=n.replace(/[$,]/g,"").match(/^([-+]?\d*\.?\d+)([TBMKtbmk])?/);if(t){let n=parseFloat(t[1]);const o=null===(e=t[2])||void 0===e?void 0:e.toUpperCase();return"T"===o?n*=1e12:"B"===o?n*=1e9:"M"===o?n*=1e6:"K"===o&&(n*=1e3),n}}return parseFloat(n)||0},i=n(t),s=n(e);return j.number(i,s,o)}return"date"===n?j.date(t+"",e+"",o):"boolean"===n?j.boolean(!!t,!!e,o):"enum"===n?j.enum(t+"",e+"",o):j.string(t+"",e+"",o)})(o,d,s,r)})})({rows:e,sortColumn:n,headers:t}),N=t=>{const{rows:e=[],headers:n=[],rowGrouping:o,rowManager:i}=t;if(i)return i.getAggregatedRows();if(!o||0===o.length)return e;const s=(t=>d(t).filter(t=>t.aggregation))(n);if(0===s.length)return e;const r=JSON.parse(JSON.stringify(e)),l=(t,e=0)=>t.map(t=>{const n=o[e],i=o[e+1],r=t[n];if(r&&v(r)){const o=l(r,e+1),d=Object.assign({},t);return d[n]=o,s.forEach(t=>{const e=((t,e,n,o)=>{const i=[],s=t=>{t.forEach(t=>{const n=o?t[o]:void 0;if(o&&n&&v(n))s(n);else{const n=f(t,e);null!=n&&i.push(n)}})};if(s(t),0===i.length)return;if("custom"===n.type&&n.customFn)return n.customFn(i);const r=n.parseValue?i.map(n.parseValue).filter(t=>!isNaN(t)):i.map(t=>"number"==typeof t?t:"string"==typeof t?parseFloat(t):NaN).filter(t=>!isNaN(t));if(0===r.length)return"count"===n.type?i.length:void 0;let l;switch(n.type){case"sum":l=r.reduce((t,e)=>t+e,0);break;case"average":l=r.reduce((t,e)=>t+e,0)/r.length;break;case"count":l=i.length;break;case"min":l=Math.min(...r);break;case"max":l=Math.max(...r);break;default:return}return n.formatResult?n.formatResult(l):l})(o,t.accessor,t.aggregation,i);void 0!==e&&w(d,t.accessor,e)}),d}return t});return l(r)};class z{constructor(t){this.subscribers=new Set,this.headerLookup=new Map,this.config=t,this.updateHeaderLookup();const e=this.getInitialSort(),n=this.computeSortedRows(t.tableRows,e);this.state={sort:e,sortedRows:n}}updateHeaderLookup(){const t=d(this.config.headers);this.headerLookup=new Map,t.forEach(t=>{this.headerLookup.set(t.accessor,t)})}getInitialSort(){if(!this.config.initialSortColumn)return null;const t=this.headerLookup.get(this.config.initialSortColumn);return t?{key:t,direction:this.config.initialSortDirection||"asc"}:null}sortNestedRows({groupingKeys:t,headers:e,rows:n,sortColumn:o}){const i=B({headers:e,rows:n,sortColumn:o});return t&&0!==t.length?i.map(n=>{const i=t[0],s=n[i];if(v(s)){const r=this.sortNestedRows({rows:s,sortColumn:o,headers:e,groupingKeys:t.slice(1)});return Object.assign(Object.assign({},n),{[i]:r})}return n}):i}computeSortedRows(t,e){if(this.config.externalSortHandling)return t;const n=N({rows:t,headers:this.config.headers,rowGrouping:this.config.rowGrouping});return e?this.config.rowGrouping&&this.config.rowGrouping.length>0?this.sortNestedRows({groupingKeys:this.config.rowGrouping,headers:this.config.headers,rows:n,sortColumn:e}):B({headers:this.config.headers,rows:n,sortColumn:e}):n}updateConfig(t){const e=this.config.headers;this.config=Object.assign(Object.assign({},this.config),t),t.headers&&t.headers!==e&&this.updateHeaderLookup();const n=this.computeSortedRows(this.config.tableRows,this.state.sort);n!==this.state.sortedRows&&(this.state=Object.assign(Object.assign({},this.state),{sortedRows:n}),this.notifySubscribers())}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}notifySubscribers(){this.subscribers.forEach(t=>t(this.state))}updateSort(t){var e,n,o,i;if(!t)return this.state=Object.assign(Object.assign({},this.state),{sort:null,sortedRows:this.config.tableRows}),null===(n=(e=this.config).onSortChange)||void 0===n||n.call(e,null),void this.notifySubscribers();const{accessor:s,direction:r}=t,l=this.headerLookup.get(s);if(!l)return;let d=null;if(r)d={key:l,direction:r};else{const t=l.sortingOrder||["asc","desc",null];let e=-1;this.state.sort&&this.state.sort.key.accessor===s&&(e=t.indexOf(this.state.sort.direction));const n=t[(e+1)%t.length];d=null===n?null:{key:l,direction:n}}const a=this.computeSortedRows(this.config.tableRows,d);this.state={sort:d,sortedRows:a},null===(i=(o=this.config).onSortChange)||void 0===i||i.call(o,d),this.config.announce&&this.config.announce(d?`Sorted by ${l.label}, ${"asc"===d.direction?"ascending":"descending"}`:"Sort removed from "+l.label),this.notifySubscribers()}computeSortedRowsPreview(t){const e=n=>{for(const o of n){if(o.accessor===t)return o;if(o.children&&o.children.length>0){const t=e(o.children);if(t)return t}}},n=e(this.config.headers);if(!n)return this.config.tableRows;let o=null;const i=n.sortingOrder||["asc","desc",null];let s=-1;this.state.sort&&this.state.sort.key.accessor===t&&(s=i.indexOf(this.state.sort.direction));const r=i[(s+1)%i.length];return o=null===r?null:{key:n,direction:r},this.computeSortedRows(this.config.tableRows,o)}getState(){return this.state}getSortColumn(){return this.state.sort}getSortedRows(){return this.state.sortedRows}destroy(){this.subscribers.clear()}}const q=t=>{if(!t)return new Date;if(/^\d{4}-\d{2}-\d{2}$/.test(t)){const[e,n,o]=t.split("-").map(Number);return new Date(e,n-1,o,12,0,0)}const e=new Date(t);return isNaN(e.getTime())?new Date:new Date(e.getFullYear(),e.getMonth(),e.getDate(),12,0,0)},V=t=>new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0),G=t=>{if(!t)return new Date;if("string"==typeof t)return q(t);if("number"==typeof t){const e=new Date(t);return isNaN(e.getTime())?new Date:V(e)}return t instanceof Date?V(t):new Date};class U{constructor(t){this.subscribers=new Set,this.headerLookup=new Map,this.config=t,this.updateHeaderLookup();const e={},n=this.computeFilteredRows(t.rows,e);this.state={filters:e,filteredRows:n}}updateHeaderLookup(){const t=d(this.config.headers);this.headerLookup=new Map,t.forEach(t=>{this.headerLookup.set(t.accessor,t)})}computeFilteredRows(t,e){return this.config.externalFilterHandling?t:e&&0!==Object.keys(e).length?t.filter(t=>Object.values(e).every(e=>{try{return((t,e)=>{const{operator:n,value:o,values:i}=e;if(null==t)return"isEmpty"===n;if("isEmpty"===n)return!t||""===(t+"").trim();if("isNotEmpty"===n)return t&&""!==(t+"").trim();if("string"==typeof t||"contains"===n||"notContains"===n||"startsWith"===n||"endsWith"===n){const e=(t+"").toLowerCase(),i=o?(o+"").toLowerCase():"";switch(n){case"equals":return e===i;case"notEquals":return e!==i;case"contains":return e.includes(i);case"notContains":return!e.includes(i);case"startsWith":return e.startsWith(i);case"endsWith":return e.endsWith(i)}}if("number"==typeof t||!isNaN(+t)){const e=+t,s=+o;switch(n){case"equals":return e===s;case"notEquals":return e!==s;case"greaterThan":return e>s;case"lessThan":return s>e;case"greaterThanOrEqual":return e>=s;case"lessThanOrEqual":return s>=e;case"between":if(i&&2===i.length){const[t,n]=i.map(Number);return e>=t&&n>=e}return!1;case"notBetween":if(i&&2===i.length){const[t,n]=i.map(Number);return t>e||e>n}return!0}}if(t instanceof Date||!isNaN(Date.parse(t))){const e=G(t),s=G((o||"")+""),r=V(e),l=V(s);switch(n){case"equals":return r.getTime()===l.getTime();case"notEquals":return r.getTime()!==l.getTime();case"before":return l>r;case"after":return r>l;case"between":if(i&&2===i.length){const[t,e]=i.map(t=>V(G((t||"")+"")));return r>=t&&e>=r}return!1;case"notBetween":if(i&&2===i.length){const[t,e]=i.map(t=>V(G((t||"")+"")));return t>r||r>e}return!0}}if("boolean"==typeof t&&"equals"===n)return t===!!o;if(Array.isArray(t)){const e=t.map(t=>"object"==typeof t&&null!==t?JSON.stringify(t):t+"").join(", ");t=e}if("in"===n||"notIn"===n){if(i&&Array.isArray(i)){const e=i.includes(t+"");return"in"===n?e:!e}return!1}const s=(t+"").toLowerCase(),r=o?(o+"").toLowerCase():"";switch(n){case"equals":return s===r;case"notEquals":return s!==r;default:return!0}})(f(t,e.accessor),e)}catch(t){return console.warn(`Filter error for accessor ${e.accessor}:`,t),!0}})):t}updateConfig(t){const e=this.config.headers;this.config=Object.assign(Object.assign({},this.config),t),t.headers&&t.headers!==e&&this.updateHeaderLookup();const n=this.computeFilteredRows(this.config.rows,this.state.filters);n!==this.state.filteredRows&&(this.state=Object.assign(Object.assign({},this.state),{filteredRows:n}),this.notifySubscribers())}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}notifySubscribers(){this.subscribers.forEach(t=>t(this.state))}updateFilter(t){var e,n;const o=Object.assign(Object.assign({},this.state.filters),{[t.accessor]:t}),i=this.computeFilteredRows(this.config.rows,o);if(this.state={filters:o,filteredRows:i},null===(n=(e=this.config).onFilterChange)||void 0===n||n.call(e,o),this.config.announce){const e=this.headerLookup.get(t.accessor);e&&this.config.announce("Filter applied to "+e.label)}this.notifySubscribers()}clearFilter(t){var e,n;const o=Object.assign({},this.state.filters);delete o[t];const i=this.computeFilteredRows(this.config.rows,o);if(this.state={filters:o,filteredRows:i},null===(n=(e=this.config).onFilterChange)||void 0===n||n.call(e,o),this.config.announce){const e=this.headerLookup.get(t);e&&this.config.announce("Filter removed from "+e.label)}this.notifySubscribers()}clearAllFilters(){var t,e;this.state={filters:{},filteredRows:this.config.rows},null===(e=(t=this.config).onFilterChange)||void 0===e||e.call(t,{}),this.config.announce&&this.config.announce("All filters cleared"),this.notifySubscribers()}computeFilteredRowsPreview(t){const e=Object.assign(Object.assign({},this.state.filters),{[t.accessor]:t});return this.computeFilteredRows(this.config.rows,e)}getState(){return this.state}getFilters(){return this.state.filters}getFilteredRows(){return this.state.filteredRows}destroy(){this.subscribers.clear()}}const K=(t,e)=>{const{rowTopPositions:n}=e;if(0===n.length)return 0;if(0>=t)return 0;if(t>=e.totalHeight)return n.length-1;let o=0,i=n.length-1;for(;i>o;){const e=Math.floor((o+i+1)/2);n[e]>t?i=e-1:o=e}return o},J=(t,e)=>{if(!e||0===e.length)return 0;let n=0,o=0,i=e.length;for(;i>o;){const n=Math.floor((o+i)/2);t>e[n][0]?o=n+1:i=n}for(let t=0;o>t;t++)n+=e[t][1];return n},Y=({bufferRowCount:t,contentHeight:e,rowHeight:n,scrollTop:o,tableRows:i,scrollDirection:s="none",heightMap:r})=>{const l=n+1;if(!r){const n=t*l;let r=n,d=n;"down"===s?(r=Math.max(l,.1*n),d=.9*n):"up"===s&&(r=.9*n,d=Math.max(l,.1*n));const a=o+e+d,c=Math.max(0,Math.floor(Math.max(0,o-r)/l)),h=Math.min(i.length,Math.ceil(a/l)),u=o+e,p=Math.max(0,Math.ceil(o/l)),f=Math.min(i.length,Math.floor(u/l)),w=o+e,v=Math.max(0,Math.floor(o/l)),m=Math.min(i.length,Math.ceil(w/l));return{rendered:{startIndex:c,endIndex:h,rows:i.slice(c,h)},fullyVisible:{startIndex:p,endIndex:f,rows:i.slice(p,f)},partiallyVisible:{startIndex:v,endIndex:m,rows:i.slice(v,m)}}}const{rowTopPositions:d}=r,a=t*l;let c=a,h=a;"down"===s?(c=Math.max(l,.1*a),h=.9*a):"up"===s&&(c=.9*a,h=Math.max(l,.1*a));const u=o+e+h,p=K(Math.max(0,o-c),r);let f=K(u,r)+1;f=Math.min(i.length,f);const w=o,v=o+e;let m=K(w,r);w>d[m]&&(m=Math.min(m+1,i.length));let g=K(v,r);g=Math.min(i.length,g);const b=o+e,x=K(o,r);let y=K(b,r)+1;return y=Math.min(i.length,y),{rendered:{startIndex:p,endIndex:f,rows:i.slice(p,f)},fullyVisible:{startIndex:m,endIndex:g,rows:i.slice(m,g)},partiallyVisible:{startIndex:x,endIndex:y,rows:i.slice(x,y)}}},_=({position:t,rowHeight:e,heightOffsets:n,customTheme:o})=>t*(e+o.rowSeparatorWidth)-o.rowSeparatorWidth+J(t,n),X=({position:t,rowHeight:e,heightOffsets:n,customTheme:o})=>t*(e+o.rowSeparatorWidth)+J(t,n),Q=(t,e)=>{var n,o;const i=t.position,s=e[i+1];return null!==(o=null===(n=null==s?void 0:s.parentIndices)||void 0===n?void 0:n.includes(i))&&void 0!==o&&o},Z=new Map,tt=({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:o,partiallyVisibleRowIndex:i,recursionDepth:s,stickyParents:r,rowGrouping:l})=>{let d=o[i];if(!d||s>10)return{stickyParents:r,regularRows:e};let a=0;if(d.parentIndices&&d.parentIndices.length>0){for(const e of d.parentIndices){const o=t[e];if(o){const e=n.some(t=>t.position===o.position);if(d.rowIndexPath&&d.rowIndexPath.length>0){const e=t[d.parentIndices[d.parentIndices.length-1]],n=e.row[l[e.depth]];if(r.length>=(Array.isArray(n)?n:[]).length-d.rowIndexPath[d.rowIndexPath.length-1])break}e||r.some(t=>g(t.rowId)===g(o.rowId))||(r.push(o),a++)}}if(r.length>0){Q(d,t)&&(r.push(d),a++);const e=o[i+=a];e&&(d=e)}}else if(Q(d,t))return r.push(d),i++,tt({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:o,partiallyVisibleRowIndex:i,recursionDepth:s+1,stickyParents:r,rowGrouping:l});return Q(d,t)?tt({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:o,partiallyVisibleRowIndex:i,recursionDepth:s+1,stickyParents:r,rowGrouping:l}):{stickyParents:r,regularRows:e}},et=(t,e,n)=>{const o=t.getBoundingClientRect(),i=e.getBoundingClientRect(),s=10;if(i.top+s>o.top?e.scrollTop-=i.top-o.top+s:o.bottom>i.bottom-s&&(e.scrollTop+=o.bottom-i.bottom+s),n){const t=n.getBoundingClientRect();t.left+s>o.left?n.scrollLeft-=t.left-o.left+s:o.right>t.right-s&&(n.scrollLeft+=o.right-t.right+s)}},nt=(t,e,n,o)=>{const i=document.querySelector(".st-body-container"),s=document.querySelector(".st-body-main");if(!i)return;const r=o?o.findIndex(e=>g(e.rowId)===t.rowId+""):-1,l=0>r?t.rowIndex:r,d=e+n.rowSeparatorWidth,a=i.querySelector(`.st-cell[data-row-id="${t.rowId}"][data-col-index="${t.colIndex}"]`);if(a&&o){const t=((t,e,n,o)=>{const i=Y({bufferRowCount:0,contentHeight:e.clientHeight,rowHeight:n,scrollTop:e.scrollTop,tableRows:o,scrollDirection:"none"}),{startIndex:s,endIndex:r}=i.fullyVisible;return t>=s&&r>t})(l,i,e,o);if(t)return void et(a,i,s)}if(!a)return i.scrollTop=Math.max(0,l*d-i.clientHeight/3),void setTimeout(()=>{const e=i.querySelector(`.st-cell[data-row-id="${t.rowId}"][data-col-index="${t.colIndex}"]`);e&&et(e,i,s)},100);et(a,i,s)},ot=({rowIndex:t,colIndex:e,rowId:n})=>`${t}-${e}-${n}`;function it(t,e,n,o){const i=new Set,s=new Map;n.forEach((t,e)=>{const n=g(t.rowId);s.set(n,e)});const r=s.get(t.rowId+""),l=s.get(e.rowId+""),d=void 0!==r?r:t.rowIndex,a=void 0!==l?l:e.rowIndex,c=Math.min(d,a),h=Math.max(d,a),u=Math.min(t.colIndex,e.colIndex),p=Math.max(t.colIndex,e.colIndex);for(let t=c;h>=t;t++)for(let e=u;p>=e;e++)if(t>=0&&n.length>t){if(o&&0===e)continue;const s=g(n[t].rowId);i.add(ot({colIndex:e,rowIndex:t,rowId:s}))}return i}function st(t,e){var n,o,i;const s=document.querySelector(".st-body-container");if(!s)return null;const r=s.getBoundingClientRect(),l=Math.max(r.left,Math.min(r.right,t)),d=Math.max(r.top,Math.min(r.bottom,e)),a=document.querySelectorAll(".st-cell[data-row-index][data-col-index][data-row-id]:not(.st-selection-cell)");if(0===a.length)return null;const c=new Map;for(let t=0;a.length>t;t++){const e=a[t],o=e.getAttribute("data-row-id"),i=null!==(n=null!=o?o:e.getAttribute("data-row-index"))&&void 0!==n?n:"";if(!i)continue;let s=c.get(i);s||(s=[],c.set(i,s)),s.push(e)}const h=[];c.forEach((t,e)=>{const n=t[0].getBoundingClientRect();h.push({key:e,top:n.top,bottom:n.bottom})}),h.sort((t,e)=>t.top-e.top);let u=null,p=1/0;for(let t=0;h.length>t;t++){const{key:e,top:n,bottom:o}=h[t];if(d>=n&&o>=d){u=e,p=0;break}const i=Math.abs(d-(n+o)/2);p>i&&(p=i,u=e)}if(null===u)return null;const f=c.get(u);if(!f||0===f.length)return null;let w=null,v=1/0;for(let t=0;f.length>t;t++){const e=f[t],n=parseInt(null!==(o=e.getAttribute("data-row-index"))&&void 0!==o?o:"-1",10),s=parseInt(null!==(i=e.getAttribute("data-col-index"))&&void 0!==i?i:"-1",10),r=e.getAttribute("data-row-id");if(0>n||0>s||null==r||""===r)continue;const a=e.getBoundingClientRect(),c=Math.sqrt((a.left+a.width/2-l)**2+(a.top+a.height/2-d)**2);v>c&&(v=c,w=e)}if(null!==w){const t=parseInt(w.getAttribute("data-row-index")||"-1",10),e=parseInt(w.getAttribute("data-col-index")||"-1",10),n=w.getAttribute("data-row-id");if(t>=0&&e>=0&&null!==n)return{rowIndex:t,colIndex:e,rowId:n}}return null}class rt{constructor(t){this.selectedCells=new Set,this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.initialFocusedCell=null,this.copyFlashCells=new Set,this.warningFlashCells=new Set,this.isSelecting=!1,this.startCell=null,this.keydownHandler=null,this.currentMouseX=null,this.currentMouseY=null,this.scrollAnimationFrame=null,this.lastSelectionUpdate=0,this.selectionThrottleMs=16,this.globalMouseMoveHandler=null,this.globalMouseUpHandler=null,this.columnsWithSelectedCells=new Set,this.rowsWithSelectedCells=new Set,this.leafHeaders=[],this.rowIdToTableIndex=new Map,this.selectedByRowIdColIndex=new Set,this.fullTableSelected=!1,this.config=t,this.updateDerivedState(),this.setupKeyboardNavigation()}updateConfig(t,e){this.config=Object.assign(Object.assign({},this.config),t),(null==e?void 0:e.positionOnlyBody)?this.updateRowIdAndSelectionLookupOnly():this.updateDerivedState()}updateDerivedState(){if(this.leafHeaders=this.config.headers.flatMap(t=>x(t,this.config.collapsedHeaders)),this.rowIdToTableIndex.clear(),this.config.tableRows.forEach((t,e)=>{this.rowIdToTableIndex.set(g(t.rowId),e)}),this.fullTableSelected){this.selectedByRowIdColIndex.clear(),this.columnsWithSelectedCells=new Set;const t=this.leafHeaders.length,e=this.config.enableRowSelection?1:0;for(let n=0;t>n;n++)this.columnsWithSelectedCells.add(n+e);return this.rowsWithSelectedCells=new Set,void this.config.tableRows.forEach(t=>{this.rowsWithSelectedCells.add(g(t.rowId))})}this.selectedByRowIdColIndex.clear(),this.columnsWithSelectedCells=new Set,this.rowsWithSelectedCells=new Set,this.selectedCells.forEach(t=>{const e=t.split("-");if(e.length>=3){const t=parseInt(e[1],10),n=e.slice(2).join("-");isNaN(t)||(this.selectedByRowIdColIndex.add(`${n}\t${t}`),this.columnsWithSelectedCells.add(t),this.rowsWithSelectedCells.add(n))}}),this.selectedColumns.forEach(t=>{this.columnsWithSelectedCells.add(t),this.config.tableRows.forEach(e=>{this.selectedByRowIdColIndex.add(`${g(e.rowId)}\t${t}`),this.rowsWithSelectedCells.add(g(e.rowId))})})}updateRowIdAndSelectionLookupOnly(){this.rowIdToTableIndex.clear(),this.config.tableRows.forEach((t,e)=>{this.rowIdToTableIndex.set(g(t.rowId),e)}),this.fullTableSelected||(this.selectedByRowIdColIndex.clear(),this.selectedCells.forEach(t=>{const e=t.split("-");if(e.length>=3){const t=parseInt(e[1],10),n=e.slice(2).join("-");isNaN(t)||this.selectedByRowIdColIndex.add(`${n}\t${t}`)}}),this.selectedColumns.forEach(t=>{this.config.tableRows.forEach(e=>{this.selectedByRowIdColIndex.add(`${g(e.rowId)}\t${t}`)})}))}setupKeyboardNavigation(){this.keydownHandler=this.handleKeyDown.bind(this),document.addEventListener("keydown",this.keydownHandler)}destroy(){this.keydownHandler&&(document.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=null),this.globalMouseMoveHandler&&(document.removeEventListener("mousemove",this.globalMouseMoveHandler),this.globalMouseMoveHandler=null),this.globalMouseUpHandler&&(document.removeEventListener("mouseup",this.globalMouseUpHandler),this.globalMouseUpHandler=null),null!==this.scrollAnimationFrame&&(cancelAnimationFrame(this.scrollAnimationFrame),this.scrollAnimationFrame=null)}handleKeyDown(t){if(!this.config.selectableCells)return;if(!this.initialFocusedCell)return;const e=document.activeElement;if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||"true"===(null==e?void 0:e.getAttribute("contenteditable")))){if((t.ctrlKey||t.metaKey)&&"a"===t.key)return t.preventDefault(),void this.selectAll();if(0!==this.selectedCells.size||this.fullTableSelected){if(!t.ctrlKey&&!t.metaKey||"c"!==t.key)return(t.ctrlKey||t.metaKey)&&"v"===t.key?(t.preventDefault(),void this.pasteFromClipboard()):"Delete"===t.key||"Backspace"===t.key?(t.preventDefault(),void this.deleteSelectedCells()):void("Escape"!==t.key?this.handleNavigationKeys(t):this.clearSelection());this.copyToClipboard()}}}handleNavigationKeys(t){if(!this.initialFocusedCell)return;let{rowIndex:e,colIndex:n,rowId:o}=this.initialFocusedCell;const i=this.config.tableRows[e];if((i?g(i.rowId):null)!==o){const t=this.config.tableRows.findIndex(t=>g(t.rowId)===o);if(-1===t)return;e=t}"ArrowUp"===t.key?(t.preventDefault(),this.handleArrowUp(t,e,n)):"ArrowDown"===t.key?(t.preventDefault(),this.handleArrowDown(t,e,n)):"ArrowLeft"===t.key||"Tab"===t.key&&t.shiftKey?(t.preventDefault(),this.handleArrowLeft(t,e,n)):"ArrowRight"===t.key||"Tab"===t.key?(t.preventDefault(),this.handleArrowRight(t,e,n)):"Home"===t.key?(t.preventDefault(),this.handleHome(t,e,n)):"End"===t.key?(t.preventDefault(),this.handleEnd(t,e,n)):"PageUp"===t.key?(t.preventDefault(),this.handlePageUp(t,e,n)):"PageDown"===t.key&&(t.preventDefault(),this.handlePageDown(t,e,n))}findEdgeInDirection(t,e,n){return function(t,e,n,o,i,s){let r=o,l=i;return"up"===s?r=0:"down"===s?r=t-1:"left"===s?l=n?1:0:"right"===s&&(l=n?e:e-1),{rowIndex:r,colIndex:l}}(this.config.tableRows.length,this.leafHeaders.length,!!this.config.enableRowSelection,t,e,n)}handleArrowUp(t,e,n){if(t.shiftKey){this.startCell||(this.startCell=this.initialFocusedCell);let o=e-1;if((t.ctrlKey||t.metaKey)&&(o=this.findEdgeInDirection(e,n,"up").rowIndex),o>=0){const t=g(this.config.tableRows[o].rowId);this.selectCellRange(this.startCell,{rowIndex:o,colIndex:n,rowId:t})}}else if(e>0){let o=e-1;(t.ctrlKey||t.metaKey)&&(o=this.findEdgeInDirection(e,n,"up").rowIndex);const i=g(this.config.tableRows[o].rowId);this.selectSingleCell({rowIndex:o,colIndex:n,rowId:i}),this.startCell=null}}handleArrowDown(t,e,n){if(t.shiftKey){this.startCell||(this.startCell=this.initialFocusedCell);let o=e+1;if((t.ctrlKey||t.metaKey)&&(o=this.findEdgeInDirection(e,n,"down").rowIndex),this.config.tableRows.length>o){const t=g(this.config.tableRows[o].rowId);this.selectCellRange(this.startCell,{rowIndex:o,colIndex:n,rowId:t})}}else if(this.config.tableRows.length-1>e){let o=e+1;(t.ctrlKey||t.metaKey)&&(o=this.findEdgeInDirection(e,n,"down").rowIndex);const i=g(this.config.tableRows[o].rowId);this.selectSingleCell({rowIndex:o,colIndex:n,rowId:i}),this.startCell=null}}handleArrowLeft(t,e,n){if(t.shiftKey&&"ArrowLeft"===t.key){this.startCell||(this.startCell=this.initialFocusedCell);let o=n-1;if(t.ctrlKey||t.metaKey)o=this.findEdgeInDirection(e,n,"left").colIndex;else if(this.config.enableRowSelection&&0===o)return;if(o>=0){const t=g(this.config.tableRows[e].rowId);this.selectCellRange(this.startCell,{rowIndex:e,colIndex:o,rowId:t})}}else if(n>0){let o=n-1;if((t.ctrlKey||t.metaKey)&&"ArrowLeft"===t.key)o=this.findEdgeInDirection(e,n,"left").colIndex;else if(this.config.enableRowSelection&&0===o)return;if(o>=0){const t=g(this.config.tableRows[e].rowId);this.selectSingleCell({rowIndex:e,colIndex:o,rowId:t}),this.startCell=null}}}handleArrowRight(t,e,n){const o=this.config.enableRowSelection?this.leafHeaders.length:this.leafHeaders.length-1;if(t.shiftKey&&"ArrowRight"===t.key){this.startCell||(this.startCell=this.initialFocusedCell);let i=n+1;if((t.ctrlKey||t.metaKey)&&(i=this.findEdgeInDirection(e,n,"right").colIndex),o>=i){const t=g(this.config.tableRows[e].rowId);this.selectCellRange(this.startCell,{rowIndex:e,colIndex:i,rowId:t})}}else if(o>n){let i=n+1;if((t.ctrlKey||t.metaKey)&&"ArrowRight"===t.key&&(i=this.findEdgeInDirection(e,n,"right").colIndex),o>=i){const t=g(this.config.tableRows[e].rowId);this.selectSingleCell({rowIndex:e,colIndex:i,rowId:t}),this.startCell=null}}}handleHome(t,e,n){if(t.shiftKey){this.startCell||(this.startCell=this.initialFocusedCell);let n=e;const o=this.config.enableRowSelection?1:0;(t.ctrlKey||t.metaKey)&&(n=0);const i=g(this.config.tableRows[n].rowId);this.selectCellRange(this.startCell,{rowIndex:n,colIndex:o,rowId:i})}else{let n=e;const o=this.config.enableRowSelection?1:0;(t.ctrlKey||t.metaKey)&&(n=0);const i=g(this.config.tableRows[n].rowId);this.selectSingleCell({rowIndex:n,colIndex:o,rowId:i}),this.startCell=null}}handleEnd(t,e,n){if(t.shiftKey){this.startCell||(this.startCell=this.initialFocusedCell);let n=e;const o=this.config.enableRowSelection?this.leafHeaders.length:this.leafHeaders.length-1;(t.ctrlKey||t.metaKey)&&(n=this.config.tableRows.length-1);const i=g(this.config.tableRows[n].rowId);this.selectCellRange(this.startCell,{rowIndex:n,colIndex:o,rowId:i})}else{let n=e;const o=this.config.enableRowSelection?this.leafHeaders.length:this.leafHeaders.length-1;(t.ctrlKey||t.metaKey)&&(n=this.config.tableRows.length-1);const i=g(this.config.tableRows[n].rowId);this.selectSingleCell({rowIndex:n,colIndex:o,rowId:i}),this.startCell=null}}handlePageUp(t,e,n){let o=Math.max(0,e-10);if(t.shiftKey){this.startCell||(this.startCell=this.initialFocusedCell);const t=g(this.config.tableRows[o].rowId);this.selectCellRange(this.startCell,{rowIndex:o,colIndex:n,rowId:t})}else{const t=g(this.config.tableRows[o].rowId);this.selectSingleCell({rowIndex:o,colIndex:n,rowId:t}),this.startCell=null}}handlePageDown(t,e,n){let o=Math.min(this.config.tableRows.length-1,e+10);if(t.shiftKey){this.startCell||(this.startCell=this.initialFocusedCell);const t=g(this.config.tableRows[o].rowId);this.selectCellRange(this.startCell,{rowIndex:o,colIndex:n,rowId:t})}else{const t=g(this.config.tableRows[o].rowId);this.selectSingleCell({rowIndex:o,colIndex:n,rowId:t}),this.startCell=null}}copyToClipboard(){const t=this.fullTableSelected?this.buildFullTableSelectedSet():this.selectedCells;if(0===t.size)return;const e=((t,e,n,o=!1)=>{const i=this.leafHeaders.filter(t=>!t.hide&&!t.excludeFromRender),s=new Map,r=new Map;i.forEach((t,e)=>{s.set(e,t.accessor),r.set(e,t)});const l=Array.from(t).reduce((t,e)=>{var o;const[i,l]=e.split("-").map(Number);t[i]||(t[i]=[]);const d=s.get(l),a=r.get(l);if(d&&(null===(o=n[i])||void 0===o?void 0:o.row)){const e=n[i].row,o=f(e,d);if(!1!==(null==a?void 0:a.useFormattedValueForClipboard)&&(null==a?void 0:a.valueFormatter)){const n=a.valueFormatter({accessor:d,colIndex:l,row:e,rowIndex:i,value:o});t[i][l]=n}else t[i][l]=!a||"lineAreaChart"!==a.type&&"barChart"!==a.type?o:Array.isArray(o)?o.join(", "):""}else t[i][l]="";return t},{}),d=new Set;o&&Array.from(t).forEach(t=>{const[,e]=t.split("-").map(Number);d.add(e)});let a="";o&&d.size>0&&(a=Array.from(d).sort((t,e)=>t-e).map(t=>{var e;const n=r.get(t);return null!==(e=null==n?void 0:n.label)&&void 0!==e?e:""}).join("\t"));const c=Object.values(l).map(t=>Object.values(t).join("\t")).join("\n");return o&&a?`${a}\n${c}`:c})(t,0,this.config.tableRows,this.config.copyHeadersToClipboard);navigator.clipboard.writeText(e),this.copyFlashCells=new Set(t),this.updateCellFlashClasses(),setTimeout(()=>{this.copyFlashCells=new Set,this.updateCellFlashClasses()},800)}async pasteFromClipboard(){if(this.initialFocusedCell)try{const t=await navigator.clipboard.readText();if(!t)return;const{updatedCells:e,warningCells:n}=((t,e,n,o,i,s)=>{const r=new Set,l=new Set,d=t.split("\n").filter(t=>t.length>0);if(0===d.length)return{updatedCells:r,warningCells:l};const a=n.filter(t=>!t.hide&&!t.excludeFromRender),c=o.findIndex(t=>g(t.rowId)===e.rowId+""),h=0>c?e.rowIndex:c,u=e.colIndex;return d.forEach((t,e)=>{t.split("\t").forEach((t,n)=>{const d=h+e,c=u+n;if(d>=o.length||c>=a.length)return;const p=o[d],f=a[c],v=g(p.rowId);if(!(null==f?void 0:f.isEditable))return void l.add(`${d}-${c}-${v}`);let m=t;if("number"===f.type){const e=+t;isNaN(e)||(m=e)}else if("boolean"===f.type)m="true"===t.toLowerCase()||"1"===t;else if("date"===f.type){const e=new Date(t);isNaN(e.getTime())||(m=e)}else"lineAreaChart"!==f.type&&"barChart"!==f.type||(m=t.split(",").map(t=>{const e=+t.trim();return isNaN(e)?0:e}));if(w(p.row,f.accessor,m),s){const t=s.get(`${v}-${f.accessor}`);t&&t.updateContent(m)}null==i||i({accessor:f.accessor,newValue:m,row:p.row,rowIndex:d}),r.add(`${d}-${c}-${v}`)})}),{updatedCells:r,warningCells:l}})(t,this.initialFocusedCell,this.leafHeaders,this.config.tableRows,this.config.onCellEdit,this.config.cellRegistry);e.size>0&&(this.copyFlashCells=e,this.updateCellFlashClasses(),setTimeout(()=>{this.copyFlashCells=new Set,this.updateCellFlashClasses()},800)),n.size>0&&(this.warningFlashCells=n,this.updateCellFlashClasses(),setTimeout(()=>{this.warningFlashCells=new Set,this.updateCellFlashClasses()},800))}catch(t){console.warn("Failed to paste from clipboard:",t)}}deleteSelectedCells(){const t=this.fullTableSelected?this.buildFullTableSelectedSet():this.selectedCells;if(0===t.size)return;const{deletedCells:e,warningCells:n}=((t,e,n,o,i)=>{const s=new Set,r=new Set,l=e.filter(t=>!t.hide&&!t.excludeFromRender),d=new Map;return l.forEach((t,e)=>{d.set(e,t.accessor)}),Array.from(t).forEach(t=>{const[e,d]=t.split("-").map(Number);if(e>=n.length||d>=l.length)return;const a=n[e],c=l[d],h=g(a.rowId);if(!(null==c?void 0:c.isEditable))return void r.add(t);let u=null;if(u="string"===c.type?"":"number"===c.type?null:"boolean"!==c.type&&("date"===c.type?null:"lineAreaChart"===c.type||"barChart"===c.type||Array.isArray(f(a.row,c.accessor))?[]:""),w(a.row,c.accessor,u),i){const t=i.get(`${h}-${c.accessor}`);t&&t.updateContent(u)}null==o||o({accessor:c.accessor,newValue:u,row:a.row,rowIndex:e}),s.add(t)}),{deletedCells:s,warningCells:r}})(t,this.leafHeaders,this.config.tableRows,this.config.onCellEdit,this.config.cellRegistry);e.size>0&&(this.copyFlashCells=e,this.updateCellFlashClasses(),setTimeout(()=>{this.copyFlashCells=new Set,this.updateCellFlashClasses()},800)),n.size>0&&(this.warningFlashCells=n,this.updateCellFlashClasses(),setTimeout(()=>{this.warningFlashCells=new Set,this.updateCellFlashClasses()},800))}selectAll(){this.fullTableSelected=!0,this.selectedCells=new Set,this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.updateDerivedState(),this.updateAllCellClasses()}buildFullTableSelectedSet(){const t=new Set;for(let e=0;this.config.tableRows.length>e;e++)for(let n=0;this.leafHeaders.length>n;n++){const o=this.config.enableRowSelection?n+1:n,i=g(this.config.tableRows[e].rowId);t.add(`${e}-${o}-${i}`)}return t}clearSelection(){this.fullTableSelected=!1,this.selectedCells=new Set,this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.startCell=null,this.updateDerivedState(),this.updateAllCellClasses()}setSelectedCells(t){this.fullTableSelected=!1,this.selectedCells=t,this.updateDerivedState(),this.updateAllCellClasses()}setSelectedColumns(t){this.fullTableSelected=!1,this.selectedColumns=t,this.updateDerivedState(),this.updateAllCellClasses()}updateCellFlashClasses(){requestAnimationFrame(()=>{document.querySelectorAll(".st-cell[data-row-index][data-col-index][data-row-id]").forEach(t=>{if(!(t instanceof HTMLElement))return;const e=parseInt(t.getAttribute("data-row-index")||"-1",10),n=parseInt(t.getAttribute("data-col-index")||"-1",10),o=t.getAttribute("data-row-id");if(0>e||0>n||!o)return;const i=ot({rowIndex:e,colIndex:n,rowId:o}),s=this.isInitialFocusedCell({rowIndex:e,colIndex:n,rowId:o});this.copyFlashCells.has(i)?t.classList.add(s?"st-cell-copy-flash-first":"st-cell-copy-flash"):t.classList.remove("st-cell-copy-flash-first","st-cell-copy-flash"),this.warningFlashCells.has(i)?t.classList.add(s?"st-cell-warning-flash-first":"st-cell-warning-flash"):t.classList.remove("st-cell-warning-flash-first","st-cell-warning-flash")})})}syncHeaderSelectionClasses(){var t;if(!this.config.selectableColumns&&!this.config.selectableCells)return;const e=(null!==(t=this.config.tableRoot)&&void 0!==t?t:document).querySelectorAll(".st-header-cell"),n=new Map;for(const t of d(this.config.headers))n.set(t.accessor+"",t);for(let t=0;e.length>t;t++){const o=e[t];if(!(o instanceof HTMLElement))continue;const i=o.getAttribute("data-accessor"),s=o.getAttribute("aria-colindex");if(!i||!s)continue;const r=parseInt(s,10)-1;if(0>r||Number.isNaN(r))continue;const d=n.get(i);if(!d)continue;if(d.isSelectionColumn&&this.config.enableRowSelection){for(const t of rt.HEADER_SELECTION_CLASSES)o.classList.remove(t);continue}const a=l(d,r),c=a.some(t=>this.selectedColumns.has(t)),h=!c&&a.some(t=>this.columnsWithSelectedCells.has(t));if(c)o.classList.add("st-header-selected"),o.classList.remove("st-header-has-highlighted-cell");else if(h)o.classList.add("st-header-has-highlighted-cell"),o.classList.remove("st-header-selected");else for(const t of rt.HEADER_SELECTION_CLASSES)o.classList.remove(t)}}clearHeaderSelectionHighlightClasses(){var t;if(!this.config.selectableColumns&&!this.config.selectableCells)return;const e=(null!==(t=this.config.tableRoot)&&void 0!==t?t:document).querySelectorAll(".st-header-cell");for(let t=0;e.length>t;t++){const n=e[t];if(n instanceof HTMLElement)for(const t of rt.HEADER_SELECTION_CLASSES)n.classList.remove(t)}}syncAllCellClasses(){var t;const e=(null!==(t=this.config.tableRoot)&&void 0!==t?t:document).querySelectorAll(".st-cell[data-row-index][data-col-index][data-row-id]");if(this.fullTableSelected||0!==this.selectedCells.size||0!==this.selectedColumns.size){for(let t=0;e.length>t;t++){const n=e[t];if(!(n instanceof HTMLElement))continue;const o=parseInt(n.getAttribute("data-row-index")||"-1",10),i=parseInt(n.getAttribute("data-col-index")||"-1",10),s=n.getAttribute("data-row-id");if(0>o||0>i||!s)continue;const r={rowIndex:o,colIndex:i,rowId:s},l=this.isSelected(r),d=this.selectedColumns.has(i),a=l&&!d,c=this.isInitialFocusedCell(r),h=this.getBorderClass(r),u=new Set;a&&(u.add(c?"st-cell-selected-first":"st-cell-selected"),h.split(" ").filter(Boolean).forEach(t=>u.add(t))),d&&u.add(c?"st-cell-column-selected-first":"st-cell-column-selected");for(const t of rt.SELECTION_CLASSES){const e=u.has(t),o=n.classList.contains(t);e&&!o?n.classList.add(t):!e&&o&&n.classList.remove(t)}const p=c?"0":"-1";if(n.getAttribute("tabindex")!==p&&n.setAttribute("tabindex",p),c&&document.activeElement!==n){const t=document.activeElement;t&&n.contains(t)||n.focus({preventScroll:!0})}}this.syncHeaderSelectionClasses()}else{for(let t=0;e.length>t;t++){const n=e[t];if(n instanceof HTMLElement){for(const t of rt.SELECTION_CLASSES)n.classList.contains(t)&&n.classList.remove(t);"-1"!==n.getAttribute("tabindex")&&n.setAttribute("tabindex","-1")}}this.clearHeaderSelectionHighlightClasses()}}updateAllCellClasses(){this.isSelecting||this.fullTableSelected?this.syncAllCellClasses():requestAnimationFrame(()=>this.syncAllCellClasses())}isSelected({colIndex:t,rowIndex:e,rowId:n}){if(this.fullTableSelected)return!0;const o=n+"";if(this.selectedByRowIdColIndex.has(`${o}\t${t}`))return!0;const i=this.rowIdToTableIndex.get(o);if(void 0!==i){const e=ot({rowIndex:i,colIndex:t,rowId:o});if(this.selectedCells.has(e))return!0}const s=ot({colIndex:t,rowIndex:e,rowId:n});return this.selectedCells.has(s)}getBorderClass({colIndex:t,rowIndex:e,rowId:n}){var o;if(this.isSelecting)return"";const i=null!==(o=this.rowIdToTableIndex.get(n+""))&&void 0!==o?o:e;if(this.fullTableSelected){const e=this.config.enableRowSelection?1:0,n=this.config.enableRowSelection?this.leafHeaders.length:this.leafHeaders.length-1,o=[];return 0===i&&o.push("st-selected-top-border"),i===this.config.tableRows.length-1&&o.push("st-selected-bottom-border"),t===e&&o.push("st-selected-left-border"),t===n&&o.push("st-selected-right-border"),o.join(" ")}const s=[],r=this.config.tableRows[i-1],l=r?g(r.rowId):null,d=this.config.tableRows[i+1],a=d?g(d.rowId):null,c=null!==l&&this.isSelected({colIndex:t,rowIndex:i-1,rowId:l}),h=null!==a&&this.isSelected({colIndex:t,rowIndex:i+1,rowId:a}),u=this.isSelected({colIndex:t-1,rowIndex:i,rowId:n}),p=this.isSelected({colIndex:t+1,rowIndex:i,rowId:n});return(!l||!c||this.selectedColumns.has(t)&&0===i)&&s.push("st-selected-top-border"),(!a||!h||this.selectedColumns.has(t)&&i===this.config.tableRows.length-1)&&s.push("st-selected-bottom-border"),u||s.push("st-selected-left-border"),p||s.push("st-selected-right-border"),s.join(" ")}isInitialFocusedCell({colIndex:t,rowId:e}){return!!this.initialFocusedCell&&t===this.initialFocusedCell.colIndex&&e+""==this.initialFocusedCell.rowId+""}isCopyFlashing({colIndex:t,rowIndex:e,rowId:n}){const o=ot({colIndex:t,rowIndex:e,rowId:n});return this.copyFlashCells.has(o)}isWarningFlashing({colIndex:t,rowIndex:e,rowId:n}){const o=ot({colIndex:t,rowIndex:e,rowId:n});return this.warningFlashCells.has(o)}getColumnsWithSelectedCells(){return this.columnsWithSelectedCells}getRowsWithSelectedCells(){return this.rowsWithSelectedCells}getSelectedCells(){return this.fullTableSelected?this.buildFullTableSelectedSet():this.selectedCells}getSelectedColumns(){return this.selectedColumns}getLastSelectedColumnIndex(){return this.lastSelectedColumnIndex}getStartCell(){return this.startCell}setInitialFocusedCell(t){this.initialFocusedCell=t,this.updateDerivedState(),this.updateAllCellClasses()}selectSingleCell(t){if(t.rowIndex>=0&&this.config.tableRows.length>t.rowIndex&&t.colIndex>=0&&(this.config.enableRowSelection?this.leafHeaders.length:this.leafHeaders.length-1)>=t.colIndex){this.fullTableSelected=!1;const e=ot(t);this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.selectedCells=new Set([e]),this.initialFocusedCell=t,this.updateDerivedState(),this.updateAllCellClasses(),setTimeout(()=>nt(t,this.config.rowHeight,this.config.customTheme,this.config.tableRows),0)}}selectCellRange(t,e){this.fullTableSelected=!1;const n=it(t,e,this.config.tableRows,!!this.config.enableRowSelection);this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.selectedCells=n,this.initialFocusedCell=e,this.updateDerivedState(),this.updateAllCellClasses(),setTimeout(()=>nt(e,this.config.rowHeight,this.config.customTheme,this.config.tableRows),0)}selectColumns(t,e=!1){this.fullTableSelected=!1,this.selectedCells=new Set,this.initialFocusedCell=null;const n=new Set(e?this.selectedColumns:[]);t.forEach(t=>n.add(t)),this.selectedColumns=n,t.length>0&&(this.lastSelectedColumnIndex=t[t.length-1]),this.updateDerivedState(),this.updateAllCellClasses()}updateSelectionRange(t,e){this.fullTableSelected=!1;const n=it(t,e,this.config.tableRows,!!this.config.enableRowSelection);this.selectedCells.size===n.size&&Array.from(n).every(t=>this.selectedCells.has(t))||(this.selectedCells=n,this.updateDerivedState(),this.updateAllCellClasses())}calculateNearestCell(t,e){return st(t,e)}getCellFromMousePosition(t,e){return function(t,e){const n=document.elementFromPoint(t,e);if(!n)return null;const o=n.closest(".st-cell");if(o instanceof HTMLElement){const t=parseInt(o.getAttribute("data-row-index")||"-1",10),e=parseInt(o.getAttribute("data-col-index")||"-1",10),n=o.getAttribute("data-row-id");if(t>=0&&e>=0&&null!==n)return{rowIndex:t,colIndex:e,rowId:n}}return st(t,e)}(t,e)}handleAutoScroll(t,e){var n;!function(t,e,n=document){const o=n.querySelector(".st-body-container");if(!o)return;const i=o.getBoundingClientRect(),s=Math.max(0,o.scrollHeight-o.clientHeight);i.top+50>e?o.scrollTop=Math.max(0,o.scrollTop-10*Math.min(3,1+Math.max(0,i.top-e)/100)):e>i.bottom-50&&(o.scrollTop=Math.min(s,o.scrollTop+10*Math.min(3,1+Math.max(0,e-i.bottom)/100)));const r=n.querySelector(".st-body-main");if(r){const e=Math.max(0,r.scrollWidth-r.clientWidth);i.left+50>t?r.scrollLeft=Math.max(0,r.scrollLeft-10*Math.min(3,1+Math.max(0,i.left-t)/100)):t>i.right-50&&(r.scrollLeft=Math.min(e,r.scrollLeft+10*Math.min(3,1+Math.max(0,t-i.right)/100)))}}(t,e,null!==(n=this.config.tableRoot)&&void 0!==n?n:document)}continuousScroll(){if(this.isSelecting&&this.startCell){if(null!==this.currentMouseX&&null!==this.currentMouseY){this.handleAutoScroll(this.currentMouseX,this.currentMouseY);const t=Date.now();if(t-this.lastSelectionUpdate>=this.selectionThrottleMs){const e=this.getCellFromMousePosition(this.currentMouseX,this.currentMouseY);e&&(this.updateSelectionRange(this.startCell,e),this.lastSelectionUpdate=t)}}this.scrollAnimationFrame=requestAnimationFrame(()=>this.continuousScroll())}else null!==this.scrollAnimationFrame&&(cancelAnimationFrame(this.scrollAnimationFrame),this.scrollAnimationFrame=null)}handleMouseDown({colIndex:t,rowIndex:e,rowId:n}){this.config.selectableCells&&(this.fullTableSelected=!1,this.isSelecting=!0,this.startCell={rowIndex:e,colIndex:t,rowId:n},setTimeout(()=>{this.selectedColumns=new Set,this.lastSelectedColumnIndex=null;const o=ot({colIndex:t,rowIndex:e,rowId:n});this.selectedCells=new Set([o]),this.initialFocusedCell={rowIndex:e,colIndex:t,rowId:n},this.updateDerivedState(),this.updateAllCellClasses()},0),this.currentMouseX=null,this.currentMouseY=null,this.lastSelectionUpdate=0,this.globalMouseMoveHandler=t=>{this.isSelecting&&this.startCell&&(this.currentMouseX=t.clientX,this.currentMouseY=t.clientY)},this.globalMouseUpHandler=()=>{var t,e;this.isSelecting=!1,null!==this.scrollAnimationFrame&&(cancelAnimationFrame(this.scrollAnimationFrame),this.scrollAnimationFrame=null),this.globalMouseMoveHandler&&(document.removeEventListener("mousemove",this.globalMouseMoveHandler),this.globalMouseMoveHandler=null),this.globalMouseUpHandler&&(document.removeEventListener("mouseup",this.globalMouseUpHandler),this.globalMouseUpHandler=null),null===(e=(t=this.config).onSelectionDragEnd)||void 0===e||e.call(t),this.syncAllCellClasses(),requestAnimationFrame(()=>this.syncAllCellClasses())},document.addEventListener("mousemove",this.globalMouseMoveHandler),document.addEventListener("mouseup",this.globalMouseUpHandler),this.scrollAnimationFrame=requestAnimationFrame(()=>this.continuousScroll()))}handleMouseOver({colIndex:t,rowIndex:e,rowId:n}){this.config.selectableCells&&this.isSelecting&&this.startCell&&this.updateSelectionRange(this.startCell,{colIndex:t,rowIndex:e,rowId:n})}}rt.SELECTION_CLASSES=["st-cell-selected","st-cell-selected-first","st-cell-column-selected","st-cell-column-selected-first","st-selected-top-border","st-selected-bottom-border","st-selected-left-border","st-selected-right-border"],rt.HEADER_SELECTION_CLASSES=["st-header-selected","st-header-has-highlighted-cell"];const lt=(t,e)=>t.filter(t=>!(!t||!t.rowId)&&e.has(g(t.rowId))).map(t=>t.row);class dt{constructor(t){this.subscribers=new Set,this.config=t,this.state={selectedRows:new Set,selectedRowCount:0,selectedRowsData:[]}}updateConfig(t){this.config=Object.assign(Object.assign({},this.config),t),t.tableRows&&this.updateDerivedState()}updateDerivedState(){var t;this.state=Object.assign(Object.assign({},this.state),{selectedRowCount:(t=this.state.selectedRows,t.size),selectedRowsData:lt(this.config.tableRows,this.state.selectedRows)})}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}notifySubscribers(){this.subscribers.forEach(t=>t(this.state))}isRowSelected(t){return!!this.config.enableRowSelection&&(t=>this.state.selectedRows.has(t))(t)}areAllRowsSelected(){return!!this.config.enableRowSelection&&(e=this.state.selectedRows,0!==(t=this.config.tableRows).length&&t.filter(t=>t&&t.rowId).every(t=>e.has(g(t.rowId))));var t,e}getSelectedRows(){return this.state.selectedRows}getSelectedRowCount(){return this.state.selectedRowCount}getSelectedRowsData(){return this.state.selectedRowsData}setSelectedRows(t){this.state=Object.assign(Object.assign({},this.state),{selectedRows:t}),this.updateDerivedState(),this.notifySubscribers()}handleRowSelect(t,e){if(!this.config.enableRowSelection)return;const n=(t=>{const e=new Set(this.state.selectedRows);return e.has(t)?e.delete(t):e.add(t),e})(t);if(this.state=Object.assign(Object.assign({},this.state),{selectedRows:n}),this.updateDerivedState(),this.config.onRowSelectionChange){const o=this.config.tableRows.find(e=>g(e.rowId)===t);o&&this.config.onRowSelectionChange({row:o.row,isSelected:e,selectedRows:n})}this.notifySubscribers()}handleSelectAll(t){if(!this.config.enableRowSelection)return;let e;t?(e=new Set(this.config.tableRows.filter(t=>t&&t.rowId).map(t=>g(t.rowId))),this.config.onRowSelectionChange&&this.config.tableRows.forEach(t=>this.config.onRowSelectionChange({row:t.row,isSelected:!0,selectedRows:e}))):(e=new Set,this.config.onRowSelectionChange&&this.state.selectedRows.forEach(t=>{const n=this.config.tableRows.find(e=>g(e.rowId)===t);n&&this.config.onRowSelectionChange({row:n.row,isSelected:!1,selectedRows:e})})),this.state=Object.assign(Object.assign({},this.state),{selectedRows:e}),this.updateDerivedState(),this.notifySubscribers()}handleToggleRow(t){if(!this.config.enableRowSelection)return;const e=this.isRowSelected(t);this.handleRowSelect(t,!e)}clearSelection(){if(this.config.enableRowSelection){if(this.config.onRowSelectionChange){const t=new Set;this.state.selectedRows.forEach(e=>{const n=this.config.tableRows.find(t=>g(t.rowId)===e);n&&this.config.onRowSelectionChange({row:n.row,isSelected:!1,selectedRows:t})})}this.state=Object.assign(Object.assign({},this.state),{selectedRows:new Set}),this.updateDerivedState(),this.notifySubscribers()}}getState(){return this.state}destroy(){this.subscribers.clear()}}class at{constructor(){this.callbacks=new Set,this.isListening=!1,this.handleResize=()=>{this.callbacks.forEach(t=>t())}}addCallback(t){return this.callbacks.add(t),this.isListening||this.startListening(),()=>{this.callbacks.delete(t),0===this.callbacks.size&&this.stopListening()}}startListening(){this.isListening||(window.addEventListener("resize",this.handleResize),this.isListening=!0)}stopListening(){this.isListening&&(window.removeEventListener("resize",this.handleResize),this.isListening=!1)}destroy(){this.stopListening(),this.callbacks.clear()}}class ct{constructor(t){this.isListening=!1,this.handleClickOutside=t=>{var e,n,o,i,s,r;const l=t.target;if(!l.closest(".editable-cell-input")||!l.closest(".st-header-cell")){if(this.config.activeHeaderDropdown&&this.config.setActiveHeaderDropdown){const t=l.closest(".st-dropdown-content")||l.closest(".dropdown-content");l.closest(".st-header-cell")||t||this.config.setActiveHeaderDropdown(null)}if(!(l.closest(".st-cell")||this.config.selectableColumns&&(l.classList.contains("st-header-cell")||l.classList.contains("st-header-label")||l.classList.contains("st-header-label-text")))){const t=null!==(o=null===(n=(e=this.config).getSelectedCells)||void 0===n?void 0:n.call(e))&&void 0!==o?o:this.config.selectedCells,l=null!==(r=null===(s=(i=this.config).getSelectedColumns)||void 0===s?void 0:s.call(i))&&void 0!==r?r:this.config.selectedColumns;(t.size>0||l.size>0)&&(this.config.onClearSelection?this.config.onClearSelection():(this.config.setSelectedCells(new Set),this.config.setSelectedColumns(new Set),this.config.startCell&&(this.config.startCell.current=null)))}}},this.config=t}updateConfig(t){this.config=Object.assign(Object.assign({},this.config),t)}startListening(){this.isListening||(document.addEventListener("mousedown",this.handleClickOutside),this.isListening=!0)}stopListening(){this.isListening&&(document.removeEventListener("mousedown",this.handleClickOutside),this.isListening=!1)}destroy(){this.stopListening()}}class ht{constructor(t){this.isMainSectionScrollable=!1,this.headerContainer=null,this.mainSection=null,this.scrollbarWidth=0,this.resizeObserver=null,this.observers=new Set,this.rafId=null,this.headerContainer=t.headerContainer||null,this.mainSection=t.mainSection||null,this.scrollbarWidth=t.scrollbarWidth,this.mainSection&&this.headerContainer&&this.initialize()}initialize(){this.mainSection&&this.headerContainer&&(this.checkScrollability(),this.resizeObserver=new ResizeObserver(()=>{null!==this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=requestAnimationFrame(()=>{this.rafId=null,this.checkScrollability()})}),this.resizeObserver.observe(this.mainSection))}checkScrollability(){if(this.mainSection){const t=this.mainSection.scrollHeight>this.mainSection.clientHeight;t!==this.isMainSectionScrollable&&(this.isMainSectionScrollable=t,this.updateHeaderPadding(),this.notifyObservers())}}updateHeaderPadding(){this.headerContainer&&(this.isMainSectionScrollable?(this.headerContainer.classList.add("st-header-scroll-padding"),this.headerContainer.style.setProperty("--st-after-width",this.scrollbarWidth+"px")):this.headerContainer.classList.remove("st-header-scroll-padding"))}setScrollbarWidth(t){this.scrollbarWidth=t,this.updateHeaderPadding()}setHeaderContainer(t){this.headerContainer&&this.headerContainer.classList.remove("st-header-scroll-padding"),this.headerContainer=t,this.updateHeaderPadding()}setMainSection(t){this.resizeObserver&&this.mainSection&&this.resizeObserver.unobserve(this.mainSection),this.mainSection=t,this.mainSection&&this.headerContainer&&this.initialize()}getIsMainSectionScrollable(){return this.isMainSectionScrollable}subscribe(t){return this.observers.add(t),()=>{this.observers.delete(t)}}notifyObservers(){this.observers.forEach(t=>t(this.isMainSectionScrollable))}destroy(){null!==this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.resizeObserver&&this.mainSection&&(this.resizeObserver.unobserve(this.mainSection),this.resizeObserver=null),this.headerContainer&&this.headerContainer.classList.remove("st-header-scroll-padding"),this.observers.clear()}}const ut=(t,e)=>{if(!e||0===e.length)return new Set;if(t){const t=Array.from({length:e.length},(t,e)=>e);return new Set(t)}return new Set};class pt{constructor(t,e){this.observers=new Set,this.expandedDepths=ut(t,e)}updateRowGrouping(t){if(!t||0===t.length)return void this.setExpandedDepths(new Set);const e=t.length,n=Array.from(this.expandedDepths).filter(t=>e>t);this.setExpandedDepths(new Set(n))}getExpandedDepths(){return this.expandedDepths}setExpandedDepths(t){this.expandedDepths=t,this.notifyObservers()}subscribe(t){return this.observers.add(t),()=>{this.observers.delete(t)}}notifyObservers(){this.observers.forEach(t=>t(this.expandedDepths))}expandAll(){const t=new Set;for(let e=0;10>e;e++)t.add(e);this.setExpandedDepths(t)}collapseAll(){this.setExpandedDepths(new Set)}expandDepth(t){const e=new Set(this.expandedDepths);e.add(t),this.setExpandedDepths(e)}collapseDepth(t){const e=new Set(this.expandedDepths);e.delete(t),this.setExpandedDepths(e)}toggleDepth(t){this.expandedDepths.has(t)?this.collapseDepth(t):this.expandDepth(t)}destroy(){this.observers.clear()}}class ft{constructor(){this.announcement="",this.timeoutId=null,this.observers=new Set}announce(t){this.announcement=t,this.notifyObservers(),this.timeoutId&&clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.announcement="",this.notifyObservers()},1e3)}getAnnouncement(){return this.announcement}subscribe(t){return this.observers.add(t),()=>{this.observers.delete(t)}}notifyObservers(){this.observers.forEach(t=>t(this.announcement))}destroy(){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null),this.observers.clear(),this.announcement=""}}function wt(t){return t?t.offsetWidth-t.clientWidth:0}const vt=t=>{if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map(vt);const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=vt(t[n]));return e},mt=(t,e)=>t.filter(t=>t.pinned===e).some(t=>!t.hide&&!t.excludeFromRender),gt=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("width","24"),e.setAttribute("height","24"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"),n.setAttribute("fill","inherit"),e.appendChild(n),e},bt=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("width","24"),e.setAttribute("height","24"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z"),n.setAttribute("fill","inherit"),e.appendChild(n),e},xt=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false"),e.setAttribute("role","img"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("viewBox","0 0 320 512"),e.setAttribute("height","1em"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M298 177.5c3.8-8.8 2-19-4.6-26l-116-144C172.9 2.7 166.6 0 160 0s-12.9 2.7-17.4 7.5l-116 144c-6.6 7-8.4 17.2-4.6 26S34.4 192 44 192l72 0 0 288c0 17.7 14.3 32 32 32l24 0c17.7 0 32-14.3 32-32l0-288 72 0c9.6 0 18.2-5.7 22-14.5z"),n.setAttribute("fill","inherit"),e.appendChild(n),e},yt=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false"),e.setAttribute("role","img"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("viewBox","0 0 320 512"),e.setAttribute("height","1em"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M22 334.5c-3.8 8.8-2 19 4.6 26l116 144c4.5 4.8 10.8 7.5 17.4 7.5s12.9-2.7 17.4-7.5l116-144c6.6-7 8.4-17.2 4.6-26s-12.5-14.5-22-14.5l-72 0 0-288c0-17.7-14.3-32-32-32L148 0C130.3 0 116 14.3 116 32l0 288-72 0c-9.6 0-18.2 5.7-22 14.5z"),n.setAttribute("fill","inherit"),e.appendChild(n),e},Rt=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");return e.setAttribute("aria-hidden","true"),e.setAttribute("role","img"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("viewBox","0 0 16 10"),e.setAttribute("width","16px"),e.setAttribute("height","10px"),t&&e.setAttribute("class",t),[{cx:"3",cy:"3"},{cx:"8",cy:"3"},{cx:"13",cy:"3"},{cx:"3",cy:"7"},{cx:"8",cy:"7"},{cx:"13",cy:"7"}].forEach(({cx:t,cy:n})=>{const o=document.createElementNS("http://www.w3.org/2000/svg","circle");o.setAttribute("cx",t),o.setAttribute("cy",n),o.setAttribute("r","1.5"),o.setAttribute("fill","currentColor"),e.appendChild(o)}),e},Ct=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("aria-hidden","true"),e.setAttribute("role","img"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("viewBox","0 0 512 512"),e.setAttribute("height","1em"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M3.9 54.9C10.5 40.9 24.5 32 40 32l432 0c15.5 0 29.5 8.9 36.1 22.9s4.6 30.5-5.2 42.5L320 320.9 320 448c0 12.1-6.8 23.2-17.7 28.6s-23.8 4.3-33.5-3l-64-48c-8.1-6-12.8-15.5-12.8-25.6l0-79.1L9 97.3C-.7 85.4-2.8 68.8 3.9 54.9z"),n.setAttribute("fill","inherit"),e.appendChild(n),e};function St(t){return{pinnedLeft:t.filter(t=>"left"===t.pinned),unpinned:t.filter(t=>!t.pinned),pinnedRight:t.filter(t=>"right"===t.pinned)}}function It(t,e){return!0===t.isEssential||e.has(t.accessor+"")}function Ht(t,e){let n=!1;for(const o of t){if(o.isSelectionColumn||o.excludeFromRender)continue;const t=It(o,e);if(t&&n)return!1;t||(n=!0)}return!0}function Mt(t,e){var n;const{pinnedLeft:o,unpinned:i,pinnedRight:s}=St(t);if(!Ht(o,e))return!1;if(!Ht(i,e))return!1;if(!Ht(s,e))return!1;for(const o of t)if((null===(n=o.children)||void 0===n?void 0:n.length)&&!kt(o.children,e))return!1;return!0}function kt(t,e){var n;if(!Ht(t,e))return!1;for(const o of t)if((null===(n=o.children)||void 0===n?void 0:n.length)&&!kt(o.children,e))return!1;return!0}function Et(t){const{pinnedLeft:e,unpinned:n,pinnedRight:o}=St(t);return{left:e.map(t=>t.accessor),main:n.map(t=>t.accessor),right:o.map(t=>t.accessor)}}function Ot(t,e,n){return[...t.filter(t=>It(e.get(t+""),n)),...t.filter(t=>!It(e.get(t+""),n))]}function Tt(t,e,n){const o=new Set(t.map(t=>t.accessor+"")),i=[...e.left,...e.main,...e.right];if(i.length!==o.size)return null;for(const t of i)if(!o.has(t+""))return null;const s=new Map(t.map(t=>[t.accessor+"",t])),r=Ot(e.left,s,n),l=Ot(e.main,s,n),d=Ot(e.right,s,n),a=(t,e)=>{const n=Object.assign({},t);return"left"===e?n.pinned="left":"right"===e?n.pinned="right":delete n.pinned,n};return[...r.map(t=>a(s.get(t+""),"left")),...l.map(t=>a(s.get(t+""),void 0)),...d.map(t=>a(s.get(t+""),"right"))]}function At(t,e,n,o){const i=e+"",s=Et(t),r=s.left.filter(t=>t+""!==i),l=s.main.filter(t=>t+""!==i),d=s.right.filter(t=>t+""!==i),a=t.find(t=>t.accessor+""===i);return a&&(!It(a,o)||"main"!==n||"left"!==a.pinned&&"right"!==a.pinned)?("left"===n?r.push(e):"right"===n?d.push(e):"left"===a.pinned?l.unshift(e):l.push(e),Tt(t,{left:r,main:l,right:d},o)):null}class Wt{static resolveIcons(t){var e,n,o,i,s,r,l,d,a,c,h,u,p,f,w,v,m,g;const b={drag:Rt("st-drag-icon"),expand:bt("st-expand-icon"),filter:Ct("st-header-icon"),headerCollapse:bt("st-header-icon"),headerExpand:gt("st-header-icon"),next:bt("st-next-prev-icon"),prev:gt("st-next-prev-icon"),sortDown:yt("st-header-icon"),sortUp:xt("st-header-icon")};return{drag:null!==(n=null===(e=t.icons)||void 0===e?void 0:e.drag)&&void 0!==n?n:b.drag,expand:null!==(i=null===(o=t.icons)||void 0===o?void 0:o.expand)&&void 0!==i?i:b.expand,filter:null!==(r=null===(s=t.icons)||void 0===s?void 0:s.filter)&&void 0!==r?r:b.filter,headerCollapse:null!==(d=null===(l=t.icons)||void 0===l?void 0:l.headerCollapse)&&void 0!==d?d:b.headerCollapse,headerExpand:null!==(c=null===(a=t.icons)||void 0===a?void 0:a.headerExpand)&&void 0!==c?c:b.headerExpand,next:null!==(u=null===(h=t.icons)||void 0===h?void 0:h.next)&&void 0!==u?u:b.next,prev:null!==(f=null===(p=t.icons)||void 0===p?void 0:p.prev)&&void 0!==f?f:b.prev,sortDown:null!==(v=null===(w=t.icons)||void 0===w?void 0:w.sortDown)&&void 0!==v?v:b.sortDown,sortUp:null!==(g=null===(m=t.icons)||void 0===m?void 0:m.sortUp)&&void 0!==g?g:b.sortUp}}static mergeCustomTheme(e){return Object.assign(Object.assign({},t),e.customTheme)}static mergeColumnEditorConfig(t){var e,n,o,i,s,r,l,d,a,c,h;return{text:null!==(n=null===(e=t.columnEditorConfig)||void 0===e?void 0:e.text)&&void 0!==n?n:"Columns",searchEnabled:null===(i=null===(o=t.columnEditorConfig)||void 0===o?void 0:o.searchEnabled)||void 0===i||i,searchPlaceholder:null!==(r=null===(s=t.columnEditorConfig)||void 0===s?void 0:s.searchPlaceholder)&&void 0!==r?r:"Search columns...",allowColumnPinning:null===(d=null===(l=t.columnEditorConfig)||void 0===l?void 0:l.allowColumnPinning)||void 0===d||d,searchFunction:null===(a=t.columnEditorConfig)||void 0===a?void 0:a.searchFunction,rowRenderer:null===(c=t.columnEditorConfig)||void 0===c?void 0:c.rowRenderer,customRenderer:null===(h=t.columnEditorConfig)||void 0===h?void 0:h.customRenderer}}static buildEssentialAccessors(t){return function(t){const e=new Set,n=t=>{var o;for(const i of t)i.isEssential&&e.add(i.accessor+""),(null===(o=i.children)||void 0===o?void 0:o.length)&&n(i.children)};return n(t),e}(t)}static getInitialCollapsedHeaders(t){const e=new Set,n=t=>{t.forEach(t=>{t.collapseDefault&&t.collapsible&&e.add(t.accessor),t.children&&n(t.children)})};return n(t),e}static getInitialExpandedDepths(t){var e;return ut(null===(e=t.expandAll)||void 0===e||e,t.rowGrouping)}}class Pt{constructor(){this.elements=null,this.refs={mainBodyRef:{current:null},pinnedLeftRef:{current:null},pinnedRightRef:{current:null},mainHeaderRef:{current:null},pinnedLeftHeaderRef:{current:null},pinnedRightHeaderRef:{current:null},headerContainerRef:{current:null},tableBodyContainerRef:{current:null},horizontalScrollbarRef:{current:null}}}createDOMStructure(t,e){var n,o,i;const s=null!==(n=e.theme)&&void 0!==n?n:"modern-light",r=null!==(o=e.className)&&void 0!==o?o:"",l=null!==(i=e.columnBorders)&&void 0!==i&&i,d=document.createElement("div");d.className=`simple-table-root st-wrapper theme-${s} ${r} ${l?"st-column-borders":""}`,d.setAttribute("role","grid");const a=document.createElement("div");a.className="st-wrapper-container";const c=document.createElement("div");c.className="st-content-wrapper";const h=document.createElement("div");h.className="st-content",h.style.width=e.editColumns?"calc(100% - 29.5px)":"100%";const u=document.createElement("div");u.className="st-header-container",this.refs.headerContainerRef.current=u;const p=document.createElement("div");p.className="st-body-container",this.refs.tableBodyContainerRef.current=p;const f=document.createElement("div");f.id="st-footer-container";const w=document.createElement("div");return w.setAttribute("aria-live","polite"),w.setAttribute("aria-atomic","true"),w.className="st-sr-only",h.appendChild(u),h.appendChild(p),c.appendChild(h),a.appendChild(c),a.appendChild(f),d.appendChild(a),d.appendChild(w),t.appendChild(d),this.elements={rootElement:d,wrapperContainer:a,contentWrapper:c,content:h,headerContainer:u,bodyContainer:p,footerContainer:f,ariaLiveRegion:w},this.elements}updateTheme(t){if(!this.elements)return;const e=this.elements.rootElement,n=e.className.replace(/\btheme-\S+/g,"").trim();e.className=`${n} theme-${t}`}getElements(){return this.elements}getRefs(){return this.refs}destroy(t){var e;(null===(e=this.elements)||void 0===e?void 0:e.rootElement)&&t.contains(this.elements.rootElement)&&t.removeChild(this.elements.rootElement),this.elements=null}}const Lt=new WeakMap;let $t=0,Dt=Date.now(),Ft={screenX:0,screenY:0},jt=null;const Bt=t=>{Dt=t},Nt=new WeakMap,zt=t=>(Nt.has(t)||Nt.set(t,new Map),Nt.get(t)),qt=new WeakMap,Vt=t=>(qt.has(t)||qt.set(t,new Map),qt.get(t)),Gt=(t,e)=>{const n=Date.now();0!==$t&&e>n-$t||($t=n,t())},Ut=(t,e,n,o)=>{t.addEventListener(e,n,o),Lt.has(t)||Lt.set(t,[]),Lt.get(t).push({event:e,handler:n,options:o})},Kt=t=>{const e=t.closest(".simple-table-root");null==e||e.querySelectorAll(".st-tooltip").forEach(t=>t.remove())},Jt=t=>{if($t=0,t){const e=zt(t);e.forEach(t=>{t.remove()}),e.clear(),Vt(t).clear(),Kt(t)}},Yt={equals:"Equals",notEquals:"Not equals",contains:"Contains",notContains:"Does not contain",startsWith:"Starts with",endsWith:"Ends with",greaterThan:"Greater than",lessThan:"Less than",greaterThanOrEqual:"Greater than or equal",lessThanOrEqual:"Less than or equal",between:"Between",notBetween:"Not between",before:"Before",after:"After",in:"Is one of",notIn:"Is not one of",isEmpty:"Is empty",isNotEmpty:"Is not empty"},_t=t=>{switch(t){case"string":return["equals","notEquals","contains","notContains","startsWith","endsWith","isEmpty","isNotEmpty"];case"number":return["equals","notEquals","greaterThan","lessThan","greaterThanOrEqual","lessThanOrEqual","between","notBetween","isEmpty","isNotEmpty"];case"boolean":return["equals","isEmpty","isNotEmpty"];case"date":return["equals","notEquals","before","after","between","notBetween","isEmpty","isNotEmpty"];case"enum":return["in","notIn","isEmpty","isNotEmpty"];default:return["equals","notEquals","isEmpty","isNotEmpty"]}},Xt=t=>!["between","notBetween","in","notIn","isEmpty","isNotEmpty"].includes(t),Qt=t=>["between","notBetween","in","notIn"].includes(t),Zt=t=>["isEmpty","isNotEmpty"].includes(t),te=t=>{var e;return null!==(e=null==t?void 0:t.closest(".simple-table-root"))&&void 0!==e?e:null},ee=t=>{var e,n,o;let{children:i,containerRef:s,mainBodyRef:r,anchorElement:l,onClose:d,open:a,overflow:c="auto",width:h,maxWidth:u,positioning:p="fixed",allowDescendantOverflow:f=!1}=t,w=f;const v="st-dropdown-content--allow-descendant-overflow",m=document.createElement("div");m.className="st-dropdown-content",w&&m.classList.add(v),m.style.position=p,m.style.overflow=w?"visible":c,h&&(m.style.width=h+"px"),u&&(m.style.maxWidth=u+"px"),m.addEventListener("click",t=>t.stopPropagation()),m.addEventListener("mousedown",t=>t.stopPropagation()),m.addEventListener("touchstart",t=>t.stopPropagation()),m.appendChild(i);let g=l;if("fixed"===p){const t=null!==(o=null!==(n=null!==(e=te(g))&&void 0!==e?e:te(null!=r?r:null))&&void 0!==n?n:te(null!=s?s:null))&&void 0!==o?o:document.querySelector(".simple-table-root");(null!=t?t:document.body).appendChild(m)}const b=t=>{a&&m&&!m.contains(t.target)&&(C(!1),null==d||d())},x=t=>{const e=t.target;if(!m.contains(e)&&!(null==g?void 0:g.contains(e))){if("absolute"===p){const t=m.parentElement;if(null==t?void 0:t.contains(e))return}C(!1),null==d||d()}},y=t=>{"Escape"===t.key&&a&&(C(!1),null==d||d())},R=t=>{"Enter"===t.key&&x(t)},C=t=>{a=t,a?(m.style.display="flex",(()=>{if(!a)return;if("absolute"===p&&!m.parentElement)return;if("fixed"===p&&!m.parentElement)return;m.style.visibility="hidden";const t=g||m.parentElement;t&&requestAnimationFrame(()=>{const e=t.getBoundingClientRect(),n=m.offsetHeight,o=h||m.offsetWidth;let i;i=s?s.getBoundingClientRect():r?r.getBoundingClientRect():{top:0,right:window.innerWidth,bottom:window.innerHeight,left:0,width:window.innerWidth,height:window.innerHeight,x:0,y:0,toJSON:()=>{}};const l=i.bottom-e.bottom,d=e.top-i.top;let a="bottom";(n>l&&d>=n||n>l&&d>l)&&(a="top");let c="left";if(o>i.right-e.right+e.width&&(c="right"),"fixed"===p)"bottom"===a?(m.style.top=e.bottom+4+"px",m.style.bottom="auto"):(m.style.bottom=window.innerHeight-e.top+4+"px",m.style.top="auto"),"left"===c?(m.style.left=e.left+"px",m.style.right="auto"):(m.style.right=window.innerWidth-e.right+"px",m.style.left="auto");else{const t=m.parentElement;if(!t)return;const n=t.getBoundingClientRect();"bottom"===a?(m.style.top=e.bottom-n.top+4+"px",m.style.bottom="auto"):(m.style.bottom=n.bottom-e.top+4+"px",m.style.top="auto"),"left"===c?(m.style.left=e.left-n.left+"px",m.style.right="auto"):(m.style.right=n.right-e.right+"px",m.style.left="auto")}m.className=`st-dropdown-content st-dropdown-${a}-${c}${w?" "+v:""}`,m.style.visibility="visible"})})(),window.addEventListener("scroll",b,!0),document.addEventListener("mousedown",x,!0),document.addEventListener("keydown",R,!0),document.addEventListener("keydown",y)):(m.style.display="none",window.removeEventListener("scroll",b,!0),document.removeEventListener("mousedown",x,!0),document.removeEventListener("keydown",R,!0),document.removeEventListener("keydown",y))};return a?C(!0):m.style.display="none",{element:m,update:t=>{void 0!==t.anchorElement&&(g=t.anchorElement),void 0!==t.open&&C(t.open),void 0!==t.children&&(m.innerHTML="",m.appendChild(t.children)),void 0!==t.width&&(h=t.width,m.style.width=h?h+"px":"auto"),void 0!==t.maxWidth&&(u=t.maxWidth,m.style.maxWidth=u?u+"px":""),void 0!==t.overflow&&(c=t.overflow,m.style.overflow=w?"visible":c),void 0!==t.allowDescendantOverflow&&(w=t.allowDescendantOverflow,m.classList.toggle(v,w),m.style.overflow=w?"visible":c)},destroy:()=>{C(!1),m.remove()},setOpen:C}},ne=t=>{let{value:e,onChange:n,options:o,placeholder:i="Select...",className:s="",disabled:r=!1,containerRef:l,mainBodyRef:d}=t,a=!1,c=-1;const h=document.createElement("div");h.className=`st-custom-select ${s} ${r?"st-custom-select-disabled":""}`.trim();const u=document.createElement("button");u.type="button",u.className="st-custom-select-trigger",u.disabled=r,u.setAttribute("aria-haspopup","listbox"),u.setAttribute("aria-expanded","false"),u.setAttribute("aria-labelledby","select-label");const p=document.createElement("span");p.className="st-custom-select-value";const f=o.find(t=>t.value===e);p.textContent=f?f.label:i;const w=document.createElement("template");w.innerHTML='<svg\n class="st-custom-select-arrow"\n width="12"\n height="12"\n viewBox="0 0 12 12"\n fill="none"\n xmlns="http://www.w3.org/2000/svg"\n>\n <path\n d="M3 4.5L6 7.5L9 4.5"\n stroke="currentColor"\n stroke-width="1.5"\n stroke-linecap="round"\n stroke-linejoin="round"\n />\n</svg>';const v=w.content.firstElementChild;u.appendChild(p),u.appendChild(v),h.appendChild(u);const m=document.createElement("div");m.className="st-custom-select-options",m.setAttribute("role","listbox");const g=()=>{m.innerHTML="",o.forEach((t,n)=>{const o=document.createElement("div");o.className=`st-custom-select-option ${t.value===e?"st-custom-select-option-selected":""} ${n===c?"st-custom-select-option-focused":""}`.trim(),o.setAttribute("role","option"),o.setAttribute("aria-selected",""+(t.value===e)),o.setAttribute("tabindex","0"),o.textContent=t.label,o.addEventListener("click",()=>y(t.value)),o.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),y(t.value))}),m.appendChild(o)})};g();const b=ee({children:m,containerRef:l,mainBodyRef:d,anchorElement:u,onClose:()=>{S(!1)},open:a,overflow:"auto",positioning:"absolute"});h.appendChild(b.element);const x=t=>{e=t;const n=o.find(t=>t.value===e);p.textContent=n?n.label:i},y=t=>{x(t),n(t),S(!1),c=-1,g()},R=()=>{if(!r){if(S(!a),a)c=-1;else{const t=o.findIndex(t=>t.value===e);c=0>t?0:t}g()}},C=t=>{if(a)switch(t.key){case"ArrowDown":t.preventDefault(),c=o.length-1>c?c+1:0,g();break;case"ArrowUp":t.preventDefault(),c=c>0?c-1:o.length-1,g();break;case"Enter":if(t.preventDefault(),c>=0){const t=o[c].value;x(t),n(t),S(!1),c=-1,g()}break;case"Escape":t.preventDefault(),S(!1),c=-1,g()}},S=t=>{a=t,u.setAttribute("aria-expanded",""+a),a?(h.classList.add("st-custom-select-open"),document.addEventListener("keydown",C)):(h.classList.remove("st-custom-select-open"),document.removeEventListener("keydown",C)),b.setOpen(a)};return u.addEventListener("click",R),{element:h,update:t=>{if(void 0!==t.value){e=t.value;const n=o.find(t=>t.value===e);p.textContent=n?n.label:i,g()}void 0!==t.options&&(o=t.options,g()),void 0!==t.disabled&&(r=t.disabled,u.disabled=r,r?h.classList.add("st-custom-select-disabled"):h.classList.remove("st-custom-select-disabled")),void 0!==t.onChange&&(n=t.onChange)},destroy:()=>{u.removeEventListener("click",R),document.removeEventListener("keydown",C),b.destroy(),h.remove()},setOpen:S}},oe=t=>{let{type:e="text",value:n,onChange:o,onEnter:i,placeholder:s="",autoFocus:r=!1,min:l,max:d,step:a}=t;const c=document.createElement("input");c.className="st-filter-input",c.type=e,c.value=n,c.placeholder=s,void 0!==l&&(c.min=l),void 0!==d&&(c.max=d),void 0!==a&&(c.step=a),r&&setTimeout(()=>c.focus(),0);const h=t=>{o(t.target.value)},u=t=>{"Enter"===t.key&&i&&(t.preventDefault(),i())};return c.addEventListener("input",h),c.addEventListener("keydown",u),{element:c,update:t=>{void 0!==t.value&&(n=t.value,c.value=n),void 0!==t.type&&(e=t.type,c.type=e),void 0!==t.placeholder&&(s=t.placeholder,c.placeholder=s),void 0!==t.min&&(l=t.min,c.min=l),void 0!==t.max&&(d=t.max,c.max=d),void 0!==t.step&&(a=t.step,c.step=a),void 0!==t.onChange&&(o=t.onChange),void 0!==t.onEnter&&(i=t.onEnter)},destroy:()=>{c.removeEventListener("input",h),c.removeEventListener("keydown",u),c.remove()}}},ie=t=>{let{onApply:e,onClear:n,canApply:o,showClear:i}=t;const s=document.createElement("div");s.className="st-filter-actions";const r=document.createElement("button");r.type="button",r.tabIndex=0,r.textContent="Apply";const l=()=>{r.disabled=!o,r.className=("st-filter-button st-filter-button-apply"+(o?"":" st-filter-button-disabled")).trim()};l();const d=()=>{e()};r.addEventListener("click",d),s.appendChild(r);let a=null;const c=()=>{null==n||n()},h=()=>{const t=i&&!!n;t&&!a?(a=document.createElement("button"),a.type="button",a.tabIndex=0,a.className="st-filter-button st-filter-button-clear",a.textContent="Clear",a.addEventListener("click",c),s.appendChild(a)):!t&&a&&(a.removeEventListener("click",c),a.remove(),a=null)};return h(),{element:s,update:t=>{void 0!==t.canApply&&(o=t.canApply,l()),void 0!==t.showClear&&(i=t.showClear,h()),void 0!==t.onApply&&(e=t.onApply),void 0!==t.onClear&&(n=t.onClear,h())},destroy:()=>{r.removeEventListener("click",d),a&&a.removeEventListener("click",c),s.remove()}}},se=t=>{let{onChange:e,onClose:n,value:o}=t,i=o||new Date,s="days";const r=document.createElement("div");r.className="st-datepicker";const l=(t,e)=>new Date(t,e+1,0).getDate(),d=()=>{i=new Date(i.getFullYear(),i.getMonth()-1,1),f()},a=()=>{i=new Date(i.getFullYear(),i.getMonth()+1,1),f()},c=t=>{i=new Date(t,i.getMonth(),1),s="months",f()},h=t=>{const o=i.getFullYear(),s=i.getMonth(),r=new Date(o,s,t,12,0,0);i=r,e(r),null==n||n()},u=t=>{const o=new Date(i.getFullYear(),i.getMonth()-1,t,12,0,0);i=o,e(o),null==n||n()},p=t=>{const o=new Date(i.getFullYear(),i.getMonth()+1,t,12,0,0);i=o,e(o),null==n||n()},f=()=>{r.innerHTML="";const t=document.createElement("div");if(t.className="st-datepicker-header","days"===s){const e=document.createElement("button");e.className="st-datepicker-nav-btn",e.innerHTML='<svg viewBox="0 0 24 24" width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n <path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z" />\n</svg>',e.addEventListener("click",d);const n=document.createElement("div");n.className="st-datepicker-header-label",n.textContent=`${w=i,w.toLocaleString("default",{month:"long"})} ${i.getFullYear()}`,n.addEventListener("click",()=>{s="months",f()});const o=document.createElement("button");o.className="st-datepicker-nav-btn",o.innerHTML='<svg viewBox="0 0 24 24" width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n <path d="M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z" />\n</svg>',o.addEventListener("click",a),t.appendChild(e),t.appendChild(n),t.appendChild(o)}else if("months"===s){const e=document.createElement("div");e.className="st-datepicker-header-label",e.textContent=""+i.getFullYear(),e.addEventListener("click",()=>{s="years",f()}),t.appendChild(e)}else{const e=document.createElement("div");e.className="st-datepicker-header-label",e.textContent="Select Year",t.appendChild(e)}var w;r.appendChild(t);const v=document.createElement("div");var m;v.className=`st-datepicker-grid st-datepicker-${s}-grid`,"days"===s?(t=>{const e=i.getFullYear(),n=i.getMonth(),s=l(e,n),r=((t,e)=>new Date(t,e,1).getDay())(e,n),d=l(e,n-1);["Su","Mo","Tu","We","Th","Fr","Sa"].forEach(e=>{const n=document.createElement("div");n.className="st-datepicker-weekday",n.textContent=e,t.appendChild(n)});for(let e=0;r>e;e++){const n=d-r+e+1,o=document.createElement("div");o.className="st-datepicker-day other-month",o.textContent=""+n,o.addEventListener("click",()=>u(n)),t.appendChild(o)}for(let i=1;s>=i;i++){const s=i===(new Date).getDate()&&n===(new Date).getMonth()&&e===(new Date).getFullYear(),r=new Date(o),l=i===r.getDate()&&n===r.getMonth()&&e===r.getFullYear(),d=document.createElement("div");d.className=`st-datepicker-day ${s?"today":""} ${l?"selected":""}`.trim(),d.textContent=""+i,d.addEventListener("click",()=>h(i)),t.appendChild(d)}const a=35-(r+s);for(let e=1;a>=e;e++){const n=document.createElement("div");n.className="st-datepicker-day other-month",n.textContent=""+e,n.addEventListener("click",()=>p(e)),t.appendChild(n)}})(v):"months"===s?(m=v,Array.from({length:12},(t,e)=>new Date(2e3,e,1).toLocaleString("default",{month:"short"})).forEach((t,e)=>{const n=e===i.getMonth(),o=document.createElement("div");o.className=("st-datepicker-month "+(n?"selected":"")).trim(),o.textContent=t,o.addEventListener("click",()=>(t=>{i=new Date(i.getFullYear(),t,1),s="days",f()})(e)),m.appendChild(o)})):(t=>{const e=i.getFullYear(),n=e-6;for(let o=n;n+12>o;o++){const n=o===e,i=document.createElement("div");i.className=("st-datepicker-year "+(n?"selected":"")).trim(),i.textContent=""+o,i.addEventListener("click",()=>c(o)),t.appendChild(i)}})(v),r.appendChild(v);const g=document.createElement("div");g.className="st-datepicker-footer";const b=document.createElement("button");b.className="st-datepicker-today-btn",b.textContent="Today",b.addEventListener("click",()=>{const t=new Date,o=new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0);i=o,e(o),null==n||n()}),g.appendChild(b),r.appendChild(g)};return f(),{element:r,update:t=>{void 0!==t.value&&(o=t.value,i=o||new Date,f()),void 0!==t.onChange&&(e=t.onChange),void 0!==t.onClose&&(n=t.onClose)},destroy:()=>{r.remove()}}},re=()=>{const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("aria-hidden","true"),t.setAttribute("role","img"),t.setAttribute("xmlns","http://www.w3.org/2000/svg"),t.setAttribute("viewBox","0 0 448 512"),t.setAttribute("class","st-checkbox-checkmark"),t.style.height="10px";const e=document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttribute("d","M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"),t.appendChild(e),t},le=(t,e)=>{const n=t.querySelector(".st-checkbox-input"),o=t.querySelector(".st-checkbox-custom");n&&o&&n.checked!==e&&(n.checked=e,n.setAttribute("aria-checked",e+""),o.className="st-checkbox-custom "+(e?"st-checked":""),o.setAttribute("aria-hidden","true"),o.innerHTML="",e&&o.appendChild(re()))},de=({checked:t,onChange:e,ariaLabel:n})=>{const o=document.createElement("label");o.className="st-checkbox-label";const i=document.createElement("input");i.type="checkbox",i.checked=t,i.className="st-checkbox-input",n&&i.setAttribute("aria-label",n),i.setAttribute("aria-checked",""+t);const s=document.createElement("span");s.className="st-checkbox-custom "+(t?"st-checked":""),s.setAttribute("aria-hidden","true"),t&&s.appendChild(re());const r=()=>{const t=i.checked;i.setAttribute("aria-checked",""+t),t?(s.classList.add("st-checked"),s.appendChild(re())):(s.classList.remove("st-checked"),s.innerHTML=""),e(t)};return i.addEventListener("change",r),i.addEventListener("keydown",t=>{" "===t.key&&t.stopPropagation()}),o.addEventListener("mousedown",t=>{t.stopPropagation()}),o.addEventListener("dragstart",t=>{t.preventDefault(),t.stopPropagation()}),o.appendChild(i),o.appendChild(s),{element:o,update:t=>{i.checked!==t&&(i.checked=t,i.setAttribute("aria-checked",""+t),t?(s.classList.add("st-checked"),s.innerHTML="",s.appendChild(re())):(s.classList.remove("st-checked"),s.innerHTML=""))},destroy:()=>{i.removeEventListener("change",r)}}},ae=t=>{const{header:e}=t;switch(e.type){case"string":default:return(t=>{let{header:e,currentFilter:n,onApplyFilter:o,onClearFilter:i,containerRef:s,mainBodyRef:r}=t,l=(null==n?void 0:n.operator)||"contains",d=((null==n?void 0:n.value)||"")+"";const a=_t("string"),c=document.createElement("div");c.className="st-filter-container";const h=document.createElement("div");h.className="st-filter-section";const u=ne({value:l,onChange:t=>{l=t,g()},options:a.map(t=>({value:t,label:Yt[t]})),containerRef:s,mainBodyRef:r});h.appendChild(u.element),c.appendChild(h);let p=null,f=null,w=null;const v=()=>{const t=Object.assign({accessor:e.accessor,operator:l},Xt(l)&&{value:d});o(t)},m=()=>Zt(l)||""!==d.trim(),g=()=>{p&&(p.remove(),p=null),f&&(f.destroy(),f=null),Xt(l)&&(p=document.createElement("div"),p.className="st-filter-section",f=oe({type:"text",value:d,onChange:t=>{d=t,w&&w.update({canApply:m()})},onEnter:v,placeholder:"Filter...",autoFocus:!0}),p.appendChild(f.element),c.insertBefore(p,c.lastChild)),w&&w.update({canApply:m()})};return w=ie({onApply:v,onClear:i,canApply:m(),showClear:!!n}),c.appendChild(w.element),g(),{element:c,update:t=>{void 0!==t.currentFilter&&(n=t.currentFilter,l=(null==n?void 0:n.operator)||"contains",d=((null==n?void 0:n.value)||"")+"",u.update({value:l}),f&&f.update({value:d}),w&&w.update({showClear:!!n,canApply:m()}),g())},destroy:()=>{u.destroy(),f&&f.destroy(),w&&w.destroy(),c.remove()}}})(t);case"number":return(t=>{var e,n;let{header:o,currentFilter:i,onApplyFilter:s,onClearFilter:r,containerRef:l,mainBodyRef:d}=t,a=(null==i?void 0:i.operator)||"equals",c=((null==i?void 0:i.value)||"")+"",h=((null===(e=null==i?void 0:i.values)||void 0===e?void 0:e[0])||"")+"",u=((null===(n=null==i?void 0:i.values)||void 0===n?void 0:n[1])||"")+"";const p=_t("number"),f=document.createElement("div");f.className="st-filter-container";const w=document.createElement("div");w.className="st-filter-section";const v=ne({value:a,onChange:t=>{a=t,S()},options:p.map(t=>({value:t,label:Yt[t]})),containerRef:l,mainBodyRef:d});w.appendChild(v.element),f.appendChild(w);let m=null,g=null,b=null,x=null,y=null;const R=()=>{const t={accessor:o.accessor,operator:a};Xt(a)?t.value=parseFloat(c):Qt(a)&&(t.values=[parseFloat(h),parseFloat(u)]),s(t)},C=()=>!!Zt(a)||(Xt(a)?""!==c.trim():!!Qt(a)&&""!==h.trim()&&""!==u.trim()),S=()=>{m&&(m.remove(),m=null),g&&(g.destroy(),g=null),b&&(b.destroy(),b=null),x&&(x.destroy(),x=null),Xt(a)?(m=document.createElement("div"),m.className="st-filter-section",g=oe({type:"number",value:c,onChange:t=>{c=t,y&&y.update({canApply:C()})},onEnter:R,placeholder:"Enter number...",autoFocus:!0}),m.appendChild(g.element),f.insertBefore(m,f.lastChild)):Qt(a)&&(m=document.createElement("div"),m.className="st-filter-section",b=oe({type:"number",value:h,onChange:t=>{h=t,y&&y.update({canApply:C()})},onEnter:R,placeholder:"From...",autoFocus:!0}),b.element.classList.add("st-filter-input-range-from"),x=oe({type:"number",value:u,onChange:t=>{u=t,y&&y.update({canApply:C()})},onEnter:R,placeholder:"To..."}),m.appendChild(b.element),m.appendChild(x.element),f.insertBefore(m,f.lastChild)),y&&y.update({canApply:C()})};return y=ie({onApply:R,onClear:r,canApply:C(),showClear:!!i}),f.appendChild(y.element),S(),{element:f,update:t=>{var e,n;void 0!==t.currentFilter&&(i=t.currentFilter,a=(null==i?void 0:i.operator)||"equals",c=((null==i?void 0:i.value)||"")+"",h=((null===(e=null==i?void 0:i.values)||void 0===e?void 0:e[0])||"")+"",u=((null===(n=null==i?void 0:i.values)||void 0===n?void 0:n[1])||"")+"",v.update({value:a}),g&&g.update({value:c}),b&&b.update({value:h}),x&&x.update({value:u}),y&&y.update({showClear:!!i,canApply:C()}),S())},destroy:()=>{v.destroy(),g&&g.destroy(),b&&b.destroy(),x&&x.destroy(),y&&y.destroy(),f.remove()}}})(t);case"boolean":return(t=>{let{header:e,currentFilter:n,onApplyFilter:o,onClearFilter:i,containerRef:s,mainBodyRef:r}=t,l=(null==n?void 0:n.operator)||"equals",d=void 0!==(null==n?void 0:n.value)?n.value+"":"true";const a=_t("boolean"),c=document.createElement("div");c.className="st-filter-container";const h=document.createElement("div");h.className="st-filter-section";const u=ne({value:l,onChange:t=>{l=t,g()},options:a.map(t=>({value:t,label:Yt[t]})),containerRef:s,mainBodyRef:r});h.appendChild(u.element),c.appendChild(h);let p=null,f=null,w=null;const v=()=>Zt(l)||""!==d,m=[{value:"true",label:"True"},{value:"false",label:"False"}],g=()=>{p&&(p.remove(),p=null),f&&(f.destroy(),f=null),Xt(l)&&(p=document.createElement("div"),p.className="st-filter-section",f=ne({value:d,onChange:t=>{d=t,w&&w.update({canApply:v()})},options:m,containerRef:s,mainBodyRef:r}),p.appendChild(f.element),c.insertBefore(p,c.lastChild)),w&&w.update({canApply:v()})};return w=ie({onApply:()=>{const t={accessor:e.accessor,operator:l};Xt(l)&&(t.value="true"===d),o(t)},onClear:i,canApply:v(),showClear:!!n}),c.appendChild(w.element),g(),{element:c,update:t=>{void 0!==t.currentFilter&&(n=t.currentFilter,l=(null==n?void 0:n.operator)||"equals",d=void 0!==(null==n?void 0:n.value)?n.value+"":"true",u.update({value:l}),f&&f.update({value:d}),w&&w.update({showClear:!!n,canApply:v()}),g())},destroy:()=>{u.destroy(),f&&f.destroy(),w&&w.destroy(),c.remove()}}})(t);case"date":return(t=>{var e,n;let{header:o,currentFilter:i,onApplyFilter:s,onClearFilter:r,containerRef:l,mainBodyRef:d}=t,a=(null==i?void 0:i.operator)||"equals",c=(null==i?void 0:i.value)?i.value+"":"",h=(null===(e=null==i?void 0:i.values)||void 0===e?void 0:e[0])?i.values[0]+"":"",u=((null===(n=null==i?void 0:i.values)||void 0===n?void 0:n[1])||"")+"";const p=_t("date"),f=document.createElement("div");f.className="st-filter-container";const w=document.createElement("div");w.className="st-filter-section";const v=ne({value:a,onChange:t=>{a=t,T()},options:p.map(t=>({value:t,label:Yt[t]})),containerRef:l,mainBodyRef:d});w.appendChild(v.element),f.appendChild(w);let m=null,g=null,b=null,x=null,y=null,R=null,C=null,S=null,I=null,H=null,M=null;const k=()=>!!Zt(a)||(Xt(a)?""!==c.trim():!!Qt(a)&&""!==h.trim()&&""!==u.trim()),E=t=>{if(!t)return"";const e=G(t);return isNaN(e.getTime())?"":e.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})},O=(t,e,n,o=!1)=>{const i=document.createElement("div");i.className="st-date-input-container",i.style.position="relative";const s=document.createElement("input");s.type="text",s.className="st-filter-input",s.value=E(t),s.placeholder=n,s.readOnly=!0,s.style.cursor="pointer",o&&setTimeout(()=>s.focus(),0);let r=!1;const a=t?G(t):new Date,c=se({value:a,onChange:t=>{const n=t.toISOString().split("T")[0];e(n),s.value=E(n),h.setOpen(!1),r=!1},onClose:()=>{h.setOpen(!1),r=!1}}),h=ee({children:c.element,containerRef:l,mainBodyRef:d,anchorElement:s,onClose:()=>{r=!1},open:!1,overflow:"hidden",positioning:"absolute",width:240});i.appendChild(s),i.appendChild(h.element);const u=()=>{r=!r,h.setOpen(r)},p=t=>{"Enter"===t.key||" "===t.key?(t.preventDefault(),r=!r,h.setOpen(r)):"Escape"===t.key&&(r=!1,h.setOpen(!1))};return s.addEventListener("click",u),s.addEventListener("keydown",p),{container:i,input:s,picker:c,dropdown:h,destroy:()=>{s.removeEventListener("click",u),s.removeEventListener("keydown",p),c.destroy(),h.destroy(),i.remove()}}},T=()=>{if(m&&(m.remove(),m=null),g&&(g=null),b&&(b=null),x&&(x=null),y&&(y.destroy(),y=null),R&&(R.destroy(),R=null),C&&(C.destroy(),C=null),S&&(S.destroy(),S=null),I&&(I.destroy(),I=null),H&&(H.destroy(),H=null),Xt(a)){m=document.createElement("div"),m.className="st-filter-section";const t=O(c,t=>{c=t,M&&M.update({canApply:k()})},"Select date...",!0);g=t.container,y=t.picker,S=t.dropdown,m.appendChild(g),f.insertBefore(m,f.lastChild)}else if(Qt(a)){m=document.createElement("div"),m.className="st-filter-section";const t=O(h,t=>{h=t,M&&M.update({canApply:k()})},"From date...",!0);t.input.classList.add("st-filter-input-range-from");const e=O(u,t=>{u=t,M&&M.update({canApply:k()})},"To date...",!1);b=t.container,R=t.picker,I=t.dropdown,x=e.container,C=e.picker,H=e.dropdown,m.appendChild(b),m.appendChild(x),f.insertBefore(m,f.lastChild)}M&&M.update({canApply:k()})};return M=ie({onApply:()=>{const t={accessor:o.accessor,operator:a};Xt(a)?t.value=c:Qt(a)&&(t.values=[h,u]),s(t)},onClear:r,canApply:k(),showClear:!!i}),f.appendChild(M.element),T(),{element:f,update:t=>{var e,n;void 0!==t.currentFilter&&(i=t.currentFilter,a=(null==i?void 0:i.operator)||"equals",c=(null==i?void 0:i.value)?i.value+"":"",h=(null===(e=null==i?void 0:i.values)||void 0===e?void 0:e[0])?i.values[0]+"":"",u=((null===(n=null==i?void 0:i.values)||void 0===n?void 0:n[1])||"")+"",v.update({value:a}),M&&M.update({showClear:!!i,canApply:k()}),T())},destroy:()=>{v.destroy(),y&&y.destroy(),R&&R.destroy(),C&&C.destroy(),S&&S.destroy(),I&&I.destroy(),H&&H.destroy(),M&&M.destroy(),f.remove()}}})(t);case"enum":return(t=>{let{header:e,currentFilter:n,onApplyFilter:o,onClearFilter:i}=t;const s=e.enumOptions||[],r=s.map(t=>t.value);let l=(null==n?void 0:n.values)?n.values.map(String):r,d="";const a=document.createElement("div");a.className="st-filter-container";const c=document.createElement("div");c.className="st-filter-section";const h=document.createElement("div");h.className="st-enum-filter-options";const u=document.createElement("div");u.className="st-enum-select-all";const p=de({checked:l.length===r.length,onChange:t=>{l=t?[...r]:[],b(),y&&y.update({canApply:x()})}}),f=document.createElement("span");f.className="st-enum-option-label st-enum-select-all-label",f.textContent="Select All",p.element.appendChild(f),u.appendChild(p.element),h.appendChild(u);let w=null,v=null;s.length>10&&(w=document.createElement("div"),w.className="st-enum-search",v=oe({type:"text",value:d,onChange:t=>{d=t,b()},placeholder:"Search..."}),w.appendChild(v.element),h.appendChild(w));const m=document.createElement("div");h.appendChild(m);const g=[],b=()=>{m.innerHTML="",g.forEach(t=>t.checkbox.destroy()),g.length=0;const t=d?s.filter(t=>t.label.toLowerCase().includes(d.toLowerCase())):s;if(d&&0===t.length){const t=document.createElement("div");t.className="st-enum-no-results",t.textContent="No matching options",m.appendChild(t)}else t.forEach(t=>{const e=de({checked:l.includes(t.value),onChange:()=>{l=l.includes(t.value)?l.filter(e=>e!==t.value):[...l,t.value];const e=l.length===r.length;p.element.querySelector("input").checked=e,y&&y.update({canApply:x()})}}),n=document.createElement("span");n.className="st-enum-option-label",n.textContent=t.label,e.element.appendChild(n),m.appendChild(e.element),g.push({container:e.element,checkbox:e,value:t.value})});const e=l.length===r.length;p.element.querySelector("input").checked=e};b(),c.appendChild(h),a.appendChild(c);const x=()=>0!==l.length&&l.length!==r.length,y=ie({onApply:()=>{l.length!==r.length?o({accessor:e.accessor,operator:"in",values:l}):i()},onClear:i,canApply:x(),showClear:!!n});return a.appendChild(y.element),{element:a,update:t=>{void 0!==t.currentFilter&&(n=t.currentFilter,l=(null==n?void 0:n.values)?n.values.map(String):r,d="",v&&v.update({value:d}),b(),y&&y.update({showClear:!!n,canApply:x()}))},destroy:()=>{p.destroy(),v&&v.destroy(),g.forEach(t=>t.checkbox.destroy()),y&&y.destroy(),a.remove()}}})(t)}},ce=new WeakMap,he=(t,e,n,o)=>{t.addEventListener(e,n,o),ce.has(t)||ce.set(t,[]),ce.get(t).push({event:e,handler:n,options:o})},ue=new WeakMap,pe=t=>(ue.has(t)||ue.set(t,new Map),ue.get(t)),fe=(t,e,n)=>{var o,i;const s=t.querySelector(".st-expand-icon-container");if(!(s&&s instanceof HTMLElement))return;if(s.classList.contains("expanded")===e)return;const r=null!==(o=null==n?void 0:n.ariaLabelWhenExpanded)&&void 0!==o?o:"Collapse row",l=null!==(i=null==n?void 0:n.ariaLabelWhenCollapsed)&&void 0!==i?i:"Expand row";requestAnimationFrame(()=>{requestAnimationFrame(()=>{s.classList.toggle("expanded",e),s.classList.toggle("collapsed",!e),s.setAttribute("aria-label",e?r:l),(null==n?void 0:n.syncAriaExpanded)&&s.setAttribute("aria-expanded",e+"")})})},we=(t,e,n=[])=>{for(let o=0;t.length>o;o++){const i=t[o];if(i.accessor===e)return[...n,o];if(i.children&&i.children.length>0){const t=we(i.children,e,[...n,o]);if(t)return t}}return null},ve=t=>"left"===t.pinned?"left":"right"===t.pinned?"right":"main";function me(t,e,n){const o=vt(t);let i=!1;function s(t,e){let n,o=t;for(let t=0;e.length-1>t;t++)o=o[e[t]].children;return n=o[e[e.length-1]],n}function r(t,e,n){let o=t;for(let t=0;e.length-1>t;t++){if(!o[e[t]].children){i=!0;break}o=o[e[t]].children}o[e[e.length-1]]=n}const l=s(o,e);return r(o,e,s(o,n)),r(o,n,l),{newHeaders:o,emergencyBreak:i}}const ge=(t,n)=>{const{mainBodyWidth:o,pinnedLeftWidth:i,pinnedRightWidth:s,pinnedLeftContentWidth:r,pinnedRightContentWidth:l,tableBodyContainerRef:d,editColumns:a}=n,c=a?e:0,h=(a?s+1:s)+(d.scrollHeight>d.clientHeight?d.offsetWidth-d.clientWidth:0),u=t.querySelector(".st-horizontal-scrollbar-left"),p=null==u?void 0:u.firstElementChild;i>0&&u&&p&&(u.style.width=i+"px",p.style.width=r+"px");const f=t.querySelector(".st-horizontal-scrollbar-middle"),w=null==f?void 0:f.firstElementChild;o>0&&f&&w&&(w.style.width=o+"px");const v=t.querySelector(".st-horizontal-scrollbar-right"),m=null==v?void 0:v.firstElementChild;if(s>0&&v&&m&&(v.style.width=h+"px",m.style.width=l+"px"),c>0){const e=Array.from(t.children).find(t=>t instanceof HTMLElement&&!t.classList.contains("st-horizontal-scrollbar-left")&&!t.classList.contains("st-horizontal-scrollbar-middle")&&!t.classList.contains("st-horizontal-scrollbar-right"));e&&(e.style.width=c-1.5+"px")}},be=(t,e)=>{if(e){const n=t.querySelector(".st-horizontal-scrollbar-left"),o=t.querySelector(".st-horizontal-scrollbar-middle"),i=t.querySelector(".st-horizontal-scrollbar-right");n instanceof HTMLElement&&e.unregisterPane("pinned-left",n),o instanceof HTMLElement&&e.unregisterPane("main",o),i instanceof HTMLElement&&e.unregisterPane("pinned-right",i)}t.remove()},xe=({headers:t,containerWidth:e,collapsedHeaders:n})=>{let o=0,i=0,r=0;t.forEach(t=>{if(t.hide)return;const e=x(t,n).reduce((t,e)=>t+I(e),0);"left"===t.pinned?o+=e:"right"===t.pinned?i+=e:r+=e});const l=o,d=i;if(e&&e>0){const t=e*s(e,o>0,i>0);o>t&&(o=t),i>t&&(i=t)}return{leftWidth:a(o),rightWidth:a(i),mainWidth:r,leftContentWidth:l,rightContentWidth:d}},ye=(t,e)=>{if(t.pinned)return t.pinned;const n=((t,e)=>{const n=d(t);for(const t of n)if(t.children&&t.children.length>0&&t.children.some(t=>t.accessor===e))return t;return null})(e,t.accessor);return n?ye(n,e):void 0},Re=(t,e,n)=>{var o;const i=[],s=[],l=[];t.forEach(e=>{if(e.hide)return;const n=ye(e,t);"left"===n?i.push(e):"right"===n?l.push(e):s.push(e)});const d=(t,o,i)=>{var s,l;const a=o;if(t.children&&t.children.length>0){const l=null==e?void 0:e.has(t.accessor),c=t.children.filter(t=>{if(t.hide)return!1;const e=t.showWhen||r;return l?"parentCollapsed"===e||"always"===e:"parentExpanded"===e||"always"===e});if(t.singleRowChildren){const e=null!==(s=null==n?void 0:n.get(t.accessor))&&void 0!==s?s:"number"==typeof t.width?t.width:I(t);return i.set(t.accessor,{left:a,width:e}),o=a+e,c.forEach(t=>{o=d(t,o,i)}),o}c.forEach(t=>{o=d(t,o,i)}),i.set(t.accessor,{left:a,width:o-a})}else{const e=null!==(l=null==n?void 0:n.get(t.accessor))&&void 0!==l?l:"number"==typeof t.width?t.width:I(t);i.set(t.accessor,{left:o,width:e}),o+=e}return o},a=t=>{const e=new Map;let n=0;return t.forEach(t=>{n=d(t,n,e)}),e},c=a(i),u=a(s),p=a(l),f=new Map;c.forEach((t,e)=>f.set(e,t)),u.forEach((t,e)=>f.set(e,t)),p.forEach((t,e)=>f.set(e,t)),f.forEach((t,e)=>{const{left:n,width:o}=t,i=h({accessor:e,rowId:"header"}),s=document.getElementById(i);c.has(e),p.has(e),s&&(s.style.left=n+"px",s.style.width=o+"px"),document.querySelectorAll(`[id$="-${e}"]`).forEach(t=>{t instanceof HTMLElement&&!t.id.endsWith("-header")&&(t.style.left=n+"px",t.style.width=o+"px")})});const w=document.querySelector(".st-body-container"),v=null!==(o=null==w?void 0:w.clientWidth)&&void 0!==o?o:0,m=xe({headers:t,containerWidth:v>0?v:void 0,collapsedHeaders:e}),{leftWidth:g,rightWidth:b,mainWidth:x,leftContentWidth:y,rightContentWidth:R}=m;if(g>0){const t=document.querySelector(".st-header-pinned-left"),e=document.querySelector(".st-body-pinned-left");t&&(t.style.width=g+"px"),e&&(e.style.width=g+"px")}if(b>0){const t=document.querySelector(".st-header-pinned-right"),e=document.querySelector(".st-body-pinned-right");t&&(t.style.width=b+"px"),e&&(e.style.width=b+"px")}const C=null==w?void 0:w.closest(".simple-table-root"),S=null==C?void 0:C.querySelector(".st-horizontal-scrollbar-container"),H=null==C?void 0:C.querySelector(".st-body-main"),M=!!(null==C?void 0:C.querySelector(".st-column-editor"));S&&H&&w&&H.scrollWidth-H.clientWidth>1&&ge(S,{mainBodyRef:H,mainBodyWidth:x,pinnedLeftWidth:g,pinnedRightWidth:b,pinnedLeftContentWidth:y,pinnedRightContentWidth:R,tableBodyContainerRef:w,editColumns:M})},Ce=({columnsToShrink:t,totalCompensation:e,initialWidthsMap:n})=>{if(0>e){const o=Math.abs(e),i=t.reduce((t,e)=>t+(n.get(e.accessor)||100),0);if(0===i)return;return void t.forEach((e,s)=>{const r=n.get(e.accessor)||100;let l=o*(r/i);if(s===t.length-1){const e=t.slice(0,s).reduce((t,e)=>{const o=n.get(e.accessor)||100;return t+(("number"==typeof e.width?e.width:100)-o)},0);l=o-e}e.width=r+l})}let o=e;for(;o>.5;){const e=i,s=t.map(t=>{const o=n.get(t.accessor)||100;return{column:t,headroom:Math.max(0,o-e),initialWidth:o,minWidth:e}}).filter(t=>t.headroom>0);if(0>=s.length)break;{const t=s.reduce((t,e)=>t+e.headroom,0);let e=0;const n=o;s.forEach((o,i)=>{let r=n*(o.headroom/t);r=Math.min(r,o.headroom),i===s.length-1&&(r=Math.min(n-e,o.headroom)),o.column.width=o.initialWidth-r,e+=r}),o-=e}}},Se=({childrenToResize:t=[],collapsedHeaders:e,containerWidth:n,delta:o,headers:r,initialWidthsMap:l,isParentResize:d=!1,resizedHeader:a,reverse:c,rootPinned:h,sectionHeaders:u,sectionWidth:p,startWidth:f})=>{let w=o;if(h&&n>0){const t=((t,e,n)=>t*s(t,e,n))(n,r.some(t=>"left"===t.pinned&&!t.hide),r.some(t=>"right"===t.pinned&&!t.hide)),e=Array.from(l.values()).reduce((t,e)=>t+e,0);o>0&&e+o>t&&(w=Math.max(0,t-e))}if(o=w,d&&t.length>1){const n=k(u,e),s=n.findIndex(e=>e.accessor===t[0].accessor),r=n.findIndex(e=>e.accessor===t[t.length-1].accessor);if(-1===s||-1===r)return;const d=0===s,a=r===n.length-1;let w;w="left"===h&&a||"right"===h&&d?[]:d?n.slice(r+1):a||c?n.slice(0,s):n.slice(r+1);const v=Array.from(l.values()).reduce((t,e)=>t+e,0);if(o>0){let e=o,n=!1;if(w.length>0&&v+o>(p>0?Math.max(p,v):v+Math.abs(o)+1)){n=!0;const t=w.reduce((t,e)=>{const n=l.get(e.accessor)||100;return t+Math.max(0,n-i)},0);e=Math.min(o,t)}const s=(f+e)/t.reduce((t,e)=>t+(l.get(e.accessor)||100),0);t.forEach(t=>{const e=l.get(t.accessor)||100;t.width=Math.max(e*s,40)}),n&&e>0&&w.length>0&&Ce({columnsToShrink:w,totalCompensation:e,initialWidthsMap:l})}else{const e=t.reduce((t,e)=>t+(l.get(e.accessor)||100),0),n=Math.max(f+o,i*t.length),s=n/e;t.forEach(t=>{const e=l.get(t.accessor)||100;t.width=Math.max(e*s,40)});const r=f-n;r>0&&w.length>0&&Ce({columnsToShrink:w,totalCompensation:-r,initialWidthsMap:l})}return}const v=k(u,e),m=v.findIndex(t=>t.accessor===a.accessor);if(-1===m)return;const g=0===m,b=m===v.length-1;let x;if(x="left"===h&&b||"right"===h&&g?[]:g?v.slice(m+1):b||c?v.slice(0,m):v.slice(m+1),0===x.length)return void(a.width=Math.max(f+o,i));const y=Array.from(l.values()).reduce((t,e)=>t+e,0);if(o>0){if((p>0?Math.max(p,y):y+Math.abs(o)+1)>=y+o)return void(a.width=f+o);const t=x.reduce((t,e)=>{const n=l.get(e.accessor)||100;return t+Math.max(0,n-i)},0),e=Math.min(o,t);a.width=f+e,e>0&&Ce({columnsToShrink:x,totalCompensation:e,initialWidthsMap:l})}else{const t=Math.max(f+o,40),e=f-t;a.width=t,e>0&&Ce({columnsToShrink:x,totalCompensation:-e,initialWidthsMap:l})}},Ie=(t,e)=>{if(t>0)return t;const n=null==e?void 0:e.current;if(!n)return 0;const o=n.closest(".simple-table-root"),i=null==o?void 0:o.querySelector(".st-body-container");return i instanceof HTMLElement?i.clientWidth:n.clientWidth},He=({autoExpandColumns:t,collapsedHeaders:e,containerWidth:n,event:o,header:i,headers:r,mainBodyRef:l,onColumnWidthChange:d,reverse:a=!1,setHeaders:c,setIsResizing:h,startWidth:u})=>{o.preventDefault();const p="clientX"in o?o.clientX:o.touches[0].clientX,f="touches"in o;if(!i||i.hide)return;const w=Ie(n,l);h(!0);const v=ye(i,r),m=M(i);let g;if(i.children&&i.children.length>0){const t=x(i,e);g=t.length>0?t:[i]}else g=[i];const b=new Map;let y=0,R=0;if(t){const t=r.filter(t=>t.pinned===v);if(k(t,e).forEach(t=>{const e=I(t);b.set(t.accessor,e)}),w>0){const{leftWidth:t,rightWidth:n,mainWidth:o}=xe({headers:r,containerWidth:w,collapsedHeaders:e});y="left"===v?t:"right"===v?n:o,R=w-t-n}}let C=!1;const S=new Map;let E=[];if(t&&v&&w>0){const t=k(r.filter(t=>t.pinned===v),e);if(t.length>0){let n=!1;if(g.length>1){const e=t.findIndex(t=>t.accessor===g[0].accessor),o=t.findIndex(t=>t.accessor===g[g.length-1].accessor);n="left"===v&&o===t.length-1||"right"===v&&0===e}else{const e=g[0]||i,o=t.findIndex(t=>t.accessor===e.accessor);n="left"===v&&o===t.length-1||"right"===v&&0===o}if(n){C=!0;const t=r.filter(t=>!t.pinned);E=k(t,e),E.forEach(t=>{S.set(t.accessor,I(t))})}}}const O=(n,o=!1)=>{const l="right"===v?p-n:n-p;if(t){const t=r.filter(t=>t.pinned===v);if(Se({childrenToResize:g,collapsedHeaders:e,containerWidth:w,delta:l,headers:r,initialWidthsMap:b,isParentResize:g.length>1,resizedHeader:g.length>0?g[g.length-1]:i,reverse:a,rootPinned:v,sectionHeaders:t,sectionWidth:y,startWidth:u}),C&&E.length>0){const t=g.reduce((t,e)=>{const n=b.get(e.accessor)||0;return t+(("number"==typeof e.width?e.width:n)-n)},0),e=Math.max(0,R-t),n=Array.from(S.values()).reduce((t,e)=>t+e,0);if(e>0&&n>0){const t=e/n;let o=0;E.forEach((n,i)=>{const s=S.get(n.accessor)||100;i===E.length-1?n.width=e-o:(n.width=Math.round(s*t),o+=n.width)})}}}else{const t=(({header:t,headers:e,collapsedHeaders:n})=>{const o=document.querySelector(".st-body-container");if(!o||0===o.clientWidth)return 1e3;const i=o.clientWidth;if(!t.pinned)return 1/0;const r=e.some(t=>"left"===t.pinned&&!t.hide),l=e.some(t=>"right"===t.pinned&&!t.hide),d=i*s(i,r,l)-e.filter(e=>e.pinned===t.pinned&&e.accessor!==t.accessor).reduce((t,e)=>e.hide?t:t+x(e,n).reduce((t,e)=>t+I(e),0),0),a=M(t);return a>d?(console.warn(`Header ${t.accessor} exceeds pinned section width limit`),a):d})({header:i,headers:r,collapsedHeaders:e});g.length>1?(({delta:t,leafHeaders:e,minWidth:n,startWidth:o,maxWidth:i})=>{const s=e.reduce((t,e)=>Math.min(t,M(e)),40),r=e.reduce((t,e)=>t+("number"==typeof e.width?e.width:150),0),l=Math.max(Math.min(o+t,i),s)-r;e.forEach(t=>{const e="number"==typeof t.width?t.width:150;t.width=Math.max(e+l*(e/r),n)})})({delta:l,leafHeaders:g,minWidth:m,startWidth:u,maxWidth:t}):g[0].width=Math.max(Math.min(u+l,t),m),r.forEach(t=>{H(t)})}if(o){const t=[...r];c(t);const n=new Map;g.forEach(t=>{"number"==typeof t.width&&n.set(t.accessor,t.width)}),C&&E.forEach(t=>{"number"==typeof t.width&&n.set(t.accessor,t.width)}),Re(r,e,n)}else Re(r,e)};let T=null,A=null,W=p;const P=t=>{W=t,A=t,null===T&&(T=requestAnimationFrame(()=>{null!==A&&(O(A,!1),A=null),T=null}))};if(f){const t=t=>{P(t.touches[0].clientX)},e=()=>{document.removeEventListener("touchmove",t),document.removeEventListener("touchend",e),null!==T&&(cancelAnimationFrame(T),T=null),O(W,!0),h(!1),d&&d([...r])};document.addEventListener("touchmove",t),document.addEventListener("touchend",e)}else{const t=t=>{P(t.clientX)},e=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",e),null!==T&&(cancelAnimationFrame(T),T=null),O(W,!0),h(!1),d&&d([...r])};document.addEventListener("mousemove",t),document.addEventListener("mouseup",e)}},Me=t=>{var e,n;const o=null===(e=t.mainBodyRef)||void 0===e?void 0:e.current;return o?null!==(n=o.closest(".simple-table-root"))&&void 0!==n?n:o:null},ke=(t,e,o)=>{const{columnResizing:i}=e;if(!i||t.isSelectionColumn&&e.enableRowSelection||o)return null;const s=document.createElement("div");s.className="st-header-resize-handle-container",s.setAttribute("role","separator"),s.setAttribute("aria-label",`Resize ${t.label} column`),s.setAttribute("aria-orientation","vertical");const r=document.createElement("div");r.className="st-header-resize-handle",s.appendChild(r);const l=t=>({rows:e.rows,header:t,maxWidth:500,sampleSize:50,styleRoot:Me(e)});let d=0;const a=()=>{const n=Date.now();120>n-d||(d=n,(()=>{const n=document.getElementById(h({accessor:t.accessor,rowId:"header"}));if(e.autoExpandColumns){(({header:t,headers:e,collapsedHeaders:n,containerWidth:o,mainBodyRef:i,reverse:s,headerCellElement:r,getTargetLeafWidth:l})=>{var d;if(!t||t.hide)return;const a=Ie(o,i),c=ye(t,e);let h;if(t.children&&t.children.length>0){const e=x(t,n);h=e.length>0?e:[t]}else h=[t];const u=new Map;let p=0,f=0;const w=e.filter(t=>t.pinned===c);if(k(w,n).forEach(t=>{const e=I(t);u.set(t.accessor,e)}),a>0){const{leftWidth:t,rightWidth:o,mainWidth:i}=xe({headers:e,containerWidth:a,collapsedHeaders:n});p="left"===c?t:"right"===c?o:i,f=a-t-o}let v=!1;const m=new Map;let g=[];if(c&&a>0){const o=k(e.filter(t=>t.pinned===c),n);if(o.length>0){let i=!1;if(h.length>1){const t=o.findIndex(t=>t.accessor===h[0].accessor),e=o.findIndex(t=>t.accessor===h[h.length-1].accessor);i="left"===c&&e===o.length-1||"right"===c&&0===t}else{const e=h[0]||t,n=o.findIndex(t=>t.accessor===e.accessor);i="left"===c&&n===o.length-1||"right"===c&&0===n}if(i){v=!0;const t=e.filter(t=>!t.pinned);g=k(t,n),g.forEach(t=>{m.set(t.accessor,I(t))})}}}const b=h.reduce((t,e)=>t+l(e),0),y=null!==(d=null==r?void 0:r.offsetWidth)&&void 0!==d?d:h.reduce((t,e)=>t+I(e),0);if(Se({childrenToResize:h,collapsedHeaders:n,containerWidth:a,delta:b-y,headers:e,initialWidthsMap:u,isParentResize:h.length>1,resizedHeader:h.length>0?h[h.length-1]:t,reverse:s,rootPinned:c,sectionHeaders:w,sectionWidth:p,startWidth:y}),v&&g.length>0){const t=h.reduce((t,e)=>{const n=u.get(e.accessor)||0;return t+(("number"==typeof e.width?e.width:n)-n)},0),e=Math.max(0,f-t),n=Array.from(m.values()).reduce((t,e)=>t+e,0);if(e>0&&n>0){const t=e/n;let o=0;g.forEach((n,i)=>{const s=m.get(n.accessor)||100;i===g.length-1?n.width=e-o:(n.width=Math.round(s*t),o+=n.width)})}}const R=new Map;h.forEach(t=>{"number"==typeof t.width&&R.set(t.accessor,t.width)}),v&&g.forEach(t=>{"number"==typeof t.width&&R.set(t.accessor,t.width)}),Re(e,n,R)})({header:t,headers:e.headers,collapsedHeaders:e.collapsedHeaders,containerWidth:e.containerWidth,mainBodyRef:e.mainBodyRef,reverse:e.reverse,headerCellElement:n,getTargetLeafWidth:t=>E(t.accessor,l(t))});const o=[...e.headers];return e.setHeaders(o),void(e.onColumnWidthChange&&e.onColumnWidthChange(o))}const o=E(t.accessor,l(t)),i=we(e.headers,t.accessor);if(!i)return;const s=((t,e)=>{let n=t;for(let t=0;e.length-1>t;t++)n=n[e[t]].children;return n})(e.headers,i),r=i[i.length-1],d=s.map((t,e)=>e===r?Object.assign(Object.assign({},t),{width:o}):t),a=((t,e,n)=>{if(1===e.length)return n;let o=t;for(let t=0;e.length-2>t;t++)o=o[e[t]].children;return o[e[e.length-2]].children=n,t})(e.headers,i,d);a.forEach(t=>H(t));const c=d[r],u=new Map;c&&"number"==typeof c.width&&u.set(c.accessor+"",c.width),Re(a,e.collapsedHeaders,u),e.setHeaders(a),e.onColumnWidthChange&&e.onColumnWidthChange(a)})())};return Ut(s,"mousedown",o=>{var i;if(o.detail>=2)return o.preventDefault(),void a();const s=null===(i=document.getElementById(h({accessor:t.accessor,rowId:"header"})))||void 0===i?void 0:i.offsetWidth;Gt(()=>{He({autoExpandColumns:e.autoExpandColumns,collapsedHeaders:e.collapsedHeaders,containerWidth:e.containerWidth,event:o,forceUpdate:e.forceUpdate,header:t,headers:e.headers,mainBodyRef:e.mainBodyRef,onColumnWidthChange:e.onColumnWidthChange,pinnedLeftRef:e.pinnedLeftRef,pinnedRightRef:e.pinnedRightRef,reverse:e.reverse,setHeaders:e.setHeaders,setIsResizing:e.setIsResizing,startWidth:null!=s?s:n})},10)}),Ut(s,"touchstart",o=>{var i;const s=o,r=null===(i=document.getElementById(h({accessor:t.accessor,rowId:"header"})))||void 0===i?void 0:i.offsetWidth;Gt(()=>{He({autoExpandColumns:e.autoExpandColumns,collapsedHeaders:e.collapsedHeaders,containerWidth:e.containerWidth,event:s,forceUpdate:e.forceUpdate,header:t,headers:e.headers,mainBodyRef:e.mainBodyRef,onColumnWidthChange:e.onColumnWidthChange,pinnedLeftRef:e.pinnedLeftRef,pinnedRightRef:e.pinnedRightRef,reverse:e.reverse,setHeaders:e.setHeaders,setIsResizing:e.setIsResizing,startWidth:null!=r?r:n})},10)}),Ut(s,"dblclick",a),s},Ee=(t,e,n)=>{const o=document.createElement("input");return o.type="text",o.className="st-header-edit-input",o.value=t.label||"",Ut(o,"blur",()=>{const i=o.value;i!==t.label&&(n=>{const o=e.headers.map(e=>e.accessor===t.accessor?Object.assign(Object.assign({},e),{label:n}):e);e.setHeaders(o),e.onHeaderEdit&&e.onHeaderEdit(t,n)})(i);const s=n.parentElement;if(s){const o=Oe(t,e,i);s.replaceChild(o,n)}if(e.headerRegistry&&!t.isSelectionColumn){const n=e.headerRegistry.get(t.accessor+"");n&&n.setEditing(!1)}}),Ut(o,"keydown",e=>{"Enter"===e.key?(e.preventDefault(),o.blur()):"Escape"===e.key&&(e.preventDefault(),o.value=t.label||"",o.blur())}),setTimeout(()=>o.focus(),0),o},Oe=(t,e,n)=>{const o=t.isSelectionColumn&&e.enableRowSelection,i=void 0!==n?n:t.label||"",s=document.createElement("span");if(s.className="st-header-label-text "+("right"===t.align?"right-aligned":"center"===t.align?"center-aligned":"left-aligned"),o){const t=(t=>{const e=!!t.areAllRowsSelected&&t.areAllRowsSelected();return de({checked:e,onChange:e=>{var n;null===(n=t.handleSelectAll)||void 0===n||n.call(t,e)},ariaLabel:"Select all rows"}).element})(e);s.appendChild(t)}else s.textContent=i;if(t.tooltip&&!o){let e=null,n=null;const o=()=>{n=setTimeout(()=>{if(!s.isConnected)return;const n=s.getBoundingClientRect();if(n.width>0&&n.height>0){e=document.createElement("div"),e.className="st-tooltip",e.textContent=t.tooltip||"",e.style.position="fixed",e.style.zIndex="10000";const o=200,i=40;let r=n.left+n.width/2-o/2,l=n.bottom+8;8>r?r=8:r+o>window.innerWidth-8&&(r=window.innerWidth-o-8),l+i>window.innerHeight-8&&(l=n.top-i-8),e.style.top=l+"px",e.style.left=r+"px",(s.closest(".simple-table-root")||document.body).appendChild(e)}},500)},i=()=>{var t;n&&(clearTimeout(n),n=null),e&&(null===(t=e.parentElement)||void 0===t||t.removeChild(e),e=null)};Ut(s,"mouseenter",o),Ut(s,"mouseleave",i)}return s},Te=(t,e,n,o)=>{const{columnReordering:i,draggedHeaderRef:s,hoveredHeaderRef:r,headers:l}=o;!i||n.disableReorder||n.isSelectionColumn&&o.enableRowSelection||(t.setAttribute("draggable","true"),Ut(t,"dragstart",t=>{s.current=n,Bt(Date.now()),e.classList.add("st-dragging")}),Ut(t,"dragend",t=>{t.preventDefault(),s.current=null,r.current=null,e.classList.remove("st-dragging"),setTimeout(()=>{o.setHeaders(t=>[...t]),o.onColumnOrderChange&&o.onColumnOrderChange(vt(o.getHeaders()))},10)}),Ut(e,"dragover",t=>{const e=t;e.preventDefault(),l&&s.current&&Gt(()=>{const{screenX:t,screenY:i}=e,d=Math.sqrt(Math.pow(t-Ft.screenX,2)+Math.pow(i-Ft.screenY,2));r.current=n;const a=s.current;if(!a)return;let c,h=!1;if(ve(a)!==ve(n)){const t=function({headers:t,draggedHeader:e,hoveredHeader:n}){const o=vt(t);let i=!1;try{const t=ve(n),s=o.findIndex(t=>t.accessor===e.accessor),r=o.findIndex(t=>t.accessor===n.accessor);if(-1===s||-1===r)return i=!0,{newHeaders:o,emergencyBreak:i};const[l]=o.splice(s,1),d=((t,e)=>{const n=Object.assign({},t);return"left"===e?n.pinned="left":"right"===e?n.pinned="right":delete n.pinned,n})(l,t);o.splice(r,0,d)}catch(t){console.error("Error in insertHeaderAcrossSections:",t),i=!0}return{newHeaders:o,emergencyBreak:i}}({headers:l,draggedHeader:a,hoveredHeader:n});c=t.newHeaders,h=t.emergencyBreak}else{const t=we(l,a.accessor),e=we(l,n.accessor);if(!t||!e)return;const o=t.length,i=e.length;let s=e;if(o!==i){const t=i-o;t>0&&(s=e.slice(0,-t))}if((u=t).length!==(p=s).length||1!==u.length&&!u.slice(0,-1).every((t,e)=>t===p[e]))return;const r=me(l,t,s);c=r.newHeaders,h=r.emergencyBreak}var u,p;if(n.accessor===a.accessor||10>d||JSON.stringify(c)===JSON.stringify(l)||h)return;const f=o.essentialAccessors;if(f&&f.size>0&&!Mt(c,f))return;const w=Date.now();JSON.stringify(c)===JSON.stringify(jt)&&(1500>w-Dt||40>d)||(Bt(w),Ft={screenX:t,screenY:i},(t=>{jt=t})(l),o.onTableHeaderDragEnd(c))},50)}),Ut(document.documentElement,"dragover",t=>{t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="move")}))},Ae=(t,e,n)=>{var o,i;const{header:s,colIndex:d,parentHeader:a}=t,{collapsedHeaders:c,columnBorders:h,columnReordering:u,enableHeaderEditing:p,selectedColumns:f,columnsWithSelectedCells:w,draggedHeaderRef:v,hoveredHeaderRef:m}=e,g=s.isSelectionColumn&&e.enableRowSelection,b=!!(null==s?void 0:s.isSortable),x=c.has(s.accessor),y=!(!s.children||0===s.children.length)&&(!x||s.children.some(t=>{const e=t.showWhen||r;return"parentCollapsed"===e||"always"===e})),R=null==a?void 0:a.singleRowChildren,C=y&&!s.singleRowChildren,S=!!h&&(s.children&&0!==s.children.length?l(s,d).includes(e.lastHeaderIndex):d===e.lastHeaderIndex),I=!(!e.selectableColumns||g)&&l(s,d).some(t=>f.has(t)),H=!g&&l(s,d).some(t=>w.has(t));return["st-header-cell",s.accessor===(null===(o=m.current)||void 0===o?void 0:o.accessor)?"st-hovered":"",(null===(i=v.current)||void 0===i?void 0:i.accessor)===s.accessor?"st-dragging":"",b?"clickable":"",u&&!b?"columnReordering":"",C?"parent":"",R?"st-sub-header":"",S?"st-last-column":"",p&&!g?"st-header-editable":"",I?"st-header-selected":"",H&&!I?"st-header-has-highlighted-cell":"",n?"st-no-resize":""].filter(Boolean).join(" ")},We=(t,e,n)=>{var o;const{header:i,colIndex:s}=t,{reverse:r}=e,d=i.isSelectionColumn&&e.enableRowSelection,a=Ae(t,e,n),u=document.createElement("div");u.className=a,u.id=h({accessor:i.accessor,rowId:"header"}),u.setAttribute("data-accessor",i.accessor+""),u.setAttribute("role","columnheader"),u.setAttribute("aria-colindex",s+1+""),i.isSortable&&((null===(o=e.sort)||void 0===o?void 0:o.key.accessor)===i.accessor?u.setAttribute("aria-sort","asc"===e.sort.direction?"ascending":"descending"):u.setAttribute("aria-sort","none"));const p=((t,e)=>{const n=[];return t.type&&"other"!==t.type&&n.push(t.type+" column"),t.isSortable&&n.push("sortable"),e&&n.push("filterable"),t.tooltip&&n.push(t.tooltip),n.join(", ")})(i,!!i.filterable);if(p){const t="header-desc-"+i.accessor;u.setAttribute("aria-describedby",t);const e=document.createElement("span");e.id=t,e.className="st-sr-only",e.textContent=p,u.appendChild(e)}u.style.position="absolute",u.style.left=t.left+"px",u.style.top=t.top+"px",u.style.width=t.width+"px",u.style.height=t.height+"px";const f=((t,e)=>{const{sort:n,icons:o}=e;if(!n||n.key.accessor!==t.accessor)return null;const i=document.createElement("div");i.className="st-icon-container",i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.setAttribute("aria-label",`Sort ${t.label} ${"asc"===n.direction?"descending":"ascending"}`);const s="asc"===n.direction?o.sortUp:o.sortDown;return s&&("string"==typeof s?i.innerHTML=s:(s instanceof HTMLElement||s instanceof SVGSVGElement)&&i.appendChild(s.cloneNode(!0))),Ut(i,"click",n=>{n.stopPropagation(),e.onSort(t.accessor)}),Ut(i,"keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),e.onSort(t.accessor))}),i})(i,e),w=((t,e)=>{const{filters:n,handleApplyFilter:o,handleClearFilter:i,icons:s}=e;if(!t.filterable)return null;const r=n[t.accessor],l=document.createElement("div");l.className="st-icon-container",l.setAttribute("role","button"),l.setAttribute("tabindex","0"),l.setAttribute("aria-label","Filter "+t.label),l.setAttribute("aria-expanded","false"),l.setAttribute("aria-haspopup","dialog");const d=s.filter;let a=null;if(d)if("string"==typeof d)l.innerHTML=d,a=l.querySelector("svg");else if(d instanceof HTMLElement||d instanceof SVGSVGElement){const t=d.cloneNode(!0);l.appendChild(t),a=t}a&&(a.style.fill=r?"var(--st-button-active-background-color)":"var(--st-header-icon-color)");let c=!1,h=null,u=null;const p=n=>{if(n.stopPropagation(),c=!c,l.setAttribute("aria-expanded",c+""),c){const n=t=>{o(t),c=!1,l.setAttribute("aria-expanded","false"),u&&(u.destroy(),u=null),h&&(h.destroy(),h=null),a&&(a.style.fill="var(--st-button-active-background-color)")},s=()=>{i(t.accessor),c=!1,l.setAttribute("aria-expanded","false"),u&&(u.destroy(),u=null),h&&(h.destroy(),h=null),a&&(a.style.fill="var(--st-header-icon-color)")},d=e.mainBodyRef.current||void 0;h=ae({header:t,currentFilter:r,onApplyFilter:n,onClearFilter:s,containerRef:d,mainBodyRef:d}),u=ee({children:h.element,containerRef:d,mainBodyRef:d,anchorElement:l,onClose:()=>{c=!1,l.setAttribute("aria-expanded","false"),h&&(h.destroy(),h=null)},open:!0,positioning:"fixed",maxWidth:280,allowDescendantOverflow:!0})}else u&&(u.destroy(),u=null),h&&(h.destroy(),h=null)};return Ut(l,"click",p),Ut(l,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),p(t))}),l})(i,e),v=((t,e)=>{var n,o;const{icons:i}=e;if(!c(t)||t.isSelectionColumn&&e.enableRowSelection)return null;const s=(null!==(o=null===(n=e.getCollapsedHeaders)||void 0===n?void 0:n.call(e))&&void 0!==o?o:e.collapsedHeaders).has(t.accessor),r=document.createElement("div");r.className="st-icon-container st-collapsible-header-icon st-expand-icon-container "+(s?"collapsed":"expanded"),r.setAttribute("role","button"),r.setAttribute("tabindex","0"),r.setAttribute("aria-label",`${s?"Expand":"Collapse"} ${t.label} column`),r.setAttribute("aria-expanded",!s+"");const l=i.expand;l&&("string"==typeof l?r.innerHTML=l:(l instanceof HTMLElement||l instanceof SVGSVGElement)&&r.appendChild(l.cloneNode(!0)));const d=n=>{var o,i;n.stopPropagation();const s=(null!==(i=null===(o=e.getCollapsedHeaders)||void 0===o?void 0:o.call(e))&&void 0!==i?i:e.collapsedHeaders).has(t.accessor);e.setCollapsedHeaders(e=>{const n=new Set(e);return s?n.delete(t.accessor):n.add(t.accessor),n})};return Ut(r,"click",d),Ut(r,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),d(t))}),r})(i,e);if(r){const t=ke(i,e,n);t&&u.appendChild(t)}i.headerRenderer||"right"!==i.align||(v&&u.appendChild(v),w&&u.appendChild(w),f&&u.appendChild(f));const m=document.createElement("div");if(m.className="st-header-label",i.headerRenderer){const t=Oe(i,e),n=i.headerRenderer({accessor:i.accessor,colIndex:s,header:i,components:{sortIcon:f||void 0,filterIcon:w||void 0,collapseIcon:v||void 0,labelContent:t}});n instanceof HTMLElement?m.appendChild(n):m.appendChild(t)}else{const t=Oe(i,e);m.appendChild(t)}if(Ut(m,"click",t=>{d||((t,e,n,o)=>{if(!e.isSelectionColumn){if(o.selectableColumns){const i=l(e,n),s=i.some(t=>o.selectedColumns.has(t));if(o.enableHeaderEditing&&s&&!t.shiftKey){const t=document.getElementById(h({accessor:e.accessor,rowId:"header"}));if(t){const n=t.querySelector(".st-header-label");if(n){const t=n.querySelector(".st-header-label-text");if(t){t.innerHTML="";const n=Ee(e,o,t);if(t.appendChild(n),o.headerRegistry&&!e.isSelectionColumn){const t=o.headerRegistry.get(e.accessor+"");t&&t.setEditing(!0)}}}}return}t.shiftKey&&o.selectColumns?o.setSelectedColumns(t=>{if(0===t.size)return new Set(i);const e=i[0],n=Array.from(t).sort((t,e)=>t-e);let o=n[0],s=Math.abs(e-o);n.forEach(t=>{const n=Math.abs(e-t);s>n&&(s=n,o=t)});const r=[...((t,e)=>{const n=Math.min(t,e);return Array.from({length:Math.max(t,e)-n+1},(t,e)=>n+e)})(o,e),...i];return new Set([...Array.from(t),...r])}):o.selectColumns&&o.selectColumns(i),o.setSelectedCells(new Set),o.setInitialFocusedCell(null)}o.onColumnSelect&&o.onColumnSelect(e),!o.selectableColumns&&e.isSortable&&o.onSort(e.accessor)}})(t,i,s,e)}),Ut(m,"dblclick",t=>{d||((t,e,n)=>{e.isSelectionColumn||n.selectableColumns&&e.isSortable&&n.onSort(e.accessor)})(0,i,e)}),Te(m,u,i,e),u.appendChild(m),i.headerRenderer||"right"===i.align||(v&&u.appendChild(v),w&&u.appendChild(w),f&&u.appendChild(f)),!r){const t=ke(i,e,n);t&&u.appendChild(t)}return e.headerRegistry&&!i.isSelectionColumn&&e.headerRegistry.set(i.accessor+"",{setEditing:t=>{if(t){const t=m.querySelector(".st-header-label-text");if(t){t.innerHTML="";const n=Ee(i,e,t);t.appendChild(n)}}}}),u},Pe=(t,e,n,o=0)=>{var i,s;const r=n.pinned?n.containerWidth:null!==(i=n.mainSectionContainerWidth)&&void 0!==i?i:n.containerWidth||(null===(s=t.parentElement)||void 0===s?void 0:s.clientWidth)||t.clientWidth||0,l=n.pinned?e:((t,e,n,o=100)=>{if(0===t.length)return[];const i=e-o,s=e+n+o;return t.filter(t=>t.left+t.width>=i&&s>=t.left)})(e,o,r),d=(t=>0===t.length?-1:Math.max(...t.map(t=>t.colIndex)))(e),a=zt(t),u=new Set(l.map(t=>h({accessor:t.header.accessor,rowId:"header"}))),p=Vt(t);let f=!1;a.forEach((t,e)=>{u.has(e)||(p.delete(e),t.remove(),a.delete(e),f=!0)}),f&&Kt(t);const w=document.createDocumentFragment(),v=[];l.forEach(t=>{const e=h({accessor:t.header.accessor,rowId:"header"}),o=!(!n.autoExpandColumns||n.pinned||t.colIndex!==d);if(a.has(e)){const i=a.get(e),s=p.get(e);(!s||s.left!==t.left||s.top!==t.top||s.width!==t.width||s.height!==t.height)&&(i.style.left=t.left+"px",i.style.top=t.top+"px",i.style.width=t.width+"px",i.style.height=t.height+"px",p.set(e,{left:t.left,top:t.top,width:t.width,height:t.height})),t.header.isSelectionColumn&&n.enableRowSelection&&"function"==typeof n.areAllRowsSelected&&((t,e)=>{le(t,e)})(i,n.areAllRowsSelected());const r=Ae(t,n,o);i.className!==r&&(i.className=r),c(t.header)&&((t,e,n)=>{fe(t,!e,{ariaLabelWhenExpanded:n?`Collapse ${n} column`:"Collapse column",ariaLabelWhenCollapsed:n?`Expand ${n} column`:"Expand column",syncAriaExpanded:!0})})(i,n.collapsedHeaders.has(t.header.accessor),t.header.label)}else v.push({cell:t,cellId:e,isLastMainAutoExpandColumn:o})}),v.forEach(({cell:t,cellId:e,isLastMainAutoExpandColumn:o})=>{const i=We(t,n,o);w.appendChild(i),a.set(e,i),p.set(e,{left:t.left,top:t.top,width:t.width,height:t.height})}),w.childNodes.length>0&&t.appendChild(w),n.pinned||(t.dataset.lastScrollLeft=o+"")},Le=(t,e,n)=>{var o;const i=document.createElement("div");i.className="st-dropdown-content",i.style.position=n.positioning||"fixed",i.style.zIndex="1000",i.style.visibility="hidden",i.style.overflow=null!==(o=n.overflow)&&void 0!==o?o:"auto",n.width&&(i.style.width=n.width+"px"),n.maxHeight&&(i.style.maxHeight=n.maxHeight+"px"),i.appendChild(e);const s=t.closest(".simple-table-root")||document.querySelector(".simple-table-root");"fixed"===n.positioning?s?s.appendChild(i):document.body.appendChild(i):t.appendChild(i),requestAnimationFrame(()=>{const{position:e,placement:o}=((t,e,n)=>{const o=t.getBoundingClientRect(),i=window.innerHeight,s=window.innerWidth,r=i-o.bottom,l=s-o.left;let d="bottom";e.offsetHeight>r&&o.top>r&&(d="top");let a="left";(n.width||e.offsetWidth)>l&&o.right>l&&(a="right");const c={};return"fixed"===n.positioning?("bottom"===d?c.top=o.bottom+4:c.bottom=i-o.top+4,"left"===a?c.left=o.left:c.right=s-o.right):("bottom"===d?c.top=o.height+4:c.bottom=o.height+4,"left"===a?c.left=0:c.right=0),{position:c,placement:`${d}-${a}`}})(t,i,n);i.className="st-dropdown-content st-dropdown-"+o,Object.entries(e).forEach(([t,e])=>{void 0!==e&&(i.style[t]=e+"px")}),i.style.visibility="visible"});const r=e=>{const n=e.target;i.contains(n)||t.contains(n)||a()},l=t=>{"Escape"===t.key&&(t.preventDefault(),a())},d=t=>{i.contains(t.target)||a()},a=()=>{i.remove(),document.removeEventListener("mousedown",r,!0),document.removeEventListener("keydown",l,!0),window.removeEventListener("scroll",d,!0),n.onClose()};return setTimeout(()=>{document.addEventListener("mousedown",r,!0),document.addEventListener("keydown",l,!0),window.addEventListener("scroll",d,!0)},0),he(i,"mousedown",t=>{t.stopPropagation()}),i},$e=(t,e)=>new Date(t,e+1,0).getDate(),De=["January","February","March","April","May","June","July","August","September","October","November","December"],Fe=["Su","Mo","Tu","We","Th","Fr","Sa"],je=(t,e,n)=>{const{header:o,row:i}=t,s=f(i,o.accessor);return"boolean"===o.type?((t,e,n,o)=>{const{header:i,row:s,rowIndex:r}=t;let l;const d=document.createElement("div");d.className="st-dropdown-item "+(!0===n?"selected":""),d.textContent="True",d.setAttribute("role","option"),d.setAttribute("aria-selected",(!0===n)+""),d.setAttribute("aria-disabled","false");const a=document.createElement("div");a.className="st-dropdown-item "+(!1===n?"selected":""),a.textContent="False",a.setAttribute("role","option"),a.setAttribute("aria-selected",(!1===n)+""),a.setAttribute("aria-disabled","false");const c=t=>{w(s,i.accessor,t),e.onCellEdit&&e.onCellEdit({accessor:i.accessor,newValue:t,row:s,rowIndex:r}),l.remove(),o()};he(d,"click",()=>c(!0)),he(a,"click",()=>c(!1));const u=t=>{const e=t;"ArrowDown"===e.key||"ArrowUp"===e.key?(e.preventDefault(),document.activeElement===d?a.focus():d.focus()):"Enter"===e.key&&(e.preventDefault(),document.activeElement===d?c(!0):document.activeElement===a&&c(!1))};d.setAttribute("tabindex","0"),a.setAttribute("tabindex","0"),he(d,"keydown",u),he(a,"keydown",u);const p=document.createDocumentFragment();p.appendChild(d),p.appendChild(a);const f=h({accessor:i.accessor,rowId:t.rowId}),v=document.getElementById(f);return l=Le(v||document.body,p,{width:120,positioning:"fixed",onClose:o}),l})(t,e,!!s,n):"enum"===o.type?((t,e,n,o)=>{const{header:i,row:s,rowIndex:r}=t,l=i.enumOptions||[];let d;const a=t=>{w(s,i.accessor,t),e.onCellEdit&&e.onCellEdit({accessor:i.accessor,newValue:t,row:s,rowIndex:r}),d.remove(),o()},c=[];l.forEach((t,e)=>{const o=document.createElement("div");o.className="st-dropdown-item "+(n===t.value?"selected":""),o.textContent=t.label,o.setAttribute("role","option"),o.setAttribute("aria-selected",(n===t.value)+""),o.setAttribute("aria-disabled","false"),o.setAttribute("tabindex","0"),o.dataset.value=t.value,he(o,"click",()=>a(t.value)),c.push(o)});const u=t=>{const e=t,n=c.findIndex(t=>t===document.activeElement);if("ArrowDown"===e.key)e.preventDefault(),c[(n+1)%c.length].focus();else if("ArrowUp"===e.key)e.preventDefault(),c[(n-1+c.length)%c.length].focus();else if("Enter"===e.key){e.preventDefault();const t=document.activeElement.dataset.value;t&&a(t)}};c.forEach(t=>{he(t,"keydown",u)});const p=document.createElement("div");p.className="st-enum-dropdown-content",c.forEach(t=>p.appendChild(t));const f=h({accessor:i.accessor,rowId:t.rowId}),v=document.getElementById(f);return d=Le(v||document.body,p,{width:150,maxHeight:300,positioning:"fixed",onClose:o}),setTimeout(()=>{const t=l.findIndex(t=>t.value===n);t>=0&&c[t]?(c[t].focus(),c[t].scrollIntoView({block:"nearest"})):c.length>0&&c[0].focus()},0),d})(t,e,(s||"")+"",n):"date"===o.type?((t,e,n,o)=>{var i,s;const{header:r,row:l,rowIndex:d}=t;let a,c;try{c=n?q(n+""):new Date}catch(t){c=new Date}let u=c.getFullYear(),p=c.getMonth();const f=document.createElement("div");f.className="st-datepicker";const v=document.createElement("div");v.className="st-datepicker-header";const m=document.createElement("button");m.className="st-datepicker-nav-btn",m.setAttribute("aria-label","Previous month");const g=null!==(i=e.icons.prev)&&void 0!==i?i:gt("st-next-prev-icon");"string"==typeof g?m.innerHTML=g:m.appendChild(g.cloneNode(!0));const b=document.createElement("div");b.className="st-datepicker-header-label",b.setAttribute("aria-hidden","true");const x=document.createElement("button");x.className="st-datepicker-nav-btn",x.setAttribute("aria-label","Next month");const y=null!==(s=e.icons.next)&&void 0!==s?s:bt("st-next-prev-icon");"string"==typeof y?x.innerHTML=y:x.appendChild(y.cloneNode(!0)),v.appendChild(m),v.appendChild(b),v.appendChild(x);const R=document.createElement("div");R.className="st-datepicker-grid st-datepicker-days-grid",Fe.forEach(t=>{const e=document.createElement("div");e.className="st-datepicker-weekday",e.textContent=t,R.appendChild(e)});const C=document.createElement("div");C.className="st-datepicker-footer";const S=document.createElement("button");S.className="st-datepicker-today-btn",S.textContent="Today",he(S,"click",()=>{const t=new Date,e=new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0);I(e)}),C.appendChild(S),f.appendChild(v),f.appendChild(R),f.appendChild(C);const I=t=>{const n=t.toISOString().split("T")[0];w(l,r.accessor,n),e.onCellEdit&&e.onCellEdit({accessor:r.accessor,newValue:n,row:l,rowIndex:d}),a.remove(),o()},H=()=>{var t,e,n;for(b.textContent=`${De[p]} ${u}`;R.children.length>7;)null===(t=R.lastElementChild)||void 0===t||t.remove();const o=$e(u,p),i=new Date(u,p,1).getDay(),s=$e(u,p-1),r=new Date;for(let t=0;i>t;t++){const n=s-i+t+1,o=new Date(u,p-1,n),r=document.createElement("div");r.className="st-datepicker-day other-month",r.textContent=n+"",r.setAttribute("tabindex","0"),r.setAttribute("role","button"),r.setAttribute("aria-label",`${null!==(e=De[p-1])&&void 0!==e?e:De[11]} ${n}, ${o.getFullYear()}`),he(r,"click",()=>I(o)),he(r,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),I(o))}),R.appendChild(r)}const l=c.getFullYear()===u&&c.getMonth()===p;for(let t=1;o>=t;t++){const e=document.createElement("div");e.className="st-datepicker-day",e.textContent=t+"",e.setAttribute("tabindex","0"),e.setAttribute("role","button"),e.setAttribute("aria-label",`${De[p]} ${t}, ${u}`),r.getFullYear()===u&&r.getMonth()===p&&r.getDate()===t&&e.classList.add("today"),l&&c.getDate()===t&&e.classList.add("selected");const n=new Date(u,p,t);he(e,"click",()=>I(n)),he(e,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),I(n))}),R.appendChild(e)}const d=i+o,a=Math.max(35,7*Math.ceil(d/7))-d;for(let t=1;a>=t;t++){const e=new Date(u,p+1,t),o=document.createElement("div");o.className="st-datepicker-day other-month",o.textContent=t+"",o.setAttribute("tabindex","0"),o.setAttribute("role","button"),o.setAttribute("aria-label",`${null!==(n=De[p+1])&&void 0!==n?n:De[0]} ${t}, ${e.getFullYear()}`),he(o,"click",()=>I(e)),he(o,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),I(e))}),R.appendChild(o)}};he(m,"click",()=>{p--,0>p&&(p=11,u--),H()}),he(x,"click",()=>{p++,p>11&&(p=0,u++),H()}),H();const M=h({accessor:r.accessor,rowId:t.rowId}),k=document.getElementById(M);return a=Le(k||document.body,f,{width:240,overflow:"hidden",positioning:"fixed",onClose:o}),a})(t,e,s,n):((t,e,n,o)=>{const{header:i,row:s,rowIndex:r}=t,l=document.createElement("input");l.className="editable-cell-input","number"===i.type?(l.type="text",l.inputMode="decimal"):l.type="text",l.value=null!=n?n+"":"",l.setAttribute("autofocus","true"),setTimeout(()=>{l.focus(),l.select()},0);let d=!0;if("number"===i.type){const t=()=>{const t=l.value;/^-?\d*\.?\d*$/.test(t)||(l.value=t.slice(0,-1))};he(l,"input",t)}return he(l,"blur",t=>{if(!d)return void o();let n=l.value;if("number"===i.type){const t=parseFloat(l.value);n=isNaN(t)?0:t}w(s,i.accessor,n),e.onCellEdit&&e.onCellEdit({accessor:i.accessor,newValue:n,row:s,rowIndex:r}),o()}),he(l,"keydown",t=>{const e=t;e.stopPropagation(),"Enter"===e.key?(d=!0,l.blur()):"Escape"===e.key&&(d=!1,l.blur())}),he(l,"mousedown",t=>{t.stopPropagation()}),l})(t,e,s,n)},Be=(t,e,n,o,i)=>{if(e.valueFormatter){const s=e.valueFormatter({accessor:e.accessor,colIndex:n,row:o,rowIndex:i,value:t});return"object"==typeof s&&null!==s?t+"":s+""}return"boolean"==typeof t?t?"True":"False":Array.isArray(t)?0===t.length?"[]":t.map(t=>"object"==typeof t&&null!==t?JSON.stringify(t):t+"").join(", "):"date"===e.type&&null!=t&&("string"==typeof t||"number"==typeof t||"object"==typeof t&&t instanceof Date)?G(t).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):null==t?"":t+""},Ne=(t,e,n)=>{var o;const{header:i,row:s,rowIndex:r,colIndex:l,depth:d,rowId:a}=t,c=f(s,i.accessor),h=i.isSelectionColumn&&e.enableRowSelection;if(e.isLoading||t.tableRow.isLoadingSkeleton){const t=document.createElement("div");return t.className="st-loading-skeleton",void n.appendChild(t)}if(h){const o=document.createElement("div");o.className="st-selection-cell-content";const i=document.createElement("div");i.className="st-selection-control";const s=!!e.isRowSelected&&e.isRowSelected(a+""),r=((t,e,n)=>de({checked:n,onChange:n=>{var o;null===(o=e.handleRowSelect)||void 0===o||o.call(e,t.rowId+"",n)},ariaLabel:"Select row "+(t.displayRowNumber+1)}).element)(t,e,s);i.appendChild(r),o.appendChild(i);const l=((t,e)=>{if(!e.rowButtons||0===e.rowButtons.length)return null;const n=document.createElement("div");n.className="st-row-buttons",n.setAttribute("role","group"),n.setAttribute("aria-label","Actions for row "+(t.displayRowNumber+1));const o={row:t.row,rowIndex:t.displayRowNumber};return e.rowButtons.forEach((t,e)=>{try{const e=t(o);if(!e)return;const i=document.createElement("span");i.className="st-row-button",i.appendChild(e),n.appendChild(i)}catch(t){console.error("Error rendering row button:",t)}}),n})(t,e);return l&&o.appendChild(l),void n.appendChild(o)}const u=e.rowGrouping&&e.rowGrouping[d],p=!!u&&((t,e)=>!!e&&v(t[e]))(s,u),w=e.rowGrouping&&e.rowGrouping.length>d,m=!e.canExpandRowGroup||e.canExpandRowGroup(s);if(i.expandable&&(p&&w&&m||i.nestedTable||e.onRowGroupExpand&&w&&m)){const o=new Set(e.expandedDepths),i=((t,e,n)=>{const o=document.createElement("div");o.className="st-icon-container st-expand-icon-container "+(n?"expanded":"collapsed"),o.setAttribute("role","button"),o.setAttribute("aria-label",n?"Collapse row":"Expand row"),o.setAttribute("tabindex","0");const i=e.icons.expand;i&&("string"==typeof i?o.innerHTML=i:(i instanceof HTMLElement||i instanceof SVGSVGElement)&&o.appendChild(i.cloneNode(!0)));const s=n=>{n.stopPropagation();const{rowId:o,depth:i}=t,s=new Set(e.expandedDepths),r=e.getExpandedRows?e.getExpandedRows():e.expandedRows,l=e.getCollapsedRows?e.getCollapsedRows():e.collapsedRows,d=b(o,i,s,r,l),a=!d;if(d?(e.setCollapsedRows(t=>{const e=new Map(t);return e.set(o,i),e}),e.setExpandedRows(t=>{const e=new Map(t);return e.delete(o),e}),e.setRowStateMap(t=>{const e=new Map(t);return e.delete(o),e})):(e.setExpandedRows(t=>{const e=new Map(t);return e.set(o,i),e}),e.setCollapsedRows(t=>{const e=new Map(t);return e.delete(o),e})),e.onRowGroupExpand&&t.tableRow.rowIndexPath&&e.rowGrouping){const n=t.header.pinned,s=t=>{setTimeout(()=>{e.setRowStateMap(e=>{const i=new Map(e),s=i.get(o)||{};return i.set(o,Object.assign(Object.assign({},s),{loading:t,triggerSection:n})),i})},0)},r=t=>{e.setRowStateMap(e=>{const i=new Map(e),s=i.get(o)||{};return i.set(o,Object.assign(Object.assign({},s),{error:t,loading:!1,triggerSection:n})),i})},l=(t,i)=>{e.setRowStateMap(e=>{const i=new Map(e),s=i.get(o)||{};return i.set(o,Object.assign(Object.assign({},s),{isEmpty:t,loading:!1,triggerSection:n})),i})};e.onRowGroupExpand({row:t.row,depth:i,event:{stopPropagation:()=>{},preventDefault:()=>{}},groupingKey:e.rowGrouping[i],isExpanded:a,rowIndexPath:t.tableRow.rowIndexPath,rowIdPath:t.tableRow.rowPath,groupingKeys:e.rowGrouping,setLoading:s,setError:r,setEmpty:l})}};return he(o,"click",s),he(o,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),s(t))}),o})(t,e,b(a,d,o,e.expandedRows,e.collapsedRows));n.appendChild(i)}if("lineAreaChart"===i.type&&Array.isArray(c)){const t=c.filter(t=>"number"==typeof t);if(t.length>0){const e=(t=>{let{data:e,width:n="100%",height:o=30,color:i,fillColor:s,fillOpacity:r=.25,strokeWidth:l=1.5,className:d="",min:a,max:c}=t;if(!e||0===e.length)return null;const h=void 0!==a?a:Math.min(...e),u=(void 0!==c?c:Math.max(...e))-h||1,p=o,f=document.createElementNS("http://www.w3.org/2000/svg","svg");f.setAttribute("width",n+""),f.setAttribute("height",o+""),f.setAttribute("viewBox","0 0 100 "+p),f.setAttribute("preserveAspectRatio","none"),f.setAttribute("class",("st-line-area-chart "+d).trim()),f.setAttribute("shape-rendering","geometricPrecision"),f.style.display="block";const w=()=>{f.innerHTML="";const t=e.map((t,n)=>({x:n/(e.length-1)*100,y:p-(t-h)/u*p})).map((t,e)=>`${0===e?"M":"L"} ${t.x},${t.y}`).join(" "),n=`\n ${t}\n L 100,${p}\n L 0,${p}\n Z\n `,o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",n),o.setAttribute("fill",s||"var(--st-chart-fill-color)"),o.setAttribute("fill-opacity",r+""),o.setAttribute("stroke","none");const d=document.createElementNS("http://www.w3.org/2000/svg","path");d.setAttribute("d",t),d.setAttribute("fill","none"),d.setAttribute("stroke",i||"var(--st-chart-color)"),d.setAttribute("stroke-width",l+""),d.setAttribute("stroke-linecap","round"),d.setAttribute("stroke-linejoin","round"),f.appendChild(o),f.appendChild(d)};return w(),{element:f,update:t=>{void 0===t.data||(e=t.data,e&&0!==e.length)?(void 0!==t.width&&(n=t.width,f.setAttribute("width",n+"")),void 0!==t.height&&(o=t.height,f.setAttribute("height",o+"")),void 0!==t.color&&(i=t.color),void 0!==t.fillColor&&(s=t.fillColor),void 0!==t.fillOpacity&&(r=t.fillOpacity),void 0!==t.strokeWidth&&(l=t.strokeWidth),void 0!==t.className&&(d=t.className,f.setAttribute("class",("st-line-area-chart "+d).trim())),void 0!==t.min&&(a=t.min),void 0!==t.max&&(c=t.max),w()):f.innerHTML=""},destroy:()=>{f.remove()}}})(Object.assign({data:t,width:"100%",height:30},i.chartOptions));return void((null==e?void 0:e.element)&&n.appendChild(e.element))}}else if("barChart"===i.type&&Array.isArray(c)){const t=c.filter(t=>"number"==typeof t);if(t.length>0){const e=(t=>{let{data:e,width:n="100%",height:o=30,color:i,gap:s=2,className:r="",min:l,max:d}=t;if(!e||0===e.length)return null;const a=void 0!==l?l:Math.min(...e),c=void 0!==d?d:Math.max(...e),h=c-a||1,u=o,p=(100-s*(e.length-1))/e.length,f=0>a,w=f?u*(c/h):u,v=document.createElementNS("http://www.w3.org/2000/svg","svg");v.setAttribute("width",n+""),v.setAttribute("height",o+""),v.setAttribute("viewBox","0 0 100 "+u),v.setAttribute("preserveAspectRatio","none"),v.setAttribute("class",("st-bar-chart "+r).trim()),v.setAttribute("shape-rendering","crispEdges"),v.style.display="block";const m=()=>{v.innerHTML="",e.forEach((t,e)=>{const n=e*(p+s),o=(t-a)/h*u;let r=u-o,l=o;f&&(0>t?(l=Math.abs(t)/h*u,r=w):(l=t/h*u,r=w-l));const d=document.createElementNS("http://www.w3.org/2000/svg","rect");d.setAttribute("x",n+""),d.setAttribute("y",r+""),d.setAttribute("width",p+""),d.setAttribute("height",l+""),d.setAttribute("fill",i||"var(--st-chart-color)"),d.setAttribute("rx","0.5"),v.appendChild(d)})};return m(),{element:v,update:t=>{void 0===t.data||(e=t.data,e&&0!==e.length)?(void 0!==t.width&&(n=t.width,v.setAttribute("width",n+"")),void 0!==t.height&&(o=t.height,v.setAttribute("height",o+"")),void 0!==t.color&&(i=t.color),void 0!==t.gap&&(s=t.gap),void 0!==t.className&&(r=t.className,v.setAttribute("class",("st-bar-chart "+r).trim())),void 0!==t.min&&(l=t.min),void 0!==t.max&&(d=t.max),m()):v.innerHTML=""},destroy:()=>{v.remove()}}})(Object.assign({data:t,width:"100%",height:30},i.chartOptions));return void((null==e?void 0:e.element)&&n.appendChild(e.element))}}if(i.cellRenderer){try{const d=i.cellRenderer({accessor:i.accessor,colIndex:l,row:s,rowIndex:t.tableRow.absoluteRowIndex||r,rowPath:t.tableRow.rowPath,theme:e.theme,value:c,formattedValue:null===(o=i.valueFormatter)||void 0===o?void 0:o.call(i,{accessor:i.accessor,colIndex:l,row:s,rowIndex:r,value:c})});if("string"==typeof d||"number"==typeof d){const t=document.createTextNode(d+"");n.appendChild(t)}else if(d instanceof Node)n.appendChild(d);else if(null!=d&&"object"==typeof d){const t=Be(c,i,l,s,r);if(null!==t){const e=document.createTextNode(t);n.appendChild(e)}}}catch(t){console.error("Error rendering cell:",t);const e=Be(c,i,l,s,r);if(null!==e){const t=document.createTextNode(e);n.appendChild(t)}}return}const g=Be(c,i,l,s,r);if(null!==g){const t=document.createTextNode(g);n.appendChild(t)}},ze=new Map,qe=new WeakMap;let Ve=null;const Ge=(t,e)=>{const n=ze.get(t);n&&n.forEach(t=>{e?t.classList.add("st-row-hovered"):t.classList.remove("st-row-hovered")})},Ue=(t,e)=>{var n;const{header:o,rowIndex:i,colIndex:s,rowId:r,depth:l,isOdd:d}=t,a=o.isSelectionColumn&&e.enableRowSelection,c=!!(null==o?void 0:o.isEditable)||!(!e.onCellClick||a),h={rowIndex:i,colIndex:s,rowId:r},u=e.getBorderClass(h),p=e.isSelected(h),f=e.isInitialFocusedCell(h),w=e.isCopyFlashing(h),v=e.isWarningFlashing(h),m=e.selectedColumns.has(s),g=p&&!m,b=a&&e.rowsWithSelectedCells.has(r+""),x=(()=>{var t,n,i;if(!e.columnBorders)return!1;const s=e.headers.filter(t=>"left"===t.pinned),r=e.headers.filter(t=>!t.pinned),l=e.headers.filter(t=>"right"===t.pinned);return"left"===o.pinned?(null===(t=s[s.length-1])||void 0===t?void 0:t.accessor)===o.accessor:"right"===o.pinned?(null===(n=l[l.length-1])||void 0===n?void 0:n.accessor)===o.accessor:(null===(i=r[r.length-1])||void 0===i?void 0:i.accessor)===o.accessor})();return["st-cell",l>0&&o.expandable?"st-cell-depth-"+l:"",g?f?"st-cell-selected-first "+u:"st-cell-selected "+u:"",m?f?"st-cell-column-selected-first":"st-cell-column-selected":"",c?"clickable":"",w?f?"st-cell-copy-flash-first":"st-cell-copy-flash":"",v?f?"st-cell-warning-flash-first":"st-cell-warning-flash":"",e.useOddColumnBackground?s%2==0?"even-column":"odd-column":"",a?"st-selection-cell":"",b?"st-selection-has-highlighted-cell":"",x?"st-last-column":"","",e.useOddEvenRowBackground?d?"st-cell-even-row":"st-cell-odd-row":"",(null===(n=e.isRowSelected)||void 0===n?void 0:n.call(e,r))?"st-cell-selected-row":""].filter(Boolean).join(" ")},Ke=(t,e)=>{var n;const{header:o,row:i,rowIndex:s,colIndex:r,rowId:l}=t,d=o.isSelectionColumn&&e.enableRowSelection,a={rowIndex:s,colIndex:r,rowId:l},c=e.isInitialFocusedCell(a),u=Ue(t,e),p=document.createElement("div");p.className=u,p.id=h({accessor:o.accessor,rowId:l}),p.setAttribute("role","gridcell"),p.setAttribute("tabindex",c?"0":"-1");const v=null!==(n=e.maxHeaderDepth)&&void 0!==n?n:1;p.setAttribute("aria-rowindex",t.tableRow.position+v+1+""),p.setAttribute("aria-colindex",r+1+""),p.setAttribute("data-row-index",s+""),p.setAttribute("data-col-index",r+""),p.setAttribute("data-row-id",l+""),p.setAttribute("data-accessor",o.accessor+""),p.style.position="absolute",p.style.left=t.left+"px",p.style.top=t.top+"px",p.style.width=t.width+"px",p.style.height=t.height+"px";let m=!1;const g="boolean"===o.type||"date"===o.type||"enum"===o.type,b=()=>{if(m&&!g){p.innerHTML="",p.setAttribute("tabindex","-1");const n=je(t,e,()=>{m=!1,p.setAttribute("tabindex",c?"0":"-1"),b(),x()});if(n){const t=document.createElement("div");t.className="st-cell-editing",t.appendChild(n),p.appendChild(t)}}else if(m&&g)je(t,e,()=>{m=!1,b(),x()});else{p.innerHTML="";const n=document.createElement("span");n.className="st-cell-content "+("right"===o.align?"right-aligned":"center"===o.align?"center-aligned":"left-aligned"),Ne(t,e,n),p.appendChild(n)}};b();const x=()=>{e.cellRegistry&&!d&&e.cellRegistry.set(`${l}-${o.accessor}`,{updateContent:t=>{m||(w(i,o.accessor,t),b(),e.cellUpdateFlash&&(p.classList.add(c?"st-cell-updating-first":"st-cell-updating"),setTimeout(()=>{p.classList.remove("st-cell-updating-first","st-cell-updating")},800)))}})};if(x(),!m&&!d){const t=()=>{e.handleMouseOver(a)};he(p,"mousedown",t=>{t.preventDefault(),t.target.closest(".st-expand-icon-container")||e.handleMouseDown(a)}),he(p,"mouseover",t)}if(he(p,"keydown",t=>{m||d||"F2"!==t.key&&"Enter"!==t.key||!o.isEditable||m||(t.preventDefault(),m=!0,b())}),he(p,"dblclick",t=>{!o.isEditable||d||m||(m=!0,b())}),qe.set(p,{current:i}),e.onCellClick&&!d){const t=t=>{var n,l,d;if(t.target.closest(".st-expand-icon-container"))return;const a=null!==(l=null===(n=qe.get(p))||void 0===n?void 0:n.current)&&void 0!==l?l:i,c=f(a,o.accessor);null===(d=e.onCellClick)||void 0===d||d.call(e,{accessor:o.accessor,colIndex:r,row:a,rowIndex:s,value:c})};he(p,"click",t)}if(e.useHoverRowBackground){((t,e)=>{ze.has(t)||ze.set(t,new Set),ze.get(t).add(e)})(s,p);const t=()=>{Ge(s,!1),Ve===s&&(Ve=null)};he(p,"mouseenter",()=>{null!==Ve&&Ve!==s&&Ge(Ve,!1),Ge(s,!0),Ve=s}),he(p,"mouseleave",t)}return p},Je=(t,e)=>{t.style.left="0",t.style.width="number"!=typeof e||0>e?"100%":e+"px"},Ye=e=>{const{position:n,rowHeight:o,displayStrongBorder:i,heightOffsets:s,customTheme:r=t,isSticky:l=!1,sectionWidthPx:d}=e,a=document.createElement("div");a.className="st-row-separator "+(i?"st-last-group-row":"");const c=l?n:_({position:n,rowHeight:o,heightOffsets:s,customTheme:r});Je(a,d),l?(a.style.position="absolute",a.style.top="0",a.style.transform=`translateY(${c}px)`):a.style.transform=`translate3d(0, ${c}px, 0)`;const h=document.createElement("div");h.style.width="100%",a.appendChild(h);let u=null;return a.addEventListener("mousedown",t=>{t.preventDefault();const e=a.style.pointerEvents;a.style.pointerEvents="none";const n=document.elementFromPoint(t.clientX,t.clientY);if(a.style.pointerEvents=e,!n)return;const o=n.closest(".st-cell");if(o instanceof HTMLElement){u=o;const e=o.getBoundingClientRect(),n=new MouseEvent("mousedown",{bubbles:!0,cancelable:!0,view:window,button:0,clientX:t.clientX,clientY:e.top+e.height/2});o.dispatchEvent(n)}}),a.addEventListener("mouseup",t=>{if(u){const e=u.getBoundingClientRect(),n=new MouseEvent("mouseup",{bubbles:!0,cancelable:!0,view:window,button:0,clientX:t.clientX,clientY:e.top+e.height/2});u.dispatchEvent(n),u=null}}),a},_e=new WeakMap,Xe=new WeakMap,Qe=t=>(Xe.has(t)||Xe.set(t,new Map),Xe.get(t)),Ze=(e,n,o,i=0,s,r)=>{var l,d,a,c,u;const p=o.pinned?null!==(d=null!==(l=o.containerWidth)&&void 0!==l?l:e.clientWidth)&&void 0!==d?d:0:null!==(u=null!==(c=null!==(a=o.mainSectionContainerWidth)&&void 0!==a?a:o.containerWidth)&&void 0!==c?c:e.clientWidth)&&void 0!==u?u:0,f=o.pinned?n:((t,e,n,o=100)=>{if(0===t.length)return[];const i=e-o,s=e+n+o;return t.filter(t=>t.left+t.width>=i&&s>=t.left)})(n,i,p),w=pe(e),v=(t=>(_e.has(t)||_e.set(t,new Map),_e.get(t)))(e),m=new Set(f.map(t=>h({accessor:t.header.accessor,rowId:t.rowId}))),g=(null==s?void 0:s.length)?new Set(s.map(t=>t.position)):new Set(f.map(t=>t.rowIndex));if(w.forEach((t,e)=>{if(!m.has(e)){const n=parseInt(t.getAttribute("data-row-index")||"-1",10);0>n||((t,e)=>{const n=ze.get(t);n&&(n.delete(e),0===n.size&&ze.delete(t))})(n,t),t.remove(),w.delete(e)}}),!r){const t=Qe(e);v.forEach((e,n)=>{g.has(n)||(e.remove(),v.delete(n),t.delete(n))})}const x=document.createDocumentFragment(),y=[];f.forEach(t=>{var e,n,i,s;const l=h({accessor:t.header.accessor,rowId:t.rowId});if(w.has(l)){const d=w.get(l);if(r)((t,e)=>{t.style.left=e.left+"px",t.style.top=e.top+"px",t.style.width=e.width+"px",t.style.height=e.height+"px"})(d,t);else{if(((t,e,n)=>{var o;const{rowIndex:i,colIndex:s,rowId:r}=e,l={rowIndex:i,colIndex:s,rowId:r};t.className=Ue(e,n);const d=n.isInitialFocusedCell(l);t.setAttribute("tabindex",d?"0":"-1"),t.style.left=e.left+"px",t.style.top=e.top+"px",t.style.width=e.width+"px",t.style.height=e.height+"px",t.setAttribute("data-row-index",i+""),t.setAttribute("data-col-index",s+"");const a=null!==(o=n.maxHeaderDepth)&&void 0!==o?o:1;t.setAttribute("aria-rowindex",e.tableRow.position+a+1+""),t.setAttribute("aria-colindex",s+1+""),t.setAttribute("data-row-id",r+""),t.setAttribute("data-accessor",e.header.accessor+"");const c=qe.get(t);if(c&&(c.current=e.row),!e.header.expandable){const o=t.querySelector(".st-cell-content");o&&(o.innerHTML="",Ne(e,n,o))}})(d,t,o),t.header.isSelectionColumn&&o.enableRowSelection&&o.isRowSelected){const e=o.isRowSelected(t.rowId);le(d,e)}if(t.header.expandable){const r=new Set(o.expandedDepths),l=null!==(n=null===(e=o.getExpandedRows)||void 0===e?void 0:e.call(o))&&void 0!==n?n:o.expandedRows,a=null!==(s=null===(i=o.getCollapsedRows)||void 0===i?void 0:i.call(o))&&void 0!==s?s:o.collapsedRows,c=b(t.rowId,t.depth,r,l,a);fe(d,c)}}}else y.push({cell:t,cellId:l})}),y.forEach(({cell:t,cellId:e})=>{const n=Ke(t,o);x.appendChild(n),w.set(e,n)}),x.childNodes.length>0&&e.appendChild(x),r||((e,n,o,i,s)=>{const r=Qe(e),l=(()=>{var t,n,i,s,r;const l=o.pinned?null!==(n=null!==(t=o.containerWidth)&&void 0!==t?t:e.clientWidth)&&void 0!==n?n:0:null!==(r=null!==(s=null!==(i=o.mainSectionContainerWidth)&&void 0!==i?i:o.containerWidth)&&void 0!==s?s:e.clientWidth)&&void 0!==r?r:0;return l>0?l:void 0})();let d=[];if(s&&s.length>0)d=s.map((t,e)=>({rowIndex:t.position,position:t.position,displayStrongBorder:e>0&&s[e-1].isLastGroupRow}));else if(n.length>0){const t=[];let e,o=-1,i=null;n.forEach(n=>{n.rowIndex!==o&&(i&&o>0&&t.push({rowIndex:o,firstCell:i,prevCell:e}),e=i||void 0,o=n.rowIndex,i=n)}),i&&o>0&&t.push({rowIndex:o,firstCell:i,prevCell:e}),d=t.map(({rowIndex:t,firstCell:e,prevCell:n})=>{var o,i;return{rowIndex:t,position:e.tableRow.position,displayStrongBorder:null!==(i=null===(o=null==n?void 0:n.tableRow)||void 0===o?void 0:o.isLastGroupRow)&&void 0!==i&&i}})}0!==d.length&&d.forEach(({rowIndex:n,position:s,displayStrongBorder:d})=>{var a;const c=r.get(n);if(i.has(n)){const e=i.get(n);if(!c||c.position!==s||c.displayStrongBorder!==d||c.sectionWidthPx!==l){if(Je(e,l),(null==c?void 0:c.displayStrongBorder)!==d&&(d?e.classList.add("st-last-group-row"):e.classList.remove("st-last-group-row")),!c||c.position!==s){const n=_({position:s,rowHeight:o.rowHeight,heightOffsets:o.heightOffsets,customTheme:null!==(a=o.customTheme)&&void 0!==a?a:t});e.style.transform=`translate3d(0, ${n}px, 0)`}r.set(n,{position:s,displayStrongBorder:d,sectionWidthPx:l})}}else{const t=Ye({position:s,rowHeight:o.rowHeight,displayStrongBorder:d,heightOffsets:o.heightOffsets,customTheme:o.customTheme,isSticky:!1,sectionWidthPx:l});e.appendChild(t),i.set(n,t),r.set(n,{position:s,displayStrongBorder:d,sectionWidthPx:l})}})})(e,f,o,v,s)};function tn(t,e){return t?"string"==typeof t?t:t instanceof HTMLElement?t.cloneNode(!0):"function"==typeof t?t(e):null:null}class en{constructor(){this.headerSections=new Map,this.bodySections=new Map,this.bodyCellsCache=new Map,this.headerCellsCache=new Map,this.contextCache=new Map,this.nextColIndexMap=new Map,this.stateRowsMap=new Map,this.nestedGridRowsMap=new Map}renderHeaderSection(t){const{headers:e,collapsedHeaders:n,pinned:o,maxHeaderDepth:i,headerHeight:s,context:r,sectionWidth:l,startColIndex:d=0}=t,a=o||"main";let c=this.headerSections.get(a);c||(c=document.createElement("div"),c.className="left"===o?"st-header-pinned-left":"right"===o?"st-header-pinned-right":"st-header-main",c.setAttribute("role","rowgroup"),this.headerSections.set(a,c));const h=e.filter(t=>"left"===o?"left"===t.pinned:"right"===o?"right"===t.pinned:!t.pinned);if(0===h.length)return c.style.display="none",c;c.style.display="",c.style.cssText=`\n position: relative;\n ${void 0!==l?`width: ${l}px;`:""}\n height: ${i*s}px;\n `;const u=this.getCachedHeaderCells(a,h,n,i,s,d),p=u.length>0?Math.max(...u.map(t=>t.colIndex))+1:d;this.nextColIndexMap.set(a,p);const f=this.getCachedContext("header-"+a,r,o),w=c.scrollLeft;return Pe(c,u,f,w),o||w===c.scrollLeft||(c.scrollLeft=w),!o&&c&&(c.__renderHeaderCells=t=>{c&&Pe(c,u,f,t)}),c}renderBodySection(e){var n,o;const{headers:i,rows:s,collapsedHeaders:r,pinned:l,context:d,sectionWidth:a,rowHeight:c,heightOffsets:h,totalRowCount:u,startColIndex:p=0,positionOnly:f=!1,fullTableRows:w,renderedStartIndex:v,renderedEndIndex:m}=e,g=l||"main";let b=this.bodySections.get(g);b||(b=document.createElement("div"),b.className="left"===l?"st-body-pinned-left":"right"===l?"st-body-pinned-right":"st-body-main",b.setAttribute("role","rowgroup"),this.bodySections.set(g,b));const x=i.filter(t=>"left"===l?"left"===t.pinned:"right"===l?"right"===t.pinned:!t.pinned);if(0===x.length)return b.style.display="none",b;b.style.display="";const y=((t,e,n,o)=>t*(e+o.rowSeparatorWidth)-o.rowSeparatorWidth+((null==n?void 0:n.reduce((t,[e,n])=>t+n,0))||0))(void 0!==u?u:s.length,c,h,null!==(n=d.customTheme)&&void 0!==n?n:t);b.style.cssText=`\n position: relative;\n ${void 0!==a?`width: ${a}px;`:""}\n ${l?"":"flex-grow: 1;"}\n height: ${y}px;\n `;const R=this.getCachedBodyCells(g,x,s,r,c,h,null!==(o=d.customTheme)&&void 0!==o?o:t,p,w,v,m),C=R.length>0?Math.max(...R.map(t=>t.colIndex))+1:p;this.nextColIndexMap.set(g,C);const S=this.getCachedContext("body-"+g,d,l);return Ze(b,R,S,b.scrollLeft,s,f),this.renderNestedGridRows(b,g,s,l,S),l||this.renderStateRows(b,g,s,S),!l&&b&&(b.__renderBodyCells=t=>{b&&Ze(b,R,S,t,s,!0)}),b}renderNestedGridRows(t,e,n,o,i){var s;const r=n.filter(t=>t.nestedTable),l=new Set(r.map(t=>t.position));let d=this.nestedGridRowsMap.get(e);d||(d=new Map,this.nestedGridRowsMap.set(e,d)),d.forEach((t,e)=>{var n;l.has(e)||(null===(n=t.cleanup)||void 0===n||n.call(t),t.element.remove(),d.delete(e))});const a={rowHeight:i.rowHeight,heightOffsets:i.heightOffsets,customTheme:null!==(s=i.customTheme)&&void 0!==s?s:{},theme:i.theme,rowGrouping:i.rowGrouping,depth:0,loadingStateRenderer:i.loadingStateRenderer,errorStateRenderer:i.errorStateRenderer,emptyStateRenderer:i.emptyStateRenderer,icons:i.icons};r.forEach(e=>{var n;const s=e.position;if(!d.get(s))if(o){const o=function(t,e){const{nestedTable:n}=t;if(!n)throw Error("createNestedGridSpacer called without tableRow.nestedTable");const o=t.nestedTable.expandableHeader.nestedTable,i=u({calculatedHeight:n.calculatedHeight,customHeight:null==o?void 0:o.height,customTheme:e.customTheme}),s=X({position:t.position,rowHeight:e.rowHeight,heightOffsets:e.heightOffsets,customTheme:e.customTheme}),r=document.createElement("div");return r.className="st-row st-nested-grid-spacer",r.dataset.index=t.position+"",r.style.position="absolute",r.style.left="0",r.style.right="0",r.style.transform=`translate3d(0, ${s}px, 0)`,r.style.height=i+"px",r.style.pointerEvents="none",r}(e,{rowHeight:i.rowHeight,heightOffsets:i.heightOffsets,customTheme:null!==(n=i.customTheme)&&void 0!==n?n:{}});t.appendChild(o),d.set(s,{element:o})}else{a.depth=e.depth>0?e.depth-1:0;const{element:n,cleanup:o}=function(t,e){const{nestedTable:n}=t;if(!n)throw Error("createNestedGridRow called without tableRow.nestedTable");const{rowHeight:o,heightOffsets:i,customTheme:s,theme:r,rowGrouping:l,depth:d,loadingStateRenderer:a,errorStateRenderer:c,emptyStateRenderer:h,icons:p}=e,{parentRow:w,expandableHeader:v,childAccessor:m,calculatedHeight:g}=n,b=v.nestedTable;if(!b)throw Error("createNestedGridRow: expandableHeader.nestedTable is missing");const x=f(w,m),y=Array.isArray(x)?x:[],R=l&&l[d+1]?l.slice(d+1):void 0,C=b.customTheme?Object.assign(Object.assign({},s),b.customTheme):s,S=(({calculatedHeight:t,customHeight:e,customTheme:n})=>e?"string"==typeof e?e:e+"px":t-n.nestedGridPaddingTop-n.nestedGridPaddingBottom+"px")({calculatedHeight:g,customHeight:b.height,customTheme:s}),I=u({calculatedHeight:g,customHeight:b.height,customTheme:s}),H=X({position:t.position,rowHeight:o,heightOffsets:i,customTheme:s}),M=document.createElement("div");M.className="st-row st-nested-grid-row",M.dataset.index=t.position+"",M.style.position="absolute",M.style.left="0",M.style.right="0",M.style.transform=`translate3d(0, ${H}px, 0)`,M.style.height=I+"px",M.style.paddingTop=s.nestedGridPaddingTop+"px",M.style.paddingBottom=s.nestedGridPaddingBottom+"px",M.style.paddingLeft=s.nestedGridPaddingLeft+"px",M.style.paddingRight=s.nestedGridPaddingRight+"px",M.style.boxSizing="border-box";const k=document.createElement("div");k.style.height="100%",k.style.width="100%",M.appendChild(k);const E=Object.assign(Object.assign({},b),{defaultHeaders:b.defaultHeaders,rows:y,theme:r,customTheme:C,height:S,rowGrouping:R,loadingStateRenderer:a,errorStateRenderer:c,emptyStateRenderer:h,icons:p}),O=new yn(k,E);O.mount();const T=()=>{O.destroy()};return M.__nestedTableCleanup=T,{element:M,cleanup:T}}(e,a);t.appendChild(n),d.set(s,{element:n,cleanup:o})}})}renderStateRows(t,e,n,o){var i;const s=n.filter(t=>t.stateIndicator),r=new Set(s.map(t=>t.position));let l=this.stateRowsMap.get(e);l||(l=new Map,this.stateRowsMap.set(e,l)),l.forEach((t,e)=>{r.has(e)||(t.remove(),l.delete(e))});const d={index:0,rowHeight:o.rowHeight,heightOffsets:o.heightOffsets,customTheme:null!==(i=o.customTheme)&&void 0!==i?i:{},loadingStateRenderer:o.loadingStateRenderer,errorStateRenderer:o.errorStateRenderer,emptyStateRenderer:o.emptyStateRenderer};s.forEach((e,n)=>{var i,s;const r=e.position,a=l.get(r);if(a){const t=X({position:r,rowHeight:o.rowHeight,heightOffsets:o.heightOffsets,customTheme:null!==(i=o.customTheme)&&void 0!==i?i:{}});return void(a.style.transform=`translate3d(0, ${t}px, 0)`)}const c=((t,e)=>{const{position:n,stateIndicator:o}=t;if(!o)throw Error("createStateRow called without stateIndicator");const i=document.createElement("div");i.className="st-row st-state-row",i.dataset.index=e.index+"",i.style.width="100%",i.style.transform=`translate3d(0, ${X({position:n,rowHeight:e.rowHeight,heightOffsets:e.heightOffsets,customTheme:e.customTheme})}px, 0)`,i.style.height=e.rowHeight+"px";const s=document.createElement("div");s.className="st-cell st-state-row-cell",s.style.width="100%",s.style.padding="0";let r=null;return o.state.loading&&e.loadingStateRenderer?r=tn(e.loadingStateRenderer,{parentRow:o.parentRow}):o.state.error&&e.errorStateRenderer?r=tn(e.errorStateRenderer,{error:o.state.error,parentRow:o.parentRow}):o.state.isEmpty&&e.emptyStateRenderer&&(r=tn(e.emptyStateRenderer,{message:o.state.emptyMessage,parentRow:o.parentRow})),r&&("string"==typeof r?s.textContent=r:r instanceof HTMLElement&&s.appendChild(r)),i.appendChild(s),i})(e,Object.assign(Object.assign({},d),{index:n})),h=X({position:r,rowHeight:o.rowHeight,heightOffsets:o.heightOffsets,customTheme:null!==(s=o.customTheme)&&void 0!==s?s:{}});c.style.position="absolute",c.style.transform=`translate3d(0, ${h}px, 0)`,c.style.width="100%",t.appendChild(c),l.set(r,c)})}calculateAbsoluteHeaderCells(t,e,n,o,i=0){const s=[];let r=i,l=0;const d=(t,i,a)=>{if(t.hide||t.excludeFromRender)return 0;const c=e.has(t.accessor);if(t.children&&t.children.length>0){const e=t.children.filter(t=>{const e=t.showWhen||"parentExpanded";return c?"parentCollapsed"===e||"always"===e:"parentExpanded"===e||"always"===e});if(t.singleRowChildren){const c="number"==typeof t.width?t.width:150;s.push({header:t,left:l,top:i*o,width:c,height:(n-i)*o,colIndex:r,parentHeader:a}),r++,l+=c;let h=0;return e.forEach(e=>{h+=d(e,i,t)}),c+h}if(0===e.length){const e="number"==typeof t.width?t.width:150;return s.push({header:t,left:l,top:i*o,width:e,height:(n-i)*o,colIndex:r,parentHeader:a}),r++,l+=e,e}const h=l,u=r;let p=0;return e.forEach(e=>{p+=d(e,i+1,t)}),s.push({header:t,left:h,top:i*o,width:p,height:o,colIndex:u,parentHeader:a}),p}{const e="number"==typeof t.width?t.width:150;return s.push({header:t,left:l,top:i*o,width:e,height:(n-i)*o,colIndex:r,parentHeader:a}),r++,l+=e,e}};return t.forEach(t=>d(t,0)),s}calculateAbsoluteBodyCells(t,e,n,o,i,s,r=0){const l=[],d=e.filter(t=>!t.nestedTable&&!t.stateIndicator),a=this.getLeafHeaders(t,n),c=new Map;let h=0;return a.forEach(t=>{const e="number"==typeof t.width?t.width:150;c.set(t.accessor,{left:h,width:e}),h+=e}),d.forEach((t,e)=>{const n=s?X({position:t.position,rowHeight:o,heightOffsets:i,customTheme:s}):e*o;a.forEach((i,s)=>{var d,a;const h=c.get(i.accessor);l.push({header:i,row:t.row,rowIndex:e,colIndex:r+s,rowId:g(t.rowId),displayRowNumber:t.displayPosition,depth:t.depth,isOdd:e%2==1,tableRow:t,left:null!==(d=null==h?void 0:h.left)&&void 0!==d?d:0,top:n,width:null!==(a=null==h?void 0:h.width)&&void 0!==a?a:150,height:o})})}),l}getLeafHeaders(t,e){const n=[],o=t=>{if(t.hide||t.excludeFromRender)return;const i=e.has(t.accessor);if(t.children&&t.children.length>0){const e=t.children.filter(t=>{const e=t.showWhen||"parentExpanded";return i?"parentCollapsed"===e||"always"===e:"parentExpanded"===e||"always"===e});t.singleRowChildren&&n.push(t),e.length>0?e.forEach(t=>o(t)):t.singleRowChildren||n.push(t)}else n.push(t)};return t.forEach(t=>o(t)),n}createHeadersHash(t){const e=t=>{let n=`${t.accessor}:${t.width}:${t.pinned||""}:${t.hide||""}`;return t.children&&t.children.length>0&&(n+=`:children[${t.children.map(e).join(",")}]`),n};return t.map(e).join("|")}createHeightOffsetsHash(t){return t&&0!==t.length?t.map(([t,e])=>`${t}:${e}`).join("|"):""}createContextHash(t){let e=["columnBorders","enableRowSelection","cellUpdateFlash","useOddColumnBackground","useHoverRowBackground","useOddEvenRowBackground","rowHeight","containerWidth"].map(e=>`${e}:${t[e]}`).join("|");if(e+=t.sort?`|sort:${t.sort.key.accessor}-${t.sort.direction}`:"|sort:none",e+=t.filters&&Object.keys(t.filters).length>0?"|filters:"+JSON.stringify(t.filters):"|filters:none",t.expandedRows&&(e+="|expandedRows:"+t.expandedRows.size),t.collapsedRows&&(e+="|collapsedRows:"+t.collapsedRows.size),t.expandedDepths&&(e+="|expandedDepths:"+(Array.isArray(t.expandedDepths)?t.expandedDepths.length:t.expandedDepths.size)),null!=t.collapsedHeaders){const n=t.collapsedHeaders.size;e+=`|collapsedHeaders:${n}:${0===n?"":Array.from(t.collapsedHeaders).sort().join(",")}`}return void 0!==t.selectedRowCount&&(e+="|selectedRowCount:"+t.selectedRowCount),t.selectedColumns&&void 0!==t.selectedColumns.size&&(e+="|selectedColumns:"+Array.from(t.selectedColumns).sort((t,e)=>t-e).join(",")),t.columnsWithSelectedCells&&void 0!==t.columnsWithSelectedCells.size&&(e+="|columnsWithSelectedCells:"+Array.from(t.columnsWithSelectedCells).sort((t,e)=>t-e).join(",")),t.rowsWithSelectedCells&&void 0!==t.rowsWithSelectedCells.size&&(e+="|rowsWithSelectedCells:"+Array.from(t.rowsWithSelectedCells).sort().join(",")),e}getCachedBodyCells(t,e,n,o,i,s,r,l=0,d,a,c){const h=this.createHeadersHash(e),u=this.createHeightOffsetsHash(s),p=null!=d&&null!=a&&null!=c,f=this.bodyCellsCache.get(t);if(f&&f.deps.headersHash===h&&f.deps.collapsedHeadersSize===o.size&&f.deps.rowHeight===i&&f.deps.heightOffsetsHash===u&&(p?f.deps.fullTableRowsRef===d&&f.deps.renderedStartIndex===a&&f.deps.renderedEndIndex===c:f.deps.rowsRef===n))return f.cells;const w=p?d.slice(a,c):n,v=this.calculateAbsoluteBodyCells(e,w,o,i,s,r,l);return this.bodyCellsCache.set(t,{cells:v,deps:Object.assign({headersHash:h,rowsRef:w,collapsedHeadersSize:o.size,rowHeight:i,heightOffsetsHash:u},p&&{fullTableRowsRef:d,renderedStartIndex:a,renderedEndIndex:c})}),v}getCachedHeaderCells(t,e,n,o,i,s=0){const r=this.headerCellsCache.get(t),l=this.createHeadersHash(e);if(r&&r.deps.headersHash===l&&r.deps.collapsedHeadersSize===n.size&&r.deps.maxDepth===o&&r.deps.headerHeight===i)return r.cells;const d=this.calculateAbsoluteHeaderCells(e,n,o,i,s);return this.headerCellsCache.set(t,{cells:d,deps:{headersHash:l,collapsedHeadersSize:n.size,maxDepth:o,headerHeight:i}}),d}getCachedContext(t,e,n){const o=this.contextCache.get(t),i=this.createContextHash(e);if(o&&o.deps.contextHash===i)return o.context;const s=Object.assign(Object.assign({},e),{pinned:n});return this.contextCache.set(t,{context:s,deps:{contextHash:i}}),s}invalidateCache(t){t&&"all"!==t?"body"===t?this.bodyCellsCache.clear():"header"===t?(this.headerCellsCache.clear(),this.headerSections.forEach(t=>{Jt(t)})):"context"===t&&(this.contextCache.clear(),this.headerCellsCache.clear(),this.headerSections.forEach(t=>{Jt(t)})):(this.bodyCellsCache.clear(),this.headerCellsCache.clear(),this.contextCache.clear(),this.bodySections.forEach(t=>{(t=>{if(t){const e=pe(t);e.forEach(t=>{t.remove()}),e.clear()}})(t)}),this.headerSections.forEach(t=>{Jt(t)}))}getNextColIndex(t){var e;return null!==(e=this.nextColIndexMap.get(t))&&void 0!==e?e:0}cleanup(){this.headerSections.clear(),this.bodySections.clear(),this.bodyCellsCache.clear(),this.headerCellsCache.clear(),this.contextCache.clear(),this.nextColIndexMap.clear()}}const nn=(t,e)=>{"string"==typeof e?t.innerHTML=e:(t.innerHTML="",t.appendChild(e.cloneNode(!0)))},on=(t,e,n=new Set)=>{for(const o of t)if(!n.has(o.accessor)&&(n.add(o.accessor),o.children&&o.children.length>0)){const t=o.children.some(t=>t.accessor===e);let i=!1;if(!t)for(const t of o.children)if(on([t],e,n),!1===t.hide){i=!0;break}(t||i)&&(o.hide=!1)}},sn=t=>t.every(t=>t.hide),rn=t=>{t.forEach(t=>{t.children&&t.children.length>0&&(rn(t.children),sn(t.children)&&(t.hide=!0))})},ln=(t,e)=>{const n=e.toLowerCase();return!!t.label.toLowerCase().includes(n)||!(!t.children||0>=t.children.length)&&t.children.some(t=>ln(t,e))},dn=(t,e,n)=>{if(!e.trim())return t;const o=n||ln;return t.filter(t=>!t.isSelectionColumn&&!t.excludeFromRender&&o(t,e))};function an(t,e,n,o){e&&t.appendChild(e),t.appendChild(n),o&&t.appendChild(o)}function cn(t,e,n,o,i,s,r){const l=e({headers:n,searchSection:o,listSection:i,resetSection:s,resetColumns:r});if(l instanceof HTMLElement)t.appendChild(l);else if("string"==typeof l){const e=document.createElement("div");e.innerHTML=l,t.appendChild(e)}}const hn=t=>{let e=t,{headers:n,open:o,searchEnabled:i,searchPlaceholder:s,searchFunction:r,columnEditorConfig:l,essentialAccessors:d,setHeaders:a,onColumnVisibilityChange:c,onColumnOrderChange:h,resetColumns:u}=e,p="",f=null,w=null,v=!1;const m=new Set,g=t=>{t.forEach(t=>{t.children&&t.children.length>0&&(m.add(t.accessor),g(t.children))})};g(n);let b=m;const x=document.createElement("div");x.className="st-column-editor-popout "+(o?"open":"");const y=document.createElement("div");y.className="st-column-editor-popout-content",y.addEventListener("click",t=>t.stopPropagation());let R=null,C=null;if(i){const t=function(t){const e=document.createElement("div");e.className="st-column-editor-search-wrapper";const n=document.createElement("div");n.className="st-column-editor-search";const o=document.createElement("input");return o.type="text",o.value="",o.placeholder=t,o.className="st-filter-input",o.addEventListener("click",t=>t.stopPropagation()),o.addEventListener("input",t=>{p=t.target.value,W()}),n.appendChild(o),e.appendChild(n),{wrapper:e,input:o}}(s);C=t.wrapper,R=t.input}const S=document.createElement("div");S.className="st-column-editor-lists";let I=null;u&&(I=function(t){const e=document.createElement("div");e.className="st-column-editor-footer";const n=document.createElement("button");return n.type="button",n.className="st-column-editor-reset-btn",n.textContent="Reset columns",n.addEventListener("click",e=>{e.stopPropagation(),t()}),e.appendChild(n),e}(u));let H=l.customRenderer;H?cn(y,H,n,C,S,I,u):an(y,C,S,I),x.appendChild(y);const M=t=>{f=t,null!==t?v=!0:(v=!1,W())},k=()=>{w=null},E=t=>{w=t,v?T():W()},O=t=>{const e=b;b=t,W(e)},T=()=>{S.querySelectorAll(".st-column-editor-drag-separator").forEach((t,e)=>{const n=t;n.style.opacity=0===e?-1===w?"1":"0":w===e-1?"1":"0"})},A=(t,e,o,s,u)=>{if(0===t.length)return;const v=t.filter(t=>!t.isSelectionColumn&&!t.excludeFromRender);if(0===(i?dn(v,p,r):v).length)return;if(o){const t=document.createElement("div");t.className="st-column-editor-section-label",t.textContent=o,s.appendChild(t)}const m=document.createElement("div");m.className="st-column-editor-list st-column-editor-list-section",s.appendChild(m);const g=((t,e)=>{const n=i?dn(t,p,r):t,o=[],s=i&&p.trim().length>0,l=({headers:t,depth:n=0,parent:i=null,currentPath:r=[]})=>{t.forEach((t,d)=>{if(t.isSelectionColumn||t.excludeFromRender)return;const a=[...r,d];o.push({header:t,visualIndex:o.length,depth:n,parent:i,indexPath:a,panelSection:e});const c=t.children&&t.children.length>0,h=s||b.has(t.accessor);c&&h&&t.children&&l({headers:t.children,depth:n+1,parent:t,currentPath:a})})};return l({headers:n,depth:0,parent:null,currentPath:[]}),o})(t,e),x=(t=>t.some(t=>t.children&&t.children.length>0))(t);g.forEach(t=>{var o;const s=(t=>{var e;const{allHeaders:n,clearHoverSeparator:o,depth:i,doesAnyHeaderHaveChildren:s,draggingRow:r,getDraggingRow:l,getHoveredSeparatorIndex:d,expandedHeaders:a,flattenedHeaders:c,forceExpanded:h,header:u,hoveredSeparatorIndex:p,panelSection:f,rowIndex:w,setDraggingRow:v,setExpandedHeaders:m,setHoveredSeparatorIndex:g,headers:b,setHeaders:x,onColumnVisibilityChange:y,onColumnOrderChange:R,previousExpandedHeaders:C}=t,S=null!==(e=t.essentialAccessors)&&void 0!==e?e:new Set,I=!1!==t.columnEditorConfig.allowColumnPinning,H=It(u,S),M=!H,k=document.createDocumentFragment(),E=16*i+"px",O=u.children&&u.children.length>0,T=!(u.hide||O&&u.children&&sn(u.children)),A=a.has(u.accessor),W=h||A;let P;if(0===w){const t=document.createElement("div");t.className="st-column-editor-drag-separator",t.style.opacity=-1===p?"1":"0",k.appendChild(t)}const L=document.createElement("div");L.className="st-header-checkbox-item",L.style.paddingLeft=E,L.draggable=!0;const $=t=>!(S.size>0&&!Mt(t,S)||(null==R||R(t),x(t),0)),D=t=>{if(t.stopPropagation(),h)return;const e=new Set(a);A?e.delete(u.accessor):e.add(u.accessor),m(e)};let F;if(L.addEventListener("dragstart",t=>{t.dataTransfer&&(t.dataTransfer.effectAllowed="move"),null==o||o(),v(c[w])}),L.addEventListener("dragenter",t=>{t.preventDefault()}),L.addEventListener("dragover",t=>{t.preventDefault();const e=l?l():r;if(e&&e.panelSection===f){const n=t.currentTarget.getBoundingClientRect(),o=(({flattenedHeaders:t,draggingRow:e,hoveredRowIndex:n,isTopHalfOfRow:o})=>{var i,s;const r=t[n];if(r.depth===e.depth)return(null===(i=r.parent)||void 0===i?void 0:i.accessor)!==(null===(s=e.parent)||void 0===s?void 0:s.accessor)?null:o||r.header.children?n-1:n;if(r.depth>e.depth){let i=r,s=n;for(;i.parent&&i.depth>e.depth;){const e=i.parent.accessor,n=t.findIndex(t=>t.header.accessor===e);if(-1===n)break;i=t[n],s=n}const l=s;let d=s;for(let e=s+1;t.length>e&&t[e].depth>i.depth;e++)d=e;const a=d-l+1,c=n-l;let h=a/2>c;return a%2==1&&c===Math.floor(a/2)&&(h=o),h?s-1:d}return null})({flattenedHeaders:c,draggingRow:e,hoveredRowIndex:w,isTopHalfOfRow:n.top+n.height/2>t.clientY});g(o)}}),L.addEventListener("dragend",()=>{const t=l?l():r,e=d?d():p,n=()=>{v(null),g(null)};if(!t||null===e||t.panelSection!==f)return void n();let o,i=c[e>t.visualIndex?e:e+1];if(i){if(i.depth>t.depth&&i.parent){const t=c.findIndex(t=>t.header.accessor===i.parent.accessor);-1!==t&&(i=c[t])}if(t.header.accessor!==i.header.accessor)if(t.indexPath.length!==i.indexPath.length||1!==t.indexPath.length&&!t.indexPath.slice(0,-1).every((t,e)=>t===i.indexPath[e]))n();else{if(1===t.indexPath.length){const{newHeaders:e,emergencyBreak:s}=me(b,t.indexPath,i.indexPath);if(s)return void n();o=e}else{const{newHeaders:e,emergencyBreak:s}=me(b,t.indexPath,i.indexPath);if(s)return void n();o=e}$(o),n()}else n()}else n()}),s){const e=document.createElement("div");if(e.className="st-header-icon-container",O){const t=void 0!==C?h||C.has(u.accessor):W,n=!h&&void 0!==C&&t!==W,o=n?t:W,i=document.createElement("div");i.className="st-collapsible-header-icon st-expand-icon-container "+(o?"expanded":"collapsed"),i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.setAttribute("aria-expanded",o+""),i.setAttribute("aria-label",o?`Collapse ${u.label} column`:`Expand ${u.label} column`),i.appendChild(bt("st-expand-icon")),i.addEventListener("click",D),i.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),D(t))}),e.appendChild(i),F=i,n&&(P=()=>{fe(L,W,{ariaLabelWhenExpanded:`Collapse ${u.label} column`,ariaLabelWhenCollapsed:`Expand ${u.label} column`,syncAriaExpanded:!0})})}t.columnEditorConfig.rowRenderer||L.appendChild(e)}const j=de({checked:T,onChange:t=>{if(!M)return;u.hide=!t,t?(on(n,u.accessor),O&&u.children&&u.children.length>0&&u.children.every(t=>!0===t.hide)&&u.children[0]&&(u.children[0].hide=!1,on(n,u.children[0].accessor))):rn(n);const e=[...b];if(x(vt(e)),y){const t=(t=>{const e={},n=t=>{e[t.accessor]=!t.hide,t.children&&t.children.length>0&&t.children.forEach(n)};return t.forEach(n),e})(e);y(t)}}});M||(j.element.classList.add("st-checkbox-disabled"),j.element.style.pointerEvents="none");const B=document.createElement("div");B.className="st-drag-icon-container",B.innerHTML='<svg\n aria-hidden="true"\n role="img"\n xmlns="http://www.w3.org/2000/svg"\n viewBox="0 0 16 10"\n style="height: 10px; width: 16px;"\n>\n <circle cx="3" cy="3" r="1.5" fill="currentColor" />\n <circle cx="8" cy="3" r="1.5" fill="currentColor" />\n <circle cx="13" cy="3" r="1.5" fill="currentColor" />\n <circle cx="3" cy="7" r="1.5" fill="currentColor" />\n <circle cx="8" cy="7" r="1.5" fill="currentColor" />\n <circle cx="13" cy="7" r="1.5" fill="currentColor" />\n</svg>';const N=document.createElement("div");N.className="st-column-label-container",N.textContent=u.label;const z="left"===u.pinned||"right"===u.pinned?u.pinned:null,q=!!z&&!H,V=!z&&"main"===f,G=!z&&"main"===f,U=()=>{const t=At(b,u.accessor,"left",S);t&&$(t)},K=()=>{const t=At(b,u.accessor,"right",S);t&&$(t)},J=()=>{const t=At(b,u.accessor,"main",S);t&&$(t)},{rowRenderer:Y}=t.columnEditorConfig;if(Y){const t=Y({accessor:u.accessor,header:u,components:{expandIcon:F,checkbox:j.element,dragIcon:B,labelContent:N},panelSection:f,isEssential:H,canToggleVisibility:M,allowColumnPinning:I,pinControl:I&&0===i?{pinnedSide:z,canPinLeft:V,canPinRight:G,canUnpin:q,pinLeft:U,pinRight:K,unpin:J}:void 0});t instanceof HTMLElement?L.appendChild(t):"string"==typeof t&&(L.innerHTML=t)}else if(L.appendChild(j.element),L.appendChild(B),L.appendChild(N),I&&0===i){const t=document.createElement("div");if(t.className="st-column-pin-side-group",t.addEventListener("mousedown",t=>{t.stopPropagation()}),t.addEventListener("dragstart",t=>{t.preventDefault(),t.stopPropagation()}),z){const e=document.createElement("div"),n=H;e.className="st-column-pin-btn st-column-pin-side st-column-pin-pinned-active"+(n?" st-column-pin-pinned-essential":""),e.textContent="left"===z?"L":"R",e.title=n?"Essential column — cannot be unpinned":"Unpin column",q&&e.addEventListener("click",t=>{t.stopPropagation(),J()}),t.appendChild(e)}else{if(V){const e=document.createElement("button");e.type="button",e.className="st-column-pin-btn st-column-pin-side st-column-pin-side-option",e.textContent="L",e.title="Pin column to left",e.addEventListener("click",t=>{t.stopPropagation(),U()}),t.appendChild(e)}if(G){const e=document.createElement("button");e.type="button",e.className="st-column-pin-btn st-column-pin-side st-column-pin-side-option",e.textContent="R",e.title="Pin column to right",e.addEventListener("click",t=>{t.stopPropagation(),K()}),t.appendChild(e)}}L.appendChild(t)}k.appendChild(L);const _=document.createElement("div");return _.className="st-column-editor-drag-separator",_.style.opacity=p===w?"1":"0",k.appendChild(_),{fragment:k,scheduleExpandIconAnimation:P}})({allHeaders:n,clearHoverSeparator:k,depth:t.depth,doesAnyHeaderHaveChildren:x,draggingRow:f,getDraggingRow:()=>f,getHoveredSeparatorIndex:()=>w,expandedHeaders:b,flattenedHeaders:g,forceExpanded:i&&p.trim().length>0,header:t.header,hoveredSeparatorIndex:w,panelSection:e,rowIndex:t.visualIndex,setDraggingRow:M,setExpandedHeaders:O,setHoveredSeparatorIndex:E,columnEditorConfig:l,essentialAccessors:null!=d?d:new Set,headers:n,setHeaders:a,onColumnVisibilityChange:c,onColumnOrderChange:h,previousExpandedHeaders:u});m.appendChild(s.fragment),null===(o=s.scheduleExpandIconAnimation)||void 0===o||o.call(s)})},W=t=>{S.innerHTML="";const e=!1!==l.allowColumnPinning,{pinnedLeft:o,unpinned:i,pinnedRight:s}=St(n);if(e)A(o,"left","Pinned Left",S,t),A(i,"main","Main",S,t),A(s,"right","Pinned Right",S,t);else{const e=[...o,...i,...s];A(e,"main",null,S,t)}};return W(),{element:x,update:t=>{void 0!==t.headers&&(n=t.headers),void 0!==t.searchEnabled&&(i=t.searchEnabled),void 0!==t.searchPlaceholder&&(s=t.searchPlaceholder),void 0!==t.searchFunction&&(r=t.searchFunction),void 0!==t.essentialAccessors&&(d=t.essentialAccessors),void 0!==t.setHeaders&&(a=t.setHeaders),void 0!==t.onColumnVisibilityChange&&(c=t.onColumnVisibilityChange),void 0!==t.onColumnOrderChange&&(h=t.onColumnOrderChange),void 0!==t.resetColumns&&(u=t.resetColumns);let e=!1;if(void 0!==t.columnEditorConfig){const n=t.columnEditorConfig.customRenderer;n!==H&&(H=n,e=!0),l=t.columnEditorConfig}void 0!==t.open&&(o=t.open,o?x.classList.add("open"):x.classList.remove("open")),R&&void 0!==t.searchPlaceholder&&(R.placeholder=t.searchPlaceholder),e&&(y.innerHTML="",H?cn(y,H,n,C,S,I,u):an(y,C,S,I)),W()},destroy:()=>{R&&(R.removeEventListener("input",()=>{}),R.removeEventListener("click",()=>{})),x.removeEventListener("click",()=>{}),x.remove()}}},un=t=>{const{sectionHeaders:e,stickyParents:n,stickyHeight:o,offsetStartIndex:i,treeTransitionOffset:s,rowHeight:r,heightOffsets:l,customTheme:d,cellRenderContext:a,collapsedHeaders:c,pinned:h,width:u,scrollSyncGroup:p,sectionScrollController:f}=t,w=document.createElement("div");w.className=h?"st-sticky-section-"+h:"st-sticky-section-main",w.style.position="relative",w.style.height=o+"px",h&&u?(w.style.width=u+"px",w.style.flexGrow="0",w.style.flexShrink="0"):w.style.flexGrow="1";const v=((t,e)=>{const n=[],o=t=>{if(t.hide||t.excludeFromRender)return;const i=e.has(t.accessor);if(t.children&&t.children.length>0){const e=t.children.filter(t=>{const e=t.showWhen||"parentExpanded";return i?"parentCollapsed"===e||"always"===e:"parentExpanded"===e||"always"===e});t.singleRowChildren&&n.push(t),e.length>0?e.forEach(t=>o(t)):t.singleRowChildren||n.push(t)}else n.push(t)};return t.forEach(t=>o(t)),n})(e,c),m=new Map;let b=0;v.forEach(t=>{const e="number"==typeof t.width?t.width:150;m.set(t.accessor,{left:b,width:e}),b+=e});const x=h&&"number"==typeof u?u:"number"==typeof a.mainSectionContainerWidth?a.mainSectionContainerWidth:void 0;return n.forEach((t,e)=>{const o=-1!==i&&e>=i,c=o?s:0,h=e*(r+1)+c,u=o?e:n.length-e,p=document.createElement("div");p.className="st-row st-sticky-parent",p.style.position="absolute",p.style.top="0px",p.style.left="0",p.style.right="0",p.style.height=r+"px",p.style.transform=`translateY(${h}px)`,p.style.zIndex=u+"",p.setAttribute("data-index",t.position+""),v.forEach((e,n)=>{var o,i;const s=m.get(e.accessor),l={header:e,row:t.row,rowIndex:t.position,colIndex:n,rowId:g(t.rowId),displayRowNumber:t.displayPosition,depth:t.depth,isOdd:t.position%2==1,tableRow:t,left:null!==(o=null==s?void 0:s.left)&&void 0!==o?o:0,top:0,width:null!==(i=null==s?void 0:s.width)&&void 0!==i?i:150,height:r},d=Ke(l,a);p.appendChild(d)}),w.appendChild(p);const f=Ye({position:(e+1)*(r+1)-1+c,rowHeight:r,displayStrongBorder:!1,heightOffsets:l,customTheme:d,isSticky:!0,sectionWidthPx:x});w.appendChild(f)}),f&&p&&f.registerPane("pinned-left"===p?"pinned-left":"pinned-right"===p?"pinned-right":"main",w,"sticky"),w},pn=(t,e)=>{if(e){const n=t.querySelector(".st-sticky-section-left"),o=t.querySelector(".st-sticky-section-main"),i=t.querySelector(".st-sticky-section-right");n instanceof HTMLElement&&e.unregisterPane("pinned-left",n),o instanceof HTMLElement&&e.unregisterPane("main",o),i instanceof HTMLElement&&e.unregisterPane("pinned-right",i)}t.remove()};class fn{constructor(){this.footerInstance=null,this.columnEditorInstance=null,this.horizontalScrollbarRef={current:null},this.scrollbarTimeoutId=null,this.stickyParentsContainer=null,this.sectionScrollController=null,this.renderScheduled=!1,this.pendingRenderCallback=null,this.sectionRenderer=new en}scheduleRender(t){this.renderScheduled||(this.renderScheduled=!0,this.pendingRenderCallback=t,queueMicrotask(()=>{this.renderScheduled=!1,this.pendingRenderCallback&&(this.pendingRenderCallback(),this.pendingRenderCallback=null)}))}invalidateCache(t){this.sectionRenderer.invalidateCache(t)}renderHeader(t,e,n,o){var i,s,r,l,d,a,c,h,u,p,f,w;if(!t||o.config.hideHeader)return;t.style.height=e+"px";const v=mt(o.effectiveHeaders,"left")||mt(o.effectiveHeaders,void 0)||mt(o.effectiveHeaders,"right");t.style.minHeight=v?"":e+"px",t.setAttribute("aria-rowcount",1+o.localRows.length+""),t.setAttribute("aria-colcount",o.effectiveHeaders.length+"");const m=null!==(s=null===(i=o.dimensionManager)||void 0===i?void 0:i.getState())&&void 0!==s?s:{containerWidth:0,calculatedHeaderHeight:o.customTheme.headerHeight,maxHeaderDepth:1},{mainWidth:g,leftWidth:b,rightWidth:x}=xe({headers:o.effectiveHeaders,containerWidth:m.containerWidth,collapsedHeaders:o.collapsedHeaders}),y=null===(r=o.sortManager)||void 0===r?void 0:r.getState(),R=null===(l=o.filterManager)||void 0===l?void 0:l.getState(),C=null!==(a=null===(d=o.rowSelectionManager)||void 0===d?void 0:d.getSelectedRowCount())&&void 0!==a?a:0,S={reverse:!1,collapsedHeaders:o.collapsedHeaders,getCollapsedHeaders:o.getCollapsedHeaders,columnBorders:null!==(c=o.config.columnBorders)&&void 0!==c&&c,columnReordering:null!==(h=o.config.columnReordering)&&void 0!==h&&h,columnResizing:null!==(u=o.config.columnResizing)&&void 0!==u&&u,containerWidth:m.containerWidth,mainSectionContainerWidth:g,enableHeaderEditing:o.config.enableHeaderEditing,enableRowSelection:o.config.enableRowSelection,selectedRowCount:C,filters:null!==(p=null==R?void 0:R.filters)&&void 0!==p?p:{},icons:o.resolvedIcons,selectedColumns:o.config.selectableColumns&&o.selectionManager?o.selectionManager.getSelectedColumns():new Set,columnsWithSelectedCells:o.selectionManager&&(o.config.selectableCells||o.config.selectableColumns)?o.selectionManager.getColumnsWithSelectedCells():new Set,sort:null!==(f=null==y?void 0:y.sort)&&void 0!==f?f:null,autoExpandColumns:null!==(w=o.config.autoExpandColumns)&&void 0!==w&&w,essentialAccessors:o.essentialAccessors,selectableColumns:o.config.selectableColumns,headers:o.effectiveHeaders,rows:o.localRows,headerHeight:o.customTheme.headerHeight,lastHeaderIndex:o.effectiveHeaders.length-1,onSort:t=>{o.sortManager&&o.sortManager.updateSort({accessor:t})},handleApplyFilter:t=>{o.filterManager&&o.filterManager.updateFilter(t)},handleClearFilter:t=>{o.filterManager&&o.filterManager.clearFilter(t)},getHeaders:()=>o.getHeaders(),handleSelectAll:t=>{var e;null===(e=o.rowSelectionManager)||void 0===e||e.handleSelectAll(t)},setCollapsedHeaders:t=>{o.setCollapsedHeaders("function"==typeof t?t(o.collapsedHeaders):t),o.onRender()},setHeaders:t=>{o.setHeaders("function"==typeof t?t(o.getHeaders()):t),o.onRender()},setIsResizing:t=>{o.setIsResizing("function"==typeof t?t(o.isResizing):t)},onColumnWidthChange:o.config.onColumnWidthChange,onColumnOrderChange:o.config.onColumnOrderChange,onTableHeaderDragEnd:t=>{o.setHeaders(t),o.onRender()},onHeaderEdit:o.config.onHeaderEdit,onColumnSelect:o.config.onColumnSelect,selectColumns:o.selectionManager&&o.config.selectableColumns?(t,e)=>{o.selectionManager.selectColumns(t,e),o.onRender()}:t=>{},setSelectedColumns:o.selectionManager&&o.config.selectableColumns?t=>{const e=o.selectionManager.getSelectedColumns(),n="function"==typeof t?t(e):t;o.selectionManager.setSelectedColumns(n),o.onRender()}:t=>{},setSelectedCells:o.selectionManager?t=>{var e;const n=o.selectionManager.getSelectedCells(),i="function"==typeof t?t(n):t;o.selectionManager.setSelectedCells(i instanceof Set?i:new Set),null===(e=o.onRender)||void 0===e||e.call(o)}:t=>{},setInitialFocusedCell:o.selectionManager?t=>{var e;o.selectionManager.setInitialFocusedCell(null!=t?t:null),null===(e=o.onRender)||void 0===e||e.call(o)}:t=>{},areAllRowsSelected:()=>{var t,e;return null!==(e=null===(t=o.rowSelectionManager)||void 0===t?void 0:t.areAllRowsSelected())&&void 0!==e&&e},draggedHeaderRef:o.draggedHeaderRef,hoveredHeaderRef:o.hoveredHeaderRef,headerRegistry:o.headerRegistry,forceUpdate:()=>o.onRender(),mainBodyRef:o.mainBodyRef,pinnedLeftRef:o.pinnedLeftRef,pinnedRightRef:o.pinnedRightRef},I=o.effectiveHeaders.filter(t=>"left"===t.pinned),H=o.effectiveHeaders.filter(t=>!t.pinned),M=o.effectiveHeaders.filter(t=>"right"===t.pinned);let k=0;const E=[];if(I.length>0){const e=this.sectionRenderer.renderHeaderSection({headers:o.effectiveHeaders,collapsedHeaders:o.collapsedHeaders,pinned:"left",maxHeaderDepth:n,headerHeight:o.customTheme.headerHeight,context:S,sectionWidth:b,startColIndex:k});o.pinnedLeftHeaderRef.current=e,E.push(e),t.appendChild(e),k=this.sectionRenderer.getNextColIndex("left")}if(H.length>0){const e=this.sectionRenderer.renderHeaderSection({headers:o.effectiveHeaders,collapsedHeaders:o.collapsedHeaders,maxHeaderDepth:n,headerHeight:o.customTheme.headerHeight,context:S,sectionWidth:g,startColIndex:k});o.mainHeaderRef.current=e,E.push(e),t.appendChild(e),k=this.sectionRenderer.getNextColIndex("main")}if(M.length>0){const e=this.sectionRenderer.renderHeaderSection({headers:o.effectiveHeaders,collapsedHeaders:o.collapsedHeaders,pinned:"right",maxHeaderDepth:n,headerHeight:o.customTheme.headerHeight,context:S,sectionWidth:x,startColIndex:k});o.pinnedRightHeaderRef.current=e,E.push(e),t.appendChild(e)}Array.from(t.children).forEach(t=>{E.includes(t)||t.remove()})}renderBody(t,e,n){var o,i,s,r,l,d,a,c,h,u,p,f,w,v,m,g,b,x,y,R;if(!t)return;if(mt(n.effectiveHeaders,"left")||mt(n.effectiveHeaders,void 0)||mt(n.effectiveHeaders,"right"))t.style.minHeight="";else{const n=null!==(i=null===(o=null==e?void 0:e.heightMap)||void 0===o?void 0:o.totalHeight)&&void 0!==i?i:0;t.style.minHeight=n+"px"}const C=e.rowsToRender||e.currentTableRows,S=!n.internalIsLoading&&0===e.currentTableRows.length;if(n.selectionManager&&e.currentTableRows&&n.selectionManager.updateConfig({tableRows:e.currentTableRows,headers:n.effectiveHeaders,collapsedHeaders:n.collapsedHeaders,selectableColumns:null!==(s=n.config.selectableColumns)&&void 0!==s&&s},{positionOnlyBody:n.positionOnlyBody}),S){t.innerHTML="";const e=document.createElement("div");return e.className="st-empty-state-wrapper","string"==typeof n.config.tableEmptyStateRenderer?e.textContent=n.config.tableEmptyStateRenderer:n.config.tableEmptyStateRenderer instanceof HTMLElement?e.appendChild(n.config.tableEmptyStateRenderer.cloneNode(!0)):e.innerHTML="<div class='st-empty-state'>No rows to display</div>",void t.appendChild(e)}const I=null!==(l=null===(r=n.dimensionManager)||void 0===r?void 0:r.getState())&&void 0!==l?l:{containerWidth:0,calculatedHeaderHeight:n.customTheme.headerHeight,maxHeaderDepth:1},{mainWidth:H,leftWidth:M,rightWidth:k}=xe({headers:n.effectiveHeaders,containerWidth:I.containerWidth,collapsedHeaders:n.collapsedHeaders}),E=null!==(a=null===(d=n.rowSelectionManager)||void 0===d?void 0:d.getSelectedRowCount())&&void 0!==a?a:0,O=null!==(c=I.maxHeaderDepth)&&void 0!==c?c:1,T={collapsedHeaders:n.collapsedHeaders,collapsedRows:n.getCollapsedRows(),expandedRows:n.getExpandedRows(),expandedDepths:Array.from(n.expandedDepths),selectedColumns:null!==(u=null===(h=n.selectionManager)||void 0===h?void 0:h.getSelectedColumns())&&void 0!==u?u:new Set,rowsWithSelectedCells:null!==(f=null===(p=n.selectionManager)||void 0===p?void 0:p.getRowsWithSelectedCells())&&void 0!==f?f:new Set,columnBorders:null!==(w=n.config.columnBorders)&&void 0!==w&&w,enableRowSelection:n.config.enableRowSelection,selectedRowCount:E,cellUpdateFlash:n.config.cellUpdateFlash,useOddColumnBackground:n.config.useOddColumnBackground,useHoverRowBackground:n.config.useHoverRowBackground,useOddEvenRowBackground:n.config.useOddEvenRowBackground,rowGrouping:n.config.rowGrouping,headers:n.effectiveHeaders,rowHeight:n.customTheme.rowHeight,maxHeaderDepth:O,heightOffsets:e.paginatedHeightOffsets,customTheme:n.customTheme,containerWidth:I.containerWidth,mainSectionContainerWidth:H,onCellEdit:n.config.onCellEdit,onCellClick:n.config.onCellClick,onRowGroupExpand:n.config.onRowGroupExpand,handleRowSelect:(t,e)=>{var o;null===(o=n.rowSelectionManager)||void 0===o||o.handleRowSelect(t,e)},cellRegistry:n.cellRegistry,getCollapsedRows:()=>n.getCollapsedRows(),getExpandedRows:()=>n.getExpandedRows(),setCollapsedRows:t=>{n.setCollapsedRows("function"==typeof t?t(n.getCollapsedRows()):t),this.scheduleRender(n.onRender)},setExpandedRows:t=>{n.setExpandedRows("function"==typeof t?t(n.getExpandedRows()):t),this.scheduleRender(n.onRender)},setRowStateMap:t=>{n.setRowStateMap("function"==typeof t?t(n.getRowStateMap()):t),this.scheduleRender(n.onRender)},icons:n.resolvedIcons,theme:null!==(v=n.config.theme)&&void 0!==v?v:"modern-light",rowButtons:n.config.rowButtons,loadingStateRenderer:n.config.loadingStateRenderer,errorStateRenderer:n.config.errorStateRenderer,emptyStateRenderer:n.config.emptyStateRenderer,getBorderClass:t=>{var e;return(null===(e=n.selectionManager)||void 0===e?void 0:e.getBorderClass(t))||""},isSelected:t=>{var e;return(null===(e=n.selectionManager)||void 0===e?void 0:e.isSelected(t))||!1},isInitialFocusedCell:t=>{var e;return(null===(e=n.selectionManager)||void 0===e?void 0:e.isInitialFocusedCell(t))||!1},isCopyFlashing:t=>{var e;return(null===(e=n.selectionManager)||void 0===e?void 0:e.isCopyFlashing(t))||!1},isWarningFlashing:t=>{var e;return(null===(e=n.selectionManager)||void 0===e?void 0:e.isWarningFlashing(t))||!1},handleMouseDown:t=>{var e;return null===(e=n.selectionManager)||void 0===e?void 0:e.handleMouseDown(t)},handleMouseOver:t=>{var e;return null===(e=n.selectionManager)||void 0===e?void 0:e.handleMouseOver(t)},isRowSelected:t=>{var e,o;return null!==(o=null===(e=n.rowSelectionManager)||void 0===e?void 0:e.isRowSelected(t))&&void 0!==o&&o},canExpandRowGroup:n.config.canExpandRowGroup,isLoading:n.internalIsLoading},A=n.effectiveHeaders.filter(t=>"left"===t.pinned),W=n.effectiveHeaders.filter(t=>!t.pinned),P=n.effectiveHeaders.filter(t=>"right"===t.pinned);let L=0;const $=[];if(A.length>0){const o=this.sectionRenderer.renderBodySection({headers:n.effectiveHeaders,rows:C,collapsedHeaders:n.collapsedHeaders,pinned:"left",context:T,sectionWidth:M,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,totalRowCount:e.currentTableRows.length,startColIndex:L,positionOnly:n.positionOnlyBody,fullTableRows:e.currentTableRows,renderedStartIndex:e.renderedStartIndex,renderedEndIndex:e.renderedEndIndex});n.pinnedLeftRef.current=o,$.push(o),t.appendChild(o),L=this.sectionRenderer.getNextColIndex("left")}if(W.length>0){const o=this.sectionRenderer.renderBodySection({headers:n.effectiveHeaders,rows:C,collapsedHeaders:n.collapsedHeaders,context:T,sectionWidth:H,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,totalRowCount:e.currentTableRows.length,startColIndex:L,positionOnly:n.positionOnlyBody,fullTableRows:e.currentTableRows,renderedStartIndex:e.renderedStartIndex,renderedEndIndex:e.renderedEndIndex});n.mainBodyRef.current=o,$.push(o),t.appendChild(o),L=this.sectionRenderer.getNextColIndex("main")}if(P.length>0){const o=this.sectionRenderer.renderBodySection({headers:n.effectiveHeaders,rows:C,collapsedHeaders:n.collapsedHeaders,pinned:"right",context:T,sectionWidth:k,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,totalRowCount:e.currentTableRows.length,startColIndex:L,positionOnly:n.positionOnlyBody,fullTableRows:e.currentTableRows,renderedStartIndex:e.renderedStartIndex,renderedEndIndex:e.renderedEndIndex});n.pinnedRightRef.current=o,$.push(o),t.appendChild(o)}if(n.config.enableStickyParents&&e.stickyParents&&e.stickyParents.length>0){this.stickyParentsContainer&&(pn(this.stickyParentsContainer,null!==(m=n.sectionScrollController)&&void 0!==m?m:null),this.stickyParentsContainer=null);const o=null!==(b=null===(g=n.mainBodyRef.current)||void 0===g?void 0:g.scrollTop)&&void 0!==b?b:0;this.stickyParentsContainer=((t,e)=>{const{stickyParents:n}=t;if(0===n.length)return null;const{treeTransitionOffset:o,offsetStartIndex:i}=((t,e,n,o,i,s)=>{var r,l;if(0===t.length)return{treeTransitionOffset:0,offsetStartIndex:-1};const d=e[0];if(!d)return{treeTransitionOffset:0,offsetStartIndex:-1};let a;if((null==d?void 0:d.parentIndices)&&d.parentIndices.length>0)for(let e=d.parentIndices.length-1;e>=0;e--){const n=d.parentIndices[e];if(t.some(t=>t.position===n)){a=n;break}}const c=void 0!==a?t.findIndex(t=>t.position===a):-1;let h=-1;for(let e=0;t.length>e;e++){const n=t[e],o=t[e+1];if(!o)break;if(o.depth===n.depth){h=e;break}if(n.depth>o.depth){h=t.findIndex(t=>t.depth===n.depth);break}}if(-1===h)return{treeTransitionOffset:0,offsetStartIndex:c};const u=null===(r=t[h])||void 0===r?void 0:r.position;if(void 0===u)return{treeTransitionOffset:0,offsetStartIndex:c};let p=0;for(const t of e){if(!(null===(l=t.parentIndices)||void 0===l?void 0:l.includes(u)))break;p++}if(0===p)return{treeTransitionOffset:0,offsetStartIndex:c};const f=e[0];let w;return w=n?n.rowTopPositions[f.position]:f.position*(o+i.rowSeparatorWidth),{treeTransitionOffset:-((h+1-p)*o+Math.max(0,s-w)),offsetStartIndex:c}})(n,t.partiallyVisibleRows,t.heightMap,e.rowHeight,e.customTheme,t.scrollTop),s=n.length>0?n.length*(e.rowHeight+1)+o:0,r=`calc(100% - ${t.scrollbarWidth}px - ${e.editColumns?"29.5px":"0px"})`,l=document.createElement("div");l.className="st-sticky-top",l.style.height=s+"px",l.style.width=r,l.style.top=t.calculatedHeaderHeight+"px";const d=e.headers.filter(t=>!t.pinned),a=e.sectionScrollController;if(t.pinnedLeftColumns.length>0){const r=un({sectionHeaders:t.pinnedLeftColumns,stickyParents:n,stickyHeight:s,offsetStartIndex:i,treeTransitionOffset:o,rowHeight:e.rowHeight,heightOffsets:e.heightOffsets,customTheme:e.customTheme,cellRenderContext:e.cellRenderContext,collapsedHeaders:e.collapsedHeaders,pinned:"left",width:t.pinnedLeftWidth,scrollSyncGroup:"pinned-left",sectionScrollController:a});l.appendChild(r)}const c=un({cellRenderContext:e.cellRenderContext,collapsedHeaders:e.collapsedHeaders,customTheme:e.customTheme,heightOffsets:e.heightOffsets,offsetStartIndex:i,rowHeight:e.rowHeight,scrollSyncGroup:"default",sectionHeaders:d,stickyHeight:s,stickyParents:n,treeTransitionOffset:o,sectionScrollController:a});if(l.appendChild(c),t.pinnedRightColumns.length>0){const r=un({sectionHeaders:t.pinnedRightColumns,stickyParents:n,stickyHeight:s,offsetStartIndex:i,treeTransitionOffset:o,rowHeight:e.rowHeight,heightOffsets:e.heightOffsets,customTheme:e.customTheme,cellRenderContext:e.cellRenderContext,collapsedHeaders:e.collapsedHeaders,pinned:"right",width:t.pinnedRightWidth,scrollSyncGroup:"pinned-right",sectionScrollController:a});l.appendChild(r)}return l})({calculatedHeaderHeight:I.calculatedHeaderHeight,heightMap:e.heightMap,partiallyVisibleRows:e.partiallyVisibleRows||[],pinnedLeftColumns:A,pinnedLeftWidth:M,pinnedRightColumns:P,pinnedRightWidth:k,scrollTop:o,scrollbarWidth:n.mainBodyRef.current?n.mainBodyRef.current.offsetWidth-n.mainBodyRef.current.clientWidth:0,stickyParents:e.stickyParents},{collapsedHeaders:n.collapsedHeaders,customTheme:n.customTheme,editColumns:null!==(x=n.config.editColumns)&&void 0!==x&&x,headers:n.effectiveHeaders,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,cellRenderContext:T,sectionScrollController:null!==(y=n.sectionScrollController)&&void 0!==y?y:null}),this.stickyParentsContainer&&($.push(this.stickyParentsContainer),t.contains(this.stickyParentsContainer)||t.appendChild(this.stickyParentsContainer))}else this.stickyParentsContainer&&(pn(this.stickyParentsContainer,null!==(R=n.sectionScrollController)&&void 0!==R?R:null),this.stickyParentsContainer=null);Array.from(t.children).forEach(t=>{$.includes(t)||t.remove()})}renderFooter(t,e,n,o,i){var s,r,l,d,a,c,h,u,p,f,w;if(!t)return;const v=!!i.config.footerRenderer;if(!v&&(!i.config.shouldPaginate||i.config.hideFooter))return void(t.innerHTML="");const m=null!==(s=i.config.rowsPerPage)&&void 0!==s?s:10,g=Math.ceil(e/m);if(v){const s=(n-1)*m+1,d=i.config.footerRenderer({currentPage:n,endRow:Math.min(n*m,e),hasNextPage:g>n,hasPrevPage:n>1,nextIcon:null===(r=i.resolvedIcons)||void 0===r?void 0:r.next,onNextPage:async()=>{g>n&&(o(n+1),i.config.onNextPage&&await i.config.onNextPage(n+1))},onPageChange:o,onPrevPage:()=>{n>1&&o(n-1)},prevIcon:null===(l=i.resolvedIcons)||void 0===l?void 0:l.prev,rowsPerPage:m,startRow:s,totalPages:g,totalRows:e});return t.innerHTML="",d instanceof HTMLElement?t.appendChild(d):"string"==typeof d&&(t.innerHTML=d),void(this.footerInstance=null)}if(this.footerInstance)this.footerInstance.update({currentPage:n,hideFooter:null!==(d=i.config.hideFooter)&&void 0!==d&&d,onPageChange:o,onNextPage:i.config.onNextPage,onUserPageChange:i.config.onPageChange,rowsPerPage:m,shouldPaginate:null!==(a=i.config.shouldPaginate)&&void 0!==a&&a,totalPages:g,totalRows:e,prevIcon:null===(c=i.resolvedIcons)||void 0===c?void 0:c.prev,nextIcon:null===(h=i.resolvedIcons)||void 0===h?void 0:h.next});else{t.innerHTML="";const s=(t=>{let{currentPage:e,hideFooter:n,onPageChange:o,onNextPage:i,onUserPageChange:s,rowsPerPage:r,shouldPaginate:l,totalPages:d,totalRows:a,prevIcon:c,nextIcon:h}=t,u=!0;if(n||!l)return{element:document.createElement("div"),update:()=>{},destroy:()=>{}};const p=document.createElement("div");p.className="st-footer";const f=()=>{p.innerHTML="";const t=e>1,n=d>e,l=e===d,w=Math.min((e-1)*r+1,a),v=Math.min(e*r,a),m=!t,g=!n&&!i||!u&&l,b=document.createElement("div");b.className="st-footer-info";const x=document.createElement("span");x.className="st-footer-results-text",x.textContent=`Showing ${w} to ${v} of ${a.toLocaleString()} results`,b.appendChild(x),p.appendChild(b);const y=document.createElement("div");y.className="st-footer-pagination";const R=((t,e)=>{if(15>=e)return Array.from({length:e},(t,e)=>e+1);const n=[];let o,i;if(t>8)if(e-7>t){const e=7;o=t-e,i=t+(15-e-1)}else o=Math.max(1,e-15+1),i=e;else o=1,i=14;o>2?(n.push(1),n.push(-1)):2===o&&n.push(1);for(let t=o;i>=t;t++)n.push(t);return e-1>i?(n.push(-2),n.push(e)):i===e-1&&n.push(e),n})(e,d),C=[];R.forEach((t,n)=>{if(0>t){const t=document.createElement("span");t.className="st-page-ellipsis",t.textContent="...",y.appendChild(t)}else{const i=document.createElement("button"),r=n>0&&0>R[n-1];i.className=["st-page-btn",e===t?"active":""].filter(Boolean).join(" "),i.textContent=""+t,i.setAttribute("aria-label","Go to page "+t),e===t&&i.setAttribute("aria-current","page"),i.addEventListener("click",()=>(async t=>{1>t||t>d||(o(t),s&&await s(t))})(t)),y.appendChild(i),C.push({button:i,page:t,afterEllipsis:r})}}),C.forEach((t,n)=>{const{button:o,page:i,afterEllipsis:s}=t,r=n+1,l=e===i,d=o.previousElementSibling,a=o.nextElementSibling,c=null!==d&&d.classList.contains("st-page-btn")&&d.classList.contains("active")||null!==a&&a.classList.contains("st-page-btn")&&a.classList.contains("active");r>9&&!(l||s||c)&&o.classList.add("st-page-btn--compact-hidden")});const S=document.createElement("button");S.className="st-next-prev-btn "+(m?"disabled":""),S.disabled=m,S.setAttribute("aria-label","Go to previous page"),c?nn(S,c):S.innerHTML='<svg\n class="st-next-prev-icon"\n viewBox="0 0 24 24"\n width="24"\n height="24"\n xmlns="http://www.w3.org/2000/svg"\n>\n <path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z" />\n</svg>',S.addEventListener("click",async()=>{const t=e-1;1>t||(o(t),s&&await s(t))}),y.appendChild(S);const I=document.createElement("button");I.className="st-next-prev-btn "+(g?"disabled":""),I.disabled=g,I.setAttribute("aria-label","Go to next page"),h?nn(I,h):I.innerHTML='<svg\n class="st-next-prev-icon"\n viewBox="0 0 24 24"\n width="24"\n height="24"\n xmlns="http://www.w3.org/2000/svg"\n>\n <path d="M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z" />\n</svg>',I.addEventListener("click",async()=>{const t=e+1;if(i&&e===d&&!await i(e))return u=!1,void f();t>d&&!i||(o(t),s&&await s(t))}),y.appendChild(I),p.appendChild(y)};return f(),{element:p,update:t=>{void 0!==t.currentPage&&(e=t.currentPage),void 0!==t.hideFooter&&(n=t.hideFooter),void 0!==t.onPageChange&&(o=t.onPageChange),void 0!==t.onNextPage&&(i=t.onNextPage),void 0!==t.onUserPageChange&&(s=t.onUserPageChange),void 0!==t.rowsPerPage&&(r=t.rowsPerPage),void 0!==t.shouldPaginate&&(l=t.shouldPaginate),void 0!==t.totalPages&&(d=t.totalPages),void 0!==t.totalRows&&(a=t.totalRows),void 0!==t.prevIcon&&(c=t.prevIcon),void 0!==t.nextIcon&&(h=t.nextIcon),n||!l?p.style.display="none":(p.style.display="flex",f())},destroy:()=>{p.remove()}}})({currentPage:n,hideFooter:null!==(u=i.config.hideFooter)&&void 0!==u&&u,onPageChange:o,onNextPage:i.config.onNextPage,onUserPageChange:i.config.onPageChange,rowsPerPage:m,shouldPaginate:null!==(p=i.config.shouldPaginate)&&void 0!==p&&p,totalPages:g,totalRows:e,prevIcon:null===(f=i.resolvedIcons)||void 0===f?void 0:f.prev,nextIcon:null===(w=i.resolvedIcons)||void 0===w?void 0:w.next});this.footerInstance=s,t.appendChild(s.element)}}renderColumnEditor(t,e,n,o,i){if(!t)return;if(!i.config.editColumns)return void(this.columnEditorInstance&&(this.columnEditorInstance.destroy(),this.columnEditorInstance=null));const s=()=>{const t=i.config.defaultHeaders;if(t){const e=t.map(t=>Object.assign({},t));i.setHeaders(e),i.onRender()}};if(this.columnEditorInstance)this.columnEditorInstance.update({columnEditorText:o.text,editColumns:i.config.editColumns,headers:i.headers,open:e,searchEnabled:o.searchEnabled,searchPlaceholder:o.searchPlaceholder,searchFunction:o.searchFunction,columnEditorConfig:o,essentialAccessors:i.essentialAccessors,setHeaders:t=>{i.setHeaders(t),this.columnEditorInstance&&this.columnEditorInstance.update({headers:t}),i.onRender()},onColumnVisibilityChange:i.config.onColumnVisibilityChange,onColumnOrderChange:i.config.onColumnOrderChange,resetColumns:s,setOpen:n});else{const r=(t=>{let{columnEditorText:e,editColumns:n,headers:o,open:i,searchEnabled:s,searchPlaceholder:r,searchFunction:l,columnEditorConfig:d,essentialAccessors:a,resetColumns:c,setHeaders:h,onColumnVisibilityChange:u,onColumnOrderChange:p,setOpen:f}=t;if(!n)return{element:document.createElement("div"),update:()=>{},destroy:()=>{}};const w=document.createElement("div");w.className="st-column-editor "+(i?"open":""),w.style.width="29.5px";const v=t=>{f(!i)},m=document.createElement("div");m.className="st-column-editor-text",m.textContent=e,w.addEventListener("click",v),w.appendChild(m);const g=hn({headers:o,open:i,searchEnabled:s,searchPlaceholder:r,searchFunction:l,columnEditorConfig:d,essentialAccessors:a,resetColumns:c,setHeaders:h,onColumnVisibilityChange:u,onColumnOrderChange:p});w.appendChild(g.element);const b={update:t=>{void 0!==t.open&&(i=t.open,t.open?w.classList.add("open"):w.classList.remove("open")),void 0!==t.setOpen&&(f=t.setOpen),void 0!==t.columnEditorText&&(m.textContent=t.columnEditorText),void 0!==t.essentialAccessors&&(a=t.essentialAccessors),void 0!==t.resetColumns&&(c=t.resetColumns),g.update({headers:t.headers,open:t.open,searchEnabled:t.searchEnabled,searchPlaceholder:t.searchPlaceholder,searchFunction:t.searchFunction,columnEditorConfig:t.columnEditorConfig,essentialAccessors:t.essentialAccessors,resetColumns:t.resetColumns,setHeaders:t.setHeaders,onColumnVisibilityChange:t.onColumnVisibilityChange,onColumnOrderChange:t.onColumnOrderChange})},destroy:()=>{w.removeEventListener("click",v),g.destroy(),w.remove()}};return w.__columnEditor=b,Object.assign({element:w},b)})({columnEditorText:o.text,editColumns:i.config.editColumns,headers:i.headers,open:e,searchEnabled:o.searchEnabled,searchPlaceholder:o.searchPlaceholder,searchFunction:o.searchFunction,columnEditorConfig:o,essentialAccessors:i.essentialAccessors,setHeaders:t=>{i.setHeaders(t),this.columnEditorInstance&&this.columnEditorInstance.update({headers:t}),i.onRender()},onColumnVisibilityChange:i.config.onColumnVisibilityChange,onColumnOrderChange:i.config.onColumnOrderChange,resetColumns:s,setOpen:n});this.columnEditorInstance=r,t.appendChild(r.element)}}renderHorizontalScrollbar(t,n,o,i,s,r,l,d){var a,c;if(t&&d.mainBodyRef.current&&l)return d.mainBodyRef.current.scrollWidth-d.mainBodyRef.current.clientWidth>1?void(this.horizontalScrollbarRef.current&&t.contains(this.horizontalScrollbarRef.current)?ge(this.horizontalScrollbarRef.current,{mainBodyRef:d.mainBodyRef.current,mainBodyWidth:n,pinnedLeftWidth:o,pinnedRightWidth:i,pinnedLeftContentWidth:s,pinnedRightContentWidth:r,tableBodyContainerRef:l,editColumns:null!==(a=d.config.editColumns)&&void 0!==a&&a,sectionScrollController:null!==(c=d.sectionScrollController)&&void 0!==c?c:void 0}):(null!==this.scrollbarTimeoutId&&(clearTimeout(this.scrollbarTimeoutId),this.scrollbarTimeoutId=null),this.scrollbarTimeoutId=window.setTimeout(()=>{var a,c,h,u;if(!d.mainBodyRef.current||!l||!t)return;if(this.horizontalScrollbarRef.current&&t.contains(this.horizontalScrollbarRef.current))return ge(this.horizontalScrollbarRef.current,{mainBodyRef:d.mainBodyRef.current,mainBodyWidth:n,pinnedLeftWidth:o,pinnedRightWidth:i,pinnedLeftContentWidth:s,pinnedRightContentWidth:r,tableBodyContainerRef:l,editColumns:null!==(a=d.config.editColumns)&&void 0!==a&&a,sectionScrollController:null!==(c=d.sectionScrollController)&&void 0!==c?c:void 0}),void(this.scrollbarTimeoutId=null);this.sectionScrollController=null!==(h=d.sectionScrollController)&&void 0!==h?h:null;const p=(t=>{const{mainBodyRef:n,mainBodyWidth:o,pinnedLeftWidth:i,pinnedRightWidth:s,pinnedLeftContentWidth:r,pinnedRightContentWidth:l,tableBodyContainerRef:d,editColumns:a,sectionScrollController:c}=t;if(1>=n.scrollWidth-n.clientWidth)return null;const h=a?e:0,u=(a?s+1:s)+(d.scrollHeight>d.clientHeight?d.offsetWidth-d.clientWidth:0),p=document.createElement("div");if(p.className="st-horizontal-scrollbar-container",i>0){const t=document.createElement("div");t.className="st-horizontal-scrollbar-left",t.style.width=i+"px";const e=document.createElement("div");e.style.width=r+"px",t.appendChild(e),p.appendChild(t),null==c||c.registerPane("pinned-left",t,"scrollbar")}if(o>0){const t=document.createElement("div");t.className="st-horizontal-scrollbar-middle";const e=document.createElement("div");e.style.width=o+"px",t.appendChild(e),p.appendChild(t),null==c||c.registerPane("main",t,"scrollbar")}if(s>0){const t=document.createElement("div");t.className="st-horizontal-scrollbar-right",t.style.width=u+"px";const e=document.createElement("div");e.style.width=l+"px",t.appendChild(e),p.appendChild(t),null==c||c.registerPane("pinned-right",t,"scrollbar")}if(h>0){const t=document.createElement("div");t.style.width=h-1.5+"px",t.style.height="100%",t.style.flexShrink="0",p.appendChild(t)}return p})({mainBodyRef:d.mainBodyRef.current,mainBodyWidth:n,pinnedLeftWidth:o,pinnedRightWidth:i,pinnedLeftContentWidth:s,pinnedRightContentWidth:r,tableBodyContainerRef:l,editColumns:null!==(u=d.config.editColumns)&&void 0!==u&&u,sectionScrollController:this.sectionScrollController});if(p){const e=t.querySelector(".st-content-wrapper");e&&e.nextSibling?t.insertBefore(p,e.nextSibling):t.appendChild(p),this.horizontalScrollbarRef.current=p}this.scrollbarTimeoutId=null},1))):(this.horizontalScrollbarRef.current&&(be(this.horizontalScrollbarRef.current,d.sectionScrollController),this.horizontalScrollbarRef.current=null),void(null!==this.scrollbarTimeoutId&&(clearTimeout(this.scrollbarTimeoutId),this.scrollbarTimeoutId=null)))}cleanup(){var t,e;this.sectionRenderer.cleanup(),null===(t=this.footerInstance)||void 0===t||t.destroy(),null===(e=this.columnEditorInstance)||void 0===e||e.destroy(),null!==this.scrollbarTimeoutId&&(clearTimeout(this.scrollbarTimeoutId),this.scrollbarTimeoutId=null),this.horizontalScrollbarRef.current&&(be(this.horizontalScrollbarRef.current,this.sectionScrollController),this.horizontalScrollbarRef.current=null),this.stickyParentsContainer&&(pn(this.stickyParentsContainer,this.sectionScrollController),this.stickyParentsContainer=null),this.sectionScrollController=null}}function wn(t){const{rows:e=[],rowGrouping:n=[],getRowId:o,expandedRows:i=new Map,collapsedRows:s=new Map,expandedDepths:r=new Set,rowStateMap:l=new Map,hasLoadingRenderer:d=!1,hasErrorRenderer:a=!1,hasEmptyRenderer:c=!1,headers:h=[],rowHeight:p=40,headerHeight:f=40,customTheme:w}=t;if(!n||0===n.length){const t=e.map((t,e)=>{const n=[e],i=[e];return{row:t,depth:0,displayPosition:e,groupingKey:void 0,position:e,rowId:m({row:t,getRowId:o,depth:0,index:e,rowPath:n,rowIndexPath:i,groupingKey:void 0}),rowPath:n,rowIndexPath:i,absoluteRowIndex:e,isLastGroupRow:!1}});return{flattenedRows:t,heightOffsets:[],paginatableRows:t,parentEndPositions:e.map((t,e)=>e+1)}}const x=[],y=[],R=[],C=[];let S=0;const I=(t,e,H=[],M=[],k=[])=>{t.forEach((t,E)=>{var O,T;const A=n[e],W=x.length,P=[...H,E],L=[...M,E],$=m({row:t,getRowId:o,depth:e,index:E,rowPath:P,rowIndexPath:L,groupingKey:A}),D=x.length,F={row:t,depth:e,displayPosition:S,groupingKey:A,position:W,isLastGroupRow:!1,rowId:$,rowPath:P,rowIndexPath:L,absoluteRowIndex:W,parentIndices:k.length>0?[...k]:void 0};x.push(F),y.push(F),S++;const j=g($);if(b(j,e,r,i,s)&&n.length>e){const n=null==l?void 0:l.get(j),o=((t,e)=>{const n=t[e];return v(n)?n:[]})(t,A),i=h.find(t=>t.expandable&&t.nestedTable);if((null==i?void 0:i.nestedTable)&&o.length>0){const n=x.length,s=(null===(O=i.nestedTable.customTheme)||void 0===O?void 0:O.rowHeight)||p,r=(null===(T=i.nestedTable.customTheme)||void 0===T?void 0:T.headerHeight)||f,l=(({childRowCount:t,rowHeight:e,headerHeight:n,customTheme:o})=>Math.min(n+o.rowSeparatorWidth+t*(e+o.rowSeparatorWidth)+o.nestedGridPaddingTop+o.nestedGridPaddingBottom+o.nestedGridBorderWidth,o.nestedGridMaxHeight+o.nestedGridPaddingTop+o.nestedGridPaddingBottom+o.nestedGridBorderWidth))({childRowCount:o.length,rowHeight:s,headerHeight:r,customTheme:w}),d=u({calculatedHeight:l,customHeight:i.nestedTable.height,customTheme:w});R.push([n,d-p]);const a=[...P,A];x.push({row:{},depth:e+1,displayPosition:S-1,groupingKey:A,position:n,isLastGroupRow:!1,rowId:a,rowPath:a,rowIndexPath:L,nestedTable:{parentRow:t,expandableHeader:i,childAccessor:A,calculatedHeight:d},absoluteRowIndex:n})}else if(n&&(n.loading||n.error||n.isEmpty)){if(n.loading&&d||n.error&&a||n.isEmpty&&c){const o=x.length,i=[...P,A];x.push({row:{},depth:e+1,displayPosition:S-1,groupingKey:A,position:o,isLastGroupRow:!1,rowId:i,rowPath:i,rowIndexPath:L,stateIndicator:{parentRowId:j,parentRow:t,state:n},absoluteRowIndex:o,parentIndices:[...k,D]})}else if(n.loading&&!d){const t=x.length,n=[...P,A,"loading-skeleton"];x.push({row:{},depth:e+1,displayPosition:S-1,groupingKey:A,position:t,isLastGroupRow:!1,rowId:n,rowPath:n,rowIndexPath:L,isLoadingSkeleton:!0,absoluteRowIndex:t,parentIndices:[...k,D]})}}else if(o.length>0){const t=[...P,A],n=[...L];I(o,e+1,t,n,[...k,D])}}0===e&&C.push(x.length)})};return I(e,0,[],[],[]),C.forEach((t,e)=>{const n=t-1;n>=0&&x.length>n&&(x[n].isLastGroupRow=!0)}),{flattenedRows:x,heightOffsets:R,paginatableRows:y,parentEndPositions:C}}function vn(t){const{contentHeight:e,currentPage:n,customTheme:o,enableStickyParents:i,flattenedRows:s,heightOffsets:r,parentEndPositions:l,rowHeight:d,rowsPerPage:a,scrollDirection:c="none",scrollTop:h,serverSidePagination:u,shouldPaginate:p,rowGrouping:f}=t,w=(t=>Math.ceil(800/(t+1)))(d),v=function(t,e,n,o,i,s){if(!i||s)return t.map((t,e)=>Object.assign(Object.assign({},t),{position:e,absoluteRowIndex:e}));const r=(n-1)*o,l=n*o,d=0===r?0:e[r-1];return t.slice(d,l>e.length?t.length:e[l-1]).map((t,e)=>{const n=t.nestedTable?t.absoluteRowIndex:i&&!s?d+e:e;return Object.assign(Object.assign({},t),{position:e,absoluteRowIndex:n})})}(s,l,n,a,p,u),m=r&&0!==r.length&&p&&!u?(()=>{const t=new Map;return v.forEach(e=>{e.nestedTable&&t.set(e.absoluteRowIndex,e.position)}),r.filter(([e])=>t.has(e)).map(([e,n])=>[t.get(e),n])})():r,g=m&&m.length>0?((t,e,n,o)=>{const i=e+o.rowSeparatorWidth,s=Array(t),r=new Map;n&&n.forEach(([t,e])=>{r.set(t,e)});let l=0;for(let e=0;t>e;e++){s[e]=l,l+=i;const t=r.get(e);void 0!==t&&(l+=t)}return{rowTopPositions:s,totalHeight:l-o.rowSeparatorWidth}})(v.length,d,m,o):void 0;let b,x=0,y=v.length;if(void 0===e)b=v;else{const t=Y({bufferRowCount:w,contentHeight:e,tableRows:v,rowHeight:d,scrollTop:h,scrollDirection:c,heightMap:g});b=t.rendered.rows,x=t.rendered.startIndex,y=t.rendered.endIndex}const{stickyParents:R,regularRows:C,partiallyVisibleRows:S}=i&&void 0!==e?(()=>{const t=Y({bufferRowCount:w,contentHeight:e,tableRows:v,rowHeight:d,scrollTop:h,scrollDirection:c,heightMap:g}),n=f?((t,e,n,o,i)=>{var s,r,l,d,a,c;const h=null!==(r=null===(s=o[0])||void 0===s?void 0:s.position)&&void 0!==r?r:-1,u=null!==(d=null===(l=e[0])||void 0===l?void 0:l.position)&&void 0!==d?d:-1,p=null!==(c=null===(a=e[e.length-1])||void 0===a?void 0:a.position)&&void 0!==c?c:-1,f=`${h}:${u}:${p}:${i.join(",")}`,w=Z.get(f);if(w&&w.firstVisiblePosition===h&&w.renderedStartPosition===u&&w.renderedEndPosition===p)return w.result;const v=tt({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:o,partiallyVisibleRowIndex:0,recursionDepth:0,stickyParents:[],rowGrouping:i});if(Z.set(f,{result:v,firstVisiblePosition:h,renderedStartPosition:u,renderedEndPosition:p}),Z.size>50){const t=Z.keys().next().value;void 0!==t&&Z.delete(t)}return v})(v,t.rendered.rows,t.fullyVisible.rows,t.partiallyVisible.rows,f):{stickyParents:[],regularRows:t.rendered.rows,partiallyVisibleRows:[]};return Object.assign(Object.assign({},n),{partiallyVisibleRows:t.partiallyVisible.rows})})():{stickyParents:[],regularRows:b,partiallyVisibleRows:[]};return{currentTableRows:v,rowsToRender:b,renderedStartIndex:x,renderedEndIndex:y,stickyParents:R,regularRows:C,partiallyVisibleRows:S,paginatedHeightOffsets:m,heightMap:g}}const mn=t=>{var e;const n=document.querySelector(".simple-table-root");if("string"==typeof t){if(t.endsWith("px"))return parseInt(t,10);if(t.endsWith("vh"))return window.innerHeight*parseInt(t,10)/100;if(t.endsWith("%")){const o=null===(e=null==n?void 0:n.parentElement)||void 0===e?void 0:e.clientHeight;return!o||50>o?0:o*parseInt(t,10)/100}return window.innerHeight}return t};class gn{constructor(){this.lastHeadersRef=null,this.lastRowsRef=null,this.flattenedRowsCache=null,this.lastProcessedResult=null,this.tableRenderer=new fn}getCachedFlattenResult(){var t,e;return null!==(e=null===(t=this.flattenedRowsCache)||void 0===t?void 0:t.flattenResult)&&void 0!==e?e:null}getLastProcessedResult(){return this.lastProcessedResult}invalidateCache(t){this.tableRenderer.invalidateCache(t),t&&"all"!==t&&"body"!==t||(this.flattenedRowsCache=null,this.lastProcessedResult=null)}computeEffectiveHeaders(t,e,n,o){var i;let s=[...t];return e.enableRowSelection&&!(null===(i=null==t?void 0:t[0])||void 0===i?void 0:i.isSelectionColumn)&&(s=[{accessor:"__row_selection__",label:"",width:n.selectionColumnWidth,isEditable:!1,type:"boolean",pinned:"left",isSelectionColumn:!0,isSortable:!1,filterable:!1,align:"center"},...s]),null!=o&&o>0?S(s,{containerWidth:o}):S(s)}primeLastProcessedResult(t,e){var n;const o=this.buildRowModelSnapshot(t,e);o&&(this.lastProcessedResult=o.processedResult,null===(n=t.rowSelectionManager)||void 0===n||n.updateConfig({tableRows:o.processedResult.currentTableRows}))}buildRowModelSnapshot(t,e){var n,o,i,s,r,l,d,a,c,h,u,p,w,v;if(this.lastHeadersRef!==t.headers&&(this.invalidateCache("header"),this.invalidateCache("context"),this.lastHeadersRef=t.headers),!t.dimensionManager)return null;const m=t.dimensionManager.getState(),{containerWidth:g,calculatedHeaderHeight:b,maxHeaderDepth:x}=m;let y=this.computeEffectiveHeaders(t.headers,t.config,t.customTheme,g);const{leftWidth:R,rightWidth:C}=xe({headers:y,containerWidth:g,collapsedHeaders:t.collapsedHeaders});t.config.autoExpandColumns&&g>0&&(y=P(y,{autoExpandColumns:!0,containerWidth:g,pinnedLeftWidth:R,pinnedRightWidth:C,mainBodyRef:null!==(n=t.mainBodyRef)&&void 0!==n?n:{current:null},isResizing:null!==(o=t.isResizing)&&void 0!==o&&o}));let S=t.localRows;if(t.sortManager?S=t.sortManager.getSortedRows():t.filterManager&&(S=t.filterManager.getFilteredRows()),this.lastRowsRef!==S&&(this.invalidateCache("body"),this.invalidateCache("context"),this.lastRowsRef=S),t.internalIsLoading&&0===S.length){let n=t.config.shouldPaginate&&null!==(i=t.config.rowsPerPage)&&void 0!==i?i:10;e.isMainSectionScrollable&&(n+=1),S=Array.from({length:n},()=>({}))}const I=null===(s=t.sortManager)||void 0===s?void 0:s.getState(),H=null===(r=t.filterManager)||void 0===r?void 0:r.getState(),M=(null==I?void 0:I.sort)?`${I.sort.key.accessor}-${I.sort.direction}`:"none",k=JSON.stringify((null==H?void 0:H.filters)||{}),E=t.config.quickFilter,O=E?`${null!==(l=E.text)&&void 0!==l?l:""}|${null!==(d=E.mode)&&void 0!==d?d:"simple"}`:"";let T,A,W;this.flattenedRowsCache&&this.flattenedRowsCache.deps.rowsRef===S&&this.flattenedRowsCache.deps.quickFilterKey===O&&this.flattenedRowsCache.deps.expandedRowsSize===t.expandedRows.size&&this.flattenedRowsCache.deps.collapsedRowsSize===t.collapsedRows.size&&this.flattenedRowsCache.deps.expandedDepthsSize===t.expandedDepths.size&&this.flattenedRowsCache.deps.rowStateMapSize===t.rowStateMap.size&&this.flattenedRowsCache.deps.sortKey===M&&this.flattenedRowsCache.deps.filterKey===k&&this.flattenedRowsCache?(T=this.flattenedRowsCache.aggregatedRows,A=this.flattenedRowsCache.quickFilteredRows,W=this.flattenedRowsCache.flattenResult):(T=t.sortManager?S:N({rows:S,headers:t.headers,rowGrouping:t.config.rowGrouping}),A=(({rows:t,headers:e,quickFilter:n})=>{if(!n||!n.text||""===n.text.trim())return t;const{text:o,columns:i,caseSensitive:s=!1,mode:r="simple",useFormattedValue:l=!0}=n,d=e.filter(t=>!t.hide&&!t.excludeFromRender&&(i&&i.length>0?i.includes(t.accessor):!1!==t.quickFilterable)),a="smart"===r?(t=>{const e=[];let n=0;for(;t.length>n;){for(;t.length>n&&/\s/.test(t[n]);)n++;if(n>=t.length)break;if("-"===t[n]){n++;const o=n;for(;t.length>n&&!/\s/.test(t[n]);)n++;const i=t.substring(o,n);i&&e.push({type:"negation",value:i});continue}if('"'===t[n]){n++;const o=n;for(;t.length>n&&'"'!==t[n];)n++;const i=t.substring(o,n);i&&e.push({type:"phrase",value:i}),t.length>n&&'"'===t[n]&&n++;continue}const o=n;for(;t.length>n&&!/[\s:]/.test(t[n]);)n++;const i=t.substring(o,n);if(t.length>n&&":"===t[n]){n++;const o=n;for(;t.length>n&&!/\s/.test(t[n]);)n++;const s=t.substring(o,n);s&&e.push({type:"columnSpecific",value:s,column:i});continue}i&&e.push({type:"word",value:i})}return e})(o):null;return t.filter(t=>{if("smart"===r&&a){const e=new Set,n=new Map;a.forEach((t,e)=>{"columnSpecific"===t.type&&t.column&&(n.has(t.column)||n.set(t.column,[]),n.get(t.column).push(e))});const o=[];d.forEach(i=>{try{let r;if(i.quickFilterGetter)r=i.quickFilterGetter({row:t,accessor:i.accessor});else{const e=f(t,i.accessor);if(l&&i.valueFormatter){const n=i.valueFormatter({accessor:i.accessor,colIndex:0,row:t,rowIndex:0,value:e});r=Array.isArray(n)?n.join(" "):n+""}else r=null==e?"":Array.isArray(e)?e.join(" "):e+""}o.push(r);const d=n.get(i.accessor);d&&d.forEach(t=>{const n=a[t],o=s?r:r.toLowerCase(),i=s?n.value:n.value.toLowerCase();o.includes(i)&&e.add(t)})}catch(t){console.warn(`Quick filter error for column ${i.accessor}:`,t)}});const i=s?o.join(" "):o.join(" ").toLowerCase();return a.forEach((t,n)=>{if("columnSpecific"===t.type)return;const o=s?t.value:t.value.toLowerCase();switch(t.type){case"word":case"phrase":i.includes(o)&&e.add(n);break;case"negation":i.includes(o)||e.add(n)}}),e.size===a.length}return d.some(e=>{try{let n;if(e.quickFilterGetter)n=e.quickFilterGetter({row:t,accessor:e.accessor});else{const o=f(t,e.accessor);if(l&&e.valueFormatter){const i=e.valueFormatter({accessor:e.accessor,colIndex:0,row:t,rowIndex:0,value:o});n=Array.isArray(i)?i.join(" "):i+""}else n=null==o?"":Array.isArray(o)?o.join(" "):o+""}return((t,e,n)=>{if(!e)return!0;const o=n?t:t.toLowerCase(),i=n?e:e.toLowerCase();return o.includes(i)})(n,o,s)}catch(t){return console.warn(`Quick filter error for column ${e.accessor}:`,t),!1}})})})({rows:T,headers:y,quickFilter:t.config.quickFilter}),W=wn({rows:A,rowGrouping:t.config.rowGrouping,getRowId:t.config.getRowId,expandedRows:t.expandedRows,collapsedRows:t.collapsedRows,expandedDepths:t.expandedDepths,rowStateMap:t.rowStateMap,hasLoadingRenderer:!!t.config.loadingStateRenderer,hasErrorRenderer:!!t.config.errorStateRenderer,hasEmptyRenderer:!!t.config.emptyStateRenderer,headers:y,rowHeight:t.customTheme.rowHeight,headerHeight:t.customTheme.headerHeight,customTheme:t.customTheme}),this.flattenedRowsCache={aggregatedRows:T,quickFilteredRows:A,flattenResult:W,deps:{rowsRef:S,quickFilterKey:O,expandedRowsSize:t.expandedRows.size,collapsedRowsSize:t.collapsedRows.size,expandedDepthsSize:t.expandedDepths.size,rowStateMapSize:t.rowStateMap.size,sortKey:M,filterKey:k}});const L=(({height:t,maxHeight:e,rowHeight:n,totalRowCount:o,headerHeight:i,footerHeight:s})=>{if(e){const t=mn(e);if(0===t)return;const r=i||n;if(t>=r+o*n+(s||0)||20>o)return;return Math.max(0,t-r)}if(!t)return;const r=mn(t);return 0!==r?Math.max(0,r-n):void 0})({height:t.config.height,maxHeight:t.config.maxHeight,rowHeight:t.customTheme.rowHeight,shouldPaginate:null!==(a=t.config.shouldPaginate)&&void 0!==a&&a,rowsPerPage:null!==(c=t.config.rowsPerPage)&&void 0!==c?c:10,totalRowCount:null!==(h=t.config.totalRowCount)&&void 0!==h?h:W.paginatableRows.length,headerHeight:b,footerHeight:!t.config.shouldPaginate&&!t.config.footerRenderer||t.config.hideFooter?void 0:t.customTheme.footerHeight});return{dimensionState:m,containerWidth:g,effectiveHeaders:y,calculatedHeaderHeight:b,maxHeaderDepth:x,flattenResult:W,processedResult:vn({flattenedRows:W.flattenedRows,paginatableRows:W.paginatableRows,parentEndPositions:W.parentEndPositions,currentPage:e.currentPage,rowsPerPage:null!==(u=t.config.rowsPerPage)&&void 0!==u?u:10,shouldPaginate:null!==(p=t.config.shouldPaginate)&&void 0!==p&&p,serverSidePagination:null!==(w=t.config.serverSidePagination)&&void 0!==w&&w,contentHeight:L,rowHeight:t.customTheme.rowHeight,scrollTop:e.scrollTop,scrollDirection:e.scrollDirection,heightOffsets:W.heightOffsets,customTheme:t.customTheme,enableStickyParents:null!==(v=t.config.enableStickyParents)&&void 0!==v&&v,rowGrouping:t.config.rowGrouping})}}render(t,n,o,i,s){var r,l,d,a,c,h,u,p,f;const w=null!==(h=null!==(d=null===(l=null===(r=o.mainBodyRef)||void 0===r?void 0:r.current)||void 0===l?void 0:l.scrollLeft)&&void 0!==d?d:null===(c=null===(a=o.mainHeaderRef)||void 0===a?void 0:a.current)||void 0===c?void 0:c.scrollLeft)&&void 0!==h?h:0,v=this.buildRowModelSnapshot(o,i);if(!v)return;const{dimensionState:m,containerWidth:g,effectiveHeaders:b,calculatedHeaderHeight:x,maxHeaderDepth:y,flattenResult:R,processedResult:C}=v;this.lastProcessedResult=C,null===(u=o.rowSelectionManager)||void 0===u||u.updateConfig({tableRows:C.currentTableRows});const{mainWidth:S,leftWidth:I,rightWidth:H,leftContentWidth:M,rightContentWidth:k}=xe({headers:b,containerWidth:g,collapsedHeaders:o.collapsedHeaders}),E=g-I-H,O=t=>"number"==typeof t?t+"px":t,T=t.rootElement.style;if(o.config.maxHeight){const t=O(o.config.maxHeight);T.maxHeight=t,T.height=void 0===m.contentHeight?"auto":t}else T.removeProperty("max-height"),o.config.height?T.height=O(o.config.height):T.removeProperty("height");const{customTheme:A}=o;T.setProperty("--st-main-section-width",E+"px"),T.setProperty("--st-scrollbar-width",i.scrollbarWidth+"px"),T.setProperty("--st-editor-width",(o.config.editColumns?e:0)+"px"),T.setProperty("--st-border-width",A.borderWidth+"px"),T.setProperty("--st-footer-height",A.footerHeight+"px");const W=null!==(p=o.config.columnResizing)&&void 0!==p&&p;t.content.className="st-content "+(W?"st-resizeable":"st-not-resizeable"),t.content.style.width=o.config.editColumns?"calc(100% - 29.5px)":"100%",this.renderHeader(t.headerContainer,x,y,b,o),this.renderBody(t.bodyContainer,C,b,o),this.registerSectionPanes(o);const P=o.sectionScrollController;P&&(P.setSectionScrollLeft("main",w),null!=o.pinnedLeftRef.current&&P.setSectionScrollLeft("pinned-left",o.pinnedLeftRef.current.scrollLeft),null!=o.pinnedRightRef.current&&P.setSectionScrollLeft("pinned-right",o.pinnedRightRef.current.scrollLeft),P.restoreAll()),this.renderFooter(t.footerContainer,null!==(f=o.config.totalRowCount)&&void 0!==f?f:R.paginatableRows.length,i.currentPage,b,o),this.renderColumnEditor(t.contentWrapper,i.columnEditorOpen,s,b,o),this.renderHorizontalScrollbar(t.wrapperContainer,S,I,H,M,k,n.tableBodyContainerRef.current,b,o)}renderHeader(t,e,n,o,i){if(i.config.hideHeader)return;const s=this.buildRendererDeps(o,i);this.tableRenderer.renderHeader(t,e,n,s)}renderBody(t,e,n,o){const i=this.buildRendererDeps(n,o);this.tableRenderer.renderBody(t,e,i)}renderFooter(t,e,n,o,i){const s=this.buildRendererDeps(o,i);this.tableRenderer.renderFooter(t,e,n,t=>{i.setCurrentPage(t),i.onRender()},s)}renderColumnEditor(t,e,n,o,i){const s=this.buildRendererDeps(o,i);this.tableRenderer.renderColumnEditor(t,e,t=>{i.setColumnEditorOpen(t),i.onRender()},n,s)}renderHorizontalScrollbar(t,e,n,o,i,s,r,l,d){if(!d.mainBodyRef.current||!r)return;const a=this.buildRendererDeps(l,d);this.tableRenderer.renderHorizontalScrollbar(t,e,n,o,i,s,r,a)}registerSectionPanes(t){const e=t.sectionScrollController;e&&(t.pinnedLeftHeaderRef.current&&e.registerPane("pinned-left",t.pinnedLeftHeaderRef.current,"header"),t.pinnedLeftRef.current&&e.registerPane("pinned-left",t.pinnedLeftRef.current,"body"),t.mainHeaderRef.current&&e.registerPane("main",t.mainHeaderRef.current,"header"),t.mainBodyRef.current&&e.registerPane("main",t.mainBodyRef.current,"body"),t.pinnedRightHeaderRef.current&&e.registerPane("pinned-right",t.pinnedRightHeaderRef.current,"header"),t.pinnedRightRef.current&&e.registerPane("pinned-right",t.pinnedRightRef.current,"body"))}buildRendererDeps(t,e){return{config:e.config,customTheme:e.customTheme,resolvedIcons:e.resolvedIcons,effectiveHeaders:t,headers:e.headers,localRows:e.localRows,collapsedHeaders:e.collapsedHeaders,collapsedRows:e.collapsedRows,expandedRows:e.expandedRows,expandedDepths:e.expandedDepths,isResizing:e.isResizing,internalIsLoading:e.internalIsLoading,cellRegistry:e.cellRegistry,headerRegistry:e.headerRegistry,draggedHeaderRef:e.draggedHeaderRef,hoveredHeaderRef:e.hoveredHeaderRef,mainBodyRef:e.mainBodyRef,pinnedLeftRef:e.pinnedLeftRef,pinnedRightRef:e.pinnedRightRef,mainHeaderRef:e.mainHeaderRef,pinnedLeftHeaderRef:e.pinnedLeftHeaderRef,pinnedRightHeaderRef:e.pinnedRightHeaderRef,dimensionManager:e.dimensionManager,sectionScrollController:e.sectionScrollController,sortManager:e.sortManager,filterManager:e.filterManager,selectionManager:e.selectionManager,rowSelectionManager:e.rowSelectionManager,rowStateMap:e.rowStateMap,onRender:e.onRender,setIsResizing:e.setIsResizing,setHeaders:e.setHeaders,setCollapsedHeaders:e.setCollapsedHeaders,setCollapsedRows:e.setCollapsedRows,setExpandedRows:e.setExpandedRows,setRowStateMap:e.setRowStateMap,getCollapsedRows:e.getCollapsedRows,getCollapsedHeaders:e.getCollapsedHeaders,getExpandedRows:e.getExpandedRows,getHeaders:e.getHeaders,getRowStateMap:e.getRowStateMap,positionOnlyBody:e.positionOnlyBody,essentialAccessors:e.essentialAccessors}}cleanup(){this.tableRenderer.cleanup()}}const bn=t=>{if(null==t)return"";const e=t+"";return e.includes(",")||e.includes('"')||e.includes("\n")||e.includes("\r")?`"${e.replace(/"/g,'""')}"`:e};class xn{static createAPI(t){const e=()=>{var e;return(null===(e=t.getCachedFlattenResult)||void 0===e?void 0:e.call(t))||wn({rows:t.localRows,rowGrouping:t.config.rowGrouping,getRowId:t.config.getRowId,expandedRows:t.expandedRows,collapsedRows:t.collapsedRows,expandedDepths:t.expandedDepths,rowStateMap:t.rowStateMap,hasLoadingRenderer:!!t.config.loadingStateRenderer,hasErrorRenderer:!!t.config.errorStateRenderer,hasEmptyRenderer:!!t.config.emptyStateRenderer,headers:t.effectiveHeaders,rowHeight:t.customTheme.rowHeight,headerHeight:t.customTheme.headerHeight,customTheme:t.customTheme})},n=new Map;let o=!1;const i=()=>{if(o=!1,0===n.size)return;let e=!1;if(n.forEach((n,o)=>{var i;(null===(i=t.cellRegistry)||void 0===i?void 0:i.get(o))||(e=!0)}),e)return n.clear(),void t.onRender();n.forEach((e,n)=>{t.cellRegistry.get(n).updateContent(e)}),n.clear()};return{updateData:e=>{const{rowIndex:s,accessor:r,newValue:l}=e;if(s>=0&&t.localRows.length>s){t.localRows[s][r]=l;const e=[s],d=`${(t.config.getRowId?[s,t.config.getRowId({row:t.localRows[s],depth:0,index:s,rowPath:e,rowIndexPath:e})]:[s]).join("-")}-${r}`;n.set(d,l),o||(o=!0,queueMicrotask(i))}},setHeaderRename:e=>{const n=t.headerRegistry.get(e.accessor);n&&n.setEditing(!0)},getVisibleRows:()=>{var n;const o=null===(n=t.getCachedProcessedResult)||void 0===n?void 0:n.call(t);return o?o.rowsToRender:e().flattenedRows},getAllRows:()=>e().flattenedRows,getHeaders:()=>t.effectiveHeaders,exportToCSV:n=>{var o;((t,e,n,o=!0)=>{((t,e="table-export.csv")=>{const n=new Blob([t],{type:"text/csv;charset=utf-8;"}),o=document.createElement("a"),i=URL.createObjectURL(n);o.setAttribute("href",i),o.setAttribute("download",e),o.style.visibility="hidden",document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(i)})(((t,e,n=!0)=>{const o=(t=>{const e=[],n=t=>{for(const o of t)o.hide||o.isSelectionColumn||o.excludeFromCsv||(o.children&&o.children.length>0?(o.singleRowChildren&&e.push(o),n(o.children)):e.push(o))};return n(t),e})(e),i=o.map(t=>bn(t.label)).join(","),s=t.map((t,e)=>{const n=t.row;return o.map((t,o)=>{const i=f(n,t.accessor);if(t.exportValueGetter){const s=t.valueFormatter?t.valueFormatter({accessor:t.accessor,colIndex:o,row:n,rowIndex:e,value:i}):void 0,r=t.exportValueGetter({accessor:t.accessor,colIndex:o,row:n,rowIndex:e,value:i,formattedValue:s});return bn(r)}if(!1!==t.useFormattedValueForCSV&&t.valueFormatter){const s=t.valueFormatter({accessor:t.accessor,colIndex:o,row:n,rowIndex:e,value:i});return bn(s)}return bn(i)}).join(",")});return(n?[i,...s]:s).join("\n")})(t,e,o),n)})(e().flattenedRows,t.effectiveHeaders,null==n?void 0:n.filename,null===(o=t.config.includeHeadersInCSVExport)||void 0===o||o)},getSortState:()=>{var e,n;return null!==(n=null===(e=t.sortManager)||void 0===e?void 0:e.getSortColumn())&&void 0!==n?n:null},applySortState:async e=>{t.sortManager&&t.sortManager.updateSort(e)},getPinnedState:()=>Et(t.headers),applyPinnedState:async e=>{const n=Tt(t.headers,e,t.essentialAccessors);n&&(t.setHeaders(n),t.onRender())},resetColumns:()=>{t.setHeaders(vt(t.config.defaultHeaders)),t.onRender()},getFilterState:()=>{var e,n;return null!==(n=null===(e=t.filterManager)||void 0===e?void 0:e.getFilters())&&void 0!==n?n:{}},applyFilter:async e=>{t.filterManager&&t.filterManager.updateFilter(e)},clearFilter:async e=>{t.filterManager&&t.filterManager.clearFilter(e)},clearAllFilters:async()=>{t.filterManager&&t.filterManager.clearAllFilters()},getCurrentPage:()=>t.getCurrentPage(),getTotalPages:()=>{var n,o;const i=null!==(n=t.config.totalRowCount)&&void 0!==n?n:e().paginatableRows.length;return Math.ceil(i/(null!==(o=t.config.rowsPerPage)&&void 0!==o?o:10))},setPage:async n=>{var o,i;const s=null!==(o=t.config.totalRowCount)&&void 0!==o?o:e().paginatableRows.length,r=null!==(i=t.config.rowsPerPage)&&void 0!==i?i:10;1>n||n>Math.ceil(s/r)||(t.setCurrentPage(n),t.onRender(),t.config.onPageChange&&await t.config.onPageChange(n))},expandAll:()=>{var e;null===(e=t.expandedDepthsManager)||void 0===e||e.expandAll()},collapseAll:()=>{var e;null===(e=t.expandedDepthsManager)||void 0===e||e.collapseAll()},expandDepth:e=>{var n;null===(n=t.expandedDepthsManager)||void 0===n||n.expandDepth(e)},collapseDepth:e=>{var n;null===(n=t.expandedDepthsManager)||void 0===n||n.collapseDepth(e)},toggleDepth:e=>{var n;null===(n=t.expandedDepthsManager)||void 0===n||n.toggleDepth(e)},setExpandedDepths:e=>{t.expandedDepths=e,t.onRender()},getExpandedDepths:()=>{var e,n;return null!==(n=null===(e=t.expandedDepthsManager)||void 0===e?void 0:e.getExpandedDepths())&&void 0!==n?n:t.expandedDepths},getGroupingProperty:e=>{var n;return null===(n=t.config.rowGrouping)||void 0===n?void 0:n[e]},getGroupingDepth:e=>{var n,o;return null!==(o=null===(n=t.config.rowGrouping)||void 0===n?void 0:n.indexOf(e))&&void 0!==o?o:-1},toggleColumnEditor:e=>{t.config.editColumns&&(t.setColumnEditorOpen(void 0!==e?e:!t.columnEditorOpen),t.onRender())},applyColumnVisibility:async e=>{const n=o=>o.map(o=>{const i=o.accessor+"";let s=i in e?!e[i]:o.hide;return It(o,t.essentialAccessors)&&(s=!1),Object.assign(Object.assign({},o),{hide:s,children:o.children?n(o.children):o.children})});t.setHeaders(n(t.headers)),t.onRender(),t.config.onColumnVisibilityChange&&t.config.onColumnVisibilityChange(e)},setQuickFilter:e=>{var n;(null===(n=t.config.quickFilter)||void 0===n?void 0:n.onChange)&&t.config.quickFilter.onChange(e)},getSelectedCells:()=>{var e;return(null===(e=t.selectionManager)||void 0===e?void 0:e.getSelectedCells())||new Set},clearSelection:()=>{var e;null===(e=t.selectionManager)||void 0===e||e.clearSelection()},selectCell:e=>{var n;null===(n=t.selectionManager)||void 0===n||n.selectSingleCell(e)},selectCellRange:(e,n)=>{var o;null===(o=t.selectionManager)||void 0===o||o.selectCellRange(e,n)}}}}class yn{constructor(t,e){var n,o;this.draggedHeaderRef={current:null},this.hoveredHeaderRef={current:null},this.localRows=[],this.headers=[],this.essentialAccessors=new Set,this.currentPage=1,this.scrollTop=0,this.scrollDirection="none",this.isResizing=!1,this.isScrolling=!1,this._positionOnlyBody=!1,this.firstRenderDone=!1,this.internalIsLoading=!1,this.scrollbarWidth=0,this.isMainSectionScrollable=!1,this.columnEditorOpen=!1,this.collapsedHeaders=new Set,this.expandedDepths=new Set,this.expandedRows=new Map,this.collapsedRows=new Map,this.rowStateMap=new Map,this.announcement="",this.cellRegistry=new Map,this.headerRegistry=new Map,this.rowIndexMap=new Map,this.autoScaleManager=null,this.dimensionManager=null,this.scrollManager=null,this.sectionScrollController=null,this.sortManager=null,this.filterManager=null,this.selectionManager=null,this.rowSelectionManager=null,this.windowResizeManager=null,this.handleOutsideClickManager=null,this.scrollbarVisibilityManager=null,this.expandedDepthsManager=null,this.ariaAnnouncementManager=null,this.mounted=!1,this.scrollRafId=null,this.scrollEndTimeoutId=null,this.lastScrollTop=0,this.isUpdating=!1,this.container=t,this.config=e,this.customTheme=Wt.mergeCustomTheme(e),this.mergedColumnEditorConfig=Wt.mergeColumnEditorConfig(e),this.resolvedIcons=Wt.resolveIcons(e),this.localRows=[...e.rows],this.headers=[...e.defaultHeaders],this.essentialAccessors=Wt.buildEssentialAccessors(this.headers),this.columnEditorOpen=null!==(n=e.editColumnsInitOpen)&&void 0!==n&&n,this.internalIsLoading=null!==(o=e.isLoading)&&void 0!==o&&o,this.collapsedHeaders=Wt.getInitialCollapsedHeaders(e.defaultHeaders),this.expandedDepths=Wt.getInitialExpandedDepths(e),this.domManager=new Pt,this.renderOrchestrator=new gn,this.rebuildRowIndexMap(),this.initializeManagers()}rebuildRowIndexMap(){this.rowIndexMap.clear(),this.localRows.forEach((t,e)=>{const n=m({row:t,getRowId:this.config.getRowId,depth:0,index:e,rowPath:[e],rowIndexPath:[e]}),o=g(n);this.rowIndexMap.set(o,e)})}initializeManagers(){var t,e,n;this.ariaAnnouncementManager=new ft,this.ariaAnnouncementManager.subscribe(t=>{this.announcement=t,this.updateAriaLiveRegion()}),this.expandedDepthsManager=new pt(null===(t=this.config.expandAll)||void 0===t||t,this.config.rowGrouping),this.expandedDepthsManager.subscribe(t=>{this.expandedDepths=t,this.render("expandedDepthsManager")});const o=t=>{this.ariaAnnouncementManager&&this.ariaAnnouncementManager.announce(t)};this.sortManager=new z({headers:this.headers,tableRows:this.localRows,externalSortHandling:this.config.externalSortHandling||!1,onSortChange:this.config.onSortChange,rowGrouping:this.config.rowGrouping,initialSortColumn:this.config.initialSortColumn,initialSortDirection:this.config.initialSortDirection,announce:o}),this.sortManager.subscribe(t=>{this.render("sortManager")}),this.filterManager=new U({rows:this.localRows,headers:this.headers,externalFilterHandling:this.config.externalFilterHandling||!1,onFilterChange:this.config.onFilterChange,announce:o}),this.filterManager.subscribe(t=>{this.sortManager&&this.sortManager.updateConfig({tableRows:t.filteredRows}),this.render("filterManager")}),this.selectionManager=new rt({selectableCells:null!==(e=this.config.selectableCells)&&void 0!==e&&e,selectableColumns:null!==(n=this.config.selectableColumns)&&void 0!==n&&n,headers:this.headers,tableRows:[],onCellEdit:this.config.onCellEdit,cellRegistry:this.cellRegistry,collapsedHeaders:this.collapsedHeaders,rowHeight:this.customTheme.rowHeight,enableRowSelection:this.config.enableRowSelection,copyHeadersToClipboard:this.config.copyHeadersToClipboard,customTheme:this.customTheme,tableRoot:this.container,onSelectionDragEnd:()=>{this.renderOrchestrator.invalidateCache("context"),this.renderOrchestrator.invalidateCache("body"),this.render("selectionDragEnd")}})}mount(){this.mounted?console.warn("SimpleTableVanilla: Table is already mounted"):(this.domManager.createDOMStructure(this.container,this.config),this.mounted=!0,this.setupManagers())}setupManagers(){var t;const e=this.domManager.getRefs(),n=this.domManager.getElements();if(!e.tableBodyContainerRef.current||!n)return;this.scrollbarWidth=wt(e.tableBodyContainerRef.current);const o=this.renderOrchestrator.computeEffectiveHeaders(this.headers,this.config,this.customTheme);this.dimensionManager=new $({effectiveHeaders:o,headerHeight:this.customTheme.headerHeight,rowHeight:this.customTheme.rowHeight,height:this.config.height,maxHeight:this.config.maxHeight,totalRowCount:this.localRows.length,footerHeight:!this.config.shouldPaginate&&!this.config.footerRenderer||this.config.hideFooter?void 0:this.customTheme.footerHeight,containerElement:e.tableBodyContainerRef.current}),this.dimensionManager.subscribe(()=>{this.render("dimensionManager"),this.firstRenderDone||(this.firstRenderDone=!0,this.config.onGridReady&&this.config.onGridReady())}),this.scrollManager=new D({onLoadMore:this.config.onLoadMore,infiniteScrollThreshold:200}),this.sectionScrollController=new F({onMainSectionScrollLeft:t=>{var e,n;const o=this.domManager.getRefs(),i=o.mainHeaderRef.current,s=o.mainBodyRef.current;null===(e=null==i?void 0:i.__renderHeaderCells)||void 0===e||e.call(i,t),null===(n=null==s?void 0:s.__renderBodyCells)||void 0===n||n.call(s,t)}}),this.config.autoExpandColumns&&(this.autoScaleManager=new L({autoExpandColumns:this.config.autoExpandColumns,containerWidth:this.dimensionManager.getState().containerWidth,pinnedLeftWidth:0,pinnedRightWidth:0,mainBodyRef:e.mainBodyRef,isResizing:this.isResizing},()=>{this.render("autoScaleManager")})),e.headerContainerRef.current&&e.tableBodyContainerRef.current&&(this.scrollbarVisibilityManager=new ht({headerContainer:e.headerContainerRef.current,mainSection:e.tableBodyContainerRef.current,scrollbarWidth:this.scrollbarWidth}),this.scrollbarVisibilityManager.subscribe(t=>{this.isMainSectionScrollable=t,this.render("scrollbarVisibilityManager")})),this.windowResizeManager=new at,this.windowResizeManager.addCallback(()=>{var t;if(e.tableBodyContainerRef.current){const n=wt(e.tableBodyContainerRef.current);this.scrollbarWidth=n,null===(t=this.scrollbarVisibilityManager)||void 0===t||t.setScrollbarWidth(n)}this.render("scrollbarWidth-change")}),this.config.enableRowSelection&&(this.rowSelectionManager=new dt({tableRows:[],onRowSelectionChange:this.config.onRowSelectionChange,enableRowSelection:!0}),this.rowSelectionManager.subscribe(()=>{this.render("rowSelectionManager")})),this.selectionManager&&(this.handleOutsideClickManager=new ct({selectableColumns:null!==(t=this.config.selectableColumns)&&void 0!==t&&t,selectedCells:new Set,selectedColumns:new Set,setSelectedCells:t=>this.selectionManager.setSelectedCells(t),setSelectedColumns:t=>this.selectionManager.setSelectedColumns(t),getSelectedCells:()=>this.selectionManager.getSelectedCells(),getSelectedColumns:()=>this.selectionManager.getSelectedColumns(),onClearSelection:()=>this.selectionManager.clearSelection()}),this.handleOutsideClickManager.startListening()),this.setupEventListeners(),this.dimensionManager&&this.renderOrchestrator.primeLastProcessedResult(this.getRenderContext(),this.getRenderState())}setupEventListeners(){const t=this.domManager.getElements();(null==t?void 0:t.bodyContainer)&&(t.bodyContainer.addEventListener("scroll",this.handleScroll.bind(this)),t.bodyContainer.addEventListener("mouseleave",()=>{this.clearHoveredRows()}))}handleScroll(t){const e=t.currentTarget,n=e.scrollTop;this.isScrolling=!0,null!==this.scrollEndTimeoutId&&clearTimeout(this.scrollEndTimeoutId),this.scrollEndTimeoutId=window.setTimeout(()=>{this.isScrolling=!1,this.scrollEndTimeoutId=null,this.render("scroll-end")},150),null!==this.scrollRafId&&cancelAnimationFrame(this.scrollRafId),this.scrollRafId=requestAnimationFrame(()=>{const t=n>this.lastScrollTop?"down":this.lastScrollTop>n?"up":"none";this.scrollTop=n,this.scrollDirection=t,this.lastScrollTop=n,this.scrollManager&&this.scrollManager.handleScroll(n,e.scrollLeft,e.clientHeight,e.scrollHeight),this.render("scroll-raf"),this.scrollRafId=null})}clearHoveredRows(){document.querySelectorAll(".st-row.hovered").forEach(t=>{t.classList.remove("hovered")})}updateAriaLiveRegion(){const t=this.domManager.getElements();(null==t?void 0:t.ariaLiveRegion)&&(t.ariaLiveRegion.textContent=this.announcement)}getRenderContext(){const t=this.domManager.getRefs();return{config:this.config,customTheme:this.customTheme,resolvedIcons:this.resolvedIcons,effectiveHeaders:[],essentialAccessors:this.essentialAccessors,headers:this.headers,localRows:this.localRows,collapsedHeaders:this.collapsedHeaders,collapsedRows:this.collapsedRows,expandedRows:this.expandedRows,expandedDepths:this.expandedDepths,isResizing:this.isResizing,internalIsLoading:this.internalIsLoading,cellRegistry:this.cellRegistry,headerRegistry:this.headerRegistry,draggedHeaderRef:this.draggedHeaderRef,hoveredHeaderRef:this.hoveredHeaderRef,mainBodyRef:t.mainBodyRef,pinnedLeftRef:t.pinnedLeftRef,pinnedRightRef:t.pinnedRightRef,mainHeaderRef:t.mainHeaderRef,pinnedLeftHeaderRef:t.pinnedLeftHeaderRef,pinnedRightHeaderRef:t.pinnedRightHeaderRef,dimensionManager:this.dimensionManager,scrollManager:this.scrollManager,sectionScrollController:this.sectionScrollController,sortManager:this.sortManager,filterManager:this.filterManager,selectionManager:this.selectionManager,rowSelectionManager:this.rowSelectionManager,rowStateMap:this.rowStateMap,positionOnlyBody:this._positionOnlyBody,onRender:()=>this.render("resizeHandler-onRender"),setIsResizing:t=>{var e,n,o,i,s,r,l,d;if(this.isResizing=t,this.autoScaleManager&&!1===t){const t=this.domManager.getRefs(),a=null!==(d=null!==(r=null!==(o=null===(n=null===(e=t.tableBodyContainerRef)||void 0===e?void 0:e.current)||void 0===n?void 0:n.clientWidth)&&void 0!==o?o:null===(s=null===(i=t.mainBodyRef)||void 0===i?void 0:i.current)||void 0===s?void 0:s.clientWidth)&&void 0!==r?r:null===(l=this.dimensionManager)||void 0===l?void 0:l.getState().containerWidth)&&void 0!==d?d:0;this.autoScaleManager.updateConfig({isResizing:!1,containerWidth:a})}},setHeaders:t=>{this.headers=vt(t),this.renderOrchestrator.invalidateCache("header")},setCollapsedHeaders:t=>{this.collapsedHeaders=t},setCollapsedRows:t=>{this.collapsedRows="function"==typeof t?t(this.collapsedRows):t,this.render("expansion")},setExpandedRows:t=>{this.expandedRows="function"==typeof t?t(this.expandedRows):t,this.render("expansion")},setRowStateMap:t=>{this.rowStateMap="function"==typeof t?t(this.rowStateMap):t,this.render("rowStateMap")},getCollapsedRows:()=>this.collapsedRows,getCollapsedHeaders:()=>this.collapsedHeaders,getExpandedRows:()=>this.expandedRows,getHeaders:()=>this.headers,getRowStateMap:()=>this.rowStateMap,setColumnEditorOpen:t=>{this.columnEditorOpen=t},setCurrentPage:t=>{this.currentPage=t}}}getRenderState(){return{currentPage:this.currentPage,scrollTop:this.scrollTop,scrollDirection:this.scrollDirection,scrollbarWidth:this.scrollbarWidth,isMainSectionScrollable:this.isMainSectionScrollable,columnEditorOpen:this.columnEditorOpen}}render(t){if(!this.mounted)return;if(this.isUpdating&&"update"!==t)return;this._positionOnlyBody="scroll-raf"===t&&!0===this.isScrolling;const e=this.domManager.getElements(),n=this.domManager.getRefs();e&&this.renderOrchestrator.render(e,n,this.getRenderContext(),this.getRenderState(),this.mergedColumnEditorConfig)}update(e){var n,o,i;if(this.isUpdating=!0,this.config=Object.assign(Object.assign({},this.config),e),void 0!==e.rows&&(this.localRows=[...e.rows],this.rebuildRowIndexMap(),this.filterManager&&this.filterManager.updateConfig({rows:this.localRows}),this.sortManager&&this.sortManager.updateConfig({tableRows:this.localRows})),void 0!==e.defaultHeaders&&(this.headers=[...e.defaultHeaders],this.essentialAccessors=Wt.buildEssentialAccessors(this.headers),this.filterManager&&this.filterManager.updateConfig({headers:this.headers}),this.sortManager&&this.sortManager.updateConfig({headers:this.headers}),this.selectionManager&&this.selectionManager.updateConfig({headers:this.headers})),void 0!==e.isLoading&&(this.internalIsLoading=e.isLoading),void 0!==e.theme&&this.domManager.updateTheme(e.theme),void 0!==e.customTheme){const e=this.customTheme;this.customTheme=Wt.mergeCustomTheme(this.config),function(e,n){for(const o of Object.keys(t))if(e[o]!==n[o])return!1;return!0}(e,this.customTheme)||(this.selectionManager&&this.selectionManager.updateConfig({customTheme:this.customTheme,rowHeight:this.customTheme.rowHeight}),null===(n=this.dimensionManager)||void 0===n||n.updateConfig({headerHeight:this.customTheme.headerHeight,rowHeight:this.customTheme.rowHeight,footerHeight:!this.config.shouldPaginate&&!this.config.footerRenderer||this.config.hideFooter?void 0:this.customTheme.footerHeight}),this.config.shouldPaginate&&e.rowHeight!==this.customTheme.rowHeight&&(this.currentPage=1),this.renderOrchestrator.invalidateCache("all"))}void 0===e.selectableColumns&&void 0===e.selectableCells||!this.selectionManager||this.selectionManager.updateConfig({selectableColumns:null!==(o=this.config.selectableColumns)&&void 0!==o&&o,selectableCells:null!==(i=this.config.selectableCells)&&void 0!==i&&i}),this.isUpdating=!1,this.render("update")}updateConfig(t){this.update(t)}destroy(){var t,e,n,o,i,s,r,l,d,a,c,h,u;this.mounted=!1,this.firstRenderDone=!1,null!==this.scrollRafId&&(cancelAnimationFrame(this.scrollRafId),this.scrollRafId=null),null!==this.scrollEndTimeoutId&&(clearTimeout(this.scrollEndTimeoutId),this.scrollEndTimeoutId=null),null===(t=this.dimensionManager)||void 0===t||t.destroy(),null===(e=this.scrollManager)||void 0===e||e.destroy(),null===(n=this.sectionScrollController)||void 0===n||n.destroy(),null===(o=this.sortManager)||void 0===o||o.destroy(),null===(i=this.filterManager)||void 0===i||i.destroy(),null===(s=this.rowSelectionManager)||void 0===s||s.destroy(),null===(r=this.selectionManager)||void 0===r||r.destroy(),null===(l=this.autoScaleManager)||void 0===l||l.destroy(),null===(d=this.windowResizeManager)||void 0===d||d.destroy(),null===(a=this.handleOutsideClickManager)||void 0===a||a.destroy(),null===(c=this.scrollbarVisibilityManager)||void 0===c||c.destroy(),null===(h=this.expandedDepthsManager)||void 0===h||h.destroy(),null===(u=this.ariaAnnouncementManager)||void 0===u||u.destroy(),this.renderOrchestrator.cleanup(),this.domManager.destroy(this.container)}getAPI(){const t=this.renderOrchestrator.computeEffectiveHeaders(this.headers,this.config,this.customTheme),e=this;return xn.createAPI({config:this.config,localRows:this.localRows,effectiveHeaders:t,get headers(){return e.headers},essentialAccessors:this.essentialAccessors,customTheme:this.customTheme,currentPage:this.currentPage,getCurrentPage:()=>this.currentPage,expandedRows:this.expandedRows,collapsedRows:this.collapsedRows,expandedDepths:this.expandedDepths,rowStateMap:this.rowStateMap,headerRegistry:this.headerRegistry,cellRegistry:this.cellRegistry,columnEditorOpen:this.columnEditorOpen,getCachedFlattenResult:()=>this.renderOrchestrator.getCachedFlattenResult(),getCachedProcessedResult:()=>this.renderOrchestrator.getLastProcessedResult(),expandedDepthsManager:this.expandedDepthsManager,selectionManager:this.selectionManager,sortManager:this.sortManager,filterManager:this.filterManager,onRender:()=>this.render("columnEditor-onRender"),setHeaders:t=>{this.headers=vt(t),this.renderOrchestrator.invalidateCache("header")},setCurrentPage:t=>{this.currentPage=t},setColumnEditorOpen:t=>{this.columnEditorOpen=t,this.render("columnEditor-toggle")}})}}exports.SimpleTableVanilla=yn,exports.asRows=function(t){return t};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|