simple-table-core 4.0.9 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/styles.css +1 -1
- package/dist/icons/MinusIcon.d.ts +2 -0
- package/dist/icons/index.d.ts +1 -0
- package/dist/index.es.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/utils/columnEditor/columnEditorUtils.d.ts +3 -0
- package/dist/utils/columnEditor/createCheckbox.d.ts +7 -2
- package/package.json +1 -1
- package/src/styles/base.css +11 -4
package/dist/index.es.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const t="parentExpanded",e={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};function n(t){var e;return(null===(e=t.children)||void 0===e?void 0:e.length)?Object.assign(Object.assign({},t),{children:t.children.map(n)}):t}function i(t){return t.map(n)}function o(t){if(!t.columns)throw Error("SimpleTable requires `columns`");return Object.assign(Object.assign({},t),{columns:i(t.columns)})}function s(t){return void 0!==t.columns?Object.assign(Object.assign({},t),{columns:i(t.columns)}):Object.assign({},t)}const r=new WeakMap,l=(t,e,n)=>{const i=(t=>{let e=r.get(t);return e||(e=new Map,r.set(t,e)),e})(t);let o=i.get(e);o||(o=document.createElement("div"),o.className="st-aria-row",o.setAttribute("role","row"),o.style.display="contents",t.appendChild(o),i.set(e,o));const s=n+"";return o.getAttribute("aria-rowindex")!==s&&o.setAttribute("aria-rowindex",s),o},a=t=>{const e=r.get(t);e&&e.forEach((t,n)=>{0===t.childElementCount&&(t.remove(),e.delete(n))})},d=t=>{const e=r.get(t);e&&(e.forEach(t=>t.remove()),e.clear())},c=new WeakMap,h=(t,e,n,i)=>{t.addEventListener(e,n,i),c.has(t)||c.set(t,[]),c.get(t).push({event:e,handler:n,options:i})},u=new WeakMap,f=t=>(u.has(t)||u.set(t,new Map),u.get(t)),v=(t,e)=>{if(t){const n=f(t);n.forEach(t=>{null==e||e(t),t.remove()}),n.clear(),d(t)}},p=new WeakMap;let w=0,m=Date.now(),g={screenX:0,screenY:0},b=null;const x=t=>{m=t},y=new WeakMap,R=t=>(y.has(t)||y.set(t,new Map),y.get(t)),S=new WeakMap,C=t=>(S.has(t)||S.set(t,new Map),S.get(t)),M=(t,e)=>{const n=Date.now();0!==w&&e>n-w||(w=n,t())},I=(t,e,n,i)=>{t.addEventListener(e,n,i),p.has(t)||p.set(t,[]),p.get(t).push({event:e,handler:n,options:i})},H=t=>{const e=t.closest(".simple-table-root");null==e||e.querySelectorAll(".st-tooltip").forEach(t=>t.remove())},k=.5,T="st-cell-animating-out",E="data-animating-out",A="data-shrinking-out",O=t=>{const e=f(t),n=R(t);if(0===e.size)return n;if(0===n.size)return e;const i=new Map(e);return n.forEach((t,e)=>i.set(e,t)),i};class W{constructor(t={}){var e,n;this.enabled=!1,this.snapshot=null,this.incomingOrigins=null,this.accordionPreVisibleAccessors=null,this.inFlight=new Map,this.retainedCells=new Map,this.scrollerMetricsCache=new WeakMap,this.externalVerticalScroll=null,this.scheduledFlip=null,this.duration=null!==(e=t.duration)&&void 0!==e?e:400,this.easing=null!==(n=t.easing)&&void 0!==n?n:"ease-out",this.prefersReducedMotion=j()}setOnHostDiscard(t){this.onHostDiscard=t}setEnabled(t){this.enabled!==t&&(this.enabled=t,t||this.cancel())}setDuration(t){Number.isFinite(t)&&t>0&&(this.duration=t)}setEasing(t){"string"==typeof t&&t.length>0&&(this.easing=t)}isEnabled(){return this.enabled&&!this.prefersReducedMotion}isInFlight(t){return this.inFlight.has(t)}hasInFlight(){return this.inFlight.size>0}getDuration(){return this.duration}getEasing(){return this.easing}setIncomingOrigins(t){this.incomingOrigins=this.isEnabled()&&t&&t.size>0?t:null}setAccordionPreVisibleAccessors(t){this.accordionPreVisibleAccessors=this.isEnabled()&&t&&t.size>0?t:null}wasRenderableBeforeAccordion(t){var e,n;return null!==(n=null===(e=this.accordionPreVisibleAccessors)||void 0===e?void 0:e.has(t))&&void 0!==n&&n}getScrollerMetrics(t){let e=this.scrollerMetricsCache.get(t);if(!e){const n=$(t);e=this.externalVerticalScroll?Object.assign(Object.assign({},n),{clientHeight:this.externalVerticalScroll.clientHeight,scrollHeight:this.externalVerticalScroll.scrollHeight,scrollTop:this.externalVerticalScroll.scrollTop}):n,this.scrollerMetricsCache.set(t,e)}return e}setExternalVerticalScroll(t){this.externalVerticalScroll=t,this.clearScrollerMetricsCache()}clearScrollerMetricsCache(){this.scrollerMetricsCache=new WeakMap}captureSnapshot(t){var e;if(!this.isEnabled())return void(this.snapshot=null);this.clearScrollerMetricsCache();const n=new Map;for(const i of t.containers){if(!i)continue;const o=i.getBoundingClientRect(),s=o.left,r=o.top;O(i).forEach((t,e)=>{n.has(e)||n.set(e,this.readPosition(e,t,i,s,r))});const l=this.retainedCells.get(i);l&&l.forEach((t,e)=>{n.has(e)||n.set(e,this.readPosition(e,t,i,s,r))});const a=null===(e=t.preLayouts)||void 0===e?void 0:e.get(i);a&&a.forEach((t,e)=>{n.has(e)||n.set(e,{sourceContainer:null,sourceContainerLeft:0,sourceContainerTop:0,left:t.left,top:t.top,styleTop:t.top,styleLeft:t.left,fromDom:!1})})}this.snapshot=n.size>0?n:null}shouldRetain(t){var e;return!!(null===(e=this.snapshot)||void 0===e?void 0:e.has(t))}hasSnapshotEntry(t){var e;return!!(null===(e=this.snapshot)||void 0===e?void 0:e.has(t))}hasSnapshotEntryInContainer(t,e){var n;const i=null===(n=this.snapshot)||void 0===n?void 0:n.get(t);return!!i&&(null===i.sourceContainer||i.sourceContainer===e)}shouldAnimateVerticalTransition(t){const e=this.getScrollerMetrics(t.container),n=F(t.beforeTop,t.cellHeight,e),i=F(t.afterTop,t.cellHeight,e);return n||i}shouldAnimateHorizontalTransition(t){const e=this.getScrollerMetrics(t.container),n=L(t.beforeLeft,t.cellWidth,e),i=L(t.afterLeft,t.cellWidth,e);return n||i}shouldAnimateTransition(t){const e=Math.abs(t.beforeTop-t.afterTop)>=k,n=Math.abs(t.beforeLeft-t.afterLeft)>=k;return!(!e||!this.shouldAnimateVerticalTransition({beforeTop:t.beforeTop,afterTop:t.afterTop,cellHeight:t.cellHeight,container:t.container}))||!(!n||!this.shouldAnimateHorizontalTransition({beforeLeft:t.beforeLeft,afterLeft:t.afterLeft,cellWidth:t.cellWidth,container:t.container}))}shouldMountIncomingCell(t){var e;const n=null===(e=this.snapshot)||void 0===e?void 0:e.get(t.cellId);if(!n)return!0;const i=this.getScrollerMetrics(t.container),o=F(n.styleTop,t.cellHeight,i),s=F(t.afterTop,t.cellHeight,i),r=L(n.styleLeft,t.cellWidth,i),l=L(t.afterLeft,t.cellWidth,i);return o||s||r||l}isCellRenderedInScrollerViewport(t,e){const n=t.getBoundingClientRect();if(0===n.width&&0===n.height)return!1;const i=e.getBoundingClientRect(),o=n.right>i.left&&i.right>n.left,s=this.externalVerticalScroll?null:e.parentElement;if(!s)return o;const r=s.getBoundingClientRect();return o&&n.bottom>r.top&&r.bottom>n.top}shouldRetainDomCellAtScrollExtrema(t,e){var n;const i=null===(n=this.snapshot)||void 0===n?void 0:n.get(t);if(!i||null===i.sourceContainer)return!1;const o=this.getScrollerMetrics(e);if(o.clientHeight>=o.scrollHeight)return!1;const s=o.scrollTop+o.clientHeight>=o.scrollHeight-1,r=1>=o.scrollTop;if(!s&&!r)return!1;const l=o.clientHeight;return!(!s||o.scrollTop-l>i.styleTop)||!(!r||i.styleTop>o.scrollTop+l)}retainCell(t){var e;const{cellId:n,element:i,container:o,newPosition:s}=t,r=P(i.style.top),l=P(i.style.left),a=this.getScrollerMetrics(o),d=D(s.top,r,s.height,a,"y"),c=D(s.left,l,s.width,a,"x");let h=this.retainedCells.get(o);h||(h=new Map,this.retainedCells.set(o,h));const u=h.get(n);u&&u!==i&&(this.cancelInFlight(n),null===(e=this.onHostDiscard)||void 0===e||e.call(this,u),u.remove()),i.id&&i.removeAttribute("id"),i.classList.add(T),i.setAttribute(E,"true"),i.style.left=c+"px",i.style.top=d+"px",i.style.width=s.width+"px",i.style.height=s.height+"px",i.style.pointerEvents="none",h.set(n,i)}claimRetainedForReuse(t,e){var n,i;const o=this.retainedCells.get(e);if(!o)return null;const s=o.get(t);return s?s.hasAttribute(A)?(this.cancelInFlight(t),o.delete(t),null===(n=this.snapshot)||void 0===n||n.delete(t),null===(i=this.onHostDiscard)||void 0===i||i.call(this,s),s.remove(),null):(this.cancelInFlight(t),o.delete(t),s.classList.remove(T),s.removeAttribute(E),s.id=t,s.style.pointerEvents="",s):null}shrinkOutCell(t){var e;const{cellId:n,element:i,container:o,axis:s}=t;this.cancelInFlight(n);let r=this.retainedCells.get(o);r||(r=new Map,this.retainedCells.set(o,r));const l=r.get(n);l&&l!==i&&(this.cancelInFlight(n),null===(e=this.onHostDiscard)||void 0===e||e.call(this,l),l.remove()),i.id&&i.removeAttribute("id"),i.classList.add(T),i.setAttribute(E,"true"),i.setAttribute(A,"true"),i.style.pointerEvents="none","horizontal"===s?i.style.width="0px":i.style.height="0px",r.set(n,i);const a=window.setTimeout(()=>{var t;const e=this.retainedCells.get(o);e&&e.get(n)===i&&e.delete(n),null===(t=this.onHostDiscard)||void 0===t||t.call(this,i),i.remove()},this.duration+80);this.inFlight.set(n,{element:i,cleanupTimeout:a,transitionEndHandler:()=>{},isRetained:!0})}discardRetainedIfPresent(t,e){var n;const i=this.retainedCells.get(e);if(!i)return;const o=i.get(t);o&&(this.cancelInFlight(t),i.delete(t),null===(n=this.onHostDiscard)||void 0===n||n.call(this,o),o.remove())}play(t){const e=this.snapshot,n=this.incomingOrigins;if(this.snapshot=null,this.incomingOrigins=null,!this.isEnabled()||!e)return void this.retainedCells.forEach(t=>{t.forEach((e,n)=>{var i;this.inFlight.has(n)||(null===(i=this.onHostDiscard)||void 0===i||i.call(this,e),e.remove(),t.delete(n))})});const i=[],o=new Set,s=new Map,r=(t,r,l,a)=>{var d,c;if(o.has(r))return;if(l&&t.hasAttribute(A))return void o.add(r);let h=e.get(r);if(!h&&!l&&n){const t=n.get(r);t&&(h={sourceContainer:null,sourceContainerLeft:0,sourceContainerTop:0,left:t.left,top:t.top,styleTop:t.top,styleLeft:t.left,fromDom:!1})}if(!h)return;if(!l&&null!==h.sourceContainer&&h.sourceContainer!==a)return void o.add(r);if(t.querySelector(".st-cell-editing"))return;const u=P(t.style.left),f=P(t.style.top);if(!l&&this.inFlight.has(r)&&k>Math.abs(h.styleTop-f)&&k>Math.abs(h.styleLeft-u))return void o.add(r);const v=l||h.fromDom,p=v?0:P(t.style.height)||t.offsetHeight||0,w=v?0:P(t.style.width)||t.offsetWidth||0,m=v?null:this.getScrollerMetrics(a),g=v||!m?h.top:D(h.top,f,p,m,"y"),b=v||!m?h.left:D(h.left,u,w,m,"x"),x=null!=m?m:this.getScrollerMetrics(a),y=P(t.style.height)||t.offsetHeight||p||0;let R=g;const S=!!x&&F(f,y,x);if(!l&&x&&S){const t=x.scrollTop,e=x.scrollTop+x.clientHeight;(l||null!==h.sourceContainer||h.fromDom||Math.abs(g-f)>=k&&!F(g,y,x))&&F(g,y,x)||(R=g>f?e:t-y)}let C=0;if(null!==h.sourceContainer){const t=(t=>{let e=s.get(t);if(!e){const n=t.getBoundingClientRect();e={left:n.left,top:n.top},s.set(t,e)}return e})(a);C=t.left-h.sourceContainerLeft}let M=b-u-C,I=R-f-0;k>Math.abs(M)&&k>Math.abs(I)?l&&(this.cancelInFlight(r),null===(d=this.retainedCells.get(a))||void 0===d||d.delete(r),null===(c=this.onHostDiscard)||void 0===c||c.call(this,t),t.remove()):(i.push({cellId:r,element:t,dx:M,dy:I,isRetained:l}),o.add(r))};for(const e of t.containers){if(!e)continue;const t=this.retainedCells.get(e);t&&t.forEach((t,n)=>{r(t,n,!0,e)}),O(e).forEach((t,n)=>{r(t,n,!1,e)})}if(this.scheduledFlip){cancelAnimationFrame(this.scheduledFlip.rafId);for(const{element:t}of this.scheduledFlip.pending)t.style.transition="none",t.style.transform="",t.style.willChange="";this.scheduledFlip=null}for(const{cellId:t,element:e,dx:n,dy:o}of i)this.cancelInFlight(t),e.style.transition="none",e.style.transform=`translate3d(${n}px, ${o}px, 0)`,e.style.willChange="transform";if(0===i.length)return;const l=requestAnimationFrame(()=>{const t=requestAnimationFrame(()=>{this.scheduledFlip=null;for(const{cellId:t,element:e,isRetained:n}of i)e.isConnected&&this.startTransition(t,e,n)});this.scheduledFlip&&(this.scheduledFlip.rafId=t)});this.scheduledFlip={rafId:l,pending:i}}cancel(){this.snapshot=null,this.incomingOrigins=null,this.accordionPreVisibleAccessors=null,this.clearScrollerMetricsCache(),this.scheduledFlip&&(cancelAnimationFrame(this.scheduledFlip.rafId),this.scheduledFlip=null);const t=Array.from(this.inFlight.entries());this.inFlight.clear();for(const[e,n]of t)window.clearTimeout(n.cleanupTimeout),n.element.removeEventListener("transitionend",n.transitionEndHandler),this.finishElement(e,n.element,n.isRetained);this.retainedCells.forEach(t=>{t.forEach(t=>{var e;null===(e=this.onHostDiscard)||void 0===e||e.call(this,t),t.remove()}),t.clear()}),this.retainedCells.clear()}destroy(){this.cancel()}readPosition(t,e,n,i,o){const s=P(e.style.top),r=P(e.style.left);if(this.inFlight.get(t)){const t=e.getBoundingClientRect(),l=e.offsetParent;if(l){const e=l.getBoundingClientRect();return{sourceContainer:n,sourceContainerLeft:i,sourceContainerTop:o,left:t.left-e.left+l.scrollLeft,top:t.top-e.top+l.scrollTop,styleTop:s,styleLeft:r,fromDom:!0}}return{sourceContainer:n,sourceContainerLeft:i,sourceContainerTop:o,left:t.left,top:t.top,styleTop:s,styleLeft:r,fromDom:!0}}return{sourceContainer:n,sourceContainerLeft:i,sourceContainerTop:o,left:r,top:s,styleTop:s,styleLeft:r,fromDom:!1}}startTransition(t,e,n){e.style.transition=`transform ${this.duration}ms ${n?"ease-in":this.easing}`,e.style.transform="translate3d(0, 0, 0)",n||(e.style.pointerEvents="none");const i=n=>{"transform"===n.propertyName&&this.finalizeCell(t,e)};e.addEventListener("transitionend",i);const o=window.setTimeout(()=>{this.finalizeCell(t,e)},this.duration+80);this.inFlight.set(t,{element:e,cleanupTimeout:o,transitionEndHandler:i,isRetained:n})}cancelInFlight(t){const e=this.inFlight.get(t);e&&(window.clearTimeout(e.cleanupTimeout),e.element.removeEventListener("transitionend",e.transitionEndHandler),this.inFlight.delete(t))}finalizeCell(t,e){var n;const i=this.inFlight.get(t),o=null!==(n=null==i?void 0:i.isRetained)&&void 0!==n?n:this.isCellRetained(e);i&&(window.clearTimeout(i.cleanupTimeout),i.element.removeEventListener("transitionend",i.transitionEndHandler),this.inFlight.delete(t)),this.finishElement(t,e,o)}finishElement(t,e,n){var i;if(n)return this.retainedCells.forEach(n=>{n.get(t)===e&&n.delete(t)}),null===(i=this.onHostDiscard)||void 0===i||i.call(this,e),void e.remove();e.style.transition="",e.style.transform="",e.style.willChange="",e.style.pointerEvents=""}isCellRetained(t){return t.hasAttribute(E)}}const P=t=>{if(!t)return 0;const e=parseFloat(t);return Number.isFinite(e)?e:0},$=t=>{const e=t.parentElement;return{clientHeight:e?e.clientHeight:0,scrollHeight:e?e.scrollHeight:0,scrollTop:e?e.scrollTop:0,clientWidth:t.clientWidth,scrollWidth:t.scrollWidth,scrollLeft:t.scrollLeft}},F=(t,e,n)=>{const i=n.clientHeight;return 0>=i||i>=n.scrollHeight||t>=n.scrollTop&&n.scrollTop+i>t},L=(t,e,n)=>{const i=n.clientWidth;return 0>=i||i>=n.scrollWidth||t>=n.scrollLeft&&n.scrollLeft+i>t},D=(t,e,n,i,o)=>{const s="y"===o?i.clientHeight:i.clientWidth;if(0>=s||s>=("y"===o?i.scrollHeight:i.scrollWidth))return t;const r=t-e,l=Math.abs(r);if(0===l)return t;const a=n>0?n:0,d="y"===o?i.scrollTop:i.scrollLeft;if(t>=d-a&&d+s>=t)return t;const c=s+a;if(c>=l)return t;const h=l-c,u=c+s*h/(h+10*c);return e+Math.sign(r)*u},j=()=>{if("undefined"==typeof window||"function"!=typeof window.matchMedia)return!1;try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch(t){return!1}},N=t=>Math.ceil(800/(t+1)),B=29.5,z=(t,e=!0)=>t&&e?B:0,V=(t,e=!0)=>!(!t||!e),q=150,G=["lineAreaChart","barChart"],K=500,_=40,U=(t,e,n)=>e&&n?480>t?.25:768>t?.3:.4:(t=>480>t?.4:768>t?.5:.6)(t),J=(t,e)=>{if(!t.children||0===t.children.length)return[e];const n=[],i=(t,e)=>{if(!t.children||0===t.children.length)return n.push(e),e+1;let o=e;for(const e of t.children)o=i(e,o);return o};return i(t,e),n},Y=t=>t.flatMap(t=>t.children&&0!==t.children.length?Y(t.children):[t]),X=t=>t.flatMap(t=>{const e=[t];return t.children&&t.children.length>0&&e.push(...X(t.children)),e}),Q=(t=0)=>t?t+1:0,Z=t=>!(!t.hide&&!t.excludeFromRender),tt=(t,e)=>{const n=X(t);for(const t of n)if(t.children&&t.children.length>0&&t.children.some(t=>t.accessor===e))return t;return null},et=(e,n,i)=>{const o=tt(n,e.accessor);if(o){const n=i.has(o.accessor),s=e.showWhen||t;return n?"parentExpanded"===s:"parentCollapsed"===s}return!1},nt=t=>{var e;return!(!(null===(e=t.children)||void 0===e?void 0:e.length)||!t.collapsible)},it=(t,e,n)=>{if(!t.children||0===t.children.length)return 1;const i=Y(t.children);let o=0;for(const t of i)Z(t)||et(t,e,n)||(o+=1);return o},ot=({accessor:t,rowId:e})=>`${e}-${t}`,st=new WeakSet,rt=t=>st.has(t),lt=t=>{if(t)return e=>{if(!rt(e.row))return t(e)}},at=({calculatedHeight:t,customHeight:e,customTheme:n})=>e?("string"==typeof e?parseFloat(e):e)+n.nestedGridPaddingTop+n.nestedGridPaddingBottom:t,dt=t=>{const e=t.match(/^(.+?)\[(\d+)\]$/);return e?{key:e[1],index:parseInt(e[2],10)}:{key:t,index:null}},ct=(t,e)=>{const n=e+"";return n.includes(".")||n.includes("[")?n.split(".").reduce((t,e)=>{if(null==t)return;const{key:n,index:i}=dt(e);let o=t[n];return null!==i&&Array.isArray(o)&&(o=o[i]),o},t):t[e]},ht=(t,e)=>{if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;t.length>n;n++)if(t[n]!==e[n])return!1;return!0},ut=(t,e,n)=>{const i=e+"";if(!i.includes(".")&&!i.includes("["))return void(t[e]=n);const o=i.split(".");let s=t;for(let t=0;o.length-1>t;t++){const{key:e,index:n}=dt(o[t]);if(null==s[e]){const n=dt(o[t+1]);s[e]=null!==n.index?[]:{}}if(s=s[e],null!==n){if(!Array.isArray(s))throw Error(`Expected array at ${o.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}=dt(o[o.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},ft=t=>Array.isArray(t)&&t.length>0&&"object"==typeof t[0]&&null!==t[0],vt=t=>{const{getRowId:e,rowPath:n}=t,i=[...n];if(e){const n=e({row:t.row,depth:t.depth,index:t.index,rowPath:t.rowPath,rowIndexPath:t.rowIndexPath,groupingKey:t.groupingKey});null!=n&&""!==n&&i.push(n)}return i},pt=t=>t.join("-"),wt=new WeakMap;let mt=0;const gt=t=>{const{getRowId:e}=t,n=e?e({row:t.row,depth:t.depth,index:t.index,rowPath:t.rowPath,rowIndexPath:t.rowIndexPath,groupingKey:t.groupingKey}):void 0,i=null!=n&&""!==n?n+"":(t=>{if(t&&"object"==typeof t){const e=wt.get(t);if(void 0!==e)return e;const n="__row_"+ ++mt;return wt.set(t,n),n}return"__row_p_"+t})(t.row),o=[];return t.parentStableKey&&o.push(t.parentStableKey),t.groupingKey&&t.depth>0&&o.push(t.groupingKey),o.push(i),o.join("/")},bt=t=>t.stableRowKey?t.stableRowKey:pt(t.rowId),xt=(t,e)=>`${t+""}nested-chrome${(null!=e?e:"")+""}`,yt=(t,e)=>!!e&&ft(t[e]),Rt=(t,e,n,i,o)=>{const s=t+"",r=i.has(s)&&i.get(s)===e,l=o.has(s)&&o.get(s)===e;return n.has(e)?!l:r},St=(e,n)=>{if(Z(e))return[];if(!e.children||0===e.children.length)return[e];if(n&&n.has(e.accessor)){const i=e.children.filter(e=>{const n=e.showWhen||t;return"parentCollapsed"===n||"always"===n});return e.singleRowChildren?0===i.length?[e]:[e,...i.flatMap(t=>St(t,n))]:0===i.length?[e]:i.flatMap(t=>St(t,n))}const i=e.children.filter(e=>{const n=e.showWhen||t;return"parentExpanded"===n||"always"===n});return e.singleRowChildren?[e,...i.flatMap(t=>St(t,n))]:i.flatMap(t=>St(t,n))};function Ct(t){if(Z(t))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"auto"===e.toLowerCase()?{type:"auto"}: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 Mt(t){const e=[],n=t=>{Z(t)||(t.children&&0!==t.children.length?(t.singleRowChildren&&e.push(t),t.children.forEach(n)):e.push(t))};return t.forEach(n),e}function It(t,e){const n=t.map(t=>Ct(t)),i=n.reduce((t,e)=>"px"===(null==e?void 0:e.type)?t+e.value:t,0),o=n.reduce((t,e)=>"pct"===(null==e?void 0:e.type)?t+e.value:t,0),s=e*(o/100),r=n.reduce((t,e)=>"fr"===(null==e?void 0:e.type)?t+e.value:t,0),l=r>0?Math.max(0,e-i-s)/r:150,a=new Map;return t.forEach((t,i)=>{const o=n[i];if(o)if("auto"===o.type)a.set(t.accessor,Math.max(q,"number"==typeof t.minWidth?t.minWidth:"string"==typeof t.minWidth&&parseFloat(t.minWidth+"")||0));else if("px"===o.type)a.set(t.accessor,o.value);else if("fr"===o.type){const e=o.value*l,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"===o.type?e*o.value/100:q);else a.set(t.accessor,q)}),a}function Ht(t,e){const n="object"==typeof e&&null!=e?e.containerWidth:void 0;let i,o="number"==typeof e?e:void 0;if(null!=n&&n>0){const e=Mt(t);i=It(e,n)}else{const e=Mt(t),n=e.map(t=>Ct(t));let s=o;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)}i=It(e,s)}return t.map(function t(e){const n=Object.assign({},e),o=i.get(e.accessor);return null!=o&&(n.width=o),e.children&&e.children.length>0&&(n.children=e.children.map(t)),n})}const kt=t=>{if(Z(t))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(ot({accessor:t.accessor,rowId:"header"}));return(null==e?void 0:e.offsetWidth)||q}},Tt=t=>{var e;const n=t.width;"string"==typeof n&&n.includes("fr")&&(t.width=(null===(e=document.getElementById(ot({accessor:t.accessor,rowId:"header"})))||void 0===e?void 0:e.offsetWidth)||q),t.children&&t.children.length>0&&t.children.forEach(t=>{Tt(t)})},Et=t=>"number"==typeof t.minWidth?t.minWidth:_,At=(t,e)=>{const n=[];return t.forEach(t=>{Z(t)||n.push(...St(t,e))}),n},Ot=t=>t instanceof HTMLElement?t:document.body,Wt=t=>t.replace(/["\\]/g,"\\$&"),Pt=t=>t.includes("\n")||t.includes("\r")?t.split(/\r\n|\r|\n/):[t],$t=(t,e)=>{const n=document.createElement("span");n.style.visibility="hidden",n.style.position="absolute",n.style.whiteSpace="nowrap",n.style.width="auto";const i=window.getComputedStyle(e);n.style.font=i.font,n.style.fontSize=i.fontSize,n.style.fontWeight=i.fontWeight,n.style.fontFamily=i.fontFamily,n.style.letterSpacing=i.letterSpacing,n.style.padding=i.padding,document.body.appendChild(n);let o=0;for(const e of Pt(t))n.textContent=e,o=Math.max(o,n.offsetWidth);return document.body.removeChild(n),o},Ft=(t,e,n="st-icon-container")=>{const i=document.createElement("div");i.className=n,i.style.visibility="hidden",i.style.position="absolute",i.style.top="-99999px",i.style.left="-99999px","string"==typeof t?i.innerHTML=t:i.appendChild(t.cloneNode(!0));const o=Ot(e);o.appendChild(i);const s=window.getComputedStyle(i),r=i.offsetWidth+(parseFloat(s.marginLeft)||0)+(parseFloat(s.marginRight)||0);return o.removeChild(i),r+4},Lt=(t,e)=>{var n,i,o,s,r,l,a;const{rows:d,header:c,maxWidth:h=K,headSampleSize:u,stridedSampleSize:f,sampleSize:v,outlierPercentile:p,outlierThreshold:w,autoSizeMode:m=(null!==(n=null==c?void 0:c.autoSizeMode)&&void 0!==n?n:"content"),theme:g,styleRoot:b,sortIcon:x,expandIcon:y,onRendererHostDiscard:R}=e||{},S=null!==(i=null!=u?u:v)&&void 0!==i?i:25,C=null!=f?f:null!=v?0:75,M=null!=b?b:document,I=ot({accessor:t,rowId:"header"}),H=M instanceof HTMLElement?M.querySelector(`[id="${Wt(I)}"]`):document.getElementById(I),k=null!=H?H:M.querySelector(".st-header-cell");if(!k)return{width:q,settled:!0};const T=window.getComputedStyle(k),E=parseFloat(T.paddingLeft)||0,A=parseFloat(T.paddingRight)||0,O=parseFloat(T.gap)||0;let W=E+A,P=!(null==c?void 0:c.headerRenderer);const $=null==H?void 0:H.querySelector(".st-header-label");let F=!1,L=!1;if($){const t=$.querySelector(".st-header-label-text");if((null==c?void 0:c.headerRenderer)||!t){const t=((t,e)=>{const n=document.createElement("div");n.style.visibility="hidden",n.style.position="absolute",n.style.top="-99999px",n.style.left="-99999px",n.style.whiteSpace="nowrap",n.style.width="max-content";const i=t.cloneNode(!0);i.style.flex="none",i.style.width="max-content",i.style.minWidth="0",i.style.maxWidth="none",i.style.overflow="visible",i.style.height="auto";const o=window.getComputedStyle(t);i.style.font=o.font,i.style.fontSize=o.fontSize,i.style.fontWeight=o.fontWeight,i.style.fontFamily=o.fontFamily,i.style.letterSpacing=o.letterSpacing,n.appendChild(i);const s=Ot(e);s.appendChild(n);const r=n.offsetWidth;return s.removeChild(n),r})($,M);if(1>t){if(null==c?void 0:c.headerRenderer)P=!1;else if(null==c?void 0:c.label){const t=null!==(o=M.querySelector(".st-header-label-text"))&&void 0!==o?o:$;W+=$t(c.label+"",t)}}else W+=t,P=!0,F=!!$.querySelector('.st-icon-container[aria-label^="Sort"]'),L=!!$.querySelector(".st-collapsible-header-icon")}else W+=$t(null!==(s=t.textContent)&&void 0!==s?s:"",t)}else if(null==c?void 0:c.label){const t=null!==(r=M.querySelector(".st-header-label-text"))&&void 0!==r?r:k;W+=$t(c.label+"",t),P=!0}const D=H?Array.from(H.children):[];let j=1;for(let t=0;D.length>t;t++){const e=D[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&&(W+=(e.offsetWidth||0)+(parseFloat(n.marginLeft)||0)+(parseFloat(n.marginRight)||0),j++,(null===(l=e.getAttribute("aria-label"))||void 0===l?void 0:l.startsWith("Sort"))&&(F=!0),e.classList.contains("st-collapsible-header-icon")&&(L=!0))}(null==c?void 0:c.sortable)&&!F&&x&&(W+=Ft(x,M),j++),c&&nt(c)&&!L&&y&&(W+=Ft(y,M,"st-icon-container st-collapsible-header-icon st-expand-icon-container expanded"),j++),O>0&&j>1&&(W+=O*(j-1));let N=0,B=!(null==c?void 0:c.cellRenderer)||"header"===m;const z=c&&c.type&&G.includes(c.type);if(d&&d.length>0&&!z&&"header"!==m){const e=document.createElement("div");e.style.visibility="hidden",e.style.position="absolute",e.style.top="-99999px",e.style.left="-99999px",e.style.whiteSpace="nowrap",e.style.width="auto",e.style.display="inline-block";let n=0,i=0;const o=M.querySelector(".st-cell-content");if(o){const t=window.getComputedStyle(o);e.style.font=t.font,e.style.fontSize=t.fontSize,e.style.fontFamily=t.fontFamily,n=parseFloat(t.paddingLeft)||0,i=parseFloat(t.paddingRight)||0}document.body.appendChild(e);const s=[],r=t=>{let o=0;for(const n of Pt(t))e.textContent=n,o=Math.max(o,e.offsetWidth);return o+n+i},l=((t,e,n)=>{if(0>=t)return[];const i=Math.max(0,Math.floor(e)),o=Math.max(0,Math.floor(n));if(i+o>=t)return Array.from({length:t},(t,e)=>e);const s=new Set;for(let e=0;Math.min(i,t)>e;e++)s.add(e);const r=i,l=t-r;if(o>0&&l>0){const e=Math.max(1,Math.floor(l/o));for(let n=0;o>n;n++){const i=r+n*e;if(i>=t)break;s.add(i)}s.add(t-1)}return Array.from(s).sort((t,e)=>t-e)})(d.length,S,C);let h=!1,u=!1;for(const o of l){const l=d[o];let f;f=(null==c?void 0:c.valueGetter)?c.valueGetter({accessor:t,row:l,rowIndex:o}):ct(l,t);let v=f;(null==c?void 0:c.valueFormatter)&&null!=f&&(v=c.valueFormatter({accessor:t,colIndex:0,row:l,rowIndex:o,value:f}));let p=-1;if((null==c?void 0:c.cellRenderer)&&!h)try{const s=c.cellRenderer({accessor:t,colIndex:0,row:l,rowIndex:o,theme:g,value:f,formattedValue:v});if("string"==typeof s||"number"==typeof s)p=r(s+""),p>0&&(u=!0);else if(s instanceof Node)if(s instanceof HTMLElement&&(s.hasAttribute("data-st-portal-id")||s.hasAttribute("data-st-mount-id")||(null===(a=s.querySelector)||void 0===a?void 0:a.call(s,"[data-st-portal-id], [data-st-mount-id]"))))s instanceof HTMLElement&&(null==R||R(s)),h=!0,p=-1;else{e.textContent="",e.appendChild(s);const t=e.offsetWidth+n+i;s instanceof HTMLElement&&(null==R||R(s)),e.textContent="",p=t>n+i?t:-1,u=!0}}catch(t){p=-1}0>p&&!(null==c?void 0:c.cellRenderer)&&(p=r(null!=v?v+"":"")),0>p||s.push(p)}document.body.removeChild(e),(null==c?void 0:c.cellRenderer)&&(M.querySelectorAll(`.st-cell[data-accessor="${Wt(t+"")}"] .st-cell-content`).forEach(t=>{const e=t;if(e.querySelector(".st-loading-skeleton"))return;const o=((t,e)=>{const n=document.createElement("div");n.style.visibility="hidden",n.style.position="absolute",n.style.top="-99999px",n.style.left="-99999px",n.style.whiteSpace="nowrap",n.style.width="max-content";const i=t.cloneNode(!0);i.style.flex="none",i.style.width="max-content",i.style.minWidth="0",i.style.maxWidth="none",i.style.overflow="visible",i.style.padding="0";const o=window.getComputedStyle(t);i.style.font=o.font,i.style.fontSize=o.fontSize,i.style.fontFamily=o.fontFamily,i.style.letterSpacing=o.letterSpacing,n.appendChild(i);const s=Ot(e);s.appendChild(n);const r=n.offsetWidth;return s.removeChild(n),r})(e,M);o>0&&(s.push(o+n+i),u=!0)}),B=u),N=((t,e)=>{var n,i,o;if(0===t.length)return 0;const s=Math.max(...t),r=null!==(n=null==e?void 0:e.percentile)&&void 0!==n?n:95,l=null!==(i=null==e?void 0:e.threshold)&&void 0!==i?i:.5;if((null!==(o=null==e?void 0:e.minSampleForClip)&&void 0!==o?o:20)>t.length)return s;const a=((t,e)=>{if(0===t.length)return 0;if(1===t.length)return t[0];const n=[...t].sort((t,e)=>t-e),i=Math.min(100,Math.max(0,e))/100*(n.length-1),o=Math.floor(i),s=Math.ceil(i);return o===s?n[o]:n[o]+(n[s]-n[o])*(i-o)})(t,r);return a>0&&s>a*(1+l)?a:s})(s,{percentile:p,threshold:w})}let V="header"===m?W:Math.max(W,N);z&&(V=Math.max(V,150));const U="number"==typeof(null==c?void 0:c.maxWidth)?c.maxWidth:"string"==typeof(null==c?void 0:c.maxWidth)&&parseFloat(c.maxWidth+"")||void 0,J=null!=U?U:h;return V>J&&(V=J),{width:Math.max(V+2,"number"==typeof(null==c?void 0:c.minWidth)?c.minWidth:"string"==typeof(null==c?void 0:c.minWidth)&&parseFloat(c.minWidth+"")||_,_),settled:P&&B}};class Dt{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 jt=t=>"number"==typeof t.width?t.width:"string"==typeof t.width&&t.width.endsWith("px")?parseFloat(t.width):150,Nt=(t,e)=>{const n=new Map,i=t.map(jt),o=i.reduce((t,e)=>t+e,0);if(0===o)return n;const s=e/o;if(.01>s-1)return n;const r=t.map((t,e)=>{const n="number"==typeof t.maxWidth?t.maxWidth:"string"==typeof t.maxWidth?parseFloat(t.maxWidth):NaN;return Number.isFinite(n)&&n>0?Math.max(n,i[e]):1/0}),l=new Map;let a=s;for(;;){const t=i.map((t,e)=>e).filter(t=>!l.has(t));if(0===t.length)break;const n=Array.from(l.values()).reduce((t,e)=>t+e,0),o=t.reduce((t,e)=>t+i[e],0);a=Math.max(1,(e-n)/o);const s=t.filter(t=>i[t]*a>r[t]);if(0===s.length)break;s.forEach(t=>l.set(t,r[t]))}const d=t.map((t,e)=>{const n=l.get(e);return Math.round(void 0!==n?n:i[e]*a)});let c=-1;for(let e=t.length-1;e>=0;e--)if(!l.has(e)){c=e;break}if(c>=0){const t=d.reduce((t,e,n)=>n===c?t:t+e,0);d[c]=Math.round(Math.min(Math.max(e-t,i[c]),r[c]))}return t.forEach((t,e)=>{n.set(t.accessor,d[e])}),n},Bt=(t,e)=>{const{autoExpandColumns:n,containerWidth:i,pinnedLeftWidth:o,pinnedRightWidth:s,isResizing:r,collapsedHeaders:l}=e;if(!n||0===i||r)return t;const a=Math.max(0,i-o-s),d=t.filter(t=>"left"===t.pinned),c=t.filter(t=>"right"===t.pinned),h=t.filter(t=>!t.pinned),u=At(d,l),f=At(c,l),v=At(h,l),p=new Map;if(u.length>0&&Nt(u,o).forEach((t,e)=>p.set(e,t)),f.length>0&&Nt(f,s).forEach((t,e)=>p.set(e,t)),v.length>0&&a>0&&Nt(v,a).forEach((t,e)=>p.set(e,t)),0===p.size)return t;const w=(t,e)=>{var n;if(Z(t))return t;const i=null!=e?e:t.pinned,o=null===(n=t.children)||void 0===n?void 0:n.map(t=>w(t,i)),s=p.get(t.accessor);return Object.assign(Object.assign({},t),void 0!==s?{width:s,children:o}:{children:o})};return t.map(t=>w(t,t.pinned))};class zt{constructor(t,e){var n;this.config=t,this.onHeadersUpdate=e,this.isResizingTracker=new Dt(null!==(n=t.isResizing)&&void 0!==n&&n),this.containerWidthTracker=new Dt(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,i=this.config.containerWidth,o=this.isResizingTracker.get();this.isResizingTracker.set(n);const s=this.containerWidthTracker.get();this.containerWidthTracker.set(i),o&&!n&&this.config.autoExpandColumns&&this.triggerAutoScale(),Math.abs(i-s)>10&&!n&&this.config.autoExpandColumns&&this.triggerAutoScale()}triggerAutoScale(){this.onHeadersUpdate&&this.onHeadersUpdate(this.config)}applyAutoScale(t){return Bt(t,this.config)}setHeaders(t,e){const n="function"==typeof t?t(e):t;return this.applyAutoScale(n)}destroy(){this.onHeadersUpdate=()=>{}}}const Vt=t=>{if(t.endsWith("dvh")||t.endsWith("svh")||t.endsWith("lvh")||t.endsWith("vh")){const e=parseFloat(t);return Number.isFinite(e)?window.innerHeight*e/100:null}return null},qt=(t,e=document.querySelector(".simple-table-root"))=>{var n;if("string"==typeof t){const i=t.trim();if(/^calc\(/i.test(i)&&i.endsWith(")")){const t=((t,e)=>{const n=[];for(let e=0;t.length>e;){const i=t[e];if(" "===i||"\t"===i||"\n"===i){e++;continue}if("("===i||")"===i||"+"===i||"-"===i||"*"===i||"/"===i){n.push(i),e++;continue}const o=/^\d*\.?\d+(px|dvh|svh|lvh|vh|vw|%)?/.exec(t.slice(e));if(!o)return null;n.push(o[0]),e+=o[0].length}if(0===n.length)return null;let i=0,o=!1;const s=()=>{let t=r();for(;!o&&("+"===n[i]||"-"===n[i]);){const e=n[i++],o=r();t="+"===e?t+o:t-o}return t},r=()=>{let t=l();for(;!o&&("*"===n[i]||"/"===n[i]);){const e=n[i++],o=l();t="*"===e?t*o:t/o}return t},l=()=>{const t=n[i];if(void 0===t)return o=!0,0;if("+"===t)return i++,l();if("-"===t)return i++,-l();if("("===t){i++;const t=s();return")"!==n[i]?(o=!0,0):(i++,t)}const r=((t,e)=>{var n;const i=t.trim();if(""===i)return null;if(i.endsWith("px")){const t=parseFloat(i);return Number.isFinite(t)?t:null}const o=Vt(i);if(null!==o)return o;if(i.endsWith("vw")){const t=parseFloat(i);return Number.isFinite(t)?window.innerWidth*t/100:null}if(i.endsWith("%")){const t=parseFloat(i),o=null===(n=null==e?void 0:e.parentElement)||void 0===n?void 0:n.clientHeight;return Number.isFinite(t)&&o&&o>=50?o*t/100:null}const s=+i;return Number.isFinite(s)?s:null})(t,e);return null===r?(o=!0,0):(i++,r)},a=s();return o||i!==n.length||!Number.isFinite(a)?null:a})(i.slice(i.indexOf("(")+1,-1),e);return null===t?0:Math.max(0,t)}if(i.endsWith("px"))return parseInt(i,10);const o=Vt(i);if(null!==o)return o;if(i.endsWith("%")){const t=null===(n=null==e?void 0:e.parentElement)||void 0===n?void 0:n.clientHeight;return!t||50>t?0:t*parseInt(i,10)/100}return window.innerHeight}return t};class Gt{constructor(t){this.subscribers=new Set,this.resizeObserver=null,this.rafId=null,this.resizeNotifyDebounceId=null,this.resizeBurstEndId=null,this.resizeBurstNotifyCount=0,this.resizeBurstNeedsFinalFlush=!1,this.initialNotifyPending=!1,this.config=t;const e=this.calculateMaxHeaderDepth(),n=this.calculateHeaderHeight(e),i=this.calculateContentHeight();this.state={containerWidth:0,calculatedHeaderHeight:n,maxHeaderDepth:e,contentHeight:i},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;return t*(null!==(e=this.config.headerHeight)&&void 0!==e?e:this.config.rowHeight)}convertHeightToPixels(t){const e=this.config.containerElement||document.querySelector(".simple-table-root");return qt(t,e)}calculateContentHeight(){const{height:t,maxHeight:e,rowHeight:n,totalRowCount:i,headerHeight:o,footerHeight:s,externalViewportHeight:r}=this.config;if(e){const t=this.convertHeightToPixels(e);if(0===t)return;const r=o||n;if(t>=r+i*n+(s||0))return;return Math.max(0,t-r)}if(!t&&void 0!==r&&r>0)return Math.max(0,r-(o||n));if(!t)return;const l=this.convertHeightToPixels(t);return 0!==l?Math.max(0,l-n):void 0}cancelPendingResizeNotify(){null!==this.resizeNotifyDebounceId&&(clearTimeout(this.resizeNotifyDebounceId),this.resizeNotifyDebounceId=null)}cancelResizeBurstEnd(){null!==this.resizeBurstEndId&&(clearTimeout(this.resizeBurstEndId),this.resizeBurstEndId=null)}scheduleResizeBurstEnd(){this.cancelResizeBurstEnd(),this.resizeBurstEndId=setTimeout(()=>{this.resizeBurstEndId=null,this.resizeBurstNeedsFinalFlush&&(this.resizeBurstNeedsFinalFlush=!1,this.notifySubscribers()),this.resizeBurstNotifyCount=0},150)}scheduleResizeNotify(){this.cancelPendingResizeNotify(),this.cancelResizeBurstEnd(),this.resizeNotifyDebounceId=setTimeout(()=>{this.resizeNotifyDebounceId=null,0===this.resizeBurstNotifyCount?(this.resizeBurstNotifyCount=1,this.resizeBurstNeedsFinalFlush=!1,this.notifySubscribers()):this.resizeBurstNeedsFinalFlush=!0,this.scheduleResizeBurstEnd()},100)}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})),this.initialNotifyPending?(this.initialNotifyPending=!1,this.cancelPendingResizeNotify(),this.notifySubscribers()):n&&this.scheduleResizeNotify()})}),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 i=!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}),i=!0}if("height"in t||"maxHeight"in t||void 0!==t.totalRowCount||void 0!==t.externalViewportHeight){const t=this.calculateContentHeight();this.state=Object.assign(Object.assign({},this.state),{contentHeight:t}),i=!0}if(t.containerElement&&t.containerElement!==n&&(this.resizeObserver&&n&&this.resizeObserver.unobserve(n),this.observeContainer(t.containerElement),i=!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}),i=!0}i&&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.cancelPendingResizeNotify(),this.cancelResizeBurstEnd(),this.resizeBurstNotifyCount=0,this.resizeBurstNeedsFinalFlush=!1,this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.subscribers.clear()}}class Kt{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,i){const o=t>this.lastScrollTop?"down":this.lastScrollTop>t?"up":"none";this.lastScrollTop=t,this.state={scrollTop:t,scrollLeft:e,scrollDirection:o,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>i-(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 _t{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.headerTouchMoveHandlers=new WeakMap,this.isSyncing=!1,this.lastMainVirtualizationScrollLeft=null,this.isTouchScrolling=!1,this.touchSettleTimeoutId=null,this.config=t}updateConfig(t){this.config=Object.assign(Object.assign({},this.config),t)}registerPane(t,e,n){var i;const o=this.panesBySection.get(t);if(Array.from(o).find(t=>t.element===e))return;const s=Array.from(o).find(t=>t.role===n);if(s&&(this.removeScrollListener(s.element),o.delete(s)),o.add({element:e,role:n}),("header"===n||"sticky"===n)&&(e.style.overflowX="hidden"),"sticky"!==n&&(this.addScrollListener(t,e,n),"body"===n&&this.addTouchTracking(t,e)),"header"===n){e.style.touchAction="none";const t=t=>t.preventDefault();this.headerTouchMoveHandlers.set(e,t),e.addEventListener("touchmove",t,{passive:!1})}const r=null!==(i=this.scrollLeftBySection[t])&&void 0!==i?i: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 i=Array.from(n).find(t=>t.element===e);i&&n.delete(i)}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,n){this.removeScrollListener(e);const i=()=>{if(this.isSyncing)return;if(this.isTouchScrolling&&"body"!==n)return;const i=e.scrollLeft;this.scrollLeftBySection[t]=i,this.isSyncing=!0;const o=this.panesBySection.get(t);o&&o.forEach(({element:t,role:n})=>{t!==e&&t.scrollLeft!==i&&("scrollbar"===n&&this.isTouchScrolling||(t.scrollLeft=i))}),this.isTouchScrolling&&this.scheduleTouchSettle(t),"main"!==t||!this.config.onMainSectionScrollLeft||null!==this.lastMainVirtualizationScrollLeft&&20>Math.abs(i-this.lastMainVirtualizationScrollLeft)||(this.lastMainVirtualizationScrollLeft=i,this.config.onMainSectionScrollLeft(i)),this.isSyncing=!1};this.scrollHandlers.set(e,i),e.addEventListener("scroll",i,{passive:!0})}addTouchTracking(t,e){e.addEventListener("touchstart",()=>{this.isTouchScrolling=!0,null!==this.touchSettleTimeoutId&&(clearTimeout(this.touchSettleTimeoutId),this.touchSettleTimeoutId=null)},{passive:!0}),e.addEventListener("touchend",()=>this.scheduleTouchSettle(t),{passive:!0})}scheduleTouchSettle(t){null!==this.touchSettleTimeoutId&&clearTimeout(this.touchSettleTimeoutId),this.touchSettleTimeoutId=window.setTimeout(()=>{var e;this.touchSettleTimeoutId=null,this.isTouchScrolling=!1;const n=null!==(e=this.scrollLeftBySection[t])&&void 0!==e?e:0,i=this.panesBySection.get(t);i&&(this.isSyncing=!0,i.forEach(({element:t,role:e})=>{"scrollbar"===e&&t.scrollLeft!==n&&(t.scrollLeft=n)}),this.isSyncing=!1)},100)}removeScrollListener(t){const e=this.scrollHandlers.get(t);e&&(t.removeEventListener("scroll",e),this.scrollHandlers.delete(t));const n=this.headerTouchMoveHandlers.get(t);n&&(t.removeEventListener("touchmove",n),this.headerTouchMoveHandlers.delete(t))}destroy(){null!==this.touchSettleTimeoutId&&(clearTimeout(this.touchSettleTimeoutId),this.touchSettleTimeoutId=null),["pinned-left","main","pinned-right"].forEach(t=>this.unregisterSection(t))}}const Ut={string:(t,e,n)=>{if(t===e)return 0;const i=t.localeCompare(e);return"asc"===n?i:-i},number:(t,e,n)=>{if(t===e)return 0;const i=t-e;return"asc"===n?i:-i},boolean:(t,e,n)=>{if(t===e)return 0;const i=t===e?0:t?-1:1;return"asc"===n?i:-i},date:(t,e,n)=>{const i=new Date(t),o=new Date(e);if(i.getTime()===o.getTime())return 0;const s=i.getTime()-o.getTime();return"asc"===n?s:-s},enum:(t,e,n)=>Ut.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?Ut.string(t,e,n):"number"==typeof t&&"number"==typeof e?Ut.number(t,e,n):"boolean"==typeof t&&"boolean"==typeof e?Ut.boolean(t,e,n):Ut.string(t+"",e+"",n)},Jt=({headers:t,rows:e,sortColumn:n})=>(({rows:t,sortColumn:e,headers:n})=>{const i=(t,e)=>{for(const n of t){if(n.accessor===e)return n;if(n.children&&n.children.length>0){const t=i(n.children,e);if(t)return t}}},o=i(n,e.key.accessor),s=(null==o?void 0:o.type)||"string",r=e.direction,l=e.key.accessor;return[...t].sort((e,n)=>{let i,a;if(null==o?void 0:o.valueGetter){const s=t.indexOf(e),r=t.indexOf(n);i=o.valueGetter({accessor:l,row:e,rowIndex:s}),a=o.valueGetter({accessor:l,row:n,rowIndex:r})}else i=ct(e,l),a=ct(n,l);return(null==o?void 0:o.comparator)?o.comparator({rowA:e,rowB:n,valueA:i,valueB:a,direction:r}):((t,e,n="string",i)=>{if(null==t||""===t)return"asc"===i?-1:1;if(null==e||""===e)return"asc"===i?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 i=null===(e=t[2])||void 0===e?void 0:e.toUpperCase();return"T"===i?n*=1e12:"B"===i?n*=1e9:"M"===i?n*=1e6:"K"===i&&(n*=1e3),n}}return parseFloat(n)||0},o=n(t),s=n(e);return Ut.number(o,s,i)}return"date"===n?Ut.date(t+"",e+"",i):"boolean"===n?Ut.boolean(!!t,!!e,i):"enum"===n?Ut.enum(t+"",e+"",i):Ut.string(t+"",e+"",i)})(i,a,s,r)})})({rows:e,sortColumn:n,headers:t}),Yt=(t,e)=>{if(0===t.length)return;if("custom"===e.type&&e.customFn)return e.customFn(t);const n=e.parseValue?t.map(e.parseValue).filter(t=>!isNaN(t)):t.map(t=>"number"==typeof t?t:"string"==typeof t?parseFloat(t):NaN).filter(t=>!isNaN(t));if(0===n.length)return"count"===e.type?t.length:void 0;let i;switch(e.type){case"sum":i=n.reduce((t,e)=>t+e,0);break;case"average":i=n.reduce((t,e)=>t+e,0)/n.length;break;case"count":i=t.length;break;case"min":i=Math.min(...n);break;case"max":i=Math.max(...n);break;default:return}return e.formatResult?e.formatResult(i):i},Xt=t=>{const{rows:e=[],headers:n=[],rowGrouping:i,rowManager:o}=t;if(o)return o.getAggregatedRows();if(!i||0===i.length)return e;const s=(t=>X(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=i[e],o=i[e+1],r=t[n];if(r&&ft(r)){const i=l(r,e+1),a=Object.assign({},t);return a[n]=i,s.forEach(t=>{const e=((t,e,n,i)=>{const o=[],s=t=>{t.forEach(t=>{const n=i?t[i]:void 0;if(i&&n&&ft(n))s(n);else{const n=ct(t,e);null!=n&&o.push(n)}})};return s(t),Yt(o,n)})(i,t.accessor,t.aggregation,o);void 0!==e&&ut(a,t.accessor,e)}),a}return t});return l(r)};class Qt{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=X(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:i}){const o=Jt({headers:e,rows:n,sortColumn:i});return t&&0!==t.length?o.map(n=>{const o=t[0],s=n[o];if(ft(s)){const r=this.sortNestedRows({rows:s,sortColumn:i,headers:e,groupingKeys:t.slice(1)});return Object.assign(Object.assign({},n),{[o]:r})}return n}):o}computeSortedRows(t,e){if(this.config.externalSortHandling)return t;const n=Xt({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}):Jt({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);ht(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,i,o;if(!t)return this.state=Object.assign(Object.assign({},this.state),{sort:null,sortedRows:this.computeSortedRows(this.config.tableRows,null)}),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 a=null;if(r)a={key:l,direction:r};else{const t=l.sortingOrder||["asc","desc",null];let e=-1;this.state.sort&&this.state.sort.key.accessor===s&&(e=t.indexOf(this.state.sort.direction));const n=t[(e+1)%t.length];a=null===n?null:{key:l,direction:n}}const d=this.computeSortedRows(this.config.tableRows,a);this.state={sort:a,sortedRows:d},null===(o=(i=this.config).onSortChange)||void 0===o||o.call(i,a),this.config.announce&&this.config.announce(a?`Sorted by ${l.label}, ${"asc"===a.direction?"ascending":"descending"}`:"Sort removed from "+l.label),this.notifySubscribers()}computeSortedRowsPreview(t){const e=n=>{for(const i of n){if(i.accessor===t)return i;if(i.children&&i.children.length>0){const t=e(i.children);if(t)return t}}},n=e(this.config.headers);if(!n)return this.config.tableRows;let i=null;const o=n.sortingOrder||["asc","desc",null];let s=-1;this.state.sort&&this.state.sort.key.accessor===t&&(s=o.indexOf(this.state.sort.direction));const r=o[(s+1)%o.length];return i=null===r?null:{key:n,direction:r},this.computeSortedRows(this.config.tableRows,i)}getState(){return this.state}getSortColumn(){return this.state.sort}getSortedRows(){return this.state.sortedRows}destroy(){this.subscribers.clear()}}const Zt=t=>{if(!t)return new Date;if(/^\d{4}-\d{2}-\d{2}$/.test(t)){const[e,n,i]=t.split("-").map(Number);return new Date(e,n-1,i,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)},te=t=>new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0),ee=t=>{if(!t)return new Date;if("string"==typeof t)return Zt(t);if("number"==typeof t){const e=new Date(t);return isNaN(e.getTime())?new Date:te(e)}return t instanceof Date?te(t):new Date};class ne{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=X(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:i,values:o}=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(),o=i?(i+"").toLowerCase():"";switch(n){case"equals":return e===o;case"notEquals":return e!==o;case"contains":return e.includes(o);case"notContains":return!e.includes(o);case"startsWith":return e.startsWith(o);case"endsWith":return e.endsWith(o)}}if("number"==typeof t||!isNaN(+t)){const e=+t,s=+i;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(o&&2===o.length){const[t,n]=o.map(Number);return e>=t&&n>=e}return!1;case"notBetween":if(o&&2===o.length){const[t,n]=o.map(Number);return t>e||e>n}return!0}}if(t instanceof Date||!isNaN(Date.parse(t))){const e=ee(t),s=ee((i||"")+""),r=te(e),l=te(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(o&&2===o.length){const[t,e]=o.map(t=>te(ee((t||"")+"")));return r>=t&&e>=r}return!1;case"notBetween":if(o&&2===o.length){const[t,e]=o.map(t=>te(ee((t||"")+"")));return t>r||r>e}return!0}}if("boolean"==typeof t&&"equals"===n)return t===!!i;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(o&&Array.isArray(o)){const e=o.includes(t+"");return"in"===n?e:!e}return!1}const s=(t+"").toLowerCase(),r=i?(i+"").toLowerCase():"";switch(n){case"equals":return s===r;case"notEquals":return s!==r;default:return!0}})(ct(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);ht(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 i=Object.assign(Object.assign({},this.state.filters),{[t.accessor]:t}),o=this.computeFilteredRows(this.config.rows,i);if(this.state={filters:i,filteredRows:o},null===(n=(e=this.config).onFilterChange)||void 0===n||n.call(e,i),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 i=Object.assign({},this.state.filters);delete i[t];const o=this.computeFilteredRows(this.config.rows,i);if(this.state={filters:i,filteredRows:o},null===(n=(e=this.config).onFilterChange)||void 0===n||n.call(e,i),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 ie="__pivotChildren",oe="__pivotIsTotal",se="__pivot:",re="(blank)",le="",ae="__total__",de=t=>null==t?re:"string"==typeof t||"number"==typeof t||"boolean"==typeof t?t:t+"",ce=t=>t+"",he=t=>t.map(ce).join(le),ue=t=>""===t?[]:t.split(le),fe=(t,e)=>t===re&&e!==re?1:e===re&&t!==re?-1:t.localeCompare(e,void 0,{numeric:!0,sensitivity:"base"}),ve=(t,e)=>t.get(e+""),pe=(t,e)=>`${se}${t}${le}${e+""}`,we=t=>pe(ae,t),me=(t,e,n)=>`${t}${le}${e}${le}${n}`,ge=({accessor:t,label:e,field:n,alignRight:i})=>{var o,s,r,l;return{accessor:t,label:e,width:null!==(o=null==n?void 0:n.width)&&void 0!==o?o:100,type:null!==(s=null==n?void 0:n.type)&&void 0!==s?s:"number",align:i?"right":null!==(r=null==n?void 0:n.align)&&void 0!==r?r:"right",sortable:null===(l=null==n?void 0:n.sortable)||void 0===l||l,filterable:!1,editable:!1,valueFormatter:null==n?void 0:n.valueFormatter,valueGetter:null==n?void 0:n.valueGetter,minWidth:null==n?void 0:n.minWidth,maxWidth:null==n?void 0:n.maxWidth}},be=(t,e,n,i,o)=>{const s=`${le}${n}${le}${i}`,r=[];if(o){const n=t.get(`${e}${s}`);return n&&r.push(...n),r}for(const[n,i]of t){if(!n.endsWith(s))continue;const t=n.slice(0,n.length-s.length);(""===e||t===e||t.startsWith(e+le))&&r.push(...i)}return r},xe=({row:t,buckets:e,rowKeyPrefix:n,colKeys:i,values:o,showRowTotals:s,exactRowKey:r})=>{for(const s of i)o.forEach((i,o)=>{const l=be(e,n,s,o,r),a=Yt(l,i.aggregation);void 0!==a&&(t[pe(s,i.accessor)]=a)});s&&o.forEach((o,s)=>{const l=[];for(const t of i)l.push(...be(e,n,t,s,r));0===i.length&&l.push(...be(e,n,"",s,r));const a=Yt(l,o.aggregation);void 0!==a&&(t[we(o.accessor)]=a)})},ye=({rowDims:t,prefixParts:e,distinctRowKeys:n,buckets:i,colKeys:o,values:s,showRowTotals:r})=>{const l=e.length;if(l>=t.length)return[];const a=he(e),d=l,c=new Map;for(const t of n){const e=ue(t);if(""!==a&&t!==a&&!t.startsWith(a+le))continue;if(d>=e.length)continue;const n=e[d];c.set(ce(n),n)}const h=Array.from(c.keys()).sort(fe),u=l===t.length-1;return h.map(a=>{const d=c.get(a),h=[...e,d],f=he(h),v={};if(t.forEach((t,e)=>{e>l||(v[t]=h[e])}),u)return xe({row:v,buckets:i,rowKeyPrefix:f,colKeys:o,values:s,showRowTotals:r,exactRowKey:!0}),v;const p=ye({rowDims:t,prefixParts:h,distinctRowKeys:n,buckets:i,colKeys:o,values:s,showRowTotals:r});return v[ie]=p,xe({row:v,buckets:i,rowKeyPrefix:f,colKeys:o,values:s,showRowTotals:r,exactRowKey:!1}),v})},Re=({rows:t,pivot:e,fieldHeaders:n})=>{var i,o;if(!e.values||0===e.values.length)throw Error("pivot.values must contain at least one measure");const s=null!==(i=e.rows)&&void 0!==i?i:[],r=null!==(o=e.columns)&&void 0!==o?o:[],l=e.values,a=!1!==e.showRowTotals,d=!1!==e.showColumnTotals,c=!1!==e.showGrandTotal,h=new Map;for(const t of X(n))h.set(t.accessor+"",t);const u=new Map,f=new Set,v=new Set;for(const e of t){const t=s.map(t=>de(ct(e,t))),n=r.map(t=>de(ct(e,t))),i=he(t),o=he(n);f.add(i),v.add(o),l.forEach((t,n)=>{const s=ct(e,t.accessor);if(null==s)return;const r=me(i,o,n);let l=u.get(r);l||(l=[],u.set(r,l)),l.push(s)})}const p=Array.from(f).sort((t,e)=>{var n,i;const o=ue(t),s=ue(e),r=Math.max(o.length,s.length);for(let t=0;r>t;t++){const e=fe(null!==(n=o[t])&&void 0!==n?n:"",null!==(i=s[t])&&void 0!==i?i:"");if(0!==e)return e}return 0}),w=Array.from(v).sort((t,e)=>{var n,i;const o=ue(t),s=ue(e),r=Math.max(o.length,s.length);for(let t=0;r>t;t++){const e=fe(null!==(n=o[t])&&void 0!==n?n:"",null!==(i=s[t])&&void 0!==i?i:"");if(0!==e)return e}return 0}),m=0===r.length?[""]:w,g=a&&r.length>0,b=(({colKeys:t,values:e,catalog:n,showRowTotals:i})=>{var o,s;const r=e.length>1,l=[],a={label:"",children:new Map};for(const e of t){const t=ue(e);if(0===t.length)continue;let n=a;for(const e of t){let t=n.children.get(e);t||(t={label:e,children:new Map},n.children.set(e,t)),n=t}n.colKey=e}const d=(t,i)=>Array.from(t.children.entries()).sort(([t],[e])=>fe(t,e)).map(([t,o])=>{const s=i?`${i}${le}${t}`:t;if(void 0!==o.colKey&&0===o.children.size){if(!r){const i=e[0],s=ve(n,i.accessor);return ge({accessor:pe(o.colKey,i.accessor),label:t,field:s,alignRight:!0})}return{accessor:"__pivotGroup:"+o.colKey,label:t,width:100,children:e.map(t=>{var e,i;const s=ve(n,t.accessor);return ge({accessor:pe(o.colKey,t.accessor),label:null!==(i=null!==(e=t.label)&&void 0!==e?e:null==s?void 0:s.label)&&void 0!==i?i:t.accessor+"",field:s,alignRight:!0})})}}return{accessor:"__pivotGroup:"+s,label:t,width:100,children:d(o,s)}});if(0===t.length||1===t.length&&""===t[0])for(const t of e){const e=ve(n,t.accessor);l.push(ge({accessor:pe("",t.accessor),label:null!==(s=null!==(o=t.label)&&void 0!==o?o:null==e?void 0:e.label)&&void 0!==s?s:t.accessor+"",field:e,alignRight:!0}))}else l.push(...d(a,""));if(i)if(r)l.push({accessor:"__pivotGroup:"+ae,label:"Total",width:100,children:e.map(t=>{var e,i;const o=ve(n,t.accessor);return ge({accessor:we(t.accessor),label:null!==(i=null!==(e=t.label)&&void 0!==e?e:null==o?void 0:o.label)&&void 0!==i?i:t.accessor+"",field:o,alignRight:!0})})});else{const t=e[0],i=ve(n,t.accessor);l.push(ge({accessor:we(t.accessor),label:"Total",field:i,alignRight:!0}))}return l})({colKeys:0===r.length?[]:w,values:l,catalog:h,showRowTotals:g}),x=((t,e,n)=>t.map((t,i)=>{var o,s,r,l,a;const d=ve(e,t);return{accessor:t,label:null!==(o=null==d?void 0:d.label)&&void 0!==o?o:t+"",width:null!==(s=null==d?void 0:d.width)&&void 0!==s?s:140,type:null!==(r=null==d?void 0:d.type)&&void 0!==r?r:"string",align:null!==(l=null==d?void 0:d.align)&&void 0!==l?l:"left",pinned:"left",sortable:null===(a=null==d?void 0:d.sortable)||void 0===a||a,filterable:null==d?void 0:d.filterable,expandable:!(!n||0!==i)||(null==d?void 0:d.expandable),valueFormatter:null==d?void 0:d.valueFormatter,valueGetter:null==d?void 0:d.valueGetter,minWidth:null==d?void 0:d.minWidth,maxWidth:null==d?void 0:d.maxWidth}}))(s,h,s.length>1),y=[...x,...b];let R;if(0===s.length){const t={};xe({row:t,buckets:u,rowKeyPrefix:"",colKeys:m,values:l,showRowTotals:g&&c,exactRowKey:!1}),R=[t]}else R=ye({rowDims:s,prefixParts:[],distinctRowKeys:p,buckets:u,colKeys:m,values:l,showRowTotals:g});if(d&&s.length>0){const t={[oe]:!0};t[s[0]]="Total",xe({row:t,buckets:u,rowKeyPrefix:"",colKeys:m,values:l,showRowTotals:g&&c,exactRowKey:!1}),R=[...R,t]}return{rows:R,headers:y,rowGrouping:s.length>1?Array.from({length:s.length-1},()=>ie):void 0}};class Se{constructor(t){this.subscribers=new Set,this.cacheKey="",this.config=t,this.state=this.computeState(t),this.cacheKey=this.buildCacheKey(t)}buildCacheKey(t){return`${e=t.pivot,e?JSON.stringify({rows:e.rows,columns:e.columns,values:e.values.map(t=>({accessor:t.accessor,label:t.label,type:t.aggregation.type})),showRowTotals:!1!==e.showRowTotals,showColumnTotals:!1!==e.showColumnTotals,showGrandTotal:!1!==e.showGrandTotal}):""}|rows:${t.sourceRows.length}|hdr:${t.fieldHeaders.length}`;var e}computeState(t){var e;const n=null!==(e=t.pivot)&&void 0!==e?e:null;if(!n||!n.values||0===n.values.length)return{active:!1,pivotedRows:t.sourceRows,headers:t.fieldHeaders,rowGrouping:void 0,pivot:null};let i;try{i=Re({rows:t.sourceRows,pivot:n,fieldHeaders:t.fieldHeaders})}catch(e){return{active:!1,pivotedRows:t.sourceRows,headers:t.fieldHeaders,rowGrouping:void 0,pivot:null}}return{active:!0,pivotedRows:i.rows,headers:i.headers,rowGrouping:i.rowGrouping,pivot:n}}getState(){return this.state}isActive(){return this.state.active}getPivot(){return this.state.pivot}updateConfig(t){const e=Object.assign(Object.assign({},this.config),t),n=this.buildCacheKey(e),i=void 0!==t.sourceRows&&t.sourceRows!==this.config.sourceRows,o=void 0!==t.fieldHeaders&&t.fieldHeaders!==this.config.fieldHeaders,s=void 0!==t.pivot&&t.pivot!==this.config.pivot;this.config=e,(i||o||s||n!==this.cacheKey)&&(this.cacheKey=n,this.state=this.computeState(this.config),this.notifySubscribers())}setPivot(t){this.updateConfig({pivot:t})}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}notifySubscribers(){this.subscribers.forEach(t=>t(this.state))}destroy(){this.subscribers.clear()}}const Ce=(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 i=0,o=n.length-1;for(;o>i;){const e=Math.floor((i+o+1)/2);n[e]>t?o=e-1:i=e}return i},Me=(t,e)=>{if(!e||0===e.length)return 0;let n=0,i=0,o=e.length;for(;o>i;){const n=Math.floor((i+o)/2);t>e[n][0]?i=n+1:o=n}for(let t=0;i>t;t++)n+=e[t][1];return n},Ie=({bufferRowCount:t,contentHeight:e,rowHeight:n,scrollTop:i,tableRows:o,scrollDirection:s="none",heightMap:r})=>{const l=n+1;if(!r){const n=t*l;let r=n,a=n;"down"===s?(r=Math.max(l,.1*n),a=.9*n):"up"===s&&(r=.9*n,a=Math.max(l,.1*n));const d=i+e+a,c=Math.max(0,Math.floor(Math.max(0,i-r)/l)),h=Math.min(o.length,Math.ceil(d/l)),u=i+e,f=Math.max(0,Math.ceil(i/l)),v=Math.min(o.length,Math.floor(u/l)),p=i+e,w=Math.max(0,Math.floor(i/l)),m=Math.min(o.length,Math.ceil(p/l));return{rendered:{startIndex:c,endIndex:h,rows:o.slice(c,h)},fullyVisible:{startIndex:f,endIndex:v,rows:o.slice(f,v)},partiallyVisible:{startIndex:w,endIndex:m,rows:o.slice(w,m)}}}const{rowTopPositions:a}=r,d=t*l;let c=d,h=d;"down"===s?(c=Math.max(l,.1*d),h=.9*d):"up"===s&&(c=.9*d,h=Math.max(l,.1*d));const u=i+e+h,f=Ce(Math.max(0,i-c),r);let v=Ce(u,r)+1;v=Math.min(o.length,v);const p=i,w=i+e;let m=Ce(p,r);p>a[m]&&(m=Math.min(m+1,o.length));let g=Ce(w,r);g=Math.min(o.length,g);const b=i+e,x=Ce(i,r);let y=Ce(b,r)+1;return y=Math.min(o.length,y),{rendered:{startIndex:f,endIndex:v,rows:o.slice(f,v)},fullyVisible:{startIndex:m,endIndex:g,rows:o.slice(m,g)},partiallyVisible:{startIndex:x,endIndex:y,rows:o.slice(x,y)}}},He=({position:t,rowHeight:e,heightOffsets:n,customTheme:i})=>t*(e+i.rowSeparatorWidth)-i.rowSeparatorWidth+Me(t,n),ke=({position:t,rowHeight:e,heightOffsets:n,customTheme:i})=>t*(e+i.rowSeparatorWidth)+Me(t,n),Te=(t,e)=>{var n,i;const o=t.position,s=e[o+1];return null!==(i=null===(n=null==s?void 0:s.parentIndices)||void 0===n?void 0:n.includes(o))&&void 0!==i&&i},Ee=new Map,Ae=t=>{var e;return t?null!==(e=t.stableRowKey)&&void 0!==e?e:pt(t.rowId):""},Oe=(t,e,n,i,o)=>{var s,r,l,a,d,c;const h=null!==(r=null===(s=i[0])||void 0===s?void 0:s.position)&&void 0!==r?r:-1,u=null!==(a=null===(l=e[0])||void 0===l?void 0:l.position)&&void 0!==a?a:-1,f=null!==(c=null===(d=e[e.length-1])||void 0===d?void 0:d.position)&&void 0!==c?c:-1,v=[Ae(t[h]),Ae(t[u]),Ae(t[f]),Ae(t[0]),t.length+""].join("|"),p=`${h}:${u}:${f}:${o.join(",")}:${v}`,w=Ee.get(p);if(w&&w.firstVisiblePosition===h&&w.renderedStartPosition===u&&w.renderedEndPosition===f){const n=[];let i=!0;for(const e of w.result.stickyParents){const o=t[e.position];if(!o||Ae(o)!==Ae(e)){i=!1;break}n.push(o)}if(i)return{stickyParents:n,regularRows:e};Ee.delete(p)}const m=We({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:i,partiallyVisibleRowIndex:0,recursionDepth:0,stickyParents:[],rowGrouping:o});if(Ee.set(p,{result:m,firstVisiblePosition:h,renderedStartPosition:u,renderedEndPosition:f}),Ee.size>50){const t=Ee.keys().next().value;void 0!==t&&Ee.delete(t)}return m},We=({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:i,partiallyVisibleRowIndex:o,recursionDepth:s,stickyParents:r,rowGrouping:l})=>{let a=i[o];if(!a||s>10)return{stickyParents:r,regularRows:e};let d=0;if(a.parentIndices&&a.parentIndices.length>0){for(const e of a.parentIndices){const i=t[e];if(i){const e=n.some(t=>t.position===i.position);if(a.rowIndexPath&&a.rowIndexPath.length>0){const e=t[a.parentIndices[a.parentIndices.length-1]],n=e.row[l[e.depth]];if(r.length>=(Array.isArray(n)?n:[]).length-a.rowIndexPath[a.rowIndexPath.length-1])break}e||r.some(t=>pt(t.rowId)===pt(i.rowId))||(r.push(i),d++)}}if(r.length>0){Te(a,t)&&(r.push(a),d++);const e=i[o+=d];e&&(a=e)}}else if(Te(a,t))return r.push(a),o++,We({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:i,partiallyVisibleRowIndex:o,recursionDepth:s+1,stickyParents:r,rowGrouping:l});return Te(a,t)?We({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:i,partiallyVisibleRowIndex:o,recursionDepth:s+1,stickyParents:r,rowGrouping:l}):{stickyParents:r,regularRows:e}},Pe=(t,e,n)=>{const i=t.getBoundingClientRect(),o=e.getBoundingClientRect(),s=10;if(o.top+s>i.top?e.scrollTop-=o.top-i.top+s:i.bottom>o.bottom-s&&(e.scrollTop+=i.bottom-o.bottom+s),n){const t=n.getBoundingClientRect();t.left+s>i.left?n.scrollLeft-=t.left-i.left+s:i.right>t.right-s&&(n.scrollLeft+=i.right-t.right+s)}},$e=(t,e,n,i)=>{const o=document.querySelector(".st-body-container"),s=document.querySelector(".st-body-main");if(!o)return;const r=i?i.findIndex(e=>pt(e.rowId)===t.rowId+""):-1,l=0>r?t.rowIndex:r,a=e+n.rowSeparatorWidth,d=o.querySelector(`.st-cell[data-row-id="${t.rowId}"][data-col-index="${t.colIndex}"]`);if(d&&i){const t=((t,e,n,i)=>{const o=Ie({bufferRowCount:0,contentHeight:e.clientHeight,rowHeight:n,scrollTop:e.scrollTop,tableRows:i,scrollDirection:"none"}),{startIndex:s,endIndex:r}=o.fullyVisible;return t>=s&&r>t})(l,o,e,i);if(t)return void Pe(d,o,s)}if(!d)return o.scrollTop=Math.max(0,l*a-o.clientHeight/3),void setTimeout(()=>{const e=o.querySelector(`.st-cell[data-row-id="${t.rowId}"][data-col-index="${t.colIndex}"]`);e&&Pe(e,o,s)},100);Pe(d,o,s)},Fe=({rowIndex:t,colIndex:e,rowId:n})=>`${t}-${e}-${n}`;function Le(t,e,n,i){const o=new Set,s=new Map;n.forEach((t,e)=>{const n=pt(t.rowId);s.set(n,e)});const r=s.get(t.rowId+""),l=s.get(e.rowId+""),a=void 0!==r?r:t.rowIndex,d=void 0!==l?l:e.rowIndex,c=Math.min(a,d),h=Math.max(a,d),u=Math.min(t.colIndex,e.colIndex),f=Math.max(t.colIndex,e.colIndex);for(let t=c;h>=t;t++)for(let e=u;f>=e;e++)if(t>=0&&n.length>t){if(i&&0===e)continue;const s=pt(n[t].rowId);o.add(Fe({colIndex:e,rowIndex:t,rowId:s}))}return o}function De(t,e,n=document){var i,o,s;const r=n,l=r.querySelector(".st-body-container");if(!l)return null;const a=l.getBoundingClientRect(),d=Math.max(a.left,Math.min(a.right,t)),c=Math.max(a.top,Math.min(a.bottom,e)),h=r.querySelectorAll(".st-cell[data-row-index][data-col-index][data-row-id]:not(.st-selection-cell)");if(0===h.length)return null;const u=new Map;for(let t=0;h.length>t;t++){const e=h[t],n=e.getAttribute("data-row-id"),o=null!==(i=null!=n?n:e.getAttribute("data-row-index"))&&void 0!==i?i:"";if(!o)continue;let s=u.get(o);s||(s=[],u.set(o,s)),s.push(e)}const f=[];u.forEach((t,e)=>{const n=t[0].getBoundingClientRect();f.push({key:e,top:n.top,bottom:n.bottom})}),f.sort((t,e)=>t.top-e.top);let v=null,p=1/0;for(let t=0;f.length>t;t++){const{key:e,top:n,bottom:i}=f[t];if(c>=n&&i>=c){v=e,p=0;break}const o=Math.abs(c-(n+i)/2);p>o&&(p=o,v=e)}if(null===v)return null;const w=u.get(v);if(!w||0===w.length)return null;let m=null,g=1/0;for(let t=0;w.length>t;t++){const e=w[t],n=parseInt(null!==(o=e.getAttribute("data-row-index"))&&void 0!==o?o:"-1",10),i=parseInt(null!==(s=e.getAttribute("data-col-index"))&&void 0!==s?s:"-1",10),r=e.getAttribute("data-row-id");if(0>n||0>i||null==r||""===r)continue;const l=e.getBoundingClientRect(),a=Math.sqrt((l.left+l.width/2-d)**2+(l.top+l.height/2-c)**2);g>a&&(g=a,m=e)}if(null!==m){const t=parseInt(m.getAttribute("data-row-index")||"-1",10),e=parseInt(m.getAttribute("data-col-index")||"-1",10),n=m.getAttribute("data-row-id");if(t>=0&&e>=0&&null!==n)return{rowIndex:t,colIndex:e,rowId:n}}return null}class je{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=>St(t,this.config.collapsedHeaders)),this.rowIdToTableIndex.clear(),this.config.tableRows.forEach((t,e)=>{this.rowIdToTableIndex.set(pt(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(pt(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(`${pt(e.rowId)}\t${t}`),this.rowsWithSelectedCells.add(pt(e.rowId))})})}updateRowIdAndSelectionLookupOnly(){this.rowIdToTableIndex.clear(),this.config.tableRows.forEach((t,e)=>{this.rowIdToTableIndex.set(pt(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(`${pt(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:i}=this.initialFocusedCell;const o=this.config.tableRows[e];if((o?pt(o.rowId):null)!==i){const t=this.config.tableRows.findIndex(t=>pt(t.rowId)===i);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,i,o,s){let r=i,l=o;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 i=e-1;if((t.ctrlKey||t.metaKey)&&(i=this.findEdgeInDirection(e,n,"up").rowIndex),i>=0){const t=pt(this.config.tableRows[i].rowId);this.selectCellRange(this.startCell,{rowIndex:i,colIndex:n,rowId:t})}}else if(e>0){let i=e-1;(t.ctrlKey||t.metaKey)&&(i=this.findEdgeInDirection(e,n,"up").rowIndex);const o=pt(this.config.tableRows[i].rowId);this.selectSingleCell({rowIndex:i,colIndex:n,rowId:o}),this.startCell=null}}handleArrowDown(t,e,n){if(t.shiftKey){this.startCell||(this.startCell=this.initialFocusedCell);let i=e+1;if((t.ctrlKey||t.metaKey)&&(i=this.findEdgeInDirection(e,n,"down").rowIndex),this.config.tableRows.length>i){const t=pt(this.config.tableRows[i].rowId);this.selectCellRange(this.startCell,{rowIndex:i,colIndex:n,rowId:t})}}else if(this.config.tableRows.length-1>e){let i=e+1;(t.ctrlKey||t.metaKey)&&(i=this.findEdgeInDirection(e,n,"down").rowIndex);const o=pt(this.config.tableRows[i].rowId);this.selectSingleCell({rowIndex:i,colIndex:n,rowId:o}),this.startCell=null}}handleArrowLeft(t,e,n){if(t.shiftKey&&"ArrowLeft"===t.key){this.startCell||(this.startCell=this.initialFocusedCell);let i=n-1;if(t.ctrlKey||t.metaKey)i=this.findEdgeInDirection(e,n,"left").colIndex;else if(this.config.enableRowSelection&&0===i)return;if(i>=0){const t=pt(this.config.tableRows[e].rowId);this.selectCellRange(this.startCell,{rowIndex:e,colIndex:i,rowId:t})}}else if(n>0){let i=n-1;if((t.ctrlKey||t.metaKey)&&"ArrowLeft"===t.key)i=this.findEdgeInDirection(e,n,"left").colIndex;else if(this.config.enableRowSelection&&0===i)return;if(i>=0){const t=pt(this.config.tableRows[e].rowId);this.selectSingleCell({rowIndex:e,colIndex:i,rowId:t}),this.startCell=null}}}handleArrowRight(t,e,n){const i=this.config.enableRowSelection?this.leafHeaders.length:this.leafHeaders.length-1;if(t.shiftKey&&"ArrowRight"===t.key){this.startCell||(this.startCell=this.initialFocusedCell);let o=n+1;if((t.ctrlKey||t.metaKey)&&(o=this.findEdgeInDirection(e,n,"right").colIndex),i>=o){const t=pt(this.config.tableRows[e].rowId);this.selectCellRange(this.startCell,{rowIndex:e,colIndex:o,rowId:t})}}else if(i>n){let o=n+1;if((t.ctrlKey||t.metaKey)&&"ArrowRight"===t.key&&(o=this.findEdgeInDirection(e,n,"right").colIndex),i>=o){const t=pt(this.config.tableRows[e].rowId);this.selectSingleCell({rowIndex:e,colIndex:o,rowId:t}),this.startCell=null}}}handleHome(t,e,n){if(t.shiftKey){this.startCell||(this.startCell=this.initialFocusedCell);let n=e;const i=this.config.enableRowSelection?1:0;(t.ctrlKey||t.metaKey)&&(n=0);const o=pt(this.config.tableRows[n].rowId);this.selectCellRange(this.startCell,{rowIndex:n,colIndex:i,rowId:o})}else{let n=e;const i=this.config.enableRowSelection?1:0;(t.ctrlKey||t.metaKey)&&(n=0);const o=pt(this.config.tableRows[n].rowId);this.selectSingleCell({rowIndex:n,colIndex:i,rowId:o}),this.startCell=null}}handleEnd(t,e,n){if(t.shiftKey){this.startCell||(this.startCell=this.initialFocusedCell);let n=e;const i=this.config.enableRowSelection?this.leafHeaders.length:this.leafHeaders.length-1;(t.ctrlKey||t.metaKey)&&(n=this.config.tableRows.length-1);const o=pt(this.config.tableRows[n].rowId);this.selectCellRange(this.startCell,{rowIndex:n,colIndex:i,rowId:o})}else{let n=e;const i=this.config.enableRowSelection?this.leafHeaders.length:this.leafHeaders.length-1;(t.ctrlKey||t.metaKey)&&(n=this.config.tableRows.length-1);const o=pt(this.config.tableRows[n].rowId);this.selectSingleCell({rowIndex:n,colIndex:i,rowId:o}),this.startCell=null}}handlePageUp(t,e,n){let i=Math.max(0,e-10);if(t.shiftKey){this.startCell||(this.startCell=this.initialFocusedCell);const t=pt(this.config.tableRows[i].rowId);this.selectCellRange(this.startCell,{rowIndex:i,colIndex:n,rowId:t})}else{const t=pt(this.config.tableRows[i].rowId);this.selectSingleCell({rowIndex:i,colIndex:n,rowId:t}),this.startCell=null}}handlePageDown(t,e,n){let i=Math.min(this.config.tableRows.length-1,e+10);if(t.shiftKey){this.startCell||(this.startCell=this.initialFocusedCell);const t=pt(this.config.tableRows[i].rowId);this.selectCellRange(this.startCell,{rowIndex:i,colIndex:n,rowId:t})}else{const t=pt(this.config.tableRows[i].rowId);this.selectSingleCell({rowIndex:i,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,i=!1)=>{const o=this.leafHeaders.filter(t=>!Z(t)),s=new Map,r=new Map;o.forEach((t,e)=>{s.set(e,t.accessor),r.set(e,t)});const l=Array.from(t).reduce((t,e)=>{var i;const[o,l]=e.split("-").map(Number);t[o]||(t[o]=[]);const a=s.get(l),d=r.get(l);if(a&&(null===(i=n[o])||void 0===i?void 0:i.row)){const e=n[o].row,i=ct(e,a);if(!1!==(null==d?void 0:d.useFormattedValueForClipboard)&&(null==d?void 0:d.valueFormatter)){const n=d.valueFormatter({accessor:a,colIndex:l,row:e,rowIndex:o,value:i});t[o][l]=n}else t[o][l]=!d||"lineAreaChart"!==d.type&&"barChart"!==d.type?i:Array.isArray(i)?i.join(", "):""}else t[o][l]="";return t},{}),a=new Set;i&&Array.from(t).forEach(t=>{const[,e]=t.split("-").map(Number);a.add(e)});let d="";i&&a.size>0&&(d=Array.from(a).sort((t,e)=>t-e).map(t=>{var e;const n=r.get(t);return null!==(e=null==n?void 0:n.label)&&void 0!==e?e:""}).join("\t"));const c=Object.values(l).map(t=>Object.values(t).join("\t")).join("\n");return i&&d?`${d}\n${c}`:c})(t,0,this.config.tableRows,this.config.copyHeadersToClipboard);navigator.clipboard.writeText(e),this.copyFlashCells=new Set(t),this.updateCellFlashClasses(),setTimeout(()=>{this.copyFlashCells=new Set,this.updateCellFlashClasses()},800)}async pasteFromClipboard(){if(this.initialFocusedCell)try{const t=await navigator.clipboard.readText();if(!t)return;const{updatedCells:e,warningCells:n}=((t,e,n,i,o,s)=>{const r=new Set,l=new Set,a=t.split("\n").filter(t=>t.length>0);if(0===a.length)return{updatedCells:r,warningCells:l};const d=n.filter(t=>!Z(t)),c=i.findIndex(t=>pt(t.rowId)===e.rowId+""),h=0>c?e.rowIndex:c,u=e.colIndex;return a.forEach((t,e)=>{t.split("\t").forEach((t,n)=>{var a;const c=h+e,f=u+n;if(c>=i.length||f>=d.length)return;const v=i[c],p=d[f],w=pt(v.rowId);if(!(null==p?void 0:p.editable))return void l.add(`${c}-${f}-${w}`);let m=t;if("number"===p.type){const e=+t;isNaN(e)||(m=e)}else if("boolean"===p.type)m="true"===t.toLowerCase()||"1"===t;else if("date"===p.type){const e=new Date(t);isNaN(e.getTime())||(m=e)}else"lineAreaChart"!==p.type&&"barChart"!==p.type||(m=t.split(",").map(t=>{const e=+t.trim();return isNaN(e)?0:e}));if(ut(v.row,p.accessor,m),s){const t=`${null!==(a=v.stableRowKey)&&void 0!==a?a:w}-${p.accessor}`,e=s.get(t);e&&e.updateContent(m)}null==o||o({accessor:p.accessor,newValue:m,row:v.row,rowIndex:c}),r.add(`${c}-${f}-${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,i,o)=>{const s=new Set,r=new Set,l=e.filter(t=>!Z(t)),a=new Map;return l.forEach((t,e)=>{a.set(e,t.accessor)}),Array.from(t).forEach(t=>{var e;const[a,d]=t.split("-").map(Number);if(a>=n.length||d>=l.length)return;const c=n[a],h=l[d],u=pt(c.rowId);if(!(null==h?void 0:h.editable))return void r.add(t);let f=null;if(f="string"===h.type?"":"number"===h.type?null:"boolean"!==h.type&&("date"===h.type?null:"lineAreaChart"===h.type||"barChart"===h.type||Array.isArray(ct(c.row,h.accessor))?[]:""),ut(c.row,h.accessor,f),o){const t=`${null!==(e=c.stableRowKey)&&void 0!==e?e:u}-${h.accessor}`,n=o.get(t);n&&n.updateContent(f)}null==i||i({accessor:h.accessor,newValue:f,row:c.row,rowIndex:a}),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 i=this.config.enableRowSelection?n+1:n,o=pt(this.config.tableRows[e].rowId);t.add(`${e}-${i}-${o}`)}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),i=t.getAttribute("data-row-id");if(0>e||0>n||!i)return;const o=Fe({rowIndex:e,colIndex:n,rowId:i}),s=this.isInitialFocusedCell({rowIndex:e,colIndex:n,rowId:i});this.copyFlashCells.has(o)?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(o)?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 X(this.config.headers))n.set(t.accessor+"",t);for(let t=0;e.length>t;t++){const i=e[t];if(!(i instanceof HTMLElement))continue;const o=i.getAttribute("data-accessor"),s=i.getAttribute("aria-colindex");if(!o||!s)continue;const r=parseInt(s,10)-1;if(0>r||Number.isNaN(r))continue;const l=n.get(o);if(!l){for(const t of je.HEADER_SELECTION_CLASSES)i.classList.remove(t);continue}if(l.isSelectionColumn&&this.config.enableRowSelection){for(const t of je.HEADER_SELECTION_CLASSES)i.classList.remove(t);continue}const a=J(l,r),d=a.some(t=>this.selectedColumns.has(t)),c=!d&&a.some(t=>this.columnsWithSelectedCells.has(t));if(d)i.classList.add("st-header-selected"),i.classList.remove("st-header-has-highlighted-cell");else if(c)i.classList.add("st-header-has-highlighted-cell"),i.classList.remove("st-header-selected");else for(const t of je.HEADER_SELECTION_CLASSES)i.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 je.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 i=parseInt(n.getAttribute("data-row-index")||"-1",10),o=parseInt(n.getAttribute("data-col-index")||"-1",10),s=n.getAttribute("data-row-id");if(0>i||0>o||!s)continue;const r={rowIndex:i,colIndex:o,rowId:s},l=this.isSelected(r),a=this.selectedColumns.has(o),d=l&&!a,c=this.isInitialFocusedCell(r),h=this.getBorderClass(r),u=new Set;d&&(u.add(c?"st-cell-selected-first":"st-cell-selected"),h.split(" ").filter(Boolean).forEach(t=>u.add(t))),a&&u.add(c?"st-cell-column-selected-first":"st-cell-column-selected");for(const t of je.SELECTION_CLASSES){const e=u.has(t),i=n.classList.contains(t);e&&!i?n.classList.add(t):!e&&i&&n.classList.remove(t)}const f=c?"0":"-1";if(n.getAttribute("tabindex")!==f&&n.setAttribute("tabindex",f),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 je.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 i=n+"";if(this.selectedByRowIdColIndex.has(`${i}\t${t}`))return!0;const o=this.rowIdToTableIndex.get(i);if(void 0!==o){const e=Fe({rowIndex:o,colIndex:t,rowId:i});if(this.selectedCells.has(e))return!0}const s=Fe({colIndex:t,rowIndex:e,rowId:n});return this.selectedCells.has(s)}getBorderClass({colIndex:t,rowIndex:e,rowId:n}){var i;if(this.isSelecting)return"";const o=null!==(i=this.rowIdToTableIndex.get(n+""))&&void 0!==i?i:e;if(this.fullTableSelected){const e=this.config.enableRowSelection?1:0,n=this.config.enableRowSelection?this.leafHeaders.length:this.leafHeaders.length-1,i=[];return 0===o&&i.push("st-selected-top-border"),o===this.config.tableRows.length-1&&i.push("st-selected-bottom-border"),t===e&&i.push("st-selected-left-border"),t===n&&i.push("st-selected-right-border"),i.join(" ")}const s=[],r=this.config.tableRows[o-1],l=r?pt(r.rowId):null,a=this.config.tableRows[o+1],d=a?pt(a.rowId):null,c=null!==l&&this.isSelected({colIndex:t,rowIndex:o-1,rowId:l}),h=null!==d&&this.isSelected({colIndex:t,rowIndex:o+1,rowId:d}),u=this.isSelected({colIndex:t-1,rowIndex:o,rowId:n}),f=this.isSelected({colIndex:t+1,rowIndex:o,rowId:n});return(!l||!c||this.selectedColumns.has(t)&&0===o)&&s.push("st-selected-top-border"),(!d||!h||this.selectedColumns.has(t)&&o===this.config.tableRows.length-1)&&s.push("st-selected-bottom-border"),u||s.push("st-selected-left-border"),f||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 i=Fe({colIndex:t,rowIndex:e,rowId:n});return this.copyFlashCells.has(i)}isWarningFlashing({colIndex:t,rowIndex:e,rowId:n}){const i=Fe({colIndex:t,rowIndex:e,rowId:n});return this.warningFlashCells.has(i)}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=Fe(t);this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.selectedCells=new Set([e]),this.initialFocusedCell=t,this.updateDerivedState(),this.updateAllCellClasses(),setTimeout(()=>$e(t,this.config.rowHeight,this.config.customTheme,this.config.tableRows),0)}}selectCellRange(t,e){this.fullTableSelected=!1;const n=Le(t,e,this.config.tableRows,!!this.config.enableRowSelection);this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.selectedCells=n,this.startCell=t,this.initialFocusedCell=e,this.updateDerivedState(),this.updateAllCellClasses(),setTimeout(()=>$e(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=Le(t,e,this.config.tableRows,!!this.config.enableRowSelection);this.initialFocusedCell=e,this.selectedCells.size===n.size&&Array.from(n).every(t=>this.selectedCells.has(t))||(this.selectedCells=n,this.updateDerivedState(),this.updateAllCellClasses())}getCellFromMousePosition(t,e){var n;return function(t,e,n=document){const i=document.elementFromPoint(t,e);if(!i)return null;const o=i.closest(".st-cell");if(o instanceof HTMLElement){if(!n.contains(o))return De(t,e,n);const i=parseInt(o.getAttribute("data-row-index")||"-1",10),s=parseInt(o.getAttribute("data-col-index")||"-1",10),r=o.getAttribute("data-row-id");if(i>=0&&s>=0&&null!==r)return{rowIndex:i,colIndex:s,rowId:r}}return De(t,e,n)}(t,e,null!==(n=this.config.tableRoot)&&void 0!==n?n:document)}handleAutoScroll(t,e){var n;!function(t,e,n=document){const i=n.querySelector(".st-body-container");if(!i)return;const o=i.getBoundingClientRect(),s=Math.max(0,i.scrollHeight-i.clientHeight);o.top+50>e?i.scrollTop=Math.max(0,i.scrollTop-10*Math.min(3,1+Math.max(0,o.top-e)/100)):e>o.bottom-50&&(i.scrollTop=Math.min(s,i.scrollTop+10*Math.min(3,1+Math.max(0,e-o.bottom)/100)));const r=n.querySelector(".st-body-main");if(r){const e=Math.max(0,r.scrollWidth-r.clientWidth);o.left+50>t?r.scrollLeft=Math.max(0,r.scrollLeft-10*Math.min(3,1+Math.max(0,o.left-t)/100)):t>o.right-50&&(r.scrollLeft=Math.min(e,r.scrollLeft+10*Math.min(3,1+Math.max(0,t-o.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}){if(!this.config.selectableCells)return;this.fullTableSelected=!1,this.isSelecting=!0,this.startCell={rowIndex:e,colIndex:t,rowId:n},this.initialFocusedCell={rowIndex:e,colIndex:t,rowId:n};const i=Fe({colIndex:t,rowIndex:e,rowId:n});this.selectedCells=new Set([i]),setTimeout(()=>{this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.selectedCells.size>1||(this.selectedCells=new Set([i]),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(t,e,n){var i;if(this.config.selectableCells&&this.isSelecting&&this.startCell){const o=null!==(i=this.getCellFromMousePosition(e,n))&&void 0!==i?i:t;this.updateSelectionRange(this.startCell,o)}}}je.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"],je.HEADER_SELECTION_CLASSES=["st-header-selected","st-header-has-highlighted-cell"];const Ne=t=>!(!t.enableRowSelection||(!t.rowButtons||0>=t.rowButtons.length)&&!1===t.showRowSelectionColumn),Be=(t,e)=>t.filter(t=>!(!t||!t.rowId)&&e.has(pt(t.rowId))).map(t=>t.row);class ze{constructor(t){this.subscribers=new Set,this.anchorRowId=null,this.keydownHandler=null,this.config=Object.assign({rowSelectionMode:"multiple",selectRowOnClick:!1,showRowSelectionColumn:!0,selectableCells:!1},t),this.state={selectedRows:new Set,selectedRowCount:0,selectedRowsData:[],activeRowId:null},this.setupKeyboardNavigation()}updateConfig(t){this.config=Object.assign(Object.assign({},this.config),t),t.tableRows&&this.updateDerivedState()}getMode(){var t;return null!==(t=this.config.rowSelectionMode)&&void 0!==t?t:"multiple"}updateDerivedState(){var t;this.state=Object.assign(Object.assign({},this.state),{selectedRowCount:(t=this.state.selectedRows,t.size),selectedRowsData:Be(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))}fireChange(t,e,n){if(!this.config.onRowSelectionChange)return;const i=this.config.tableRows.find(e=>pt(e.rowId)===t);i&&this.config.onRowSelectionChange({row:i.row,isSelected:e,selectedRows:n})}applySelection(t){const e=this.state.selectedRows;this.state=Object.assign(Object.assign({},this.state),{selectedRows:t}),this.updateDerivedState(),this.config.onRowSelectionChange&&new Set([...e,...t]).forEach(n=>{const i=e.has(n),o=t.has(n);i!==o&&this.fireChange(n,o,t)}),this.notifySubscribers()}isRowSelected(t){return!!this.config.enableRowSelection&&(t=>this.state.selectedRows.has(t))(t)}areAllRowsSelected(){return!!this.config.enableRowSelection&&"single"!==this.getMode()&&(e=this.state.selectedRows,0!==(t=this.config.tableRows).length&&t.filter(t=>t&&t.rowId).every(t=>e.has(pt(t.rowId))));var t,e}getSelectedRows(){return this.state.selectedRows}getSelectedRowCount(){return this.state.selectedRowCount}getSelectedRowsData(){return this.state.selectedRowsData}getRow(t){return((t,e)=>{const n=this.config.tableRows.find(t=>null!=(null==t?void 0:t.rowId)&&pt(t.rowId)===e);return null==n?void 0:n.row})(0,t)}getActiveRowId(){return this.state.activeRowId}setActiveRowId(t){this.state.activeRowId!==t&&(this.state=Object.assign(Object.assign({},this.state),{activeRowId:t}),this.notifySubscribers())}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=this.getMode(),i=((t,e,n,i="multiple")=>{if("single"===i){if(e)return new Set([t]);const i=new Set(n);return i.delete(t),i}const o=new Set(n);return e?o.add(t):o.delete(t),o})(t,e,this.state.selectedRows,n);i.size===this.state.selectedRows.size&&[...i].every(t=>this.state.selectedRows.has(t))||(this.anchorRowId=t,this.state=Object.assign(Object.assign({},this.state),{activeRowId:t}),this.applySelection(i))}selectRow(t){this.handleRowSelect(t,!0)}deselectRow(t){this.handleRowSelect(t,!1)}handleSelectAll(t){if(!this.config.enableRowSelection)return;if("single"===this.getMode())return;let e;e=t?new Set(this.config.tableRows.filter(t=>t&&t.rowId).map(t=>pt(t.rowId))):new Set,this.applySelection(e)}handleToggleRow(t){if(!this.config.enableRowSelection)return;if("single"===this.getMode())return void this.handleRowSelect(t,!0);const e=this.isRowSelected(t);this.handleRowSelect(t,!e)}handleRowClickSelect(t){this.config.enableRowSelection&&this.config.selectRowOnClick&&this.handleToggleRow(t)}clearSelection(){this.config.enableRowSelection&&0!==this.state.selectedRows.size&&this.applySelection(new Set)}getState(){return this.state}setupKeyboardNavigation(){this.keydownHandler=this.handleKeyDown.bind(this),document.addEventListener("keydown",this.keydownHandler)}isEventInsideTable(t){const e=this.config.tableRoot;if(!e)return!1;const n=t.target;return n instanceof Node&&e.contains(n)}isTypingInFormField(){const t=document.activeElement;return t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement||"true"===(null==t?void 0:t.getAttribute("contenteditable"))}findRowIndex(t){return t?this.config.tableRows.findIndex(e=>pt(e.rowId)===t):-1}resolveActiveRowId(){if(this.state.activeRowId&&-1!==this.findRowIndex(this.state.activeRowId))return this.state.activeRowId;for(const t of this.state.selectedRows)if(-1!==this.findRowIndex(t))return t;const t=this.config.tableRows[0];return t?pt(t.rowId):null}moveActiveRow(t,e){var n;const i=this.config.tableRows;if(0===i.length)return;const o=Math.max(0,Math.min(i.length-1,t)),s=pt(i[o].rowId),r=this.getMode();if(this.state=Object.assign(Object.assign({},this.state),{activeRowId:s}),e&&"multiple"===r){const t=null!==(n=this.anchorRowId)&&void 0!==n?n:s,e=this.findRowIndex(t),r=((t,e,n)=>{const i=Math.min(e,n),o=Math.max(e,n),s=new Set([]);for(let e=i;o>=e;e++){const n=t[e];null!=(null==n?void 0:n.rowId)&&s.add(pt(n.rowId))}return s})(i,-1===e?o:e,o);return void this.applySelection(r)}this.anchorRowId=s,"single"===r?this.applySelection(new Set([s])):this.notifySubscribers()}handleKeyDown(t){var e,n,i;if(!this.config.enableRowSelection)return;if(!this.isEventInsideTable(t))return;if(this.isTypingInFormField())return;const o=!this.config.selectableCells,s=t.key;if(" "===s||"Spacebar"===s){if(t.target instanceof HTMLInputElement&&"checkbox"===t.target.type)return;t.preventDefault();const o=this.resolveActiveRowId();if(o){const t=null===(n=null===(e=document.activeElement)||void 0===e?void 0:e.closest)||void 0===n?void 0:n.call(e,"[data-row-id]"),s=null!==(i=null==t?void 0:t.getAttribute("data-row-id"))&&void 0!==i?i:o;this.handleToggleRow(s),this.state=Object.assign(Object.assign({},this.state),{activeRowId:s})}return}if(!o)return;if((t.ctrlKey||t.metaKey)&&"a"===s.toLowerCase())return void("multiple"===this.getMode()&&(t.preventDefault(),this.handleSelectAll(!0)));const r=this.resolveActiveRowId(),l=this.findRowIndex(r),a=this.config.tableRows.length-1;if(0>a)return;const d=t.shiftKey;"ArrowUp"===s?(t.preventDefault(),this.moveActiveRow(l>0?l-1:0,d)):"ArrowDown"===s?(t.preventDefault(),this.moveActiveRow(0>l?0:Math.min(a,l+1),d)):"Home"===s?(t.preventDefault(),this.moveActiveRow(0,d)):"End"===s&&(t.preventDefault(),this.moveActiveRow(a,d))}destroy(){this.keydownHandler&&(document.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=null),this.subscribers.clear()}}class Ve{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 qe{constructor(t){this.isListening=!1,this.handleClickOutside=t=>{var e,n,i,o,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!==(i=null===(n=(e=this.config).getSelectedCells)||void 0===n?void 0:n.call(e))&&void 0!==i?i:this.config.selectedCells,l=null!==(r=null===(s=(o=this.config).getSelectedColumns)||void 0===s?void 0:s.call(o))&&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 Ge{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(){if(this.headerContainer)if(this.isMainSectionScrollable){const t=null!=this.mainSection?this.mainSection.offsetWidth-this.mainSection.clientWidth:this.scrollbarWidth;this.scrollbarWidth=t,this.headerContainer.classList.add("st-header-scroll-padding"),this.headerContainer.style.setProperty("--st-after-width",t+"px")}else 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 Ke=(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 _e{constructor(t,e){this.observers=new Set,this.notifyMicrotaskScheduled=!1,this.expandedDepths=Ke(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.notifyMicrotaskScheduled||(this.notifyMicrotaskScheduled=!0,queueMicrotask(()=>{this.notifyMicrotaskScheduled=!1,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 Ue{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 Je(t){return t?t.offsetWidth-t.clientWidth:0}const Ye=(t,e,n)=>{var i;const o=document.createElement("div");o.className="st-dropdown-content",o.style.position=n.positioning||"fixed",o.style.zIndex="1000",o.style.visibility="hidden",o.style.overflow=null!==(i=n.overflow)&&void 0!==i?i:"auto",n.width&&(o.style.width=n.width+"px"),n.maxHeight&&(o.style.maxHeight=n.maxHeight+"px"),o.appendChild(e);const s=t.closest(".simple-table-root")||document.querySelector(".simple-table-root");"fixed"===n.positioning?s?s.appendChild(o):document.body.appendChild(o):t.appendChild(o),requestAnimationFrame(()=>{const{position:e,placement:i}=((t,e,n)=>{const i=t.getBoundingClientRect(),o=window.innerHeight,s=window.innerWidth,r=o-i.bottom,l=s-i.left;let a="bottom";e.offsetHeight>r&&i.top>r&&(a="top");let d="left";(n.width||e.offsetWidth)>l&&i.right>l&&(d="right");const c={};return"fixed"===n.positioning?("bottom"===a?c.top=i.bottom+4:c.bottom=o-i.top+4,"left"===d?c.left=i.left:c.right=s-i.right):("bottom"===a?c.top=i.height+4:c.bottom=i.height+4,"left"===d?c.left=0:c.right=0),{position:c,placement:`${a}-${d}`}})(t,o,n);o.className="st-dropdown-content st-dropdown-"+i,Object.entries(e).forEach(([t,e])=>{void 0!==e&&(o.style[t]=e+"px")}),o.style.visibility="visible"});const r=e=>{const n=e.target;o.contains(n)||t.contains(n)||d()},l=t=>{"Escape"===t.key&&(t.preventDefault(),d())},a=t=>{o.contains(t.target)||d()},d=()=>{o.remove(),document.removeEventListener("mousedown",r,!0),document.removeEventListener("keydown",l,!0),window.removeEventListener("scroll",a,!0),n.onClose()};return setTimeout(()=>{document.addEventListener("mousedown",r,!0),document.addEventListener("keydown",l,!0),window.addEventListener("scroll",a,!0)},0),h(o,"mousedown",t=>{t.stopPropagation()}),o},Xe=({className:t,width:e=20,height:n=20,paths:i,circles:o=[],strokeWidth:s=2})=>{const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("aria-hidden","true"),r.setAttribute("role","img"),r.setAttribute("xmlns","http://www.w3.org/2000/svg"),r.setAttribute("viewBox","0 0 24 24"),r.setAttribute("width",e+""),r.setAttribute("height",n+""),r.setAttribute("fill","none"),r.setAttribute("stroke","currentColor"),r.setAttribute("stroke-width",s+""),r.setAttribute("stroke-linecap","round"),r.setAttribute("stroke-linejoin","round"),t&&r.setAttribute("class",t);for(const t of i){const e=document.createElementNS("http://www.w3.org/2000/svg","path");e.setAttribute("d",t),e.setAttribute("fill","none"),r.appendChild(e)}for(const{cx:t,cy:e,r:n}of o){const i=document.createElementNS("http://www.w3.org/2000/svg","circle");i.setAttribute("cx",t+""),i.setAttribute("cy",e+""),i.setAttribute("r",n+""),i.setAttribute("fill","currentColor"),i.setAttribute("stroke","none"),r.appendChild(i)}return r},Qe=t=>Xe({className:t,paths:["m15 18-6-6 6-6"]}),Ze=t=>Xe({className:t,paths:["m9 18 6-6-6-6"]}),tn=t=>Xe({className:t,paths:["m5 12 7-7 7 7","M12 19V5"]}),en=t=>Xe({className:t,paths:["M12 5v14","m19 12-7 7-7-7"]}),nn=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","16"),e.setAttribute("height","10"),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 i=document.createElementNS("http://www.w3.org/2000/svg","circle");i.setAttribute("cx",t),i.setAttribute("cy",n),i.setAttribute("r","1.5"),i.setAttribute("fill","currentColor"),e.appendChild(i)}),e},on=(t,e)=>new Date(t,e+1,0).getDate(),sn=["January","February","March","April","May","June","July","August","September","October","November","December"],rn=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],ln=["Su","Mo","Tu","We","Th","Fr","Sa"],an=(t,e,n)=>{const{header:i,row:o}=t,s=ct(o,i.accessor);return"boolean"===i.type?((t,e,n,i)=>{var o;const{header:s,row:r,rowIndex:l}=t;let a;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 c=document.createElement("div");c.className="st-dropdown-item "+(!1===n?"selected":""),c.textContent="False",c.setAttribute("role","option"),c.setAttribute("aria-selected",(!1===n)+""),c.setAttribute("aria-disabled","false");const u=t=>{ut(r,s.accessor,t),e.onCellEdit&&e.onCellEdit({accessor:s.accessor,newValue:t,row:r,rowIndex:l}),a.remove(),i()};h(d,"click",()=>u(!0)),h(c,"click",()=>u(!1));const f=t=>{const e=t;"ArrowDown"===e.key||"ArrowUp"===e.key?(e.preventDefault(),document.activeElement===d?c.focus():d.focus()):"Enter"===e.key&&(e.preventDefault(),document.activeElement===d?u(!0):document.activeElement===c&&u(!1))};d.setAttribute("tabindex","0"),c.setAttribute("tabindex","0"),h(d,"keydown",f),h(c,"keydown",f);const v=document.createDocumentFragment();v.appendChild(d),v.appendChild(c);const p=ot({accessor:s.accessor,rowId:null!==(o=t.stableRowKey)&&void 0!==o?o:t.rowId}),w=document.getElementById(p);return a=Ye(w||document.body,v,{width:120,positioning:"fixed",onClose:i}),a})(t,e,!!s,n):"enum"===i.type?((t,e,n,i)=>{var o;const{header:s,row:r,rowIndex:l}=t,a=s.enumOptions||[];let d;const c=t=>{ut(r,s.accessor,t),e.onCellEdit&&e.onCellEdit({accessor:s.accessor,newValue:t,row:r,rowIndex:l}),d.remove(),i()},u=[];a.forEach((t,e)=>{const i=document.createElement("div");i.className="st-dropdown-item "+(n===t.value?"selected":""),i.textContent=t.label,i.setAttribute("role","option"),i.setAttribute("aria-selected",(n===t.value)+""),i.setAttribute("aria-disabled","false"),i.setAttribute("tabindex","0"),i.dataset.value=t.value,h(i,"click",()=>c(t.value)),u.push(i)});const f=t=>{const e=t,n=u.findIndex(t=>t===document.activeElement);if("ArrowDown"===e.key)e.preventDefault(),u[(n+1)%u.length].focus();else if("ArrowUp"===e.key)e.preventDefault(),u[(n-1+u.length)%u.length].focus();else if("Enter"===e.key){e.preventDefault();const t=document.activeElement.dataset.value;t&&c(t)}};u.forEach(t=>{h(t,"keydown",f)});const v=document.createElement("div");v.className="st-enum-dropdown-content",u.forEach(t=>v.appendChild(t));const p=ot({accessor:s.accessor,rowId:null!==(o=t.stableRowKey)&&void 0!==o?o:t.rowId}),w=document.getElementById(p);return d=Ye(w||document.body,v,{width:150,maxHeight:300,positioning:"fixed",onClose:i}),setTimeout(()=>{const t=a.findIndex(t=>t.value===n);t>=0&&u[t]?(u[t].focus(),u[t].scrollIntoView({block:"nearest"})):u.length>0&&u[0].focus()},0),d})(t,e,(s||"")+"",n):"date"===i.type?((t,e,n,i)=>{var o,s,r;const{header:l,row:a,rowIndex:d}=t;let c,u;try{u=n?Zt(n+""):new Date}catch(t){u=new Date}let f=u.getFullYear(),v=u.getMonth(),p="days";const w=document.createElement("div");w.className="st-datepicker";const m=null!==(o=e.icons.prev)&&void 0!==o?o:Qe("st-next-prev-icon"),g=null!==(s=e.icons.next)&&void 0!==s?s:Ze("st-next-prev-icon"),b=(t,e)=>{"string"==typeof e?t.innerHTML=e:t.appendChild(e.cloneNode(!0))},x=t=>{const n=t.toISOString().split("T")[0];ut(a,l.accessor,n),e.onCellEdit&&e.onCellEdit({accessor:l.accessor,newValue:n,row:a,rowIndex:d}),c.remove(),i()},y=()=>{w.innerHTML="";const t=document.createElement("div");if(t.className="st-datepicker-header","days"===p){const e=document.createElement("button");e.className="st-datepicker-nav-btn",e.setAttribute("aria-label","Previous month"),b(e,m),h(e,"click",()=>{v--,0>v&&(v=11,f--),y()});const n=document.createElement("div");n.className="st-datepicker-header-label",n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.setAttribute("aria-label","Select month"),n.textContent=`${sn[v]} ${f}`;const i=()=>{p="months",y()};h(n,"click",i),h(n,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),i())});const o=document.createElement("button");o.className="st-datepicker-nav-btn",o.setAttribute("aria-label","Next month"),b(o,g),h(o,"click",()=>{v++,v>11&&(v=0,f++),y()}),t.appendChild(e),t.appendChild(n),t.appendChild(o)}else if("months"===p){const e=document.createElement("div");e.className="st-datepicker-header-label",e.setAttribute("role","button"),e.setAttribute("tabindex","0"),e.setAttribute("aria-label","Select year"),e.textContent=f+"";const n=()=>{p="years",y()};h(e,"click",n),h(e,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),n())}),t.appendChild(e)}else{const e=document.createElement("div");e.className="st-datepicker-header-label",e.textContent="Select Year",t.appendChild(e)}w.appendChild(t);const e=document.createElement("div");if(e.className=`st-datepicker-grid st-datepicker-${p}-grid`,"days"===p){ln.forEach(t=>{const n=document.createElement("div");n.className="st-datepicker-weekday",n.textContent=t,e.appendChild(n)});const t=on(f,v),n=new Date(f,v,1).getDay(),i=on(f,v-1),o=new Date;for(let t=0;n>t;t++){const o=i-n+t+1,s=new Date(f,v-1,o),r=document.createElement("div");r.className="st-datepicker-day other-month",r.textContent=o+"",r.setAttribute("tabindex","0"),r.setAttribute("role","button"),r.setAttribute("aria-label",`${sn[s.getMonth()]} ${o}, ${s.getFullYear()}`),h(r,"click",()=>x(s)),h(r,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),x(s))}),e.appendChild(r)}const s=u.getFullYear()===f&&u.getMonth()===v;for(let n=1;t>=n;n++){const t=document.createElement("div");t.className="st-datepicker-day",t.textContent=n+"",t.setAttribute("tabindex","0"),t.setAttribute("role","button"),t.setAttribute("aria-label",`${sn[v]} ${n}, ${f}`),o.getFullYear()===f&&o.getMonth()===v&&o.getDate()===n&&t.classList.add("today"),s&&u.getDate()===n&&t.classList.add("selected");const i=new Date(f,v,n);h(t,"click",()=>x(i)),h(t,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),x(i))}),e.appendChild(t)}const r=n+t,l=Math.max(35,7*Math.ceil(r/7))-r;for(let t=1;l>=t;t++){const n=new Date(f,v+1,t),i=document.createElement("div");i.className="st-datepicker-day other-month",i.textContent=t+"",i.setAttribute("tabindex","0"),i.setAttribute("role","button"),i.setAttribute("aria-label",`${sn[n.getMonth()]} ${t}, ${n.getFullYear()}`),h(i,"click",()=>x(n)),h(i,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),x(n))}),e.appendChild(i)}}else if("months"===p)rn.forEach((t,n)=>{const i=document.createElement("div");i.className="st-datepicker-month"+(n===v?" selected":""),i.textContent=t,i.setAttribute("tabindex","0"),i.setAttribute("role","button"),i.setAttribute("aria-label",sn[n]);const o=()=>{v=n,p="days",y()};h(i,"click",o),h(i,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),o())}),e.appendChild(i)});else{const t=f-6;for(let n=t;t+12>n;n++){const t=document.createElement("div");t.className="st-datepicker-year"+(n===f?" selected":""),t.textContent=n+"",t.setAttribute("tabindex","0"),t.setAttribute("role","button"),t.setAttribute("aria-label",n+"");const i=()=>{f=n,p="months",y()};h(t,"click",i),h(t,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),i())}),e.appendChild(t)}}w.appendChild(e);const n=document.createElement("div");n.className="st-datepicker-footer";const i=document.createElement("button");i.className="st-datepicker-today-btn",i.textContent="Today",h(i,"click",()=>{const t=new Date,e=new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0);x(e)}),n.appendChild(i),w.appendChild(n)};y();const R=ot({accessor:l.accessor,rowId:null!==(r=t.stableRowKey)&&void 0!==r?r:t.rowId}),S=document.getElementById(R);return c=Ye(S||document.body,w,{width:280,overflow:"hidden",positioning:"fixed",onClose:i}),c})(t,e,s,n):((t,e,n,i)=>{const{header:o,row:s,rowIndex:r}=t,l=document.createElement("input");l.className="editable-cell-input","number"===o.type?(l.type="text",l.inputMode="decimal"):l.type="text",l.value=null!=n?n+"":"",l.setAttribute("autofocus","true"),setTimeout(()=>{l.focus(),l.select()},0);let a=!0;if("number"===o.type){const t=()=>{const t=l.value;/^-?\d*\.?\d*$/.test(t)||(l.value=t.slice(0,-1))};h(l,"input",t)}return h(l,"blur",t=>{if(!a)return void i();let n=l.value;if("number"===o.type){const t=parseFloat(l.value);n=isNaN(t)?0:t}ut(s,o.accessor,n),e.onCellEdit&&e.onCellEdit({accessor:o.accessor,newValue:n,row:s,rowIndex:r}),i()}),h(l,"keydown",t=>{const e=t;e.stopPropagation(),"Enter"===e.key?(a=!0,l.blur()):"Escape"===e.key&&(a=!1,l.blur())}),h(l,"mousedown",t=>{t.stopPropagation()}),l})(t,e,s,n)};let dn=0;const cn=()=>Xe({className:"st-checkbox-checkmark",width:12,height:12,strokeWidth:2.5,paths:["M20 6 9 17l-5-5"]}),hn=(t,e)=>{const n=t.querySelector(".st-checkbox-input"),i=t.querySelector(".st-checkbox-custom");n&&i&&n.checked!==e&&(n.checked=e,n.setAttribute("aria-checked",e+""),i.className="st-checkbox-custom "+(e?"st-checked":""),i.setAttribute("aria-hidden","true"),i.innerHTML="",e&&i.appendChild(cn()))},un=({checked:t,onChange:e,ariaLabel:n})=>{const i=document.createElement("label");i.className="st-checkbox-label";const o=document.createElement("input");o.type="checkbox",o.checked=t,o.className="st-checkbox-input",n&&o.setAttribute("aria-label",n),o.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(cn());const r=()=>{const t=o.checked;o.setAttribute("aria-checked",""+t),t?(s.classList.add("st-checked"),s.appendChild(cn())):(s.classList.remove("st-checked"),s.innerHTML=""),e(t)};return o.addEventListener("change",r),o.addEventListener("keydown",t=>{" "===t.key&&t.stopPropagation()}),i.addEventListener("mousedown",t=>{t.stopPropagation()}),i.addEventListener("dragstart",t=>{t.preventDefault(),t.stopPropagation()}),i.appendChild(o),i.appendChild(s),{element:i,update:t=>{o.checked!==t&&(o.checked=t,o.setAttribute("aria-checked",""+t),t?(s.classList.add("st-checked"),s.innerHTML="",s.appendChild(cn())):(s.classList.remove("st-checked"),s.innerHTML=""))},destroy:()=>{o.removeEventListener("change",r)}}},fn=new WeakMap,vn=new WeakMap,pn=new WeakSet,wn=(t,e,n)=>{const i=t.querySelector(".st-expand-icon-container");if(!(i&&i instanceof HTMLElement))return;const o=i.classList.contains("expanded");vn.set(i,{desired:e,options:n}),pn.has(i)||(o!==e?(pn.add(i),requestAnimationFrame(()=>{requestAnimationFrame(()=>{var t,e,n,o;pn.delete(i);const s=vn.get(i);if(vn.delete(i),!s)return;const r=s.desired;if(i.classList.contains("expanded")===r)return;const l=null!==(e=null===(t=s.options)||void 0===t?void 0:t.ariaLabelWhenExpanded)&&void 0!==e?e:"Collapse row",a=null!==(o=null===(n=s.options)||void 0===n?void 0:n.ariaLabelWhenCollapsed)&&void 0!==o?o:"Expand row";i.classList.toggle("expanded",r),i.classList.toggle("collapsed",!r),i.setAttribute("aria-label",r?l:a),i.setAttribute("aria-expanded",r+"")})})):vn.delete(i))},mn=(t,e,n,i,o)=>{if(e.valueFormatter){const s=e.valueFormatter({accessor:e.accessor,colIndex:n,row:i,rowIndex:o,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)?ee(t).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):null==t?"":t+""},gn=(t,e,n)=>{var i;const{header:o,row:s,rowIndex:r,colIndex:l,depth:a,rowId:d}=t,c=ct(s,o.accessor),u=o.isSelectionColumn&&e.enableRowSelection;if(t.tableRow.isLoadingSkeleton){const t=document.createElement("div");return t.className="st-loading-skeleton",void n.appendChild(t)}if(u){const i=document.createElement("div");i.className="st-selection-cell-content";const o=document.createElement("div");o.className="st-selection-control";const s=!!e.isRowSelected&&e.isRowSelected(d+""),r=((t,e,n)=>un({checked:n,onChange:n=>{var i;null===(i=e.handleRowSelect)||void 0===i||i.call(e,t.rowId+"",n)},ariaLabel:"Select row "+(t.displayRowNumber+1)}).element)(t,e,s);o.appendChild(r),i.appendChild(o);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 i={row:t.row,rowIndex:t.displayRowNumber};return e.rowButtons.forEach((t,e)=>{try{const e=t(i);if(!e)return;const o=document.createElement("span");o.className="st-row-button",o.appendChild(e),n.appendChild(o)}catch(t){console.error("Error rendering row button:",t)}}),n})(t,e);return l&&i.appendChild(l),void n.appendChild(i)}const f=e.rowGrouping&&e.rowGrouping[a],v=!!f&&yt(s,f),p=e.rowGrouping&&e.rowGrouping.length>a,w=!e.canExpandRowGroup||e.canExpandRowGroup(s);if(o.expandable&&(v&&p&&w||o.nestedTable||e.onRowGroupExpand&&p&&w)){const i=new Set(e.expandedDepths),o=bt(t.tableRow),s=((t,e,n)=>{const i=document.createElement("div");i.className="st-icon-container st-expand-icon-container "+(n?"expanded":"collapsed"),i.setAttribute("role","button"),i.setAttribute("aria-label",n?"Collapse row":"Expand row"),i.setAttribute("aria-expanded",n+""),i.setAttribute("tabindex","0");const o=e.icons.expand;o&&("string"==typeof o?i.innerHTML=o:(o instanceof HTMLElement||o instanceof SVGSVGElement)&&i.appendChild(o.cloneNode(!0)));const s=n=>{var o,s;n.stopPropagation();const r=i.closest("[data-row-id]"),l=r?fn.get(r):void 0,a=null!==(o=null==l?void 0:l.tableRow)&&void 0!==o?o:t.tableRow,d=null!==(s=null==l?void 0:l.row)&&void 0!==s?s:t.row,c=bt(a),h=a.depth,u=new Set(e.expandedDepths),f=e.getExpandedRows?e.getExpandedRows():e.expandedRows,v=e.getCollapsedRows?e.getCollapsedRows():e.collapsedRows,p=Rt(c,h,u,f,v),w=!p;if(p?(e.setCollapsedRows(t=>{const e=new Map(t);return e.set(c,h),e}),e.setExpandedRows(t=>{const e=new Map(t);return e.delete(c),e}),e.setRowStateMap(t=>{const e=new Map(t);return e.delete(c),e})):(e.setExpandedRows(t=>{const e=new Map(t);return e.set(c,h),e}),e.setCollapsedRows(t=>{const e=new Map(t);return e.delete(c),e})),e.onRowGroupExpand&&a.rowIndexPath&&e.rowGrouping){const n=t.header.pinned,i=t=>{setTimeout(()=>{e.setRowStateMap(e=>{const i=new Map(e),o=i.get(c)||{};return i.set(c,Object.assign(Object.assign({},o),{loading:t,triggerSection:n})),i})},0)},o=t=>{e.setRowStateMap(e=>{const i=new Map(e),o=i.get(c)||{};return i.set(c,Object.assign(Object.assign({},o),{error:t,loading:!1,triggerSection:n})),i})},s=(t,i)=>{e.setRowStateMap(e=>{const i=new Map(e),o=i.get(c)||{};return i.set(c,Object.assign(Object.assign({},o),{isEmpty:t,loading:!1,triggerSection:n})),i})};e.onRowGroupExpand({row:d,depth:h,event:{stopPropagation:()=>{},preventDefault:()=>{}},groupingKey:e.rowGrouping[h],isExpanded:w,rowIndexPath:a.rowIndexPath,rowIdPath:a.rowPath,groupingKeys:e.rowGrouping,setLoading:i,setError:o,setEmpty:s})}};return h(i,"click",s),h(i,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),s(t))}),i})(t,e,Rt(o,a,i,e.expandedRows,e.collapsedRows));n.appendChild(s)}if("lineAreaChart"===o.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:i=30,color:o,fillColor:s,fillOpacity:r=.25,strokeWidth:l=1.5,className:a="",min:d,max:c}=t;if(!e||0===e.length)return null;const h="st-line-area-gradient-"+ ++dn,u=document.createElementNS("http://www.w3.org/2000/svg","svg");u.setAttribute("width",n+""),u.setAttribute("height",i+""),u.setAttribute("preserveAspectRatio","none"),u.setAttribute("class",("st-line-area-chart "+a).trim()),u.style.display="block";let f="number"==typeof n?n:100;const v=()=>{u.innerHTML="";const t=f,n=i;u.setAttribute("viewBox",`0 0 ${t} ${n}`);const a=void 0!==d?d:Math.min(...e),v=(void 0!==c?c:Math.max(...e))-a||1,p=l/2+.5,w=Math.max(1,t-2*p),m=Math.max(1,n-2*p),g=e.map((t,n)=>({x:1===e.length?p+w/2:p+n/(e.length-1)*w,y:p+m-(t-a)/v*m})),b=g.map((t,e)=>`${0===e?"M":"L"} ${t.x.toFixed(2)},${t.y.toFixed(2)}`).join(" "),x=g[0].x,y=`${b} L ${g[g.length-1].x.toFixed(2)},${n} L ${x.toFixed(2)},${n} Z`,R=s||"var(--st-chart-fill-color)",S=document.createElementNS("http://www.w3.org/2000/svg","defs"),C=document.createElementNS("http://www.w3.org/2000/svg","linearGradient");C.setAttribute("id",h),C.setAttribute("x1","0"),C.setAttribute("y1","0"),C.setAttribute("x2","0"),C.setAttribute("y2","1");const M=document.createElementNS("http://www.w3.org/2000/svg","stop");M.setAttribute("offset","0%"),M.style.stopColor=R,M.setAttribute("stop-opacity",r+"");const I=document.createElementNS("http://www.w3.org/2000/svg","stop");I.setAttribute("offset","100%"),I.style.stopColor=R,I.setAttribute("stop-opacity",.15*r+""),C.appendChild(M),C.appendChild(I),S.appendChild(C),u.appendChild(S);const H=document.createElementNS("http://www.w3.org/2000/svg","path");H.setAttribute("d",y),H.setAttribute("fill",`url(#${h})`),H.setAttribute("stroke","none");const k=document.createElementNS("http://www.w3.org/2000/svg","path");k.setAttribute("d",b),k.setAttribute("fill","none"),k.setAttribute("stroke",o||"var(--st-chart-color)"),k.setAttribute("stroke-width",l+""),k.setAttribute("stroke-linecap","round"),k.setAttribute("stroke-linejoin","round"),u.appendChild(H),u.appendChild(k)};v();const p="undefined"!=typeof ResizeObserver?new ResizeObserver(t=>{var e,n;const i=null!==(n=null===(e=t[0])||void 0===e?void 0:e.contentRect.width)&&void 0!==n?n:0;i>0&&Math.abs(i-f)>=.5&&(f=i,v())}):null;return null==p||p.observe(u),{element:u,update:t=>{void 0===t.data||(e=t.data,e&&0!==e.length)?(void 0!==t.width&&(n=t.width,u.setAttribute("width",n+""),"number"==typeof n&&(f=n)),void 0!==t.height&&(i=t.height,u.setAttribute("height",i+"")),void 0!==t.color&&(o=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&&(a=t.className,u.setAttribute("class",("st-line-area-chart "+a).trim())),void 0!==t.min&&(d=t.min),void 0!==t.max&&(c=t.max),v()):u.innerHTML=""},destroy:()=>{null==p||p.disconnect(),u.remove()}}})(Object.assign({data:t,width:"100%",height:30},o.chartOptions));return void((null==e?void 0:e.element)&&n.appendChild(e.element))}}else if("barChart"===o.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:i=30,color:o,gap:s=2,className:r="",min:l,max:a}=t;if(!e||0===e.length)return null;const d=document.createElementNS("http://www.w3.org/2000/svg","svg");d.setAttribute("width",n+""),d.setAttribute("height",i+""),d.setAttribute("preserveAspectRatio","none"),d.setAttribute("class",("st-bar-chart "+r).trim()),d.style.display="block";let c="number"==typeof n?n:100;const h=()=>{d.innerHTML="";const t=c,n=i;d.setAttribute("viewBox",`0 0 ${t} ${n}`);const r=void 0!==l?l:Math.min(...e),h=void 0!==a?a:Math.max(...e),u=h-r||1,f=e.length;let v=Math.max(0,s);f>1&&1>(t-v*(f-1))/f&&(v=Math.max(0,Math.floor((t-f)/(f-1))));const p=(t-v*(f-1))/f,w=p+v,m=0>r,g=m?n*(h/u):n;e.forEach((t,e)=>{let i,s;m?0>t?(i=g,s=g+Math.abs(t)/u*n):(i=g-t/u*n,s=g):(i=n-(t-r)/u*n,s=n);const l=Math.round(e*w),a=Math.max(l+1,Math.round(e*w+p)),c=Math.round(i),h=Math.max(c+1,Math.round(s)),f=document.createElementNS("http://www.w3.org/2000/svg","rect");f.setAttribute("x",l+""),f.setAttribute("y",c+""),f.setAttribute("width",a-l+""),f.setAttribute("height",h-c+""),f.setAttribute("fill",o||"var(--st-chart-color)"),f.setAttribute("rx",Math.min(1,(a-l)/3)+""),d.appendChild(f)})};h();const u="undefined"!=typeof ResizeObserver?new ResizeObserver(t=>{var e,n;const i=null!==(n=null===(e=t[0])||void 0===e?void 0:e.contentRect.width)&&void 0!==n?n:0;i>0&&Math.abs(i-c)>=.5&&(c=i,h())}):null;return null==u||u.observe(d),{element:d,update:t=>{void 0===t.data||(e=t.data,e&&0!==e.length)?(void 0!==t.width&&(n=t.width,d.setAttribute("width",n+""),"number"==typeof n&&(c=n)),void 0!==t.height&&(i=t.height,d.setAttribute("height",i+"")),void 0!==t.color&&(o=t.color),void 0!==t.gap&&(s=t.gap),void 0!==t.className&&(r=t.className,d.setAttribute("class",("st-bar-chart "+r).trim())),void 0!==t.min&&(l=t.min),void 0!==t.max&&(a=t.max),h()):d.innerHTML=""},destroy:()=>{null==u||u.disconnect(),d.remove()}}})(Object.assign({data:t,width:"100%",height:30},o.chartOptions));return void((null==e?void 0:e.element)&&n.appendChild(e.element))}}if(o.cellRenderer){try{const a=o.cellRenderer({accessor:o.accessor,colIndex:l,row:s,rowIndex:t.tableRow.absoluteRowIndex||r,rowPath:t.tableRow.rowPath,theme:e.theme,value:c,formattedValue:null===(i=o.valueFormatter)||void 0===i?void 0:i.call(o,{accessor:o.accessor,colIndex:l,row:s,rowIndex:r,value:c})});if("string"==typeof a||"number"==typeof a){const t=document.createTextNode(a+"");n.appendChild(t)}else if(a instanceof Node)n.appendChild(a);else if(null!=a&&"object"==typeof a){const t=mn(c,o,l,s,r);if(null!==t){const e=document.createTextNode(t);n.appendChild(e)}}}catch(t){console.error("Error rendering cell:",t);const e=mn(c,o,l,s,r);if(null!==e){const t=document.createTextNode(e);n.appendChild(t)}}return}const m=mn(c,o,l,s,r);if(null!==m){const t=document.createTextNode(m);n.appendChild(t)}},bn=new Map,xn=new Map,yn=new WeakMap,Rn=new WeakMap,Sn=new WeakMap,Cn=(t,e,n)=>{yn.set(e,n);const i=(t=>{let e=bn.get(t);return e||(e=new Map,bn.set(t,e)),e})(n);i.has(t)||i.set(t,new Set),i.get(t).add(e)},Mn=(t,e)=>{const n=yn.get(e);if(!n)return;yn.delete(e);const i=bn.get(n);if(!i)return;const o=i.get(t);o&&(o.delete(e),0===o.size&&i.delete(t)),0===i.size&&(bn.delete(n),xn.delete(n))},In=(t,e,n)=>{var i;const o=null===(i=bn.get(n))||void 0===i?void 0:i.get(t);o&&o.forEach(t=>{e?t.classList.add("st-row-hovered"):t.classList.remove("st-row-hovered")})},Hn=(t,e)=>{var n;const{header:i,rowIndex:o,colIndex:s,rowId:r,depth:l,isOdd:a}=t,d=i.isSelectionColumn&&e.enableRowSelection,c=!!(null==i?void 0:i.editable)||!(!e.onCellClick||d)||!(!e.selectRowOnClick||!e.enableRowSelection||d),h={rowIndex:o,colIndex:s,rowId:r},u=e.getBorderClass(h),f=e.isSelected(h),v=e.isInitialFocusedCell(h),p=e.isCopyFlashing(h),w=e.isWarningFlashing(h),m=e.selectedColumns.has(s),g=f&&!m,b=d&&e.rowsWithSelectedCells.has(r+""),x=(()=>{var t,n,o;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"===i.pinned?(null===(t=s[s.length-1])||void 0===t?void 0:t.accessor)===i.accessor:"right"===i.pinned?(null===(n=l[l.length-1])||void 0===n?void 0:n.accessor)===i.accessor:(null===(o=r[r.length-1])||void 0===o?void 0:o.accessor)===i.accessor})();return["st-cell","st-row-position-"+t.tableRow.position,l>0&&i.expandable?"st-cell-depth-"+l:"",g?v?"st-cell-selected-first "+u:"st-cell-selected "+u:"",m?v?"st-cell-column-selected-first":"st-cell-column-selected":"",c?"clickable":"",p?v?"st-cell-copy-flash-first":"st-cell-copy-flash":"",w?v?"st-cell-warning-flash-first":"st-cell-warning-flash":"",e.oddColumnBackground?s%2==0?"even-column":"odd-column":"",d?"st-selection-cell":"",b?"st-selection-has-highlighted-cell":"",x?"st-last-column":"","",e.oddEvenRowBackground?a?"st-cell-even-row":"st-cell-odd-row":"",(null===(n=e.isRowSelected)||void 0===n?void 0:n.call(e,r))?"st-cell-selected-row":"",null!=e.activeRowId&&e.activeRowId+""==r+""?"st-row-active":""].filter(Boolean).join(" ")},kn=(t,e)=>{var n,i,o;const{header:s,row:r,rowIndex:l,colIndex:a,rowId:d}=t,c=s.isSelectionColumn&&e.enableRowSelection,u={rowIndex:l,colIndex:a,rowId:d},f=e.isInitialFocusedCell(u),v=Hn(t,e),p=document.createElement("div");p.className=v,p.id=ot({accessor:s.accessor,rowId:null!==(n=t.stableRowKey)&&void 0!==n?n:d}),p.setAttribute("role",void 0!==e.rowHeaderAccessor&&s.accessor===e.rowHeaderAccessor?"rowheader":"gridcell"),p.setAttribute("tabindex",f?"0":"-1");const w=null!==(i=e.maxHeaderDepth)&&void 0!==i?i:1;p.setAttribute("aria-rowindex",t.tableRow.position+w+1+""),p.setAttribute("aria-colindex",a+1+""),e.enableRowSelection&&p.setAttribute("aria-selected",(null===(o=e.isRowSelected)||void 0===o?void 0:o.call(e,d))?"true":"false"),p.setAttribute("data-row-index",l+""),p.setAttribute("data-col-index",a+""),p.setAttribute("data-row-id",d+""),p.setAttribute("data-accessor",s.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"===s.type||"date"===s.type||"enum"===s.type,b=()=>{var n,i,o,r;const l=null!==(i=null===(n=fn.get(p))||void 0===n?void 0:n.context)&&void 0!==i?i:e;if(m&&!g){null===(o=l.onRendererHostDiscard)||void 0===o||o.call(l,p),p.innerHTML="",p.setAttribute("tabindex","-1");const e=an(t,l,()=>{m=!1,p.setAttribute("tabindex",f?"0":"-1"),b(),y()});if(e){const t=document.createElement("div");t.className="st-cell-editing",t.appendChild(e),p.appendChild(t)}}else if(m&&g)an(t,l,()=>{m=!1,b(),y()});else{null===(r=l.onRendererHostDiscard)||void 0===r||r.call(l,p),p.innerHTML="";const e=document.createElement("span");e.className="st-cell-content "+("right"===s.align?"right-aligned":"center"===s.align?"center-aligned":"left-aligned"),gn(t,l,e),p.appendChild(e)}};b(),t.header.expandable||Sn.set(p,{row:t.row,value:ct(r,s.accessor),theme:e.theme,skeleton:!!t.tableRow.isLoadingSkeleton});const x={row:r,tableRow:t.tableRow,context:e};fn.set(p,x);const y=()=>{var n;if(e.cellRegistry&&!c){const i=ot({accessor:s.accessor,rowId:null!==(n=t.stableRowKey)&&void 0!==n?n:d});Rn.set(p,i),e.cellRegistry.set(i,{updateContent:t=>{var n,i;if(!m){if(ut(x.row,s.accessor,t),b(),!s.expandable){const t=null!==(i=null===(n=fn.get(p))||void 0===n?void 0:n.context)&&void 0!==i?i:e;Sn.set(p,{row:x.row,value:ct(x.row,s.accessor),theme:t.theme,skeleton:!!x.tableRow.isLoadingSkeleton})}e.cellUpdateFlash&&(p.classList.add(f?"st-cell-updating-first":"st-cell-updating"),setTimeout(()=>{p.classList.remove("st-cell-updating-first","st-cell-updating")},800))}}})}};if(y(),!m&&!c){const t=t=>{var n,i;const o=t.target;if(o.closest("a, button, input, select, textarea, [contenteditable='true']"))return;if(t.preventDefault(),o.closest(".st-expand-icon-container"))return;const s=parseInt(null!==(n=p.getAttribute("data-row-index"))&&void 0!==n?n:"-1",10),r=parseInt(null!==(i=p.getAttribute("data-col-index"))&&void 0!==i?i:"-1",10),l=p.getAttribute("data-row-id");0>s||0>r||null===l||e.handleMouseDown({rowIndex:s,colIndex:r,rowId:l})},n=t=>{var n,i;const o=t,s=parseInt(null!==(n=p.getAttribute("data-row-index"))&&void 0!==n?n:"-1",10),r=parseInt(null!==(i=p.getAttribute("data-col-index"))&&void 0!==i?i:"-1",10),l=p.getAttribute("data-row-id");e.handleMouseOver(0>s||0>r||null===l?u:{rowIndex:s,colIndex:r,rowId:l},o.clientX,o.clientY)};h(p,"mousedown",t),h(p,"mouseover",n)}if(h(p,"keydown",t=>{m||c||"F2"!==t.key&&"Enter"!==t.key||!s.editable||m||(t.preventDefault(),m=!0,b())}),h(p,"dblclick",t=>{!s.editable||c||m||(m=!0,b())}),(e.onCellClick||e.selectRowOnClick)&&!c){const t=t=>{var n,i,o,c,h,u,f,v;if(t.target.closest(".st-expand-icon-container"))return;const w=null!==(i=null===(n=fn.get(p))||void 0===n?void 0:n.row)&&void 0!==i?i:r,m=null!==(c=null===(o=fn.get(p))||void 0===o?void 0:o.context)&&void 0!==c?c:e,g=null!==(h=p.getAttribute("data-row-id"))&&void 0!==h?h:d+"";if(m.selectRowOnClick&&m.enableRowSelection&&(null===(u=m.handleToggleRow)||void 0===u||u.call(m,g)),m.onCellClick){const t=ct(w,s.accessor),e=parseInt(null!==(f=p.getAttribute("data-row-index"))&&void 0!==f?f:l+"",10),n=parseInt(null!==(v=p.getAttribute("data-col-index"))&&void 0!==v?v:a+"",10);m.onCellClick({accessor:s.accessor,colIndex:n,row:w,rowIndex:e,value:t})}};h(p,"click",t)}if(e.hoverRowBackground){const t=d+"",n=e.hoverScopeId;Cn(t,p,n);const i=()=>{var e,i,o;const s=null!==(e=yn.get(p))&&void 0!==e?e:n,r=null!==(i=p.getAttribute("data-row-id"))&&void 0!==i?i:t,l=null!==(o=xn.get(s))&&void 0!==o?o:null;null!==l&&l!==r&&In(l,!1,s),In(r,!0,s),xn.set(s,r)},o=()=>{var e,i,o;const s=null!==(e=yn.get(p))&&void 0!==e?e:n,r=null!==(i=p.getAttribute("data-row-id"))&&void 0!==i?i:t;In(r,!1,s),(null!==(o=xn.get(s))&&void 0!==o?o:null)===r&&xn.set(s,null)};h(p,"mouseenter",i),h(p,"mouseleave",o)}return p},Tn=(t,e,n)=>{var i,o,s,r,l,a;const{rowIndex:d,colIndex:c,rowId:h}=e,u={rowIndex:d,colIndex:c,rowId:h};t.className=Hn(e,n);const f=n.isInitialFocusedCell(u);t.setAttribute("tabindex",f?"0":"-1"),t.style.left=e.left+"px",t.style.top=e.top+"px";const v=t.dataset.stAccordionGrow;"horizontal"!==v&&(t.style.width=e.width+"px"),"vertical"!==v&&(t.style.height=e.height+"px"),t.setAttribute("data-row-index",d+""),t.setAttribute("data-col-index",c+"");const p=null!==(i=n.maxHeaderDepth)&&void 0!==i?i:1;t.setAttribute("aria-rowindex",e.tableRow.position+p+1+""),t.setAttribute("aria-colindex",c+1+""),n.enableRowSelection?t.setAttribute("aria-selected",(null===(o=n.isRowSelected)||void 0===o?void 0:o.call(n,h))?"true":"false"):t.hasAttribute("aria-selected")&&t.removeAttribute("aria-selected");const w=void 0!==n.rowHeaderAccessor&&e.header.accessor===n.rowHeaderAccessor?"rowheader":"gridcell";t.getAttribute("role")!==w&&t.setAttribute("role",w);const m=t.getAttribute("data-row-id"),g=h+"";if(m&&m!==g){const e=null!==(s=yn.get(t))&&void 0!==s?s:n.hoverScopeId;Mn(m,t),Cn(g,t,e)}t.setAttribute("data-row-id",g),t.setAttribute("data-accessor",e.header.accessor+"");const b=fn.get(t);if(b?(b.row=e.row,b.tableRow=e.tableRow,b.context=n):fn.set(t,{row:e.row,tableRow:e.tableRow,context:n}),e.header.expandable){const i=t.querySelector(".st-cell-content");i&&!!e.tableRow.isLoadingSkeleton!=(null!==i.querySelector(".st-loading-skeleton"))&&(null===(r=n.onRendererHostDiscard)||void 0===r||r.call(n,i),i.innerHTML="",gn(e,n,i))}else{const i=t.querySelector(".st-cell-content");if(i){const o=Sn.get(t),s=ct(e.row,e.header.accessor),r=!!e.tableRow.isLoadingSkeleton,d=i.querySelector("[data-st-portal-id]"),c=null!==d&&""===(null!==(l=d.textContent)&&void 0!==l?l:"").trim()&&0===d.childNodes.length;0!==i.childNodes.length&&!c&&void 0!==o&&o.row===e.row&&o.value===s&&o.theme===n.theme&&o.skeleton===r||(Sn.set(t,{row:e.row,value:s,theme:n.theme,skeleton:r}),null===(a=n.onRendererHostDiscard)||void 0===a||a.call(n,i),i.innerHTML="",gn(e,n,i))}}},En=t=>{if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map(En);const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=En(t[n]));return e},An=(t,e)=>t.filter(t=>t.pinned===e).some(t=>!Z(t)),On="st-accordion-animating",Wn="--st-accordion-duration",Pn="--st-accordion-easing";function $n(t){return{pinnedLeft:t.filter(t=>"left"===t.pinned),unpinned:t.filter(t=>!t.pinned),pinnedRight:t.filter(t=>"right"===t.pinned)}}function Fn(t,e){return!0===t.essential||e.has(t.accessor+"")}function Ln(t,e){let n=!1;for(const i of t){if(i.isSelectionColumn||Z(i))continue;const t=Fn(i,e);if(t&&n)return!1;t||(n=!0)}return!0}function Dn(t,e){var n;const{pinnedLeft:i,unpinned:o,pinnedRight:s}=$n(t);if(!Ln(i,e))return!1;if(!Ln(o,e))return!1;if(!Ln(s,e))return!1;for(const i of t)if((null===(n=i.children)||void 0===n?void 0:n.length)&&!jn(i.children,e))return!1;return!0}function jn(t,e){var n;if(!Ln(t,e))return!1;for(const i of t)if((null===(n=i.children)||void 0===n?void 0:n.length)&&!jn(i.children,e))return!1;return!0}function Nn(t){const{pinnedLeft:e,unpinned:n,pinnedRight:i}=$n(t);return{left:e.map(t=>t.accessor),main:n.map(t=>t.accessor),right:i.map(t=>t.accessor)}}function Bn(t,e,n){return[...t.filter(t=>Fn(e.get(t+""),n)),...t.filter(t=>!Fn(e.get(t+""),n))]}function zn(t,e,n){const i=new Set(t.map(t=>t.accessor+"")),o=[...e.left,...e.main,...e.right];if(o.length!==i.size)return null;for(const t of o)if(!i.has(t+""))return null;const s=new Map(t.map(t=>[t.accessor+"",t])),r=Bn(e.left,s,n),l=Bn(e.main,s,n),a=Bn(e.right,s,n),d=(t,e)=>{const n=Object.assign({},t);return"left"===e?n.pinned="left":"right"===e?n.pinned="right":delete n.pinned,n};return[...r.map(t=>d(s.get(t+""),"left")),...l.map(t=>d(s.get(t+""),void 0)),...a.map(t=>d(s.get(t+""),"right"))]}function Vn(t,e,n,i){const o=e+"",s=Nn(t),r=s.left.filter(t=>t+""!==o),l=s.main.filter(t=>t+""!==o),a=s.right.filter(t=>t+""!==o),d=t.find(t=>t.accessor+""===o);return d&&(!Fn(d,i)||"main"!==n||"left"!==d.pinned&&"right"!==d.pinned)?("left"===n?r.push(e):"right"===n?a.push(e):"left"===d.pinned?l.unshift(e):l.push(e),zn(t,{left:r,main:l,right:a},i)):null}class qn{static resolveIcons(t){var e,n,i,o,s,r,l,a,d,c,h,u,f,v,p,w,m,g;const b={drag:nn("st-drag-icon"),expand:Ze("st-expand-icon"),filter:Xe({className:"st-header-icon",paths:["M3 6h18","M7 12h10","M10 18h4"]}),headerCollapse:Ze("st-header-icon"),headerExpand:Qe("st-header-icon"),next:Ze("st-next-prev-icon"),prev:Qe("st-next-prev-icon"),sortDown:en("st-header-icon"),sortUp:tn("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!==(o=null===(i=t.icons)||void 0===i?void 0:i.expand)&&void 0!==o?o:b.expand,filter:null!==(r=null===(s=t.icons)||void 0===s?void 0:s.filter)&&void 0!==r?r:b.filter,headerCollapse:null!==(a=null===(l=t.icons)||void 0===l?void 0:l.headerCollapse)&&void 0!==a?a:b.headerCollapse,headerExpand:null!==(c=null===(d=t.icons)||void 0===d?void 0:d.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!==(v=null===(f=t.icons)||void 0===f?void 0:f.prev)&&void 0!==v?v:b.prev,sortDown:null!==(w=null===(p=t.icons)||void 0===p?void 0:p.sortDown)&&void 0!==w?w:b.sortDown,sortUp:null!==(g=null===(m=t.icons)||void 0===m?void 0:m.sortUp)&&void 0!==g?g:b.sortUp}}static mergeCustomTheme(t){return Object.assign(Object.assign({},e),t.customTheme)}static mergeColumnEditorConfig(t){var e,n,i,o,s,r,l,a,d,c,h,u,f;return{text:null!==(n=null===(e=t.columnEditorConfig)||void 0===e?void 0:e.text)&&void 0!==n?n:"Columns",showToggle:null===(o=null===(i=t.columnEditorConfig)||void 0===i?void 0:i.showToggle)||void 0===o||o,searchEnabled:null===(r=null===(s=t.columnEditorConfig)||void 0===s?void 0:s.searchEnabled)||void 0===r||r,searchPlaceholder:null!==(a=null===(l=t.columnEditorConfig)||void 0===l?void 0:l.searchPlaceholder)&&void 0!==a?a:"Search columns...",allowColumnPinning:null===(c=null===(d=t.columnEditorConfig)||void 0===d?void 0:d.allowColumnPinning)||void 0===c||c,searchFunction:null===(h=t.columnEditorConfig)||void 0===h?void 0:h.searchFunction,rowRenderer:null===(u=t.columnEditorConfig)||void 0===u?void 0:u.rowRenderer,customRenderer:null===(f=t.columnEditorConfig)||void 0===f?void 0:f.customRenderer}}static buildEssentialAccessors(t){return function(t){const e=new Set,n=t=>{var i;for(const o of t)o.essential&&e.add(o.accessor+""),(null===(i=o.children)||void 0===i?void 0:i.length)&&n(o.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 Ke(null===(e=t.expandAll)||void 0===e||e,t.rowGrouping)}}class Gn{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,i,o,s;const r=null!==(n=e.theme)&&void 0!==n?n:"modern-light",l=null!==(i=e.className)&&void 0!==i?i:"",a=null!==(o=e.columnBorders)&&void 0!==o&&o,d=document.createElement("div");d.className=`simple-table-root st-wrapper theme-${r} ${l} ${a?"st-column-borders":""}`;const c=document.createElement("div");c.className="st-wrapper-container";const h=document.createElement("div");h.className="st-content-wrapper";const u=document.createElement("div");u.className="st-content",u.setAttribute("role",Array.isArray(e.rowGrouping)&&e.rowGrouping.length>0?"treegrid":"grid");const f=z(e.enableColumnEditor,null===(s=e.columnEditorConfig)||void 0===s?void 0:s.showToggle);u.style.width=f>0?`calc(100% - ${f}px)`:"100%";const v=document.createElement("div");v.className="st-header-container",v.setAttribute("role","rowgroup"),this.refs.headerContainerRef.current=v;const p=document.createElement("div");p.className="st-body-container",p.setAttribute("role","rowgroup"),p.setAttribute("tabindex","0"),this.refs.tableBodyContainerRef.current=p;const w=document.createElement("div");w.id="st-footer-container";const m="top"===e.footerPosition;m&&d.classList.add("st-footer-position-top");const g=document.createElement("div");return g.setAttribute("aria-live","polite"),g.setAttribute("aria-atomic","true"),g.className="st-sr-only",u.appendChild(v),u.appendChild(p),h.appendChild(u),m?(c.appendChild(w),c.appendChild(h)):(c.appendChild(h),c.appendChild(w)),d.appendChild(c),d.appendChild(g),t.appendChild(d),this.elements={rootElement:d,wrapperContainer:c,contentWrapper:h,content:u,headerContainer:v,bodyContainer:p,footerContainer:w,ariaLiveRegion:g},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}`}syncFooterPosition(t){if(!this.elements)return;const{rootElement:e,wrapperContainer:n,contentWrapper:i,footerContainer:o}=this.elements,s="top"===t;e.classList.toggle("st-footer-position-top",s);const r=n.querySelector(".st-horizontal-scrollbar-container");if(s)return o!==n.firstElementChild&&n.insertBefore(o,i),void(r&&n.appendChild(r));r&&r.parentElement===n?n.insertBefore(o,r):o!==n.lastElementChild&&n.appendChild(o)}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 Kn=(t,e)=>{const{sort:n,icons:i}=e;if(!n||n.key.accessor!==t.accessor)return null;const o=document.createElement("div");o.className="st-icon-container",o.setAttribute("role","button"),o.setAttribute("tabindex","0"),o.setAttribute("aria-label",`Sort ${t.label} ${"asc"===n.direction?"descending":"ascending"}`);const s="asc"===n.direction?i.sortUp:i.sortDown;return s&&("string"==typeof s?o.innerHTML=s:(s instanceof HTMLElement||s instanceof SVGSVGElement)&&o.appendChild(s.cloneNode(!0))),I(o,"click",n=>{n.stopPropagation(),e.onSort(t.accessor)}),I(o,"keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),e.onSort(t.accessor))}),o},_n={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"},Un={string:["equals","notEquals","contains","notContains","startsWith","endsWith","isEmpty","isNotEmpty"],number:["equals","notEquals","greaterThan","lessThan","greaterThanOrEqual","lessThanOrEqual","between","notBetween","isEmpty","isNotEmpty"],boolean:["equals","isEmpty","isNotEmpty"],date:["equals","notEquals","before","after","between","notBetween","isEmpty","isNotEmpty"],enum:["in","notIn","isEmpty","isNotEmpty"]},Jn=["equals","notEquals","isEmpty","isNotEmpty"],Yn=(t,e)=>{var n;const i=null!==(n=Un[t])&&void 0!==n?n:Jn;if(e&&e.length>0){const t=new Set(i),n=e.filter(e=>t.has(e));if(n.length>0)return n}return i},Xn=t=>!["between","notBetween","in","notIn","isEmpty","isNotEmpty"].includes(t),Qn=t=>["between","notBetween","in","notIn"].includes(t),Zn=t=>["isEmpty","isNotEmpty"].includes(t),ti=t=>{var e;return null!==(e=null==t?void 0:t.closest(".simple-table-root"))&&void 0!==e?e:null},ei=t=>{var e,n,i;let{children:o,containerRef:s,mainBodyRef:r,anchorElement:l,onClose:a,open:d,overflow:c="auto",width:h,maxWidth:u,positioning:f="fixed",allowDescendantOverflow:v=!1}=t,p=v;const w="st-dropdown-content--allow-descendant-overflow",m=document.createElement("div");m.className="st-dropdown-content",p&&m.classList.add(w),m.style.position=f,m.style.overflow=p?"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(o);let g=l;if("fixed"===f){const t=null!==(i=null!==(n=null!==(e=ti(g))&&void 0!==e?e:ti(null!=r?r:null))&&void 0!==n?n:ti(null!=s?s:null))&&void 0!==i?i:document.querySelector(".simple-table-root");(null!=t?t:document.body).appendChild(m)}const b=t=>{d&&m&&!m.contains(t.target)&&(S(!1),null==a||a())},x=t=>{const e=t.target;if(!m.contains(e)&&!(null==g?void 0:g.contains(e))){if("absolute"===f){const t=m.parentElement;if(null==t?void 0:t.contains(e))return}S(!1),null==a||a()}},y=t=>{"Escape"===t.key&&d&&(S(!1),null==a||a())},R=t=>{"Enter"===t.key&&x(t)},S=t=>{d=t,d?(m.style.display="flex",(()=>{if(!d)return;if("absolute"===f&&!m.parentElement)return;if("fixed"===f&&!m.parentElement)return;m.style.visibility="hidden";const t=g||m.parentElement;t?requestAnimationFrame(()=>{const e=t.getBoundingClientRect(),n=m.offsetHeight,i=h||m.offsetWidth;let o;o=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=o.bottom-e.bottom,a=e.top-o.top;let d="bottom";(n>l&&a>=n||n>l&&a>l)&&(d="top");let c="left";if(i>o.right-e.right+e.width&&(c="right"),"fixed"===f)"bottom"===d?(m.style.top=e.bottom+4+"px",m.style.bottom="auto"):(m.style.bottom=window.innerHeight-e.top+4+"px",m.style.top="auto"),"left"===c?(m.style.left=e.left+"px",m.style.right="auto"):(m.style.right=window.innerWidth-e.right+"px",m.style.left="auto");else{const t=m.parentElement;if(!t)return void(m.style.visibility="visible");const n=t.getBoundingClientRect();"bottom"===d?(m.style.top=e.bottom-n.top+4+"px",m.style.bottom="auto"):(m.style.bottom=n.bottom-e.top+4+"px",m.style.top="auto"),"left"===c?(m.style.left=e.left-n.left+"px",m.style.right="auto"):(m.style.right=n.right-e.right+"px",m.style.left="auto")}m.className=`st-dropdown-content st-dropdown-${d}-${c}${p?" "+w:""}`,m.style.visibility="visible"}):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 d?S(!0):m.style.display="none",{element:m,update:t=>{void 0!==t.anchorElement&&(g=t.anchorElement),void 0!==t.open&&S(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=p?"visible":c),void 0!==t.allowDescendantOverflow&&(p=t.allowDescendantOverflow,m.classList.toggle(w,p),m.style.overflow=p?"visible":c)},destroy:()=>{S(!1),m.remove()},setOpen:S}},ni=t=>{let{value:e,onChange:n,options:i,placeholder:o="Select...",className:s="",disabled:r=!1,containerRef:l,mainBodyRef:a}=t,d=!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 f=document.createElement("span");f.className="st-custom-select-value";const v=i.find(t=>t.value===e);f.textContent=v?v.label:o;const p=(()=>{const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("class","st-custom-select-arrow"),t.setAttribute("width","12"),t.setAttribute("height","12"),t.setAttribute("viewBox","0 0 12 12"),t.setAttribute("fill","none"),t.setAttribute("xmlns","http://www.w3.org/2000/svg"),t.setAttribute("aria-hidden","true");const e=document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttribute("d","M3 4.5L6 7.5L9 4.5"),e.setAttribute("stroke","currentColor"),e.setAttribute("stroke-width","1.5"),e.setAttribute("stroke-linecap","round"),e.setAttribute("stroke-linejoin","round"),e.setAttribute("fill","none"),t.appendChild(e),t})();u.appendChild(f),u.appendChild(p),h.appendChild(u);const w=document.createElement("div");w.className="st-custom-select-options",w.setAttribute("role","listbox");const m=()=>{w.innerHTML="",i.forEach((t,n)=>{const i=document.createElement("div");i.className=`st-custom-select-option ${t.value===e?"st-custom-select-option-selected":""} ${n===c?"st-custom-select-option-focused":""}`.trim(),i.setAttribute("role","option"),i.setAttribute("aria-selected",""+(t.value===e)),i.setAttribute("tabindex","0"),i.textContent=t.label,i.addEventListener("click",()=>x(t.value)),i.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),x(t.value))}),w.appendChild(i)})};m();const g=ei({children:w,containerRef:l,mainBodyRef:a,anchorElement:u,onClose:()=>{S(!1)},open:d,overflow:"auto",positioning:"absolute"});h.appendChild(g.element);const b=t=>{e=t;const n=i.find(t=>t.value===e);f.textContent=n?n.label:o},x=t=>{b(t),n(t),S(!1),c=-1,m()},y=()=>{if(!r){if(S(!d),d)c=-1;else{const t=i.findIndex(t=>t.value===e);c=0>t?0:t}m()}},R=t=>{if(d)switch(t.key){case"ArrowDown":t.preventDefault(),c=i.length-1>c?c+1:0,m();break;case"ArrowUp":t.preventDefault(),c=c>0?c-1:i.length-1,m();break;case"Enter":if(t.preventDefault(),c>=0){const t=i[c].value;b(t),n(t),S(!1),c=-1,m()}break;case"Escape":t.preventDefault(),S(!1),c=-1,m()}},S=t=>{d=t,u.setAttribute("aria-expanded",""+d),d?(h.classList.add("st-custom-select-open"),document.addEventListener("keydown",R)):(h.classList.remove("st-custom-select-open"),document.removeEventListener("keydown",R)),g.setOpen(d)};return u.addEventListener("click",y),{element:h,update:t=>{if(void 0!==t.value){e=t.value;const n=i.find(t=>t.value===e);f.textContent=n?n.label:o,m()}void 0!==t.options&&(i=t.options,m()),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",y),document.removeEventListener("keydown",R),g.destroy(),h.remove()},setOpen:S}},ii=t=>{let{type:e="text",value:n,onChange:i,onEnter:o,placeholder:s="",autoFocus:r=!1,min:l,max:a,step:d}=t;const c=document.createElement("input");c.className="st-filter-input",c.type=e,c.value=n,c.placeholder=s,void 0!==l&&(c.min=l),void 0!==a&&(c.max=a),void 0!==d&&(c.step=d),r&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{c.focus()})});const h=t=>{i(t.target.value)},u=t=>{"Enter"===t.key&&o&&(t.preventDefault(),o())};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&&(a=t.max,c.max=a),void 0!==t.step&&(d=t.step,c.step=d),void 0!==t.onChange&&(i=t.onChange),void 0!==t.onEnter&&(o=t.onEnter)},destroy:()=>{c.removeEventListener("input",h),c.removeEventListener("keydown",u),c.remove()}}},oi=t=>{let{onApply:e,onClear:n,canApply:i,showClear:o}=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=!i,r.className=("st-filter-button st-filter-button-apply"+(i?"":" st-filter-button-disabled")).trim()};l();const a=()=>{e()};r.addEventListener("click",a),s.appendChild(r);let d=null;const c=()=>{null==n||n()},h=()=>{const t=o&&!!n;t&&!d?(d=document.createElement("button"),d.type="button",d.tabIndex=0,d.className="st-filter-button st-filter-button-clear",d.textContent="Clear",d.addEventListener("click",c),s.appendChild(d)):!t&&d&&(d.removeEventListener("click",c),d.remove(),d=null)};return h(),{element:s,update:t=>{void 0!==t.canApply&&(i=t.canApply,l()),void 0!==t.showClear&&(o=t.showClear,h()),void 0!==t.onApply&&(e=t.onApply),void 0!==t.onClear&&(n=t.onClear,h())},destroy:()=>{r.removeEventListener("click",a),d&&d.removeEventListener("click",c),s.remove()}}},si=t=>{let{onChange:e,onClose:n,value:i}=t,o=i||new Date,s="days";const r=document.createElement("div");r.className="st-datepicker";const l=(t,e)=>new Date(t,e+1,0).getDate(),a=()=>{o=new Date(o.getFullYear(),o.getMonth()-1,1),v()},d=()=>{o=new Date(o.getFullYear(),o.getMonth()+1,1),v()},c=t=>{o=new Date(t,o.getMonth(),1),s="months",v()},h=t=>{const i=o.getFullYear(),s=o.getMonth(),r=new Date(i,s,t,12,0,0);o=r,e(r),null==n||n()},u=t=>{const i=new Date(o.getFullYear(),o.getMonth()-1,t,12,0,0);o=i,e(i),null==n||n()},f=t=>{const i=new Date(o.getFullYear(),o.getMonth()+1,t,12,0,0);o=i,e(i),null==n||n()},v=()=>{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.appendChild(Qe()),e.addEventListener("click",a);const n=document.createElement("div");n.className="st-datepicker-header-label",n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.setAttribute("aria-label","Select month"),n.textContent=`${p=o,p.toLocaleString("default",{month:"long"})} ${o.getFullYear()}`,n.addEventListener("click",()=>{s="months",v()});const i=document.createElement("button");i.className="st-datepicker-nav-btn",i.appendChild(Ze()),i.addEventListener("click",d),t.appendChild(e),t.appendChild(n),t.appendChild(i)}else if("months"===s){const e=document.createElement("div");e.className="st-datepicker-header-label",e.setAttribute("role","button"),e.setAttribute("tabindex","0"),e.setAttribute("aria-label","Select year"),e.textContent=""+o.getFullYear(),e.addEventListener("click",()=>{s="years",v()}),t.appendChild(e)}else{const e=document.createElement("div");e.className="st-datepicker-header-label",e.textContent="Select Year",t.appendChild(e)}var p;r.appendChild(t);const w=document.createElement("div");var m;w.className=`st-datepicker-grid st-datepicker-${s}-grid`,"days"===s?(t=>{const e=o.getFullYear(),n=o.getMonth(),s=l(e,n),r=((t,e)=>new Date(t,e,1).getDay())(e,n),a=l(e,n-1);["Su","Mo","Tu","We","Th","Fr","Sa"].forEach(e=>{const n=document.createElement("div");n.className="st-datepicker-weekday",n.textContent=e,t.appendChild(n)});for(let e=0;r>e;e++){const n=a-r+e+1,i=document.createElement("div");i.className="st-datepicker-day other-month",i.textContent=""+n,i.addEventListener("click",()=>u(n)),t.appendChild(i)}for(let o=1;s>=o;o++){const s=o===(new Date).getDate()&&n===(new Date).getMonth()&&e===(new Date).getFullYear(),r=new Date(i),l=o===r.getDate()&&n===r.getMonth()&&e===r.getFullYear(),a=document.createElement("div");a.className=`st-datepicker-day ${s?"today":""} ${l?"selected":""}`.trim(),a.textContent=""+o,a.addEventListener("click",()=>h(o)),t.appendChild(a)}const d=35-(r+s);for(let e=1;d>=e;e++){const n=document.createElement("div");n.className="st-datepicker-day other-month",n.textContent=""+e,n.addEventListener("click",()=>f(e)),t.appendChild(n)}})(w):"months"===s?(m=w,Array.from({length:12},(t,e)=>new Date(2e3,e,1).toLocaleString("default",{month:"short"})).forEach((t,e)=>{const n=e===o.getMonth(),i=document.createElement("div");i.className=("st-datepicker-month "+(n?"selected":"")).trim(),i.textContent=t,i.addEventListener("click",()=>(t=>{o=new Date(o.getFullYear(),t,1),s="days",v()})(e)),m.appendChild(i)})):(t=>{const e=o.getFullYear(),n=e-6;for(let i=n;n+12>i;i++){const n=i===e,o=document.createElement("div");o.className=("st-datepicker-year "+(n?"selected":"")).trim(),o.textContent=""+i,o.addEventListener("click",()=>c(i)),t.appendChild(o)}})(w),r.appendChild(w);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,i=new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0);o=i,e(i),null==n||n()}),g.appendChild(b),r.appendChild(g)};return v(),{element:r,update:t=>{void 0!==t.value&&(i=t.value,o=i||new Date,v()),void 0!==t.onChange&&(e=t.onChange),void 0!==t.onClose&&(n=t.onClose)},destroy:()=>{r.remove()}}},ri=t=>{const{header:e}=t;switch(e.type){case"string":default:return(t=>{let{header:e,currentFilter:n,onApplyFilter:i,onClearFilter:o,containerRef:s,mainBodyRef:r}=t;const l=Yn("string",e.filterOperators),a=l.includes("contains")?"contains":l[0];let d=(null==n?void 0:n.operator)||a;l.includes(d)||(d=a);let c=((null==n?void 0:n.value)||"")+"";const h=document.createElement("div");h.className="st-filter-container";const u=document.createElement("div");u.className="st-filter-section";const f=ni({value:d,onChange:t=>{d=t,b()},options:l.map(t=>({value:t,label:_n[t]})),containerRef:s,mainBodyRef:r});u.appendChild(f.element),h.appendChild(u);let v=null,p=null,w=null;const m=()=>{const t=Object.assign({accessor:e.accessor,operator:d},Xn(d)&&{value:c});i(t)},g=()=>Zn(d)||""!==c.trim(),b=()=>{v&&(v.remove(),v=null),p&&(p.destroy(),p=null),Xn(d)&&(v=document.createElement("div"),v.className="st-filter-section",p=ii({type:"text",value:c,onChange:t=>{c=t,w&&w.update({canApply:g()})},onEnter:m,placeholder:"Filter...",autoFocus:!0}),v.appendChild(p.element),h.insertBefore(v,h.lastChild)),w&&w.update({canApply:g()})};return w=oi({onApply:m,onClear:o,canApply:g(),showClear:!!n}),h.appendChild(w.element),b(),{element:h,update:t=>{void 0!==t.currentFilter&&(n=t.currentFilter,d=(null==n?void 0:n.operator)||a,l.includes(d)||(d=a),c=((null==n?void 0:n.value)||"")+"",f.update({value:d}),p&&p.update({value:c}),w&&w.update({showClear:!!n,canApply:g()}),b())},destroy:()=>{f.destroy(),p&&p.destroy(),w&&w.destroy(),h.remove()}}})(t);case"number":return(t=>{var e,n;let{header:i,currentFilter:o,onApplyFilter:s,onClearFilter:r,containerRef:l,mainBodyRef:a}=t;const d=Yn("number",i.filterOperators),c=d.includes("equals")?"equals":d[0];let h=(null==o?void 0:o.operator)||c;d.includes(h)||(h=c);let u=((null==o?void 0:o.value)||"")+"",f=((null===(e=null==o?void 0:o.values)||void 0===e?void 0:e[0])||"")+"",v=((null===(n=null==o?void 0:o.values)||void 0===n?void 0:n[1])||"")+"";const p=document.createElement("div");p.className="st-filter-container";const w=document.createElement("div");w.className="st-filter-section";const m=ni({value:h,onChange:t=>{h=t,M()},options:d.map(t=>({value:t,label:_n[t]})),containerRef:l,mainBodyRef:a});w.appendChild(m.element),p.appendChild(w);let g=null,b=null,x=null,y=null,R=null;const S=()=>{const t={accessor:i.accessor,operator:h};Xn(h)?t.value=parseFloat(u):Qn(h)&&(t.values=[parseFloat(f),parseFloat(v)]),s(t)},C=()=>!!Zn(h)||(Xn(h)?""!==u.trim():!!Qn(h)&&""!==f.trim()&&""!==v.trim()),M=()=>{g&&(g.remove(),g=null),b&&(b.destroy(),b=null),x&&(x.destroy(),x=null),y&&(y.destroy(),y=null),Xn(h)?(g=document.createElement("div"),g.className="st-filter-section",b=ii({type:"number",value:u,onChange:t=>{u=t,R&&R.update({canApply:C()})},onEnter:S,placeholder:"Enter number...",autoFocus:!0}),g.appendChild(b.element),p.insertBefore(g,p.lastChild)):Qn(h)&&(g=document.createElement("div"),g.className="st-filter-section",x=ii({type:"number",value:f,onChange:t=>{f=t,R&&R.update({canApply:C()})},onEnter:S,placeholder:"From...",autoFocus:!0}),x.element.classList.add("st-filter-input-range-from"),y=ii({type:"number",value:v,onChange:t=>{v=t,R&&R.update({canApply:C()})},onEnter:S,placeholder:"To..."}),g.appendChild(x.element),g.appendChild(y.element),p.insertBefore(g,p.lastChild)),R&&R.update({canApply:C()})};return R=oi({onApply:S,onClear:r,canApply:C(),showClear:!!o}),p.appendChild(R.element),M(),{element:p,update:t=>{var e,n;void 0!==t.currentFilter&&(o=t.currentFilter,h=(null==o?void 0:o.operator)||c,d.includes(h)||(h=c),u=((null==o?void 0:o.value)||"")+"",f=((null===(e=null==o?void 0:o.values)||void 0===e?void 0:e[0])||"")+"",v=((null===(n=null==o?void 0:o.values)||void 0===n?void 0:n[1])||"")+"",m.update({value:h}),b&&b.update({value:u}),x&&x.update({value:f}),y&&y.update({value:v}),R&&R.update({showClear:!!o,canApply:C()}),M())},destroy:()=>{m.destroy(),b&&b.destroy(),x&&x.destroy(),y&&y.destroy(),R&&R.destroy(),p.remove()}}})(t);case"boolean":return(t=>{let{header:e,currentFilter:n,onApplyFilter:i,onClearFilter:o,containerRef:s,mainBodyRef:r}=t;const l=Yn("boolean",e.filterOperators),a=l.includes("equals")?"equals":l[0];let d=(null==n?void 0:n.operator)||a;l.includes(d)||(d=a);let c=void 0!==(null==n?void 0:n.value)?n.value+"":"true";const h=document.createElement("div");h.className="st-filter-container";const u=document.createElement("div");u.className="st-filter-section";const f=ni({value:d,onChange:t=>{d=t,b()},options:l.map(t=>({value:t,label:_n[t]})),containerRef:s,mainBodyRef:r});u.appendChild(f.element),h.appendChild(u);let v=null,p=null,w=null;const m=()=>Zn(d)||""!==c,g=[{value:"true",label:"True"},{value:"false",label:"False"}],b=()=>{v&&(v.remove(),v=null),p&&(p.destroy(),p=null),Xn(d)&&(v=document.createElement("div"),v.className="st-filter-section",p=ni({value:c,onChange:t=>{c=t,w&&w.update({canApply:m()})},options:g,containerRef:s,mainBodyRef:r}),v.appendChild(p.element),h.insertBefore(v,h.lastChild)),w&&w.update({canApply:m()})};return w=oi({onApply:()=>{const t={accessor:e.accessor,operator:d};Xn(d)&&(t.value="true"===c),i(t)},onClear:o,canApply:m(),showClear:!!n}),h.appendChild(w.element),b(),{element:h,update:t=>{void 0!==t.currentFilter&&(n=t.currentFilter,d=(null==n?void 0:n.operator)||a,l.includes(d)||(d=a),c=void 0!==(null==n?void 0:n.value)?n.value+"":"true",f.update({value:d}),p&&p.update({value:c}),w&&w.update({showClear:!!n,canApply:m()}),b())},destroy:()=>{f.destroy(),p&&p.destroy(),w&&w.destroy(),h.remove()}}})(t);case"date":return(t=>{var e,n;let{header:i,currentFilter:o,onApplyFilter:s,onClearFilter:r,containerRef:l,mainBodyRef:a}=t;const d=Yn("date",i.filterOperators),c=d.includes("equals")?"equals":d[0];let h=(null==o?void 0:o.operator)||c;d.includes(h)||(h=c);let u=(null==o?void 0:o.value)?o.value+"":"",f=(null===(e=null==o?void 0:o.values)||void 0===e?void 0:e[0])?o.values[0]+"":"",v=((null===(n=null==o?void 0:o.values)||void 0===n?void 0:n[1])||"")+"";const p=document.createElement("div");p.className="st-filter-container";const w=document.createElement("div");w.className="st-filter-section";const m=ni({value:h,onChange:t=>{h=t,O()},options:d.map(t=>({value:t,label:_n[t]})),containerRef:l,mainBodyRef:a});w.appendChild(m.element),p.appendChild(w);let g=null,b=null,x=null,y=null,R=null,S=null,C=null,M=null,I=null,H=null,k=null;const T=()=>!!Zn(h)||(Xn(h)?""!==u.trim():!!Qn(h)&&""!==f.trim()&&""!==v.trim()),E=t=>{if(!t)return"";const e=ee(t);return isNaN(e.getTime())?"":e.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})},A=(t,e,n,i=!1)=>{const o=document.createElement("div");o.className="st-date-input-container",o.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",i&&setTimeout(()=>s.focus(),0);let r=!1;const d=t?ee(t):new Date,c=si({value:d,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=ei({children:c.element,containerRef:l,mainBodyRef:a,anchorElement:s,onClose:()=>{r=!1},open:!1,overflow:"hidden",positioning:"absolute",width:280});o.appendChild(s),o.appendChild(h.element);const u=()=>{r=!r,h.setOpen(r)},f=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",f),{container:o,input:s,picker:c,dropdown:h,destroy:()=>{s.removeEventListener("click",u),s.removeEventListener("keydown",f),c.destroy(),h.destroy(),o.remove()}}},O=()=>{if(g&&(g.remove(),g=null),b&&(b=null),x&&(x=null),y&&(y=null),R&&(R.destroy(),R=null),S&&(S.destroy(),S=null),C&&(C.destroy(),C=null),M&&(M.destroy(),M=null),I&&(I.destroy(),I=null),H&&(H.destroy(),H=null),Xn(h)){g=document.createElement("div"),g.className="st-filter-section";const t=A(u,t=>{u=t,k&&k.update({canApply:T()})},"Select date...",!0);b=t.container,R=t.picker,M=t.dropdown,g.appendChild(b),p.insertBefore(g,p.lastChild)}else if(Qn(h)){g=document.createElement("div"),g.className="st-filter-section";const t=A(f,t=>{f=t,k&&k.update({canApply:T()})},"From date...",!0);t.input.classList.add("st-filter-input-range-from");const e=A(v,t=>{v=t,k&&k.update({canApply:T()})},"To date...",!1);x=t.container,S=t.picker,I=t.dropdown,y=e.container,C=e.picker,H=e.dropdown,g.appendChild(x),g.appendChild(y),p.insertBefore(g,p.lastChild)}k&&k.update({canApply:T()})};return k=oi({onApply:()=>{const t={accessor:i.accessor,operator:h};Xn(h)?t.value=u:Qn(h)&&(t.values=[f,v]),s(t)},onClear:r,canApply:T(),showClear:!!o}),p.appendChild(k.element),O(),{element:p,update:t=>{var e,n;void 0!==t.currentFilter&&(o=t.currentFilter,h=(null==o?void 0:o.operator)||c,d.includes(h)||(h=c),u=(null==o?void 0:o.value)?o.value+"":"",f=(null===(e=null==o?void 0:o.values)||void 0===e?void 0:e[0])?o.values[0]+"":"",v=((null===(n=null==o?void 0:o.values)||void 0===n?void 0:n[1])||"")+"",m.update({value:h}),k&&k.update({showClear:!!o,canApply:T()}),O())},destroy:()=>{m.destroy(),R&&R.destroy(),S&&S.destroy(),C&&C.destroy(),M&&M.destroy(),I&&I.destroy(),H&&H.destroy(),k&&k.destroy(),p.remove()}}})(t);case"enum":return(t=>{let{header:e,currentFilter:n,onApplyFilter:i,onClearFilter:o}=t;const s=e.enumOptions||[],r=s.map(t=>t.value);let l=(null==n?void 0:n.values)?n.values.map(String):r,a="";const d=document.createElement("div");d.className="st-filter-container";const c=document.createElement("div");c.className="st-filter-section";const h=document.createElement("div");h.className="st-enum-filter-options";const u=document.createElement("div");u.className="st-enum-select-all";const f=un({checked:l.length===r.length,onChange:t=>{l=t?[...r]:[],b(),y&&y.update({canApply:x()})}}),v=document.createElement("span");v.className="st-enum-option-label st-enum-select-all-label",v.textContent="Select All",f.element.appendChild(v),u.appendChild(f.element),h.appendChild(u);let p=null,w=null;s.length>10&&(p=document.createElement("div"),p.className="st-enum-search",w=ii({type:"text",value:a,onChange:t=>{a=t,b()},placeholder:"Search..."}),p.appendChild(w.element),h.appendChild(p));const m=document.createElement("div");h.appendChild(m);const g=[],b=()=>{m.innerHTML="",g.forEach(t=>t.checkbox.destroy()),g.length=0;const t=a?s.filter(t=>t.label.toLowerCase().includes(a.toLowerCase())):s;if(a&&0===t.length){const t=document.createElement("div");t.className="st-enum-no-results",t.textContent="No matching options",m.appendChild(t)}else t.forEach(t=>{const e=un({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;f.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;f.element.querySelector("input").checked=e};b(),c.appendChild(h),d.appendChild(c);const x=()=>0!==l.length&&l.length!==r.length,y=oi({onApply:()=>{l.length!==r.length?i({accessor:e.accessor,operator:"in",values:l}):o()},onClear:o,canApply:x(),showClear:!!n});return d.appendChild(y.element),{element:d,update:t=>{void 0!==t.currentFilter&&(n=t.currentFilter,l=(null==n?void 0:n.values)?n.values.map(String):r,a="",w&&w.update({value:a}),b(),y&&y.update({showClear:!!n,canApply:x()}))},destroy:()=>{f.destroy(),w&&w.destroy(),g.forEach(t=>t.checkbox.destroy()),y&&y.destroy(),d.remove()}}})(t)}},li=(t,e)=>{const{filters:n,handleApplyFilter:i,handleClearFilter:o,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 a=s.filter;let d=null;if(a)if("string"==typeof a)l.innerHTML=a,d=l.querySelector("svg");else if(a instanceof HTMLElement||a instanceof SVGSVGElement){const t=a.cloneNode(!0);l.appendChild(t),d=t}if(d){const t=r?"var(--st-button-active-background-color)":"var(--st-header-icon-color)";d.style.color=t,"none"!==d.getAttribute("fill")&&(d.style.fill=t)}let c=!1,h=null,u=null;const f=n=>{if(n.stopPropagation(),c=!c,l.setAttribute("aria-expanded",c+""),c){const n=t=>{i(t),c=!1,l.setAttribute("aria-expanded","false"),u&&(u.destroy(),u=null),h&&(h.destroy(),h=null),d&&(d.style.color="var(--st-button-active-background-color)","none"!==d.getAttribute("fill")&&(d.style.fill="var(--st-button-active-background-color)"))},s=()=>{o(t.accessor),c=!1,l.setAttribute("aria-expanded","false"),u&&(u.destroy(),u=null),h&&(h.destroy(),h=null),d&&(d.style.color="var(--st-header-icon-color)","none"!==d.getAttribute("fill")&&(d.style.fill="var(--st-header-icon-color)"))},a=e.mainBodyRef.current||void 0;h=ri({header:t,currentFilter:r,onApplyFilter:n,onClearFilter:s,containerRef:a,mainBodyRef:a}),u=ei({children:h.element,containerRef:a,mainBodyRef:a,anchorElement:l,onClose:()=>{c=!1,l.setAttribute("aria-expanded","false"),h&&(h.destroy(),h=null)},open:!0,positioning:"fixed",maxWidth:320,allowDescendantOverflow:!0})}else u&&(u.destroy(),u=null),h&&(h.destroy(),h=null)};return I(l,"click",f),I(l,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),f(t))}),l},ai=(t,e)=>{var n,i;const{icons:o}=e;if(!nt(t)||t.isSelectionColumn&&e.enableRowSelection)return null;const s=(null!==(i=null===(n=e.getCollapsedHeaders)||void 0===n?void 0:n.call(e))&&void 0!==i?i: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=o.expand;l&&("string"==typeof l?r.innerHTML=l:(l instanceof HTMLElement||l instanceof SVGSVGElement)&&r.appendChild(l.cloneNode(!0)));const a=n=>{var i,o;n.stopPropagation();const s=(null!==(o=null===(i=e.getCollapsedHeaders)||void 0===i?void 0:i.call(e))&&void 0!==o?o: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 I(r,"click",a),I(r,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),a(t))}),r},di=(t,e,n=[])=>{for(let i=0;t.length>i;i++){const o=t[i];if(o.accessor===e)return[...n,i];if(o.children&&o.children.length>0){const t=di(o.children,e,[...n,i]);if(t)return t}}return null},ci=(t,e)=>{if(t.pinned)return t.pinned;const n=tt(e,t.accessor);return n?ci(n,e):void 0},hi=(t,e)=>{const n=ci(t,e);return"left"===n?"left":"right"===n?"right":"main"};function ui(t,e,n){const i=En(t);let o=!1;function s(t,e){let n,i=t;for(let t=0;e.length-1>t;t++)i=i[e[t]].children;return n=i[e[e.length-1]],n}function r(t,e,n){let i=t;for(let t=0;e.length-1>t;t++){if(!i[e[t]].children){o=!0;break}i=i[e[t]].children}i[e[e.length-1]]=n}const l=s(i,e);return r(i,e,s(i,n)),r(i,n,l),{newHeaders:i,emergencyBreak:o}}const fi=(t,e)=>{const{mainBodyWidth:n,pinnedLeftWidth:i,pinnedRightWidth:o,pinnedLeftContentWidth:s,pinnedRightContentWidth:r,tableBodyContainerRef:l,enableColumnEditor:a}=e,d=a?B:0,c=(a?o+1:o)+(l.scrollHeight>l.clientHeight?l.offsetWidth-l.clientWidth:0),h=t.querySelector(".st-horizontal-scrollbar-left"),u=null==h?void 0:h.firstElementChild;i>0&&h&&u&&(h.style.width=i+"px",u.style.width=s+"px");const f=t.querySelector(".st-horizontal-scrollbar-middle"),v=null==f?void 0:f.firstElementChild;n>0&&f&&v&&(v.style.width=n+"px");const p=t.querySelector(".st-horizontal-scrollbar-right"),w=null==p?void 0:p.firstElementChild;if(o>0&&p&&w&&(p.style.width=c+"px",w.style.width=r+"px"),d>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=d-1.5+"px")}},vi=(t,e)=>{if(e){const n=t.querySelector(".st-horizontal-scrollbar-left"),i=t.querySelector(".st-horizontal-scrollbar-middle"),o=t.querySelector(".st-horizontal-scrollbar-right");n instanceof HTMLElement&&e.unregisterPane("pinned-left",n),i instanceof HTMLElement&&e.unregisterPane("main",i),o instanceof HTMLElement&&e.unregisterPane("pinned-right",o)}t.remove()},pi=({containerWidth:t,leftWidth:e,rightWidth:n})=>t>0?Math.max(0,t-e-n):void 0,wi=({headers:t,containerWidth:e,collapsedHeaders:n})=>{let i=0,o=0,s=0;t.forEach(t=>{if(Z(t))return;const e=St(t,n).reduce((t,e)=>t+kt(e),0);"left"===t.pinned?i+=e:"right"===t.pinned?o+=e:s+=e});const r=i,l=o;if(e&&e>0){const t=e*U(e,i>0,o>0);i>t&&(i=t),o>t&&(o=t)}return{leftWidth:Q(i),rightWidth:Q(o),mainWidth:s,leftContentWidth:r,rightContentWidth:l}},mi=(t,e)=>{if(t.pinned)return t.pinned;const n=tt(e,t.accessor);return n?mi(n,e):void 0},gi=(e,n,i)=>{var o;const s=[],r=[],l=[];e.forEach(t=>{if(Z(t))return;const n=mi(t,e);"left"===n?s.push(t):"right"===n?l.push(t):r.push(t)});const a=(e,o,s)=>{var r,l;if(Z(e))return o;const d=o;if(e.children&&e.children.length>0){const l=null==n?void 0:n.has(e.accessor),c=e.children.filter(e=>{if(Z(e))return!1;const n=e.showWhen||t;return l?"parentCollapsed"===n||"always"===n:"parentExpanded"===n||"always"===n});if(e.singleRowChildren){const t=null!==(r=null==i?void 0:i.get(e.accessor))&&void 0!==r?r:kt(e);return s.set(e.accessor,{left:d,width:t}),o=d+t,c.forEach(t=>{o=a(t,o,s)}),o}c.forEach(t=>{o=a(t,o,s)}),s.set(e.accessor,{left:d,width:o-d})}else{const t=null!==(l=null==i?void 0:i.get(e.accessor))&&void 0!==l?l:kt(e);s.set(e.accessor,{left:o,width:t}),o+=t}return o},d=t=>{const e=new Map;let n=0;return t.forEach(t=>{n=a(t,n,e)}),e},c=d(s),h=d(r),u=d(l),f=new Map;c.forEach((t,e)=>f.set(e,t)),h.forEach((t,e)=>f.set(e,t)),u.forEach((t,e)=>f.set(e,t)),f.forEach((t,e)=>{const{left:n,width:i}=t,o=ot({accessor:e,rowId:"header"}),s=document.getElementById(o);c.has(e),u.has(e),s&&(s.style.left=n+"px",s.style.width=i+"px"),document.querySelectorAll(`[id$="-${e}"]`).forEach(t=>{t instanceof HTMLElement&&!t.id.endsWith("-header")&&(t.style.left=n+"px",t.style.width=i+"px")})});const v=document.querySelector(".st-body-container"),p=null!==(o=null==v?void 0:v.clientWidth)&&void 0!==o?o:0,w=wi({headers:e,containerWidth:p>0?p:void 0,collapsedHeaders:n}),{leftWidth:m,rightWidth:g,mainWidth:b,leftContentWidth:x,rightContentWidth:y}=w;if(m>0){const t=document.querySelector(".st-header-pinned-left"),e=document.querySelector(".st-body-pinned-left");t&&(t.style.width=m+"px"),e&&(e.style.width=m+"px")}if(g>0){const t=document.querySelector(".st-header-pinned-right"),e=document.querySelector(".st-body-pinned-right");t&&(t.style.width=g+"px"),e&&(e.style.width=g+"px")}const R=null==v?void 0:v.closest(".simple-table-root"),S=null==R?void 0:R.querySelector(".st-horizontal-scrollbar-container"),C=null==R?void 0:R.querySelector(".st-body-main"),M=!!(null==R?void 0:R.querySelector(".st-column-editor:not(.st-column-editor--no-toggle)"));S&&C&&v&&C.scrollWidth-C.clientWidth>1&&fi(S,{mainBodyRef:C,mainBodyWidth:b,pinnedLeftWidth:m,pinnedRightWidth:g,pinnedLeftContentWidth:x,pinnedRightContentWidth:y,tableBodyContainerRef:v,enableColumnEditor:M})},bi=({columnsToShrink:t,totalCompensation:e,initialWidthsMap:n,shrinkFloors:i})=>{if(0>e){const i=Math.abs(e),o=t.reduce((t,e)=>t+(n.get(e.accessor)||100),0);if(0===o)return;return void t.forEach((e,s)=>{const r=n.get(e.accessor)||100;let l=i*(r/o);if(s===t.length-1){const e=t.slice(0,s).reduce((t,e)=>{const i=n.get(e.accessor)||100;return t+(("number"==typeof e.width?e.width:100)-i)},0);l=i-e}e.width=r+l})}let o=e;for(;o>.5;){const e=t.map(t=>{var e;const o=n.get(t.accessor)||100,s=Math.max(null!==(e=null==i?void 0:i.get(t.accessor))&&void 0!==e?e:_,_),r=Math.min(s,o);return{column:t,headroom:Math.max(0,o-r),initialWidth:o,minWidth:r}}).filter(t=>t.headroom>0);if(0>=e.length)break;{const t=e.reduce((t,e)=>t+e.headroom,0);let n=0;const i=o;e.forEach((o,s)=>{let r=i*(o.headroom/t);r=Math.min(r,o.headroom),s===e.length-1&&(r=Math.min(i-n,o.headroom)),o.column.width=o.initialWidth-r,n+=r}),o-=n}}},xi=({childrenToResize:t=[],collapsedHeaders:e,containerWidth:n,delta:i,headers:o,initialWidthsMap:s,isParentResize:r=!1,resizedHeader:l,reverse:a,rootPinned:d,sectionHeaders:c,sectionWidth:h,sectionViewportWidth:u=0,shrinkFloors:f,startWidth:v})=>{const p=t=>t.reduce((t,e)=>{const n=s.get(e.accessor)||100;return t+Math.max(0,n-(t=>{var e;const n=s.get(t.accessor)||100,i=Math.max(null!==(e=null==f?void 0:f.get(t.accessor))&&void 0!==e?e:_,_);return Math.min(i,n)})(e))},0),w=t=>{if(!d||0>=n||0>=t)return t;const e=o.some(t=>"left"===t.pinned&&!Z(t)),i=o.some(t=>"right"===t.pinned&&!Z(t)),r=((t,e,n)=>t*U(t,e,n))(n,e,i),l=Math.max(0,r-Array.from(s.values()).reduce((t,e)=>t+e,0));return Math.min(t,l)};if(r&&t.length>1){const n=At(c,e),o=n.findIndex(e=>e.accessor===t[0].accessor),r=n.findIndex(e=>e.accessor===t[t.length-1].accessor);if(-1===o||-1===r)return;const l=0===o,m=r===n.length-1;let g;g="left"===d&&m||"right"===d&&l?[]:l?n.slice(r+1):m||a?n.slice(0,o):n.slice(r+1);const b=Array.from(s.values()).reduce((t,e)=>t+e,0),x=!d&&u>0?u:h>0?Math.max(h,b):b+Math.abs(i)+1;if(i>0){const e=Math.max(0,x-b),n=Math.max(0,i-e),o=g.length>0?p(g):0,r=Math.min(n,o);let l;l=d?0===g.length?w(i):Math.min(i,w(e)+r):i;const a=(v+l)/t.reduce((t,e)=>t+(s.get(e.accessor)||100),0);t.forEach(t=>{const e=s.get(t.accessor)||100;t.width=Math.max(e*a,_)}),r>0&&g.length>0&&bi({columnsToShrink:g,totalCompensation:r,initialWidthsMap:s,shrinkFloors:f})}else{const e=t.reduce((t,e)=>t+(s.get(e.accessor)||100),0),n=Math.max(v+i,_*t.length),o=n/e;t.forEach(t=>{const e=s.get(t.accessor)||100;t.width=Math.max(e*o,_)});const r=Math.max(0,v-n-Math.max(0,b-x));r>0&&g.length>0&&bi({columnsToShrink:g,totalCompensation:-r,initialWidthsMap:s})}return}const m=At(c,e),g=m.findIndex(t=>t.accessor===l.accessor);if(-1===g)return;const b=0===g,x=g===m.length-1;let y;if(y="left"===d&&x||"right"===d&&b?[]:b?m.slice(g+1):x||a?m.slice(0,g):m.slice(g+1),0===y.length){const t=i>0?w(i):i;return void(l.width=Math.max(v+t,_))}const R=Array.from(s.values()).reduce((t,e)=>t+e,0),S=!d&&u>0?u:h>0?Math.max(h,R):R+Math.abs(i)+1;if(i>0){const t=Math.max(0,S-R);if(t>=i){const t=w(i);return void(l.width=v+t)}const e=i-t,n=p(y),o=Math.min(e,n);if(d){const e=w(t)+o;l.width=v+e}else l.width=v+i;o>0&&bi({columnsToShrink:y,totalCompensation:o,initialWidthsMap:s,shrinkFloors:f})}else{const t=Math.max(v+i,_),e=v-t;l.width=t;const n=Math.max(0,e-Math.max(0,R-S));n>0&&bi({columnsToShrink:y,totalCompensation:-n,initialWidthsMap:s})}},yi=({mainLeafHeaders:t,mainInitialWidths:e,newMainAvailable:n,shrinkFloors:i})=>{const o=Array.from(e.values()).reduce((t,e)=>t+e,0);if(0>=n||0>=o)return;const s=n/o;if(s>=1){let i=0;return void t.forEach((o,r)=>{const l=e.get(o.accessor)||100;r===t.length-1?o.width=n-i:(o.width=Math.round(l*s),i+=o.width)})}t.forEach(t=>{var n;const o=e.get(t.accessor)||100,r=Math.min(Math.max(null!==(n=null==i?void 0:i.get(t.accessor))&&void 0!==n?n:_,_),o);t.width=Math.max(Math.round(o*s),r)})},Ri=(t,e)=>{if(t>0)return t;const n=null==e?void 0:e.current;if(!n)return 0;const i=n.closest(".simple-table-root"),o=null==i?void 0:i.querySelector(".st-body-container");return o instanceof HTMLElement?o.clientWidth:n.clientWidth},Si=({autoExpandColumns:t,collapsedHeaders:e,containerWidth:n,event:i,header:o,headers:s,mainBodyRef:r,onColumnWidthChange:l,onAutoExpandNaturalWidths:a,reverse:d=!1,setHeaders:c,setIsResizing:h,shrinkFloors:u,startWidth:f})=>{i.preventDefault();const v="clientX"in i?i.clientX:i.touches[0].clientX,p="touches"in i;if(!o||Z(o))return;const w=Ri(n,r);h(!0);const m=mi(o,s),g=Et(o);let b;if(o.children&&o.children.length>0){const t=St(o,e);b=t.length>0?t:[o]}else b=[o];const x=new Map;let y=0,R=0;if(t){const t=s.filter(t=>t.pinned===m);if(At(t,e).forEach(t=>{const e=kt(t);x.set(t.accessor,e)}),w>0){const{leftWidth:t,rightWidth:n,mainWidth:i}=wi({headers:s,containerWidth:w,collapsedHeaders:e});y="left"===m?t:"right"===m?n:i;const o=Math.max(0,w-t-n),l=null!=(null==r?void 0:r.current)&&r.current.clientWidth>0?r.current.clientWidth:0;R=l>0?Math.min(o,l):o}}let S=!1;const C=new Map;let M=[];if(t&&m&&w>0){const t=At(s.filter(t=>t.pinned===m),e);if(t.length>0){let n=!1;if(b.length>1){const e=t.findIndex(t=>t.accessor===b[0].accessor),i=t.findIndex(t=>t.accessor===b[b.length-1].accessor);n="left"===m&&i===t.length-1||"right"===m&&0===e}else{const e=b[0]||o,i=t.findIndex(t=>t.accessor===e.accessor);n="left"===m&&i===t.length-1||"right"===m&&0===i}if(n){S=!0;const t=s.filter(t=>!t.pinned);M=At(t,e),M.forEach(t=>{C.set(t.accessor,kt(t))})}}}const I=(n,i=!1)=>{const r="right"===m?v-n:n-v;if(t){const t=s.filter(t=>t.pinned===m);if(xi({childrenToResize:b,collapsedHeaders:e,containerWidth:w,delta:r,headers:s,initialWidthsMap:x,isParentResize:b.length>1,resizedHeader:b.length>0?b[b.length-1]:o,reverse:d,rootPinned:m,sectionHeaders:t,sectionWidth:y,sectionViewportWidth:m?y:R,shrinkFloors:u,startWidth:f}),S&&M.length>0){const t=b.reduce((t,e)=>{const n=x.get(e.accessor)||0;return t+(("number"==typeof e.width?e.width:n)-n)},0);yi({mainLeafHeaders:M,mainInitialWidths:C,newMainAvailable:Math.max(0,R-t),shrinkFloors:u})}}else{const t=(({header:t,headers:e,collapsedHeaders:n})=>{const i=document.querySelector(".st-body-container");if(!i||0===i.clientWidth)return 1e3;const o=i.clientWidth;if(!t.pinned)return 1/0;const s=e.some(t=>"left"===t.pinned&&!Z(t)),r=e.some(t=>"right"===t.pinned&&!Z(t)),l=o*U(o,s,r)-e.filter(e=>e.pinned===t.pinned&&e.accessor!==t.accessor).reduce((t,e)=>Z(e)?t:t+St(e,n).reduce((t,e)=>t+kt(e),0),0),a=Et(t);return a>l?(console.warn(`Header ${t.accessor} exceeds pinned section width limit`),a):l})({header:o,headers:s,collapsedHeaders:e});b.length>1?(({delta:t,leafHeaders:e,minWidth:n,startWidth:i,maxWidth:o})=>{const s=e.reduce((t,e)=>Math.min(t,Et(e)),40),r=e.reduce((t,e)=>t+("number"==typeof e.width?e.width:150),0),l=Math.max(Math.min(i+t,o),s)-r;e.forEach(t=>{const e="number"==typeof t.width?t.width:150;t.width=Math.max(e+l*(e/r),n)})})({delta:r,leafHeaders:b,minWidth:g,startWidth:f,maxWidth:t}):b[0].width=Math.max(Math.min(f+r,t),g),s.forEach(t=>{Tt(t)})}if(i){if(t&&a){const t=new Map;b.forEach(e=>{"number"==typeof e.width&&t.set(e.accessor,e.width)}),t.size>0&&a(t)}const n=[...s];c(n);const i=new Map;b.forEach(t=>{"number"==typeof t.width&&i.set(t.accessor,t.width)}),S&&M.forEach(t=>{"number"==typeof t.width&&i.set(t.accessor,t.width)}),gi(s,e,i)}else gi(s,e)};let H=null,k=null,T=v;const E=t=>{T=t,k=t,null===H&&(H=requestAnimationFrame(()=>{null!==k&&(I(k,!1),k=null),H=null}))};if(p){const t=t=>{E(t.touches[0].clientX)},e=()=>{document.removeEventListener("touchmove",t),document.removeEventListener("touchend",e),null!==H&&(cancelAnimationFrame(H),H=null),I(T,!0),h(!1),l&&l([...s])};document.addEventListener("touchmove",t),document.addEventListener("touchend",e)}else{const t=t=>{E(t.clientX)},e=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",e),null!==H&&(cancelAnimationFrame(H),H=null),I(T,!0),h(!1),l&&l([...s])};document.addEventListener("mousemove",t),document.addEventListener("mouseup",e)}},Ci=t=>{var e,n;const i=null===(e=t.mainBodyRef)||void 0===e?void 0:e.current;return i?null!==(n=i.closest(".simple-table-root"))&&void 0!==n?n:i:null},Mi=(t,e)=>{var n;for(const i of t){if(i.accessor===e)return i;if(null===(n=i.children)||void 0===n?void 0:n.length){const t=Mi(i.children,e);if(t)return t}}},Ii=(t,e)=>{const{columnResizing:n}=e;if(!n||t.isSelectionColumn&&e.enableRowSelection)return null;const i=document.createElement("div");i.className="st-header-resize-handle-container",i.setAttribute("role","separator"),i.setAttribute("aria-label",`Resize ${t.label} column`),i.setAttribute("aria-orientation","vertical");const o=document.createElement("div");o.className="st-header-resize-handle",i.appendChild(o);const s=t=>({rows:e.rows,header:t,styleRoot:Ci(e),autoSizeMode:t.autoSizeMode,sortIcon:e.icons.sortUp,expandIcon:e.icons.expand,onRendererHostDiscard:e.onRendererHostDiscard}),r=()=>{var n,i,o;const s=null!==(i=null===(n=e.getCollapsedHeaders)||void 0===n?void 0:n.call(e))&&void 0!==i?i:e.collapsedHeaders,r=e.getHeaders();return((t,e)=>{const n=At(t,e);for(const t of n){const e=document.getElementById(ot({accessor:t.accessor,rowId:"header"})),n=null==e?void 0:e.offsetWidth;null!=n&&n>0&&(t.width=n)}})(r,s),{headers:r,header:null!==(o=Mi(r,t.accessor))&&void 0!==o?o:t,collapsedHeaders:s}};let l=0;const a=()=>{const n=Date.now();120>n-l||(l=n,(()=>{var n;const i=document.getElementById(ot({accessor:t.accessor,rowId:"header"}));if(e.autoExpandColumns){const{headers:t,header:o,collapsedHeaders:l}=r();(({header:t,headers:e,collapsedHeaders:n,containerWidth:i,mainBodyRef:o,reverse:s,headerCellElement:r,getTargetLeafWidth:l,onAutoExpandNaturalWidths:a,shrinkFloors:d})=>{var c;if(!t||Z(t))return;const h=Ri(i,o),u=mi(t,e);let f;if(t.children&&t.children.length>0){const e=St(t,n);f=e.length>0?e:[t]}else f=[t];const v=new Map;let p=0,w=0;const m=e.filter(t=>t.pinned===u);if(At(m,n).forEach(t=>{const e=kt(t);v.set(t.accessor,e)}),h>0){const{leftWidth:t,rightWidth:i,mainWidth:s}=wi({headers:e,containerWidth:h,collapsedHeaders:n});p="left"===u?t:"right"===u?i:s;const r=Math.max(0,h-t-i),l=null!=(null==o?void 0:o.current)&&o.current.clientWidth>0?o.current.clientWidth:0;w=l>0?Math.min(r,l):r}let g=!1;const b=new Map;let x=[];if(u&&h>0){const i=At(e.filter(t=>t.pinned===u),n);if(i.length>0){let o=!1;if(f.length>1){const t=i.findIndex(t=>t.accessor===f[0].accessor),e=i.findIndex(t=>t.accessor===f[f.length-1].accessor);o="left"===u&&e===i.length-1||"right"===u&&0===t}else{const e=f[0]||t,n=i.findIndex(t=>t.accessor===e.accessor);o="left"===u&&n===i.length-1||"right"===u&&0===n}if(o){g=!0;const t=e.filter(t=>!t.pinned);x=At(t,n),x.forEach(t=>{b.set(t.accessor,kt(t))})}}}const y=f.reduce((t,e)=>t+l(e),0),R=null!==(c=null==r?void 0:r.offsetWidth)&&void 0!==c?c:f.reduce((t,e)=>t+kt(e),0);if(xi({childrenToResize:f,collapsedHeaders:n,containerWidth:h,delta:y-R,headers:e,initialWidthsMap:v,isParentResize:f.length>1,resizedHeader:f.length>0?f[f.length-1]:t,reverse:s,rootPinned:u,sectionHeaders:m,sectionWidth:p,sectionViewportWidth:u?p:w,shrinkFloors:d,startWidth:R}),g&&x.length>0){const t=f.reduce((t,e)=>{const n=v.get(e.accessor)||0;return t+(("number"==typeof e.width?e.width:n)-n)},0);yi({mainLeafHeaders:x,mainInitialWidths:b,newMainAvailable:Math.max(0,w-t),shrinkFloors:d})}if(a){const t=new Map;f.forEach(e=>{"number"==typeof e.width&&t.set(e.accessor,e.width)}),t.size>0&&a(t)}const S=new Map;f.forEach(t=>{"number"==typeof t.width&&S.set(t.accessor,t.width)}),g&&x.forEach(t=>{"number"==typeof t.width&&S.set(t.accessor,t.width)}),gi(e,n,S)})({header:o,headers:t,collapsedHeaders:l,containerWidth:e.containerWidth,mainBodyRef:e.mainBodyRef,reverse:e.reverse,headerCellElement:i,getTargetLeafWidth:t=>Lt(t.accessor,s(t)).width,onAutoExpandNaturalWidths:e.onAutoExpandNaturalWidths,shrinkFloors:null===(n=e.getShrinkFloors)||void 0===n?void 0:n.call(e)});const a=[...t];return e.setHeaders(a),void(e.onColumnWidthChange&&e.onColumnWidthChange(a))}const{headers:o,header:l,collapsedHeaders:a}=r(),d=Lt(l.accessor,s(l)).width,c=di(o,l.accessor);if(!c)return;const h=((t,e)=>{let n=t;for(let t=0;e.length-1>t;t++)n=n[e[t]].children;return n})(o,c),u=c[c.length-1],f=h.map((t,e)=>e===u?Object.assign(Object.assign({},t),{width:d}):t),v=((t,e,n)=>{if(1===e.length)return n;let i=t;for(let t=0;e.length-2>t;t++)i=i[e[t]].children;return i[e[e.length-2]].children=n,t})(o,c,f);v.forEach(t=>Tt(t));const p=f[u],w=new Map;p&&"number"==typeof p.width&&w.set(p.accessor+"",p.width),gi(v,a,w),e.setHeaders(v),e.onColumnWidthChange&&e.onColumnWidthChange(v)})())};return I(i,"mousedown",n=>{var i;if(n.detail>=2)return n.preventDefault(),void a();const o=null===(i=document.getElementById(ot({accessor:t.accessor,rowId:"header"})))||void 0===i?void 0:i.offsetWidth;M(()=>{var t;const{headers:i,header:s,collapsedHeaders:l}=r();Si({autoExpandColumns:e.autoExpandColumns,collapsedHeaders:l,containerWidth:e.containerWidth,event:n,forceUpdate:e.forceUpdate,header:s,headers:i,mainBodyRef:e.mainBodyRef,onColumnWidthChange:e.onColumnWidthChange,onAutoExpandNaturalWidths:e.onAutoExpandNaturalWidths,pinnedLeftRef:e.pinnedLeftRef,pinnedRightRef:e.pinnedRightRef,reverse:e.reverse,setHeaders:e.setHeaders,setIsResizing:e.setIsResizing,shrinkFloors:null===(t=e.getShrinkFloors)||void 0===t?void 0:t.call(e),startWidth:null!=o?o:q})},10)}),I(i,"touchstart",n=>{var i;const o=n,s=null===(i=document.getElementById(ot({accessor:t.accessor,rowId:"header"})))||void 0===i?void 0:i.offsetWidth;M(()=>{var t;const{headers:n,header:i,collapsedHeaders:l}=r();Si({autoExpandColumns:e.autoExpandColumns,collapsedHeaders:l,containerWidth:e.containerWidth,event:o,forceUpdate:e.forceUpdate,header:i,headers:n,mainBodyRef:e.mainBodyRef,onColumnWidthChange:e.onColumnWidthChange,onAutoExpandNaturalWidths:e.onAutoExpandNaturalWidths,pinnedLeftRef:e.pinnedLeftRef,pinnedRightRef:e.pinnedRightRef,reverse:e.reverse,setHeaders:e.setHeaders,setIsResizing:e.setIsResizing,shrinkFloors:null===(t=e.getShrinkFloors)||void 0===t?void 0:t.call(e),startWidth:null!=s?s:q})},10)}),I(i,"dblclick",a),i},Hi=(t,e,n)=>{const i=document.createElement("input");return i.type="text",i.className="st-header-edit-input",i.value=t.label||"",I(i,"blur",()=>{const o=i.value;o!==t.label&&(n=>{const i=e.headers.map(e=>e.accessor===t.accessor?Object.assign(Object.assign({},e),{label:n}):e);e.setHeaders(i),e.onHeaderEdit&&e.onHeaderEdit(t,n)})(o);const s=n.parentElement;if(s){const i=ki(t,e,o);s.replaceChild(i,n)}if(e.headerRegistry&&!t.isSelectionColumn){const n=e.headerRegistry.get(t.accessor+"");n&&n.setEditing(!1)}}),I(i,"keydown",e=>{"Enter"===e.key?(e.preventDefault(),i.blur()):"Escape"===e.key&&(e.preventDefault(),i.value=t.label||"",i.blur())}),setTimeout(()=>i.focus(),0),i},ki=(t,e,n)=>{const i=t.isSelectionColumn&&e.enableRowSelection,o=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"),i){if("single"!==e.rowSelectionMode){const t=(t=>{const e=!!t.areAllRowsSelected&&t.areAllRowsSelected();return un({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=o;if(t.tooltip&&!i){let e=null,n=null;const i=()=>{var i;n&&(clearTimeout(n),n=null),e&&(null===(i=e.parentElement)||void 0===i||i.removeChild(e),e=null),n=setTimeout(()=>{if(!s.isConnected)return void(n=null);const i=s.getBoundingClientRect();if(i.width>0&&i.height>0){e=document.createElement("div"),e.className="st-tooltip",e.textContent=t.tooltip||"",e.style.position="fixed",e.style.zIndex="10000";const n=200,o=40;let r=i.left+i.width/2-n/2,l=i.bottom+8;8>r?r=8:r+n>window.innerWidth-8&&(r=window.innerWidth-n-8),l+o>window.innerHeight-8&&(l=i.top-o-8),e.style.top=l+"px",e.style.left=r+"px",(s.closest(".simple-table-root")||document.body).appendChild(e)}n=null},500)},o=()=>{var t;n&&(clearTimeout(n),n=null),e&&(null===(t=e.parentElement)||void 0===t||t.removeChild(e),e=null)};I(s,"mouseenter",i),I(s,"mouseleave",o)}return s},Ti=(t,e,n,i)=>{const{columnReordering:o,draggedHeaderRef:s,hoveredHeaderRef:r}=i;!o||n.disableReorder||n.isSelectionColumn&&i.enableRowSelection||(t.setAttribute("draggable","true"),I(t,"dragstart",t=>{s.current=n,x(Date.now()),e.classList.add("st-dragging")}),I(t,"dragend",t=>{t.preventDefault(),s.current=null,r.current=null,e.classList.remove("st-dragging"),setTimeout(()=>{i.setHeaders(t=>[...t]),i.onColumnOrderChange&&i.onColumnOrderChange(En(i.getHeaders()))},10)}),I(e,"dragover",t=>{const e=t;e.preventDefault(),s.current&&M(()=>{const t=i.getHeaders();if(!t)return;const{screenX:o,screenY:l}=e,a=Math.sqrt(Math.pow(o-g.screenX,2)+Math.pow(l-g.screenY,2));r.current=n;const d=s.current;if(!d)return;let c,h=!1;if(hi(d,t)!==hi(n,t)){const e=function({headers:t,draggedHeader:e,hoveredHeader:n}){const i=En(t);let o=!1;try{const t=hi(n,i),s=i.findIndex(t=>t.accessor===e.accessor),r=i.findIndex(t=>t.accessor===n.accessor);if(-1===s||-1===r)return o=!0,{newHeaders:i,emergencyBreak:o};const[l]=i.splice(s,1),a=((t,e)=>{const n=Object.assign({},t);return"left"===e?n.pinned="left":"right"===e?n.pinned="right":delete n.pinned,n})(l,t);i.splice(r,0,a)}catch(t){console.error("Error in insertHeaderAcrossSections:",t),o=!0}return{newHeaders:i,emergencyBreak:o}}({headers:t,draggedHeader:d,hoveredHeader:n});c=e.newHeaders,h=e.emergencyBreak}else{const e=di(t,d.accessor),i=di(t,n.accessor);if(!e||!i)return;const o=e.length,s=i.length;let r=i;if(o!==s){const t=s-o;t>0&&(r=i.slice(0,-t))}if((u=e).length!==(f=r).length||1!==u.length&&!u.slice(0,-1).every((t,e)=>t===f[e]))return;const l=ui(t,e,r);c=l.newHeaders,h=l.emergencyBreak}var u,f;if(n.accessor===d.accessor||10>a||JSON.stringify(c)===JSON.stringify(t)||h)return;const v=i.essentialAccessors;if(v&&v.size>0&&!Dn(c,v))return;const p=Date.now();JSON.stringify(c)===JSON.stringify(b)&&(150>p-m||40>a)||(x(p),g={screenX:o,screenY:l},b=t,i.onTableHeaderDragEnd(c))},50)}),I(document.documentElement,"dragover",t=>{t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="move")}))},Ei=(e,n)=>{var i,o;const{header:s,colIndex:r,parentHeader:l}=e,{collapsedHeaders:a,columnBorders:d,columnReordering:c,enableHeaderEditing:h,selectedColumns:u,columnsWithSelectedCells:f,draggedHeaderRef:v,hoveredHeaderRef:p}=n,w=s.isSelectionColumn&&n.enableRowSelection,m=!!(null==s?void 0:s.sortable),g=a.has(s.accessor),b=!(!s.children||0===s.children.length)&&(!g||s.children.some(e=>{const n=e.showWhen||t;return"parentCollapsed"===n||"always"===n})),x=null==l?void 0:l.singleRowChildren,y=b&&!s.singleRowChildren,R=!!d&&(s.children&&0!==s.children.length?J(s,r).includes(n.lastHeaderIndex):r===n.lastHeaderIndex),S=!(!n.selectableColumns||w)&&J(s,r).some(t=>u.has(t)),C=!w&&J(s,r).some(t=>f.has(t));return["st-header-cell",s.accessor===(null===(i=p.current)||void 0===i?void 0:i.accessor)?"st-hovered":"",(null===(o=v.current)||void 0===o?void 0:o.accessor)===s.accessor?"st-dragging":"",m?"clickable":"",c&&!m?"columnReordering":"",y?"parent":"",x?"st-sub-header":"",R?"st-last-column":"",h&&!w?"st-header-editable":"",S?"st-header-selected":"",C&&!S?"st-header-has-highlighted-cell":""].filter(Boolean).join(" ")},Ai=(t,e,n,i,o)=>{var s;const r=ki(e,i),l=e.headerRenderer({accessor:e.accessor,colIndex:n,header:e,components:{sortIcon:o.sortIcon||void 0,filterIcon:o.filterIcon||void 0,collapseIcon:o.collapseIcon||void 0,labelContent:r}});l instanceof HTMLElement&&l.parentElement===t||(null===(s=i.onRendererHostDiscard)||void 0===s||s.call(i,t),H(t),t.innerHTML="",l instanceof HTMLElement?t.appendChild(l):t.appendChild(r))},Oi=(t,e,n,i=0)=>{var o,s;const r=n.pinned?n.containerWidth:null!==(o=n.mainSectionViewportWidth)&&void 0!==o?o:n.containerWidth||(null===(s=t.parentElement)||void 0===s?void 0:s.clientWidth)||t.clientWidth||0,d=n.pinned||!1===n.enableVirtualization?e:((t,e,n,i=100)=>{if(0===t.length)return[];const o=e-i,s=e+n+i;return t.filter(t=>t.left+t.width>=o&&s>=t.left)})(e,i,r);(t=>{0===t.length||t.map(t=>t.colIndex)})(e);const c=R(t),h=new Set(d.map(t=>ot({accessor:t.header.accessor,rowId:"header"}))),u=new Map,f=Array.from(new Set(e.map(t=>Math.round(t.top)))).sort((t,e)=>t-e);f.forEach((t,e)=>u.set(t,e));const v=t=>"header-band-"+Math.round(t.top),p=t=>{var e;return(null!==(e=u.get(Math.round(t.top)))&&void 0!==e?e:0)+1},w=C(t),m=n.animationCoordinator&&n.accordionAxis?n.accordionAxis:null,g="horizontal"===m?(t=>{const e=new Set,n=t=>{var i;for(const o of t)Z(o)||(e.add(o.accessor+""),(null===(i=o.children)||void 0===i?void 0:i.length)&&n(o.children))};return n(t),e})(n.headers):null;let b=!1;c.forEach((e,i)=>{var o,s,r;if(!h.has(i)){w.delete(i);const l=null!==(o=e.getAttribute("data-accessor"))&&void 0!==o?o:"",a=null!==(s=null==g?void 0:g.has(l))&&void 0!==s&&s;"horizontal"===m&&n.animationCoordinator&&!a&&n.animationCoordinator.shouldRetain(i)?n.animationCoordinator.shrinkOutCell({cellId:i,element:e,container:t,axis:m}):(null===(r=n.onRendererHostDiscard)||void 0===r||r.call(n,e),e.remove()),c.delete(i),b=!0}}),b&&H(t);const x=[];d.forEach(e=>{const i=ot({accessor:e.header.accessor,rowId:"header"});if(c.has(i)){const o=c.get(i);l(t,v(e),p(e)),o.setAttribute("aria-colindex",e.colIndex+1+""),e.header.children&&e.header.children.length>0&&o.setAttribute("aria-colspan",it(e.header,n.headers,n.collapsedHeaders)+"");const s=w.get(i);if(!s||s.left!==e.left||s.top!==e.top||s.width!==e.width||s.height!==e.height){o.style.left=e.left+"px",o.style.top=e.top+"px";const t=o.dataset.stAccordionGrow;"horizontal"!==t&&(o.style.width=e.width+"px"),"vertical"!==t&&(o.style.height=e.height+"px"),w.set(i,{left:e.left,top:e.top,width:e.width,height:e.height})}e.header.isSelectionColumn&&n.enableRowSelection&&"function"==typeof n.areAllRowsSelected&&((t,e)=>{hn(t,e)})(o,n.areAllRowsSelected());const r=Ei(e,n);if(o.className!==r&&(o.className=r),nt(e.header)){const t=n.collapsedHeaders.has(e.header.accessor);o.setAttribute("aria-expanded",!t+""),((t,e,n)=>{wn(t,!e,{ariaLabelWhenExpanded:n?`Collapse ${n} column`:"Collapse column",ariaLabelWhenCollapsed:n?`Expand ${n} column`:"Expand column",syncAriaExpanded:!0})})(o,t,e.header.label)}const a=`${n.sort&&n.sort.key.accessor===e.header.accessor?n.sort.direction:"none"}|${n.filters&&n.filters[e.header.accessor]?"1":"0"}`;o.dataset.stIconState!==a&&(((t,e,n,i)=>{const o=Kn(e,n),s=li(e,n),r=ai(e,n);if(e.headerRenderer){const l=t.querySelector(".st-header-label");return void(l&&Ai(l,e,i,n,{sortIcon:o,filterIcon:s,collapseIcon:r}))}const l=t.querySelector('.st-icon-container[aria-label*="Sort"]'),a=t.querySelector('.st-icon-container[aria-label*="Filter"]'),d=t.querySelector(".st-expand-icon-container");if(null==l||l.remove(),null==a||a.remove(),null==d||d.remove(),"right"===e.align)r&&t.insertBefore(r,t.firstChild),s&&t.insertBefore(s,t.firstChild),o&&t.insertBefore(o,t.firstChild);else{const e=t.querySelector(".st-header-resize-handle-container"),n=null!=e&&e!==t.firstChild;o&&(n?t.insertBefore(o,e):t.appendChild(o)),s&&(n?t.insertBefore(s,e):t.appendChild(s)),r&&(n?t.insertBefore(r,e):t.appendChild(r))}})(o,e.header,n,e.colIndex),o.dataset.stIconState=a)}else x.push({cell:e,cellId:i})});const y=n.animationCoordinator&&n.accordionAxis?n.accordionAxis:null,S=[];x.forEach(({cell:e,cellId:i})=>{const o=((t,e)=>{var n,i,o;const{header:s,colIndex:r}=t,{reverse:l}=e,a=s.isSelectionColumn&&e.enableRowSelection,d=Ei(t,e),c=document.createElement("div");if(c.className=d,c.id=ot({accessor:s.accessor,rowId:"header"}),c.setAttribute("data-accessor",s.accessor+""),c.setAttribute("role","columnheader"),c.setAttribute("aria-colindex",r+1+""),s.children&&s.children.length>0){const t=it(s,e.headers,e.collapsedHeaders);c.setAttribute("aria-colspan",t+"")}if(nt(s)){const t=null!==(i=null===(n=e.getCollapsedHeaders)||void 0===n?void 0:n.call(e))&&void 0!==i?i:e.collapsedHeaders;c.setAttribute("aria-expanded",!t.has(s.accessor)+"")}s.sortable&&((null===(o=e.sort)||void 0===o?void 0:o.key.accessor)===s.accessor?c.setAttribute("aria-sort","asc"===e.sort.direction?"ascending":"descending"):c.setAttribute("aria-sort","none"));const h=((t,e)=>{const n=[];return t.type&&"other"!==t.type&&n.push(t.type+" column"),t.sortable&&n.push("sortable"),e&&n.push("filterable"),t.tooltip&&n.push(t.tooltip),n.join(", ")})(s,!!s.filterable);if(h){const t="header-desc-"+s.accessor;c.setAttribute("aria-describedby",t);const e=document.createElement("span");e.id=t,e.className="st-sr-only",e.textContent=h,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 u=Kn(s,e),f=li(s,e),v=ai(s,e),p=l!==("right"===e.pinned);if(p){const t=Ii(s,e);t&&c.appendChild(t)}s.headerRenderer||"right"!==s.align||(v&&c.appendChild(v),f&&c.appendChild(f),u&&c.appendChild(u));const w=document.createElement("div");if(w.className="st-header-label",s.headerRenderer)Ai(w,s,r,e,{sortIcon:u,filterIcon:f,collapseIcon:v});else{const t=ki(s,e);w.appendChild(t)}if(I(w,"click",t=>{a||((t,e,n,i)=>{if(!e.isSelectionColumn){if(i.selectableColumns){const o=J(e,n),s=o.some(t=>i.selectedColumns.has(t));if(i.enableHeaderEditing&&s&&!t.shiftKey){const t=document.getElementById(ot({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=Hi(e,i,t);if(t.appendChild(n),i.headerRegistry&&!e.isSelectionColumn){const t=i.headerRegistry.get(e.accessor+"");t&&t.setEditing(!0)}}}}return}t.shiftKey&&i.selectColumns?i.setSelectedColumns(t=>{if(0===t.size)return new Set(o);const e=o[0],n=Array.from(t).sort((t,e)=>t-e);let i=n[0],s=Math.abs(e-i);n.forEach(t=>{const n=Math.abs(e-t);s>n&&(s=n,i=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)})(i,e),...o];return new Set([...Array.from(t),...r])}):i.selectColumns&&i.selectColumns(o),i.setSelectedCells(new Set),i.setInitialFocusedCell(null)}i.onColumnSelect&&i.onColumnSelect(e),!i.selectableColumns&&e.sortable&&i.onSort(e.accessor)}})(t,s,r,e)}),I(w,"dblclick",t=>{a||((t,e,n)=>{e.isSelectionColumn||n.selectableColumns&&e.sortable&&n.onSort(e.accessor)})(0,s,e)}),Ti(w,c,s,e),c.appendChild(w),s.headerRenderer||"right"===s.align||(v&&c.appendChild(v),f&&c.appendChild(f),u&&c.appendChild(u)),!p){const t=Ii(s,e);t&&c.appendChild(t)}return e.headerRegistry&&!s.isSelectionColumn&&e.headerRegistry.set(s.accessor+"",{setEditing:t=>{if(t){const t=w.querySelector(".st-header-label-text");if(t){t.innerHTML="";const n=Hi(s,e,t);t.appendChild(n)}}}}),c})(e,n);o.dataset.stIconState=`${n.sort&&n.sort.key.accessor===e.header.accessor?n.sort.direction:"none"}|${n.filters&&n.filters[e.header.accessor]?"1":"0"}`,y&&n.animationCoordinator&&!n.animationCoordinator.hasSnapshotEntry(i)&&!n.animationCoordinator.wasRenderableBeforeAccordion(e.header.accessor+"")&&("vertical"===y?o.style.height="0px":o.style.width="0px",o.dataset.stAccordionGrow=y,S.push({element:o,cell:e})),l(t,v(e),p(e)).appendChild(o),c.set(i,o),w.set(i,{left:e.left,top:e.top,width:e.width,height:e.height})}),y&&S.length>0&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{for(const{element:t,cell:e}of S)t.isConnected&&("vertical"===y?t.style.height=e.height+"px":t.style.width=e.width+"px",delete t.dataset.stAccordionGrow)})}),n.pinned||(t.dataset.lastScrollLeft=i+""),d.forEach(t=>{const e=c.get(ot({accessor:t.header.accessor,rowId:"header"}));if(!e)return;const n=(t=>{const e=t.top,n=t.top+t.height,i=f.filter(t=>t>=e-1&&n-1>t).length;return i>0?i:1})(t);n>1?e.setAttribute("aria-rowspan",n+""):e.hasAttribute("aria-rowspan")&&e.removeAttribute("aria-rowspan")}),a(t)},Wi=(t,e)=>{t.style.left="0",t.style.width="number"!=typeof e||0>e?"100%":e+"px"},Pi=t=>{const{position:n,rowHeight:i,displayStrongBorder:o,heightOffsets:s,customTheme:r=e,isSticky:l=!1,sectionWidthPx:a}=t,d=document.createElement("div");d.className="st-row-separator "+(o?"st-last-group-row":"");const c=l?n:He({position:n,rowHeight:i,heightOffsets:s,customTheme:r});Wi(d,a),l?(d.style.position="absolute",d.style.top="0",d.style.transform=`translateY(${c}px)`):d.style.transform=`translate3d(0, ${c}px, 0)`;const h=document.createElement("div");h.style.width="100%",d.appendChild(h);let u=null;return d.addEventListener("mousedown",t=>{t.preventDefault();const e=d.style.pointerEvents;d.style.pointerEvents="none";const n=document.elementFromPoint(t.clientX,t.clientY);if(d.style.pointerEvents=e,!n)return;const i=n.closest(".st-cell");if(i instanceof HTMLElement){u=i;const e=i.getBoundingClientRect(),n=new MouseEvent("mousedown",{bubbles:!0,cancelable:!0,view:window,button:0,clientX:t.clientX,clientY:e.top+e.height/2});i.dispatchEvent(n)}}),d.addEventListener("mouseup",t=>{if(u){const e=u.getBoundingClientRect(),n=new MouseEvent("mouseup",{bubbles:!0,cancelable:!0,view:window,button:0,clientX:t.clientX,clientY:e.top+e.height/2});u.dispatchEvent(n),u=null}}),d},$i=new WeakMap,Fi=new WeakMap,Li=t=>(Fi.has(t)||Fi.set(t,new Map),Fi.get(t)),Di=(t,n,i,o=0,s,r,d,c)=>{var h,u,v,p,w,m,g,b;const x=i.pinned?null!==(u=null!==(h=i.containerWidth)&&void 0!==h?h:t.clientWidth)&&void 0!==u?u:0:null!==(w=null!==(p=null!==(v=i.mainSectionViewportWidth)&&void 0!==v?v:i.containerWidth)&&void 0!==p?p:t.clientWidth)&&void 0!==w?w:0,y=i.pinned||!1===i.enableVirtualization?n:((t,e,n,i=100)=>{if(0===t.length)return[];const o=e-i,s=e+n+i;return t.filter(t=>t.left+t.width>=o&&s>=t.left)})(n,o,x),R=f(t),S=(t=>($i.has(t)||$i.set(t,new Map),$i.get(t)))(t),C=new Set(y.map(t=>{var e;return ot({accessor:t.header.accessor,rowId:null!==(e=t.stableRowKey)&&void 0!==e?e:t.rowId})}));let M=null;if(d)if(c)M=c;else{M=new Map;for(const t of n){const e=ot({accessor:t.header.accessor,rowId:null!==(m=t.stableRowKey)&&void 0!==m?m:t.rowId});M.set(e,{left:t.left,top:t.top,width:t.width,height:t.height})}}const I=d&&i.accordionAxis?i.accordionAxis:null,H="horizontal"===I?(t=>{const e=new Set,n=t=>{var i;for(const o of t)Z(o)||(e.add(o.accessor+""),(null===(i=o.children)||void 0===i?void 0:i.length)&&n(o.children))};return n(t),e})(i.headers):null,k=(null==s?void 0:s.length)?new Set(s.map(t=>t.position)):new Set(y.map(t=>t.rowIndex));R.forEach((e,n)=>{var o,s,r;if(!C.has(n)){const l=e.getAttribute("data-row-id");l&&Mn(l,e);const a=null==M?void 0:M.get(n);if(d&&d.shouldRetain(n)&&a&&(d.shouldAnimateTransition({beforeTop:parseFloat(e.style.top||"0"),afterTop:a.top,beforeLeft:parseFloat(e.style.left||"0"),afterLeft:a.left,cellHeight:a.height||parseFloat(e.style.height||"0"),cellWidth:a.width||parseFloat(e.style.width||"0"),container:t})||d.isCellRenderedInScrollerViewport(e,t)||d.shouldRetainDomCellAtScrollExtrema(n,t)))return d.retainCell({cellId:n,element:e,container:t,newPosition:a}),void R.delete(n);if(d&&"horizontal"===I&&d.shouldRetain(n)){const i=null!==(o=e.getAttribute("data-accessor"))&&void 0!==o?o:"";if(null===(s=null==H?void 0:H.has(i))||void 0===s||!s)return d.shrinkOutCell({cellId:n,element:e,container:t,axis:I}),void R.delete(n)}((t,e)=>{const n=Rn.get(t);void 0!==n&&(null==e||e.delete(n),Rn.delete(t))})(e,i.cellRegistry),null===(r=i.onRendererHostDiscard)||void 0===r||r.call(i,e),e.remove(),R.delete(n)}});const T=Li(t);S.forEach((t,e)=>{k.has(e)||(t.remove(),S.delete(e),T.delete(e))});const E=null!==(g=i.maxHeaderDepth)&&void 0!==g?g:1,A=t=>{var e;return(null!==(e=t.stableRowKey)&&void 0!==e?e:t.rowId)+""},O=t=>t.tableRow.position+E+1,W=(t,e)=>{var n;i.enableRowSelection?t.setAttribute("aria-selected",(null===(n=i.isRowSelected)||void 0===n?void 0:n.call(i,e.rowId))?"true":"false"):t.hasAttribute("aria-selected")&&t.removeAttribute("aria-selected")},P=!!i.rowGrouping&&i.rowGrouping.length>0,$=t=>{var e;return(null!==(e=t.stableRowKey)&&void 0!==e?e:pt(t.rowId))+""},F=new Map;if(P&&s&&s.length>0){const t=new Map;for(const e of s){const n=null!==(b=e.rowIndexPath)&&void 0!==b?b:[],i=`${e.depth}|${n.slice(0,-1).join("/")}`;let o=t.get(i);o||(o=[],t.set(i,o)),o.push(e)}t.forEach(t=>{t.slice().sort((t,e)=>t.position-e.position).forEach((e,n)=>{F.set($(e),{posinset:n+1,setsize:t.length})})})}const L=(t,e)=>{if(!P)return;const n=e.tableRow;t.setAttribute("aria-level",n.depth+1+"");const o=F.get($(n));o&&(t.setAttribute("aria-posinset",o.posinset+""),t.setAttribute("aria-setsize",o.setsize+""));const{expandable:s,expanded:r}=(t=>{var e;const n=t.depth,o=null===(e=i.rowGrouping)||void 0===e?void 0:e[n],s=!!o&&yt(t.row,o),r=!!i.rowGrouping&&i.rowGrouping.length>n,l=!i.canExpandRowGroup||i.canExpandRowGroup(t.row);return s&&r&&l||i.onRowGroupExpand&&r&&l?{expandable:!0,expanded:Rt(bt(t),n,new Set(i.expandedDepths),i.expandedRows,i.collapsedRows)}:{expandable:!1,expanded:!1}})(n);s?t.setAttribute("aria-expanded",r+""):t.hasAttribute("aria-expanded")&&t.removeAttribute("aria-expanded")},D=[],j=new Set;y.forEach(e=>{var n,o,s,a,c;const h=ot({accessor:e.header.accessor,rowId:null!==(n=e.stableRowKey)&&void 0!==n?n:e.rowId});if(!j.has(h))if(j.add(h),R.has(h)){const n=R.get(h),d=l(t,A(e),O(e));if(W(d,e),L(d,e),r)((t,e)=>{t.style.left=e.left+"px",t.style.top=e.top+"px";const n=t.dataset.stAccordionGrow;"horizontal"!==n&&(t.style.width=e.width+"px"),"vertical"!==n&&(t.style.height=e.height+"px")})(n,e);else{if(Tn(n,e,i),e.header.isSelectionColumn&&i.enableRowSelection&&i.isRowSelected){const t=i.isRowSelected(e.rowId);hn(n,t)}if(e.header.expandable){const t=new Set(i.expandedDepths),r=null!==(s=null===(o=i.getExpandedRows)||void 0===o?void 0:o.call(i))&&void 0!==s?s:i.expandedRows,l=null!==(c=null===(a=i.getCollapsedRows)||void 0===a?void 0:a.call(i))&&void 0!==c?c:i.collapsedRows,d=Rt(bt(e.tableRow),e.depth,t,r,l);wn(n,d)}}}else{if(d&&d.hasSnapshotEntry(h)&&!d.shouldMountIncomingCell({cellId:h,afterTop:e.top,afterLeft:e.left,cellHeight:e.height,cellWidth:e.width,container:t}))return;D.push({cell:e,cellId:h})}});const N=[];D.forEach(({cell:e,cellId:n})=>{const o=null==d?void 0:d.claimRetainedForReuse(n,t);if(o){(t=>{Sn.delete(t)})(o),Tn(o,e,i);const s=l(t,A(e),O(e));return W(s,e),L(s,e),o.parentElement!==s&&s.appendChild(o),void R.set(n,o)}const s=kn(e,i);I&&d&&!d.hasSnapshotEntry(n)&&!d.wasRenderableBeforeAccordion(e.header.accessor+"")&&("vertical"===I?s.style.height="0px":s.style.width="0px",s.dataset.stAccordionGrow=I,N.push({element:s,cell:e}));const r=l(t,A(e),O(e));W(r,e),L(r,e),r.appendChild(s),R.set(n,s)}),I&&N.length>0&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{for(const{element:t,cell:e}of N)t.isConnected&&("vertical"===I?t.style.height=e.height+"px":t.style.width=e.width+"px",delete t.dataset.stAccordionGrow)})}),((t,n,i,o,s)=>{const r=Li(t),l=i.pinned&&n.length>0?n.reduce((t,e)=>Math.max(t,e.left+e.width),0):0,a=(()=>{var e,n,o;if(i.pinned){const e=Math.max("number"==typeof i.pinnedSectionWidthPx&&i.pinnedSectionWidthPx>0?i.pinnedSectionWidthPx:t.clientWidth,l);return e>0?e:void 0}const s=null!==(o=null!==(n=null!==(e=i.mainSectionContainerWidth)&&void 0!==e?e:i.containerWidth)&&void 0!==n?n:t.clientWidth)&&void 0!==o?o:0;return s>0?s: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,i=-1,o=null;n.forEach(n=>{n.rowIndex!==i&&(o&&i>0&&t.push({rowIndex:i,firstCell:o,prevCell:e}),e=o||void 0,i=n.rowIndex,o=n)}),o&&i>0&&t.push({rowIndex:i,firstCell:o,prevCell:e}),d=t.map(({rowIndex:t,firstCell:e,prevCell:n})=>{var i,o;return{rowIndex:t,position:e.tableRow.position,displayStrongBorder:null!==(o=null===(i=null==n?void 0:n.tableRow)||void 0===i?void 0:i.isLastGroupRow)&&void 0!==o&&o}})}0!==d.length&&d.forEach(({rowIndex:n,position:s,displayStrongBorder:l})=>{var d;const c=r.get(n),h=He({position:s,rowHeight:i.rowHeight,heightOffsets:i.heightOffsets,customTheme:null!==(d=i.customTheme)&&void 0!==d?d:e});if(o.has(n)){const t=o.get(n);(!c||c.topPx!==h||c.displayStrongBorder!==l||c.sectionWidthPx!==a)&&(Wi(t,a),(null==c?void 0:c.displayStrongBorder)!==l&&(l?t.classList.add("st-last-group-row"):t.classList.remove("st-last-group-row")),c&&c.topPx===h||(t.style.transform=`translate3d(0, ${h}px, 0)`),r.set(n,{position:s,topPx:h,displayStrongBorder:l,sectionWidthPx:a}))}else{const e=Pi({position:s,rowHeight:i.rowHeight,displayStrongBorder:l,heightOffsets:i.heightOffsets,customTheme:i.customTheme,isSticky:!1,sectionWidthPx:a});t.appendChild(e),o.set(n,e),r.set(n,{position:s,topPx:h,displayStrongBorder:l,sectionWidthPx:a})}})})(t,y,i,S,s),a(t)};function ji(t,e){return t?"string"==typeof t?t:t instanceof HTMLElement?t.cloneNode(!0):"function"==typeof t?t(e):null:null}function Ni(t){var e,n;const i=new Map,o=t.rows.filter(t=>!t.nestedTable&&!t.stateIndicator),s=void 0!==t.pageStartIndex;for(const r of o){let o;o=s?(r.position-(null!==(e=t.pageStartIndex)&&void 0!==e?e:0))*t.rowHeight:t.customTheme?ke({position:r.position,rowHeight:t.rowHeight,heightOffsets:t.heightOffsets,customTheme:t.customTheme}):r.position*t.rowHeight;const l=null!==(n=r.stableRowKey)&&void 0!==n?n:pt(r.rowId);for(const e of t.headerPositions){const n=ot({accessor:e.accessor,rowId:l});i.set(n,{left:e.left,top:o,width:e.width,height:t.rowHeight})}}return i}class Bi{constructor(){this.headerSections=new Map,this.bodySections=new Map,this.bodyCellsCache=new Map,this.headerCellsCache=new Map,this.contextCache=new Map,this.bodySectionSnapshots=new Map,this.nextColIndexMap=new Map,this.stateRowsMap=new Map,this.nestedGridRowsMap=new Map}renderHeaderSection(t){const{headers:e,collapsedHeaders:n,pinned:i,maxHeaderDepth:o,headerHeight:s,context:r,sectionWidth:l,startColIndex:a=0}=t,d=i||"main";let c=this.headerSections.get(d);c||(c=document.createElement("div"),c.className="left"===i?"st-header-pinned-left":"right"===i?"st-header-pinned-right":"st-header-main",this.headerSections.set(d,c));const h=e.filter(t=>"left"===i?"left"===t.pinned:"right"===i?"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: ${o*s}px;\n `;const u=this.getCachedHeaderCells(d,h,n,o,s,a),f=u.length>0?Math.max(...u.map(t=>t.colIndex))+1:a;this.nextColIndexMap.set(d,f);const v=this.getCachedContext("header-"+d,r,i,l),p=c.scrollLeft;return Oi(c,u,v,p),i||p===c.scrollLeft||(c.scrollLeft=p),!i&&c&&(c.__renderHeaderCells=(t,e)=>{if(!c)return;const n=void 0!==e?Object.assign(Object.assign({},v),{columnsWithSelectedCells:e.columnsWithSelectedCells,selectedColumns:e.selectedColumns}):v;Oi(c,u,n,t)}),c}renderBodySection(t){var n,i,o,s;const{headers:r,rows:l,collapsedHeaders:a,pinned:d,context:c,sectionWidth:h,rowHeight:u,heightOffsets:f,totalRowCount:v,startColIndex:p=0,positionOnly:w=!1,fullTableRows:m,renderedStartIndex:g,renderedEndIndex:b,allFlattenedRows:x,pageStartIndex:y,animationCoordinator:R}=t,S=d||"main";let C=this.bodySections.get(S);C||(C=document.createElement("div"),C.className="left"===d?"st-body-pinned-left":"right"===d?"st-body-pinned-right":"st-body-main",this.bodySections.set(S,C));const M=r.filter(t=>"left"===d?"left"===t.pinned:"right"===d?"right"===t.pinned:!t.pinned);if(0===M.length)return C.style.display="none",C;C.style.display="";const I=((t,e,n,i)=>t*(e+i.rowSeparatorWidth)-i.rowSeparatorWidth+((null==n?void 0:n.reduce((t,[e,n])=>t+n,0))||0))(void 0!==v?v:l.length,u,f,null!==(n=c.customTheme)&&void 0!==n?n:e);C.style.cssText=`\n position: relative;\n ${void 0!==h?`width: ${h}px;`:""}\n ${d?"":"flex-grow: 1;"}\n height: ${I}px;\n `;const H=this.getCachedBodyCells(S,M,l,a,u,f,null!==(i=c.customTheme)&&void 0!==i?i:e,p,m,g,b),k=null!==(o=null!=x?x:m)&&void 0!==o?o:l;this.captureSnapshotConfig(S,M,a,k,u,f,null!==(s=c.customTheme)&&void 0!==s?s:e,void 0!==x?null!=y?y:0:void 0);const T=R?this.getFullSectionLayout(S):null,E=l.filter(t=>!t.nestedTable&&!t.stateIndicator).length;this.nextColIndexMap.set(S,H.length>0&&E>0?p+H.length/E:p);const A=this.getCachedContext("body-"+S,c,d,h);return Di(C,H,A,C.scrollLeft,l,w,R,null!=T?T:void 0),this.renderNestedGridRows(C,S,l,d,A,R),d||this.renderStateRows(C,S,l,A,R),!d&&C&&(C.__renderBodyCells=t=>{C&&Di(C,H,A,t,l,!0)}),C}renderNestedGridRows(t,e,n,i,s,r){var l,a;const d=null!==(l=null==r?void 0:r.isEnabled())&&void 0!==l&&l,c=d?`transform ${r.getDuration()}ms ${r.getEasing()}, height ${r.getDuration()}ms ${r.getEasing()}`:"",h=n.filter(t=>t.nestedTable),u=new Set(h.map(t=>bt(t)));let f=this.nestedGridRowsMap.get(e);f||(f=new Map,this.nestedGridRowsMap.set(e,f)),f.forEach((t,e)=>{var n;u.has(e)||(null===(n=t.cleanup)||void 0===n||n.call(t),t.element.remove(),f.delete(e))});const v={rowHeight:s.rowHeight,heightOffsets:s.heightOffsets,customTheme:null!==(a=s.customTheme)&&void 0!==a?a:{},theme:s.theme,rowGrouping:s.rowGrouping,depth:0,loadingStateRenderer:s.loadingStateRenderer,errorStateRenderer:s.errorStateRenderer,emptyStateRenderer:s.emptyStateRenderer,icons:s.icons,createNestedTable:s.createNestedTable};h.forEach(n=>{var r,l,a,h,u,p,w;const m=bt(n),g=f.get(m);if(g){const t=ke({position:n.position,rowHeight:s.rowHeight,heightOffsets:s.heightOffsets,customTheme:null!==(r=s.customTheme)&&void 0!==r?r:{}}),e=at({calculatedHeight:n.nestedTable.calculatedHeight,customHeight:null===(l=n.nestedTable.expandableHeader.nestedTable)||void 0===l?void 0:l.height,customTheme:null!==(a=s.customTheme)&&void 0!==a?a:{}}),i=g.lastTop!==t,o=g.lastWrapperHeight!==e;return(i||o)&&(g.element.style.transition=c,i&&(g.element.style.transform=`translate3d(0, ${t}px, 0)`),o&&(g.element.style.height=e+"px"),g.lastTop=t,g.lastWrapperHeight=e),g.element.dataset.index=n.position+"",void(g.lastPosition=n.position)}const b=this.stateRowsMap.get(e),x=b&&b.has(m)?s.rowHeight:0,y=at({calculatedHeight:n.nestedTable.calculatedHeight,customHeight:null===(h=n.nestedTable.expandableHeader.nestedTable)||void 0===h?void 0:h.height,customTheme:null!==(u=s.customTheme)&&void 0!==u?u:{}}),R=ke({position:n.position,rowHeight:s.rowHeight,heightOffsets:s.heightOffsets,customTheme:null!==(p=s.customTheme)&&void 0!==p?p:{}});if(i){const e=function(t,e){const{nestedTable:n}=t;if(!n)throw Error("createNestedGridSpacer called without tableRow.nestedTable");const i=t.nestedTable.expandableHeader.nestedTable,o=at({calculatedHeight:n.calculatedHeight,customHeight:null==i?void 0:i.height,customTheme:e.customTheme}),s=ke({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.setAttribute("role","presentation"),r.setAttribute("aria-hidden","true"),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=o+"px",r.style.pointerEvents="none",r}(n,{rowHeight:s.rowHeight,heightOffsets:s.heightOffsets,customTheme:null!==(w=s.customTheme)&&void 0!==w?w:{}});d&&x!==y&&(e.style.height=x+"px"),t.appendChild(e),f.set(m,{element:e,lastPosition:n.position,lastTop:R,lastWrapperHeight:y}),d&&x!==y&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transition=c,e.style.height=y+"px"})})}else{v.depth=n.depth>0?n.depth-1:0;const{element:e,cleanup:i}=function(t,e){const{nestedTable:n}=t;if(!n)throw Error("createNestedGridRow called without tableRow.nestedTable");const{rowHeight:i,heightOffsets:s,customTheme:r,theme:l,rowGrouping:a,depth:d,loadingStateRenderer:c,errorStateRenderer:h,emptyStateRenderer:u,icons:f}=e,{parentRow:v,expandableHeader:p,childAccessor:w,calculatedHeight:m}=n,g=p.nestedTable;if(!g)throw Error("createNestedGridRow: expandableHeader.nestedTable is missing");const b=ct(v,w),x=Array.isArray(b)?b:[],y=a&&a[d+1]?a.slice(d+1):void 0,R=g.customTheme?Object.assign(Object.assign({},r),g.customTheme):r,S=(({calculatedHeight:t,customHeight:e,customTheme:n})=>e?"string"==typeof e?e:e+"px":t-n.nestedGridPaddingTop-n.nestedGridPaddingBottom+"px")({calculatedHeight:m,customHeight:g.height,customTheme:r}),C=at({calculatedHeight:m,customHeight:g.height,customTheme:r}),M=ke({position:t.position,rowHeight:i,heightOffsets:s,customTheme:r}),I=document.createElement("div");I.className="st-row st-nested-grid-row st-row-position-"+t.position,I.setAttribute("role","row"),I.dataset.index=t.position+"",I.style.position="absolute",I.style.left="0",I.style.right="0",I.style.transform=`translate3d(0, ${M}px, 0)`,I.style.height=C+"px",I.style.paddingTop=r.nestedGridPaddingTop+"px",I.style.paddingBottom=r.nestedGridPaddingBottom+"px",I.style.paddingLeft=r.nestedGridPaddingLeft+"px",I.style.paddingRight=r.nestedGridPaddingRight+"px",I.style.boxSizing="border-box";const H=document.createElement("div");if(H.setAttribute("role","gridcell"),H.style.height="100%",H.style.width="100%",I.appendChild(H),!g.columns)throw Error("createNestedGridRow: nestedTable.columns is required");const k=o(Object.assign(Object.assign({},g),{columns:g.columns,rows:x,theme:l,customTheme:R,height:S,rowGrouping:y,loadingStateRenderer:c,errorStateRenderer:h,emptyStateRenderer:u,icons:f}));if(!e.createNestedTable)throw Error("createNestedGridRow: context.createNestedTable factory was not provided");const T=e.createNestedTable(H,k);T.mount();const E=()=>{T.destroy()};return I.__nestedTableCleanup=E,{element:I,cleanup:E}}(n,v);d&&x!==y&&(e.style.height=x+"px",e.style.overflow="hidden"),t.appendChild(e),f.set(m,{element:e,cleanup:i,lastPosition:n.position,lastTop:R,lastWrapperHeight:y}),d&&x!==y&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transition=c,e.style.height=y+"px"})})}})}renderStateRows(t,e,n,i,o){var s,r;const l=n.filter(t=>t.stateIndicator),a=new Set(l.map(t=>bt(t)));let d=this.stateRowsMap.get(e);d||(d=new Map,this.stateRowsMap.set(e,d));const c=null!==(s=null==o?void 0:o.isEnabled())&&void 0!==s&&s,h=c?`transform ${o.getDuration()}ms ${o.getEasing()}, height ${o.getDuration()}ms ${o.getEasing()}`:"";d.forEach((t,e)=>{a.has(e)||(t.element.remove(),d.delete(e))});const u={index:0,rowHeight:i.rowHeight,heightOffsets:i.heightOffsets,customTheme:null!==(r=i.customTheme)&&void 0!==r?r:{},loadingStateRenderer:i.loadingStateRenderer,errorStateRenderer:i.errorStateRenderer,emptyStateRenderer:i.emptyStateRenderer};l.forEach((e,n)=>{var o;const s=bt(e),r=ke({position:e.position,rowHeight:i.rowHeight,heightOffsets:i.heightOffsets,customTheme:null!==(o=i.customTheme)&&void 0!==o?o:{}}),l=d.get(s);if(l)return l.lastTop!==r&&(l.element.style.transition=h,l.element.style.transform=`translate3d(0, ${r}px, 0)`,l.lastTop=r),void(l.lastPosition=e.position);const a=((t,e)=>{const{position:n,stateIndicator:i}=t;if(!i)throw Error("createStateRow called without stateIndicator");const o=document.createElement("div");o.className="st-row st-state-row st-row-position-"+n,o.setAttribute("role","row"),o.dataset.index=e.index+"",o.style.width="100%",o.style.transform=`translate3d(0, ${ke({position:n,rowHeight:e.rowHeight,heightOffsets:e.heightOffsets,customTheme:e.customTheme})}px, 0)`,o.style.height=e.rowHeight+"px";const s=document.createElement("div");s.className="st-cell st-state-row-cell",s.setAttribute("role","gridcell"),s.style.width="100%",s.style.padding="0";let r=null;return i.state.loading&&e.loadingStateRenderer?r=ji(e.loadingStateRenderer,{parentRow:i.parentRow}):i.state.error&&e.errorStateRenderer?r=ji(e.errorStateRenderer,{error:i.state.error,parentRow:i.parentRow}):i.state.isEmpty&&e.emptyStateRenderer&&(r=ji(e.emptyStateRenderer,{message:i.state.emptyMessage,parentRow:i.parentRow})),r&&("string"==typeof r?s.textContent=r:r instanceof HTMLElement&&s.appendChild(r)),o.appendChild(s),o})(e,Object.assign(Object.assign({},u),{index:n}));a.style.position="absolute",a.style.transform=`translate3d(0, ${r}px, 0)`,a.style.width="100%",c?(a.style.height="0px",a.style.overflow="hidden",t.appendChild(a),requestAnimationFrame(()=>{requestAnimationFrame(()=>{a.style.transition=h,a.style.height=i.rowHeight+"px"})})):t.appendChild(a),d.set(s,{element:a,lastTop:r,lastPosition:e.position})})}calculateAbsoluteHeaderCells(t,e,n,i,o=0){const s=[];let r=o,l=0;const a=(t,o,d)=>{if(Z(t))return 0;const c=e.has(t.accessor);if(t.children&&t.children.length>0){const e=t.children.filter(t=>{if(Z(t))return!1;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:o*i,width:c,height:(n-o)*i,colIndex:r,parentHeader:d}),r++,l+=c;let h=0;return e.forEach(e=>{h+=a(e,o,t)}),c+h}if(0===e.length){const e="number"==typeof t.width?t.width:150;return s.push({header:t,left:l,top:o*i,width:e,height:(n-o)*i,colIndex:r,parentHeader:d}),r++,l+=e,e}const h=l,u=r;let f=0;return e.forEach(e=>{f+=a(e,o+1,t)}),s.push({header:t,left:h,top:o*i,width:f,height:i,colIndex:u,parentHeader:d}),f}{const e="number"==typeof t.width?t.width:150;return s.push({header:t,left:l,top:o*i,width:e,height:(n-o)*i,colIndex:r,parentHeader:d}),r++,l+=e,e}};return t.forEach(t=>a(t,0)),s}calculateAbsoluteBodyCells(t,e,n,i,o,s,r=0){const l=[],a=e.filter(t=>!t.nestedTable&&!t.stateIndicator),d=this.getLeafHeaders(t,n),c=new Map;let h=0;return d.forEach(t=>{const e="number"==typeof t.width?t.width:150;c.set(t.accessor,{left:h,width:e}),h+=e}),a.forEach((t,e)=>{const n=s?ke({position:t.position,rowHeight:i,heightOffsets:o,customTheme:s}):e*i,a=t.position%2==1;d.forEach((o,s)=>{var d,h;const u=c.get(o.accessor);l.push({header:o,row:t.row,rowIndex:e,colIndex:r+s,rowId:pt(t.rowId),stableRowKey:t.stableRowKey,displayRowNumber:t.displayPosition,depth:t.depth,isOdd:a,tableRow:t,left:null!==(d=null==u?void 0:u.left)&&void 0!==d?d:0,top:n,width:null!==(h=null==u?void 0:u.width)&&void 0!==h?h:150,height:i})})}),l}getLeafHeaders(t,e){const n=[],i=t=>{if(Z(t))return;const o=e.has(t.accessor);if(t.children&&t.children.length>0){const e=t.children.filter(t=>{if(Z(t))return!1;const e=t.showWhen||"parentExpanded";return o?"parentCollapsed"===e||"always"===e:"parentExpanded"===e||"always"===e});t.singleRowChildren&&n.push(t),e.length>0?e.forEach(t=>i(t)):t.singleRowChildren||n.push(t)}else n.push(t)};return t.forEach(t=>i(t)),n}createHeadersHash(t){const e=t=>{let n=`${t.accessor}:${t.width}:${t.pinned||""}:${t.hide||""}:${t.excludeFromRender||""}`;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","selectRowOnClick","rowSelectionMode","activeRowId","cellUpdateFlash","oddColumnBackground","hoverRowBackground","oddEvenRowBackground","rowHeight","containerWidth","isLoading","mainSectionViewportWidth","mainSectionContainerWidth","enableVirtualization"].map(e=>`${e}:${t[e]}`).join("|");const n=t.heightOffsets;if(Array.isArray(n)&&n.length>0){let t="";for(let e=0;n.length>e;e++){const i=n[e];t+=`${i[0]}:${i[1]};`}e+="|offsets:"+t}else e+="|offsets:none";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(",")),t.pinned&&(e+="|pinned:"+t.pinned),void 0!==t.pinnedSectionWidthPx&&(e+="|pinnedSectionWidthPx:"+t.pinnedSectionWidthPx),e}getCachedBodyCells(t,e,n,i,o,s,r,l=0,a,d,c){const h=this.createHeadersHash(e),u=this.createHeightOffsetsHash(s),f=null!=a&&null!=d&&null!=c,v=this.bodyCellsCache.get(t),p=v&&v.deps.headersHash===h&&v.deps.collapsedHeadersSize===i.size&&v.deps.rowHeight===o&&v.deps.heightOffsetsHash===u&&(f?v.deps.fullTableRowsRef===a&&void 0!==v.deps.bandStart&&void 0!==v.deps.bandEnd&&((t,e)=>d>=t&&e>=c)(v.deps.bandStart,v.deps.bandEnd):v.deps.rowsRef===n);if(p&&v){if(!f)return v.cells;const t=new Map;n.forEach((e,n)=>{t.set(e.position,n)});const e=[];for(const n of v.cells){const i=t.get(n.tableRow.position);void 0!==i&&e.push(n.rowIndex!==i?Object.assign(Object.assign({},n),{rowIndex:i}):n)}return e}let w,m,g;if(f){const t=a.length;m=Math.max(0,d-28),g=Math.min(t,c+28),w=a.slice(m,g)}else w=n;const b=this.calculateAbsoluteBodyCells(e,w,i,o,s,r,l);if(this.bodyCellsCache.set(t,{cells:b,deps:Object.assign({headersHash:h,rowsRef:w,collapsedHeadersSize:i.size,rowHeight:o,heightOffsetsHash:u},f&&{fullTableRowsRef:a,bandStart:m,bandEnd:g})}),!f)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?Object.assign(Object.assign({},t),{rowIndex:e}):t)}return y}getCachedHeaderCells(t,e,n,i,o,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===i&&r.deps.headerHeight===o)return r.cells;const a=this.calculateAbsoluteHeaderCells(e,n,i,o,s);return this.headerCellsCache.set(t,{cells:a,deps:{headersHash:l,collapsedHeadersSize:n.size,maxDepth:i,headerHeight:o}}),a}getCachedContext(t,e,n,i){const o=this.contextCache.get(t),s="left"===n||"right"===n?i:void 0,r=Object.assign(Object.assign({},e),{pinned:n,pinnedSectionWidthPx:s}),l=this.createContextHash(r);return o&&o.deps.contextHash===l?o.context:(this.contextCache.set(t,{context:r,deps:{contextHash:l}}),r)}setOnRendererHostDiscard(t){this.onRendererHostDiscard=t}invalidateCache(t){t&&"all"!==t?"body"===t?this.bodyCellsCache.clear():"header"===t?this.headerCellsCache.clear():"context"===t&&(this.contextCache.clear(),this.headerCellsCache.clear()):(this.bodyCellsCache.clear(),this.headerCellsCache.clear(),this.contextCache.clear(),this.bodySections.forEach(t=>{v(t,this.onRendererHostDiscard)}),this.headerSections.forEach(t=>{((t,e)=>{if(w=0,t){const n=R(t);n.forEach(t=>{null==e||e(t),t.remove()}),n.clear(),C(t).clear(),H(t),d(t)}})(t,this.onRendererHostDiscard)}))}getNextColIndex(t){var e;return null!==(e=this.nextColIndexMap.get(t))&&void 0!==e?e:0}getCurrentBodyLayouts(){const t=new Map;return this.bodySectionSnapshots.forEach((e,n)=>{const i=this.bodySections.get(n);i&&t.set(i,Ni(e))}),t}getFullSectionLayout(t){const e=this.bodySectionSnapshots.get(t);return e?Ni(e):null}captureSnapshotConfig(t,e,n,i,o,s,r,l){const a=this.getLeafHeaders(e,n),d=[];let c=0;for(const t of a){const e="number"==typeof t.width?t.width:150;d.push({accessor:t.accessor,left:c,width:e}),c+=e}this.bodySectionSnapshots.set(t,{rows:i,headerPositions:d,rowHeight:o,heightOffsets:s,customTheme:r,pageStartIndex:l})}releaseBodySections(){this.bodySections.forEach(t=>{v(t,this.onRendererHostDiscard),t.remove()}),this.bodySections.clear(),this.bodyCellsCache.clear(),this.bodySectionSnapshots.clear(),this.nestedGridRowsMap.forEach(t=>{t.forEach(t=>{var e;null===(e=t.cleanup)||void 0===e||e.call(t),t.element.remove()}),t.clear()}),this.nestedGridRowsMap.clear(),this.stateRowsMap.forEach(t=>{t.forEach(t=>{t.element.remove()}),t.clear()}),this.stateRowsMap.clear()}cleanup(){this.releaseBodySections(),this.headerSections.clear(),this.headerCellsCache.clear(),this.contextCache.clear(),this.nextColIndexMap.clear()}}const zi=(t,e)=>{"string"==typeof e?t.innerHTML=e:(t.innerHTML="",t.appendChild(e.cloneNode(!0)))},Vi=(t,e,n=new Set)=>{for(const i of t)if(!n.has(i.accessor)&&(n.add(i.accessor),i.children&&i.children.length>0)){const t=i.children.some(t=>t.accessor===e);let o=!1;if(!t)for(const t of i.children)if(Vi([t],e,n),!1===t.hide){o=!0;break}(t||o)&&(i.hide=!1)}},qi=t=>t.every(t=>t.hide),Gi=t=>{t.forEach(t=>{t.children&&t.children.length>0&&(Gi(t.children),qi(t.children)&&(t.hide=!0))})},Ki=(t,e)=>{const n=e.toLowerCase();return!!t.label.toLowerCase().includes(n)||!(!t.children||0>=t.children.length)&&t.children.some(t=>Ki(t,e))},_i=(t,e,n)=>{if(!e.trim())return t;const i=n||Ki;return t.filter(t=>!t.isSelectionColumn&&!t.excludeFromRender&&i(t,e))};function Ui(t,e,n,i){e&&t.appendChild(e),t.appendChild(n),i&&t.appendChild(i)}function Ji(t,e,n,i,o,s,r){const l=e({headers:n,searchSection:i,listSection:o,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 Yi=t=>{let e=t,{headers:n,open:i,searchEnabled:o,searchPlaceholder:s,searchFunction:r,columnEditorConfig:l,icons:a,essentialAccessors:d,setHeaders:c,onColumnVisibilityChange:h,onColumnOrderChange:u,resetColumns:f}=e,v="",p=null,w=null,m=!1;const g=new Set,b=t=>{t.forEach(t=>{t.children&&t.children.length>0&&(g.add(t.accessor),b(t.children))})};b(n);let x=g;const y=document.createElement("div");y.className="st-column-editor-popout "+(i?"open":"");const R=document.createElement("div");R.className="st-column-editor-popout-content",R.addEventListener("click",t=>t.stopPropagation());let S=null,C=null;if(o){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 i=document.createElement("input");return i.type="text",i.value="",i.placeholder=t,i.className="st-filter-input",i.addEventListener("click",t=>t.stopPropagation()),i.addEventListener("input",t=>{v=t.target.value,P()}),n.appendChild(i),e.appendChild(n),{wrapper:e,input:i}}(s);C=t.wrapper,S=t.input}const M=document.createElement("div");M.className="st-column-editor-lists";let I=null;f&&(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}(f));let H=l.customRenderer;H?Ji(R,H,n,C,M,I,f):Ui(R,C,M,I),y.appendChild(R);const k=t=>{p=t,null!==t?m=!0:(m=!1,P())},T=()=>{w=null},E=t=>{w=t,m?O():P()},A=t=>{const e=x;x=t,P(e)},O=()=>{M.querySelectorAll(".st-column-editor-list-section").forEach(t=>{const e=null!==w&&w.panelSection===t.dataset.panelSection;t.querySelectorAll(".st-column-editor-drag-separator").forEach((t,n)=>{t.style.opacity=e&&w.index===n-1?"1":"0"})})},W=(t,e,i,s,f)=>{if(0===t.length)return;const m=t.filter(t=>!t.isSelectionColumn&&!t.excludeFromRender);if(0===(o?_i(m,v,r):m).length)return;if(i){const t=document.createElement("div");t.className="st-column-editor-section-label",t.textContent=i,s.appendChild(t)}const g=document.createElement("div");g.className="st-column-editor-list st-column-editor-list-section",g.dataset.panelSection=e,s.appendChild(g);const b=((t,e)=>{const n=o?_i(t,v,r):t,i=[],s=o&&v.trim().length>0,l=({headers:t,depth:n=0,parent:o=null,currentPath:r=[]})=>{t.forEach((t,a)=>{if(t.isSelectionColumn||t.excludeFromRender)return;const d=[...r,a];i.push({header:t,visualIndex:i.length,depth:n,parent:o,indexPath:d,panelSection:e});const c=t.children&&t.children.length>0,h=s||x.has(t.accessor);c&&h&&t.children&&l({headers:t.children,depth:n+1,parent:t,currentPath:d})})};return l({headers:n,depth:0,parent:null,currentPath:[]}),i})(t,e),y=(t=>t.some(t=>t.children&&t.children.length>0))(t);b.forEach(t=>{var i;const s=(t=>{var e,n;const{allHeaders:i,clearHoverSeparator:o,depth:s,doesAnyHeaderHaveChildren:r,draggingRow:l,getDraggingRow:a,getHoveredSeparator:d,expandedHeaders:c,flattenedHeaders:h,forceExpanded:u,header:f,hoveredSeparator:v,panelSection:p,rowIndex:w,setDraggingRow:m,setExpandedHeaders:g,setHoveredSeparator:b,headers:x,setHeaders:y,onColumnVisibilityChange:R,onColumnOrderChange:S,previousExpandedHeaders:C}=t,M=null!==(e=t.essentialAccessors)&&void 0!==e?e:new Set,I=!1!==t.columnEditorConfig.allowColumnPinning,H=Fn(f,M),k=!H,T=document.createDocumentFragment(),E=16*s+"px",A=f.children&&f.children.length>0,O=!(f.hide||A&&f.children&&qi(f.children)),W=c.has(f.accessor),P=u||W,$=null!==v&&v.panelSection===(null!=p?p:"main");let F;if(0===w){const t=document.createElement("div");t.className="st-column-editor-drag-separator",t.style.opacity=$&&-1===v.index?"1":"0",T.appendChild(t)}const L=document.createElement("div");L.className="st-header-checkbox-item",L.style.paddingLeft=E,L.draggable=!0;const D=t=>!(M.size>0&&!Dn(t,M)||(null==S||S(t),y(t),0)),j=t=>{if(t.stopPropagation(),u)return;const e=new Set(c);W?e.delete(f.accessor):e.add(f.accessor),g(e)};let N;if(L.addEventListener("dragstart",t=>{t.dataTransfer&&(t.dataTransfer.effectAllowed="move"),null==o||o(),m(h[w])}),L.addEventListener("dragenter",t=>{t.preventDefault()}),L.addEventListener("dragover",t=>{t.preventDefault();const e=a?a():l;if(e&&e.panelSection===p){const n=t.currentTarget.getBoundingClientRect(),i=(({flattenedHeaders:t,draggingRow:e,hoveredRowIndex:n,isTopHalfOfRow:i})=>{var o,s;const r=t[n];if(r.depth===e.depth)return(null===(o=r.parent)||void 0===o?void 0:o.accessor)!==(null===(s=e.parent)||void 0===s?void 0:s.accessor)?null:i||r.header.children?n-1:n;if(r.depth>e.depth){let o=r,s=n;for(;o.parent&&o.depth>e.depth;){const e=o.parent.accessor,n=t.findIndex(t=>t.header.accessor===e);if(-1===n)break;o=t[n],s=n}const l=s;let a=s;for(let e=s+1;t.length>e&&t[e].depth>o.depth;e++)a=e;const d=a-l+1,c=n-l;let h=d/2>c;return d%2==1&&c===Math.floor(d/2)&&(h=i),h?s-1:a}return null})({flattenedHeaders:h,draggingRow:e,hoveredRowIndex:w,isTopHalfOfRow:n.top+n.height/2>t.clientY});b(null===i?null:{panelSection:null!=p?p:"main",index:i})}}),L.addEventListener("dragend",()=>{const t=a?a():l,e=d?d():v,n=()=>{m(null),b(null)};if(!t||null===e||t.panelSection!==p)return void n();const i=e.index;let o=h[i>t.visualIndex?i:i+1];if(!o)return void n();if(o.depth>t.depth&&o.parent){const t=h.findIndex(t=>t.header.accessor===o.parent.accessor);-1!==t&&(o=h[t])}if(t.header.accessor===o.header.accessor)return void n();if(t.indexPath.length!==o.indexPath.length||1!==t.indexPath.length&&!t.indexPath.slice(0,-1).every((t,e)=>t===o.indexPath[e]))return void n();const s=di(x,t.header.accessor),r=di(x,o.header.accessor);if(!s||!r)return void n();const{newHeaders:c,emergencyBreak:u}=ui(x,s,r);u||D(c),n()}),r){const e=document.createElement("div");if(e.className="st-header-icon-container",A){const t=void 0!==C?u||C.has(f.accessor):P,n=!u&&void 0!==C&&t!==P,i=n?t:P,o=document.createElement("div");o.className="st-column-editor-expand-icon st-expand-icon-container "+(i?"expanded":"collapsed"),o.setAttribute("role","button"),o.setAttribute("tabindex","0"),o.setAttribute("aria-expanded",i+""),o.setAttribute("aria-label",i?`Collapse ${f.label} column`:`Expand ${f.label} column`),o.appendChild(Ze("st-expand-icon")),o.addEventListener("click",j),o.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),j(t))}),e.appendChild(o),N=o,n&&(F=()=>{wn(L,P,{ariaLabelWhenExpanded:`Collapse ${f.label} column`,ariaLabelWhenCollapsed:`Expand ${f.label} column`,syncAriaExpanded:!0})})}t.columnEditorConfig.rowRenderer||L.appendChild(e)}const B=un({checked:O,onChange:t=>{if(!k)return;f.hide=!t,t?(Vi(i,f.accessor),A&&f.children&&f.children.length>0&&f.children.every(t=>!0===t.hide)&&f.children[0]&&(f.children[0].hide=!1,Vi(i,f.children[0].accessor))):Gi(i);const e=[...x];if(y(En(e)),R){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);R(t)}}});k||(B.element.classList.add("st-checkbox-disabled"),B.element.style.pointerEvents="none");const z=document.createElement("div");z.className="st-drag-icon-container";const V=null===(n=t.icons)||void 0===n?void 0:n.drag;"string"==typeof V?z.innerHTML=V:V instanceof HTMLElement||V instanceof SVGSVGElement?z.appendChild(V.cloneNode(!0)):z.appendChild(nn("st-drag-icon"));const q=document.createElement("div");q.className="st-column-label-container",q.textContent=f.label;const G="left"===f.pinned||"right"===f.pinned?f.pinned:null,K=!!G&&!H,_=!G&&"main"===p,U=!G&&"main"===p,J=()=>{const t=Vn(x,f.accessor,"left",M);t&&D(t)},Y=()=>{const t=Vn(x,f.accessor,"right",M);t&&D(t)},X=()=>{const t=Vn(x,f.accessor,"main",M);t&&D(t)},{rowRenderer:Q}=t.columnEditorConfig;if(Q){const t=Q({accessor:f.accessor,header:f,components:{expandIcon:N,checkbox:B.element,dragIcon:z,labelContent:q},panelSection:p,essential:H,canToggleVisibility:k,allowColumnPinning:I,pinControl:I&&0===s?{pinnedSide:G,canPinLeft:_,canPinRight:U,canUnpin:K,pinLeft:J,pinRight:Y,unpin:X}:void 0});t instanceof HTMLElement?L.appendChild(t):"string"==typeof t&&(L.innerHTML=t)}else if(L.appendChild(B.element),L.appendChild(z),L.appendChild(q),I&&0===s){const t=document.createElement("div");if(t.className="st-column-pin-side-group",t.addEventListener("mousedown",t=>{t.stopPropagation()}),t.addEventListener("dragstart",t=>{t.preventDefault(),t.stopPropagation()}),G){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"===G?"L":"R",e.title=n?"Essential column — cannot be unpinned":"Unpin column",K&&e.addEventListener("click",t=>{t.stopPropagation(),X()}),t.appendChild(e)}else{if(_){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(),J()}),t.appendChild(e)}if(U){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(),Y()}),t.appendChild(e)}}L.appendChild(t)}T.appendChild(L);const Z=document.createElement("div");return Z.className="st-column-editor-drag-separator",Z.style.opacity=$&&v.index===w?"1":"0",T.appendChild(Z),{fragment:T,scheduleExpandIconAnimation:F}})({allHeaders:n,clearHoverSeparator:T,depth:t.depth,doesAnyHeaderHaveChildren:y,draggingRow:p,getDraggingRow:()=>p,getHoveredSeparator:()=>w,expandedHeaders:x,flattenedHeaders:b,forceExpanded:o&&v.trim().length>0,header:t.header,hoveredSeparator:w,panelSection:e,rowIndex:t.visualIndex,setDraggingRow:k,setExpandedHeaders:A,setHoveredSeparator:E,columnEditorConfig:l,icons:a,essentialAccessors:null!=d?d:new Set,headers:n,setHeaders:c,onColumnVisibilityChange:h,onColumnOrderChange:u,previousExpandedHeaders:f});g.appendChild(s.fragment),null===(i=s.scheduleExpandIconAnimation)||void 0===i||i.call(s)})},P=t=>{M.innerHTML="";const e=!1!==l.allowColumnPinning,{pinnedLeft:i,unpinned:o,pinnedRight:s}=$n(n);if(e)W(i,"left","Pinned Left",M,t),W(o,"main","Main",M,t),W(s,"right","Pinned Right",M,t);else{const e=[...i,...o,...s];W(e,"main",null,M,t)}};return P(),{element:y,update:t=>{void 0!==t.headers&&(n=t.headers),void 0!==t.searchEnabled&&(o=t.searchEnabled),void 0!==t.searchPlaceholder&&(s=t.searchPlaceholder),void 0!==t.searchFunction&&(r=t.searchFunction),void 0!==t.icons&&(a=t.icons),void 0!==t.essentialAccessors&&(d=t.essentialAccessors),void 0!==t.setHeaders&&(c=t.setHeaders),void 0!==t.onColumnVisibilityChange&&(h=t.onColumnVisibilityChange),void 0!==t.onColumnOrderChange&&(u=t.onColumnOrderChange),void 0!==t.resetColumns&&(f=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&&(i=t.open,i?y.classList.add("open"):y.classList.remove("open")),S&&void 0!==t.searchPlaceholder&&(S.placeholder=t.searchPlaceholder),e&&(R.innerHTML="",H?Ji(R,H,n,C,M,I,f):Ui(R,C,M,I)),P()},destroy:()=>{S&&(S.removeEventListener("input",()=>{}),S.removeEventListener("click",()=>{})),y.removeEventListener("click",()=>{}),y.remove()}}},Xi=t=>{const{sectionHeaders:e,stickyParents:n,stickyHeight:i,offsetStartIndex:o,treeTransitionOffset:s,rowHeight:r,heightOffsets:l,customTheme:a,cellRenderContext:d,collapsedHeaders:c,pinned:h,width:u,scrollSyncGroup:f,sectionScrollController:v,startColIndex:p,resolveBodyRowIndex:w}=t,m=document.createElement("div");m.className=h?"st-sticky-section-"+h:"st-sticky-section-main",m.style.position="relative",m.style.height=i+"px",h&&u?(m.style.width=u+"px",m.style.flexGrow="0",m.style.flexShrink="0"):m.style.flexGrow="1";const g=((t,e)=>{const n=[],i=t=>{if(Z(t))return;const o=e.has(t.accessor);if(t.children&&t.children.length>0){const e=t.children.filter(t=>{const e=t.showWhen||"parentExpanded";return o?"parentCollapsed"===e||"always"===e:"parentExpanded"===e||"always"===e});t.singleRowChildren&&n.push(t),e.length>0?e.forEach(t=>i(t)):t.singleRowChildren||n.push(t)}else n.push(t)};return t.forEach(t=>i(t)),n})(e,c),b=new Map;let x=0;g.forEach(t=>{const e="number"==typeof t.width?t.width:150;b.set(t.accessor,{left:x,width:e}),x+=e});const y=h&&"number"==typeof u?u:"number"==typeof d.mainSectionContainerWidth?d.mainSectionContainerWidth:void 0;return n.forEach((t,e)=>{const i=-1!==o&&e>=o,c=i?s:0,h=e*(r+1)+c,u=i?e:n.length-e,f=document.createElement("div");f.className="st-row st-sticky-parent",f.style.position="absolute",f.style.top="0px",f.style.left="0",f.style.right="0",f.style.height=r+"px",f.style.transform=`translateY(${h}px)`,f.style.zIndex=u+"",f.setAttribute("data-index",t.position+""),g.forEach((e,n)=>{var i,o;const s=b.get(e.accessor),l=p+n,a={header:e,row:t.row,rowIndex:w(t),colIndex:l,rowId:pt(t.rowId),stableRowKey:t.stableRowKey,displayRowNumber:t.displayPosition,depth:t.depth,isOdd:t.position%2==1,tableRow:t,left:null!==(i=null==s?void 0:s.left)&&void 0!==i?i:0,top:0,width:null!==(o=null==s?void 0:s.width)&&void 0!==o?o:150,height:r},c=kn(a,d);f.appendChild(c)}),m.appendChild(f);const v=Pi({position:(e+1)*(r+1)-1+c,rowHeight:r,displayStrongBorder:!1,heightOffsets:l,customTheme:a,isSticky:!0,sectionWidthPx:y});m.appendChild(v)}),v&&f&&v.registerPane("pinned-left"===f?"pinned-left":"pinned-right"===f?"pinned-right":"main",m,"sticky"),m},Qi=(t,e)=>{if(e){const n=t.querySelector(".st-sticky-section-left"),i=t.querySelector(".st-sticky-section-main"),o=t.querySelector(".st-sticky-section-right");n instanceof HTMLElement&&e.unregisterPane("pinned-left",n),i instanceof HTMLElement&&e.unregisterPane("main",i),o instanceof HTMLElement&&e.unregisterPane("pinned-right",o)}t.remove()};class Zi{constructor(){this.footerInstance=null,this.lastCustomFooterRenderer=null,this.lastCustomFooterKey=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 Bi}scheduleRender(t){this.renderScheduled||(this.renderScheduled=!0,this.pendingRenderCallback=t,queueMicrotask(()=>{this.renderScheduled=!1,this.pendingRenderCallback&&(this.pendingRenderCallback(),this.pendingRenderCallback=null)}))}setOnRendererHostDiscard(t){this.sectionRenderer.setOnRendererHostDiscard(t)}invalidateCache(t){this.sectionRenderer.invalidateCache(t)}invalidateCustomFooterCache(){this.lastCustomFooterRenderer=null,this.lastCustomFooterKey=null}getCurrentBodyLayouts(){return this.sectionRenderer.getCurrentBodyLayouts()}renderHeader(t,e,n,i){var o,s,r,l,a,d,c,h,u,f,v,p,w,m;if(!t||i.config.hideHeader)return;t.style.height=e+"px";const g=An(i.effectiveHeaders,"left")||An(i.effectiveHeaders,void 0)||An(i.effectiveHeaders,"right");t.style.minHeight=g?"":e+"px";const b=t.parentElement;if(b)if(b.setAttribute("aria-rowcount",1+i.localRows.length+""),b.setAttribute("aria-colcount",i.effectiveHeaders.length+""),i.config.enableRowSelection){const t="multiple"===(null!==(o=i.config.rowSelectionMode)&&void 0!==o?o:"multiple");b.setAttribute("aria-multiselectable",t?"true":"false")}else b.removeAttribute("aria-multiselectable");const x=null!==(r=null===(s=i.dimensionManager)||void 0===s?void 0:s.getState())&&void 0!==r?r:{containerWidth:0,calculatedHeaderHeight:i.customTheme.headerHeight,maxHeaderDepth:1},{mainWidth:y,leftWidth:R,rightWidth:S}=wi({headers:i.effectiveHeaders,containerWidth:x.containerWidth,collapsedHeaders:i.collapsedHeaders}),C=null===(l=i.sortManager)||void 0===l?void 0:l.getState(),M=null===(a=i.filterManager)||void 0===a?void 0:a.getState(),I=null!==(c=null===(d=i.rowSelectionManager)||void 0===d?void 0:d.getSelectedRowCount())&&void 0!==c?c:0,H={reverse:!1,collapsedHeaders:i.collapsedHeaders,getCollapsedHeaders:i.getCollapsedHeaders,columnBorders:null!==(h=i.config.columnBorders)&&void 0!==h&&h,columnReordering:null!==(u=i.config.columnReordering)&&void 0!==u&&u,columnResizing:null!==(f=i.config.columnResizing)&&void 0!==f&&f,containerWidth:x.containerWidth,mainSectionContainerWidth:y,mainSectionViewportWidth:pi({containerWidth:x.containerWidth,leftWidth:R,rightWidth:S}),enableVirtualization:!1!==i.config.enableVirtualization,enableHeaderEditing:i.config.enableHeaderEditing,enableRowSelection:i.config.enableRowSelection,rowSelectionMode:null!==(v=i.config.rowSelectionMode)&&void 0!==v?v:"multiple",selectedRowCount:I,filters:null!==(p=null==M?void 0:M.filters)&&void 0!==p?p:{},icons:i.resolvedIcons,selectedColumns:i.config.selectableColumns&&i.selectionManager?i.selectionManager.getSelectedColumns():new Set,columnsWithSelectedCells:i.selectionManager&&(i.config.selectableCells||i.config.selectableColumns)?i.selectionManager.getColumnsWithSelectedCells():new Set,sort:null!==(w=null==C?void 0:C.sort)&&void 0!==w?w:null,autoExpandColumns:null!==(m=i.config.autoExpandColumns)&&void 0!==m&&m,getShrinkFloors:i.getShrinkFloors,onAutoExpandNaturalWidths:i.onAutoExpandNaturalWidths,essentialAccessors:i.essentialAccessors,selectableColumns:i.config.selectableColumns,headers:i.effectiveHeaders,rows:i.localRows,headerHeight:i.customTheme.headerHeight,lastHeaderIndex:i.effectiveHeaders.length-1,onSort:t=>{i.sortManager&&i.sortManager.updateSort({accessor:t})},handleApplyFilter:t=>{i.filterManager&&i.filterManager.updateFilter(t)},handleClearFilter:t=>{i.filterManager&&i.filterManager.clearFilter(t)},getHeaders:()=>i.getHeaders(),handleSelectAll:t=>{var e;null===(e=i.rowSelectionManager)||void 0===e||e.handleSelectAll(t)},setCollapsedHeaders:t=>{if("function"==typeof t){const e=i.getCollapsedHeaders?i.getCollapsedHeaders():i.collapsedHeaders;i.setCollapsedHeaders(t(e))}else i.setCollapsedHeaders(t);i.onRender()},setHeaders:t=>{i.setHeaders("function"==typeof t?t(i.getHeaders()):t),i.onRender()},setIsResizing:t=>{i.setIsResizing("function"==typeof t?t(i.isResizing):t)},onColumnWidthChange:i.config.onColumnWidthChange,onColumnOrderChange:i.config.onColumnOrderChange,onTableHeaderDragEnd:t=>{i.setHeaders(t),i.onRender()},onHeaderEdit:i.config.onHeaderEdit,onColumnSelect:i.config.onColumnSelect,selectColumns:i.selectionManager&&i.config.selectableColumns?(t,e)=>{i.selectionManager.selectColumns(t,e),i.onRender()}:t=>{},setSelectedColumns:i.selectionManager&&i.config.selectableColumns?t=>{const e=i.selectionManager.getSelectedColumns(),n="function"==typeof t?t(e):t;i.selectionManager.setSelectedColumns(n),i.onRender()}:t=>{},setSelectedCells:i.selectionManager?t=>{var e;const n=i.selectionManager.getSelectedCells(),o="function"==typeof t?t(n):t;i.selectionManager.setSelectedCells(o instanceof Set?o:new Set),null===(e=i.onRender)||void 0===e||e.call(i)}:t=>{},setInitialFocusedCell:i.selectionManager?t=>{var e;i.selectionManager.setInitialFocusedCell(null!=t?t:null),null===(e=i.onRender)||void 0===e||e.call(i)}:t=>{},areAllRowsSelected:()=>{var t,e;return null!==(e=null===(t=i.rowSelectionManager)||void 0===t?void 0:t.areAllRowsSelected())&&void 0!==e&&e},draggedHeaderRef:i.draggedHeaderRef,hoveredHeaderRef:i.hoveredHeaderRef,headerRegistry:i.headerRegistry,forceUpdate:()=>i.onRender(),mainBodyRef:i.mainBodyRef,pinnedLeftRef:i.pinnedLeftRef,pinnedRightRef:i.pinnedRightRef,accordionAxis:i.accordionAxis,animationCoordinator:i.animationCoordinator,onRendererHostDiscard:i.config.onRendererHostDiscard},k=i.effectiveHeaders.filter(t=>"left"===t.pinned),T=i.effectiveHeaders.filter(t=>!t.pinned),E=i.effectiveHeaders.filter(t=>"right"===t.pinned);let A=0;const O=[];if(k.length>0){const e=this.sectionRenderer.renderHeaderSection({headers:i.effectiveHeaders,collapsedHeaders:i.collapsedHeaders,pinned:"left",maxHeaderDepth:n,headerHeight:i.customTheme.headerHeight,context:H,sectionWidth:R,startColIndex:A});i.pinnedLeftHeaderRef.current=e,O.push(e),e.parentElement!==t&&t.insertBefore(e,t.firstChild),A=this.sectionRenderer.getNextColIndex("left")}if(T.length>0){const e=this.sectionRenderer.renderHeaderSection({headers:i.effectiveHeaders,collapsedHeaders:i.collapsedHeaders,maxHeaderDepth:n,headerHeight:i.customTheme.headerHeight,context:H,sectionWidth:y,startColIndex:A});if(i.mainHeaderRef.current=e,O.push(e),e.parentElement!==t){const n=i.pinnedRightHeaderRef.current;n&&n.parentElement===t?t.insertBefore(e,n):t.appendChild(e)}A=this.sectionRenderer.getNextColIndex("main")}if(E.length>0){const e=this.sectionRenderer.renderHeaderSection({headers:i.effectiveHeaders,collapsedHeaders:i.collapsedHeaders,pinned:"right",maxHeaderDepth:n,headerHeight:i.customTheme.headerHeight,context:H,sectionWidth:S,startColIndex:A});i.pinnedRightHeaderRef.current=e,O.push(e),e.parentElement!==t&&t.appendChild(e)}Array.from(t.children).forEach(t=>{O.includes(t)||t.remove()})}renderBody(t,e,n){var i,o,s,r,l,a,d,c,h,u,f,v,p,w,m,g,b,x,y,R,S,C,M,I,H,k,T;if(!t)return;if(An(n.effectiveHeaders,"left")||An(n.effectiveHeaders,void 0)||An(n.effectiveHeaders,"right"))t.style.minHeight="";else{const n=null!==(o=null===(i=null==e?void 0:e.heightMap)||void 0===i?void 0:i.totalHeight)&&void 0!==o?o:0;t.style.minHeight=n+"px"}const E=e.rowsToRender||e.currentTableRows,A=!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}),A){this.sectionRenderer.releaseBodySections(),t.innerHTML="",n.mainBodyRef.current=null,n.pinnedLeftRef.current=null,n.pinnedRightRef.current=null;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 O=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:W,leftWidth:P,rightWidth:$}=wi({headers:n.effectiveHeaders,containerWidth:O.containerWidth,collapsedHeaders:n.collapsedHeaders}),F=null!==(d=null===(a=n.rowSelectionManager)||void 0===a?void 0:a.getSelectedRowCount())&&void 0!==d?d:0,L=null!==(c=O.maxHeaderDepth)&&void 0!==c?c:1,D=null===(h=Y(n.effectiveHeaders).find(t=>!t.isSelectionColumn))||void 0===h?void 0:h.accessor,j={collapsedHeaders:n.collapsedHeaders,collapsedRows:n.getCollapsedRows(),expandedRows:n.getExpandedRows(),expandedDepths:Array.from(n.expandedDepths),selectedColumns:null!==(f=null===(u=n.selectionManager)||void 0===u?void 0:u.getSelectedColumns())&&void 0!==f?f:new Set,rowsWithSelectedCells:null!==(p=null===(v=n.selectionManager)||void 0===v?void 0:v.getRowsWithSelectedCells())&&void 0!==p?p:new Set,columnBorders:null!==(w=n.config.columnBorders)&&void 0!==w&&w,enableRowSelection:n.config.enableRowSelection,selectRowOnClick:null!==(m=n.config.selectRowOnClick)&&void 0!==m&&m,rowSelectionMode:null!==(g=n.config.rowSelectionMode)&&void 0!==g?g:"multiple",selectedRowCount:F,activeRowId:null!==(x=null===(b=n.rowSelectionManager)||void 0===b?void 0:b.getActiveRowId())&&void 0!==x?x:null,cellUpdateFlash:n.config.cellUpdateFlash,oddColumnBackground:n.config.oddColumnBackground,hoverRowBackground:null===(y=n.config.hoverRowBackground)||void 0===y||y,hoverScopeId:n.hoverScopeId,oddEvenRowBackground:n.config.oddEvenRowBackground,rowGrouping:n.config.rowGrouping,headers:n.effectiveHeaders,rowHeaderAccessor:D,rowHeight:n.customTheme.rowHeight,maxHeaderDepth:L,heightOffsets:e.paginatedHeightOffsets,customTheme:n.customTheme,containerWidth:O.containerWidth,mainSectionContainerWidth:W,mainSectionViewportWidth:pi({containerWidth:O.containerWidth,leftWidth:P,rightWidth:$}),enableVirtualization:!1!==n.config.enableVirtualization,onCellEdit:n.config.onCellEdit,onCellClick:n.config.onCellClick,onRowGroupExpand:n.config.onRowGroupExpand,handleRowSelect:(t,e)=>{var i;null===(i=n.rowSelectionManager)||void 0===i||i.handleRowSelect(t,e)},handleToggleRow:t=>{var e;null===(e=n.rowSelectionManager)||void 0===e||e.handleToggleRow(t)},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!==(R=n.config.theme)&&void 0!==R?R:"modern-light",rowButtons:n.config.rowButtons,loadingStateRenderer:n.config.loadingStateRenderer,errorStateRenderer:n.config.errorStateRenderer,emptyStateRenderer:n.config.emptyStateRenderer,createNestedTable:n.createNestedTable,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,e,i)=>{var o;return null===(o=n.selectionManager)||void 0===o?void 0:o.handleMouseOver(t,e,i)},onRendererHostDiscard:n.config.onRendererHostDiscard,isRowSelected:t=>{var e,i;return null!==(i=null===(e=n.rowSelectionManager)||void 0===e?void 0:e.isRowSelected(t))&&void 0!==i&&i},canExpandRowGroup:n.config.canExpandRowGroup,isLoading:n.internalIsLoading,accordionAxis:n.accordionAxis},N=n.effectiveHeaders.filter(t=>"left"===t.pinned),B=n.effectiveHeaders.filter(t=>!t.pinned),z=n.effectiveHeaders.filter(t=>"right"===t.pinned);let q=0;const G=[],K=n.positionOnlyBody?void 0:n.animationCoordinator;if(N.length>0){const i=this.sectionRenderer.renderBodySection({headers:n.effectiveHeaders,rows:E,collapsedHeaders:n.collapsedHeaders,pinned:"left",context:j,sectionWidth:P,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,totalRowCount:e.currentTableRows.length,startColIndex:q,positionOnly:n.positionOnlyBody,fullTableRows:e.currentTableRows,renderedStartIndex:e.renderedStartIndex,renderedEndIndex:e.renderedEndIndex,allFlattenedRows:e.allFlattenedRows,pageStartIndex:e.pageStartIndex,animationCoordinator:K});n.pinnedLeftRef.current=i,G.push(i),i.parentElement!==t&&t.insertBefore(i,t.firstChild),q=this.sectionRenderer.getNextColIndex("left")}if(B.length>0){const i=this.sectionRenderer.renderBodySection({headers:n.effectiveHeaders,rows:E,collapsedHeaders:n.collapsedHeaders,context:j,sectionWidth:W,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,totalRowCount:e.currentTableRows.length,startColIndex:q,positionOnly:n.positionOnlyBody,fullTableRows:e.currentTableRows,renderedStartIndex:e.renderedStartIndex,renderedEndIndex:e.renderedEndIndex,allFlattenedRows:e.allFlattenedRows,pageStartIndex:e.pageStartIndex,animationCoordinator:K});if(n.mainBodyRef.current=i,G.push(i),i.parentElement!==t){const e=n.pinnedRightRef.current;e&&e.parentElement===t?t.insertBefore(i,e):t.appendChild(i)}q=this.sectionRenderer.getNextColIndex("main")}if(z.length>0){const i=this.sectionRenderer.renderBodySection({headers:n.effectiveHeaders,rows:E,collapsedHeaders:n.collapsedHeaders,pinned:"right",context:j,sectionWidth:$,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,totalRowCount:e.currentTableRows.length,startColIndex:q,positionOnly:n.positionOnlyBody,fullTableRows:e.currentTableRows,renderedStartIndex:e.renderedStartIndex,renderedEndIndex:e.renderedEndIndex,allFlattenedRows:e.allFlattenedRows,pageStartIndex:e.pageStartIndex,animationCoordinator:K});n.pinnedRightRef.current=i,G.push(i),i.parentElement!==t&&t.appendChild(i)}if(n.config.enableStickyParents&&e.stickyParents&&e.stickyParents.length>0){this.stickyParentsContainer&&(Qi(this.stickyParentsContainer,null!==(S=n.sectionScrollController)&&void 0!==S?S:null),this.stickyParentsContainer=null);const i=n.externalScrollActive?null!==(C=n.stickyParentsScrollTop)&&void 0!==C?C:0:null!==(I=null===(M=n.mainBodyRef.current)||void 0===M?void 0:M.scrollTop)&&void 0!==I?I:0,o=t.offsetWidth-t.clientWidth,s={left:0,main:N.length>0?this.sectionRenderer.getNextColIndex("left"):0,right:B.length>0?this.sectionRenderer.getNextColIndex("main"):N.length>0?this.sectionRenderer.getNextColIndex("left"):0},r=E.filter(t=>!t.nestedTable&&!t.stateIndicator),l=new Map;if(r.forEach((t,e)=>{var n;const i=null!==(n=t.stableRowKey)&&void 0!==n?n:pt(t.rowId);l.set(i,e)}),this.stickyParentsContainer=((t,e)=>{const{stickyParents:n,stickySectionColStart:i,stickyBodyRowIndexByRowKey:o}=t;if(0===n.length)return null;const s=t=>{var e,n;const i=null!==(e=t.stableRowKey)&&void 0!==e?e:pt(t.rowId);return null!==(n=o.get(i))&&void 0!==n?n:t.position},{treeTransitionOffset:r,offsetStartIndex:l}=((t,e,n,i,o,s)=>{var r,l;if(0===t.length)return{treeTransitionOffset:0,offsetStartIndex:-1};const a=e[0];if(!a)return{treeTransitionOffset:0,offsetStartIndex:-1};let d;if((null==a?void 0:a.parentIndices)&&a.parentIndices.length>0)for(let e=a.parentIndices.length-1;e>=0;e--){const n=a.parentIndices[e];if(t.some(t=>t.position===n)){d=n;break}}const c=void 0!==d?t.findIndex(t=>t.position===d):-1;let h=-1;for(let e=0;t.length>e;e++){const n=t[e],i=t[e+1];if(!i)break;if(i.depth===n.depth){h=e;break}if(n.depth>i.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 f=0;for(const t of e){if(!(null===(l=t.parentIndices)||void 0===l?void 0:l.includes(u)))break;f++}if(0===f)return{treeTransitionOffset:0,offsetStartIndex:c};const v=e[0];let p;return p=n?n.rowTopPositions[v.position]:v.position*(i+o.rowSeparatorWidth),{treeTransitionOffset:-((h+1-f)*i+Math.max(0,s-p)),offsetStartIndex:c}})(n,t.partiallyVisibleRows,t.heightMap,e.rowHeight,e.customTheme,t.scrollTop),a=n.length>0?n.length*(e.rowHeight+1)+r:0,d=`calc(100% - ${t.scrollbarWidth}px - ${e.enableColumnEditor?"29.5px":"0px"})`,c=document.createElement("div");c.className="st-sticky-top",c.setAttribute("aria-hidden","true"),c.style.height=a+"px",c.style.width=d,t.externalScrollActive?c.style.marginBottom=-a+"px":c.style.top=t.calculatedHeaderHeight+"px";const h=e.headers.filter(t=>!t.pinned),u=e.sectionScrollController;if(t.pinnedLeftColumns.length>0){const o=Xi({sectionHeaders:t.pinnedLeftColumns,stickyParents:n,stickyHeight:a,offsetStartIndex:l,treeTransitionOffset:r,rowHeight:e.rowHeight,heightOffsets:e.heightOffsets,customTheme:e.customTheme,cellRenderContext:e.cellRenderContext,collapsedHeaders:e.collapsedHeaders,pinned:"left",width:t.pinnedLeftWidth,scrollSyncGroup:"pinned-left",sectionScrollController:u,startColIndex:i.left,resolveBodyRowIndex:s});c.appendChild(o)}const f=Xi({cellRenderContext:e.cellRenderContext,collapsedHeaders:e.collapsedHeaders,customTheme:e.customTheme,heightOffsets:e.heightOffsets,offsetStartIndex:l,rowHeight:e.rowHeight,scrollSyncGroup:"default",sectionHeaders:h,stickyHeight:a,stickyParents:n,treeTransitionOffset:r,sectionScrollController:u,startColIndex:i.main,resolveBodyRowIndex:s});if(c.appendChild(f),t.pinnedRightColumns.length>0){const o=Xi({sectionHeaders:t.pinnedRightColumns,stickyParents:n,stickyHeight:a,offsetStartIndex:l,treeTransitionOffset:r,rowHeight:e.rowHeight,heightOffsets:e.heightOffsets,customTheme:e.customTheme,cellRenderContext:e.cellRenderContext,collapsedHeaders:e.collapsedHeaders,pinned:"right",width:t.pinnedRightWidth,scrollSyncGroup:"pinned-right",sectionScrollController:u,startColIndex:i.right,resolveBodyRowIndex:s});c.appendChild(o)}return c})({calculatedHeaderHeight:O.calculatedHeaderHeight,heightMap:e.heightMap,partiallyVisibleRows:e.partiallyVisibleRows||[],pinnedLeftColumns:N,pinnedLeftWidth:P,pinnedRightColumns:z,pinnedRightWidth:$,scrollTop:i,scrollbarWidth:o,stickyParents:e.stickyParents,stickySectionColStart:s,stickyBodyRowIndexByRowKey:l,externalScrollActive:n.externalScrollActive},{collapsedHeaders:n.collapsedHeaders,customTheme:n.customTheme,enableColumnEditor:V(n.config.enableColumnEditor,null===(H=n.config.columnEditorConfig)||void 0===H?void 0:H.showToggle),headers:n.effectiveHeaders,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,cellRenderContext:j,sectionScrollController:null!==(k=n.sectionScrollController)&&void 0!==k?k:null}),this.stickyParentsContainer){const e=t.parentElement;e&&this.stickyParentsContainer.parentElement!==e?e.insertBefore(this.stickyParentsContainer,t):e||t.appendChild(this.stickyParentsContainer)}}else this.stickyParentsContainer&&(Qi(this.stickyParentsContainer,null!==(T=n.sectionScrollController)&&void 0!==T?T:null),this.stickyParentsContainer=null);Array.from(t.children).forEach(t=>{G.includes(t)||t.remove()})}renderFooter(t,e,n,i,o){var s,r,l,a,d,c,h,u,f,v,p,w,m;if(!t)return;const g=!!o.config.footerRenderer,b=o.config.enablePagination&&!o.config.hideFooter;if(g||(this.lastCustomFooterRenderer=null,this.lastCustomFooterKey=null),!g&&!b)return void(t.innerHTML="");const x=null!==(s=o.config.rowsPerPage)&&void 0!==s?s:10,y=Math.ceil(e/x);if(g){const s=(n-1)*x+1,c=Math.min(n*x,e),h=`${n}|${e}|${x}|${y}|${o.config.hideFooter?1:0}|${null!==(r=o.config.footerRenderKey)&&void 0!==r?r:""}`;if(t.childNodes.length>0&&this.lastCustomFooterRenderer===o.config.footerRenderer&&this.lastCustomFooterKey===h)return void(this.footerInstance=null);this.lastCustomFooterRenderer=o.config.footerRenderer,this.lastCustomFooterKey=h;const u=null!==(l=o.config.serverSidePagination)&&void 0!==l&&l,f=t=>{if(u&&o.config.onPageChange)return o.config.onPageChange(t)},v=o.config.footerRenderer({currentPage:n,endRow:c,hasNextPage:y>n,hasPrevPage:n>1,nextIcon:null===(a=o.resolvedIcons)||void 0===a?void 0:a.next,onNextPage:async()=>{y>n&&(i(n+1),o.config.onNextPage&&await o.config.onNextPage(n+1),await f(n+1))},onPageChange:t=>{i(t),f(t)},onPrevPage:()=>{n>1&&(i(n-1),f(n-1))},prevIcon:null===(d=o.resolvedIcons)||void 0===d?void 0:d.prev,rowsPerPage:x,startRow:s,totalPages:y,totalRows:e});return t.innerHTML="",v instanceof HTMLElement?t.appendChild(v):"string"==typeof v&&(t.innerHTML=v),void(this.footerInstance=null)}if(this.footerInstance)this.footerInstance.update({currentPage:n,hideFooter:null!==(c=o.config.hideFooter)&&void 0!==c&&c,onPageChange:i,onNextPage:o.config.onNextPage,onUserPageChange:o.config.onPageChange,rowsPerPage:x,enablePagination:null!==(h=o.config.enablePagination)&&void 0!==h&&h,totalPages:y,totalRows:e,prevIcon:null===(u=o.resolvedIcons)||void 0===u?void 0:u.prev,nextIcon:null===(f=o.resolvedIcons)||void 0===f?void 0:f.next});else{t.innerHTML="";const s=(t=>{let{currentPage:e,hideFooter:n,onPageChange:i,onNextPage:o,onUserPageChange:s,rowsPerPage:r,enablePagination:l,totalPages:a,totalRows:d,prevIcon:c,nextIcon:h}=t,u=!0;if(n||!l)return{element:document.createElement("div"),update:()=>{},destroy:()=>{}};const f=document.createElement("div");f.className="st-footer";const v=()=>{f.innerHTML="";const t=e>1,n=a>e,l=e===a,p=Math.min((e-1)*r+1,d),w=Math.min(e*r,d),m=!t,g=!n&&!o||!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 ${p} to ${w} of ${d.toLocaleString()} results`,b.appendChild(x),f.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 i,o;if(t>8)if(e-7>t){const e=7;i=t-e,o=t+(15-e-1)}else i=Math.max(1,e-15+1),o=e;else i=1,o=14;i>2?(n.push(1),n.push(-1)):2===i&&n.push(1);for(let t=i;o>=t;t++)n.push(t);return e-1>o?(n.push(-2),n.push(e)):o===e-1&&n.push(e),n})(e,a),S=[];R.forEach((t,n)=>{if(0>t){const t=document.createElement("span");t.className="st-page-ellipsis",t.textContent="...",y.appendChild(t)}else{const o=document.createElement("button"),r=n>0&&0>R[n-1];o.className=["st-page-btn",e===t?"active":""].filter(Boolean).join(" "),o.textContent=""+t,o.setAttribute("aria-label","Go to page "+t),e===t&&o.setAttribute("aria-current","page"),o.addEventListener("click",()=>(async t=>{1>t||t>a||(i(t),s&&await s(t))})(t)),y.appendChild(o),S.push({button:o,page:t,afterEllipsis:r})}}),S.forEach((t,n)=>{const{button:i,page:o,afterEllipsis:s}=t,r=n+1,l=e===o,a=i.previousElementSibling,d=i.nextElementSibling,c=null!==a&&a.classList.contains("st-page-btn")&&a.classList.contains("active")||null!==d&&d.classList.contains("st-page-btn")&&d.classList.contains("active");r>9&&!(l||s||c)&&i.classList.add("st-page-btn--compact-hidden")});const C=document.createElement("button");C.className="st-next-prev-btn "+(m?"disabled":""),C.disabled=m,C.setAttribute("aria-label","Go to previous page"),zi(C,c||Qe("st-next-prev-icon")),C.addEventListener("click",async()=>{const t=e-1;1>t||(i(t),s&&await s(t))}),y.appendChild(C);const M=document.createElement("button");M.className="st-next-prev-btn "+(g?"disabled":""),M.disabled=g,M.setAttribute("aria-label","Go to next page"),zi(M,h||Ze("st-next-prev-icon")),M.addEventListener("click",async()=>{const t=e+1;if(o&&e===a&&!await o(e))return u=!1,void v();t>a&&!o||(i(t),s&&await s(t))}),y.appendChild(M),f.appendChild(y)};return v(),{element:f,update:t=>{void 0!==t.currentPage&&(e=t.currentPage),void 0!==t.hideFooter&&(n=t.hideFooter),void 0!==t.onPageChange&&(i=t.onPageChange),void 0!==t.onNextPage&&(o=t.onNextPage),void 0!==t.onUserPageChange&&(s=t.onUserPageChange),void 0!==t.rowsPerPage&&(r=t.rowsPerPage),void 0!==t.enablePagination&&(l=t.enablePagination),void 0!==t.totalPages&&(a=t.totalPages),void 0!==t.totalRows&&(d=t.totalRows),void 0!==t.prevIcon&&(c=t.prevIcon),void 0!==t.nextIcon&&(h=t.nextIcon),n||!l?f.style.display="none":(f.style.display="flex",v())},destroy:()=>{f.remove()}}})({currentPage:n,hideFooter:null!==(v=o.config.hideFooter)&&void 0!==v&&v,onPageChange:i,onNextPage:o.config.onNextPage,onUserPageChange:o.config.onPageChange,rowsPerPage:x,enablePagination:null!==(p=o.config.enablePagination)&&void 0!==p&&p,totalPages:y,totalRows:e,prevIcon:null===(w=o.resolvedIcons)||void 0===w?void 0:w.prev,nextIcon:null===(m=o.resolvedIcons)||void 0===m?void 0:m.next});this.footerInstance=s,t.appendChild(s.element)}}renderColumnEditor(t,e,n,i,o){if(!t)return;if(!o.config.enableColumnEditor)return void(this.columnEditorInstance&&(this.columnEditorInstance.destroy(),this.columnEditorInstance=null));const s=()=>{const t=o.getPristineDefaultHeaders();t&&(o.setHeaders(En(t)),o.onRender())};if(this.columnEditorInstance)this.columnEditorInstance.update({columnEditorText:i.text,enableColumnEditor:o.config.enableColumnEditor,headers:o.headers,open:e,searchEnabled:i.searchEnabled,searchPlaceholder:i.searchPlaceholder,searchFunction:i.searchFunction,columnEditorConfig:i,icons:o.resolvedIcons,essentialAccessors:o.essentialAccessors,setHeaders:t=>{o.setHeaders(t),this.columnEditorInstance&&this.columnEditorInstance.update({headers:t}),o.onRender()},onColumnVisibilityChange:o.config.onColumnVisibilityChange,onColumnOrderChange:o.config.onColumnOrderChange,resetColumns:s,setOpen:n});else{const r=(t=>{let{columnEditorText:e,enableColumnEditor:n,headers:i,open:o,searchEnabled:s,searchPlaceholder:r,searchFunction:l,columnEditorConfig:a,icons:d,essentialAccessors:c,resetColumns:h,setHeaders:u,onColumnVisibilityChange:f,onColumnOrderChange:v,setOpen:p}=t;if(!n)return{element:document.createElement("div"),update:()=>{},destroy:()=>{}};const w=!1!==a.showToggle,m=document.createElement("div");m.className=`st-column-editor${w?"":" st-column-editor--no-toggle"}${o?" open":""}`,m.style.width=w?"29.5px":"0px";const g=()=>{p(!o)};let b=null;w&&(b=document.createElement("div"),b.className="st-column-editor-text",b.textContent=e,m.addEventListener("click",g),m.appendChild(b));const x=Yi({headers:i,open:o,searchEnabled:s,searchPlaceholder:r,searchFunction:l,columnEditorConfig:a,icons:d,essentialAccessors:c,resetColumns:h,setHeaders:u,onColumnVisibilityChange:f,onColumnOrderChange:v});m.appendChild(x.element);const y={update:t=>{void 0!==t.open&&(o=t.open,t.open?m.classList.add("open"):m.classList.remove("open")),void 0!==t.setOpen&&(p=t.setOpen),void 0!==t.columnEditorText&&b&&(b.textContent=t.columnEditorText),void 0!==t.essentialAccessors&&(c=t.essentialAccessors),void 0!==t.icons&&(d=t.icons),void 0!==t.resetColumns&&(h=t.resetColumns),x.update({headers:t.headers,open:t.open,searchEnabled:t.searchEnabled,searchPlaceholder:t.searchPlaceholder,searchFunction:t.searchFunction,columnEditorConfig:t.columnEditorConfig,icons:t.icons,essentialAccessors:t.essentialAccessors,resetColumns:t.resetColumns,setHeaders:t.setHeaders,onColumnVisibilityChange:t.onColumnVisibilityChange,onColumnOrderChange:t.onColumnOrderChange})},destroy:()=>{w&&m.removeEventListener("click",g),x.destroy(),m.remove()}};return m.__columnEditor=y,Object.assign({element:m},y)})({columnEditorText:i.text,enableColumnEditor:o.config.enableColumnEditor,headers:o.headers,open:e,searchEnabled:i.searchEnabled,searchPlaceholder:i.searchPlaceholder,searchFunction:i.searchFunction,columnEditorConfig:i,icons:o.resolvedIcons,essentialAccessors:o.essentialAccessors,setHeaders:t=>{o.setHeaders(t),this.columnEditorInstance&&this.columnEditorInstance.update({headers:t}),o.onRender()},onColumnVisibilityChange:o.config.onColumnVisibilityChange,onColumnOrderChange:o.config.onColumnOrderChange,resetColumns:s,setOpen:n});this.columnEditorInstance=r,t.appendChild(r.element)}}renderHorizontalScrollbar(t,e,n,i,o,s,r,l){var a,d,c,h,u;if(!t||!r)return;const f=null!==(a=l.mainBodyRef.current)&&void 0!==a?a:l.mainHeaderRef.current;if(!f)return;const v=null!==(c=null===(d=l.mainBodyRef.current)||void 0===d?void 0:d.clientWidth)&&void 0!==c?c:Math.max(0,r.clientWidth-n-i);if(1>=e-v&&1>=f.scrollWidth-f.clientWidth)return this.horizontalScrollbarRef.current&&(vi(this.horizontalScrollbarRef.current,l.sectionScrollController),this.horizontalScrollbarRef.current=null),void(null!==this.scrollbarTimeoutId&&(clearTimeout(this.scrollbarTimeoutId),this.scrollbarTimeoutId=null));this.horizontalScrollbarRef.current&&t.contains(this.horizontalScrollbarRef.current)?fi(this.horizontalScrollbarRef.current,{mainBodyRef:f,mainBodyWidth:e,pinnedLeftWidth:n,pinnedRightWidth:i,pinnedLeftContentWidth:o,pinnedRightContentWidth:s,tableBodyContainerRef:r,enableColumnEditor:V(l.config.enableColumnEditor,null===(h=l.config.columnEditorConfig)||void 0===h?void 0:h.showToggle),sectionScrollController:null!==(u=l.sectionScrollController)&&void 0!==u?u:void 0}):(null!==this.scrollbarTimeoutId&&(clearTimeout(this.scrollbarTimeoutId),this.scrollbarTimeoutId=null),this.scrollbarTimeoutId=window.setTimeout(()=>{var a,d,c,h,u;if(!r||!t)return;const f=null!==(a=l.mainBodyRef.current)&&void 0!==a?a:l.mainHeaderRef.current;if(!f)return;if(this.horizontalScrollbarRef.current&&t.contains(this.horizontalScrollbarRef.current))return fi(this.horizontalScrollbarRef.current,{mainBodyRef:f,mainBodyWidth:e,pinnedLeftWidth:n,pinnedRightWidth:i,pinnedLeftContentWidth:o,pinnedRightContentWidth:s,tableBodyContainerRef:r,enableColumnEditor:V(l.config.enableColumnEditor,null===(d=l.config.columnEditorConfig)||void 0===d?void 0:d.showToggle),sectionScrollController:null!==(c=l.sectionScrollController)&&void 0!==c?c:void 0}),void(this.scrollbarTimeoutId=null);this.sectionScrollController=null!==(h=l.sectionScrollController)&&void 0!==h?h:null;const v=(t=>{const{mainBodyRef:e,mainBodyWidth:n,pinnedLeftWidth:i,pinnedRightWidth:o,pinnedLeftContentWidth:s,pinnedRightContentWidth:r,tableBodyContainerRef:l,enableColumnEditor:a,sectionScrollController:d,forceScrollable:c=!1}=t;if(!c){const t=e.clientWidth;if(1>=Math.max(e.scrollWidth,n)-t)return null}const h=a?B:0,u=(a?o+1:o)+(l.scrollHeight>l.clientHeight?l.offsetWidth-l.clientWidth:0),f=document.createElement("div");if(f.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=s+"px",t.appendChild(e),f.appendChild(t),null==d||d.registerPane("pinned-left",t,"scrollbar")}if(n>0){const t=document.createElement("div");t.className="st-horizontal-scrollbar-middle";const e=document.createElement("div");e.style.width=n+"px",t.appendChild(e),f.appendChild(t),null==d||d.registerPane("main",t,"scrollbar")}if(o>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=r+"px",t.appendChild(e),f.appendChild(t),null==d||d.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",f.appendChild(t)}return f})({mainBodyRef:f,mainBodyWidth:e,pinnedLeftWidth:n,pinnedRightWidth:i,pinnedLeftContentWidth:o,pinnedRightContentWidth:s,tableBodyContainerRef:r,enableColumnEditor:V(l.config.enableColumnEditor,null===(u=l.config.columnEditorConfig)||void 0===u?void 0:u.showToggle),sectionScrollController:this.sectionScrollController,forceScrollable:!0});if(v){const e=t.querySelector(".st-content-wrapper");e&&e.nextSibling?t.insertBefore(v,e.nextSibling):t.appendChild(v),this.horizontalScrollbarRef.current=v}this.scrollbarTimeoutId=null},1))}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&&(vi(this.horizontalScrollbarRef.current,this.sectionScrollController),this.horizontalScrollbarRef.current=null),this.stickyParentsContainer&&(Qi(this.stickyParentsContainer,this.sectionScrollController),this.stickyParentsContainer=null),this.sectionScrollController=null}}function to(t){const{rows:e=[],rowGrouping:n=[],getRowId:i,expandedRows:o=new Map,collapsedRows:s=new Map,expandedDepths:r=new Set,rowStateMap:l=new Map,hasLoadingRenderer:a=!1,hasErrorRenderer:d=!1,hasEmptyRenderer:c=!1,headers:h=[],rowHeight:u=40,headerHeight:f=40,customTheme:v}=t;if(!n||0===n.length){const t=e.map((t,e)=>{const n=[e],o=[e],s=vt({row:t,getRowId:i,depth:0,index:e,rowPath:n,rowIndexPath:o,groupingKey:void 0}),r=gt({getRowId:i,row:t,depth:0,index:e,rowPath:n,rowIndexPath:o,groupingKey:void 0,parentStableKey:null});return Object.assign({row:t,depth:0,displayPosition:e,groupingKey:void 0,position:e,rowId:s,rowPath:n,rowIndexPath:o,absoluteRowIndex:e,isLastGroupRow:!1,stableRowKey:r},rt(t)?{isLoadingSkeleton:!0}:{})});return{flattenedRows:t,heightOffsets:[],paginatableRows:t,parentEndPositions:e.map((t,e)=>e+1)}}const p=[],w=[],m=[],g=[];let b=0;const x=(t,e,y=[],R=[],S=[],C=null)=>{t.forEach((t,M)=>{var I,H;const k=n[e],T=p.length,E=[...y,M],A=[...R,M],O=vt({row:t,getRowId:i,depth:e,index:M,rowPath:E,rowIndexPath:A,groupingKey:k}),W=gt({getRowId:i,row:t,depth:e,index:M,rowPath:E,rowIndexPath:A,groupingKey:k,parentStableKey:C}),P=p.length,$=Object.assign({row:t,depth:e,displayPosition:b,groupingKey:k,position:T,isLastGroupRow:!1,rowId:O,rowPath:E,rowIndexPath:A,absoluteRowIndex:T,parentIndices:S.length>0?[...S]:void 0,stableRowKey:W},rt(t)?{isLoadingSkeleton:!0}:{});p.push($),w.push($),b++;const F=bt({stableRowKey:W,rowId:O});if(Rt(F,e,r,o,s)&&n.length>e){const n=null==l?void 0:l.get(F),i=((t,e)=>{const n=t[e];return ft(n)?n:[]})(t,k),o=h.find(t=>t.expandable&&t.nestedTable);if((null==o?void 0:o.nestedTable)&&i.length>0){const n=p.length,s=(null===(I=o.nestedTable.customTheme)||void 0===I?void 0:I.rowHeight)||u,r=(null===(H=o.nestedTable.customTheme)||void 0===H?void 0:H.headerHeight)||f,l=(({childRowCount:t,rowHeight:e,headerHeight:n,customTheme:i})=>Math.min(n+i.rowSeparatorWidth+t*(e+i.rowSeparatorWidth)+i.nestedGridPaddingTop+i.nestedGridPaddingBottom+i.nestedGridBorderWidth,i.nestedGridMaxHeight+i.nestedGridPaddingTop+i.nestedGridPaddingBottom+i.nestedGridBorderWidth))({childRowCount:i.length,rowHeight:s,headerHeight:r,customTheme:v}),a=at({calculatedHeight:l,customHeight:o.nestedTable.height,customTheme:v});m.push([n,a-u]);const d=[...E,k];p.push({row:{},depth:e+1,displayPosition:b-1,groupingKey:k,position:n,isLastGroupRow:!1,rowId:d,rowPath:d,rowIndexPath:A,stableRowKey:xt(F,k),nestedTable:{parentRow:t,expandableHeader:o,childAccessor:k,calculatedHeight:a},absoluteRowIndex:n})}else if(n&&(n.loading||n.error||n.isEmpty)){if(n.loading&&a||n.error&&d||n.isEmpty&&c){const i=p.length,o=[...E,k];p.push({row:{},depth:e+1,displayPosition:b-1,groupingKey:k,position:i,isLastGroupRow:!1,rowId:o,rowPath:o,rowIndexPath:A,stableRowKey:xt(F,k),stateIndicator:{parentRowId:F,parentRow:t,state:n},absoluteRowIndex:i,parentIndices:[...S,P]})}else if(n.loading&&!a){const t=p.length,n=[...E,k,"loading-skeleton"];p.push({row:{},depth:e+1,displayPosition:b-1,groupingKey:k,position:t,isLastGroupRow:!1,rowId:n,rowPath:n,rowIndexPath:A,isLoadingSkeleton:!0,absoluteRowIndex:t,parentIndices:[...S,P]})}}else if(i.length>0){const t=[...E,k],n=[...A];x(i,e+1,t,n,[...S,P],W)}}0===e&&g.push(p.length)})};return x(e,0,[],[],[]),g.forEach((t,e)=>{const n=t-1;n>=0&&p.length>n&&(p[n].isLastGroupRow=!0)}),{flattenedRows:p,heightOffsets:m,paginatableRows:w,parentEndPositions:g}}class eo{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 Zi}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}getCurrentBodyLayouts(){return this.tableRenderer.getCurrentBodyLayouts()}setOnRendererHostDiscard(t){this.tableRenderer.setOnRendererHostDiscard(t)}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)}invalidateCustomFooterCache(){this.tableRenderer.invalidateCustomFooterCache()}computeEffectiveHeaders(t,e,n,i){var o;let s=[...t];return Ne(e)&&!(null===(o=null==t?void 0:t[0])||void 0===o?void 0:o.isSelectionColumn)&&(s=[{accessor:"__row_selection__",label:"",width:n.selectionColumnWidth,editable:!1,type:"boolean",pinned:"left",isSelectionColumn:!0,sortable:!1,filterable:!1,align:"center"},...s]),null!=i&&i>0?Ht(s,{containerWidth:i}):Ht(s)}primeLastProcessedResult(t,e){var n;const i=this.buildRowModelSnapshot(t,e);i&&(this.lastProcessedResult=i.processedResult,null===(n=t.rowSelectionManager)||void 0===n||n.updateConfig({tableRows:i.processedResult.currentTableRows}))}buildRowModelSnapshot(t,e){var n,i,o,s,r,l,a,d,c,h,u,f,v,p,w,m,g,b,x;if(this.lastHeadersRef!==t.headers&&(this.invalidateCache("header"),this.invalidateCache("context"),this.lastHeadersRef=t.headers),!t.dimensionManager)return null;const y=t.dimensionManager.getState(),{containerWidth:R,calculatedHeaderHeight:S,maxHeaderDepth:C}=y,M=0===t.collapsedHeaders.size?"":[...t.collapsedHeaders].map(String).sort().join("\0");let I;t.positionOnlyBody&&!0!==t.config.autoExpandColumns&&this.scrollRafHeadersMemo&&this.scrollRafHeadersMemo.headersRef===t.headers&&this.scrollRafHeadersMemo.containerWidth===R&&this.scrollRafHeadersMemo.collapsedKey===M?I=this.scrollRafHeadersMemo.effectiveHeaders:(I=this.computeEffectiveHeaders(t.headers,t.config,t.customTheme,R),this.scrollRafHeadersMemo=!0!==t.config.autoExpandColumns?{headersRef:t.headers,containerWidth:R,collapsedKey:M,effectiveHeaders:I}:null);const{leftWidth:H,rightWidth:k}=wi({headers:I,containerWidth:R,collapsedHeaders:t.collapsedHeaders});t.config.autoExpandColumns&&R>0&&(I=Bt(I,{autoExpandColumns:!0,containerWidth:R,pinnedLeftWidth:H,pinnedRightWidth:k,mainBodyRef:null!==(n=t.mainBodyRef)&&void 0!==n?n:{current:null},isResizing:null!==(i=t.isResizing)&&void 0!==i&&i,collapsedHeaders:t.collapsedHeaders}));let T=t.localRows;t.sortManager?T=t.sortManager.getSortedRows():t.filterManager&&(T=t.filterManager.getFilteredRows()),this.lastRowsRef!==T&&(this.invalidateCache("body"),this.invalidateCache("context"),this.lastRowsRef=T);const E=t.internalIsLoading,A=null===(o=t.sortManager)||void 0===o?void 0:o.getState(),O=null===(s=t.filterManager)||void 0===s?void 0:s.getState(),W=(null==A?void 0:A.sort)?`${A.sort.key.accessor}-${A.sort.direction}`:"none",P=JSON.stringify((null==O?void 0:O.filters)||{}),$=t.config.quickFilter,F=$?`${null!==(r=$.text)&&void 0!==r?r:""}|${null!==(l=$.mode)&&void 0!==l?l:"simple"}`:"",L=this.flattenedRowsCache&&this.flattenedRowsCache.deps.rowsRef===T&&this.flattenedRowsCache.deps.isLoading===E&&this.flattenedRowsCache.deps.quickFilterKey===F&&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===W&&this.flattenedRowsCache.deps.filterKey===P;let D,j,B;if(L&&this.flattenedRowsCache)D=this.flattenedRowsCache.aggregatedRows,j=this.flattenedRowsCache.quickFilteredRows,B=this.flattenedRowsCache.flattenResult;else{D=t.sortManager?T:Xt({rows:T,headers:t.headers,rowGrouping:t.config.rowGrouping}),j=(({rows:t,headers:e,quickFilter:n})=>{if(!n||!n.text||""===n.text.trim())return t;const{text:i,columns:o,caseSensitive:s=!1,mode:r="simple",useFormattedValue:l=!0}=n,a=e.filter(t=>!Z(t)&&(o&&o.length>0?o.includes(t.accessor):!1!==t.quickFilterable)),d="smart"===r?(t=>{const e=[];let n=0;for(;t.length>n;){for(;t.length>n&&/\s/.test(t[n]);)n++;if(n>=t.length)break;if("-"===t[n]){n++;const i=n;for(;t.length>n&&!/\s/.test(t[n]);)n++;const o=t.substring(i,n);o&&e.push({type:"negation",value:o});continue}if('"'===t[n]){n++;const i=n;for(;t.length>n&&'"'!==t[n];)n++;const o=t.substring(i,n);o&&e.push({type:"phrase",value:o}),t.length>n&&'"'===t[n]&&n++;continue}const i=n;for(;t.length>n&&!/[\s:]/.test(t[n]);)n++;const o=t.substring(i,n);if(t.length>n&&":"===t[n]){n++;const i=n;for(;t.length>n&&!/\s/.test(t[n]);)n++;const s=t.substring(i,n);s&&e.push({type:"columnSpecific",value:s,column:o});continue}o&&e.push({type:"word",value:o})}return e})(i):null;return t.filter(t=>{if("smart"===r&&d){const e=new Set,n=new Map;d.forEach((t,e)=>{"columnSpecific"===t.type&&t.column&&(n.has(t.column)||n.set(t.column,[]),n.get(t.column).push(e))});const i=[];a.forEach(o=>{try{let r;if(o.quickFilterGetter)r=o.quickFilterGetter({row:t,accessor:o.accessor});else{const e=ct(t,o.accessor);if(l&&o.valueFormatter){const n=o.valueFormatter({accessor:o.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+""}i.push(r);const a=n.get(o.accessor);a&&a.forEach(t=>{const n=d[t],i=s?r:r.toLowerCase(),o=s?n.value:n.value.toLowerCase();i.includes(o)&&e.add(t)})}catch(t){console.warn(`Quick filter error for column ${o.accessor}:`,t)}});const o=s?i.join(" "):i.join(" ").toLowerCase();return d.forEach((t,n)=>{if("columnSpecific"===t.type)return;const i=s?t.value:t.value.toLowerCase();switch(t.type){case"word":case"phrase":o.includes(i)&&e.add(n);break;case"negation":o.includes(i)||e.add(n)}}),e.size===d.length}return a.some(e=>{try{let n;if(e.quickFilterGetter)n=e.quickFilterGetter({row:t,accessor:e.accessor});else{const i=ct(t,e.accessor);if(l&&e.valueFormatter){const o=e.valueFormatter({accessor:e.accessor,colIndex:0,row:t,rowIndex:0,value:i});n=Array.isArray(o)?o.join(" "):o+""}else n=null==i?"":Array.isArray(i)?i.join(" "):i+""}return((t,e,n)=>{if(!e)return!0;const i=n?t:t.toLowerCase(),o=n?e:e.toLowerCase();return i.includes(o)})(n,i,s)}catch(t){return console.warn(`Quick filter error for column ${e.accessor}:`,t),!1}})})})({rows:D,headers:I,quickFilter:t.config.quickFilter});let n=j,i=!1;if(E){let o=t.config.enablePagination&&null!==(a=t.config.rowsPerPage)&&void 0!==a?a:10;e.isMainSectionScrollable&&(o+=1);const s=Array.from({length:o},()=>(()=>{const t={};return st.add(t),t})());n=0===n.length?s:[...n,...s],i=!0}B=to({rows:n,rowGrouping:t.config.rowGrouping,getRowId:i?lt(t.config.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:I,rowHeight:t.customTheme.rowHeight,headerHeight:t.customTheme.headerHeight,customTheme:t.customTheme}),this.flattenedRowsCache={aggregatedRows:D,quickFilteredRows:j,flattenResult:B,deps:{rowsRef:T,isLoading:E,quickFilterKey:F,expandedRowsSize:t.expandedRows.size,collapsedRowsSize:t.collapsedRows.size,expandedDepthsSize:t.expandedDepths.size,rowStateMapSize:t.rowStateMap.size,sortKey:W,filterKey:P}}}const z=!1===t.config.enableVirtualization?void 0:(({height:t,maxHeight:e,rowHeight:n,totalRowCount:i,headerHeight:o,footerHeight:s,externalViewportHeight:r})=>{if(e){const t=qt(e);if(0===t)return;const r=o||n;if(t>=r+i*n+(s||0))return;return Math.max(0,t-r)}if(void 0!==r&&r>0)return Math.max(0,r-(o||n));if(!t)return;const l=qt(t);return 0!==l?Math.max(0,l-n):void 0})({height:t.config.height,maxHeight:t.config.maxHeight,rowHeight:t.customTheme.rowHeight,enablePagination:null!==(d=t.config.enablePagination)&&void 0!==d&&d,rowsPerPage:null!==(c=t.config.rowsPerPage)&&void 0!==c?c:10,totalRowCount:null!==(h=t.config.totalRowCount)&&void 0!==h?h:B.paginatableRows.length,headerHeight:S,footerHeight:!t.config.enablePagination&&!t.config.footerRenderer||t.config.hideFooter?void 0:t.customTheme.footerHeight,externalViewportHeight:t.externalViewportHeight}),V=null!==(u=t.config.enablePagination)&&void 0!==u&&u,q=null!==(f=t.config.rowsPerPage)&&void 0!==f?f:10,G=null!==(v=t.config.serverSidePagination)&&void 0!==v&&v,K=null!==(p=t.config.totalRowCount)&&void 0!==p?p:B.paginatableRows.length,_=null!==(m=null===(w=t.config.rowGrouping)||void 0===w?void 0:w.join("\0"))&&void 0!==m?m:"",U=null!==(b=null===(g=B.heightOffsets)||void 0===g?void 0:g.length)&&void 0!==b?b:0;let J=0;if(B.heightOffsets)for(const[,t]of B.heightOffsets)J+=t;const Y=null!==(x=t.config.enableStickyParents)&&void 0!==x&&x,X=void 0===z?"":`${L?1:0}|${z}|${e.currentPage}|${q}|${V}|${G}|${t.customTheme.rowHeight}|${S}|${K}|${Y}|${_}|${B.flattenedRows.length}|${U}|${J}`;let Q;return t.positionOnlyBody&&void 0!==z&&null!==this.processRowsScrollReuseKey&&null!==this.processRowsScrollReuseBase&&this.processRowsScrollReuseKey===X&&this.processRowsScrollReuseBase?Q=function(t,e){const{contentHeight:n,rowHeight:i,scrollDirection:o="none",scrollTop:s,enableStickyParents:r,rowGrouping:l}=e,a=N(i),{currentTableRows:d,paginatedHeightOffsets:c,heightMap:h}=t;let u,f,v,p,w=0,m=d.length;if(void 0===n)u=d,f=[],v=u,p=[];else{const t=Ie({bufferRowCount:a,contentHeight:n,tableRows:d,rowHeight:i,scrollTop:s,scrollDirection:o,heightMap:h});if(u=t.rendered.rows,w=t.rendered.startIndex,m=t.rendered.endIndex,r)if(l){const e=Oe(d,t.rendered.rows,t.fullyVisible.rows,t.partiallyVisible.rows,l);f=e.stickyParents,v=e.regularRows,p=t.partiallyVisible.rows}else f=[],v=t.rendered.rows,p=[];else f=[],v=u,p=[]}return{currentTableRows:d,rowsToRender:u,renderedStartIndex:w,renderedEndIndex:m,stickyParents:f,regularRows:v,partiallyVisibleRows:p,paginatedHeightOffsets:c,heightMap:h,allFlattenedRows:t.allFlattenedRows,pageStartIndex:t.pageStartIndex}}(this.processRowsScrollReuseBase,{contentHeight:z,rowHeight:t.customTheme.rowHeight,scrollTop:e.scrollTop,scrollDirection:e.scrollDirection,enableStickyParents:Y,rowGrouping:t.config.rowGrouping}):(Q=function(t){var e;const{contentHeight:n,currentPage:i,customTheme:o,enableStickyParents:s,flattenedRows:r,heightOffsets:l,parentEndPositions:a,rowHeight:d,rowsPerPage:c,scrollDirection:h="none",scrollTop:u,serverSidePagination:f,enablePagination:v,rowGrouping:p}=t,w=N(d),m=function(t,e,n,i,o,s){if(!o||s)return t.map((t,e)=>Object.assign(Object.assign({},t),{position:e,absoluteRowIndex:e}));const r=(n-1)*i,l=n*i,a=0===r?0:e[r-1];return t.slice(a,l>e.length?t.length:e[l-1]).map((t,e)=>{const n=t.nestedTable?t.absoluteRowIndex:o&&!s?a+e:e;return Object.assign(Object.assign({},t),{position:e,absoluteRowIndex:n})})}(r,a,i,c,v,f);let g=0;if(v&&!f){const t=(i-1)*c;g=0===t?0:null!==(e=a[t-1])&&void 0!==e?e:0}const b=l&&0!==l.length&&v&&!f?(()=>{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,x=b&&b.length>0?((t,e,n,i)=>{const o=e+i.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+=o;const t=r.get(e);void 0!==t&&(l+=t)}return{rowTopPositions:s,totalHeight:l-i.rowSeparatorWidth}})(m.length,d,b,o):void 0;let y,R,S,C,M=0,I=m.length;if(void 0===n)y=m,R=[],S=y,C=[];else{const t=Ie({bufferRowCount:w,contentHeight:n,tableRows:m,rowHeight:d,scrollTop:u,scrollDirection:h,heightMap:x});if(y=t.rendered.rows,M=t.rendered.startIndex,I=t.rendered.endIndex,s)if(p){const e=Oe(m,t.rendered.rows,t.fullyVisible.rows,t.partiallyVisible.rows,p);R=e.stickyParents,S=e.regularRows,C=t.partiallyVisible.rows}else R=[],S=t.rendered.rows,C=[];else R=[],S=y,C=[]}return{currentTableRows:m,rowsToRender:y,renderedStartIndex:M,renderedEndIndex:I,stickyParents:R,regularRows:S,partiallyVisibleRows:C,paginatedHeightOffsets:b,heightMap:x,allFlattenedRows:r,pageStartIndex:g}}({flattenedRows:B.flattenedRows,paginatableRows:B.paginatableRows,parentEndPositions:B.parentEndPositions,currentPage:e.currentPage,rowsPerPage:q,enablePagination:V,serverSidePagination:G,contentHeight:z,rowHeight:t.customTheme.rowHeight,scrollTop:e.scrollTop,scrollDirection:e.scrollDirection,heightOffsets:B.heightOffsets,customTheme:t.customTheme,enableStickyParents:Y,rowGrouping:t.config.rowGrouping}),void 0!==z?(this.processRowsScrollReuseKey=X,this.processRowsScrollReuseBase={currentTableRows:Q.currentTableRows,paginatedHeightOffsets:Q.paginatedHeightOffsets,heightMap:Q.heightMap,allFlattenedRows:Q.allFlattenedRows,pageStartIndex:Q.pageStartIndex}):(this.processRowsScrollReuseKey=null,this.processRowsScrollReuseBase=null)),{dimensionState:y,containerWidth:R,effectiveHeaders:I,calculatedHeaderHeight:S,maxHeaderDepth:C,flattenResult:B,processedResult:Q}}render(t,e,n,i,o){var s,r,l,a,d,c,h,u,f;const v=null!==(c=null!==(l=null===(r=null===(s=n.mainBodyRef)||void 0===s?void 0:s.current)||void 0===r?void 0:r.scrollLeft)&&void 0!==l?l:null===(d=null===(a=n.mainHeaderRef)||void 0===a?void 0:a.current)||void 0===d?void 0:d.scrollLeft)&&void 0!==c?c:0,p=this.buildRowModelSnapshot(n,i);if(!p)return;const{dimensionState:w,containerWidth:m,effectiveHeaders:g,calculatedHeaderHeight:b,maxHeaderDepth:x,flattenResult:y,processedResult:R}=p;this.lastProcessedResult=R;const S=!0===n.positionOnlyBody;if(S&&null!==this.lastScrollRafPaintedRange&&R.renderedStartIndex===this.lastScrollRafPaintedRange.start&&R.renderedEndIndex===this.lastScrollRafPaintedRange.end)return;null===(h=n.rowSelectionManager)||void 0===h||h.updateConfig({tableRows:R.currentTableRows});const{mainWidth:C,leftWidth:M,rightWidth:I,leftContentWidth:H,rightContentWidth:k}=wi({headers:g,containerWidth:m,collapsedHeaders:n.collapsedHeaders}),T=m-M-I;if(!S){const e=t=>"number"==typeof t?t+"px":t,s=t.rootElement.style;if(n.config.maxHeight){const t=e(n.config.maxHeight);s.maxHeight=t,s.height=void 0===w.contentHeight?"auto":t}else s.removeProperty("max-height"),n.config.height?s.height=e(n.config.height):s.removeProperty("height");t.rootElement.classList.toggle("st-external-scroll",void 0!==n.externalViewportHeight);const{customTheme:r}=n;s.setProperty("--st-main-section-width",T+"px"),s.setProperty("--st-scrollbar-width",i.scrollbarWidth+"px");const l=z(n.config.enableColumnEditor,o.showToggle);s.setProperty("--st-editor-width",l+"px"),s.setProperty("--st-border-width",r.borderWidth+"px"),s.setProperty("--st-footer-height",r.footerHeight+"px"),s.setProperty("--st-calculated-header-height",b+"px");const a=null!==(u=n.config.columnResizing)&&void 0!==u&&u;t.content.className="st-content "+(a?"st-resizeable":"st-not-resizeable"),t.content.style.width=l>0?`calc(100% - ${l}px)`:"100%",this.renderHeader(t.headerContainer,b,x,g,n)}this.renderBody(t.bodyContainer,R,g,n,i),this.lastScrollRafPaintedRange=S?{start:R.renderedStartIndex,end:R.renderedEndIndex}:null,this.registerSectionPanes(n);const E=n.sectionScrollController;E&&(E.setSectionScrollLeft("main",v),null!=n.pinnedLeftRef.current&&E.setSectionScrollLeft("pinned-left",n.pinnedLeftRef.current.scrollLeft),null!=n.pinnedRightRef.current&&E.setSectionScrollLeft("pinned-right",n.pinnedRightRef.current.scrollLeft),E.restoreAll()),S||(this.renderFooter(t.footerContainer,null!==(f=n.config.totalRowCount)&&void 0!==f?f:y.paginatableRows.length,i.currentPage,g,n),this.renderColumnEditor(t.contentWrapper,i.columnEditorOpen,o,g,n),this.renderHorizontalScrollbar(t.wrapperContainer,C,M,I,H,k,e.tableBodyContainerRef.current,g,n))}renderHeader(t,e,n,i,o){if(o.config.hideHeader)return;const s=this.buildRendererDeps(i,o);this.tableRenderer.renderHeader(t,e,n,s)}renderBody(t,e,n,i,o){const s=this.buildRendererDeps(n,i,o);this.tableRenderer.renderBody(t,e,s)}renderFooter(t,e,n,i,o){const s=this.buildRendererDeps(i,o);this.tableRenderer.renderFooter(t,e,n,t=>{o.setCurrentPage(t),o.onRender()},s)}renderColumnEditor(t,e,n,i,o){const s=this.buildRendererDeps(i,o);this.tableRenderer.renderColumnEditor(t,e,t=>{o.setColumnEditorOpen(t),o.onRender()},n,s)}renderHorizontalScrollbar(t,e,n,i,o,s,r,l,a){if(!a.mainBodyRef.current&&!a.mainHeaderRef.current||!r)return;const d=this.buildRendererDeps(l,a);this.tableRenderer.renderHorizontalScrollbar(t,e,n,i,o,s,r,d)}registerSectionPanes(t){const e=t.sectionScrollController;e&&(t.pinnedLeftHeaderRef.current&&e.registerPane("pinned-left",t.pinnedLeftHeaderRef.current,"header"),t.pinnedLeftRef.current&&e.registerPane("pinned-left",t.pinnedLeftRef.current,"body"),t.mainHeaderRef.current&&e.registerPane("main",t.mainHeaderRef.current,"header"),t.mainBodyRef.current&&e.registerPane("main",t.mainBodyRef.current,"body"),t.pinnedRightHeaderRef.current&&e.registerPane("pinned-right",t.pinnedRightHeaderRef.current,"header"),t.pinnedRightRef.current&&e.registerPane("pinned-right",t.pinnedRightRef.current,"body"))}buildRendererDeps(t,e,n){return{accordionAxis:e.accordionAxis,externalScrollActive:void 0!==e.externalViewportHeight,stickyParentsScrollTop:null==n?void 0:n.scrollTop,animationCoordinator:e.animationCoordinator,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,hoverScopeId:e.hoverScopeId,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,createNestedTable:e.createNestedTable,onRender:e.onRender,getShrinkFloors:e.getShrinkFloors,onAutoExpandNaturalWidths:e.onAutoExpandNaturalWidths,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,getPristineDefaultHeaders:e.getPristineDefaultHeaders,getRowStateMap:e.getRowStateMap,positionOnlyBody:e.positionOnlyBody,essentialAccessors:e.essentialAccessors}}cleanup(){this.tableRenderer.cleanup()}}const no=t=>{if(null==t)return"";const e=t+"";return e.includes(",")||e.includes('"')||e.includes("\n")||e.includes("\r")?`"${e.replace(/"/g,'""')}"`:e};class io{static createAPI(t){const e=()=>{var e;return(null===(e=t.getCachedFlattenResult)||void 0===e?void 0:e.call(t))||to({rows:t.getPivotedRows(),rowGrouping:t.getEffectiveRowGrouping(),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,i=new Set;let o=!1,s=!1,r=null;const l=()=>{var e,s;if(o=!1,0===n.size)return void(i.size>0&&!(null===(e=t.hasAnimatingCells)||void 0===e?void 0:e.call(t))?a():i.size>0&&c());let r=!1;n.forEach((e,i)=>{var o,s;if(null===(o=t.isCellAnimating)||void 0===o?void 0:o.call(t,i))return void(r=!0);const l=null===(s=t.cellRegistry)||void 0===s?void 0:s.get(i);l&&l.updateContent(e),n.delete(i)}),r&&n.size>0&&c(),(null===(s=t.hasAnimatingCells)||void 0===s?void 0:s.call(t))?c():a()},a=()=>{null==r&&(r=setTimeout(()=>{r=null,(()=>{var e,n,o,s,r,l;if(null===(e=t.hasAnimatingCells)||void 0===e?void 0:e.call(t))return void c();const a=i;if(0===a.size)return;const d=null===(n=t.filterManager)||void 0===n?void 0:n.getFilters(),h=(d?Object.keys(d):[]).some(t=>a.has(t)),u=null===(o=t.sortManager)||void 0===o?void 0:o.getSortColumn(),f=!(!u||!a.has(u.key.accessor+"")),v=(null!==(l=null===(r=null===(s=t.config.quickFilter)||void 0===s?void 0:s.text)||void 0===r?void 0:r.trim())&&void 0!==l?l:"").length>0;if(!h&&!f&&!v)return void a.clear();a.clear();const p=()=>{var e,n,i;if(h&&t.filterManager&&t.filterManager.updateConfig({rows:t.localRows}),f&&t.sortManager){const i=null!==(n=null===(e=t.filterManager)||void 0===e?void 0:e.getFilteredRows())&&void 0!==n?n:t.localRows;t.sortManager.updateConfig({tableRows:i})}v&&(null===(i=t.invalidateRowsCache)||void 0===i||i.call(t),t.onRender())};t.runWithoutAnimationSnapshot?t.runWithoutAnimationSnapshot(p):p()})()},400))},d=()=>{o||(o=!0,queueMicrotask(l))},c=()=>{s||(s=!0,setTimeout(()=>{s=!1,(n.size>0||i.size>0)&&d()},120))};let h=null,u=null;return{updateData:e=>{var o;const{accessor:s,newValue:r}=e,l=(e=>null!=e.rowId&&""!==e.rowId?(()=>{const e=t.localRows,n=t.config.getRowId;if(u&&u.rowsRef===e&&u.getRowId===n)return u.map;const i=new Map;for(let t=0;e.length>t;t++){const o=e[t];if(!n)continue;const s=n({row:o,depth:0,index:t,rowPath:[t],rowIndexPath:[t]});null!=s&&""!==s&&i.set(s+"",t)}return u={rowsRef:e,getRowId:n,map:i},i})().get(e.rowId+""):"number"==typeof e.rowIndex?e.rowIndex:void 0)(e);if(void 0===l||0>l||l>=t.localRows.length)return;const a=t.localRows[l];ut(a,s,r);const c=(e=>{var n;const i=null===(n=t.getCachedProcessedResult)||void 0===n?void 0:n.call(t),o=null==i?void 0:i.rowsToRender;if(o&&0!==o.length){if(!h||h.rowsRef!==o){const t=new WeakMap;for(const e of o)e.row&&t.set(e.row,e);h={rowsRef:o,map:t}}return h.map.get(e)}})(a),f=c?null!==(o=c.stableRowKey)&&void 0!==o?o:pt(c.rowId):gt({getRowId:t.config.getRowId,row:a,depth:0,index:l,rowPath:[l],rowIndexPath:[l]}),v=ot({accessor:s,rowId:f});n.set(v,r),i.add(s+""),d()},setHeaderRename:e=>{const n=t.headerRegistry.get(e.accessor);n&&n.setEditing(!0)},getVisibleRows:()=>{var n;const i=null===(n=t.getCachedProcessedResult)||void 0===n?void 0:n.call(t);return i?i.rowsToRender:e().flattenedRows},getAllRows:()=>e().flattenedRows,getHeaders:()=>t.effectiveHeaders,exportToCSV:n=>{var i;((t,e,n,i=!0)=>{((t,e="table-export.csv")=>{const n=new Blob([t],{type:"text/csv;charset=utf-8;"}),i=document.createElement("a"),o=URL.createObjectURL(n);i.setAttribute("href",o),i.setAttribute("download",e),i.style.visibility="hidden",document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)})(((t,e,n=!0)=>{const i=(t=>{const e=[],n=t=>{for(const i of t)i.hide||i.isSelectionColumn||i.excludeFromCsv||(i.children&&i.children.length>0?(i.singleRowChildren&&e.push(i),n(i.children)):e.push(i))};return n(t),e})(e),o=i.map(t=>no(t.label)).join(","),s=t.map((t,e)=>{const n=t.row;return i.map((t,i)=>{const o=ct(n,t.accessor);if(t.exportValueGetter){const s=t.valueFormatter?t.valueFormatter({accessor:t.accessor,colIndex:i,row:n,rowIndex:e,value:o}):void 0,r=t.exportValueGetter({accessor:t.accessor,colIndex:i,row:n,rowIndex:e,value:o,formattedValue:s});return no(r)}if(!1!==t.useFormattedValueForCSV&&t.valueFormatter){const s=t.valueFormatter({accessor:t.accessor,colIndex:i,row:n,rowIndex:e,value:o});return no(s)}return no(o)}).join(",")});return(n?[o,...s]:s).join("\n")})(t,e,i),n)})(e().flattenedRows,t.effectiveHeaders,null==n?void 0:n.filename,null===(i=t.config.includeHeadersInCSVExport)||void 0===i||i)},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:()=>Nn(t.headers),applyPinnedState:async e=>{const n=zn(t.headers,e,t.essentialAccessors);n&&(t.setHeaders(n),t.onRender())},resetColumns:()=>{const e=t.getPivot()?En(t.getPivotHeaders()):En(t.getPristineDefaultHeaders());t.setHeaders(e),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,i;const o=null!==(n=t.config.totalRowCount)&&void 0!==n?n:e().paginatableRows.length;return Math.ceil(o/(null!==(i=t.config.rowsPerPage)&&void 0!==i?i:10))},setPage:async n=>{var i,o;const s=null!==(i=t.config.totalRowCount)&&void 0!==i?i:e().paginatableRows.length,r=null!==(o=t.config.rowsPerPage)&&void 0!==o?o:10;1>n||n>Math.ceil(s/r)||(t.setCurrentPage(n),t.onRender(),t.config.onPageChange&&await t.config.onPageChange(n))},expandAll:()=>{var e;t.clearExpandedRows(),t.clearCollapsedRows(),null===(e=t.expandedDepthsManager)||void 0===e||e.expandAll()},collapseAll:()=>{var e;t.clearExpandedRows(),t.clearCollapsedRows(),null===(e=t.expandedDepthsManager)||void 0===e||e.collapseAll()},expandDepth:e=>{var n;t.clearExpandedRows(),t.clearCollapsedRows(),null===(n=t.expandedDepthsManager)||void 0===n||n.expandDepth(e)},collapseDepth:e=>{var n;t.clearExpandedRows(),t.clearCollapsedRows(),null===(n=t.expandedDepthsManager)||void 0===n||n.collapseDepth(e)},toggleDepth:e=>{var n;t.clearExpandedRows(),t.clearCollapsedRows(),null===(n=t.expandedDepthsManager)||void 0===n||n.toggleDepth(e)},setExpandedDepths:e=>{var n,i;t.clearExpandedRows(),t.clearCollapsedRows();const o=t.expandedDepthsManager;if(o){const s=null!==(i=null===(n=t.getEffectiveRowGrouping())||void 0===n?void 0:n.length)&&void 0!==i?i:0,r=0===s?new Set:new Set([...e].filter(t=>Number.isInteger(t)&&t>=0&&s>t));return void o.setExpandedDepths(r)}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.getEffectiveRowGrouping())||void 0===n?void 0:n[e]},getGroupingDepth:e=>{var n,i;return null!==(i=null===(n=t.getEffectiveRowGrouping())||void 0===n?void 0:n.indexOf(e))&&void 0!==i?i:-1},setPivot:e=>{t.setPivot(e)},getPivot:()=>t.getPivot(),getPivotHeaders:()=>t.getPivotHeaders(),getPivotedRows:()=>t.getPivotedRows(),toggleColumnEditor:e=>{t.config.enableColumnEditor&&(t.setColumnEditorOpen(void 0!==e?e:!t.columnEditorOpen),t.onRender())},applyColumnVisibility:async e=>{const n=i=>i.map(i=>{const o=i.accessor+"";let s=o in e?!e[o]:i.hide;return Fn(i,t.essentialAccessors)&&(s=!1),Object.assign(Object.assign({},i),{hide:s,children:i.children?n(i.children):i.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 i;null===(i=t.selectionManager)||void 0===i||i.selectCellRange(e,n)},getSelectedRows:()=>{var e,n;return null!==(n=null===(e=t.rowSelectionManager)||void 0===e?void 0:e.getSelectedRows())&&void 0!==n?n:new Set},getSelectedRowsData:()=>{var e,n;return null!==(n=null===(e=t.rowSelectionManager)||void 0===e?void 0:e.getSelectedRowsData())&&void 0!==n?n:[]},getRow:e=>{var n,i;const o=e+"",s=null===(n=t.rowSelectionManager)||void 0===n?void 0:n.getRow(o);if(void 0!==s)return s;const r=null===(i=t.getCachedProcessedResult)||void 0===i?void 0:i.call(t);if(r){const t=r.currentTableRows.find(t=>null!=(null==t?void 0:t.rowId)&&pt(t.rowId)===o);if(t)return t.row}},selectRow:e=>{var n;null===(n=t.rowSelectionManager)||void 0===n||n.selectRow(e+"")},deselectRow:e=>{var n;null===(n=t.rowSelectionManager)||void 0===n||n.deselectRow(e+"")},toggleRowSelection:e=>{var n;null===(n=t.rowSelectionManager)||void 0===n||n.handleToggleRow(e+"")},clearRowSelection:()=>{var e;null===(e=t.rowSelectionManager)||void 0===e||e.clearSelection()}}}}const oo=t=>{if(!t)return null;if("undefined"!=typeof Window&&t instanceof Window){const e=t.innerHeight;return{top:0,bottom:e,height:e,width:t.innerWidth}}const e=t.getBoundingClientRect();return{top:e.top,bottom:e.bottom,height:e.height,width:e.width}},so=()=>"undefined"!=typeof window&&window.innerHeight>0?window.innerHeight:1/0,ro=(t,e)=>{if(!t||!e)return null;const n=oo(t);if(!n)return null;const i=e.getBoundingClientRect(),o=i.height;if(0>=o)return{relativeScrollTop:0,visibleViewportHeight:0,distanceFromTableBottom:1/0,tableTotalHeight:0,viewportWidth:n.width};const s=Math.max(n.top,i.top),r=Math.min(Math.max(0,Math.min(n.bottom,i.bottom)-s),so());return{relativeScrollTop:Math.max(0,Math.min(n.top-i.top,Math.max(0,o-r))),visibleViewportHeight:r,distanceFromTableBottom:i.bottom-n.bottom,tableTotalHeight:o,viewportWidth:n.width}};class lo{constructor(t,e){var n,i,s;this.draggedHeaderRef={current:null},this.hoveredHeaderRef={current:null},this.localRows=[],this.headers=[],this.pristineDefaultHeaders=[],this.essentialAccessors=new Set,this.autoSizeAccessors=new Set,this.pendingAutoSize=new Set,this.naturalWidths=new Map,this.isAutoSizing=!1,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.hoverScopeId="st-hover-"+ ++lo.nextHoverScopeId,this.headerRegistry=new Map,this.rowIndexMap=new Map,this.suppressNextAnimationSnapshot=!1,this.cachedAPI=null,this.autoScaleManager=null,this.dimensionManager=null,this.scrollManager=null,this.sectionScrollController=null,this.sortManager=null,this.filterManager=null,this.pivotManager=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.hasWarnedUnvirtualizedRows=!1,this.unvirtualizedRowsCheckTimeoutId=null,this.resolvedScrollParent=null,this.externalScrollListener=null,this.externalWindowResizeListener=null,this.externalParentResizeObserver=null,this.externalViewportHeight=0,this.externalScrollRetryRaf=null,this.externalScrollRetryCount=0,this.bodyScrollListenerAttached=!1,this.bodyContainerMouseLeaveListener=null,this.bodyContainerScrollListener=null,this.overscrollBehaviorTarget=null,this.overscrollBehaviorPrev="",this.pendingAccordionAxis=null,this.accordionCleanupTimerId=null,this.lastRenderedVisibilityKey=null,this.container=t,this.config=o(e);const r=this.config;this.customTheme=qn.mergeCustomTheme(r),this.mergedColumnEditorConfig=qn.mergeColumnEditorConfig(r),this.resolvedIcons=qn.resolveIcons(r),this.localRows=[...r.rows],this.headers=[...r.columns],this.pristineDefaultHeaders=En(r.columns),this.columnEditorOpen=null!==(n=r.enableColumnEditorInitOpen)&&void 0!==n&&n,this.internalIsLoading=null!==(i=r.isLoading)&&void 0!==i&&i,this.pivotManager=new Se({sourceRows:this.localRows,fieldHeaders:this.pristineDefaultHeaders,pivot:null!==(s=r.pivot)&&void 0!==s?s:null});const l=this.pivotManager.getState();l.active&&(this.headers=l.headers),this.essentialAccessors=qn.buildEssentialAccessors(this.headers),this.collapsedHeaders=qn.getInitialCollapsedHeaders(this.headers),this.expandedDepths=qn.getInitialExpandedDepths(Object.assign(Object.assign({},r),{rowGrouping:this.getEffectiveRowGrouping()})),this.autoSizeAccessors=this.computeAutoSizeAccessors(),this.pendingAutoSize=new Set(this.autoSizeAccessors),this.domManager=new Gn,this.renderOrchestrator=new eo,this.animationCoordinator=new W,this.applyAnimationsConfig(e.animations),this.animationCoordinator.setOnHostDiscard(e.onRendererHostDiscard),this.renderOrchestrator.setOnRendererHostDiscard(e.onRendererHostDiscard),this.rebuildRowIndexMap(),this.initializeManagers()}applyAnimationsConfig(t){var e;this.animationCoordinator.setEnabled(null===(e=null==t?void 0:t.enabled)||void 0===e||e),void 0!==(null==t?void 0:t.duration)&&this.animationCoordinator.setDuration(t.duration),void 0!==(null==t?void 0:t.easing)&&this.animationCoordinator.setEasing(t.easing)}rebuildRowIndexMap(){this.rowIndexMap.clear(),this.localRows.forEach((t,e)=>{const n=vt({row:t,getRowId:this.config.getRowId,depth:0,index:e,rowPath:[e],rowIndexPath:[e]}),i=pt(n);this.rowIndexMap.set(i,e)})}getBodyContainers(){const t=this.domManager.getRefs();return[t.mainBodyRef.current,t.pinnedLeftRef.current,t.pinnedRightRef.current].filter(t=>null!==t)}getHeaderContainers(){const t=this.domManager.getRefs();return[t.mainHeaderRef.current,t.pinnedLeftHeaderRef.current,t.pinnedRightHeaderRef.current].filter(t=>null!==t)}getAnimatableContainers(){return[...this.getBodyContainers(),...this.getHeaderContainers()]}buildVisibilityKey(t){const e=[],n=(t,i)=>{var o,s;if(Z(t))return;const r=null!==(s=null!==(o=t.pinned)&&void 0!==o?o:i)&&void 0!==s?s:"main";if(t.children&&t.children.length>0)for(const e of t.children)n(e,r);else e.push(`${t.accessor+""}:${r}`)};for(const e of t)n(e,void 0);return e.join("|")}didColumnVisibilityChange(t){const e=this.buildVisibilityKey(t);return null!==this.lastRenderedVisibilityKey&&e!==this.lastRenderedVisibilityKey}captureAnimationSnapshot(){const t=this.animationCoordinator.isEnabled()?this.renderOrchestrator.getCurrentBodyLayouts():void 0;this.updateAnimationVerticalScroll(),this.animationCoordinator.captureSnapshot({containers:this.getAnimatableContainers(),preLayouts:t})}updateAnimationVerticalScroll(){var t,e;if(!this.resolvedScrollParent)return void this.animationCoordinator.setExternalVerticalScroll(null);const n=null!==(e=null===(t=this.domManager.getElements())||void 0===t?void 0:t.rootElement)&&void 0!==e?e:this.container,i=ro(this.resolvedScrollParent,n);this.animationCoordinator.setExternalVerticalScroll(i&&i.visibleViewportHeight>0&&i.tableTotalHeight>0?{clientHeight:i.visibleViewportHeight,scrollHeight:i.tableTotalHeight,scrollTop:i.relativeScrollTop}:null)}collectAccordionRenderableAccessors(){const e=new Set,n=i=>{if(Z(i))return;if(e.add(i.accessor+""),!i.children||0===i.children.length)return;const o=this.collapsedHeaders.has(i.accessor);for(const e of i.children){const i=e.showWhen||t;(o?"parentCollapsed"===i||"always"===i:"parentExpanded"===i||"always"===i)&&n(e)}};for(const t of this.headers)n(t);return e}beginAccordionAnimation(t){var e,n,i,o;if(!this.animationCoordinator.isEnabled())return;if(null===t)return;if("vertical"===t&&(null!==(n=null===(e=this.getEffectiveRowGrouping())||void 0===e?void 0:e.length)&&void 0!==n?n:0)>0)return;this.captureAnimationSnapshot(),this.animationCoordinator.setAccordionPreVisibleAccessors("horizontal"===t?this.collectAccordionRenderableAccessors():null),this.pendingAccordionAxis=t;const s=this.animationCoordinator.getDuration(),r=this.animationCoordinator.getEasing(),l=null!==(o=null===(i=this.domManager.getElements())||void 0===i?void 0:i.rootElement)&&void 0!==o?o:this.container;l.style.setProperty(Wn,s+"ms"),l.style.setProperty(Pn,r),l.classList.add(On),null!==this.accordionCleanupTimerId&&window.clearTimeout(this.accordionCleanupTimerId),this.accordionCleanupTimerId=window.setTimeout(()=>{l.classList.remove(On),l.style.removeProperty(Wn),l.style.removeProperty(Pn),this.accordionCleanupTimerId=null},s+80)}initializeManagers(){var t,e,n,i;this.ariaAnnouncementManager=new Ue,this.ariaAnnouncementManager.subscribe(t=>{this.announcement=t,this.updateAriaLiveRegion()}),this.expandedDepthsManager=new _e(null===(t=this.config.expandAll)||void 0===t||t,this.getEffectiveRowGrouping()),this.expandedDepthsManager.subscribe(t=>{this.beginAccordionAnimation("vertical"),this.expandedDepths=t,this.render("expandedDepthsManager")});const o=t=>{this.ariaAnnouncementManager&&this.ariaAnnouncementManager.announce(t)},s=null===(e=this.pivotManager)||void 0===e?void 0:e.getState();this.sortManager=new Qt({headers:this.headers,tableRows:(null==s?void 0:s.active)?s.pivotedRows:this.localRows,externalSortHandling:this.config.externalSortHandling||!1,onSortChange:t=>{var e,n;return null===(n=(e=this.config).onSortChange)||void 0===n?void 0:n.call(e,t)},rowGrouping:(null==s?void 0:s.active)?s.rowGrouping:this.config.rowGrouping,initialSortColumn:this.config.initialSortColumn,initialSortDirection:this.config.initialSortDirection,announce:o}),this.sortManager.subscribe(()=>{this.suppressNextAnimationSnapshot?this.render("live-sort"):(this.captureAnimationSnapshot(),this.render("sortManager"))}),this.filterManager=new ne({rows:this.localRows,headers:this.pristineDefaultHeaders,externalFilterHandling:this.config.externalFilterHandling||!1,onFilterChange:t=>{var e,n;return null===(n=(e=this.config).onFilterChange)||void 0===n?void 0:n.call(e,t)},announce:o}),this.filterManager.subscribe(t=>{this.syncPivotPipeline(t.filteredRows),this.render("filterManager")}),this.selectionManager=new je({selectableCells:null!==(n=this.config.selectableCells)&&void 0!==n&&n,selectableColumns:null!==(i=this.config.selectableColumns)&&void 0!==i&&i,headers:this.headers,tableRows:[],onCellEdit:t=>{var e,n;return null===(n=(e=this.config).onCellEdit)||void 0===n?void 0:n.call(e,t)},cellRegistry:this.cellRegistry,collapsedHeaders:this.collapsedHeaders,rowHeight:this.customTheme.rowHeight,enableRowSelection:Ne(this.config),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,e,n;const i=this.domManager.getRefs(),o=this.domManager.getElements();if(!i.tableBodyContainerRef.current||!o)return;this.scrollbarWidth=Je(i.tableBodyContainerRef.current);const s=this.renderOrchestrator.computeEffectiveHeaders(this.headers,this.config,this.customTheme);this.dimensionManager=new Gt({effectiveHeaders:s,headerHeight:this.customTheme.headerHeight,rowHeight:this.customTheme.rowHeight,height:this.config.height,maxHeight:this.config.maxHeight,totalRowCount:null!==(t=this.config.totalRowCount)&&void 0!==t?t:this.localRows.length,footerHeight:!this.config.enablePagination&&!this.config.footerRenderer||this.config.hideFooter?void 0:this.customTheme.footerHeight,containerElement:i.tableBodyContainerRef.current}),this.dimensionManager.subscribe(()=>{this.render("dimensionManager"),this.firstRenderDone||(this.firstRenderDone=!0,this.resolvedScrollParent&&"undefined"!=typeof requestAnimationFrame&&requestAnimationFrame(()=>{this.mounted&&this.recomputeExternalViewportHeight()}),this.config.onTableReady&&this.config.onTableReady())}),this.scrollManager=new Kt({onLoadMore:this.config.onLoadMore,infiniteScrollThreshold:null!==(e=this.config.infiniteScrollThreshold)&&void 0!==e?e:200});const r=t=>{var e;const n=this.domManager.getRefs().mainHeaderRef.current,i=this.selectionManager,o=i&&(this.config.selectableCells||this.config.selectableColumns)?{columnsWithSelectedCells:i.getColumnsWithSelectedCells(),selectedColumns:i.getSelectedColumns()}:void 0;null===(e=null==n?void 0:n.__renderHeaderCells)||void 0===e||e.call(n,t,o)};this.sectionScrollController=new _t({onMainSectionScrollLeft:t=>{var e;r(t);const n=this.domManager.getRefs().mainBodyRef.current;null===(e=null==n?void 0:n.__renderBodyCells)||void 0===e||e.call(n,t)}}),this.config.autoExpandColumns&&(this.autoScaleManager=new zt({autoExpandColumns:this.config.autoExpandColumns,containerWidth:this.dimensionManager.getState().containerWidth,pinnedLeftWidth:0,pinnedRightWidth:0,mainBodyRef:i.mainBodyRef,isResizing:this.isResizing,collapsedHeaders:this.collapsedHeaders},()=>{this.render("autoScaleManager")})),i.headerContainerRef.current&&i.tableBodyContainerRef.current&&(this.scrollbarVisibilityManager=new Ge({headerContainer:i.headerContainerRef.current,mainSection:i.tableBodyContainerRef.current,scrollbarWidth:this.scrollbarWidth}),this.scrollbarVisibilityManager.subscribe(t=>{this.isMainSectionScrollable=t,i.tableBodyContainerRef.current&&(this.scrollbarWidth=Je(i.tableBodyContainerRef.current)),this.render("scrollbarVisibilityManager")})),this.windowResizeManager=new Ve,this.windowResizeManager.addCallback(()=>{var t;if(i.tableBodyContainerRef.current){const e=Je(i.tableBodyContainerRef.current);this.scrollbarWidth=e,null===(t=this.scrollbarVisibilityManager)||void 0===t||t.setScrollbarWidth(e)}this.render("scrollbarWidth-change")}),this.syncRowSelectionManager(),this.selectionManager&&(this.handleOutsideClickManager=new qe({selectableColumns:null!==(n=this.config.selectableColumns)&&void 0!==n&&n,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)&&(this.bodyContainerMouseLeaveListener=()=>{this.clearHoveredRows()},t.bodyContainer.addEventListener("mouseleave",this.bodyContainerMouseLeaveListener),this.syncExternalScrollWiring())}syncExternalScrollWiring(){var t;const e=this.domManager.getElements();if(!(null==e?void 0:e.bodyContainer))return;const n=!(null==this.config.scrollParent||null!=this.config.height&&""!==this.config.height||null!=this.config.maxHeight&&""!==this.config.maxHeight),i=n?(t=>{if(null==t)return null;if("function"==typeof t)try{const e=t();return null!=e?e:null}catch(t){return null}return"window"===t?"undefined"!=typeof window?window:null:"undefined"!=typeof HTMLElement&&t instanceof HTMLElement||"function"==typeof t.addEventListener?t:null})(this.config.scrollParent):null;if(i!==this.resolvedScrollParent&&this.detachExternalScrollWiring(),i)this.externalScrollRetryCount=0,this.attachExternalScrollWiring(i),this.ensureBodyScrollListenerDetached(e.bodyContainer),this.recomputeExternalViewportHeight();else if(n){this.ensureBodyScrollListenerDetached(e.bodyContainer);const n="undefined"!=typeof window?window.innerHeight:0;n>0&&this.externalViewportHeight!==n&&(this.externalViewportHeight=n,null===(t=this.dimensionManager)||void 0===t||t.updateConfig({externalViewportHeight:n})),this.scheduleExternalScrollParentRetry()}else this.externalScrollRetryCount=0,this.ensureBodyScrollListenerAttached(e.bodyContainer),this.externalViewportHeight=0,this.dimensionManager&&this.dimensionManager.updateConfig({externalViewportHeight:void 0})}scheduleExternalScrollParentRetry(){null===this.externalScrollRetryRaf&&lo.EXTERNAL_SCROLL_MAX_RETRIES>this.externalScrollRetryCount&&"undefined"!=typeof requestAnimationFrame&&(this.externalScrollRetryRaf=requestAnimationFrame(()=>{this.externalScrollRetryRaf=null,this.mounted&&(this.externalScrollRetryCount++,this.syncExternalScrollWiring())}))}ensureBodyScrollListenerAttached(t){this.bodyScrollListenerAttached||(this.bodyContainerScrollListener=t=>this.handleScroll(t),t.addEventListener("scroll",this.bodyContainerScrollListener),this.bodyScrollListenerAttached=!0)}ensureBodyScrollListenerDetached(t){this.bodyScrollListenerAttached&&(this.bodyContainerScrollListener&&(t.removeEventListener("scroll",this.bodyContainerScrollListener),this.bodyContainerScrollListener=null),this.bodyScrollListenerAttached=!1)}attachExternalScrollWiring(t){if(!t)return;this.resolvedScrollParent=t;const e=t=>this.handleExternalScroll(t);if(this.externalScrollListener=e,t.addEventListener("scroll",e,{passive:!0}),"undefined"!=typeof Window&&t instanceof Window){const e=()=>this.handleExternalResize();this.externalWindowResizeListener=e,t.addEventListener("resize",e,{passive:!0})}else if("undefined"!=typeof ResizeObserver){const e=new ResizeObserver(()=>this.handleExternalResize());e.observe(t),this.externalParentResizeObserver=e}this.recomputeExternalScrollPaddingTop(),this.applyOverscrollContainment(t)}detachExternalScrollWiring(){const t=this.resolvedScrollParent;t&&this.externalScrollListener&&t.removeEventListener("scroll",this.externalScrollListener),this.externalScrollListener=null,t&&this.externalWindowResizeListener&&"undefined"!=typeof Window&&t instanceof Window&&t.removeEventListener("resize",this.externalWindowResizeListener),this.externalWindowResizeListener=null,this.externalParentResizeObserver&&(this.externalParentResizeObserver.disconnect(),this.externalParentResizeObserver=null),this.resolvedScrollParent=null;const e=this.domManager.getElements();e&&e.rootElement.style.removeProperty("--st-external-scroll-padding-top"),this.restoreOverscrollBehavior()}applyOverscrollContainment(t){const e="undefined"!=typeof Window&&t instanceof Window?"undefined"!=typeof document?document.documentElement:null:t;e&&(this.overscrollBehaviorTarget=e,this.overscrollBehaviorPrev=e.style.overscrollBehaviorY,e.style.overscrollBehaviorY="none")}restoreOverscrollBehavior(){this.overscrollBehaviorTarget&&(this.overscrollBehaviorTarget.style.overscrollBehaviorY=this.overscrollBehaviorPrev,this.overscrollBehaviorTarget=null,this.overscrollBehaviorPrev="")}recomputeExternalScrollPaddingTop(){const t=this.domManager.getElements();if(!t)return;const e=this.resolvedScrollParent;let n=0;if(e&&"undefined"!=typeof HTMLElement&&e instanceof HTMLElement){const t=getComputedStyle(e);n=parseFloat(t.paddingTop)||0}t.rootElement.style.setProperty("--st-external-scroll-padding-top",n+"px")}recomputeExternalViewportHeight(){var t;if(!this.resolvedScrollParent)return;const e=this.domManager.getElements(),n=null!==(t=null==e?void 0:e.rootElement)&&void 0!==t?t:this.container,i=ro(this.resolvedScrollParent,n);if(!i)return;let o=i.visibleViewportHeight;o>0||(o=(()=>{const t=oo(this.resolvedScrollParent);return t?Math.min(t.height,so()):0})()),o>0&&o!==this.externalViewportHeight&&(this.externalViewportHeight=o,this.dimensionManager&&this.dimensionManager.updateConfig({externalViewportHeight:o}))}handleExternalResize(){this.recomputeExternalViewportHeight(),this.recomputeExternalScrollPaddingTop(),this.render("external-scroll-resize")}handleExternalScroll(t){var e;const n=this.resolvedScrollParent;if(!n)return;const i=this.domManager.getElements(),o=null!==(e=null==i?void 0:i.rootElement)&&void 0!==e?e:this.container,s=ro(n,o);if(!s)return;const r=s.relativeScrollTop;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=r>this.lastScrollTop?"down":this.lastScrollTop>r?"up":"none";this.scrollTop=r,this.scrollDirection=t,this.lastScrollTop=r,s.visibleViewportHeight!==this.externalViewportHeight&&(this.externalViewportHeight=s.visibleViewportHeight,this.dimensionManager&&this.dimensionManager.updateConfig({externalViewportHeight:s.visibleViewportHeight})),this.scrollManager&&(this.config.onLoadMore?this.scrollManager.handleScroll(r,0,s.visibleViewportHeight,s.relativeScrollTop+s.visibleViewportHeight+Math.max(0,s.distanceFromTableBottom)):this.scrollManager.handleScroll(r,0,0,0)),this.render("scroll-raf"),this.scrollRafId=null})}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)}getEffectiveRowGrouping(){var t;const e=null===(t=this.pivotManager)||void 0===t?void 0:t.getState();return(null==e?void 0:e.active)?e.rowGrouping:this.config.rowGrouping}syncPivotPipeline(t){var e,n,i,o,s,r,l,a,d,c;if(!this.pivotManager)return;const h=null!==(n=null!=t?t:null===(e=this.filterManager)||void 0===e?void 0:e.getFilteredRows())&&void 0!==n?n:this.localRows,u=this.pivotManager.isActive();this.pivotManager.updateConfig({sourceRows:h,fieldHeaders:this.pristineDefaultHeaders,pivot:null!==(i=this.config.pivot)&&void 0!==i?i:null});const f=this.pivotManager.getState();if(f.active){if(this.headers=f.headers,this.essentialAccessors=qn.buildEssentialAccessors(this.headers),null===(o=this.sortManager)||void 0===o||o.updateConfig({tableRows:f.pivotedRows,headers:f.headers,rowGrouping:f.rowGrouping}),null===(s=this.selectionManager)||void 0===s||s.updateConfig({headers:f.headers}),u?null===(l=this.expandedDepthsManager)||void 0===l||l.updateRowGrouping(f.rowGrouping):(null===(r=this.expandedDepthsManager)||void 0===r||r.updateRowGrouping(f.rowGrouping),this.collapsedHeaders=qn.getInitialCollapsedHeaders(f.headers)),this.dimensionManager){const t=this.renderOrchestrator.computeEffectiveHeaders(this.headers,this.config,this.customTheme);this.dimensionManager.updateConfig({effectiveHeaders:t})}}else{if(u&&(this.headers=En(this.pristineDefaultHeaders),this.essentialAccessors=qn.buildEssentialAccessors(this.headers),this.collapsedHeaders=qn.getInitialCollapsedHeaders(this.headers),null===(a=this.expandedDepthsManager)||void 0===a||a.updateRowGrouping(this.config.rowGrouping),this.dimensionManager)){const t=this.renderOrchestrator.computeEffectiveHeaders(this.headers,this.config,this.customTheme);this.dimensionManager.updateConfig({effectiveHeaders:t})}null===(d=this.sortManager)||void 0===d||d.updateConfig({tableRows:h,headers:this.headers,rowGrouping:this.config.rowGrouping}),null===(c=this.selectionManager)||void 0===c||c.updateConfig({headers:this.headers})}}getRenderContext(){var t;const e=this.domManager.getRefs(),n=null===(t=this.pivotManager)||void 0===t?void 0:t.getState(),i=(null==n?void 0:n.active)?Object.assign(Object.assign({},this.config),{rowGrouping:n.rowGrouping}):this.config;return{accordionAxis:this.pendingAccordionAxis,config:i,customTheme:this.customTheme,resolvedIcons:this.resolvedIcons,effectiveHeaders:[],essentialAccessors:this.essentialAccessors,headers:this.headers,localRows:(null==n?void 0:n.active)?n.pivotedRows:this.localRows,collapsedHeaders:this.collapsedHeaders,collapsedRows:this.collapsedRows,expandedRows:this.expandedRows,expandedDepths:this.expandedDepths,isResizing:this.isResizing,internalIsLoading:this.internalIsLoading,createNestedTable:(t,e)=>new lo(t,e),cellRegistry:this.cellRegistry,hoverScopeId:this.hoverScopeId,headerRegistry:this.headerRegistry,draggedHeaderRef:this.draggedHeaderRef,hoveredHeaderRef:this.hoveredHeaderRef,mainBodyRef:e.mainBodyRef,pinnedLeftRef:e.pinnedLeftRef,pinnedRightRef:e.pinnedRightRef,mainHeaderRef:e.mainHeaderRef,pinnedLeftHeaderRef:e.pinnedLeftHeaderRef,pinnedRightHeaderRef:e.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,externalViewportHeight:this.externalViewportHeight>0?this.externalViewportHeight:void 0,onRender:()=>this.render("resizeHandler-onRender"),getShrinkFloors:()=>this.getShrinkFloors(),onAutoExpandNaturalWidths:t=>this.recordNaturalWidths(t),setIsResizing:t=>{var e,n,i,o,s,r,l,a;if(this.isResizing=t,this.autoScaleManager&&!1===t){const t=this.domManager.getRefs(),d=null!==(a=null!==(r=null!==(i=null===(n=null===(e=t.tableBodyContainerRef)||void 0===e?void 0:e.current)||void 0===n?void 0:n.clientWidth)&&void 0!==i?i:null===(s=null===(o=t.mainBodyRef)||void 0===o?void 0:o.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!==a?a:0;this.autoScaleManager.updateConfig({isResizing:!1,containerWidth:d})}},setHeaders:t=>{this.didColumnVisibilityChange(t)?this.beginAccordionAnimation("horizontal"):this.captureAnimationSnapshot(),this.headers=En(t),this.renderOrchestrator.invalidateCache("header")},animationCoordinator:this.animationCoordinator,setCollapsedHeaders:t=>{this.beginAccordionAnimation("horizontal"),this.collapsedHeaders=t},setCollapsedRows:t=>{this.beginAccordionAnimation("vertical"),this.collapsedRows="function"==typeof t?t(this.collapsedRows):t,this.render("expansion")},setExpandedRows:t=>{this.beginAccordionAnimation("vertical"),this.expandedRows="function"==typeof t?t(this.expandedRows):t,this.render("expansion")},setRowStateMap:t=>{this.beginAccordionAnimation("vertical"),this.rowStateMap="function"==typeof t?t(this.rowStateMap):t,this.render("rowStateMap")},getCollapsedRows:()=>this.collapsedRows,getCollapsedHeaders:()=>this.collapsedHeaders,getExpandedRows:()=>this.expandedRows,getHeaders:()=>this.headers,getPristineDefaultHeaders:()=>this.pristineDefaultHeaders,getRowStateMap:()=>this.rowStateMap,setColumnEditorOpen:t=>{this.columnEditorOpen=t},setCurrentPage:t=>{t!==this.currentPage&&this.config.enablePagination&&!this.config.serverSidePagination&&this.autoSizeAccessors.forEach(t=>this.pendingAutoSize.add(t)),this.currentPage=t}}}getRenderState(){return{currentPage:this.currentPage,scrollTop:this.scrollTop,scrollDirection:this.scrollDirection,scrollbarWidth:this.scrollbarWidth,isMainSectionScrollable:this.isMainSectionScrollable,columnEditorOpen:this.columnEditorOpen}}isAutoSizeLeaf(t){return!t.isSelectionColumn&&(t=>"string"==typeof t.width&&"auto"===t.width.trim().toLowerCase())(t)}computeAutoSizeAccessors(){const t=new Set,e=At(this.headers,this.collapsedHeaders);for(const n of e)this.isAutoSizeLeaf(n)&&t.add(n.accessor);return t}getAutoSizeStyleRoot(){var t,e,n,i,o,s,r,l;const a=this.domManager.getRefs(),d=null!==(s=null!==(i=null!==(e=null===(t=a.mainBodyRef)||void 0===t?void 0:t.current)&&void 0!==e?e:null===(n=a.mainHeaderRef)||void 0===n?void 0:n.current)&&void 0!==i?i:null===(o=a.pinnedLeftHeaderRef)||void 0===o?void 0:o.current)&&void 0!==s?s:null===(r=a.pinnedRightHeaderRef)||void 0===r?void 0:r.current;return d?null!==(l=d.closest(".simple-table-root"))&&void 0!==l?l:d:null}getAutoSizeRows(){if(this.config.enablePagination&&!this.config.serverSidePagination){const t=this.renderOrchestrator.getLastProcessedResult();if(t){const e=t.currentTableRows.filter(t=>t.row&&!t.stateIndicator&&!t.isLoadingSkeleton&&!t.nestedTable).map(t=>t.row);if(e.length>0)return e}}return this.localRows}getShrinkFloors(){var t;const e=new Map,n=t=>{if(t.children&&t.children.length>0&&t.children.forEach(n),"number"==typeof t.width)e.set(t.accessor+"",t.width);else if("string"==typeof t.width&&t.width.trim().endsWith("px")){const n=parseFloat(t.width);Number.isFinite(n)&&e.set(t.accessor+"",n)}};this.pristineDefaultHeaders.forEach(n);const i=new Map,o=At(this.headers,this.collapsedHeaders);for(const n of o){const o=n.accessor+"",s=null!==(t=this.naturalWidths.get(o))&&void 0!==t?t:e.get(o);i.set(o,Math.max(null!=s?s:0,Et(n)))}return i}recordNaturalWidths(t){t.forEach((t,e)=>this.naturalWidths.set(e,t))}applyMeasuredWidths(t){const e=n=>{const i=Object.assign({},n);return t.has(n.accessor)&&(i.width=t.get(n.accessor)),n.children&&n.children.length>0&&(i.children=n.children.map(e)),i};this.headers=this.headers.map(e),t.forEach((t,e)=>this.naturalWidths.set(e+"",t))}maybeAutoSizeColumns(){if(this.isAutoSizing||0===this.pendingAutoSize.size)return;const t=this.getAutoSizeStyleRoot();if(t instanceof HTMLElement&&t.querySelector(".st-header-cell")){this.isAutoSizing=!0;try{const e=At(this.headers,this.collapsedHeaders),n=new Map(e.map(t=>[t.accessor,t])),i=this.getAutoSizeRows(),o=new Map;for(const e of this.pendingAutoSize){const s=n.get(e);if(!s)continue;const{width:r}=Lt(e,{rows:i,header:s,styleRoot:t,theme:this.config.theme,autoSizeMode:s.autoSizeMode,sortIcon:this.resolvedIcons.sortUp,expandIcon:this.resolvedIcons.expand,onRendererHostDiscard:this.config.onRendererHostDiscard});o.set(e,r)}if(this.pendingAutoSize.clear(),0===o.size)return;let s=!1;for(const[t,e]of o){const i=n.get(t);if(("number"==typeof(null==i?void 0:i.width)?i.width:this.naturalWidths.get(t+""))!==e){s=!0;break}}if(!s)return;this.applyMeasuredWidths(o),this.renderOrchestrator.invalidateCache("header");const r=this.domManager.getElements(),l=this.domManager.getRefs();r&&this.renderOrchestrator.render(r,l,this.getRenderContext(),this.getRenderState(),this.mergedColumnEditorConfig),this.config.onColumnWidthChange&&this.config.onColumnWidthChange(this.headers)}finally{this.isAutoSizing=!1}}}refitAutoSizeColumns(){0!==this.autoSizeAccessors.size&&(this.autoSizeAccessors.forEach(t=>this.pendingAutoSize.add(t)),this.render("auto-size-refit"))}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),this.maybeAutoSizeColumns(),this.pendingAccordionAxis=null,this.lastRenderedVisibilityKey=this.buildVisibilityKey(this.headers),"scroll-raf"!==t&&"live-sort"!==t&&this.animationCoordinator.play({containers:this.getAnimatableContainers()}),this.maybeScheduleUnvirtualizedRowsWarning())}maybeScheduleUnvirtualizedRowsWarning(){var t,e,n;(()=>{try{const t=globalThis.process;return!!(null==t?void 0:t.env)&&"production"!==t.env.NODE_ENV}catch(t){return!1}})()&&(this.hasWarnedUnvirtualizedRows||null===this.unvirtualizedRowsCheckTimeoutId&&"undefined"!=typeof window&&!1!==this.config.enableVirtualization&&void 0===(null===(t=this.dimensionManager)||void 0===t?void 0:t.getContentHeight())&&(500>(null!==(n=null===(e=this.renderOrchestrator.getLastProcessedResult())||void 0===e?void 0:e.currentTableRows.length)&&void 0!==n?n:0)||(this.unvirtualizedRowsCheckTimeoutId=window.setTimeout(()=>{this.unvirtualizedRowsCheckTimeoutId=null,this.evaluateUnvirtualizedRowsWarning()},400))))}evaluateUnvirtualizedRowsWarning(){var t,e,n;if(this.hasWarnedUnvirtualizedRows||!this.mounted)return;if(!1===this.config.enableVirtualization)return;if(void 0!==(null===(t=this.dimensionManager)||void 0===t?void 0:t.getContentHeight()))return;const i=null!==(n=null===(e=this.renderOrchestrator.getLastProcessedResult())||void 0===e?void 0:e.currentTableRows.length)&&void 0!==n?n:0;500>i||(this.hasWarnedUnvirtualizedRows=!0,console.warn(`[simple-table] Rendering ${i} rows without virtualization. This can cause slow renders and high memory use. To virtualize, set \`height\` or \`maxHeight\` on the table, or pass a bounded \`scrollParent\`.`+(null!=this.config.scrollParent?' A `scrollParent` is set but did not produce a bounded viewport — make sure it is an element whose visible height is smaller than its content (e.g. a fixed/max height with `overflow: auto`), or use `"window"`.':"")))}update(t){var n,i,o,r,l,a,d,c,h,u,f,v,p,w,m;this.isUpdating=!0;const g=s(t);if(this.config=Object.assign(Object.assign({},this.config),g),void 0!==t.animations&&this.applyAnimationsConfig(t.animations),void 0!==t.onRendererHostDiscard&&(this.animationCoordinator.setOnHostDiscard(t.onRendererHostDiscard),this.renderOrchestrator.setOnRendererHostDiscard(t.onRendererHostDiscard)),void 0!==t.rows&&(this.firstRenderDone&&this.captureAnimationSnapshot(),this.localRows=[...t.rows],this.rebuildRowIndexMap(),this.filterManager&&this.filterManager.updateConfig({rows:this.localRows}),this.syncPivotPipeline(null!==(i=null===(n=this.filterManager)||void 0===n?void 0:n.getFilteredRows())&&void 0!==i?i:this.localRows),this.autoSizeAccessors.forEach(t=>this.pendingAutoSize.add(t))),void 0!==t.pivot&&void 0===t.rows&&this.syncPivotPipeline(null!==(r=null===(o=this.filterManager)||void 0===o?void 0:o.getFilteredRows())&&void 0!==r?r:this.localRows),void 0===t.rows&&void 0===t.totalRowCount||null===(l=this.dimensionManager)||void 0===l||l.updateConfig({totalRowCount:null!==(a=this.config.totalRowCount)&&void 0!==a?a:this.localRows.length}),void 0!==t.columns&&!this.isResizing){if(this.captureAnimationSnapshot(),this.pristineDefaultHeaders=En(t.columns),this.filterManager&&this.filterManager.updateConfig({headers:this.pristineDefaultHeaders}),null===(d=this.pivotManager)||void 0===d?void 0:d.isActive())this.syncPivotPipeline(null!==(h=null===(c=this.filterManager)||void 0===c?void 0:c.getFilteredRows())&&void 0!==h?h:this.localRows);else if(this.headers=[...t.columns],this.essentialAccessors=qn.buildEssentialAccessors(this.headers),this.sortManager&&this.sortManager.updateConfig({headers:this.headers}),this.selectionManager&&this.selectionManager.updateConfig({headers:this.headers}),this.dimensionManager){const t=this.renderOrchestrator.computeEffectiveHeaders(this.headers,this.config,this.customTheme);this.dimensionManager.updateConfig({effectiveHeaders:t})}this.autoSizeAccessors=this.computeAutoSizeAccessors(),this.pendingAutoSize=new Set(this.autoSizeAccessors),this.naturalWidths.clear()}if(void 0!==t.isLoading){const e=this.internalIsLoading;this.internalIsLoading=t.isLoading,e&&!t.isLoading&&this.autoSizeAccessors.size>0&&this.autoSizeAccessors.forEach(t=>this.pendingAutoSize.add(t))}if(void 0!==t.theme&&this.domManager.updateTheme(t.theme),void 0!==t.footerPosition&&this.domManager.syncFooterPosition(this.config.footerPosition),void 0===t.rows&&void 0===t.footerRenderer&&void 0===t.footerRenderKey||this.renderOrchestrator.invalidateCustomFooterCache(),void 0!==t.customTheme){const t=this.customTheme;this.customTheme=qn.mergeCustomTheme(this.config),function(t,n){for(const i of Object.keys(e))if(t[i]!==n[i])return!1;return!0}(t,this.customTheme)||(this.selectionManager&&this.selectionManager.updateConfig({customTheme:this.customTheme,rowHeight:this.customTheme.rowHeight}),null===(u=this.dimensionManager)||void 0===u||u.updateConfig({headerHeight:this.customTheme.headerHeight,rowHeight:this.customTheme.rowHeight,footerHeight:!this.config.enablePagination&&!this.config.footerRenderer||this.config.hideFooter?void 0:this.customTheme.footerHeight}),this.config.enablePagination&&t.rowHeight!==this.customTheme.rowHeight&&(this.currentPage=1),this.renderOrchestrator.invalidateCache("all"))}if(void 0===t.selectableColumns&&void 0===t.selectableCells||!this.selectionManager||this.selectionManager.updateConfig({selectableColumns:null!==(f=this.config.selectableColumns)&&void 0!==f&&f,selectableCells:null!==(v=this.config.selectableCells)&&void 0!==v&&v}),(void 0!==t.enableRowSelection||void 0!==t.rowSelectionMode||void 0!==t.selectRowOnClick||void 0!==t.showRowSelectionColumn||void 0!==t.rowButtons||void 0!==t.onRowSelectionChange||void 0!==t.selectableCells)&&(this.syncRowSelectionManager(),null===(p=this.selectionManager)||void 0===p||p.updateConfig({enableRowSelection:Ne(this.config)}),(void 0!==t.enableRowSelection||void 0!==t.showRowSelectionColumn||void 0!==t.rowButtons)&&(this.renderOrchestrator.invalidateCache("header"),this.renderOrchestrator.invalidateCache("all"),this.dimensionManager))){const t=this.renderOrchestrator.computeEffectiveHeaders(this.headers,this.config,this.customTheme);this.dimensionManager.updateConfig({effectiveHeaders:t})}void 0===t.height&&void 0===t.maxHeight||null===(w=this.dimensionManager)||void 0===w||w.updateConfig({height:this.config.height,maxHeight:this.config.maxHeight}),void 0===t.scrollParent&&void 0===t.height&&void 0===t.maxHeight||this.syncExternalScrollWiring(),void 0===t.onLoadMore&&void 0===t.infiniteScrollThreshold||!this.scrollManager||this.scrollManager.updateConfig({onLoadMore:this.config.onLoadMore,infiniteScrollThreshold:null!==(m=this.config.infiniteScrollThreshold)&&void 0!==m?m:200}),this.isUpdating=!1,this.render("update")}updateConfig(t){this.update(t)}syncRowSelectionManager(){var t,e,n,i,o;if(this.config.enableRowSelection){const s={onRowSelectionChange:this.config.onRowSelectionChange,enableRowSelection:!0,rowSelectionMode:null!==(t=this.config.rowSelectionMode)&&void 0!==t?t:"multiple",selectRowOnClick:null!==(e=this.config.selectRowOnClick)&&void 0!==e&&e,showRowSelectionColumn:!1!==this.config.showRowSelectionColumn,selectableCells:null!==(n=this.config.selectableCells)&&void 0!==n&&n,tableRoot:this.container};this.rowSelectionManager?this.rowSelectionManager.updateConfig(s):(this.rowSelectionManager=new ze(Object.assign({tableRows:null!==(o=null===(i=this.renderOrchestrator.getLastProcessedResult())||void 0===i?void 0:i.currentTableRows)&&void 0!==o?o:[]},s)),this.rowSelectionManager.subscribe(()=>{this.render("rowSelectionManager")}))}else this.rowSelectionManager&&(this.rowSelectionManager.destroy(),this.rowSelectionManager=null)}destroy(){var t,e,n,i,o,s,r,l,a,d,c,h,u,f,v,p;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!==this.externalScrollRetryRaf&&(cancelAnimationFrame(this.externalScrollRetryRaf),this.externalScrollRetryRaf=null),null!==this.unvirtualizedRowsCheckTimeoutId&&(clearTimeout(this.unvirtualizedRowsCheckTimeoutId),this.unvirtualizedRowsCheckTimeoutId=null),this.detachExternalScrollWiring();const w=this.domManager.getElements();(null==w?void 0:w.bodyContainer)&&(this.ensureBodyScrollListenerDetached(w.bodyContainer),this.bodyContainerMouseLeaveListener&&(w.bodyContainer.removeEventListener("mouseleave",this.bodyContainerMouseLeaveListener),this.bodyContainerMouseLeaveListener=null)),null!==this.accordionCleanupTimerId&&(window.clearTimeout(this.accordionCleanupTimerId),this.accordionCleanupTimerId=null);const m=null!==(e=null===(t=this.domManager.getElements())||void 0===t?void 0:t.rootElement)&&void 0!==e?e:this.container;m.classList.remove(On),m.style.removeProperty(Wn),m.style.removeProperty(Pn),null===(n=this.dimensionManager)||void 0===n||n.destroy(),null===(i=this.scrollManager)||void 0===i||i.destroy(),null===(o=this.sectionScrollController)||void 0===o||o.destroy(),null===(s=this.sortManager)||void 0===s||s.destroy(),null===(r=this.filterManager)||void 0===r||r.destroy(),null===(l=this.pivotManager)||void 0===l||l.destroy(),this.pivotManager=null,null===(a=this.rowSelectionManager)||void 0===a||a.destroy(),null===(d=this.selectionManager)||void 0===d||d.destroy(),null===(c=this.autoScaleManager)||void 0===c||c.destroy(),null===(h=this.windowResizeManager)||void 0===h||h.destroy(),null===(u=this.handleOutsideClickManager)||void 0===u||u.destroy(),null===(f=this.scrollbarVisibilityManager)||void 0===f||f.destroy(),null===(v=this.expandedDepthsManager)||void 0===v||v.destroy(),null===(p=this.ariaAnnouncementManager)||void 0===p||p.destroy(),this.animationCoordinator.destroy(),this.cellRegistry.clear(),this.headerRegistry.clear(),m.querySelectorAll("[data-row-id]").forEach(t=>{const e=t.getAttribute("data-row-id");e&&Mn(e,t)}),this.renderOrchestrator.cleanup(),this.domManager.destroy(this.container),this.cachedAPI=null}getAPI(){if(this.cachedAPI)return this.cachedAPI;const t=this;return this.cachedAPI=io.createAPI({get config(){return t.config},get localRows(){return t.localRows},get effectiveHeaders(){return t.renderOrchestrator.computeEffectiveHeaders(t.headers,t.config,t.customTheme)},get headers(){return t.headers},getPristineDefaultHeaders:()=>t.pristineDefaultHeaders,get essentialAccessors(){return t.essentialAccessors},get customTheme(){return t.customTheme},get currentPage(){return t.currentPage},getCurrentPage:()=>this.currentPage,get expandedRows(){return t.expandedRows},get collapsedRows(){return t.collapsedRows},get expandedDepths(){return t.expandedDepths},clearExpandedRows:()=>{t.expandedRows=new Map},clearCollapsedRows:()=>{t.collapsedRows=new Map},get rowStateMap(){return t.rowStateMap},get headerRegistry(){return t.headerRegistry},get cellRegistry(){return t.cellRegistry},isCellAnimating:t=>this.animationCoordinator.isInFlight(t),hasAnimatingCells:()=>this.animationCoordinator.hasInFlight(),get columnEditorOpen(){return t.columnEditorOpen},getCachedFlattenResult:()=>this.renderOrchestrator.getCachedFlattenResult(),getCachedProcessedResult:()=>this.renderOrchestrator.getLastProcessedResult(),get expandedDepthsManager(){return t.expandedDepthsManager},get selectionManager(){return t.selectionManager},get rowSelectionManager(){return t.rowSelectionManager},get sortManager(){return t.sortManager},get filterManager(){return t.filterManager},getEffectiveRowGrouping:()=>this.getEffectiveRowGrouping(),setPivot:t=>{var e,n,i,o;this.config=Object.assign(Object.assign({},this.config),{pivot:t}),this.syncPivotPipeline(null!==(n=null===(e=this.filterManager)||void 0===e?void 0:e.getFilteredRows())&&void 0!==n?n:this.localRows),null===(o=(i=this.config).onPivotChange)||void 0===o||o.call(i,t),this.renderOrchestrator.invalidateCache("header"),this.renderOrchestrator.invalidateCache("body"),this.render("setPivot")},getPivot:()=>{var t,e,n;return null!==(n=null!==(e=null===(t=this.pivotManager)||void 0===t?void 0:t.getPivot())&&void 0!==e?e:this.config.pivot)&&void 0!==n?n:null},getPivotHeaders:()=>{var t;const e=null===(t=this.pivotManager)||void 0===t?void 0:t.getState();return(null==e?void 0:e.active)?e.headers:this.headers},getPivotedRows:()=>{var t;const e=null===(t=this.pivotManager)||void 0===t?void 0:t.getState();return(null==e?void 0:e.active)?e.pivotedRows:this.localRows},onRender:()=>this.render("columnEditor-onRender"),invalidateRowsCache:()=>{this.renderOrchestrator.invalidateCache("body")},runWithoutAnimationSnapshot:t=>{this.suppressNextAnimationSnapshot=!0;try{t()}finally{this.suppressNextAnimationSnapshot=!1}},setHeaders:t=>{this.didColumnVisibilityChange(t)?this.beginAccordionAnimation("horizontal"):this.captureAnimationSnapshot(),this.headers=En(t),this.renderOrchestrator.invalidateCache("header")},setCurrentPage:t=>{this.currentPage=t},setColumnEditorOpen:t=>{this.columnEditorOpen=t,this.render("columnEditor-toggle")}}),this.cachedAPI}}function ao(t){return t}function co(t,e){if(t===e)return!0;if(t.accessor!==e.accessor||t.width!==e.width||t.minWidth!==e.minWidth||t.maxWidth!==e.maxWidth||t.label!==e.label||t.type!==e.type||t.pinned!==e.pinned||t.hide!==e.hide||t.sortable!==e.sortable||t.filterable!==e.filterable||t.align!==e.align||t.collapsible!==e.collapsible||t.collapseDefault!==e.collapseDefault||t.showWhen!==e.showWhen||t.editable!==e.editable||t.essential!==e.essential||t.disableReorder!==e.disableReorder||t.expandable!==e.expandable||t.excludeFromRender!==e.excludeFromRender||t.autoSizeMode!==e.autoSizeMode||t.tooltip!==e.tooltip||t.quickFilterable!==e.quickFilterable)return!1;const n=t.filterOperators,i=e.filterOperators;if(n!==i){if(!n||!i||n.length!==i.length)return!1;for(let t=0;n.length>t;t++)if(n[t]!==i[t])return!1}const o=t.children,s=e.children;if(o===s)return!0;if(!o||!s)return!o&&!s;if(o.length!==s.length)return!1;for(let t=0;o.length>t;t++)if(!co(o[t],s[t]))return!1;return!0}function ho(t,e){if(t===e)return!0;if(!t||!e)return!t&&!e;if(t.length!==e.length)return!1;for(let n=0;t.length>n;n++)if(!co(t[n],e[n]))return!1;return!0}function uo(t,e=new Set){var n;for(const i of t)e.add(i.accessor+""),(null===(n=i.children)||void 0===n?void 0:n.length)&&uo(i.children,e);return e}function fo(t,e){if(t===e)return!0;const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const i of n)if(t[i]!==e[i])return!1;return!0}lo.nextHoverScopeId=0,lo.EXTERNAL_SCROLL_MAX_RETRIES=60;const vo=5e4;function po(t,e,n){if(t===e)return!0;if(!t||!e)return!t&&!e;if(t.length!==e.length)return!1;const i=5e4>=e.length;for(let o=0;t.length>o;o++){const s=t[o],r=e[o];if(s!==r){if(n&&n({row:s,depth:0,index:o,rowPath:[],rowIndexPath:[o]})+""!=n({row:r,depth:0,index:o,rowPath:[],rowIndexPath:[o]})+"")return!1;if(!i)return!1;if(!fo(s,r))return!1}}return!0}export{se as PIVOT_ACCESSOR_PREFIX,re as PIVOT_BLANK_LABEL,ie as PIVOT_CHILDREN_KEY,oe as PIVOT_IS_TOTAL_KEY,vo as SHALLOW_ROW_COMPARE_MAX,lo as SimpleTableVanilla,ao as asRows,pe as buildPivotAccessor,we as buildPivotRowTotalAccessor,uo as collectHeaderAccessors,ho as headersStructurallyEqual,n as normalizeColumnDef,i as normalizeColumnDefs,o as normalizeConfig,s as normalizeConfigPatch,Re as pivotRows,po as rowsShallowUnchanged,fo as shallowEqualRow};
|
|
1
|
+
const t="parentExpanded",e={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};function n(t){var e;return(null===(e=t.children)||void 0===e?void 0:e.length)?Object.assign(Object.assign({},t),{children:t.children.map(n)}):t}function i(t){return t.map(n)}function o(t){if(!t.columns)throw Error("SimpleTable requires `columns`");return Object.assign(Object.assign({},t),{columns:i(t.columns)})}function s(t){return void 0!==t.columns?Object.assign(Object.assign({},t),{columns:i(t.columns)}):Object.assign({},t)}const r=new WeakMap,l=(t,e,n)=>{const i=(t=>{let e=r.get(t);return e||(e=new Map,r.set(t,e)),e})(t);let o=i.get(e);o||(o=document.createElement("div"),o.className="st-aria-row",o.setAttribute("role","row"),o.style.display="contents",t.appendChild(o),i.set(e,o));const s=n+"";return o.getAttribute("aria-rowindex")!==s&&o.setAttribute("aria-rowindex",s),o},a=t=>{const e=r.get(t);e&&e.forEach((t,n)=>{0===t.childElementCount&&(t.remove(),e.delete(n))})},d=t=>{const e=r.get(t);e&&(e.forEach(t=>t.remove()),e.clear())},c=new WeakMap,h=(t,e,n,i)=>{t.addEventListener(e,n,i),c.has(t)||c.set(t,[]),c.get(t).push({event:e,handler:n,options:i})},u=new WeakMap,f=t=>(u.has(t)||u.set(t,new Map),u.get(t)),v=(t,e)=>{if(t){const n=f(t);n.forEach(t=>{null==e||e(t),t.remove()}),n.clear(),d(t)}},p=new WeakMap;let w=0,m=Date.now(),g={screenX:0,screenY:0},b=null;const x=t=>{m=t},y=new WeakMap,R=t=>(y.has(t)||y.set(t,new Map),y.get(t)),S=new WeakMap,C=t=>(S.has(t)||S.set(t,new Map),S.get(t)),M=(t,e)=>{const n=Date.now();0!==w&&e>n-w||(w=n,t())},I=(t,e,n,i)=>{t.addEventListener(e,n,i),p.has(t)||p.set(t,[]),p.get(t).push({event:e,handler:n,options:i})},H=t=>{const e=t.closest(".simple-table-root");null==e||e.querySelectorAll(".st-tooltip").forEach(t=>t.remove())},k=.5,T="st-cell-animating-out",E="data-animating-out",A="data-shrinking-out",W=t=>{const e=f(t),n=R(t);if(0===e.size)return n;if(0===n.size)return e;const i=new Map(e);return n.forEach((t,e)=>i.set(e,t)),i};class O{constructor(t={}){var e,n;this.enabled=!1,this.snapshot=null,this.incomingOrigins=null,this.accordionPreVisibleAccessors=null,this.inFlight=new Map,this.retainedCells=new Map,this.scrollerMetricsCache=new WeakMap,this.externalVerticalScroll=null,this.scheduledFlip=null,this.duration=null!==(e=t.duration)&&void 0!==e?e:400,this.easing=null!==(n=t.easing)&&void 0!==n?n:"ease-out",this.prefersReducedMotion=j()}setOnHostDiscard(t){this.onHostDiscard=t}setEnabled(t){this.enabled!==t&&(this.enabled=t,t||this.cancel())}setDuration(t){Number.isFinite(t)&&t>0&&(this.duration=t)}setEasing(t){"string"==typeof t&&t.length>0&&(this.easing=t)}isEnabled(){return this.enabled&&!this.prefersReducedMotion}isInFlight(t){return this.inFlight.has(t)}hasInFlight(){return this.inFlight.size>0}getDuration(){return this.duration}getEasing(){return this.easing}setIncomingOrigins(t){this.incomingOrigins=this.isEnabled()&&t&&t.size>0?t:null}setAccordionPreVisibleAccessors(t){this.accordionPreVisibleAccessors=this.isEnabled()&&t&&t.size>0?t:null}wasRenderableBeforeAccordion(t){var e,n;return null!==(n=null===(e=this.accordionPreVisibleAccessors)||void 0===e?void 0:e.has(t))&&void 0!==n&&n}getScrollerMetrics(t){let e=this.scrollerMetricsCache.get(t);if(!e){const n=$(t);e=this.externalVerticalScroll?Object.assign(Object.assign({},n),{clientHeight:this.externalVerticalScroll.clientHeight,scrollHeight:this.externalVerticalScroll.scrollHeight,scrollTop:this.externalVerticalScroll.scrollTop}):n,this.scrollerMetricsCache.set(t,e)}return e}setExternalVerticalScroll(t){this.externalVerticalScroll=t,this.clearScrollerMetricsCache()}clearScrollerMetricsCache(){this.scrollerMetricsCache=new WeakMap}captureSnapshot(t){var e;if(!this.isEnabled())return void(this.snapshot=null);this.clearScrollerMetricsCache();const n=new Map;for(const i of t.containers){if(!i)continue;const o=i.getBoundingClientRect(),s=o.left,r=o.top;W(i).forEach((t,e)=>{n.has(e)||n.set(e,this.readPosition(e,t,i,s,r))});const l=this.retainedCells.get(i);l&&l.forEach((t,e)=>{n.has(e)||n.set(e,this.readPosition(e,t,i,s,r))});const a=null===(e=t.preLayouts)||void 0===e?void 0:e.get(i);a&&a.forEach((t,e)=>{n.has(e)||n.set(e,{sourceContainer:null,sourceContainerLeft:0,sourceContainerTop:0,left:t.left,top:t.top,styleTop:t.top,styleLeft:t.left,fromDom:!1})})}this.snapshot=n.size>0?n:null}shouldRetain(t){var e;return!!(null===(e=this.snapshot)||void 0===e?void 0:e.has(t))}hasSnapshotEntry(t){var e;return!!(null===(e=this.snapshot)||void 0===e?void 0:e.has(t))}hasSnapshotEntryInContainer(t,e){var n;const i=null===(n=this.snapshot)||void 0===n?void 0:n.get(t);return!!i&&(null===i.sourceContainer||i.sourceContainer===e)}shouldAnimateVerticalTransition(t){const e=this.getScrollerMetrics(t.container),n=F(t.beforeTop,t.cellHeight,e),i=F(t.afterTop,t.cellHeight,e);return n||i}shouldAnimateHorizontalTransition(t){const e=this.getScrollerMetrics(t.container),n=L(t.beforeLeft,t.cellWidth,e),i=L(t.afterLeft,t.cellWidth,e);return n||i}shouldAnimateTransition(t){const e=Math.abs(t.beforeTop-t.afterTop)>=k,n=Math.abs(t.beforeLeft-t.afterLeft)>=k;return!(!e||!this.shouldAnimateVerticalTransition({beforeTop:t.beforeTop,afterTop:t.afterTop,cellHeight:t.cellHeight,container:t.container}))||!(!n||!this.shouldAnimateHorizontalTransition({beforeLeft:t.beforeLeft,afterLeft:t.afterLeft,cellWidth:t.cellWidth,container:t.container}))}shouldMountIncomingCell(t){var e;const n=null===(e=this.snapshot)||void 0===e?void 0:e.get(t.cellId);if(!n)return!0;const i=this.getScrollerMetrics(t.container),o=F(n.styleTop,t.cellHeight,i),s=F(t.afterTop,t.cellHeight,i),r=L(n.styleLeft,t.cellWidth,i),l=L(t.afterLeft,t.cellWidth,i);return o||s||r||l}isCellRenderedInScrollerViewport(t,e){const n=t.getBoundingClientRect();if(0===n.width&&0===n.height)return!1;const i=e.getBoundingClientRect(),o=n.right>i.left&&i.right>n.left,s=this.externalVerticalScroll?null:e.parentElement;if(!s)return o;const r=s.getBoundingClientRect();return o&&n.bottom>r.top&&r.bottom>n.top}shouldRetainDomCellAtScrollExtrema(t,e){var n;const i=null===(n=this.snapshot)||void 0===n?void 0:n.get(t);if(!i||null===i.sourceContainer)return!1;const o=this.getScrollerMetrics(e);if(o.clientHeight>=o.scrollHeight)return!1;const s=o.scrollTop+o.clientHeight>=o.scrollHeight-1,r=1>=o.scrollTop;if(!s&&!r)return!1;const l=o.clientHeight;return!(!s||o.scrollTop-l>i.styleTop)||!(!r||i.styleTop>o.scrollTop+l)}retainCell(t){var e;const{cellId:n,element:i,container:o,newPosition:s}=t,r=P(i.style.top),l=P(i.style.left),a=this.getScrollerMetrics(o),d=D(s.top,r,s.height,a,"y"),c=D(s.left,l,s.width,a,"x");let h=this.retainedCells.get(o);h||(h=new Map,this.retainedCells.set(o,h));const u=h.get(n);u&&u!==i&&(this.cancelInFlight(n),null===(e=this.onHostDiscard)||void 0===e||e.call(this,u),u.remove()),i.id&&i.removeAttribute("id"),i.classList.add(T),i.setAttribute(E,"true"),i.style.left=c+"px",i.style.top=d+"px",i.style.width=s.width+"px",i.style.height=s.height+"px",i.style.pointerEvents="none",h.set(n,i)}claimRetainedForReuse(t,e){var n,i;const o=this.retainedCells.get(e);if(!o)return null;const s=o.get(t);return s?s.hasAttribute(A)?(this.cancelInFlight(t),o.delete(t),null===(n=this.snapshot)||void 0===n||n.delete(t),null===(i=this.onHostDiscard)||void 0===i||i.call(this,s),s.remove(),null):(this.cancelInFlight(t),o.delete(t),s.classList.remove(T),s.removeAttribute(E),s.id=t,s.style.pointerEvents="",s):null}shrinkOutCell(t){var e;const{cellId:n,element:i,container:o,axis:s}=t;this.cancelInFlight(n);let r=this.retainedCells.get(o);r||(r=new Map,this.retainedCells.set(o,r));const l=r.get(n);l&&l!==i&&(this.cancelInFlight(n),null===(e=this.onHostDiscard)||void 0===e||e.call(this,l),l.remove()),i.id&&i.removeAttribute("id"),i.classList.add(T),i.setAttribute(E,"true"),i.setAttribute(A,"true"),i.style.pointerEvents="none","horizontal"===s?i.style.width="0px":i.style.height="0px",r.set(n,i);const a=window.setTimeout(()=>{var t;const e=this.retainedCells.get(o);e&&e.get(n)===i&&e.delete(n),null===(t=this.onHostDiscard)||void 0===t||t.call(this,i),i.remove()},this.duration+80);this.inFlight.set(n,{element:i,cleanupTimeout:a,transitionEndHandler:()=>{},isRetained:!0})}discardRetainedIfPresent(t,e){var n;const i=this.retainedCells.get(e);if(!i)return;const o=i.get(t);o&&(this.cancelInFlight(t),i.delete(t),null===(n=this.onHostDiscard)||void 0===n||n.call(this,o),o.remove())}play(t){const e=this.snapshot,n=this.incomingOrigins;if(this.snapshot=null,this.incomingOrigins=null,!this.isEnabled()||!e)return void this.retainedCells.forEach(t=>{t.forEach((e,n)=>{var i;this.inFlight.has(n)||(null===(i=this.onHostDiscard)||void 0===i||i.call(this,e),e.remove(),t.delete(n))})});const i=[],o=new Set,s=new Map,r=(t,r,l,a)=>{var d,c;if(o.has(r))return;if(l&&t.hasAttribute(A))return void o.add(r);let h=e.get(r);if(!h&&!l&&n){const t=n.get(r);t&&(h={sourceContainer:null,sourceContainerLeft:0,sourceContainerTop:0,left:t.left,top:t.top,styleTop:t.top,styleLeft:t.left,fromDom:!1})}if(!h)return;if(!l&&null!==h.sourceContainer&&h.sourceContainer!==a)return void o.add(r);if(t.querySelector(".st-cell-editing"))return;const u=P(t.style.left),f=P(t.style.top);if(!l&&this.inFlight.has(r)&&k>Math.abs(h.styleTop-f)&&k>Math.abs(h.styleLeft-u))return void o.add(r);const v=l||h.fromDom,p=v?0:P(t.style.height)||t.offsetHeight||0,w=v?0:P(t.style.width)||t.offsetWidth||0,m=v?null:this.getScrollerMetrics(a),g=v||!m?h.top:D(h.top,f,p,m,"y"),b=v||!m?h.left:D(h.left,u,w,m,"x"),x=null!=m?m:this.getScrollerMetrics(a),y=P(t.style.height)||t.offsetHeight||p||0;let R=g;const S=!!x&&F(f,y,x);if(!l&&x&&S){const t=x.scrollTop,e=x.scrollTop+x.clientHeight;(l||null!==h.sourceContainer||h.fromDom||Math.abs(g-f)>=k&&!F(g,y,x))&&F(g,y,x)||(R=g>f?e:t-y)}let C=0;if(null!==h.sourceContainer){const t=(t=>{let e=s.get(t);if(!e){const n=t.getBoundingClientRect();e={left:n.left,top:n.top},s.set(t,e)}return e})(a);C=t.left-h.sourceContainerLeft}let M=b-u-C,I=R-f-0;k>Math.abs(M)&&k>Math.abs(I)?l&&(this.cancelInFlight(r),null===(d=this.retainedCells.get(a))||void 0===d||d.delete(r),null===(c=this.onHostDiscard)||void 0===c||c.call(this,t),t.remove()):(i.push({cellId:r,element:t,dx:M,dy:I,isRetained:l}),o.add(r))};for(const e of t.containers){if(!e)continue;const t=this.retainedCells.get(e);t&&t.forEach((t,n)=>{r(t,n,!0,e)}),W(e).forEach((t,n)=>{r(t,n,!1,e)})}if(this.scheduledFlip){cancelAnimationFrame(this.scheduledFlip.rafId);for(const{element:t}of this.scheduledFlip.pending)t.style.transition="none",t.style.transform="",t.style.willChange="";this.scheduledFlip=null}for(const{cellId:t,element:e,dx:n,dy:o}of i)this.cancelInFlight(t),e.style.transition="none",e.style.transform=`translate3d(${n}px, ${o}px, 0)`,e.style.willChange="transform";if(0===i.length)return;const l=requestAnimationFrame(()=>{const t=requestAnimationFrame(()=>{this.scheduledFlip=null;for(const{cellId:t,element:e,isRetained:n}of i)e.isConnected&&this.startTransition(t,e,n)});this.scheduledFlip&&(this.scheduledFlip.rafId=t)});this.scheduledFlip={rafId:l,pending:i}}cancel(){this.snapshot=null,this.incomingOrigins=null,this.accordionPreVisibleAccessors=null,this.clearScrollerMetricsCache(),this.scheduledFlip&&(cancelAnimationFrame(this.scheduledFlip.rafId),this.scheduledFlip=null);const t=Array.from(this.inFlight.entries());this.inFlight.clear();for(const[e,n]of t)window.clearTimeout(n.cleanupTimeout),n.element.removeEventListener("transitionend",n.transitionEndHandler),this.finishElement(e,n.element,n.isRetained);this.retainedCells.forEach(t=>{t.forEach(t=>{var e;null===(e=this.onHostDiscard)||void 0===e||e.call(this,t),t.remove()}),t.clear()}),this.retainedCells.clear()}destroy(){this.cancel()}readPosition(t,e,n,i,o){const s=P(e.style.top),r=P(e.style.left);if(this.inFlight.get(t)){const t=e.getBoundingClientRect(),l=e.offsetParent;if(l){const e=l.getBoundingClientRect();return{sourceContainer:n,sourceContainerLeft:i,sourceContainerTop:o,left:t.left-e.left+l.scrollLeft,top:t.top-e.top+l.scrollTop,styleTop:s,styleLeft:r,fromDom:!0}}return{sourceContainer:n,sourceContainerLeft:i,sourceContainerTop:o,left:t.left,top:t.top,styleTop:s,styleLeft:r,fromDom:!0}}return{sourceContainer:n,sourceContainerLeft:i,sourceContainerTop:o,left:r,top:s,styleTop:s,styleLeft:r,fromDom:!1}}startTransition(t,e,n){e.style.transition=`transform ${this.duration}ms ${n?"ease-in":this.easing}`,e.style.transform="translate3d(0, 0, 0)",n||(e.style.pointerEvents="none");const i=n=>{"transform"===n.propertyName&&this.finalizeCell(t,e)};e.addEventListener("transitionend",i);const o=window.setTimeout(()=>{this.finalizeCell(t,e)},this.duration+80);this.inFlight.set(t,{element:e,cleanupTimeout:o,transitionEndHandler:i,isRetained:n})}cancelInFlight(t){const e=this.inFlight.get(t);e&&(window.clearTimeout(e.cleanupTimeout),e.element.removeEventListener("transitionend",e.transitionEndHandler),this.inFlight.delete(t))}finalizeCell(t,e){var n;const i=this.inFlight.get(t),o=null!==(n=null==i?void 0:i.isRetained)&&void 0!==n?n:this.isCellRetained(e);i&&(window.clearTimeout(i.cleanupTimeout),i.element.removeEventListener("transitionend",i.transitionEndHandler),this.inFlight.delete(t)),this.finishElement(t,e,o)}finishElement(t,e,n){var i;if(n)return this.retainedCells.forEach(n=>{n.get(t)===e&&n.delete(t)}),null===(i=this.onHostDiscard)||void 0===i||i.call(this,e),void e.remove();e.style.transition="",e.style.transform="",e.style.willChange="",e.style.pointerEvents=""}isCellRetained(t){return t.hasAttribute(E)}}const P=t=>{if(!t)return 0;const e=parseFloat(t);return Number.isFinite(e)?e:0},$=t=>{const e=t.parentElement;return{clientHeight:e?e.clientHeight:0,scrollHeight:e?e.scrollHeight:0,scrollTop:e?e.scrollTop:0,clientWidth:t.clientWidth,scrollWidth:t.scrollWidth,scrollLeft:t.scrollLeft}},F=(t,e,n)=>{const i=n.clientHeight;return 0>=i||i>=n.scrollHeight||t>=n.scrollTop&&n.scrollTop+i>t},L=(t,e,n)=>{const i=n.clientWidth;return 0>=i||i>=n.scrollWidth||t>=n.scrollLeft&&n.scrollLeft+i>t},D=(t,e,n,i,o)=>{const s="y"===o?i.clientHeight:i.clientWidth;if(0>=s||s>=("y"===o?i.scrollHeight:i.scrollWidth))return t;const r=t-e,l=Math.abs(r);if(0===l)return t;const a=n>0?n:0,d="y"===o?i.scrollTop:i.scrollLeft;if(t>=d-a&&d+s>=t)return t;const c=s+a;if(c>=l)return t;const h=l-c,u=c+s*h/(h+10*c);return e+Math.sign(r)*u},j=()=>{if("undefined"==typeof window||"function"!=typeof window.matchMedia)return!1;try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch(t){return!1}},N=t=>Math.ceil(800/(t+1)),B=29.5,z=(t,e=!0)=>t&&e?B:0,V=(t,e=!0)=>!(!t||!e),q=150,G=["lineAreaChart","barChart"],K=500,_=40,U=(t,e,n)=>e&&n?480>t?.25:768>t?.3:.4:(t=>480>t?.4:768>t?.5:.6)(t),J=(t,e)=>{if(!t.children||0===t.children.length)return[e];const n=[],i=(t,e)=>{if(!t.children||0===t.children.length)return n.push(e),e+1;let o=e;for(const e of t.children)o=i(e,o);return o};return i(t,e),n},Y=t=>t.flatMap(t=>t.children&&0!==t.children.length?Y(t.children):[t]),X=t=>t.flatMap(t=>{const e=[t];return t.children&&t.children.length>0&&e.push(...X(t.children)),e}),Q=(t=0)=>t?t+1:0,Z=t=>!(!t.hide&&!t.excludeFromRender),tt=(t,e)=>{const n=X(t);for(const t of n)if(t.children&&t.children.length>0&&t.children.some(t=>t.accessor===e))return t;return null},et=(e,n,i)=>{const o=tt(n,e.accessor);if(o){const n=i.has(o.accessor),s=e.showWhen||t;return n?"parentExpanded"===s:"parentCollapsed"===s}return!1},nt=t=>{var e;return!(!(null===(e=t.children)||void 0===e?void 0:e.length)||!t.collapsible)},it=(t,e,n)=>{if(!t.children||0===t.children.length)return 1;const i=Y(t.children);let o=0;for(const t of i)Z(t)||et(t,e,n)||(o+=1);return o},ot=({accessor:t,rowId:e})=>`${e}-${t}`,st=new WeakSet,rt=t=>st.has(t),lt=t=>{if(t)return e=>{if(!rt(e.row))return t(e)}},at=({calculatedHeight:t,customHeight:e,customTheme:n})=>e?("string"==typeof e?parseFloat(e):e)+n.nestedGridPaddingTop+n.nestedGridPaddingBottom:t,dt=t=>{const e=t.match(/^(.+?)\[(\d+)\]$/);return e?{key:e[1],index:parseInt(e[2],10)}:{key:t,index:null}},ct=(t,e)=>{const n=e+"";return n.includes(".")||n.includes("[")?n.split(".").reduce((t,e)=>{if(null==t)return;const{key:n,index:i}=dt(e);let o=t[n];return null!==i&&Array.isArray(o)&&(o=o[i]),o},t):t[e]},ht=(t,e)=>{if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;t.length>n;n++)if(t[n]!==e[n])return!1;return!0},ut=(t,e,n)=>{const i=e+"";if(!i.includes(".")&&!i.includes("["))return void(t[e]=n);const o=i.split(".");let s=t;for(let t=0;o.length-1>t;t++){const{key:e,index:n}=dt(o[t]);if(null==s[e]){const n=dt(o[t+1]);s[e]=null!==n.index?[]:{}}if(s=s[e],null!==n){if(!Array.isArray(s))throw Error(`Expected array at ${o.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}=dt(o[o.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},ft=t=>Array.isArray(t)&&t.length>0&&"object"==typeof t[0]&&null!==t[0],vt=t=>{const{getRowId:e,rowPath:n}=t,i=[...n];if(e){const n=e({row:t.row,depth:t.depth,index:t.index,rowPath:t.rowPath,rowIndexPath:t.rowIndexPath,groupingKey:t.groupingKey});null!=n&&""!==n&&i.push(n)}return i},pt=t=>t.join("-"),wt=new WeakMap;let mt=0;const gt=t=>{const{getRowId:e}=t,n=e?e({row:t.row,depth:t.depth,index:t.index,rowPath:t.rowPath,rowIndexPath:t.rowIndexPath,groupingKey:t.groupingKey}):void 0,i=null!=n&&""!==n?n+"":(t=>{if(t&&"object"==typeof t){const e=wt.get(t);if(void 0!==e)return e;const n="__row_"+ ++mt;return wt.set(t,n),n}return"__row_p_"+t})(t.row),o=[];return t.parentStableKey&&o.push(t.parentStableKey),t.groupingKey&&t.depth>0&&o.push(t.groupingKey),o.push(i),o.join("/")},bt=t=>t.stableRowKey?t.stableRowKey:pt(t.rowId),xt=(t,e)=>`${t+""}nested-chrome${(null!=e?e:"")+""}`,yt=(t,e)=>!!e&&ft(t[e]),Rt=(t,e,n,i,o)=>{const s=t+"",r=i.has(s)&&i.get(s)===e,l=o.has(s)&&o.get(s)===e;return n.has(e)?!l:r},St=(e,n)=>{if(Z(e))return[];if(!e.children||0===e.children.length)return[e];if(n&&n.has(e.accessor)){const i=e.children.filter(e=>{const n=e.showWhen||t;return"parentCollapsed"===n||"always"===n});return e.singleRowChildren?0===i.length?[e]:[e,...i.flatMap(t=>St(t,n))]:0===i.length?[e]:i.flatMap(t=>St(t,n))}const i=e.children.filter(e=>{const n=e.showWhen||t;return"parentExpanded"===n||"always"===n});return e.singleRowChildren?[e,...i.flatMap(t=>St(t,n))]:i.flatMap(t=>St(t,n))};function Ct(t){if(Z(t))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"auto"===e.toLowerCase()?{type:"auto"}: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 Mt(t){const e=[],n=t=>{Z(t)||(t.children&&0!==t.children.length?(t.singleRowChildren&&e.push(t),t.children.forEach(n)):e.push(t))};return t.forEach(n),e}function It(t,e){const n=t.map(t=>Ct(t)),i=n.reduce((t,e)=>"px"===(null==e?void 0:e.type)?t+e.value:t,0),o=n.reduce((t,e)=>"pct"===(null==e?void 0:e.type)?t+e.value:t,0),s=e*(o/100),r=n.reduce((t,e)=>"fr"===(null==e?void 0:e.type)?t+e.value:t,0),l=r>0?Math.max(0,e-i-s)/r:150,a=new Map;return t.forEach((t,i)=>{const o=n[i];if(o)if("auto"===o.type)a.set(t.accessor,Math.max(q,"number"==typeof t.minWidth?t.minWidth:"string"==typeof t.minWidth&&parseFloat(t.minWidth+"")||0));else if("px"===o.type)a.set(t.accessor,o.value);else if("fr"===o.type){const e=o.value*l,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"===o.type?e*o.value/100:q);else a.set(t.accessor,q)}),a}function Ht(t,e){const n="object"==typeof e&&null!=e?e.containerWidth:void 0;let i,o="number"==typeof e?e:void 0;if(null!=n&&n>0){const e=Mt(t);i=It(e,n)}else{const e=Mt(t),n=e.map(t=>Ct(t));let s=o;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)}i=It(e,s)}return t.map(function t(e){const n=Object.assign({},e),o=i.get(e.accessor);return null!=o&&(n.width=o),e.children&&e.children.length>0&&(n.children=e.children.map(t)),n})}const kt=t=>{if(Z(t))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(ot({accessor:t.accessor,rowId:"header"}));return(null==e?void 0:e.offsetWidth)||q}},Tt=t=>{var e;const n=t.width;"string"==typeof n&&n.includes("fr")&&(t.width=(null===(e=document.getElementById(ot({accessor:t.accessor,rowId:"header"})))||void 0===e?void 0:e.offsetWidth)||q),t.children&&t.children.length>0&&t.children.forEach(t=>{Tt(t)})},Et=t=>"number"==typeof t.minWidth?t.minWidth:_,At=(t,e)=>{const n=[];return t.forEach(t=>{Z(t)||n.push(...St(t,e))}),n},Wt=t=>t instanceof HTMLElement?t:document.body,Ot=t=>t.replace(/["\\]/g,"\\$&"),Pt=t=>t.includes("\n")||t.includes("\r")?t.split(/\r\n|\r|\n/):[t],$t=(t,e)=>{const n=document.createElement("span");n.style.visibility="hidden",n.style.position="absolute",n.style.whiteSpace="nowrap",n.style.width="auto";const i=window.getComputedStyle(e);n.style.font=i.font,n.style.fontSize=i.fontSize,n.style.fontWeight=i.fontWeight,n.style.fontFamily=i.fontFamily,n.style.letterSpacing=i.letterSpacing,n.style.padding=i.padding,document.body.appendChild(n);let o=0;for(const e of Pt(t))n.textContent=e,o=Math.max(o,n.offsetWidth);return document.body.removeChild(n),o},Ft=(t,e,n="st-icon-container")=>{const i=document.createElement("div");i.className=n,i.style.visibility="hidden",i.style.position="absolute",i.style.top="-99999px",i.style.left="-99999px","string"==typeof t?i.innerHTML=t:i.appendChild(t.cloneNode(!0));const o=Wt(e);o.appendChild(i);const s=window.getComputedStyle(i),r=i.offsetWidth+(parseFloat(s.marginLeft)||0)+(parseFloat(s.marginRight)||0);return o.removeChild(i),r+4},Lt=(t,e)=>{var n,i,o,s,r,l,a;const{rows:d,header:c,maxWidth:h=K,headSampleSize:u,stridedSampleSize:f,sampleSize:v,outlierPercentile:p,outlierThreshold:w,autoSizeMode:m=(null!==(n=null==c?void 0:c.autoSizeMode)&&void 0!==n?n:"content"),theme:g,styleRoot:b,sortIcon:x,expandIcon:y,onRendererHostDiscard:R}=e||{},S=null!==(i=null!=u?u:v)&&void 0!==i?i:25,C=null!=f?f:null!=v?0:75,M=null!=b?b:document,I=ot({accessor:t,rowId:"header"}),H=M instanceof HTMLElement?M.querySelector(`[id="${Ot(I)}"]`):document.getElementById(I),k=null!=H?H:M.querySelector(".st-header-cell");if(!k)return{width:q,settled:!0};const T=window.getComputedStyle(k),E=parseFloat(T.paddingLeft)||0,A=parseFloat(T.paddingRight)||0,W=parseFloat(T.gap)||0;let O=E+A,P=!(null==c?void 0:c.headerRenderer);const $=null==H?void 0:H.querySelector(".st-header-label");let F=!1,L=!1;if($){const t=$.querySelector(".st-header-label-text");if((null==c?void 0:c.headerRenderer)||!t){const t=((t,e)=>{const n=document.createElement("div");n.style.visibility="hidden",n.style.position="absolute",n.style.top="-99999px",n.style.left="-99999px",n.style.whiteSpace="nowrap",n.style.width="max-content";const i=t.cloneNode(!0);i.style.flex="none",i.style.width="max-content",i.style.minWidth="0",i.style.maxWidth="none",i.style.overflow="visible",i.style.height="auto";const o=window.getComputedStyle(t);i.style.font=o.font,i.style.fontSize=o.fontSize,i.style.fontWeight=o.fontWeight,i.style.fontFamily=o.fontFamily,i.style.letterSpacing=o.letterSpacing,n.appendChild(i);const s=Wt(e);s.appendChild(n);const r=n.offsetWidth;return s.removeChild(n),r})($,M);if(1>t){if(null==c?void 0:c.headerRenderer)P=!1;else if(null==c?void 0:c.label){const t=null!==(o=M.querySelector(".st-header-label-text"))&&void 0!==o?o:$;O+=$t(c.label+"",t)}}else O+=t,P=!0,F=!!$.querySelector('.st-icon-container[aria-label^="Sort"]'),L=!!$.querySelector(".st-collapsible-header-icon")}else O+=$t(null!==(s=t.textContent)&&void 0!==s?s:"",t)}else if(null==c?void 0:c.label){const t=null!==(r=M.querySelector(".st-header-label-text"))&&void 0!==r?r:k;O+=$t(c.label+"",t),P=!0}const D=H?Array.from(H.children):[];let j=1;for(let t=0;D.length>t;t++){const e=D[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&&(O+=(e.offsetWidth||0)+(parseFloat(n.marginLeft)||0)+(parseFloat(n.marginRight)||0),j++,(null===(l=e.getAttribute("aria-label"))||void 0===l?void 0:l.startsWith("Sort"))&&(F=!0),e.classList.contains("st-collapsible-header-icon")&&(L=!0))}(null==c?void 0:c.sortable)&&!F&&x&&(O+=Ft(x,M),j++),c&&nt(c)&&!L&&y&&(O+=Ft(y,M,"st-icon-container st-collapsible-header-icon st-expand-icon-container expanded"),j++),W>0&&j>1&&(O+=W*(j-1));let N=0,B=!(null==c?void 0:c.cellRenderer)||"header"===m;const z=c&&c.type&&G.includes(c.type);if(d&&d.length>0&&!z&&"header"!==m){const e=document.createElement("div");e.style.visibility="hidden",e.style.position="absolute",e.style.top="-99999px",e.style.left="-99999px",e.style.whiteSpace="nowrap",e.style.width="auto",e.style.display="inline-block";let n=0,i=0;const o=M.querySelector(".st-cell-content");if(o){const t=window.getComputedStyle(o);e.style.font=t.font,e.style.fontSize=t.fontSize,e.style.fontFamily=t.fontFamily,n=parseFloat(t.paddingLeft)||0,i=parseFloat(t.paddingRight)||0}document.body.appendChild(e);const s=[],r=t=>{let o=0;for(const n of Pt(t))e.textContent=n,o=Math.max(o,e.offsetWidth);return o+n+i},l=((t,e,n)=>{if(0>=t)return[];const i=Math.max(0,Math.floor(e)),o=Math.max(0,Math.floor(n));if(i+o>=t)return Array.from({length:t},(t,e)=>e);const s=new Set;for(let e=0;Math.min(i,t)>e;e++)s.add(e);const r=i,l=t-r;if(o>0&&l>0){const e=Math.max(1,Math.floor(l/o));for(let n=0;o>n;n++){const i=r+n*e;if(i>=t)break;s.add(i)}s.add(t-1)}return Array.from(s).sort((t,e)=>t-e)})(d.length,S,C);let h=!1,u=!1;for(const o of l){const l=d[o];let f;f=(null==c?void 0:c.valueGetter)?c.valueGetter({accessor:t,row:l,rowIndex:o}):ct(l,t);let v=f;(null==c?void 0:c.valueFormatter)&&null!=f&&(v=c.valueFormatter({accessor:t,colIndex:0,row:l,rowIndex:o,value:f}));let p=-1;if((null==c?void 0:c.cellRenderer)&&!h)try{const s=c.cellRenderer({accessor:t,colIndex:0,row:l,rowIndex:o,theme:g,value:f,formattedValue:v});if("string"==typeof s||"number"==typeof s)p=r(s+""),p>0&&(u=!0);else if(s instanceof Node)if(s instanceof HTMLElement&&(s.hasAttribute("data-st-portal-id")||s.hasAttribute("data-st-mount-id")||(null===(a=s.querySelector)||void 0===a?void 0:a.call(s,"[data-st-portal-id], [data-st-mount-id]"))))s instanceof HTMLElement&&(null==R||R(s)),h=!0,p=-1;else{e.textContent="",e.appendChild(s);const t=e.offsetWidth+n+i;s instanceof HTMLElement&&(null==R||R(s)),e.textContent="",p=t>n+i?t:-1,u=!0}}catch(t){p=-1}0>p&&!(null==c?void 0:c.cellRenderer)&&(p=r(null!=v?v+"":"")),0>p||s.push(p)}document.body.removeChild(e),(null==c?void 0:c.cellRenderer)&&(M.querySelectorAll(`.st-cell[data-accessor="${Ot(t+"")}"] .st-cell-content`).forEach(t=>{const e=t;if(e.querySelector(".st-loading-skeleton"))return;const o=((t,e)=>{const n=document.createElement("div");n.style.visibility="hidden",n.style.position="absolute",n.style.top="-99999px",n.style.left="-99999px",n.style.whiteSpace="nowrap",n.style.width="max-content";const i=t.cloneNode(!0);i.style.flex="none",i.style.width="max-content",i.style.minWidth="0",i.style.maxWidth="none",i.style.overflow="visible",i.style.padding="0";const o=window.getComputedStyle(t);i.style.font=o.font,i.style.fontSize=o.fontSize,i.style.fontFamily=o.fontFamily,i.style.letterSpacing=o.letterSpacing,n.appendChild(i);const s=Wt(e);s.appendChild(n);const r=n.offsetWidth;return s.removeChild(n),r})(e,M);o>0&&(s.push(o+n+i),u=!0)}),B=u),N=((t,e)=>{var n,i,o;if(0===t.length)return 0;const s=Math.max(...t),r=null!==(n=null==e?void 0:e.percentile)&&void 0!==n?n:95,l=null!==(i=null==e?void 0:e.threshold)&&void 0!==i?i:.5;if((null!==(o=null==e?void 0:e.minSampleForClip)&&void 0!==o?o:20)>t.length)return s;const a=((t,e)=>{if(0===t.length)return 0;if(1===t.length)return t[0];const n=[...t].sort((t,e)=>t-e),i=Math.min(100,Math.max(0,e))/100*(n.length-1),o=Math.floor(i),s=Math.ceil(i);return o===s?n[o]:n[o]+(n[s]-n[o])*(i-o)})(t,r);return a>0&&s>a*(1+l)?a:s})(s,{percentile:p,threshold:w})}let V="header"===m?O:Math.max(O,N);z&&(V=Math.max(V,150));const U="number"==typeof(null==c?void 0:c.maxWidth)?c.maxWidth:"string"==typeof(null==c?void 0:c.maxWidth)&&parseFloat(c.maxWidth+"")||void 0,J=null!=U?U:h;return V>J&&(V=J),{width:Math.max(V+2,"number"==typeof(null==c?void 0:c.minWidth)?c.minWidth:"string"==typeof(null==c?void 0:c.minWidth)&&parseFloat(c.minWidth+"")||_,_),settled:P&&B}};class Dt{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 jt=t=>"number"==typeof t.width?t.width:"string"==typeof t.width&&t.width.endsWith("px")?parseFloat(t.width):150,Nt=(t,e)=>{const n=new Map,i=t.map(jt),o=i.reduce((t,e)=>t+e,0);if(0===o)return n;const s=e/o;if(.01>s-1)return n;const r=t.map((t,e)=>{const n="number"==typeof t.maxWidth?t.maxWidth:"string"==typeof t.maxWidth?parseFloat(t.maxWidth):NaN;return Number.isFinite(n)&&n>0?Math.max(n,i[e]):1/0}),l=new Map;let a=s;for(;;){const t=i.map((t,e)=>e).filter(t=>!l.has(t));if(0===t.length)break;const n=Array.from(l.values()).reduce((t,e)=>t+e,0),o=t.reduce((t,e)=>t+i[e],0);a=Math.max(1,(e-n)/o);const s=t.filter(t=>i[t]*a>r[t]);if(0===s.length)break;s.forEach(t=>l.set(t,r[t]))}const d=t.map((t,e)=>{const n=l.get(e);return Math.round(void 0!==n?n:i[e]*a)});let c=-1;for(let e=t.length-1;e>=0;e--)if(!l.has(e)){c=e;break}if(c>=0){const t=d.reduce((t,e,n)=>n===c?t:t+e,0);d[c]=Math.round(Math.min(Math.max(e-t,i[c]),r[c]))}return t.forEach((t,e)=>{n.set(t.accessor,d[e])}),n},Bt=(t,e)=>{const{autoExpandColumns:n,containerWidth:i,pinnedLeftWidth:o,pinnedRightWidth:s,isResizing:r,collapsedHeaders:l}=e;if(!n||0===i||r)return t;const a=Math.max(0,i-o-s),d=t.filter(t=>"left"===t.pinned),c=t.filter(t=>"right"===t.pinned),h=t.filter(t=>!t.pinned),u=At(d,l),f=At(c,l),v=At(h,l),p=new Map;if(u.length>0&&Nt(u,o).forEach((t,e)=>p.set(e,t)),f.length>0&&Nt(f,s).forEach((t,e)=>p.set(e,t)),v.length>0&&a>0&&Nt(v,a).forEach((t,e)=>p.set(e,t)),0===p.size)return t;const w=(t,e)=>{var n;if(Z(t))return t;const i=null!=e?e:t.pinned,o=null===(n=t.children)||void 0===n?void 0:n.map(t=>w(t,i)),s=p.get(t.accessor);return Object.assign(Object.assign({},t),void 0!==s?{width:s,children:o}:{children:o})};return t.map(t=>w(t,t.pinned))};class zt{constructor(t,e){var n;this.config=t,this.onHeadersUpdate=e,this.isResizingTracker=new Dt(null!==(n=t.isResizing)&&void 0!==n&&n),this.containerWidthTracker=new Dt(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,i=this.config.containerWidth,o=this.isResizingTracker.get();this.isResizingTracker.set(n);const s=this.containerWidthTracker.get();this.containerWidthTracker.set(i),o&&!n&&this.config.autoExpandColumns&&this.triggerAutoScale(),Math.abs(i-s)>10&&!n&&this.config.autoExpandColumns&&this.triggerAutoScale()}triggerAutoScale(){this.onHeadersUpdate&&this.onHeadersUpdate(this.config)}applyAutoScale(t){return Bt(t,this.config)}setHeaders(t,e){const n="function"==typeof t?t(e):t;return this.applyAutoScale(n)}destroy(){this.onHeadersUpdate=()=>{}}}const Vt=t=>{if(t.endsWith("dvh")||t.endsWith("svh")||t.endsWith("lvh")||t.endsWith("vh")){const e=parseFloat(t);return Number.isFinite(e)?window.innerHeight*e/100:null}return null},qt=(t,e=document.querySelector(".simple-table-root"))=>{var n;if("string"==typeof t){const i=t.trim();if(/^calc\(/i.test(i)&&i.endsWith(")")){const t=((t,e)=>{const n=[];for(let e=0;t.length>e;){const i=t[e];if(" "===i||"\t"===i||"\n"===i){e++;continue}if("("===i||")"===i||"+"===i||"-"===i||"*"===i||"/"===i){n.push(i),e++;continue}const o=/^\d*\.?\d+(px|dvh|svh|lvh|vh|vw|%)?/.exec(t.slice(e));if(!o)return null;n.push(o[0]),e+=o[0].length}if(0===n.length)return null;let i=0,o=!1;const s=()=>{let t=r();for(;!o&&("+"===n[i]||"-"===n[i]);){const e=n[i++],o=r();t="+"===e?t+o:t-o}return t},r=()=>{let t=l();for(;!o&&("*"===n[i]||"/"===n[i]);){const e=n[i++],o=l();t="*"===e?t*o:t/o}return t},l=()=>{const t=n[i];if(void 0===t)return o=!0,0;if("+"===t)return i++,l();if("-"===t)return i++,-l();if("("===t){i++;const t=s();return")"!==n[i]?(o=!0,0):(i++,t)}const r=((t,e)=>{var n;const i=t.trim();if(""===i)return null;if(i.endsWith("px")){const t=parseFloat(i);return Number.isFinite(t)?t:null}const o=Vt(i);if(null!==o)return o;if(i.endsWith("vw")){const t=parseFloat(i);return Number.isFinite(t)?window.innerWidth*t/100:null}if(i.endsWith("%")){const t=parseFloat(i),o=null===(n=null==e?void 0:e.parentElement)||void 0===n?void 0:n.clientHeight;return Number.isFinite(t)&&o&&o>=50?o*t/100:null}const s=+i;return Number.isFinite(s)?s:null})(t,e);return null===r?(o=!0,0):(i++,r)},a=s();return o||i!==n.length||!Number.isFinite(a)?null:a})(i.slice(i.indexOf("(")+1,-1),e);return null===t?0:Math.max(0,t)}if(i.endsWith("px"))return parseInt(i,10);const o=Vt(i);if(null!==o)return o;if(i.endsWith("%")){const t=null===(n=null==e?void 0:e.parentElement)||void 0===n?void 0:n.clientHeight;return!t||50>t?0:t*parseInt(i,10)/100}return window.innerHeight}return t};class Gt{constructor(t){this.subscribers=new Set,this.resizeObserver=null,this.rafId=null,this.resizeNotifyDebounceId=null,this.resizeBurstEndId=null,this.resizeBurstNotifyCount=0,this.resizeBurstNeedsFinalFlush=!1,this.initialNotifyPending=!1,this.config=t;const e=this.calculateMaxHeaderDepth(),n=this.calculateHeaderHeight(e),i=this.calculateContentHeight();this.state={containerWidth:0,calculatedHeaderHeight:n,maxHeaderDepth:e,contentHeight:i},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;return t*(null!==(e=this.config.headerHeight)&&void 0!==e?e:this.config.rowHeight)}convertHeightToPixels(t){const e=this.config.containerElement||document.querySelector(".simple-table-root");return qt(t,e)}calculateContentHeight(){const{height:t,maxHeight:e,rowHeight:n,totalRowCount:i,headerHeight:o,footerHeight:s,externalViewportHeight:r}=this.config;if(e){const t=this.convertHeightToPixels(e);if(0===t)return;const r=o||n;if(t>=r+i*n+(s||0))return;return Math.max(0,t-r)}if(!t&&void 0!==r&&r>0)return Math.max(0,r-(o||n));if(!t)return;const l=this.convertHeightToPixels(t);return 0!==l?Math.max(0,l-n):void 0}cancelPendingResizeNotify(){null!==this.resizeNotifyDebounceId&&(clearTimeout(this.resizeNotifyDebounceId),this.resizeNotifyDebounceId=null)}cancelResizeBurstEnd(){null!==this.resizeBurstEndId&&(clearTimeout(this.resizeBurstEndId),this.resizeBurstEndId=null)}scheduleResizeBurstEnd(){this.cancelResizeBurstEnd(),this.resizeBurstEndId=setTimeout(()=>{this.resizeBurstEndId=null,this.resizeBurstNeedsFinalFlush&&(this.resizeBurstNeedsFinalFlush=!1,this.notifySubscribers()),this.resizeBurstNotifyCount=0},150)}scheduleResizeNotify(){this.cancelPendingResizeNotify(),this.cancelResizeBurstEnd(),this.resizeNotifyDebounceId=setTimeout(()=>{this.resizeNotifyDebounceId=null,0===this.resizeBurstNotifyCount?(this.resizeBurstNotifyCount=1,this.resizeBurstNeedsFinalFlush=!1,this.notifySubscribers()):this.resizeBurstNeedsFinalFlush=!0,this.scheduleResizeBurstEnd()},100)}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})),this.initialNotifyPending?(this.initialNotifyPending=!1,this.cancelPendingResizeNotify(),this.notifySubscribers()):n&&this.scheduleResizeNotify()})}),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 i=!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}),i=!0}if("height"in t||"maxHeight"in t||void 0!==t.totalRowCount||void 0!==t.externalViewportHeight){const t=this.calculateContentHeight();this.state=Object.assign(Object.assign({},this.state),{contentHeight:t}),i=!0}if(t.containerElement&&t.containerElement!==n&&(this.resizeObserver&&n&&this.resizeObserver.unobserve(n),this.observeContainer(t.containerElement),i=!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}),i=!0}i&&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.cancelPendingResizeNotify(),this.cancelResizeBurstEnd(),this.resizeBurstNotifyCount=0,this.resizeBurstNeedsFinalFlush=!1,this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.subscribers.clear()}}class Kt{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,i){const o=t>this.lastScrollTop?"down":this.lastScrollTop>t?"up":"none";this.lastScrollTop=t,this.state={scrollTop:t,scrollLeft:e,scrollDirection:o,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>i-(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 _t{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.headerTouchMoveHandlers=new WeakMap,this.isSyncing=!1,this.lastMainVirtualizationScrollLeft=null,this.isTouchScrolling=!1,this.touchSettleTimeoutId=null,this.config=t}updateConfig(t){this.config=Object.assign(Object.assign({},this.config),t)}registerPane(t,e,n){var i;const o=this.panesBySection.get(t);if(Array.from(o).find(t=>t.element===e))return;const s=Array.from(o).find(t=>t.role===n);if(s&&(this.removeScrollListener(s.element),o.delete(s)),o.add({element:e,role:n}),("header"===n||"sticky"===n)&&(e.style.overflowX="hidden"),"sticky"!==n&&(this.addScrollListener(t,e,n),"body"===n&&this.addTouchTracking(t,e)),"header"===n){e.style.touchAction="none";const t=t=>t.preventDefault();this.headerTouchMoveHandlers.set(e,t),e.addEventListener("touchmove",t,{passive:!1})}const r=null!==(i=this.scrollLeftBySection[t])&&void 0!==i?i: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 i=Array.from(n).find(t=>t.element===e);i&&n.delete(i)}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,n){this.removeScrollListener(e);const i=()=>{if(this.isSyncing)return;if(this.isTouchScrolling&&"body"!==n)return;const i=e.scrollLeft;this.scrollLeftBySection[t]=i,this.isSyncing=!0;const o=this.panesBySection.get(t);o&&o.forEach(({element:t,role:n})=>{t!==e&&t.scrollLeft!==i&&("scrollbar"===n&&this.isTouchScrolling||(t.scrollLeft=i))}),this.isTouchScrolling&&this.scheduleTouchSettle(t),"main"!==t||!this.config.onMainSectionScrollLeft||null!==this.lastMainVirtualizationScrollLeft&&20>Math.abs(i-this.lastMainVirtualizationScrollLeft)||(this.lastMainVirtualizationScrollLeft=i,this.config.onMainSectionScrollLeft(i)),this.isSyncing=!1};this.scrollHandlers.set(e,i),e.addEventListener("scroll",i,{passive:!0})}addTouchTracking(t,e){e.addEventListener("touchstart",()=>{this.isTouchScrolling=!0,null!==this.touchSettleTimeoutId&&(clearTimeout(this.touchSettleTimeoutId),this.touchSettleTimeoutId=null)},{passive:!0}),e.addEventListener("touchend",()=>this.scheduleTouchSettle(t),{passive:!0})}scheduleTouchSettle(t){null!==this.touchSettleTimeoutId&&clearTimeout(this.touchSettleTimeoutId),this.touchSettleTimeoutId=window.setTimeout(()=>{var e;this.touchSettleTimeoutId=null,this.isTouchScrolling=!1;const n=null!==(e=this.scrollLeftBySection[t])&&void 0!==e?e:0,i=this.panesBySection.get(t);i&&(this.isSyncing=!0,i.forEach(({element:t,role:e})=>{"scrollbar"===e&&t.scrollLeft!==n&&(t.scrollLeft=n)}),this.isSyncing=!1)},100)}removeScrollListener(t){const e=this.scrollHandlers.get(t);e&&(t.removeEventListener("scroll",e),this.scrollHandlers.delete(t));const n=this.headerTouchMoveHandlers.get(t);n&&(t.removeEventListener("touchmove",n),this.headerTouchMoveHandlers.delete(t))}destroy(){null!==this.touchSettleTimeoutId&&(clearTimeout(this.touchSettleTimeoutId),this.touchSettleTimeoutId=null),["pinned-left","main","pinned-right"].forEach(t=>this.unregisterSection(t))}}const Ut={string:(t,e,n)=>{if(t===e)return 0;const i=t.localeCompare(e);return"asc"===n?i:-i},number:(t,e,n)=>{if(t===e)return 0;const i=t-e;return"asc"===n?i:-i},boolean:(t,e,n)=>{if(t===e)return 0;const i=t===e?0:t?-1:1;return"asc"===n?i:-i},date:(t,e,n)=>{const i=new Date(t),o=new Date(e);if(i.getTime()===o.getTime())return 0;const s=i.getTime()-o.getTime();return"asc"===n?s:-s},enum:(t,e,n)=>Ut.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?Ut.string(t,e,n):"number"==typeof t&&"number"==typeof e?Ut.number(t,e,n):"boolean"==typeof t&&"boolean"==typeof e?Ut.boolean(t,e,n):Ut.string(t+"",e+"",n)},Jt=({headers:t,rows:e,sortColumn:n})=>(({rows:t,sortColumn:e,headers:n})=>{const i=(t,e)=>{for(const n of t){if(n.accessor===e)return n;if(n.children&&n.children.length>0){const t=i(n.children,e);if(t)return t}}},o=i(n,e.key.accessor),s=(null==o?void 0:o.type)||"string",r=e.direction,l=e.key.accessor;return[...t].sort((e,n)=>{let i,a;if(null==o?void 0:o.valueGetter){const s=t.indexOf(e),r=t.indexOf(n);i=o.valueGetter({accessor:l,row:e,rowIndex:s}),a=o.valueGetter({accessor:l,row:n,rowIndex:r})}else i=ct(e,l),a=ct(n,l);return(null==o?void 0:o.comparator)?o.comparator({rowA:e,rowB:n,valueA:i,valueB:a,direction:r}):((t,e,n="string",i)=>{if(null==t||""===t)return"asc"===i?-1:1;if(null==e||""===e)return"asc"===i?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 i=null===(e=t[2])||void 0===e?void 0:e.toUpperCase();return"T"===i?n*=1e12:"B"===i?n*=1e9:"M"===i?n*=1e6:"K"===i&&(n*=1e3),n}}return parseFloat(n)||0},o=n(t),s=n(e);return Ut.number(o,s,i)}return"date"===n?Ut.date(t+"",e+"",i):"boolean"===n?Ut.boolean(!!t,!!e,i):"enum"===n?Ut.enum(t+"",e+"",i):Ut.string(t+"",e+"",i)})(i,a,s,r)})})({rows:e,sortColumn:n,headers:t}),Yt=(t,e)=>{if(0===t.length)return;if("custom"===e.type&&e.customFn)return e.customFn(t);const n=e.parseValue?t.map(e.parseValue).filter(t=>!isNaN(t)):t.map(t=>"number"==typeof t?t:"string"==typeof t?parseFloat(t):NaN).filter(t=>!isNaN(t));if(0===n.length)return"count"===e.type?t.length:void 0;let i;switch(e.type){case"sum":i=n.reduce((t,e)=>t+e,0);break;case"average":i=n.reduce((t,e)=>t+e,0)/n.length;break;case"count":i=t.length;break;case"min":i=Math.min(...n);break;case"max":i=Math.max(...n);break;default:return}return e.formatResult?e.formatResult(i):i},Xt=t=>{const{rows:e=[],headers:n=[],rowGrouping:i,rowManager:o}=t;if(o)return o.getAggregatedRows();if(!i||0===i.length)return e;const s=(t=>X(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=i[e],o=i[e+1],r=t[n];if(r&&ft(r)){const i=l(r,e+1),a=Object.assign({},t);return a[n]=i,s.forEach(t=>{const e=((t,e,n,i)=>{const o=[],s=t=>{t.forEach(t=>{const n=i?t[i]:void 0;if(i&&n&&ft(n))s(n);else{const n=ct(t,e);null!=n&&o.push(n)}})};return s(t),Yt(o,n)})(i,t.accessor,t.aggregation,o);void 0!==e&&ut(a,t.accessor,e)}),a}return t});return l(r)};class Qt{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=X(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:i}){const o=Jt({headers:e,rows:n,sortColumn:i});return t&&0!==t.length?o.map(n=>{const o=t[0],s=n[o];if(ft(s)){const r=this.sortNestedRows({rows:s,sortColumn:i,headers:e,groupingKeys:t.slice(1)});return Object.assign(Object.assign({},n),{[o]:r})}return n}):o}computeSortedRows(t,e){if(this.config.externalSortHandling)return t;const n=Xt({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}):Jt({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);ht(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,i,o;if(!t)return this.state=Object.assign(Object.assign({},this.state),{sort:null,sortedRows:this.computeSortedRows(this.config.tableRows,null)}),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 a=null;if(r)a={key:l,direction:r};else{const t=l.sortingOrder||["asc","desc",null];let e=-1;this.state.sort&&this.state.sort.key.accessor===s&&(e=t.indexOf(this.state.sort.direction));const n=t[(e+1)%t.length];a=null===n?null:{key:l,direction:n}}const d=this.computeSortedRows(this.config.tableRows,a);this.state={sort:a,sortedRows:d},null===(o=(i=this.config).onSortChange)||void 0===o||o.call(i,a),this.config.announce&&this.config.announce(a?`Sorted by ${l.label}, ${"asc"===a.direction?"ascending":"descending"}`:"Sort removed from "+l.label),this.notifySubscribers()}computeSortedRowsPreview(t){const e=n=>{for(const i of n){if(i.accessor===t)return i;if(i.children&&i.children.length>0){const t=e(i.children);if(t)return t}}},n=e(this.config.headers);if(!n)return this.config.tableRows;let i=null;const o=n.sortingOrder||["asc","desc",null];let s=-1;this.state.sort&&this.state.sort.key.accessor===t&&(s=o.indexOf(this.state.sort.direction));const r=o[(s+1)%o.length];return i=null===r?null:{key:n,direction:r},this.computeSortedRows(this.config.tableRows,i)}getState(){return this.state}getSortColumn(){return this.state.sort}getSortedRows(){return this.state.sortedRows}destroy(){this.subscribers.clear()}}const Zt=t=>{if(!t)return new Date;if(/^\d{4}-\d{2}-\d{2}$/.test(t)){const[e,n,i]=t.split("-").map(Number);return new Date(e,n-1,i,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)},te=t=>new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0),ee=t=>{if(!t)return new Date;if("string"==typeof t)return Zt(t);if("number"==typeof t){const e=new Date(t);return isNaN(e.getTime())?new Date:te(e)}return t instanceof Date?te(t):new Date};class ne{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=X(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:i,values:o}=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(),o=i?(i+"").toLowerCase():"";switch(n){case"equals":return e===o;case"notEquals":return e!==o;case"contains":return e.includes(o);case"notContains":return!e.includes(o);case"startsWith":return e.startsWith(o);case"endsWith":return e.endsWith(o)}}if("number"==typeof t||!isNaN(+t)){const e=+t,s=+i;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(o&&2===o.length){const[t,n]=o.map(Number);return e>=t&&n>=e}return!1;case"notBetween":if(o&&2===o.length){const[t,n]=o.map(Number);return t>e||e>n}return!0}}if(t instanceof Date||!isNaN(Date.parse(t))){const e=ee(t),s=ee((i||"")+""),r=te(e),l=te(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(o&&2===o.length){const[t,e]=o.map(t=>te(ee((t||"")+"")));return r>=t&&e>=r}return!1;case"notBetween":if(o&&2===o.length){const[t,e]=o.map(t=>te(ee((t||"")+"")));return t>r||r>e}return!0}}if("boolean"==typeof t&&"equals"===n)return t===!!i;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(o&&Array.isArray(o)){const e=o.includes(t+"");return"in"===n?e:!e}return!1}const s=(t+"").toLowerCase(),r=i?(i+"").toLowerCase():"";switch(n){case"equals":return s===r;case"notEquals":return s!==r;default:return!0}})(ct(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);ht(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 i=Object.assign(Object.assign({},this.state.filters),{[t.accessor]:t}),o=this.computeFilteredRows(this.config.rows,i);if(this.state={filters:i,filteredRows:o},null===(n=(e=this.config).onFilterChange)||void 0===n||n.call(e,i),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 i=Object.assign({},this.state.filters);delete i[t];const o=this.computeFilteredRows(this.config.rows,i);if(this.state={filters:i,filteredRows:o},null===(n=(e=this.config).onFilterChange)||void 0===n||n.call(e,i),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 ie="__pivotChildren",oe="__pivotIsTotal",se="__pivot:",re="(blank)",le="",ae="__total__",de=t=>null==t?re:"string"==typeof t||"number"==typeof t||"boolean"==typeof t?t:t+"",ce=t=>t+"",he=t=>t.map(ce).join(le),ue=t=>""===t?[]:t.split(le),fe=(t,e)=>t===re&&e!==re?1:e===re&&t!==re?-1:t.localeCompare(e,void 0,{numeric:!0,sensitivity:"base"}),ve=(t,e)=>t.get(e+""),pe=(t,e)=>`${se}${t}${le}${e+""}`,we=t=>pe(ae,t),me=(t,e,n)=>`${t}${le}${e}${le}${n}`,ge=({accessor:t,label:e,field:n,alignRight:i})=>{var o,s,r,l;return{accessor:t,label:e,width:null!==(o=null==n?void 0:n.width)&&void 0!==o?o:100,type:null!==(s=null==n?void 0:n.type)&&void 0!==s?s:"number",align:i?"right":null!==(r=null==n?void 0:n.align)&&void 0!==r?r:"right",sortable:null===(l=null==n?void 0:n.sortable)||void 0===l||l,filterable:!1,editable:!1,valueFormatter:null==n?void 0:n.valueFormatter,valueGetter:null==n?void 0:n.valueGetter,minWidth:null==n?void 0:n.minWidth,maxWidth:null==n?void 0:n.maxWidth}},be=(t,e,n,i,o)=>{const s=`${le}${n}${le}${i}`,r=[];if(o){const n=t.get(`${e}${s}`);return n&&r.push(...n),r}for(const[n,i]of t){if(!n.endsWith(s))continue;const t=n.slice(0,n.length-s.length);(""===e||t===e||t.startsWith(e+le))&&r.push(...i)}return r},xe=({row:t,buckets:e,rowKeyPrefix:n,colKeys:i,values:o,showRowTotals:s,exactRowKey:r})=>{for(const s of i)o.forEach((i,o)=>{const l=be(e,n,s,o,r),a=Yt(l,i.aggregation);void 0!==a&&(t[pe(s,i.accessor)]=a)});s&&o.forEach((o,s)=>{const l=[];for(const t of i)l.push(...be(e,n,t,s,r));0===i.length&&l.push(...be(e,n,"",s,r));const a=Yt(l,o.aggregation);void 0!==a&&(t[we(o.accessor)]=a)})},ye=({rowDims:t,prefixParts:e,distinctRowKeys:n,buckets:i,colKeys:o,values:s,showRowTotals:r})=>{const l=e.length;if(l>=t.length)return[];const a=he(e),d=l,c=new Map;for(const t of n){const e=ue(t);if(""!==a&&t!==a&&!t.startsWith(a+le))continue;if(d>=e.length)continue;const n=e[d];c.set(ce(n),n)}const h=Array.from(c.keys()).sort(fe),u=l===t.length-1;return h.map(a=>{const d=c.get(a),h=[...e,d],f=he(h),v={};if(t.forEach((t,e)=>{e>l||(v[t]=h[e])}),u)return xe({row:v,buckets:i,rowKeyPrefix:f,colKeys:o,values:s,showRowTotals:r,exactRowKey:!0}),v;const p=ye({rowDims:t,prefixParts:h,distinctRowKeys:n,buckets:i,colKeys:o,values:s,showRowTotals:r});return v[ie]=p,xe({row:v,buckets:i,rowKeyPrefix:f,colKeys:o,values:s,showRowTotals:r,exactRowKey:!1}),v})},Re=({rows:t,pivot:e,fieldHeaders:n})=>{var i,o;if(!e.values||0===e.values.length)throw Error("pivot.values must contain at least one measure");const s=null!==(i=e.rows)&&void 0!==i?i:[],r=null!==(o=e.columns)&&void 0!==o?o:[],l=e.values,a=!1!==e.showRowTotals,d=!1!==e.showColumnTotals,c=!1!==e.showGrandTotal,h=new Map;for(const t of X(n))h.set(t.accessor+"",t);const u=new Map,f=new Set,v=new Set;for(const e of t){const t=s.map(t=>de(ct(e,t))),n=r.map(t=>de(ct(e,t))),i=he(t),o=he(n);f.add(i),v.add(o),l.forEach((t,n)=>{const s=ct(e,t.accessor);if(null==s)return;const r=me(i,o,n);let l=u.get(r);l||(l=[],u.set(r,l)),l.push(s)})}const p=Array.from(f).sort((t,e)=>{var n,i;const o=ue(t),s=ue(e),r=Math.max(o.length,s.length);for(let t=0;r>t;t++){const e=fe(null!==(n=o[t])&&void 0!==n?n:"",null!==(i=s[t])&&void 0!==i?i:"");if(0!==e)return e}return 0}),w=Array.from(v).sort((t,e)=>{var n,i;const o=ue(t),s=ue(e),r=Math.max(o.length,s.length);for(let t=0;r>t;t++){const e=fe(null!==(n=o[t])&&void 0!==n?n:"",null!==(i=s[t])&&void 0!==i?i:"");if(0!==e)return e}return 0}),m=0===r.length?[""]:w,g=a&&r.length>0,b=(({colKeys:t,values:e,catalog:n,showRowTotals:i})=>{var o,s;const r=e.length>1,l=[],a={label:"",children:new Map};for(const e of t){const t=ue(e);if(0===t.length)continue;let n=a;for(const e of t){let t=n.children.get(e);t||(t={label:e,children:new Map},n.children.set(e,t)),n=t}n.colKey=e}const d=(t,i)=>Array.from(t.children.entries()).sort(([t],[e])=>fe(t,e)).map(([t,o])=>{const s=i?`${i}${le}${t}`:t;if(void 0!==o.colKey&&0===o.children.size){if(!r){const i=e[0],s=ve(n,i.accessor);return ge({accessor:pe(o.colKey,i.accessor),label:t,field:s,alignRight:!0})}return{accessor:"__pivotGroup:"+o.colKey,label:t,width:100,children:e.map(t=>{var e,i;const s=ve(n,t.accessor);return ge({accessor:pe(o.colKey,t.accessor),label:null!==(i=null!==(e=t.label)&&void 0!==e?e:null==s?void 0:s.label)&&void 0!==i?i:t.accessor+"",field:s,alignRight:!0})})}}return{accessor:"__pivotGroup:"+s,label:t,width:100,children:d(o,s)}});if(0===t.length||1===t.length&&""===t[0])for(const t of e){const e=ve(n,t.accessor);l.push(ge({accessor:pe("",t.accessor),label:null!==(s=null!==(o=t.label)&&void 0!==o?o:null==e?void 0:e.label)&&void 0!==s?s:t.accessor+"",field:e,alignRight:!0}))}else l.push(...d(a,""));if(i)if(r)l.push({accessor:"__pivotGroup:"+ae,label:"Total",width:100,children:e.map(t=>{var e,i;const o=ve(n,t.accessor);return ge({accessor:we(t.accessor),label:null!==(i=null!==(e=t.label)&&void 0!==e?e:null==o?void 0:o.label)&&void 0!==i?i:t.accessor+"",field:o,alignRight:!0})})});else{const t=e[0],i=ve(n,t.accessor);l.push(ge({accessor:we(t.accessor),label:"Total",field:i,alignRight:!0}))}return l})({colKeys:0===r.length?[]:w,values:l,catalog:h,showRowTotals:g}),x=((t,e,n)=>t.map((t,i)=>{var o,s,r,l,a;const d=ve(e,t);return{accessor:t,label:null!==(o=null==d?void 0:d.label)&&void 0!==o?o:t+"",width:null!==(s=null==d?void 0:d.width)&&void 0!==s?s:140,type:null!==(r=null==d?void 0:d.type)&&void 0!==r?r:"string",align:null!==(l=null==d?void 0:d.align)&&void 0!==l?l:"left",pinned:"left",sortable:null===(a=null==d?void 0:d.sortable)||void 0===a||a,filterable:null==d?void 0:d.filterable,expandable:!(!n||0!==i)||(null==d?void 0:d.expandable),valueFormatter:null==d?void 0:d.valueFormatter,valueGetter:null==d?void 0:d.valueGetter,minWidth:null==d?void 0:d.minWidth,maxWidth:null==d?void 0:d.maxWidth}}))(s,h,s.length>1),y=[...x,...b];let R;if(0===s.length){const t={};xe({row:t,buckets:u,rowKeyPrefix:"",colKeys:m,values:l,showRowTotals:g&&c,exactRowKey:!1}),R=[t]}else R=ye({rowDims:s,prefixParts:[],distinctRowKeys:p,buckets:u,colKeys:m,values:l,showRowTotals:g});if(d&&s.length>0){const t={[oe]:!0};t[s[0]]="Total",xe({row:t,buckets:u,rowKeyPrefix:"",colKeys:m,values:l,showRowTotals:g&&c,exactRowKey:!1}),R=[...R,t]}return{rows:R,headers:y,rowGrouping:s.length>1?Array.from({length:s.length-1},()=>ie):void 0}};class Se{constructor(t){this.subscribers=new Set,this.cacheKey="",this.config=t,this.state=this.computeState(t),this.cacheKey=this.buildCacheKey(t)}buildCacheKey(t){return`${e=t.pivot,e?JSON.stringify({rows:e.rows,columns:e.columns,values:e.values.map(t=>({accessor:t.accessor,label:t.label,type:t.aggregation.type})),showRowTotals:!1!==e.showRowTotals,showColumnTotals:!1!==e.showColumnTotals,showGrandTotal:!1!==e.showGrandTotal}):""}|rows:${t.sourceRows.length}|hdr:${t.fieldHeaders.length}`;var e}computeState(t){var e;const n=null!==(e=t.pivot)&&void 0!==e?e:null;if(!n||!n.values||0===n.values.length)return{active:!1,pivotedRows:t.sourceRows,headers:t.fieldHeaders,rowGrouping:void 0,pivot:null};let i;try{i=Re({rows:t.sourceRows,pivot:n,fieldHeaders:t.fieldHeaders})}catch(e){return{active:!1,pivotedRows:t.sourceRows,headers:t.fieldHeaders,rowGrouping:void 0,pivot:null}}return{active:!0,pivotedRows:i.rows,headers:i.headers,rowGrouping:i.rowGrouping,pivot:n}}getState(){return this.state}isActive(){return this.state.active}getPivot(){return this.state.pivot}updateConfig(t){const e=Object.assign(Object.assign({},this.config),t),n=this.buildCacheKey(e),i=void 0!==t.sourceRows&&t.sourceRows!==this.config.sourceRows,o=void 0!==t.fieldHeaders&&t.fieldHeaders!==this.config.fieldHeaders,s=void 0!==t.pivot&&t.pivot!==this.config.pivot;this.config=e,(i||o||s||n!==this.cacheKey)&&(this.cacheKey=n,this.state=this.computeState(this.config),this.notifySubscribers())}setPivot(t){this.updateConfig({pivot:t})}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}notifySubscribers(){this.subscribers.forEach(t=>t(this.state))}destroy(){this.subscribers.clear()}}const Ce=(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 i=0,o=n.length-1;for(;o>i;){const e=Math.floor((i+o+1)/2);n[e]>t?o=e-1:i=e}return i},Me=(t,e)=>{if(!e||0===e.length)return 0;let n=0,i=0,o=e.length;for(;o>i;){const n=Math.floor((i+o)/2);t>e[n][0]?i=n+1:o=n}for(let t=0;i>t;t++)n+=e[t][1];return n},Ie=({bufferRowCount:t,contentHeight:e,rowHeight:n,scrollTop:i,tableRows:o,scrollDirection:s="none",heightMap:r})=>{const l=n+1;if(!r){const n=t*l;let r=n,a=n;"down"===s?(r=Math.max(l,.1*n),a=.9*n):"up"===s&&(r=.9*n,a=Math.max(l,.1*n));const d=i+e+a,c=Math.max(0,Math.floor(Math.max(0,i-r)/l)),h=Math.min(o.length,Math.ceil(d/l)),u=i+e,f=Math.max(0,Math.ceil(i/l)),v=Math.min(o.length,Math.floor(u/l)),p=i+e,w=Math.max(0,Math.floor(i/l)),m=Math.min(o.length,Math.ceil(p/l));return{rendered:{startIndex:c,endIndex:h,rows:o.slice(c,h)},fullyVisible:{startIndex:f,endIndex:v,rows:o.slice(f,v)},partiallyVisible:{startIndex:w,endIndex:m,rows:o.slice(w,m)}}}const{rowTopPositions:a}=r,d=t*l;let c=d,h=d;"down"===s?(c=Math.max(l,.1*d),h=.9*d):"up"===s&&(c=.9*d,h=Math.max(l,.1*d));const u=i+e+h,f=Ce(Math.max(0,i-c),r);let v=Ce(u,r)+1;v=Math.min(o.length,v);const p=i,w=i+e;let m=Ce(p,r);p>a[m]&&(m=Math.min(m+1,o.length));let g=Ce(w,r);g=Math.min(o.length,g);const b=i+e,x=Ce(i,r);let y=Ce(b,r)+1;return y=Math.min(o.length,y),{rendered:{startIndex:f,endIndex:v,rows:o.slice(f,v)},fullyVisible:{startIndex:m,endIndex:g,rows:o.slice(m,g)},partiallyVisible:{startIndex:x,endIndex:y,rows:o.slice(x,y)}}},He=({position:t,rowHeight:e,heightOffsets:n,customTheme:i})=>t*(e+i.rowSeparatorWidth)-i.rowSeparatorWidth+Me(t,n),ke=({position:t,rowHeight:e,heightOffsets:n,customTheme:i})=>t*(e+i.rowSeparatorWidth)+Me(t,n),Te=(t,e)=>{var n,i;const o=t.position,s=e[o+1];return null!==(i=null===(n=null==s?void 0:s.parentIndices)||void 0===n?void 0:n.includes(o))&&void 0!==i&&i},Ee=new Map,Ae=t=>{var e;return t?null!==(e=t.stableRowKey)&&void 0!==e?e:pt(t.rowId):""},We=(t,e,n,i,o)=>{var s,r,l,a,d,c;const h=null!==(r=null===(s=i[0])||void 0===s?void 0:s.position)&&void 0!==r?r:-1,u=null!==(a=null===(l=e[0])||void 0===l?void 0:l.position)&&void 0!==a?a:-1,f=null!==(c=null===(d=e[e.length-1])||void 0===d?void 0:d.position)&&void 0!==c?c:-1,v=[Ae(t[h]),Ae(t[u]),Ae(t[f]),Ae(t[0]),t.length+""].join("|"),p=`${h}:${u}:${f}:${o.join(",")}:${v}`,w=Ee.get(p);if(w&&w.firstVisiblePosition===h&&w.renderedStartPosition===u&&w.renderedEndPosition===f){const n=[];let i=!0;for(const e of w.result.stickyParents){const o=t[e.position];if(!o||Ae(o)!==Ae(e)){i=!1;break}n.push(o)}if(i)return{stickyParents:n,regularRows:e};Ee.delete(p)}const m=Oe({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:i,partiallyVisibleRowIndex:0,recursionDepth:0,stickyParents:[],rowGrouping:o});if(Ee.set(p,{result:m,firstVisiblePosition:h,renderedStartPosition:u,renderedEndPosition:f}),Ee.size>50){const t=Ee.keys().next().value;void 0!==t&&Ee.delete(t)}return m},Oe=({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:i,partiallyVisibleRowIndex:o,recursionDepth:s,stickyParents:r,rowGrouping:l})=>{let a=i[o];if(!a||s>10)return{stickyParents:r,regularRows:e};let d=0;if(a.parentIndices&&a.parentIndices.length>0){for(const e of a.parentIndices){const i=t[e];if(i){const e=n.some(t=>t.position===i.position);if(a.rowIndexPath&&a.rowIndexPath.length>0){const e=t[a.parentIndices[a.parentIndices.length-1]],n=e.row[l[e.depth]];if(r.length>=(Array.isArray(n)?n:[]).length-a.rowIndexPath[a.rowIndexPath.length-1])break}e||r.some(t=>pt(t.rowId)===pt(i.rowId))||(r.push(i),d++)}}if(r.length>0){Te(a,t)&&(r.push(a),d++);const e=i[o+=d];e&&(a=e)}}else if(Te(a,t))return r.push(a),o++,Oe({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:i,partiallyVisibleRowIndex:o,recursionDepth:s+1,stickyParents:r,rowGrouping:l});return Te(a,t)?Oe({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:i,partiallyVisibleRowIndex:o,recursionDepth:s+1,stickyParents:r,rowGrouping:l}):{stickyParents:r,regularRows:e}},Pe=(t,e,n)=>{const i=t.getBoundingClientRect(),o=e.getBoundingClientRect(),s=10;if(o.top+s>i.top?e.scrollTop-=o.top-i.top+s:i.bottom>o.bottom-s&&(e.scrollTop+=i.bottom-o.bottom+s),n){const t=n.getBoundingClientRect();t.left+s>i.left?n.scrollLeft-=t.left-i.left+s:i.right>t.right-s&&(n.scrollLeft+=i.right-t.right+s)}},$e=(t,e,n,i)=>{const o=document.querySelector(".st-body-container"),s=document.querySelector(".st-body-main");if(!o)return;const r=i?i.findIndex(e=>pt(e.rowId)===t.rowId+""):-1,l=0>r?t.rowIndex:r,a=e+n.rowSeparatorWidth,d=o.querySelector(`.st-cell[data-row-id="${t.rowId}"][data-col-index="${t.colIndex}"]`);if(d&&i){const t=((t,e,n,i)=>{const o=Ie({bufferRowCount:0,contentHeight:e.clientHeight,rowHeight:n,scrollTop:e.scrollTop,tableRows:i,scrollDirection:"none"}),{startIndex:s,endIndex:r}=o.fullyVisible;return t>=s&&r>t})(l,o,e,i);if(t)return void Pe(d,o,s)}if(!d)return o.scrollTop=Math.max(0,l*a-o.clientHeight/3),void setTimeout(()=>{const e=o.querySelector(`.st-cell[data-row-id="${t.rowId}"][data-col-index="${t.colIndex}"]`);e&&Pe(e,o,s)},100);Pe(d,o,s)},Fe=({rowIndex:t,colIndex:e,rowId:n})=>`${t}-${e}-${n}`;function Le(t,e,n,i){const o=new Set,s=new Map;n.forEach((t,e)=>{const n=pt(t.rowId);s.set(n,e)});const r=s.get(t.rowId+""),l=s.get(e.rowId+""),a=void 0!==r?r:t.rowIndex,d=void 0!==l?l:e.rowIndex,c=Math.min(a,d),h=Math.max(a,d),u=Math.min(t.colIndex,e.colIndex),f=Math.max(t.colIndex,e.colIndex);for(let t=c;h>=t;t++)for(let e=u;f>=e;e++)if(t>=0&&n.length>t){if(i&&0===e)continue;const s=pt(n[t].rowId);o.add(Fe({colIndex:e,rowIndex:t,rowId:s}))}return o}function De(t,e,n=document){var i,o,s;const r=n,l=r.querySelector(".st-body-container");if(!l)return null;const a=l.getBoundingClientRect(),d=Math.max(a.left,Math.min(a.right,t)),c=Math.max(a.top,Math.min(a.bottom,e)),h=r.querySelectorAll(".st-cell[data-row-index][data-col-index][data-row-id]:not(.st-selection-cell)");if(0===h.length)return null;const u=new Map;for(let t=0;h.length>t;t++){const e=h[t],n=e.getAttribute("data-row-id"),o=null!==(i=null!=n?n:e.getAttribute("data-row-index"))&&void 0!==i?i:"";if(!o)continue;let s=u.get(o);s||(s=[],u.set(o,s)),s.push(e)}const f=[];u.forEach((t,e)=>{const n=t[0].getBoundingClientRect();f.push({key:e,top:n.top,bottom:n.bottom})}),f.sort((t,e)=>t.top-e.top);let v=null,p=1/0;for(let t=0;f.length>t;t++){const{key:e,top:n,bottom:i}=f[t];if(c>=n&&i>=c){v=e,p=0;break}const o=Math.abs(c-(n+i)/2);p>o&&(p=o,v=e)}if(null===v)return null;const w=u.get(v);if(!w||0===w.length)return null;let m=null,g=1/0;for(let t=0;w.length>t;t++){const e=w[t],n=parseInt(null!==(o=e.getAttribute("data-row-index"))&&void 0!==o?o:"-1",10),i=parseInt(null!==(s=e.getAttribute("data-col-index"))&&void 0!==s?s:"-1",10),r=e.getAttribute("data-row-id");if(0>n||0>i||null==r||""===r)continue;const l=e.getBoundingClientRect(),a=Math.sqrt((l.left+l.width/2-d)**2+(l.top+l.height/2-c)**2);g>a&&(g=a,m=e)}if(null!==m){const t=parseInt(m.getAttribute("data-row-index")||"-1",10),e=parseInt(m.getAttribute("data-col-index")||"-1",10),n=m.getAttribute("data-row-id");if(t>=0&&e>=0&&null!==n)return{rowIndex:t,colIndex:e,rowId:n}}return null}class je{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=>St(t,this.config.collapsedHeaders)),this.rowIdToTableIndex.clear(),this.config.tableRows.forEach((t,e)=>{this.rowIdToTableIndex.set(pt(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(pt(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(`${pt(e.rowId)}\t${t}`),this.rowsWithSelectedCells.add(pt(e.rowId))})})}updateRowIdAndSelectionLookupOnly(){this.rowIdToTableIndex.clear(),this.config.tableRows.forEach((t,e)=>{this.rowIdToTableIndex.set(pt(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(`${pt(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:i}=this.initialFocusedCell;const o=this.config.tableRows[e];if((o?pt(o.rowId):null)!==i){const t=this.config.tableRows.findIndex(t=>pt(t.rowId)===i);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,i,o,s){let r=i,l=o;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 i=e-1;if((t.ctrlKey||t.metaKey)&&(i=this.findEdgeInDirection(e,n,"up").rowIndex),i>=0){const t=pt(this.config.tableRows[i].rowId);this.selectCellRange(this.startCell,{rowIndex:i,colIndex:n,rowId:t})}}else if(e>0){let i=e-1;(t.ctrlKey||t.metaKey)&&(i=this.findEdgeInDirection(e,n,"up").rowIndex);const o=pt(this.config.tableRows[i].rowId);this.selectSingleCell({rowIndex:i,colIndex:n,rowId:o}),this.startCell=null}}handleArrowDown(t,e,n){if(t.shiftKey){this.startCell||(this.startCell=this.initialFocusedCell);let i=e+1;if((t.ctrlKey||t.metaKey)&&(i=this.findEdgeInDirection(e,n,"down").rowIndex),this.config.tableRows.length>i){const t=pt(this.config.tableRows[i].rowId);this.selectCellRange(this.startCell,{rowIndex:i,colIndex:n,rowId:t})}}else if(this.config.tableRows.length-1>e){let i=e+1;(t.ctrlKey||t.metaKey)&&(i=this.findEdgeInDirection(e,n,"down").rowIndex);const o=pt(this.config.tableRows[i].rowId);this.selectSingleCell({rowIndex:i,colIndex:n,rowId:o}),this.startCell=null}}handleArrowLeft(t,e,n){if(t.shiftKey&&"ArrowLeft"===t.key){this.startCell||(this.startCell=this.initialFocusedCell);let i=n-1;if(t.ctrlKey||t.metaKey)i=this.findEdgeInDirection(e,n,"left").colIndex;else if(this.config.enableRowSelection&&0===i)return;if(i>=0){const t=pt(this.config.tableRows[e].rowId);this.selectCellRange(this.startCell,{rowIndex:e,colIndex:i,rowId:t})}}else if(n>0){let i=n-1;if((t.ctrlKey||t.metaKey)&&"ArrowLeft"===t.key)i=this.findEdgeInDirection(e,n,"left").colIndex;else if(this.config.enableRowSelection&&0===i)return;if(i>=0){const t=pt(this.config.tableRows[e].rowId);this.selectSingleCell({rowIndex:e,colIndex:i,rowId:t}),this.startCell=null}}}handleArrowRight(t,e,n){const i=this.config.enableRowSelection?this.leafHeaders.length:this.leafHeaders.length-1;if(t.shiftKey&&"ArrowRight"===t.key){this.startCell||(this.startCell=this.initialFocusedCell);let o=n+1;if((t.ctrlKey||t.metaKey)&&(o=this.findEdgeInDirection(e,n,"right").colIndex),i>=o){const t=pt(this.config.tableRows[e].rowId);this.selectCellRange(this.startCell,{rowIndex:e,colIndex:o,rowId:t})}}else if(i>n){let o=n+1;if((t.ctrlKey||t.metaKey)&&"ArrowRight"===t.key&&(o=this.findEdgeInDirection(e,n,"right").colIndex),i>=o){const t=pt(this.config.tableRows[e].rowId);this.selectSingleCell({rowIndex:e,colIndex:o,rowId:t}),this.startCell=null}}}handleHome(t,e,n){if(t.shiftKey){this.startCell||(this.startCell=this.initialFocusedCell);let n=e;const i=this.config.enableRowSelection?1:0;(t.ctrlKey||t.metaKey)&&(n=0);const o=pt(this.config.tableRows[n].rowId);this.selectCellRange(this.startCell,{rowIndex:n,colIndex:i,rowId:o})}else{let n=e;const i=this.config.enableRowSelection?1:0;(t.ctrlKey||t.metaKey)&&(n=0);const o=pt(this.config.tableRows[n].rowId);this.selectSingleCell({rowIndex:n,colIndex:i,rowId:o}),this.startCell=null}}handleEnd(t,e,n){if(t.shiftKey){this.startCell||(this.startCell=this.initialFocusedCell);let n=e;const i=this.config.enableRowSelection?this.leafHeaders.length:this.leafHeaders.length-1;(t.ctrlKey||t.metaKey)&&(n=this.config.tableRows.length-1);const o=pt(this.config.tableRows[n].rowId);this.selectCellRange(this.startCell,{rowIndex:n,colIndex:i,rowId:o})}else{let n=e;const i=this.config.enableRowSelection?this.leafHeaders.length:this.leafHeaders.length-1;(t.ctrlKey||t.metaKey)&&(n=this.config.tableRows.length-1);const o=pt(this.config.tableRows[n].rowId);this.selectSingleCell({rowIndex:n,colIndex:i,rowId:o}),this.startCell=null}}handlePageUp(t,e,n){let i=Math.max(0,e-10);if(t.shiftKey){this.startCell||(this.startCell=this.initialFocusedCell);const t=pt(this.config.tableRows[i].rowId);this.selectCellRange(this.startCell,{rowIndex:i,colIndex:n,rowId:t})}else{const t=pt(this.config.tableRows[i].rowId);this.selectSingleCell({rowIndex:i,colIndex:n,rowId:t}),this.startCell=null}}handlePageDown(t,e,n){let i=Math.min(this.config.tableRows.length-1,e+10);if(t.shiftKey){this.startCell||(this.startCell=this.initialFocusedCell);const t=pt(this.config.tableRows[i].rowId);this.selectCellRange(this.startCell,{rowIndex:i,colIndex:n,rowId:t})}else{const t=pt(this.config.tableRows[i].rowId);this.selectSingleCell({rowIndex:i,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,i=!1)=>{const o=this.leafHeaders.filter(t=>!Z(t)),s=new Map,r=new Map;o.forEach((t,e)=>{s.set(e,t.accessor),r.set(e,t)});const l=Array.from(t).reduce((t,e)=>{var i;const[o,l]=e.split("-").map(Number);t[o]||(t[o]=[]);const a=s.get(l),d=r.get(l);if(a&&(null===(i=n[o])||void 0===i?void 0:i.row)){const e=n[o].row,i=ct(e,a);if(!1!==(null==d?void 0:d.useFormattedValueForClipboard)&&(null==d?void 0:d.valueFormatter)){const n=d.valueFormatter({accessor:a,colIndex:l,row:e,rowIndex:o,value:i});t[o][l]=n}else t[o][l]=!d||"lineAreaChart"!==d.type&&"barChart"!==d.type?i:Array.isArray(i)?i.join(", "):""}else t[o][l]="";return t},{}),a=new Set;i&&Array.from(t).forEach(t=>{const[,e]=t.split("-").map(Number);a.add(e)});let d="";i&&a.size>0&&(d=Array.from(a).sort((t,e)=>t-e).map(t=>{var e;const n=r.get(t);return null!==(e=null==n?void 0:n.label)&&void 0!==e?e:""}).join("\t"));const c=Object.values(l).map(t=>Object.values(t).join("\t")).join("\n");return i&&d?`${d}\n${c}`:c})(t,0,this.config.tableRows,this.config.copyHeadersToClipboard);navigator.clipboard.writeText(e),this.copyFlashCells=new Set(t),this.updateCellFlashClasses(),setTimeout(()=>{this.copyFlashCells=new Set,this.updateCellFlashClasses()},800)}async pasteFromClipboard(){if(this.initialFocusedCell)try{const t=await navigator.clipboard.readText();if(!t)return;const{updatedCells:e,warningCells:n}=((t,e,n,i,o,s)=>{const r=new Set,l=new Set,a=t.split("\n").filter(t=>t.length>0);if(0===a.length)return{updatedCells:r,warningCells:l};const d=n.filter(t=>!Z(t)),c=i.findIndex(t=>pt(t.rowId)===e.rowId+""),h=0>c?e.rowIndex:c,u=e.colIndex;return a.forEach((t,e)=>{t.split("\t").forEach((t,n)=>{var a;const c=h+e,f=u+n;if(c>=i.length||f>=d.length)return;const v=i[c],p=d[f],w=pt(v.rowId);if(!(null==p?void 0:p.editable))return void l.add(`${c}-${f}-${w}`);let m=t;if("number"===p.type){const e=+t;isNaN(e)||(m=e)}else if("boolean"===p.type)m="true"===t.toLowerCase()||"1"===t;else if("date"===p.type){const e=new Date(t);isNaN(e.getTime())||(m=e)}else"lineAreaChart"!==p.type&&"barChart"!==p.type||(m=t.split(",").map(t=>{const e=+t.trim();return isNaN(e)?0:e}));if(ut(v.row,p.accessor,m),s){const t=`${null!==(a=v.stableRowKey)&&void 0!==a?a:w}-${p.accessor}`,e=s.get(t);e&&e.updateContent(m)}null==o||o({accessor:p.accessor,newValue:m,row:v.row,rowIndex:c}),r.add(`${c}-${f}-${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,i,o)=>{const s=new Set,r=new Set,l=e.filter(t=>!Z(t)),a=new Map;return l.forEach((t,e)=>{a.set(e,t.accessor)}),Array.from(t).forEach(t=>{var e;const[a,d]=t.split("-").map(Number);if(a>=n.length||d>=l.length)return;const c=n[a],h=l[d],u=pt(c.rowId);if(!(null==h?void 0:h.editable))return void r.add(t);let f=null;if(f="string"===h.type?"":"number"===h.type?null:"boolean"!==h.type&&("date"===h.type?null:"lineAreaChart"===h.type||"barChart"===h.type||Array.isArray(ct(c.row,h.accessor))?[]:""),ut(c.row,h.accessor,f),o){const t=`${null!==(e=c.stableRowKey)&&void 0!==e?e:u}-${h.accessor}`,n=o.get(t);n&&n.updateContent(f)}null==i||i({accessor:h.accessor,newValue:f,row:c.row,rowIndex:a}),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 i=this.config.enableRowSelection?n+1:n,o=pt(this.config.tableRows[e].rowId);t.add(`${e}-${i}-${o}`)}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),i=t.getAttribute("data-row-id");if(0>e||0>n||!i)return;const o=Fe({rowIndex:e,colIndex:n,rowId:i}),s=this.isInitialFocusedCell({rowIndex:e,colIndex:n,rowId:i});this.copyFlashCells.has(o)?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(o)?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 X(this.config.headers))n.set(t.accessor+"",t);for(let t=0;e.length>t;t++){const i=e[t];if(!(i instanceof HTMLElement))continue;const o=i.getAttribute("data-accessor"),s=i.getAttribute("aria-colindex");if(!o||!s)continue;const r=parseInt(s,10)-1;if(0>r||Number.isNaN(r))continue;const l=n.get(o);if(!l){for(const t of je.HEADER_SELECTION_CLASSES)i.classList.remove(t);continue}if(l.isSelectionColumn&&this.config.enableRowSelection){for(const t of je.HEADER_SELECTION_CLASSES)i.classList.remove(t);continue}const a=J(l,r),d=a.some(t=>this.selectedColumns.has(t)),c=!d&&a.some(t=>this.columnsWithSelectedCells.has(t));if(d)i.classList.add("st-header-selected"),i.classList.remove("st-header-has-highlighted-cell");else if(c)i.classList.add("st-header-has-highlighted-cell"),i.classList.remove("st-header-selected");else for(const t of je.HEADER_SELECTION_CLASSES)i.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 je.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 i=parseInt(n.getAttribute("data-row-index")||"-1",10),o=parseInt(n.getAttribute("data-col-index")||"-1",10),s=n.getAttribute("data-row-id");if(0>i||0>o||!s)continue;const r={rowIndex:i,colIndex:o,rowId:s},l=this.isSelected(r),a=this.selectedColumns.has(o),d=l&&!a,c=this.isInitialFocusedCell(r),h=this.getBorderClass(r),u=new Set;d&&(u.add(c?"st-cell-selected-first":"st-cell-selected"),h.split(" ").filter(Boolean).forEach(t=>u.add(t))),a&&u.add(c?"st-cell-column-selected-first":"st-cell-column-selected");for(const t of je.SELECTION_CLASSES){const e=u.has(t),i=n.classList.contains(t);e&&!i?n.classList.add(t):!e&&i&&n.classList.remove(t)}const f=c?"0":"-1";if(n.getAttribute("tabindex")!==f&&n.setAttribute("tabindex",f),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 je.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 i=n+"";if(this.selectedByRowIdColIndex.has(`${i}\t${t}`))return!0;const o=this.rowIdToTableIndex.get(i);if(void 0!==o){const e=Fe({rowIndex:o,colIndex:t,rowId:i});if(this.selectedCells.has(e))return!0}const s=Fe({colIndex:t,rowIndex:e,rowId:n});return this.selectedCells.has(s)}getBorderClass({colIndex:t,rowIndex:e,rowId:n}){var i;if(this.isSelecting)return"";const o=null!==(i=this.rowIdToTableIndex.get(n+""))&&void 0!==i?i:e;if(this.fullTableSelected){const e=this.config.enableRowSelection?1:0,n=this.config.enableRowSelection?this.leafHeaders.length:this.leafHeaders.length-1,i=[];return 0===o&&i.push("st-selected-top-border"),o===this.config.tableRows.length-1&&i.push("st-selected-bottom-border"),t===e&&i.push("st-selected-left-border"),t===n&&i.push("st-selected-right-border"),i.join(" ")}const s=[],r=this.config.tableRows[o-1],l=r?pt(r.rowId):null,a=this.config.tableRows[o+1],d=a?pt(a.rowId):null,c=null!==l&&this.isSelected({colIndex:t,rowIndex:o-1,rowId:l}),h=null!==d&&this.isSelected({colIndex:t,rowIndex:o+1,rowId:d}),u=this.isSelected({colIndex:t-1,rowIndex:o,rowId:n}),f=this.isSelected({colIndex:t+1,rowIndex:o,rowId:n});return(!l||!c||this.selectedColumns.has(t)&&0===o)&&s.push("st-selected-top-border"),(!d||!h||this.selectedColumns.has(t)&&o===this.config.tableRows.length-1)&&s.push("st-selected-bottom-border"),u||s.push("st-selected-left-border"),f||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 i=Fe({colIndex:t,rowIndex:e,rowId:n});return this.copyFlashCells.has(i)}isWarningFlashing({colIndex:t,rowIndex:e,rowId:n}){const i=Fe({colIndex:t,rowIndex:e,rowId:n});return this.warningFlashCells.has(i)}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=Fe(t);this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.selectedCells=new Set([e]),this.initialFocusedCell=t,this.updateDerivedState(),this.updateAllCellClasses(),setTimeout(()=>$e(t,this.config.rowHeight,this.config.customTheme,this.config.tableRows),0)}}selectCellRange(t,e){this.fullTableSelected=!1;const n=Le(t,e,this.config.tableRows,!!this.config.enableRowSelection);this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.selectedCells=n,this.startCell=t,this.initialFocusedCell=e,this.updateDerivedState(),this.updateAllCellClasses(),setTimeout(()=>$e(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=Le(t,e,this.config.tableRows,!!this.config.enableRowSelection);this.initialFocusedCell=e,this.selectedCells.size===n.size&&Array.from(n).every(t=>this.selectedCells.has(t))||(this.selectedCells=n,this.updateDerivedState(),this.updateAllCellClasses())}getCellFromMousePosition(t,e){var n;return function(t,e,n=document){const i=document.elementFromPoint(t,e);if(!i)return null;const o=i.closest(".st-cell");if(o instanceof HTMLElement){if(!n.contains(o))return De(t,e,n);const i=parseInt(o.getAttribute("data-row-index")||"-1",10),s=parseInt(o.getAttribute("data-col-index")||"-1",10),r=o.getAttribute("data-row-id");if(i>=0&&s>=0&&null!==r)return{rowIndex:i,colIndex:s,rowId:r}}return De(t,e,n)}(t,e,null!==(n=this.config.tableRoot)&&void 0!==n?n:document)}handleAutoScroll(t,e){var n;!function(t,e,n=document){const i=n.querySelector(".st-body-container");if(!i)return;const o=i.getBoundingClientRect(),s=Math.max(0,i.scrollHeight-i.clientHeight);o.top+50>e?i.scrollTop=Math.max(0,i.scrollTop-10*Math.min(3,1+Math.max(0,o.top-e)/100)):e>o.bottom-50&&(i.scrollTop=Math.min(s,i.scrollTop+10*Math.min(3,1+Math.max(0,e-o.bottom)/100)));const r=n.querySelector(".st-body-main");if(r){const e=Math.max(0,r.scrollWidth-r.clientWidth);o.left+50>t?r.scrollLeft=Math.max(0,r.scrollLeft-10*Math.min(3,1+Math.max(0,o.left-t)/100)):t>o.right-50&&(r.scrollLeft=Math.min(e,r.scrollLeft+10*Math.min(3,1+Math.max(0,t-o.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}){if(!this.config.selectableCells)return;this.fullTableSelected=!1,this.isSelecting=!0,this.startCell={rowIndex:e,colIndex:t,rowId:n},this.initialFocusedCell={rowIndex:e,colIndex:t,rowId:n};const i=Fe({colIndex:t,rowIndex:e,rowId:n});this.selectedCells=new Set([i]),setTimeout(()=>{this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.selectedCells.size>1||(this.selectedCells=new Set([i]),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(t,e,n){var i;if(this.config.selectableCells&&this.isSelecting&&this.startCell){const o=null!==(i=this.getCellFromMousePosition(e,n))&&void 0!==i?i:t;this.updateSelectionRange(this.startCell,o)}}}je.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"],je.HEADER_SELECTION_CLASSES=["st-header-selected","st-header-has-highlighted-cell"];const Ne=t=>!(!t.enableRowSelection||(!t.rowButtons||0>=t.rowButtons.length)&&!1===t.showRowSelectionColumn),Be=(t,e)=>t.filter(t=>!(!t||!t.rowId)&&e.has(pt(t.rowId))).map(t=>t.row);class ze{constructor(t){this.subscribers=new Set,this.anchorRowId=null,this.keydownHandler=null,this.config=Object.assign({rowSelectionMode:"multiple",selectRowOnClick:!1,showRowSelectionColumn:!0,selectableCells:!1},t),this.state={selectedRows:new Set,selectedRowCount:0,selectedRowsData:[],activeRowId:null},this.setupKeyboardNavigation()}updateConfig(t){this.config=Object.assign(Object.assign({},this.config),t),t.tableRows&&this.updateDerivedState()}getMode(){var t;return null!==(t=this.config.rowSelectionMode)&&void 0!==t?t:"multiple"}updateDerivedState(){var t;this.state=Object.assign(Object.assign({},this.state),{selectedRowCount:(t=this.state.selectedRows,t.size),selectedRowsData:Be(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))}fireChange(t,e,n){if(!this.config.onRowSelectionChange)return;const i=this.config.tableRows.find(e=>pt(e.rowId)===t);i&&this.config.onRowSelectionChange({row:i.row,isSelected:e,selectedRows:n})}applySelection(t){const e=this.state.selectedRows;this.state=Object.assign(Object.assign({},this.state),{selectedRows:t}),this.updateDerivedState(),this.config.onRowSelectionChange&&new Set([...e,...t]).forEach(n=>{const i=e.has(n),o=t.has(n);i!==o&&this.fireChange(n,o,t)}),this.notifySubscribers()}isRowSelected(t){return!!this.config.enableRowSelection&&(t=>this.state.selectedRows.has(t))(t)}areAllRowsSelected(){return!!this.config.enableRowSelection&&"single"!==this.getMode()&&(e=this.state.selectedRows,0!==(t=this.config.tableRows).length&&t.filter(t=>t&&t.rowId).every(t=>e.has(pt(t.rowId))));var t,e}getSelectedRows(){return this.state.selectedRows}getSelectedRowCount(){return this.state.selectedRowCount}getSelectedRowsData(){return this.state.selectedRowsData}getRow(t){return((t,e)=>{const n=this.config.tableRows.find(t=>null!=(null==t?void 0:t.rowId)&&pt(t.rowId)===e);return null==n?void 0:n.row})(0,t)}getActiveRowId(){return this.state.activeRowId}setActiveRowId(t){this.state.activeRowId!==t&&(this.state=Object.assign(Object.assign({},this.state),{activeRowId:t}),this.notifySubscribers())}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=this.getMode(),i=((t,e,n,i="multiple")=>{if("single"===i){if(e)return new Set([t]);const i=new Set(n);return i.delete(t),i}const o=new Set(n);return e?o.add(t):o.delete(t),o})(t,e,this.state.selectedRows,n);i.size===this.state.selectedRows.size&&[...i].every(t=>this.state.selectedRows.has(t))||(this.anchorRowId=t,this.state=Object.assign(Object.assign({},this.state),{activeRowId:t}),this.applySelection(i))}selectRow(t){this.handleRowSelect(t,!0)}deselectRow(t){this.handleRowSelect(t,!1)}handleSelectAll(t){if(!this.config.enableRowSelection)return;if("single"===this.getMode())return;let e;e=t?new Set(this.config.tableRows.filter(t=>t&&t.rowId).map(t=>pt(t.rowId))):new Set,this.applySelection(e)}handleToggleRow(t){if(!this.config.enableRowSelection)return;if("single"===this.getMode())return void this.handleRowSelect(t,!0);const e=this.isRowSelected(t);this.handleRowSelect(t,!e)}handleRowClickSelect(t){this.config.enableRowSelection&&this.config.selectRowOnClick&&this.handleToggleRow(t)}clearSelection(){this.config.enableRowSelection&&0!==this.state.selectedRows.size&&this.applySelection(new Set)}getState(){return this.state}setupKeyboardNavigation(){this.keydownHandler=this.handleKeyDown.bind(this),document.addEventListener("keydown",this.keydownHandler)}isEventInsideTable(t){const e=this.config.tableRoot;if(!e)return!1;const n=t.target;return n instanceof Node&&e.contains(n)}isTypingInFormField(){const t=document.activeElement;return t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement||"true"===(null==t?void 0:t.getAttribute("contenteditable"))}findRowIndex(t){return t?this.config.tableRows.findIndex(e=>pt(e.rowId)===t):-1}resolveActiveRowId(){if(this.state.activeRowId&&-1!==this.findRowIndex(this.state.activeRowId))return this.state.activeRowId;for(const t of this.state.selectedRows)if(-1!==this.findRowIndex(t))return t;const t=this.config.tableRows[0];return t?pt(t.rowId):null}moveActiveRow(t,e){var n;const i=this.config.tableRows;if(0===i.length)return;const o=Math.max(0,Math.min(i.length-1,t)),s=pt(i[o].rowId),r=this.getMode();if(this.state=Object.assign(Object.assign({},this.state),{activeRowId:s}),e&&"multiple"===r){const t=null!==(n=this.anchorRowId)&&void 0!==n?n:s,e=this.findRowIndex(t),r=((t,e,n)=>{const i=Math.min(e,n),o=Math.max(e,n),s=new Set([]);for(let e=i;o>=e;e++){const n=t[e];null!=(null==n?void 0:n.rowId)&&s.add(pt(n.rowId))}return s})(i,-1===e?o:e,o);return void this.applySelection(r)}this.anchorRowId=s,"single"===r?this.applySelection(new Set([s])):this.notifySubscribers()}handleKeyDown(t){var e,n,i;if(!this.config.enableRowSelection)return;if(!this.isEventInsideTable(t))return;if(this.isTypingInFormField())return;const o=!this.config.selectableCells,s=t.key;if(" "===s||"Spacebar"===s){if(t.target instanceof HTMLInputElement&&"checkbox"===t.target.type)return;t.preventDefault();const o=this.resolveActiveRowId();if(o){const t=null===(n=null===(e=document.activeElement)||void 0===e?void 0:e.closest)||void 0===n?void 0:n.call(e,"[data-row-id]"),s=null!==(i=null==t?void 0:t.getAttribute("data-row-id"))&&void 0!==i?i:o;this.handleToggleRow(s),this.state=Object.assign(Object.assign({},this.state),{activeRowId:s})}return}if(!o)return;if((t.ctrlKey||t.metaKey)&&"a"===s.toLowerCase())return void("multiple"===this.getMode()&&(t.preventDefault(),this.handleSelectAll(!0)));const r=this.resolveActiveRowId(),l=this.findRowIndex(r),a=this.config.tableRows.length-1;if(0>a)return;const d=t.shiftKey;"ArrowUp"===s?(t.preventDefault(),this.moveActiveRow(l>0?l-1:0,d)):"ArrowDown"===s?(t.preventDefault(),this.moveActiveRow(0>l?0:Math.min(a,l+1),d)):"Home"===s?(t.preventDefault(),this.moveActiveRow(0,d)):"End"===s&&(t.preventDefault(),this.moveActiveRow(a,d))}destroy(){this.keydownHandler&&(document.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=null),this.subscribers.clear()}}class Ve{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 qe{constructor(t){this.isListening=!1,this.handleClickOutside=t=>{var e,n,i,o,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!==(i=null===(n=(e=this.config).getSelectedCells)||void 0===n?void 0:n.call(e))&&void 0!==i?i:this.config.selectedCells,l=null!==(r=null===(s=(o=this.config).getSelectedColumns)||void 0===s?void 0:s.call(o))&&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 Ge{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(){if(this.headerContainer)if(this.isMainSectionScrollable){const t=null!=this.mainSection?this.mainSection.offsetWidth-this.mainSection.clientWidth:this.scrollbarWidth;this.scrollbarWidth=t,this.headerContainer.classList.add("st-header-scroll-padding"),this.headerContainer.style.setProperty("--st-after-width",t+"px")}else 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 Ke=(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 _e{constructor(t,e){this.observers=new Set,this.notifyMicrotaskScheduled=!1,this.expandedDepths=Ke(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.notifyMicrotaskScheduled||(this.notifyMicrotaskScheduled=!0,queueMicrotask(()=>{this.notifyMicrotaskScheduled=!1,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 Ue{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 Je(t){return t?t.offsetWidth-t.clientWidth:0}const Ye=(t,e,n)=>{var i;const o=document.createElement("div");o.className="st-dropdown-content",o.style.position=n.positioning||"fixed",o.style.zIndex="1000",o.style.visibility="hidden",o.style.overflow=null!==(i=n.overflow)&&void 0!==i?i:"auto",n.width&&(o.style.width=n.width+"px"),n.maxHeight&&(o.style.maxHeight=n.maxHeight+"px"),o.appendChild(e);const s=t.closest(".simple-table-root")||document.querySelector(".simple-table-root");"fixed"===n.positioning?s?s.appendChild(o):document.body.appendChild(o):t.appendChild(o),requestAnimationFrame(()=>{const{position:e,placement:i}=((t,e,n)=>{const i=t.getBoundingClientRect(),o=window.innerHeight,s=window.innerWidth,r=o-i.bottom,l=s-i.left;let a="bottom";e.offsetHeight>r&&i.top>r&&(a="top");let d="left";(n.width||e.offsetWidth)>l&&i.right>l&&(d="right");const c={};return"fixed"===n.positioning?("bottom"===a?c.top=i.bottom+4:c.bottom=o-i.top+4,"left"===d?c.left=i.left:c.right=s-i.right):("bottom"===a?c.top=i.height+4:c.bottom=i.height+4,"left"===d?c.left=0:c.right=0),{position:c,placement:`${a}-${d}`}})(t,o,n);o.className="st-dropdown-content st-dropdown-"+i,Object.entries(e).forEach(([t,e])=>{void 0!==e&&(o.style[t]=e+"px")}),o.style.visibility="visible"});const r=e=>{const n=e.target;o.contains(n)||t.contains(n)||d()},l=t=>{"Escape"===t.key&&(t.preventDefault(),d())},a=t=>{o.contains(t.target)||d()},d=()=>{o.remove(),document.removeEventListener("mousedown",r,!0),document.removeEventListener("keydown",l,!0),window.removeEventListener("scroll",a,!0),n.onClose()};return setTimeout(()=>{document.addEventListener("mousedown",r,!0),document.addEventListener("keydown",l,!0),window.addEventListener("scroll",a,!0)},0),h(o,"mousedown",t=>{t.stopPropagation()}),o},Xe=({className:t,width:e=20,height:n=20,paths:i,circles:o=[],strokeWidth:s=2})=>{const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("aria-hidden","true"),r.setAttribute("role","img"),r.setAttribute("xmlns","http://www.w3.org/2000/svg"),r.setAttribute("viewBox","0 0 24 24"),r.setAttribute("width",e+""),r.setAttribute("height",n+""),r.setAttribute("fill","none"),r.setAttribute("stroke","currentColor"),r.setAttribute("stroke-width",s+""),r.setAttribute("stroke-linecap","round"),r.setAttribute("stroke-linejoin","round"),t&&r.setAttribute("class",t);for(const t of i){const e=document.createElementNS("http://www.w3.org/2000/svg","path");e.setAttribute("d",t),e.setAttribute("fill","none"),r.appendChild(e)}for(const{cx:t,cy:e,r:n}of o){const i=document.createElementNS("http://www.w3.org/2000/svg","circle");i.setAttribute("cx",t+""),i.setAttribute("cy",e+""),i.setAttribute("r",n+""),i.setAttribute("fill","currentColor"),i.setAttribute("stroke","none"),r.appendChild(i)}return r},Qe=t=>Xe({className:t,paths:["m15 18-6-6 6-6"]}),Ze=t=>Xe({className:t,paths:["m9 18 6-6-6-6"]}),tn=t=>Xe({className:t,paths:["m5 12 7-7 7 7","M12 19V5"]}),en=t=>Xe({className:t,paths:["M12 5v14","m19 12-7 7-7-7"]}),nn=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","16"),e.setAttribute("height","10"),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 i=document.createElementNS("http://www.w3.org/2000/svg","circle");i.setAttribute("cx",t),i.setAttribute("cy",n),i.setAttribute("r","1.5"),i.setAttribute("fill","currentColor"),e.appendChild(i)}),e},on=(t,e)=>new Date(t,e+1,0).getDate(),sn=["January","February","March","April","May","June","July","August","September","October","November","December"],rn=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],ln=["Su","Mo","Tu","We","Th","Fr","Sa"],an=(t,e,n)=>{const{header:i,row:o}=t,s=ct(o,i.accessor);return"boolean"===i.type?((t,e,n,i)=>{var o;const{header:s,row:r,rowIndex:l}=t;let a;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 c=document.createElement("div");c.className="st-dropdown-item "+(!1===n?"selected":""),c.textContent="False",c.setAttribute("role","option"),c.setAttribute("aria-selected",(!1===n)+""),c.setAttribute("aria-disabled","false");const u=t=>{ut(r,s.accessor,t),e.onCellEdit&&e.onCellEdit({accessor:s.accessor,newValue:t,row:r,rowIndex:l}),a.remove(),i()};h(d,"click",()=>u(!0)),h(c,"click",()=>u(!1));const f=t=>{const e=t;"ArrowDown"===e.key||"ArrowUp"===e.key?(e.preventDefault(),document.activeElement===d?c.focus():d.focus()):"Enter"===e.key&&(e.preventDefault(),document.activeElement===d?u(!0):document.activeElement===c&&u(!1))};d.setAttribute("tabindex","0"),c.setAttribute("tabindex","0"),h(d,"keydown",f),h(c,"keydown",f);const v=document.createDocumentFragment();v.appendChild(d),v.appendChild(c);const p=ot({accessor:s.accessor,rowId:null!==(o=t.stableRowKey)&&void 0!==o?o:t.rowId}),w=document.getElementById(p);return a=Ye(w||document.body,v,{width:120,positioning:"fixed",onClose:i}),a})(t,e,!!s,n):"enum"===i.type?((t,e,n,i)=>{var o;const{header:s,row:r,rowIndex:l}=t,a=s.enumOptions||[];let d;const c=t=>{ut(r,s.accessor,t),e.onCellEdit&&e.onCellEdit({accessor:s.accessor,newValue:t,row:r,rowIndex:l}),d.remove(),i()},u=[];a.forEach((t,e)=>{const i=document.createElement("div");i.className="st-dropdown-item "+(n===t.value?"selected":""),i.textContent=t.label,i.setAttribute("role","option"),i.setAttribute("aria-selected",(n===t.value)+""),i.setAttribute("aria-disabled","false"),i.setAttribute("tabindex","0"),i.dataset.value=t.value,h(i,"click",()=>c(t.value)),u.push(i)});const f=t=>{const e=t,n=u.findIndex(t=>t===document.activeElement);if("ArrowDown"===e.key)e.preventDefault(),u[(n+1)%u.length].focus();else if("ArrowUp"===e.key)e.preventDefault(),u[(n-1+u.length)%u.length].focus();else if("Enter"===e.key){e.preventDefault();const t=document.activeElement.dataset.value;t&&c(t)}};u.forEach(t=>{h(t,"keydown",f)});const v=document.createElement("div");v.className="st-enum-dropdown-content",u.forEach(t=>v.appendChild(t));const p=ot({accessor:s.accessor,rowId:null!==(o=t.stableRowKey)&&void 0!==o?o:t.rowId}),w=document.getElementById(p);return d=Ye(w||document.body,v,{width:150,maxHeight:300,positioning:"fixed",onClose:i}),setTimeout(()=>{const t=a.findIndex(t=>t.value===n);t>=0&&u[t]?(u[t].focus(),u[t].scrollIntoView({block:"nearest"})):u.length>0&&u[0].focus()},0),d})(t,e,(s||"")+"",n):"date"===i.type?((t,e,n,i)=>{var o,s,r;const{header:l,row:a,rowIndex:d}=t;let c,u;try{u=n?Zt(n+""):new Date}catch(t){u=new Date}let f=u.getFullYear(),v=u.getMonth(),p="days";const w=document.createElement("div");w.className="st-datepicker";const m=null!==(o=e.icons.prev)&&void 0!==o?o:Qe("st-next-prev-icon"),g=null!==(s=e.icons.next)&&void 0!==s?s:Ze("st-next-prev-icon"),b=(t,e)=>{"string"==typeof e?t.innerHTML=e:t.appendChild(e.cloneNode(!0))},x=t=>{const n=t.toISOString().split("T")[0];ut(a,l.accessor,n),e.onCellEdit&&e.onCellEdit({accessor:l.accessor,newValue:n,row:a,rowIndex:d}),c.remove(),i()},y=()=>{w.innerHTML="";const t=document.createElement("div");if(t.className="st-datepicker-header","days"===p){const e=document.createElement("button");e.className="st-datepicker-nav-btn",e.setAttribute("aria-label","Previous month"),b(e,m),h(e,"click",()=>{v--,0>v&&(v=11,f--),y()});const n=document.createElement("div");n.className="st-datepicker-header-label",n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.setAttribute("aria-label","Select month"),n.textContent=`${sn[v]} ${f}`;const i=()=>{p="months",y()};h(n,"click",i),h(n,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),i())});const o=document.createElement("button");o.className="st-datepicker-nav-btn",o.setAttribute("aria-label","Next month"),b(o,g),h(o,"click",()=>{v++,v>11&&(v=0,f++),y()}),t.appendChild(e),t.appendChild(n),t.appendChild(o)}else if("months"===p){const e=document.createElement("div");e.className="st-datepicker-header-label",e.setAttribute("role","button"),e.setAttribute("tabindex","0"),e.setAttribute("aria-label","Select year"),e.textContent=f+"";const n=()=>{p="years",y()};h(e,"click",n),h(e,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),n())}),t.appendChild(e)}else{const e=document.createElement("div");e.className="st-datepicker-header-label",e.textContent="Select Year",t.appendChild(e)}w.appendChild(t);const e=document.createElement("div");if(e.className=`st-datepicker-grid st-datepicker-${p}-grid`,"days"===p){ln.forEach(t=>{const n=document.createElement("div");n.className="st-datepicker-weekday",n.textContent=t,e.appendChild(n)});const t=on(f,v),n=new Date(f,v,1).getDay(),i=on(f,v-1),o=new Date;for(let t=0;n>t;t++){const o=i-n+t+1,s=new Date(f,v-1,o),r=document.createElement("div");r.className="st-datepicker-day other-month",r.textContent=o+"",r.setAttribute("tabindex","0"),r.setAttribute("role","button"),r.setAttribute("aria-label",`${sn[s.getMonth()]} ${o}, ${s.getFullYear()}`),h(r,"click",()=>x(s)),h(r,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),x(s))}),e.appendChild(r)}const s=u.getFullYear()===f&&u.getMonth()===v;for(let n=1;t>=n;n++){const t=document.createElement("div");t.className="st-datepicker-day",t.textContent=n+"",t.setAttribute("tabindex","0"),t.setAttribute("role","button"),t.setAttribute("aria-label",`${sn[v]} ${n}, ${f}`),o.getFullYear()===f&&o.getMonth()===v&&o.getDate()===n&&t.classList.add("today"),s&&u.getDate()===n&&t.classList.add("selected");const i=new Date(f,v,n);h(t,"click",()=>x(i)),h(t,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),x(i))}),e.appendChild(t)}const r=n+t,l=Math.max(35,7*Math.ceil(r/7))-r;for(let t=1;l>=t;t++){const n=new Date(f,v+1,t),i=document.createElement("div");i.className="st-datepicker-day other-month",i.textContent=t+"",i.setAttribute("tabindex","0"),i.setAttribute("role","button"),i.setAttribute("aria-label",`${sn[n.getMonth()]} ${t}, ${n.getFullYear()}`),h(i,"click",()=>x(n)),h(i,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),x(n))}),e.appendChild(i)}}else if("months"===p)rn.forEach((t,n)=>{const i=document.createElement("div");i.className="st-datepicker-month"+(n===v?" selected":""),i.textContent=t,i.setAttribute("tabindex","0"),i.setAttribute("role","button"),i.setAttribute("aria-label",sn[n]);const o=()=>{v=n,p="days",y()};h(i,"click",o),h(i,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),o())}),e.appendChild(i)});else{const t=f-6;for(let n=t;t+12>n;n++){const t=document.createElement("div");t.className="st-datepicker-year"+(n===f?" selected":""),t.textContent=n+"",t.setAttribute("tabindex","0"),t.setAttribute("role","button"),t.setAttribute("aria-label",n+"");const i=()=>{f=n,p="months",y()};h(t,"click",i),h(t,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),i())}),e.appendChild(t)}}w.appendChild(e);const n=document.createElement("div");n.className="st-datepicker-footer";const i=document.createElement("button");i.className="st-datepicker-today-btn",i.textContent="Today",h(i,"click",()=>{const t=new Date,e=new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0);x(e)}),n.appendChild(i),w.appendChild(n)};y();const R=ot({accessor:l.accessor,rowId:null!==(r=t.stableRowKey)&&void 0!==r?r:t.rowId}),S=document.getElementById(R);return c=Ye(S||document.body,w,{width:280,overflow:"hidden",positioning:"fixed",onClose:i}),c})(t,e,s,n):((t,e,n,i)=>{const{header:o,row:s,rowIndex:r}=t,l=document.createElement("input");l.className="editable-cell-input","number"===o.type?(l.type="text",l.inputMode="decimal"):l.type="text",l.value=null!=n?n+"":"",l.setAttribute("autofocus","true"),setTimeout(()=>{l.focus(),l.select()},0);let a=!0;if("number"===o.type){const t=()=>{const t=l.value;/^-?\d*\.?\d*$/.test(t)||(l.value=t.slice(0,-1))};h(l,"input",t)}return h(l,"blur",t=>{if(!a)return void i();let n=l.value;if("number"===o.type){const t=parseFloat(l.value);n=isNaN(t)?0:t}ut(s,o.accessor,n),e.onCellEdit&&e.onCellEdit({accessor:o.accessor,newValue:n,row:s,rowIndex:r}),i()}),h(l,"keydown",t=>{const e=t;e.stopPropagation(),"Enter"===e.key?(a=!0,l.blur()):"Escape"===e.key&&(a=!1,l.blur())}),h(l,"mousedown",t=>{t.stopPropagation()}),l})(t,e,s,n)};let dn=0;const cn=(t,e,n,i)=>{t.checked=n,t.indeterminate=i,t.setAttribute("aria-checked",i?"mixed":n+""),e.className="st-checkbox-custom "+(i?"st-indeterminate":n?"st-checked":""),e.setAttribute("aria-hidden","true"),e.innerHTML="",i?e.appendChild(Xe({className:"st-checkbox-minus",width:12,height:12,strokeWidth:2.5,paths:["M5 12h14"]})):n&&e.appendChild(Xe({className:"st-checkbox-checkmark",width:12,height:12,strokeWidth:2.5,paths:["M20 6 9 17l-5-5"]}))},hn=(t,e)=>{const n=t.querySelector(".st-checkbox-input"),i=t.querySelector(".st-checkbox-custom");n&&i&&(n.checked!==e||n.indeterminate)&&cn(n,i,e,!1)},un=({checked:t,indeterminate:e=!1,onChange:n,ariaLabel:i})=>{const o=document.createElement("label");o.className="st-checkbox-label";const s=document.createElement("input");s.type="checkbox",s.className="st-checkbox-input",i&&s.setAttribute("aria-label",i);const r=document.createElement("span");cn(s,r,t,e);const l=()=>{cn(s,r,s.checked,!1),n(s.checked)};return s.addEventListener("change",l),s.addEventListener("keydown",t=>{" "===t.key&&t.stopPropagation()}),o.addEventListener("mousedown",t=>{t.stopPropagation()}),o.addEventListener("dragstart",t=>{t.preventDefault(),t.stopPropagation()}),o.appendChild(s),o.appendChild(r),{element:o,update:(t,e=!1)=>{s.checked===t&&s.indeterminate===e||cn(s,r,t,e)},destroy:()=>{s.removeEventListener("change",l)}}},fn=new WeakMap,vn=new WeakMap,pn=new WeakSet,wn=(t,e,n)=>{const i=t.querySelector(".st-expand-icon-container");if(!(i&&i instanceof HTMLElement))return;const o=i.classList.contains("expanded");vn.set(i,{desired:e,options:n}),pn.has(i)||(o!==e?(pn.add(i),requestAnimationFrame(()=>{requestAnimationFrame(()=>{var t,e,n,o;pn.delete(i);const s=vn.get(i);if(vn.delete(i),!s)return;const r=s.desired;if(i.classList.contains("expanded")===r)return;const l=null!==(e=null===(t=s.options)||void 0===t?void 0:t.ariaLabelWhenExpanded)&&void 0!==e?e:"Collapse row",a=null!==(o=null===(n=s.options)||void 0===n?void 0:n.ariaLabelWhenCollapsed)&&void 0!==o?o:"Expand row";i.classList.toggle("expanded",r),i.classList.toggle("collapsed",!r),i.setAttribute("aria-label",r?l:a),i.setAttribute("aria-expanded",r+"")})})):vn.delete(i))},mn=(t,e,n,i,o)=>{if(e.valueFormatter){const s=e.valueFormatter({accessor:e.accessor,colIndex:n,row:i,rowIndex:o,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)?ee(t).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):null==t?"":t+""},gn=(t,e,n)=>{var i;const{header:o,row:s,rowIndex:r,colIndex:l,depth:a,rowId:d}=t,c=ct(s,o.accessor),u=o.isSelectionColumn&&e.enableRowSelection;if(t.tableRow.isLoadingSkeleton){const t=document.createElement("div");return t.className="st-loading-skeleton",void n.appendChild(t)}if(u){const i=document.createElement("div");i.className="st-selection-cell-content";const o=document.createElement("div");o.className="st-selection-control";const s=!!e.isRowSelected&&e.isRowSelected(d+""),r=((t,e,n)=>un({checked:n,onChange:n=>{var i;null===(i=e.handleRowSelect)||void 0===i||i.call(e,t.rowId+"",n)},ariaLabel:"Select row "+(t.displayRowNumber+1)}).element)(t,e,s);o.appendChild(r),i.appendChild(o);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 i={row:t.row,rowIndex:t.displayRowNumber};return e.rowButtons.forEach((t,e)=>{try{const e=t(i);if(!e)return;const o=document.createElement("span");o.className="st-row-button",o.appendChild(e),n.appendChild(o)}catch(t){console.error("Error rendering row button:",t)}}),n})(t,e);return l&&i.appendChild(l),void n.appendChild(i)}const f=e.rowGrouping&&e.rowGrouping[a],v=!!f&&yt(s,f),p=e.rowGrouping&&e.rowGrouping.length>a,w=!e.canExpandRowGroup||e.canExpandRowGroup(s);if(o.expandable&&(v&&p&&w||o.nestedTable||e.onRowGroupExpand&&p&&w)){const i=new Set(e.expandedDepths),o=bt(t.tableRow),s=((t,e,n)=>{const i=document.createElement("div");i.className="st-icon-container st-expand-icon-container "+(n?"expanded":"collapsed"),i.setAttribute("role","button"),i.setAttribute("aria-label",n?"Collapse row":"Expand row"),i.setAttribute("aria-expanded",n+""),i.setAttribute("tabindex","0");const o=e.icons.expand;o&&("string"==typeof o?i.innerHTML=o:(o instanceof HTMLElement||o instanceof SVGSVGElement)&&i.appendChild(o.cloneNode(!0)));const s=n=>{var o,s;n.stopPropagation();const r=i.closest("[data-row-id]"),l=r?fn.get(r):void 0,a=null!==(o=null==l?void 0:l.tableRow)&&void 0!==o?o:t.tableRow,d=null!==(s=null==l?void 0:l.row)&&void 0!==s?s:t.row,c=bt(a),h=a.depth,u=new Set(e.expandedDepths),f=e.getExpandedRows?e.getExpandedRows():e.expandedRows,v=e.getCollapsedRows?e.getCollapsedRows():e.collapsedRows,p=Rt(c,h,u,f,v),w=!p;if(p?(e.setCollapsedRows(t=>{const e=new Map(t);return e.set(c,h),e}),e.setExpandedRows(t=>{const e=new Map(t);return e.delete(c),e}),e.setRowStateMap(t=>{const e=new Map(t);return e.delete(c),e})):(e.setExpandedRows(t=>{const e=new Map(t);return e.set(c,h),e}),e.setCollapsedRows(t=>{const e=new Map(t);return e.delete(c),e})),e.onRowGroupExpand&&a.rowIndexPath&&e.rowGrouping){const n=t.header.pinned,i=t=>{setTimeout(()=>{e.setRowStateMap(e=>{const i=new Map(e),o=i.get(c)||{};return i.set(c,Object.assign(Object.assign({},o),{loading:t,triggerSection:n})),i})},0)},o=t=>{e.setRowStateMap(e=>{const i=new Map(e),o=i.get(c)||{};return i.set(c,Object.assign(Object.assign({},o),{error:t,loading:!1,triggerSection:n})),i})},s=(t,i)=>{e.setRowStateMap(e=>{const i=new Map(e),o=i.get(c)||{};return i.set(c,Object.assign(Object.assign({},o),{isEmpty:t,loading:!1,triggerSection:n})),i})};e.onRowGroupExpand({row:d,depth:h,event:{stopPropagation:()=>{},preventDefault:()=>{}},groupingKey:e.rowGrouping[h],isExpanded:w,rowIndexPath:a.rowIndexPath,rowIdPath:a.rowPath,groupingKeys:e.rowGrouping,setLoading:i,setError:o,setEmpty:s})}};return h(i,"click",s),h(i,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),s(t))}),i})(t,e,Rt(o,a,i,e.expandedRows,e.collapsedRows));n.appendChild(s)}if("lineAreaChart"===o.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:i=30,color:o,fillColor:s,fillOpacity:r=.25,strokeWidth:l=1.5,className:a="",min:d,max:c}=t;if(!e||0===e.length)return null;const h="st-line-area-gradient-"+ ++dn,u=document.createElementNS("http://www.w3.org/2000/svg","svg");u.setAttribute("width",n+""),u.setAttribute("height",i+""),u.setAttribute("preserveAspectRatio","none"),u.setAttribute("class",("st-line-area-chart "+a).trim()),u.style.display="block";let f="number"==typeof n?n:100;const v=()=>{u.innerHTML="";const t=f,n=i;u.setAttribute("viewBox",`0 0 ${t} ${n}`);const a=void 0!==d?d:Math.min(...e),v=(void 0!==c?c:Math.max(...e))-a||1,p=l/2+.5,w=Math.max(1,t-2*p),m=Math.max(1,n-2*p),g=e.map((t,n)=>({x:1===e.length?p+w/2:p+n/(e.length-1)*w,y:p+m-(t-a)/v*m})),b=g.map((t,e)=>`${0===e?"M":"L"} ${t.x.toFixed(2)},${t.y.toFixed(2)}`).join(" "),x=g[0].x,y=`${b} L ${g[g.length-1].x.toFixed(2)},${n} L ${x.toFixed(2)},${n} Z`,R=s||"var(--st-chart-fill-color)",S=document.createElementNS("http://www.w3.org/2000/svg","defs"),C=document.createElementNS("http://www.w3.org/2000/svg","linearGradient");C.setAttribute("id",h),C.setAttribute("x1","0"),C.setAttribute("y1","0"),C.setAttribute("x2","0"),C.setAttribute("y2","1");const M=document.createElementNS("http://www.w3.org/2000/svg","stop");M.setAttribute("offset","0%"),M.style.stopColor=R,M.setAttribute("stop-opacity",r+"");const I=document.createElementNS("http://www.w3.org/2000/svg","stop");I.setAttribute("offset","100%"),I.style.stopColor=R,I.setAttribute("stop-opacity",.15*r+""),C.appendChild(M),C.appendChild(I),S.appendChild(C),u.appendChild(S);const H=document.createElementNS("http://www.w3.org/2000/svg","path");H.setAttribute("d",y),H.setAttribute("fill",`url(#${h})`),H.setAttribute("stroke","none");const k=document.createElementNS("http://www.w3.org/2000/svg","path");k.setAttribute("d",b),k.setAttribute("fill","none"),k.setAttribute("stroke",o||"var(--st-chart-color)"),k.setAttribute("stroke-width",l+""),k.setAttribute("stroke-linecap","round"),k.setAttribute("stroke-linejoin","round"),u.appendChild(H),u.appendChild(k)};v();const p="undefined"!=typeof ResizeObserver?new ResizeObserver(t=>{var e,n;const i=null!==(n=null===(e=t[0])||void 0===e?void 0:e.contentRect.width)&&void 0!==n?n:0;i>0&&Math.abs(i-f)>=.5&&(f=i,v())}):null;return null==p||p.observe(u),{element:u,update:t=>{void 0===t.data||(e=t.data,e&&0!==e.length)?(void 0!==t.width&&(n=t.width,u.setAttribute("width",n+""),"number"==typeof n&&(f=n)),void 0!==t.height&&(i=t.height,u.setAttribute("height",i+"")),void 0!==t.color&&(o=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&&(a=t.className,u.setAttribute("class",("st-line-area-chart "+a).trim())),void 0!==t.min&&(d=t.min),void 0!==t.max&&(c=t.max),v()):u.innerHTML=""},destroy:()=>{null==p||p.disconnect(),u.remove()}}})(Object.assign({data:t,width:"100%",height:30},o.chartOptions));return void((null==e?void 0:e.element)&&n.appendChild(e.element))}}else if("barChart"===o.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:i=30,color:o,gap:s=2,className:r="",min:l,max:a}=t;if(!e||0===e.length)return null;const d=document.createElementNS("http://www.w3.org/2000/svg","svg");d.setAttribute("width",n+""),d.setAttribute("height",i+""),d.setAttribute("preserveAspectRatio","none"),d.setAttribute("class",("st-bar-chart "+r).trim()),d.style.display="block";let c="number"==typeof n?n:100;const h=()=>{d.innerHTML="";const t=c,n=i;d.setAttribute("viewBox",`0 0 ${t} ${n}`);const r=void 0!==l?l:Math.min(...e),h=void 0!==a?a:Math.max(...e),u=h-r||1,f=e.length;let v=Math.max(0,s);f>1&&1>(t-v*(f-1))/f&&(v=Math.max(0,Math.floor((t-f)/(f-1))));const p=(t-v*(f-1))/f,w=p+v,m=0>r,g=m?n*(h/u):n;e.forEach((t,e)=>{let i,s;m?0>t?(i=g,s=g+Math.abs(t)/u*n):(i=g-t/u*n,s=g):(i=n-(t-r)/u*n,s=n);const l=Math.round(e*w),a=Math.max(l+1,Math.round(e*w+p)),c=Math.round(i),h=Math.max(c+1,Math.round(s)),f=document.createElementNS("http://www.w3.org/2000/svg","rect");f.setAttribute("x",l+""),f.setAttribute("y",c+""),f.setAttribute("width",a-l+""),f.setAttribute("height",h-c+""),f.setAttribute("fill",o||"var(--st-chart-color)"),f.setAttribute("rx",Math.min(1,(a-l)/3)+""),d.appendChild(f)})};h();const u="undefined"!=typeof ResizeObserver?new ResizeObserver(t=>{var e,n;const i=null!==(n=null===(e=t[0])||void 0===e?void 0:e.contentRect.width)&&void 0!==n?n:0;i>0&&Math.abs(i-c)>=.5&&(c=i,h())}):null;return null==u||u.observe(d),{element:d,update:t=>{void 0===t.data||(e=t.data,e&&0!==e.length)?(void 0!==t.width&&(n=t.width,d.setAttribute("width",n+""),"number"==typeof n&&(c=n)),void 0!==t.height&&(i=t.height,d.setAttribute("height",i+"")),void 0!==t.color&&(o=t.color),void 0!==t.gap&&(s=t.gap),void 0!==t.className&&(r=t.className,d.setAttribute("class",("st-bar-chart "+r).trim())),void 0!==t.min&&(l=t.min),void 0!==t.max&&(a=t.max),h()):d.innerHTML=""},destroy:()=>{null==u||u.disconnect(),d.remove()}}})(Object.assign({data:t,width:"100%",height:30},o.chartOptions));return void((null==e?void 0:e.element)&&n.appendChild(e.element))}}if(o.cellRenderer){try{const a=o.cellRenderer({accessor:o.accessor,colIndex:l,row:s,rowIndex:t.tableRow.absoluteRowIndex||r,rowPath:t.tableRow.rowPath,theme:e.theme,value:c,formattedValue:null===(i=o.valueFormatter)||void 0===i?void 0:i.call(o,{accessor:o.accessor,colIndex:l,row:s,rowIndex:r,value:c})});if("string"==typeof a||"number"==typeof a){const t=document.createTextNode(a+"");n.appendChild(t)}else if(a instanceof Node)n.appendChild(a);else if(null!=a&&"object"==typeof a){const t=mn(c,o,l,s,r);if(null!==t){const e=document.createTextNode(t);n.appendChild(e)}}}catch(t){console.error("Error rendering cell:",t);const e=mn(c,o,l,s,r);if(null!==e){const t=document.createTextNode(e);n.appendChild(t)}}return}const m=mn(c,o,l,s,r);if(null!==m){const t=document.createTextNode(m);n.appendChild(t)}},bn=new Map,xn=new Map,yn=new WeakMap,Rn=new WeakMap,Sn=new WeakMap,Cn=(t,e,n)=>{yn.set(e,n);const i=(t=>{let e=bn.get(t);return e||(e=new Map,bn.set(t,e)),e})(n);i.has(t)||i.set(t,new Set),i.get(t).add(e)},Mn=(t,e)=>{const n=yn.get(e);if(!n)return;yn.delete(e);const i=bn.get(n);if(!i)return;const o=i.get(t);o&&(o.delete(e),0===o.size&&i.delete(t)),0===i.size&&(bn.delete(n),xn.delete(n))},In=(t,e,n)=>{var i;const o=null===(i=bn.get(n))||void 0===i?void 0:i.get(t);o&&o.forEach(t=>{e?t.classList.add("st-row-hovered"):t.classList.remove("st-row-hovered")})},Hn=(t,e)=>{var n;const{header:i,rowIndex:o,colIndex:s,rowId:r,depth:l,isOdd:a}=t,d=i.isSelectionColumn&&e.enableRowSelection,c=!!(null==i?void 0:i.editable)||!(!e.onCellClick||d)||!(!e.selectRowOnClick||!e.enableRowSelection||d),h={rowIndex:o,colIndex:s,rowId:r},u=e.getBorderClass(h),f=e.isSelected(h),v=e.isInitialFocusedCell(h),p=e.isCopyFlashing(h),w=e.isWarningFlashing(h),m=e.selectedColumns.has(s),g=f&&!m,b=d&&e.rowsWithSelectedCells.has(r+""),x=(()=>{var t,n,o;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"===i.pinned?(null===(t=s[s.length-1])||void 0===t?void 0:t.accessor)===i.accessor:"right"===i.pinned?(null===(n=l[l.length-1])||void 0===n?void 0:n.accessor)===i.accessor:(null===(o=r[r.length-1])||void 0===o?void 0:o.accessor)===i.accessor})();return["st-cell","st-row-position-"+t.tableRow.position,l>0&&i.expandable?"st-cell-depth-"+l:"",g?v?"st-cell-selected-first "+u:"st-cell-selected "+u:"",m?v?"st-cell-column-selected-first":"st-cell-column-selected":"",c?"clickable":"",p?v?"st-cell-copy-flash-first":"st-cell-copy-flash":"",w?v?"st-cell-warning-flash-first":"st-cell-warning-flash":"",e.oddColumnBackground?s%2==0?"even-column":"odd-column":"",d?"st-selection-cell":"",b?"st-selection-has-highlighted-cell":"",x?"st-last-column":"","",e.oddEvenRowBackground?a?"st-cell-even-row":"st-cell-odd-row":"",(null===(n=e.isRowSelected)||void 0===n?void 0:n.call(e,r))?"st-cell-selected-row":"",null!=e.activeRowId&&e.activeRowId+""==r+""?"st-row-active":""].filter(Boolean).join(" ")},kn=(t,e)=>{var n,i,o;const{header:s,row:r,rowIndex:l,colIndex:a,rowId:d}=t,c=s.isSelectionColumn&&e.enableRowSelection,u={rowIndex:l,colIndex:a,rowId:d},f=e.isInitialFocusedCell(u),v=Hn(t,e),p=document.createElement("div");p.className=v,p.id=ot({accessor:s.accessor,rowId:null!==(n=t.stableRowKey)&&void 0!==n?n:d}),p.setAttribute("role",void 0!==e.rowHeaderAccessor&&s.accessor===e.rowHeaderAccessor?"rowheader":"gridcell"),p.setAttribute("tabindex",f?"0":"-1");const w=null!==(i=e.maxHeaderDepth)&&void 0!==i?i:1;p.setAttribute("aria-rowindex",t.tableRow.position+w+1+""),p.setAttribute("aria-colindex",a+1+""),e.enableRowSelection&&p.setAttribute("aria-selected",(null===(o=e.isRowSelected)||void 0===o?void 0:o.call(e,d))?"true":"false"),p.setAttribute("data-row-index",l+""),p.setAttribute("data-col-index",a+""),p.setAttribute("data-row-id",d+""),p.setAttribute("data-accessor",s.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"===s.type||"date"===s.type||"enum"===s.type,b=()=>{var n,i,o,r;const l=null!==(i=null===(n=fn.get(p))||void 0===n?void 0:n.context)&&void 0!==i?i:e;if(m&&!g){null===(o=l.onRendererHostDiscard)||void 0===o||o.call(l,p),p.innerHTML="",p.setAttribute("tabindex","-1");const e=an(t,l,()=>{m=!1,p.setAttribute("tabindex",f?"0":"-1"),b(),y()});if(e){const t=document.createElement("div");t.className="st-cell-editing",t.appendChild(e),p.appendChild(t)}}else if(m&&g)an(t,l,()=>{m=!1,b(),y()});else{null===(r=l.onRendererHostDiscard)||void 0===r||r.call(l,p),p.innerHTML="";const e=document.createElement("span");e.className="st-cell-content "+("right"===s.align?"right-aligned":"center"===s.align?"center-aligned":"left-aligned"),gn(t,l,e),p.appendChild(e)}};b(),t.header.expandable||Sn.set(p,{row:t.row,value:ct(r,s.accessor),theme:e.theme,skeleton:!!t.tableRow.isLoadingSkeleton});const x={row:r,tableRow:t.tableRow,context:e};fn.set(p,x);const y=()=>{var n;if(e.cellRegistry&&!c){const i=ot({accessor:s.accessor,rowId:null!==(n=t.stableRowKey)&&void 0!==n?n:d});Rn.set(p,i),e.cellRegistry.set(i,{updateContent:t=>{var n,i;if(!m){if(ut(x.row,s.accessor,t),b(),!s.expandable){const t=null!==(i=null===(n=fn.get(p))||void 0===n?void 0:n.context)&&void 0!==i?i:e;Sn.set(p,{row:x.row,value:ct(x.row,s.accessor),theme:t.theme,skeleton:!!x.tableRow.isLoadingSkeleton})}e.cellUpdateFlash&&(p.classList.add(f?"st-cell-updating-first":"st-cell-updating"),setTimeout(()=>{p.classList.remove("st-cell-updating-first","st-cell-updating")},800))}}})}};if(y(),!m&&!c){const t=t=>{var n,i;const o=t.target;if(o.closest("a, button, input, select, textarea, [contenteditable='true']"))return;if(t.preventDefault(),o.closest(".st-expand-icon-container"))return;const s=parseInt(null!==(n=p.getAttribute("data-row-index"))&&void 0!==n?n:"-1",10),r=parseInt(null!==(i=p.getAttribute("data-col-index"))&&void 0!==i?i:"-1",10),l=p.getAttribute("data-row-id");0>s||0>r||null===l||e.handleMouseDown({rowIndex:s,colIndex:r,rowId:l})},n=t=>{var n,i;const o=t,s=parseInt(null!==(n=p.getAttribute("data-row-index"))&&void 0!==n?n:"-1",10),r=parseInt(null!==(i=p.getAttribute("data-col-index"))&&void 0!==i?i:"-1",10),l=p.getAttribute("data-row-id");e.handleMouseOver(0>s||0>r||null===l?u:{rowIndex:s,colIndex:r,rowId:l},o.clientX,o.clientY)};h(p,"mousedown",t),h(p,"mouseover",n)}if(h(p,"keydown",t=>{m||c||"F2"!==t.key&&"Enter"!==t.key||!s.editable||m||(t.preventDefault(),m=!0,b())}),h(p,"dblclick",t=>{!s.editable||c||m||(m=!0,b())}),(e.onCellClick||e.selectRowOnClick)&&!c){const t=t=>{var n,i,o,c,h,u,f,v;if(t.target.closest(".st-expand-icon-container"))return;const w=null!==(i=null===(n=fn.get(p))||void 0===n?void 0:n.row)&&void 0!==i?i:r,m=null!==(c=null===(o=fn.get(p))||void 0===o?void 0:o.context)&&void 0!==c?c:e,g=null!==(h=p.getAttribute("data-row-id"))&&void 0!==h?h:d+"";if(m.selectRowOnClick&&m.enableRowSelection&&(null===(u=m.handleToggleRow)||void 0===u||u.call(m,g)),m.onCellClick){const t=ct(w,s.accessor),e=parseInt(null!==(f=p.getAttribute("data-row-index"))&&void 0!==f?f:l+"",10),n=parseInt(null!==(v=p.getAttribute("data-col-index"))&&void 0!==v?v:a+"",10);m.onCellClick({accessor:s.accessor,colIndex:n,row:w,rowIndex:e,value:t})}};h(p,"click",t)}if(e.hoverRowBackground){const t=d+"",n=e.hoverScopeId;Cn(t,p,n);const i=()=>{var e,i,o;const s=null!==(e=yn.get(p))&&void 0!==e?e:n,r=null!==(i=p.getAttribute("data-row-id"))&&void 0!==i?i:t,l=null!==(o=xn.get(s))&&void 0!==o?o:null;null!==l&&l!==r&&In(l,!1,s),In(r,!0,s),xn.set(s,r)},o=()=>{var e,i,o;const s=null!==(e=yn.get(p))&&void 0!==e?e:n,r=null!==(i=p.getAttribute("data-row-id"))&&void 0!==i?i:t;In(r,!1,s),(null!==(o=xn.get(s))&&void 0!==o?o:null)===r&&xn.set(s,null)};h(p,"mouseenter",i),h(p,"mouseleave",o)}return p},Tn=(t,e,n)=>{var i,o,s,r,l,a;const{rowIndex:d,colIndex:c,rowId:h}=e,u={rowIndex:d,colIndex:c,rowId:h};t.className=Hn(e,n);const f=n.isInitialFocusedCell(u);t.setAttribute("tabindex",f?"0":"-1"),t.style.left=e.left+"px",t.style.top=e.top+"px";const v=t.dataset.stAccordionGrow;"horizontal"!==v&&(t.style.width=e.width+"px"),"vertical"!==v&&(t.style.height=e.height+"px"),t.setAttribute("data-row-index",d+""),t.setAttribute("data-col-index",c+"");const p=null!==(i=n.maxHeaderDepth)&&void 0!==i?i:1;t.setAttribute("aria-rowindex",e.tableRow.position+p+1+""),t.setAttribute("aria-colindex",c+1+""),n.enableRowSelection?t.setAttribute("aria-selected",(null===(o=n.isRowSelected)||void 0===o?void 0:o.call(n,h))?"true":"false"):t.hasAttribute("aria-selected")&&t.removeAttribute("aria-selected");const w=void 0!==n.rowHeaderAccessor&&e.header.accessor===n.rowHeaderAccessor?"rowheader":"gridcell";t.getAttribute("role")!==w&&t.setAttribute("role",w);const m=t.getAttribute("data-row-id"),g=h+"";if(m&&m!==g){const e=null!==(s=yn.get(t))&&void 0!==s?s:n.hoverScopeId;Mn(m,t),Cn(g,t,e)}t.setAttribute("data-row-id",g),t.setAttribute("data-accessor",e.header.accessor+"");const b=fn.get(t);if(b?(b.row=e.row,b.tableRow=e.tableRow,b.context=n):fn.set(t,{row:e.row,tableRow:e.tableRow,context:n}),e.header.expandable){const i=t.querySelector(".st-cell-content");i&&!!e.tableRow.isLoadingSkeleton!=(null!==i.querySelector(".st-loading-skeleton"))&&(null===(r=n.onRendererHostDiscard)||void 0===r||r.call(n,i),i.innerHTML="",gn(e,n,i))}else{const i=t.querySelector(".st-cell-content");if(i){const o=Sn.get(t),s=ct(e.row,e.header.accessor),r=!!e.tableRow.isLoadingSkeleton,d=i.querySelector("[data-st-portal-id]"),c=null!==d&&""===(null!==(l=d.textContent)&&void 0!==l?l:"").trim()&&0===d.childNodes.length;0!==i.childNodes.length&&!c&&void 0!==o&&o.row===e.row&&o.value===s&&o.theme===n.theme&&o.skeleton===r||(Sn.set(t,{row:e.row,value:s,theme:n.theme,skeleton:r}),null===(a=n.onRendererHostDiscard)||void 0===a||a.call(n,i),i.innerHTML="",gn(e,n,i))}}},En=t=>{if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map(En);const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=En(t[n]));return e},An=(t,e)=>t.filter(t=>t.pinned===e).some(t=>!Z(t)),Wn="st-accordion-animating",On="--st-accordion-duration",Pn="--st-accordion-easing";function $n(t){return{pinnedLeft:t.filter(t=>"left"===t.pinned),unpinned:t.filter(t=>!t.pinned),pinnedRight:t.filter(t=>"right"===t.pinned)}}function Fn(t,e){return!0===t.essential||e.has(t.accessor+"")}function Ln(t,e){let n=!1;for(const i of t){if(i.isSelectionColumn||Z(i))continue;const t=Fn(i,e);if(t&&n)return!1;t||(n=!0)}return!0}function Dn(t,e){var n;const{pinnedLeft:i,unpinned:o,pinnedRight:s}=$n(t);if(!Ln(i,e))return!1;if(!Ln(o,e))return!1;if(!Ln(s,e))return!1;for(const i of t)if((null===(n=i.children)||void 0===n?void 0:n.length)&&!jn(i.children,e))return!1;return!0}function jn(t,e){var n;if(!Ln(t,e))return!1;for(const i of t)if((null===(n=i.children)||void 0===n?void 0:n.length)&&!jn(i.children,e))return!1;return!0}function Nn(t){const{pinnedLeft:e,unpinned:n,pinnedRight:i}=$n(t);return{left:e.map(t=>t.accessor),main:n.map(t=>t.accessor),right:i.map(t=>t.accessor)}}function Bn(t,e,n){return[...t.filter(t=>Fn(e.get(t+""),n)),...t.filter(t=>!Fn(e.get(t+""),n))]}function zn(t,e,n){const i=new Set(t.map(t=>t.accessor+"")),o=[...e.left,...e.main,...e.right];if(o.length!==i.size)return null;for(const t of o)if(!i.has(t+""))return null;const s=new Map(t.map(t=>[t.accessor+"",t])),r=Bn(e.left,s,n),l=Bn(e.main,s,n),a=Bn(e.right,s,n),d=(t,e)=>{const n=Object.assign({},t);return"left"===e?n.pinned="left":"right"===e?n.pinned="right":delete n.pinned,n};return[...r.map(t=>d(s.get(t+""),"left")),...l.map(t=>d(s.get(t+""),void 0)),...a.map(t=>d(s.get(t+""),"right"))]}function Vn(t,e,n,i){const o=e+"",s=Nn(t),r=s.left.filter(t=>t+""!==o),l=s.main.filter(t=>t+""!==o),a=s.right.filter(t=>t+""!==o),d=t.find(t=>t.accessor+""===o);return d&&(!Fn(d,i)||"main"!==n||"left"!==d.pinned&&"right"!==d.pinned)?("left"===n?r.push(e):"right"===n?a.push(e):"left"===d.pinned?l.unshift(e):l.push(e),zn(t,{left:r,main:l,right:a},i)):null}class qn{static resolveIcons(t){var e,n,i,o,s,r,l,a,d,c,h,u,f,v,p,w,m,g;const b={drag:nn("st-drag-icon"),expand:Ze("st-expand-icon"),filter:Xe({className:"st-header-icon",paths:["M3 6h18","M7 12h10","M10 18h4"]}),headerCollapse:Ze("st-header-icon"),headerExpand:Qe("st-header-icon"),next:Ze("st-next-prev-icon"),prev:Qe("st-next-prev-icon"),sortDown:en("st-header-icon"),sortUp:tn("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!==(o=null===(i=t.icons)||void 0===i?void 0:i.expand)&&void 0!==o?o:b.expand,filter:null!==(r=null===(s=t.icons)||void 0===s?void 0:s.filter)&&void 0!==r?r:b.filter,headerCollapse:null!==(a=null===(l=t.icons)||void 0===l?void 0:l.headerCollapse)&&void 0!==a?a:b.headerCollapse,headerExpand:null!==(c=null===(d=t.icons)||void 0===d?void 0:d.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!==(v=null===(f=t.icons)||void 0===f?void 0:f.prev)&&void 0!==v?v:b.prev,sortDown:null!==(w=null===(p=t.icons)||void 0===p?void 0:p.sortDown)&&void 0!==w?w:b.sortDown,sortUp:null!==(g=null===(m=t.icons)||void 0===m?void 0:m.sortUp)&&void 0!==g?g:b.sortUp}}static mergeCustomTheme(t){return Object.assign(Object.assign({},e),t.customTheme)}static mergeColumnEditorConfig(t){var e,n,i,o,s,r,l,a,d,c,h,u,f;return{text:null!==(n=null===(e=t.columnEditorConfig)||void 0===e?void 0:e.text)&&void 0!==n?n:"Columns",showToggle:null===(o=null===(i=t.columnEditorConfig)||void 0===i?void 0:i.showToggle)||void 0===o||o,searchEnabled:null===(r=null===(s=t.columnEditorConfig)||void 0===s?void 0:s.searchEnabled)||void 0===r||r,searchPlaceholder:null!==(a=null===(l=t.columnEditorConfig)||void 0===l?void 0:l.searchPlaceholder)&&void 0!==a?a:"Search columns...",allowColumnPinning:null===(c=null===(d=t.columnEditorConfig)||void 0===d?void 0:d.allowColumnPinning)||void 0===c||c,searchFunction:null===(h=t.columnEditorConfig)||void 0===h?void 0:h.searchFunction,rowRenderer:null===(u=t.columnEditorConfig)||void 0===u?void 0:u.rowRenderer,customRenderer:null===(f=t.columnEditorConfig)||void 0===f?void 0:f.customRenderer}}static buildEssentialAccessors(t){return function(t){const e=new Set,n=t=>{var i;for(const o of t)o.essential&&e.add(o.accessor+""),(null===(i=o.children)||void 0===i?void 0:i.length)&&n(o.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 Ke(null===(e=t.expandAll)||void 0===e||e,t.rowGrouping)}}class Gn{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,i,o,s;const r=null!==(n=e.theme)&&void 0!==n?n:"modern-light",l=null!==(i=e.className)&&void 0!==i?i:"",a=null!==(o=e.columnBorders)&&void 0!==o&&o,d=document.createElement("div");d.className=`simple-table-root st-wrapper theme-${r} ${l} ${a?"st-column-borders":""}`;const c=document.createElement("div");c.className="st-wrapper-container";const h=document.createElement("div");h.className="st-content-wrapper";const u=document.createElement("div");u.className="st-content",u.setAttribute("role",Array.isArray(e.rowGrouping)&&e.rowGrouping.length>0?"treegrid":"grid");const f=z(e.enableColumnEditor,null===(s=e.columnEditorConfig)||void 0===s?void 0:s.showToggle);u.style.width=f>0?`calc(100% - ${f}px)`:"100%";const v=document.createElement("div");v.className="st-header-container",v.setAttribute("role","rowgroup"),this.refs.headerContainerRef.current=v;const p=document.createElement("div");p.className="st-body-container",p.setAttribute("role","rowgroup"),p.setAttribute("tabindex","0"),this.refs.tableBodyContainerRef.current=p;const w=document.createElement("div");w.id="st-footer-container";const m="top"===e.footerPosition;m&&d.classList.add("st-footer-position-top");const g=document.createElement("div");return g.setAttribute("aria-live","polite"),g.setAttribute("aria-atomic","true"),g.className="st-sr-only",u.appendChild(v),u.appendChild(p),h.appendChild(u),m?(c.appendChild(w),c.appendChild(h)):(c.appendChild(h),c.appendChild(w)),d.appendChild(c),d.appendChild(g),t.appendChild(d),this.elements={rootElement:d,wrapperContainer:c,contentWrapper:h,content:u,headerContainer:v,bodyContainer:p,footerContainer:w,ariaLiveRegion:g},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}`}syncFooterPosition(t){if(!this.elements)return;const{rootElement:e,wrapperContainer:n,contentWrapper:i,footerContainer:o}=this.elements,s="top"===t;e.classList.toggle("st-footer-position-top",s);const r=n.querySelector(".st-horizontal-scrollbar-container");if(s)return o!==n.firstElementChild&&n.insertBefore(o,i),void(r&&n.appendChild(r));r&&r.parentElement===n?n.insertBefore(o,r):o!==n.lastElementChild&&n.appendChild(o)}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 Kn=(t,e)=>{const{sort:n,icons:i}=e;if(!n||n.key.accessor!==t.accessor)return null;const o=document.createElement("div");o.className="st-icon-container",o.setAttribute("role","button"),o.setAttribute("tabindex","0"),o.setAttribute("aria-label",`Sort ${t.label} ${"asc"===n.direction?"descending":"ascending"}`);const s="asc"===n.direction?i.sortUp:i.sortDown;return s&&("string"==typeof s?o.innerHTML=s:(s instanceof HTMLElement||s instanceof SVGSVGElement)&&o.appendChild(s.cloneNode(!0))),I(o,"click",n=>{n.stopPropagation(),e.onSort(t.accessor)}),I(o,"keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),e.onSort(t.accessor))}),o},_n={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"},Un={string:["equals","notEquals","contains","notContains","startsWith","endsWith","isEmpty","isNotEmpty"],number:["equals","notEquals","greaterThan","lessThan","greaterThanOrEqual","lessThanOrEqual","between","notBetween","isEmpty","isNotEmpty"],boolean:["equals","isEmpty","isNotEmpty"],date:["equals","notEquals","before","after","between","notBetween","isEmpty","isNotEmpty"],enum:["in","notIn","isEmpty","isNotEmpty"]},Jn=["equals","notEquals","isEmpty","isNotEmpty"],Yn=(t,e)=>{var n;const i=null!==(n=Un[t])&&void 0!==n?n:Jn;if(e&&e.length>0){const t=new Set(i),n=e.filter(e=>t.has(e));if(n.length>0)return n}return i},Xn=t=>!["between","notBetween","in","notIn","isEmpty","isNotEmpty"].includes(t),Qn=t=>["between","notBetween","in","notIn"].includes(t),Zn=t=>["isEmpty","isNotEmpty"].includes(t),ti=t=>{var e;return null!==(e=null==t?void 0:t.closest(".simple-table-root"))&&void 0!==e?e:null},ei=t=>{var e,n,i;let{children:o,containerRef:s,mainBodyRef:r,anchorElement:l,onClose:a,open:d,overflow:c="auto",width:h,maxWidth:u,positioning:f="fixed",allowDescendantOverflow:v=!1}=t,p=v;const w="st-dropdown-content--allow-descendant-overflow",m=document.createElement("div");m.className="st-dropdown-content",p&&m.classList.add(w),m.style.position=f,m.style.overflow=p?"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(o);let g=l;if("fixed"===f){const t=null!==(i=null!==(n=null!==(e=ti(g))&&void 0!==e?e:ti(null!=r?r:null))&&void 0!==n?n:ti(null!=s?s:null))&&void 0!==i?i:document.querySelector(".simple-table-root");(null!=t?t:document.body).appendChild(m)}const b=t=>{d&&m&&!m.contains(t.target)&&(S(!1),null==a||a())},x=t=>{const e=t.target;if(!m.contains(e)&&!(null==g?void 0:g.contains(e))){if("absolute"===f){const t=m.parentElement;if(null==t?void 0:t.contains(e))return}S(!1),null==a||a()}},y=t=>{"Escape"===t.key&&d&&(S(!1),null==a||a())},R=t=>{"Enter"===t.key&&x(t)},S=t=>{d=t,d?(m.style.display="flex",(()=>{if(!d)return;if("absolute"===f&&!m.parentElement)return;if("fixed"===f&&!m.parentElement)return;m.style.visibility="hidden";const t=g||m.parentElement;t?requestAnimationFrame(()=>{const e=t.getBoundingClientRect(),n=m.offsetHeight,i=h||m.offsetWidth;let o;o=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=o.bottom-e.bottom,a=e.top-o.top;let d="bottom";(n>l&&a>=n||n>l&&a>l)&&(d="top");let c="left";if(i>o.right-e.right+e.width&&(c="right"),"fixed"===f)"bottom"===d?(m.style.top=e.bottom+4+"px",m.style.bottom="auto"):(m.style.bottom=window.innerHeight-e.top+4+"px",m.style.top="auto"),"left"===c?(m.style.left=e.left+"px",m.style.right="auto"):(m.style.right=window.innerWidth-e.right+"px",m.style.left="auto");else{const t=m.parentElement;if(!t)return void(m.style.visibility="visible");const n=t.getBoundingClientRect();"bottom"===d?(m.style.top=e.bottom-n.top+4+"px",m.style.bottom="auto"):(m.style.bottom=n.bottom-e.top+4+"px",m.style.top="auto"),"left"===c?(m.style.left=e.left-n.left+"px",m.style.right="auto"):(m.style.right=n.right-e.right+"px",m.style.left="auto")}m.className=`st-dropdown-content st-dropdown-${d}-${c}${p?" "+w:""}`,m.style.visibility="visible"}):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 d?S(!0):m.style.display="none",{element:m,update:t=>{void 0!==t.anchorElement&&(g=t.anchorElement),void 0!==t.open&&S(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=p?"visible":c),void 0!==t.allowDescendantOverflow&&(p=t.allowDescendantOverflow,m.classList.toggle(w,p),m.style.overflow=p?"visible":c)},destroy:()=>{S(!1),m.remove()},setOpen:S}},ni=t=>{let{value:e,onChange:n,options:i,placeholder:o="Select...",className:s="",disabled:r=!1,containerRef:l,mainBodyRef:a}=t,d=!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 f=document.createElement("span");f.className="st-custom-select-value";const v=i.find(t=>t.value===e);f.textContent=v?v.label:o;const p=(()=>{const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("class","st-custom-select-arrow"),t.setAttribute("width","12"),t.setAttribute("height","12"),t.setAttribute("viewBox","0 0 12 12"),t.setAttribute("fill","none"),t.setAttribute("xmlns","http://www.w3.org/2000/svg"),t.setAttribute("aria-hidden","true");const e=document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttribute("d","M3 4.5L6 7.5L9 4.5"),e.setAttribute("stroke","currentColor"),e.setAttribute("stroke-width","1.5"),e.setAttribute("stroke-linecap","round"),e.setAttribute("stroke-linejoin","round"),e.setAttribute("fill","none"),t.appendChild(e),t})();u.appendChild(f),u.appendChild(p),h.appendChild(u);const w=document.createElement("div");w.className="st-custom-select-options",w.setAttribute("role","listbox");const m=()=>{w.innerHTML="",i.forEach((t,n)=>{const i=document.createElement("div");i.className=`st-custom-select-option ${t.value===e?"st-custom-select-option-selected":""} ${n===c?"st-custom-select-option-focused":""}`.trim(),i.setAttribute("role","option"),i.setAttribute("aria-selected",""+(t.value===e)),i.setAttribute("tabindex","0"),i.textContent=t.label,i.addEventListener("click",()=>x(t.value)),i.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),x(t.value))}),w.appendChild(i)})};m();const g=ei({children:w,containerRef:l,mainBodyRef:a,anchorElement:u,onClose:()=>{S(!1)},open:d,overflow:"auto",positioning:"absolute"});h.appendChild(g.element);const b=t=>{e=t;const n=i.find(t=>t.value===e);f.textContent=n?n.label:o},x=t=>{b(t),n(t),S(!1),c=-1,m()},y=()=>{if(!r){if(S(!d),d)c=-1;else{const t=i.findIndex(t=>t.value===e);c=0>t?0:t}m()}},R=t=>{if(d)switch(t.key){case"ArrowDown":t.preventDefault(),c=i.length-1>c?c+1:0,m();break;case"ArrowUp":t.preventDefault(),c=c>0?c-1:i.length-1,m();break;case"Enter":if(t.preventDefault(),c>=0){const t=i[c].value;b(t),n(t),S(!1),c=-1,m()}break;case"Escape":t.preventDefault(),S(!1),c=-1,m()}},S=t=>{d=t,u.setAttribute("aria-expanded",""+d),d?(h.classList.add("st-custom-select-open"),document.addEventListener("keydown",R)):(h.classList.remove("st-custom-select-open"),document.removeEventListener("keydown",R)),g.setOpen(d)};return u.addEventListener("click",y),{element:h,update:t=>{if(void 0!==t.value){e=t.value;const n=i.find(t=>t.value===e);f.textContent=n?n.label:o,m()}void 0!==t.options&&(i=t.options,m()),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",y),document.removeEventListener("keydown",R),g.destroy(),h.remove()},setOpen:S}},ii=t=>{let{type:e="text",value:n,onChange:i,onEnter:o,placeholder:s="",autoFocus:r=!1,min:l,max:a,step:d}=t;const c=document.createElement("input");c.className="st-filter-input",c.type=e,c.value=n,c.placeholder=s,void 0!==l&&(c.min=l),void 0!==a&&(c.max=a),void 0!==d&&(c.step=d),r&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{c.focus()})});const h=t=>{i(t.target.value)},u=t=>{"Enter"===t.key&&o&&(t.preventDefault(),o())};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&&(a=t.max,c.max=a),void 0!==t.step&&(d=t.step,c.step=d),void 0!==t.onChange&&(i=t.onChange),void 0!==t.onEnter&&(o=t.onEnter)},destroy:()=>{c.removeEventListener("input",h),c.removeEventListener("keydown",u),c.remove()}}},oi=t=>{let{onApply:e,onClear:n,canApply:i,showClear:o}=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=!i,r.className=("st-filter-button st-filter-button-apply"+(i?"":" st-filter-button-disabled")).trim()};l();const a=()=>{e()};r.addEventListener("click",a),s.appendChild(r);let d=null;const c=()=>{null==n||n()},h=()=>{const t=o&&!!n;t&&!d?(d=document.createElement("button"),d.type="button",d.tabIndex=0,d.className="st-filter-button st-filter-button-clear",d.textContent="Clear",d.addEventListener("click",c),s.appendChild(d)):!t&&d&&(d.removeEventListener("click",c),d.remove(),d=null)};return h(),{element:s,update:t=>{void 0!==t.canApply&&(i=t.canApply,l()),void 0!==t.showClear&&(o=t.showClear,h()),void 0!==t.onApply&&(e=t.onApply),void 0!==t.onClear&&(n=t.onClear,h())},destroy:()=>{r.removeEventListener("click",a),d&&d.removeEventListener("click",c),s.remove()}}},si=t=>{let{onChange:e,onClose:n,value:i}=t,o=i||new Date,s="days";const r=document.createElement("div");r.className="st-datepicker";const l=(t,e)=>new Date(t,e+1,0).getDate(),a=()=>{o=new Date(o.getFullYear(),o.getMonth()-1,1),v()},d=()=>{o=new Date(o.getFullYear(),o.getMonth()+1,1),v()},c=t=>{o=new Date(t,o.getMonth(),1),s="months",v()},h=t=>{const i=o.getFullYear(),s=o.getMonth(),r=new Date(i,s,t,12,0,0);o=r,e(r),null==n||n()},u=t=>{const i=new Date(o.getFullYear(),o.getMonth()-1,t,12,0,0);o=i,e(i),null==n||n()},f=t=>{const i=new Date(o.getFullYear(),o.getMonth()+1,t,12,0,0);o=i,e(i),null==n||n()},v=()=>{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.appendChild(Qe()),e.addEventListener("click",a);const n=document.createElement("div");n.className="st-datepicker-header-label",n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.setAttribute("aria-label","Select month"),n.textContent=`${p=o,p.toLocaleString("default",{month:"long"})} ${o.getFullYear()}`,n.addEventListener("click",()=>{s="months",v()});const i=document.createElement("button");i.className="st-datepicker-nav-btn",i.appendChild(Ze()),i.addEventListener("click",d),t.appendChild(e),t.appendChild(n),t.appendChild(i)}else if("months"===s){const e=document.createElement("div");e.className="st-datepicker-header-label",e.setAttribute("role","button"),e.setAttribute("tabindex","0"),e.setAttribute("aria-label","Select year"),e.textContent=""+o.getFullYear(),e.addEventListener("click",()=>{s="years",v()}),t.appendChild(e)}else{const e=document.createElement("div");e.className="st-datepicker-header-label",e.textContent="Select Year",t.appendChild(e)}var p;r.appendChild(t);const w=document.createElement("div");var m;w.className=`st-datepicker-grid st-datepicker-${s}-grid`,"days"===s?(t=>{const e=o.getFullYear(),n=o.getMonth(),s=l(e,n),r=((t,e)=>new Date(t,e,1).getDay())(e,n),a=l(e,n-1);["Su","Mo","Tu","We","Th","Fr","Sa"].forEach(e=>{const n=document.createElement("div");n.className="st-datepicker-weekday",n.textContent=e,t.appendChild(n)});for(let e=0;r>e;e++){const n=a-r+e+1,i=document.createElement("div");i.className="st-datepicker-day other-month",i.textContent=""+n,i.addEventListener("click",()=>u(n)),t.appendChild(i)}for(let o=1;s>=o;o++){const s=o===(new Date).getDate()&&n===(new Date).getMonth()&&e===(new Date).getFullYear(),r=new Date(i),l=o===r.getDate()&&n===r.getMonth()&&e===r.getFullYear(),a=document.createElement("div");a.className=`st-datepicker-day ${s?"today":""} ${l?"selected":""}`.trim(),a.textContent=""+o,a.addEventListener("click",()=>h(o)),t.appendChild(a)}const d=35-(r+s);for(let e=1;d>=e;e++){const n=document.createElement("div");n.className="st-datepicker-day other-month",n.textContent=""+e,n.addEventListener("click",()=>f(e)),t.appendChild(n)}})(w):"months"===s?(m=w,Array.from({length:12},(t,e)=>new Date(2e3,e,1).toLocaleString("default",{month:"short"})).forEach((t,e)=>{const n=e===o.getMonth(),i=document.createElement("div");i.className=("st-datepicker-month "+(n?"selected":"")).trim(),i.textContent=t,i.addEventListener("click",()=>(t=>{o=new Date(o.getFullYear(),t,1),s="days",v()})(e)),m.appendChild(i)})):(t=>{const e=o.getFullYear(),n=e-6;for(let i=n;n+12>i;i++){const n=i===e,o=document.createElement("div");o.className=("st-datepicker-year "+(n?"selected":"")).trim(),o.textContent=""+i,o.addEventListener("click",()=>c(i)),t.appendChild(o)}})(w),r.appendChild(w);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,i=new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0);o=i,e(i),null==n||n()}),g.appendChild(b),r.appendChild(g)};return v(),{element:r,update:t=>{void 0!==t.value&&(i=t.value,o=i||new Date,v()),void 0!==t.onChange&&(e=t.onChange),void 0!==t.onClose&&(n=t.onClose)},destroy:()=>{r.remove()}}},ri=t=>{const{header:e}=t;switch(e.type){case"string":default:return(t=>{let{header:e,currentFilter:n,onApplyFilter:i,onClearFilter:o,containerRef:s,mainBodyRef:r}=t;const l=Yn("string",e.filterOperators),a=l.includes("contains")?"contains":l[0];let d=(null==n?void 0:n.operator)||a;l.includes(d)||(d=a);let c=((null==n?void 0:n.value)||"")+"";const h=document.createElement("div");h.className="st-filter-container";const u=document.createElement("div");u.className="st-filter-section";const f=ni({value:d,onChange:t=>{d=t,b()},options:l.map(t=>({value:t,label:_n[t]})),containerRef:s,mainBodyRef:r});u.appendChild(f.element),h.appendChild(u);let v=null,p=null,w=null;const m=()=>{const t=Object.assign({accessor:e.accessor,operator:d},Xn(d)&&{value:c});i(t)},g=()=>Zn(d)||""!==c.trim(),b=()=>{v&&(v.remove(),v=null),p&&(p.destroy(),p=null),Xn(d)&&(v=document.createElement("div"),v.className="st-filter-section",p=ii({type:"text",value:c,onChange:t=>{c=t,w&&w.update({canApply:g()})},onEnter:m,placeholder:"Filter...",autoFocus:!0}),v.appendChild(p.element),h.insertBefore(v,h.lastChild)),w&&w.update({canApply:g()})};return w=oi({onApply:m,onClear:o,canApply:g(),showClear:!!n}),h.appendChild(w.element),b(),{element:h,update:t=>{void 0!==t.currentFilter&&(n=t.currentFilter,d=(null==n?void 0:n.operator)||a,l.includes(d)||(d=a),c=((null==n?void 0:n.value)||"")+"",f.update({value:d}),p&&p.update({value:c}),w&&w.update({showClear:!!n,canApply:g()}),b())},destroy:()=>{f.destroy(),p&&p.destroy(),w&&w.destroy(),h.remove()}}})(t);case"number":return(t=>{var e,n;let{header:i,currentFilter:o,onApplyFilter:s,onClearFilter:r,containerRef:l,mainBodyRef:a}=t;const d=Yn("number",i.filterOperators),c=d.includes("equals")?"equals":d[0];let h=(null==o?void 0:o.operator)||c;d.includes(h)||(h=c);let u=((null==o?void 0:o.value)||"")+"",f=((null===(e=null==o?void 0:o.values)||void 0===e?void 0:e[0])||"")+"",v=((null===(n=null==o?void 0:o.values)||void 0===n?void 0:n[1])||"")+"";const p=document.createElement("div");p.className="st-filter-container";const w=document.createElement("div");w.className="st-filter-section";const m=ni({value:h,onChange:t=>{h=t,M()},options:d.map(t=>({value:t,label:_n[t]})),containerRef:l,mainBodyRef:a});w.appendChild(m.element),p.appendChild(w);let g=null,b=null,x=null,y=null,R=null;const S=()=>{const t={accessor:i.accessor,operator:h};Xn(h)?t.value=parseFloat(u):Qn(h)&&(t.values=[parseFloat(f),parseFloat(v)]),s(t)},C=()=>!!Zn(h)||(Xn(h)?""!==u.trim():!!Qn(h)&&""!==f.trim()&&""!==v.trim()),M=()=>{g&&(g.remove(),g=null),b&&(b.destroy(),b=null),x&&(x.destroy(),x=null),y&&(y.destroy(),y=null),Xn(h)?(g=document.createElement("div"),g.className="st-filter-section",b=ii({type:"number",value:u,onChange:t=>{u=t,R&&R.update({canApply:C()})},onEnter:S,placeholder:"Enter number...",autoFocus:!0}),g.appendChild(b.element),p.insertBefore(g,p.lastChild)):Qn(h)&&(g=document.createElement("div"),g.className="st-filter-section",x=ii({type:"number",value:f,onChange:t=>{f=t,R&&R.update({canApply:C()})},onEnter:S,placeholder:"From...",autoFocus:!0}),x.element.classList.add("st-filter-input-range-from"),y=ii({type:"number",value:v,onChange:t=>{v=t,R&&R.update({canApply:C()})},onEnter:S,placeholder:"To..."}),g.appendChild(x.element),g.appendChild(y.element),p.insertBefore(g,p.lastChild)),R&&R.update({canApply:C()})};return R=oi({onApply:S,onClear:r,canApply:C(),showClear:!!o}),p.appendChild(R.element),M(),{element:p,update:t=>{var e,n;void 0!==t.currentFilter&&(o=t.currentFilter,h=(null==o?void 0:o.operator)||c,d.includes(h)||(h=c),u=((null==o?void 0:o.value)||"")+"",f=((null===(e=null==o?void 0:o.values)||void 0===e?void 0:e[0])||"")+"",v=((null===(n=null==o?void 0:o.values)||void 0===n?void 0:n[1])||"")+"",m.update({value:h}),b&&b.update({value:u}),x&&x.update({value:f}),y&&y.update({value:v}),R&&R.update({showClear:!!o,canApply:C()}),M())},destroy:()=>{m.destroy(),b&&b.destroy(),x&&x.destroy(),y&&y.destroy(),R&&R.destroy(),p.remove()}}})(t);case"boolean":return(t=>{let{header:e,currentFilter:n,onApplyFilter:i,onClearFilter:o,containerRef:s,mainBodyRef:r}=t;const l=Yn("boolean",e.filterOperators),a=l.includes("equals")?"equals":l[0];let d=(null==n?void 0:n.operator)||a;l.includes(d)||(d=a);let c=void 0!==(null==n?void 0:n.value)?n.value+"":"true";const h=document.createElement("div");h.className="st-filter-container";const u=document.createElement("div");u.className="st-filter-section";const f=ni({value:d,onChange:t=>{d=t,b()},options:l.map(t=>({value:t,label:_n[t]})),containerRef:s,mainBodyRef:r});u.appendChild(f.element),h.appendChild(u);let v=null,p=null,w=null;const m=()=>Zn(d)||""!==c,g=[{value:"true",label:"True"},{value:"false",label:"False"}],b=()=>{v&&(v.remove(),v=null),p&&(p.destroy(),p=null),Xn(d)&&(v=document.createElement("div"),v.className="st-filter-section",p=ni({value:c,onChange:t=>{c=t,w&&w.update({canApply:m()})},options:g,containerRef:s,mainBodyRef:r}),v.appendChild(p.element),h.insertBefore(v,h.lastChild)),w&&w.update({canApply:m()})};return w=oi({onApply:()=>{const t={accessor:e.accessor,operator:d};Xn(d)&&(t.value="true"===c),i(t)},onClear:o,canApply:m(),showClear:!!n}),h.appendChild(w.element),b(),{element:h,update:t=>{void 0!==t.currentFilter&&(n=t.currentFilter,d=(null==n?void 0:n.operator)||a,l.includes(d)||(d=a),c=void 0!==(null==n?void 0:n.value)?n.value+"":"true",f.update({value:d}),p&&p.update({value:c}),w&&w.update({showClear:!!n,canApply:m()}),b())},destroy:()=>{f.destroy(),p&&p.destroy(),w&&w.destroy(),h.remove()}}})(t);case"date":return(t=>{var e,n;let{header:i,currentFilter:o,onApplyFilter:s,onClearFilter:r,containerRef:l,mainBodyRef:a}=t;const d=Yn("date",i.filterOperators),c=d.includes("equals")?"equals":d[0];let h=(null==o?void 0:o.operator)||c;d.includes(h)||(h=c);let u=(null==o?void 0:o.value)?o.value+"":"",f=(null===(e=null==o?void 0:o.values)||void 0===e?void 0:e[0])?o.values[0]+"":"",v=((null===(n=null==o?void 0:o.values)||void 0===n?void 0:n[1])||"")+"";const p=document.createElement("div");p.className="st-filter-container";const w=document.createElement("div");w.className="st-filter-section";const m=ni({value:h,onChange:t=>{h=t,W()},options:d.map(t=>({value:t,label:_n[t]})),containerRef:l,mainBodyRef:a});w.appendChild(m.element),p.appendChild(w);let g=null,b=null,x=null,y=null,R=null,S=null,C=null,M=null,I=null,H=null,k=null;const T=()=>!!Zn(h)||(Xn(h)?""!==u.trim():!!Qn(h)&&""!==f.trim()&&""!==v.trim()),E=t=>{if(!t)return"";const e=ee(t);return isNaN(e.getTime())?"":e.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})},A=(t,e,n,i=!1)=>{const o=document.createElement("div");o.className="st-date-input-container",o.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",i&&setTimeout(()=>s.focus(),0);let r=!1;const d=t?ee(t):new Date,c=si({value:d,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=ei({children:c.element,containerRef:l,mainBodyRef:a,anchorElement:s,onClose:()=>{r=!1},open:!1,overflow:"hidden",positioning:"absolute",width:280});o.appendChild(s),o.appendChild(h.element);const u=()=>{r=!r,h.setOpen(r)},f=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",f),{container:o,input:s,picker:c,dropdown:h,destroy:()=>{s.removeEventListener("click",u),s.removeEventListener("keydown",f),c.destroy(),h.destroy(),o.remove()}}},W=()=>{if(g&&(g.remove(),g=null),b&&(b=null),x&&(x=null),y&&(y=null),R&&(R.destroy(),R=null),S&&(S.destroy(),S=null),C&&(C.destroy(),C=null),M&&(M.destroy(),M=null),I&&(I.destroy(),I=null),H&&(H.destroy(),H=null),Xn(h)){g=document.createElement("div"),g.className="st-filter-section";const t=A(u,t=>{u=t,k&&k.update({canApply:T()})},"Select date...",!0);b=t.container,R=t.picker,M=t.dropdown,g.appendChild(b),p.insertBefore(g,p.lastChild)}else if(Qn(h)){g=document.createElement("div"),g.className="st-filter-section";const t=A(f,t=>{f=t,k&&k.update({canApply:T()})},"From date...",!0);t.input.classList.add("st-filter-input-range-from");const e=A(v,t=>{v=t,k&&k.update({canApply:T()})},"To date...",!1);x=t.container,S=t.picker,I=t.dropdown,y=e.container,C=e.picker,H=e.dropdown,g.appendChild(x),g.appendChild(y),p.insertBefore(g,p.lastChild)}k&&k.update({canApply:T()})};return k=oi({onApply:()=>{const t={accessor:i.accessor,operator:h};Xn(h)?t.value=u:Qn(h)&&(t.values=[f,v]),s(t)},onClear:r,canApply:T(),showClear:!!o}),p.appendChild(k.element),W(),{element:p,update:t=>{var e,n;void 0!==t.currentFilter&&(o=t.currentFilter,h=(null==o?void 0:o.operator)||c,d.includes(h)||(h=c),u=(null==o?void 0:o.value)?o.value+"":"",f=(null===(e=null==o?void 0:o.values)||void 0===e?void 0:e[0])?o.values[0]+"":"",v=((null===(n=null==o?void 0:o.values)||void 0===n?void 0:n[1])||"")+"",m.update({value:h}),k&&k.update({showClear:!!o,canApply:T()}),W())},destroy:()=>{m.destroy(),R&&R.destroy(),S&&S.destroy(),C&&C.destroy(),M&&M.destroy(),I&&I.destroy(),H&&H.destroy(),k&&k.destroy(),p.remove()}}})(t);case"enum":return(t=>{let{header:e,currentFilter:n,onApplyFilter:i,onClearFilter:o}=t;const s=e.enumOptions||[],r=s.map(t=>t.value);let l=(null==n?void 0:n.values)?n.values.map(String):r,a="";const d=document.createElement("div");d.className="st-filter-container";const c=document.createElement("div");c.className="st-filter-section";const h=document.createElement("div");h.className="st-enum-filter-options";const u=document.createElement("div");u.className="st-enum-select-all";const f=un({checked:l.length===r.length,onChange:t=>{l=t?[...r]:[],b(),y&&y.update({canApply:x()})}}),v=document.createElement("span");v.className="st-enum-option-label st-enum-select-all-label",v.textContent="Select All",f.element.appendChild(v),u.appendChild(f.element),h.appendChild(u);let p=null,w=null;s.length>10&&(p=document.createElement("div"),p.className="st-enum-search",w=ii({type:"text",value:a,onChange:t=>{a=t,b()},placeholder:"Search..."}),p.appendChild(w.element),h.appendChild(p));const m=document.createElement("div");h.appendChild(m);const g=[],b=()=>{m.innerHTML="",g.forEach(t=>t.checkbox.destroy()),g.length=0;const t=a?s.filter(t=>t.label.toLowerCase().includes(a.toLowerCase())):s;if(a&&0===t.length){const t=document.createElement("div");t.className="st-enum-no-results",t.textContent="No matching options",m.appendChild(t)}else t.forEach(t=>{const e=un({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;f.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;f.element.querySelector("input").checked=e};b(),c.appendChild(h),d.appendChild(c);const x=()=>0!==l.length&&l.length!==r.length,y=oi({onApply:()=>{l.length!==r.length?i({accessor:e.accessor,operator:"in",values:l}):o()},onClear:o,canApply:x(),showClear:!!n});return d.appendChild(y.element),{element:d,update:t=>{void 0!==t.currentFilter&&(n=t.currentFilter,l=(null==n?void 0:n.values)?n.values.map(String):r,a="",w&&w.update({value:a}),b(),y&&y.update({showClear:!!n,canApply:x()}))},destroy:()=>{f.destroy(),w&&w.destroy(),g.forEach(t=>t.checkbox.destroy()),y&&y.destroy(),d.remove()}}})(t)}},li=(t,e)=>{const{filters:n,handleApplyFilter:i,handleClearFilter:o,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 a=s.filter;let d=null;if(a)if("string"==typeof a)l.innerHTML=a,d=l.querySelector("svg");else if(a instanceof HTMLElement||a instanceof SVGSVGElement){const t=a.cloneNode(!0);l.appendChild(t),d=t}if(d){const t=r?"var(--st-button-active-background-color)":"var(--st-header-icon-color)";d.style.color=t,"none"!==d.getAttribute("fill")&&(d.style.fill=t)}let c=!1,h=null,u=null;const f=n=>{if(n.stopPropagation(),c=!c,l.setAttribute("aria-expanded",c+""),c){const n=t=>{i(t),c=!1,l.setAttribute("aria-expanded","false"),u&&(u.destroy(),u=null),h&&(h.destroy(),h=null),d&&(d.style.color="var(--st-button-active-background-color)","none"!==d.getAttribute("fill")&&(d.style.fill="var(--st-button-active-background-color)"))},s=()=>{o(t.accessor),c=!1,l.setAttribute("aria-expanded","false"),u&&(u.destroy(),u=null),h&&(h.destroy(),h=null),d&&(d.style.color="var(--st-header-icon-color)","none"!==d.getAttribute("fill")&&(d.style.fill="var(--st-header-icon-color)"))},a=e.mainBodyRef.current||void 0;h=ri({header:t,currentFilter:r,onApplyFilter:n,onClearFilter:s,containerRef:a,mainBodyRef:a}),u=ei({children:h.element,containerRef:a,mainBodyRef:a,anchorElement:l,onClose:()=>{c=!1,l.setAttribute("aria-expanded","false"),h&&(h.destroy(),h=null)},open:!0,positioning:"fixed",maxWidth:320,allowDescendantOverflow:!0})}else u&&(u.destroy(),u=null),h&&(h.destroy(),h=null)};return I(l,"click",f),I(l,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),f(t))}),l},ai=(t,e)=>{var n,i;const{icons:o}=e;if(!nt(t)||t.isSelectionColumn&&e.enableRowSelection)return null;const s=(null!==(i=null===(n=e.getCollapsedHeaders)||void 0===n?void 0:n.call(e))&&void 0!==i?i: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=o.expand;l&&("string"==typeof l?r.innerHTML=l:(l instanceof HTMLElement||l instanceof SVGSVGElement)&&r.appendChild(l.cloneNode(!0)));const a=n=>{var i,o;n.stopPropagation();const s=(null!==(o=null===(i=e.getCollapsedHeaders)||void 0===i?void 0:i.call(e))&&void 0!==o?o: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 I(r,"click",a),I(r,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),a(t))}),r},di=(t,e,n=[])=>{for(let i=0;t.length>i;i++){const o=t[i];if(o.accessor===e)return[...n,i];if(o.children&&o.children.length>0){const t=di(o.children,e,[...n,i]);if(t)return t}}return null},ci=(t,e)=>{if(t.pinned)return t.pinned;const n=tt(e,t.accessor);return n?ci(n,e):void 0},hi=(t,e)=>{const n=ci(t,e);return"left"===n?"left":"right"===n?"right":"main"};function ui(t,e,n){const i=En(t);let o=!1;function s(t,e){let n,i=t;for(let t=0;e.length-1>t;t++)i=i[e[t]].children;return n=i[e[e.length-1]],n}function r(t,e,n){let i=t;for(let t=0;e.length-1>t;t++){if(!i[e[t]].children){o=!0;break}i=i[e[t]].children}i[e[e.length-1]]=n}const l=s(i,e);return r(i,e,s(i,n)),r(i,n,l),{newHeaders:i,emergencyBreak:o}}const fi=(t,e)=>{const{mainBodyWidth:n,pinnedLeftWidth:i,pinnedRightWidth:o,pinnedLeftContentWidth:s,pinnedRightContentWidth:r,tableBodyContainerRef:l,enableColumnEditor:a}=e,d=a?B:0,c=(a?o+1:o)+(l.scrollHeight>l.clientHeight?l.offsetWidth-l.clientWidth:0),h=t.querySelector(".st-horizontal-scrollbar-left"),u=null==h?void 0:h.firstElementChild;i>0&&h&&u&&(h.style.width=i+"px",u.style.width=s+"px");const f=t.querySelector(".st-horizontal-scrollbar-middle"),v=null==f?void 0:f.firstElementChild;n>0&&f&&v&&(v.style.width=n+"px");const p=t.querySelector(".st-horizontal-scrollbar-right"),w=null==p?void 0:p.firstElementChild;if(o>0&&p&&w&&(p.style.width=c+"px",w.style.width=r+"px"),d>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=d-1.5+"px")}},vi=(t,e)=>{if(e){const n=t.querySelector(".st-horizontal-scrollbar-left"),i=t.querySelector(".st-horizontal-scrollbar-middle"),o=t.querySelector(".st-horizontal-scrollbar-right");n instanceof HTMLElement&&e.unregisterPane("pinned-left",n),i instanceof HTMLElement&&e.unregisterPane("main",i),o instanceof HTMLElement&&e.unregisterPane("pinned-right",o)}t.remove()},pi=({containerWidth:t,leftWidth:e,rightWidth:n})=>t>0?Math.max(0,t-e-n):void 0,wi=({headers:t,containerWidth:e,collapsedHeaders:n})=>{let i=0,o=0,s=0;t.forEach(t=>{if(Z(t))return;const e=St(t,n).reduce((t,e)=>t+kt(e),0);"left"===t.pinned?i+=e:"right"===t.pinned?o+=e:s+=e});const r=i,l=o;if(e&&e>0){const t=e*U(e,i>0,o>0);i>t&&(i=t),o>t&&(o=t)}return{leftWidth:Q(i),rightWidth:Q(o),mainWidth:s,leftContentWidth:r,rightContentWidth:l}},mi=(t,e)=>{if(t.pinned)return t.pinned;const n=tt(e,t.accessor);return n?mi(n,e):void 0},gi=(e,n,i)=>{var o;const s=[],r=[],l=[];e.forEach(t=>{if(Z(t))return;const n=mi(t,e);"left"===n?s.push(t):"right"===n?l.push(t):r.push(t)});const a=(e,o,s)=>{var r,l;if(Z(e))return o;const d=o;if(e.children&&e.children.length>0){const l=null==n?void 0:n.has(e.accessor),c=e.children.filter(e=>{if(Z(e))return!1;const n=e.showWhen||t;return l?"parentCollapsed"===n||"always"===n:"parentExpanded"===n||"always"===n});if(e.singleRowChildren){const t=null!==(r=null==i?void 0:i.get(e.accessor))&&void 0!==r?r:kt(e);return s.set(e.accessor,{left:d,width:t}),o=d+t,c.forEach(t=>{o=a(t,o,s)}),o}c.forEach(t=>{o=a(t,o,s)}),s.set(e.accessor,{left:d,width:o-d})}else{const t=null!==(l=null==i?void 0:i.get(e.accessor))&&void 0!==l?l:kt(e);s.set(e.accessor,{left:o,width:t}),o+=t}return o},d=t=>{const e=new Map;let n=0;return t.forEach(t=>{n=a(t,n,e)}),e},c=d(s),h=d(r),u=d(l),f=new Map;c.forEach((t,e)=>f.set(e,t)),h.forEach((t,e)=>f.set(e,t)),u.forEach((t,e)=>f.set(e,t)),f.forEach((t,e)=>{const{left:n,width:i}=t,o=ot({accessor:e,rowId:"header"}),s=document.getElementById(o);c.has(e),u.has(e),s&&(s.style.left=n+"px",s.style.width=i+"px"),document.querySelectorAll(`[id$="-${e}"]`).forEach(t=>{t instanceof HTMLElement&&!t.id.endsWith("-header")&&(t.style.left=n+"px",t.style.width=i+"px")})});const v=document.querySelector(".st-body-container"),p=null!==(o=null==v?void 0:v.clientWidth)&&void 0!==o?o:0,w=wi({headers:e,containerWidth:p>0?p:void 0,collapsedHeaders:n}),{leftWidth:m,rightWidth:g,mainWidth:b,leftContentWidth:x,rightContentWidth:y}=w;if(m>0){const t=document.querySelector(".st-header-pinned-left"),e=document.querySelector(".st-body-pinned-left");t&&(t.style.width=m+"px"),e&&(e.style.width=m+"px")}if(g>0){const t=document.querySelector(".st-header-pinned-right"),e=document.querySelector(".st-body-pinned-right");t&&(t.style.width=g+"px"),e&&(e.style.width=g+"px")}const R=null==v?void 0:v.closest(".simple-table-root"),S=null==R?void 0:R.querySelector(".st-horizontal-scrollbar-container"),C=null==R?void 0:R.querySelector(".st-body-main"),M=!!(null==R?void 0:R.querySelector(".st-column-editor:not(.st-column-editor--no-toggle)"));S&&C&&v&&C.scrollWidth-C.clientWidth>1&&fi(S,{mainBodyRef:C,mainBodyWidth:b,pinnedLeftWidth:m,pinnedRightWidth:g,pinnedLeftContentWidth:x,pinnedRightContentWidth:y,tableBodyContainerRef:v,enableColumnEditor:M})},bi=({columnsToShrink:t,totalCompensation:e,initialWidthsMap:n,shrinkFloors:i})=>{if(0>e){const i=Math.abs(e),o=t.reduce((t,e)=>t+(n.get(e.accessor)||100),0);if(0===o)return;return void t.forEach((e,s)=>{const r=n.get(e.accessor)||100;let l=i*(r/o);if(s===t.length-1){const e=t.slice(0,s).reduce((t,e)=>{const i=n.get(e.accessor)||100;return t+(("number"==typeof e.width?e.width:100)-i)},0);l=i-e}e.width=r+l})}let o=e;for(;o>.5;){const e=t.map(t=>{var e;const o=n.get(t.accessor)||100,s=Math.max(null!==(e=null==i?void 0:i.get(t.accessor))&&void 0!==e?e:_,_),r=Math.min(s,o);return{column:t,headroom:Math.max(0,o-r),initialWidth:o,minWidth:r}}).filter(t=>t.headroom>0);if(0>=e.length)break;{const t=e.reduce((t,e)=>t+e.headroom,0);let n=0;const i=o;e.forEach((o,s)=>{let r=i*(o.headroom/t);r=Math.min(r,o.headroom),s===e.length-1&&(r=Math.min(i-n,o.headroom)),o.column.width=o.initialWidth-r,n+=r}),o-=n}}},xi=({childrenToResize:t=[],collapsedHeaders:e,containerWidth:n,delta:i,headers:o,initialWidthsMap:s,isParentResize:r=!1,resizedHeader:l,reverse:a,rootPinned:d,sectionHeaders:c,sectionWidth:h,sectionViewportWidth:u=0,shrinkFloors:f,startWidth:v})=>{const p=t=>t.reduce((t,e)=>{const n=s.get(e.accessor)||100;return t+Math.max(0,n-(t=>{var e;const n=s.get(t.accessor)||100,i=Math.max(null!==(e=null==f?void 0:f.get(t.accessor))&&void 0!==e?e:_,_);return Math.min(i,n)})(e))},0),w=t=>{if(!d||0>=n||0>=t)return t;const e=o.some(t=>"left"===t.pinned&&!Z(t)),i=o.some(t=>"right"===t.pinned&&!Z(t)),r=((t,e,n)=>t*U(t,e,n))(n,e,i),l=Math.max(0,r-Array.from(s.values()).reduce((t,e)=>t+e,0));return Math.min(t,l)};if(r&&t.length>1){const n=At(c,e),o=n.findIndex(e=>e.accessor===t[0].accessor),r=n.findIndex(e=>e.accessor===t[t.length-1].accessor);if(-1===o||-1===r)return;const l=0===o,m=r===n.length-1;let g;g="left"===d&&m||"right"===d&&l?[]:l?n.slice(r+1):m||a?n.slice(0,o):n.slice(r+1);const b=Array.from(s.values()).reduce((t,e)=>t+e,0),x=!d&&u>0?u:h>0?Math.max(h,b):b+Math.abs(i)+1;if(i>0){const e=Math.max(0,x-b),n=Math.max(0,i-e),o=g.length>0?p(g):0,r=Math.min(n,o);let l;l=d?0===g.length?w(i):Math.min(i,w(e)+r):i;const a=(v+l)/t.reduce((t,e)=>t+(s.get(e.accessor)||100),0);t.forEach(t=>{const e=s.get(t.accessor)||100;t.width=Math.max(e*a,_)}),r>0&&g.length>0&&bi({columnsToShrink:g,totalCompensation:r,initialWidthsMap:s,shrinkFloors:f})}else{const e=t.reduce((t,e)=>t+(s.get(e.accessor)||100),0),n=Math.max(v+i,_*t.length),o=n/e;t.forEach(t=>{const e=s.get(t.accessor)||100;t.width=Math.max(e*o,_)});const r=Math.max(0,v-n-Math.max(0,b-x));r>0&&g.length>0&&bi({columnsToShrink:g,totalCompensation:-r,initialWidthsMap:s})}return}const m=At(c,e),g=m.findIndex(t=>t.accessor===l.accessor);if(-1===g)return;const b=0===g,x=g===m.length-1;let y;if(y="left"===d&&x||"right"===d&&b?[]:b?m.slice(g+1):x||a?m.slice(0,g):m.slice(g+1),0===y.length){const t=i>0?w(i):i;return void(l.width=Math.max(v+t,_))}const R=Array.from(s.values()).reduce((t,e)=>t+e,0),S=!d&&u>0?u:h>0?Math.max(h,R):R+Math.abs(i)+1;if(i>0){const t=Math.max(0,S-R);if(t>=i){const t=w(i);return void(l.width=v+t)}const e=i-t,n=p(y),o=Math.min(e,n);if(d){const e=w(t)+o;l.width=v+e}else l.width=v+i;o>0&&bi({columnsToShrink:y,totalCompensation:o,initialWidthsMap:s,shrinkFloors:f})}else{const t=Math.max(v+i,_),e=v-t;l.width=t;const n=Math.max(0,e-Math.max(0,R-S));n>0&&bi({columnsToShrink:y,totalCompensation:-n,initialWidthsMap:s})}},yi=({mainLeafHeaders:t,mainInitialWidths:e,newMainAvailable:n,shrinkFloors:i})=>{const o=Array.from(e.values()).reduce((t,e)=>t+e,0);if(0>=n||0>=o)return;const s=n/o;if(s>=1){let i=0;return void t.forEach((o,r)=>{const l=e.get(o.accessor)||100;r===t.length-1?o.width=n-i:(o.width=Math.round(l*s),i+=o.width)})}t.forEach(t=>{var n;const o=e.get(t.accessor)||100,r=Math.min(Math.max(null!==(n=null==i?void 0:i.get(t.accessor))&&void 0!==n?n:_,_),o);t.width=Math.max(Math.round(o*s),r)})},Ri=(t,e)=>{if(t>0)return t;const n=null==e?void 0:e.current;if(!n)return 0;const i=n.closest(".simple-table-root"),o=null==i?void 0:i.querySelector(".st-body-container");return o instanceof HTMLElement?o.clientWidth:n.clientWidth},Si=({autoExpandColumns:t,collapsedHeaders:e,containerWidth:n,event:i,header:o,headers:s,mainBodyRef:r,onColumnWidthChange:l,onAutoExpandNaturalWidths:a,reverse:d=!1,setHeaders:c,setIsResizing:h,shrinkFloors:u,startWidth:f})=>{i.preventDefault();const v="clientX"in i?i.clientX:i.touches[0].clientX,p="touches"in i;if(!o||Z(o))return;const w=Ri(n,r);h(!0);const m=mi(o,s),g=Et(o);let b;if(o.children&&o.children.length>0){const t=St(o,e);b=t.length>0?t:[o]}else b=[o];const x=new Map;let y=0,R=0;if(t){const t=s.filter(t=>t.pinned===m);if(At(t,e).forEach(t=>{const e=kt(t);x.set(t.accessor,e)}),w>0){const{leftWidth:t,rightWidth:n,mainWidth:i}=wi({headers:s,containerWidth:w,collapsedHeaders:e});y="left"===m?t:"right"===m?n:i;const o=Math.max(0,w-t-n),l=null!=(null==r?void 0:r.current)&&r.current.clientWidth>0?r.current.clientWidth:0;R=l>0?Math.min(o,l):o}}let S=!1;const C=new Map;let M=[];if(t&&m&&w>0){const t=At(s.filter(t=>t.pinned===m),e);if(t.length>0){let n=!1;if(b.length>1){const e=t.findIndex(t=>t.accessor===b[0].accessor),i=t.findIndex(t=>t.accessor===b[b.length-1].accessor);n="left"===m&&i===t.length-1||"right"===m&&0===e}else{const e=b[0]||o,i=t.findIndex(t=>t.accessor===e.accessor);n="left"===m&&i===t.length-1||"right"===m&&0===i}if(n){S=!0;const t=s.filter(t=>!t.pinned);M=At(t,e),M.forEach(t=>{C.set(t.accessor,kt(t))})}}}const I=(n,i=!1)=>{const r="right"===m?v-n:n-v;if(t){const t=s.filter(t=>t.pinned===m);if(xi({childrenToResize:b,collapsedHeaders:e,containerWidth:w,delta:r,headers:s,initialWidthsMap:x,isParentResize:b.length>1,resizedHeader:b.length>0?b[b.length-1]:o,reverse:d,rootPinned:m,sectionHeaders:t,sectionWidth:y,sectionViewportWidth:m?y:R,shrinkFloors:u,startWidth:f}),S&&M.length>0){const t=b.reduce((t,e)=>{const n=x.get(e.accessor)||0;return t+(("number"==typeof e.width?e.width:n)-n)},0);yi({mainLeafHeaders:M,mainInitialWidths:C,newMainAvailable:Math.max(0,R-t),shrinkFloors:u})}}else{const t=(({header:t,headers:e,collapsedHeaders:n})=>{const i=document.querySelector(".st-body-container");if(!i||0===i.clientWidth)return 1e3;const o=i.clientWidth;if(!t.pinned)return 1/0;const s=e.some(t=>"left"===t.pinned&&!Z(t)),r=e.some(t=>"right"===t.pinned&&!Z(t)),l=o*U(o,s,r)-e.filter(e=>e.pinned===t.pinned&&e.accessor!==t.accessor).reduce((t,e)=>Z(e)?t:t+St(e,n).reduce((t,e)=>t+kt(e),0),0),a=Et(t);return a>l?(console.warn(`Header ${t.accessor} exceeds pinned section width limit`),a):l})({header:o,headers:s,collapsedHeaders:e});b.length>1?(({delta:t,leafHeaders:e,minWidth:n,startWidth:i,maxWidth:o})=>{const s=e.reduce((t,e)=>Math.min(t,Et(e)),40),r=e.reduce((t,e)=>t+("number"==typeof e.width?e.width:150),0),l=Math.max(Math.min(i+t,o),s)-r;e.forEach(t=>{const e="number"==typeof t.width?t.width:150;t.width=Math.max(e+l*(e/r),n)})})({delta:r,leafHeaders:b,minWidth:g,startWidth:f,maxWidth:t}):b[0].width=Math.max(Math.min(f+r,t),g),s.forEach(t=>{Tt(t)})}if(i){if(t&&a){const t=new Map;b.forEach(e=>{"number"==typeof e.width&&t.set(e.accessor,e.width)}),t.size>0&&a(t)}const n=[...s];c(n);const i=new Map;b.forEach(t=>{"number"==typeof t.width&&i.set(t.accessor,t.width)}),S&&M.forEach(t=>{"number"==typeof t.width&&i.set(t.accessor,t.width)}),gi(s,e,i)}else gi(s,e)};let H=null,k=null,T=v;const E=t=>{T=t,k=t,null===H&&(H=requestAnimationFrame(()=>{null!==k&&(I(k,!1),k=null),H=null}))};if(p){const t=t=>{E(t.touches[0].clientX)},e=()=>{document.removeEventListener("touchmove",t),document.removeEventListener("touchend",e),null!==H&&(cancelAnimationFrame(H),H=null),I(T,!0),h(!1),l&&l([...s])};document.addEventListener("touchmove",t),document.addEventListener("touchend",e)}else{const t=t=>{E(t.clientX)},e=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",e),null!==H&&(cancelAnimationFrame(H),H=null),I(T,!0),h(!1),l&&l([...s])};document.addEventListener("mousemove",t),document.addEventListener("mouseup",e)}},Ci=t=>{var e,n;const i=null===(e=t.mainBodyRef)||void 0===e?void 0:e.current;return i?null!==(n=i.closest(".simple-table-root"))&&void 0!==n?n:i:null},Mi=(t,e)=>{var n;for(const i of t){if(i.accessor===e)return i;if(null===(n=i.children)||void 0===n?void 0:n.length){const t=Mi(i.children,e);if(t)return t}}},Ii=(t,e)=>{const{columnResizing:n}=e;if(!n||t.isSelectionColumn&&e.enableRowSelection)return null;const i=document.createElement("div");i.className="st-header-resize-handle-container",i.setAttribute("role","separator"),i.setAttribute("aria-label",`Resize ${t.label} column`),i.setAttribute("aria-orientation","vertical");const o=document.createElement("div");o.className="st-header-resize-handle",i.appendChild(o);const s=t=>({rows:e.rows,header:t,styleRoot:Ci(e),autoSizeMode:t.autoSizeMode,sortIcon:e.icons.sortUp,expandIcon:e.icons.expand,onRendererHostDiscard:e.onRendererHostDiscard}),r=()=>{var n,i,o;const s=null!==(i=null===(n=e.getCollapsedHeaders)||void 0===n?void 0:n.call(e))&&void 0!==i?i:e.collapsedHeaders,r=e.getHeaders();return((t,e)=>{const n=At(t,e);for(const t of n){const e=document.getElementById(ot({accessor:t.accessor,rowId:"header"})),n=null==e?void 0:e.offsetWidth;null!=n&&n>0&&(t.width=n)}})(r,s),{headers:r,header:null!==(o=Mi(r,t.accessor))&&void 0!==o?o:t,collapsedHeaders:s}};let l=0;const a=()=>{const n=Date.now();120>n-l||(l=n,(()=>{var n;const i=document.getElementById(ot({accessor:t.accessor,rowId:"header"}));if(e.autoExpandColumns){const{headers:t,header:o,collapsedHeaders:l}=r();(({header:t,headers:e,collapsedHeaders:n,containerWidth:i,mainBodyRef:o,reverse:s,headerCellElement:r,getTargetLeafWidth:l,onAutoExpandNaturalWidths:a,shrinkFloors:d})=>{var c;if(!t||Z(t))return;const h=Ri(i,o),u=mi(t,e);let f;if(t.children&&t.children.length>0){const e=St(t,n);f=e.length>0?e:[t]}else f=[t];const v=new Map;let p=0,w=0;const m=e.filter(t=>t.pinned===u);if(At(m,n).forEach(t=>{const e=kt(t);v.set(t.accessor,e)}),h>0){const{leftWidth:t,rightWidth:i,mainWidth:s}=wi({headers:e,containerWidth:h,collapsedHeaders:n});p="left"===u?t:"right"===u?i:s;const r=Math.max(0,h-t-i),l=null!=(null==o?void 0:o.current)&&o.current.clientWidth>0?o.current.clientWidth:0;w=l>0?Math.min(r,l):r}let g=!1;const b=new Map;let x=[];if(u&&h>0){const i=At(e.filter(t=>t.pinned===u),n);if(i.length>0){let o=!1;if(f.length>1){const t=i.findIndex(t=>t.accessor===f[0].accessor),e=i.findIndex(t=>t.accessor===f[f.length-1].accessor);o="left"===u&&e===i.length-1||"right"===u&&0===t}else{const e=f[0]||t,n=i.findIndex(t=>t.accessor===e.accessor);o="left"===u&&n===i.length-1||"right"===u&&0===n}if(o){g=!0;const t=e.filter(t=>!t.pinned);x=At(t,n),x.forEach(t=>{b.set(t.accessor,kt(t))})}}}const y=f.reduce((t,e)=>t+l(e),0),R=null!==(c=null==r?void 0:r.offsetWidth)&&void 0!==c?c:f.reduce((t,e)=>t+kt(e),0);if(xi({childrenToResize:f,collapsedHeaders:n,containerWidth:h,delta:y-R,headers:e,initialWidthsMap:v,isParentResize:f.length>1,resizedHeader:f.length>0?f[f.length-1]:t,reverse:s,rootPinned:u,sectionHeaders:m,sectionWidth:p,sectionViewportWidth:u?p:w,shrinkFloors:d,startWidth:R}),g&&x.length>0){const t=f.reduce((t,e)=>{const n=v.get(e.accessor)||0;return t+(("number"==typeof e.width?e.width:n)-n)},0);yi({mainLeafHeaders:x,mainInitialWidths:b,newMainAvailable:Math.max(0,w-t),shrinkFloors:d})}if(a){const t=new Map;f.forEach(e=>{"number"==typeof e.width&&t.set(e.accessor,e.width)}),t.size>0&&a(t)}const S=new Map;f.forEach(t=>{"number"==typeof t.width&&S.set(t.accessor,t.width)}),g&&x.forEach(t=>{"number"==typeof t.width&&S.set(t.accessor,t.width)}),gi(e,n,S)})({header:o,headers:t,collapsedHeaders:l,containerWidth:e.containerWidth,mainBodyRef:e.mainBodyRef,reverse:e.reverse,headerCellElement:i,getTargetLeafWidth:t=>Lt(t.accessor,s(t)).width,onAutoExpandNaturalWidths:e.onAutoExpandNaturalWidths,shrinkFloors:null===(n=e.getShrinkFloors)||void 0===n?void 0:n.call(e)});const a=[...t];return e.setHeaders(a),void(e.onColumnWidthChange&&e.onColumnWidthChange(a))}const{headers:o,header:l,collapsedHeaders:a}=r(),d=Lt(l.accessor,s(l)).width,c=di(o,l.accessor);if(!c)return;const h=((t,e)=>{let n=t;for(let t=0;e.length-1>t;t++)n=n[e[t]].children;return n})(o,c),u=c[c.length-1],f=h.map((t,e)=>e===u?Object.assign(Object.assign({},t),{width:d}):t),v=((t,e,n)=>{if(1===e.length)return n;let i=t;for(let t=0;e.length-2>t;t++)i=i[e[t]].children;return i[e[e.length-2]].children=n,t})(o,c,f);v.forEach(t=>Tt(t));const p=f[u],w=new Map;p&&"number"==typeof p.width&&w.set(p.accessor+"",p.width),gi(v,a,w),e.setHeaders(v),e.onColumnWidthChange&&e.onColumnWidthChange(v)})())};return I(i,"mousedown",n=>{var i;if(n.detail>=2)return n.preventDefault(),void a();const o=null===(i=document.getElementById(ot({accessor:t.accessor,rowId:"header"})))||void 0===i?void 0:i.offsetWidth;M(()=>{var t;const{headers:i,header:s,collapsedHeaders:l}=r();Si({autoExpandColumns:e.autoExpandColumns,collapsedHeaders:l,containerWidth:e.containerWidth,event:n,forceUpdate:e.forceUpdate,header:s,headers:i,mainBodyRef:e.mainBodyRef,onColumnWidthChange:e.onColumnWidthChange,onAutoExpandNaturalWidths:e.onAutoExpandNaturalWidths,pinnedLeftRef:e.pinnedLeftRef,pinnedRightRef:e.pinnedRightRef,reverse:e.reverse,setHeaders:e.setHeaders,setIsResizing:e.setIsResizing,shrinkFloors:null===(t=e.getShrinkFloors)||void 0===t?void 0:t.call(e),startWidth:null!=o?o:q})},10)}),I(i,"touchstart",n=>{var i;const o=n,s=null===(i=document.getElementById(ot({accessor:t.accessor,rowId:"header"})))||void 0===i?void 0:i.offsetWidth;M(()=>{var t;const{headers:n,header:i,collapsedHeaders:l}=r();Si({autoExpandColumns:e.autoExpandColumns,collapsedHeaders:l,containerWidth:e.containerWidth,event:o,forceUpdate:e.forceUpdate,header:i,headers:n,mainBodyRef:e.mainBodyRef,onColumnWidthChange:e.onColumnWidthChange,onAutoExpandNaturalWidths:e.onAutoExpandNaturalWidths,pinnedLeftRef:e.pinnedLeftRef,pinnedRightRef:e.pinnedRightRef,reverse:e.reverse,setHeaders:e.setHeaders,setIsResizing:e.setIsResizing,shrinkFloors:null===(t=e.getShrinkFloors)||void 0===t?void 0:t.call(e),startWidth:null!=s?s:q})},10)}),I(i,"dblclick",a),i},Hi=(t,e,n)=>{const i=document.createElement("input");return i.type="text",i.className="st-header-edit-input",i.value=t.label||"",I(i,"blur",()=>{const o=i.value;o!==t.label&&(n=>{const i=e.headers.map(e=>e.accessor===t.accessor?Object.assign(Object.assign({},e),{label:n}):e);e.setHeaders(i),e.onHeaderEdit&&e.onHeaderEdit(t,n)})(o);const s=n.parentElement;if(s){const i=ki(t,e,o);s.replaceChild(i,n)}if(e.headerRegistry&&!t.isSelectionColumn){const n=e.headerRegistry.get(t.accessor+"");n&&n.setEditing(!1)}}),I(i,"keydown",e=>{"Enter"===e.key?(e.preventDefault(),i.blur()):"Escape"===e.key&&(e.preventDefault(),i.value=t.label||"",i.blur())}),setTimeout(()=>i.focus(),0),i},ki=(t,e,n)=>{const i=t.isSelectionColumn&&e.enableRowSelection,o=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"),i){if("single"!==e.rowSelectionMode){const t=(t=>{const e=!!t.areAllRowsSelected&&t.areAllRowsSelected();return un({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=o;if(t.tooltip&&!i){let e=null,n=null;const i=()=>{var i;n&&(clearTimeout(n),n=null),e&&(null===(i=e.parentElement)||void 0===i||i.removeChild(e),e=null),n=setTimeout(()=>{if(!s.isConnected)return void(n=null);const i=s.getBoundingClientRect();if(i.width>0&&i.height>0){e=document.createElement("div"),e.className="st-tooltip",e.textContent=t.tooltip||"",e.style.position="fixed",e.style.zIndex="10000";const n=200,o=40;let r=i.left+i.width/2-n/2,l=i.bottom+8;8>r?r=8:r+n>window.innerWidth-8&&(r=window.innerWidth-n-8),l+o>window.innerHeight-8&&(l=i.top-o-8),e.style.top=l+"px",e.style.left=r+"px",(s.closest(".simple-table-root")||document.body).appendChild(e)}n=null},500)},o=()=>{var t;n&&(clearTimeout(n),n=null),e&&(null===(t=e.parentElement)||void 0===t||t.removeChild(e),e=null)};I(s,"mouseenter",i),I(s,"mouseleave",o)}return s},Ti=(t,e,n,i)=>{const{columnReordering:o,draggedHeaderRef:s,hoveredHeaderRef:r}=i;!o||n.disableReorder||n.isSelectionColumn&&i.enableRowSelection||(t.setAttribute("draggable","true"),I(t,"dragstart",t=>{s.current=n,x(Date.now()),e.classList.add("st-dragging")}),I(t,"dragend",t=>{t.preventDefault(),s.current=null,r.current=null,e.classList.remove("st-dragging"),setTimeout(()=>{i.setHeaders(t=>[...t]),i.onColumnOrderChange&&i.onColumnOrderChange(En(i.getHeaders()))},10)}),I(e,"dragover",t=>{const e=t;e.preventDefault(),s.current&&M(()=>{const t=i.getHeaders();if(!t)return;const{screenX:o,screenY:l}=e,a=Math.sqrt(Math.pow(o-g.screenX,2)+Math.pow(l-g.screenY,2));r.current=n;const d=s.current;if(!d)return;let c,h=!1;if(hi(d,t)!==hi(n,t)){const e=function({headers:t,draggedHeader:e,hoveredHeader:n}){const i=En(t);let o=!1;try{const t=hi(n,i),s=i.findIndex(t=>t.accessor===e.accessor),r=i.findIndex(t=>t.accessor===n.accessor);if(-1===s||-1===r)return o=!0,{newHeaders:i,emergencyBreak:o};const[l]=i.splice(s,1),a=((t,e)=>{const n=Object.assign({},t);return"left"===e?n.pinned="left":"right"===e?n.pinned="right":delete n.pinned,n})(l,t);i.splice(r,0,a)}catch(t){console.error("Error in insertHeaderAcrossSections:",t),o=!0}return{newHeaders:i,emergencyBreak:o}}({headers:t,draggedHeader:d,hoveredHeader:n});c=e.newHeaders,h=e.emergencyBreak}else{const e=di(t,d.accessor),i=di(t,n.accessor);if(!e||!i)return;const o=e.length,s=i.length;let r=i;if(o!==s){const t=s-o;t>0&&(r=i.slice(0,-t))}if((u=e).length!==(f=r).length||1!==u.length&&!u.slice(0,-1).every((t,e)=>t===f[e]))return;const l=ui(t,e,r);c=l.newHeaders,h=l.emergencyBreak}var u,f;if(n.accessor===d.accessor||10>a||JSON.stringify(c)===JSON.stringify(t)||h)return;const v=i.essentialAccessors;if(v&&v.size>0&&!Dn(c,v))return;const p=Date.now();JSON.stringify(c)===JSON.stringify(b)&&(150>p-m||40>a)||(x(p),g={screenX:o,screenY:l},b=t,i.onTableHeaderDragEnd(c))},50)}),I(document.documentElement,"dragover",t=>{t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="move")}))},Ei=(e,n)=>{var i,o;const{header:s,colIndex:r,parentHeader:l}=e,{collapsedHeaders:a,columnBorders:d,columnReordering:c,enableHeaderEditing:h,selectedColumns:u,columnsWithSelectedCells:f,draggedHeaderRef:v,hoveredHeaderRef:p}=n,w=s.isSelectionColumn&&n.enableRowSelection,m=!!(null==s?void 0:s.sortable),g=a.has(s.accessor),b=!(!s.children||0===s.children.length)&&(!g||s.children.some(e=>{const n=e.showWhen||t;return"parentCollapsed"===n||"always"===n})),x=null==l?void 0:l.singleRowChildren,y=b&&!s.singleRowChildren,R=!!d&&(s.children&&0!==s.children.length?J(s,r).includes(n.lastHeaderIndex):r===n.lastHeaderIndex),S=!(!n.selectableColumns||w)&&J(s,r).some(t=>u.has(t)),C=!w&&J(s,r).some(t=>f.has(t));return["st-header-cell",s.accessor===(null===(i=p.current)||void 0===i?void 0:i.accessor)?"st-hovered":"",(null===(o=v.current)||void 0===o?void 0:o.accessor)===s.accessor?"st-dragging":"",m?"clickable":"",c&&!m?"columnReordering":"",y?"parent":"",x?"st-sub-header":"",R?"st-last-column":"",h&&!w?"st-header-editable":"",S?"st-header-selected":"",C&&!S?"st-header-has-highlighted-cell":""].filter(Boolean).join(" ")},Ai=(t,e,n,i,o)=>{var s;const r=ki(e,i),l=e.headerRenderer({accessor:e.accessor,colIndex:n,header:e,components:{sortIcon:o.sortIcon||void 0,filterIcon:o.filterIcon||void 0,collapseIcon:o.collapseIcon||void 0,labelContent:r}});l instanceof HTMLElement&&l.parentElement===t||(null===(s=i.onRendererHostDiscard)||void 0===s||s.call(i,t),H(t),t.innerHTML="",l instanceof HTMLElement?t.appendChild(l):t.appendChild(r))},Wi=(t,e,n,i=0)=>{var o,s;const r=n.pinned?n.containerWidth:null!==(o=n.mainSectionViewportWidth)&&void 0!==o?o:n.containerWidth||(null===(s=t.parentElement)||void 0===s?void 0:s.clientWidth)||t.clientWidth||0,d=n.pinned||!1===n.enableVirtualization?e:((t,e,n,i=100)=>{if(0===t.length)return[];const o=e-i,s=e+n+i;return t.filter(t=>t.left+t.width>=o&&s>=t.left)})(e,i,r);(t=>{0===t.length||t.map(t=>t.colIndex)})(e);const c=R(t),h=new Set(d.map(t=>ot({accessor:t.header.accessor,rowId:"header"}))),u=new Map,f=Array.from(new Set(e.map(t=>Math.round(t.top)))).sort((t,e)=>t-e);f.forEach((t,e)=>u.set(t,e));const v=t=>"header-band-"+Math.round(t.top),p=t=>{var e;return(null!==(e=u.get(Math.round(t.top)))&&void 0!==e?e:0)+1},w=C(t),m=n.animationCoordinator&&n.accordionAxis?n.accordionAxis:null,g="horizontal"===m?(t=>{const e=new Set,n=t=>{var i;for(const o of t)Z(o)||(e.add(o.accessor+""),(null===(i=o.children)||void 0===i?void 0:i.length)&&n(o.children))};return n(t),e})(n.headers):null;let b=!1;c.forEach((e,i)=>{var o,s,r;if(!h.has(i)){w.delete(i);const l=null!==(o=e.getAttribute("data-accessor"))&&void 0!==o?o:"",a=null!==(s=null==g?void 0:g.has(l))&&void 0!==s&&s;"horizontal"===m&&n.animationCoordinator&&!a&&n.animationCoordinator.shouldRetain(i)?n.animationCoordinator.shrinkOutCell({cellId:i,element:e,container:t,axis:m}):(null===(r=n.onRendererHostDiscard)||void 0===r||r.call(n,e),e.remove()),c.delete(i),b=!0}}),b&&H(t);const x=[];d.forEach(e=>{const i=ot({accessor:e.header.accessor,rowId:"header"});if(c.has(i)){const o=c.get(i);l(t,v(e),p(e)),o.setAttribute("aria-colindex",e.colIndex+1+""),e.header.children&&e.header.children.length>0&&o.setAttribute("aria-colspan",it(e.header,n.headers,n.collapsedHeaders)+"");const s=w.get(i);if(!s||s.left!==e.left||s.top!==e.top||s.width!==e.width||s.height!==e.height){o.style.left=e.left+"px",o.style.top=e.top+"px";const t=o.dataset.stAccordionGrow;"horizontal"!==t&&(o.style.width=e.width+"px"),"vertical"!==t&&(o.style.height=e.height+"px"),w.set(i,{left:e.left,top:e.top,width:e.width,height:e.height})}e.header.isSelectionColumn&&n.enableRowSelection&&"function"==typeof n.areAllRowsSelected&&((t,e)=>{hn(t,e)})(o,n.areAllRowsSelected());const r=Ei(e,n);if(o.className!==r&&(o.className=r),nt(e.header)){const t=n.collapsedHeaders.has(e.header.accessor);o.setAttribute("aria-expanded",!t+""),((t,e,n)=>{wn(t,!e,{ariaLabelWhenExpanded:n?`Collapse ${n} column`:"Collapse column",ariaLabelWhenCollapsed:n?`Expand ${n} column`:"Expand column",syncAriaExpanded:!0})})(o,t,e.header.label)}const a=`${n.sort&&n.sort.key.accessor===e.header.accessor?n.sort.direction:"none"}|${n.filters&&n.filters[e.header.accessor]?"1":"0"}`;o.dataset.stIconState!==a&&(((t,e,n,i)=>{const o=Kn(e,n),s=li(e,n),r=ai(e,n);if(e.headerRenderer){const l=t.querySelector(".st-header-label");return void(l&&Ai(l,e,i,n,{sortIcon:o,filterIcon:s,collapseIcon:r}))}const l=t.querySelector('.st-icon-container[aria-label*="Sort"]'),a=t.querySelector('.st-icon-container[aria-label*="Filter"]'),d=t.querySelector(".st-expand-icon-container");if(null==l||l.remove(),null==a||a.remove(),null==d||d.remove(),"right"===e.align)r&&t.insertBefore(r,t.firstChild),s&&t.insertBefore(s,t.firstChild),o&&t.insertBefore(o,t.firstChild);else{const e=t.querySelector(".st-header-resize-handle-container"),n=null!=e&&e!==t.firstChild;o&&(n?t.insertBefore(o,e):t.appendChild(o)),s&&(n?t.insertBefore(s,e):t.appendChild(s)),r&&(n?t.insertBefore(r,e):t.appendChild(r))}})(o,e.header,n,e.colIndex),o.dataset.stIconState=a)}else x.push({cell:e,cellId:i})});const y=n.animationCoordinator&&n.accordionAxis?n.accordionAxis:null,S=[];x.forEach(({cell:e,cellId:i})=>{const o=((t,e)=>{var n,i,o;const{header:s,colIndex:r}=t,{reverse:l}=e,a=s.isSelectionColumn&&e.enableRowSelection,d=Ei(t,e),c=document.createElement("div");if(c.className=d,c.id=ot({accessor:s.accessor,rowId:"header"}),c.setAttribute("data-accessor",s.accessor+""),c.setAttribute("role","columnheader"),c.setAttribute("aria-colindex",r+1+""),s.children&&s.children.length>0){const t=it(s,e.headers,e.collapsedHeaders);c.setAttribute("aria-colspan",t+"")}if(nt(s)){const t=null!==(i=null===(n=e.getCollapsedHeaders)||void 0===n?void 0:n.call(e))&&void 0!==i?i:e.collapsedHeaders;c.setAttribute("aria-expanded",!t.has(s.accessor)+"")}s.sortable&&((null===(o=e.sort)||void 0===o?void 0:o.key.accessor)===s.accessor?c.setAttribute("aria-sort","asc"===e.sort.direction?"ascending":"descending"):c.setAttribute("aria-sort","none"));const h=((t,e)=>{const n=[];return t.type&&"other"!==t.type&&n.push(t.type+" column"),t.sortable&&n.push("sortable"),e&&n.push("filterable"),t.tooltip&&n.push(t.tooltip),n.join(", ")})(s,!!s.filterable);if(h){const t="header-desc-"+s.accessor;c.setAttribute("aria-describedby",t);const e=document.createElement("span");e.id=t,e.className="st-sr-only",e.textContent=h,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 u=Kn(s,e),f=li(s,e),v=ai(s,e),p=l!==("right"===e.pinned);if(p){const t=Ii(s,e);t&&c.appendChild(t)}s.headerRenderer||"right"!==s.align||(v&&c.appendChild(v),f&&c.appendChild(f),u&&c.appendChild(u));const w=document.createElement("div");if(w.className="st-header-label",s.headerRenderer)Ai(w,s,r,e,{sortIcon:u,filterIcon:f,collapseIcon:v});else{const t=ki(s,e);w.appendChild(t)}if(I(w,"click",t=>{a||((t,e,n,i)=>{if(!e.isSelectionColumn){if(i.selectableColumns){const o=J(e,n),s=o.some(t=>i.selectedColumns.has(t));if(i.enableHeaderEditing&&s&&!t.shiftKey){const t=document.getElementById(ot({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=Hi(e,i,t);if(t.appendChild(n),i.headerRegistry&&!e.isSelectionColumn){const t=i.headerRegistry.get(e.accessor+"");t&&t.setEditing(!0)}}}}return}t.shiftKey&&i.selectColumns?i.setSelectedColumns(t=>{if(0===t.size)return new Set(o);const e=o[0],n=Array.from(t).sort((t,e)=>t-e);let i=n[0],s=Math.abs(e-i);n.forEach(t=>{const n=Math.abs(e-t);s>n&&(s=n,i=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)})(i,e),...o];return new Set([...Array.from(t),...r])}):i.selectColumns&&i.selectColumns(o),i.setSelectedCells(new Set),i.setInitialFocusedCell(null)}i.onColumnSelect&&i.onColumnSelect(e),!i.selectableColumns&&e.sortable&&i.onSort(e.accessor)}})(t,s,r,e)}),I(w,"dblclick",t=>{a||((t,e,n)=>{e.isSelectionColumn||n.selectableColumns&&e.sortable&&n.onSort(e.accessor)})(0,s,e)}),Ti(w,c,s,e),c.appendChild(w),s.headerRenderer||"right"===s.align||(v&&c.appendChild(v),f&&c.appendChild(f),u&&c.appendChild(u)),!p){const t=Ii(s,e);t&&c.appendChild(t)}return e.headerRegistry&&!s.isSelectionColumn&&e.headerRegistry.set(s.accessor+"",{setEditing:t=>{if(t){const t=w.querySelector(".st-header-label-text");if(t){t.innerHTML="";const n=Hi(s,e,t);t.appendChild(n)}}}}),c})(e,n);o.dataset.stIconState=`${n.sort&&n.sort.key.accessor===e.header.accessor?n.sort.direction:"none"}|${n.filters&&n.filters[e.header.accessor]?"1":"0"}`,y&&n.animationCoordinator&&!n.animationCoordinator.hasSnapshotEntry(i)&&!n.animationCoordinator.wasRenderableBeforeAccordion(e.header.accessor+"")&&("vertical"===y?o.style.height="0px":o.style.width="0px",o.dataset.stAccordionGrow=y,S.push({element:o,cell:e})),l(t,v(e),p(e)).appendChild(o),c.set(i,o),w.set(i,{left:e.left,top:e.top,width:e.width,height:e.height})}),y&&S.length>0&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{for(const{element:t,cell:e}of S)t.isConnected&&("vertical"===y?t.style.height=e.height+"px":t.style.width=e.width+"px",delete t.dataset.stAccordionGrow)})}),n.pinned||(t.dataset.lastScrollLeft=i+""),d.forEach(t=>{const e=c.get(ot({accessor:t.header.accessor,rowId:"header"}));if(!e)return;const n=(t=>{const e=t.top,n=t.top+t.height,i=f.filter(t=>t>=e-1&&n-1>t).length;return i>0?i:1})(t);n>1?e.setAttribute("aria-rowspan",n+""):e.hasAttribute("aria-rowspan")&&e.removeAttribute("aria-rowspan")}),a(t)},Oi=(t,e)=>{t.style.left="0",t.style.width="number"!=typeof e||0>e?"100%":e+"px"},Pi=t=>{const{position:n,rowHeight:i,displayStrongBorder:o,heightOffsets:s,customTheme:r=e,isSticky:l=!1,sectionWidthPx:a}=t,d=document.createElement("div");d.className="st-row-separator "+(o?"st-last-group-row":"");const c=l?n:He({position:n,rowHeight:i,heightOffsets:s,customTheme:r});Oi(d,a),l?(d.style.position="absolute",d.style.top="0",d.style.transform=`translateY(${c}px)`):d.style.transform=`translate3d(0, ${c}px, 0)`;const h=document.createElement("div");h.style.width="100%",d.appendChild(h);let u=null;return d.addEventListener("mousedown",t=>{t.preventDefault();const e=d.style.pointerEvents;d.style.pointerEvents="none";const n=document.elementFromPoint(t.clientX,t.clientY);if(d.style.pointerEvents=e,!n)return;const i=n.closest(".st-cell");if(i instanceof HTMLElement){u=i;const e=i.getBoundingClientRect(),n=new MouseEvent("mousedown",{bubbles:!0,cancelable:!0,view:window,button:0,clientX:t.clientX,clientY:e.top+e.height/2});i.dispatchEvent(n)}}),d.addEventListener("mouseup",t=>{if(u){const e=u.getBoundingClientRect(),n=new MouseEvent("mouseup",{bubbles:!0,cancelable:!0,view:window,button:0,clientX:t.clientX,clientY:e.top+e.height/2});u.dispatchEvent(n),u=null}}),d},$i=new WeakMap,Fi=new WeakMap,Li=t=>(Fi.has(t)||Fi.set(t,new Map),Fi.get(t)),Di=(t,n,i,o=0,s,r,d,c)=>{var h,u,v,p,w,m,g,b;const x=i.pinned?null!==(u=null!==(h=i.containerWidth)&&void 0!==h?h:t.clientWidth)&&void 0!==u?u:0:null!==(w=null!==(p=null!==(v=i.mainSectionViewportWidth)&&void 0!==v?v:i.containerWidth)&&void 0!==p?p:t.clientWidth)&&void 0!==w?w:0,y=i.pinned||!1===i.enableVirtualization?n:((t,e,n,i=100)=>{if(0===t.length)return[];const o=e-i,s=e+n+i;return t.filter(t=>t.left+t.width>=o&&s>=t.left)})(n,o,x),R=f(t),S=(t=>($i.has(t)||$i.set(t,new Map),$i.get(t)))(t),C=new Set(y.map(t=>{var e;return ot({accessor:t.header.accessor,rowId:null!==(e=t.stableRowKey)&&void 0!==e?e:t.rowId})}));let M=null;if(d)if(c)M=c;else{M=new Map;for(const t of n){const e=ot({accessor:t.header.accessor,rowId:null!==(m=t.stableRowKey)&&void 0!==m?m:t.rowId});M.set(e,{left:t.left,top:t.top,width:t.width,height:t.height})}}const I=d&&i.accordionAxis?i.accordionAxis:null,H="horizontal"===I?(t=>{const e=new Set,n=t=>{var i;for(const o of t)Z(o)||(e.add(o.accessor+""),(null===(i=o.children)||void 0===i?void 0:i.length)&&n(o.children))};return n(t),e})(i.headers):null,k=(null==s?void 0:s.length)?new Set(s.map(t=>t.position)):new Set(y.map(t=>t.rowIndex));R.forEach((e,n)=>{var o,s,r;if(!C.has(n)){const l=e.getAttribute("data-row-id");l&&Mn(l,e);const a=null==M?void 0:M.get(n);if(d&&d.shouldRetain(n)&&a&&(d.shouldAnimateTransition({beforeTop:parseFloat(e.style.top||"0"),afterTop:a.top,beforeLeft:parseFloat(e.style.left||"0"),afterLeft:a.left,cellHeight:a.height||parseFloat(e.style.height||"0"),cellWidth:a.width||parseFloat(e.style.width||"0"),container:t})||d.isCellRenderedInScrollerViewport(e,t)||d.shouldRetainDomCellAtScrollExtrema(n,t)))return d.retainCell({cellId:n,element:e,container:t,newPosition:a}),void R.delete(n);if(d&&"horizontal"===I&&d.shouldRetain(n)){const i=null!==(o=e.getAttribute("data-accessor"))&&void 0!==o?o:"";if(null===(s=null==H?void 0:H.has(i))||void 0===s||!s)return d.shrinkOutCell({cellId:n,element:e,container:t,axis:I}),void R.delete(n)}((t,e)=>{const n=Rn.get(t);void 0!==n&&(null==e||e.delete(n),Rn.delete(t))})(e,i.cellRegistry),null===(r=i.onRendererHostDiscard)||void 0===r||r.call(i,e),e.remove(),R.delete(n)}});const T=Li(t);S.forEach((t,e)=>{k.has(e)||(t.remove(),S.delete(e),T.delete(e))});const E=null!==(g=i.maxHeaderDepth)&&void 0!==g?g:1,A=t=>{var e;return(null!==(e=t.stableRowKey)&&void 0!==e?e:t.rowId)+""},W=t=>t.tableRow.position+E+1,O=(t,e)=>{var n;i.enableRowSelection?t.setAttribute("aria-selected",(null===(n=i.isRowSelected)||void 0===n?void 0:n.call(i,e.rowId))?"true":"false"):t.hasAttribute("aria-selected")&&t.removeAttribute("aria-selected")},P=!!i.rowGrouping&&i.rowGrouping.length>0,$=t=>{var e;return(null!==(e=t.stableRowKey)&&void 0!==e?e:pt(t.rowId))+""},F=new Map;if(P&&s&&s.length>0){const t=new Map;for(const e of s){const n=null!==(b=e.rowIndexPath)&&void 0!==b?b:[],i=`${e.depth}|${n.slice(0,-1).join("/")}`;let o=t.get(i);o||(o=[],t.set(i,o)),o.push(e)}t.forEach(t=>{t.slice().sort((t,e)=>t.position-e.position).forEach((e,n)=>{F.set($(e),{posinset:n+1,setsize:t.length})})})}const L=(t,e)=>{if(!P)return;const n=e.tableRow;t.setAttribute("aria-level",n.depth+1+"");const o=F.get($(n));o&&(t.setAttribute("aria-posinset",o.posinset+""),t.setAttribute("aria-setsize",o.setsize+""));const{expandable:s,expanded:r}=(t=>{var e;const n=t.depth,o=null===(e=i.rowGrouping)||void 0===e?void 0:e[n],s=!!o&&yt(t.row,o),r=!!i.rowGrouping&&i.rowGrouping.length>n,l=!i.canExpandRowGroup||i.canExpandRowGroup(t.row);return s&&r&&l||i.onRowGroupExpand&&r&&l?{expandable:!0,expanded:Rt(bt(t),n,new Set(i.expandedDepths),i.expandedRows,i.collapsedRows)}:{expandable:!1,expanded:!1}})(n);s?t.setAttribute("aria-expanded",r+""):t.hasAttribute("aria-expanded")&&t.removeAttribute("aria-expanded")},D=[],j=new Set;y.forEach(e=>{var n,o,s,a,c;const h=ot({accessor:e.header.accessor,rowId:null!==(n=e.stableRowKey)&&void 0!==n?n:e.rowId});if(!j.has(h))if(j.add(h),R.has(h)){const n=R.get(h),d=l(t,A(e),W(e));if(O(d,e),L(d,e),r)((t,e)=>{t.style.left=e.left+"px",t.style.top=e.top+"px";const n=t.dataset.stAccordionGrow;"horizontal"!==n&&(t.style.width=e.width+"px"),"vertical"!==n&&(t.style.height=e.height+"px")})(n,e);else{if(Tn(n,e,i),e.header.isSelectionColumn&&i.enableRowSelection&&i.isRowSelected){const t=i.isRowSelected(e.rowId);hn(n,t)}if(e.header.expandable){const t=new Set(i.expandedDepths),r=null!==(s=null===(o=i.getExpandedRows)||void 0===o?void 0:o.call(i))&&void 0!==s?s:i.expandedRows,l=null!==(c=null===(a=i.getCollapsedRows)||void 0===a?void 0:a.call(i))&&void 0!==c?c:i.collapsedRows,d=Rt(bt(e.tableRow),e.depth,t,r,l);wn(n,d)}}}else{if(d&&d.hasSnapshotEntry(h)&&!d.shouldMountIncomingCell({cellId:h,afterTop:e.top,afterLeft:e.left,cellHeight:e.height,cellWidth:e.width,container:t}))return;D.push({cell:e,cellId:h})}});const N=[];D.forEach(({cell:e,cellId:n})=>{const o=null==d?void 0:d.claimRetainedForReuse(n,t);if(o){(t=>{Sn.delete(t)})(o),Tn(o,e,i);const s=l(t,A(e),W(e));return O(s,e),L(s,e),o.parentElement!==s&&s.appendChild(o),void R.set(n,o)}const s=kn(e,i);I&&d&&!d.hasSnapshotEntry(n)&&!d.wasRenderableBeforeAccordion(e.header.accessor+"")&&("vertical"===I?s.style.height="0px":s.style.width="0px",s.dataset.stAccordionGrow=I,N.push({element:s,cell:e}));const r=l(t,A(e),W(e));O(r,e),L(r,e),r.appendChild(s),R.set(n,s)}),I&&N.length>0&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{for(const{element:t,cell:e}of N)t.isConnected&&("vertical"===I?t.style.height=e.height+"px":t.style.width=e.width+"px",delete t.dataset.stAccordionGrow)})}),((t,n,i,o,s)=>{const r=Li(t),l=i.pinned&&n.length>0?n.reduce((t,e)=>Math.max(t,e.left+e.width),0):0,a=(()=>{var e,n,o;if(i.pinned){const e=Math.max("number"==typeof i.pinnedSectionWidthPx&&i.pinnedSectionWidthPx>0?i.pinnedSectionWidthPx:t.clientWidth,l);return e>0?e:void 0}const s=null!==(o=null!==(n=null!==(e=i.mainSectionContainerWidth)&&void 0!==e?e:i.containerWidth)&&void 0!==n?n:t.clientWidth)&&void 0!==o?o:0;return s>0?s: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,i=-1,o=null;n.forEach(n=>{n.rowIndex!==i&&(o&&i>0&&t.push({rowIndex:i,firstCell:o,prevCell:e}),e=o||void 0,i=n.rowIndex,o=n)}),o&&i>0&&t.push({rowIndex:i,firstCell:o,prevCell:e}),d=t.map(({rowIndex:t,firstCell:e,prevCell:n})=>{var i,o;return{rowIndex:t,position:e.tableRow.position,displayStrongBorder:null!==(o=null===(i=null==n?void 0:n.tableRow)||void 0===i?void 0:i.isLastGroupRow)&&void 0!==o&&o}})}0!==d.length&&d.forEach(({rowIndex:n,position:s,displayStrongBorder:l})=>{var d;const c=r.get(n),h=He({position:s,rowHeight:i.rowHeight,heightOffsets:i.heightOffsets,customTheme:null!==(d=i.customTheme)&&void 0!==d?d:e});if(o.has(n)){const t=o.get(n);(!c||c.topPx!==h||c.displayStrongBorder!==l||c.sectionWidthPx!==a)&&(Oi(t,a),(null==c?void 0:c.displayStrongBorder)!==l&&(l?t.classList.add("st-last-group-row"):t.classList.remove("st-last-group-row")),c&&c.topPx===h||(t.style.transform=`translate3d(0, ${h}px, 0)`),r.set(n,{position:s,topPx:h,displayStrongBorder:l,sectionWidthPx:a}))}else{const e=Pi({position:s,rowHeight:i.rowHeight,displayStrongBorder:l,heightOffsets:i.heightOffsets,customTheme:i.customTheme,isSticky:!1,sectionWidthPx:a});t.appendChild(e),o.set(n,e),r.set(n,{position:s,topPx:h,displayStrongBorder:l,sectionWidthPx:a})}})})(t,y,i,S,s),a(t)};function ji(t,e){return t?"string"==typeof t?t:t instanceof HTMLElement?t.cloneNode(!0):"function"==typeof t?t(e):null:null}function Ni(t){var e,n;const i=new Map,o=t.rows.filter(t=>!t.nestedTable&&!t.stateIndicator),s=void 0!==t.pageStartIndex;for(const r of o){let o;o=s?(r.position-(null!==(e=t.pageStartIndex)&&void 0!==e?e:0))*t.rowHeight:t.customTheme?ke({position:r.position,rowHeight:t.rowHeight,heightOffsets:t.heightOffsets,customTheme:t.customTheme}):r.position*t.rowHeight;const l=null!==(n=r.stableRowKey)&&void 0!==n?n:pt(r.rowId);for(const e of t.headerPositions){const n=ot({accessor:e.accessor,rowId:l});i.set(n,{left:e.left,top:o,width:e.width,height:t.rowHeight})}}return i}class Bi{constructor(){this.headerSections=new Map,this.bodySections=new Map,this.bodyCellsCache=new Map,this.headerCellsCache=new Map,this.contextCache=new Map,this.bodySectionSnapshots=new Map,this.nextColIndexMap=new Map,this.stateRowsMap=new Map,this.nestedGridRowsMap=new Map}renderHeaderSection(t){const{headers:e,collapsedHeaders:n,pinned:i,maxHeaderDepth:o,headerHeight:s,context:r,sectionWidth:l,startColIndex:a=0}=t,d=i||"main";let c=this.headerSections.get(d);c||(c=document.createElement("div"),c.className="left"===i?"st-header-pinned-left":"right"===i?"st-header-pinned-right":"st-header-main",this.headerSections.set(d,c));const h=e.filter(t=>"left"===i?"left"===t.pinned:"right"===i?"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: ${o*s}px;\n `;const u=this.getCachedHeaderCells(d,h,n,o,s,a),f=u.length>0?Math.max(...u.map(t=>t.colIndex))+1:a;this.nextColIndexMap.set(d,f);const v=this.getCachedContext("header-"+d,r,i,l),p=c.scrollLeft;return Wi(c,u,v,p),i||p===c.scrollLeft||(c.scrollLeft=p),!i&&c&&(c.__renderHeaderCells=(t,e)=>{if(!c)return;const n=void 0!==e?Object.assign(Object.assign({},v),{columnsWithSelectedCells:e.columnsWithSelectedCells,selectedColumns:e.selectedColumns}):v;Wi(c,u,n,t)}),c}renderBodySection(t){var n,i,o,s;const{headers:r,rows:l,collapsedHeaders:a,pinned:d,context:c,sectionWidth:h,rowHeight:u,heightOffsets:f,totalRowCount:v,startColIndex:p=0,positionOnly:w=!1,fullTableRows:m,renderedStartIndex:g,renderedEndIndex:b,allFlattenedRows:x,pageStartIndex:y,animationCoordinator:R}=t,S=d||"main";let C=this.bodySections.get(S);C||(C=document.createElement("div"),C.className="left"===d?"st-body-pinned-left":"right"===d?"st-body-pinned-right":"st-body-main",this.bodySections.set(S,C));const M=r.filter(t=>"left"===d?"left"===t.pinned:"right"===d?"right"===t.pinned:!t.pinned);if(0===M.length)return C.style.display="none",C;C.style.display="";const I=((t,e,n,i)=>t*(e+i.rowSeparatorWidth)-i.rowSeparatorWidth+((null==n?void 0:n.reduce((t,[e,n])=>t+n,0))||0))(void 0!==v?v:l.length,u,f,null!==(n=c.customTheme)&&void 0!==n?n:e);C.style.cssText=`\n position: relative;\n ${void 0!==h?`width: ${h}px;`:""}\n ${d?"":"flex-grow: 1;"}\n height: ${I}px;\n `;const H=this.getCachedBodyCells(S,M,l,a,u,f,null!==(i=c.customTheme)&&void 0!==i?i:e,p,m,g,b),k=null!==(o=null!=x?x:m)&&void 0!==o?o:l;this.captureSnapshotConfig(S,M,a,k,u,f,null!==(s=c.customTheme)&&void 0!==s?s:e,void 0!==x?null!=y?y:0:void 0);const T=R?this.getFullSectionLayout(S):null,E=l.filter(t=>!t.nestedTable&&!t.stateIndicator).length;this.nextColIndexMap.set(S,H.length>0&&E>0?p+H.length/E:p);const A=this.getCachedContext("body-"+S,c,d,h);return Di(C,H,A,C.scrollLeft,l,w,R,null!=T?T:void 0),this.renderNestedGridRows(C,S,l,d,A,R),d||this.renderStateRows(C,S,l,A,R),!d&&C&&(C.__renderBodyCells=t=>{C&&Di(C,H,A,t,l,!0)}),C}renderNestedGridRows(t,e,n,i,s,r){var l,a;const d=null!==(l=null==r?void 0:r.isEnabled())&&void 0!==l&&l,c=d?`transform ${r.getDuration()}ms ${r.getEasing()}, height ${r.getDuration()}ms ${r.getEasing()}`:"",h=n.filter(t=>t.nestedTable),u=new Set(h.map(t=>bt(t)));let f=this.nestedGridRowsMap.get(e);f||(f=new Map,this.nestedGridRowsMap.set(e,f)),f.forEach((t,e)=>{var n;u.has(e)||(null===(n=t.cleanup)||void 0===n||n.call(t),t.element.remove(),f.delete(e))});const v={rowHeight:s.rowHeight,heightOffsets:s.heightOffsets,customTheme:null!==(a=s.customTheme)&&void 0!==a?a:{},theme:s.theme,rowGrouping:s.rowGrouping,depth:0,loadingStateRenderer:s.loadingStateRenderer,errorStateRenderer:s.errorStateRenderer,emptyStateRenderer:s.emptyStateRenderer,icons:s.icons,createNestedTable:s.createNestedTable};h.forEach(n=>{var r,l,a,h,u,p,w;const m=bt(n),g=f.get(m);if(g){const t=ke({position:n.position,rowHeight:s.rowHeight,heightOffsets:s.heightOffsets,customTheme:null!==(r=s.customTheme)&&void 0!==r?r:{}}),e=at({calculatedHeight:n.nestedTable.calculatedHeight,customHeight:null===(l=n.nestedTable.expandableHeader.nestedTable)||void 0===l?void 0:l.height,customTheme:null!==(a=s.customTheme)&&void 0!==a?a:{}}),i=g.lastTop!==t,o=g.lastWrapperHeight!==e;return(i||o)&&(g.element.style.transition=c,i&&(g.element.style.transform=`translate3d(0, ${t}px, 0)`),o&&(g.element.style.height=e+"px"),g.lastTop=t,g.lastWrapperHeight=e),g.element.dataset.index=n.position+"",void(g.lastPosition=n.position)}const b=this.stateRowsMap.get(e),x=b&&b.has(m)?s.rowHeight:0,y=at({calculatedHeight:n.nestedTable.calculatedHeight,customHeight:null===(h=n.nestedTable.expandableHeader.nestedTable)||void 0===h?void 0:h.height,customTheme:null!==(u=s.customTheme)&&void 0!==u?u:{}}),R=ke({position:n.position,rowHeight:s.rowHeight,heightOffsets:s.heightOffsets,customTheme:null!==(p=s.customTheme)&&void 0!==p?p:{}});if(i){const e=function(t,e){const{nestedTable:n}=t;if(!n)throw Error("createNestedGridSpacer called without tableRow.nestedTable");const i=t.nestedTable.expandableHeader.nestedTable,o=at({calculatedHeight:n.calculatedHeight,customHeight:null==i?void 0:i.height,customTheme:e.customTheme}),s=ke({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.setAttribute("role","presentation"),r.setAttribute("aria-hidden","true"),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=o+"px",r.style.pointerEvents="none",r}(n,{rowHeight:s.rowHeight,heightOffsets:s.heightOffsets,customTheme:null!==(w=s.customTheme)&&void 0!==w?w:{}});d&&x!==y&&(e.style.height=x+"px"),t.appendChild(e),f.set(m,{element:e,lastPosition:n.position,lastTop:R,lastWrapperHeight:y}),d&&x!==y&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transition=c,e.style.height=y+"px"})})}else{v.depth=n.depth>0?n.depth-1:0;const{element:e,cleanup:i}=function(t,e){const{nestedTable:n}=t;if(!n)throw Error("createNestedGridRow called without tableRow.nestedTable");const{rowHeight:i,heightOffsets:s,customTheme:r,theme:l,rowGrouping:a,depth:d,loadingStateRenderer:c,errorStateRenderer:h,emptyStateRenderer:u,icons:f}=e,{parentRow:v,expandableHeader:p,childAccessor:w,calculatedHeight:m}=n,g=p.nestedTable;if(!g)throw Error("createNestedGridRow: expandableHeader.nestedTable is missing");const b=ct(v,w),x=Array.isArray(b)?b:[],y=a&&a[d+1]?a.slice(d+1):void 0,R=g.customTheme?Object.assign(Object.assign({},r),g.customTheme):r,S=(({calculatedHeight:t,customHeight:e,customTheme:n})=>e?"string"==typeof e?e:e+"px":t-n.nestedGridPaddingTop-n.nestedGridPaddingBottom+"px")({calculatedHeight:m,customHeight:g.height,customTheme:r}),C=at({calculatedHeight:m,customHeight:g.height,customTheme:r}),M=ke({position:t.position,rowHeight:i,heightOffsets:s,customTheme:r}),I=document.createElement("div");I.className="st-row st-nested-grid-row st-row-position-"+t.position,I.setAttribute("role","row"),I.dataset.index=t.position+"",I.style.position="absolute",I.style.left="0",I.style.right="0",I.style.transform=`translate3d(0, ${M}px, 0)`,I.style.height=C+"px",I.style.paddingTop=r.nestedGridPaddingTop+"px",I.style.paddingBottom=r.nestedGridPaddingBottom+"px",I.style.paddingLeft=r.nestedGridPaddingLeft+"px",I.style.paddingRight=r.nestedGridPaddingRight+"px",I.style.boxSizing="border-box";const H=document.createElement("div");if(H.setAttribute("role","gridcell"),H.style.height="100%",H.style.width="100%",I.appendChild(H),!g.columns)throw Error("createNestedGridRow: nestedTable.columns is required");const k=o(Object.assign(Object.assign({},g),{columns:g.columns,rows:x,theme:l,customTheme:R,height:S,rowGrouping:y,loadingStateRenderer:c,errorStateRenderer:h,emptyStateRenderer:u,icons:f}));if(!e.createNestedTable)throw Error("createNestedGridRow: context.createNestedTable factory was not provided");const T=e.createNestedTable(H,k);T.mount();const E=()=>{T.destroy()};return I.__nestedTableCleanup=E,{element:I,cleanup:E}}(n,v);d&&x!==y&&(e.style.height=x+"px",e.style.overflow="hidden"),t.appendChild(e),f.set(m,{element:e,cleanup:i,lastPosition:n.position,lastTop:R,lastWrapperHeight:y}),d&&x!==y&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transition=c,e.style.height=y+"px"})})}})}renderStateRows(t,e,n,i,o){var s,r;const l=n.filter(t=>t.stateIndicator),a=new Set(l.map(t=>bt(t)));let d=this.stateRowsMap.get(e);d||(d=new Map,this.stateRowsMap.set(e,d));const c=null!==(s=null==o?void 0:o.isEnabled())&&void 0!==s&&s,h=c?`transform ${o.getDuration()}ms ${o.getEasing()}, height ${o.getDuration()}ms ${o.getEasing()}`:"";d.forEach((t,e)=>{a.has(e)||(t.element.remove(),d.delete(e))});const u={index:0,rowHeight:i.rowHeight,heightOffsets:i.heightOffsets,customTheme:null!==(r=i.customTheme)&&void 0!==r?r:{},loadingStateRenderer:i.loadingStateRenderer,errorStateRenderer:i.errorStateRenderer,emptyStateRenderer:i.emptyStateRenderer};l.forEach((e,n)=>{var o;const s=bt(e),r=ke({position:e.position,rowHeight:i.rowHeight,heightOffsets:i.heightOffsets,customTheme:null!==(o=i.customTheme)&&void 0!==o?o:{}}),l=d.get(s);if(l)return l.lastTop!==r&&(l.element.style.transition=h,l.element.style.transform=`translate3d(0, ${r}px, 0)`,l.lastTop=r),void(l.lastPosition=e.position);const a=((t,e)=>{const{position:n,stateIndicator:i}=t;if(!i)throw Error("createStateRow called without stateIndicator");const o=document.createElement("div");o.className="st-row st-state-row st-row-position-"+n,o.setAttribute("role","row"),o.dataset.index=e.index+"",o.style.width="100%",o.style.transform=`translate3d(0, ${ke({position:n,rowHeight:e.rowHeight,heightOffsets:e.heightOffsets,customTheme:e.customTheme})}px, 0)`,o.style.height=e.rowHeight+"px";const s=document.createElement("div");s.className="st-cell st-state-row-cell",s.setAttribute("role","gridcell"),s.style.width="100%",s.style.padding="0";let r=null;return i.state.loading&&e.loadingStateRenderer?r=ji(e.loadingStateRenderer,{parentRow:i.parentRow}):i.state.error&&e.errorStateRenderer?r=ji(e.errorStateRenderer,{error:i.state.error,parentRow:i.parentRow}):i.state.isEmpty&&e.emptyStateRenderer&&(r=ji(e.emptyStateRenderer,{message:i.state.emptyMessage,parentRow:i.parentRow})),r&&("string"==typeof r?s.textContent=r:r instanceof HTMLElement&&s.appendChild(r)),o.appendChild(s),o})(e,Object.assign(Object.assign({},u),{index:n}));a.style.position="absolute",a.style.transform=`translate3d(0, ${r}px, 0)`,a.style.width="100%",c?(a.style.height="0px",a.style.overflow="hidden",t.appendChild(a),requestAnimationFrame(()=>{requestAnimationFrame(()=>{a.style.transition=h,a.style.height=i.rowHeight+"px"})})):t.appendChild(a),d.set(s,{element:a,lastTop:r,lastPosition:e.position})})}calculateAbsoluteHeaderCells(t,e,n,i,o=0){const s=[];let r=o,l=0;const a=(t,o,d)=>{if(Z(t))return 0;const c=e.has(t.accessor);if(t.children&&t.children.length>0){const e=t.children.filter(t=>{if(Z(t))return!1;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:o*i,width:c,height:(n-o)*i,colIndex:r,parentHeader:d}),r++,l+=c;let h=0;return e.forEach(e=>{h+=a(e,o,t)}),c+h}if(0===e.length){const e="number"==typeof t.width?t.width:150;return s.push({header:t,left:l,top:o*i,width:e,height:(n-o)*i,colIndex:r,parentHeader:d}),r++,l+=e,e}const h=l,u=r;let f=0;return e.forEach(e=>{f+=a(e,o+1,t)}),s.push({header:t,left:h,top:o*i,width:f,height:i,colIndex:u,parentHeader:d}),f}{const e="number"==typeof t.width?t.width:150;return s.push({header:t,left:l,top:o*i,width:e,height:(n-o)*i,colIndex:r,parentHeader:d}),r++,l+=e,e}};return t.forEach(t=>a(t,0)),s}calculateAbsoluteBodyCells(t,e,n,i,o,s,r=0){const l=[],a=e.filter(t=>!t.nestedTable&&!t.stateIndicator),d=this.getLeafHeaders(t,n),c=new Map;let h=0;return d.forEach(t=>{const e="number"==typeof t.width?t.width:150;c.set(t.accessor,{left:h,width:e}),h+=e}),a.forEach((t,e)=>{const n=s?ke({position:t.position,rowHeight:i,heightOffsets:o,customTheme:s}):e*i,a=t.position%2==1;d.forEach((o,s)=>{var d,h;const u=c.get(o.accessor);l.push({header:o,row:t.row,rowIndex:e,colIndex:r+s,rowId:pt(t.rowId),stableRowKey:t.stableRowKey,displayRowNumber:t.displayPosition,depth:t.depth,isOdd:a,tableRow:t,left:null!==(d=null==u?void 0:u.left)&&void 0!==d?d:0,top:n,width:null!==(h=null==u?void 0:u.width)&&void 0!==h?h:150,height:i})})}),l}getLeafHeaders(t,e){const n=[],i=t=>{if(Z(t))return;const o=e.has(t.accessor);if(t.children&&t.children.length>0){const e=t.children.filter(t=>{if(Z(t))return!1;const e=t.showWhen||"parentExpanded";return o?"parentCollapsed"===e||"always"===e:"parentExpanded"===e||"always"===e});t.singleRowChildren&&n.push(t),e.length>0?e.forEach(t=>i(t)):t.singleRowChildren||n.push(t)}else n.push(t)};return t.forEach(t=>i(t)),n}createHeadersHash(t){const e=t=>{let n=`${t.accessor}:${t.width}:${t.pinned||""}:${t.hide||""}:${t.excludeFromRender||""}`;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","selectRowOnClick","rowSelectionMode","activeRowId","cellUpdateFlash","oddColumnBackground","hoverRowBackground","oddEvenRowBackground","rowHeight","containerWidth","isLoading","mainSectionViewportWidth","mainSectionContainerWidth","enableVirtualization"].map(e=>`${e}:${t[e]}`).join("|");const n=t.heightOffsets;if(Array.isArray(n)&&n.length>0){let t="";for(let e=0;n.length>e;e++){const i=n[e];t+=`${i[0]}:${i[1]};`}e+="|offsets:"+t}else e+="|offsets:none";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(",")),t.pinned&&(e+="|pinned:"+t.pinned),void 0!==t.pinnedSectionWidthPx&&(e+="|pinnedSectionWidthPx:"+t.pinnedSectionWidthPx),e}getCachedBodyCells(t,e,n,i,o,s,r,l=0,a,d,c){const h=this.createHeadersHash(e),u=this.createHeightOffsetsHash(s),f=null!=a&&null!=d&&null!=c,v=this.bodyCellsCache.get(t),p=v&&v.deps.headersHash===h&&v.deps.collapsedHeadersSize===i.size&&v.deps.rowHeight===o&&v.deps.heightOffsetsHash===u&&(f?v.deps.fullTableRowsRef===a&&void 0!==v.deps.bandStart&&void 0!==v.deps.bandEnd&&((t,e)=>d>=t&&e>=c)(v.deps.bandStart,v.deps.bandEnd):v.deps.rowsRef===n);if(p&&v){if(!f)return v.cells;const t=new Map;n.forEach((e,n)=>{t.set(e.position,n)});const e=[];for(const n of v.cells){const i=t.get(n.tableRow.position);void 0!==i&&e.push(n.rowIndex!==i?Object.assign(Object.assign({},n),{rowIndex:i}):n)}return e}let w,m,g;if(f){const t=a.length;m=Math.max(0,d-28),g=Math.min(t,c+28),w=a.slice(m,g)}else w=n;const b=this.calculateAbsoluteBodyCells(e,w,i,o,s,r,l);if(this.bodyCellsCache.set(t,{cells:b,deps:Object.assign({headersHash:h,rowsRef:w,collapsedHeadersSize:i.size,rowHeight:o,heightOffsetsHash:u},f&&{fullTableRowsRef:a,bandStart:m,bandEnd:g})}),!f)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?Object.assign(Object.assign({},t),{rowIndex:e}):t)}return y}getCachedHeaderCells(t,e,n,i,o,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===i&&r.deps.headerHeight===o)return r.cells;const a=this.calculateAbsoluteHeaderCells(e,n,i,o,s);return this.headerCellsCache.set(t,{cells:a,deps:{headersHash:l,collapsedHeadersSize:n.size,maxDepth:i,headerHeight:o}}),a}getCachedContext(t,e,n,i){const o=this.contextCache.get(t),s="left"===n||"right"===n?i:void 0,r=Object.assign(Object.assign({},e),{pinned:n,pinnedSectionWidthPx:s}),l=this.createContextHash(r);return o&&o.deps.contextHash===l?o.context:(this.contextCache.set(t,{context:r,deps:{contextHash:l}}),r)}setOnRendererHostDiscard(t){this.onRendererHostDiscard=t}invalidateCache(t){t&&"all"!==t?"body"===t?this.bodyCellsCache.clear():"header"===t?this.headerCellsCache.clear():"context"===t&&(this.contextCache.clear(),this.headerCellsCache.clear()):(this.bodyCellsCache.clear(),this.headerCellsCache.clear(),this.contextCache.clear(),this.bodySections.forEach(t=>{v(t,this.onRendererHostDiscard)}),this.headerSections.forEach(t=>{((t,e)=>{if(w=0,t){const n=R(t);n.forEach(t=>{null==e||e(t),t.remove()}),n.clear(),C(t).clear(),H(t),d(t)}})(t,this.onRendererHostDiscard)}))}getNextColIndex(t){var e;return null!==(e=this.nextColIndexMap.get(t))&&void 0!==e?e:0}getCurrentBodyLayouts(){const t=new Map;return this.bodySectionSnapshots.forEach((e,n)=>{const i=this.bodySections.get(n);i&&t.set(i,Ni(e))}),t}getFullSectionLayout(t){const e=this.bodySectionSnapshots.get(t);return e?Ni(e):null}captureSnapshotConfig(t,e,n,i,o,s,r,l){const a=this.getLeafHeaders(e,n),d=[];let c=0;for(const t of a){const e="number"==typeof t.width?t.width:150;d.push({accessor:t.accessor,left:c,width:e}),c+=e}this.bodySectionSnapshots.set(t,{rows:i,headerPositions:d,rowHeight:o,heightOffsets:s,customTheme:r,pageStartIndex:l})}releaseBodySections(){this.bodySections.forEach(t=>{v(t,this.onRendererHostDiscard),t.remove()}),this.bodySections.clear(),this.bodyCellsCache.clear(),this.bodySectionSnapshots.clear(),this.nestedGridRowsMap.forEach(t=>{t.forEach(t=>{var e;null===(e=t.cleanup)||void 0===e||e.call(t),t.element.remove()}),t.clear()}),this.nestedGridRowsMap.clear(),this.stateRowsMap.forEach(t=>{t.forEach(t=>{t.element.remove()}),t.clear()}),this.stateRowsMap.clear()}cleanup(){this.releaseBodySections(),this.headerSections.clear(),this.headerCellsCache.clear(),this.contextCache.clear(),this.nextColIndexMap.clear()}}const zi=(t,e)=>{"string"==typeof e?t.innerHTML=e:(t.innerHTML="",t.appendChild(e.cloneNode(!0)))},Vi=(t,e,n=new Set)=>{for(const i of t)if(!n.has(i.accessor)&&(n.add(i.accessor),i.children&&i.children.length>0)){const t=i.children.some(t=>t.accessor===e);let o=!1;if(!t)for(const t of i.children)if(Vi([t],e,n),!1===t.hide){o=!0;break}(t||o)&&(i.hide=!1)}},qi=t=>t.every(t=>t.hide),Gi=t=>t.every(t=>!t.hide),Ki=t=>{for(const e of t)e.hide=!1,e.children&&e.children.length>0&&Ki(e.children)},_i=t=>{t.forEach(t=>{t.children&&t.children.length>0&&(_i(t.children),qi(t.children)&&(t.hide=!0))})},Ui=(t,e)=>{const n=e.toLowerCase();return!!t.label.toLowerCase().includes(n)||!(!t.children||0>=t.children.length)&&t.children.some(t=>Ui(t,e))},Ji=(t,e,n)=>{if(!e.trim())return t;const i=n||Ui;return t.filter(t=>!t.isSelectionColumn&&!t.excludeFromRender&&i(t,e))};function Yi(t,e,n,i){e&&t.appendChild(e),t.appendChild(n),i&&t.appendChild(i)}function Xi(t,e,n,i,o,s,r){const l=e({headers:n,searchSection:i,listSection:o,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 Qi=t=>{let e=t,{headers:n,open:i,searchEnabled:o,searchPlaceholder:s,searchFunction:r,columnEditorConfig:l,icons:a,essentialAccessors:d,setHeaders:c,onColumnVisibilityChange:h,onColumnOrderChange:u,resetColumns:f}=e,v="",p=null,w=null,m=!1;const g=new Set,b=t=>{t.forEach(t=>{t.children&&t.children.length>0&&(g.add(t.accessor),b(t.children))})};b(n);let x=g;const y=document.createElement("div");y.className="st-column-editor-popout "+(i?"open":"");const R=document.createElement("div");R.className="st-column-editor-popout-content",R.addEventListener("click",t=>t.stopPropagation());let S=null,C=null;if(o){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 i=document.createElement("input");return i.type="text",i.value="",i.placeholder=t,i.className="st-filter-input",i.addEventListener("click",t=>t.stopPropagation()),i.addEventListener("input",t=>{v=t.target.value,P()}),n.appendChild(i),e.appendChild(n),{wrapper:e,input:i}}(s);C=t.wrapper,S=t.input}const M=document.createElement("div");M.className="st-column-editor-lists";let I=null;f&&(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}(f));let H=l.customRenderer;H?Xi(R,H,n,C,M,I,f):Yi(R,C,M,I),y.appendChild(R);const k=t=>{p=t,null!==t?m=!0:(m=!1,P())},T=()=>{w=null},E=t=>{w=t,m?W():P()},A=t=>{const e=x;x=t,P(e)},W=()=>{M.querySelectorAll(".st-column-editor-list-section").forEach(t=>{const e=null!==w&&w.panelSection===t.dataset.panelSection;t.querySelectorAll(".st-column-editor-drag-separator").forEach((t,n)=>{t.style.opacity=e&&w.index===n-1?"1":"0"})})},O=(t,e,i,s,f)=>{if(0===t.length)return;const m=t.filter(t=>!t.isSelectionColumn&&!t.excludeFromRender);if(0===(o?Ji(m,v,r):m).length)return;if(i){const t=document.createElement("div");t.className="st-column-editor-section-label",t.textContent=i,s.appendChild(t)}const g=document.createElement("div");g.className="st-column-editor-list st-column-editor-list-section",g.dataset.panelSection=e,s.appendChild(g);const b=((t,e)=>{const n=o?Ji(t,v,r):t,i=[],s=o&&v.trim().length>0,l=({headers:t,depth:n=0,parent:o=null,currentPath:r=[]})=>{t.forEach((t,a)=>{if(t.isSelectionColumn||t.excludeFromRender)return;const d=[...r,a];i.push({header:t,visualIndex:i.length,depth:n,parent:o,indexPath:d,panelSection:e});const c=t.children&&t.children.length>0,h=s||x.has(t.accessor);c&&h&&t.children&&l({headers:t.children,depth:n+1,parent:t,currentPath:d})})};return l({headers:n,depth:0,parent:null,currentPath:[]}),i})(t,e),y=(t=>t.some(t=>t.children&&t.children.length>0))(t);b.forEach(t=>{var i;const s=(t=>{var e,n;const{allHeaders:i,clearHoverSeparator:o,depth:s,doesAnyHeaderHaveChildren:r,draggingRow:l,getDraggingRow:a,getHoveredSeparator:d,expandedHeaders:c,flattenedHeaders:h,forceExpanded:u,header:f,hoveredSeparator:v,panelSection:p,rowIndex:w,setDraggingRow:m,setExpandedHeaders:g,setHoveredSeparator:b,headers:x,setHeaders:y,onColumnVisibilityChange:R,onColumnOrderChange:S,previousExpandedHeaders:C}=t,M=null!==(e=t.essentialAccessors)&&void 0!==e?e:new Set,I=!1!==t.columnEditorConfig.allowColumnPinning,H=Fn(f,M),k=!H,T=document.createDocumentFragment(),E=16*s+"px",A=f.children&&f.children.length>0;let W=!f.hide,O=!1;if(A&&f.children){const t=qi(f.children),e=Gi(f.children);f.hide||t?(W=!1,O=!1):e?(W=!0,O=!1):(W=!1,O=!0)}const P=c.has(f.accessor),$=u||P,F=null!==v&&v.panelSection===(null!=p?p:"main");let L;if(0===w){const t=document.createElement("div");t.className="st-column-editor-drag-separator",t.style.opacity=F&&-1===v.index?"1":"0",T.appendChild(t)}const D=document.createElement("div");D.className="st-header-checkbox-item",D.style.paddingLeft=E,D.draggable=!0;const j=t=>!(M.size>0&&!Dn(t,M)||(null==S||S(t),y(t),0)),N=t=>{if(t.stopPropagation(),u)return;const e=new Set(c);P?e.delete(f.accessor):e.add(f.accessor),g(e)};let B;if(D.addEventListener("dragstart",t=>{t.dataTransfer&&(t.dataTransfer.effectAllowed="move"),null==o||o(),m(h[w])}),D.addEventListener("dragenter",t=>{t.preventDefault()}),D.addEventListener("dragover",t=>{t.preventDefault();const e=a?a():l;if(e&&e.panelSection===p){const n=t.currentTarget.getBoundingClientRect(),i=(({flattenedHeaders:t,draggingRow:e,hoveredRowIndex:n,isTopHalfOfRow:i})=>{var o,s;const r=t[n];if(r.depth===e.depth)return(null===(o=r.parent)||void 0===o?void 0:o.accessor)!==(null===(s=e.parent)||void 0===s?void 0:s.accessor)?null:i||r.header.children?n-1:n;if(r.depth>e.depth){let o=r,s=n;for(;o.parent&&o.depth>e.depth;){const e=o.parent.accessor,n=t.findIndex(t=>t.header.accessor===e);if(-1===n)break;o=t[n],s=n}const l=s;let a=s;for(let e=s+1;t.length>e&&t[e].depth>o.depth;e++)a=e;const d=a-l+1,c=n-l;let h=d/2>c;return d%2==1&&c===Math.floor(d/2)&&(h=i),h?s-1:a}return null})({flattenedHeaders:h,draggingRow:e,hoveredRowIndex:w,isTopHalfOfRow:n.top+n.height/2>t.clientY});b(null===i?null:{panelSection:null!=p?p:"main",index:i})}}),D.addEventListener("dragend",()=>{const t=a?a():l,e=d?d():v,n=()=>{m(null),b(null)};if(!t||null===e||t.panelSection!==p)return void n();const i=e.index;let o=h[i>t.visualIndex?i:i+1];if(!o)return void n();if(o.depth>t.depth&&o.parent){const t=h.findIndex(t=>t.header.accessor===o.parent.accessor);-1!==t&&(o=h[t])}if(t.header.accessor===o.header.accessor)return void n();if(t.indexPath.length!==o.indexPath.length||1!==t.indexPath.length&&!t.indexPath.slice(0,-1).every((t,e)=>t===o.indexPath[e]))return void n();const s=di(x,t.header.accessor),r=di(x,o.header.accessor);if(!s||!r)return void n();const{newHeaders:c,emergencyBreak:u}=ui(x,s,r);u||j(c),n()}),r){const e=document.createElement("div");if(e.className="st-header-icon-container",A){const t=void 0!==C?u||C.has(f.accessor):$,n=!u&&void 0!==C&&t!==$,i=n?t:$,o=document.createElement("div");o.className="st-column-editor-expand-icon st-expand-icon-container "+(i?"expanded":"collapsed"),o.setAttribute("role","button"),o.setAttribute("tabindex","0"),o.setAttribute("aria-expanded",i+""),o.setAttribute("aria-label",i?`Collapse ${f.label} column`:`Expand ${f.label} column`),o.appendChild(Ze("st-expand-icon")),o.addEventListener("click",N),o.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),N(t))}),e.appendChild(o),B=o,n&&(L=()=>{wn(D,$,{ariaLabelWhenExpanded:`Collapse ${f.label} column`,ariaLabelWhenCollapsed:`Expand ${f.label} column`,syncAriaExpanded:!0})})}t.columnEditorConfig.rowRenderer||D.appendChild(e)}const z=un({checked:W,indeterminate:O,onChange:t=>{if(!k)return;f.hide=!t,t?(Vi(i,f.accessor),A&&f.children&&f.children.length>0&&(qi(f.children)||Gi(f.children)?qi(f.children)&&f.children[0]&&(f.children[0].hide=!1,Vi(i,f.children[0].accessor)):Ki(f.children))):_i(i);const e=[...x];if(y(En(e)),R){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);R(t)}}});k||(z.element.classList.add("st-checkbox-disabled"),z.element.style.pointerEvents="none");const V=document.createElement("div");V.className="st-drag-icon-container";const q=null===(n=t.icons)||void 0===n?void 0:n.drag;"string"==typeof q?V.innerHTML=q:q instanceof HTMLElement||q instanceof SVGSVGElement?V.appendChild(q.cloneNode(!0)):V.appendChild(nn("st-drag-icon"));const G=document.createElement("div");G.className="st-column-label-container",G.textContent=f.label;const K="left"===f.pinned||"right"===f.pinned?f.pinned:null,_=!!K&&!H,U=!K&&"main"===p,J=!K&&"main"===p,Y=()=>{const t=Vn(x,f.accessor,"left",M);t&&j(t)},X=()=>{const t=Vn(x,f.accessor,"right",M);t&&j(t)},Q=()=>{const t=Vn(x,f.accessor,"main",M);t&&j(t)},{rowRenderer:Z}=t.columnEditorConfig;if(Z){const t=Z({accessor:f.accessor,header:f,components:{expandIcon:B,checkbox:z.element,dragIcon:V,labelContent:G},panelSection:p,essential:H,canToggleVisibility:k,allowColumnPinning:I,pinControl:I&&0===s?{pinnedSide:K,canPinLeft:U,canPinRight:J,canUnpin:_,pinLeft:Y,pinRight:X,unpin:Q}:void 0});t instanceof HTMLElement?D.appendChild(t):"string"==typeof t&&(D.innerHTML=t)}else if(D.appendChild(z.element),D.appendChild(V),D.appendChild(G),I&&0===s){const t=document.createElement("div");if(t.className="st-column-pin-side-group",t.addEventListener("mousedown",t=>{t.stopPropagation()}),t.addEventListener("dragstart",t=>{t.preventDefault(),t.stopPropagation()}),K){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"===K?"L":"R",e.title=n?"Essential column — cannot be unpinned":"Unpin column",_&&e.addEventListener("click",t=>{t.stopPropagation(),Q()}),t.appendChild(e)}else{if(U){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(),Y()}),t.appendChild(e)}if(J){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(),X()}),t.appendChild(e)}}D.appendChild(t)}T.appendChild(D);const tt=document.createElement("div");return tt.className="st-column-editor-drag-separator",tt.style.opacity=F&&v.index===w?"1":"0",T.appendChild(tt),{fragment:T,scheduleExpandIconAnimation:L}})({allHeaders:n,clearHoverSeparator:T,depth:t.depth,doesAnyHeaderHaveChildren:y,draggingRow:p,getDraggingRow:()=>p,getHoveredSeparator:()=>w,expandedHeaders:x,flattenedHeaders:b,forceExpanded:o&&v.trim().length>0,header:t.header,hoveredSeparator:w,panelSection:e,rowIndex:t.visualIndex,setDraggingRow:k,setExpandedHeaders:A,setHoveredSeparator:E,columnEditorConfig:l,icons:a,essentialAccessors:null!=d?d:new Set,headers:n,setHeaders:c,onColumnVisibilityChange:h,onColumnOrderChange:u,previousExpandedHeaders:f});g.appendChild(s.fragment),null===(i=s.scheduleExpandIconAnimation)||void 0===i||i.call(s)})},P=t=>{M.innerHTML="";const e=!1!==l.allowColumnPinning,{pinnedLeft:i,unpinned:o,pinnedRight:s}=$n(n);if(e)O(i,"left","Pinned Left",M,t),O(o,"main","Main",M,t),O(s,"right","Pinned Right",M,t);else{const e=[...i,...o,...s];O(e,"main",null,M,t)}};return P(),{element:y,update:t=>{void 0!==t.headers&&(n=t.headers),void 0!==t.searchEnabled&&(o=t.searchEnabled),void 0!==t.searchPlaceholder&&(s=t.searchPlaceholder),void 0!==t.searchFunction&&(r=t.searchFunction),void 0!==t.icons&&(a=t.icons),void 0!==t.essentialAccessors&&(d=t.essentialAccessors),void 0!==t.setHeaders&&(c=t.setHeaders),void 0!==t.onColumnVisibilityChange&&(h=t.onColumnVisibilityChange),void 0!==t.onColumnOrderChange&&(u=t.onColumnOrderChange),void 0!==t.resetColumns&&(f=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&&(i=t.open,i?y.classList.add("open"):y.classList.remove("open")),S&&void 0!==t.searchPlaceholder&&(S.placeholder=t.searchPlaceholder),e&&(R.innerHTML="",H?Xi(R,H,n,C,M,I,f):Yi(R,C,M,I)),P()},destroy:()=>{S&&(S.removeEventListener("input",()=>{}),S.removeEventListener("click",()=>{})),y.removeEventListener("click",()=>{}),y.remove()}}},Zi=t=>{const{sectionHeaders:e,stickyParents:n,stickyHeight:i,offsetStartIndex:o,treeTransitionOffset:s,rowHeight:r,heightOffsets:l,customTheme:a,cellRenderContext:d,collapsedHeaders:c,pinned:h,width:u,scrollSyncGroup:f,sectionScrollController:v,startColIndex:p,resolveBodyRowIndex:w}=t,m=document.createElement("div");m.className=h?"st-sticky-section-"+h:"st-sticky-section-main",m.style.position="relative",m.style.height=i+"px",h&&u?(m.style.width=u+"px",m.style.flexGrow="0",m.style.flexShrink="0"):m.style.flexGrow="1";const g=((t,e)=>{const n=[],i=t=>{if(Z(t))return;const o=e.has(t.accessor);if(t.children&&t.children.length>0){const e=t.children.filter(t=>{const e=t.showWhen||"parentExpanded";return o?"parentCollapsed"===e||"always"===e:"parentExpanded"===e||"always"===e});t.singleRowChildren&&n.push(t),e.length>0?e.forEach(t=>i(t)):t.singleRowChildren||n.push(t)}else n.push(t)};return t.forEach(t=>i(t)),n})(e,c),b=new Map;let x=0;g.forEach(t=>{const e="number"==typeof t.width?t.width:150;b.set(t.accessor,{left:x,width:e}),x+=e});const y=h&&"number"==typeof u?u:"number"==typeof d.mainSectionContainerWidth?d.mainSectionContainerWidth:void 0;return n.forEach((t,e)=>{const i=-1!==o&&e>=o,c=i?s:0,h=e*(r+1)+c,u=i?e:n.length-e,f=document.createElement("div");f.className="st-row st-sticky-parent",f.style.position="absolute",f.style.top="0px",f.style.left="0",f.style.right="0",f.style.height=r+"px",f.style.transform=`translateY(${h}px)`,f.style.zIndex=u+"",f.setAttribute("data-index",t.position+""),g.forEach((e,n)=>{var i,o;const s=b.get(e.accessor),l=p+n,a={header:e,row:t.row,rowIndex:w(t),colIndex:l,rowId:pt(t.rowId),stableRowKey:t.stableRowKey,displayRowNumber:t.displayPosition,depth:t.depth,isOdd:t.position%2==1,tableRow:t,left:null!==(i=null==s?void 0:s.left)&&void 0!==i?i:0,top:0,width:null!==(o=null==s?void 0:s.width)&&void 0!==o?o:150,height:r},c=kn(a,d);f.appendChild(c)}),m.appendChild(f);const v=Pi({position:(e+1)*(r+1)-1+c,rowHeight:r,displayStrongBorder:!1,heightOffsets:l,customTheme:a,isSticky:!0,sectionWidthPx:y});m.appendChild(v)}),v&&f&&v.registerPane("pinned-left"===f?"pinned-left":"pinned-right"===f?"pinned-right":"main",m,"sticky"),m},to=(t,e)=>{if(e){const n=t.querySelector(".st-sticky-section-left"),i=t.querySelector(".st-sticky-section-main"),o=t.querySelector(".st-sticky-section-right");n instanceof HTMLElement&&e.unregisterPane("pinned-left",n),i instanceof HTMLElement&&e.unregisterPane("main",i),o instanceof HTMLElement&&e.unregisterPane("pinned-right",o)}t.remove()};class eo{constructor(){this.footerInstance=null,this.lastCustomFooterRenderer=null,this.lastCustomFooterKey=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 Bi}scheduleRender(t){this.renderScheduled||(this.renderScheduled=!0,this.pendingRenderCallback=t,queueMicrotask(()=>{this.renderScheduled=!1,this.pendingRenderCallback&&(this.pendingRenderCallback(),this.pendingRenderCallback=null)}))}setOnRendererHostDiscard(t){this.sectionRenderer.setOnRendererHostDiscard(t)}invalidateCache(t){this.sectionRenderer.invalidateCache(t)}invalidateCustomFooterCache(){this.lastCustomFooterRenderer=null,this.lastCustomFooterKey=null}getCurrentBodyLayouts(){return this.sectionRenderer.getCurrentBodyLayouts()}renderHeader(t,e,n,i){var o,s,r,l,a,d,c,h,u,f,v,p,w,m;if(!t||i.config.hideHeader)return;t.style.height=e+"px";const g=An(i.effectiveHeaders,"left")||An(i.effectiveHeaders,void 0)||An(i.effectiveHeaders,"right");t.style.minHeight=g?"":e+"px";const b=t.parentElement;if(b)if(b.setAttribute("aria-rowcount",1+i.localRows.length+""),b.setAttribute("aria-colcount",i.effectiveHeaders.length+""),i.config.enableRowSelection){const t="multiple"===(null!==(o=i.config.rowSelectionMode)&&void 0!==o?o:"multiple");b.setAttribute("aria-multiselectable",t?"true":"false")}else b.removeAttribute("aria-multiselectable");const x=null!==(r=null===(s=i.dimensionManager)||void 0===s?void 0:s.getState())&&void 0!==r?r:{containerWidth:0,calculatedHeaderHeight:i.customTheme.headerHeight,maxHeaderDepth:1},{mainWidth:y,leftWidth:R,rightWidth:S}=wi({headers:i.effectiveHeaders,containerWidth:x.containerWidth,collapsedHeaders:i.collapsedHeaders}),C=null===(l=i.sortManager)||void 0===l?void 0:l.getState(),M=null===(a=i.filterManager)||void 0===a?void 0:a.getState(),I=null!==(c=null===(d=i.rowSelectionManager)||void 0===d?void 0:d.getSelectedRowCount())&&void 0!==c?c:0,H={reverse:!1,collapsedHeaders:i.collapsedHeaders,getCollapsedHeaders:i.getCollapsedHeaders,columnBorders:null!==(h=i.config.columnBorders)&&void 0!==h&&h,columnReordering:null!==(u=i.config.columnReordering)&&void 0!==u&&u,columnResizing:null!==(f=i.config.columnResizing)&&void 0!==f&&f,containerWidth:x.containerWidth,mainSectionContainerWidth:y,mainSectionViewportWidth:pi({containerWidth:x.containerWidth,leftWidth:R,rightWidth:S}),enableVirtualization:!1!==i.config.enableVirtualization,enableHeaderEditing:i.config.enableHeaderEditing,enableRowSelection:i.config.enableRowSelection,rowSelectionMode:null!==(v=i.config.rowSelectionMode)&&void 0!==v?v:"multiple",selectedRowCount:I,filters:null!==(p=null==M?void 0:M.filters)&&void 0!==p?p:{},icons:i.resolvedIcons,selectedColumns:i.config.selectableColumns&&i.selectionManager?i.selectionManager.getSelectedColumns():new Set,columnsWithSelectedCells:i.selectionManager&&(i.config.selectableCells||i.config.selectableColumns)?i.selectionManager.getColumnsWithSelectedCells():new Set,sort:null!==(w=null==C?void 0:C.sort)&&void 0!==w?w:null,autoExpandColumns:null!==(m=i.config.autoExpandColumns)&&void 0!==m&&m,getShrinkFloors:i.getShrinkFloors,onAutoExpandNaturalWidths:i.onAutoExpandNaturalWidths,essentialAccessors:i.essentialAccessors,selectableColumns:i.config.selectableColumns,headers:i.effectiveHeaders,rows:i.localRows,headerHeight:i.customTheme.headerHeight,lastHeaderIndex:i.effectiveHeaders.length-1,onSort:t=>{i.sortManager&&i.sortManager.updateSort({accessor:t})},handleApplyFilter:t=>{i.filterManager&&i.filterManager.updateFilter(t)},handleClearFilter:t=>{i.filterManager&&i.filterManager.clearFilter(t)},getHeaders:()=>i.getHeaders(),handleSelectAll:t=>{var e;null===(e=i.rowSelectionManager)||void 0===e||e.handleSelectAll(t)},setCollapsedHeaders:t=>{if("function"==typeof t){const e=i.getCollapsedHeaders?i.getCollapsedHeaders():i.collapsedHeaders;i.setCollapsedHeaders(t(e))}else i.setCollapsedHeaders(t);i.onRender()},setHeaders:t=>{i.setHeaders("function"==typeof t?t(i.getHeaders()):t),i.onRender()},setIsResizing:t=>{i.setIsResizing("function"==typeof t?t(i.isResizing):t)},onColumnWidthChange:i.config.onColumnWidthChange,onColumnOrderChange:i.config.onColumnOrderChange,onTableHeaderDragEnd:t=>{i.setHeaders(t),i.onRender()},onHeaderEdit:i.config.onHeaderEdit,onColumnSelect:i.config.onColumnSelect,selectColumns:i.selectionManager&&i.config.selectableColumns?(t,e)=>{i.selectionManager.selectColumns(t,e),i.onRender()}:t=>{},setSelectedColumns:i.selectionManager&&i.config.selectableColumns?t=>{const e=i.selectionManager.getSelectedColumns(),n="function"==typeof t?t(e):t;i.selectionManager.setSelectedColumns(n),i.onRender()}:t=>{},setSelectedCells:i.selectionManager?t=>{var e;const n=i.selectionManager.getSelectedCells(),o="function"==typeof t?t(n):t;i.selectionManager.setSelectedCells(o instanceof Set?o:new Set),null===(e=i.onRender)||void 0===e||e.call(i)}:t=>{},setInitialFocusedCell:i.selectionManager?t=>{var e;i.selectionManager.setInitialFocusedCell(null!=t?t:null),null===(e=i.onRender)||void 0===e||e.call(i)}:t=>{},areAllRowsSelected:()=>{var t,e;return null!==(e=null===(t=i.rowSelectionManager)||void 0===t?void 0:t.areAllRowsSelected())&&void 0!==e&&e},draggedHeaderRef:i.draggedHeaderRef,hoveredHeaderRef:i.hoveredHeaderRef,headerRegistry:i.headerRegistry,forceUpdate:()=>i.onRender(),mainBodyRef:i.mainBodyRef,pinnedLeftRef:i.pinnedLeftRef,pinnedRightRef:i.pinnedRightRef,accordionAxis:i.accordionAxis,animationCoordinator:i.animationCoordinator,onRendererHostDiscard:i.config.onRendererHostDiscard},k=i.effectiveHeaders.filter(t=>"left"===t.pinned),T=i.effectiveHeaders.filter(t=>!t.pinned),E=i.effectiveHeaders.filter(t=>"right"===t.pinned);let A=0;const W=[];if(k.length>0){const e=this.sectionRenderer.renderHeaderSection({headers:i.effectiveHeaders,collapsedHeaders:i.collapsedHeaders,pinned:"left",maxHeaderDepth:n,headerHeight:i.customTheme.headerHeight,context:H,sectionWidth:R,startColIndex:A});i.pinnedLeftHeaderRef.current=e,W.push(e),e.parentElement!==t&&t.insertBefore(e,t.firstChild),A=this.sectionRenderer.getNextColIndex("left")}if(T.length>0){const e=this.sectionRenderer.renderHeaderSection({headers:i.effectiveHeaders,collapsedHeaders:i.collapsedHeaders,maxHeaderDepth:n,headerHeight:i.customTheme.headerHeight,context:H,sectionWidth:y,startColIndex:A});if(i.mainHeaderRef.current=e,W.push(e),e.parentElement!==t){const n=i.pinnedRightHeaderRef.current;n&&n.parentElement===t?t.insertBefore(e,n):t.appendChild(e)}A=this.sectionRenderer.getNextColIndex("main")}if(E.length>0){const e=this.sectionRenderer.renderHeaderSection({headers:i.effectiveHeaders,collapsedHeaders:i.collapsedHeaders,pinned:"right",maxHeaderDepth:n,headerHeight:i.customTheme.headerHeight,context:H,sectionWidth:S,startColIndex:A});i.pinnedRightHeaderRef.current=e,W.push(e),e.parentElement!==t&&t.appendChild(e)}Array.from(t.children).forEach(t=>{W.includes(t)||t.remove()})}renderBody(t,e,n){var i,o,s,r,l,a,d,c,h,u,f,v,p,w,m,g,b,x,y,R,S,C,M,I,H,k,T;if(!t)return;if(An(n.effectiveHeaders,"left")||An(n.effectiveHeaders,void 0)||An(n.effectiveHeaders,"right"))t.style.minHeight="";else{const n=null!==(o=null===(i=null==e?void 0:e.heightMap)||void 0===i?void 0:i.totalHeight)&&void 0!==o?o:0;t.style.minHeight=n+"px"}const E=e.rowsToRender||e.currentTableRows,A=!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}),A){this.sectionRenderer.releaseBodySections(),t.innerHTML="",n.mainBodyRef.current=null,n.pinnedLeftRef.current=null,n.pinnedRightRef.current=null;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 W=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:O,leftWidth:P,rightWidth:$}=wi({headers:n.effectiveHeaders,containerWidth:W.containerWidth,collapsedHeaders:n.collapsedHeaders}),F=null!==(d=null===(a=n.rowSelectionManager)||void 0===a?void 0:a.getSelectedRowCount())&&void 0!==d?d:0,L=null!==(c=W.maxHeaderDepth)&&void 0!==c?c:1,D=null===(h=Y(n.effectiveHeaders).find(t=>!t.isSelectionColumn))||void 0===h?void 0:h.accessor,j={collapsedHeaders:n.collapsedHeaders,collapsedRows:n.getCollapsedRows(),expandedRows:n.getExpandedRows(),expandedDepths:Array.from(n.expandedDepths),selectedColumns:null!==(f=null===(u=n.selectionManager)||void 0===u?void 0:u.getSelectedColumns())&&void 0!==f?f:new Set,rowsWithSelectedCells:null!==(p=null===(v=n.selectionManager)||void 0===v?void 0:v.getRowsWithSelectedCells())&&void 0!==p?p:new Set,columnBorders:null!==(w=n.config.columnBorders)&&void 0!==w&&w,enableRowSelection:n.config.enableRowSelection,selectRowOnClick:null!==(m=n.config.selectRowOnClick)&&void 0!==m&&m,rowSelectionMode:null!==(g=n.config.rowSelectionMode)&&void 0!==g?g:"multiple",selectedRowCount:F,activeRowId:null!==(x=null===(b=n.rowSelectionManager)||void 0===b?void 0:b.getActiveRowId())&&void 0!==x?x:null,cellUpdateFlash:n.config.cellUpdateFlash,oddColumnBackground:n.config.oddColumnBackground,hoverRowBackground:null===(y=n.config.hoverRowBackground)||void 0===y||y,hoverScopeId:n.hoverScopeId,oddEvenRowBackground:n.config.oddEvenRowBackground,rowGrouping:n.config.rowGrouping,headers:n.effectiveHeaders,rowHeaderAccessor:D,rowHeight:n.customTheme.rowHeight,maxHeaderDepth:L,heightOffsets:e.paginatedHeightOffsets,customTheme:n.customTheme,containerWidth:W.containerWidth,mainSectionContainerWidth:O,mainSectionViewportWidth:pi({containerWidth:W.containerWidth,leftWidth:P,rightWidth:$}),enableVirtualization:!1!==n.config.enableVirtualization,onCellEdit:n.config.onCellEdit,onCellClick:n.config.onCellClick,onRowGroupExpand:n.config.onRowGroupExpand,handleRowSelect:(t,e)=>{var i;null===(i=n.rowSelectionManager)||void 0===i||i.handleRowSelect(t,e)},handleToggleRow:t=>{var e;null===(e=n.rowSelectionManager)||void 0===e||e.handleToggleRow(t)},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!==(R=n.config.theme)&&void 0!==R?R:"modern-light",rowButtons:n.config.rowButtons,loadingStateRenderer:n.config.loadingStateRenderer,errorStateRenderer:n.config.errorStateRenderer,emptyStateRenderer:n.config.emptyStateRenderer,createNestedTable:n.createNestedTable,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,e,i)=>{var o;return null===(o=n.selectionManager)||void 0===o?void 0:o.handleMouseOver(t,e,i)},onRendererHostDiscard:n.config.onRendererHostDiscard,isRowSelected:t=>{var e,i;return null!==(i=null===(e=n.rowSelectionManager)||void 0===e?void 0:e.isRowSelected(t))&&void 0!==i&&i},canExpandRowGroup:n.config.canExpandRowGroup,isLoading:n.internalIsLoading,accordionAxis:n.accordionAxis},N=n.effectiveHeaders.filter(t=>"left"===t.pinned),B=n.effectiveHeaders.filter(t=>!t.pinned),z=n.effectiveHeaders.filter(t=>"right"===t.pinned);let q=0;const G=[],K=n.positionOnlyBody?void 0:n.animationCoordinator;if(N.length>0){const i=this.sectionRenderer.renderBodySection({headers:n.effectiveHeaders,rows:E,collapsedHeaders:n.collapsedHeaders,pinned:"left",context:j,sectionWidth:P,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,totalRowCount:e.currentTableRows.length,startColIndex:q,positionOnly:n.positionOnlyBody,fullTableRows:e.currentTableRows,renderedStartIndex:e.renderedStartIndex,renderedEndIndex:e.renderedEndIndex,allFlattenedRows:e.allFlattenedRows,pageStartIndex:e.pageStartIndex,animationCoordinator:K});n.pinnedLeftRef.current=i,G.push(i),i.parentElement!==t&&t.insertBefore(i,t.firstChild),q=this.sectionRenderer.getNextColIndex("left")}if(B.length>0){const i=this.sectionRenderer.renderBodySection({headers:n.effectiveHeaders,rows:E,collapsedHeaders:n.collapsedHeaders,context:j,sectionWidth:O,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,totalRowCount:e.currentTableRows.length,startColIndex:q,positionOnly:n.positionOnlyBody,fullTableRows:e.currentTableRows,renderedStartIndex:e.renderedStartIndex,renderedEndIndex:e.renderedEndIndex,allFlattenedRows:e.allFlattenedRows,pageStartIndex:e.pageStartIndex,animationCoordinator:K});if(n.mainBodyRef.current=i,G.push(i),i.parentElement!==t){const e=n.pinnedRightRef.current;e&&e.parentElement===t?t.insertBefore(i,e):t.appendChild(i)}q=this.sectionRenderer.getNextColIndex("main")}if(z.length>0){const i=this.sectionRenderer.renderBodySection({headers:n.effectiveHeaders,rows:E,collapsedHeaders:n.collapsedHeaders,pinned:"right",context:j,sectionWidth:$,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,totalRowCount:e.currentTableRows.length,startColIndex:q,positionOnly:n.positionOnlyBody,fullTableRows:e.currentTableRows,renderedStartIndex:e.renderedStartIndex,renderedEndIndex:e.renderedEndIndex,allFlattenedRows:e.allFlattenedRows,pageStartIndex:e.pageStartIndex,animationCoordinator:K});n.pinnedRightRef.current=i,G.push(i),i.parentElement!==t&&t.appendChild(i)}if(n.config.enableStickyParents&&e.stickyParents&&e.stickyParents.length>0){this.stickyParentsContainer&&(to(this.stickyParentsContainer,null!==(S=n.sectionScrollController)&&void 0!==S?S:null),this.stickyParentsContainer=null);const i=n.externalScrollActive?null!==(C=n.stickyParentsScrollTop)&&void 0!==C?C:0:null!==(I=null===(M=n.mainBodyRef.current)||void 0===M?void 0:M.scrollTop)&&void 0!==I?I:0,o=t.offsetWidth-t.clientWidth,s={left:0,main:N.length>0?this.sectionRenderer.getNextColIndex("left"):0,right:B.length>0?this.sectionRenderer.getNextColIndex("main"):N.length>0?this.sectionRenderer.getNextColIndex("left"):0},r=E.filter(t=>!t.nestedTable&&!t.stateIndicator),l=new Map;if(r.forEach((t,e)=>{var n;const i=null!==(n=t.stableRowKey)&&void 0!==n?n:pt(t.rowId);l.set(i,e)}),this.stickyParentsContainer=((t,e)=>{const{stickyParents:n,stickySectionColStart:i,stickyBodyRowIndexByRowKey:o}=t;if(0===n.length)return null;const s=t=>{var e,n;const i=null!==(e=t.stableRowKey)&&void 0!==e?e:pt(t.rowId);return null!==(n=o.get(i))&&void 0!==n?n:t.position},{treeTransitionOffset:r,offsetStartIndex:l}=((t,e,n,i,o,s)=>{var r,l;if(0===t.length)return{treeTransitionOffset:0,offsetStartIndex:-1};const a=e[0];if(!a)return{treeTransitionOffset:0,offsetStartIndex:-1};let d;if((null==a?void 0:a.parentIndices)&&a.parentIndices.length>0)for(let e=a.parentIndices.length-1;e>=0;e--){const n=a.parentIndices[e];if(t.some(t=>t.position===n)){d=n;break}}const c=void 0!==d?t.findIndex(t=>t.position===d):-1;let h=-1;for(let e=0;t.length>e;e++){const n=t[e],i=t[e+1];if(!i)break;if(i.depth===n.depth){h=e;break}if(n.depth>i.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 f=0;for(const t of e){if(!(null===(l=t.parentIndices)||void 0===l?void 0:l.includes(u)))break;f++}if(0===f)return{treeTransitionOffset:0,offsetStartIndex:c};const v=e[0];let p;return p=n?n.rowTopPositions[v.position]:v.position*(i+o.rowSeparatorWidth),{treeTransitionOffset:-((h+1-f)*i+Math.max(0,s-p)),offsetStartIndex:c}})(n,t.partiallyVisibleRows,t.heightMap,e.rowHeight,e.customTheme,t.scrollTop),a=n.length>0?n.length*(e.rowHeight+1)+r:0,d=`calc(100% - ${t.scrollbarWidth}px - ${e.enableColumnEditor?"29.5px":"0px"})`,c=document.createElement("div");c.className="st-sticky-top",c.setAttribute("aria-hidden","true"),c.style.height=a+"px",c.style.width=d,t.externalScrollActive?c.style.marginBottom=-a+"px":c.style.top=t.calculatedHeaderHeight+"px";const h=e.headers.filter(t=>!t.pinned),u=e.sectionScrollController;if(t.pinnedLeftColumns.length>0){const o=Zi({sectionHeaders:t.pinnedLeftColumns,stickyParents:n,stickyHeight:a,offsetStartIndex:l,treeTransitionOffset:r,rowHeight:e.rowHeight,heightOffsets:e.heightOffsets,customTheme:e.customTheme,cellRenderContext:e.cellRenderContext,collapsedHeaders:e.collapsedHeaders,pinned:"left",width:t.pinnedLeftWidth,scrollSyncGroup:"pinned-left",sectionScrollController:u,startColIndex:i.left,resolveBodyRowIndex:s});c.appendChild(o)}const f=Zi({cellRenderContext:e.cellRenderContext,collapsedHeaders:e.collapsedHeaders,customTheme:e.customTheme,heightOffsets:e.heightOffsets,offsetStartIndex:l,rowHeight:e.rowHeight,scrollSyncGroup:"default",sectionHeaders:h,stickyHeight:a,stickyParents:n,treeTransitionOffset:r,sectionScrollController:u,startColIndex:i.main,resolveBodyRowIndex:s});if(c.appendChild(f),t.pinnedRightColumns.length>0){const o=Zi({sectionHeaders:t.pinnedRightColumns,stickyParents:n,stickyHeight:a,offsetStartIndex:l,treeTransitionOffset:r,rowHeight:e.rowHeight,heightOffsets:e.heightOffsets,customTheme:e.customTheme,cellRenderContext:e.cellRenderContext,collapsedHeaders:e.collapsedHeaders,pinned:"right",width:t.pinnedRightWidth,scrollSyncGroup:"pinned-right",sectionScrollController:u,startColIndex:i.right,resolveBodyRowIndex:s});c.appendChild(o)}return c})({calculatedHeaderHeight:W.calculatedHeaderHeight,heightMap:e.heightMap,partiallyVisibleRows:e.partiallyVisibleRows||[],pinnedLeftColumns:N,pinnedLeftWidth:P,pinnedRightColumns:z,pinnedRightWidth:$,scrollTop:i,scrollbarWidth:o,stickyParents:e.stickyParents,stickySectionColStart:s,stickyBodyRowIndexByRowKey:l,externalScrollActive:n.externalScrollActive},{collapsedHeaders:n.collapsedHeaders,customTheme:n.customTheme,enableColumnEditor:V(n.config.enableColumnEditor,null===(H=n.config.columnEditorConfig)||void 0===H?void 0:H.showToggle),headers:n.effectiveHeaders,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,cellRenderContext:j,sectionScrollController:null!==(k=n.sectionScrollController)&&void 0!==k?k:null}),this.stickyParentsContainer){const e=t.parentElement;e&&this.stickyParentsContainer.parentElement!==e?e.insertBefore(this.stickyParentsContainer,t):e||t.appendChild(this.stickyParentsContainer)}}else this.stickyParentsContainer&&(to(this.stickyParentsContainer,null!==(T=n.sectionScrollController)&&void 0!==T?T:null),this.stickyParentsContainer=null);Array.from(t.children).forEach(t=>{G.includes(t)||t.remove()})}renderFooter(t,e,n,i,o){var s,r,l,a,d,c,h,u,f,v,p,w,m;if(!t)return;const g=!!o.config.footerRenderer,b=o.config.enablePagination&&!o.config.hideFooter;if(g||(this.lastCustomFooterRenderer=null,this.lastCustomFooterKey=null),!g&&!b)return void(t.innerHTML="");const x=null!==(s=o.config.rowsPerPage)&&void 0!==s?s:10,y=Math.ceil(e/x);if(g){const s=(n-1)*x+1,c=Math.min(n*x,e),h=`${n}|${e}|${x}|${y}|${o.config.hideFooter?1:0}|${null!==(r=o.config.footerRenderKey)&&void 0!==r?r:""}`;if(t.childNodes.length>0&&this.lastCustomFooterRenderer===o.config.footerRenderer&&this.lastCustomFooterKey===h)return void(this.footerInstance=null);this.lastCustomFooterRenderer=o.config.footerRenderer,this.lastCustomFooterKey=h;const u=null!==(l=o.config.serverSidePagination)&&void 0!==l&&l,f=t=>{if(u&&o.config.onPageChange)return o.config.onPageChange(t)},v=o.config.footerRenderer({currentPage:n,endRow:c,hasNextPage:y>n,hasPrevPage:n>1,nextIcon:null===(a=o.resolvedIcons)||void 0===a?void 0:a.next,onNextPage:async()=>{y>n&&(i(n+1),o.config.onNextPage&&await o.config.onNextPage(n+1),await f(n+1))},onPageChange:t=>{i(t),f(t)},onPrevPage:()=>{n>1&&(i(n-1),f(n-1))},prevIcon:null===(d=o.resolvedIcons)||void 0===d?void 0:d.prev,rowsPerPage:x,startRow:s,totalPages:y,totalRows:e});return t.innerHTML="",v instanceof HTMLElement?t.appendChild(v):"string"==typeof v&&(t.innerHTML=v),void(this.footerInstance=null)}if(this.footerInstance)this.footerInstance.update({currentPage:n,hideFooter:null!==(c=o.config.hideFooter)&&void 0!==c&&c,onPageChange:i,onNextPage:o.config.onNextPage,onUserPageChange:o.config.onPageChange,rowsPerPage:x,enablePagination:null!==(h=o.config.enablePagination)&&void 0!==h&&h,totalPages:y,totalRows:e,prevIcon:null===(u=o.resolvedIcons)||void 0===u?void 0:u.prev,nextIcon:null===(f=o.resolvedIcons)||void 0===f?void 0:f.next});else{t.innerHTML="";const s=(t=>{let{currentPage:e,hideFooter:n,onPageChange:i,onNextPage:o,onUserPageChange:s,rowsPerPage:r,enablePagination:l,totalPages:a,totalRows:d,prevIcon:c,nextIcon:h}=t,u=!0;if(n||!l)return{element:document.createElement("div"),update:()=>{},destroy:()=>{}};const f=document.createElement("div");f.className="st-footer";const v=()=>{f.innerHTML="";const t=e>1,n=a>e,l=e===a,p=Math.min((e-1)*r+1,d),w=Math.min(e*r,d),m=!t,g=!n&&!o||!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 ${p} to ${w} of ${d.toLocaleString()} results`,b.appendChild(x),f.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 i,o;if(t>8)if(e-7>t){const e=7;i=t-e,o=t+(15-e-1)}else i=Math.max(1,e-15+1),o=e;else i=1,o=14;i>2?(n.push(1),n.push(-1)):2===i&&n.push(1);for(let t=i;o>=t;t++)n.push(t);return e-1>o?(n.push(-2),n.push(e)):o===e-1&&n.push(e),n})(e,a),S=[];R.forEach((t,n)=>{if(0>t){const t=document.createElement("span");t.className="st-page-ellipsis",t.textContent="...",y.appendChild(t)}else{const o=document.createElement("button"),r=n>0&&0>R[n-1];o.className=["st-page-btn",e===t?"active":""].filter(Boolean).join(" "),o.textContent=""+t,o.setAttribute("aria-label","Go to page "+t),e===t&&o.setAttribute("aria-current","page"),o.addEventListener("click",()=>(async t=>{1>t||t>a||(i(t),s&&await s(t))})(t)),y.appendChild(o),S.push({button:o,page:t,afterEllipsis:r})}}),S.forEach((t,n)=>{const{button:i,page:o,afterEllipsis:s}=t,r=n+1,l=e===o,a=i.previousElementSibling,d=i.nextElementSibling,c=null!==a&&a.classList.contains("st-page-btn")&&a.classList.contains("active")||null!==d&&d.classList.contains("st-page-btn")&&d.classList.contains("active");r>9&&!(l||s||c)&&i.classList.add("st-page-btn--compact-hidden")});const C=document.createElement("button");C.className="st-next-prev-btn "+(m?"disabled":""),C.disabled=m,C.setAttribute("aria-label","Go to previous page"),zi(C,c||Qe("st-next-prev-icon")),C.addEventListener("click",async()=>{const t=e-1;1>t||(i(t),s&&await s(t))}),y.appendChild(C);const M=document.createElement("button");M.className="st-next-prev-btn "+(g?"disabled":""),M.disabled=g,M.setAttribute("aria-label","Go to next page"),zi(M,h||Ze("st-next-prev-icon")),M.addEventListener("click",async()=>{const t=e+1;if(o&&e===a&&!await o(e))return u=!1,void v();t>a&&!o||(i(t),s&&await s(t))}),y.appendChild(M),f.appendChild(y)};return v(),{element:f,update:t=>{void 0!==t.currentPage&&(e=t.currentPage),void 0!==t.hideFooter&&(n=t.hideFooter),void 0!==t.onPageChange&&(i=t.onPageChange),void 0!==t.onNextPage&&(o=t.onNextPage),void 0!==t.onUserPageChange&&(s=t.onUserPageChange),void 0!==t.rowsPerPage&&(r=t.rowsPerPage),void 0!==t.enablePagination&&(l=t.enablePagination),void 0!==t.totalPages&&(a=t.totalPages),void 0!==t.totalRows&&(d=t.totalRows),void 0!==t.prevIcon&&(c=t.prevIcon),void 0!==t.nextIcon&&(h=t.nextIcon),n||!l?f.style.display="none":(f.style.display="flex",v())},destroy:()=>{f.remove()}}})({currentPage:n,hideFooter:null!==(v=o.config.hideFooter)&&void 0!==v&&v,onPageChange:i,onNextPage:o.config.onNextPage,onUserPageChange:o.config.onPageChange,rowsPerPage:x,enablePagination:null!==(p=o.config.enablePagination)&&void 0!==p&&p,totalPages:y,totalRows:e,prevIcon:null===(w=o.resolvedIcons)||void 0===w?void 0:w.prev,nextIcon:null===(m=o.resolvedIcons)||void 0===m?void 0:m.next});this.footerInstance=s,t.appendChild(s.element)}}renderColumnEditor(t,e,n,i,o){if(!t)return;if(!o.config.enableColumnEditor)return void(this.columnEditorInstance&&(this.columnEditorInstance.destroy(),this.columnEditorInstance=null));const s=()=>{const t=o.getPristineDefaultHeaders();t&&(o.setHeaders(En(t)),o.onRender())};if(this.columnEditorInstance)this.columnEditorInstance.update({columnEditorText:i.text,enableColumnEditor:o.config.enableColumnEditor,headers:o.headers,open:e,searchEnabled:i.searchEnabled,searchPlaceholder:i.searchPlaceholder,searchFunction:i.searchFunction,columnEditorConfig:i,icons:o.resolvedIcons,essentialAccessors:o.essentialAccessors,setHeaders:t=>{o.setHeaders(t),this.columnEditorInstance&&this.columnEditorInstance.update({headers:t}),o.onRender()},onColumnVisibilityChange:o.config.onColumnVisibilityChange,onColumnOrderChange:o.config.onColumnOrderChange,resetColumns:s,setOpen:n});else{const r=(t=>{let{columnEditorText:e,enableColumnEditor:n,headers:i,open:o,searchEnabled:s,searchPlaceholder:r,searchFunction:l,columnEditorConfig:a,icons:d,essentialAccessors:c,resetColumns:h,setHeaders:u,onColumnVisibilityChange:f,onColumnOrderChange:v,setOpen:p}=t;if(!n)return{element:document.createElement("div"),update:()=>{},destroy:()=>{}};const w=!1!==a.showToggle,m=document.createElement("div");m.className=`st-column-editor${w?"":" st-column-editor--no-toggle"}${o?" open":""}`,m.style.width=w?"29.5px":"0px";const g=()=>{p(!o)};let b=null;w&&(b=document.createElement("div"),b.className="st-column-editor-text",b.textContent=e,m.addEventListener("click",g),m.appendChild(b));const x=Qi({headers:i,open:o,searchEnabled:s,searchPlaceholder:r,searchFunction:l,columnEditorConfig:a,icons:d,essentialAccessors:c,resetColumns:h,setHeaders:u,onColumnVisibilityChange:f,onColumnOrderChange:v});m.appendChild(x.element);const y={update:t=>{void 0!==t.open&&(o=t.open,t.open?m.classList.add("open"):m.classList.remove("open")),void 0!==t.setOpen&&(p=t.setOpen),void 0!==t.columnEditorText&&b&&(b.textContent=t.columnEditorText),void 0!==t.essentialAccessors&&(c=t.essentialAccessors),void 0!==t.icons&&(d=t.icons),void 0!==t.resetColumns&&(h=t.resetColumns),x.update({headers:t.headers,open:t.open,searchEnabled:t.searchEnabled,searchPlaceholder:t.searchPlaceholder,searchFunction:t.searchFunction,columnEditorConfig:t.columnEditorConfig,icons:t.icons,essentialAccessors:t.essentialAccessors,resetColumns:t.resetColumns,setHeaders:t.setHeaders,onColumnVisibilityChange:t.onColumnVisibilityChange,onColumnOrderChange:t.onColumnOrderChange})},destroy:()=>{w&&m.removeEventListener("click",g),x.destroy(),m.remove()}};return m.__columnEditor=y,Object.assign({element:m},y)})({columnEditorText:i.text,enableColumnEditor:o.config.enableColumnEditor,headers:o.headers,open:e,searchEnabled:i.searchEnabled,searchPlaceholder:i.searchPlaceholder,searchFunction:i.searchFunction,columnEditorConfig:i,icons:o.resolvedIcons,essentialAccessors:o.essentialAccessors,setHeaders:t=>{o.setHeaders(t),this.columnEditorInstance&&this.columnEditorInstance.update({headers:t}),o.onRender()},onColumnVisibilityChange:o.config.onColumnVisibilityChange,onColumnOrderChange:o.config.onColumnOrderChange,resetColumns:s,setOpen:n});this.columnEditorInstance=r,t.appendChild(r.element)}}renderHorizontalScrollbar(t,e,n,i,o,s,r,l){var a,d,c,h,u;if(!t||!r)return;const f=null!==(a=l.mainBodyRef.current)&&void 0!==a?a:l.mainHeaderRef.current;if(!f)return;const v=null!==(c=null===(d=l.mainBodyRef.current)||void 0===d?void 0:d.clientWidth)&&void 0!==c?c:Math.max(0,r.clientWidth-n-i);if(1>=e-v&&1>=f.scrollWidth-f.clientWidth)return this.horizontalScrollbarRef.current&&(vi(this.horizontalScrollbarRef.current,l.sectionScrollController),this.horizontalScrollbarRef.current=null),void(null!==this.scrollbarTimeoutId&&(clearTimeout(this.scrollbarTimeoutId),this.scrollbarTimeoutId=null));this.horizontalScrollbarRef.current&&t.contains(this.horizontalScrollbarRef.current)?fi(this.horizontalScrollbarRef.current,{mainBodyRef:f,mainBodyWidth:e,pinnedLeftWidth:n,pinnedRightWidth:i,pinnedLeftContentWidth:o,pinnedRightContentWidth:s,tableBodyContainerRef:r,enableColumnEditor:V(l.config.enableColumnEditor,null===(h=l.config.columnEditorConfig)||void 0===h?void 0:h.showToggle),sectionScrollController:null!==(u=l.sectionScrollController)&&void 0!==u?u:void 0}):(null!==this.scrollbarTimeoutId&&(clearTimeout(this.scrollbarTimeoutId),this.scrollbarTimeoutId=null),this.scrollbarTimeoutId=window.setTimeout(()=>{var a,d,c,h,u;if(!r||!t)return;const f=null!==(a=l.mainBodyRef.current)&&void 0!==a?a:l.mainHeaderRef.current;if(!f)return;if(this.horizontalScrollbarRef.current&&t.contains(this.horizontalScrollbarRef.current))return fi(this.horizontalScrollbarRef.current,{mainBodyRef:f,mainBodyWidth:e,pinnedLeftWidth:n,pinnedRightWidth:i,pinnedLeftContentWidth:o,pinnedRightContentWidth:s,tableBodyContainerRef:r,enableColumnEditor:V(l.config.enableColumnEditor,null===(d=l.config.columnEditorConfig)||void 0===d?void 0:d.showToggle),sectionScrollController:null!==(c=l.sectionScrollController)&&void 0!==c?c:void 0}),void(this.scrollbarTimeoutId=null);this.sectionScrollController=null!==(h=l.sectionScrollController)&&void 0!==h?h:null;const v=(t=>{const{mainBodyRef:e,mainBodyWidth:n,pinnedLeftWidth:i,pinnedRightWidth:o,pinnedLeftContentWidth:s,pinnedRightContentWidth:r,tableBodyContainerRef:l,enableColumnEditor:a,sectionScrollController:d,forceScrollable:c=!1}=t;if(!c){const t=e.clientWidth;if(1>=Math.max(e.scrollWidth,n)-t)return null}const h=a?B:0,u=(a?o+1:o)+(l.scrollHeight>l.clientHeight?l.offsetWidth-l.clientWidth:0),f=document.createElement("div");if(f.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=s+"px",t.appendChild(e),f.appendChild(t),null==d||d.registerPane("pinned-left",t,"scrollbar")}if(n>0){const t=document.createElement("div");t.className="st-horizontal-scrollbar-middle";const e=document.createElement("div");e.style.width=n+"px",t.appendChild(e),f.appendChild(t),null==d||d.registerPane("main",t,"scrollbar")}if(o>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=r+"px",t.appendChild(e),f.appendChild(t),null==d||d.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",f.appendChild(t)}return f})({mainBodyRef:f,mainBodyWidth:e,pinnedLeftWidth:n,pinnedRightWidth:i,pinnedLeftContentWidth:o,pinnedRightContentWidth:s,tableBodyContainerRef:r,enableColumnEditor:V(l.config.enableColumnEditor,null===(u=l.config.columnEditorConfig)||void 0===u?void 0:u.showToggle),sectionScrollController:this.sectionScrollController,forceScrollable:!0});if(v){const e=t.querySelector(".st-content-wrapper");e&&e.nextSibling?t.insertBefore(v,e.nextSibling):t.appendChild(v),this.horizontalScrollbarRef.current=v}this.scrollbarTimeoutId=null},1))}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&&(vi(this.horizontalScrollbarRef.current,this.sectionScrollController),this.horizontalScrollbarRef.current=null),this.stickyParentsContainer&&(to(this.stickyParentsContainer,this.sectionScrollController),this.stickyParentsContainer=null),this.sectionScrollController=null}}function no(t){const{rows:e=[],rowGrouping:n=[],getRowId:i,expandedRows:o=new Map,collapsedRows:s=new Map,expandedDepths:r=new Set,rowStateMap:l=new Map,hasLoadingRenderer:a=!1,hasErrorRenderer:d=!1,hasEmptyRenderer:c=!1,headers:h=[],rowHeight:u=40,headerHeight:f=40,customTheme:v}=t;if(!n||0===n.length){const t=e.map((t,e)=>{const n=[e],o=[e],s=vt({row:t,getRowId:i,depth:0,index:e,rowPath:n,rowIndexPath:o,groupingKey:void 0}),r=gt({getRowId:i,row:t,depth:0,index:e,rowPath:n,rowIndexPath:o,groupingKey:void 0,parentStableKey:null});return Object.assign({row:t,depth:0,displayPosition:e,groupingKey:void 0,position:e,rowId:s,rowPath:n,rowIndexPath:o,absoluteRowIndex:e,isLastGroupRow:!1,stableRowKey:r},rt(t)?{isLoadingSkeleton:!0}:{})});return{flattenedRows:t,heightOffsets:[],paginatableRows:t,parentEndPositions:e.map((t,e)=>e+1)}}const p=[],w=[],m=[],g=[];let b=0;const x=(t,e,y=[],R=[],S=[],C=null)=>{t.forEach((t,M)=>{var I,H;const k=n[e],T=p.length,E=[...y,M],A=[...R,M],W=vt({row:t,getRowId:i,depth:e,index:M,rowPath:E,rowIndexPath:A,groupingKey:k}),O=gt({getRowId:i,row:t,depth:e,index:M,rowPath:E,rowIndexPath:A,groupingKey:k,parentStableKey:C}),P=p.length,$=Object.assign({row:t,depth:e,displayPosition:b,groupingKey:k,position:T,isLastGroupRow:!1,rowId:W,rowPath:E,rowIndexPath:A,absoluteRowIndex:T,parentIndices:S.length>0?[...S]:void 0,stableRowKey:O},rt(t)?{isLoadingSkeleton:!0}:{});p.push($),w.push($),b++;const F=bt({stableRowKey:O,rowId:W});if(Rt(F,e,r,o,s)&&n.length>e){const n=null==l?void 0:l.get(F),i=((t,e)=>{const n=t[e];return ft(n)?n:[]})(t,k),o=h.find(t=>t.expandable&&t.nestedTable);if((null==o?void 0:o.nestedTable)&&i.length>0){const n=p.length,s=(null===(I=o.nestedTable.customTheme)||void 0===I?void 0:I.rowHeight)||u,r=(null===(H=o.nestedTable.customTheme)||void 0===H?void 0:H.headerHeight)||f,l=(({childRowCount:t,rowHeight:e,headerHeight:n,customTheme:i})=>Math.min(n+i.rowSeparatorWidth+t*(e+i.rowSeparatorWidth)+i.nestedGridPaddingTop+i.nestedGridPaddingBottom+i.nestedGridBorderWidth,i.nestedGridMaxHeight+i.nestedGridPaddingTop+i.nestedGridPaddingBottom+i.nestedGridBorderWidth))({childRowCount:i.length,rowHeight:s,headerHeight:r,customTheme:v}),a=at({calculatedHeight:l,customHeight:o.nestedTable.height,customTheme:v});m.push([n,a-u]);const d=[...E,k];p.push({row:{},depth:e+1,displayPosition:b-1,groupingKey:k,position:n,isLastGroupRow:!1,rowId:d,rowPath:d,rowIndexPath:A,stableRowKey:xt(F,k),nestedTable:{parentRow:t,expandableHeader:o,childAccessor:k,calculatedHeight:a},absoluteRowIndex:n})}else if(n&&(n.loading||n.error||n.isEmpty)){if(n.loading&&a||n.error&&d||n.isEmpty&&c){const i=p.length,o=[...E,k];p.push({row:{},depth:e+1,displayPosition:b-1,groupingKey:k,position:i,isLastGroupRow:!1,rowId:o,rowPath:o,rowIndexPath:A,stableRowKey:xt(F,k),stateIndicator:{parentRowId:F,parentRow:t,state:n},absoluteRowIndex:i,parentIndices:[...S,P]})}else if(n.loading&&!a){const t=p.length,n=[...E,k,"loading-skeleton"];p.push({row:{},depth:e+1,displayPosition:b-1,groupingKey:k,position:t,isLastGroupRow:!1,rowId:n,rowPath:n,rowIndexPath:A,isLoadingSkeleton:!0,absoluteRowIndex:t,parentIndices:[...S,P]})}}else if(i.length>0){const t=[...E,k],n=[...A];x(i,e+1,t,n,[...S,P],O)}}0===e&&g.push(p.length)})};return x(e,0,[],[],[]),g.forEach((t,e)=>{const n=t-1;n>=0&&p.length>n&&(p[n].isLastGroupRow=!0)}),{flattenedRows:p,heightOffsets:m,paginatableRows:w,parentEndPositions:g}}class io{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 eo}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}getCurrentBodyLayouts(){return this.tableRenderer.getCurrentBodyLayouts()}setOnRendererHostDiscard(t){this.tableRenderer.setOnRendererHostDiscard(t)}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)}invalidateCustomFooterCache(){this.tableRenderer.invalidateCustomFooterCache()}computeEffectiveHeaders(t,e,n,i){var o;let s=[...t];return Ne(e)&&!(null===(o=null==t?void 0:t[0])||void 0===o?void 0:o.isSelectionColumn)&&(s=[{accessor:"__row_selection__",label:"",width:n.selectionColumnWidth,editable:!1,type:"boolean",pinned:"left",isSelectionColumn:!0,sortable:!1,filterable:!1,align:"center"},...s]),null!=i&&i>0?Ht(s,{containerWidth:i}):Ht(s)}primeLastProcessedResult(t,e){var n;const i=this.buildRowModelSnapshot(t,e);i&&(this.lastProcessedResult=i.processedResult,null===(n=t.rowSelectionManager)||void 0===n||n.updateConfig({tableRows:i.processedResult.currentTableRows}))}buildRowModelSnapshot(t,e){var n,i,o,s,r,l,a,d,c,h,u,f,v,p,w,m,g,b,x;if(this.lastHeadersRef!==t.headers&&(this.invalidateCache("header"),this.invalidateCache("context"),this.lastHeadersRef=t.headers),!t.dimensionManager)return null;const y=t.dimensionManager.getState(),{containerWidth:R,calculatedHeaderHeight:S,maxHeaderDepth:C}=y,M=0===t.collapsedHeaders.size?"":[...t.collapsedHeaders].map(String).sort().join("\0");let I;t.positionOnlyBody&&!0!==t.config.autoExpandColumns&&this.scrollRafHeadersMemo&&this.scrollRafHeadersMemo.headersRef===t.headers&&this.scrollRafHeadersMemo.containerWidth===R&&this.scrollRafHeadersMemo.collapsedKey===M?I=this.scrollRafHeadersMemo.effectiveHeaders:(I=this.computeEffectiveHeaders(t.headers,t.config,t.customTheme,R),this.scrollRafHeadersMemo=!0!==t.config.autoExpandColumns?{headersRef:t.headers,containerWidth:R,collapsedKey:M,effectiveHeaders:I}:null);const{leftWidth:H,rightWidth:k}=wi({headers:I,containerWidth:R,collapsedHeaders:t.collapsedHeaders});t.config.autoExpandColumns&&R>0&&(I=Bt(I,{autoExpandColumns:!0,containerWidth:R,pinnedLeftWidth:H,pinnedRightWidth:k,mainBodyRef:null!==(n=t.mainBodyRef)&&void 0!==n?n:{current:null},isResizing:null!==(i=t.isResizing)&&void 0!==i&&i,collapsedHeaders:t.collapsedHeaders}));let T=t.localRows;t.sortManager?T=t.sortManager.getSortedRows():t.filterManager&&(T=t.filterManager.getFilteredRows()),this.lastRowsRef!==T&&(this.invalidateCache("body"),this.invalidateCache("context"),this.lastRowsRef=T);const E=t.internalIsLoading,A=null===(o=t.sortManager)||void 0===o?void 0:o.getState(),W=null===(s=t.filterManager)||void 0===s?void 0:s.getState(),O=(null==A?void 0:A.sort)?`${A.sort.key.accessor}-${A.sort.direction}`:"none",P=JSON.stringify((null==W?void 0:W.filters)||{}),$=t.config.quickFilter,F=$?`${null!==(r=$.text)&&void 0!==r?r:""}|${null!==(l=$.mode)&&void 0!==l?l:"simple"}`:"",L=this.flattenedRowsCache&&this.flattenedRowsCache.deps.rowsRef===T&&this.flattenedRowsCache.deps.isLoading===E&&this.flattenedRowsCache.deps.quickFilterKey===F&&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===O&&this.flattenedRowsCache.deps.filterKey===P;let D,j,B;if(L&&this.flattenedRowsCache)D=this.flattenedRowsCache.aggregatedRows,j=this.flattenedRowsCache.quickFilteredRows,B=this.flattenedRowsCache.flattenResult;else{D=t.sortManager?T:Xt({rows:T,headers:t.headers,rowGrouping:t.config.rowGrouping}),j=(({rows:t,headers:e,quickFilter:n})=>{if(!n||!n.text||""===n.text.trim())return t;const{text:i,columns:o,caseSensitive:s=!1,mode:r="simple",useFormattedValue:l=!0}=n,a=e.filter(t=>!Z(t)&&(o&&o.length>0?o.includes(t.accessor):!1!==t.quickFilterable)),d="smart"===r?(t=>{const e=[];let n=0;for(;t.length>n;){for(;t.length>n&&/\s/.test(t[n]);)n++;if(n>=t.length)break;if("-"===t[n]){n++;const i=n;for(;t.length>n&&!/\s/.test(t[n]);)n++;const o=t.substring(i,n);o&&e.push({type:"negation",value:o});continue}if('"'===t[n]){n++;const i=n;for(;t.length>n&&'"'!==t[n];)n++;const o=t.substring(i,n);o&&e.push({type:"phrase",value:o}),t.length>n&&'"'===t[n]&&n++;continue}const i=n;for(;t.length>n&&!/[\s:]/.test(t[n]);)n++;const o=t.substring(i,n);if(t.length>n&&":"===t[n]){n++;const i=n;for(;t.length>n&&!/\s/.test(t[n]);)n++;const s=t.substring(i,n);s&&e.push({type:"columnSpecific",value:s,column:o});continue}o&&e.push({type:"word",value:o})}return e})(i):null;return t.filter(t=>{if("smart"===r&&d){const e=new Set,n=new Map;d.forEach((t,e)=>{"columnSpecific"===t.type&&t.column&&(n.has(t.column)||n.set(t.column,[]),n.get(t.column).push(e))});const i=[];a.forEach(o=>{try{let r;if(o.quickFilterGetter)r=o.quickFilterGetter({row:t,accessor:o.accessor});else{const e=ct(t,o.accessor);if(l&&o.valueFormatter){const n=o.valueFormatter({accessor:o.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+""}i.push(r);const a=n.get(o.accessor);a&&a.forEach(t=>{const n=d[t],i=s?r:r.toLowerCase(),o=s?n.value:n.value.toLowerCase();i.includes(o)&&e.add(t)})}catch(t){console.warn(`Quick filter error for column ${o.accessor}:`,t)}});const o=s?i.join(" "):i.join(" ").toLowerCase();return d.forEach((t,n)=>{if("columnSpecific"===t.type)return;const i=s?t.value:t.value.toLowerCase();switch(t.type){case"word":case"phrase":o.includes(i)&&e.add(n);break;case"negation":o.includes(i)||e.add(n)}}),e.size===d.length}return a.some(e=>{try{let n;if(e.quickFilterGetter)n=e.quickFilterGetter({row:t,accessor:e.accessor});else{const i=ct(t,e.accessor);if(l&&e.valueFormatter){const o=e.valueFormatter({accessor:e.accessor,colIndex:0,row:t,rowIndex:0,value:i});n=Array.isArray(o)?o.join(" "):o+""}else n=null==i?"":Array.isArray(i)?i.join(" "):i+""}return((t,e,n)=>{if(!e)return!0;const i=n?t:t.toLowerCase(),o=n?e:e.toLowerCase();return i.includes(o)})(n,i,s)}catch(t){return console.warn(`Quick filter error for column ${e.accessor}:`,t),!1}})})})({rows:D,headers:I,quickFilter:t.config.quickFilter});let n=j,i=!1;if(E){let o=t.config.enablePagination&&null!==(a=t.config.rowsPerPage)&&void 0!==a?a:10;e.isMainSectionScrollable&&(o+=1);const s=Array.from({length:o},()=>(()=>{const t={};return st.add(t),t})());n=0===n.length?s:[...n,...s],i=!0}B=no({rows:n,rowGrouping:t.config.rowGrouping,getRowId:i?lt(t.config.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:I,rowHeight:t.customTheme.rowHeight,headerHeight:t.customTheme.headerHeight,customTheme:t.customTheme}),this.flattenedRowsCache={aggregatedRows:D,quickFilteredRows:j,flattenResult:B,deps:{rowsRef:T,isLoading:E,quickFilterKey:F,expandedRowsSize:t.expandedRows.size,collapsedRowsSize:t.collapsedRows.size,expandedDepthsSize:t.expandedDepths.size,rowStateMapSize:t.rowStateMap.size,sortKey:O,filterKey:P}}}const z=!1===t.config.enableVirtualization?void 0:(({height:t,maxHeight:e,rowHeight:n,totalRowCount:i,headerHeight:o,footerHeight:s,externalViewportHeight:r})=>{if(e){const t=qt(e);if(0===t)return;const r=o||n;if(t>=r+i*n+(s||0))return;return Math.max(0,t-r)}if(void 0!==r&&r>0)return Math.max(0,r-(o||n));if(!t)return;const l=qt(t);return 0!==l?Math.max(0,l-n):void 0})({height:t.config.height,maxHeight:t.config.maxHeight,rowHeight:t.customTheme.rowHeight,enablePagination:null!==(d=t.config.enablePagination)&&void 0!==d&&d,rowsPerPage:null!==(c=t.config.rowsPerPage)&&void 0!==c?c:10,totalRowCount:null!==(h=t.config.totalRowCount)&&void 0!==h?h:B.paginatableRows.length,headerHeight:S,footerHeight:!t.config.enablePagination&&!t.config.footerRenderer||t.config.hideFooter?void 0:t.customTheme.footerHeight,externalViewportHeight:t.externalViewportHeight}),V=null!==(u=t.config.enablePagination)&&void 0!==u&&u,q=null!==(f=t.config.rowsPerPage)&&void 0!==f?f:10,G=null!==(v=t.config.serverSidePagination)&&void 0!==v&&v,K=null!==(p=t.config.totalRowCount)&&void 0!==p?p:B.paginatableRows.length,_=null!==(m=null===(w=t.config.rowGrouping)||void 0===w?void 0:w.join("\0"))&&void 0!==m?m:"",U=null!==(b=null===(g=B.heightOffsets)||void 0===g?void 0:g.length)&&void 0!==b?b:0;let J=0;if(B.heightOffsets)for(const[,t]of B.heightOffsets)J+=t;const Y=null!==(x=t.config.enableStickyParents)&&void 0!==x&&x,X=void 0===z?"":`${L?1:0}|${z}|${e.currentPage}|${q}|${V}|${G}|${t.customTheme.rowHeight}|${S}|${K}|${Y}|${_}|${B.flattenedRows.length}|${U}|${J}`;let Q;return t.positionOnlyBody&&void 0!==z&&null!==this.processRowsScrollReuseKey&&null!==this.processRowsScrollReuseBase&&this.processRowsScrollReuseKey===X&&this.processRowsScrollReuseBase?Q=function(t,e){const{contentHeight:n,rowHeight:i,scrollDirection:o="none",scrollTop:s,enableStickyParents:r,rowGrouping:l}=e,a=N(i),{currentTableRows:d,paginatedHeightOffsets:c,heightMap:h}=t;let u,f,v,p,w=0,m=d.length;if(void 0===n)u=d,f=[],v=u,p=[];else{const t=Ie({bufferRowCount:a,contentHeight:n,tableRows:d,rowHeight:i,scrollTop:s,scrollDirection:o,heightMap:h});if(u=t.rendered.rows,w=t.rendered.startIndex,m=t.rendered.endIndex,r)if(l){const e=We(d,t.rendered.rows,t.fullyVisible.rows,t.partiallyVisible.rows,l);f=e.stickyParents,v=e.regularRows,p=t.partiallyVisible.rows}else f=[],v=t.rendered.rows,p=[];else f=[],v=u,p=[]}return{currentTableRows:d,rowsToRender:u,renderedStartIndex:w,renderedEndIndex:m,stickyParents:f,regularRows:v,partiallyVisibleRows:p,paginatedHeightOffsets:c,heightMap:h,allFlattenedRows:t.allFlattenedRows,pageStartIndex:t.pageStartIndex}}(this.processRowsScrollReuseBase,{contentHeight:z,rowHeight:t.customTheme.rowHeight,scrollTop:e.scrollTop,scrollDirection:e.scrollDirection,enableStickyParents:Y,rowGrouping:t.config.rowGrouping}):(Q=function(t){var e;const{contentHeight:n,currentPage:i,customTheme:o,enableStickyParents:s,flattenedRows:r,heightOffsets:l,parentEndPositions:a,rowHeight:d,rowsPerPage:c,scrollDirection:h="none",scrollTop:u,serverSidePagination:f,enablePagination:v,rowGrouping:p}=t,w=N(d),m=function(t,e,n,i,o,s){if(!o||s)return t.map((t,e)=>Object.assign(Object.assign({},t),{position:e,absoluteRowIndex:e}));const r=(n-1)*i,l=n*i,a=0===r?0:e[r-1];return t.slice(a,l>e.length?t.length:e[l-1]).map((t,e)=>{const n=t.nestedTable?t.absoluteRowIndex:o&&!s?a+e:e;return Object.assign(Object.assign({},t),{position:e,absoluteRowIndex:n})})}(r,a,i,c,v,f);let g=0;if(v&&!f){const t=(i-1)*c;g=0===t?0:null!==(e=a[t-1])&&void 0!==e?e:0}const b=l&&0!==l.length&&v&&!f?(()=>{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,x=b&&b.length>0?((t,e,n,i)=>{const o=e+i.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+=o;const t=r.get(e);void 0!==t&&(l+=t)}return{rowTopPositions:s,totalHeight:l-i.rowSeparatorWidth}})(m.length,d,b,o):void 0;let y,R,S,C,M=0,I=m.length;if(void 0===n)y=m,R=[],S=y,C=[];else{const t=Ie({bufferRowCount:w,contentHeight:n,tableRows:m,rowHeight:d,scrollTop:u,scrollDirection:h,heightMap:x});if(y=t.rendered.rows,M=t.rendered.startIndex,I=t.rendered.endIndex,s)if(p){const e=We(m,t.rendered.rows,t.fullyVisible.rows,t.partiallyVisible.rows,p);R=e.stickyParents,S=e.regularRows,C=t.partiallyVisible.rows}else R=[],S=t.rendered.rows,C=[];else R=[],S=y,C=[]}return{currentTableRows:m,rowsToRender:y,renderedStartIndex:M,renderedEndIndex:I,stickyParents:R,regularRows:S,partiallyVisibleRows:C,paginatedHeightOffsets:b,heightMap:x,allFlattenedRows:r,pageStartIndex:g}}({flattenedRows:B.flattenedRows,paginatableRows:B.paginatableRows,parentEndPositions:B.parentEndPositions,currentPage:e.currentPage,rowsPerPage:q,enablePagination:V,serverSidePagination:G,contentHeight:z,rowHeight:t.customTheme.rowHeight,scrollTop:e.scrollTop,scrollDirection:e.scrollDirection,heightOffsets:B.heightOffsets,customTheme:t.customTheme,enableStickyParents:Y,rowGrouping:t.config.rowGrouping}),void 0!==z?(this.processRowsScrollReuseKey=X,this.processRowsScrollReuseBase={currentTableRows:Q.currentTableRows,paginatedHeightOffsets:Q.paginatedHeightOffsets,heightMap:Q.heightMap,allFlattenedRows:Q.allFlattenedRows,pageStartIndex:Q.pageStartIndex}):(this.processRowsScrollReuseKey=null,this.processRowsScrollReuseBase=null)),{dimensionState:y,containerWidth:R,effectiveHeaders:I,calculatedHeaderHeight:S,maxHeaderDepth:C,flattenResult:B,processedResult:Q}}render(t,e,n,i,o){var s,r,l,a,d,c,h,u,f;const v=null!==(c=null!==(l=null===(r=null===(s=n.mainBodyRef)||void 0===s?void 0:s.current)||void 0===r?void 0:r.scrollLeft)&&void 0!==l?l:null===(d=null===(a=n.mainHeaderRef)||void 0===a?void 0:a.current)||void 0===d?void 0:d.scrollLeft)&&void 0!==c?c:0,p=this.buildRowModelSnapshot(n,i);if(!p)return;const{dimensionState:w,containerWidth:m,effectiveHeaders:g,calculatedHeaderHeight:b,maxHeaderDepth:x,flattenResult:y,processedResult:R}=p;this.lastProcessedResult=R;const S=!0===n.positionOnlyBody;if(S&&null!==this.lastScrollRafPaintedRange&&R.renderedStartIndex===this.lastScrollRafPaintedRange.start&&R.renderedEndIndex===this.lastScrollRafPaintedRange.end)return;null===(h=n.rowSelectionManager)||void 0===h||h.updateConfig({tableRows:R.currentTableRows});const{mainWidth:C,leftWidth:M,rightWidth:I,leftContentWidth:H,rightContentWidth:k}=wi({headers:g,containerWidth:m,collapsedHeaders:n.collapsedHeaders}),T=m-M-I;if(!S){const e=t=>"number"==typeof t?t+"px":t,s=t.rootElement.style;if(n.config.maxHeight){const t=e(n.config.maxHeight);s.maxHeight=t,s.height=void 0===w.contentHeight?"auto":t}else s.removeProperty("max-height"),n.config.height?s.height=e(n.config.height):s.removeProperty("height");t.rootElement.classList.toggle("st-external-scroll",void 0!==n.externalViewportHeight);const{customTheme:r}=n;s.setProperty("--st-main-section-width",T+"px"),s.setProperty("--st-scrollbar-width",i.scrollbarWidth+"px");const l=z(n.config.enableColumnEditor,o.showToggle);s.setProperty("--st-editor-width",l+"px"),s.setProperty("--st-border-width",r.borderWidth+"px"),s.setProperty("--st-footer-height",r.footerHeight+"px"),s.setProperty("--st-calculated-header-height",b+"px");const a=null!==(u=n.config.columnResizing)&&void 0!==u&&u;t.content.className="st-content "+(a?"st-resizeable":"st-not-resizeable"),t.content.style.width=l>0?`calc(100% - ${l}px)`:"100%",this.renderHeader(t.headerContainer,b,x,g,n)}this.renderBody(t.bodyContainer,R,g,n,i),this.lastScrollRafPaintedRange=S?{start:R.renderedStartIndex,end:R.renderedEndIndex}:null,this.registerSectionPanes(n);const E=n.sectionScrollController;E&&(E.setSectionScrollLeft("main",v),null!=n.pinnedLeftRef.current&&E.setSectionScrollLeft("pinned-left",n.pinnedLeftRef.current.scrollLeft),null!=n.pinnedRightRef.current&&E.setSectionScrollLeft("pinned-right",n.pinnedRightRef.current.scrollLeft),E.restoreAll()),S||(this.renderFooter(t.footerContainer,null!==(f=n.config.totalRowCount)&&void 0!==f?f:y.paginatableRows.length,i.currentPage,g,n),this.renderColumnEditor(t.contentWrapper,i.columnEditorOpen,o,g,n),this.renderHorizontalScrollbar(t.wrapperContainer,C,M,I,H,k,e.tableBodyContainerRef.current,g,n))}renderHeader(t,e,n,i,o){if(o.config.hideHeader)return;const s=this.buildRendererDeps(i,o);this.tableRenderer.renderHeader(t,e,n,s)}renderBody(t,e,n,i,o){const s=this.buildRendererDeps(n,i,o);this.tableRenderer.renderBody(t,e,s)}renderFooter(t,e,n,i,o){const s=this.buildRendererDeps(i,o);this.tableRenderer.renderFooter(t,e,n,t=>{o.setCurrentPage(t),o.onRender()},s)}renderColumnEditor(t,e,n,i,o){const s=this.buildRendererDeps(i,o);this.tableRenderer.renderColumnEditor(t,e,t=>{o.setColumnEditorOpen(t),o.onRender()},n,s)}renderHorizontalScrollbar(t,e,n,i,o,s,r,l,a){if(!a.mainBodyRef.current&&!a.mainHeaderRef.current||!r)return;const d=this.buildRendererDeps(l,a);this.tableRenderer.renderHorizontalScrollbar(t,e,n,i,o,s,r,d)}registerSectionPanes(t){const e=t.sectionScrollController;e&&(t.pinnedLeftHeaderRef.current&&e.registerPane("pinned-left",t.pinnedLeftHeaderRef.current,"header"),t.pinnedLeftRef.current&&e.registerPane("pinned-left",t.pinnedLeftRef.current,"body"),t.mainHeaderRef.current&&e.registerPane("main",t.mainHeaderRef.current,"header"),t.mainBodyRef.current&&e.registerPane("main",t.mainBodyRef.current,"body"),t.pinnedRightHeaderRef.current&&e.registerPane("pinned-right",t.pinnedRightHeaderRef.current,"header"),t.pinnedRightRef.current&&e.registerPane("pinned-right",t.pinnedRightRef.current,"body"))}buildRendererDeps(t,e,n){return{accordionAxis:e.accordionAxis,externalScrollActive:void 0!==e.externalViewportHeight,stickyParentsScrollTop:null==n?void 0:n.scrollTop,animationCoordinator:e.animationCoordinator,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,hoverScopeId:e.hoverScopeId,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,createNestedTable:e.createNestedTable,onRender:e.onRender,getShrinkFloors:e.getShrinkFloors,onAutoExpandNaturalWidths:e.onAutoExpandNaturalWidths,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,getPristineDefaultHeaders:e.getPristineDefaultHeaders,getRowStateMap:e.getRowStateMap,positionOnlyBody:e.positionOnlyBody,essentialAccessors:e.essentialAccessors}}cleanup(){this.tableRenderer.cleanup()}}const oo=t=>{if(null==t)return"";const e=t+"";return e.includes(",")||e.includes('"')||e.includes("\n")||e.includes("\r")?`"${e.replace(/"/g,'""')}"`:e};class so{static createAPI(t){const e=()=>{var e;return(null===(e=t.getCachedFlattenResult)||void 0===e?void 0:e.call(t))||no({rows:t.getPivotedRows(),rowGrouping:t.getEffectiveRowGrouping(),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,i=new Set;let o=!1,s=!1,r=null;const l=()=>{var e,s;if(o=!1,0===n.size)return void(i.size>0&&!(null===(e=t.hasAnimatingCells)||void 0===e?void 0:e.call(t))?a():i.size>0&&c());let r=!1;n.forEach((e,i)=>{var o,s;if(null===(o=t.isCellAnimating)||void 0===o?void 0:o.call(t,i))return void(r=!0);const l=null===(s=t.cellRegistry)||void 0===s?void 0:s.get(i);l&&l.updateContent(e),n.delete(i)}),r&&n.size>0&&c(),(null===(s=t.hasAnimatingCells)||void 0===s?void 0:s.call(t))?c():a()},a=()=>{null==r&&(r=setTimeout(()=>{r=null,(()=>{var e,n,o,s,r,l;if(null===(e=t.hasAnimatingCells)||void 0===e?void 0:e.call(t))return void c();const a=i;if(0===a.size)return;const d=null===(n=t.filterManager)||void 0===n?void 0:n.getFilters(),h=(d?Object.keys(d):[]).some(t=>a.has(t)),u=null===(o=t.sortManager)||void 0===o?void 0:o.getSortColumn(),f=!(!u||!a.has(u.key.accessor+"")),v=(null!==(l=null===(r=null===(s=t.config.quickFilter)||void 0===s?void 0:s.text)||void 0===r?void 0:r.trim())&&void 0!==l?l:"").length>0;if(!h&&!f&&!v)return void a.clear();a.clear();const p=()=>{var e,n,i;if(h&&t.filterManager&&t.filterManager.updateConfig({rows:t.localRows}),f&&t.sortManager){const i=null!==(n=null===(e=t.filterManager)||void 0===e?void 0:e.getFilteredRows())&&void 0!==n?n:t.localRows;t.sortManager.updateConfig({tableRows:i})}v&&(null===(i=t.invalidateRowsCache)||void 0===i||i.call(t),t.onRender())};t.runWithoutAnimationSnapshot?t.runWithoutAnimationSnapshot(p):p()})()},400))},d=()=>{o||(o=!0,queueMicrotask(l))},c=()=>{s||(s=!0,setTimeout(()=>{s=!1,(n.size>0||i.size>0)&&d()},120))};let h=null,u=null;return{updateData:e=>{var o;const{accessor:s,newValue:r}=e,l=(e=>null!=e.rowId&&""!==e.rowId?(()=>{const e=t.localRows,n=t.config.getRowId;if(u&&u.rowsRef===e&&u.getRowId===n)return u.map;const i=new Map;for(let t=0;e.length>t;t++){const o=e[t];if(!n)continue;const s=n({row:o,depth:0,index:t,rowPath:[t],rowIndexPath:[t]});null!=s&&""!==s&&i.set(s+"",t)}return u={rowsRef:e,getRowId:n,map:i},i})().get(e.rowId+""):"number"==typeof e.rowIndex?e.rowIndex:void 0)(e);if(void 0===l||0>l||l>=t.localRows.length)return;const a=t.localRows[l];ut(a,s,r);const c=(e=>{var n;const i=null===(n=t.getCachedProcessedResult)||void 0===n?void 0:n.call(t),o=null==i?void 0:i.rowsToRender;if(o&&0!==o.length){if(!h||h.rowsRef!==o){const t=new WeakMap;for(const e of o)e.row&&t.set(e.row,e);h={rowsRef:o,map:t}}return h.map.get(e)}})(a),f=c?null!==(o=c.stableRowKey)&&void 0!==o?o:pt(c.rowId):gt({getRowId:t.config.getRowId,row:a,depth:0,index:l,rowPath:[l],rowIndexPath:[l]}),v=ot({accessor:s,rowId:f});n.set(v,r),i.add(s+""),d()},setHeaderRename:e=>{const n=t.headerRegistry.get(e.accessor);n&&n.setEditing(!0)},getVisibleRows:()=>{var n;const i=null===(n=t.getCachedProcessedResult)||void 0===n?void 0:n.call(t);return i?i.rowsToRender:e().flattenedRows},getAllRows:()=>e().flattenedRows,getHeaders:()=>t.effectiveHeaders,exportToCSV:n=>{var i;((t,e,n,i=!0)=>{((t,e="table-export.csv")=>{const n=new Blob([t],{type:"text/csv;charset=utf-8;"}),i=document.createElement("a"),o=URL.createObjectURL(n);i.setAttribute("href",o),i.setAttribute("download",e),i.style.visibility="hidden",document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)})(((t,e,n=!0)=>{const i=(t=>{const e=[],n=t=>{for(const i of t)i.hide||i.isSelectionColumn||i.excludeFromCsv||(i.children&&i.children.length>0?(i.singleRowChildren&&e.push(i),n(i.children)):e.push(i))};return n(t),e})(e),o=i.map(t=>oo(t.label)).join(","),s=t.map((t,e)=>{const n=t.row;return i.map((t,i)=>{const o=ct(n,t.accessor);if(t.exportValueGetter){const s=t.valueFormatter?t.valueFormatter({accessor:t.accessor,colIndex:i,row:n,rowIndex:e,value:o}):void 0,r=t.exportValueGetter({accessor:t.accessor,colIndex:i,row:n,rowIndex:e,value:o,formattedValue:s});return oo(r)}if(!1!==t.useFormattedValueForCSV&&t.valueFormatter){const s=t.valueFormatter({accessor:t.accessor,colIndex:i,row:n,rowIndex:e,value:o});return oo(s)}return oo(o)}).join(",")});return(n?[o,...s]:s).join("\n")})(t,e,i),n)})(e().flattenedRows,t.effectiveHeaders,null==n?void 0:n.filename,null===(i=t.config.includeHeadersInCSVExport)||void 0===i||i)},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:()=>Nn(t.headers),applyPinnedState:async e=>{const n=zn(t.headers,e,t.essentialAccessors);n&&(t.setHeaders(n),t.onRender())},resetColumns:()=>{const e=t.getPivot()?En(t.getPivotHeaders()):En(t.getPristineDefaultHeaders());t.setHeaders(e),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,i;const o=null!==(n=t.config.totalRowCount)&&void 0!==n?n:e().paginatableRows.length;return Math.ceil(o/(null!==(i=t.config.rowsPerPage)&&void 0!==i?i:10))},setPage:async n=>{var i,o;const s=null!==(i=t.config.totalRowCount)&&void 0!==i?i:e().paginatableRows.length,r=null!==(o=t.config.rowsPerPage)&&void 0!==o?o:10;1>n||n>Math.ceil(s/r)||(t.setCurrentPage(n),t.onRender(),t.config.onPageChange&&await t.config.onPageChange(n))},expandAll:()=>{var e;t.clearExpandedRows(),t.clearCollapsedRows(),null===(e=t.expandedDepthsManager)||void 0===e||e.expandAll()},collapseAll:()=>{var e;t.clearExpandedRows(),t.clearCollapsedRows(),null===(e=t.expandedDepthsManager)||void 0===e||e.collapseAll()},expandDepth:e=>{var n;t.clearExpandedRows(),t.clearCollapsedRows(),null===(n=t.expandedDepthsManager)||void 0===n||n.expandDepth(e)},collapseDepth:e=>{var n;t.clearExpandedRows(),t.clearCollapsedRows(),null===(n=t.expandedDepthsManager)||void 0===n||n.collapseDepth(e)},toggleDepth:e=>{var n;t.clearExpandedRows(),t.clearCollapsedRows(),null===(n=t.expandedDepthsManager)||void 0===n||n.toggleDepth(e)},setExpandedDepths:e=>{var n,i;t.clearExpandedRows(),t.clearCollapsedRows();const o=t.expandedDepthsManager;if(o){const s=null!==(i=null===(n=t.getEffectiveRowGrouping())||void 0===n?void 0:n.length)&&void 0!==i?i:0,r=0===s?new Set:new Set([...e].filter(t=>Number.isInteger(t)&&t>=0&&s>t));return void o.setExpandedDepths(r)}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.getEffectiveRowGrouping())||void 0===n?void 0:n[e]},getGroupingDepth:e=>{var n,i;return null!==(i=null===(n=t.getEffectiveRowGrouping())||void 0===n?void 0:n.indexOf(e))&&void 0!==i?i:-1},setPivot:e=>{t.setPivot(e)},getPivot:()=>t.getPivot(),getPivotHeaders:()=>t.getPivotHeaders(),getPivotedRows:()=>t.getPivotedRows(),toggleColumnEditor:e=>{t.config.enableColumnEditor&&(t.setColumnEditorOpen(void 0!==e?e:!t.columnEditorOpen),t.onRender())},applyColumnVisibility:async e=>{const n=i=>i.map(i=>{const o=i.accessor+"";let s=o in e?!e[o]:i.hide;return Fn(i,t.essentialAccessors)&&(s=!1),Object.assign(Object.assign({},i),{hide:s,children:i.children?n(i.children):i.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 i;null===(i=t.selectionManager)||void 0===i||i.selectCellRange(e,n)},getSelectedRows:()=>{var e,n;return null!==(n=null===(e=t.rowSelectionManager)||void 0===e?void 0:e.getSelectedRows())&&void 0!==n?n:new Set},getSelectedRowsData:()=>{var e,n;return null!==(n=null===(e=t.rowSelectionManager)||void 0===e?void 0:e.getSelectedRowsData())&&void 0!==n?n:[]},getRow:e=>{var n,i;const o=e+"",s=null===(n=t.rowSelectionManager)||void 0===n?void 0:n.getRow(o);if(void 0!==s)return s;const r=null===(i=t.getCachedProcessedResult)||void 0===i?void 0:i.call(t);if(r){const t=r.currentTableRows.find(t=>null!=(null==t?void 0:t.rowId)&&pt(t.rowId)===o);if(t)return t.row}},selectRow:e=>{var n;null===(n=t.rowSelectionManager)||void 0===n||n.selectRow(e+"")},deselectRow:e=>{var n;null===(n=t.rowSelectionManager)||void 0===n||n.deselectRow(e+"")},toggleRowSelection:e=>{var n;null===(n=t.rowSelectionManager)||void 0===n||n.handleToggleRow(e+"")},clearRowSelection:()=>{var e;null===(e=t.rowSelectionManager)||void 0===e||e.clearSelection()}}}}const ro=t=>{if(!t)return null;if("undefined"!=typeof Window&&t instanceof Window){const e=t.innerHeight;return{top:0,bottom:e,height:e,width:t.innerWidth}}const e=t.getBoundingClientRect();return{top:e.top,bottom:e.bottom,height:e.height,width:e.width}},lo=()=>"undefined"!=typeof window&&window.innerHeight>0?window.innerHeight:1/0,ao=(t,e)=>{if(!t||!e)return null;const n=ro(t);if(!n)return null;const i=e.getBoundingClientRect(),o=i.height;if(0>=o)return{relativeScrollTop:0,visibleViewportHeight:0,distanceFromTableBottom:1/0,tableTotalHeight:0,viewportWidth:n.width};const s=Math.max(n.top,i.top),r=Math.min(Math.max(0,Math.min(n.bottom,i.bottom)-s),lo());return{relativeScrollTop:Math.max(0,Math.min(n.top-i.top,Math.max(0,o-r))),visibleViewportHeight:r,distanceFromTableBottom:i.bottom-n.bottom,tableTotalHeight:o,viewportWidth:n.width}};class co{constructor(t,e){var n,i,s;this.draggedHeaderRef={current:null},this.hoveredHeaderRef={current:null},this.localRows=[],this.headers=[],this.pristineDefaultHeaders=[],this.essentialAccessors=new Set,this.autoSizeAccessors=new Set,this.pendingAutoSize=new Set,this.naturalWidths=new Map,this.isAutoSizing=!1,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.hoverScopeId="st-hover-"+ ++co.nextHoverScopeId,this.headerRegistry=new Map,this.rowIndexMap=new Map,this.suppressNextAnimationSnapshot=!1,this.cachedAPI=null,this.autoScaleManager=null,this.dimensionManager=null,this.scrollManager=null,this.sectionScrollController=null,this.sortManager=null,this.filterManager=null,this.pivotManager=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.hasWarnedUnvirtualizedRows=!1,this.unvirtualizedRowsCheckTimeoutId=null,this.resolvedScrollParent=null,this.externalScrollListener=null,this.externalWindowResizeListener=null,this.externalParentResizeObserver=null,this.externalViewportHeight=0,this.externalScrollRetryRaf=null,this.externalScrollRetryCount=0,this.bodyScrollListenerAttached=!1,this.bodyContainerMouseLeaveListener=null,this.bodyContainerScrollListener=null,this.overscrollBehaviorTarget=null,this.overscrollBehaviorPrev="",this.pendingAccordionAxis=null,this.accordionCleanupTimerId=null,this.lastRenderedVisibilityKey=null,this.container=t,this.config=o(e);const r=this.config;this.customTheme=qn.mergeCustomTheme(r),this.mergedColumnEditorConfig=qn.mergeColumnEditorConfig(r),this.resolvedIcons=qn.resolveIcons(r),this.localRows=[...r.rows],this.headers=[...r.columns],this.pristineDefaultHeaders=En(r.columns),this.columnEditorOpen=null!==(n=r.enableColumnEditorInitOpen)&&void 0!==n&&n,this.internalIsLoading=null!==(i=r.isLoading)&&void 0!==i&&i,this.pivotManager=new Se({sourceRows:this.localRows,fieldHeaders:this.pristineDefaultHeaders,pivot:null!==(s=r.pivot)&&void 0!==s?s:null});const l=this.pivotManager.getState();l.active&&(this.headers=l.headers),this.essentialAccessors=qn.buildEssentialAccessors(this.headers),this.collapsedHeaders=qn.getInitialCollapsedHeaders(this.headers),this.expandedDepths=qn.getInitialExpandedDepths(Object.assign(Object.assign({},r),{rowGrouping:this.getEffectiveRowGrouping()})),this.autoSizeAccessors=this.computeAutoSizeAccessors(),this.pendingAutoSize=new Set(this.autoSizeAccessors),this.domManager=new Gn,this.renderOrchestrator=new io,this.animationCoordinator=new O,this.applyAnimationsConfig(e.animations),this.animationCoordinator.setOnHostDiscard(e.onRendererHostDiscard),this.renderOrchestrator.setOnRendererHostDiscard(e.onRendererHostDiscard),this.rebuildRowIndexMap(),this.initializeManagers()}applyAnimationsConfig(t){var e;this.animationCoordinator.setEnabled(null===(e=null==t?void 0:t.enabled)||void 0===e||e),void 0!==(null==t?void 0:t.duration)&&this.animationCoordinator.setDuration(t.duration),void 0!==(null==t?void 0:t.easing)&&this.animationCoordinator.setEasing(t.easing)}rebuildRowIndexMap(){this.rowIndexMap.clear(),this.localRows.forEach((t,e)=>{const n=vt({row:t,getRowId:this.config.getRowId,depth:0,index:e,rowPath:[e],rowIndexPath:[e]}),i=pt(n);this.rowIndexMap.set(i,e)})}getBodyContainers(){const t=this.domManager.getRefs();return[t.mainBodyRef.current,t.pinnedLeftRef.current,t.pinnedRightRef.current].filter(t=>null!==t)}getHeaderContainers(){const t=this.domManager.getRefs();return[t.mainHeaderRef.current,t.pinnedLeftHeaderRef.current,t.pinnedRightHeaderRef.current].filter(t=>null!==t)}getAnimatableContainers(){return[...this.getBodyContainers(),...this.getHeaderContainers()]}buildVisibilityKey(t){const e=[],n=(t,i)=>{var o,s;if(Z(t))return;const r=null!==(s=null!==(o=t.pinned)&&void 0!==o?o:i)&&void 0!==s?s:"main";if(t.children&&t.children.length>0)for(const e of t.children)n(e,r);else e.push(`${t.accessor+""}:${r}`)};for(const e of t)n(e,void 0);return e.join("|")}didColumnVisibilityChange(t){const e=this.buildVisibilityKey(t);return null!==this.lastRenderedVisibilityKey&&e!==this.lastRenderedVisibilityKey}captureAnimationSnapshot(){const t=this.animationCoordinator.isEnabled()?this.renderOrchestrator.getCurrentBodyLayouts():void 0;this.updateAnimationVerticalScroll(),this.animationCoordinator.captureSnapshot({containers:this.getAnimatableContainers(),preLayouts:t})}updateAnimationVerticalScroll(){var t,e;if(!this.resolvedScrollParent)return void this.animationCoordinator.setExternalVerticalScroll(null);const n=null!==(e=null===(t=this.domManager.getElements())||void 0===t?void 0:t.rootElement)&&void 0!==e?e:this.container,i=ao(this.resolvedScrollParent,n);this.animationCoordinator.setExternalVerticalScroll(i&&i.visibleViewportHeight>0&&i.tableTotalHeight>0?{clientHeight:i.visibleViewportHeight,scrollHeight:i.tableTotalHeight,scrollTop:i.relativeScrollTop}:null)}collectAccordionRenderableAccessors(){const e=new Set,n=i=>{if(Z(i))return;if(e.add(i.accessor+""),!i.children||0===i.children.length)return;const o=this.collapsedHeaders.has(i.accessor);for(const e of i.children){const i=e.showWhen||t;(o?"parentCollapsed"===i||"always"===i:"parentExpanded"===i||"always"===i)&&n(e)}};for(const t of this.headers)n(t);return e}beginAccordionAnimation(t){var e,n,i,o;if(!this.animationCoordinator.isEnabled())return;if(null===t)return;if("vertical"===t&&(null!==(n=null===(e=this.getEffectiveRowGrouping())||void 0===e?void 0:e.length)&&void 0!==n?n:0)>0)return;this.captureAnimationSnapshot(),this.animationCoordinator.setAccordionPreVisibleAccessors("horizontal"===t?this.collectAccordionRenderableAccessors():null),this.pendingAccordionAxis=t;const s=this.animationCoordinator.getDuration(),r=this.animationCoordinator.getEasing(),l=null!==(o=null===(i=this.domManager.getElements())||void 0===i?void 0:i.rootElement)&&void 0!==o?o:this.container;l.style.setProperty(On,s+"ms"),l.style.setProperty(Pn,r),l.classList.add(Wn),null!==this.accordionCleanupTimerId&&window.clearTimeout(this.accordionCleanupTimerId),this.accordionCleanupTimerId=window.setTimeout(()=>{l.classList.remove(Wn),l.style.removeProperty(On),l.style.removeProperty(Pn),this.accordionCleanupTimerId=null},s+80)}initializeManagers(){var t,e,n,i;this.ariaAnnouncementManager=new Ue,this.ariaAnnouncementManager.subscribe(t=>{this.announcement=t,this.updateAriaLiveRegion()}),this.expandedDepthsManager=new _e(null===(t=this.config.expandAll)||void 0===t||t,this.getEffectiveRowGrouping()),this.expandedDepthsManager.subscribe(t=>{this.beginAccordionAnimation("vertical"),this.expandedDepths=t,this.render("expandedDepthsManager")});const o=t=>{this.ariaAnnouncementManager&&this.ariaAnnouncementManager.announce(t)},s=null===(e=this.pivotManager)||void 0===e?void 0:e.getState();this.sortManager=new Qt({headers:this.headers,tableRows:(null==s?void 0:s.active)?s.pivotedRows:this.localRows,externalSortHandling:this.config.externalSortHandling||!1,onSortChange:t=>{var e,n;return null===(n=(e=this.config).onSortChange)||void 0===n?void 0:n.call(e,t)},rowGrouping:(null==s?void 0:s.active)?s.rowGrouping:this.config.rowGrouping,initialSortColumn:this.config.initialSortColumn,initialSortDirection:this.config.initialSortDirection,announce:o}),this.sortManager.subscribe(()=>{this.suppressNextAnimationSnapshot?this.render("live-sort"):(this.captureAnimationSnapshot(),this.render("sortManager"))}),this.filterManager=new ne({rows:this.localRows,headers:this.pristineDefaultHeaders,externalFilterHandling:this.config.externalFilterHandling||!1,onFilterChange:t=>{var e,n;return null===(n=(e=this.config).onFilterChange)||void 0===n?void 0:n.call(e,t)},announce:o}),this.filterManager.subscribe(t=>{this.syncPivotPipeline(t.filteredRows),this.render("filterManager")}),this.selectionManager=new je({selectableCells:null!==(n=this.config.selectableCells)&&void 0!==n&&n,selectableColumns:null!==(i=this.config.selectableColumns)&&void 0!==i&&i,headers:this.headers,tableRows:[],onCellEdit:t=>{var e,n;return null===(n=(e=this.config).onCellEdit)||void 0===n?void 0:n.call(e,t)},cellRegistry:this.cellRegistry,collapsedHeaders:this.collapsedHeaders,rowHeight:this.customTheme.rowHeight,enableRowSelection:Ne(this.config),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,e,n;const i=this.domManager.getRefs(),o=this.domManager.getElements();if(!i.tableBodyContainerRef.current||!o)return;this.scrollbarWidth=Je(i.tableBodyContainerRef.current);const s=this.renderOrchestrator.computeEffectiveHeaders(this.headers,this.config,this.customTheme);this.dimensionManager=new Gt({effectiveHeaders:s,headerHeight:this.customTheme.headerHeight,rowHeight:this.customTheme.rowHeight,height:this.config.height,maxHeight:this.config.maxHeight,totalRowCount:null!==(t=this.config.totalRowCount)&&void 0!==t?t:this.localRows.length,footerHeight:!this.config.enablePagination&&!this.config.footerRenderer||this.config.hideFooter?void 0:this.customTheme.footerHeight,containerElement:i.tableBodyContainerRef.current}),this.dimensionManager.subscribe(()=>{this.render("dimensionManager"),this.firstRenderDone||(this.firstRenderDone=!0,this.resolvedScrollParent&&"undefined"!=typeof requestAnimationFrame&&requestAnimationFrame(()=>{this.mounted&&this.recomputeExternalViewportHeight()}),this.config.onTableReady&&this.config.onTableReady())}),this.scrollManager=new Kt({onLoadMore:this.config.onLoadMore,infiniteScrollThreshold:null!==(e=this.config.infiniteScrollThreshold)&&void 0!==e?e:200});const r=t=>{var e;const n=this.domManager.getRefs().mainHeaderRef.current,i=this.selectionManager,o=i&&(this.config.selectableCells||this.config.selectableColumns)?{columnsWithSelectedCells:i.getColumnsWithSelectedCells(),selectedColumns:i.getSelectedColumns()}:void 0;null===(e=null==n?void 0:n.__renderHeaderCells)||void 0===e||e.call(n,t,o)};this.sectionScrollController=new _t({onMainSectionScrollLeft:t=>{var e;r(t);const n=this.domManager.getRefs().mainBodyRef.current;null===(e=null==n?void 0:n.__renderBodyCells)||void 0===e||e.call(n,t)}}),this.config.autoExpandColumns&&(this.autoScaleManager=new zt({autoExpandColumns:this.config.autoExpandColumns,containerWidth:this.dimensionManager.getState().containerWidth,pinnedLeftWidth:0,pinnedRightWidth:0,mainBodyRef:i.mainBodyRef,isResizing:this.isResizing,collapsedHeaders:this.collapsedHeaders},()=>{this.render("autoScaleManager")})),i.headerContainerRef.current&&i.tableBodyContainerRef.current&&(this.scrollbarVisibilityManager=new Ge({headerContainer:i.headerContainerRef.current,mainSection:i.tableBodyContainerRef.current,scrollbarWidth:this.scrollbarWidth}),this.scrollbarVisibilityManager.subscribe(t=>{this.isMainSectionScrollable=t,i.tableBodyContainerRef.current&&(this.scrollbarWidth=Je(i.tableBodyContainerRef.current)),this.render("scrollbarVisibilityManager")})),this.windowResizeManager=new Ve,this.windowResizeManager.addCallback(()=>{var t;if(i.tableBodyContainerRef.current){const e=Je(i.tableBodyContainerRef.current);this.scrollbarWidth=e,null===(t=this.scrollbarVisibilityManager)||void 0===t||t.setScrollbarWidth(e)}this.render("scrollbarWidth-change")}),this.syncRowSelectionManager(),this.selectionManager&&(this.handleOutsideClickManager=new qe({selectableColumns:null!==(n=this.config.selectableColumns)&&void 0!==n&&n,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)&&(this.bodyContainerMouseLeaveListener=()=>{this.clearHoveredRows()},t.bodyContainer.addEventListener("mouseleave",this.bodyContainerMouseLeaveListener),this.syncExternalScrollWiring())}syncExternalScrollWiring(){var t;const e=this.domManager.getElements();if(!(null==e?void 0:e.bodyContainer))return;const n=!(null==this.config.scrollParent||null!=this.config.height&&""!==this.config.height||null!=this.config.maxHeight&&""!==this.config.maxHeight),i=n?(t=>{if(null==t)return null;if("function"==typeof t)try{const e=t();return null!=e?e:null}catch(t){return null}return"window"===t?"undefined"!=typeof window?window:null:"undefined"!=typeof HTMLElement&&t instanceof HTMLElement||"function"==typeof t.addEventListener?t:null})(this.config.scrollParent):null;if(i!==this.resolvedScrollParent&&this.detachExternalScrollWiring(),i)this.externalScrollRetryCount=0,this.attachExternalScrollWiring(i),this.ensureBodyScrollListenerDetached(e.bodyContainer),this.recomputeExternalViewportHeight();else if(n){this.ensureBodyScrollListenerDetached(e.bodyContainer);const n="undefined"!=typeof window?window.innerHeight:0;n>0&&this.externalViewportHeight!==n&&(this.externalViewportHeight=n,null===(t=this.dimensionManager)||void 0===t||t.updateConfig({externalViewportHeight:n})),this.scheduleExternalScrollParentRetry()}else this.externalScrollRetryCount=0,this.ensureBodyScrollListenerAttached(e.bodyContainer),this.externalViewportHeight=0,this.dimensionManager&&this.dimensionManager.updateConfig({externalViewportHeight:void 0})}scheduleExternalScrollParentRetry(){null===this.externalScrollRetryRaf&&co.EXTERNAL_SCROLL_MAX_RETRIES>this.externalScrollRetryCount&&"undefined"!=typeof requestAnimationFrame&&(this.externalScrollRetryRaf=requestAnimationFrame(()=>{this.externalScrollRetryRaf=null,this.mounted&&(this.externalScrollRetryCount++,this.syncExternalScrollWiring())}))}ensureBodyScrollListenerAttached(t){this.bodyScrollListenerAttached||(this.bodyContainerScrollListener=t=>this.handleScroll(t),t.addEventListener("scroll",this.bodyContainerScrollListener),this.bodyScrollListenerAttached=!0)}ensureBodyScrollListenerDetached(t){this.bodyScrollListenerAttached&&(this.bodyContainerScrollListener&&(t.removeEventListener("scroll",this.bodyContainerScrollListener),this.bodyContainerScrollListener=null),this.bodyScrollListenerAttached=!1)}attachExternalScrollWiring(t){if(!t)return;this.resolvedScrollParent=t;const e=t=>this.handleExternalScroll(t);if(this.externalScrollListener=e,t.addEventListener("scroll",e,{passive:!0}),"undefined"!=typeof Window&&t instanceof Window){const e=()=>this.handleExternalResize();this.externalWindowResizeListener=e,t.addEventListener("resize",e,{passive:!0})}else if("undefined"!=typeof ResizeObserver){const e=new ResizeObserver(()=>this.handleExternalResize());e.observe(t),this.externalParentResizeObserver=e}this.recomputeExternalScrollPaddingTop(),this.applyOverscrollContainment(t)}detachExternalScrollWiring(){const t=this.resolvedScrollParent;t&&this.externalScrollListener&&t.removeEventListener("scroll",this.externalScrollListener),this.externalScrollListener=null,t&&this.externalWindowResizeListener&&"undefined"!=typeof Window&&t instanceof Window&&t.removeEventListener("resize",this.externalWindowResizeListener),this.externalWindowResizeListener=null,this.externalParentResizeObserver&&(this.externalParentResizeObserver.disconnect(),this.externalParentResizeObserver=null),this.resolvedScrollParent=null;const e=this.domManager.getElements();e&&e.rootElement.style.removeProperty("--st-external-scroll-padding-top"),this.restoreOverscrollBehavior()}applyOverscrollContainment(t){const e="undefined"!=typeof Window&&t instanceof Window?"undefined"!=typeof document?document.documentElement:null:t;e&&(this.overscrollBehaviorTarget=e,this.overscrollBehaviorPrev=e.style.overscrollBehaviorY,e.style.overscrollBehaviorY="none")}restoreOverscrollBehavior(){this.overscrollBehaviorTarget&&(this.overscrollBehaviorTarget.style.overscrollBehaviorY=this.overscrollBehaviorPrev,this.overscrollBehaviorTarget=null,this.overscrollBehaviorPrev="")}recomputeExternalScrollPaddingTop(){const t=this.domManager.getElements();if(!t)return;const e=this.resolvedScrollParent;let n=0;if(e&&"undefined"!=typeof HTMLElement&&e instanceof HTMLElement){const t=getComputedStyle(e);n=parseFloat(t.paddingTop)||0}t.rootElement.style.setProperty("--st-external-scroll-padding-top",n+"px")}recomputeExternalViewportHeight(){var t;if(!this.resolvedScrollParent)return;const e=this.domManager.getElements(),n=null!==(t=null==e?void 0:e.rootElement)&&void 0!==t?t:this.container,i=ao(this.resolvedScrollParent,n);if(!i)return;let o=i.visibleViewportHeight;o>0||(o=(()=>{const t=ro(this.resolvedScrollParent);return t?Math.min(t.height,lo()):0})()),o>0&&o!==this.externalViewportHeight&&(this.externalViewportHeight=o,this.dimensionManager&&this.dimensionManager.updateConfig({externalViewportHeight:o}))}handleExternalResize(){this.recomputeExternalViewportHeight(),this.recomputeExternalScrollPaddingTop(),this.render("external-scroll-resize")}handleExternalScroll(t){var e;const n=this.resolvedScrollParent;if(!n)return;const i=this.domManager.getElements(),o=null!==(e=null==i?void 0:i.rootElement)&&void 0!==e?e:this.container,s=ao(n,o);if(!s)return;const r=s.relativeScrollTop;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=r>this.lastScrollTop?"down":this.lastScrollTop>r?"up":"none";this.scrollTop=r,this.scrollDirection=t,this.lastScrollTop=r,s.visibleViewportHeight!==this.externalViewportHeight&&(this.externalViewportHeight=s.visibleViewportHeight,this.dimensionManager&&this.dimensionManager.updateConfig({externalViewportHeight:s.visibleViewportHeight})),this.scrollManager&&(this.config.onLoadMore?this.scrollManager.handleScroll(r,0,s.visibleViewportHeight,s.relativeScrollTop+s.visibleViewportHeight+Math.max(0,s.distanceFromTableBottom)):this.scrollManager.handleScroll(r,0,0,0)),this.render("scroll-raf"),this.scrollRafId=null})}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)}getEffectiveRowGrouping(){var t;const e=null===(t=this.pivotManager)||void 0===t?void 0:t.getState();return(null==e?void 0:e.active)?e.rowGrouping:this.config.rowGrouping}syncPivotPipeline(t){var e,n,i,o,s,r,l,a,d,c;if(!this.pivotManager)return;const h=null!==(n=null!=t?t:null===(e=this.filterManager)||void 0===e?void 0:e.getFilteredRows())&&void 0!==n?n:this.localRows,u=this.pivotManager.isActive();this.pivotManager.updateConfig({sourceRows:h,fieldHeaders:this.pristineDefaultHeaders,pivot:null!==(i=this.config.pivot)&&void 0!==i?i:null});const f=this.pivotManager.getState();if(f.active){if(this.headers=f.headers,this.essentialAccessors=qn.buildEssentialAccessors(this.headers),null===(o=this.sortManager)||void 0===o||o.updateConfig({tableRows:f.pivotedRows,headers:f.headers,rowGrouping:f.rowGrouping}),null===(s=this.selectionManager)||void 0===s||s.updateConfig({headers:f.headers}),u?null===(l=this.expandedDepthsManager)||void 0===l||l.updateRowGrouping(f.rowGrouping):(null===(r=this.expandedDepthsManager)||void 0===r||r.updateRowGrouping(f.rowGrouping),this.collapsedHeaders=qn.getInitialCollapsedHeaders(f.headers)),this.dimensionManager){const t=this.renderOrchestrator.computeEffectiveHeaders(this.headers,this.config,this.customTheme);this.dimensionManager.updateConfig({effectiveHeaders:t})}}else{if(u&&(this.headers=En(this.pristineDefaultHeaders),this.essentialAccessors=qn.buildEssentialAccessors(this.headers),this.collapsedHeaders=qn.getInitialCollapsedHeaders(this.headers),null===(a=this.expandedDepthsManager)||void 0===a||a.updateRowGrouping(this.config.rowGrouping),this.dimensionManager)){const t=this.renderOrchestrator.computeEffectiveHeaders(this.headers,this.config,this.customTheme);this.dimensionManager.updateConfig({effectiveHeaders:t})}null===(d=this.sortManager)||void 0===d||d.updateConfig({tableRows:h,headers:this.headers,rowGrouping:this.config.rowGrouping}),null===(c=this.selectionManager)||void 0===c||c.updateConfig({headers:this.headers})}}getRenderContext(){var t;const e=this.domManager.getRefs(),n=null===(t=this.pivotManager)||void 0===t?void 0:t.getState(),i=(null==n?void 0:n.active)?Object.assign(Object.assign({},this.config),{rowGrouping:n.rowGrouping}):this.config;return{accordionAxis:this.pendingAccordionAxis,config:i,customTheme:this.customTheme,resolvedIcons:this.resolvedIcons,effectiveHeaders:[],essentialAccessors:this.essentialAccessors,headers:this.headers,localRows:(null==n?void 0:n.active)?n.pivotedRows:this.localRows,collapsedHeaders:this.collapsedHeaders,collapsedRows:this.collapsedRows,expandedRows:this.expandedRows,expandedDepths:this.expandedDepths,isResizing:this.isResizing,internalIsLoading:this.internalIsLoading,createNestedTable:(t,e)=>new co(t,e),cellRegistry:this.cellRegistry,hoverScopeId:this.hoverScopeId,headerRegistry:this.headerRegistry,draggedHeaderRef:this.draggedHeaderRef,hoveredHeaderRef:this.hoveredHeaderRef,mainBodyRef:e.mainBodyRef,pinnedLeftRef:e.pinnedLeftRef,pinnedRightRef:e.pinnedRightRef,mainHeaderRef:e.mainHeaderRef,pinnedLeftHeaderRef:e.pinnedLeftHeaderRef,pinnedRightHeaderRef:e.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,externalViewportHeight:this.externalViewportHeight>0?this.externalViewportHeight:void 0,onRender:()=>this.render("resizeHandler-onRender"),getShrinkFloors:()=>this.getShrinkFloors(),onAutoExpandNaturalWidths:t=>this.recordNaturalWidths(t),setIsResizing:t=>{var e,n,i,o,s,r,l,a;if(this.isResizing=t,this.autoScaleManager&&!1===t){const t=this.domManager.getRefs(),d=null!==(a=null!==(r=null!==(i=null===(n=null===(e=t.tableBodyContainerRef)||void 0===e?void 0:e.current)||void 0===n?void 0:n.clientWidth)&&void 0!==i?i:null===(s=null===(o=t.mainBodyRef)||void 0===o?void 0:o.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!==a?a:0;this.autoScaleManager.updateConfig({isResizing:!1,containerWidth:d})}},setHeaders:t=>{this.didColumnVisibilityChange(t)?this.beginAccordionAnimation("horizontal"):this.captureAnimationSnapshot(),this.headers=En(t),this.renderOrchestrator.invalidateCache("header")},animationCoordinator:this.animationCoordinator,setCollapsedHeaders:t=>{this.beginAccordionAnimation("horizontal"),this.collapsedHeaders=t},setCollapsedRows:t=>{this.beginAccordionAnimation("vertical"),this.collapsedRows="function"==typeof t?t(this.collapsedRows):t,this.render("expansion")},setExpandedRows:t=>{this.beginAccordionAnimation("vertical"),this.expandedRows="function"==typeof t?t(this.expandedRows):t,this.render("expansion")},setRowStateMap:t=>{this.beginAccordionAnimation("vertical"),this.rowStateMap="function"==typeof t?t(this.rowStateMap):t,this.render("rowStateMap")},getCollapsedRows:()=>this.collapsedRows,getCollapsedHeaders:()=>this.collapsedHeaders,getExpandedRows:()=>this.expandedRows,getHeaders:()=>this.headers,getPristineDefaultHeaders:()=>this.pristineDefaultHeaders,getRowStateMap:()=>this.rowStateMap,setColumnEditorOpen:t=>{this.columnEditorOpen=t},setCurrentPage:t=>{t!==this.currentPage&&this.config.enablePagination&&!this.config.serverSidePagination&&this.autoSizeAccessors.forEach(t=>this.pendingAutoSize.add(t)),this.currentPage=t}}}getRenderState(){return{currentPage:this.currentPage,scrollTop:this.scrollTop,scrollDirection:this.scrollDirection,scrollbarWidth:this.scrollbarWidth,isMainSectionScrollable:this.isMainSectionScrollable,columnEditorOpen:this.columnEditorOpen}}isAutoSizeLeaf(t){return!t.isSelectionColumn&&(t=>"string"==typeof t.width&&"auto"===t.width.trim().toLowerCase())(t)}computeAutoSizeAccessors(){const t=new Set,e=At(this.headers,this.collapsedHeaders);for(const n of e)this.isAutoSizeLeaf(n)&&t.add(n.accessor);return t}getAutoSizeStyleRoot(){var t,e,n,i,o,s,r,l;const a=this.domManager.getRefs(),d=null!==(s=null!==(i=null!==(e=null===(t=a.mainBodyRef)||void 0===t?void 0:t.current)&&void 0!==e?e:null===(n=a.mainHeaderRef)||void 0===n?void 0:n.current)&&void 0!==i?i:null===(o=a.pinnedLeftHeaderRef)||void 0===o?void 0:o.current)&&void 0!==s?s:null===(r=a.pinnedRightHeaderRef)||void 0===r?void 0:r.current;return d?null!==(l=d.closest(".simple-table-root"))&&void 0!==l?l:d:null}getAutoSizeRows(){if(this.config.enablePagination&&!this.config.serverSidePagination){const t=this.renderOrchestrator.getLastProcessedResult();if(t){const e=t.currentTableRows.filter(t=>t.row&&!t.stateIndicator&&!t.isLoadingSkeleton&&!t.nestedTable).map(t=>t.row);if(e.length>0)return e}}return this.localRows}getShrinkFloors(){var t;const e=new Map,n=t=>{if(t.children&&t.children.length>0&&t.children.forEach(n),"number"==typeof t.width)e.set(t.accessor+"",t.width);else if("string"==typeof t.width&&t.width.trim().endsWith("px")){const n=parseFloat(t.width);Number.isFinite(n)&&e.set(t.accessor+"",n)}};this.pristineDefaultHeaders.forEach(n);const i=new Map,o=At(this.headers,this.collapsedHeaders);for(const n of o){const o=n.accessor+"",s=null!==(t=this.naturalWidths.get(o))&&void 0!==t?t:e.get(o);i.set(o,Math.max(null!=s?s:0,Et(n)))}return i}recordNaturalWidths(t){t.forEach((t,e)=>this.naturalWidths.set(e,t))}applyMeasuredWidths(t){const e=n=>{const i=Object.assign({},n);return t.has(n.accessor)&&(i.width=t.get(n.accessor)),n.children&&n.children.length>0&&(i.children=n.children.map(e)),i};this.headers=this.headers.map(e),t.forEach((t,e)=>this.naturalWidths.set(e+"",t))}maybeAutoSizeColumns(){if(this.isAutoSizing||0===this.pendingAutoSize.size)return;const t=this.getAutoSizeStyleRoot();if(t instanceof HTMLElement&&t.querySelector(".st-header-cell")){this.isAutoSizing=!0;try{const e=At(this.headers,this.collapsedHeaders),n=new Map(e.map(t=>[t.accessor,t])),i=this.getAutoSizeRows(),o=new Map;for(const e of this.pendingAutoSize){const s=n.get(e);if(!s)continue;const{width:r}=Lt(e,{rows:i,header:s,styleRoot:t,theme:this.config.theme,autoSizeMode:s.autoSizeMode,sortIcon:this.resolvedIcons.sortUp,expandIcon:this.resolvedIcons.expand,onRendererHostDiscard:this.config.onRendererHostDiscard});o.set(e,r)}if(this.pendingAutoSize.clear(),0===o.size)return;let s=!1;for(const[t,e]of o){const i=n.get(t);if(("number"==typeof(null==i?void 0:i.width)?i.width:this.naturalWidths.get(t+""))!==e){s=!0;break}}if(!s)return;this.applyMeasuredWidths(o),this.renderOrchestrator.invalidateCache("header");const r=this.domManager.getElements(),l=this.domManager.getRefs();r&&this.renderOrchestrator.render(r,l,this.getRenderContext(),this.getRenderState(),this.mergedColumnEditorConfig),this.config.onColumnWidthChange&&this.config.onColumnWidthChange(this.headers)}finally{this.isAutoSizing=!1}}}refitAutoSizeColumns(){0!==this.autoSizeAccessors.size&&(this.autoSizeAccessors.forEach(t=>this.pendingAutoSize.add(t)),this.render("auto-size-refit"))}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),this.maybeAutoSizeColumns(),this.pendingAccordionAxis=null,this.lastRenderedVisibilityKey=this.buildVisibilityKey(this.headers),"scroll-raf"!==t&&"live-sort"!==t&&this.animationCoordinator.play({containers:this.getAnimatableContainers()}),this.maybeScheduleUnvirtualizedRowsWarning())}maybeScheduleUnvirtualizedRowsWarning(){var t,e,n;(()=>{try{const t=globalThis.process;return!!(null==t?void 0:t.env)&&"production"!==t.env.NODE_ENV}catch(t){return!1}})()&&(this.hasWarnedUnvirtualizedRows||null===this.unvirtualizedRowsCheckTimeoutId&&"undefined"!=typeof window&&!1!==this.config.enableVirtualization&&void 0===(null===(t=this.dimensionManager)||void 0===t?void 0:t.getContentHeight())&&(500>(null!==(n=null===(e=this.renderOrchestrator.getLastProcessedResult())||void 0===e?void 0:e.currentTableRows.length)&&void 0!==n?n:0)||(this.unvirtualizedRowsCheckTimeoutId=window.setTimeout(()=>{this.unvirtualizedRowsCheckTimeoutId=null,this.evaluateUnvirtualizedRowsWarning()},400))))}evaluateUnvirtualizedRowsWarning(){var t,e,n;if(this.hasWarnedUnvirtualizedRows||!this.mounted)return;if(!1===this.config.enableVirtualization)return;if(void 0!==(null===(t=this.dimensionManager)||void 0===t?void 0:t.getContentHeight()))return;const i=null!==(n=null===(e=this.renderOrchestrator.getLastProcessedResult())||void 0===e?void 0:e.currentTableRows.length)&&void 0!==n?n:0;500>i||(this.hasWarnedUnvirtualizedRows=!0,console.warn(`[simple-table] Rendering ${i} rows without virtualization. This can cause slow renders and high memory use. To virtualize, set \`height\` or \`maxHeight\` on the table, or pass a bounded \`scrollParent\`.`+(null!=this.config.scrollParent?' A `scrollParent` is set but did not produce a bounded viewport — make sure it is an element whose visible height is smaller than its content (e.g. a fixed/max height with `overflow: auto`), or use `"window"`.':"")))}update(t){var n,i,o,r,l,a,d,c,h,u,f,v,p,w,m;this.isUpdating=!0;const g=this.config.theme,b=s(t);if(this.config=Object.assign(Object.assign({},this.config),b),void 0!==t.animations&&this.applyAnimationsConfig(t.animations),void 0!==t.onRendererHostDiscard&&(this.animationCoordinator.setOnHostDiscard(t.onRendererHostDiscard),this.renderOrchestrator.setOnRendererHostDiscard(t.onRendererHostDiscard)),void 0!==t.rows&&(this.firstRenderDone&&this.captureAnimationSnapshot(),this.localRows=[...t.rows],this.rebuildRowIndexMap(),this.filterManager&&this.filterManager.updateConfig({rows:this.localRows}),this.syncPivotPipeline(null!==(i=null===(n=this.filterManager)||void 0===n?void 0:n.getFilteredRows())&&void 0!==i?i:this.localRows),this.autoSizeAccessors.forEach(t=>this.pendingAutoSize.add(t))),void 0!==t.pivot&&void 0===t.rows&&this.syncPivotPipeline(null!==(r=null===(o=this.filterManager)||void 0===o?void 0:o.getFilteredRows())&&void 0!==r?r:this.localRows),void 0===t.rows&&void 0===t.totalRowCount||null===(l=this.dimensionManager)||void 0===l||l.updateConfig({totalRowCount:null!==(a=this.config.totalRowCount)&&void 0!==a?a:this.localRows.length}),void 0!==t.columns&&!this.isResizing){if(this.captureAnimationSnapshot(),this.pristineDefaultHeaders=En(t.columns),this.filterManager&&this.filterManager.updateConfig({headers:this.pristineDefaultHeaders}),null===(d=this.pivotManager)||void 0===d?void 0:d.isActive())this.syncPivotPipeline(null!==(h=null===(c=this.filterManager)||void 0===c?void 0:c.getFilteredRows())&&void 0!==h?h:this.localRows);else if(this.headers=[...t.columns],this.essentialAccessors=qn.buildEssentialAccessors(this.headers),this.sortManager&&this.sortManager.updateConfig({headers:this.headers}),this.selectionManager&&this.selectionManager.updateConfig({headers:this.headers}),this.dimensionManager){const t=this.renderOrchestrator.computeEffectiveHeaders(this.headers,this.config,this.customTheme);this.dimensionManager.updateConfig({effectiveHeaders:t})}this.autoSizeAccessors=this.computeAutoSizeAccessors(),this.pendingAutoSize=new Set(this.autoSizeAccessors),this.naturalWidths.clear()}if(void 0!==t.isLoading){const e=this.internalIsLoading;this.internalIsLoading=t.isLoading,e&&!t.isLoading&&this.autoSizeAccessors.size>0&&this.autoSizeAccessors.forEach(t=>this.pendingAutoSize.add(t))}if(void 0!==t.theme&&(this.domManager.updateTheme(t.theme),t.theme!==g&&(this.renderOrchestrator.invalidateCache("all"),this.renderOrchestrator.invalidateCustomFooterCache())),void 0!==t.footerPosition&&this.domManager.syncFooterPosition(this.config.footerPosition),void 0===t.rows&&void 0===t.footerRenderer&&void 0===t.footerRenderKey||this.renderOrchestrator.invalidateCustomFooterCache(),void 0!==t.customTheme){const t=this.customTheme;this.customTheme=qn.mergeCustomTheme(this.config),function(t,n){for(const i of Object.keys(e))if(t[i]!==n[i])return!1;return!0}(t,this.customTheme)||(this.selectionManager&&this.selectionManager.updateConfig({customTheme:this.customTheme,rowHeight:this.customTheme.rowHeight}),null===(u=this.dimensionManager)||void 0===u||u.updateConfig({headerHeight:this.customTheme.headerHeight,rowHeight:this.customTheme.rowHeight,footerHeight:!this.config.enablePagination&&!this.config.footerRenderer||this.config.hideFooter?void 0:this.customTheme.footerHeight}),this.config.enablePagination&&t.rowHeight!==this.customTheme.rowHeight&&(this.currentPage=1),this.renderOrchestrator.invalidateCache("all"))}if(void 0===t.selectableColumns&&void 0===t.selectableCells||!this.selectionManager||this.selectionManager.updateConfig({selectableColumns:null!==(f=this.config.selectableColumns)&&void 0!==f&&f,selectableCells:null!==(v=this.config.selectableCells)&&void 0!==v&&v}),(void 0!==t.enableRowSelection||void 0!==t.rowSelectionMode||void 0!==t.selectRowOnClick||void 0!==t.showRowSelectionColumn||void 0!==t.rowButtons||void 0!==t.onRowSelectionChange||void 0!==t.selectableCells)&&(this.syncRowSelectionManager(),null===(p=this.selectionManager)||void 0===p||p.updateConfig({enableRowSelection:Ne(this.config)}),(void 0!==t.enableRowSelection||void 0!==t.showRowSelectionColumn||void 0!==t.rowButtons)&&(this.renderOrchestrator.invalidateCache("header"),this.renderOrchestrator.invalidateCache("all"),this.dimensionManager))){const t=this.renderOrchestrator.computeEffectiveHeaders(this.headers,this.config,this.customTheme);this.dimensionManager.updateConfig({effectiveHeaders:t})}void 0===t.height&&void 0===t.maxHeight||null===(w=this.dimensionManager)||void 0===w||w.updateConfig({height:this.config.height,maxHeight:this.config.maxHeight}),void 0===t.scrollParent&&void 0===t.height&&void 0===t.maxHeight||this.syncExternalScrollWiring(),void 0===t.onLoadMore&&void 0===t.infiniteScrollThreshold||!this.scrollManager||this.scrollManager.updateConfig({onLoadMore:this.config.onLoadMore,infiniteScrollThreshold:null!==(m=this.config.infiniteScrollThreshold)&&void 0!==m?m:200}),this.isUpdating=!1,this.render("update")}updateConfig(t){this.update(t)}syncRowSelectionManager(){var t,e,n,i,o;if(this.config.enableRowSelection){const s={onRowSelectionChange:this.config.onRowSelectionChange,enableRowSelection:!0,rowSelectionMode:null!==(t=this.config.rowSelectionMode)&&void 0!==t?t:"multiple",selectRowOnClick:null!==(e=this.config.selectRowOnClick)&&void 0!==e&&e,showRowSelectionColumn:!1!==this.config.showRowSelectionColumn,selectableCells:null!==(n=this.config.selectableCells)&&void 0!==n&&n,tableRoot:this.container};this.rowSelectionManager?this.rowSelectionManager.updateConfig(s):(this.rowSelectionManager=new ze(Object.assign({tableRows:null!==(o=null===(i=this.renderOrchestrator.getLastProcessedResult())||void 0===i?void 0:i.currentTableRows)&&void 0!==o?o:[]},s)),this.rowSelectionManager.subscribe(()=>{this.render("rowSelectionManager")}))}else this.rowSelectionManager&&(this.rowSelectionManager.destroy(),this.rowSelectionManager=null)}destroy(){var t,e,n,i,o,s,r,l,a,d,c,h,u,f,v,p;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!==this.externalScrollRetryRaf&&(cancelAnimationFrame(this.externalScrollRetryRaf),this.externalScrollRetryRaf=null),null!==this.unvirtualizedRowsCheckTimeoutId&&(clearTimeout(this.unvirtualizedRowsCheckTimeoutId),this.unvirtualizedRowsCheckTimeoutId=null),this.detachExternalScrollWiring();const w=this.domManager.getElements();(null==w?void 0:w.bodyContainer)&&(this.ensureBodyScrollListenerDetached(w.bodyContainer),this.bodyContainerMouseLeaveListener&&(w.bodyContainer.removeEventListener("mouseleave",this.bodyContainerMouseLeaveListener),this.bodyContainerMouseLeaveListener=null)),null!==this.accordionCleanupTimerId&&(window.clearTimeout(this.accordionCleanupTimerId),this.accordionCleanupTimerId=null);const m=null!==(e=null===(t=this.domManager.getElements())||void 0===t?void 0:t.rootElement)&&void 0!==e?e:this.container;m.classList.remove(Wn),m.style.removeProperty(On),m.style.removeProperty(Pn),null===(n=this.dimensionManager)||void 0===n||n.destroy(),null===(i=this.scrollManager)||void 0===i||i.destroy(),null===(o=this.sectionScrollController)||void 0===o||o.destroy(),null===(s=this.sortManager)||void 0===s||s.destroy(),null===(r=this.filterManager)||void 0===r||r.destroy(),null===(l=this.pivotManager)||void 0===l||l.destroy(),this.pivotManager=null,null===(a=this.rowSelectionManager)||void 0===a||a.destroy(),null===(d=this.selectionManager)||void 0===d||d.destroy(),null===(c=this.autoScaleManager)||void 0===c||c.destroy(),null===(h=this.windowResizeManager)||void 0===h||h.destroy(),null===(u=this.handleOutsideClickManager)||void 0===u||u.destroy(),null===(f=this.scrollbarVisibilityManager)||void 0===f||f.destroy(),null===(v=this.expandedDepthsManager)||void 0===v||v.destroy(),null===(p=this.ariaAnnouncementManager)||void 0===p||p.destroy(),this.animationCoordinator.destroy(),this.cellRegistry.clear(),this.headerRegistry.clear(),m.querySelectorAll("[data-row-id]").forEach(t=>{const e=t.getAttribute("data-row-id");e&&Mn(e,t)}),this.renderOrchestrator.cleanup(),this.domManager.destroy(this.container),this.cachedAPI=null}getAPI(){if(this.cachedAPI)return this.cachedAPI;const t=this;return this.cachedAPI=so.createAPI({get config(){return t.config},get localRows(){return t.localRows},get effectiveHeaders(){return t.renderOrchestrator.computeEffectiveHeaders(t.headers,t.config,t.customTheme)},get headers(){return t.headers},getPristineDefaultHeaders:()=>t.pristineDefaultHeaders,get essentialAccessors(){return t.essentialAccessors},get customTheme(){return t.customTheme},get currentPage(){return t.currentPage},getCurrentPage:()=>this.currentPage,get expandedRows(){return t.expandedRows},get collapsedRows(){return t.collapsedRows},get expandedDepths(){return t.expandedDepths},clearExpandedRows:()=>{t.expandedRows=new Map},clearCollapsedRows:()=>{t.collapsedRows=new Map},get rowStateMap(){return t.rowStateMap},get headerRegistry(){return t.headerRegistry},get cellRegistry(){return t.cellRegistry},isCellAnimating:t=>this.animationCoordinator.isInFlight(t),hasAnimatingCells:()=>this.animationCoordinator.hasInFlight(),get columnEditorOpen(){return t.columnEditorOpen},getCachedFlattenResult:()=>this.renderOrchestrator.getCachedFlattenResult(),getCachedProcessedResult:()=>this.renderOrchestrator.getLastProcessedResult(),get expandedDepthsManager(){return t.expandedDepthsManager},get selectionManager(){return t.selectionManager},get rowSelectionManager(){return t.rowSelectionManager},get sortManager(){return t.sortManager},get filterManager(){return t.filterManager},getEffectiveRowGrouping:()=>this.getEffectiveRowGrouping(),setPivot:t=>{var e,n,i,o;this.config=Object.assign(Object.assign({},this.config),{pivot:t}),this.syncPivotPipeline(null!==(n=null===(e=this.filterManager)||void 0===e?void 0:e.getFilteredRows())&&void 0!==n?n:this.localRows),null===(o=(i=this.config).onPivotChange)||void 0===o||o.call(i,t),this.renderOrchestrator.invalidateCache("header"),this.renderOrchestrator.invalidateCache("body"),this.render("setPivot")},getPivot:()=>{var t,e,n;return null!==(n=null!==(e=null===(t=this.pivotManager)||void 0===t?void 0:t.getPivot())&&void 0!==e?e:this.config.pivot)&&void 0!==n?n:null},getPivotHeaders:()=>{var t;const e=null===(t=this.pivotManager)||void 0===t?void 0:t.getState();return(null==e?void 0:e.active)?e.headers:this.headers},getPivotedRows:()=>{var t;const e=null===(t=this.pivotManager)||void 0===t?void 0:t.getState();return(null==e?void 0:e.active)?e.pivotedRows:this.localRows},onRender:()=>this.render("columnEditor-onRender"),invalidateRowsCache:()=>{this.renderOrchestrator.invalidateCache("body")},runWithoutAnimationSnapshot:t=>{this.suppressNextAnimationSnapshot=!0;try{t()}finally{this.suppressNextAnimationSnapshot=!1}},setHeaders:t=>{this.didColumnVisibilityChange(t)?this.beginAccordionAnimation("horizontal"):this.captureAnimationSnapshot(),this.headers=En(t),this.renderOrchestrator.invalidateCache("header")},setCurrentPage:t=>{this.currentPage=t},setColumnEditorOpen:t=>{this.columnEditorOpen=t,this.render("columnEditor-toggle")}}),this.cachedAPI}}function ho(t){return t}function uo(t,e){if(t===e)return!0;if(t.accessor!==e.accessor||t.width!==e.width||t.minWidth!==e.minWidth||t.maxWidth!==e.maxWidth||t.label!==e.label||t.type!==e.type||t.pinned!==e.pinned||t.hide!==e.hide||t.sortable!==e.sortable||t.filterable!==e.filterable||t.align!==e.align||t.collapsible!==e.collapsible||t.collapseDefault!==e.collapseDefault||t.showWhen!==e.showWhen||t.editable!==e.editable||t.essential!==e.essential||t.disableReorder!==e.disableReorder||t.expandable!==e.expandable||t.excludeFromRender!==e.excludeFromRender||t.autoSizeMode!==e.autoSizeMode||t.tooltip!==e.tooltip||t.quickFilterable!==e.quickFilterable)return!1;const n=t.filterOperators,i=e.filterOperators;if(n!==i){if(!n||!i||n.length!==i.length)return!1;for(let t=0;n.length>t;t++)if(n[t]!==i[t])return!1}const o=t.children,s=e.children;if(o===s)return!0;if(!o||!s)return!o&&!s;if(o.length!==s.length)return!1;for(let t=0;o.length>t;t++)if(!uo(o[t],s[t]))return!1;return!0}function fo(t,e){if(t===e)return!0;if(!t||!e)return!t&&!e;if(t.length!==e.length)return!1;for(let n=0;t.length>n;n++)if(!uo(t[n],e[n]))return!1;return!0}function vo(t,e=new Set){var n;for(const i of t)e.add(i.accessor+""),(null===(n=i.children)||void 0===n?void 0:n.length)&&vo(i.children,e);return e}function po(t,e){if(t===e)return!0;const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const i of n)if(t[i]!==e[i])return!1;return!0}co.nextHoverScopeId=0,co.EXTERNAL_SCROLL_MAX_RETRIES=60;const wo=5e4;function mo(t,e,n){if(t===e)return!0;if(!t||!e)return!t&&!e;if(t.length!==e.length)return!1;const i=5e4>=e.length;for(let o=0;t.length>o;o++){const s=t[o],r=e[o];if(s!==r){if(n&&n({row:s,depth:0,index:o,rowPath:[],rowIndexPath:[o]})+""!=n({row:r,depth:0,index:o,rowPath:[],rowIndexPath:[o]})+"")return!1;if(!i)return!1;if(!po(s,r))return!1}}return!0}export{se as PIVOT_ACCESSOR_PREFIX,re as PIVOT_BLANK_LABEL,ie as PIVOT_CHILDREN_KEY,oe as PIVOT_IS_TOTAL_KEY,wo as SHALLOW_ROW_COMPARE_MAX,co as SimpleTableVanilla,ho as asRows,pe as buildPivotAccessor,we as buildPivotRowTotalAccessor,vo as collectHeaderAccessors,fo as headersStructurallyEqual,n as normalizeColumnDef,i as normalizeColumnDefs,o as normalizeConfig,s as normalizeConfigPatch,Re as pivotRows,mo as rowsShallowUnchanged,po as shallowEqualRow};
|
|
2
2
|
//# sourceMappingURL=index.es.js.map
|