simple-table-core 3.0.6 → 3.0.7
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
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=t=>Math.ceil(800/(t+1)),n=29.5,o=150,i=["lineAreaChart","barChart"],s=40,r=(t,e,n)=>e&&n?480>t?.25:768>t?.3:.4:(t=>480>t?.4:768>t?.5:.6)(t),l="parentExpanded",d=(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},a=t=>t.flatMap(t=>{const e=[t];return t.children&&t.children.length>0&&e.push(...a(t.children)),e}),c=(t=0)=>t?t+1:0,h=t=>{var e;return!(!(null===(e=t.children)||void 0===e?void 0:e.length)||!t.collapsible)},u=({accessor:t,rowId:e})=>`${e}-${t}`,p=({calculatedHeight:t,customHeight:e,customTheme:n})=>e?("string"==typeof e?parseFloat(e):e)+n.nestedGridPaddingTop+n.nestedGridPaddingBottom:t,f=t=>{const e=t.match(/^(.+?)\[(\d+)\]$/);return e?{key:e[1],index:parseInt(e[2],10)}:{key:t,index:null}},w=(t,e)=>{const n=e+"";return n.includes(".")||n.includes("[")?n.split(".").reduce((t,e)=>{if(null==t)return;const{key:n,index:o}=f(e);let i=t[n];return null!==o&&Array.isArray(i)&&(i=i[o]),i},t):t[e]},v=(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}=f(i[t]);if(null==s[e]){const n=f(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}=f(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},m=t=>Array.isArray(t)&&t.length>0&&"object"==typeof t[0]&&null!==t[0],g=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},b=t=>t.join("-"),x=(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},y=(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||l;return"parentCollapsed"===e||"always"===e});return t.singleRowChildren?0===n.length?[t]:[t,...n.flatMap(t=>y(t,e))]:0===n.length?[t]:n.flatMap(t=>y(t,e))}const n=t.children.filter(t=>{const e=t.showWhen||l;return"parentExpanded"===e||"always"===e});return t.singleRowChildren?[t,...n.flatMap(t=>y(t,e))]:n.flatMap(t=>y(t,e))};function R(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 C(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 S(t,e){const n=t.map(t=>R(t)),i=n.reduce((t,e)=>"px"===(null==e?void 0:e.type)?t+e.value:t,0),s=n.reduce((t,e)=>"pct"===(null==e?void 0:e.type)?t+e.value:t,0),r=e*(s/100),l=n.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=n[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:o);else a.set(t.accessor,o)}),a}function I(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=C(t);o=S(e,n)}else{const e=C(t),n=e.map(t=>R(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=S(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 H=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(u({accessor:t.accessor,rowId:"header"}));return(null==e?void 0:e.offsetWidth)||o}},M=t=>{var e;const n=t.width;"string"==typeof n&&n.includes("fr")&&(t.width=(null===(e=document.getElementById(u({accessor:t.accessor,rowId:"header"})))||void 0===e?void 0:e.offsetWidth)||o),t.children&&t.children.length>0&&t.children.forEach(t=>{M(t)})},k=t=>"number"==typeof t.minWidth?t.minWidth:s,E=(t,e)=>{const n=[];return t.forEach(t=>{t.hide||n.push(...y(t,e))}),n},O=(t,e)=>{const{rows:n,header:r,maxWidth:l=500,sampleSize:d=50,styleRoot:a}=e||{},c=null!=a?a:document,h=document.getElementById(u({accessor:t,rowId:"header"}));if(!h)return o;const p=window.getComputedStyle(h),f=parseFloat(p.paddingLeft)||0,v=parseFloat(p.paddingRight)||0,m=parseFloat(p.gap)||0;let g=f+v;const b=h.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(h.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&&i.includes(r.type);if(n&&n.length>0&&!C){const e=Math.min(n.length,d),o=document.createElement("div");o.style.visibility="hidden",o.style.position="absolute",o.style.whiteSpace="nowrap",o.style.width="auto";let i=0,s=0;const l=c.querySelector(".st-cell-content");if(l){const t=window.getComputedStyle(l);o.style.font=t.font,o.style.fontSize=t.fontSize,o.style.fontFamily=t.fontFamily,i=parseFloat(t.paddingLeft)||0,s=parseFloat(t.paddingRight)||0}document.body.appendChild(o);for(let l=0;e>l;l++){const e=n[l];let d;d=(null==r?void 0:r.valueGetter)?r.valueGetter({accessor:t,row:e,rowIndex:l}):w(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})),o.textContent=null!=a?a+"":"";const c=o.offsetWidth+i+s;c>R&&(R=c)}document.body.removeChild(o)}let S=Math.max(g,R);return C&&(S=Math.max(S,150)),S>l&&(S=l),Math.max(S+2,s)};class T{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 A=(t,e)=>{const n=[];return t.forEach(t=>{t.hide||(t.children&&t.children.length>0?n.push(...A(t.children,null!=e?e:t.pinned)):n.push(t))}),n},W=(t,e)=>e>=t.reduce((t,e)=>t+k(e),0),P=(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},$=(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=A(d,"left"),u=A(a,"right"),p=A(c,void 0),f=h.length>0&&W(h,i),w=u.length>0&&W(u,s),v=p.length>0&&l>0&&W(p,l),m=new Map;if(f&&P(h,i).forEach((t,e)=>m.set(e,t)),w&&P(u,s).forEach((t,e)=>m.set(e,t)),v&&P(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 T(null!==(n=t.isResizing)&&void 0!==n&&n),this.containerWidthTracker=new T(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 $(t,this.config)}setHeaders(t,e){const n="function"==typeof t?t(e):t;return this.applyAutoScale(n)}destroy(){this.onHeadersUpdate=()=>{}}}class D{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 F{constructor(t){this.subscribers=new Set,this.lastScrollTop=0,this.scrollTimeoutId=null,this.notifySubscribersRafId=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(){0!==this.subscribers.size&&this.subscribers.forEach(t=>t(this.state))}scheduleNotifySubscribersFromScroll(){0!==this.subscribers.size&&null===this.notifySubscribersRafId&&(this.notifySubscribersRafId=requestAnimationFrame(()=>{this.notifySubscribersRafId=null,this.notifySubscribers()}))}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.scheduleNotifySubscribersFromScroll()},150),this.config.onLoadMore&&this.config.infiniteScrollThreshold&&this.config.infiniteScrollThreshold>o-(t+n)&&this.config.onLoadMore(),this.scheduleNotifySubscribersFromScroll()}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),null!==this.notifySubscribersRafId&&(cancelAnimationFrame(this.notifySubscribersRafId),this.notifySubscribersRafId=null),this.subscribers.clear()}}class j{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 B={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)=>B.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?B.string(t,e,n):"number"==typeof t&&"number"==typeof e?B.number(t,e,n):"boolean"==typeof t&&"boolean"==typeof e?B.boolean(t,e,n):B.string(t+"",e+"",n)},N=({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=w(e,l),d=w(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 B.number(i,s,o)}return"date"===n?B.date(t+"",e+"",o):"boolean"===n?B.boolean(!!t,!!e,o):"enum"===n?B.enum(t+"",e+"",o):B.string(t+"",e+"",o)})(o,d,s,r)})})({rows:e,sortColumn:n,headers:t}),z=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=>a(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&&m(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&&m(n))s(n);else{const n=w(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&&v(d,t.accessor,e)}),d}return t});return l(r)};class q{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=a(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=N({headers:e,rows:n,sortColumn:o});return t&&0!==t.length?i.map(n=>{const i=t[0],s=n[i];if(m(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=z({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}):N({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 G=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),U=t=>{if(!t)return new Date;if("string"==typeof t)return G(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 K{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=a(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=U(t),s=U((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(U((t||"")+"")));return r>=t&&e>=r}return!1;case"notBetween":if(i&&2===i.length){const[t,e]=i.map(t=>V(U((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}})(w(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 J=(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},Y=(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},_=({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=J(Math.max(0,o-c),r);let f=J(u,r)+1;f=Math.min(i.length,f);const w=o,v=o+e;let m=J(w,r);w>d[m]&&(m=Math.min(m+1,i.length));let g=J(v,r);g=Math.min(i.length,g);const b=o+e,x=J(o,r);let y=J(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)}}},X=({position:t,rowHeight:e,heightOffsets:n,customTheme:o})=>t*(e+o.rowSeparatorWidth)-o.rowSeparatorWidth+Y(t,n),Q=({position:t,rowHeight:e,heightOffsets:n,customTheme:o})=>t*(e+o.rowSeparatorWidth)+Y(t,n),Z=(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},tt=new Map,et=(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=tt.get(f);if(w&&w.firstVisiblePosition===h&&w.renderedStartPosition===u&&w.renderedEndPosition===p)return w.result;const v=nt({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:o,partiallyVisibleRowIndex:0,recursionDepth:0,stickyParents:[],rowGrouping:i});if(tt.set(f,{result:v,firstVisiblePosition:h,renderedStartPosition:u,renderedEndPosition:p}),tt.size>50){const t=tt.keys().next().value;void 0!==t&&tt.delete(t)}return v},nt=({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=>b(t.rowId)===b(o.rowId))||(r.push(o),a++)}}if(r.length>0){Z(d,t)&&(r.push(d),a++);const e=o[i+=a];e&&(d=e)}}else if(Z(d,t))return r.push(d),i++,nt({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:o,partiallyVisibleRowIndex:i,recursionDepth:s+1,stickyParents:r,rowGrouping:l});return Z(d,t)?nt({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:o,partiallyVisibleRowIndex:i,recursionDepth:s+1,stickyParents:r,rowGrouping:l}):{stickyParents:r,regularRows:e}},ot=(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)}},it=(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=>b(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=_({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 ot(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&&ot(e,i,s)},100);ot(a,i,s)},st=({rowIndex:t,colIndex:e,rowId:n})=>`${t}-${e}-${n}`;function rt(t,e,n,o){const i=new Set,s=new Map;n.forEach((t,e)=>{const n=b(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=b(n[t].rowId);i.add(st({colIndex:e,rowIndex:t,rowId:s}))}return i}function lt(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 dt{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=>y(t,this.config.collapsedHeaders)),this.rowIdToTableIndex.clear(),this.config.tableRows.forEach((t,e)=>{this.rowIdToTableIndex.set(b(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(b(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(`${b(e.rowId)}\t${t}`),this.rowsWithSelectedCells.add(b(e.rowId))})})}updateRowIdAndSelectionLookupOnly(){this.rowIdToTableIndex.clear(),this.config.tableRows.forEach((t,e)=>{this.rowIdToTableIndex.set(b(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(`${b(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?b(i.rowId):null)!==o){const t=this.config.tableRows.findIndex(t=>b(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=b(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=b(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=b(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=b(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=b(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=b(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=b(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=b(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=b(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=b(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=b(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=b(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=b(this.config.tableRows[o].rowId);this.selectCellRange(this.startCell,{rowIndex:o,colIndex:n,rowId:t})}else{const t=b(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=b(this.config.tableRows[o].rowId);this.selectCellRange(this.startCell,{rowIndex:o,colIndex:n,rowId:t})}else{const t=b(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=w(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=>b(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],w=b(p.rowId);if(!(null==f?void 0:f.isEditable))return void l.add(`${d}-${c}-${w}`);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(v(p.row,f.accessor,m),s){const t=s.get(`${w}-${f.accessor}`);t&&t.updateContent(m)}null==i||i({accessor:f.accessor,newValue:m,row:p.row,rowIndex:d}),r.add(`${d}-${c}-${w}`)})}),{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=b(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(w(a.row,c.accessor))?[]:""),v(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=b(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=st({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 a(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 l=n.get(i);if(!l)continue;if(l.isSelectionColumn&&this.config.enableRowSelection){for(const t of dt.HEADER_SELECTION_CLASSES)o.classList.remove(t);continue}const a=d(l,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 dt.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 dt.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 dt.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 dt.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=st({rowIndex:i,colIndex:t,rowId:o});if(this.selectedCells.has(e))return!0}const s=st({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?b(r.rowId):null,d=this.config.tableRows[i+1],a=d?b(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=st({colIndex:t,rowIndex:e,rowId:n});return this.copyFlashCells.has(o)}isWarningFlashing({colIndex:t,rowIndex:e,rowId:n}){const o=st({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=st(t);this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.selectedCells=new Set([e]),this.initialFocusedCell=t,this.updateDerivedState(),this.updateAllCellClasses(),setTimeout(()=>it(t,this.config.rowHeight,this.config.customTheme,this.config.tableRows),0)}}selectCellRange(t,e){this.fullTableSelected=!1;const n=rt(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(()=>it(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=rt(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 lt(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 lt(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=st({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})}}dt.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"],dt.HEADER_SELECTION_CLASSES=["st-header-selected","st-header-has-highlighted-cell"];const at=(t,e)=>t.filter(t=>!(!t||!t.rowId)&&e.has(b(t.rowId))).map(t=>t.row);class ct{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:at(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(b(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=>b(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=>b(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=>b(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=>b(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 ht{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 ut{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 pt{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 ft=(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 wt{constructor(t,e){this.observers=new Set,this.expandedDepths=ft(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 vt{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 mt(t){return t?t.offsetWidth-t.clientWidth:0}const gt=t=>{if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map(gt);const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=gt(t[n]));return e},bt=(t,e)=>t.filter(t=>t.pinned===e).some(t=>!t.hide&&!t.excludeFromRender),xt=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},yt=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},Rt=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},Ct=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},St=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},It=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 Ht(t){return{pinnedLeft:t.filter(t=>"left"===t.pinned),unpinned:t.filter(t=>!t.pinned),pinnedRight:t.filter(t=>"right"===t.pinned)}}function Mt(t,e){return!0===t.isEssential||e.has(t.accessor+"")}function kt(t,e){let n=!1;for(const o of t){if(o.isSelectionColumn||o.excludeFromRender)continue;const t=Mt(o,e);if(t&&n)return!1;t||(n=!0)}return!0}function Et(t,e){var n;const{pinnedLeft:o,unpinned:i,pinnedRight:s}=Ht(t);if(!kt(o,e))return!1;if(!kt(i,e))return!1;if(!kt(s,e))return!1;for(const o of t)if((null===(n=o.children)||void 0===n?void 0:n.length)&&!Ot(o.children,e))return!1;return!0}function Ot(t,e){var n;if(!kt(t,e))return!1;for(const o of t)if((null===(n=o.children)||void 0===n?void 0:n.length)&&!Ot(o.children,e))return!1;return!0}function Tt(t){const{pinnedLeft:e,unpinned:n,pinnedRight:o}=Ht(t);return{left:e.map(t=>t.accessor),main:n.map(t=>t.accessor),right:o.map(t=>t.accessor)}}function At(t,e,n){return[...t.filter(t=>Mt(e.get(t+""),n)),...t.filter(t=>!Mt(e.get(t+""),n))]}function Wt(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=At(e.left,s,n),l=At(e.main,s,n),d=At(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 Pt(t,e,n,o){const i=e+"",s=Tt(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&&(!Mt(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),Wt(t,{left:r,main:l,right:d},o)):null}class $t{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:St("st-drag-icon"),expand:yt("st-expand-icon"),filter:It("st-header-icon"),headerCollapse:yt("st-header-icon"),headerExpand:xt("st-header-icon"),next:yt("st-next-prev-icon"),prev:xt("st-next-prev-icon"),sortDown:Ct("st-header-icon"),sortUp:Rt("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 ft(null===(e=t.expandAll)||void 0===e||e,t.rowGrouping)}}class Lt{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 Dt=new WeakMap;let Ft=0,jt=Date.now(),Bt={screenX:0,screenY:0},Nt=null;const zt=t=>{jt=t},qt=new WeakMap,Gt=t=>(qt.has(t)||qt.set(t,new Map),qt.get(t)),Vt=new WeakMap,Ut=t=>(Vt.has(t)||Vt.set(t,new Map),Vt.get(t)),Kt=(t,e)=>{const n=Date.now();0!==Ft&&e>n-Ft||(Ft=n,t())},Jt=(t,e,n,o)=>{t.addEventListener(e,n,o),Dt.has(t)||Dt.set(t,[]),Dt.get(t).push({event:e,handler:n,options:o})},Yt=t=>{const e=t.closest(".simple-table-root");null==e||e.querySelectorAll(".st-tooltip").forEach(t=>t.remove())},_t=t=>{if(Ft=0,t){const e=Gt(t);e.forEach(t=>{t.remove()}),e.clear(),Ut(t).clear(),Yt(t)}},Xt={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"},Qt=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"]}},Zt=t=>!["between","notBetween","in","notIn","isEmpty","isNotEmpty"].includes(t),te=t=>["between","notBetween","in","notIn"].includes(t),ee=t=>["isEmpty","isNotEmpty"].includes(t),ne=t=>{var e;return null!==(e=null==t?void 0:t.closest(".simple-table-root"))&&void 0!==e?e:null},oe=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=ne(g))&&void 0!==e?e:ne(null!=r?r:null))&&void 0!==n?n:ne(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}},ie=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=oe({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}},se=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()}}},re=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()}}},le=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()}}},de=()=>{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},ae=(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(de()))},ce=({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(de());const r=()=>{const t=i.checked;i.setAttribute("aria-checked",""+t),t?(s.classList.add("st-checked"),s.appendChild(de())):(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(de())):(s.classList.remove("st-checked"),s.innerHTML=""))},destroy:()=>{i.removeEventListener("change",r)}}},he=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=Qt("string"),c=document.createElement("div");c.className="st-filter-container";const h=document.createElement("div");h.className="st-filter-section";const u=ie({value:l,onChange:t=>{l=t,g()},options:a.map(t=>({value:t,label:Xt[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},Zt(l)&&{value:d});o(t)},m=()=>ee(l)||""!==d.trim(),g=()=>{p&&(p.remove(),p=null),f&&(f.destroy(),f=null),Zt(l)&&(p=document.createElement("div"),p.className="st-filter-section",f=se({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=re({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=Qt("number"),f=document.createElement("div");f.className="st-filter-container";const w=document.createElement("div");w.className="st-filter-section";const v=ie({value:a,onChange:t=>{a=t,S()},options:p.map(t=>({value:t,label:Xt[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};Zt(a)?t.value=parseFloat(c):te(a)&&(t.values=[parseFloat(h),parseFloat(u)]),s(t)},C=()=>!!ee(a)||(Zt(a)?""!==c.trim():!!te(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),Zt(a)?(m=document.createElement("div"),m.className="st-filter-section",g=se({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)):te(a)&&(m=document.createElement("div"),m.className="st-filter-section",b=se({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=se({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=re({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=Qt("boolean"),c=document.createElement("div");c.className="st-filter-container";const h=document.createElement("div");h.className="st-filter-section";const u=ie({value:l,onChange:t=>{l=t,g()},options:a.map(t=>({value:t,label:Xt[t]})),containerRef:s,mainBodyRef:r});h.appendChild(u.element),c.appendChild(h);let p=null,f=null,w=null;const v=()=>ee(l)||""!==d,m=[{value:"true",label:"True"},{value:"false",label:"False"}],g=()=>{p&&(p.remove(),p=null),f&&(f.destroy(),f=null),Zt(l)&&(p=document.createElement("div"),p.className="st-filter-section",f=ie({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=re({onApply:()=>{const t={accessor:e.accessor,operator:l};Zt(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=Qt("date"),f=document.createElement("div");f.className="st-filter-container";const w=document.createElement("div");w.className="st-filter-section";const v=ie({value:a,onChange:t=>{a=t,T()},options:p.map(t=>({value:t,label:Xt[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=()=>!!ee(a)||(Zt(a)?""!==c.trim():!!te(a)&&""!==h.trim()&&""!==u.trim()),E=t=>{if(!t)return"";const e=U(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?U(t):new Date,c=le({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=oe({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),Zt(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(te(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=re({onApply:()=>{const t={accessor:o.accessor,operator:a};Zt(a)?t.value=c:te(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=ce({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=se({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=ce({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=re({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)}},ue=new WeakMap,pe=(t,e,n,o)=>{t.addEventListener(e,n,o),ue.has(t)||ue.set(t,[]),ue.get(t).push({event:e,handler:n,options:o})},fe=new WeakMap,we=t=>(fe.has(t)||fe.set(t,new Map),fe.get(t)),ve=(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+"")})})},me=(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=me(i.children,e,[...n,o]);if(t)return t}}return null},ge=t=>"left"===t.pinned?"left":"right"===t.pinned?"right":"main";function be(t,e,n){const o=gt(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 xe=(t,e)=>{const{mainBodyWidth:o,pinnedLeftWidth:i,pinnedRightWidth:s,pinnedLeftContentWidth:r,pinnedRightContentWidth:l,tableBodyContainerRef:d,editColumns:a}=e,c=a?n: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")}},ye=(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()},Re=({headers:t,containerWidth:e,collapsedHeaders:n})=>{let o=0,i=0,s=0;t.forEach(t=>{if(t.hide)return;const e=y(t,n).reduce((t,e)=>t+H(e),0);"left"===t.pinned?o+=e:"right"===t.pinned?i+=e:s+=e});const l=o,d=i;if(e&&e>0){const t=e*r(e,o>0,i>0);o>t&&(o=t),i>t&&(i=t)}return{leftWidth:c(o),rightWidth:c(i),mainWidth:s,leftContentWidth:l,rightContentWidth:d}},Ce=(t,e)=>{if(t.pinned)return t.pinned;const n=((t,e)=>{const n=a(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?Ce(n,e):void 0},Se=(t,e,n)=>{var o;const i=[],s=[],r=[];t.forEach(e=>{if(e.hide)return;const n=Ce(e,t);"left"===n?i.push(e):"right"===n?r.push(e):s.push(e)});const d=(t,o,i)=>{var s,r;const a=o;if(t.children&&t.children.length>0){const r=null==e?void 0:e.has(t.accessor),c=t.children.filter(t=>{if(t.hide)return!1;const e=t.showWhen||l;return r?"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:H(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!==(r=null==n?void 0:n.get(t.accessor))&&void 0!==r?r:"number"==typeof t.width?t.width:H(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),h=a(s),p=a(r),f=new Map;c.forEach((t,e)=>f.set(e,t)),h.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=u({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=Re({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"),I=null==C?void 0:C.querySelector(".st-body-main"),M=!!(null==C?void 0:C.querySelector(".st-column-editor"));S&&I&&w&&I.scrollWidth-I.clientWidth>1&&xe(S,{mainBodyRef:I,mainBodyWidth:x,pinnedLeftWidth:g,pinnedRightWidth:b,pinnedLeftContentWidth:y,pinnedRightContentWidth:R,tableBodyContainerRef:w,editColumns:M})},Ie=({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=s,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=o;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}),o-=e}}},He=({childrenToResize:t=[],collapsedHeaders:e,containerWidth:n,delta:o,headers:i,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*r(t,e,n))(n,i.some(t=>"left"===t.pinned&&!t.hide),i.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=E(u,e),i=n.findIndex(e=>e.accessor===t[0].accessor),r=n.findIndex(e=>e.accessor===t[t.length-1].accessor);if(-1===i||-1===r)return;const d=0===i,a=r===n.length-1;let w;w="left"===h&&a||"right"===h&&d?[]:d?n.slice(r+1):a||c?n.slice(0,i):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-s)},0);e=Math.min(o,t)}const i=(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*i,40)}),n&&e>0&&w.length>0&&Ie({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,s*t.length),i=n/e;t.forEach(t=>{const e=l.get(t.accessor)||100;t.width=Math.max(e*i,40)});const r=f-n;r>0&&w.length>0&&Ie({columnsToShrink:w,totalCompensation:-r,initialWidthsMap:l})}return}const v=E(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,s));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-s)},0),e=Math.min(o,t);a.width=f+e,e>0&&Ie({columnsToShrink:x,totalCompensation:e,initialWidthsMap:l})}else{const t=Math.max(f+o,40),e=f-t;a.width=t,e>0&&Ie({columnsToShrink:x,totalCompensation:-e,initialWidthsMap:l})}},Me=(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},ke=({autoExpandColumns:t,collapsedHeaders:e,containerWidth:n,event:o,header:i,headers:s,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=Me(n,l);h(!0);const v=Ce(i,s),m=k(i);let g;if(i.children&&i.children.length>0){const t=y(i,e);g=t.length>0?t:[i]}else g=[i];const b=new Map;let x=0,R=0;if(t){const t=s.filter(t=>t.pinned===v);if(E(t,e).forEach(t=>{const e=H(t);b.set(t.accessor,e)}),w>0){const{leftWidth:t,rightWidth:n,mainWidth:o}=Re({headers:s,containerWidth:w,collapsedHeaders:e});x="left"===v?t:"right"===v?n:o,R=w-t-n}}let C=!1;const S=new Map;let I=[];if(t&&v&&w>0){const t=E(s.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=s.filter(t=>!t.pinned);I=E(t,e),I.forEach(t=>{S.set(t.accessor,H(t))})}}}const O=(n,o=!1)=>{const l="right"===v?p-n:n-p;if(t){const t=s.filter(t=>t.pinned===v);if(He({childrenToResize:g,collapsedHeaders:e,containerWidth:w,delta:l,headers:s,initialWidthsMap:b,isParentResize:g.length>1,resizedHeader:g.length>0?g[g.length-1]:i,reverse:a,rootPinned:v,sectionHeaders:t,sectionWidth:x,startWidth:u}),C&&I.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;I.forEach((n,i)=>{const s=S.get(n.accessor)||100;i===I.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 s=e.some(t=>"left"===t.pinned&&!t.hide),l=e.some(t=>"right"===t.pinned&&!t.hide),d=i*r(i,s,l)-e.filter(e=>e.pinned===t.pinned&&e.accessor!==t.accessor).reduce((t,e)=>e.hide?t:t+y(e,n).reduce((t,e)=>t+H(e),0),0),a=k(t);return a>d?(console.warn(`Header ${t.accessor} exceeds pinned section width limit`),a):d})({header:i,headers:s,collapsedHeaders:e});g.length>1?(({delta:t,leafHeaders:e,minWidth:n,startWidth:o,maxWidth:i})=>{const s=e.reduce((t,e)=>Math.min(t,k(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),s.forEach(t=>{M(t)})}if(o){const t=[...s];c(t);const n=new Map;g.forEach(t=>{"number"==typeof t.width&&n.set(t.accessor,t.width)}),C&&I.forEach(t=>{"number"==typeof t.width&&n.set(t.accessor,t.width)}),Se(s,e,n)}else Se(s,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([...s])};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([...s])};document.addEventListener("mousemove",t),document.addEventListener("mouseup",e)}},Ee=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},Oe=(t,e,n)=>{const{columnResizing:i}=e;if(!i||t.isSelectionColumn&&e.enableRowSelection||n)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:Ee(e)});let d=0;const a=()=>{const n=Date.now();120>n-d||(d=n,(()=>{const n=document.getElementById(u({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=Me(o,i),c=Ce(t,e);let h;if(t.children&&t.children.length>0){const e=y(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(E(w,n).forEach(t=>{const e=H(t);u.set(t.accessor,e)}),a>0){const{leftWidth:t,rightWidth:o,mainWidth:i}=Re({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=E(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=E(t,n),g.forEach(t=>{m.set(t.accessor,H(t))})}}}const b=h.reduce((t,e)=>t+l(e),0),x=null!==(d=null==r?void 0:r.offsetWidth)&&void 0!==d?d:h.reduce((t,e)=>t+H(e),0);if(He({childrenToResize:h,collapsedHeaders:n,containerWidth:a,delta:b-x,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:x}),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)}),Se(e,n,R)})({header:t,headers:e.headers,collapsedHeaders:e.collapsedHeaders,containerWidth:e.containerWidth,mainBodyRef:e.mainBodyRef,reverse:e.reverse,headerCellElement:n,getTargetLeafWidth:t=>O(t.accessor,l(t))});const o=[...e.headers];return e.setHeaders(o),void(e.onColumnWidthChange&&e.onColumnWidthChange(o))}const o=O(t.accessor,l(t)),i=me(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=>M(t));const c=d[r],h=new Map;c&&"number"==typeof c.width&&h.set(c.accessor+"",c.width),Se(a,e.collapsedHeaders,h),e.setHeaders(a),e.onColumnWidthChange&&e.onColumnWidthChange(a)})())};return Jt(s,"mousedown",n=>{var i;if(n.detail>=2)return n.preventDefault(),void a();const s=null===(i=document.getElementById(u({accessor:t.accessor,rowId:"header"})))||void 0===i?void 0:i.offsetWidth;Kt(()=>{ke({autoExpandColumns:e.autoExpandColumns,collapsedHeaders:e.collapsedHeaders,containerWidth:e.containerWidth,event:n,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:o})},10)}),Jt(s,"touchstart",n=>{var i;const s=n,r=null===(i=document.getElementById(u({accessor:t.accessor,rowId:"header"})))||void 0===i?void 0:i.offsetWidth;Kt(()=>{ke({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:o})},10)}),Jt(s,"dblclick",a),s},Te=(t,e,n)=>{const o=document.createElement("input");return o.type="text",o.className="st-header-edit-input",o.value=t.label||"",Jt(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=Ae(t,e,i);s.replaceChild(o,n)}if(e.headerRegistry&&!t.isSelectionColumn){const n=e.headerRegistry.get(t.accessor+"");n&&n.setEditing(!1)}}),Jt(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},Ae=(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 ce({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)};Jt(s,"mouseenter",o),Jt(s,"mouseleave",i)}return s},We=(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"),Jt(t,"dragstart",t=>{s.current=n,zt(Date.now()),e.classList.add("st-dragging")}),Jt(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(gt(o.getHeaders()))},10)}),Jt(e,"dragover",t=>{const e=t;e.preventDefault(),l&&s.current&&Kt(()=>{const{screenX:t,screenY:i}=e,d=Math.sqrt(Math.pow(t-Bt.screenX,2)+Math.pow(i-Bt.screenY,2));r.current=n;const a=s.current;if(!a)return;let c,h=!1;if(ge(a)!==ge(n)){const t=function({headers:t,draggedHeader:e,hoveredHeader:n}){const o=gt(t);let i=!1;try{const t=ge(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=me(l,a.accessor),e=me(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=be(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&&!Et(c,f))return;const w=Date.now();JSON.stringify(c)===JSON.stringify(Nt)&&(1500>w-jt||40>d)||(zt(w),Bt={screenX:t,screenY:i},(t=>{Nt=t})(l),o.onTableHeaderDragEnd(c))},50)}),Jt(document.documentElement,"dragover",t=>{t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="move")}))},Pe=(t,e,n)=>{var o,i;const{header:s,colIndex:r,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||l;return"parentCollapsed"===e||"always"===e})),R=null==a?void 0:a.singleRowChildren,C=y&&!s.singleRowChildren,S=!!h&&(s.children&&0!==s.children.length?d(s,r).includes(e.lastHeaderIndex):r===e.lastHeaderIndex),I=!(!e.selectableColumns||g)&&d(s,r).some(t=>f.has(t)),H=!g&&d(s,r).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(" ")},$e=(t,e,n)=>{var o;const{header:i,colIndex:s}=t,{reverse:r}=e,l=i.isSelectionColumn&&e.enableRowSelection,a=Pe(t,e,n),c=document.createElement("div");c.className=a,c.id=u({accessor:i.accessor,rowId:"header"}),c.setAttribute("data-accessor",i.accessor+""),c.setAttribute("role","columnheader"),c.setAttribute("aria-colindex",s+1+""),i.isSortable&&((null===(o=e.sort)||void 0===o?void 0:o.key.accessor)===i.accessor?c.setAttribute("aria-sort","asc"===e.sort.direction?"ascending":"descending"):c.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;c.setAttribute("aria-describedby",t);const e=document.createElement("span");e.id=t,e.className="st-sr-only",e.textContent=p,c.appendChild(e)}c.style.position="absolute",c.style.left=t.left+"px",c.style.top=t.top+"px",c.style.width=t.width+"px",c.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))),Jt(i,"click",n=>{n.stopPropagation(),e.onSort(t.accessor)}),Jt(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=he({header:t,currentFilter:r,onApplyFilter:n,onClearFilter:s,containerRef:d,mainBodyRef:d}),u=oe({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 Jt(l,"click",p),Jt(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(!h(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 Jt(r,"click",d),Jt(r,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),d(t))}),r})(i,e);if(r){const t=Oe(i,e,n);t&&c.appendChild(t)}i.headerRenderer||"right"!==i.align||(v&&c.appendChild(v),w&&c.appendChild(w),f&&c.appendChild(f));const m=document.createElement("div");if(m.className="st-header-label",i.headerRenderer){const t=Ae(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=Ae(i,e);m.appendChild(t)}if(Jt(m,"click",t=>{l||((t,e,n,o)=>{if(!e.isSelectionColumn){if(o.selectableColumns){const i=d(e,n),s=i.some(t=>o.selectedColumns.has(t));if(o.enableHeaderEditing&&s&&!t.shiftKey){const t=document.getElementById(u({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=Te(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)}),Jt(m,"dblclick",t=>{l||((t,e,n)=>{e.isSelectionColumn||n.selectableColumns&&e.isSortable&&n.onSort(e.accessor)})(0,i,e)}),We(m,c,i,e),c.appendChild(m),i.headerRenderer||"right"===i.align||(v&&c.appendChild(v),w&&c.appendChild(w),f&&c.appendChild(f)),!r){const t=Oe(i,e,n);t&&c.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=Te(i,e,t);t.appendChild(n)}}}}),c},Le=(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=Gt(t),c=new Set(l.map(t=>u({accessor:t.header.accessor,rowId:"header"}))),p=Ut(t);let f=!1;a.forEach((t,e)=>{c.has(e)||(p.delete(e),t.remove(),a.delete(e),f=!0)}),f&&Yt(t);const w=document.createDocumentFragment(),v=[];l.forEach(t=>{const e=u({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)=>{ae(t,e)})(i,n.areAllRowsSelected());const r=Pe(t,n,o);i.className!==r&&(i.className=r),h(t.header)&&((t,e,n)=>{ve(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=$e(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+"")},De=(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),pe(i,"mousedown",t=>{t.stopPropagation()}),i},Fe=(t,e)=>new Date(t,e+1,0).getDate(),je=["January","February","March","April","May","June","July","August","September","October","November","December"],Be=["Su","Mo","Tu","We","Th","Fr","Sa"],Ne=(t,e,n)=>{const{header:o,row:i}=t,s=w(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=>{v(s,i.accessor,t),e.onCellEdit&&e.onCellEdit({accessor:i.accessor,newValue:t,row:s,rowIndex:r}),l.remove(),o()};pe(d,"click",()=>c(!0)),pe(a,"click",()=>c(!1));const h=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"),pe(d,"keydown",h),pe(a,"keydown",h);const p=document.createDocumentFragment();p.appendChild(d),p.appendChild(a);const f=u({accessor:i.accessor,rowId:t.rowId}),w=document.getElementById(f);return l=De(w||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=>{v(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,pe(o,"click",()=>a(t.value)),c.push(o)});const h=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=>{pe(t,"keydown",h)});const p=document.createElement("div");p.className="st-enum-dropdown-content",c.forEach(t=>p.appendChild(t));const f=u({accessor:i.accessor,rowId:t.rowId}),w=document.getElementById(f);return d=De(w||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?G(n+""):new Date}catch(t){c=new Date}let h=c.getFullYear(),p=c.getMonth();const f=document.createElement("div");f.className="st-datepicker";const w=document.createElement("div");w.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:xt("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:yt("st-next-prev-icon");"string"==typeof y?x.innerHTML=y:x.appendChild(y.cloneNode(!0)),w.appendChild(m),w.appendChild(b),w.appendChild(x);const R=document.createElement("div");R.className="st-datepicker-grid st-datepicker-days-grid",Be.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",pe(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(w),f.appendChild(R),f.appendChild(C);const I=t=>{const n=t.toISOString().split("T")[0];v(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=`${je[p]} ${h}`;R.children.length>7;)null===(t=R.lastElementChild)||void 0===t||t.remove();const o=Fe(h,p),i=new Date(h,p,1).getDay(),s=Fe(h,p-1),r=new Date;for(let t=0;i>t;t++){const n=s-i+t+1,o=new Date(h,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=je[p-1])&&void 0!==e?e:je[11]} ${n}, ${o.getFullYear()}`),pe(r,"click",()=>I(o)),pe(r,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),I(o))}),R.appendChild(r)}const l=c.getFullYear()===h&&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",`${je[p]} ${t}, ${h}`),r.getFullYear()===h&&r.getMonth()===p&&r.getDate()===t&&e.classList.add("today"),l&&c.getDate()===t&&e.classList.add("selected");const n=new Date(h,p,t);pe(e,"click",()=>I(n)),pe(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(h,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=je[p+1])&&void 0!==n?n:je[0]} ${t}, ${e.getFullYear()}`),pe(o,"click",()=>I(e)),pe(o,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),I(e))}),R.appendChild(o)}};pe(m,"click",()=>{p--,0>p&&(p=11,h--),H()}),pe(x,"click",()=>{p++,p>11&&(p=0,h++),H()}),H();const M=u({accessor:r.accessor,rowId:t.rowId}),k=document.getElementById(M);return a=De(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))};pe(l,"input",t)}return pe(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}v(s,i.accessor,n),e.onCellEdit&&e.onCellEdit({accessor:i.accessor,newValue:n,row:s,rowIndex:r}),o()}),pe(l,"keydown",t=>{const e=t;e.stopPropagation(),"Enter"===e.key?(d=!0,l.blur()):"Escape"===e.key&&(d=!1,l.blur())}),pe(l,"mousedown",t=>{t.stopPropagation()}),l})(t,e,s,n)},ze=(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)?U(t).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):null==t?"":t+""},qe=(t,e,n)=>{var o;const{header:i,row:s,rowIndex:r,colIndex:l,depth:d,rowId:a}=t,c=w(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)=>ce({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&&m(t[e]))(s,u),f=e.rowGrouping&&e.rowGrouping.length>d,v=!e.canExpandRowGroup||e.canExpandRowGroup(s);if(i.expandable&&(p&&f&&v||i.nestedTable||e.onRowGroupExpand&&f&&v)){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=x(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 pe(o,"click",s),pe(o,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),s(t))}),o})(t,e,x(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=ze(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=ze(c,i,l,s,r);if(null!==e){const t=document.createTextNode(e);n.appendChild(t)}}return}const g=ze(c,i,l,s,r);if(null!==g){const t=document.createTextNode(g);n.appendChild(t)}},Ge=new Map,Ve=new WeakMap;let Ue=null;const Ke=(t,e)=>{const n=Ge.get(t);n&&n.forEach(t=>{e?t.classList.add("st-row-hovered"):t.classList.remove("st-row-hovered")})},Je=(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(" ")},Ye=(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),h=Je(t,e),p=document.createElement("div");p.className=h,p.id=u({accessor:o.accessor,rowId:l}),p.setAttribute("role","gridcell"),p.setAttribute("tabindex",c?"0":"-1");const f=null!==(n=e.maxHeaderDepth)&&void 0!==n?n:1;p.setAttribute("aria-rowindex",t.tableRow.position+f+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=Ne(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)Ne(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"),qe(t,e,n),p.appendChild(n)}};b();const x=()=>{e.cellRegistry&&!d&&e.cellRegistry.set(`${l}-${o.accessor}`,{updateContent:t=>{m||(v(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)};pe(p,"mousedown",t=>{t.preventDefault(),t.target.closest(".st-expand-icon-container")||e.handleMouseDown(a)}),pe(p,"mouseover",t)}if(pe(p,"keydown",t=>{m||d||"F2"!==t.key&&"Enter"!==t.key||!o.isEditable||m||(t.preventDefault(),m=!0,b())}),pe(p,"dblclick",t=>{!o.isEditable||d||m||(m=!0,b())}),Ve.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=Ve.get(p))||void 0===n?void 0:n.current)&&void 0!==l?l:i,c=w(a,o.accessor);null===(d=e.onCellClick)||void 0===d||d.call(e,{accessor:o.accessor,colIndex:r,row:a,rowIndex:s,value:c})};pe(p,"click",t)}if(e.useHoverRowBackground){((t,e)=>{Ge.has(t)||Ge.set(t,new Set),Ge.get(t).add(e)})(s,p);const t=()=>{Ke(s,!1),Ue===s&&(Ue=null)};pe(p,"mouseenter",()=>{null!==Ue&&Ue!==s&&Ke(Ue,!1),Ke(s,!0),Ue=s}),pe(p,"mouseleave",t)}return p},_e=(t,e)=>{t.style.left="0",t.style.width="number"!=typeof e||0>e?"100%":e+"px"},Xe=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:X({position:n,rowHeight:o,heightOffsets:s,customTheme:r});_e(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},Qe=new WeakMap,Ze=new WeakMap,tn=t=>(Ze.has(t)||Ze.set(t,new Map),Ze.get(t)),en=(e,n,o,i=0,s,r)=>{var l,d,a,c,h;const p=o.pinned?null!==(d=null!==(l=o.containerWidth)&&void 0!==l?l:e.clientWidth)&&void 0!==d?d:0:null!==(h=null!==(c=null!==(a=o.mainSectionContainerWidth)&&void 0!==a?a:o.containerWidth)&&void 0!==c?c:e.clientWidth)&&void 0!==h?h: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=we(e),v=(t=>(Qe.has(t)||Qe.set(t,new Map),Qe.get(t)))(e),m=new Set(f.map(t=>u({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=Ge.get(t);n&&(n.delete(e),0===n.size&&Ge.delete(t))})(n,t),t.remove(),w.delete(e)}}),!r){const t=tn(e);v.forEach((e,n)=>{g.has(n)||(e.remove(),v.delete(n),t.delete(n))})}const b=document.createDocumentFragment(),y=[];f.forEach(t=>{var e,n,i,s;const l=u({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=Je(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=Ve.get(t);if(c&&(c.current=e.row),!e.header.expandable){const o=t.querySelector(".st-cell-content");o&&(o.innerHTML="",qe(e,n,o))}})(d,t,o),t.header.isSelectionColumn&&o.enableRowSelection&&o.isRowSelected){const e=o.isRowSelected(t.rowId);ae(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=x(t.rowId,t.depth,r,l,a);ve(d,c)}}}else y.push({cell:t,cellId:l})}),y.forEach(({cell:t,cellId:e})=>{const n=Ye(t,o);b.appendChild(n),w.set(e,n)}),b.childNodes.length>0&&e.appendChild(b),r||((e,n,o,i,s)=>{const r=tn(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(_e(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=X({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=Xe({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 nn(t,e){return t?"string"==typeof t?t:t instanceof HTMLElement?t.cloneNode(!0):"function"==typeof t?t(e):null:null}class on{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 Le(c,u,f,w),o||w===c.scrollLeft||(c.scrollLeft=w),!o&&c&&(c.__renderHeaderCells=t=>{c&&Le(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=s.filter(t=>!t.nestedTable&&!t.stateIndicator).length;this.nextColIndexMap.set(g,R.length>0&&C>0?p+R.length/C:p);const S=this.getCachedContext("body-"+g,d,l);return en(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&&en(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=p({calculatedHeight:n.calculatedHeight,customHeight:null==o?void 0:o.height,customTheme:e.customTheme}),s=Q({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:u}=e,{parentRow:f,expandableHeader:v,childAccessor:m,calculatedHeight:g}=n,b=v.nestedTable;if(!b)throw Error("createNestedGridRow: expandableHeader.nestedTable is missing");const x=w(f,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=p({calculatedHeight:g,customHeight:b.height,customTheme:s}),H=Q({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:u}),O=new Rn(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=Q({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, ${Q({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=nn(e.loadingStateRenderer,{parentRow:o.parentRow}):o.state.error&&e.errorStateRenderer?r=nn(e.errorStateRenderer,{error:o.state.error,parentRow:o.parentRow}):o.state.isEmpty&&e.emptyStateRenderer&&(r=nn(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=Q({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?Q({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:b(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),w=f&&f.deps.headersHash===h&&f.deps.collapsedHeadersSize===o.size&&f.deps.rowHeight===i&&f.deps.heightOffsetsHash===u&&(p?f.deps.fullTableRowsRef===d&&void 0!==f.deps.bandStart&&void 0!==f.deps.bandEnd&&((t,e)=>a>=t&&e>=c)(f.deps.bandStart,f.deps.bandEnd):f.deps.rowsRef===n);if(w&&f){if(!p)return f.cells;const t=new Map;n.forEach((e,n)=>{t.set(e.position,n)});const e=[];for(const n of f.cells){const o=t.get(n.tableRow.position);void 0!==o&&e.push(n.rowIndex!==o||n.isOdd!==(o%2==1)?Object.assign(Object.assign({},n),{rowIndex:o,isOdd:o%2==1}):n)}return e}let v,m,g;if(p){const t=d.length;m=Math.max(0,a-28),g=Math.min(t,c+28),v=d.slice(m,g)}else v=n;const b=this.calculateAbsoluteBodyCells(e,v,o,i,s,r,l);if(this.bodyCellsCache.set(t,{cells:b,deps:Object.assign({headersHash:h,rowsRef:v,collapsedHeadersSize:o.size,rowHeight:i,heightOffsetsHash:u},p&&{fullTableRowsRef:d,bandStart:m,bandEnd:g})}),!p)return b;const x=new Map;n.forEach((t,e)=>{x.set(t.position,e)});const y=[];for(const t of b){const e=x.get(t.tableRow.position);void 0!==e&&y.push(t.rowIndex!==e||t.isOdd!==(e%2==1)?Object.assign(Object.assign({},t),{rowIndex:e,isOdd:e%2==1}):t)}return y}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=>{_t(t)})):"context"===t&&(this.contextCache.clear(),this.headerCellsCache.clear(),this.headerSections.forEach(t=>{_t(t)})):(this.bodyCellsCache.clear(),this.headerCellsCache.clear(),this.contextCache.clear(),this.bodySections.forEach(t=>{(t=>{if(t){const e=we(t);e.forEach(t=>{t.remove()}),e.clear()}})(t)}),this.headerSections.forEach(t=>{_t(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 sn=(t,e)=>{"string"==typeof e?t.innerHTML=e:(t.innerHTML="",t.appendChild(e.cloneNode(!0)))},rn=(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(rn([t],e,n),!1===t.hide){i=!0;break}(t||i)&&(o.hide=!1)}},ln=t=>t.every(t=>t.hide),dn=t=>{t.forEach(t=>{t.children&&t.children.length>0&&(dn(t.children),ln(t.children)&&(t.hide=!0))})},an=(t,e)=>{const n=e.toLowerCase();return!!t.label.toLowerCase().includes(n)||!(!t.children||0>=t.children.length)&&t.children.some(t=>an(t,e))},cn=(t,e,n)=>{if(!e.trim())return t;const o=n||an;return t.filter(t=>!t.isSelectionColumn&&!t.excludeFromRender&&o(t,e))};function hn(t,e,n,o){e&&t.appendChild(e),t.appendChild(n),o&&t.appendChild(o)}function un(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 pn=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?un(y,H,n,C,S,I,u):hn(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?cn(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?cn(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=Mt(u,S),M=!H,k=document.createDocumentFragment(),E=16*i+"px",O=u.children&&u.children.length>0,T=!(u.hide||O&&u.children&&ln(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 $=document.createElement("div");$.className="st-header-checkbox-item",$.style.paddingLeft=E,$.draggable=!0;const L=t=>!(S.size>0&&!Et(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($.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 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)}}),$.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}=be(b,t.indexPath,i.indexPath);if(s)return void n();o=e}else{const{newHeaders:e,emergencyBreak:s}=be(b,t.indexPath,i.indexPath);if(s)return void n();o=e}L(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(yt("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=()=>{ve($,W,{ariaLabelWhenExpanded:`Collapse ${u.label} column`,ariaLabelWhenCollapsed:`Expand ${u.label} column`,syncAriaExpanded:!0})})}t.columnEditorConfig.rowRenderer||$.appendChild(e)}const j=ce({checked:T,onChange:t=>{if(!M)return;u.hide=!t,t?(rn(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,rn(n,u.children[0].accessor))):dn(n);const e=[...b];if(x(gt(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,G=!z&&"main"===f,V=!z&&"main"===f,U=()=>{const t=Pt(b,u.accessor,"left",S);t&&L(t)},K=()=>{const t=Pt(b,u.accessor,"right",S);t&&L(t)},J=()=>{const t=Pt(b,u.accessor,"main",S);t&&L(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:G,canPinRight:V,canUnpin:q,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===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(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="L",e.title="Pin column to left",e.addEventListener("click",t=>{t.stopPropagation(),U()}),t.appendChild(e)}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="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: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}=Ht(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?un(y,H,n,C,S,I,u):hn(y,C,S,I)),W()},destroy:()=>{R&&(R.removeEventListener("input",()=>{}),R.removeEventListener("click",()=>{})),x.removeEventListener("click",()=>{}),x.remove()}}},fn=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 g=0;v.forEach(t=>{const e="number"==typeof t.width?t.width:150;m.set(t.accessor,{left:g,width:e}),g+=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:b(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=Ye(l,a);p.appendChild(d)}),w.appendChild(p);const f=Xe({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},wn=(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 vn{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 on}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=bt(o.effectiveHeaders,"left")||bt(o.effectiveHeaders,void 0)||bt(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}=Re({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(bt(n.effectiveHeaders,"left")||bt(n.effectiveHeaders,void 0)||bt(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}=Re({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 $=0;const L=[];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,L.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,L.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,L.push(o),t.appendChild(o)}if(n.config.enableStickyParents&&e.stickyParents&&e.stickyParents.length>0){this.stickyParentsContainer&&(wn(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=fn({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=fn({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=fn({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&&(L.push(this.stickyParentsContainer),t.contains(this.stickyParentsContainer)||t.appendChild(this.stickyParentsContainer))}else this.stickyParentsContainer&&(wn(this.stickyParentsContainer,null!==(R=n.sectionScrollController)&&void 0!==R?R:null),this.stickyParentsContainer=null);Array.from(t.children).forEach(t=>{L.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?sn(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?sn(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=pn({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,e,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)?xe(this.horizontalScrollbarRef.current,{mainBodyRef:d.mainBodyRef.current,mainBodyWidth:e,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 xe(this.horizontalScrollbarRef.current,{mainBodyRef:d.mainBodyRef.current,mainBodyWidth:e,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:e,mainBodyWidth:o,pinnedLeftWidth:i,pinnedRightWidth:s,pinnedLeftContentWidth:r,pinnedRightContentWidth:l,tableBodyContainerRef:d,editColumns:a,sectionScrollController:c}=t;if(1>=e.scrollWidth-e.clientWidth)return null;const h=a?n: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:e,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&&(ye(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&&(ye(this.horizontalScrollbarRef.current,this.sectionScrollController),this.horizontalScrollbarRef.current=null),this.stickyParentsContainer&&(wn(this.stickyParentsContainer,this.sectionScrollController),this.stickyParentsContainer=null),this.sectionScrollController=null}}function mn(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:u=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:g({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 v=[],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=v.length,P=[...H,E],$=[...M,E],L=g({row:t,getRowId:o,depth:e,index:E,rowPath:P,rowIndexPath:$,groupingKey:A}),D=v.length,F={row:t,depth:e,displayPosition:S,groupingKey:A,position:W,isLastGroupRow:!1,rowId:L,rowPath:P,rowIndexPath:$,absoluteRowIndex:W,parentIndices:k.length>0?[...k]:void 0};v.push(F),y.push(F),S++;const j=b(L);if(x(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 m(n)?n:[]})(t,A),i=h.find(t=>t.expandable&&t.nestedTable);if((null==i?void 0:i.nestedTable)&&o.length>0){const n=v.length,s=(null===(O=i.nestedTable.customTheme)||void 0===O?void 0:O.rowHeight)||u,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=p({calculatedHeight:l,customHeight:i.nestedTable.height,customTheme:w});R.push([n,d-u]);const a=[...P,A];v.push({row:{},depth:e+1,displayPosition:S-1,groupingKey:A,position:n,isLastGroupRow:!1,rowId:a,rowPath:a,rowIndexPath:$,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=v.length,i=[...P,A];v.push({row:{},depth:e+1,displayPosition:S-1,groupingKey:A,position:o,isLastGroupRow:!1,rowId:i,rowPath:i,rowIndexPath:$,stateIndicator:{parentRowId:j,parentRow:t,state:n},absoluteRowIndex:o,parentIndices:[...k,D]})}else if(n.loading&&!d){const t=v.length,n=[...P,A,"loading-skeleton"];v.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,D]})}}else if(o.length>0){const t=[...P,A],n=[...$];I(o,e+1,t,n,[...k,D])}}0===e&&C.push(v.length)})};return I(e,0,[],[],[]),C.forEach((t,e)=>{const n=t-1;n>=0&&v.length>n&&(v[n].isLastGroupRow=!0)}),{flattenedRows:v,heightOffsets:R,paginatableRows:y,parentEndPositions:C}}const gn=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 bn{constructor(){this.lastHeadersRef=null,this.lastRowsRef=null,this.flattenedRowsCache=null,this.lastProcessedResult=null,this.processRowsScrollReuseKey=null,this.processRowsScrollReuseBase=null,this.lastScrollRafPaintedRange=null,this.scrollRafHeadersMemo=null,this.tableRenderer=new vn}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),t&&"all"!==t&&"body"!==t&&"context"!==t||(this.processRowsScrollReuseKey=null,this.processRowsScrollReuseBase=null,this.lastScrollRafPaintedRange=null,this.scrollRafHeadersMemo=null),t&&"all"!==t&&"header"!==t||(this.lastScrollRafPaintedRange=null,this.scrollRafHeadersMemo=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?I(s,{containerWidth:o}):I(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,n){var o,i,s,r,l,d,a,c,h,u,p,f,v,m,g,b,x,y,R,C,S;if(this.lastHeadersRef!==t.headers&&(this.invalidateCache("header"),this.invalidateCache("context"),this.lastHeadersRef=t.headers),!t.dimensionManager)return null;const I=t.dimensionManager.getState(),{containerWidth:H,calculatedHeaderHeight:M,maxHeaderDepth:k}=I,E=0===t.collapsedHeaders.size?"":[...t.collapsedHeaders].map(String).sort().join("\0");let O;t.positionOnlyBody&&!0!==t.config.autoExpandColumns&&this.scrollRafHeadersMemo&&this.scrollRafHeadersMemo.headersRef===t.headers&&this.scrollRafHeadersMemo.containerWidth===H&&this.scrollRafHeadersMemo.collapsedKey===E?O=this.scrollRafHeadersMemo.effectiveHeaders:(O=this.computeEffectiveHeaders(t.headers,t.config,t.customTheme,H),this.scrollRafHeadersMemo=!0!==t.config.autoExpandColumns?{headersRef:t.headers,containerWidth:H,collapsedKey:E,effectiveHeaders:O}:null);const{leftWidth:T,rightWidth:A}=Re({headers:O,containerWidth:H,collapsedHeaders:t.collapsedHeaders});t.config.autoExpandColumns&&H>0&&(O=$(O,{autoExpandColumns:!0,containerWidth:H,pinnedLeftWidth:T,pinnedRightWidth:A,mainBodyRef:null!==(o=t.mainBodyRef)&&void 0!==o?o:{current:null},isResizing:null!==(i=t.isResizing)&&void 0!==i&&i}));let W=t.localRows;if(t.sortManager?W=t.sortManager.getSortedRows():t.filterManager&&(W=t.filterManager.getFilteredRows()),this.lastRowsRef!==W&&(this.invalidateCache("body"),this.invalidateCache("context"),this.lastRowsRef=W),t.internalIsLoading&&0===W.length){let e=t.config.shouldPaginate&&null!==(s=t.config.rowsPerPage)&&void 0!==s?s:10;n.isMainSectionScrollable&&(e+=1),W=Array.from({length:e},()=>({}))}const P=null===(r=t.sortManager)||void 0===r?void 0:r.getState(),L=null===(l=t.filterManager)||void 0===l?void 0:l.getState(),D=(null==P?void 0:P.sort)?`${P.sort.key.accessor}-${P.sort.direction}`:"none",F=JSON.stringify((null==L?void 0:L.filters)||{}),j=t.config.quickFilter,B=j?`${null!==(d=j.text)&&void 0!==d?d:""}|${null!==(a=j.mode)&&void 0!==a?a:"simple"}`:"",N=this.flattenedRowsCache&&this.flattenedRowsCache.deps.rowsRef===W&&this.flattenedRowsCache.deps.quickFilterKey===B&&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===D&&this.flattenedRowsCache.deps.filterKey===F;let q,G,V;N&&this.flattenedRowsCache?(q=this.flattenedRowsCache.aggregatedRows,G=this.flattenedRowsCache.quickFilteredRows,V=this.flattenedRowsCache.flattenResult):(q=t.sortManager?W:z({rows:W,headers:t.headers,rowGrouping:t.config.rowGrouping}),G=(({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=w(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=w(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:q,headers:O,quickFilter:t.config.quickFilter}),V=mn({rows:G,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:O,rowHeight:t.customTheme.rowHeight,headerHeight:t.customTheme.headerHeight,customTheme:t.customTheme}),this.flattenedRowsCache={aggregatedRows:q,quickFilteredRows:G,flattenResult:V,deps:{rowsRef:W,quickFilterKey:B,expandedRowsSize:t.expandedRows.size,collapsedRowsSize:t.collapsedRows.size,expandedDepthsSize:t.expandedDepths.size,rowStateMapSize:t.rowStateMap.size,sortKey:D,filterKey:F}});const U=(({height:t,maxHeight:e,rowHeight:n,totalRowCount:o,headerHeight:i,footerHeight:s})=>{if(e){const t=gn(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=gn(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!==(c=t.config.shouldPaginate)&&void 0!==c&&c,rowsPerPage:null!==(h=t.config.rowsPerPage)&&void 0!==h?h:10,totalRowCount:null!==(u=t.config.totalRowCount)&&void 0!==u?u:V.paginatableRows.length,headerHeight:M,footerHeight:!t.config.shouldPaginate&&!t.config.footerRenderer||t.config.hideFooter?void 0:t.customTheme.footerHeight}),K=null!==(p=t.config.shouldPaginate)&&void 0!==p&&p,J=null!==(f=t.config.rowsPerPage)&&void 0!==f?f:10,Y=null!==(v=t.config.serverSidePagination)&&void 0!==v&&v,X=null!==(m=t.config.totalRowCount)&&void 0!==m?m:V.paginatableRows.length,Q=null!==(b=null===(g=t.config.rowGrouping)||void 0===g?void 0:g.join("\0"))&&void 0!==b?b:"",Z=null!==(y=null===(x=V.heightOffsets)||void 0===x?void 0:x.length)&&void 0!==y?y:0;let tt=0;if(V.heightOffsets)for(const[,t]of V.heightOffsets)tt+=t;const nt=void 0===U?"":`${N?1:0}|${U}|${n.currentPage}|${J}|${K}|${Y}|${t.customTheme.rowHeight}|${M}|${X}|${null!==(R=t.config.enableStickyParents)&&void 0!==R&&R}|${Q}|${V.flattenedRows.length}|${Z}|${tt}`;let ot;return t.positionOnlyBody&&void 0!==U&&null!==this.processRowsScrollReuseKey&&null!==this.processRowsScrollReuseBase&&this.processRowsScrollReuseKey===nt&&this.processRowsScrollReuseBase?ot=function(t,n){const{contentHeight:o,rowHeight:i,scrollDirection:s="none",scrollTop:r,enableStickyParents:l,rowGrouping:d}=n,a=e(i),{currentTableRows:c,paginatedHeightOffsets:h,heightMap:u}=t;let p,f,w,v,m=0,g=c.length;if(void 0===o)p=c,f=[],w=p,v=[];else{const t=_({bufferRowCount:a,contentHeight:o,tableRows:c,rowHeight:i,scrollTop:r,scrollDirection:s,heightMap:u});if(p=t.rendered.rows,m=t.rendered.startIndex,g=t.rendered.endIndex,l)if(d){const e=et(c,t.rendered.rows,t.fullyVisible.rows,t.partiallyVisible.rows,d);f=e.stickyParents,w=e.regularRows,v=t.partiallyVisible.rows}else f=[],w=t.rendered.rows,v=[];else f=[],w=p,v=[]}return{currentTableRows:c,rowsToRender:p,renderedStartIndex:m,renderedEndIndex:g,stickyParents:f,regularRows:w,partiallyVisibleRows:v,paginatedHeightOffsets:h,heightMap:u}}(this.processRowsScrollReuseBase,{contentHeight:U,rowHeight:t.customTheme.rowHeight,scrollTop:n.scrollTop,scrollDirection:n.scrollDirection,enableStickyParents:null!==(C=t.config.enableStickyParents)&&void 0!==C&&C,rowGrouping:t.config.rowGrouping}):(ot=function(t){const{contentHeight:n,currentPage:o,customTheme:i,enableStickyParents:s,flattenedRows:r,heightOffsets:l,parentEndPositions:d,rowHeight:a,rowsPerPage:c,scrollDirection:h="none",scrollTop:u,serverSidePagination:p,shouldPaginate:f,rowGrouping:w}=t,v=e(a),m=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})})}(r,d,o,c,f,p),g=l&&0!==l.length&&f&&!p?(()=>{const t=new Map;return m.forEach(e=>{e.nestedTable&&t.set(e.absoluteRowIndex,e.position)}),l.filter(([e])=>t.has(e)).map(([e,n])=>[t.get(e),n])})():l,b=g&&g.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}})(m.length,a,g,i):void 0;let x,y,R,C,S=0,I=m.length;if(void 0===n)x=m,y=[],R=x,C=[];else{const t=_({bufferRowCount:v,contentHeight:n,tableRows:m,rowHeight:a,scrollTop:u,scrollDirection:h,heightMap:b});if(x=t.rendered.rows,S=t.rendered.startIndex,I=t.rendered.endIndex,s)if(w){const e=et(m,t.rendered.rows,t.fullyVisible.rows,t.partiallyVisible.rows,w);y=e.stickyParents,R=e.regularRows,C=t.partiallyVisible.rows}else y=[],R=t.rendered.rows,C=[];else y=[],R=x,C=[]}return{currentTableRows:m,rowsToRender:x,renderedStartIndex:S,renderedEndIndex:I,stickyParents:y,regularRows:R,partiallyVisibleRows:C,paginatedHeightOffsets:g,heightMap:b}}({flattenedRows:V.flattenedRows,paginatableRows:V.paginatableRows,parentEndPositions:V.parentEndPositions,currentPage:n.currentPage,rowsPerPage:J,shouldPaginate:K,serverSidePagination:Y,contentHeight:U,rowHeight:t.customTheme.rowHeight,scrollTop:n.scrollTop,scrollDirection:n.scrollDirection,heightOffsets:V.heightOffsets,customTheme:t.customTheme,enableStickyParents:null!==(S=t.config.enableStickyParents)&&void 0!==S&&S,rowGrouping:t.config.rowGrouping}),void 0!==U?(this.processRowsScrollReuseKey=nt,this.processRowsScrollReuseBase={currentTableRows:ot.currentTableRows,paginatedHeightOffsets:ot.paginatedHeightOffsets,heightMap:ot.heightMap}):(this.processRowsScrollReuseKey=null,this.processRowsScrollReuseBase=null)),{dimensionState:I,containerWidth:H,effectiveHeaders:O,calculatedHeaderHeight:M,maxHeaderDepth:k,flattenResult:V,processedResult:ot}}render(t,e,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;const S=!0===o.positionOnlyBody;if(S&&null!==this.lastScrollRafPaintedRange&&C.renderedStartIndex===this.lastScrollRafPaintedRange.start&&C.renderedEndIndex===this.lastScrollRafPaintedRange.end)return;null===(u=o.rowSelectionManager)||void 0===u||u.updateConfig({tableRows:C.currentTableRows});const{mainWidth:I,leftWidth:H,rightWidth:M,leftContentWidth:k,rightContentWidth:E}=Re({headers:b,containerWidth:g,collapsedHeaders:o.collapsedHeaders}),O=g-H-M;if(!S){const e=t=>"number"==typeof t?t+"px":t,s=t.rootElement.style;if(o.config.maxHeight){const t=e(o.config.maxHeight);s.maxHeight=t,s.height=void 0===m.contentHeight?"auto":t}else s.removeProperty("max-height"),o.config.height?s.height=e(o.config.height):s.removeProperty("height");const{customTheme:r}=o;s.setProperty("--st-main-section-width",O+"px"),s.setProperty("--st-scrollbar-width",i.scrollbarWidth+"px"),s.setProperty("--st-editor-width",(o.config.editColumns?n:0)+"px"),s.setProperty("--st-border-width",r.borderWidth+"px"),s.setProperty("--st-footer-height",r.footerHeight+"px");const l=null!==(p=o.config.columnResizing)&&void 0!==p&&p;t.content.className="st-content "+(l?"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.lastScrollRafPaintedRange=S?{start:C.renderedStartIndex,end:C.renderedEndIndex}:null,this.registerSectionPanes(o);const T=o.sectionScrollController;T&&(T.setSectionScrollLeft("main",w),null!=o.pinnedLeftRef.current&&T.setSectionScrollLeft("pinned-left",o.pinnedLeftRef.current.scrollLeft),null!=o.pinnedRightRef.current&&T.setSectionScrollLeft("pinned-right",o.pinnedRightRef.current.scrollLeft),T.restoreAll()),S||(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,I,H,M,k,E,e.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 xn=t=>{if(null==t)return"";const e=t+"";return e.includes(",")||e.includes('"')||e.includes("\n")||e.includes("\r")?`"${e.replace(/"/g,'""')}"`:e};class yn{static createAPI(t){const e=()=>{var e;return(null===(e=t.getCachedFlattenResult)||void 0===e?void 0:e.call(t))||mn({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=()=>{o=!1,0!==n.size&&(n.forEach((e,n)=>{var o;const i=null===(o=t.cellRegistry)||void 0===o?void 0:o.get(n);i&&i.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=>xn(t.label)).join(","),s=t.map((t,e)=>{const n=t.row;return o.map((t,o)=>{const i=w(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 xn(r)}if(!1!==t.useFormattedValueForCSV&&t.valueFormatter){const s=t.valueFormatter({accessor:t.accessor,colIndex:o,row:n,rowIndex:e,value:i});return xn(s)}return xn(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:()=>Tt(t.headers),applyPinnedState:async e=>{const n=Wt(t.headers,e,t.essentialAccessors);n&&(t.setHeaders(n),t.onRender())},resetColumns:()=>{t.setHeaders(gt(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 Mt(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 Rn{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=$t.mergeCustomTheme(e),this.mergedColumnEditorConfig=$t.mergeColumnEditorConfig(e),this.resolvedIcons=$t.resolveIcons(e),this.localRows=[...e.rows],this.headers=[...e.defaultHeaders],this.essentialAccessors=$t.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=$t.getInitialCollapsedHeaders(e.defaultHeaders),this.expandedDepths=$t.getInitialExpandedDepths(e),this.domManager=new Lt,this.renderOrchestrator=new bn,this.rebuildRowIndexMap(),this.initializeManagers()}rebuildRowIndexMap(){this.rowIndexMap.clear(),this.localRows.forEach((t,e)=>{const n=g({row:t,getRowId:this.config.getRowId,depth:0,index:e,rowPath:[e],rowIndexPath:[e]}),o=b(n);this.rowIndexMap.set(o,e)})}initializeManagers(){var t,e,n;this.ariaAnnouncementManager=new vt,this.ariaAnnouncementManager.subscribe(t=>{this.announcement=t,this.updateAriaLiveRegion()}),this.expandedDepthsManager=new wt(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 q({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 K({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 dt({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=mt(e.tableBodyContainerRef.current);const o=this.renderOrchestrator.computeEffectiveHeaders(this.headers,this.config,this.customTheme);this.dimensionManager=new D({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 F({onLoadMore:this.config.onLoadMore,infiniteScrollThreshold:200}),this.sectionScrollController=new j({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 pt({headerContainer:e.headerContainerRef.current,mainSection:e.tableBodyContainerRef.current,scrollbarWidth:this.scrollbarWidth}),this.scrollbarVisibilityManager.subscribe(t=>{this.isMainSectionScrollable=t,this.render("scrollbarVisibilityManager")})),this.windowResizeManager=new ht,this.windowResizeManager.addCallback(()=>{var t;if(e.tableBodyContainerRef.current){const n=mt(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 ct({tableRows:[],onRowSelectionChange:this.config.onRowSelectionChange,enableRowSelection:!0}),this.rowSelectionManager.subscribe(()=>{this.render("rowSelectionManager")})),this.selectionManager&&(this.handleOutsideClickManager=new ut({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,requestAnimationFrame(()=>{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.config.onLoadMore?this.scrollManager.handleScroll(n,e.scrollLeft,e.clientHeight,e.scrollHeight):this.scrollManager.handleScroll(n,e.scrollLeft,0,0)),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=gt(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=$t.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=$t.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 yn.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=gt(t),this.renderOrchestrator.invalidateCache("header")},setCurrentPage:t=>{this.currentPage=t},setColumnEditorOpen:t=>{this.columnEditorOpen=t,this.render("columnEditor-toggle")}})}}exports.SimpleTableVanilla=Rn,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=t=>Math.ceil(800/(t+1)),n=29.5,o=150,i=["lineAreaChart","barChart"],s=40,r=(t,e,n)=>e&&n?480>t?.25:768>t?.3:.4:(t=>480>t?.4:768>t?.5:.6)(t),l="parentExpanded",d=(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},a=t=>t.flatMap(t=>{const e=[t];return t.children&&t.children.length>0&&e.push(...a(t.children)),e}),c=(t=0)=>t?t+1:0,h=t=>{var e;return!(!(null===(e=t.children)||void 0===e?void 0:e.length)||!t.collapsible)},u=({accessor:t,rowId:e})=>`${e}-${t}`,p=({calculatedHeight:t,customHeight:e,customTheme:n})=>e?("string"==typeof e?parseFloat(e):e)+n.nestedGridPaddingTop+n.nestedGridPaddingBottom:t,f=t=>{const e=t.match(/^(.+?)\[(\d+)\]$/);return e?{key:e[1],index:parseInt(e[2],10)}:{key:t,index:null}},w=(t,e)=>{const n=e+"";return n.includes(".")||n.includes("[")?n.split(".").reduce((t,e)=>{if(null==t)return;const{key:n,index:o}=f(e);let i=t[n];return null!==o&&Array.isArray(i)&&(i=i[o]),i},t):t[e]},v=(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}=f(i[t]);if(null==s[e]){const n=f(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}=f(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},m=t=>Array.isArray(t)&&t.length>0&&"object"==typeof t[0]&&null!==t[0],g=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},b=t=>t.join("-"),x=(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},y=(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||l;return"parentCollapsed"===e||"always"===e});return t.singleRowChildren?0===n.length?[t]:[t,...n.flatMap(t=>y(t,e))]:0===n.length?[t]:n.flatMap(t=>y(t,e))}const n=t.children.filter(t=>{const e=t.showWhen||l;return"parentExpanded"===e||"always"===e});return t.singleRowChildren?[t,...n.flatMap(t=>y(t,e))]:n.flatMap(t=>y(t,e))};function R(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 C(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 S(t,e){const n=t.map(t=>R(t)),i=n.reduce((t,e)=>"px"===(null==e?void 0:e.type)?t+e.value:t,0),s=n.reduce((t,e)=>"pct"===(null==e?void 0:e.type)?t+e.value:t,0),r=e*(s/100),l=n.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=n[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:o);else a.set(t.accessor,o)}),a}function I(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=C(t);o=S(e,n)}else{const e=C(t),n=e.map(t=>R(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=S(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 H=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(u({accessor:t.accessor,rowId:"header"}));return(null==e?void 0:e.offsetWidth)||o}},M=t=>{var e;const n=t.width;"string"==typeof n&&n.includes("fr")&&(t.width=(null===(e=document.getElementById(u({accessor:t.accessor,rowId:"header"})))||void 0===e?void 0:e.offsetWidth)||o),t.children&&t.children.length>0&&t.children.forEach(t=>{M(t)})},k=t=>"number"==typeof t.minWidth?t.minWidth:s,E=(t,e)=>{const n=[];return t.forEach(t=>{t.hide||n.push(...y(t,e))}),n},O=(t,e)=>{const{rows:n,header:r,maxWidth:l=500,sampleSize:d=50,styleRoot:a}=e||{},c=null!=a?a:document,h=document.getElementById(u({accessor:t,rowId:"header"}));if(!h)return o;const p=window.getComputedStyle(h),f=parseFloat(p.paddingLeft)||0,v=parseFloat(p.paddingRight)||0,m=parseFloat(p.gap)||0;let g=f+v;const b=h.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(h.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&&i.includes(r.type);if(n&&n.length>0&&!C){const e=Math.min(n.length,d),o=document.createElement("div");o.style.visibility="hidden",o.style.position="absolute",o.style.whiteSpace="nowrap",o.style.width="auto";let i=0,s=0;const l=c.querySelector(".st-cell-content");if(l){const t=window.getComputedStyle(l);o.style.font=t.font,o.style.fontSize=t.fontSize,o.style.fontFamily=t.fontFamily,i=parseFloat(t.paddingLeft)||0,s=parseFloat(t.paddingRight)||0}document.body.appendChild(o);for(let l=0;e>l;l++){const e=n[l];let d;d=(null==r?void 0:r.valueGetter)?r.valueGetter({accessor:t,row:e,rowIndex:l}):w(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})),o.textContent=null!=a?a+"":"";const c=o.offsetWidth+i+s;c>R&&(R=c)}document.body.removeChild(o)}let S=Math.max(g,R);return C&&(S=Math.max(S,150)),S>l&&(S=l),Math.max(S+2,s)};class T{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 A=(t,e)=>{const n=[];return t.forEach(t=>{t.hide||(t.children&&t.children.length>0?n.push(...A(t.children,null!=e?e:t.pinned)):n.push(t))}),n},W=(t,e)=>e>=t.reduce((t,e)=>t+k(e),0),P=(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},$=(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=A(d,"left"),u=A(a,"right"),p=A(c,void 0),f=h.length>0&&W(h,i),w=u.length>0&&W(u,s),v=p.length>0&&l>0&&W(p,l),m=new Map;if(f&&P(h,i).forEach((t,e)=>m.set(e,t)),w&&P(u,s).forEach((t,e)=>m.set(e,t)),v&&P(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 T(null!==(n=t.isResizing)&&void 0!==n&&n),this.containerWidthTracker=new T(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 $(t,this.config)}setHeaders(t,e){const n="function"==typeof t?t(e):t;return this.applyAutoScale(n)}destroy(){this.onHeadersUpdate=()=>{}}}class D{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))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 F{constructor(t){this.subscribers=new Set,this.lastScrollTop=0,this.scrollTimeoutId=null,this.notifySubscribersRafId=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(){0!==this.subscribers.size&&this.subscribers.forEach(t=>t(this.state))}scheduleNotifySubscribersFromScroll(){0!==this.subscribers.size&&null===this.notifySubscribersRafId&&(this.notifySubscribersRafId=requestAnimationFrame(()=>{this.notifySubscribersRafId=null,this.notifySubscribers()}))}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.scheduleNotifySubscribersFromScroll()},150),this.config.onLoadMore&&this.config.infiniteScrollThreshold&&this.config.infiniteScrollThreshold>o-(t+n)&&this.config.onLoadMore(),this.scheduleNotifySubscribersFromScroll()}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),null!==this.notifySubscribersRafId&&(cancelAnimationFrame(this.notifySubscribersRafId),this.notifySubscribersRafId=null),this.subscribers.clear()}}class j{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 B={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)=>B.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?B.string(t,e,n):"number"==typeof t&&"number"==typeof e?B.number(t,e,n):"boolean"==typeof t&&"boolean"==typeof e?B.boolean(t,e,n):B.string(t+"",e+"",n)},N=({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=w(e,l),d=w(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 B.number(i,s,o)}return"date"===n?B.date(t+"",e+"",o):"boolean"===n?B.boolean(!!t,!!e,o):"enum"===n?B.enum(t+"",e+"",o):B.string(t+"",e+"",o)})(o,d,s,r)})})({rows:e,sortColumn:n,headers:t}),z=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=>a(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&&m(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&&m(n))s(n);else{const n=w(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&&v(d,t.accessor,e)}),d}return t});return l(r)};class q{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=a(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=N({headers:e,rows:n,sortColumn:o});return t&&0!==t.length?i.map(n=>{const i=t[0],s=n[i];if(m(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=z({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}):N({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 G=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),U=t=>{if(!t)return new Date;if("string"==typeof t)return G(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 K{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=a(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=U(t),s=U((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(U((t||"")+"")));return r>=t&&e>=r}return!1;case"notBetween":if(i&&2===i.length){const[t,e]=i.map(t=>V(U((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}})(w(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 J=(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},Y=(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},_=({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=J(Math.max(0,o-c),r);let f=J(u,r)+1;f=Math.min(i.length,f);const w=o,v=o+e;let m=J(w,r);w>d[m]&&(m=Math.min(m+1,i.length));let g=J(v,r);g=Math.min(i.length,g);const b=o+e,x=J(o,r);let y=J(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)}}},X=({position:t,rowHeight:e,heightOffsets:n,customTheme:o})=>t*(e+o.rowSeparatorWidth)-o.rowSeparatorWidth+Y(t,n),Q=({position:t,rowHeight:e,heightOffsets:n,customTheme:o})=>t*(e+o.rowSeparatorWidth)+Y(t,n),Z=(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},tt=new Map,et=(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=tt.get(f);if(w&&w.firstVisiblePosition===h&&w.renderedStartPosition===u&&w.renderedEndPosition===p)return w.result;const v=nt({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:o,partiallyVisibleRowIndex:0,recursionDepth:0,stickyParents:[],rowGrouping:i});if(tt.set(f,{result:v,firstVisiblePosition:h,renderedStartPosition:u,renderedEndPosition:p}),tt.size>50){const t=tt.keys().next().value;void 0!==t&&tt.delete(t)}return v},nt=({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=>b(t.rowId)===b(o.rowId))||(r.push(o),a++)}}if(r.length>0){Z(d,t)&&(r.push(d),a++);const e=o[i+=a];e&&(d=e)}}else if(Z(d,t))return r.push(d),i++,nt({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:o,partiallyVisibleRowIndex:i,recursionDepth:s+1,stickyParents:r,rowGrouping:l});return Z(d,t)?nt({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:o,partiallyVisibleRowIndex:i,recursionDepth:s+1,stickyParents:r,rowGrouping:l}):{stickyParents:r,regularRows:e}},ot=(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)}},it=(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=>b(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=_({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 ot(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&&ot(e,i,s)},100);ot(a,i,s)},st=({rowIndex:t,colIndex:e,rowId:n})=>`${t}-${e}-${n}`;function rt(t,e,n,o){const i=new Set,s=new Map;n.forEach((t,e)=>{const n=b(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=b(n[t].rowId);i.add(st({colIndex:e,rowIndex:t,rowId:s}))}return i}function lt(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 dt{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=>y(t,this.config.collapsedHeaders)),this.rowIdToTableIndex.clear(),this.config.tableRows.forEach((t,e)=>{this.rowIdToTableIndex.set(b(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(b(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(`${b(e.rowId)}\t${t}`),this.rowsWithSelectedCells.add(b(e.rowId))})})}updateRowIdAndSelectionLookupOnly(){this.rowIdToTableIndex.clear(),this.config.tableRows.forEach((t,e)=>{this.rowIdToTableIndex.set(b(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(`${b(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?b(i.rowId):null)!==o){const t=this.config.tableRows.findIndex(t=>b(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=b(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=b(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=b(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=b(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=b(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=b(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=b(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=b(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=b(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=b(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=b(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=b(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=b(this.config.tableRows[o].rowId);this.selectCellRange(this.startCell,{rowIndex:o,colIndex:n,rowId:t})}else{const t=b(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=b(this.config.tableRows[o].rowId);this.selectCellRange(this.startCell,{rowIndex:o,colIndex:n,rowId:t})}else{const t=b(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=w(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=>b(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],w=b(p.rowId);if(!(null==f?void 0:f.isEditable))return void l.add(`${d}-${c}-${w}`);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(v(p.row,f.accessor,m),s){const t=s.get(`${w}-${f.accessor}`);t&&t.updateContent(m)}null==i||i({accessor:f.accessor,newValue:m,row:p.row,rowIndex:d}),r.add(`${d}-${c}-${w}`)})}),{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=b(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(w(a.row,c.accessor))?[]:""),v(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=b(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=st({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 a(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 l=n.get(i);if(!l)continue;if(l.isSelectionColumn&&this.config.enableRowSelection){for(const t of dt.HEADER_SELECTION_CLASSES)o.classList.remove(t);continue}const a=d(l,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 dt.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 dt.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 dt.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 dt.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=st({rowIndex:i,colIndex:t,rowId:o});if(this.selectedCells.has(e))return!0}const s=st({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?b(r.rowId):null,d=this.config.tableRows[i+1],a=d?b(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=st({colIndex:t,rowIndex:e,rowId:n});return this.copyFlashCells.has(o)}isWarningFlashing({colIndex:t,rowIndex:e,rowId:n}){const o=st({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=st(t);this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.selectedCells=new Set([e]),this.initialFocusedCell=t,this.updateDerivedState(),this.updateAllCellClasses(),setTimeout(()=>it(t,this.config.rowHeight,this.config.customTheme,this.config.tableRows),0)}}selectCellRange(t,e){this.fullTableSelected=!1;const n=rt(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(()=>it(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=rt(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 lt(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 lt(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=st({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})}}dt.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"],dt.HEADER_SELECTION_CLASSES=["st-header-selected","st-header-has-highlighted-cell"];const at=(t,e)=>t.filter(t=>!(!t||!t.rowId)&&e.has(b(t.rowId))).map(t=>t.row);class ct{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:at(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(b(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=>b(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=>b(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=>b(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=>b(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 ht{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 ut{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 pt{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 ft=(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 wt{constructor(t,e){this.observers=new Set,this.expandedDepths=ft(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 vt{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 mt(t){return t?t.offsetWidth-t.clientWidth:0}const gt=t=>{if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map(gt);const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=gt(t[n]));return e},bt=(t,e)=>t.filter(t=>t.pinned===e).some(t=>!t.hide&&!t.excludeFromRender),xt=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},yt=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},Rt=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},Ct=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},St=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},It=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 Ht(t){return{pinnedLeft:t.filter(t=>"left"===t.pinned),unpinned:t.filter(t=>!t.pinned),pinnedRight:t.filter(t=>"right"===t.pinned)}}function Mt(t,e){return!0===t.isEssential||e.has(t.accessor+"")}function kt(t,e){let n=!1;for(const o of t){if(o.isSelectionColumn||o.excludeFromRender)continue;const t=Mt(o,e);if(t&&n)return!1;t||(n=!0)}return!0}function Et(t,e){var n;const{pinnedLeft:o,unpinned:i,pinnedRight:s}=Ht(t);if(!kt(o,e))return!1;if(!kt(i,e))return!1;if(!kt(s,e))return!1;for(const o of t)if((null===(n=o.children)||void 0===n?void 0:n.length)&&!Ot(o.children,e))return!1;return!0}function Ot(t,e){var n;if(!kt(t,e))return!1;for(const o of t)if((null===(n=o.children)||void 0===n?void 0:n.length)&&!Ot(o.children,e))return!1;return!0}function Tt(t){const{pinnedLeft:e,unpinned:n,pinnedRight:o}=Ht(t);return{left:e.map(t=>t.accessor),main:n.map(t=>t.accessor),right:o.map(t=>t.accessor)}}function At(t,e,n){return[...t.filter(t=>Mt(e.get(t+""),n)),...t.filter(t=>!Mt(e.get(t+""),n))]}function Wt(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=At(e.left,s,n),l=At(e.main,s,n),d=At(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 Pt(t,e,n,o){const i=e+"",s=Tt(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&&(!Mt(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),Wt(t,{left:r,main:l,right:d},o)):null}class $t{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:St("st-drag-icon"),expand:yt("st-expand-icon"),filter:It("st-header-icon"),headerCollapse:yt("st-header-icon"),headerExpand:xt("st-header-icon"),next:yt("st-next-prev-icon"),prev:xt("st-next-prev-icon"),sortDown:Ct("st-header-icon"),sortUp:Rt("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 ft(null===(e=t.expandAll)||void 0===e||e,t.rowGrouping)}}class Lt{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 Dt=new WeakMap;let Ft=0,jt=Date.now(),Bt={screenX:0,screenY:0},Nt=null;const zt=t=>{jt=t},qt=new WeakMap,Gt=t=>(qt.has(t)||qt.set(t,new Map),qt.get(t)),Vt=new WeakMap,Ut=t=>(Vt.has(t)||Vt.set(t,new Map),Vt.get(t)),Kt=(t,e)=>{const n=Date.now();0!==Ft&&e>n-Ft||(Ft=n,t())},Jt=(t,e,n,o)=>{t.addEventListener(e,n,o),Dt.has(t)||Dt.set(t,[]),Dt.get(t).push({event:e,handler:n,options:o})},Yt=t=>{const e=t.closest(".simple-table-root");null==e||e.querySelectorAll(".st-tooltip").forEach(t=>t.remove())},_t=t=>{if(Ft=0,t){const e=Gt(t);e.forEach(t=>{t.remove()}),e.clear(),Ut(t).clear(),Yt(t)}},Xt={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"},Qt=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"]}},Zt=t=>!["between","notBetween","in","notIn","isEmpty","isNotEmpty"].includes(t),te=t=>["between","notBetween","in","notIn"].includes(t),ee=t=>["isEmpty","isNotEmpty"].includes(t),ne=t=>{var e;return null!==(e=null==t?void 0:t.closest(".simple-table-root"))&&void 0!==e?e:null},oe=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=ne(g))&&void 0!==e?e:ne(null!=r?r:null))&&void 0!==n?n:ne(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}},ie=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=oe({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}},se=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()}}},re=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()}}},le=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()}}},de=()=>{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},ae=(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(de()))},ce=({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(de());const r=()=>{const t=i.checked;i.setAttribute("aria-checked",""+t),t?(s.classList.add("st-checked"),s.appendChild(de())):(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(de())):(s.classList.remove("st-checked"),s.innerHTML=""))},destroy:()=>{i.removeEventListener("change",r)}}},he=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=Qt("string"),c=document.createElement("div");c.className="st-filter-container";const h=document.createElement("div");h.className="st-filter-section";const u=ie({value:l,onChange:t=>{l=t,g()},options:a.map(t=>({value:t,label:Xt[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},Zt(l)&&{value:d});o(t)},m=()=>ee(l)||""!==d.trim(),g=()=>{p&&(p.remove(),p=null),f&&(f.destroy(),f=null),Zt(l)&&(p=document.createElement("div"),p.className="st-filter-section",f=se({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=re({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=Qt("number"),f=document.createElement("div");f.className="st-filter-container";const w=document.createElement("div");w.className="st-filter-section";const v=ie({value:a,onChange:t=>{a=t,S()},options:p.map(t=>({value:t,label:Xt[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};Zt(a)?t.value=parseFloat(c):te(a)&&(t.values=[parseFloat(h),parseFloat(u)]),s(t)},C=()=>!!ee(a)||(Zt(a)?""!==c.trim():!!te(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),Zt(a)?(m=document.createElement("div"),m.className="st-filter-section",g=se({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)):te(a)&&(m=document.createElement("div"),m.className="st-filter-section",b=se({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=se({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=re({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=Qt("boolean"),c=document.createElement("div");c.className="st-filter-container";const h=document.createElement("div");h.className="st-filter-section";const u=ie({value:l,onChange:t=>{l=t,g()},options:a.map(t=>({value:t,label:Xt[t]})),containerRef:s,mainBodyRef:r});h.appendChild(u.element),c.appendChild(h);let p=null,f=null,w=null;const v=()=>ee(l)||""!==d,m=[{value:"true",label:"True"},{value:"false",label:"False"}],g=()=>{p&&(p.remove(),p=null),f&&(f.destroy(),f=null),Zt(l)&&(p=document.createElement("div"),p.className="st-filter-section",f=ie({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=re({onApply:()=>{const t={accessor:e.accessor,operator:l};Zt(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=Qt("date"),f=document.createElement("div");f.className="st-filter-container";const w=document.createElement("div");w.className="st-filter-section";const v=ie({value:a,onChange:t=>{a=t,T()},options:p.map(t=>({value:t,label:Xt[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=()=>!!ee(a)||(Zt(a)?""!==c.trim():!!te(a)&&""!==h.trim()&&""!==u.trim()),E=t=>{if(!t)return"";const e=U(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?U(t):new Date,c=le({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=oe({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),Zt(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(te(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=re({onApply:()=>{const t={accessor:o.accessor,operator:a};Zt(a)?t.value=c:te(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=ce({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=se({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=ce({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=re({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)}},ue=new WeakMap,pe=(t,e,n,o)=>{t.addEventListener(e,n,o),ue.has(t)||ue.set(t,[]),ue.get(t).push({event:e,handler:n,options:o})},fe=new WeakMap,we=t=>(fe.has(t)||fe.set(t,new Map),fe.get(t)),ve=(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+"")})})},me=(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=me(i.children,e,[...n,o]);if(t)return t}}return null},ge=t=>"left"===t.pinned?"left":"right"===t.pinned?"right":"main";function be(t,e,n){const o=gt(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 xe=(t,e)=>{const{mainBodyWidth:o,pinnedLeftWidth:i,pinnedRightWidth:s,pinnedLeftContentWidth:r,pinnedRightContentWidth:l,tableBodyContainerRef:d,editColumns:a}=e,c=a?n: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")}},ye=(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()},Re=({headers:t,containerWidth:e,collapsedHeaders:n})=>{let o=0,i=0,s=0;t.forEach(t=>{if(t.hide)return;const e=y(t,n).reduce((t,e)=>t+H(e),0);"left"===t.pinned?o+=e:"right"===t.pinned?i+=e:s+=e});const l=o,d=i;if(e&&e>0){const t=e*r(e,o>0,i>0);o>t&&(o=t),i>t&&(i=t)}return{leftWidth:c(o),rightWidth:c(i),mainWidth:s,leftContentWidth:l,rightContentWidth:d}},Ce=(t,e)=>{if(t.pinned)return t.pinned;const n=((t,e)=>{const n=a(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?Ce(n,e):void 0},Se=(t,e,n)=>{var o;const i=[],s=[],r=[];t.forEach(e=>{if(e.hide)return;const n=Ce(e,t);"left"===n?i.push(e):"right"===n?r.push(e):s.push(e)});const d=(t,o,i)=>{var s,r;const a=o;if(t.children&&t.children.length>0){const r=null==e?void 0:e.has(t.accessor),c=t.children.filter(t=>{if(t.hide)return!1;const e=t.showWhen||l;return r?"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:H(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!==(r=null==n?void 0:n.get(t.accessor))&&void 0!==r?r:"number"==typeof t.width?t.width:H(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),h=a(s),p=a(r),f=new Map;c.forEach((t,e)=>f.set(e,t)),h.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=u({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=Re({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"),I=null==C?void 0:C.querySelector(".st-body-main"),M=!!(null==C?void 0:C.querySelector(".st-column-editor"));S&&I&&w&&I.scrollWidth-I.clientWidth>1&&xe(S,{mainBodyRef:I,mainBodyWidth:x,pinnedLeftWidth:g,pinnedRightWidth:b,pinnedLeftContentWidth:y,pinnedRightContentWidth:R,tableBodyContainerRef:w,editColumns:M})},Ie=({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=s,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=o;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}),o-=e}}},He=({childrenToResize:t=[],collapsedHeaders:e,containerWidth:n,delta:o,headers:i,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*r(t,e,n))(n,i.some(t=>"left"===t.pinned&&!t.hide),i.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=E(u,e),i=n.findIndex(e=>e.accessor===t[0].accessor),r=n.findIndex(e=>e.accessor===t[t.length-1].accessor);if(-1===i||-1===r)return;const d=0===i,a=r===n.length-1;let w;w="left"===h&&a||"right"===h&&d?[]:d?n.slice(r+1):a||c?n.slice(0,i):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-s)},0);e=Math.min(o,t)}const i=(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*i,40)}),n&&e>0&&w.length>0&&Ie({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,s*t.length),i=n/e;t.forEach(t=>{const e=l.get(t.accessor)||100;t.width=Math.max(e*i,40)});const r=f-n;r>0&&w.length>0&&Ie({columnsToShrink:w,totalCompensation:-r,initialWidthsMap:l})}return}const v=E(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,s));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-s)},0),e=Math.min(o,t);a.width=f+e,e>0&&Ie({columnsToShrink:x,totalCompensation:e,initialWidthsMap:l})}else{const t=Math.max(f+o,40),e=f-t;a.width=t,e>0&&Ie({columnsToShrink:x,totalCompensation:-e,initialWidthsMap:l})}},Me=(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},ke=({autoExpandColumns:t,collapsedHeaders:e,containerWidth:n,event:o,header:i,headers:s,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=Me(n,l);h(!0);const v=Ce(i,s),m=k(i);let g;if(i.children&&i.children.length>0){const t=y(i,e);g=t.length>0?t:[i]}else g=[i];const b=new Map;let x=0,R=0;if(t){const t=s.filter(t=>t.pinned===v);if(E(t,e).forEach(t=>{const e=H(t);b.set(t.accessor,e)}),w>0){const{leftWidth:t,rightWidth:n,mainWidth:o}=Re({headers:s,containerWidth:w,collapsedHeaders:e});x="left"===v?t:"right"===v?n:o,R=w-t-n}}let C=!1;const S=new Map;let I=[];if(t&&v&&w>0){const t=E(s.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=s.filter(t=>!t.pinned);I=E(t,e),I.forEach(t=>{S.set(t.accessor,H(t))})}}}const O=(n,o=!1)=>{const l="right"===v?p-n:n-p;if(t){const t=s.filter(t=>t.pinned===v);if(He({childrenToResize:g,collapsedHeaders:e,containerWidth:w,delta:l,headers:s,initialWidthsMap:b,isParentResize:g.length>1,resizedHeader:g.length>0?g[g.length-1]:i,reverse:a,rootPinned:v,sectionHeaders:t,sectionWidth:x,startWidth:u}),C&&I.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;I.forEach((n,i)=>{const s=S.get(n.accessor)||100;i===I.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 s=e.some(t=>"left"===t.pinned&&!t.hide),l=e.some(t=>"right"===t.pinned&&!t.hide),d=i*r(i,s,l)-e.filter(e=>e.pinned===t.pinned&&e.accessor!==t.accessor).reduce((t,e)=>e.hide?t:t+y(e,n).reduce((t,e)=>t+H(e),0),0),a=k(t);return a>d?(console.warn(`Header ${t.accessor} exceeds pinned section width limit`),a):d})({header:i,headers:s,collapsedHeaders:e});g.length>1?(({delta:t,leafHeaders:e,minWidth:n,startWidth:o,maxWidth:i})=>{const s=e.reduce((t,e)=>Math.min(t,k(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),s.forEach(t=>{M(t)})}if(o){const t=[...s];c(t);const n=new Map;g.forEach(t=>{"number"==typeof t.width&&n.set(t.accessor,t.width)}),C&&I.forEach(t=>{"number"==typeof t.width&&n.set(t.accessor,t.width)}),Se(s,e,n)}else Se(s,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([...s])};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([...s])};document.addEventListener("mousemove",t),document.addEventListener("mouseup",e)}},Ee=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},Oe=(t,e,n)=>{const{columnResizing:i}=e;if(!i||t.isSelectionColumn&&e.enableRowSelection||n)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:Ee(e)});let d=0;const a=()=>{const n=Date.now();120>n-d||(d=n,(()=>{const n=document.getElementById(u({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=Me(o,i),c=Ce(t,e);let h;if(t.children&&t.children.length>0){const e=y(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(E(w,n).forEach(t=>{const e=H(t);u.set(t.accessor,e)}),a>0){const{leftWidth:t,rightWidth:o,mainWidth:i}=Re({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=E(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=E(t,n),g.forEach(t=>{m.set(t.accessor,H(t))})}}}const b=h.reduce((t,e)=>t+l(e),0),x=null!==(d=null==r?void 0:r.offsetWidth)&&void 0!==d?d:h.reduce((t,e)=>t+H(e),0);if(He({childrenToResize:h,collapsedHeaders:n,containerWidth:a,delta:b-x,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:x}),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)}),Se(e,n,R)})({header:t,headers:e.headers,collapsedHeaders:e.collapsedHeaders,containerWidth:e.containerWidth,mainBodyRef:e.mainBodyRef,reverse:e.reverse,headerCellElement:n,getTargetLeafWidth:t=>O(t.accessor,l(t))});const o=[...e.headers];return e.setHeaders(o),void(e.onColumnWidthChange&&e.onColumnWidthChange(o))}const o=O(t.accessor,l(t)),i=me(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=>M(t));const c=d[r],h=new Map;c&&"number"==typeof c.width&&h.set(c.accessor+"",c.width),Se(a,e.collapsedHeaders,h),e.setHeaders(a),e.onColumnWidthChange&&e.onColumnWidthChange(a)})())};return Jt(s,"mousedown",n=>{var i;if(n.detail>=2)return n.preventDefault(),void a();const s=null===(i=document.getElementById(u({accessor:t.accessor,rowId:"header"})))||void 0===i?void 0:i.offsetWidth;Kt(()=>{ke({autoExpandColumns:e.autoExpandColumns,collapsedHeaders:e.collapsedHeaders,containerWidth:e.containerWidth,event:n,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:o})},10)}),Jt(s,"touchstart",n=>{var i;const s=n,r=null===(i=document.getElementById(u({accessor:t.accessor,rowId:"header"})))||void 0===i?void 0:i.offsetWidth;Kt(()=>{ke({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:o})},10)}),Jt(s,"dblclick",a),s},Te=(t,e,n)=>{const o=document.createElement("input");return o.type="text",o.className="st-header-edit-input",o.value=t.label||"",Jt(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=Ae(t,e,i);s.replaceChild(o,n)}if(e.headerRegistry&&!t.isSelectionColumn){const n=e.headerRegistry.get(t.accessor+"");n&&n.setEditing(!1)}}),Jt(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},Ae=(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 ce({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)};Jt(s,"mouseenter",o),Jt(s,"mouseleave",i)}return s},We=(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"),Jt(t,"dragstart",t=>{s.current=n,zt(Date.now()),e.classList.add("st-dragging")}),Jt(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(gt(o.getHeaders()))},10)}),Jt(e,"dragover",t=>{const e=t;e.preventDefault(),l&&s.current&&Kt(()=>{const{screenX:t,screenY:i}=e,d=Math.sqrt(Math.pow(t-Bt.screenX,2)+Math.pow(i-Bt.screenY,2));r.current=n;const a=s.current;if(!a)return;let c,h=!1;if(ge(a)!==ge(n)){const t=function({headers:t,draggedHeader:e,hoveredHeader:n}){const o=gt(t);let i=!1;try{const t=ge(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=me(l,a.accessor),e=me(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=be(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&&!Et(c,f))return;const w=Date.now();JSON.stringify(c)===JSON.stringify(Nt)&&(1500>w-jt||40>d)||(zt(w),Bt={screenX:t,screenY:i},(t=>{Nt=t})(l),o.onTableHeaderDragEnd(c))},50)}),Jt(document.documentElement,"dragover",t=>{t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="move")}))},Pe=(t,e,n)=>{var o,i;const{header:s,colIndex:r,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||l;return"parentCollapsed"===e||"always"===e})),R=null==a?void 0:a.singleRowChildren,C=y&&!s.singleRowChildren,S=!!h&&(s.children&&0!==s.children.length?d(s,r).includes(e.lastHeaderIndex):r===e.lastHeaderIndex),I=!(!e.selectableColumns||g)&&d(s,r).some(t=>f.has(t)),H=!g&&d(s,r).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(" ")},$e=(t,e,n)=>{var o;const{header:i,colIndex:s}=t,{reverse:r}=e,l=i.isSelectionColumn&&e.enableRowSelection,a=Pe(t,e,n),c=document.createElement("div");c.className=a,c.id=u({accessor:i.accessor,rowId:"header"}),c.setAttribute("data-accessor",i.accessor+""),c.setAttribute("role","columnheader"),c.setAttribute("aria-colindex",s+1+""),i.isSortable&&((null===(o=e.sort)||void 0===o?void 0:o.key.accessor)===i.accessor?c.setAttribute("aria-sort","asc"===e.sort.direction?"ascending":"descending"):c.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;c.setAttribute("aria-describedby",t);const e=document.createElement("span");e.id=t,e.className="st-sr-only",e.textContent=p,c.appendChild(e)}c.style.position="absolute",c.style.left=t.left+"px",c.style.top=t.top+"px",c.style.width=t.width+"px",c.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))),Jt(i,"click",n=>{n.stopPropagation(),e.onSort(t.accessor)}),Jt(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=he({header:t,currentFilter:r,onApplyFilter:n,onClearFilter:s,containerRef:d,mainBodyRef:d}),u=oe({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 Jt(l,"click",p),Jt(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(!h(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 Jt(r,"click",d),Jt(r,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),d(t))}),r})(i,e);if(r){const t=Oe(i,e,n);t&&c.appendChild(t)}i.headerRenderer||"right"!==i.align||(v&&c.appendChild(v),w&&c.appendChild(w),f&&c.appendChild(f));const m=document.createElement("div");if(m.className="st-header-label",i.headerRenderer){const t=Ae(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=Ae(i,e);m.appendChild(t)}if(Jt(m,"click",t=>{l||((t,e,n,o)=>{if(!e.isSelectionColumn){if(o.selectableColumns){const i=d(e,n),s=i.some(t=>o.selectedColumns.has(t));if(o.enableHeaderEditing&&s&&!t.shiftKey){const t=document.getElementById(u({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=Te(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)}),Jt(m,"dblclick",t=>{l||((t,e,n)=>{e.isSelectionColumn||n.selectableColumns&&e.isSortable&&n.onSort(e.accessor)})(0,i,e)}),We(m,c,i,e),c.appendChild(m),i.headerRenderer||"right"===i.align||(v&&c.appendChild(v),w&&c.appendChild(w),f&&c.appendChild(f)),!r){const t=Oe(i,e,n);t&&c.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=Te(i,e,t);t.appendChild(n)}}}}),c},Le=(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=Gt(t),c=new Set(l.map(t=>u({accessor:t.header.accessor,rowId:"header"}))),p=Ut(t);let f=!1;a.forEach((t,e)=>{c.has(e)||(p.delete(e),t.remove(),a.delete(e),f=!0)}),f&&Yt(t);const w=document.createDocumentFragment(),v=[];l.forEach(t=>{const e=u({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)=>{ae(t,e)})(i,n.areAllRowsSelected());const r=Pe(t,n,o);i.className!==r&&(i.className=r),h(t.header)&&((t,e,n)=>{ve(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=$e(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+"")},De=(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),pe(i,"mousedown",t=>{t.stopPropagation()}),i},Fe=(t,e)=>new Date(t,e+1,0).getDate(),je=["January","February","March","April","May","June","July","August","September","October","November","December"],Be=["Su","Mo","Tu","We","Th","Fr","Sa"],Ne=(t,e,n)=>{const{header:o,row:i}=t,s=w(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=>{v(s,i.accessor,t),e.onCellEdit&&e.onCellEdit({accessor:i.accessor,newValue:t,row:s,rowIndex:r}),l.remove(),o()};pe(d,"click",()=>c(!0)),pe(a,"click",()=>c(!1));const h=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"),pe(d,"keydown",h),pe(a,"keydown",h);const p=document.createDocumentFragment();p.appendChild(d),p.appendChild(a);const f=u({accessor:i.accessor,rowId:t.rowId}),w=document.getElementById(f);return l=De(w||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=>{v(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,pe(o,"click",()=>a(t.value)),c.push(o)});const h=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=>{pe(t,"keydown",h)});const p=document.createElement("div");p.className="st-enum-dropdown-content",c.forEach(t=>p.appendChild(t));const f=u({accessor:i.accessor,rowId:t.rowId}),w=document.getElementById(f);return d=De(w||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?G(n+""):new Date}catch(t){c=new Date}let h=c.getFullYear(),p=c.getMonth();const f=document.createElement("div");f.className="st-datepicker";const w=document.createElement("div");w.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:xt("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:yt("st-next-prev-icon");"string"==typeof y?x.innerHTML=y:x.appendChild(y.cloneNode(!0)),w.appendChild(m),w.appendChild(b),w.appendChild(x);const R=document.createElement("div");R.className="st-datepicker-grid st-datepicker-days-grid",Be.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",pe(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(w),f.appendChild(R),f.appendChild(C);const I=t=>{const n=t.toISOString().split("T")[0];v(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=`${je[p]} ${h}`;R.children.length>7;)null===(t=R.lastElementChild)||void 0===t||t.remove();const o=Fe(h,p),i=new Date(h,p,1).getDay(),s=Fe(h,p-1),r=new Date;for(let t=0;i>t;t++){const n=s-i+t+1,o=new Date(h,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=je[p-1])&&void 0!==e?e:je[11]} ${n}, ${o.getFullYear()}`),pe(r,"click",()=>I(o)),pe(r,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),I(o))}),R.appendChild(r)}const l=c.getFullYear()===h&&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",`${je[p]} ${t}, ${h}`),r.getFullYear()===h&&r.getMonth()===p&&r.getDate()===t&&e.classList.add("today"),l&&c.getDate()===t&&e.classList.add("selected");const n=new Date(h,p,t);pe(e,"click",()=>I(n)),pe(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(h,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=je[p+1])&&void 0!==n?n:je[0]} ${t}, ${e.getFullYear()}`),pe(o,"click",()=>I(e)),pe(o,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),I(e))}),R.appendChild(o)}};pe(m,"click",()=>{p--,0>p&&(p=11,h--),H()}),pe(x,"click",()=>{p++,p>11&&(p=0,h++),H()}),H();const M=u({accessor:r.accessor,rowId:t.rowId}),k=document.getElementById(M);return a=De(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))};pe(l,"input",t)}return pe(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}v(s,i.accessor,n),e.onCellEdit&&e.onCellEdit({accessor:i.accessor,newValue:n,row:s,rowIndex:r}),o()}),pe(l,"keydown",t=>{const e=t;e.stopPropagation(),"Enter"===e.key?(d=!0,l.blur()):"Escape"===e.key&&(d=!1,l.blur())}),pe(l,"mousedown",t=>{t.stopPropagation()}),l})(t,e,s,n)},ze=(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)?U(t).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):null==t?"":t+""},qe=(t,e,n)=>{var o;const{header:i,row:s,rowIndex:r,colIndex:l,depth:d,rowId:a}=t,c=w(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)=>ce({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&&m(t[e]))(s,u),f=e.rowGrouping&&e.rowGrouping.length>d,v=!e.canExpandRowGroup||e.canExpandRowGroup(s);if(i.expandable&&(p&&f&&v||i.nestedTable||e.onRowGroupExpand&&f&&v)){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=x(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 pe(o,"click",s),pe(o,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),s(t))}),o})(t,e,x(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=ze(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=ze(c,i,l,s,r);if(null!==e){const t=document.createTextNode(e);n.appendChild(t)}}return}const g=ze(c,i,l,s,r);if(null!==g){const t=document.createTextNode(g);n.appendChild(t)}},Ge=new Map,Ve=new WeakMap;let Ue=null;const Ke=(t,e)=>{const n=Ge.get(t);n&&n.forEach(t=>{e?t.classList.add("st-row-hovered"):t.classList.remove("st-row-hovered")})},Je=(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(" ")},Ye=(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),h=Je(t,e),p=document.createElement("div");p.className=h,p.id=u({accessor:o.accessor,rowId:l}),p.setAttribute("role","gridcell"),p.setAttribute("tabindex",c?"0":"-1");const f=null!==(n=e.maxHeaderDepth)&&void 0!==n?n:1;p.setAttribute("aria-rowindex",t.tableRow.position+f+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=Ne(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)Ne(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"),qe(t,e,n),p.appendChild(n)}};b();const x=()=>{e.cellRegistry&&!d&&e.cellRegistry.set(`${l}-${o.accessor}`,{updateContent:t=>{m||(v(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)};pe(p,"mousedown",t=>{t.preventDefault(),t.target.closest(".st-expand-icon-container")||e.handleMouseDown(a)}),pe(p,"mouseover",t)}if(pe(p,"keydown",t=>{m||d||"F2"!==t.key&&"Enter"!==t.key||!o.isEditable||m||(t.preventDefault(),m=!0,b())}),pe(p,"dblclick",t=>{!o.isEditable||d||m||(m=!0,b())}),Ve.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=Ve.get(p))||void 0===n?void 0:n.current)&&void 0!==l?l:i,c=w(a,o.accessor);null===(d=e.onCellClick)||void 0===d||d.call(e,{accessor:o.accessor,colIndex:r,row:a,rowIndex:s,value:c})};pe(p,"click",t)}if(e.useHoverRowBackground){((t,e)=>{Ge.has(t)||Ge.set(t,new Set),Ge.get(t).add(e)})(s,p);const t=()=>{Ke(s,!1),Ue===s&&(Ue=null)};pe(p,"mouseenter",()=>{null!==Ue&&Ue!==s&&Ke(Ue,!1),Ke(s,!0),Ue=s}),pe(p,"mouseleave",t)}return p},_e=(t,e)=>{t.style.left="0",t.style.width="number"!=typeof e||0>e?"100%":e+"px"},Xe=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:X({position:n,rowHeight:o,heightOffsets:s,customTheme:r});_e(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},Qe=new WeakMap,Ze=new WeakMap,tn=t=>(Ze.has(t)||Ze.set(t,new Map),Ze.get(t)),en=(e,n,o,i=0,s,r)=>{var l,d,a,c,h;const p=o.pinned?null!==(d=null!==(l=o.containerWidth)&&void 0!==l?l:e.clientWidth)&&void 0!==d?d:0:null!==(h=null!==(c=null!==(a=o.mainSectionContainerWidth)&&void 0!==a?a:o.containerWidth)&&void 0!==c?c:e.clientWidth)&&void 0!==h?h: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=we(e),v=(t=>(Qe.has(t)||Qe.set(t,new Map),Qe.get(t)))(e),m=new Set(f.map(t=>u({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=Ge.get(t);n&&(n.delete(e),0===n.size&&Ge.delete(t))})(n,t),t.remove(),w.delete(e)}}),!r){const t=tn(e);v.forEach((e,n)=>{g.has(n)||(e.remove(),v.delete(n),t.delete(n))})}const b=document.createDocumentFragment(),y=[];f.forEach(t=>{var e,n,i,s;const l=u({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=Je(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=Ve.get(t);if(c&&(c.current=e.row),!e.header.expandable){const o=t.querySelector(".st-cell-content");o&&(o.innerHTML="",qe(e,n,o))}})(d,t,o),t.header.isSelectionColumn&&o.enableRowSelection&&o.isRowSelected){const e=o.isRowSelected(t.rowId);ae(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=x(t.rowId,t.depth,r,l,a);ve(d,c)}}}else y.push({cell:t,cellId:l})}),y.forEach(({cell:t,cellId:e})=>{const n=Ye(t,o);b.appendChild(n),w.set(e,n)}),b.childNodes.length>0&&e.appendChild(b),r||((e,n,o,i,s)=>{const r=tn(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(_e(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=X({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=Xe({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 nn(t,e){return t?"string"==typeof t?t:t instanceof HTMLElement?t.cloneNode(!0):"function"==typeof t?t(e):null:null}class on{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 Le(c,u,f,w),o||w===c.scrollLeft||(c.scrollLeft=w),!o&&c&&(c.__renderHeaderCells=t=>{c&&Le(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=s.filter(t=>!t.nestedTable&&!t.stateIndicator).length;this.nextColIndexMap.set(g,R.length>0&&C>0?p+R.length/C:p);const S=this.getCachedContext("body-"+g,d,l);return en(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&&en(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=p({calculatedHeight:n.calculatedHeight,customHeight:null==o?void 0:o.height,customTheme:e.customTheme}),s=Q({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:u}=e,{parentRow:f,expandableHeader:v,childAccessor:m,calculatedHeight:g}=n,b=v.nestedTable;if(!b)throw Error("createNestedGridRow: expandableHeader.nestedTable is missing");const x=w(f,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=p({calculatedHeight:g,customHeight:b.height,customTheme:s}),H=Q({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:u}),O=new Rn(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=Q({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, ${Q({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=nn(e.loadingStateRenderer,{parentRow:o.parentRow}):o.state.error&&e.errorStateRenderer?r=nn(e.errorStateRenderer,{error:o.state.error,parentRow:o.parentRow}):o.state.isEmpty&&e.emptyStateRenderer&&(r=nn(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=Q({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?Q({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:b(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),w=f&&f.deps.headersHash===h&&f.deps.collapsedHeadersSize===o.size&&f.deps.rowHeight===i&&f.deps.heightOffsetsHash===u&&(p?f.deps.fullTableRowsRef===d&&void 0!==f.deps.bandStart&&void 0!==f.deps.bandEnd&&((t,e)=>a>=t&&e>=c)(f.deps.bandStart,f.deps.bandEnd):f.deps.rowsRef===n);if(w&&f){if(!p)return f.cells;const t=new Map;n.forEach((e,n)=>{t.set(e.position,n)});const e=[];for(const n of f.cells){const o=t.get(n.tableRow.position);void 0!==o&&e.push(n.rowIndex!==o||n.isOdd!==(o%2==1)?Object.assign(Object.assign({},n),{rowIndex:o,isOdd:o%2==1}):n)}return e}let v,m,g;if(p){const t=d.length;m=Math.max(0,a-28),g=Math.min(t,c+28),v=d.slice(m,g)}else v=n;const b=this.calculateAbsoluteBodyCells(e,v,o,i,s,r,l);if(this.bodyCellsCache.set(t,{cells:b,deps:Object.assign({headersHash:h,rowsRef:v,collapsedHeadersSize:o.size,rowHeight:i,heightOffsetsHash:u},p&&{fullTableRowsRef:d,bandStart:m,bandEnd:g})}),!p)return b;const x=new Map;n.forEach((t,e)=>{x.set(t.position,e)});const y=[];for(const t of b){const e=x.get(t.tableRow.position);void 0!==e&&y.push(t.rowIndex!==e||t.isOdd!==(e%2==1)?Object.assign(Object.assign({},t),{rowIndex:e,isOdd:e%2==1}):t)}return y}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=>{_t(t)})):"context"===t&&(this.contextCache.clear(),this.headerCellsCache.clear(),this.headerSections.forEach(t=>{_t(t)})):(this.bodyCellsCache.clear(),this.headerCellsCache.clear(),this.contextCache.clear(),this.bodySections.forEach(t=>{(t=>{if(t){const e=we(t);e.forEach(t=>{t.remove()}),e.clear()}})(t)}),this.headerSections.forEach(t=>{_t(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 sn=(t,e)=>{"string"==typeof e?t.innerHTML=e:(t.innerHTML="",t.appendChild(e.cloneNode(!0)))},rn=(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(rn([t],e,n),!1===t.hide){i=!0;break}(t||i)&&(o.hide=!1)}},ln=t=>t.every(t=>t.hide),dn=t=>{t.forEach(t=>{t.children&&t.children.length>0&&(dn(t.children),ln(t.children)&&(t.hide=!0))})},an=(t,e)=>{const n=e.toLowerCase();return!!t.label.toLowerCase().includes(n)||!(!t.children||0>=t.children.length)&&t.children.some(t=>an(t,e))},cn=(t,e,n)=>{if(!e.trim())return t;const o=n||an;return t.filter(t=>!t.isSelectionColumn&&!t.excludeFromRender&&o(t,e))};function hn(t,e,n,o){e&&t.appendChild(e),t.appendChild(n),o&&t.appendChild(o)}function un(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 pn=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?un(y,H,n,C,S,I,u):hn(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?cn(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?cn(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=Mt(u,S),M=!H,k=document.createDocumentFragment(),E=16*i+"px",O=u.children&&u.children.length>0,T=!(u.hide||O&&u.children&&ln(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 $=document.createElement("div");$.className="st-header-checkbox-item",$.style.paddingLeft=E,$.draggable=!0;const L=t=>!(S.size>0&&!Et(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($.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 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)}}),$.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}=be(b,t.indexPath,i.indexPath);if(s)return void n();o=e}else{const{newHeaders:e,emergencyBreak:s}=be(b,t.indexPath,i.indexPath);if(s)return void n();o=e}L(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(yt("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=()=>{ve($,W,{ariaLabelWhenExpanded:`Collapse ${u.label} column`,ariaLabelWhenCollapsed:`Expand ${u.label} column`,syncAriaExpanded:!0})})}t.columnEditorConfig.rowRenderer||$.appendChild(e)}const j=ce({checked:T,onChange:t=>{if(!M)return;u.hide=!t,t?(rn(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,rn(n,u.children[0].accessor))):dn(n);const e=[...b];if(x(gt(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,G=!z&&"main"===f,V=!z&&"main"===f,U=()=>{const t=Pt(b,u.accessor,"left",S);t&&L(t)},K=()=>{const t=Pt(b,u.accessor,"right",S);t&&L(t)},J=()=>{const t=Pt(b,u.accessor,"main",S);t&&L(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:G,canPinRight:V,canUnpin:q,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===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(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="L",e.title="Pin column to left",e.addEventListener("click",t=>{t.stopPropagation(),U()}),t.appendChild(e)}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="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: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}=Ht(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?un(y,H,n,C,S,I,u):hn(y,C,S,I)),W()},destroy:()=>{R&&(R.removeEventListener("input",()=>{}),R.removeEventListener("click",()=>{})),x.removeEventListener("click",()=>{}),x.remove()}}},fn=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 g=0;v.forEach(t=>{const e="number"==typeof t.width?t.width:150;m.set(t.accessor,{left:g,width:e}),g+=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:b(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=Ye(l,a);p.appendChild(d)}),w.appendChild(p);const f=Xe({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},wn=(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 vn{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 on}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=bt(o.effectiveHeaders,"left")||bt(o.effectiveHeaders,void 0)||bt(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}=Re({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(bt(n.effectiveHeaders,"left")||bt(n.effectiveHeaders,void 0)||bt(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}=Re({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 $=0;const L=[];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,L.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,L.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,L.push(o),t.appendChild(o)}if(n.config.enableStickyParents&&e.stickyParents&&e.stickyParents.length>0){this.stickyParentsContainer&&(wn(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=fn({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=fn({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=fn({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&&(L.push(this.stickyParentsContainer),t.contains(this.stickyParentsContainer)||t.appendChild(this.stickyParentsContainer))}else this.stickyParentsContainer&&(wn(this.stickyParentsContainer,null!==(R=n.sectionScrollController)&&void 0!==R?R:null),this.stickyParentsContainer=null);Array.from(t.children).forEach(t=>{L.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?sn(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?sn(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=pn({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,e,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)?xe(this.horizontalScrollbarRef.current,{mainBodyRef:d.mainBodyRef.current,mainBodyWidth:e,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 xe(this.horizontalScrollbarRef.current,{mainBodyRef:d.mainBodyRef.current,mainBodyWidth:e,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:e,mainBodyWidth:o,pinnedLeftWidth:i,pinnedRightWidth:s,pinnedLeftContentWidth:r,pinnedRightContentWidth:l,tableBodyContainerRef:d,editColumns:a,sectionScrollController:c}=t;if(1>=e.scrollWidth-e.clientWidth)return null;const h=a?n: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:e,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&&(ye(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&&(ye(this.horizontalScrollbarRef.current,this.sectionScrollController),this.horizontalScrollbarRef.current=null),this.stickyParentsContainer&&(wn(this.stickyParentsContainer,this.sectionScrollController),this.stickyParentsContainer=null),this.sectionScrollController=null}}function mn(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:u=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:g({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 v=[],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=v.length,P=[...H,E],$=[...M,E],L=g({row:t,getRowId:o,depth:e,index:E,rowPath:P,rowIndexPath:$,groupingKey:A}),D=v.length,F={row:t,depth:e,displayPosition:S,groupingKey:A,position:W,isLastGroupRow:!1,rowId:L,rowPath:P,rowIndexPath:$,absoluteRowIndex:W,parentIndices:k.length>0?[...k]:void 0};v.push(F),y.push(F),S++;const j=b(L);if(x(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 m(n)?n:[]})(t,A),i=h.find(t=>t.expandable&&t.nestedTable);if((null==i?void 0:i.nestedTable)&&o.length>0){const n=v.length,s=(null===(O=i.nestedTable.customTheme)||void 0===O?void 0:O.rowHeight)||u,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=p({calculatedHeight:l,customHeight:i.nestedTable.height,customTheme:w});R.push([n,d-u]);const a=[...P,A];v.push({row:{},depth:e+1,displayPosition:S-1,groupingKey:A,position:n,isLastGroupRow:!1,rowId:a,rowPath:a,rowIndexPath:$,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=v.length,i=[...P,A];v.push({row:{},depth:e+1,displayPosition:S-1,groupingKey:A,position:o,isLastGroupRow:!1,rowId:i,rowPath:i,rowIndexPath:$,stateIndicator:{parentRowId:j,parentRow:t,state:n},absoluteRowIndex:o,parentIndices:[...k,D]})}else if(n.loading&&!d){const t=v.length,n=[...P,A,"loading-skeleton"];v.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,D]})}}else if(o.length>0){const t=[...P,A],n=[...$];I(o,e+1,t,n,[...k,D])}}0===e&&C.push(v.length)})};return I(e,0,[],[],[]),C.forEach((t,e)=>{const n=t-1;n>=0&&v.length>n&&(v[n].isLastGroupRow=!0)}),{flattenedRows:v,heightOffsets:R,paginatableRows:y,parentEndPositions:C}}const gn=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 bn{constructor(){this.lastHeadersRef=null,this.lastRowsRef=null,this.flattenedRowsCache=null,this.lastProcessedResult=null,this.processRowsScrollReuseKey=null,this.processRowsScrollReuseBase=null,this.lastScrollRafPaintedRange=null,this.scrollRafHeadersMemo=null,this.tableRenderer=new vn}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),t&&"all"!==t&&"body"!==t&&"context"!==t||(this.processRowsScrollReuseKey=null,this.processRowsScrollReuseBase=null,this.lastScrollRafPaintedRange=null,this.scrollRafHeadersMemo=null),t&&"all"!==t&&"header"!==t||(this.lastScrollRafPaintedRange=null,this.scrollRafHeadersMemo=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?I(s,{containerWidth:o}):I(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,n){var o,i,s,r,l,d,a,c,h,u,p,f,v,m,g,b,x,y,R,C,S;if(this.lastHeadersRef!==t.headers&&(this.invalidateCache("header"),this.invalidateCache("context"),this.lastHeadersRef=t.headers),!t.dimensionManager)return null;const I=t.dimensionManager.getState(),{containerWidth:H,calculatedHeaderHeight:M,maxHeaderDepth:k}=I,E=0===t.collapsedHeaders.size?"":[...t.collapsedHeaders].map(String).sort().join("\0");let O;t.positionOnlyBody&&!0!==t.config.autoExpandColumns&&this.scrollRafHeadersMemo&&this.scrollRafHeadersMemo.headersRef===t.headers&&this.scrollRafHeadersMemo.containerWidth===H&&this.scrollRafHeadersMemo.collapsedKey===E?O=this.scrollRafHeadersMemo.effectiveHeaders:(O=this.computeEffectiveHeaders(t.headers,t.config,t.customTheme,H),this.scrollRafHeadersMemo=!0!==t.config.autoExpandColumns?{headersRef:t.headers,containerWidth:H,collapsedKey:E,effectiveHeaders:O}:null);const{leftWidth:T,rightWidth:A}=Re({headers:O,containerWidth:H,collapsedHeaders:t.collapsedHeaders});t.config.autoExpandColumns&&H>0&&(O=$(O,{autoExpandColumns:!0,containerWidth:H,pinnedLeftWidth:T,pinnedRightWidth:A,mainBodyRef:null!==(o=t.mainBodyRef)&&void 0!==o?o:{current:null},isResizing:null!==(i=t.isResizing)&&void 0!==i&&i}));let W=t.localRows;if(t.sortManager?W=t.sortManager.getSortedRows():t.filterManager&&(W=t.filterManager.getFilteredRows()),this.lastRowsRef!==W&&(this.invalidateCache("body"),this.invalidateCache("context"),this.lastRowsRef=W),t.internalIsLoading&&0===W.length){let e=t.config.shouldPaginate&&null!==(s=t.config.rowsPerPage)&&void 0!==s?s:10;n.isMainSectionScrollable&&(e+=1),W=Array.from({length:e},()=>({}))}const P=null===(r=t.sortManager)||void 0===r?void 0:r.getState(),L=null===(l=t.filterManager)||void 0===l?void 0:l.getState(),D=(null==P?void 0:P.sort)?`${P.sort.key.accessor}-${P.sort.direction}`:"none",F=JSON.stringify((null==L?void 0:L.filters)||{}),j=t.config.quickFilter,B=j?`${null!==(d=j.text)&&void 0!==d?d:""}|${null!==(a=j.mode)&&void 0!==a?a:"simple"}`:"",N=this.flattenedRowsCache&&this.flattenedRowsCache.deps.rowsRef===W&&this.flattenedRowsCache.deps.quickFilterKey===B&&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===D&&this.flattenedRowsCache.deps.filterKey===F;let q,G,V;N&&this.flattenedRowsCache?(q=this.flattenedRowsCache.aggregatedRows,G=this.flattenedRowsCache.quickFilteredRows,V=this.flattenedRowsCache.flattenResult):(q=t.sortManager?W:z({rows:W,headers:t.headers,rowGrouping:t.config.rowGrouping}),G=(({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=w(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=w(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:q,headers:O,quickFilter:t.config.quickFilter}),V=mn({rows:G,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:O,rowHeight:t.customTheme.rowHeight,headerHeight:t.customTheme.headerHeight,customTheme:t.customTheme}),this.flattenedRowsCache={aggregatedRows:q,quickFilteredRows:G,flattenResult:V,deps:{rowsRef:W,quickFilterKey:B,expandedRowsSize:t.expandedRows.size,collapsedRowsSize:t.collapsedRows.size,expandedDepthsSize:t.expandedDepths.size,rowStateMapSize:t.rowStateMap.size,sortKey:D,filterKey:F}});const U=(({height:t,maxHeight:e,rowHeight:n,totalRowCount:o,headerHeight:i,footerHeight:s})=>{if(e){const t=gn(e);if(0===t)return;const r=i||n;if(t>=r+o*n+(s||0))return;return Math.max(0,t-r)}if(!t)return;const r=gn(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!==(c=t.config.shouldPaginate)&&void 0!==c&&c,rowsPerPage:null!==(h=t.config.rowsPerPage)&&void 0!==h?h:10,totalRowCount:null!==(u=t.config.totalRowCount)&&void 0!==u?u:V.paginatableRows.length,headerHeight:M,footerHeight:!t.config.shouldPaginate&&!t.config.footerRenderer||t.config.hideFooter?void 0:t.customTheme.footerHeight}),K=null!==(p=t.config.shouldPaginate)&&void 0!==p&&p,J=null!==(f=t.config.rowsPerPage)&&void 0!==f?f:10,Y=null!==(v=t.config.serverSidePagination)&&void 0!==v&&v,X=null!==(m=t.config.totalRowCount)&&void 0!==m?m:V.paginatableRows.length,Q=null!==(b=null===(g=t.config.rowGrouping)||void 0===g?void 0:g.join("\0"))&&void 0!==b?b:"",Z=null!==(y=null===(x=V.heightOffsets)||void 0===x?void 0:x.length)&&void 0!==y?y:0;let tt=0;if(V.heightOffsets)for(const[,t]of V.heightOffsets)tt+=t;const nt=void 0===U?"":`${N?1:0}|${U}|${n.currentPage}|${J}|${K}|${Y}|${t.customTheme.rowHeight}|${M}|${X}|${null!==(R=t.config.enableStickyParents)&&void 0!==R&&R}|${Q}|${V.flattenedRows.length}|${Z}|${tt}`;let ot;return t.positionOnlyBody&&void 0!==U&&null!==this.processRowsScrollReuseKey&&null!==this.processRowsScrollReuseBase&&this.processRowsScrollReuseKey===nt&&this.processRowsScrollReuseBase?ot=function(t,n){const{contentHeight:o,rowHeight:i,scrollDirection:s="none",scrollTop:r,enableStickyParents:l,rowGrouping:d}=n,a=e(i),{currentTableRows:c,paginatedHeightOffsets:h,heightMap:u}=t;let p,f,w,v,m=0,g=c.length;if(void 0===o)p=c,f=[],w=p,v=[];else{const t=_({bufferRowCount:a,contentHeight:o,tableRows:c,rowHeight:i,scrollTop:r,scrollDirection:s,heightMap:u});if(p=t.rendered.rows,m=t.rendered.startIndex,g=t.rendered.endIndex,l)if(d){const e=et(c,t.rendered.rows,t.fullyVisible.rows,t.partiallyVisible.rows,d);f=e.stickyParents,w=e.regularRows,v=t.partiallyVisible.rows}else f=[],w=t.rendered.rows,v=[];else f=[],w=p,v=[]}return{currentTableRows:c,rowsToRender:p,renderedStartIndex:m,renderedEndIndex:g,stickyParents:f,regularRows:w,partiallyVisibleRows:v,paginatedHeightOffsets:h,heightMap:u}}(this.processRowsScrollReuseBase,{contentHeight:U,rowHeight:t.customTheme.rowHeight,scrollTop:n.scrollTop,scrollDirection:n.scrollDirection,enableStickyParents:null!==(C=t.config.enableStickyParents)&&void 0!==C&&C,rowGrouping:t.config.rowGrouping}):(ot=function(t){const{contentHeight:n,currentPage:o,customTheme:i,enableStickyParents:s,flattenedRows:r,heightOffsets:l,parentEndPositions:d,rowHeight:a,rowsPerPage:c,scrollDirection:h="none",scrollTop:u,serverSidePagination:p,shouldPaginate:f,rowGrouping:w}=t,v=e(a),m=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})})}(r,d,o,c,f,p),g=l&&0!==l.length&&f&&!p?(()=>{const t=new Map;return m.forEach(e=>{e.nestedTable&&t.set(e.absoluteRowIndex,e.position)}),l.filter(([e])=>t.has(e)).map(([e,n])=>[t.get(e),n])})():l,b=g&&g.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}})(m.length,a,g,i):void 0;let x,y,R,C,S=0,I=m.length;if(void 0===n)x=m,y=[],R=x,C=[];else{const t=_({bufferRowCount:v,contentHeight:n,tableRows:m,rowHeight:a,scrollTop:u,scrollDirection:h,heightMap:b});if(x=t.rendered.rows,S=t.rendered.startIndex,I=t.rendered.endIndex,s)if(w){const e=et(m,t.rendered.rows,t.fullyVisible.rows,t.partiallyVisible.rows,w);y=e.stickyParents,R=e.regularRows,C=t.partiallyVisible.rows}else y=[],R=t.rendered.rows,C=[];else y=[],R=x,C=[]}return{currentTableRows:m,rowsToRender:x,renderedStartIndex:S,renderedEndIndex:I,stickyParents:y,regularRows:R,partiallyVisibleRows:C,paginatedHeightOffsets:g,heightMap:b}}({flattenedRows:V.flattenedRows,paginatableRows:V.paginatableRows,parentEndPositions:V.parentEndPositions,currentPage:n.currentPage,rowsPerPage:J,shouldPaginate:K,serverSidePagination:Y,contentHeight:U,rowHeight:t.customTheme.rowHeight,scrollTop:n.scrollTop,scrollDirection:n.scrollDirection,heightOffsets:V.heightOffsets,customTheme:t.customTheme,enableStickyParents:null!==(S=t.config.enableStickyParents)&&void 0!==S&&S,rowGrouping:t.config.rowGrouping}),void 0!==U?(this.processRowsScrollReuseKey=nt,this.processRowsScrollReuseBase={currentTableRows:ot.currentTableRows,paginatedHeightOffsets:ot.paginatedHeightOffsets,heightMap:ot.heightMap}):(this.processRowsScrollReuseKey=null,this.processRowsScrollReuseBase=null)),{dimensionState:I,containerWidth:H,effectiveHeaders:O,calculatedHeaderHeight:M,maxHeaderDepth:k,flattenResult:V,processedResult:ot}}render(t,e,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;const S=!0===o.positionOnlyBody;if(S&&null!==this.lastScrollRafPaintedRange&&C.renderedStartIndex===this.lastScrollRafPaintedRange.start&&C.renderedEndIndex===this.lastScrollRafPaintedRange.end)return;null===(u=o.rowSelectionManager)||void 0===u||u.updateConfig({tableRows:C.currentTableRows});const{mainWidth:I,leftWidth:H,rightWidth:M,leftContentWidth:k,rightContentWidth:E}=Re({headers:b,containerWidth:g,collapsedHeaders:o.collapsedHeaders}),O=g-H-M;if(!S){const e=t=>"number"==typeof t?t+"px":t,s=t.rootElement.style;if(o.config.maxHeight){const t=e(o.config.maxHeight);s.maxHeight=t,s.height=void 0===m.contentHeight?"auto":t}else s.removeProperty("max-height"),o.config.height?s.height=e(o.config.height):s.removeProperty("height");const{customTheme:r}=o;s.setProperty("--st-main-section-width",O+"px"),s.setProperty("--st-scrollbar-width",i.scrollbarWidth+"px"),s.setProperty("--st-editor-width",(o.config.editColumns?n:0)+"px"),s.setProperty("--st-border-width",r.borderWidth+"px"),s.setProperty("--st-footer-height",r.footerHeight+"px");const l=null!==(p=o.config.columnResizing)&&void 0!==p&&p;t.content.className="st-content "+(l?"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.lastScrollRafPaintedRange=S?{start:C.renderedStartIndex,end:C.renderedEndIndex}:null,this.registerSectionPanes(o);const T=o.sectionScrollController;T&&(T.setSectionScrollLeft("main",w),null!=o.pinnedLeftRef.current&&T.setSectionScrollLeft("pinned-left",o.pinnedLeftRef.current.scrollLeft),null!=o.pinnedRightRef.current&&T.setSectionScrollLeft("pinned-right",o.pinnedRightRef.current.scrollLeft),T.restoreAll()),S||(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,I,H,M,k,E,e.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 xn=t=>{if(null==t)return"";const e=t+"";return e.includes(",")||e.includes('"')||e.includes("\n")||e.includes("\r")?`"${e.replace(/"/g,'""')}"`:e};class yn{static createAPI(t){const e=()=>{var e;return(null===(e=t.getCachedFlattenResult)||void 0===e?void 0:e.call(t))||mn({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=()=>{o=!1,0!==n.size&&(n.forEach((e,n)=>{var o;const i=null===(o=t.cellRegistry)||void 0===o?void 0:o.get(n);i&&i.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=>xn(t.label)).join(","),s=t.map((t,e)=>{const n=t.row;return o.map((t,o)=>{const i=w(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 xn(r)}if(!1!==t.useFormattedValueForCSV&&t.valueFormatter){const s=t.valueFormatter({accessor:t.accessor,colIndex:o,row:n,rowIndex:e,value:i});return xn(s)}return xn(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:()=>Tt(t.headers),applyPinnedState:async e=>{const n=Wt(t.headers,e,t.essentialAccessors);n&&(t.setHeaders(n),t.onRender())},resetColumns:()=>{t.setHeaders(gt(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 Mt(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 Rn{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=$t.mergeCustomTheme(e),this.mergedColumnEditorConfig=$t.mergeColumnEditorConfig(e),this.resolvedIcons=$t.resolveIcons(e),this.localRows=[...e.rows],this.headers=[...e.defaultHeaders],this.essentialAccessors=$t.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=$t.getInitialCollapsedHeaders(e.defaultHeaders),this.expandedDepths=$t.getInitialExpandedDepths(e),this.domManager=new Lt,this.renderOrchestrator=new bn,this.rebuildRowIndexMap(),this.initializeManagers()}rebuildRowIndexMap(){this.rowIndexMap.clear(),this.localRows.forEach((t,e)=>{const n=g({row:t,getRowId:this.config.getRowId,depth:0,index:e,rowPath:[e],rowIndexPath:[e]}),o=b(n);this.rowIndexMap.set(o,e)})}initializeManagers(){var t,e,n;this.ariaAnnouncementManager=new vt,this.ariaAnnouncementManager.subscribe(t=>{this.announcement=t,this.updateAriaLiveRegion()}),this.expandedDepthsManager=new wt(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 q({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 K({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 dt({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=mt(e.tableBodyContainerRef.current);const o=this.renderOrchestrator.computeEffectiveHeaders(this.headers,this.config,this.customTheme);this.dimensionManager=new D({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 F({onLoadMore:this.config.onLoadMore,infiniteScrollThreshold:200}),this.sectionScrollController=new j({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 pt({headerContainer:e.headerContainerRef.current,mainSection:e.tableBodyContainerRef.current,scrollbarWidth:this.scrollbarWidth}),this.scrollbarVisibilityManager.subscribe(t=>{this.isMainSectionScrollable=t,this.render("scrollbarVisibilityManager")})),this.windowResizeManager=new ht,this.windowResizeManager.addCallback(()=>{var t;if(e.tableBodyContainerRef.current){const n=mt(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 ct({tableRows:[],onRowSelectionChange:this.config.onRowSelectionChange,enableRowSelection:!0}),this.rowSelectionManager.subscribe(()=>{this.render("rowSelectionManager")})),this.selectionManager&&(this.handleOutsideClickManager=new ut({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,requestAnimationFrame(()=>{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.config.onLoadMore?this.scrollManager.handleScroll(n,e.scrollLeft,e.clientHeight,e.scrollHeight):this.scrollManager.handleScroll(n,e.scrollLeft,0,0)),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=gt(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=$t.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=$t.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 yn.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=gt(t),this.renderOrchestrator.invalidateCache("header")},setCurrentPage:t=>{this.currentPage=t},setColumnEditorOpen:t=>{this.columnEditorOpen=t,this.render("columnEditor-toggle")}})}}exports.SimpleTableVanilla=Rn,exports.asRows=function(t){return t};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|