simple-table-core 3.8.5 → 3.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/src/core/SimpleTableVanilla.d.ts +8 -0
- package/dist/cjs/src/core/rendering/RenderOrchestrator.d.ts +1 -0
- package/dist/cjs/src/core/rendering/SectionRenderer.d.ts +8 -0
- package/dist/cjs/src/core/rendering/TableRenderer.d.ts +1 -0
- package/dist/cjs/src/managers/AnimationCoordinator.d.ts +44 -0
- package/dist/cjs/src/types/SimpleTableConfig.d.ts +10 -0
- package/dist/cjs/src/utils/bodyCell/eventTracking.d.ts +1 -1
- package/dist/cjs/src/utils/bodyCell/types.d.ts +8 -0
- package/dist/cjs/styles.css +1 -1
- package/dist/index.es.js +1 -1
- package/dist/src/core/SimpleTableVanilla.d.ts +8 -0
- package/dist/src/core/rendering/RenderOrchestrator.d.ts +1 -0
- package/dist/src/core/rendering/SectionRenderer.d.ts +8 -0
- package/dist/src/core/rendering/TableRenderer.d.ts +1 -0
- package/dist/src/managers/AnimationCoordinator.d.ts +44 -0
- package/dist/src/types/SimpleTableConfig.d.ts +10 -0
- package/dist/src/utils/bodyCell/eventTracking.d.ts +1 -1
- package/dist/src/utils/bodyCell/types.d.ts +8 -0
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/styles/base.css +12 -0
package/dist/cjs/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const t={rowHeight:32,headerHeight:32,footerHeight:49,rowSeparatorWidth:1,borderWidth:1,pinnedBorderWidth:1,nestedGridBorderWidth:2,nestedGridPaddingTop:8,nestedGridPaddingBottom:8,nestedGridPaddingLeft:8,nestedGridPaddingRight:8,nestedGridMaxHeight:400,selectionColumnWidth:42},e=new WeakMap,n=(t,n,i)=>{const o=(t=>{let n=e.get(t);return n||(n=new Map,e.set(t,n)),n})(t);let s=o.get(n);s||(s=document.createElement("div"),s.className="st-aria-row",s.setAttribute("role","row"),s.style.display="contents",t.appendChild(s),o.set(n,s));const r=i+"";return s.getAttribute("aria-rowindex")!==r&&s.setAttribute("aria-rowindex",r),s},i=t=>{const n=e.get(t);n&&n.forEach((t,e)=>{0===t.childElementCount&&(t.remove(),n.delete(e))})},o=t=>{const n=e.get(t);n&&(n.forEach(t=>t.remove()),n.clear())},s=new WeakMap,r=(t,e,n,i)=>{t.addEventListener(e,n,i),s.has(t)||s.set(t,[]),s.get(t).push({event:e,handler:n,options:i})},l=new WeakMap,a=t=>(l.has(t)||l.set(t,new Map),l.get(t)),d=new WeakMap;let c=0,h=Date.now(),u={screenX:0,screenY:0},p=null;const f=t=>{h=t},v=new WeakMap,w=t=>(v.has(t)||v.set(t,new Map),v.get(t)),m=new WeakMap,g=t=>(m.has(t)||m.set(t,new Map),m.get(t)),x=(t,e)=>{const n=Date.now();0!==c&&e>n-c||(c=n,t())},b=(t,e,n,i)=>{t.addEventListener(e,n,i),d.has(t)||d.set(t,[]),d.get(t).push({event:e,handler:n,options:i})},y=t=>{const e=t.closest(".simple-table-root");null==e||e.querySelectorAll(".st-tooltip").forEach(t=>t.remove())},R=.5,C="st-cell-animating-out",S="data-animating-out",I="data-shrinking-out",H=t=>{const e=a(t),n=w(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 M{constructor(t={}){var e,n;this.enabled=!1,this.snapshot=null,this.incomingOrigins=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=A()}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)}getDuration(){return this.duration}getEasing(){return this.easing}setIncomingOrigins(t){this.incomingOrigins=this.isEnabled()&&t&&t.size>0?t:null}getScrollerMetrics(t){let e=this.scrollerMetricsCache.get(t);if(!e){const n=E(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;H(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)}retainCell(t){const{cellId:e,element:n,container:i,newPosition:o}=t,s=k(n.style.top),r=k(n.style.left),l=this.getScrollerMetrics(i),a=T(o.top,s,o.height,l,"y"),d=T(o.left,r,o.width,l,"x");let c=this.retainedCells.get(i);c||(c=new Map,this.retainedCells.set(i,c));const h=c.get(e);h&&h!==n&&(this.cancelInFlight(e),h.remove()),n.id&&n.removeAttribute("id"),n.classList.add(C),n.setAttribute(S,"true"),n.style.left=d+"px",n.style.top=a+"px",n.style.width=o.width+"px",n.style.height=o.height+"px",n.style.pointerEvents="none",c.set(e,n)}claimRetainedForReuse(t,e){var n;const i=this.retainedCells.get(e);if(!i)return null;const o=i.get(t);return o?o.hasAttribute(I)?(this.cancelInFlight(t),i.delete(t),null===(n=this.snapshot)||void 0===n||n.delete(t),o.remove(),null):(this.cancelInFlight(t),i.delete(t),o.classList.remove(C),o.removeAttribute(S),o.id=t,o.style.pointerEvents="",o):null}shrinkOutCell(t){const{cellId:e,element:n,container:i,axis:o}=t;this.cancelInFlight(e);let s=this.retainedCells.get(i);s||(s=new Map,this.retainedCells.set(i,s));const r=s.get(e);r&&r!==n&&(this.cancelInFlight(e),r.remove()),n.id&&n.removeAttribute("id"),n.classList.add(C),n.setAttribute(S,"true"),n.setAttribute(I,"true"),n.style.pointerEvents="none","horizontal"===o?n.style.width="0px":n.style.height="0px",s.set(e,n);const l=window.setTimeout(()=>{const t=this.retainedCells.get(i);t&&t.get(e)===n&&t.delete(e),n.remove()},this.duration+80);this.inFlight.set(e,{element:n,cleanupTimeout:l,transitionEndHandler:()=>{},isRetained:!0})}discardRetainedIfPresent(t,e){const n=this.retainedCells.get(e);if(!n)return;const i=n.get(t);i&&(this.cancelInFlight(t),n.delete(t),i.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)=>{this.inFlight.has(n)||(e.remove(),t.delete(n))})});const i=[],o=new Set,s=new Map,r=(t,r,l,a)=>{if(o.has(r))return;if(l&&t.hasAttribute(I))return void o.add(r);let d=e.get(r);if(!d&&!l&&n){const t=n.get(r);t&&(d={sourceContainer:null,sourceContainerLeft:0,sourceContainerTop:0,left:t.left,top:t.top,styleTop:t.top,styleLeft:t.left,fromDom:!1})}if(!d)return;if(!l&&null!==d.sourceContainer&&d.sourceContainer!==a)return void o.add(r);if(t.querySelector(".st-cell-editing"))return;const c=k(t.style.left),h=k(t.style.top);if(!l&&this.inFlight.has(r)&&R>Math.abs(d.styleTop-h)&&R>Math.abs(d.styleLeft-c))return void o.add(r);const u=l||d.fromDom,p=u?0:k(t.style.height)||t.offsetHeight||0,f=u?0:k(t.style.width)||t.offsetWidth||0,v=u?null:this.getScrollerMetrics(a),w=u||!v?d.top:T(d.top,h,p,v,"y"),m=u||!v?d.left:T(d.left,c,f,v,"x");let g=0;if(null!==d.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);g=t.left-d.sourceContainerLeft}const x=m-c-g,b=w-h-0;R>Math.abs(x)&&R>Math.abs(b)?l&&t.remove():(i.push({cellId:r,element:t,dx:x,dy:b,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)}),H(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.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=>t.remove()),t.clear()}),this.retainedCells.clear()}destroy(){this.cancel()}readPosition(t,e,n,i,o){const s=k(e.style.top),r=k(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){if(n)return this.retainedCells.forEach(n=>{n.get(t)===e&&n.delete(t)}),void e.remove();e.style.transition="",e.style.transform="",e.style.willChange="",e.style.pointerEvents=""}isCellRetained(t){return t.hasAttribute(S)}}const k=t=>{if(!t)return 0;const e=parseFloat(t);return Number.isFinite(e)?e:0},E=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}},T=(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},A=()=>{if("undefined"==typeof window||"function"!=typeof window.matchMedia)return!1;try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch(t){return!1}},W=t=>Math.ceil(800/(t+1)),O=29.5,P=150,$=["lineAreaChart","barChart"],F=500,L=40,D=(t,e,n)=>e&&n?480>t?.25:768>t?.3:.4:(t=>480>t?.4:768>t?.5:.6)(t),B="parentExpanded",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},z=t=>t.flatMap(t=>t.children&&0!==t.children.length?z(t.children):[t]),N=t=>t.flatMap(t=>{const e=[t];return t.children&&t.children.length>0&&e.push(...N(t.children)),e}),q=(t=0)=>t?t+1:0,V=(t,e)=>{const n=N(t);for(const t of n)if(t.children&&t.children.length>0&&t.children.some(t=>t.accessor===e))return t;return null},G=(t,e,n)=>{const i=V(e,t.accessor);if(i){const e=n.has(i.accessor),o=t.showWhen||B;return e?"parentExpanded"===o:"parentCollapsed"===o}return!1},K=t=>{var e;return!(!(null===(e=t.children)||void 0===e?void 0:e.length)||!t.collapsible)},U=(t,e,n)=>{if(!t.children||0===t.children.length)return 1;const i=z(t.children);let o=0;for(const t of i)t.hide||G(t,e,n)||(o+=1);return o},J=({accessor:t,rowId:e})=>`${e}-${t}`,_=({calculatedHeight:t,customHeight:e,customTheme:n})=>e?("string"==typeof e?parseFloat(e):e)+n.nestedGridPaddingTop+n.nestedGridPaddingBottom:t,Y=t=>{const e=t.match(/^(.+?)\[(\d+)\]$/);return e?{key:e[1],index:parseInt(e[2],10)}:{key:t,index:null}},X=(t,e)=>{const n=e+"";return n.includes(".")||n.includes("[")?n.split(".").reduce((t,e)=>{if(null==t)return;const{key:n,index:i}=Y(e);let o=t[n];return null!==i&&Array.isArray(o)&&(o=o[i]),o},t):t[e]},Q=(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}=Y(o[t]);if(null==s[e]){const n=Y(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}=Y(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},Z=t=>Array.isArray(t)&&t.length>0&&"object"==typeof t[0]&&null!==t[0],tt=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});i.push(n)}return i},et=t=>t.join("-"),nt=new WeakMap;let it=0;const ot=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})+"":(t=>{if(t&&"object"==typeof t){const e=nt.get(t);if(void 0!==e)return e;const n="__row_"+ ++it;return nt.set(t,n),n}return"__row_p_"+t})(t.row),i=[];return t.parentStableKey&&i.push(t.parentStableKey),t.groupingKey&&t.depth>0&&i.push(t.groupingKey),i.push(n),i.join("/")},st=t=>t.stableRowKey?t.stableRowKey:et(t.rowId),rt=(t,e)=>`${t+""}nested-chrome${(null!=e?e:"")+""}`,lt=(t,e)=>!!e&&Z(t[e]),at=(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},dt=(t,e)=>{if(t.hide||t.excludeFromRender)return[];if(!t.children||0===t.children.length)return[t];if(e&&e.has(t.accessor)){const n=t.children.filter(t=>{const e=t.showWhen||B;return"parentCollapsed"===e||"always"===e});return t.singleRowChildren?0===n.length?[t]:[t,...n.flatMap(t=>dt(t,e))]:0===n.length?[t]:n.flatMap(t=>dt(t,e))}const n=t.children.filter(t=>{const e=t.showWhen||B;return"parentExpanded"===e||"always"===e});return t.singleRowChildren?[t,...n.flatMap(t=>dt(t,e))]:n.flatMap(t=>dt(t,e))};function ct(t){if(t.hide)return null;if("number"==typeof t.width)return{type:"px",value:t.width};if("string"!=typeof t.width)return null;const e=t.width.trim();return"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 ht(t){const e=[],n=t=>{t.hide||(t.children&&0!==t.children.length?t.children.forEach(n):e.push(t))};return t.forEach(n),e}function ut(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(P,"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:P);else a.set(t.accessor,P)}),a}function pt(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=ht(t);i=ut(e,n)}else{const e=ht(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=ut(e,s)}return t.map(function t(e){const n=Object.assign({},e);if(e.children&&e.children.length>0)return n.children=e.children.map(t),n;const o=i.get(e.accessor);return null!=o&&(n.width=o),n})}const ft=t=>{if(t.hide||t.excludeFromRender)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(J({accessor:t.accessor,rowId:"header"}));return(null==e?void 0:e.offsetWidth)||P}},vt=t=>{var e;const n=t.width;"string"==typeof n&&n.includes("fr")&&(t.width=(null===(e=document.getElementById(J({accessor:t.accessor,rowId:"header"})))||void 0===e?void 0:e.offsetWidth)||P),t.children&&t.children.length>0&&t.children.forEach(t=>{vt(t)})},wt=t=>"number"==typeof t.minWidth?t.minWidth:L,mt=(t,e)=>{const n=[];return t.forEach(t=>{t.hide||n.push(...dt(t,e))}),n},gt=(t,e)=>{var n,i;const{rows:o,header:s,maxWidth:r=F,headSampleSize:l,stridedSampleSize:a,sampleSize:d,outlierPercentile:c,outlierThreshold:h,autoSizeMode:u=(null!==(n=null==s?void 0:s.autoSizeMode)&&void 0!==n?n:"content"),theme:p,styleRoot:f}=e||{},v=null!==(i=null!=l?l:d)&&void 0!==i?i:25,w=null!=a?a:null!=d?0:75,m=null!=f?f:document,g=document.getElementById(J({accessor:t,rowId:"header"}));if(!g)return P;const x=window.getComputedStyle(g),b=parseFloat(x.paddingLeft)||0,y=parseFloat(x.paddingRight)||0,R=parseFloat(x.gap)||0;let C=b+y;const S=g.querySelector(".st-header-label");if(S){const t=S.querySelector(".st-header-label-text");if(t){const e=document.createElement("span");e.style.visibility="hidden",e.style.position="absolute",e.style.whiteSpace="nowrap",e.style.width="auto";const n=window.getComputedStyle(t);e.style.font=n.font,e.style.fontSize=n.fontSize,e.style.fontWeight=n.fontWeight,e.style.fontFamily=n.fontFamily,e.style.letterSpacing=n.letterSpacing,e.style.padding=n.padding,e.textContent=t.textContent,document.body.appendChild(e);const i=e.offsetWidth;document.body.removeChild(e),C+=i}}const I=Array.from(g.children);let H=1;for(let t=0;I.length>t;t++){const e=I[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&&(C+=(e.offsetWidth||0)+(parseFloat(n.marginLeft)||0)+(parseFloat(n.marginRight)||0),H++)}R>0&&H>1&&(C+=R*(H-1));let M=0;const k=s&&s.type&&$.includes(s.type);if(o&&o.length>0&&!k&&"header"!==u){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 r=m.querySelector(".st-cell-content");if(r){const t=window.getComputedStyle(r);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 l=[],a=t=>(e.textContent=t,e.offsetWidth+n+i),d=((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)})(o.length,v,w);for(const r of d){const d=o[r];let c;c=(null==s?void 0:s.valueGetter)?s.valueGetter({accessor:t,row:d,rowIndex:r}):X(d,t);let h=c;(null==s?void 0:s.valueFormatter)&&null!=c&&(h=s.valueFormatter({accessor:t,colIndex:0,row:d,rowIndex:r,value:c}));let u=-1;if(null==s?void 0:s.cellRenderer)try{const o=s.cellRenderer({accessor:t,colIndex:0,row:d,rowIndex:r,theme:p,value:c,formattedValue:h});if("string"==typeof o||"number"==typeof o)u=a(o+"");else if(o instanceof Node){e.textContent="",e.appendChild(o);const t=e.offsetWidth+n+i;e.textContent="",u=t>n+i?t:-1}}catch(t){u=-1}0>u&&(u=a(null!=h?h+"":"")),l.push(u)}document.body.removeChild(e),m.querySelectorAll(`[id$="-${t}"] .st-cell-content`).forEach(t=>{t.scrollWidth>t.clientWidth+1&&l.push(t.scrollWidth+n+i)}),M=((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})(l,{percentile:c,threshold:h})}let E="header"===u?C:Math.max(C,M);k&&(E=Math.max(E,150));const T="number"==typeof(null==s?void 0:s.maxWidth)?s.maxWidth:"string"==typeof(null==s?void 0:s.maxWidth)&&parseFloat(s.maxWidth+"")||void 0,A=null!=T?T:r;return E>A&&(E=A),Math.max(E+2,"number"==typeof(null==s?void 0:s.minWidth)?s.minWidth:"string"==typeof(null==s?void 0:s.minWidth)&&parseFloat(s.minWidth+"")||L,L)};class xt{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 bt=(t,e)=>e>=t.reduce((t,e)=>t+wt(e),0),yt=(t,e)=>{const n=new Map,i=t.reduce((t,e)=>t+("number"==typeof e.width?e.width:"string"==typeof e.width&&e.width.endsWith("px")?parseFloat(e.width):150),0);if(0===i)return n;const o=e/i;if(o>=1&&.01>o-1)return n;let s=0;return t.forEach((i,r)=>{const l="number"==typeof i.width?i.width:"string"==typeof i.width&&i.width.endsWith("px")?parseFloat(i.width):150;let a;r===t.length-1?a=e-s:(a=Math.round(l*o),s+=a),n.set(i.accessor,a)}),n},Rt=(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=mt(d,l),p=mt(c,l),f=mt(h,l),v=u.length>0&&bt(u,o),w=p.length>0&&bt(p,s),m=f.length>0&&a>0&&bt(f,a),g=new Map;if(v&&yt(u,o).forEach((t,e)=>g.set(e,t)),w&&yt(p,s).forEach((t,e)=>g.set(e,t)),m&&yt(f,a).forEach((t,e)=>g.set(e,t)),0===g.size)return t;const x=(t,e)=>{var n;if(t.hide)return t;const i=null!=e?e:t.pinned,o=null===(n=t.children)||void 0===n?void 0:n.map(t=>x(t,i)),s=g.get(t.accessor);return Object.assign(Object.assign({},t),void 0!==s?{width:s,children:o}:{children:o})};return t.map(t=>x(t,t.pinned))};class Ct{constructor(t,e){var n;this.config=t,this.onHeadersUpdate=e,this.isResizingTracker=new xt(null!==(n=t.isResizing)&&void 0!==n&&n),this.containerWidthTracker=new xt(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 Rt(t,this.config)}setHeaders(t,e){const n="function"==typeof t?t(e):t;return this.applyAutoScale(n)}destroy(){this.onHeadersUpdate=()=>{}}}const St=(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|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}if(i.endsWith("vh")){const t=parseFloat(i);return Number.isFinite(t)?window.innerHeight*t/100:null}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 o=+i;return Number.isFinite(o)?o: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);if(i.endsWith("vh"))return window.innerHeight*parseInt(i,10)/100;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 It{constructor(t){this.subscribers=new Set,this.resizeObserver=null,this.rafId=null,this.initialNotifyPending=!1,this.config=t;const e=this.calculateMaxHeaderDepth(),n=this.calculateHeaderHeight(e),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 St(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}observeContainer(t){this.resizeObserver=new ResizeObserver(()=>{null!==this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=requestAnimationFrame(()=>{this.rafId=null;const e=t.clientWidth,n=e!==this.state.containerWidth;n&&(this.state=Object.assign(Object.assign({},this.state),{containerWidth:e})),(n||this.initialNotifyPending)&&(this.initialNotifyPending=!1,this.notifySubscribers())})}),this.resizeObserver.observe(t),this.applyContainerWidthSync(t)}applyContainerWidthSync(t){const e=t.clientWidth;e>0&&e!==this.state.containerWidth&&(this.state=Object.assign(Object.assign({},this.state),{containerWidth:e}),this.initialNotifyPending=!0)}updateConfig(t){const e=this.config.effectiveHeaders,n=this.config.containerElement;this.config=Object.assign(Object.assign({},this.config),t);let 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.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.subscribers.clear()}}class Ht{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 Mt{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 kt={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)=>kt.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?kt.string(t,e,n):"number"==typeof t&&"number"==typeof e?kt.number(t,e,n):"boolean"==typeof t&&"boolean"==typeof e?kt.boolean(t,e,n):kt.string(t+"",e+"",n)},Et=({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=X(e,l),a=X(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 kt.number(o,s,i)}return"date"===n?kt.date(t+"",e+"",i):"boolean"===n?kt.boolean(!!t,!!e,i):"enum"===n?kt.enum(t+"",e+"",i):kt.string(t+"",e+"",i)})(i,a,s,r)})})({rows:e,sortColumn:n,headers:t}),Tt=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=>N(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&&Z(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&&Z(n))s(n);else{const n=X(t,e);null!=n&&o.push(n)}})};if(s(t),0===o.length)return;if("custom"===n.type&&n.customFn)return n.customFn(o);const r=n.parseValue?o.map(n.parseValue).filter(t=>!isNaN(t)):o.map(t=>"number"==typeof t?t:"string"==typeof t?parseFloat(t):NaN).filter(t=>!isNaN(t));if(0===r.length)return"count"===n.type?o.length:void 0;let l;switch(n.type){case"sum":l=r.reduce((t,e)=>t+e,0);break;case"average":l=r.reduce((t,e)=>t+e,0)/r.length;break;case"count":l=o.length;break;case"min":l=Math.min(...r);break;case"max":l=Math.max(...r);break;default:return}return n.formatResult?n.formatResult(l):l})(i,t.accessor,t.aggregation,o);void 0!==e&&Q(a,t.accessor,e)}),a}return t});return l(r)};class At{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=N(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=Et({headers:e,rows:n,sortColumn:i});return t&&0!==t.length?o.map(n=>{const o=t[0],s=n[o];if(Z(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=Tt({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}):Et({headers:this.config.headers,rows:n,sortColumn:e}):n}updateConfig(t){const e=this.config.headers;this.config=Object.assign(Object.assign({},this.config),t),t.headers&&t.headers!==e&&this.updateHeaderLookup();const n=this.computeSortedRows(this.config.tableRows,this.state.sort);n!==this.state.sortedRows&&(this.state=Object.assign(Object.assign({},this.state),{sortedRows:n}),this.notifySubscribers())}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}notifySubscribers(){this.subscribers.forEach(t=>t(this.state))}updateSort(t){var e,n,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 Wt=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)},Ot=t=>new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0),Pt=t=>{if(!t)return new Date;if("string"==typeof t)return Wt(t);if("number"==typeof t){const e=new Date(t);return isNaN(e.getTime())?new Date:Ot(e)}return t instanceof Date?Ot(t):new Date};class $t{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=N(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=Pt(t),s=Pt((i||"")+""),r=Ot(e),l=Ot(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=>Ot(Pt((t||"")+"")));return r>=t&&e>=r}return!1;case"notBetween":if(o&&2===o.length){const[t,e]=o.map(t=>Ot(Pt((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}})(X(t,e.accessor),e)}catch(t){return console.warn(`Filter error for accessor ${e.accessor}:`,t),!0}})):t}updateConfig(t){const e=this.config.headers;this.config=Object.assign(Object.assign({},this.config),t),t.headers&&t.headers!==e&&this.updateHeaderLookup();const n=this.computeFilteredRows(this.config.rows,this.state.filters);n!==this.state.filteredRows&&(this.state=Object.assign(Object.assign({},this.state),{filteredRows:n}),this.notifySubscribers())}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}notifySubscribers(){this.subscribers.forEach(t=>t(this.state))}updateFilter(t){var e,n;const 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 Ft=(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},Lt=(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},Dt=({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,p=Math.max(0,Math.ceil(i/l)),f=Math.min(o.length,Math.floor(u/l)),v=i+e,w=Math.max(0,Math.floor(i/l)),m=Math.min(o.length,Math.ceil(v/l));return{rendered:{startIndex:c,endIndex:h,rows:o.slice(c,h)},fullyVisible:{startIndex:p,endIndex:f,rows:o.slice(p,f)},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,p=Ft(Math.max(0,i-c),r);let f=Ft(u,r)+1;f=Math.min(o.length,f);const v=i,w=i+e;let m=Ft(v,r);v>a[m]&&(m=Math.min(m+1,o.length));let g=Ft(w,r);g=Math.min(o.length,g);const x=i+e,b=Ft(i,r);let y=Ft(x,r)+1;return y=Math.min(o.length,y),{rendered:{startIndex:p,endIndex:f,rows:o.slice(p,f)},fullyVisible:{startIndex:m,endIndex:g,rows:o.slice(m,g)},partiallyVisible:{startIndex:b,endIndex:y,rows:o.slice(b,y)}}},Bt=({position:t,rowHeight:e,heightOffsets:n,customTheme:i})=>t*(e+i.rowSeparatorWidth)-i.rowSeparatorWidth+Lt(t,n),jt=({position:t,rowHeight:e,heightOffsets:n,customTheme:i})=>t*(e+i.rowSeparatorWidth)+Lt(t,n),zt=(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},Nt=new Map,qt=(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,p=null!==(c=null===(d=e[e.length-1])||void 0===d?void 0:d.position)&&void 0!==c?c:-1,f=`${h}:${u}:${p}:${o.join(",")}`,v=Nt.get(f);if(v&&v.firstVisiblePosition===h&&v.renderedStartPosition===u&&v.renderedEndPosition===p)return v.result;const w=Vt({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:i,partiallyVisibleRowIndex:0,recursionDepth:0,stickyParents:[],rowGrouping:o});if(Nt.set(f,{result:w,firstVisiblePosition:h,renderedStartPosition:u,renderedEndPosition:p}),Nt.size>50){const t=Nt.keys().next().value;void 0!==t&&Nt.delete(t)}return w},Vt=({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=>et(t.rowId)===et(i.rowId))||(r.push(i),d++)}}if(r.length>0){zt(a,t)&&(r.push(a),d++);const e=i[o+=d];e&&(a=e)}}else if(zt(a,t))return r.push(a),o++,Vt({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:i,partiallyVisibleRowIndex:o,recursionDepth:s+1,stickyParents:r,rowGrouping:l});return zt(a,t)?Vt({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:i,partiallyVisibleRowIndex:o,recursionDepth:s+1,stickyParents:r,rowGrouping:l}):{stickyParents:r,regularRows:e}},Gt=(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)}},Kt=(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=>et(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=Dt({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 Gt(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&&Gt(e,o,s)},100);Gt(d,o,s)},Ut=({rowIndex:t,colIndex:e,rowId:n})=>`${t}-${e}-${n}`;function Jt(t,e,n,i){const o=new Set,s=new Map;n.forEach((t,e)=>{const n=et(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),p=Math.max(t.colIndex,e.colIndex);for(let t=c;h>=t;t++)for(let e=u;p>=e;e++)if(t>=0&&n.length>t){if(i&&0===e)continue;const s=et(n[t].rowId);o.add(Ut({colIndex:e,rowIndex:t,rowId:s}))}return o}function _t(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 p=[];u.forEach((t,e)=>{const n=t[0].getBoundingClientRect();p.push({key:e,top:n.top,bottom:n.bottom})}),p.sort((t,e)=>t.top-e.top);let f=null,v=1/0;for(let t=0;p.length>t;t++){const{key:e,top:n,bottom:i}=p[t];if(c>=n&&i>=c){f=e,v=0;break}const o=Math.abs(c-(n+i)/2);v>o&&(v=o,f=e)}if(null===f)return null;const w=u.get(f);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 Yt{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=>dt(t,this.config.collapsedHeaders)),this.rowIdToTableIndex.clear(),this.config.tableRows.forEach((t,e)=>{this.rowIdToTableIndex.set(et(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(et(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(`${et(e.rowId)}\t${t}`),this.rowsWithSelectedCells.add(et(e.rowId))})})}updateRowIdAndSelectionLookupOnly(){this.rowIdToTableIndex.clear(),this.config.tableRows.forEach((t,e)=>{this.rowIdToTableIndex.set(et(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(`${et(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?et(o.rowId):null)!==i){const t=this.config.tableRows.findIndex(t=>et(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=et(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=et(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=et(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=et(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=et(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=et(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=et(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=et(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=et(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=et(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=et(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=et(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=et(this.config.tableRows[i].rowId);this.selectCellRange(this.startCell,{rowIndex:i,colIndex:n,rowId:t})}else{const t=et(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=et(this.config.tableRows[i].rowId);this.selectCellRange(this.startCell,{rowIndex:i,colIndex:n,rowId:t})}else{const t=et(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=>!t.hide&&!t.excludeFromRender),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=X(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=>!t.hide&&!t.excludeFromRender),c=i.findIndex(t=>et(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,p=u+n;if(c>=i.length||p>=d.length)return;const f=i[c],v=d[p],w=et(f.rowId);if(!(null==v?void 0:v.isEditable))return void l.add(`${c}-${p}-${w}`);let m=t;if("number"===v.type){const e=+t;isNaN(e)||(m=e)}else if("boolean"===v.type)m="true"===t.toLowerCase()||"1"===t;else if("date"===v.type){const e=new Date(t);isNaN(e.getTime())||(m=e)}else"lineAreaChart"!==v.type&&"barChart"!==v.type||(m=t.split(",").map(t=>{const e=+t.trim();return isNaN(e)?0:e}));if(Q(f.row,v.accessor,m),s){const t=`${null!==(a=f.stableRowKey)&&void 0!==a?a:w}-${v.accessor}`,e=s.get(t);e&&e.updateContent(m)}null==o||o({accessor:v.accessor,newValue:m,row:f.row,rowIndex:c}),r.add(`${c}-${p}-${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=>!t.hide&&!t.excludeFromRender),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=et(c.rowId);if(!(null==h?void 0:h.isEditable))return void r.add(t);let p=null;if(p="string"===h.type?"":"number"===h.type?null:"boolean"!==h.type&&("date"===h.type?null:"lineAreaChart"===h.type||"barChart"===h.type||Array.isArray(X(c.row,h.accessor))?[]:""),Q(c.row,h.accessor,p),o){const t=`${null!==(e=c.stableRowKey)&&void 0!==e?e:u}-${h.accessor}`,n=o.get(t);n&&n.updateContent(p)}null==i||i({accessor:h.accessor,newValue:p,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=et(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=Ut({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 N(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 Yt.HEADER_SELECTION_CLASSES)i.classList.remove(t);continue}if(l.isSelectionColumn&&this.config.enableRowSelection){for(const t of Yt.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 Yt.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 Yt.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 Yt.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 p=c?"0":"-1";if(n.getAttribute("tabindex")!==p&&n.setAttribute("tabindex",p),c&&document.activeElement!==n){const t=document.activeElement;t&&n.contains(t)||n.focus({preventScroll:!0})}}this.syncHeaderSelectionClasses()}else{for(let t=0;e.length>t;t++){const n=e[t];if(n instanceof HTMLElement){for(const t of Yt.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=Ut({rowIndex:o,colIndex:t,rowId:i});if(this.selectedCells.has(e))return!0}const s=Ut({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?et(r.rowId):null,a=this.config.tableRows[o+1],d=a?et(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}),p=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"),p||s.push("st-selected-right-border"),s.join(" ")}isInitialFocusedCell({colIndex:t,rowId:e}){return!!this.initialFocusedCell&&t===this.initialFocusedCell.colIndex&&e+""==this.initialFocusedCell.rowId+""}isCopyFlashing({colIndex:t,rowIndex:e,rowId:n}){const i=Ut({colIndex:t,rowIndex:e,rowId:n});return this.copyFlashCells.has(i)}isWarningFlashing({colIndex:t,rowIndex:e,rowId:n}){const i=Ut({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=Ut(t);this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.selectedCells=new Set([e]),this.initialFocusedCell=t,this.updateDerivedState(),this.updateAllCellClasses(),setTimeout(()=>Kt(t,this.config.rowHeight,this.config.customTheme,this.config.tableRows),0)}}selectCellRange(t,e){this.fullTableSelected=!1;const n=Jt(t,e,this.config.tableRows,!!this.config.enableRowSelection);this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.selectedCells=n,this.initialFocusedCell=e,this.updateDerivedState(),this.updateAllCellClasses(),setTimeout(()=>Kt(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=Jt(t,e,this.config.tableRows,!!this.config.enableRowSelection);this.selectedCells.size===n.size&&Array.from(n).every(t=>this.selectedCells.has(t))||(this.selectedCells=n,this.updateDerivedState(),this.updateAllCellClasses())}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 _t(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 _t(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}){this.config.selectableCells&&(this.fullTableSelected=!1,this.isSelecting=!0,this.startCell={rowIndex:e,colIndex:t,rowId:n},setTimeout(()=>{this.selectedColumns=new Set,this.lastSelectedColumnIndex=null;const i=Ut({colIndex:t,rowIndex:e,rowId:n});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)}}}Yt.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"],Yt.HEADER_SELECTION_CLASSES=["st-header-selected","st-header-has-highlighted-cell"];const Xt=(t,e)=>t.filter(t=>!(!t||!t.rowId)&&e.has(et(t.rowId))).map(t=>t.row);class Qt{constructor(t){this.subscribers=new Set,this.config=t,this.state={selectedRows:new Set,selectedRowCount:0,selectedRowsData:[]}}updateConfig(t){this.config=Object.assign(Object.assign({},this.config),t),t.tableRows&&this.updateDerivedState()}updateDerivedState(){var t;this.state=Object.assign(Object.assign({},this.state),{selectedRowCount:(t=this.state.selectedRows,t.size),selectedRowsData:Xt(this.config.tableRows,this.state.selectedRows)})}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}notifySubscribers(){this.subscribers.forEach(t=>t(this.state))}isRowSelected(t){return!!this.config.enableRowSelection&&(t=>this.state.selectedRows.has(t))(t)}areAllRowsSelected(){return!!this.config.enableRowSelection&&(e=this.state.selectedRows,0!==(t=this.config.tableRows).length&&t.filter(t=>t&&t.rowId).every(t=>e.has(et(t.rowId))));var t,e}getSelectedRows(){return this.state.selectedRows}getSelectedRowCount(){return this.state.selectedRowCount}getSelectedRowsData(){return this.state.selectedRowsData}setSelectedRows(t){this.state=Object.assign(Object.assign({},this.state),{selectedRows:t}),this.updateDerivedState(),this.notifySubscribers()}handleRowSelect(t,e){if(!this.config.enableRowSelection)return;const n=(t=>{const e=new Set(this.state.selectedRows);return e.has(t)?e.delete(t):e.add(t),e})(t);if(this.state=Object.assign(Object.assign({},this.state),{selectedRows:n}),this.updateDerivedState(),this.config.onRowSelectionChange){const i=this.config.tableRows.find(e=>et(e.rowId)===t);i&&this.config.onRowSelectionChange({row:i.row,isSelected:e,selectedRows:n})}this.notifySubscribers()}handleSelectAll(t){if(!this.config.enableRowSelection)return;let e;t?(e=new Set(this.config.tableRows.filter(t=>t&&t.rowId).map(t=>et(t.rowId))),this.config.onRowSelectionChange&&this.config.tableRows.forEach(t=>this.config.onRowSelectionChange({row:t.row,isSelected:!0,selectedRows:e}))):(e=new Set,this.config.onRowSelectionChange&&this.state.selectedRows.forEach(t=>{const n=this.config.tableRows.find(e=>et(e.rowId)===t);n&&this.config.onRowSelectionChange({row:n.row,isSelected:!1,selectedRows:e})})),this.state=Object.assign(Object.assign({},this.state),{selectedRows:e}),this.updateDerivedState(),this.notifySubscribers()}handleToggleRow(t){if(!this.config.enableRowSelection)return;const e=this.isRowSelected(t);this.handleRowSelect(t,!e)}clearSelection(){if(this.config.enableRowSelection){if(this.config.onRowSelectionChange){const t=new Set;this.state.selectedRows.forEach(e=>{const n=this.config.tableRows.find(t=>et(t.rowId)===e);n&&this.config.onRowSelectionChange({row:n.row,isSelected:!1,selectedRows:t})})}this.state=Object.assign(Object.assign({},this.state),{selectedRows:new Set}),this.updateDerivedState(),this.notifySubscribers()}}getState(){return this.state}destroy(){this.subscribers.clear()}}class Zt{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 te{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 ee{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 ne=(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 ie{constructor(t,e){this.observers=new Set,this.expandedDepths=ne(t,e)}updateRowGrouping(t){if(!t||0===t.length)return void this.setExpandedDepths(new Set);const e=t.length,n=Array.from(this.expandedDepths).filter(t=>e>t);this.setExpandedDepths(new Set(n))}getExpandedDepths(){return this.expandedDepths}setExpandedDepths(t){this.expandedDepths=t,this.notifyObservers()}subscribe(t){return this.observers.add(t),()=>{this.observers.delete(t)}}notifyObservers(){this.observers.forEach(t=>t(this.expandedDepths))}expandAll(){const t=new Set;for(let e=0;10>e;e++)t.add(e);this.setExpandedDepths(t)}collapseAll(){this.setExpandedDepths(new Set)}expandDepth(t){const e=new Set(this.expandedDepths);e.add(t),this.setExpandedDepths(e)}collapseDepth(t){const e=new Set(this.expandedDepths);e.delete(t),this.setExpandedDepths(e)}toggleDepth(t){this.expandedDepths.has(t)?this.collapseDepth(t):this.expandDepth(t)}destroy(){this.observers.clear()}}class oe{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 se(t){return t?t.offsetWidth-t.clientWidth:0}const re=(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 l=e=>{const n=e.target;o.contains(n)||t.contains(n)||c()},a=t=>{"Escape"===t.key&&(t.preventDefault(),c())},d=t=>{o.contains(t.target)||c()},c=()=>{o.remove(),document.removeEventListener("mousedown",l,!0),document.removeEventListener("keydown",a,!0),window.removeEventListener("scroll",d,!0),n.onClose()};return setTimeout(()=>{document.addEventListener("mousedown",l,!0),document.addEventListener("keydown",a,!0),window.addEventListener("scroll",d,!0)},0),r(o,"mousedown",t=>{t.stopPropagation()}),o},le=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("width","24"),e.setAttribute("height","24"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"),n.setAttribute("fill","inherit"),e.appendChild(n),e},ae=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("width","24"),e.setAttribute("height","24"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z"),n.setAttribute("fill","inherit"),e.appendChild(n),e},de=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false"),e.setAttribute("role","img"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("viewBox","0 0 320 512"),e.setAttribute("height","1em"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M298 177.5c3.8-8.8 2-19-4.6-26l-116-144C172.9 2.7 166.6 0 160 0s-12.9 2.7-17.4 7.5l-116 144c-6.6 7-8.4 17.2-4.6 26S34.4 192 44 192l72 0 0 288c0 17.7 14.3 32 32 32l24 0c17.7 0 32-14.3 32-32l0-288 72 0c9.6 0 18.2-5.7 22-14.5z"),n.setAttribute("fill","inherit"),e.appendChild(n),e},ce=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false"),e.setAttribute("role","img"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("viewBox","0 0 320 512"),e.setAttribute("height","1em"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M22 334.5c-3.8 8.8-2 19 4.6 26l116 144c4.5 4.8 10.8 7.5 17.4 7.5s12.9-2.7 17.4-7.5l116-144c6.6-7 8.4-17.2 4.6-26s-12.5-14.5-22-14.5l-72 0 0-288c0-17.7-14.3-32-32-32L148 0C130.3 0 116 14.3 116 32l0 288-72 0c-9.6 0-18.2 5.7-22 14.5z"),n.setAttribute("fill","inherit"),e.appendChild(n),e},he=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");return e.setAttribute("aria-hidden","true"),e.setAttribute("role","img"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("viewBox","0 0 16 10"),e.setAttribute("width","16px"),e.setAttribute("height","10px"),t&&e.setAttribute("class",t),[{cx:"3",cy:"3"},{cx:"8",cy:"3"},{cx:"13",cy:"3"},{cx:"3",cy:"7"},{cx:"8",cy:"7"},{cx:"13",cy:"7"}].forEach(({cx:t,cy:n})=>{const 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},ue=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("aria-hidden","true"),e.setAttribute("role","img"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("viewBox","0 0 512 512"),e.setAttribute("height","1em"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M3.9 54.9C10.5 40.9 24.5 32 40 32l432 0c15.5 0 29.5 8.9 36.1 22.9s4.6 30.5-5.2 42.5L320 320.9 320 448c0 12.1-6.8 23.2-17.7 28.6s-23.8 4.3-33.5-3l-64-48c-8.1-6-12.8-15.5-12.8-25.6l0-79.1L9 97.3C-.7 85.4-2.8 68.8 3.9 54.9z"),n.setAttribute("fill","inherit"),e.appendChild(n),e},pe=(t,e)=>new Date(t,e+1,0).getDate(),fe=["January","February","March","April","May","June","July","August","September","October","November","December"],ve=["Su","Mo","Tu","We","Th","Fr","Sa"],we=(t,e,n)=>{const{header:i,row:o}=t,s=X(o,i.accessor);return"boolean"===i.type?((t,e,n,i)=>{var o;const{header:s,row:l,rowIndex:a}=t;let d;const c=document.createElement("div");c.className="st-dropdown-item "+(!0===n?"selected":""),c.textContent="True",c.setAttribute("role","option"),c.setAttribute("aria-selected",(!0===n)+""),c.setAttribute("aria-disabled","false");const h=document.createElement("div");h.className="st-dropdown-item "+(!1===n?"selected":""),h.textContent="False",h.setAttribute("role","option"),h.setAttribute("aria-selected",(!1===n)+""),h.setAttribute("aria-disabled","false");const u=t=>{Q(l,s.accessor,t),e.onCellEdit&&e.onCellEdit({accessor:s.accessor,newValue:t,row:l,rowIndex:a}),d.remove(),i()};r(c,"click",()=>u(!0)),r(h,"click",()=>u(!1));const p=t=>{const e=t;"ArrowDown"===e.key||"ArrowUp"===e.key?(e.preventDefault(),document.activeElement===c?h.focus():c.focus()):"Enter"===e.key&&(e.preventDefault(),document.activeElement===c?u(!0):document.activeElement===h&&u(!1))};c.setAttribute("tabindex","0"),h.setAttribute("tabindex","0"),r(c,"keydown",p),r(h,"keydown",p);const f=document.createDocumentFragment();f.appendChild(c),f.appendChild(h);const v=J({accessor:s.accessor,rowId:null!==(o=t.stableRowKey)&&void 0!==o?o:t.rowId}),w=document.getElementById(v);return d=re(w||document.body,f,{width:120,positioning:"fixed",onClose:i}),d})(t,e,!!s,n):"enum"===i.type?((t,e,n,i)=>{var o;const{header:s,row:l,rowIndex:a}=t,d=s.enumOptions||[];let c;const h=t=>{Q(l,s.accessor,t),e.onCellEdit&&e.onCellEdit({accessor:s.accessor,newValue:t,row:l,rowIndex:a}),c.remove(),i()},u=[];d.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,r(i,"click",()=>h(t.value)),u.push(i)});const p=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&&h(t)}};u.forEach(t=>{r(t,"keydown",p)});const f=document.createElement("div");f.className="st-enum-dropdown-content",u.forEach(t=>f.appendChild(t));const v=J({accessor:s.accessor,rowId:null!==(o=t.stableRowKey)&&void 0!==o?o:t.rowId}),w=document.getElementById(v);return c=re(w||document.body,f,{width:150,maxHeight:300,positioning:"fixed",onClose:i}),setTimeout(()=>{const t=d.findIndex(t=>t.value===n);t>=0&&u[t]?(u[t].focus(),u[t].scrollIntoView({block:"nearest"})):u.length>0&&u[0].focus()},0),c})(t,e,(s||"")+"",n):"date"===i.type?((t,e,n,i)=>{var o,s,l;const{header:a,row:d,rowIndex:c}=t;let h,u;try{u=n?Wt(n+""):new Date}catch(t){u=new Date}let p=u.getFullYear(),f=u.getMonth();const v=document.createElement("div");v.className="st-datepicker";const w=document.createElement("div");w.className="st-datepicker-header";const m=document.createElement("button");m.className="st-datepicker-nav-btn",m.setAttribute("aria-label","Previous month");const g=null!==(o=e.icons.prev)&&void 0!==o?o:le("st-next-prev-icon");"string"==typeof g?m.innerHTML=g:m.appendChild(g.cloneNode(!0));const x=document.createElement("div");x.className="st-datepicker-header-label",x.setAttribute("aria-hidden","true");const b=document.createElement("button");b.className="st-datepicker-nav-btn",b.setAttribute("aria-label","Next month");const y=null!==(s=e.icons.next)&&void 0!==s?s:ae("st-next-prev-icon");"string"==typeof y?b.innerHTML=y:b.appendChild(y.cloneNode(!0)),w.appendChild(m),w.appendChild(x),w.appendChild(b);const R=document.createElement("div");R.className="st-datepicker-grid st-datepicker-days-grid",ve.forEach(t=>{const e=document.createElement("div");e.className="st-datepicker-weekday",e.textContent=t,R.appendChild(e)});const C=document.createElement("div");C.className="st-datepicker-footer";const S=document.createElement("button");S.className="st-datepicker-today-btn",S.textContent="Today",r(S,"click",()=>{const t=new Date,e=new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0);I(e)}),C.appendChild(S),v.appendChild(w),v.appendChild(R),v.appendChild(C);const I=t=>{const n=t.toISOString().split("T")[0];Q(d,a.accessor,n),e.onCellEdit&&e.onCellEdit({accessor:a.accessor,newValue:n,row:d,rowIndex:c}),h.remove(),i()},H=()=>{var t,e,n;for(x.textContent=`${fe[f]} ${p}`;R.children.length>7;)null===(t=R.lastElementChild)||void 0===t||t.remove();const i=pe(p,f),o=new Date(p,f,1).getDay(),s=pe(p,f-1),l=new Date;for(let t=0;o>t;t++){const n=s-o+t+1,i=new Date(p,f-1,n),l=document.createElement("div");l.className="st-datepicker-day other-month",l.textContent=n+"",l.setAttribute("tabindex","0"),l.setAttribute("role","button"),l.setAttribute("aria-label",`${null!==(e=fe[f-1])&&void 0!==e?e:fe[11]} ${n}, ${i.getFullYear()}`),r(l,"click",()=>I(i)),r(l,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),I(i))}),R.appendChild(l)}const a=u.getFullYear()===p&&u.getMonth()===f;for(let t=1;i>=t;t++){const e=document.createElement("div");e.className="st-datepicker-day",e.textContent=t+"",e.setAttribute("tabindex","0"),e.setAttribute("role","button"),e.setAttribute("aria-label",`${fe[f]} ${t}, ${p}`),l.getFullYear()===p&&l.getMonth()===f&&l.getDate()===t&&e.classList.add("today"),a&&u.getDate()===t&&e.classList.add("selected");const n=new Date(p,f,t);r(e,"click",()=>I(n)),r(e,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),I(n))}),R.appendChild(e)}const d=o+i,c=Math.max(35,7*Math.ceil(d/7))-d;for(let t=1;c>=t;t++){const e=new Date(p,f+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",`${null!==(n=fe[f+1])&&void 0!==n?n:fe[0]} ${t}, ${e.getFullYear()}`),r(i,"click",()=>I(e)),r(i,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),I(e))}),R.appendChild(i)}};r(m,"click",()=>{f--,0>f&&(f=11,p--),H()}),r(b,"click",()=>{f++,f>11&&(f=0,p++),H()}),H();const M=J({accessor:a.accessor,rowId:null!==(l=t.stableRowKey)&&void 0!==l?l:t.rowId}),k=document.getElementById(M);return h=re(k||document.body,v,{width:240,overflow:"hidden",positioning:"fixed",onClose:i}),h})(t,e,s,n):((t,e,n,i)=>{const{header:o,row:s,rowIndex:l}=t,a=document.createElement("input");a.className="editable-cell-input","number"===o.type?(a.type="text",a.inputMode="decimal"):a.type="text",a.value=null!=n?n+"":"",a.setAttribute("autofocus","true"),setTimeout(()=>{a.focus(),a.select()},0);let d=!0;if("number"===o.type){const t=()=>{const t=a.value;/^-?\d*\.?\d*$/.test(t)||(a.value=t.slice(0,-1))};r(a,"input",t)}return r(a,"blur",t=>{if(!d)return void i();let n=a.value;if("number"===o.type){const t=parseFloat(a.value);n=isNaN(t)?0:t}Q(s,o.accessor,n),e.onCellEdit&&e.onCellEdit({accessor:o.accessor,newValue:n,row:s,rowIndex:l}),i()}),r(a,"keydown",t=>{const e=t;e.stopPropagation(),"Enter"===e.key?(d=!0,a.blur()):"Escape"===e.key&&(d=!1,a.blur())}),r(a,"mousedown",t=>{t.stopPropagation()}),a})(t,e,s,n)},me=()=>{const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("aria-hidden","true"),t.setAttribute("role","img"),t.setAttribute("xmlns","http://www.w3.org/2000/svg"),t.setAttribute("viewBox","0 0 448 512"),t.setAttribute("class","st-checkbox-checkmark"),t.style.height="10px";const e=document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttribute("d","M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"),t.appendChild(e),t},ge=(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(me()))},xe=({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(me());const r=()=>{const t=o.checked;o.setAttribute("aria-checked",""+t),t?(s.classList.add("st-checked"),s.appendChild(me())):(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(me())):(s.classList.remove("st-checked"),s.innerHTML=""))},destroy:()=>{o.removeEventListener("change",r)}}},be=new WeakMap,ye=(t,e,n)=>{var i,o;const s=t.querySelector(".st-expand-icon-container");if(!(s&&s instanceof HTMLElement))return;if(s.classList.contains("expanded")===e)return;const r=null!==(i=null==n?void 0:n.ariaLabelWhenExpanded)&&void 0!==i?i:"Collapse row",l=null!==(o=null==n?void 0:n.ariaLabelWhenCollapsed)&&void 0!==o?o:"Expand row";requestAnimationFrame(()=>{requestAnimationFrame(()=>{s.classList.toggle("expanded",e),s.classList.toggle("collapsed",!e),s.setAttribute("aria-label",e?r:l),s.setAttribute("aria-expanded",e+"")})})},Re=(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)?Pt(t).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):null==t?"":t+""},Ce=(t,e,n)=>{var i;const{header:o,row:s,rowIndex:l,colIndex:a,depth:d,rowId:c}=t,h=X(s,o.accessor),u=o.isSelectionColumn&&e.enableRowSelection;if(e.isLoading||t.tableRow.isLoadingSkeleton){const t=document.createElement("div");return t.className="st-loading-skeleton",void n.appendChild(t)}if(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(c+""),r=((t,e,n)=>xe({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 p=e.rowGrouping&&e.rowGrouping[d],f=!!p&<(s,p),v=e.rowGrouping&&e.rowGrouping.length>d,w=!e.canExpandRowGroup||e.canExpandRowGroup(s);if(o.expandable&&(f&&v&&w||o.nestedTable||e.onRowGroupExpand&&v&&w)){const i=new Set(e.expandedDepths),o=st(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;n.stopPropagation();const s=i.closest("[data-row-id]"),r=s?be.get(s):void 0,l=null!==(o=null==r?void 0:r.tableRow)&&void 0!==o?o:t.tableRow,a=st(l),d=l.depth,c=new Set(e.expandedDepths),h=e.getExpandedRows?e.getExpandedRows():e.expandedRows,u=e.getCollapsedRows?e.getCollapsedRows():e.collapsedRows,p=at(a,d,c,h,u),f=!p;if(p?(e.setCollapsedRows(t=>{const e=new Map(t);return e.set(a,d),e}),e.setExpandedRows(t=>{const e=new Map(t);return e.delete(a),e}),e.setRowStateMap(t=>{const e=new Map(t);return e.delete(a),e})):(e.setExpandedRows(t=>{const e=new Map(t);return e.set(a,d),e}),e.setCollapsedRows(t=>{const e=new Map(t);return e.delete(a),e})),e.onRowGroupExpand&&t.tableRow.rowIndexPath&&e.rowGrouping){const n=t.header.pinned,i=t=>{setTimeout(()=>{e.setRowStateMap(e=>{const i=new Map(e),o=i.get(a)||{};return i.set(a,Object.assign(Object.assign({},o),{loading:t,triggerSection:n})),i})},0)},o=t=>{e.setRowStateMap(e=>{const i=new Map(e),o=i.get(a)||{};return i.set(a,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(a)||{};return i.set(a,Object.assign(Object.assign({},o),{isEmpty:t,loading:!1,triggerSection:n})),i})};e.onRowGroupExpand({row:t.row,depth:d,event:{stopPropagation:()=>{},preventDefault:()=>{}},groupingKey:e.rowGrouping[d],isExpanded:f,rowIndexPath:t.tableRow.rowIndexPath,rowIdPath:t.tableRow.rowPath,groupingKeys:e.rowGrouping,setLoading:i,setError:o,setEmpty:s})}};return r(i,"click",s),r(i,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),s(t))}),i})(t,e,at(o,d,i,e.expandedRows,e.collapsedRows));n.appendChild(s)}if("lineAreaChart"===o.type&&Array.isArray(h)){const t=h.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=void 0!==d?d:Math.min(...e),u=(void 0!==c?c:Math.max(...e))-h||1,p=i,f=document.createElementNS("http://www.w3.org/2000/svg","svg");f.setAttribute("width",n+""),f.setAttribute("height",i+""),f.setAttribute("viewBox","0 0 100 "+p),f.setAttribute("preserveAspectRatio","none"),f.setAttribute("class",("st-line-area-chart "+a).trim()),f.setAttribute("shape-rendering","geometricPrecision"),f.style.display="block";const v=()=>{f.innerHTML="";const t=e.map((t,n)=>({x:n/(e.length-1)*100,y:p-(t-h)/u*p})).map((t,e)=>`${0===e?"M":"L"} ${t.x},${t.y}`).join(" "),n=`\n ${t}\n L 100,${p}\n L 0,${p}\n Z\n `,i=document.createElementNS("http://www.w3.org/2000/svg","path");i.setAttribute("d",n),i.setAttribute("fill",s||"var(--st-chart-fill-color)"),i.setAttribute("fill-opacity",r+""),i.setAttribute("stroke","none");const a=document.createElementNS("http://www.w3.org/2000/svg","path");a.setAttribute("d",t),a.setAttribute("fill","none"),a.setAttribute("stroke",o||"var(--st-chart-color)"),a.setAttribute("stroke-width",l+""),a.setAttribute("stroke-linecap","round"),a.setAttribute("stroke-linejoin","round"),f.appendChild(i),f.appendChild(a)};return v(),{element:f,update:t=>{void 0===t.data||(e=t.data,e&&0!==e.length)?(void 0!==t.width&&(n=t.width,f.setAttribute("width",n+"")),void 0!==t.height&&(i=t.height,f.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,f.setAttribute("class",("st-line-area-chart "+a).trim())),void 0!==t.min&&(d=t.min),void 0!==t.max&&(c=t.max),v()):f.innerHTML=""},destroy:()=>{f.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(h)){const t=h.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=void 0!==l?l:Math.min(...e),c=void 0!==a?a:Math.max(...e),h=c-d||1,u=i,p=(100-s*(e.length-1))/e.length,f=0>d,v=f?u*(c/h):u,w=document.createElementNS("http://www.w3.org/2000/svg","svg");w.setAttribute("width",n+""),w.setAttribute("height",i+""),w.setAttribute("viewBox","0 0 100 "+u),w.setAttribute("preserveAspectRatio","none"),w.setAttribute("class",("st-bar-chart "+r).trim()),w.setAttribute("shape-rendering","crispEdges"),w.style.display="block";const m=()=>{w.innerHTML="",e.forEach((t,e)=>{const n=e*(p+s),i=(t-d)/h*u;let r=u-i,l=i;f&&(0>t?(l=Math.abs(t)/h*u,r=v):(l=t/h*u,r=v-l));const a=document.createElementNS("http://www.w3.org/2000/svg","rect");a.setAttribute("x",n+""),a.setAttribute("y",r+""),a.setAttribute("width",p+""),a.setAttribute("height",l+""),a.setAttribute("fill",o||"var(--st-chart-color)"),a.setAttribute("rx","0.5"),w.appendChild(a)})};return m(),{element:w,update:t=>{void 0===t.data||(e=t.data,e&&0!==e.length)?(void 0!==t.width&&(n=t.width,w.setAttribute("width",n+"")),void 0!==t.height&&(i=t.height,w.setAttribute("height",i+"")),void 0!==t.color&&(o=t.color),void 0!==t.gap&&(s=t.gap),void 0!==t.className&&(r=t.className,w.setAttribute("class",("st-bar-chart "+r).trim())),void 0!==t.min&&(l=t.min),void 0!==t.max&&(a=t.max),m()):w.innerHTML=""},destroy:()=>{w.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 r=o.cellRenderer({accessor:o.accessor,colIndex:a,row:s,rowIndex:t.tableRow.absoluteRowIndex||l,rowPath:t.tableRow.rowPath,theme:e.theme,value:h,formattedValue:null===(i=o.valueFormatter)||void 0===i?void 0:i.call(o,{accessor:o.accessor,colIndex:a,row:s,rowIndex:l,value:h})});if("string"==typeof r||"number"==typeof r){const t=document.createTextNode(r+"");n.appendChild(t)}else if(r instanceof Node)n.appendChild(r);else if(null!=r&&"object"==typeof r){const t=Re(h,o,a,s,l);if(null!==t){const e=document.createTextNode(t);n.appendChild(e)}}}catch(t){console.error("Error rendering cell:",t);const e=Re(h,o,a,s,l);if(null!==e){const t=document.createTextNode(e);n.appendChild(t)}}return}const m=Re(h,o,a,s,l);if(null!==m){const t=document.createTextNode(m);n.appendChild(t)}},Se=new Map,Ie=new WeakMap,He=new WeakMap;let Me=null;const ke=(t,e)=>{Se.has(t)||Se.set(t,new Set),Se.get(t).add(e)},Ee=(t,e)=>{const n=Se.get(t);n&&(n.delete(e),0===n.size&&Se.delete(t))},Te=(t,e)=>{const n=Se.get(t);n&&n.forEach(t=>{e?t.classList.add("st-row-hovered"):t.classList.remove("st-row-hovered")})},Ae=(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.isEditable)||!(!e.onCellClick||d),h={rowIndex:o,colIndex:s,rowId:r},u=e.getBorderClass(h),p=e.isSelected(h),f=e.isInitialFocusedCell(h),v=e.isCopyFlashing(h),w=e.isWarningFlashing(h),m=e.selectedColumns.has(s),g=p&&!m,x=d&&e.rowsWithSelectedCells.has(r+""),b=(()=>{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?f?"st-cell-selected-first "+u:"st-cell-selected "+u:"",m?f?"st-cell-column-selected-first":"st-cell-column-selected":"",c?"clickable":"",v?f?"st-cell-copy-flash-first":"st-cell-copy-flash":"",w?f?"st-cell-warning-flash-first":"st-cell-warning-flash":"",e.useOddColumnBackground?s%2==0?"even-column":"odd-column":"",d?"st-selection-cell":"",x?"st-selection-has-highlighted-cell":"",b?"st-last-column":"","",e.useOddEvenRowBackground?a?"st-cell-even-row":"st-cell-odd-row":"",(null===(n=e.isRowSelected)||void 0===n?void 0:n.call(e,r))?"st-cell-selected-row":""].filter(Boolean).join(" ")},We=(t,e)=>{var n,i,o;const{header:s,row:l,rowIndex:a,colIndex:d,rowId:c}=t,h=s.isSelectionColumn&&e.enableRowSelection,u={rowIndex:a,colIndex:d,rowId:c},p=e.isInitialFocusedCell(u),f=Ae(t,e),v=document.createElement("div");v.className=f,v.id=J({accessor:s.accessor,rowId:null!==(n=t.stableRowKey)&&void 0!==n?n:c}),v.setAttribute("role",void 0!==e.rowHeaderAccessor&&s.accessor===e.rowHeaderAccessor?"rowheader":"gridcell"),v.setAttribute("tabindex",p?"0":"-1");const w=null!==(i=e.maxHeaderDepth)&&void 0!==i?i:1;v.setAttribute("aria-rowindex",t.tableRow.position+w+1+""),v.setAttribute("aria-colindex",d+1+""),e.enableRowSelection&&v.setAttribute("aria-selected",(null===(o=e.isRowSelected)||void 0===o?void 0:o.call(e,c))?"true":"false"),v.setAttribute("data-row-index",a+""),v.setAttribute("data-col-index",d+""),v.setAttribute("data-row-id",c+""),v.setAttribute("data-accessor",s.accessor+""),v.style.position="absolute",v.style.left=t.left+"px",v.style.top=t.top+"px",v.style.width=t.width+"px",v.style.height=t.height+"px";let m=!1;const g="boolean"===s.type||"date"===s.type||"enum"===s.type,x=()=>{var n,i;const o=null!==(i=null===(n=be.get(v))||void 0===n?void 0:n.context)&&void 0!==i?i:e;if(m&&!g){v.innerHTML="",v.setAttribute("tabindex","-1");const e=we(t,o,()=>{m=!1,v.setAttribute("tabindex",p?"0":"-1"),x(),y()});if(e){const t=document.createElement("div");t.className="st-cell-editing",t.appendChild(e),v.appendChild(t)}}else if(m&&g)we(t,o,()=>{m=!1,x(),y()});else{v.innerHTML="";const e=document.createElement("span");e.className="st-cell-content "+("right"===s.align?"right-aligned":"center"===s.align?"center-aligned":"left-aligned"),Ce(t,o,e),v.appendChild(e)}};x(),t.header.expandable||He.set(v,{row:t.row,value:X(l,s.accessor),theme:e.theme,skeleton:!(!e.isLoading&&!t.tableRow.isLoadingSkeleton)});const b={row:l,tableRow:t.tableRow,context:e};be.set(v,b);const y=()=>{var n;if(e.cellRegistry&&!h){const i=J({accessor:s.accessor,rowId:null!==(n=t.stableRowKey)&&void 0!==n?n:c});Ie.set(v,i),e.cellRegistry.set(i,{updateContent:t=>{var n,i;if(!m){if(Q(b.row,s.accessor,t),x(),!s.expandable){const t=null!==(i=null===(n=be.get(v))||void 0===n?void 0:n.context)&&void 0!==i?i:e;He.set(v,{row:b.row,value:X(b.row,s.accessor),theme:t.theme,skeleton:!(!t.isLoading&&!b.tableRow.isLoadingSkeleton)})}e.cellUpdateFlash&&(v.classList.add(p?"st-cell-updating-first":"st-cell-updating"),setTimeout(()=>{v.classList.remove("st-cell-updating-first","st-cell-updating")},800))}}})}};if(y(),!m&&!h){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=v.getAttribute("data-row-index"))&&void 0!==n?n:"-1",10),r=parseInt(null!==(i=v.getAttribute("data-col-index"))&&void 0!==i?i:"-1",10),l=v.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=v.getAttribute("data-row-index"))&&void 0!==n?n:"-1",10),r=parseInt(null!==(i=v.getAttribute("data-col-index"))&&void 0!==i?i:"-1",10),l=v.getAttribute("data-row-id");e.handleMouseOver(0>s||0>r||null===l?u:{rowIndex:s,colIndex:r,rowId:l},o.clientX,o.clientY)};r(v,"mousedown",t),r(v,"mouseover",n)}if(r(v,"keydown",t=>{m||h||"F2"!==t.key&&"Enter"!==t.key||!s.isEditable||m||(t.preventDefault(),m=!0,x())}),r(v,"dblclick",t=>{!s.isEditable||h||m||(m=!0,x())}),e.onCellClick&&!h){const t=t=>{var n,i,o,r,c;if(t.target.closest(".st-expand-icon-container"))return;const h=null!==(i=null===(n=be.get(v))||void 0===n?void 0:n.row)&&void 0!==i?i:l,u=X(h,s.accessor),p=parseInt(null!==(o=v.getAttribute("data-row-index"))&&void 0!==o?o:a+"",10),f=parseInt(null!==(r=v.getAttribute("data-col-index"))&&void 0!==r?r:d+"",10);null===(c=e.onCellClick)||void 0===c||c.call(e,{accessor:s.accessor,colIndex:f,row:h,rowIndex:p,value:u})};r(v,"click",t)}if(e.useHoverRowBackground){const t=c+"";ke(t,v);const e=()=>{var e;const n=null!==(e=v.getAttribute("data-row-id"))&&void 0!==e?e:t;null!==Me&&Me!==n&&Te(Me,!1),Te(n,!0),Me=n},n=()=>{var e;const n=null!==(e=v.getAttribute("data-row-id"))&&void 0!==e?e:t;Te(n,!1),Me===n&&(Me=null)};r(v,"mouseenter",e),r(v,"mouseleave",n)}return v},Oe=(t,e,n)=>{var i,o;const{rowIndex:s,colIndex:r,rowId:l}=e,a={rowIndex:s,colIndex:r,rowId:l};t.className=Ae(e,n);const d=n.isInitialFocusedCell(a);t.setAttribute("tabindex",d?"0":"-1"),t.style.left=e.left+"px",t.style.top=e.top+"px";const c=t.dataset.stAccordionGrow;"horizontal"!==c&&(t.style.width=e.width+"px"),"vertical"!==c&&(t.style.height=e.height+"px"),t.setAttribute("data-row-index",s+""),t.setAttribute("data-col-index",r+"");const h=null!==(i=n.maxHeaderDepth)&&void 0!==i?i:1;t.setAttribute("aria-rowindex",e.tableRow.position+h+1+""),t.setAttribute("aria-colindex",r+1+""),n.enableRowSelection?t.setAttribute("aria-selected",(null===(o=n.isRowSelected)||void 0===o?void 0:o.call(n,l))?"true":"false"):t.hasAttribute("aria-selected")&&t.removeAttribute("aria-selected");const u=void 0!==n.rowHeaderAccessor&&e.header.accessor===n.rowHeaderAccessor?"rowheader":"gridcell";t.getAttribute("role")!==u&&t.setAttribute("role",u);const p=t.getAttribute("data-row-id"),f=l+"";p&&p!==f&&(Ee(p,t),ke(f,t)),t.setAttribute("data-row-id",f),t.setAttribute("data-accessor",e.header.accessor+"");const v=be.get(t);if(v?(v.row=e.row,v.tableRow=e.tableRow,v.context=n):be.set(t,{row:e.row,tableRow:e.tableRow,context:n}),!e.header.expandable){const i=t.querySelector(".st-cell-content");if(i){const o=He.get(t),s=X(e.row,e.header.accessor),r=!(!n.isLoading&&!e.tableRow.isLoadingSkeleton);void 0!==o&&o.row===e.row&&o.value===s&&o.theme===n.theme&&o.skeleton===r||(He.set(t,{row:e.row,value:s,theme:n.theme,skeleton:r}),i.innerHTML="",Ce(e,n,i))}}},Pe=t=>{if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map(Pe);const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=Pe(t[n]));return e},$e=(t,e)=>t.filter(t=>t.pinned===e).some(t=>!t.hide&&!t.excludeFromRender),Fe="st-accordion-animating",Le="--st-accordion-duration",De="--st-accordion-easing";function Be(t){return{pinnedLeft:t.filter(t=>"left"===t.pinned),unpinned:t.filter(t=>!t.pinned),pinnedRight:t.filter(t=>"right"===t.pinned)}}function je(t,e){return!0===t.isEssential||e.has(t.accessor+"")}function ze(t,e){let n=!1;for(const i of t){if(i.isSelectionColumn||i.excludeFromRender)continue;const t=je(i,e);if(t&&n)return!1;t||(n=!0)}return!0}function Ne(t,e){var n;const{pinnedLeft:i,unpinned:o,pinnedRight:s}=Be(t);if(!ze(i,e))return!1;if(!ze(o,e))return!1;if(!ze(s,e))return!1;for(const i of t)if((null===(n=i.children)||void 0===n?void 0:n.length)&&!qe(i.children,e))return!1;return!0}function qe(t,e){var n;if(!ze(t,e))return!1;for(const i of t)if((null===(n=i.children)||void 0===n?void 0:n.length)&&!qe(i.children,e))return!1;return!0}function Ve(t){const{pinnedLeft:e,unpinned:n,pinnedRight:i}=Be(t);return{left:e.map(t=>t.accessor),main:n.map(t=>t.accessor),right:i.map(t=>t.accessor)}}function Ge(t,e,n){return[...t.filter(t=>je(e.get(t+""),n)),...t.filter(t=>!je(e.get(t+""),n))]}function Ke(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=Ge(e.left,s,n),l=Ge(e.main,s,n),a=Ge(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 Ue(t,e,n,i){const o=e+"",s=Ve(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&&(!je(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),Ke(t,{left:r,main:l,right:a},i)):null}class Je{static resolveIcons(t){var e,n,i,o,s,r,l,a,d,c,h,u,p,f,v,w,m,g;const x={drag:he("st-drag-icon"),expand:ae("st-expand-icon"),filter:ue("st-header-icon"),headerCollapse:ae("st-header-icon"),headerExpand:le("st-header-icon"),next:ae("st-next-prev-icon"),prev:le("st-next-prev-icon"),sortDown:ce("st-header-icon"),sortUp:de("st-header-icon")};return{drag:null!==(n=null===(e=t.icons)||void 0===e?void 0:e.drag)&&void 0!==n?n:x.drag,expand:null!==(o=null===(i=t.icons)||void 0===i?void 0:i.expand)&&void 0!==o?o:x.expand,filter:null!==(r=null===(s=t.icons)||void 0===s?void 0:s.filter)&&void 0!==r?r:x.filter,headerCollapse:null!==(a=null===(l=t.icons)||void 0===l?void 0:l.headerCollapse)&&void 0!==a?a:x.headerCollapse,headerExpand:null!==(c=null===(d=t.icons)||void 0===d?void 0:d.headerExpand)&&void 0!==c?c:x.headerExpand,next:null!==(u=null===(h=t.icons)||void 0===h?void 0:h.next)&&void 0!==u?u:x.next,prev:null!==(f=null===(p=t.icons)||void 0===p?void 0:p.prev)&&void 0!==f?f:x.prev,sortDown:null!==(w=null===(v=t.icons)||void 0===v?void 0:v.sortDown)&&void 0!==w?w:x.sortDown,sortUp:null!==(g=null===(m=t.icons)||void 0===m?void 0:m.sortUp)&&void 0!==g?g:x.sortUp}}static mergeCustomTheme(e){return Object.assign(Object.assign({},t),e.customTheme)}static mergeColumnEditorConfig(t){var e,n,i,o,s,r,l,a,d,c,h;return{text:null!==(n=null===(e=t.columnEditorConfig)||void 0===e?void 0:e.text)&&void 0!==n?n:"Columns",searchEnabled:null===(o=null===(i=t.columnEditorConfig)||void 0===i?void 0:i.searchEnabled)||void 0===o||o,searchPlaceholder:null!==(r=null===(s=t.columnEditorConfig)||void 0===s?void 0:s.searchPlaceholder)&&void 0!==r?r:"Search columns...",allowColumnPinning:null===(a=null===(l=t.columnEditorConfig)||void 0===l?void 0:l.allowColumnPinning)||void 0===a||a,searchFunction:null===(d=t.columnEditorConfig)||void 0===d?void 0:d.searchFunction,rowRenderer:null===(c=t.columnEditorConfig)||void 0===c?void 0:c.rowRenderer,customRenderer:null===(h=t.columnEditorConfig)||void 0===h?void 0:h.customRenderer}}static buildEssentialAccessors(t){return function(t){const e=new Set,n=t=>{var i;for(const o of t)o.isEssential&&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 ne(null===(e=t.expandAll)||void 0===e||e,t.rowGrouping)}}class _e{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;const s=null!==(n=e.theme)&&void 0!==n?n:"modern-light",r=null!==(i=e.className)&&void 0!==i?i:"",l=null!==(o=e.columnBorders)&&void 0!==o&&o,a=document.createElement("div");a.className=`simple-table-root st-wrapper theme-${s} ${r} ${l?"st-column-borders":""}`;const d=document.createElement("div");d.className="st-wrapper-container";const c=document.createElement("div");c.className="st-content-wrapper";const h=document.createElement("div");h.className="st-content",h.setAttribute("role",Array.isArray(e.rowGrouping)&&e.rowGrouping.length>0?"treegrid":"grid"),h.style.width=e.editColumns?"calc(100% - 29.5px)":"100%";const u=document.createElement("div");u.className="st-header-container",u.setAttribute("role","rowgroup"),this.refs.headerContainerRef.current=u;const p=document.createElement("div");p.className="st-body-container",p.setAttribute("role","rowgroup"),p.setAttribute("tabindex","0"),this.refs.tableBodyContainerRef.current=p;const f=document.createElement("div");f.id="st-footer-container";const v="top"===e.footerPosition;v&&a.classList.add("st-footer-position-top");const w=document.createElement("div");return w.setAttribute("aria-live","polite"),w.setAttribute("aria-atomic","true"),w.className="st-sr-only",h.appendChild(u),h.appendChild(p),c.appendChild(h),v?(d.appendChild(f),d.appendChild(c)):(d.appendChild(c),d.appendChild(f)),a.appendChild(d),a.appendChild(w),t.appendChild(a),this.elements={rootElement:a,wrapperContainer:d,contentWrapper:c,content:h,headerContainer:u,bodyContainer:p,footerContainer:f,ariaLiveRegion:w},this.elements}updateTheme(t){if(!this.elements)return;const e=this.elements.rootElement,n=e.className.replace(/\btheme-\S+/g,"").trim();e.className=`${n} theme-${t}`}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 Ye=(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))),b(o,"click",n=>{n.stopPropagation(),e.onSort(t.accessor)}),b(o,"keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),e.onSort(t.accessor))}),o},Xe={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"},Qe={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"]},Ze=["equals","notEquals","isEmpty","isNotEmpty"],tn=(t,e)=>{var n;const i=null!==(n=Qe[t])&&void 0!==n?n:Ze;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},en=t=>!["between","notBetween","in","notIn","isEmpty","isNotEmpty"].includes(t),nn=t=>["between","notBetween","in","notIn"].includes(t),on=t=>["isEmpty","isNotEmpty"].includes(t),sn=t=>{var e;return null!==(e=null==t?void 0:t.closest(".simple-table-root"))&&void 0!==e?e:null},rn=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:p="fixed",allowDescendantOverflow:f=!1}=t,v=f;const w="st-dropdown-content--allow-descendant-overflow",m=document.createElement("div");m.className="st-dropdown-content",v&&m.classList.add(w),m.style.position=p,m.style.overflow=v?"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"===p){const t=null!==(i=null!==(n=null!==(e=sn(g))&&void 0!==e?e:sn(null!=r?r:null))&&void 0!==n?n:sn(null!=s?s:null))&&void 0!==i?i:document.querySelector(".simple-table-root");(null!=t?t:document.body).appendChild(m)}const x=t=>{d&&m&&!m.contains(t.target)&&(C(!1),null==a||a())},b=t=>{const e=t.target;if(!m.contains(e)&&!(null==g?void 0:g.contains(e))){if("absolute"===p){const t=m.parentElement;if(null==t?void 0:t.contains(e))return}C(!1),null==a||a()}},y=t=>{"Escape"===t.key&&d&&(C(!1),null==a||a())},R=t=>{"Enter"===t.key&&b(t)},C=t=>{d=t,d?(m.style.display="flex",(()=>{if(!d)return;if("absolute"===p&&!m.parentElement)return;if("fixed"===p&&!m.parentElement)return;m.style.visibility="hidden";const t=g||m.parentElement;t&&requestAnimationFrame(()=>{const e=t.getBoundingClientRect(),n=m.offsetHeight,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"===p)"bottom"===d?(m.style.top=e.bottom+4+"px",m.style.bottom="auto"):(m.style.bottom=window.innerHeight-e.top+4+"px",m.style.top="auto"),"left"===c?(m.style.left=e.left+"px",m.style.right="auto"):(m.style.right=window.innerWidth-e.right+"px",m.style.left="auto");else{const t=m.parentElement;if(!t)return;const n=t.getBoundingClientRect();"bottom"===d?(m.style.top=e.bottom-n.top+4+"px",m.style.bottom="auto"):(m.style.bottom=n.bottom-e.top+4+"px",m.style.top="auto"),"left"===c?(m.style.left=e.left-n.left+"px",m.style.right="auto"):(m.style.right=n.right-e.right+"px",m.style.left="auto")}m.className=`st-dropdown-content st-dropdown-${d}-${c}${v?" "+w:""}`,m.style.visibility="visible"})})(),window.addEventListener("scroll",x,!0),document.addEventListener("mousedown",b,!0),document.addEventListener("keydown",R,!0),document.addEventListener("keydown",y)):(m.style.display="none",window.removeEventListener("scroll",x,!0),document.removeEventListener("mousedown",b,!0),document.removeEventListener("keydown",R,!0),document.removeEventListener("keydown",y))};return d?C(!0):m.style.display="none",{element:m,update:t=>{void 0!==t.anchorElement&&(g=t.anchorElement),void 0!==t.open&&C(t.open),void 0!==t.children&&(m.innerHTML="",m.appendChild(t.children)),void 0!==t.width&&(h=t.width,m.style.width=h?h+"px":"auto"),void 0!==t.maxWidth&&(u=t.maxWidth,m.style.maxWidth=u?u+"px":""),void 0!==t.overflow&&(c=t.overflow,m.style.overflow=v?"visible":c),void 0!==t.allowDescendantOverflow&&(v=t.allowDescendantOverflow,m.classList.toggle(w,v),m.style.overflow=v?"visible":c)},destroy:()=>{C(!1),m.remove()},setOpen:C}},ln=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 p=document.createElement("span");p.className="st-custom-select-value";const f=i.find(t=>t.value===e);p.textContent=f?f.label:o;const v=document.createElement("template");v.innerHTML='<svg\n class="st-custom-select-arrow"\n width="12"\n height="12"\n viewBox="0 0 12 12"\n fill="none"\n xmlns="http://www.w3.org/2000/svg"\n>\n <path\n d="M3 4.5L6 7.5L9 4.5"\n stroke="currentColor"\n stroke-width="1.5"\n stroke-linecap="round"\n stroke-linejoin="round"\n />\n</svg>';const w=v.content.firstElementChild;u.appendChild(p),u.appendChild(w),h.appendChild(u);const m=document.createElement("div");m.className="st-custom-select-options",m.setAttribute("role","listbox");const g=()=>{m.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",()=>y(t.value)),i.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),y(t.value))}),m.appendChild(i)})};g();const x=rn({children:m,containerRef:l,mainBodyRef:a,anchorElement:u,onClose:()=>{S(!1)},open:d,overflow:"auto",positioning:"absolute"});h.appendChild(x.element);const b=t=>{e=t;const n=i.find(t=>t.value===e);p.textContent=n?n.label:o},y=t=>{b(t),n(t),S(!1),c=-1,g()},R=()=>{if(!r){if(S(!d),d)c=-1;else{const t=i.findIndex(t=>t.value===e);c=0>t?0:t}g()}},C=t=>{if(d)switch(t.key){case"ArrowDown":t.preventDefault(),c=i.length-1>c?c+1:0,g();break;case"ArrowUp":t.preventDefault(),c=c>0?c-1:i.length-1,g();break;case"Enter":if(t.preventDefault(),c>=0){const t=i[c].value;b(t),n(t),S(!1),c=-1,g()}break;case"Escape":t.preventDefault(),S(!1),c=-1,g()}},S=t=>{d=t,u.setAttribute("aria-expanded",""+d),d?(h.classList.add("st-custom-select-open"),document.addEventListener("keydown",C)):(h.classList.remove("st-custom-select-open"),document.removeEventListener("keydown",C)),x.setOpen(d)};return u.addEventListener("click",R),{element:h,update:t=>{if(void 0!==t.value){e=t.value;const n=i.find(t=>t.value===e);p.textContent=n?n.label:o,g()}void 0!==t.options&&(i=t.options,g()),void 0!==t.disabled&&(r=t.disabled,u.disabled=r,r?h.classList.add("st-custom-select-disabled"):h.classList.remove("st-custom-select-disabled")),void 0!==t.onChange&&(n=t.onChange)},destroy:()=>{u.removeEventListener("click",R),document.removeEventListener("keydown",C),x.destroy(),h.remove()},setOpen:S}},an=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&&setTimeout(()=>c.focus(),0);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()}}},dn=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()}}},cn=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),f()},d=()=>{o=new Date(o.getFullYear(),o.getMonth()+1,1),f()},c=t=>{o=new Date(t,o.getMonth(),1),s="months",f()},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()},p=t=>{const i=new Date(o.getFullYear(),o.getMonth()+1,t,12,0,0);o=i,e(i),null==n||n()},f=()=>{r.innerHTML="";const t=document.createElement("div");if(t.className="st-datepicker-header","days"===s){const e=document.createElement("button");e.className="st-datepicker-nav-btn",e.innerHTML='<svg viewBox="0 0 24 24" width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n <path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z" />\n</svg>',e.addEventListener("click",a);const n=document.createElement("div");n.className="st-datepicker-header-label",n.textContent=`${v=o,v.toLocaleString("default",{month:"long"})} ${o.getFullYear()}`,n.addEventListener("click",()=>{s="months",f()});const i=document.createElement("button");i.className="st-datepicker-nav-btn",i.innerHTML='<svg viewBox="0 0 24 24" width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n <path d="M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z" />\n</svg>',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.textContent=""+o.getFullYear(),e.addEventListener("click",()=>{s="years",f()}),t.appendChild(e)}else{const e=document.createElement("div");e.className="st-datepicker-header-label",e.textContent="Select Year",t.appendChild(e)}var v;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",()=>p(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",f()})(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 x=document.createElement("button");x.className="st-datepicker-today-btn",x.textContent="Today",x.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(x),r.appendChild(g)};return f(),{element:r,update:t=>{void 0!==t.value&&(i=t.value,o=i||new Date,f()),void 0!==t.onChange&&(e=t.onChange),void 0!==t.onClose&&(n=t.onClose)},destroy:()=>{r.remove()}}},hn=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=tn("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 p=ln({value:d,onChange:t=>{d=t,x()},options:l.map(t=>({value:t,label:Xe[t]})),containerRef:s,mainBodyRef:r});u.appendChild(p.element),h.appendChild(u);let f=null,v=null,w=null;const m=()=>{const t=Object.assign({accessor:e.accessor,operator:d},en(d)&&{value:c});i(t)},g=()=>on(d)||""!==c.trim(),x=()=>{f&&(f.remove(),f=null),v&&(v.destroy(),v=null),en(d)&&(f=document.createElement("div"),f.className="st-filter-section",v=an({type:"text",value:c,onChange:t=>{c=t,w&&w.update({canApply:g()})},onEnter:m,placeholder:"Filter...",autoFocus:!0}),f.appendChild(v.element),h.insertBefore(f,h.lastChild)),w&&w.update({canApply:g()})};return w=dn({onApply:m,onClear:o,canApply:g(),showClear:!!n}),h.appendChild(w.element),x(),{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)||"")+"",p.update({value:d}),v&&v.update({value:c}),w&&w.update({showClear:!!n,canApply:g()}),x())},destroy:()=>{p.destroy(),v&&v.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=tn("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)||"")+"",p=((null===(e=null==o?void 0:o.values)||void 0===e?void 0:e[0])||"")+"",f=((null===(n=null==o?void 0:o.values)||void 0===n?void 0:n[1])||"")+"";const v=document.createElement("div");v.className="st-filter-container";const w=document.createElement("div");w.className="st-filter-section";const m=ln({value:h,onChange:t=>{h=t,I()},options:d.map(t=>({value:t,label:Xe[t]})),containerRef:l,mainBodyRef:a});w.appendChild(m.element),v.appendChild(w);let g=null,x=null,b=null,y=null,R=null;const C=()=>{const t={accessor:i.accessor,operator:h};en(h)?t.value=parseFloat(u):nn(h)&&(t.values=[parseFloat(p),parseFloat(f)]),s(t)},S=()=>!!on(h)||(en(h)?""!==u.trim():!!nn(h)&&""!==p.trim()&&""!==f.trim()),I=()=>{g&&(g.remove(),g=null),x&&(x.destroy(),x=null),b&&(b.destroy(),b=null),y&&(y.destroy(),y=null),en(h)?(g=document.createElement("div"),g.className="st-filter-section",x=an({type:"number",value:u,onChange:t=>{u=t,R&&R.update({canApply:S()})},onEnter:C,placeholder:"Enter number...",autoFocus:!0}),g.appendChild(x.element),v.insertBefore(g,v.lastChild)):nn(h)&&(g=document.createElement("div"),g.className="st-filter-section",b=an({type:"number",value:p,onChange:t=>{p=t,R&&R.update({canApply:S()})},onEnter:C,placeholder:"From...",autoFocus:!0}),b.element.classList.add("st-filter-input-range-from"),y=an({type:"number",value:f,onChange:t=>{f=t,R&&R.update({canApply:S()})},onEnter:C,placeholder:"To..."}),g.appendChild(b.element),g.appendChild(y.element),v.insertBefore(g,v.lastChild)),R&&R.update({canApply:S()})};return R=dn({onApply:C,onClear:r,canApply:S(),showClear:!!o}),v.appendChild(R.element),I(),{element:v,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)||"")+"",p=((null===(e=null==o?void 0:o.values)||void 0===e?void 0:e[0])||"")+"",f=((null===(n=null==o?void 0:o.values)||void 0===n?void 0:n[1])||"")+"",m.update({value:h}),x&&x.update({value:u}),b&&b.update({value:p}),y&&y.update({value:f}),R&&R.update({showClear:!!o,canApply:S()}),I())},destroy:()=>{m.destroy(),x&&x.destroy(),b&&b.destroy(),y&&y.destroy(),R&&R.destroy(),v.remove()}}})(t);case"boolean":return(t=>{let{header:e,currentFilter:n,onApplyFilter:i,onClearFilter:o,containerRef:s,mainBodyRef:r}=t;const l=tn("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 p=ln({value:d,onChange:t=>{d=t,x()},options:l.map(t=>({value:t,label:Xe[t]})),containerRef:s,mainBodyRef:r});u.appendChild(p.element),h.appendChild(u);let f=null,v=null,w=null;const m=()=>on(d)||""!==c,g=[{value:"true",label:"True"},{value:"false",label:"False"}],x=()=>{f&&(f.remove(),f=null),v&&(v.destroy(),v=null),en(d)&&(f=document.createElement("div"),f.className="st-filter-section",v=ln({value:c,onChange:t=>{c=t,w&&w.update({canApply:m()})},options:g,containerRef:s,mainBodyRef:r}),f.appendChild(v.element),h.insertBefore(f,h.lastChild)),w&&w.update({canApply:m()})};return w=dn({onApply:()=>{const t={accessor:e.accessor,operator:d};en(d)&&(t.value="true"===c),i(t)},onClear:o,canApply:m(),showClear:!!n}),h.appendChild(w.element),x(),{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",p.update({value:d}),v&&v.update({value:c}),w&&w.update({showClear:!!n,canApply:m()}),x())},destroy:()=>{p.destroy(),v&&v.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=tn("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+"":"",p=(null===(e=null==o?void 0:o.values)||void 0===e?void 0:e[0])?o.values[0]+"":"",f=((null===(n=null==o?void 0:o.values)||void 0===n?void 0:n[1])||"")+"";const v=document.createElement("div");v.className="st-filter-container";const w=document.createElement("div");w.className="st-filter-section";const m=ln({value:h,onChange:t=>{h=t,W()},options:d.map(t=>({value:t,label:Xe[t]})),containerRef:l,mainBodyRef:a});w.appendChild(m.element),v.appendChild(w);let g=null,x=null,b=null,y=null,R=null,C=null,S=null,I=null,H=null,M=null,k=null;const E=()=>!!on(h)||(en(h)?""!==u.trim():!!nn(h)&&""!==p.trim()&&""!==f.trim()),T=t=>{if(!t)return"";const e=Pt(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=T(t),s.placeholder=n,s.readOnly=!0,s.style.cursor="pointer",i&&setTimeout(()=>s.focus(),0);let r=!1;const d=t?Pt(t):new Date,c=cn({value:d,onChange:t=>{const n=t.toISOString().split("T")[0];e(n),s.value=T(n),h.setOpen(!1),r=!1},onClose:()=>{h.setOpen(!1),r=!1}}),h=rn({children:c.element,containerRef:l,mainBodyRef:a,anchorElement:s,onClose:()=>{r=!1},open:!1,overflow:"hidden",positioning:"absolute",width:240});o.appendChild(s),o.appendChild(h.element);const u=()=>{r=!r,h.setOpen(r)},p=t=>{"Enter"===t.key||" "===t.key?(t.preventDefault(),r=!r,h.setOpen(r)):"Escape"===t.key&&(r=!1,h.setOpen(!1))};return s.addEventListener("click",u),s.addEventListener("keydown",p),{container:o,input:s,picker:c,dropdown:h,destroy:()=>{s.removeEventListener("click",u),s.removeEventListener("keydown",p),c.destroy(),h.destroy(),o.remove()}}},W=()=>{if(g&&(g.remove(),g=null),x&&(x=null),b&&(b=null),y&&(y=null),R&&(R.destroy(),R=null),C&&(C.destroy(),C=null),S&&(S.destroy(),S=null),I&&(I.destroy(),I=null),H&&(H.destroy(),H=null),M&&(M.destroy(),M=null),en(h)){g=document.createElement("div"),g.className="st-filter-section";const t=A(u,t=>{u=t,k&&k.update({canApply:E()})},"Select date...",!0);x=t.container,R=t.picker,I=t.dropdown,g.appendChild(x),v.insertBefore(g,v.lastChild)}else if(nn(h)){g=document.createElement("div"),g.className="st-filter-section";const t=A(p,t=>{p=t,k&&k.update({canApply:E()})},"From date...",!0);t.input.classList.add("st-filter-input-range-from");const e=A(f,t=>{f=t,k&&k.update({canApply:E()})},"To date...",!1);b=t.container,C=t.picker,H=t.dropdown,y=e.container,S=e.picker,M=e.dropdown,g.appendChild(b),g.appendChild(y),v.insertBefore(g,v.lastChild)}k&&k.update({canApply:E()})};return k=dn({onApply:()=>{const t={accessor:i.accessor,operator:h};en(h)?t.value=u:nn(h)&&(t.values=[p,f]),s(t)},onClear:r,canApply:E(),showClear:!!o}),v.appendChild(k.element),W(),{element:v,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+"":"",p=(null===(e=null==o?void 0:o.values)||void 0===e?void 0:e[0])?o.values[0]+"":"",f=((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:E()}),W())},destroy:()=>{m.destroy(),R&&R.destroy(),C&&C.destroy(),S&&S.destroy(),I&&I.destroy(),H&&H.destroy(),M&&M.destroy(),k&&k.destroy(),v.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 p=xe({checked:l.length===r.length,onChange:t=>{l=t?[...r]:[],x(),y&&y.update({canApply:b()})}}),f=document.createElement("span");f.className="st-enum-option-label st-enum-select-all-label",f.textContent="Select All",p.element.appendChild(f),u.appendChild(p.element),h.appendChild(u);let v=null,w=null;s.length>10&&(v=document.createElement("div"),v.className="st-enum-search",w=an({type:"text",value:a,onChange:t=>{a=t,x()},placeholder:"Search..."}),v.appendChild(w.element),h.appendChild(v));const m=document.createElement("div");h.appendChild(m);const g=[],x=()=>{m.innerHTML="",g.forEach(t=>t.checkbox.destroy()),g.length=0;const t=a?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=xe({checked:l.includes(t.value),onChange:()=>{l=l.includes(t.value)?l.filter(e=>e!==t.value):[...l,t.value];const e=l.length===r.length;p.element.querySelector("input").checked=e,y&&y.update({canApply:b()})}}),n=document.createElement("span");n.className="st-enum-option-label",n.textContent=t.label,e.element.appendChild(n),m.appendChild(e.element),g.push({container:e.element,checkbox:e,value:t.value})});const e=l.length===r.length;p.element.querySelector("input").checked=e};x(),c.appendChild(h),d.appendChild(c);const b=()=>0!==l.length&&l.length!==r.length,y=dn({onApply:()=>{l.length!==r.length?i({accessor:e.accessor,operator:"in",values:l}):o()},onClear:o,canApply:b(),showClear:!!n});return d.appendChild(y.element),{element:d,update:t=>{void 0!==t.currentFilter&&(n=t.currentFilter,l=(null==n?void 0:n.values)?n.values.map(String):r,a="",w&&w.update({value:a}),x(),y&&y.update({showClear:!!n,canApply:b()}))},destroy:()=>{p.destroy(),w&&w.destroy(),g.forEach(t=>t.checkbox.destroy()),y&&y.destroy(),d.remove()}}})(t)}},un=(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}d&&(d.style.fill=r?"var(--st-button-active-background-color)":"var(--st-header-icon-color)");let c=!1,h=null,u=null;const p=n=>{if(n.stopPropagation(),c=!c,l.setAttribute("aria-expanded",c+""),c){const n=t=>{i(t),c=!1,l.setAttribute("aria-expanded","false"),u&&(u.destroy(),u=null),h&&(h.destroy(),h=null),d&&(d.style.fill="var(--st-button-active-background-color)")},s=()=>{o(t.accessor),c=!1,l.setAttribute("aria-expanded","false"),u&&(u.destroy(),u=null),h&&(h.destroy(),h=null),d&&(d.style.fill="var(--st-header-icon-color)")},a=e.mainBodyRef.current||void 0;h=hn({header:t,currentFilter:r,onApplyFilter:n,onClearFilter:s,containerRef:a,mainBodyRef:a}),u=rn({children:h.element,containerRef:a,mainBodyRef:a,anchorElement:l,onClose:()=>{c=!1,l.setAttribute("aria-expanded","false"),h&&(h.destroy(),h=null)},open:!0,positioning:"fixed",maxWidth:280,allowDescendantOverflow:!0})}else u&&(u.destroy(),u=null),h&&(h.destroy(),h=null)};return b(l,"click",p),b(l,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),p(t))}),l},pn=(t,e)=>{var n,i;const{icons:o}=e;if(!K(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 b(r,"click",a),b(r,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),a(t))}),r},fn=(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=fn(o.children,e,[...n,i]);if(t)return t}}return null},vn=(t,e)=>{if(t.pinned)return t.pinned;const n=V(e,t.accessor);return n?vn(n,e):void 0},wn=(t,e)=>{const n=vn(t,e);return"left"===n?"left":"right"===n?"right":"main"};function mn(t,e,n){const i=Pe(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 gn=(t,e)=>{const{mainBodyWidth:n,pinnedLeftWidth:i,pinnedRightWidth:o,pinnedLeftContentWidth:s,pinnedRightContentWidth:r,tableBodyContainerRef:l,editColumns:a}=e,d=a?O: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 p=t.querySelector(".st-horizontal-scrollbar-middle"),f=null==p?void 0:p.firstElementChild;n>0&&p&&f&&(f.style.width=n+"px");const v=t.querySelector(".st-horizontal-scrollbar-right"),w=null==v?void 0:v.firstElementChild;if(o>0&&v&&w&&(v.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")}},xn=(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()},bn=({containerWidth:t,leftWidth:e,rightWidth:n})=>t>0?Math.max(0,t-e-n):void 0,yn=({headers:t,containerWidth:e,collapsedHeaders:n})=>{let i=0,o=0,s=0;t.forEach(t=>{if(t.hide)return;const e=dt(t,n).reduce((t,e)=>t+ft(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*D(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}},Rn=(t,e)=>{if(t.pinned)return t.pinned;const n=V(e,t.accessor);return n?Rn(n,e):void 0},Cn=(t,e,n)=>{var i;const o=[],s=[],r=[];t.forEach(e=>{if(e.hide)return;const n=Rn(e,t);"left"===n?o.push(e):"right"===n?r.push(e):s.push(e)});const l=(t,i,o)=>{var s,r;const a=i;if(t.children&&t.children.length>0){const r=null==e?void 0:e.has(t.accessor),d=t.children.filter(t=>{if(t.hide)return!1;const e=t.showWhen||B;return r?"parentCollapsed"===e||"always"===e:"parentExpanded"===e||"always"===e});if(t.singleRowChildren){const e=null!==(s=null==n?void 0:n.get(t.accessor))&&void 0!==s?s:"number"==typeof t.width?t.width:ft(t);return o.set(t.accessor,{left:a,width:e}),i=a+e,d.forEach(t=>{i=l(t,i,o)}),i}d.forEach(t=>{i=l(t,i,o)}),o.set(t.accessor,{left:a,width:i-a})}else{const e=null!==(r=null==n?void 0:n.get(t.accessor))&&void 0!==r?r:"number"==typeof t.width?t.width:ft(t);o.set(t.accessor,{left:i,width:e}),i+=e}return i},a=t=>{const e=new Map;let n=0;return t.forEach(t=>{n=l(t,n,e)}),e},d=a(o),c=a(s),h=a(r),u=new Map;d.forEach((t,e)=>u.set(e,t)),c.forEach((t,e)=>u.set(e,t)),h.forEach((t,e)=>u.set(e,t)),u.forEach((t,e)=>{const{left:n,width:i}=t,o=J({accessor:e,rowId:"header"}),s=document.getElementById(o);d.has(e),h.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 p=document.querySelector(".st-body-container"),f=null!==(i=null==p?void 0:p.clientWidth)&&void 0!==i?i:0,v=yn({headers:t,containerWidth:f>0?f:void 0,collapsedHeaders:e}),{leftWidth:w,rightWidth:m,mainWidth:g,leftContentWidth:x,rightContentWidth:b}=v;if(w>0){const t=document.querySelector(".st-header-pinned-left"),e=document.querySelector(".st-body-pinned-left");t&&(t.style.width=w+"px"),e&&(e.style.width=w+"px")}if(m>0){const t=document.querySelector(".st-header-pinned-right"),e=document.querySelector(".st-body-pinned-right");t&&(t.style.width=m+"px"),e&&(e.style.width=m+"px")}const y=null==p?void 0:p.closest(".simple-table-root"),R=null==y?void 0:y.querySelector(".st-horizontal-scrollbar-container"),C=null==y?void 0:y.querySelector(".st-body-main"),S=!!(null==y?void 0:y.querySelector(".st-column-editor"));R&&C&&p&&C.scrollWidth-C.clientWidth>1&&gn(R,{mainBodyRef:C,mainBodyWidth:g,pinnedLeftWidth:w,pinnedRightWidth:m,pinnedLeftContentWidth:x,pinnedRightContentWidth:b,tableBodyContainerRef:p,editColumns:S})},Sn=({columnsToShrink:t,totalCompensation:e,initialWidthsMap:n})=>{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 i=e;for(;i>.5;){const e=L,o=t.map(t=>{const i=n.get(t.accessor)||100;return{column:t,headroom:Math.max(0,i-e),initialWidth:i,minWidth:e}}).filter(t=>t.headroom>0);if(0>=o.length)break;{const t=o.reduce((t,e)=>t+e.headroom,0);let e=0;const n=i;o.forEach((i,s)=>{let r=n*(i.headroom/t);r=Math.min(r,i.headroom),s===o.length-1&&(r=Math.min(n-e,i.headroom)),i.column.width=i.initialWidth-r,e+=r}),i-=e}}},In=({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,startWidth:u})=>{const p=t=>{if(!d||0>=n||0>=t)return t;const e=o.some(t=>"left"===t.pinned&&!t.hide),i=o.some(t=>"right"===t.pinned&&!t.hide),r=((t,e,n)=>t*D(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=mt(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,f=r===n.length-1;let v;v="left"===d&&f||"right"===d&&l?[]:l?n.slice(r+1):f||a?n.slice(0,o):n.slice(r+1);const w=Array.from(s.values()).reduce((t,e)=>t+e,0);if(i>0){let e=i,n=!1;if(v.length>0&&w+i>(h>0?Math.max(h,w):w+Math.abs(i)+1)){n=!0;const t=v.reduce((t,e)=>{const n=s.get(e.accessor)||100;return t+Math.max(0,n-L)},0);e=Math.min(i,t)}i>0&&!n&&(e=p(e));const o=(u+e)/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*o,40)}),n&&e>0&&v.length>0&&Sn({columnsToShrink:v,totalCompensation:e,initialWidthsMap:s})}else{const e=t.reduce((t,e)=>t+(s.get(e.accessor)||100),0),n=Math.max(u+i,L*t.length),o=n/e;t.forEach(t=>{const e=s.get(t.accessor)||100;t.width=Math.max(e*o,40)});const r=u-n;r>0&&v.length>0&&Sn({columnsToShrink:v,totalCompensation:-r,initialWidthsMap:s})}return}const f=mt(c,e),v=f.findIndex(t=>t.accessor===l.accessor);if(-1===v)return;const w=0===v,m=v===f.length-1;let g;if(g="left"===d&&m||"right"===d&&w?[]:w?f.slice(v+1):m||a?f.slice(0,v):f.slice(v+1),0===g.length){const t=L,e=i>0?p(i):i;return void(l.width=Math.max(u+e,t))}const x=Array.from(s.values()).reduce((t,e)=>t+e,0);if(i>0){if((h>0?Math.max(h,x):x+Math.abs(i)+1)>=x+i){const t=i>0?p(i):i;return void(l.width=u+t)}const t=g.reduce((t,e)=>{const n=s.get(e.accessor)||100;return t+Math.max(0,n-L)},0),e=Math.min(i,t);l.width=u+e,e>0&&Sn({columnsToShrink:g,totalCompensation:e,initialWidthsMap:s})}else{const t=Math.max(u+i,40),e=u-t;l.width=t,e>0&&Sn({columnsToShrink:g,totalCompensation:-e,initialWidthsMap:s})}},Hn=(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},Mn=({autoExpandColumns:t,collapsedHeaders:e,containerWidth:n,event:i,header:o,headers:s,mainBodyRef:r,onColumnWidthChange:l,reverse:a=!1,setHeaders:d,setIsResizing:c,startWidth:h})=>{i.preventDefault();const u="clientX"in i?i.clientX:i.touches[0].clientX,p="touches"in i;if(!o||o.hide)return;const f=Hn(n,r);c(!0);const v=Rn(o,s),w=wt(o);let m;if(o.children&&o.children.length>0){const t=dt(o,e);m=t.length>0?t:[o]}else m=[o];const g=new Map;let x=0,b=0;if(t){const t=s.filter(t=>t.pinned===v);if(mt(t,e).forEach(t=>{const e=ft(t);g.set(t.accessor,e)}),f>0){const{leftWidth:t,rightWidth:n,mainWidth:i}=yn({headers:s,containerWidth:f,collapsedHeaders:e});x="left"===v?t:"right"===v?n:i;const o=Math.max(0,f-t-n),l=null!=(null==r?void 0:r.current)&&r.current.clientWidth>0?r.current.clientWidth:0;b=l>0?Math.min(o,l):o}}let y=!1;const R=new Map;let C=[];if(t&&v&&f>0){const t=mt(s.filter(t=>t.pinned===v),e);if(t.length>0){let n=!1;if(m.length>1){const e=t.findIndex(t=>t.accessor===m[0].accessor),i=t.findIndex(t=>t.accessor===m[m.length-1].accessor);n="left"===v&&i===t.length-1||"right"===v&&0===e}else{const e=m[0]||o,i=t.findIndex(t=>t.accessor===e.accessor);n="left"===v&&i===t.length-1||"right"===v&&0===i}if(n){y=!0;const t=s.filter(t=>!t.pinned);C=mt(t,e),C.forEach(t=>{R.set(t.accessor,ft(t))})}}}const S=(n,i=!1)=>{const r="right"===v?u-n:n-u;if(t){const t=s.filter(t=>t.pinned===v);if(In({childrenToResize:m,collapsedHeaders:e,containerWidth:f,delta:r,headers:s,initialWidthsMap:g,isParentResize:m.length>1,resizedHeader:m.length>0?m[m.length-1]:o,reverse:a,rootPinned:v,sectionHeaders:t,sectionWidth:x,startWidth:h}),y&&C.length>0){const t=m.reduce((t,e)=>{const n=g.get(e.accessor)||0;return t+(("number"==typeof e.width?e.width:n)-n)},0),e=Math.max(0,b-t),n=Array.from(R.values()).reduce((t,e)=>t+e,0);if(e>0&&n>0){const t=e/n;let i=0;C.forEach((n,o)=>{const s=R.get(n.accessor)||100;o===C.length-1?n.width=e-i:(n.width=Math.round(s*t),i+=n.width)})}}}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&&!t.hide),r=e.some(t=>"right"===t.pinned&&!t.hide),l=o*D(o,s,r)-e.filter(e=>e.pinned===t.pinned&&e.accessor!==t.accessor).reduce((t,e)=>e.hide?t:t+dt(e,n).reduce((t,e)=>t+ft(e),0),0),a=wt(t);return a>l?(console.warn(`Header ${t.accessor} exceeds pinned section width limit`),a):l})({header:o,headers:s,collapsedHeaders:e});m.length>1?(({delta:t,leafHeaders:e,minWidth:n,startWidth:i,maxWidth:o})=>{const s=e.reduce((t,e)=>Math.min(t,wt(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:m,minWidth:w,startWidth:h,maxWidth:t}):m[0].width=Math.max(Math.min(h+r,t),w),s.forEach(t=>{vt(t)})}if(i){const t=[...s];d(t);const n=new Map;m.forEach(t=>{"number"==typeof t.width&&n.set(t.accessor,t.width)}),y&&C.forEach(t=>{"number"==typeof t.width&&n.set(t.accessor,t.width)}),Cn(s,e,n)}else Cn(s,e)};let I=null,H=null,M=u;const k=t=>{M=t,H=t,null===I&&(I=requestAnimationFrame(()=>{null!==H&&(S(H,!1),H=null),I=null}))};if(p){const t=t=>{k(t.touches[0].clientX)},e=()=>{document.removeEventListener("touchmove",t),document.removeEventListener("touchend",e),null!==I&&(cancelAnimationFrame(I),I=null),S(M,!0),c(!1),l&&l([...s])};document.addEventListener("touchmove",t),document.addEventListener("touchend",e)}else{const t=t=>{k(t.clientX)},e=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",e),null!==I&&(cancelAnimationFrame(I),I=null),S(M,!0),c(!1),l&&l([...s])};document.addEventListener("mousemove",t),document.addEventListener("mouseup",e)}},kn=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},En=(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=En(i.children,e);if(t)return t}}},Tn=(t,e,n)=>{const{columnResizing:i}=e;if(!i||t.isSelectionColumn&&e.enableRowSelection||n)return null;const o=document.createElement("div");o.className="st-header-resize-handle-container",o.setAttribute("role","separator"),o.setAttribute("aria-label",`Resize ${t.label} column`),o.setAttribute("aria-orientation","vertical");const s=document.createElement("div");s.className="st-header-resize-handle",o.appendChild(s);const r=t=>({rows:e.rows,header:t,styleRoot:kn(e),autoSizeMode:t.autoSizeMode}),l=()=>{var n;if(e.autoExpandColumns){const i=e.getHeaders();return((t,e)=>{const n=mt(t,e);for(const t of n){const e=document.getElementById(J({accessor:t.accessor,rowId:"header"})),n=null==e?void 0:e.offsetWidth;null!=n&&n>0&&(t.width=n)}})(i,e.collapsedHeaders),{headers:i,header:null!==(n=En(i,t.accessor))&&void 0!==n?n:t}}return{headers:e.headers,header:t}};let a=0;const d=()=>{const n=Date.now();120>n-a||(a=n,(()=>{const n=document.getElementById(J({accessor:t.accessor,rowId:"header"}));if(e.autoExpandColumns){const{headers:t,header:i}=l();(({header:t,headers:e,collapsedHeaders:n,containerWidth:i,mainBodyRef:o,reverse:s,headerCellElement:r,getTargetLeafWidth:l})=>{var a;if(!t||t.hide)return;const d=Hn(i,o),c=Rn(t,e);let h;if(t.children&&t.children.length>0){const e=dt(t,n);h=e.length>0?e:[t]}else h=[t];const u=new Map;let p=0,f=0;const v=e.filter(t=>t.pinned===c);if(mt(v,n).forEach(t=>{const e=ft(t);u.set(t.accessor,e)}),d>0){const{leftWidth:t,rightWidth:i,mainWidth:s}=yn({headers:e,containerWidth:d,collapsedHeaders:n});p="left"===c?t:"right"===c?i:s;const r=Math.max(0,d-t-i),l=null!=(null==o?void 0:o.current)&&o.current.clientWidth>0?o.current.clientWidth:0;f=l>0?Math.min(r,l):r}let w=!1;const m=new Map;let g=[];if(c&&d>0){const i=mt(e.filter(t=>t.pinned===c),n);if(i.length>0){let o=!1;if(h.length>1){const t=i.findIndex(t=>t.accessor===h[0].accessor),e=i.findIndex(t=>t.accessor===h[h.length-1].accessor);o="left"===c&&e===i.length-1||"right"===c&&0===t}else{const e=h[0]||t,n=i.findIndex(t=>t.accessor===e.accessor);o="left"===c&&n===i.length-1||"right"===c&&0===n}if(o){w=!0;const t=e.filter(t=>!t.pinned);g=mt(t,n),g.forEach(t=>{m.set(t.accessor,ft(t))})}}}const x=h.reduce((t,e)=>t+l(e),0),b=null!==(a=null==r?void 0:r.offsetWidth)&&void 0!==a?a:h.reduce((t,e)=>t+ft(e),0);if(In({childrenToResize:h,collapsedHeaders:n,containerWidth:d,delta:x-b,headers:e,initialWidthsMap:u,isParentResize:h.length>1,resizedHeader:h.length>0?h[h.length-1]:t,reverse:s,rootPinned:c,sectionHeaders:v,sectionWidth:p,startWidth:b}),w&&g.length>0){const t=h.reduce((t,e)=>{const n=u.get(e.accessor)||0;return t+(("number"==typeof e.width?e.width:n)-n)},0),e=Math.max(0,f-t),n=Array.from(m.values()).reduce((t,e)=>t+e,0);if(e>0&&n>0){const t=e/n;let i=0;g.forEach((n,o)=>{const s=m.get(n.accessor)||100;o===g.length-1?n.width=e-i:(n.width=Math.round(s*t),i+=n.width)})}}const y=new Map;h.forEach(t=>{"number"==typeof t.width&&y.set(t.accessor,t.width)}),w&&g.forEach(t=>{"number"==typeof t.width&&y.set(t.accessor,t.width)}),Cn(e,n,y)})({header:i,headers:t,collapsedHeaders:e.collapsedHeaders,containerWidth:e.containerWidth,mainBodyRef:e.mainBodyRef,reverse:e.reverse,headerCellElement:n,getTargetLeafWidth:t=>gt(t.accessor,r(t))});const o=[...t];return e.setHeaders(o),void(e.onColumnWidthChange&&e.onColumnWidthChange(o))}const i=gt(t.accessor,r(t)),o=fn(e.headers,t.accessor);if(!o)return;const s=((t,e)=>{let n=t;for(let t=0;e.length-1>t;t++)n=n[e[t]].children;return n})(e.headers,o),a=o[o.length-1],d=s.map((t,e)=>e===a?Object.assign(Object.assign({},t),{width:i}):t),c=((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})(e.headers,o,d);c.forEach(t=>vt(t));const h=d[a],u=new Map;h&&"number"==typeof h.width&&u.set(h.accessor+"",h.width),Cn(c,e.collapsedHeaders,u),e.setHeaders(c),e.onColumnWidthChange&&e.onColumnWidthChange(c)})())};return b(o,"mousedown",n=>{var i;if(n.detail>=2)return n.preventDefault(),void d();const o=null===(i=document.getElementById(J({accessor:t.accessor,rowId:"header"})))||void 0===i?void 0:i.offsetWidth;x(()=>{const{headers:t,header:i}=l();Mn({autoExpandColumns:e.autoExpandColumns,collapsedHeaders:e.collapsedHeaders,containerWidth:e.containerWidth,event:n,forceUpdate:e.forceUpdate,header:i,headers:t,mainBodyRef:e.mainBodyRef,onColumnWidthChange:e.onColumnWidthChange,pinnedLeftRef:e.pinnedLeftRef,pinnedRightRef:e.pinnedRightRef,reverse:e.reverse,setHeaders:e.setHeaders,setIsResizing:e.setIsResizing,startWidth:null!=o?o:P})},10)}),b(o,"touchstart",n=>{var i;const o=n,s=null===(i=document.getElementById(J({accessor:t.accessor,rowId:"header"})))||void 0===i?void 0:i.offsetWidth;x(()=>{const{headers:t,header:n}=l();Mn({autoExpandColumns:e.autoExpandColumns,collapsedHeaders:e.collapsedHeaders,containerWidth:e.containerWidth,event:o,forceUpdate:e.forceUpdate,header:n,headers:t,mainBodyRef:e.mainBodyRef,onColumnWidthChange:e.onColumnWidthChange,pinnedLeftRef:e.pinnedLeftRef,pinnedRightRef:e.pinnedRightRef,reverse:e.reverse,setHeaders:e.setHeaders,setIsResizing:e.setIsResizing,startWidth:null!=s?s:P})},10)}),b(o,"dblclick",d),o},An=(t,e,n)=>{const i=document.createElement("input");return i.type="text",i.className="st-header-edit-input",i.value=t.label||"",b(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=Wn(t,e,o);s.replaceChild(i,n)}if(e.headerRegistry&&!t.isSelectionColumn){const n=e.headerRegistry.get(t.accessor+"");n&&n.setEditing(!1)}}),b(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},Wn=(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){const t=(t=>{const e=!!t.areAllRowsSelected&&t.areAllRowsSelected();return xe({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)};b(s,"mouseenter",i),b(s,"mouseleave",o)}return s},On=(t,e,n,i)=>{const{columnReordering:o,draggedHeaderRef:s,hoveredHeaderRef:r}=i;!o||n.disableReorder||n.isSelectionColumn&&i.enableRowSelection||(t.setAttribute("draggable","true"),b(t,"dragstart",t=>{s.current=n,f(Date.now()),e.classList.add("st-dragging")}),b(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(Pe(i.getHeaders()))},10)}),b(e,"dragover",t=>{const e=t;e.preventDefault(),s.current&&x(()=>{const t=i.getHeaders();if(!t)return;const{screenX:o,screenY:l}=e,a=Math.sqrt(Math.pow(o-u.screenX,2)+Math.pow(l-u.screenY,2));r.current=n;const d=s.current;if(!d)return;let c,v=!1;if(wn(d,t)!==wn(n,t)){const e=function({headers:t,draggedHeader:e,hoveredHeader:n}){const i=Pe(t);let o=!1;try{const t=wn(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,v=e.emergencyBreak}else{const e=fn(t,d.accessor),i=fn(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((w=e).length!==(m=r).length||1!==w.length&&!w.slice(0,-1).every((t,e)=>t===m[e]))return;const l=mn(t,e,r);c=l.newHeaders,v=l.emergencyBreak}var w,m;if(n.accessor===d.accessor||10>a||JSON.stringify(c)===JSON.stringify(t)||v)return;const g=i.essentialAccessors;if(g&&g.size>0&&!Ne(c,g))return;const x=Date.now();JSON.stringify(c)===JSON.stringify(p)&&(150>x-h||40>a)||(f(x),u={screenX:o,screenY:l},p=t,i.onTableHeaderDragEnd(c))},50)}),b(document.documentElement,"dragover",t=>{t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="move")}))},Pn=(t,e,n)=>{var i,o;const{header:s,colIndex:r,parentHeader:l}=t,{collapsedHeaders:a,columnBorders:d,columnReordering:c,enableHeaderEditing:h,selectedColumns:u,columnsWithSelectedCells:p,draggedHeaderRef:f,hoveredHeaderRef:v}=e,w=s.isSelectionColumn&&e.enableRowSelection,m=!!(null==s?void 0:s.isSortable),g=a.has(s.accessor),x=!(!s.children||0===s.children.length)&&(!g||s.children.some(t=>{const e=t.showWhen||B;return"parentCollapsed"===e||"always"===e})),b=null==l?void 0:l.singleRowChildren,y=x&&!s.singleRowChildren,R=!!d&&(s.children&&0!==s.children.length?j(s,r).includes(e.lastHeaderIndex):r===e.lastHeaderIndex),C=!(!e.selectableColumns||w)&&j(s,r).some(t=>u.has(t)),S=!w&&j(s,r).some(t=>p.has(t));return["st-header-cell",s.accessor===(null===(i=v.current)||void 0===i?void 0:i.accessor)?"st-hovered":"",(null===(o=f.current)||void 0===o?void 0:o.accessor)===s.accessor?"st-dragging":"",m?"clickable":"",c&&!m?"columnReordering":"",y?"parent":"",b?"st-sub-header":"",R?"st-last-column":"",h&&!w?"st-header-editable":"",C?"st-header-selected":"",S&&!C?"st-header-has-highlighted-cell":"",n?"st-no-resize":""].filter(Boolean).join(" ")},$n=(t,e,n,i,o)=>{const s=Wn(e,i),r=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:s}});t.innerHTML="",r instanceof HTMLElement?t.appendChild(r):t.appendChild(s)},Fn=(t,e,o,s=0)=>{var r,l;const a=o.pinned?o.containerWidth:null!==(r=o.mainSectionViewportWidth)&&void 0!==r?r:o.containerWidth||(null===(l=t.parentElement)||void 0===l?void 0:l.clientWidth)||t.clientWidth||0,d=o.pinned?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,s,a),c=(t=>0===t.length?-1:Math.max(...t.map(t=>t.colIndex)))(e),h=w(t),u=new Set(d.map(t=>J({accessor:t.header.accessor,rowId:"header"}))),p=new Map,f=Array.from(new Set(e.map(t=>Math.round(t.top)))).sort((t,e)=>t-e);f.forEach((t,e)=>p.set(t,e));const v=t=>"header-band-"+Math.round(t.top),m=t=>{var e;return(null!==(e=p.get(Math.round(t.top)))&&void 0!==e?e:0)+1},x=g(t),R=o.animationCoordinator&&o.accordionAxis?o.accordionAxis:null,C="horizontal"===R?(t=>{const e=new Set,n=t=>{var i;for(const o of t)o.hide||o.excludeFromRender||(e.add(o.accessor+""),(null===(i=o.children)||void 0===i?void 0:i.length)&&n(o.children))};return n(t),e})(o.headers):null;let S=!1;h.forEach((e,n)=>{var i,s;if(!u.has(n)){x.delete(n);const r=null!==(i=e.getAttribute("data-accessor"))&&void 0!==i?i:"",l=null!==(s=null==C?void 0:C.has(r))&&void 0!==s&&s;"horizontal"===R&&o.animationCoordinator&&!l&&o.animationCoordinator.shouldRetain(n)?o.animationCoordinator.shrinkOutCell({cellId:n,element:e,container:t,axis:R}):e.remove(),h.delete(n),S=!0}}),S&&y(t);const I=[];d.forEach(e=>{const i=J({accessor:e.header.accessor,rowId:"header"}),s=!(!o.autoExpandColumns||o.pinned||e.colIndex!==c);if(h.has(i)){const r=h.get(i);n(t,v(e),m(e)),r.setAttribute("aria-colindex",e.colIndex+1+""),e.header.children&&e.header.children.length>0&&r.setAttribute("aria-colspan",U(e.header,o.headers,o.collapsedHeaders)+"");const l=x.get(i);if(!l||l.left!==e.left||l.top!==e.top||l.width!==e.width||l.height!==e.height){r.style.left=e.left+"px",r.style.top=e.top+"px";const t=r.dataset.stAccordionGrow;"horizontal"!==t&&(r.style.width=e.width+"px"),"vertical"!==t&&(r.style.height=e.height+"px"),x.set(i,{left:e.left,top:e.top,width:e.width,height:e.height})}e.header.isSelectionColumn&&o.enableRowSelection&&"function"==typeof o.areAllRowsSelected&&((t,e)=>{ge(t,e)})(r,o.areAllRowsSelected());const a=Pn(e,o,s);if(r.className!==a&&(r.className=a),K(e.header)){const t=o.collapsedHeaders.has(e.header.accessor);r.setAttribute("aria-expanded",!t+""),((t,e,n)=>{ye(t,!e,{ariaLabelWhenExpanded:n?`Collapse ${n} column`:"Collapse column",ariaLabelWhenCollapsed:n?`Expand ${n} column`:"Expand column",syncAriaExpanded:!0})})(r,t,e.header.label)}const d=`${o.sort&&o.sort.key.accessor===e.header.accessor?o.sort.direction:"none"}|${o.filters&&o.filters[e.header.accessor]?"1":"0"}`;r.dataset.stIconState!==d&&(((t,e,n,i)=>{const o=Ye(e,n),s=un(e,n),r=pn(e,n);if(e.headerRenderer){const l=t.querySelector(".st-header-label");return void(l&&$n(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))}})(r,e.header,o,e.colIndex),r.dataset.stIconState=d)}else I.push({cell:e,cellId:i,isLastMainAutoExpandColumn:s})});const H=o.animationCoordinator&&o.accordionAxis?o.accordionAxis:null,M=[];I.forEach(({cell:e,cellId:i,isLastMainAutoExpandColumn:s})=>{const r=((t,e,n)=>{var i,o,s;const{header:r,colIndex:l}=t,{reverse:a}=e,d=r.isSelectionColumn&&e.enableRowSelection,c=Pn(t,e,n),h=document.createElement("div");if(h.className=c,h.id=J({accessor:r.accessor,rowId:"header"}),h.setAttribute("data-accessor",r.accessor+""),h.setAttribute("role","columnheader"),h.setAttribute("aria-colindex",l+1+""),r.children&&r.children.length>0){const t=U(r,e.headers,e.collapsedHeaders);h.setAttribute("aria-colspan",t+"")}if(K(r)){const t=null!==(o=null===(i=e.getCollapsedHeaders)||void 0===i?void 0:i.call(e))&&void 0!==o?o:e.collapsedHeaders;h.setAttribute("aria-expanded",!t.has(r.accessor)+"")}r.isSortable&&((null===(s=e.sort)||void 0===s?void 0:s.key.accessor)===r.accessor?h.setAttribute("aria-sort","asc"===e.sort.direction?"ascending":"descending"):h.setAttribute("aria-sort","none"));const u=((t,e)=>{const n=[];return t.type&&"other"!==t.type&&n.push(t.type+" column"),t.isSortable&&n.push("sortable"),e&&n.push("filterable"),t.tooltip&&n.push(t.tooltip),n.join(", ")})(r,!!r.filterable);if(u){const t="header-desc-"+r.accessor;h.setAttribute("aria-describedby",t);const e=document.createElement("span");e.id=t,e.className="st-sr-only",e.textContent=u,h.appendChild(e)}h.style.position="absolute",h.style.left=t.left+"px",h.style.top=t.top+"px",h.style.width=t.width+"px",h.style.height=t.height+"px";const p=Ye(r,e),f=un(r,e),v=pn(r,e),w=a!==("right"===e.pinned);if(w){const t=Tn(r,e,n);t&&h.appendChild(t)}r.headerRenderer||"right"!==r.align||(v&&h.appendChild(v),f&&h.appendChild(f),p&&h.appendChild(p));const m=document.createElement("div");if(m.className="st-header-label",r.headerRenderer)$n(m,r,l,e,{sortIcon:p,filterIcon:f,collapseIcon:v});else{const t=Wn(r,e);m.appendChild(t)}if(b(m,"click",t=>{d||((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(J({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=An(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.isSortable&&i.onSort(e.accessor)}})(t,r,l,e)}),b(m,"dblclick",t=>{d||((t,e,n)=>{e.isSelectionColumn||n.selectableColumns&&e.isSortable&&n.onSort(e.accessor)})(0,r,e)}),On(m,h,r,e),h.appendChild(m),r.headerRenderer||"right"===r.align||(v&&h.appendChild(v),f&&h.appendChild(f),p&&h.appendChild(p)),!w){const t=Tn(r,e,n);t&&h.appendChild(t)}return e.headerRegistry&&!r.isSelectionColumn&&e.headerRegistry.set(r.accessor+"",{setEditing:t=>{if(t){const t=m.querySelector(".st-header-label-text");if(t){t.innerHTML="";const n=An(r,e,t);t.appendChild(n)}}}}),h})(e,o,s);r.dataset.stIconState=`${o.sort&&o.sort.key.accessor===e.header.accessor?o.sort.direction:"none"}|${o.filters&&o.filters[e.header.accessor]?"1":"0"}`,H&&o.animationCoordinator&&!o.animationCoordinator.hasSnapshotEntry(i)&&("vertical"===H?r.style.height="0px":r.style.width="0px",r.dataset.stAccordionGrow=H,M.push({element:r,cell:e})),n(t,v(e),m(e)).appendChild(r),h.set(i,r),x.set(i,{left:e.left,top:e.top,width:e.width,height:e.height})}),H&&M.length>0&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{for(const{element:t,cell:e}of M)t.isConnected&&("vertical"===H?t.style.height=e.height+"px":t.style.width=e.width+"px",delete t.dataset.stAccordionGrow)})}),o.pinned||(t.dataset.lastScrollLeft=s+""),d.forEach(t=>{const e=h.get(J({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")}),i(t)},Ln=(t,e)=>{t.style.left="0",t.style.width="number"!=typeof e||0>e?"100%":e+"px"},Dn=e=>{const{position:n,rowHeight:i,displayStrongBorder:o,heightOffsets:s,customTheme:r=t,isSticky:l=!1,sectionWidthPx:a}=e,d=document.createElement("div");d.className="st-row-separator "+(o?"st-last-group-row":"");const c=l?n:Bt({position:n,rowHeight:i,heightOffsets:s,customTheme:r});Ln(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},Bn=new WeakMap,jn=new WeakMap,zn=t=>(jn.has(t)||jn.set(t,new Map),jn.get(t)),Nn=(e,o,s,r=0,l,d,c,h)=>{var u,p,f,v,w,m,g,x;const b=s.pinned?null!==(p=null!==(u=s.containerWidth)&&void 0!==u?u:e.clientWidth)&&void 0!==p?p:0:null!==(w=null!==(v=null!==(f=s.mainSectionViewportWidth)&&void 0!==f?f:s.containerWidth)&&void 0!==v?v:e.clientWidth)&&void 0!==w?w:0,y=s.pinned?o:((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)})(o,r,b),R=a(e),C=(t=>(Bn.has(t)||Bn.set(t,new Map),Bn.get(t)))(e),S=new Set(y.map(t=>{var e;return J({accessor:t.header.accessor,rowId:null!==(e=t.stableRowKey)&&void 0!==e?e:t.rowId})}));let I=null;if(c)if(h)I=h;else{I=new Map;for(const t of o){const e=J({accessor:t.header.accessor,rowId:null!==(m=t.stableRowKey)&&void 0!==m?m:t.rowId});I.set(e,{left:t.left,top:t.top,width:t.width,height:t.height})}}const H=c&&s.accordionAxis?s.accordionAxis:null,M="horizontal"===H?(t=>{const e=new Set,n=t=>{var i;for(const o of t)o.hide||o.excludeFromRender||(e.add(o.accessor+""),(null===(i=o.children)||void 0===i?void 0:i.length)&&n(o.children))};return n(t),e})(s.headers):null,k=(null==l?void 0:l.length)?new Set(l.map(t=>t.position)):new Set(y.map(t=>t.rowIndex));R.forEach((t,n)=>{var i,o;if(!S.has(n)){const r=t.getAttribute("data-row-id");r&&Ee(r,t);const l=null==I?void 0:I.get(n);if(c&&c.shouldRetain(n)&&l)return c.retainCell({cellId:n,element:t,container:e,newPosition:l}),void R.delete(n);if(c&&"horizontal"===H&&c.shouldRetain(n)){const s=null!==(i=t.getAttribute("data-accessor"))&&void 0!==i?i:"";if(null===(o=null==M?void 0:M.has(s))||void 0===o||!o)return c.shrinkOutCell({cellId:n,element:t,container:e,axis:H}),void R.delete(n)}((t,e)=>{const n=Ie.get(t);void 0!==n&&(null==e||e.delete(n),Ie.delete(t))})(t,s.cellRegistry),t.remove(),R.delete(n)}});const E=zn(e);C.forEach((t,e)=>{k.has(e)||(t.remove(),C.delete(e),E.delete(e))});const T=null!==(g=s.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+T+1,O=(t,e)=>{var n;s.enableRowSelection?t.setAttribute("aria-selected",(null===(n=s.isRowSelected)||void 0===n?void 0:n.call(s,e.rowId))?"true":"false"):t.hasAttribute("aria-selected")&&t.removeAttribute("aria-selected")},P=!!s.rowGrouping&&s.rowGrouping.length>0,$=t=>{var e;return(null!==(e=t.stableRowKey)&&void 0!==e?e:et(t.rowId))+""},F=new Map;if(P&&l&&l.length>0){const t=new Map;for(const e of l){const n=null!==(x=e.rowIndexPath)&&void 0!==x?x:[],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 i=F.get($(n));i&&(t.setAttribute("aria-posinset",i.posinset+""),t.setAttribute("aria-setsize",i.setsize+""));const{expandable:o,expanded:r}=(t=>{var e;const n=t.depth,i=null===(e=s.rowGrouping)||void 0===e?void 0:e[n],o=!!i&<(t.row,i),r=!!s.rowGrouping&&s.rowGrouping.length>n,l=!s.canExpandRowGroup||s.canExpandRowGroup(t.row);return o&&r&&l||s.onRowGroupExpand&&r&&l?{expandable:!0,expanded:at(st(t),n,new Set(s.expandedDepths),s.expandedRows,s.collapsedRows)}:{expandable:!1,expanded:!1}})(n);o?t.setAttribute("aria-expanded",r+""):t.hasAttribute("aria-expanded")&&t.removeAttribute("aria-expanded")},D=[],B=new Set;y.forEach(t=>{var i,o,r,l,a;const c=J({accessor:t.header.accessor,rowId:null!==(i=t.stableRowKey)&&void 0!==i?i:t.rowId});if(!B.has(c))if(B.add(c),R.has(c)){const i=R.get(c),h=n(e,A(t),W(t));if(O(h,t),L(h,t),d)((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")})(i,t);else{if(Oe(i,t,s),t.header.isSelectionColumn&&s.enableRowSelection&&s.isRowSelected){const e=s.isRowSelected(t.rowId);ge(i,e)}if(t.header.expandable){const e=new Set(s.expandedDepths),n=null!==(r=null===(o=s.getExpandedRows)||void 0===o?void 0:o.call(s))&&void 0!==r?r:s.expandedRows,d=null!==(a=null===(l=s.getCollapsedRows)||void 0===l?void 0:l.call(s))&&void 0!==a?a:s.collapsedRows,c=at(st(t.tableRow),t.depth,e,n,d);ye(i,c)}}}else D.push({cell:t,cellId:c})});const j=[];D.forEach(({cell:t,cellId:i})=>{const o=null==c?void 0:c.claimRetainedForReuse(i,e);if(o){Oe(o,t,s);const r=n(e,A(t),W(t));return O(r,t),L(r,t),o.parentElement!==r&&r.appendChild(o),void R.set(i,o)}const r=We(t,s);H&&c&&!c.hasSnapshotEntry(i)&&("vertical"===H?r.style.height="0px":r.style.width="0px",r.dataset.stAccordionGrow=H,j.push({element:r,cell:t}));const l=n(e,A(t),W(t));O(l,t),L(l,t),l.appendChild(r),R.set(i,r)}),H&&j.length>0&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{for(const{element:t,cell:e}of j)t.isConnected&&("vertical"===H?t.style.height=e.height+"px":t.style.width=e.width+"px",delete t.dataset.stAccordionGrow)})}),((e,n,i,o,s)=>{const r=zn(e),l=i.pinned&&n.length>0?n.reduce((t,e)=>Math.max(t,e.left+e.width),0):0,a=(()=>{var t,n,o;if(i.pinned){const t=Math.max("number"==typeof i.pinnedSectionWidthPx&&i.pinnedSectionWidthPx>0?i.pinnedSectionWidthPx:e.clientWidth,l);return t>0?t:void 0}const s=null!==(o=null!==(n=null!==(t=i.mainSectionContainerWidth)&&void 0!==t?t:i.containerWidth)&&void 0!==n?n:e.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=Bt({position:s,rowHeight:i.rowHeight,heightOffsets:i.heightOffsets,customTheme:null!==(d=i.customTheme)&&void 0!==d?d:t});if(o.has(n)){const t=o.get(n);(!c||c.topPx!==h||c.displayStrongBorder!==l||c.sectionWidthPx!==a)&&(Ln(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 t=Dn({position:s,rowHeight:i.rowHeight,displayStrongBorder:l,heightOffsets:i.heightOffsets,customTheme:i.customTheme,isSticky:!1,sectionWidthPx:a});e.appendChild(t),o.set(n,t),r.set(n,{position:s,topPx:h,displayStrongBorder:l,sectionWidthPx:a})}})})(e,y,s,C,l),i(e)};function qn(t,e){return t?"string"==typeof t?t:t instanceof HTMLElement?t.cloneNode(!0):"function"==typeof t?t(e):null:null}function Vn(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?jt({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:et(r.rowId);for(const e of t.headerPositions){const n=J({accessor:e.accessor,rowId:l});i.set(n,{left:e.left,top:o,width:e.width,height:t.rowHeight})}}return i}class Gn{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),p=u.length>0?Math.max(...u.map(t=>t.colIndex))+1:a;this.nextColIndexMap.set(d,p);const f=this.getCachedContext("header-"+d,r,i,l),v=c.scrollLeft;return Fn(c,u,f,v),i||v===c.scrollLeft||(c.scrollLeft=v),!i&&c&&(c.__renderHeaderCells=(t,e)=>{if(!c)return;const n=void 0!==e?Object.assign(Object.assign({},f),{columnsWithSelectedCells:e.columnsWithSelectedCells,selectedColumns:e.selectedColumns}):f;Fn(c,u,n,t)}),c}renderBodySection(e){var n,i,o,s;const{headers:r,rows:l,collapsedHeaders:a,pinned:d,context:c,sectionWidth:h,rowHeight:u,heightOffsets:p,totalRowCount:f,startColIndex:v=0,positionOnly:w=!1,fullTableRows:m,renderedStartIndex:g,renderedEndIndex:x,allFlattenedRows:b,pageStartIndex:y,animationCoordinator:R}=e,C=d||"main";let S=this.bodySections.get(C);S||(S=document.createElement("div"),S.className="left"===d?"st-body-pinned-left":"right"===d?"st-body-pinned-right":"st-body-main",this.bodySections.set(C,S));const I=r.filter(t=>"left"===d?"left"===t.pinned:"right"===d?"right"===t.pinned:!t.pinned);if(0===I.length)return S.style.display="none",S;S.style.display="";const H=((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!==f?f:l.length,u,p,null!==(n=c.customTheme)&&void 0!==n?n:t);S.style.cssText=`\n position: relative;\n ${void 0!==h?`width: ${h}px;`:""}\n ${d?"":"flex-grow: 1;"}\n height: ${H}px;\n `;const M=this.getCachedBodyCells(C,I,l,a,u,p,null!==(i=c.customTheme)&&void 0!==i?i:t,v,m,g,x),k=null!==(o=null!=b?b:m)&&void 0!==o?o:l;this.captureSnapshotConfig(C,I,a,k,u,p,null!==(s=c.customTheme)&&void 0!==s?s:t,void 0!==b?null!=y?y:0:void 0);const E=R?this.getFullSectionLayout(C):null,T=l.filter(t=>!t.nestedTable&&!t.stateIndicator).length;this.nextColIndexMap.set(C,M.length>0&&T>0?v+M.length/T:v);const A=this.getCachedContext("body-"+C,c,d,h);return Nn(S,M,A,S.scrollLeft,l,w,R,null!=E?E:void 0),this.renderNestedGridRows(S,C,l,d,A,R),d||this.renderStateRows(S,C,l,A,R),!d&&S&&(S.__renderBodyCells=t=>{S&&Nn(S,M,A,t,l,!0)}),S}renderNestedGridRows(t,e,n,i,o,s){var r,l;const a=null!==(r=null==s?void 0:s.isEnabled())&&void 0!==r&&r,d=a?`transform ${s.getDuration()}ms ${s.getEasing()}, height ${s.getDuration()}ms ${s.getEasing()}`:"",c=n.filter(t=>t.nestedTable),h=new Set(c.map(t=>st(t)));let u=this.nestedGridRowsMap.get(e);u||(u=new Map,this.nestedGridRowsMap.set(e,u)),u.forEach((t,e)=>{var n;h.has(e)||(null===(n=t.cleanup)||void 0===n||n.call(t),t.element.remove(),u.delete(e))});const p={rowHeight:o.rowHeight,heightOffsets:o.heightOffsets,customTheme:null!==(l=o.customTheme)&&void 0!==l?l:{},theme:o.theme,rowGrouping:o.rowGrouping,depth:0,loadingStateRenderer:o.loadingStateRenderer,errorStateRenderer:o.errorStateRenderer,emptyStateRenderer:o.emptyStateRenderer,icons:o.icons,createNestedTable:o.createNestedTable};c.forEach(n=>{var s,r,l,c,h,f,v;const w=st(n),m=u.get(w);if(m){const t=jt({position:n.position,rowHeight:o.rowHeight,heightOffsets:o.heightOffsets,customTheme:null!==(s=o.customTheme)&&void 0!==s?s:{}}),e=_({calculatedHeight:n.nestedTable.calculatedHeight,customHeight:null===(r=n.nestedTable.expandableHeader.nestedTable)||void 0===r?void 0:r.height,customTheme:null!==(l=o.customTheme)&&void 0!==l?l:{}}),i=m.lastTop!==t,a=m.lastWrapperHeight!==e;return(i||a)&&(m.element.style.transition=d,i&&(m.element.style.transform=`translate3d(0, ${t}px, 0)`),a&&(m.element.style.height=e+"px"),m.lastTop=t,m.lastWrapperHeight=e),m.element.dataset.index=n.position+"",void(m.lastPosition=n.position)}const g=this.stateRowsMap.get(e),x=g&&g.has(w)?o.rowHeight:0,b=_({calculatedHeight:n.nestedTable.calculatedHeight,customHeight:null===(c=n.nestedTable.expandableHeader.nestedTable)||void 0===c?void 0:c.height,customTheme:null!==(h=o.customTheme)&&void 0!==h?h:{}}),y=jt({position:n.position,rowHeight:o.rowHeight,heightOffsets:o.heightOffsets,customTheme:null!==(f=o.customTheme)&&void 0!==f?f:{}});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=_({calculatedHeight:n.calculatedHeight,customHeight:null==i?void 0:i.height,customTheme:e.customTheme}),s=jt({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:o.rowHeight,heightOffsets:o.heightOffsets,customTheme:null!==(v=o.customTheme)&&void 0!==v?v:{}});a&&x!==b&&(e.style.height=x+"px"),t.appendChild(e),u.set(w,{element:e,lastPosition:n.position,lastTop:y,lastWrapperHeight:b}),a&&x!==b&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transition=d,e.style.height=b+"px"})})}else{p.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:o,customTheme:s,theme:r,rowGrouping:l,depth:a,loadingStateRenderer:d,errorStateRenderer:c,emptyStateRenderer:h,icons:u}=e,{parentRow:p,expandableHeader:f,childAccessor:v,calculatedHeight:w}=n,m=f.nestedTable;if(!m)throw Error("createNestedGridRow: expandableHeader.nestedTable is missing");const g=X(p,v),x=Array.isArray(g)?g:[],b=l&&l[a+1]?l.slice(a+1):void 0,y=m.customTheme?Object.assign(Object.assign({},s),m.customTheme):s,R=(({calculatedHeight:t,customHeight:e,customTheme:n})=>e?"string"==typeof e?e:e+"px":t-n.nestedGridPaddingTop-n.nestedGridPaddingBottom+"px")({calculatedHeight:w,customHeight:m.height,customTheme:s}),C=_({calculatedHeight:w,customHeight:m.height,customTheme:s}),S=jt({position:t.position,rowHeight:i,heightOffsets:o,customTheme:s}),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, ${S}px, 0)`,I.style.height=C+"px",I.style.paddingTop=s.nestedGridPaddingTop+"px",I.style.paddingBottom=s.nestedGridPaddingBottom+"px",I.style.paddingLeft=s.nestedGridPaddingLeft+"px",I.style.paddingRight=s.nestedGridPaddingRight+"px",I.style.boxSizing="border-box";const H=document.createElement("div");H.setAttribute("role","gridcell"),H.style.height="100%",H.style.width="100%",I.appendChild(H);const M=Object.assign(Object.assign({},m),{defaultHeaders:m.defaultHeaders,rows:x,theme:r,customTheme:y,height:R,rowGrouping:b,loadingStateRenderer:d,errorStateRenderer:c,emptyStateRenderer:h,icons:u});if(!e.createNestedTable)throw Error("createNestedGridRow: context.createNestedTable factory was not provided");const k=e.createNestedTable(H,M);k.mount();const E=()=>{k.destroy()};return I.__nestedTableCleanup=E,{element:I,cleanup:E}}(n,p);a&&x!==b&&(e.style.height=x+"px",e.style.overflow="hidden"),t.appendChild(e),u.set(w,{element:e,cleanup:i,lastPosition:n.position,lastTop:y,lastWrapperHeight:b}),a&&x!==b&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transition=d,e.style.height=b+"px"})})}})}renderStateRows(t,e,n,i,o){var s,r;const l=n.filter(t=>t.stateIndicator),a=new Set(l.map(t=>st(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=st(e),r=jt({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, ${jt({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=qn(e.loadingStateRenderer,{parentRow:i.parentRow}):i.state.error&&e.errorStateRenderer?r=qn(e.errorStateRenderer,{error:i.state.error,parentRow:i.parentRow}):i.state.isEmpty&&e.emptyStateRenderer&&(r=qn(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(t.hide||t.excludeFromRender)return 0;const c=e.has(t.accessor);if(t.children&&t.children.length>0){const e=t.children.filter(t=>{const e=t.showWhen||"parentExpanded";return c?"parentCollapsed"===e||"always"===e:"parentExpanded"===e||"always"===e});if(t.singleRowChildren){const c="number"==typeof t.width?t.width:150;s.push({header:t,left:l,top: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 p=0;return e.forEach(e=>{p+=a(e,o+1,t)}),s.push({header:t,left:h,top:o*i,width:p,height:i,colIndex:u,parentHeader:d}),p}{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?jt({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:et(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(t.hide||t.excludeFromRender)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}createHeadersHash(t){const e=t=>{let n=`${t.accessor}:${t.width}:${t.pinned||""}:${t.hide||""}`;return t.children&&t.children.length>0&&(n+=`:children[${t.children.map(e).join(",")}]`),n};return t.map(e).join("|")}createHeightOffsetsHash(t){return t&&0!==t.length?t.map(([t,e])=>`${t}:${e}`).join("|"):""}createContextHash(t){let e=["columnBorders","enableRowSelection","cellUpdateFlash","useOddColumnBackground","useHoverRowBackground","useOddEvenRowBackground","rowHeight","containerWidth"].map(e=>`${e}:${t[e]}`).join("|");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),p=null!=a&&null!=d&&null!=c,f=this.bodyCellsCache.get(t),v=f&&f.deps.headersHash===h&&f.deps.collapsedHeadersSize===i.size&&f.deps.rowHeight===o&&f.deps.heightOffsetsHash===u&&(p?f.deps.fullTableRowsRef===a&&void 0!==f.deps.bandStart&&void 0!==f.deps.bandEnd&&((t,e)=>d>=t&&e>=c)(f.deps.bandStart,f.deps.bandEnd):f.deps.rowsRef===n);if(v&&f){if(!p)return f.cells;const t=new Map;n.forEach((e,n)=>{t.set(e.position,n)});const e=[];for(const n of f.cells){const 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(p){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 x=this.calculateAbsoluteBodyCells(e,w,i,o,s,r,l);if(this.bodyCellsCache.set(t,{cells:x,deps:Object.assign({headersHash:h,rowsRef:w,collapsedHeadersSize:i.size,rowHeight:o,heightOffsetsHash:u},p&&{fullTableRowsRef:a,bandStart:m,bandEnd:g})}),!p)return x;const b=new Map;n.forEach((t,e)=>{b.set(t.position,e)});const y=[];for(const t of x){const e=b.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)}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=>{(t=>{if(t){const e=a(t);e.forEach(t=>{t.remove()}),e.clear(),o(t)}})(t)}),this.headerSections.forEach(t=>{(t=>{if(c=0,t){const e=w(t);e.forEach(t=>{t.remove()}),e.clear(),g(t).clear(),y(t),o(t)}})(t)}))}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,Vn(e))}),t}getFullSectionLayout(t){const e=this.bodySectionSnapshots.get(t);return e?Vn(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})}cleanup(){this.headerSections.clear(),this.bodySections.clear(),this.bodyCellsCache.clear(),this.headerCellsCache.clear(),this.contextCache.clear(),this.bodySectionSnapshots.clear(),this.nextColIndexMap.clear()}}const Kn=(t,e)=>{"string"==typeof e?t.innerHTML=e:(t.innerHTML="",t.appendChild(e.cloneNode(!0)))},Un=(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(Un([t],e,n),!1===t.hide){o=!0;break}(t||o)&&(i.hide=!1)}},Jn=t=>t.every(t=>t.hide),_n=t=>{t.forEach(t=>{t.children&&t.children.length>0&&(_n(t.children),Jn(t.children)&&(t.hide=!0))})},Yn=(t,e)=>{const n=e.toLowerCase();return!!t.label.toLowerCase().includes(n)||!(!t.children||0>=t.children.length)&&t.children.some(t=>Yn(t,e))},Xn=(t,e,n)=>{if(!e.trim())return t;const i=n||Yn;return t.filter(t=>!t.isSelectionColumn&&!t.excludeFromRender&&i(t,e))};function Qn(t,e,n,i){e&&t.appendChild(e),t.appendChild(n),i&&t.appendChild(i)}function Zn(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 ti=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:p}=e,f="",v=null,w=null,m=!1;const g=new Set,x=t=>{t.forEach(t=>{t.children&&t.children.length>0&&(g.add(t.accessor),x(t.children))})};x(n);let b=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 C=null,S=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=>{f=t.target.value,P()}),n.appendChild(i),e.appendChild(n),{wrapper:e,input:i}}(s);S=t.wrapper,C=t.input}const I=document.createElement("div");I.className="st-column-editor-lists";let H=null;p&&(H=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}(p));let M=l.customRenderer;M?Zn(R,M,n,S,I,H,p):Qn(R,S,I,H),y.appendChild(R);const k=t=>{v=t,null!==t?m=!0:(m=!1,P())},E=()=>{w=null},T=t=>{w=t,m?W():P()},A=t=>{const e=b;b=t,P(e)},W=()=>{I.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,p)=>{if(0===t.length)return;const m=t.filter(t=>!t.isSelectionColumn&&!t.excludeFromRender);if(0===(o?Xn(m,f,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 x=((t,e)=>{const n=o?Xn(t,f,r):t,i=[],s=o&&f.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||b.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);x.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:p,hoveredSeparator:f,panelSection:v,rowIndex:w,setDraggingRow:m,setExpandedHeaders:g,setHoveredSeparator:x,headers:b,setHeaders:y,onColumnVisibilityChange:R,onColumnOrderChange:C,previousExpandedHeaders:S}=t,I=null!==(e=t.essentialAccessors)&&void 0!==e?e:new Set,H=!1!==t.columnEditorConfig.allowColumnPinning,M=je(p,I),k=!M,E=document.createDocumentFragment(),T=16*s+"px",A=p.children&&p.children.length>0,W=!(p.hide||A&&p.children&&Jn(p.children)),O=c.has(p.accessor),P=u||O,$=null!==f&&f.panelSection===(null!=v?v:"main");let F;if(0===w){const t=document.createElement("div");t.className="st-column-editor-drag-separator",t.style.opacity=$&&-1===f.index?"1":"0",E.appendChild(t)}const L=document.createElement("div");L.className="st-header-checkbox-item",L.style.paddingLeft=T,L.draggable=!0;const D=t=>!(I.size>0&&!Ne(t,I)||(null==C||C(t),y(t),0)),B=t=>{if(t.stopPropagation(),u)return;const e=new Set(c);O?e.delete(p.accessor):e.add(p.accessor),g(e)};let j;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===v){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});x(null===i?null:{panelSection:null!=v?v:"main",index:i})}}),L.addEventListener("dragend",()=>{const t=a?a():l,e=d?d():f,n=()=>{m(null),x(null)};if(!t||null===e||t.panelSection!==v)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=fn(b,t.header.accessor),r=fn(b,o.header.accessor);if(!s||!r)return void n();const{newHeaders:c,emergencyBreak:u}=mn(b,s,r);u||D(c),n()}),r){const e=document.createElement("div");if(e.className="st-header-icon-container",A){const t=void 0!==S?u||S.has(p.accessor):P,n=!u&&void 0!==S&&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 ${p.label} column`:`Expand ${p.label} column`),o.appendChild(ae("st-expand-icon")),o.addEventListener("click",B),o.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),B(t))}),e.appendChild(o),j=o,n&&(F=()=>{ye(L,P,{ariaLabelWhenExpanded:`Collapse ${p.label} column`,ariaLabelWhenCollapsed:`Expand ${p.label} column`,syncAriaExpanded:!0})})}t.columnEditorConfig.rowRenderer||L.appendChild(e)}const z=xe({checked:W,onChange:t=>{if(!k)return;p.hide=!t,t?(Un(i,p.accessor),A&&p.children&&p.children.length>0&&p.children.every(t=>!0===t.hide)&&p.children[0]&&(p.children[0].hide=!1,Un(i,p.children[0].accessor))):_n(i);const e=[...b];if(y(Pe(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 N=document.createElement("div");N.className="st-drag-icon-container";const q=null===(n=t.icons)||void 0===n?void 0:n.drag;"string"==typeof q?N.innerHTML=q:q instanceof HTMLElement||q instanceof SVGSVGElement?N.appendChild(q.cloneNode(!0)):N.innerHTML='<svg\n aria-hidden="true"\n role="img"\n xmlns="http://www.w3.org/2000/svg"\n viewBox="0 0 16 10"\n style="height: 10px; width: 16px;"\n>\n <circle cx="3" cy="3" r="1.5" fill="currentColor" />\n <circle cx="8" cy="3" r="1.5" fill="currentColor" />\n <circle cx="13" cy="3" r="1.5" fill="currentColor" />\n <circle cx="3" cy="7" r="1.5" fill="currentColor" />\n <circle cx="8" cy="7" r="1.5" fill="currentColor" />\n <circle cx="13" cy="7" r="1.5" fill="currentColor" />\n</svg>';const V=document.createElement("div");V.className="st-column-label-container",V.textContent=p.label;const G="left"===p.pinned||"right"===p.pinned?p.pinned:null,K=!!G&&!M,U=!G&&"main"===v,J=!G&&"main"===v,_=()=>{const t=Ue(b,p.accessor,"left",I);t&&D(t)},Y=()=>{const t=Ue(b,p.accessor,"right",I);t&&D(t)},X=()=>{const t=Ue(b,p.accessor,"main",I);t&&D(t)},{rowRenderer:Q}=t.columnEditorConfig;if(Q){const t=Q({accessor:p.accessor,header:p,components:{expandIcon:j,checkbox:z.element,dragIcon:N,labelContent:V},panelSection:v,isEssential:M,canToggleVisibility:k,allowColumnPinning:H,pinControl:H&&0===s?{pinnedSide:G,canPinLeft:U,canPinRight:J,canUnpin:K,pinLeft:_,pinRight:Y,unpin:X}:void 0});t instanceof HTMLElement?L.appendChild(t):"string"==typeof t&&(L.innerHTML=t)}else if(L.appendChild(z.element),L.appendChild(N),L.appendChild(V),H&&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=M;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(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(),_()}),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(),Y()}),t.appendChild(e)}}L.appendChild(t)}E.appendChild(L);const Z=document.createElement("div");return Z.className="st-column-editor-drag-separator",Z.style.opacity=$&&f.index===w?"1":"0",E.appendChild(Z),{fragment:E,scheduleExpandIconAnimation:F}})({allHeaders:n,clearHoverSeparator:E,depth:t.depth,doesAnyHeaderHaveChildren:y,draggingRow:v,getDraggingRow:()=>v,getHoveredSeparator:()=>w,expandedHeaders:b,flattenedHeaders:x,forceExpanded:o&&f.trim().length>0,header:t.header,hoveredSeparator:w,panelSection:e,rowIndex:t.visualIndex,setDraggingRow:k,setExpandedHeaders:A,setHoveredSeparator:T,columnEditorConfig:l,icons:a,essentialAccessors:null!=d?d:new Set,headers:n,setHeaders:c,onColumnVisibilityChange:h,onColumnOrderChange:u,previousExpandedHeaders:p});g.appendChild(s.fragment),null===(i=s.scheduleExpandIconAnimation)||void 0===i||i.call(s)})},P=t=>{I.innerHTML="";const e=!1!==l.allowColumnPinning,{pinnedLeft:i,unpinned:o,pinnedRight:s}=Be(n);if(e)O(i,"left","Pinned Left",I,t),O(o,"main","Main",I,t),O(s,"right","Pinned Right",I,t);else{const e=[...i,...o,...s];O(e,"main",null,I,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&&(p=t.resetColumns);let e=!1;if(void 0!==t.columnEditorConfig){const n=t.columnEditorConfig.customRenderer;n!==M&&(M=n,e=!0),l=t.columnEditorConfig}void 0!==t.open&&(i=t.open,i?y.classList.add("open"):y.classList.remove("open")),C&&void 0!==t.searchPlaceholder&&(C.placeholder=t.searchPlaceholder),e&&(R.innerHTML="",M?Zn(R,M,n,S,I,H,p):Qn(R,S,I,H)),P()},destroy:()=>{C&&(C.removeEventListener("input",()=>{}),C.removeEventListener("click",()=>{})),y.removeEventListener("click",()=>{}),y.remove()}}},ei=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:p,sectionScrollController:f,startColIndex:v,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(t.hide||t.excludeFromRender)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),x=new Map;let b=0;g.forEach(t=>{const e="number"==typeof t.width?t.width:150;x.set(t.accessor,{left:b,width:e}),b+=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,p=document.createElement("div");p.className="st-row st-sticky-parent",p.style.position="absolute",p.style.top="0px",p.style.left="0",p.style.right="0",p.style.height=r+"px",p.style.transform=`translateY(${h}px)`,p.style.zIndex=u+"",p.setAttribute("data-index",t.position+""),g.forEach((e,n)=>{var i,o;const s=x.get(e.accessor),l=v+n,a={header:e,row:t.row,rowIndex:w(t),colIndex:l,rowId:et(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=We(a,d);p.appendChild(c)}),m.appendChild(p);const f=Dn({position:(e+1)*(r+1)-1+c,rowHeight:r,displayStrongBorder:!1,heightOffsets:l,customTheme:a,isSticky:!0,sectionWidthPx:y});m.appendChild(f)}),f&&p&&f.registerPane("pinned-left"===p?"pinned-left":"pinned-right"===p?"pinned-right":"main",m,"sticky"),m},ni=(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 ii{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 Gn}scheduleRender(t){this.renderScheduled||(this.renderScheduled=!0,this.pendingRenderCallback=t,queueMicrotask(()=>{this.renderScheduled=!1,this.pendingRenderCallback&&(this.pendingRenderCallback(),this.pendingRenderCallback=null)}))}invalidateCache(t){this.sectionRenderer.invalidateCache(t)}getCurrentBodyLayouts(){return this.sectionRenderer.getCurrentBodyLayouts()}renderHeader(t,e,n,i){var o,s,r,l,a,d,c,h,u,p,f,v;if(!t||i.config.hideHeader)return;t.style.height=e+"px";const w=$e(i.effectiveHeaders,"left")||$e(i.effectiveHeaders,void 0)||$e(i.effectiveHeaders,"right");t.style.minHeight=w?"":e+"px";const m=t.parentElement;m&&(m.setAttribute("aria-rowcount",1+i.localRows.length+""),m.setAttribute("aria-colcount",i.effectiveHeaders.length+""),i.config.enableRowSelection?m.setAttribute("aria-multiselectable","true"):m.removeAttribute("aria-multiselectable"));const g=null!==(s=null===(o=i.dimensionManager)||void 0===o?void 0:o.getState())&&void 0!==s?s:{containerWidth:0,calculatedHeaderHeight:i.customTheme.headerHeight,maxHeaderDepth:1},{mainWidth:x,leftWidth:b,rightWidth:y}=yn({headers:i.effectiveHeaders,containerWidth:g.containerWidth,collapsedHeaders:i.collapsedHeaders}),R=null===(r=i.sortManager)||void 0===r?void 0:r.getState(),C=null===(l=i.filterManager)||void 0===l?void 0:l.getState(),S=null!==(d=null===(a=i.rowSelectionManager)||void 0===a?void 0:a.getSelectedRowCount())&&void 0!==d?d:0,I={reverse:!1,collapsedHeaders:i.collapsedHeaders,getCollapsedHeaders:i.getCollapsedHeaders,columnBorders:null!==(c=i.config.columnBorders)&&void 0!==c&&c,columnReordering:null!==(h=i.config.columnReordering)&&void 0!==h&&h,columnResizing:null!==(u=i.config.columnResizing)&&void 0!==u&&u,containerWidth:g.containerWidth,mainSectionContainerWidth:x,mainSectionViewportWidth:bn({containerWidth:g.containerWidth,leftWidth:b,rightWidth:y}),enableHeaderEditing:i.config.enableHeaderEditing,enableRowSelection:i.config.enableRowSelection,selectedRowCount:S,filters:null!==(p=null==C?void 0:C.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!==(f=null==R?void 0:R.sort)&&void 0!==f?f:null,autoExpandColumns:null!==(v=i.config.autoExpandColumns)&&void 0!==v&&v,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=>{i.setCollapsedHeaders("function"==typeof t?t(i.collapsedHeaders):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},H=i.effectiveHeaders.filter(t=>"left"===t.pinned),M=i.effectiveHeaders.filter(t=>!t.pinned),k=i.effectiveHeaders.filter(t=>"right"===t.pinned);let E=0;const T=[];if(H.length>0){const e=this.sectionRenderer.renderHeaderSection({headers:i.effectiveHeaders,collapsedHeaders:i.collapsedHeaders,pinned:"left",maxHeaderDepth:n,headerHeight:i.customTheme.headerHeight,context:I,sectionWidth:b,startColIndex:E});i.pinnedLeftHeaderRef.current=e,T.push(e),t.appendChild(e),E=this.sectionRenderer.getNextColIndex("left")}if(M.length>0){const e=this.sectionRenderer.renderHeaderSection({headers:i.effectiveHeaders,collapsedHeaders:i.collapsedHeaders,maxHeaderDepth:n,headerHeight:i.customTheme.headerHeight,context:I,sectionWidth:x,startColIndex:E});i.mainHeaderRef.current=e,T.push(e),t.appendChild(e),E=this.sectionRenderer.getNextColIndex("main")}if(k.length>0){const e=this.sectionRenderer.renderHeaderSection({headers:i.effectiveHeaders,collapsedHeaders:i.collapsedHeaders,pinned:"right",maxHeaderDepth:n,headerHeight:i.customTheme.headerHeight,context:I,sectionWidth:y,startColIndex:E});i.pinnedRightHeaderRef.current=e,T.push(e),t.appendChild(e)}Array.from(t.children).forEach(t=>{T.includes(t)||t.remove()})}renderBody(t,e,n){var i,o,s,r,l,a,d,c,h,u,p,f,v,w,m,g,x,b,y,R,C,S,I;if(!t)return;if($e(n.effectiveHeaders,"left")||$e(n.effectiveHeaders,void 0)||$e(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 H=e.rowsToRender||e.currentTableRows,M=!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}),M){t.innerHTML="";const e=document.createElement("div");return e.className="st-empty-state-wrapper","string"==typeof n.config.tableEmptyStateRenderer?e.textContent=n.config.tableEmptyStateRenderer:n.config.tableEmptyStateRenderer instanceof HTMLElement?e.appendChild(n.config.tableEmptyStateRenderer.cloneNode(!0)):e.innerHTML="<div class='st-empty-state'>No rows to display</div>",void t.appendChild(e)}const k=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:E,leftWidth:T,rightWidth:A}=yn({headers:n.effectiveHeaders,containerWidth:k.containerWidth,collapsedHeaders:n.collapsedHeaders}),W=null!==(d=null===(a=n.rowSelectionManager)||void 0===a?void 0:a.getSelectedRowCount())&&void 0!==d?d:0,O=null!==(c=k.maxHeaderDepth)&&void 0!==c?c:1,P=null===(h=z(n.effectiveHeaders).find(t=>!t.isSelectionColumn))||void 0===h?void 0:h.accessor,$={collapsedHeaders:n.collapsedHeaders,collapsedRows:n.getCollapsedRows(),expandedRows:n.getExpandedRows(),expandedDepths:Array.from(n.expandedDepths),selectedColumns:null!==(p=null===(u=n.selectionManager)||void 0===u?void 0:u.getSelectedColumns())&&void 0!==p?p:new Set,rowsWithSelectedCells:null!==(v=null===(f=n.selectionManager)||void 0===f?void 0:f.getRowsWithSelectedCells())&&void 0!==v?v:new Set,columnBorders:null!==(w=n.config.columnBorders)&&void 0!==w&&w,enableRowSelection:n.config.enableRowSelection,selectedRowCount:W,cellUpdateFlash:n.config.cellUpdateFlash,useOddColumnBackground:n.config.useOddColumnBackground,useHoverRowBackground:null===(m=n.config.useHoverRowBackground)||void 0===m||m,useOddEvenRowBackground:n.config.useOddEvenRowBackground,rowGrouping:n.config.rowGrouping,headers:n.effectiveHeaders,rowHeaderAccessor:P,rowHeight:n.customTheme.rowHeight,maxHeaderDepth:O,heightOffsets:e.paginatedHeightOffsets,customTheme:n.customTheme,containerWidth:k.containerWidth,mainSectionContainerWidth:E,mainSectionViewportWidth:bn({containerWidth:k.containerWidth,leftWidth:T,rightWidth:A}),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)},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!==(g=n.config.theme)&&void 0!==g?g:"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)},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},F=n.effectiveHeaders.filter(t=>"left"===t.pinned),L=n.effectiveHeaders.filter(t=>!t.pinned),D=n.effectiveHeaders.filter(t=>"right"===t.pinned);let B=0;const j=[],N=n.positionOnlyBody?void 0:n.animationCoordinator;if(F.length>0){const i=this.sectionRenderer.renderBodySection({headers:n.effectiveHeaders,rows:H,collapsedHeaders:n.collapsedHeaders,pinned:"left",context:$,sectionWidth:T,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,totalRowCount:e.currentTableRows.length,startColIndex:B,positionOnly:n.positionOnlyBody,fullTableRows:e.currentTableRows,renderedStartIndex:e.renderedStartIndex,renderedEndIndex:e.renderedEndIndex,allFlattenedRows:e.allFlattenedRows,pageStartIndex:e.pageStartIndex,animationCoordinator:N});n.pinnedLeftRef.current=i,j.push(i),i.parentElement!==t&&t.insertBefore(i,t.firstChild),B=this.sectionRenderer.getNextColIndex("left")}if(L.length>0){const i=this.sectionRenderer.renderBodySection({headers:n.effectiveHeaders,rows:H,collapsedHeaders:n.collapsedHeaders,context:$,sectionWidth:E,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,totalRowCount:e.currentTableRows.length,startColIndex:B,positionOnly:n.positionOnlyBody,fullTableRows:e.currentTableRows,renderedStartIndex:e.renderedStartIndex,renderedEndIndex:e.renderedEndIndex,allFlattenedRows:e.allFlattenedRows,pageStartIndex:e.pageStartIndex,animationCoordinator:N});if(n.mainBodyRef.current=i,j.push(i),i.parentElement!==t){const e=n.pinnedRightRef.current;e&&e.parentElement===t?t.insertBefore(i,e):t.appendChild(i)}B=this.sectionRenderer.getNextColIndex("main")}if(D.length>0){const i=this.sectionRenderer.renderBodySection({headers:n.effectiveHeaders,rows:H,collapsedHeaders:n.collapsedHeaders,pinned:"right",context:$,sectionWidth:A,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,totalRowCount:e.currentTableRows.length,startColIndex:B,positionOnly:n.positionOnlyBody,fullTableRows:e.currentTableRows,renderedStartIndex:e.renderedStartIndex,renderedEndIndex:e.renderedEndIndex,allFlattenedRows:e.allFlattenedRows,pageStartIndex:e.pageStartIndex,animationCoordinator:N});n.pinnedRightRef.current=i,j.push(i),i.parentElement!==t&&t.appendChild(i)}if(n.config.enableStickyParents&&e.stickyParents&&e.stickyParents.length>0){this.stickyParentsContainer&&(ni(this.stickyParentsContainer,null!==(x=n.sectionScrollController)&&void 0!==x?x:null),this.stickyParentsContainer=null);const i=n.externalScrollActive?null!==(b=n.stickyParentsScrollTop)&&void 0!==b?b:0:null!==(R=null===(y=n.mainBodyRef.current)||void 0===y?void 0:y.scrollTop)&&void 0!==R?R:0,o=t.offsetWidth-t.clientWidth,s={left:0,main:F.length>0?this.sectionRenderer.getNextColIndex("left"):0,right:L.length>0?this.sectionRenderer.getNextColIndex("main"):F.length>0?this.sectionRenderer.getNextColIndex("left"):0},r=H.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:et(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:et(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 p=0;for(const t of e){if(!(null===(l=t.parentIndices)||void 0===l?void 0:l.includes(u)))break;p++}if(0===p)return{treeTransitionOffset:0,offsetStartIndex:c};const f=e[0];let v;return v=n?n.rowTopPositions[f.position]:f.position*(i+o.rowSeparatorWidth),{treeTransitionOffset:-((h+1-p)*i+Math.max(0,s-v)),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.editColumns?"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=ei({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 p=ei({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(p),t.pinnedRightColumns.length>0){const o=ei({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:k.calculatedHeaderHeight,heightMap:e.heightMap,partiallyVisibleRows:e.partiallyVisibleRows||[],pinnedLeftColumns:F,pinnedLeftWidth:T,pinnedRightColumns:D,pinnedRightWidth:A,scrollTop:i,scrollbarWidth:o,stickyParents:e.stickyParents,stickySectionColStart:s,stickyBodyRowIndexByRowKey:l,externalScrollActive:n.externalScrollActive},{collapsedHeaders:n.collapsedHeaders,customTheme:n.customTheme,editColumns:null!==(C=n.config.editColumns)&&void 0!==C&&C,headers:n.effectiveHeaders,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,cellRenderContext:$,sectionScrollController:null!==(S=n.sectionScrollController)&&void 0!==S?S: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&&(ni(this.stickyParentsContainer,null!==(I=n.sectionScrollController)&&void 0!==I?I:null),this.stickyParentsContainer=null);Array.from(t.children).forEach(t=>{j.includes(t)||t.remove()})}renderFooter(t,e,n,i,o){var s,r,l,a,d,c,h,u,p,f,v,w;if(!t)return;const m=!!o.config.footerRenderer,g=o.config.shouldPaginate&&!o.config.hideFooter;if(m||(this.lastCustomFooterRenderer=null,this.lastCustomFooterKey=null),!m&&!g)return void(t.innerHTML="");const x=null!==(s=o.config.rowsPerPage)&&void 0!==s?s:10,b=Math.ceil(e/x);if(m){const s=(n-1)*x+1,d=Math.min(n*x,e),c=`${n}|${e}|${x}|${b}|${o.config.hideFooter?1:0}`;if(t.childNodes.length>0&&this.lastCustomFooterRenderer===o.config.footerRenderer&&this.lastCustomFooterKey===c)return void(this.footerInstance=null);this.lastCustomFooterRenderer=o.config.footerRenderer,this.lastCustomFooterKey=c;const h=null!==(r=o.config.serverSidePagination)&&void 0!==r&&r,u=t=>{if(h&&o.config.onPageChange)return o.config.onPageChange(t)},p=o.config.footerRenderer({currentPage:n,endRow:d,hasNextPage:b>n,hasPrevPage:n>1,nextIcon:null===(l=o.resolvedIcons)||void 0===l?void 0:l.next,onNextPage:async()=>{b>n&&(i(n+1),o.config.onNextPage&&await o.config.onNextPage(n+1),await u(n+1))},onPageChange:t=>{i(t),u(t)},onPrevPage:()=>{n>1&&(i(n-1),u(n-1))},prevIcon:null===(a=o.resolvedIcons)||void 0===a?void 0:a.prev,rowsPerPage:x,startRow:s,totalPages:b,totalRows:e});return t.innerHTML="",p instanceof HTMLElement?t.appendChild(p):"string"==typeof p&&(t.innerHTML=p),void(this.footerInstance=null)}if(this.footerInstance)this.footerInstance.update({currentPage:n,hideFooter:null!==(d=o.config.hideFooter)&&void 0!==d&&d,onPageChange:i,onNextPage:o.config.onNextPage,onUserPageChange:o.config.onPageChange,rowsPerPage:x,shouldPaginate:null!==(c=o.config.shouldPaginate)&&void 0!==c&&c,totalPages:b,totalRows:e,prevIcon:null===(h=o.resolvedIcons)||void 0===h?void 0:h.prev,nextIcon:null===(u=o.resolvedIcons)||void 0===u?void 0:u.next});else{t.innerHTML="";const s=(t=>{let{currentPage:e,hideFooter:n,onPageChange:i,onNextPage:o,onUserPageChange:s,rowsPerPage:r,shouldPaginate:l,totalPages:a,totalRows:d,prevIcon:c,nextIcon:h}=t,u=!0;if(n||!l)return{element:document.createElement("div"),update:()=>{},destroy:()=>{}};const p=document.createElement("div");p.className="st-footer";const f=()=>{p.innerHTML="";const t=e>1,n=a>e,l=e===a,v=Math.min((e-1)*r+1,d),w=Math.min(e*r,d),m=!t,g=!n&&!o||!u&&l,x=document.createElement("div");x.className="st-footer-info";const b=document.createElement("span");b.className="st-footer-results-text",b.textContent=`Showing ${v} to ${w} of ${d.toLocaleString()} results`,x.appendChild(b),p.appendChild(x);const y=document.createElement("div");y.className="st-footer-pagination";const R=((t,e)=>{if(15>=e)return Array.from({length:e},(t,e)=>e+1);const n=[];let 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),C=[];R.forEach((t,n)=>{if(0>t){const t=document.createElement("span");t.className="st-page-ellipsis",t.textContent="...",y.appendChild(t)}else{const 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),C.push({button:o,page:t,afterEllipsis:r})}}),C.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 S=document.createElement("button");S.className="st-next-prev-btn "+(m?"disabled":""),S.disabled=m,S.setAttribute("aria-label","Go to previous page"),c?Kn(S,c):S.innerHTML='<svg\n class="st-next-prev-icon"\n viewBox="0 0 24 24"\n width="24"\n height="24"\n xmlns="http://www.w3.org/2000/svg"\n>\n <path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z" />\n</svg>',S.addEventListener("click",async()=>{const t=e-1;1>t||(i(t),s&&await s(t))}),y.appendChild(S);const I=document.createElement("button");I.className="st-next-prev-btn "+(g?"disabled":""),I.disabled=g,I.setAttribute("aria-label","Go to next page"),h?Kn(I,h):I.innerHTML='<svg\n class="st-next-prev-icon"\n viewBox="0 0 24 24"\n width="24"\n height="24"\n xmlns="http://www.w3.org/2000/svg"\n>\n <path d="M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z" />\n</svg>',I.addEventListener("click",async()=>{const t=e+1;if(o&&e===a&&!await o(e))return u=!1,void f();t>a&&!o||(i(t),s&&await s(t))}),y.appendChild(I),p.appendChild(y)};return f(),{element:p,update:t=>{void 0!==t.currentPage&&(e=t.currentPage),void 0!==t.hideFooter&&(n=t.hideFooter),void 0!==t.onPageChange&&(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.shouldPaginate&&(l=t.shouldPaginate),void 0!==t.totalPages&&(a=t.totalPages),void 0!==t.totalRows&&(d=t.totalRows),void 0!==t.prevIcon&&(c=t.prevIcon),void 0!==t.nextIcon&&(h=t.nextIcon),n||!l?p.style.display="none":(p.style.display="flex",f())},destroy:()=>{p.remove()}}})({currentPage:n,hideFooter:null!==(p=o.config.hideFooter)&&void 0!==p&&p,onPageChange:i,onNextPage:o.config.onNextPage,onUserPageChange:o.config.onPageChange,rowsPerPage:x,shouldPaginate:null!==(f=o.config.shouldPaginate)&&void 0!==f&&f,totalPages:b,totalRows:e,prevIcon:null===(v=o.resolvedIcons)||void 0===v?void 0:v.prev,nextIcon:null===(w=o.resolvedIcons)||void 0===w?void 0:w.next});this.footerInstance=s,t.appendChild(s.element)}}renderColumnEditor(t,e,n,i,o){if(!t)return;if(!o.config.editColumns)return void(this.columnEditorInstance&&(this.columnEditorInstance.destroy(),this.columnEditorInstance=null));const s=()=>{const t=o.config.defaultHeaders;if(t){const e=t.map(t=>Object.assign({},t));o.setHeaders(e),o.onRender()}};if(this.columnEditorInstance)this.columnEditorInstance.update({columnEditorText:i.text,editColumns:o.config.editColumns,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,editColumns:n,headers:i,open:o,searchEnabled:s,searchPlaceholder:r,searchFunction:l,columnEditorConfig:a,icons:d,essentialAccessors:c,resetColumns:h,setHeaders:u,onColumnVisibilityChange:p,onColumnOrderChange:f,setOpen:v}=t;if(!n)return{element:document.createElement("div"),update:()=>{},destroy:()=>{}};const w=document.createElement("div");w.className="st-column-editor "+(o?"open":""),w.style.width="29.5px";const m=t=>{v(!o)},g=document.createElement("div");g.className="st-column-editor-text",g.textContent=e,w.addEventListener("click",m),w.appendChild(g);const x=ti({headers:i,open:o,searchEnabled:s,searchPlaceholder:r,searchFunction:l,columnEditorConfig:a,icons:d,essentialAccessors:c,resetColumns:h,setHeaders:u,onColumnVisibilityChange:p,onColumnOrderChange:f});w.appendChild(x.element);const b={update:t=>{void 0!==t.open&&(o=t.open,t.open?w.classList.add("open"):w.classList.remove("open")),void 0!==t.setOpen&&(v=t.setOpen),void 0!==t.columnEditorText&&(g.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.removeEventListener("click",m),x.destroy(),w.remove()}};return w.__columnEditor=b,Object.assign({element:w},b)})({columnEditorText:i.text,editColumns:o.config.editColumns,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;if(t&&l.mainBodyRef.current&&r)return l.mainBodyRef.current.scrollWidth-l.mainBodyRef.current.clientWidth>1?void(this.horizontalScrollbarRef.current&&t.contains(this.horizontalScrollbarRef.current)?gn(this.horizontalScrollbarRef.current,{mainBodyRef:l.mainBodyRef.current,mainBodyWidth:e,pinnedLeftWidth:n,pinnedRightWidth:i,pinnedLeftContentWidth:o,pinnedRightContentWidth:s,tableBodyContainerRef:r,editColumns:null!==(a=l.config.editColumns)&&void 0!==a&&a,sectionScrollController:null!==(d=l.sectionScrollController)&&void 0!==d?d:void 0}):(null!==this.scrollbarTimeoutId&&(clearTimeout(this.scrollbarTimeoutId),this.scrollbarTimeoutId=null),this.scrollbarTimeoutId=window.setTimeout(()=>{var a,d,c,h;if(!l.mainBodyRef.current||!r||!t)return;if(this.horizontalScrollbarRef.current&&t.contains(this.horizontalScrollbarRef.current))return gn(this.horizontalScrollbarRef.current,{mainBodyRef:l.mainBodyRef.current,mainBodyWidth:e,pinnedLeftWidth:n,pinnedRightWidth:i,pinnedLeftContentWidth:o,pinnedRightContentWidth:s,tableBodyContainerRef:r,editColumns:null!==(a=l.config.editColumns)&&void 0!==a&&a,sectionScrollController:null!==(d=l.sectionScrollController)&&void 0!==d?d:void 0}),void(this.scrollbarTimeoutId=null);this.sectionScrollController=null!==(c=l.sectionScrollController)&&void 0!==c?c:null;const u=(t=>{const{mainBodyRef:e,mainBodyWidth:n,pinnedLeftWidth:i,pinnedRightWidth:o,pinnedLeftContentWidth:s,pinnedRightContentWidth:r,tableBodyContainerRef:l,editColumns:a,sectionScrollController:d}=t;if(1>=e.scrollWidth-e.clientWidth)return null;const c=a?O:0,h=(a?o+1:o)+(l.scrollHeight>l.clientHeight?l.offsetWidth-l.clientWidth:0),u=document.createElement("div");if(u.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),u.appendChild(t),null==d||d.registerPane("pinned-left",t,"scrollbar")}if(n>0){const t=document.createElement("div");t.className="st-horizontal-scrollbar-middle";const e=document.createElement("div");e.style.width=n+"px",t.appendChild(e),u.appendChild(t),null==d||d.registerPane("main",t,"scrollbar")}if(o>0){const t=document.createElement("div");t.className="st-horizontal-scrollbar-right",t.style.width=h+"px";const e=document.createElement("div");e.style.width=r+"px",t.appendChild(e),u.appendChild(t),null==d||d.registerPane("pinned-right",t,"scrollbar")}if(c>0){const t=document.createElement("div");t.style.width=c-1.5+"px",t.style.height="100%",t.style.flexShrink="0",u.appendChild(t)}return u})({mainBodyRef:l.mainBodyRef.current,mainBodyWidth:e,pinnedLeftWidth:n,pinnedRightWidth:i,pinnedLeftContentWidth:o,pinnedRightContentWidth:s,tableBodyContainerRef:r,editColumns:null!==(h=l.config.editColumns)&&void 0!==h&&h,sectionScrollController:this.sectionScrollController});if(u){const e=t.querySelector(".st-content-wrapper");e&&e.nextSibling?t.insertBefore(u,e.nextSibling):t.appendChild(u),this.horizontalScrollbarRef.current=u}this.scrollbarTimeoutId=null},1))):(this.horizontalScrollbarRef.current&&(xn(this.horizontalScrollbarRef.current,l.sectionScrollController),this.horizontalScrollbarRef.current=null),void(null!==this.scrollbarTimeoutId&&(clearTimeout(this.scrollbarTimeoutId),this.scrollbarTimeoutId=null)))}cleanup(){var t,e;this.sectionRenderer.cleanup(),null===(t=this.footerInstance)||void 0===t||t.destroy(),null===(e=this.columnEditorInstance)||void 0===e||e.destroy(),null!==this.scrollbarTimeoutId&&(clearTimeout(this.scrollbarTimeoutId),this.scrollbarTimeoutId=null),this.horizontalScrollbarRef.current&&(xn(this.horizontalScrollbarRef.current,this.sectionScrollController),this.horizontalScrollbarRef.current=null),this.stickyParentsContainer&&(ni(this.stickyParentsContainer,this.sectionScrollController),this.stickyParentsContainer=null),this.sectionScrollController=null}}function oi(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:p=40,customTheme:f}=t;if(!n||0===n.length){const t=e.map((t,e)=>{const n=[e],o=[e];return{row:t,depth:0,displayPosition:e,groupingKey:void 0,position:e,rowId:tt({row:t,getRowId:i,depth:0,index:e,rowPath:n,rowIndexPath:o,groupingKey:void 0}),rowPath:n,rowIndexPath:o,absoluteRowIndex:e,isLastGroupRow:!1,stableRowKey:ot({getRowId:i,row:t,depth:0,index:e,rowPath:n,rowIndexPath:o,groupingKey:void 0,parentStableKey:null})}});return{flattenedRows:t,heightOffsets:[],paginatableRows:t,parentEndPositions:e.map((t,e)=>e+1)}}const v=[],w=[],m=[],g=[];let x=0;const b=(t,e,y=[],R=[],C=[],S=null)=>{t.forEach((t,I)=>{var H,M;const k=n[e],E=v.length,T=[...y,I],A=[...R,I],W=tt({row:t,getRowId:i,depth:e,index:I,rowPath:T,rowIndexPath:A,groupingKey:k}),O=ot({getRowId:i,row:t,depth:e,index:I,rowPath:T,rowIndexPath:A,groupingKey:k,parentStableKey:S}),P=v.length,$={row:t,depth:e,displayPosition:x,groupingKey:k,position:E,isLastGroupRow:!1,rowId:W,rowPath:T,rowIndexPath:A,absoluteRowIndex:E,parentIndices:C.length>0?[...C]:void 0,stableRowKey:O};v.push($),w.push($),x++;const F=st({stableRowKey:O,rowId:W});if(at(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 Z(n)?n:[]})(t,k),o=h.find(t=>t.expandable&&t.nestedTable);if((null==o?void 0:o.nestedTable)&&i.length>0){const n=v.length,s=(null===(H=o.nestedTable.customTheme)||void 0===H?void 0:H.rowHeight)||u,r=(null===(M=o.nestedTable.customTheme)||void 0===M?void 0:M.headerHeight)||p,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:f}),a=_({calculatedHeight:l,customHeight:o.nestedTable.height,customTheme:f});m.push([n,a-u]);const d=[...T,k];v.push({row:{},depth:e+1,displayPosition:x-1,groupingKey:k,position:n,isLastGroupRow:!1,rowId:d,rowPath:d,rowIndexPath:A,stableRowKey:rt(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=v.length,o=[...T,k];v.push({row:{},depth:e+1,displayPosition:x-1,groupingKey:k,position:i,isLastGroupRow:!1,rowId:o,rowPath:o,rowIndexPath:A,stableRowKey:rt(F,k),stateIndicator:{parentRowId:F,parentRow:t,state:n},absoluteRowIndex:i,parentIndices:[...C,P]})}else if(n.loading&&!a){const t=v.length,n=[...T,k,"loading-skeleton"];v.push({row:{},depth:e+1,displayPosition:x-1,groupingKey:k,position:t,isLastGroupRow:!1,rowId:n,rowPath:n,rowIndexPath:A,isLoadingSkeleton:!0,absoluteRowIndex:t,parentIndices:[...C,P]})}}else if(i.length>0){const t=[...T,k],n=[...A];b(i,e+1,t,n,[...C,P],O)}}0===e&&g.push(v.length)})};return b(e,0,[],[],[]),g.forEach((t,e)=>{const n=t-1;n>=0&&v.length>n&&(v[n].isLastGroupRow=!0)}),{flattenedRows:v,heightOffsets:m,paginatableRows:w,parentEndPositions:g}}class si{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 ii}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()}invalidateCache(t){this.tableRenderer.invalidateCache(t),t&&"all"!==t&&"body"!==t||(this.flattenedRowsCache=null,this.lastProcessedResult=null),t&&"all"!==t&&"body"!==t&&"context"!==t||(this.processRowsScrollReuseKey=null,this.processRowsScrollReuseBase=null,this.lastScrollRafPaintedRange=null,this.scrollRafHeadersMemo=null),t&&"all"!==t&&"header"!==t||(this.lastScrollRafPaintedRange=null,this.scrollRafHeadersMemo=null)}computeEffectiveHeaders(t,e,n,i){var o;let s=[...t];return e.enableRowSelection&&!(null===(o=null==t?void 0:t[0])||void 0===o?void 0:o.isSelectionColumn)&&(s=[{accessor:"__row_selection__",label:"",width:n.selectionColumnWidth,isEditable:!1,type:"boolean",pinned:"left",isSelectionColumn:!0,isSortable:!1,filterable:!1,align:"center"},...s]),null!=i&&i>0?pt(s,{containerWidth:i}):pt(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,p,f,v,w,m,g,x,b;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:C,maxHeaderDepth:S}=y,I=0===t.collapsedHeaders.size?"":[...t.collapsedHeaders].map(String).sort().join("\0");let H;t.positionOnlyBody&&!0!==t.config.autoExpandColumns&&this.scrollRafHeadersMemo&&this.scrollRafHeadersMemo.headersRef===t.headers&&this.scrollRafHeadersMemo.containerWidth===R&&this.scrollRafHeadersMemo.collapsedKey===I?H=this.scrollRafHeadersMemo.effectiveHeaders:(H=this.computeEffectiveHeaders(t.headers,t.config,t.customTheme,R),this.scrollRafHeadersMemo=!0!==t.config.autoExpandColumns?{headersRef:t.headers,containerWidth:R,collapsedKey:I,effectiveHeaders:H}:null);const{leftWidth:M,rightWidth:k}=yn({headers:H,containerWidth:R,collapsedHeaders:t.collapsedHeaders});t.config.autoExpandColumns&&R>0&&(H=Rt(H,{autoExpandColumns:!0,containerWidth:R,pinnedLeftWidth:M,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 E=t.localRows;if(t.sortManager?E=t.sortManager.getSortedRows():t.filterManager&&(E=t.filterManager.getFilteredRows()),this.lastRowsRef!==E&&(this.invalidateCache("body"),this.invalidateCache("context"),this.lastRowsRef=E),t.internalIsLoading&&0===E.length){let n=t.config.shouldPaginate&&null!==(o=t.config.rowsPerPage)&&void 0!==o?o:10;e.isMainSectionScrollable&&(n+=1),E=Array.from({length:n},()=>({}))}const T=null===(s=t.sortManager)||void 0===s?void 0:s.getState(),A=null===(r=t.filterManager)||void 0===r?void 0:r.getState(),O=(null==T?void 0:T.sort)?`${T.sort.key.accessor}-${T.sort.direction}`:"none",P=JSON.stringify((null==A?void 0:A.filters)||{}),$=t.config.quickFilter,F=$?`${null!==(l=$.text)&&void 0!==l?l:""}|${null!==(a=$.mode)&&void 0!==a?a:"simple"}`:"",L=this.flattenedRowsCache&&this.flattenedRowsCache.deps.rowsRef===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,B,j;L&&this.flattenedRowsCache?(D=this.flattenedRowsCache.aggregatedRows,B=this.flattenedRowsCache.quickFilteredRows,j=this.flattenedRowsCache.flattenResult):(D=t.sortManager?E:Tt({rows:E,headers:t.headers,rowGrouping:t.config.rowGrouping}),B=(({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=>!t.hide&&!t.excludeFromRender&&(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=X(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=X(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:H,quickFilter:t.config.quickFilter}),j=oi({rows:B,rowGrouping:t.config.rowGrouping,getRowId:t.config.getRowId,expandedRows:t.expandedRows,collapsedRows:t.collapsedRows,expandedDepths:t.expandedDepths,rowStateMap:t.rowStateMap,hasLoadingRenderer:!!t.config.loadingStateRenderer,hasErrorRenderer:!!t.config.errorStateRenderer,hasEmptyRenderer:!!t.config.emptyStateRenderer,headers:H,rowHeight:t.customTheme.rowHeight,headerHeight:t.customTheme.headerHeight,customTheme:t.customTheme}),this.flattenedRowsCache={aggregatedRows:D,quickFilteredRows:B,flattenResult:j,deps:{rowsRef: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=(({height:t,maxHeight:e,rowHeight:n,totalRowCount:i,headerHeight:o,footerHeight:s,externalViewportHeight:r})=>{if(e){const t=St(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=St(t);return 0!==l?Math.max(0,l-n):void 0})({height:t.config.height,maxHeight:t.config.maxHeight,rowHeight:t.customTheme.rowHeight,shouldPaginate:null!==(d=t.config.shouldPaginate)&&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:j.paginatableRows.length,headerHeight:C,footerHeight:!t.config.shouldPaginate&&!t.config.footerRenderer||t.config.hideFooter?void 0:t.customTheme.footerHeight,externalViewportHeight:t.externalViewportHeight}),N=null!==(u=t.config.shouldPaginate)&&void 0!==u&&u,q=null!==(p=t.config.rowsPerPage)&&void 0!==p?p:10,V=null!==(f=t.config.serverSidePagination)&&void 0!==f&&f,G=null!==(v=t.config.totalRowCount)&&void 0!==v?v:j.paginatableRows.length,K=null!==(m=null===(w=t.config.rowGrouping)||void 0===w?void 0:w.join("\0"))&&void 0!==m?m:"",U=null!==(x=null===(g=j.heightOffsets)||void 0===g?void 0:g.length)&&void 0!==x?x:0;let J=0;if(j.heightOffsets)for(const[,t]of j.heightOffsets)J+=t;const _=null!==(b=t.config.enableStickyParents)&&void 0!==b&&b,Y=void 0===z?"":`${L?1:0}|${z}|${e.currentPage}|${q}|${N}|${V}|${t.customTheme.rowHeight}|${C}|${G}|${_}|${K}|${j.flattenedRows.length}|${U}|${J}`;let Q;return t.positionOnlyBody&&void 0!==z&&null!==this.processRowsScrollReuseKey&&null!==this.processRowsScrollReuseBase&&this.processRowsScrollReuseKey===Y&&this.processRowsScrollReuseBase?Q=function(t,e){const{contentHeight:n,rowHeight:i,scrollDirection:o="none",scrollTop:s,enableStickyParents:r,rowGrouping:l}=e,a=W(i),{currentTableRows:d,paginatedHeightOffsets:c,heightMap:h}=t;let u,p,f,v,w=0,m=d.length;if(void 0===n)u=d,p=[],f=u,v=[];else{const t=Dt({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=qt(d,t.rendered.rows,t.fullyVisible.rows,t.partiallyVisible.rows,l);p=e.stickyParents,f=e.regularRows,v=t.partiallyVisible.rows}else p=[],f=t.rendered.rows,v=[];else p=[],f=u,v=[]}return{currentTableRows:d,rowsToRender:u,renderedStartIndex:w,renderedEndIndex:m,stickyParents:p,regularRows:f,partiallyVisibleRows:v,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:_,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:p,shouldPaginate:f,rowGrouping:v}=t,w=W(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,f,p);let g=0;if(f&&!p){const t=(i-1)*c;g=0===t?0:null!==(e=a[t-1])&&void 0!==e?e:0}const x=l&&0!==l.length&&f&&!p?(()=>{const t=new Map;return m.forEach(e=>{e.nestedTable&&t.set(e.absoluteRowIndex,e.position)}),l.filter(([e])=>t.has(e)).map(([e,n])=>[t.get(e),n])})():l,b=x&&x.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,x,o):void 0;let y,R,C,S,I=0,H=m.length;if(void 0===n)y=m,R=[],C=y,S=[];else{const t=Dt({bufferRowCount:w,contentHeight:n,tableRows:m,rowHeight:d,scrollTop:u,scrollDirection:h,heightMap:b});if(y=t.rendered.rows,I=t.rendered.startIndex,H=t.rendered.endIndex,s)if(v){const e=qt(m,t.rendered.rows,t.fullyVisible.rows,t.partiallyVisible.rows,v);R=e.stickyParents,C=e.regularRows,S=t.partiallyVisible.rows}else R=[],C=t.rendered.rows,S=[];else R=[],C=y,S=[]}return{currentTableRows:m,rowsToRender:y,renderedStartIndex:I,renderedEndIndex:H,stickyParents:R,regularRows:C,partiallyVisibleRows:S,paginatedHeightOffsets:x,heightMap:b,allFlattenedRows:r,pageStartIndex:g}}({flattenedRows:j.flattenedRows,paginatableRows:j.paginatableRows,parentEndPositions:j.parentEndPositions,currentPage:e.currentPage,rowsPerPage:q,shouldPaginate:N,serverSidePagination:V,contentHeight:z,rowHeight:t.customTheme.rowHeight,scrollTop:e.scrollTop,scrollDirection:e.scrollDirection,heightOffsets:j.heightOffsets,customTheme:t.customTheme,enableStickyParents:_,rowGrouping:t.config.rowGrouping}),void 0!==z?(this.processRowsScrollReuseKey=Y,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:H,calculatedHeaderHeight:C,maxHeaderDepth:S,flattenResult:j,processedResult:Q}}render(t,e,n,i,o){var s,r,l,a,d,c,h,u,p;const f=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,v=this.buildRowModelSnapshot(n,i);if(!v)return;const{dimensionState:w,containerWidth:m,effectiveHeaders:g,calculatedHeaderHeight:x,maxHeaderDepth:b,flattenResult:y,processedResult:R}=v;this.lastProcessedResult=R;const C=!0===n.positionOnlyBody;if(C&&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:S,leftWidth:I,rightWidth:H,leftContentWidth:M,rightContentWidth:k}=yn({headers:g,containerWidth:m,collapsedHeaders:n.collapsedHeaders}),E=m-I-H;if(!C){const e=t=>"number"==typeof t?t+"px":t,o=t.rootElement.style;if(n.config.maxHeight){const t=e(n.config.maxHeight);o.maxHeight=t,o.height=void 0===w.contentHeight?"auto":t}else o.removeProperty("max-height"),n.config.height?o.height=e(n.config.height):o.removeProperty("height");t.rootElement.classList.toggle("st-external-scroll",void 0!==n.externalViewportHeight);const{customTheme:s}=n;o.setProperty("--st-main-section-width",E+"px"),o.setProperty("--st-scrollbar-width",i.scrollbarWidth+"px"),o.setProperty("--st-editor-width",(n.config.editColumns?O:0)+"px"),o.setProperty("--st-border-width",s.borderWidth+"px"),o.setProperty("--st-footer-height",s.footerHeight+"px"),o.setProperty("--st-calculated-header-height",x+"px");const r=null!==(u=n.config.columnResizing)&&void 0!==u&&u;t.content.className="st-content "+(r?"st-resizeable":"st-not-resizeable"),t.content.style.width=n.config.editColumns?"calc(100% - 29.5px)":"100%",this.renderHeader(t.headerContainer,x,b,g,n)}this.renderBody(t.bodyContainer,R,g,n,i),this.lastScrollRafPaintedRange=C?{start:R.renderedStartIndex,end:R.renderedEndIndex}:null,this.registerSectionPanes(n);const T=n.sectionScrollController;T&&(T.setSectionScrollLeft("main",f),null!=n.pinnedLeftRef.current&&T.setSectionScrollLeft("pinned-left",n.pinnedLeftRef.current.scrollLeft),null!=n.pinnedRightRef.current&&T.setSectionScrollLeft("pinned-right",n.pinnedRightRef.current.scrollLeft),T.restoreAll()),C||(this.renderFooter(t.footerContainer,null!==(p=n.config.totalRowCount)&&void 0!==p?p:y.paginatableRows.length,i.currentPage,g,n),this.renderColumnEditor(t.contentWrapper,i.columnEditorOpen,o,g,n),this.renderHorizontalScrollbar(t.wrapperContainer,S,I,H,M,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||!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,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,setIsResizing:e.setIsResizing,setHeaders:e.setHeaders,setCollapsedHeaders:e.setCollapsedHeaders,setCollapsedRows:e.setCollapsedRows,setExpandedRows:e.setExpandedRows,setRowStateMap:e.setRowStateMap,getCollapsedRows:e.getCollapsedRows,getCollapsedHeaders:e.getCollapsedHeaders,getExpandedRows:e.getExpandedRows,getHeaders:e.getHeaders,getRowStateMap:e.getRowStateMap,positionOnlyBody:e.positionOnlyBody,essentialAccessors:e.essentialAccessors}}cleanup(){this.tableRenderer.cleanup()}}const ri=t=>{if(null==t)return"";const e=t+"";return e.includes(",")||e.includes('"')||e.includes("\n")||e.includes("\r")?`"${e.replace(/"/g,'""')}"`:e};class li{static createAPI(t){const e=()=>{var e;return(null===(e=t.getCachedFlattenResult)||void 0===e?void 0:e.call(t))||oi({rows:t.localRows,rowGrouping:t.config.rowGrouping,getRowId:t.config.getRowId,expandedRows:t.expandedRows,collapsedRows:t.collapsedRows,expandedDepths:t.expandedDepths,rowStateMap:t.rowStateMap,hasLoadingRenderer:!!t.config.loadingStateRenderer,hasErrorRenderer:!!t.config.errorStateRenderer,hasEmptyRenderer:!!t.config.emptyStateRenderer,headers:t.effectiveHeaders,rowHeight:t.customTheme.rowHeight,headerHeight:t.customTheme.headerHeight,customTheme:t.customTheme})},n=new Map;let i=!1,o=!1;const s=()=>{if(i=!1,0===n.size)return;let e=!1;n.forEach((i,o)=>{var s,r;if(null===(s=t.isCellAnimating)||void 0===s?void 0:s.call(t,o))return void(e=!0);const l=null===(r=t.cellRegistry)||void 0===r?void 0:r.get(o);l&&l.updateContent(i),n.delete(o)}),e&&n.size>0&&l()},r=()=>{i||(i=!0,queueMicrotask(s))},l=()=>{o||(o=!0,setTimeout(()=>{o=!1,n.size>0&&r()},120))};let a=null;return{updateData:e=>{var i;const{rowIndex:o,accessor:s,newValue:l}=e;if(o>=0&&t.localRows.length>o){const e=t.localRows[o];e[s]=l;const d=(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(!a||a.rowsRef!==o){const t=new WeakMap;for(const e of o)e.row&&t.set(e.row,e);a={rowsRef:o,map:t}}return a.map.get(e)}})(e),c=d?null!==(i=d.stableRowKey)&&void 0!==i?i:et(d.rowId):ot({getRowId:t.config.getRowId,row:e,depth:0,index:o,rowPath:[o],rowIndexPath:[o]}),h=J({accessor:s,rowId:c});n.set(h,l),r()}},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=>ri(t.label)).join(","),s=t.map((t,e)=>{const n=t.row;return i.map((t,i)=>{const o=X(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 ri(r)}if(!1!==t.useFormattedValueForCSV&&t.valueFormatter){const s=t.valueFormatter({accessor:t.accessor,colIndex:i,row:n,rowIndex:e,value:o});return ri(s)}return ri(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:()=>Ve(t.headers),applyPinnedState:async e=>{const n=Ke(t.headers,e,t.essentialAccessors);n&&(t.setHeaders(n),t.onRender())},resetColumns:()=>{t.setHeaders(Pe(t.config.defaultHeaders)),t.onRender()},getFilterState:()=>{var e,n;return null!==(n=null===(e=t.filterManager)||void 0===e?void 0:e.getFilters())&&void 0!==n?n:{}},applyFilter:async e=>{t.filterManager&&t.filterManager.updateFilter(e)},clearFilter:async e=>{t.filterManager&&t.filterManager.clearFilter(e)},clearAllFilters:async()=>{t.filterManager&&t.filterManager.clearAllFilters()},getCurrentPage:()=>t.getCurrentPage(),getTotalPages:()=>{var n,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.config.rowGrouping)||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.config.rowGrouping)||void 0===n?void 0:n[e]},getGroupingDepth:e=>{var n,i;return null!==(i=null===(n=t.config.rowGrouping)||void 0===n?void 0:n.indexOf(e))&&void 0!==i?i:-1},toggleColumnEditor:e=>{t.config.editColumns&&(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 je(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)}}}}const ai=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}},di=()=>"undefined"!=typeof window&&window.innerHeight>0?window.innerHeight:1/0,ci=(t,e)=>{if(!t||!e)return null;const n=ai(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),di());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 hi{constructor(t,e){var n,i;this.draggedHeaderRef={current:null},this.hoveredHeaderRef={current:null},this.localRows=[],this.headers=[],this.essentialAccessors=new Set,this.autoSizeAccessors=new Set,this.pendingAutoSize=new Set,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.headerRegistry=new Map,this.rowIndexMap=new Map,this.autoScaleManager=null,this.dimensionManager=null,this.scrollManager=null,this.sectionScrollController=null,this.sortManager=null,this.filterManager=null,this.selectionManager=null,this.rowSelectionManager=null,this.windowResizeManager=null,this.handleOutsideClickManager=null,this.scrollbarVisibilityManager=null,this.expandedDepthsManager=null,this.ariaAnnouncementManager=null,this.mounted=!1,this.scrollRafId=null,this.scrollEndTimeoutId=null,this.lastScrollTop=0,this.isUpdating=!1,this.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=e,this.customTheme=Je.mergeCustomTheme(e),this.mergedColumnEditorConfig=Je.mergeColumnEditorConfig(e),this.resolvedIcons=Je.resolveIcons(e),this.localRows=[...e.rows],this.headers=[...e.defaultHeaders],this.essentialAccessors=Je.buildEssentialAccessors(this.headers),this.columnEditorOpen=null!==(n=e.editColumnsInitOpen)&&void 0!==n&&n,this.internalIsLoading=null!==(i=e.isLoading)&&void 0!==i&&i,this.collapsedHeaders=Je.getInitialCollapsedHeaders(e.defaultHeaders),this.expandedDepths=Je.getInitialExpandedDepths(e),this.autoSizeAccessors=this.computeAutoSizeAccessors(),this.pendingAutoSize=new Set(this.autoSizeAccessors),this.domManager=new _e,this.renderOrchestrator=new si,this.animationCoordinator=new M,this.applyAnimationsConfig(e.animations),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=tt({row:t,getRowId:this.config.getRowId,depth:0,index:e,rowPath:[e],rowIndexPath:[e]}),i=et(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(t.hide||t.excludeFromRender)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=ci(this.resolvedScrollParent,n);this.animationCoordinator.setExternalVerticalScroll(i&&i.visibleViewportHeight>0&&i.tableTotalHeight>0?{clientHeight:i.visibleViewportHeight,scrollHeight:i.tableTotalHeight,scrollTop:i.relativeScrollTop}:null)}beginAccordionAnimation(t){var e,n;if(!this.animationCoordinator.isEnabled())return;if(null===t)return;this.captureAnimationSnapshot(),this.pendingAccordionAxis=t;const i=this.animationCoordinator.getDuration(),o=this.animationCoordinator.getEasing(),s=null!==(n=null===(e=this.domManager.getElements())||void 0===e?void 0:e.rootElement)&&void 0!==n?n:this.container;s.style.setProperty(Le,i+"ms"),s.style.setProperty(De,o),s.classList.add(Fe),null!==this.accordionCleanupTimerId&&window.clearTimeout(this.accordionCleanupTimerId),this.accordionCleanupTimerId=window.setTimeout(()=>{s.classList.remove(Fe),s.style.removeProperty(Le),s.style.removeProperty(De),this.accordionCleanupTimerId=null},i+80)}initializeManagers(){var t,e,n;this.ariaAnnouncementManager=new oe,this.ariaAnnouncementManager.subscribe(t=>{this.announcement=t,this.updateAriaLiveRegion()}),this.expandedDepthsManager=new ie(null===(t=this.config.expandAll)||void 0===t||t,this.config.rowGrouping),this.expandedDepthsManager.subscribe(t=>{this.beginAccordionAnimation("vertical"),this.expandedDepths=t,this.render("expandedDepthsManager")});const i=t=>{this.ariaAnnouncementManager&&this.ariaAnnouncementManager.announce(t)};this.sortManager=new At({headers:this.headers,tableRows:this.localRows,externalSortHandling:this.config.externalSortHandling||!1,onSortChange:this.config.onSortChange,rowGrouping:this.config.rowGrouping,initialSortColumn:this.config.initialSortColumn,initialSortDirection:this.config.initialSortDirection,announce:i}),this.sortManager.subscribe(t=>{this.captureAnimationSnapshot(),this.render("sortManager")}),this.filterManager=new $t({rows:this.localRows,headers:this.headers,externalFilterHandling:this.config.externalFilterHandling||!1,onFilterChange:this.config.onFilterChange,announce:i}),this.filterManager.subscribe(t=>{this.sortManager&&this.sortManager.updateConfig({tableRows:t.filteredRows}),this.render("filterManager")}),this.selectionManager=new Yt({selectableCells:null!==(e=this.config.selectableCells)&&void 0!==e&&e,selectableColumns:null!==(n=this.config.selectableColumns)&&void 0!==n&&n,headers:this.headers,tableRows:[],onCellEdit:this.config.onCellEdit,cellRegistry:this.cellRegistry,collapsedHeaders:this.collapsedHeaders,rowHeight:this.customTheme.rowHeight,enableRowSelection:this.config.enableRowSelection,copyHeadersToClipboard:this.config.copyHeadersToClipboard,customTheme:this.customTheme,tableRoot:this.container,onSelectionDragEnd:()=>{this.renderOrchestrator.invalidateCache("context"),this.renderOrchestrator.invalidateCache("body"),this.render("selectionDragEnd")}})}mount(){this.mounted?console.warn("SimpleTableVanilla: Table is already mounted"):(this.domManager.createDOMStructure(this.container,this.config),this.mounted=!0,this.setupManagers())}setupManagers(){var t,e,n;const i=this.domManager.getRefs(),o=this.domManager.getElements();if(!i.tableBodyContainerRef.current||!o)return;this.scrollbarWidth=se(i.tableBodyContainerRef.current);const s=this.renderOrchestrator.computeEffectiveHeaders(this.headers,this.config,this.customTheme);this.dimensionManager=new It({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.shouldPaginate&&!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.onGridReady&&this.config.onGridReady())}),this.scrollManager=new Ht({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 Mt({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 Ct({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 ee({headerContainer:i.headerContainerRef.current,mainSection:i.tableBodyContainerRef.current,scrollbarWidth:this.scrollbarWidth}),this.scrollbarVisibilityManager.subscribe(t=>{this.isMainSectionScrollable=t,i.tableBodyContainerRef.current&&(this.scrollbarWidth=se(i.tableBodyContainerRef.current)),this.render("scrollbarVisibilityManager")})),this.windowResizeManager=new Zt,this.windowResizeManager.addCallback(()=>{var t;if(i.tableBodyContainerRef.current){const e=se(i.tableBodyContainerRef.current);this.scrollbarWidth=e,null===(t=this.scrollbarVisibilityManager)||void 0===t||t.setScrollbarWidth(e)}this.render("scrollbarWidth-change")}),this.config.enableRowSelection&&(this.rowSelectionManager=new Qt({tableRows:[],onRowSelectionChange:this.config.onRowSelectionChange,enableRowSelection:!0}),this.rowSelectionManager.subscribe(()=>{this.render("rowSelectionManager")})),this.selectionManager&&(this.handleOutsideClickManager=new te({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&&hi.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=ci(this.resolvedScrollParent,n);if(!i)return;let o=i.visibleViewportHeight;o>0||(o=(()=>{const t=ai(this.resolvedScrollParent);return t?Math.min(t.height,di()):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=ci(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)}getRenderContext(){const t=this.domManager.getRefs();return{accordionAxis:this.pendingAccordionAxis,config:this.config,customTheme:this.customTheme,resolvedIcons:this.resolvedIcons,effectiveHeaders:[],essentialAccessors:this.essentialAccessors,headers:this.headers,localRows:this.localRows,collapsedHeaders:this.collapsedHeaders,collapsedRows:this.collapsedRows,expandedRows:this.expandedRows,expandedDepths:this.expandedDepths,isResizing:this.isResizing,internalIsLoading:this.internalIsLoading,createNestedTable:(t,e)=>new hi(t,e),cellRegistry:this.cellRegistry,headerRegistry:this.headerRegistry,draggedHeaderRef:this.draggedHeaderRef,hoveredHeaderRef:this.hoveredHeaderRef,mainBodyRef:t.mainBodyRef,pinnedLeftRef:t.pinnedLeftRef,pinnedRightRef:t.pinnedRightRef,mainHeaderRef:t.mainHeaderRef,pinnedLeftHeaderRef:t.pinnedLeftHeaderRef,pinnedRightHeaderRef:t.pinnedRightHeaderRef,dimensionManager:this.dimensionManager,scrollManager:this.scrollManager,sectionScrollController:this.sectionScrollController,sortManager:this.sortManager,filterManager:this.filterManager,selectionManager:this.selectionManager,rowSelectionManager:this.rowSelectionManager,rowStateMap:this.rowStateMap,positionOnlyBody:this._positionOnlyBody,externalViewportHeight:this.externalViewportHeight>0?this.externalViewportHeight:void 0,onRender:()=>this.render("resizeHandler-onRender"),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=Pe(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,getRowStateMap:()=>this.rowStateMap,setColumnEditorOpen:t=>{this.columnEditorOpen=t},setCurrentPage:t=>{t!==this.currentPage&&this.config.shouldPaginate&&!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;if(this.config.autoExpandColumns)return t;const e=mt(this.headers,this.collapsedHeaders);for(const n of e)this.isAutoSizeLeaf(n)&&t.add(n.accessor);return t}getAutoSizeStyleRoot(){var t,e;const n=null===(t=this.domManager.getRefs().mainBodyRef)||void 0===t?void 0:t.current;return n?null!==(e=n.closest(".simple-table-root"))&&void 0!==e?e:n:null}getAutoSizeRows(){if(this.config.shouldPaginate&&!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}applyMeasuredWidths(t){const e=n=>{const i=Object.assign({},n);return n.children&&n.children.length>0?i.children=n.children.map(e):t.has(n.accessor)&&(i.width=t.get(n.accessor)),i};this.headers=this.headers.map(e)}maybeAutoSizeColumns(){if(!this.isAutoSizing&&0!==this.pendingAutoSize.size)if(this.config.autoExpandColumns)this.pendingAutoSize.clear();else if([...this.pendingAutoSize].some(t=>document.getElementById(J({accessor:t,rowId:"header"})))){this.isAutoSizing=!0;try{const t=this.getAutoSizeStyleRoot(),e=mt(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 r=gt(e,{rows:i,header:s,styleRoot:t,theme:this.config.theme,autoSizeMode:s.autoSizeMode});o.set(e,r)}if(this.pendingAutoSize.clear(),0===o.size)return;this.applyMeasuredWidths(o),this.renderOrchestrator.invalidateCache("header");const s=this.domManager.getElements(),r=this.domManager.getRefs();s&&this.renderOrchestrator.render(s,r,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&&this.animationCoordinator.play({containers:this.getAnimatableContainers()}),this.maybeScheduleUnvirtualizedRowsWarning())}maybeScheduleUnvirtualizedRowsWarning(){var t,e,n;(()=>{try{return"undefined"!=typeof process&&!!process.env&&"production"!==process.env.NODE_ENV}catch(t){return!1}})()&&(this.hasWarnedUnvirtualizedRows||null===this.unvirtualizedRowsCheckTimeoutId&&"undefined"!=typeof window&&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(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(e){var n,i,o,s,r,l,a;if(this.isUpdating=!0,this.config=Object.assign(Object.assign({},this.config),e),void 0!==e.animations&&this.applyAnimationsConfig(e.animations),void 0!==e.rows&&(this.firstRenderDone&&this.captureAnimationSnapshot(),this.localRows=[...e.rows],this.rebuildRowIndexMap(),this.filterManager&&this.filterManager.updateConfig({rows:this.localRows}),this.sortManager&&this.sortManager.updateConfig({tableRows:this.localRows}),this.autoSizeAccessors.forEach(t=>this.pendingAutoSize.add(t))),void 0===e.rows&&void 0===e.totalRowCount||null===(n=this.dimensionManager)||void 0===n||n.updateConfig({totalRowCount:null!==(i=this.config.totalRowCount)&&void 0!==i?i:this.localRows.length}),void 0!==e.defaultHeaders&&(this.captureAnimationSnapshot(),this.headers=[...e.defaultHeaders],this.essentialAccessors=Je.buildEssentialAccessors(this.headers),this.autoSizeAccessors=this.computeAutoSizeAccessors(),this.pendingAutoSize=new Set(this.autoSizeAccessors),this.filterManager&&this.filterManager.updateConfig({headers: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})}if(void 0!==e.isLoading&&(this.internalIsLoading=e.isLoading),void 0!==e.theme&&this.domManager.updateTheme(e.theme),void 0!==e.footerPosition&&this.domManager.syncFooterPosition(this.config.footerPosition),void 0!==e.customTheme){const e=this.customTheme;this.customTheme=Je.mergeCustomTheme(this.config),function(e,n){for(const i of Object.keys(t))if(e[i]!==n[i])return!1;return!0}(e,this.customTheme)||(this.selectionManager&&this.selectionManager.updateConfig({customTheme:this.customTheme,rowHeight:this.customTheme.rowHeight}),null===(o=this.dimensionManager)||void 0===o||o.updateConfig({headerHeight:this.customTheme.headerHeight,rowHeight:this.customTheme.rowHeight,footerHeight:!this.config.shouldPaginate&&!this.config.footerRenderer||this.config.hideFooter?void 0:this.customTheme.footerHeight}),this.config.shouldPaginate&&e.rowHeight!==this.customTheme.rowHeight&&(this.currentPage=1),this.renderOrchestrator.invalidateCache("all"))}void 0===e.selectableColumns&&void 0===e.selectableCells||!this.selectionManager||this.selectionManager.updateConfig({selectableColumns:null!==(s=this.config.selectableColumns)&&void 0!==s&&s,selectableCells:null!==(r=this.config.selectableCells)&&void 0!==r&&r}),void 0===e.height&&void 0===e.maxHeight||null===(l=this.dimensionManager)||void 0===l||l.updateConfig({height:this.config.height,maxHeight:this.config.maxHeight}),void 0===e.scrollParent&&void 0===e.height&&void 0===e.maxHeight||this.syncExternalScrollWiring(),void 0===e.onLoadMore&&void 0===e.infiniteScrollThreshold||!this.scrollManager||this.scrollManager.updateConfig({onLoadMore:this.config.onLoadMore,infiniteScrollThreshold:null!==(a=this.config.infiniteScrollThreshold)&&void 0!==a?a:200}),this.isUpdating=!1,this.render("update")}updateConfig(t){this.update(t)}destroy(){var t,e,n,i,o,s,r,l,a,d,c,h,u,p,f;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 v=this.domManager.getElements();(null==v?void 0:v.bodyContainer)&&(this.ensureBodyScrollListenerDetached(v.bodyContainer),this.bodyContainerMouseLeaveListener&&(v.bodyContainer.removeEventListener("mouseleave",this.bodyContainerMouseLeaveListener),this.bodyContainerMouseLeaveListener=null)),null!==this.accordionCleanupTimerId&&(window.clearTimeout(this.accordionCleanupTimerId),this.accordionCleanupTimerId=null);const w=null!==(e=null===(t=this.domManager.getElements())||void 0===t?void 0:t.rootElement)&&void 0!==e?e:this.container;w.classList.remove(Fe),w.style.removeProperty(Le),w.style.removeProperty(De),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.rowSelectionManager)||void 0===l||l.destroy(),null===(a=this.selectionManager)||void 0===a||a.destroy(),null===(d=this.autoScaleManager)||void 0===d||d.destroy(),null===(c=this.windowResizeManager)||void 0===c||c.destroy(),null===(h=this.handleOutsideClickManager)||void 0===h||h.destroy(),null===(u=this.scrollbarVisibilityManager)||void 0===u||u.destroy(),null===(p=this.expandedDepthsManager)||void 0===p||p.destroy(),null===(f=this.ariaAnnouncementManager)||void 0===f||f.destroy(),this.animationCoordinator.destroy(),this.cellRegistry.clear(),this.headerRegistry.clear(),w.querySelectorAll("[data-row-id]").forEach(t=>{const e=t.getAttribute("data-row-id");e&&Ee(e,t)}),this.renderOrchestrator.cleanup(),this.domManager.destroy(this.container)}getAPI(){const t=this.renderOrchestrator.computeEffectiveHeaders(this.headers,this.config,this.customTheme),e=this;return li.createAPI({config:this.config,localRows:this.localRows,effectiveHeaders:t,get headers(){return e.headers},essentialAccessors:this.essentialAccessors,customTheme:this.customTheme,currentPage:this.currentPage,getCurrentPage:()=>this.currentPage,get expandedRows(){return e.expandedRows},get collapsedRows(){return e.collapsedRows},get expandedDepths(){return e.expandedDepths},clearExpandedRows:()=>{e.expandedRows=new Map},clearCollapsedRows:()=>{e.collapsedRows=new Map},rowStateMap:this.rowStateMap,headerRegistry:this.headerRegistry,cellRegistry:this.cellRegistry,isCellAnimating:t=>this.animationCoordinator.isInFlight(t),get columnEditorOpen(){return e.columnEditorOpen},getCachedFlattenResult:()=>this.renderOrchestrator.getCachedFlattenResult(),getCachedProcessedResult:()=>this.renderOrchestrator.getLastProcessedResult(),expandedDepthsManager:this.expandedDepthsManager,selectionManager:this.selectionManager,sortManager:this.sortManager,filterManager:this.filterManager,onRender:()=>this.render("columnEditor-onRender"),setHeaders:t=>{this.didColumnVisibilityChange(t)?this.beginAccordionAnimation("horizontal"):this.captureAnimationSnapshot(),this.headers=Pe(t),this.renderOrchestrator.invalidateCache("header")},setCurrentPage:t=>{this.currentPage=t},setColumnEditorOpen:t=>{this.columnEditorOpen=t,this.render("columnEditor-toggle")}})}}hi.EXTERNAL_SCROLL_MAX_RETRIES=60,exports.SimpleTableVanilla=hi,exports.asRows=function(t){return t};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});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},n=new WeakMap,i=(t,e,i)=>{const o=(t=>{let e=n.get(t);return e||(e=new Map,n.set(t,e)),e})(t);let s=o.get(e);s||(s=document.createElement("div"),s.className="st-aria-row",s.setAttribute("role","row"),s.style.display="contents",t.appendChild(s),o.set(e,s));const r=i+"";return s.getAttribute("aria-rowindex")!==r&&s.setAttribute("aria-rowindex",r),s},o=t=>{const e=n.get(t);e&&e.forEach((t,n)=>{0===t.childElementCount&&(t.remove(),e.delete(n))})},s=t=>{const e=n.get(t);e&&(e.forEach(t=>t.remove()),e.clear())},r=new WeakMap,l=(t,e,n,i)=>{t.addEventListener(e,n,i),r.has(t)||r.set(t,[]),r.get(t).push({event:e,handler:n,options:i})},a=new WeakMap,d=t=>(a.has(t)||a.set(t,new Map),a.get(t)),c=new WeakMap;let h=0,u=Date.now(),p={screenX:0,screenY:0},f=null;const v=t=>{u=t},w=new WeakMap,m=t=>(w.has(t)||w.set(t,new Map),w.get(t)),g=new WeakMap,x=t=>(g.has(t)||g.set(t,new Map),g.get(t)),b=(t,e)=>{const n=Date.now();0!==h&&e>n-h||(h=n,t())},y=(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})},R=t=>{const e=t.closest(".simple-table-root");null==e||e.querySelectorAll(".st-tooltip").forEach(t=>t.remove())},C=.5,S="st-cell-animating-out",I="data-animating-out",H="data-shrinking-out",M=t=>{const e=d(t),n=m(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 k{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=O()}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)}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(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;M(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)}retainCell(t){var e;const{cellId:n,element:i,container:o,newPosition:s}=t,r=E(i.style.top),l=E(i.style.left),a=this.getScrollerMetrics(o),d=A(s.top,r,s.height,a,"y"),c=A(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(S),i.setAttribute(I,"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(H)?(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(S),s.removeAttribute(I),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(S),i.setAttribute(I,"true"),i.setAttribute(H,"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(H))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=E(t.style.left),p=E(t.style.top);if(!l&&this.inFlight.has(r)&&C>Math.abs(h.styleTop-p)&&C>Math.abs(h.styleLeft-u))return void o.add(r);const f=l||h.fromDom,v=f?0:E(t.style.height)||t.offsetHeight||0,w=f?0:E(t.style.width)||t.offsetWidth||0,m=f?null:this.getScrollerMetrics(a),g=f||!m?h.top:A(h.top,p,v,m,"y"),x=f||!m?h.left:A(h.left,u,w,m,"x");let b=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);b=t.left-h.sourceContainerLeft}const y=x-u-b,R=g-p-0;C>Math.abs(y)&&C>Math.abs(R)?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:y,dy:R,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)}),M(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=E(e.style.top),r=E(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(I)}}const E=t=>{if(!t)return 0;const e=parseFloat(t);return Number.isFinite(e)?e:0},T=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}},A=(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},O=()=>{if("undefined"==typeof window||"function"!=typeof window.matchMedia)return!1;try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch(t){return!1}},W=t=>Math.ceil(800/(t+1)),P=29.5,$=150,F=["lineAreaChart","barChart"],L=500,D=40,B=(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},z=t=>t.flatMap(t=>t.children&&0!==t.children.length?z(t.children):[t]),N=t=>t.flatMap(t=>{const e=[t];return t.children&&t.children.length>0&&e.push(...N(t.children)),e}),q=(t=0)=>t?t+1:0,V=(t,e)=>{const n=N(t);for(const t of n)if(t.children&&t.children.length>0&&t.children.some(t=>t.accessor===e))return t;return null},G=(e,n,i)=>{const o=V(n,e.accessor);if(o){const n=i.has(o.accessor),s=e.showWhen||t;return n?"parentExpanded"===s:"parentCollapsed"===s}return!1},K=t=>{var e;return!(!(null===(e=t.children)||void 0===e?void 0:e.length)||!t.collapsible)},U=(t,e,n)=>{if(!t.children||0===t.children.length)return 1;const i=z(t.children);let o=0;for(const t of i)t.hide||G(t,e,n)||(o+=1);return o},J=({accessor:t,rowId:e})=>`${e}-${t}`,_=({calculatedHeight:t,customHeight:e,customTheme:n})=>e?("string"==typeof e?parseFloat(e):e)+n.nestedGridPaddingTop+n.nestedGridPaddingBottom:t,Y=t=>{const e=t.match(/^(.+?)\[(\d+)\]$/);return e?{key:e[1],index:parseInt(e[2],10)}:{key:t,index:null}},X=(t,e)=>{const n=e+"";return n.includes(".")||n.includes("[")?n.split(".").reduce((t,e)=>{if(null==t)return;const{key:n,index:i}=Y(e);let o=t[n];return null!==i&&Array.isArray(o)&&(o=o[i]),o},t):t[e]},Q=(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}=Y(o[t]);if(null==s[e]){const n=Y(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}=Y(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},Z=t=>Array.isArray(t)&&t.length>0&&"object"==typeof t[0]&&null!==t[0],tt=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});i.push(n)}return i},et=t=>t.join("-"),nt=new WeakMap;let it=0;const ot=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})+"":(t=>{if(t&&"object"==typeof t){const e=nt.get(t);if(void 0!==e)return e;const n="__row_"+ ++it;return nt.set(t,n),n}return"__row_p_"+t})(t.row),i=[];return t.parentStableKey&&i.push(t.parentStableKey),t.groupingKey&&t.depth>0&&i.push(t.groupingKey),i.push(n),i.join("/")},st=t=>t.stableRowKey?t.stableRowKey:et(t.rowId),rt=(t,e)=>`${t+""}nested-chrome${(null!=e?e:"")+""}`,lt=(t,e)=>!!e&&Z(t[e]),at=(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},dt=(e,n)=>{if(e.hide||e.excludeFromRender)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=>dt(t,n))]:0===i.length?[e]:i.flatMap(t=>dt(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=>dt(t,n))]:i.flatMap(t=>dt(t,n))};function ct(t){if(t.hide)return null;if("number"==typeof t.width)return{type:"px",value:t.width};if("string"!=typeof t.width)return null;const e=t.width.trim();return"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 ht(t){const e=[],n=t=>{t.hide||(t.children&&0!==t.children.length?t.children.forEach(n):e.push(t))};return t.forEach(n),e}function ut(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($,"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:$);else a.set(t.accessor,$)}),a}function pt(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=ht(t);i=ut(e,n)}else{const e=ht(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=ut(e,s)}return t.map(function t(e){const n=Object.assign({},e);if(e.children&&e.children.length>0)return n.children=e.children.map(t),n;const o=i.get(e.accessor);return null!=o&&(n.width=o),n})}const ft=t=>{if(t.hide||t.excludeFromRender)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(J({accessor:t.accessor,rowId:"header"}));return(null==e?void 0:e.offsetWidth)||$}},vt=t=>{var e;const n=t.width;"string"==typeof n&&n.includes("fr")&&(t.width=(null===(e=document.getElementById(J({accessor:t.accessor,rowId:"header"})))||void 0===e?void 0:e.offsetWidth)||$),t.children&&t.children.length>0&&t.children.forEach(t=>{vt(t)})},wt=t=>"number"==typeof t.minWidth?t.minWidth:D,mt=(t,e)=>{const n=[];return t.forEach(t=>{t.hide||n.push(...dt(t,e))}),n},gt=(t,e)=>{var n,i;const{rows:o,header:s,maxWidth:r=L,headSampleSize:l,stridedSampleSize:a,sampleSize:d,outlierPercentile:c,outlierThreshold:h,autoSizeMode:u=(null!==(n=null==s?void 0:s.autoSizeMode)&&void 0!==n?n:"content"),theme:p,styleRoot:f}=e||{},v=null!==(i=null!=l?l:d)&&void 0!==i?i:25,w=null!=a?a:null!=d?0:75,m=null!=f?f:document,g=document.getElementById(J({accessor:t,rowId:"header"}));if(!g)return $;const x=window.getComputedStyle(g),b=parseFloat(x.paddingLeft)||0,y=parseFloat(x.paddingRight)||0,R=parseFloat(x.gap)||0;let C=b+y;const S=g.querySelector(".st-header-label");if(S){const t=S.querySelector(".st-header-label-text");if(t){const e=document.createElement("span");e.style.visibility="hidden",e.style.position="absolute",e.style.whiteSpace="nowrap",e.style.width="auto";const n=window.getComputedStyle(t);e.style.font=n.font,e.style.fontSize=n.fontSize,e.style.fontWeight=n.fontWeight,e.style.fontFamily=n.fontFamily,e.style.letterSpacing=n.letterSpacing,e.style.padding=n.padding,e.textContent=t.textContent,document.body.appendChild(e);const i=e.offsetWidth;document.body.removeChild(e),C+=i}}const I=Array.from(g.children);let H=1;for(let t=0;I.length>t;t++){const e=I[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&&(C+=(e.offsetWidth||0)+(parseFloat(n.marginLeft)||0)+(parseFloat(n.marginRight)||0),H++)}R>0&&H>1&&(C+=R*(H-1));let M=0;const k=s&&s.type&&F.includes(s.type);if(o&&o.length>0&&!k&&"header"!==u){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 r=m.querySelector(".st-cell-content");if(r){const t=window.getComputedStyle(r);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 l=[],a=t=>(e.textContent=t,e.offsetWidth+n+i),d=((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)})(o.length,v,w);for(const r of d){const d=o[r];let c;c=(null==s?void 0:s.valueGetter)?s.valueGetter({accessor:t,row:d,rowIndex:r}):X(d,t);let h=c;(null==s?void 0:s.valueFormatter)&&null!=c&&(h=s.valueFormatter({accessor:t,colIndex:0,row:d,rowIndex:r,value:c}));let u=-1;if(null==s?void 0:s.cellRenderer)try{const o=s.cellRenderer({accessor:t,colIndex:0,row:d,rowIndex:r,theme:p,value:c,formattedValue:h});if("string"==typeof o||"number"==typeof o)u=a(o+"");else if(o instanceof Node){e.textContent="",e.appendChild(o);const t=e.offsetWidth+n+i;e.textContent="",u=t>n+i?t:-1}}catch(t){u=-1}0>u&&(u=a(null!=h?h+"":"")),l.push(u)}document.body.removeChild(e),m.querySelectorAll(`[id$="-${t}"] .st-cell-content`).forEach(t=>{t.scrollWidth>t.clientWidth+1&&l.push(t.scrollWidth+n+i)}),M=((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})(l,{percentile:c,threshold:h})}let E="header"===u?C:Math.max(C,M);k&&(E=Math.max(E,150));const T="number"==typeof(null==s?void 0:s.maxWidth)?s.maxWidth:"string"==typeof(null==s?void 0:s.maxWidth)&&parseFloat(s.maxWidth+"")||void 0,A=null!=T?T:r;return E>A&&(E=A),Math.max(E+2,"number"==typeof(null==s?void 0:s.minWidth)?s.minWidth:"string"==typeof(null==s?void 0:s.minWidth)&&parseFloat(s.minWidth+"")||D,D)};class xt{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 bt=(t,e)=>e>=t.reduce((t,e)=>t+wt(e),0),yt=(t,e)=>{const n=new Map,i=t.reduce((t,e)=>t+("number"==typeof e.width?e.width:"string"==typeof e.width&&e.width.endsWith("px")?parseFloat(e.width):150),0);if(0===i)return n;const o=e/i;if(o>=1&&.01>o-1)return n;let s=0;return t.forEach((i,r)=>{const l="number"==typeof i.width?i.width:"string"==typeof i.width&&i.width.endsWith("px")?parseFloat(i.width):150;let a;r===t.length-1?a=e-s:(a=Math.round(l*o),s+=a),n.set(i.accessor,a)}),n},Rt=(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=mt(d,l),p=mt(c,l),f=mt(h,l),v=u.length>0&&bt(u,o),w=p.length>0&&bt(p,s),m=f.length>0&&a>0&&bt(f,a),g=new Map;if(v&&yt(u,o).forEach((t,e)=>g.set(e,t)),w&&yt(p,s).forEach((t,e)=>g.set(e,t)),m&&yt(f,a).forEach((t,e)=>g.set(e,t)),0===g.size)return t;const x=(t,e)=>{var n;if(t.hide)return t;const i=null!=e?e:t.pinned,o=null===(n=t.children)||void 0===n?void 0:n.map(t=>x(t,i)),s=g.get(t.accessor);return Object.assign(Object.assign({},t),void 0!==s?{width:s,children:o}:{children:o})};return t.map(t=>x(t,t.pinned))};class Ct{constructor(t,e){var n;this.config=t,this.onHeadersUpdate=e,this.isResizingTracker=new xt(null!==(n=t.isResizing)&&void 0!==n&&n),this.containerWidthTracker=new xt(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 Rt(t,this.config)}setHeaders(t,e){const n="function"==typeof t?t(e):t;return this.applyAutoScale(n)}destroy(){this.onHeadersUpdate=()=>{}}}const St=(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|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}if(i.endsWith("vh")){const t=parseFloat(i);return Number.isFinite(t)?window.innerHeight*t/100:null}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 o=+i;return Number.isFinite(o)?o: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);if(i.endsWith("vh"))return window.innerHeight*parseInt(i,10)/100;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 It{constructor(t){this.subscribers=new Set,this.resizeObserver=null,this.rafId=null,this.initialNotifyPending=!1,this.config=t;const e=this.calculateMaxHeaderDepth(),n=this.calculateHeaderHeight(e),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 St(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}observeContainer(t){this.resizeObserver=new ResizeObserver(()=>{null!==this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=requestAnimationFrame(()=>{this.rafId=null;const e=t.clientWidth,n=e!==this.state.containerWidth;n&&(this.state=Object.assign(Object.assign({},this.state),{containerWidth:e})),(n||this.initialNotifyPending)&&(this.initialNotifyPending=!1,this.notifySubscribers())})}),this.resizeObserver.observe(t),this.applyContainerWidthSync(t)}applyContainerWidthSync(t){const e=t.clientWidth;e>0&&e!==this.state.containerWidth&&(this.state=Object.assign(Object.assign({},this.state),{containerWidth:e}),this.initialNotifyPending=!0)}updateConfig(t){const e=this.config.effectiveHeaders,n=this.config.containerElement;this.config=Object.assign(Object.assign({},this.config),t);let 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.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.subscribers.clear()}}class Ht{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 Mt{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 kt={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)=>kt.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?kt.string(t,e,n):"number"==typeof t&&"number"==typeof e?kt.number(t,e,n):"boolean"==typeof t&&"boolean"==typeof e?kt.boolean(t,e,n):kt.string(t+"",e+"",n)},Et=({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=X(e,l),a=X(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 kt.number(o,s,i)}return"date"===n?kt.date(t+"",e+"",i):"boolean"===n?kt.boolean(!!t,!!e,i):"enum"===n?kt.enum(t+"",e+"",i):kt.string(t+"",e+"",i)})(i,a,s,r)})})({rows:e,sortColumn:n,headers:t}),Tt=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=>N(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&&Z(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&&Z(n))s(n);else{const n=X(t,e);null!=n&&o.push(n)}})};if(s(t),0===o.length)return;if("custom"===n.type&&n.customFn)return n.customFn(o);const r=n.parseValue?o.map(n.parseValue).filter(t=>!isNaN(t)):o.map(t=>"number"==typeof t?t:"string"==typeof t?parseFloat(t):NaN).filter(t=>!isNaN(t));if(0===r.length)return"count"===n.type?o.length:void 0;let l;switch(n.type){case"sum":l=r.reduce((t,e)=>t+e,0);break;case"average":l=r.reduce((t,e)=>t+e,0)/r.length;break;case"count":l=o.length;break;case"min":l=Math.min(...r);break;case"max":l=Math.max(...r);break;default:return}return n.formatResult?n.formatResult(l):l})(i,t.accessor,t.aggregation,o);void 0!==e&&Q(a,t.accessor,e)}),a}return t});return l(r)};class At{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=N(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=Et({headers:e,rows:n,sortColumn:i});return t&&0!==t.length?o.map(n=>{const o=t[0],s=n[o];if(Z(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=Tt({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}):Et({headers:this.config.headers,rows:n,sortColumn:e}):n}updateConfig(t){const e=this.config.headers;this.config=Object.assign(Object.assign({},this.config),t),t.headers&&t.headers!==e&&this.updateHeaderLookup();const n=this.computeSortedRows(this.config.tableRows,this.state.sort);n!==this.state.sortedRows&&(this.state=Object.assign(Object.assign({},this.state),{sortedRows:n}),this.notifySubscribers())}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}notifySubscribers(){this.subscribers.forEach(t=>t(this.state))}updateSort(t){var e,n,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 Ot=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)},Wt=t=>new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0),Pt=t=>{if(!t)return new Date;if("string"==typeof t)return Ot(t);if("number"==typeof t){const e=new Date(t);return isNaN(e.getTime())?new Date:Wt(e)}return t instanceof Date?Wt(t):new Date};class $t{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=N(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=Pt(t),s=Pt((i||"")+""),r=Wt(e),l=Wt(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=>Wt(Pt((t||"")+"")));return r>=t&&e>=r}return!1;case"notBetween":if(o&&2===o.length){const[t,e]=o.map(t=>Wt(Pt((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}})(X(t,e.accessor),e)}catch(t){return console.warn(`Filter error for accessor ${e.accessor}:`,t),!0}})):t}updateConfig(t){const e=this.config.headers;this.config=Object.assign(Object.assign({},this.config),t),t.headers&&t.headers!==e&&this.updateHeaderLookup();const n=this.computeFilteredRows(this.config.rows,this.state.filters);n!==this.state.filteredRows&&(this.state=Object.assign(Object.assign({},this.state),{filteredRows:n}),this.notifySubscribers())}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}notifySubscribers(){this.subscribers.forEach(t=>t(this.state))}updateFilter(t){var e,n;const 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 Ft=(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},Lt=(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},Dt=({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,p=Math.max(0,Math.ceil(i/l)),f=Math.min(o.length,Math.floor(u/l)),v=i+e,w=Math.max(0,Math.floor(i/l)),m=Math.min(o.length,Math.ceil(v/l));return{rendered:{startIndex:c,endIndex:h,rows:o.slice(c,h)},fullyVisible:{startIndex:p,endIndex:f,rows:o.slice(p,f)},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,p=Ft(Math.max(0,i-c),r);let f=Ft(u,r)+1;f=Math.min(o.length,f);const v=i,w=i+e;let m=Ft(v,r);v>a[m]&&(m=Math.min(m+1,o.length));let g=Ft(w,r);g=Math.min(o.length,g);const x=i+e,b=Ft(i,r);let y=Ft(x,r)+1;return y=Math.min(o.length,y),{rendered:{startIndex:p,endIndex:f,rows:o.slice(p,f)},fullyVisible:{startIndex:m,endIndex:g,rows:o.slice(m,g)},partiallyVisible:{startIndex:b,endIndex:y,rows:o.slice(b,y)}}},Bt=({position:t,rowHeight:e,heightOffsets:n,customTheme:i})=>t*(e+i.rowSeparatorWidth)-i.rowSeparatorWidth+Lt(t,n),jt=({position:t,rowHeight:e,heightOffsets:n,customTheme:i})=>t*(e+i.rowSeparatorWidth)+Lt(t,n),zt=(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},Nt=new Map,qt=(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,p=null!==(c=null===(d=e[e.length-1])||void 0===d?void 0:d.position)&&void 0!==c?c:-1,f=`${h}:${u}:${p}:${o.join(",")}`,v=Nt.get(f);if(v&&v.firstVisiblePosition===h&&v.renderedStartPosition===u&&v.renderedEndPosition===p)return v.result;const w=Vt({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:i,partiallyVisibleRowIndex:0,recursionDepth:0,stickyParents:[],rowGrouping:o});if(Nt.set(f,{result:w,firstVisiblePosition:h,renderedStartPosition:u,renderedEndPosition:p}),Nt.size>50){const t=Nt.keys().next().value;void 0!==t&&Nt.delete(t)}return w},Vt=({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=>et(t.rowId)===et(i.rowId))||(r.push(i),d++)}}if(r.length>0){zt(a,t)&&(r.push(a),d++);const e=i[o+=d];e&&(a=e)}}else if(zt(a,t))return r.push(a),o++,Vt({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:i,partiallyVisibleRowIndex:o,recursionDepth:s+1,stickyParents:r,rowGrouping:l});return zt(a,t)?Vt({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:i,partiallyVisibleRowIndex:o,recursionDepth:s+1,stickyParents:r,rowGrouping:l}):{stickyParents:r,regularRows:e}},Gt=(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)}},Kt=(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=>et(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=Dt({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 Gt(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&&Gt(e,o,s)},100);Gt(d,o,s)},Ut=({rowIndex:t,colIndex:e,rowId:n})=>`${t}-${e}-${n}`;function Jt(t,e,n,i){const o=new Set,s=new Map;n.forEach((t,e)=>{const n=et(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),p=Math.max(t.colIndex,e.colIndex);for(let t=c;h>=t;t++)for(let e=u;p>=e;e++)if(t>=0&&n.length>t){if(i&&0===e)continue;const s=et(n[t].rowId);o.add(Ut({colIndex:e,rowIndex:t,rowId:s}))}return o}function _t(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 p=[];u.forEach((t,e)=>{const n=t[0].getBoundingClientRect();p.push({key:e,top:n.top,bottom:n.bottom})}),p.sort((t,e)=>t.top-e.top);let f=null,v=1/0;for(let t=0;p.length>t;t++){const{key:e,top:n,bottom:i}=p[t];if(c>=n&&i>=c){f=e,v=0;break}const o=Math.abs(c-(n+i)/2);v>o&&(v=o,f=e)}if(null===f)return null;const w=u.get(f);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 Yt{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=>dt(t,this.config.collapsedHeaders)),this.rowIdToTableIndex.clear(),this.config.tableRows.forEach((t,e)=>{this.rowIdToTableIndex.set(et(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(et(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(`${et(e.rowId)}\t${t}`),this.rowsWithSelectedCells.add(et(e.rowId))})})}updateRowIdAndSelectionLookupOnly(){this.rowIdToTableIndex.clear(),this.config.tableRows.forEach((t,e)=>{this.rowIdToTableIndex.set(et(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(`${et(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?et(o.rowId):null)!==i){const t=this.config.tableRows.findIndex(t=>et(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=et(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=et(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=et(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=et(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=et(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=et(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=et(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=et(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=et(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=et(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=et(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=et(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=et(this.config.tableRows[i].rowId);this.selectCellRange(this.startCell,{rowIndex:i,colIndex:n,rowId:t})}else{const t=et(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=et(this.config.tableRows[i].rowId);this.selectCellRange(this.startCell,{rowIndex:i,colIndex:n,rowId:t})}else{const t=et(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=>!t.hide&&!t.excludeFromRender),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=X(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=>!t.hide&&!t.excludeFromRender),c=i.findIndex(t=>et(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,p=u+n;if(c>=i.length||p>=d.length)return;const f=i[c],v=d[p],w=et(f.rowId);if(!(null==v?void 0:v.isEditable))return void l.add(`${c}-${p}-${w}`);let m=t;if("number"===v.type){const e=+t;isNaN(e)||(m=e)}else if("boolean"===v.type)m="true"===t.toLowerCase()||"1"===t;else if("date"===v.type){const e=new Date(t);isNaN(e.getTime())||(m=e)}else"lineAreaChart"!==v.type&&"barChart"!==v.type||(m=t.split(",").map(t=>{const e=+t.trim();return isNaN(e)?0:e}));if(Q(f.row,v.accessor,m),s){const t=`${null!==(a=f.stableRowKey)&&void 0!==a?a:w}-${v.accessor}`,e=s.get(t);e&&e.updateContent(m)}null==o||o({accessor:v.accessor,newValue:m,row:f.row,rowIndex:c}),r.add(`${c}-${p}-${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=>!t.hide&&!t.excludeFromRender),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=et(c.rowId);if(!(null==h?void 0:h.isEditable))return void r.add(t);let p=null;if(p="string"===h.type?"":"number"===h.type?null:"boolean"!==h.type&&("date"===h.type?null:"lineAreaChart"===h.type||"barChart"===h.type||Array.isArray(X(c.row,h.accessor))?[]:""),Q(c.row,h.accessor,p),o){const t=`${null!==(e=c.stableRowKey)&&void 0!==e?e:u}-${h.accessor}`,n=o.get(t);n&&n.updateContent(p)}null==i||i({accessor:h.accessor,newValue:p,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=et(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=Ut({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 N(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 Yt.HEADER_SELECTION_CLASSES)i.classList.remove(t);continue}if(l.isSelectionColumn&&this.config.enableRowSelection){for(const t of Yt.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 Yt.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 Yt.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 Yt.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 p=c?"0":"-1";if(n.getAttribute("tabindex")!==p&&n.setAttribute("tabindex",p),c&&document.activeElement!==n){const t=document.activeElement;t&&n.contains(t)||n.focus({preventScroll:!0})}}this.syncHeaderSelectionClasses()}else{for(let t=0;e.length>t;t++){const n=e[t];if(n instanceof HTMLElement){for(const t of Yt.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=Ut({rowIndex:o,colIndex:t,rowId:i});if(this.selectedCells.has(e))return!0}const s=Ut({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?et(r.rowId):null,a=this.config.tableRows[o+1],d=a?et(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}),p=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"),p||s.push("st-selected-right-border"),s.join(" ")}isInitialFocusedCell({colIndex:t,rowId:e}){return!!this.initialFocusedCell&&t===this.initialFocusedCell.colIndex&&e+""==this.initialFocusedCell.rowId+""}isCopyFlashing({colIndex:t,rowIndex:e,rowId:n}){const i=Ut({colIndex:t,rowIndex:e,rowId:n});return this.copyFlashCells.has(i)}isWarningFlashing({colIndex:t,rowIndex:e,rowId:n}){const i=Ut({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=Ut(t);this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.selectedCells=new Set([e]),this.initialFocusedCell=t,this.updateDerivedState(),this.updateAllCellClasses(),setTimeout(()=>Kt(t,this.config.rowHeight,this.config.customTheme,this.config.tableRows),0)}}selectCellRange(t,e){this.fullTableSelected=!1;const n=Jt(t,e,this.config.tableRows,!!this.config.enableRowSelection);this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.selectedCells=n,this.initialFocusedCell=e,this.updateDerivedState(),this.updateAllCellClasses(),setTimeout(()=>Kt(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=Jt(t,e,this.config.tableRows,!!this.config.enableRowSelection);this.selectedCells.size===n.size&&Array.from(n).every(t=>this.selectedCells.has(t))||(this.selectedCells=n,this.updateDerivedState(),this.updateAllCellClasses())}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 _t(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 _t(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}){this.config.selectableCells&&(this.fullTableSelected=!1,this.isSelecting=!0,this.startCell={rowIndex:e,colIndex:t,rowId:n},setTimeout(()=>{this.selectedColumns=new Set,this.lastSelectedColumnIndex=null;const i=Ut({colIndex:t,rowIndex:e,rowId:n});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)}}}Yt.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"],Yt.HEADER_SELECTION_CLASSES=["st-header-selected","st-header-has-highlighted-cell"];const Xt=(t,e)=>t.filter(t=>!(!t||!t.rowId)&&e.has(et(t.rowId))).map(t=>t.row);class Qt{constructor(t){this.subscribers=new Set,this.config=t,this.state={selectedRows:new Set,selectedRowCount:0,selectedRowsData:[]}}updateConfig(t){this.config=Object.assign(Object.assign({},this.config),t),t.tableRows&&this.updateDerivedState()}updateDerivedState(){var t;this.state=Object.assign(Object.assign({},this.state),{selectedRowCount:(t=this.state.selectedRows,t.size),selectedRowsData:Xt(this.config.tableRows,this.state.selectedRows)})}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}notifySubscribers(){this.subscribers.forEach(t=>t(this.state))}isRowSelected(t){return!!this.config.enableRowSelection&&(t=>this.state.selectedRows.has(t))(t)}areAllRowsSelected(){return!!this.config.enableRowSelection&&(e=this.state.selectedRows,0!==(t=this.config.tableRows).length&&t.filter(t=>t&&t.rowId).every(t=>e.has(et(t.rowId))));var t,e}getSelectedRows(){return this.state.selectedRows}getSelectedRowCount(){return this.state.selectedRowCount}getSelectedRowsData(){return this.state.selectedRowsData}setSelectedRows(t){this.state=Object.assign(Object.assign({},this.state),{selectedRows:t}),this.updateDerivedState(),this.notifySubscribers()}handleRowSelect(t,e){if(!this.config.enableRowSelection)return;const n=(t=>{const e=new Set(this.state.selectedRows);return e.has(t)?e.delete(t):e.add(t),e})(t);if(this.state=Object.assign(Object.assign({},this.state),{selectedRows:n}),this.updateDerivedState(),this.config.onRowSelectionChange){const i=this.config.tableRows.find(e=>et(e.rowId)===t);i&&this.config.onRowSelectionChange({row:i.row,isSelected:e,selectedRows:n})}this.notifySubscribers()}handleSelectAll(t){if(!this.config.enableRowSelection)return;let e;t?(e=new Set(this.config.tableRows.filter(t=>t&&t.rowId).map(t=>et(t.rowId))),this.config.onRowSelectionChange&&this.config.tableRows.forEach(t=>this.config.onRowSelectionChange({row:t.row,isSelected:!0,selectedRows:e}))):(e=new Set,this.config.onRowSelectionChange&&this.state.selectedRows.forEach(t=>{const n=this.config.tableRows.find(e=>et(e.rowId)===t);n&&this.config.onRowSelectionChange({row:n.row,isSelected:!1,selectedRows:e})})),this.state=Object.assign(Object.assign({},this.state),{selectedRows:e}),this.updateDerivedState(),this.notifySubscribers()}handleToggleRow(t){if(!this.config.enableRowSelection)return;const e=this.isRowSelected(t);this.handleRowSelect(t,!e)}clearSelection(){if(this.config.enableRowSelection){if(this.config.onRowSelectionChange){const t=new Set;this.state.selectedRows.forEach(e=>{const n=this.config.tableRows.find(t=>et(t.rowId)===e);n&&this.config.onRowSelectionChange({row:n.row,isSelected:!1,selectedRows:t})})}this.state=Object.assign(Object.assign({},this.state),{selectedRows:new Set}),this.updateDerivedState(),this.notifySubscribers()}}getState(){return this.state}destroy(){this.subscribers.clear()}}class Zt{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 te{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 ee{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 ne=(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 ie{constructor(t,e){this.observers=new Set,this.expandedDepths=ne(t,e)}updateRowGrouping(t){if(!t||0===t.length)return void this.setExpandedDepths(new Set);const e=t.length,n=Array.from(this.expandedDepths).filter(t=>e>t);this.setExpandedDepths(new Set(n))}getExpandedDepths(){return this.expandedDepths}setExpandedDepths(t){this.expandedDepths=t,this.notifyObservers()}subscribe(t){return this.observers.add(t),()=>{this.observers.delete(t)}}notifyObservers(){this.observers.forEach(t=>t(this.expandedDepths))}expandAll(){const t=new Set;for(let e=0;10>e;e++)t.add(e);this.setExpandedDepths(t)}collapseAll(){this.setExpandedDepths(new Set)}expandDepth(t){const e=new Set(this.expandedDepths);e.add(t),this.setExpandedDepths(e)}collapseDepth(t){const e=new Set(this.expandedDepths);e.delete(t),this.setExpandedDepths(e)}toggleDepth(t){this.expandedDepths.has(t)?this.collapseDepth(t):this.expandDepth(t)}destroy(){this.observers.clear()}}class oe{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 se(t){return t?t.offsetWidth-t.clientWidth:0}const re=(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)||c()},a=t=>{"Escape"===t.key&&(t.preventDefault(),c())},d=t=>{o.contains(t.target)||c()},c=()=>{o.remove(),document.removeEventListener("mousedown",r,!0),document.removeEventListener("keydown",a,!0),window.removeEventListener("scroll",d,!0),n.onClose()};return setTimeout(()=>{document.addEventListener("mousedown",r,!0),document.addEventListener("keydown",a,!0),window.addEventListener("scroll",d,!0)},0),l(o,"mousedown",t=>{t.stopPropagation()}),o},le=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("width","24"),e.setAttribute("height","24"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"),n.setAttribute("fill","inherit"),e.appendChild(n),e},ae=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("width","24"),e.setAttribute("height","24"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z"),n.setAttribute("fill","inherit"),e.appendChild(n),e},de=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false"),e.setAttribute("role","img"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("viewBox","0 0 320 512"),e.setAttribute("height","1em"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M298 177.5c3.8-8.8 2-19-4.6-26l-116-144C172.9 2.7 166.6 0 160 0s-12.9 2.7-17.4 7.5l-116 144c-6.6 7-8.4 17.2-4.6 26S34.4 192 44 192l72 0 0 288c0 17.7 14.3 32 32 32l24 0c17.7 0 32-14.3 32-32l0-288 72 0c9.6 0 18.2-5.7 22-14.5z"),n.setAttribute("fill","inherit"),e.appendChild(n),e},ce=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false"),e.setAttribute("role","img"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("viewBox","0 0 320 512"),e.setAttribute("height","1em"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M22 334.5c-3.8 8.8-2 19 4.6 26l116 144c4.5 4.8 10.8 7.5 17.4 7.5s12.9-2.7 17.4-7.5l116-144c6.6-7 8.4-17.2 4.6-26s-12.5-14.5-22-14.5l-72 0 0-288c0-17.7-14.3-32-32-32L148 0C130.3 0 116 14.3 116 32l0 288-72 0c-9.6 0-18.2 5.7-22 14.5z"),n.setAttribute("fill","inherit"),e.appendChild(n),e},he=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");return e.setAttribute("aria-hidden","true"),e.setAttribute("role","img"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("viewBox","0 0 16 10"),e.setAttribute("width","16px"),e.setAttribute("height","10px"),t&&e.setAttribute("class",t),[{cx:"3",cy:"3"},{cx:"8",cy:"3"},{cx:"13",cy:"3"},{cx:"3",cy:"7"},{cx:"8",cy:"7"},{cx:"13",cy:"7"}].forEach(({cx:t,cy:n})=>{const 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},ue=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("aria-hidden","true"),e.setAttribute("role","img"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("viewBox","0 0 512 512"),e.setAttribute("height","1em"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M3.9 54.9C10.5 40.9 24.5 32 40 32l432 0c15.5 0 29.5 8.9 36.1 22.9s4.6 30.5-5.2 42.5L320 320.9 320 448c0 12.1-6.8 23.2-17.7 28.6s-23.8 4.3-33.5-3l-64-48c-8.1-6-12.8-15.5-12.8-25.6l0-79.1L9 97.3C-.7 85.4-2.8 68.8 3.9 54.9z"),n.setAttribute("fill","inherit"),e.appendChild(n),e},pe=(t,e)=>new Date(t,e+1,0).getDate(),fe=["January","February","March","April","May","June","July","August","September","October","November","December"],ve=["Su","Mo","Tu","We","Th","Fr","Sa"],we=(t,e,n)=>{const{header:i,row:o}=t,s=X(o,i.accessor);return"boolean"===i.type?((t,e,n,i)=>{var o;const{header:s,row:r,rowIndex:a}=t;let d;const c=document.createElement("div");c.className="st-dropdown-item "+(!0===n?"selected":""),c.textContent="True",c.setAttribute("role","option"),c.setAttribute("aria-selected",(!0===n)+""),c.setAttribute("aria-disabled","false");const h=document.createElement("div");h.className="st-dropdown-item "+(!1===n?"selected":""),h.textContent="False",h.setAttribute("role","option"),h.setAttribute("aria-selected",(!1===n)+""),h.setAttribute("aria-disabled","false");const u=t=>{Q(r,s.accessor,t),e.onCellEdit&&e.onCellEdit({accessor:s.accessor,newValue:t,row:r,rowIndex:a}),d.remove(),i()};l(c,"click",()=>u(!0)),l(h,"click",()=>u(!1));const p=t=>{const e=t;"ArrowDown"===e.key||"ArrowUp"===e.key?(e.preventDefault(),document.activeElement===c?h.focus():c.focus()):"Enter"===e.key&&(e.preventDefault(),document.activeElement===c?u(!0):document.activeElement===h&&u(!1))};c.setAttribute("tabindex","0"),h.setAttribute("tabindex","0"),l(c,"keydown",p),l(h,"keydown",p);const f=document.createDocumentFragment();f.appendChild(c),f.appendChild(h);const v=J({accessor:s.accessor,rowId:null!==(o=t.stableRowKey)&&void 0!==o?o:t.rowId}),w=document.getElementById(v);return d=re(w||document.body,f,{width:120,positioning:"fixed",onClose:i}),d})(t,e,!!s,n):"enum"===i.type?((t,e,n,i)=>{var o;const{header:s,row:r,rowIndex:a}=t,d=s.enumOptions||[];let c;const h=t=>{Q(r,s.accessor,t),e.onCellEdit&&e.onCellEdit({accessor:s.accessor,newValue:t,row:r,rowIndex:a}),c.remove(),i()},u=[];d.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,l(i,"click",()=>h(t.value)),u.push(i)});const p=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&&h(t)}};u.forEach(t=>{l(t,"keydown",p)});const f=document.createElement("div");f.className="st-enum-dropdown-content",u.forEach(t=>f.appendChild(t));const v=J({accessor:s.accessor,rowId:null!==(o=t.stableRowKey)&&void 0!==o?o:t.rowId}),w=document.getElementById(v);return c=re(w||document.body,f,{width:150,maxHeight:300,positioning:"fixed",onClose:i}),setTimeout(()=>{const t=d.findIndex(t=>t.value===n);t>=0&&u[t]?(u[t].focus(),u[t].scrollIntoView({block:"nearest"})):u.length>0&&u[0].focus()},0),c})(t,e,(s||"")+"",n):"date"===i.type?((t,e,n,i)=>{var o,s,r;const{header:a,row:d,rowIndex:c}=t;let h,u;try{u=n?Ot(n+""):new Date}catch(t){u=new Date}let p=u.getFullYear(),f=u.getMonth();const v=document.createElement("div");v.className="st-datepicker";const w=document.createElement("div");w.className="st-datepicker-header";const m=document.createElement("button");m.className="st-datepicker-nav-btn",m.setAttribute("aria-label","Previous month");const g=null!==(o=e.icons.prev)&&void 0!==o?o:le("st-next-prev-icon");"string"==typeof g?m.innerHTML=g:m.appendChild(g.cloneNode(!0));const x=document.createElement("div");x.className="st-datepicker-header-label",x.setAttribute("aria-hidden","true");const b=document.createElement("button");b.className="st-datepicker-nav-btn",b.setAttribute("aria-label","Next month");const y=null!==(s=e.icons.next)&&void 0!==s?s:ae("st-next-prev-icon");"string"==typeof y?b.innerHTML=y:b.appendChild(y.cloneNode(!0)),w.appendChild(m),w.appendChild(x),w.appendChild(b);const R=document.createElement("div");R.className="st-datepicker-grid st-datepicker-days-grid",ve.forEach(t=>{const e=document.createElement("div");e.className="st-datepicker-weekday",e.textContent=t,R.appendChild(e)});const C=document.createElement("div");C.className="st-datepicker-footer";const S=document.createElement("button");S.className="st-datepicker-today-btn",S.textContent="Today",l(S,"click",()=>{const t=new Date,e=new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0);I(e)}),C.appendChild(S),v.appendChild(w),v.appendChild(R),v.appendChild(C);const I=t=>{const n=t.toISOString().split("T")[0];Q(d,a.accessor,n),e.onCellEdit&&e.onCellEdit({accessor:a.accessor,newValue:n,row:d,rowIndex:c}),h.remove(),i()},H=()=>{var t,e,n;for(x.textContent=`${fe[f]} ${p}`;R.children.length>7;)null===(t=R.lastElementChild)||void 0===t||t.remove();const i=pe(p,f),o=new Date(p,f,1).getDay(),s=pe(p,f-1),r=new Date;for(let t=0;o>t;t++){const n=s-o+t+1,i=new Date(p,f-1,n),r=document.createElement("div");r.className="st-datepicker-day other-month",r.textContent=n+"",r.setAttribute("tabindex","0"),r.setAttribute("role","button"),r.setAttribute("aria-label",`${null!==(e=fe[f-1])&&void 0!==e?e:fe[11]} ${n}, ${i.getFullYear()}`),l(r,"click",()=>I(i)),l(r,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),I(i))}),R.appendChild(r)}const a=u.getFullYear()===p&&u.getMonth()===f;for(let t=1;i>=t;t++){const e=document.createElement("div");e.className="st-datepicker-day",e.textContent=t+"",e.setAttribute("tabindex","0"),e.setAttribute("role","button"),e.setAttribute("aria-label",`${fe[f]} ${t}, ${p}`),r.getFullYear()===p&&r.getMonth()===f&&r.getDate()===t&&e.classList.add("today"),a&&u.getDate()===t&&e.classList.add("selected");const n=new Date(p,f,t);l(e,"click",()=>I(n)),l(e,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),I(n))}),R.appendChild(e)}const d=o+i,c=Math.max(35,7*Math.ceil(d/7))-d;for(let t=1;c>=t;t++){const e=new Date(p,f+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",`${null!==(n=fe[f+1])&&void 0!==n?n:fe[0]} ${t}, ${e.getFullYear()}`),l(i,"click",()=>I(e)),l(i,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),I(e))}),R.appendChild(i)}};l(m,"click",()=>{f--,0>f&&(f=11,p--),H()}),l(b,"click",()=>{f++,f>11&&(f=0,p++),H()}),H();const M=J({accessor:a.accessor,rowId:null!==(r=t.stableRowKey)&&void 0!==r?r:t.rowId}),k=document.getElementById(M);return h=re(k||document.body,v,{width:240,overflow:"hidden",positioning:"fixed",onClose:i}),h})(t,e,s,n):((t,e,n,i)=>{const{header:o,row:s,rowIndex:r}=t,a=document.createElement("input");a.className="editable-cell-input","number"===o.type?(a.type="text",a.inputMode="decimal"):a.type="text",a.value=null!=n?n+"":"",a.setAttribute("autofocus","true"),setTimeout(()=>{a.focus(),a.select()},0);let d=!0;if("number"===o.type){const t=()=>{const t=a.value;/^-?\d*\.?\d*$/.test(t)||(a.value=t.slice(0,-1))};l(a,"input",t)}return l(a,"blur",t=>{if(!d)return void i();let n=a.value;if("number"===o.type){const t=parseFloat(a.value);n=isNaN(t)?0:t}Q(s,o.accessor,n),e.onCellEdit&&e.onCellEdit({accessor:o.accessor,newValue:n,row:s,rowIndex:r}),i()}),l(a,"keydown",t=>{const e=t;e.stopPropagation(),"Enter"===e.key?(d=!0,a.blur()):"Escape"===e.key&&(d=!1,a.blur())}),l(a,"mousedown",t=>{t.stopPropagation()}),a})(t,e,s,n)},me=()=>{const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("aria-hidden","true"),t.setAttribute("role","img"),t.setAttribute("xmlns","http://www.w3.org/2000/svg"),t.setAttribute("viewBox","0 0 448 512"),t.setAttribute("class","st-checkbox-checkmark"),t.style.height="10px";const e=document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttribute("d","M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"),t.appendChild(e),t},ge=(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(me()))},xe=({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(me());const r=()=>{const t=o.checked;o.setAttribute("aria-checked",""+t),t?(s.classList.add("st-checked"),s.appendChild(me())):(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(me())):(s.classList.remove("st-checked"),s.innerHTML=""))},destroy:()=>{o.removeEventListener("change",r)}}},be=new WeakMap,ye=(t,e,n)=>{var i,o;const s=t.querySelector(".st-expand-icon-container");if(!(s&&s instanceof HTMLElement))return;if(s.classList.contains("expanded")===e)return;const r=null!==(i=null==n?void 0:n.ariaLabelWhenExpanded)&&void 0!==i?i:"Collapse row",l=null!==(o=null==n?void 0:n.ariaLabelWhenCollapsed)&&void 0!==o?o:"Expand row";requestAnimationFrame(()=>{requestAnimationFrame(()=>{s.classList.toggle("expanded",e),s.classList.toggle("collapsed",!e),s.setAttribute("aria-label",e?r:l),s.setAttribute("aria-expanded",e+"")})})},Re=(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)?Pt(t).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):null==t?"":t+""},Ce=(t,e,n)=>{var i;const{header:o,row:s,rowIndex:r,colIndex:a,depth:d,rowId:c}=t,h=X(s,o.accessor),u=o.isSelectionColumn&&e.enableRowSelection;if(e.isLoading||t.tableRow.isLoadingSkeleton){const t=document.createElement("div");return t.className="st-loading-skeleton",void n.appendChild(t)}if(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(c+""),r=((t,e,n)=>xe({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 p=e.rowGrouping&&e.rowGrouping[d],f=!!p&<(s,p),v=e.rowGrouping&&e.rowGrouping.length>d,w=!e.canExpandRowGroup||e.canExpandRowGroup(s);if(o.expandable&&(f&&v&&w||o.nestedTable||e.onRowGroupExpand&&v&&w)){const i=new Set(e.expandedDepths),o=st(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;n.stopPropagation();const s=i.closest("[data-row-id]"),r=s?be.get(s):void 0,l=null!==(o=null==r?void 0:r.tableRow)&&void 0!==o?o:t.tableRow,a=st(l),d=l.depth,c=new Set(e.expandedDepths),h=e.getExpandedRows?e.getExpandedRows():e.expandedRows,u=e.getCollapsedRows?e.getCollapsedRows():e.collapsedRows,p=at(a,d,c,h,u),f=!p;if(p?(e.setCollapsedRows(t=>{const e=new Map(t);return e.set(a,d),e}),e.setExpandedRows(t=>{const e=new Map(t);return e.delete(a),e}),e.setRowStateMap(t=>{const e=new Map(t);return e.delete(a),e})):(e.setExpandedRows(t=>{const e=new Map(t);return e.set(a,d),e}),e.setCollapsedRows(t=>{const e=new Map(t);return e.delete(a),e})),e.onRowGroupExpand&&t.tableRow.rowIndexPath&&e.rowGrouping){const n=t.header.pinned,i=t=>{setTimeout(()=>{e.setRowStateMap(e=>{const i=new Map(e),o=i.get(a)||{};return i.set(a,Object.assign(Object.assign({},o),{loading:t,triggerSection:n})),i})},0)},o=t=>{e.setRowStateMap(e=>{const i=new Map(e),o=i.get(a)||{};return i.set(a,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(a)||{};return i.set(a,Object.assign(Object.assign({},o),{isEmpty:t,loading:!1,triggerSection:n})),i})};e.onRowGroupExpand({row:t.row,depth:d,event:{stopPropagation:()=>{},preventDefault:()=>{}},groupingKey:e.rowGrouping[d],isExpanded:f,rowIndexPath:t.tableRow.rowIndexPath,rowIdPath:t.tableRow.rowPath,groupingKeys:e.rowGrouping,setLoading:i,setError:o,setEmpty:s})}};return l(i,"click",s),l(i,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),s(t))}),i})(t,e,at(o,d,i,e.expandedRows,e.collapsedRows));n.appendChild(s)}if("lineAreaChart"===o.type&&Array.isArray(h)){const t=h.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=void 0!==d?d:Math.min(...e),u=(void 0!==c?c:Math.max(...e))-h||1,p=i,f=document.createElementNS("http://www.w3.org/2000/svg","svg");f.setAttribute("width",n+""),f.setAttribute("height",i+""),f.setAttribute("viewBox","0 0 100 "+p),f.setAttribute("preserveAspectRatio","none"),f.setAttribute("class",("st-line-area-chart "+a).trim()),f.setAttribute("shape-rendering","geometricPrecision"),f.style.display="block";const v=()=>{f.innerHTML="";const t=e.map((t,n)=>({x:n/(e.length-1)*100,y:p-(t-h)/u*p})).map((t,e)=>`${0===e?"M":"L"} ${t.x},${t.y}`).join(" "),n=`\n ${t}\n L 100,${p}\n L 0,${p}\n Z\n `,i=document.createElementNS("http://www.w3.org/2000/svg","path");i.setAttribute("d",n),i.setAttribute("fill",s||"var(--st-chart-fill-color)"),i.setAttribute("fill-opacity",r+""),i.setAttribute("stroke","none");const a=document.createElementNS("http://www.w3.org/2000/svg","path");a.setAttribute("d",t),a.setAttribute("fill","none"),a.setAttribute("stroke",o||"var(--st-chart-color)"),a.setAttribute("stroke-width",l+""),a.setAttribute("stroke-linecap","round"),a.setAttribute("stroke-linejoin","round"),f.appendChild(i),f.appendChild(a)};return v(),{element:f,update:t=>{void 0===t.data||(e=t.data,e&&0!==e.length)?(void 0!==t.width&&(n=t.width,f.setAttribute("width",n+"")),void 0!==t.height&&(i=t.height,f.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,f.setAttribute("class",("st-line-area-chart "+a).trim())),void 0!==t.min&&(d=t.min),void 0!==t.max&&(c=t.max),v()):f.innerHTML=""},destroy:()=>{f.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(h)){const t=h.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=void 0!==l?l:Math.min(...e),c=void 0!==a?a:Math.max(...e),h=c-d||1,u=i,p=(100-s*(e.length-1))/e.length,f=0>d,v=f?u*(c/h):u,w=document.createElementNS("http://www.w3.org/2000/svg","svg");w.setAttribute("width",n+""),w.setAttribute("height",i+""),w.setAttribute("viewBox","0 0 100 "+u),w.setAttribute("preserveAspectRatio","none"),w.setAttribute("class",("st-bar-chart "+r).trim()),w.setAttribute("shape-rendering","crispEdges"),w.style.display="block";const m=()=>{w.innerHTML="",e.forEach((t,e)=>{const n=e*(p+s),i=(t-d)/h*u;let r=u-i,l=i;f&&(0>t?(l=Math.abs(t)/h*u,r=v):(l=t/h*u,r=v-l));const a=document.createElementNS("http://www.w3.org/2000/svg","rect");a.setAttribute("x",n+""),a.setAttribute("y",r+""),a.setAttribute("width",p+""),a.setAttribute("height",l+""),a.setAttribute("fill",o||"var(--st-chart-color)"),a.setAttribute("rx","0.5"),w.appendChild(a)})};return m(),{element:w,update:t=>{void 0===t.data||(e=t.data,e&&0!==e.length)?(void 0!==t.width&&(n=t.width,w.setAttribute("width",n+"")),void 0!==t.height&&(i=t.height,w.setAttribute("height",i+"")),void 0!==t.color&&(o=t.color),void 0!==t.gap&&(s=t.gap),void 0!==t.className&&(r=t.className,w.setAttribute("class",("st-bar-chart "+r).trim())),void 0!==t.min&&(l=t.min),void 0!==t.max&&(a=t.max),m()):w.innerHTML=""},destroy:()=>{w.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 l=o.cellRenderer({accessor:o.accessor,colIndex:a,row:s,rowIndex:t.tableRow.absoluteRowIndex||r,rowPath:t.tableRow.rowPath,theme:e.theme,value:h,formattedValue:null===(i=o.valueFormatter)||void 0===i?void 0:i.call(o,{accessor:o.accessor,colIndex:a,row:s,rowIndex:r,value:h})});if("string"==typeof l||"number"==typeof l){const t=document.createTextNode(l+"");n.appendChild(t)}else if(l instanceof Node)n.appendChild(l);else if(null!=l&&"object"==typeof l){const t=Re(h,o,a,s,r);if(null!==t){const e=document.createTextNode(t);n.appendChild(e)}}}catch(t){console.error("Error rendering cell:",t);const e=Re(h,o,a,s,r);if(null!==e){const t=document.createTextNode(e);n.appendChild(t)}}return}const m=Re(h,o,a,s,r);if(null!==m){const t=document.createTextNode(m);n.appendChild(t)}},Se=new Map,Ie=new WeakMap,He=new WeakMap;let Me=null;const ke=(t,e)=>{Se.has(t)||Se.set(t,new Set),Se.get(t).add(e)},Ee=(t,e)=>{const n=Se.get(t);n&&(n.delete(e),0===n.size&&Se.delete(t))},Te=(t,e)=>{const n=Se.get(t);n&&n.forEach(t=>{e?t.classList.add("st-row-hovered"):t.classList.remove("st-row-hovered")})},Ae=(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.isEditable)||!(!e.onCellClick||d),h={rowIndex:o,colIndex:s,rowId:r},u=e.getBorderClass(h),p=e.isSelected(h),f=e.isInitialFocusedCell(h),v=e.isCopyFlashing(h),w=e.isWarningFlashing(h),m=e.selectedColumns.has(s),g=p&&!m,x=d&&e.rowsWithSelectedCells.has(r+""),b=(()=>{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?f?"st-cell-selected-first "+u:"st-cell-selected "+u:"",m?f?"st-cell-column-selected-first":"st-cell-column-selected":"",c?"clickable":"",v?f?"st-cell-copy-flash-first":"st-cell-copy-flash":"",w?f?"st-cell-warning-flash-first":"st-cell-warning-flash":"",e.useOddColumnBackground?s%2==0?"even-column":"odd-column":"",d?"st-selection-cell":"",x?"st-selection-has-highlighted-cell":"",b?"st-last-column":"","",e.useOddEvenRowBackground?a?"st-cell-even-row":"st-cell-odd-row":"",(null===(n=e.isRowSelected)||void 0===n?void 0:n.call(e,r))?"st-cell-selected-row":""].filter(Boolean).join(" ")},Oe=(t,e)=>{var n,i,o;const{header:s,row:r,rowIndex:a,colIndex:d,rowId:c}=t,h=s.isSelectionColumn&&e.enableRowSelection,u={rowIndex:a,colIndex:d,rowId:c},p=e.isInitialFocusedCell(u),f=Ae(t,e),v=document.createElement("div");v.className=f,v.id=J({accessor:s.accessor,rowId:null!==(n=t.stableRowKey)&&void 0!==n?n:c}),v.setAttribute("role",void 0!==e.rowHeaderAccessor&&s.accessor===e.rowHeaderAccessor?"rowheader":"gridcell"),v.setAttribute("tabindex",p?"0":"-1");const w=null!==(i=e.maxHeaderDepth)&&void 0!==i?i:1;v.setAttribute("aria-rowindex",t.tableRow.position+w+1+""),v.setAttribute("aria-colindex",d+1+""),e.enableRowSelection&&v.setAttribute("aria-selected",(null===(o=e.isRowSelected)||void 0===o?void 0:o.call(e,c))?"true":"false"),v.setAttribute("data-row-index",a+""),v.setAttribute("data-col-index",d+""),v.setAttribute("data-row-id",c+""),v.setAttribute("data-accessor",s.accessor+""),v.style.position="absolute",v.style.left=t.left+"px",v.style.top=t.top+"px",v.style.width=t.width+"px",v.style.height=t.height+"px";let m=!1;const g="boolean"===s.type||"date"===s.type||"enum"===s.type,x=()=>{var n,i,o,r;const l=null!==(i=null===(n=be.get(v))||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,v),v.innerHTML="",v.setAttribute("tabindex","-1");const e=we(t,l,()=>{m=!1,v.setAttribute("tabindex",p?"0":"-1"),x(),y()});if(e){const t=document.createElement("div");t.className="st-cell-editing",t.appendChild(e),v.appendChild(t)}}else if(m&&g)we(t,l,()=>{m=!1,x(),y()});else{null===(r=l.onRendererHostDiscard)||void 0===r||r.call(l,v),v.innerHTML="";const e=document.createElement("span");e.className="st-cell-content "+("right"===s.align?"right-aligned":"center"===s.align?"center-aligned":"left-aligned"),Ce(t,l,e),v.appendChild(e)}};x(),t.header.expandable||He.set(v,{row:t.row,value:X(r,s.accessor),theme:e.theme,skeleton:!(!e.isLoading&&!t.tableRow.isLoadingSkeleton)});const b={row:r,tableRow:t.tableRow,context:e};be.set(v,b);const y=()=>{var n;if(e.cellRegistry&&!h){const i=J({accessor:s.accessor,rowId:null!==(n=t.stableRowKey)&&void 0!==n?n:c});Ie.set(v,i),e.cellRegistry.set(i,{updateContent:t=>{var n,i;if(!m){if(Q(b.row,s.accessor,t),x(),!s.expandable){const t=null!==(i=null===(n=be.get(v))||void 0===n?void 0:n.context)&&void 0!==i?i:e;He.set(v,{row:b.row,value:X(b.row,s.accessor),theme:t.theme,skeleton:!(!t.isLoading&&!b.tableRow.isLoadingSkeleton)})}e.cellUpdateFlash&&(v.classList.add(p?"st-cell-updating-first":"st-cell-updating"),setTimeout(()=>{v.classList.remove("st-cell-updating-first","st-cell-updating")},800))}}})}};if(y(),!m&&!h){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=v.getAttribute("data-row-index"))&&void 0!==n?n:"-1",10),r=parseInt(null!==(i=v.getAttribute("data-col-index"))&&void 0!==i?i:"-1",10),l=v.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=v.getAttribute("data-row-index"))&&void 0!==n?n:"-1",10),r=parseInt(null!==(i=v.getAttribute("data-col-index"))&&void 0!==i?i:"-1",10),l=v.getAttribute("data-row-id");e.handleMouseOver(0>s||0>r||null===l?u:{rowIndex:s,colIndex:r,rowId:l},o.clientX,o.clientY)};l(v,"mousedown",t),l(v,"mouseover",n)}if(l(v,"keydown",t=>{m||h||"F2"!==t.key&&"Enter"!==t.key||!s.isEditable||m||(t.preventDefault(),m=!0,x())}),l(v,"dblclick",t=>{!s.isEditable||h||m||(m=!0,x())}),e.onCellClick&&!h){const t=t=>{var n,i,o,l,c;if(t.target.closest(".st-expand-icon-container"))return;const h=null!==(i=null===(n=be.get(v))||void 0===n?void 0:n.row)&&void 0!==i?i:r,u=X(h,s.accessor),p=parseInt(null!==(o=v.getAttribute("data-row-index"))&&void 0!==o?o:a+"",10),f=parseInt(null!==(l=v.getAttribute("data-col-index"))&&void 0!==l?l:d+"",10);null===(c=e.onCellClick)||void 0===c||c.call(e,{accessor:s.accessor,colIndex:f,row:h,rowIndex:p,value:u})};l(v,"click",t)}if(e.useHoverRowBackground){const t=c+"";ke(t,v);const e=()=>{var e;const n=null!==(e=v.getAttribute("data-row-id"))&&void 0!==e?e:t;null!==Me&&Me!==n&&Te(Me,!1),Te(n,!0),Me=n},n=()=>{var e;const n=null!==(e=v.getAttribute("data-row-id"))&&void 0!==e?e:t;Te(n,!1),Me===n&&(Me=null)};l(v,"mouseenter",e),l(v,"mouseleave",n)}return v},We=(t,e,n)=>{var i,o,s;const{rowIndex:r,colIndex:l,rowId:a}=e,d={rowIndex:r,colIndex:l,rowId:a};t.className=Ae(e,n);const c=n.isInitialFocusedCell(d);t.setAttribute("tabindex",c?"0":"-1"),t.style.left=e.left+"px",t.style.top=e.top+"px";const h=t.dataset.stAccordionGrow;"horizontal"!==h&&(t.style.width=e.width+"px"),"vertical"!==h&&(t.style.height=e.height+"px"),t.setAttribute("data-row-index",r+""),t.setAttribute("data-col-index",l+"");const u=null!==(i=n.maxHeaderDepth)&&void 0!==i?i:1;t.setAttribute("aria-rowindex",e.tableRow.position+u+1+""),t.setAttribute("aria-colindex",l+1+""),n.enableRowSelection?t.setAttribute("aria-selected",(null===(o=n.isRowSelected)||void 0===o?void 0:o.call(n,a))?"true":"false"):t.hasAttribute("aria-selected")&&t.removeAttribute("aria-selected");const p=void 0!==n.rowHeaderAccessor&&e.header.accessor===n.rowHeaderAccessor?"rowheader":"gridcell";t.getAttribute("role")!==p&&t.setAttribute("role",p);const f=t.getAttribute("data-row-id"),v=a+"";f&&f!==v&&(Ee(f,t),ke(v,t)),t.setAttribute("data-row-id",v),t.setAttribute("data-accessor",e.header.accessor+"");const w=be.get(t);if(w?(w.row=e.row,w.tableRow=e.tableRow,w.context=n):be.set(t,{row:e.row,tableRow:e.tableRow,context:n}),!e.header.expandable){const i=t.querySelector(".st-cell-content");if(i){const o=He.get(t),r=X(e.row,e.header.accessor),l=!(!n.isLoading&&!e.tableRow.isLoadingSkeleton);void 0!==o&&o.row===e.row&&o.value===r&&o.theme===n.theme&&o.skeleton===l||(He.set(t,{row:e.row,value:r,theme:n.theme,skeleton:l}),null===(s=n.onRendererHostDiscard)||void 0===s||s.call(n,i),i.innerHTML="",Ce(e,n,i))}}},Pe=t=>{if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map(Pe);const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=Pe(t[n]));return e},$e=(t,e)=>t.filter(t=>t.pinned===e).some(t=>!t.hide&&!t.excludeFromRender),Fe="st-accordion-animating",Le="--st-accordion-duration",De="--st-accordion-easing";function Be(t){return{pinnedLeft:t.filter(t=>"left"===t.pinned),unpinned:t.filter(t=>!t.pinned),pinnedRight:t.filter(t=>"right"===t.pinned)}}function je(t,e){return!0===t.isEssential||e.has(t.accessor+"")}function ze(t,e){let n=!1;for(const i of t){if(i.isSelectionColumn||i.excludeFromRender)continue;const t=je(i,e);if(t&&n)return!1;t||(n=!0)}return!0}function Ne(t,e){var n;const{pinnedLeft:i,unpinned:o,pinnedRight:s}=Be(t);if(!ze(i,e))return!1;if(!ze(o,e))return!1;if(!ze(s,e))return!1;for(const i of t)if((null===(n=i.children)||void 0===n?void 0:n.length)&&!qe(i.children,e))return!1;return!0}function qe(t,e){var n;if(!ze(t,e))return!1;for(const i of t)if((null===(n=i.children)||void 0===n?void 0:n.length)&&!qe(i.children,e))return!1;return!0}function Ve(t){const{pinnedLeft:e,unpinned:n,pinnedRight:i}=Be(t);return{left:e.map(t=>t.accessor),main:n.map(t=>t.accessor),right:i.map(t=>t.accessor)}}function Ge(t,e,n){return[...t.filter(t=>je(e.get(t+""),n)),...t.filter(t=>!je(e.get(t+""),n))]}function Ke(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=Ge(e.left,s,n),l=Ge(e.main,s,n),a=Ge(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 Ue(t,e,n,i){const o=e+"",s=Ve(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&&(!je(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),Ke(t,{left:r,main:l,right:a},i)):null}class Je{static resolveIcons(t){var e,n,i,o,s,r,l,a,d,c,h,u,p,f,v,w,m,g;const x={drag:he("st-drag-icon"),expand:ae("st-expand-icon"),filter:ue("st-header-icon"),headerCollapse:ae("st-header-icon"),headerExpand:le("st-header-icon"),next:ae("st-next-prev-icon"),prev:le("st-next-prev-icon"),sortDown:ce("st-header-icon"),sortUp:de("st-header-icon")};return{drag:null!==(n=null===(e=t.icons)||void 0===e?void 0:e.drag)&&void 0!==n?n:x.drag,expand:null!==(o=null===(i=t.icons)||void 0===i?void 0:i.expand)&&void 0!==o?o:x.expand,filter:null!==(r=null===(s=t.icons)||void 0===s?void 0:s.filter)&&void 0!==r?r:x.filter,headerCollapse:null!==(a=null===(l=t.icons)||void 0===l?void 0:l.headerCollapse)&&void 0!==a?a:x.headerCollapse,headerExpand:null!==(c=null===(d=t.icons)||void 0===d?void 0:d.headerExpand)&&void 0!==c?c:x.headerExpand,next:null!==(u=null===(h=t.icons)||void 0===h?void 0:h.next)&&void 0!==u?u:x.next,prev:null!==(f=null===(p=t.icons)||void 0===p?void 0:p.prev)&&void 0!==f?f:x.prev,sortDown:null!==(w=null===(v=t.icons)||void 0===v?void 0:v.sortDown)&&void 0!==w?w:x.sortDown,sortUp:null!==(g=null===(m=t.icons)||void 0===m?void 0:m.sortUp)&&void 0!==g?g:x.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;return{text:null!==(n=null===(e=t.columnEditorConfig)||void 0===e?void 0:e.text)&&void 0!==n?n:"Columns",searchEnabled:null===(o=null===(i=t.columnEditorConfig)||void 0===i?void 0:i.searchEnabled)||void 0===o||o,searchPlaceholder:null!==(r=null===(s=t.columnEditorConfig)||void 0===s?void 0:s.searchPlaceholder)&&void 0!==r?r:"Search columns...",allowColumnPinning:null===(a=null===(l=t.columnEditorConfig)||void 0===l?void 0:l.allowColumnPinning)||void 0===a||a,searchFunction:null===(d=t.columnEditorConfig)||void 0===d?void 0:d.searchFunction,rowRenderer:null===(c=t.columnEditorConfig)||void 0===c?void 0:c.rowRenderer,customRenderer:null===(h=t.columnEditorConfig)||void 0===h?void 0:h.customRenderer}}static buildEssentialAccessors(t){return function(t){const e=new Set,n=t=>{var i;for(const o of t)o.isEssential&&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 ne(null===(e=t.expandAll)||void 0===e||e,t.rowGrouping)}}class _e{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;const s=null!==(n=e.theme)&&void 0!==n?n:"modern-light",r=null!==(i=e.className)&&void 0!==i?i:"",l=null!==(o=e.columnBorders)&&void 0!==o&&o,a=document.createElement("div");a.className=`simple-table-root st-wrapper theme-${s} ${r} ${l?"st-column-borders":""}`;const d=document.createElement("div");d.className="st-wrapper-container";const c=document.createElement("div");c.className="st-content-wrapper";const h=document.createElement("div");h.className="st-content",h.setAttribute("role",Array.isArray(e.rowGrouping)&&e.rowGrouping.length>0?"treegrid":"grid"),h.style.width=e.editColumns?"calc(100% - 29.5px)":"100%";const u=document.createElement("div");u.className="st-header-container",u.setAttribute("role","rowgroup"),this.refs.headerContainerRef.current=u;const p=document.createElement("div");p.className="st-body-container",p.setAttribute("role","rowgroup"),p.setAttribute("tabindex","0"),this.refs.tableBodyContainerRef.current=p;const f=document.createElement("div");f.id="st-footer-container";const v="top"===e.footerPosition;v&&a.classList.add("st-footer-position-top");const w=document.createElement("div");return w.setAttribute("aria-live","polite"),w.setAttribute("aria-atomic","true"),w.className="st-sr-only",h.appendChild(u),h.appendChild(p),c.appendChild(h),v?(d.appendChild(f),d.appendChild(c)):(d.appendChild(c),d.appendChild(f)),a.appendChild(d),a.appendChild(w),t.appendChild(a),this.elements={rootElement:a,wrapperContainer:d,contentWrapper:c,content:h,headerContainer:u,bodyContainer:p,footerContainer:f,ariaLiveRegion:w},this.elements}updateTheme(t){if(!this.elements)return;const e=this.elements.rootElement,n=e.className.replace(/\btheme-\S+/g,"").trim();e.className=`${n} theme-${t}`}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 Ye=(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))),y(o,"click",n=>{n.stopPropagation(),e.onSort(t.accessor)}),y(o,"keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),e.onSort(t.accessor))}),o},Xe={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"},Qe={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"]},Ze=["equals","notEquals","isEmpty","isNotEmpty"],tn=(t,e)=>{var n;const i=null!==(n=Qe[t])&&void 0!==n?n:Ze;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},en=t=>!["between","notBetween","in","notIn","isEmpty","isNotEmpty"].includes(t),nn=t=>["between","notBetween","in","notIn"].includes(t),on=t=>["isEmpty","isNotEmpty"].includes(t),sn=t=>{var e;return null!==(e=null==t?void 0:t.closest(".simple-table-root"))&&void 0!==e?e:null},rn=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:p="fixed",allowDescendantOverflow:f=!1}=t,v=f;const w="st-dropdown-content--allow-descendant-overflow",m=document.createElement("div");m.className="st-dropdown-content",v&&m.classList.add(w),m.style.position=p,m.style.overflow=v?"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"===p){const t=null!==(i=null!==(n=null!==(e=sn(g))&&void 0!==e?e:sn(null!=r?r:null))&&void 0!==n?n:sn(null!=s?s:null))&&void 0!==i?i:document.querySelector(".simple-table-root");(null!=t?t:document.body).appendChild(m)}const x=t=>{d&&m&&!m.contains(t.target)&&(C(!1),null==a||a())},b=t=>{const e=t.target;if(!m.contains(e)&&!(null==g?void 0:g.contains(e))){if("absolute"===p){const t=m.parentElement;if(null==t?void 0:t.contains(e))return}C(!1),null==a||a()}},y=t=>{"Escape"===t.key&&d&&(C(!1),null==a||a())},R=t=>{"Enter"===t.key&&b(t)},C=t=>{d=t,d?(m.style.display="flex",(()=>{if(!d)return;if("absolute"===p&&!m.parentElement)return;if("fixed"===p&&!m.parentElement)return;m.style.visibility="hidden";const t=g||m.parentElement;t&&requestAnimationFrame(()=>{const e=t.getBoundingClientRect(),n=m.offsetHeight,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"===p)"bottom"===d?(m.style.top=e.bottom+4+"px",m.style.bottom="auto"):(m.style.bottom=window.innerHeight-e.top+4+"px",m.style.top="auto"),"left"===c?(m.style.left=e.left+"px",m.style.right="auto"):(m.style.right=window.innerWidth-e.right+"px",m.style.left="auto");else{const t=m.parentElement;if(!t)return;const n=t.getBoundingClientRect();"bottom"===d?(m.style.top=e.bottom-n.top+4+"px",m.style.bottom="auto"):(m.style.bottom=n.bottom-e.top+4+"px",m.style.top="auto"),"left"===c?(m.style.left=e.left-n.left+"px",m.style.right="auto"):(m.style.right=n.right-e.right+"px",m.style.left="auto")}m.className=`st-dropdown-content st-dropdown-${d}-${c}${v?" "+w:""}`,m.style.visibility="visible"})})(),window.addEventListener("scroll",x,!0),document.addEventListener("mousedown",b,!0),document.addEventListener("keydown",R,!0),document.addEventListener("keydown",y)):(m.style.display="none",window.removeEventListener("scroll",x,!0),document.removeEventListener("mousedown",b,!0),document.removeEventListener("keydown",R,!0),document.removeEventListener("keydown",y))};return d?C(!0):m.style.display="none",{element:m,update:t=>{void 0!==t.anchorElement&&(g=t.anchorElement),void 0!==t.open&&C(t.open),void 0!==t.children&&(m.innerHTML="",m.appendChild(t.children)),void 0!==t.width&&(h=t.width,m.style.width=h?h+"px":"auto"),void 0!==t.maxWidth&&(u=t.maxWidth,m.style.maxWidth=u?u+"px":""),void 0!==t.overflow&&(c=t.overflow,m.style.overflow=v?"visible":c),void 0!==t.allowDescendantOverflow&&(v=t.allowDescendantOverflow,m.classList.toggle(w,v),m.style.overflow=v?"visible":c)},destroy:()=>{C(!1),m.remove()},setOpen:C}},ln=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 p=document.createElement("span");p.className="st-custom-select-value";const f=i.find(t=>t.value===e);p.textContent=f?f.label:o;const v=document.createElement("template");v.innerHTML='<svg\n class="st-custom-select-arrow"\n width="12"\n height="12"\n viewBox="0 0 12 12"\n fill="none"\n xmlns="http://www.w3.org/2000/svg"\n>\n <path\n d="M3 4.5L6 7.5L9 4.5"\n stroke="currentColor"\n stroke-width="1.5"\n stroke-linecap="round"\n stroke-linejoin="round"\n />\n</svg>';const w=v.content.firstElementChild;u.appendChild(p),u.appendChild(w),h.appendChild(u);const m=document.createElement("div");m.className="st-custom-select-options",m.setAttribute("role","listbox");const g=()=>{m.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",()=>y(t.value)),i.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),y(t.value))}),m.appendChild(i)})};g();const x=rn({children:m,containerRef:l,mainBodyRef:a,anchorElement:u,onClose:()=>{S(!1)},open:d,overflow:"auto",positioning:"absolute"});h.appendChild(x.element);const b=t=>{e=t;const n=i.find(t=>t.value===e);p.textContent=n?n.label:o},y=t=>{b(t),n(t),S(!1),c=-1,g()},R=()=>{if(!r){if(S(!d),d)c=-1;else{const t=i.findIndex(t=>t.value===e);c=0>t?0:t}g()}},C=t=>{if(d)switch(t.key){case"ArrowDown":t.preventDefault(),c=i.length-1>c?c+1:0,g();break;case"ArrowUp":t.preventDefault(),c=c>0?c-1:i.length-1,g();break;case"Enter":if(t.preventDefault(),c>=0){const t=i[c].value;b(t),n(t),S(!1),c=-1,g()}break;case"Escape":t.preventDefault(),S(!1),c=-1,g()}},S=t=>{d=t,u.setAttribute("aria-expanded",""+d),d?(h.classList.add("st-custom-select-open"),document.addEventListener("keydown",C)):(h.classList.remove("st-custom-select-open"),document.removeEventListener("keydown",C)),x.setOpen(d)};return u.addEventListener("click",R),{element:h,update:t=>{if(void 0!==t.value){e=t.value;const n=i.find(t=>t.value===e);p.textContent=n?n.label:o,g()}void 0!==t.options&&(i=t.options,g()),void 0!==t.disabled&&(r=t.disabled,u.disabled=r,r?h.classList.add("st-custom-select-disabled"):h.classList.remove("st-custom-select-disabled")),void 0!==t.onChange&&(n=t.onChange)},destroy:()=>{u.removeEventListener("click",R),document.removeEventListener("keydown",C),x.destroy(),h.remove()},setOpen:S}},an=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&&setTimeout(()=>c.focus(),0);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()}}},dn=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()}}},cn=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),f()},d=()=>{o=new Date(o.getFullYear(),o.getMonth()+1,1),f()},c=t=>{o=new Date(t,o.getMonth(),1),s="months",f()},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()},p=t=>{const i=new Date(o.getFullYear(),o.getMonth()+1,t,12,0,0);o=i,e(i),null==n||n()},f=()=>{r.innerHTML="";const t=document.createElement("div");if(t.className="st-datepicker-header","days"===s){const e=document.createElement("button");e.className="st-datepicker-nav-btn",e.innerHTML='<svg viewBox="0 0 24 24" width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n <path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z" />\n</svg>',e.addEventListener("click",a);const n=document.createElement("div");n.className="st-datepicker-header-label",n.textContent=`${v=o,v.toLocaleString("default",{month:"long"})} ${o.getFullYear()}`,n.addEventListener("click",()=>{s="months",f()});const i=document.createElement("button");i.className="st-datepicker-nav-btn",i.innerHTML='<svg viewBox="0 0 24 24" width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n <path d="M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z" />\n</svg>',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.textContent=""+o.getFullYear(),e.addEventListener("click",()=>{s="years",f()}),t.appendChild(e)}else{const e=document.createElement("div");e.className="st-datepicker-header-label",e.textContent="Select Year",t.appendChild(e)}var v;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",()=>p(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",f()})(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 x=document.createElement("button");x.className="st-datepicker-today-btn",x.textContent="Today",x.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(x),r.appendChild(g)};return f(),{element:r,update:t=>{void 0!==t.value&&(i=t.value,o=i||new Date,f()),void 0!==t.onChange&&(e=t.onChange),void 0!==t.onClose&&(n=t.onClose)},destroy:()=>{r.remove()}}},hn=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=tn("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 p=ln({value:d,onChange:t=>{d=t,x()},options:l.map(t=>({value:t,label:Xe[t]})),containerRef:s,mainBodyRef:r});u.appendChild(p.element),h.appendChild(u);let f=null,v=null,w=null;const m=()=>{const t=Object.assign({accessor:e.accessor,operator:d},en(d)&&{value:c});i(t)},g=()=>on(d)||""!==c.trim(),x=()=>{f&&(f.remove(),f=null),v&&(v.destroy(),v=null),en(d)&&(f=document.createElement("div"),f.className="st-filter-section",v=an({type:"text",value:c,onChange:t=>{c=t,w&&w.update({canApply:g()})},onEnter:m,placeholder:"Filter...",autoFocus:!0}),f.appendChild(v.element),h.insertBefore(f,h.lastChild)),w&&w.update({canApply:g()})};return w=dn({onApply:m,onClear:o,canApply:g(),showClear:!!n}),h.appendChild(w.element),x(),{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)||"")+"",p.update({value:d}),v&&v.update({value:c}),w&&w.update({showClear:!!n,canApply:g()}),x())},destroy:()=>{p.destroy(),v&&v.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=tn("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)||"")+"",p=((null===(e=null==o?void 0:o.values)||void 0===e?void 0:e[0])||"")+"",f=((null===(n=null==o?void 0:o.values)||void 0===n?void 0:n[1])||"")+"";const v=document.createElement("div");v.className="st-filter-container";const w=document.createElement("div");w.className="st-filter-section";const m=ln({value:h,onChange:t=>{h=t,I()},options:d.map(t=>({value:t,label:Xe[t]})),containerRef:l,mainBodyRef:a});w.appendChild(m.element),v.appendChild(w);let g=null,x=null,b=null,y=null,R=null;const C=()=>{const t={accessor:i.accessor,operator:h};en(h)?t.value=parseFloat(u):nn(h)&&(t.values=[parseFloat(p),parseFloat(f)]),s(t)},S=()=>!!on(h)||(en(h)?""!==u.trim():!!nn(h)&&""!==p.trim()&&""!==f.trim()),I=()=>{g&&(g.remove(),g=null),x&&(x.destroy(),x=null),b&&(b.destroy(),b=null),y&&(y.destroy(),y=null),en(h)?(g=document.createElement("div"),g.className="st-filter-section",x=an({type:"number",value:u,onChange:t=>{u=t,R&&R.update({canApply:S()})},onEnter:C,placeholder:"Enter number...",autoFocus:!0}),g.appendChild(x.element),v.insertBefore(g,v.lastChild)):nn(h)&&(g=document.createElement("div"),g.className="st-filter-section",b=an({type:"number",value:p,onChange:t=>{p=t,R&&R.update({canApply:S()})},onEnter:C,placeholder:"From...",autoFocus:!0}),b.element.classList.add("st-filter-input-range-from"),y=an({type:"number",value:f,onChange:t=>{f=t,R&&R.update({canApply:S()})},onEnter:C,placeholder:"To..."}),g.appendChild(b.element),g.appendChild(y.element),v.insertBefore(g,v.lastChild)),R&&R.update({canApply:S()})};return R=dn({onApply:C,onClear:r,canApply:S(),showClear:!!o}),v.appendChild(R.element),I(),{element:v,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)||"")+"",p=((null===(e=null==o?void 0:o.values)||void 0===e?void 0:e[0])||"")+"",f=((null===(n=null==o?void 0:o.values)||void 0===n?void 0:n[1])||"")+"",m.update({value:h}),x&&x.update({value:u}),b&&b.update({value:p}),y&&y.update({value:f}),R&&R.update({showClear:!!o,canApply:S()}),I())},destroy:()=>{m.destroy(),x&&x.destroy(),b&&b.destroy(),y&&y.destroy(),R&&R.destroy(),v.remove()}}})(t);case"boolean":return(t=>{let{header:e,currentFilter:n,onApplyFilter:i,onClearFilter:o,containerRef:s,mainBodyRef:r}=t;const l=tn("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 p=ln({value:d,onChange:t=>{d=t,x()},options:l.map(t=>({value:t,label:Xe[t]})),containerRef:s,mainBodyRef:r});u.appendChild(p.element),h.appendChild(u);let f=null,v=null,w=null;const m=()=>on(d)||""!==c,g=[{value:"true",label:"True"},{value:"false",label:"False"}],x=()=>{f&&(f.remove(),f=null),v&&(v.destroy(),v=null),en(d)&&(f=document.createElement("div"),f.className="st-filter-section",v=ln({value:c,onChange:t=>{c=t,w&&w.update({canApply:m()})},options:g,containerRef:s,mainBodyRef:r}),f.appendChild(v.element),h.insertBefore(f,h.lastChild)),w&&w.update({canApply:m()})};return w=dn({onApply:()=>{const t={accessor:e.accessor,operator:d};en(d)&&(t.value="true"===c),i(t)},onClear:o,canApply:m(),showClear:!!n}),h.appendChild(w.element),x(),{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",p.update({value:d}),v&&v.update({value:c}),w&&w.update({showClear:!!n,canApply:m()}),x())},destroy:()=>{p.destroy(),v&&v.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=tn("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+"":"",p=(null===(e=null==o?void 0:o.values)||void 0===e?void 0:e[0])?o.values[0]+"":"",f=((null===(n=null==o?void 0:o.values)||void 0===n?void 0:n[1])||"")+"";const v=document.createElement("div");v.className="st-filter-container";const w=document.createElement("div");w.className="st-filter-section";const m=ln({value:h,onChange:t=>{h=t,O()},options:d.map(t=>({value:t,label:Xe[t]})),containerRef:l,mainBodyRef:a});w.appendChild(m.element),v.appendChild(w);let g=null,x=null,b=null,y=null,R=null,C=null,S=null,I=null,H=null,M=null,k=null;const E=()=>!!on(h)||(en(h)?""!==u.trim():!!nn(h)&&""!==p.trim()&&""!==f.trim()),T=t=>{if(!t)return"";const e=Pt(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=T(t),s.placeholder=n,s.readOnly=!0,s.style.cursor="pointer",i&&setTimeout(()=>s.focus(),0);let r=!1;const d=t?Pt(t):new Date,c=cn({value:d,onChange:t=>{const n=t.toISOString().split("T")[0];e(n),s.value=T(n),h.setOpen(!1),r=!1},onClose:()=>{h.setOpen(!1),r=!1}}),h=rn({children:c.element,containerRef:l,mainBodyRef:a,anchorElement:s,onClose:()=>{r=!1},open:!1,overflow:"hidden",positioning:"absolute",width:240});o.appendChild(s),o.appendChild(h.element);const u=()=>{r=!r,h.setOpen(r)},p=t=>{"Enter"===t.key||" "===t.key?(t.preventDefault(),r=!r,h.setOpen(r)):"Escape"===t.key&&(r=!1,h.setOpen(!1))};return s.addEventListener("click",u),s.addEventListener("keydown",p),{container:o,input:s,picker:c,dropdown:h,destroy:()=>{s.removeEventListener("click",u),s.removeEventListener("keydown",p),c.destroy(),h.destroy(),o.remove()}}},O=()=>{if(g&&(g.remove(),g=null),x&&(x=null),b&&(b=null),y&&(y=null),R&&(R.destroy(),R=null),C&&(C.destroy(),C=null),S&&(S.destroy(),S=null),I&&(I.destroy(),I=null),H&&(H.destroy(),H=null),M&&(M.destroy(),M=null),en(h)){g=document.createElement("div"),g.className="st-filter-section";const t=A(u,t=>{u=t,k&&k.update({canApply:E()})},"Select date...",!0);x=t.container,R=t.picker,I=t.dropdown,g.appendChild(x),v.insertBefore(g,v.lastChild)}else if(nn(h)){g=document.createElement("div"),g.className="st-filter-section";const t=A(p,t=>{p=t,k&&k.update({canApply:E()})},"From date...",!0);t.input.classList.add("st-filter-input-range-from");const e=A(f,t=>{f=t,k&&k.update({canApply:E()})},"To date...",!1);b=t.container,C=t.picker,H=t.dropdown,y=e.container,S=e.picker,M=e.dropdown,g.appendChild(b),g.appendChild(y),v.insertBefore(g,v.lastChild)}k&&k.update({canApply:E()})};return k=dn({onApply:()=>{const t={accessor:i.accessor,operator:h};en(h)?t.value=u:nn(h)&&(t.values=[p,f]),s(t)},onClear:r,canApply:E(),showClear:!!o}),v.appendChild(k.element),O(),{element:v,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+"":"",p=(null===(e=null==o?void 0:o.values)||void 0===e?void 0:e[0])?o.values[0]+"":"",f=((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:E()}),O())},destroy:()=>{m.destroy(),R&&R.destroy(),C&&C.destroy(),S&&S.destroy(),I&&I.destroy(),H&&H.destroy(),M&&M.destroy(),k&&k.destroy(),v.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 p=xe({checked:l.length===r.length,onChange:t=>{l=t?[...r]:[],x(),y&&y.update({canApply:b()})}}),f=document.createElement("span");f.className="st-enum-option-label st-enum-select-all-label",f.textContent="Select All",p.element.appendChild(f),u.appendChild(p.element),h.appendChild(u);let v=null,w=null;s.length>10&&(v=document.createElement("div"),v.className="st-enum-search",w=an({type:"text",value:a,onChange:t=>{a=t,x()},placeholder:"Search..."}),v.appendChild(w.element),h.appendChild(v));const m=document.createElement("div");h.appendChild(m);const g=[],x=()=>{m.innerHTML="",g.forEach(t=>t.checkbox.destroy()),g.length=0;const t=a?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=xe({checked:l.includes(t.value),onChange:()=>{l=l.includes(t.value)?l.filter(e=>e!==t.value):[...l,t.value];const e=l.length===r.length;p.element.querySelector("input").checked=e,y&&y.update({canApply:b()})}}),n=document.createElement("span");n.className="st-enum-option-label",n.textContent=t.label,e.element.appendChild(n),m.appendChild(e.element),g.push({container:e.element,checkbox:e,value:t.value})});const e=l.length===r.length;p.element.querySelector("input").checked=e};x(),c.appendChild(h),d.appendChild(c);const b=()=>0!==l.length&&l.length!==r.length,y=dn({onApply:()=>{l.length!==r.length?i({accessor:e.accessor,operator:"in",values:l}):o()},onClear:o,canApply:b(),showClear:!!n});return d.appendChild(y.element),{element:d,update:t=>{void 0!==t.currentFilter&&(n=t.currentFilter,l=(null==n?void 0:n.values)?n.values.map(String):r,a="",w&&w.update({value:a}),x(),y&&y.update({showClear:!!n,canApply:b()}))},destroy:()=>{p.destroy(),w&&w.destroy(),g.forEach(t=>t.checkbox.destroy()),y&&y.destroy(),d.remove()}}})(t)}},un=(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}d&&(d.style.fill=r?"var(--st-button-active-background-color)":"var(--st-header-icon-color)");let c=!1,h=null,u=null;const p=n=>{if(n.stopPropagation(),c=!c,l.setAttribute("aria-expanded",c+""),c){const n=t=>{i(t),c=!1,l.setAttribute("aria-expanded","false"),u&&(u.destroy(),u=null),h&&(h.destroy(),h=null),d&&(d.style.fill="var(--st-button-active-background-color)")},s=()=>{o(t.accessor),c=!1,l.setAttribute("aria-expanded","false"),u&&(u.destroy(),u=null),h&&(h.destroy(),h=null),d&&(d.style.fill="var(--st-header-icon-color)")},a=e.mainBodyRef.current||void 0;h=hn({header:t,currentFilter:r,onApplyFilter:n,onClearFilter:s,containerRef:a,mainBodyRef:a}),u=rn({children:h.element,containerRef:a,mainBodyRef:a,anchorElement:l,onClose:()=>{c=!1,l.setAttribute("aria-expanded","false"),h&&(h.destroy(),h=null)},open:!0,positioning:"fixed",maxWidth:280,allowDescendantOverflow:!0})}else u&&(u.destroy(),u=null),h&&(h.destroy(),h=null)};return y(l,"click",p),y(l,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),p(t))}),l},pn=(t,e)=>{var n,i;const{icons:o}=e;if(!K(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 y(r,"click",a),y(r,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),a(t))}),r},fn=(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=fn(o.children,e,[...n,i]);if(t)return t}}return null},vn=(t,e)=>{if(t.pinned)return t.pinned;const n=V(e,t.accessor);return n?vn(n,e):void 0},wn=(t,e)=>{const n=vn(t,e);return"left"===n?"left":"right"===n?"right":"main"};function mn(t,e,n){const i=Pe(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 gn=(t,e)=>{const{mainBodyWidth:n,pinnedLeftWidth:i,pinnedRightWidth:o,pinnedLeftContentWidth:s,pinnedRightContentWidth:r,tableBodyContainerRef:l,editColumns:a}=e,d=a?P: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 p=t.querySelector(".st-horizontal-scrollbar-middle"),f=null==p?void 0:p.firstElementChild;n>0&&p&&f&&(f.style.width=n+"px");const v=t.querySelector(".st-horizontal-scrollbar-right"),w=null==v?void 0:v.firstElementChild;if(o>0&&v&&w&&(v.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")}},xn=(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()},bn=({containerWidth:t,leftWidth:e,rightWidth:n})=>t>0?Math.max(0,t-e-n):void 0,yn=({headers:t,containerWidth:e,collapsedHeaders:n})=>{let i=0,o=0,s=0;t.forEach(t=>{if(t.hide)return;const e=dt(t,n).reduce((t,e)=>t+ft(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*B(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}},Rn=(t,e)=>{if(t.pinned)return t.pinned;const n=V(e,t.accessor);return n?Rn(n,e):void 0},Cn=(e,n,i)=>{var o;const s=[],r=[],l=[];e.forEach(t=>{if(t.hide)return;const n=Rn(t,e);"left"===n?s.push(t):"right"===n?l.push(t):r.push(t)});const a=(e,o,s)=>{var r,l;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(e.hide)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:"number"==typeof e.width?e.width:ft(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:"number"==typeof e.width?e.width:ft(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),p=new Map;c.forEach((t,e)=>p.set(e,t)),h.forEach((t,e)=>p.set(e,t)),u.forEach((t,e)=>p.set(e,t)),p.forEach((t,e)=>{const{left:n,width:i}=t,o=J({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 f=document.querySelector(".st-body-container"),v=null!==(o=null==f?void 0:f.clientWidth)&&void 0!==o?o:0,w=yn({headers:e,containerWidth:v>0?v:void 0,collapsedHeaders:n}),{leftWidth:m,rightWidth:g,mainWidth:x,leftContentWidth:b,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==f?void 0:f.closest(".simple-table-root"),C=null==R?void 0:R.querySelector(".st-horizontal-scrollbar-container"),S=null==R?void 0:R.querySelector(".st-body-main"),I=!!(null==R?void 0:R.querySelector(".st-column-editor"));C&&S&&f&&S.scrollWidth-S.clientWidth>1&&gn(C,{mainBodyRef:S,mainBodyWidth:x,pinnedLeftWidth:m,pinnedRightWidth:g,pinnedLeftContentWidth:b,pinnedRightContentWidth:y,tableBodyContainerRef:f,editColumns:I})},Sn=({columnsToShrink:t,totalCompensation:e,initialWidthsMap:n})=>{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 i=e;for(;i>.5;){const e=D,o=t.map(t=>{const i=n.get(t.accessor)||100;return{column:t,headroom:Math.max(0,i-e),initialWidth:i,minWidth:e}}).filter(t=>t.headroom>0);if(0>=o.length)break;{const t=o.reduce((t,e)=>t+e.headroom,0);let e=0;const n=i;o.forEach((i,s)=>{let r=n*(i.headroom/t);r=Math.min(r,i.headroom),s===o.length-1&&(r=Math.min(n-e,i.headroom)),i.column.width=i.initialWidth-r,e+=r}),i-=e}}},In=({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,startWidth:u})=>{const p=t=>{if(!d||0>=n||0>=t)return t;const e=o.some(t=>"left"===t.pinned&&!t.hide),i=o.some(t=>"right"===t.pinned&&!t.hide),r=((t,e,n)=>t*B(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=mt(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,f=r===n.length-1;let v;v="left"===d&&f||"right"===d&&l?[]:l?n.slice(r+1):f||a?n.slice(0,o):n.slice(r+1);const w=Array.from(s.values()).reduce((t,e)=>t+e,0);if(i>0){let e=i,n=!1;if(v.length>0&&w+i>(h>0?Math.max(h,w):w+Math.abs(i)+1)){n=!0;const t=v.reduce((t,e)=>{const n=s.get(e.accessor)||100;return t+Math.max(0,n-D)},0);e=Math.min(i,t)}i>0&&!n&&(e=p(e));const o=(u+e)/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*o,40)}),n&&e>0&&v.length>0&&Sn({columnsToShrink:v,totalCompensation:e,initialWidthsMap:s})}else{const e=t.reduce((t,e)=>t+(s.get(e.accessor)||100),0),n=Math.max(u+i,D*t.length),o=n/e;t.forEach(t=>{const e=s.get(t.accessor)||100;t.width=Math.max(e*o,40)});const r=u-n;r>0&&v.length>0&&Sn({columnsToShrink:v,totalCompensation:-r,initialWidthsMap:s})}return}const f=mt(c,e),v=f.findIndex(t=>t.accessor===l.accessor);if(-1===v)return;const w=0===v,m=v===f.length-1;let g;if(g="left"===d&&m||"right"===d&&w?[]:w?f.slice(v+1):m||a?f.slice(0,v):f.slice(v+1),0===g.length){const t=D,e=i>0?p(i):i;return void(l.width=Math.max(u+e,t))}const x=Array.from(s.values()).reduce((t,e)=>t+e,0);if(i>0){if((h>0?Math.max(h,x):x+Math.abs(i)+1)>=x+i){const t=i>0?p(i):i;return void(l.width=u+t)}const t=g.reduce((t,e)=>{const n=s.get(e.accessor)||100;return t+Math.max(0,n-D)},0),e=Math.min(i,t);l.width=u+e,e>0&&Sn({columnsToShrink:g,totalCompensation:e,initialWidthsMap:s})}else{const t=Math.max(u+i,40),e=u-t;l.width=t,e>0&&Sn({columnsToShrink:g,totalCompensation:-e,initialWidthsMap:s})}},Hn=(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},Mn=({autoExpandColumns:t,collapsedHeaders:e,containerWidth:n,event:i,header:o,headers:s,mainBodyRef:r,onColumnWidthChange:l,reverse:a=!1,setHeaders:d,setIsResizing:c,startWidth:h})=>{i.preventDefault();const u="clientX"in i?i.clientX:i.touches[0].clientX,p="touches"in i;if(!o||o.hide)return;const f=Hn(n,r);c(!0);const v=Rn(o,s),w=wt(o);let m;if(o.children&&o.children.length>0){const t=dt(o,e);m=t.length>0?t:[o]}else m=[o];const g=new Map;let x=0,b=0;if(t){const t=s.filter(t=>t.pinned===v);if(mt(t,e).forEach(t=>{const e=ft(t);g.set(t.accessor,e)}),f>0){const{leftWidth:t,rightWidth:n,mainWidth:i}=yn({headers:s,containerWidth:f,collapsedHeaders:e});x="left"===v?t:"right"===v?n:i;const o=Math.max(0,f-t-n),l=null!=(null==r?void 0:r.current)&&r.current.clientWidth>0?r.current.clientWidth:0;b=l>0?Math.min(o,l):o}}let y=!1;const R=new Map;let C=[];if(t&&v&&f>0){const t=mt(s.filter(t=>t.pinned===v),e);if(t.length>0){let n=!1;if(m.length>1){const e=t.findIndex(t=>t.accessor===m[0].accessor),i=t.findIndex(t=>t.accessor===m[m.length-1].accessor);n="left"===v&&i===t.length-1||"right"===v&&0===e}else{const e=m[0]||o,i=t.findIndex(t=>t.accessor===e.accessor);n="left"===v&&i===t.length-1||"right"===v&&0===i}if(n){y=!0;const t=s.filter(t=>!t.pinned);C=mt(t,e),C.forEach(t=>{R.set(t.accessor,ft(t))})}}}const S=(n,i=!1)=>{const r="right"===v?u-n:n-u;if(t){const t=s.filter(t=>t.pinned===v);if(In({childrenToResize:m,collapsedHeaders:e,containerWidth:f,delta:r,headers:s,initialWidthsMap:g,isParentResize:m.length>1,resizedHeader:m.length>0?m[m.length-1]:o,reverse:a,rootPinned:v,sectionHeaders:t,sectionWidth:x,startWidth:h}),y&&C.length>0){const t=m.reduce((t,e)=>{const n=g.get(e.accessor)||0;return t+(("number"==typeof e.width?e.width:n)-n)},0),e=Math.max(0,b-t),n=Array.from(R.values()).reduce((t,e)=>t+e,0);if(e>0&&n>0){const t=e/n;let i=0;C.forEach((n,o)=>{const s=R.get(n.accessor)||100;o===C.length-1?n.width=e-i:(n.width=Math.round(s*t),i+=n.width)})}}}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&&!t.hide),r=e.some(t=>"right"===t.pinned&&!t.hide),l=o*B(o,s,r)-e.filter(e=>e.pinned===t.pinned&&e.accessor!==t.accessor).reduce((t,e)=>e.hide?t:t+dt(e,n).reduce((t,e)=>t+ft(e),0),0),a=wt(t);return a>l?(console.warn(`Header ${t.accessor} exceeds pinned section width limit`),a):l})({header:o,headers:s,collapsedHeaders:e});m.length>1?(({delta:t,leafHeaders:e,minWidth:n,startWidth:i,maxWidth:o})=>{const s=e.reduce((t,e)=>Math.min(t,wt(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:m,minWidth:w,startWidth:h,maxWidth:t}):m[0].width=Math.max(Math.min(h+r,t),w),s.forEach(t=>{vt(t)})}if(i){const t=[...s];d(t);const n=new Map;m.forEach(t=>{"number"==typeof t.width&&n.set(t.accessor,t.width)}),y&&C.forEach(t=>{"number"==typeof t.width&&n.set(t.accessor,t.width)}),Cn(s,e,n)}else Cn(s,e)};let I=null,H=null,M=u;const k=t=>{M=t,H=t,null===I&&(I=requestAnimationFrame(()=>{null!==H&&(S(H,!1),H=null),I=null}))};if(p){const t=t=>{k(t.touches[0].clientX)},e=()=>{document.removeEventListener("touchmove",t),document.removeEventListener("touchend",e),null!==I&&(cancelAnimationFrame(I),I=null),S(M,!0),c(!1),l&&l([...s])};document.addEventListener("touchmove",t),document.addEventListener("touchend",e)}else{const t=t=>{k(t.clientX)},e=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",e),null!==I&&(cancelAnimationFrame(I),I=null),S(M,!0),c(!1),l&&l([...s])};document.addEventListener("mousemove",t),document.addEventListener("mouseup",e)}},kn=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},En=(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=En(i.children,e);if(t)return t}}},Tn=(t,e,n)=>{const{columnResizing:i}=e;if(!i||t.isSelectionColumn&&e.enableRowSelection||n)return null;const o=document.createElement("div");o.className="st-header-resize-handle-container",o.setAttribute("role","separator"),o.setAttribute("aria-label",`Resize ${t.label} column`),o.setAttribute("aria-orientation","vertical");const s=document.createElement("div");s.className="st-header-resize-handle",o.appendChild(s);const r=t=>({rows:e.rows,header:t,styleRoot:kn(e),autoSizeMode:t.autoSizeMode}),l=()=>{var n;if(e.autoExpandColumns){const i=e.getHeaders();return((t,e)=>{const n=mt(t,e);for(const t of n){const e=document.getElementById(J({accessor:t.accessor,rowId:"header"})),n=null==e?void 0:e.offsetWidth;null!=n&&n>0&&(t.width=n)}})(i,e.collapsedHeaders),{headers:i,header:null!==(n=En(i,t.accessor))&&void 0!==n?n:t}}return{headers:e.headers,header:t}};let a=0;const d=()=>{const n=Date.now();120>n-a||(a=n,(()=>{const n=document.getElementById(J({accessor:t.accessor,rowId:"header"}));if(e.autoExpandColumns){const{headers:t,header:i}=l();(({header:t,headers:e,collapsedHeaders:n,containerWidth:i,mainBodyRef:o,reverse:s,headerCellElement:r,getTargetLeafWidth:l})=>{var a;if(!t||t.hide)return;const d=Hn(i,o),c=Rn(t,e);let h;if(t.children&&t.children.length>0){const e=dt(t,n);h=e.length>0?e:[t]}else h=[t];const u=new Map;let p=0,f=0;const v=e.filter(t=>t.pinned===c);if(mt(v,n).forEach(t=>{const e=ft(t);u.set(t.accessor,e)}),d>0){const{leftWidth:t,rightWidth:i,mainWidth:s}=yn({headers:e,containerWidth:d,collapsedHeaders:n});p="left"===c?t:"right"===c?i:s;const r=Math.max(0,d-t-i),l=null!=(null==o?void 0:o.current)&&o.current.clientWidth>0?o.current.clientWidth:0;f=l>0?Math.min(r,l):r}let w=!1;const m=new Map;let g=[];if(c&&d>0){const i=mt(e.filter(t=>t.pinned===c),n);if(i.length>0){let o=!1;if(h.length>1){const t=i.findIndex(t=>t.accessor===h[0].accessor),e=i.findIndex(t=>t.accessor===h[h.length-1].accessor);o="left"===c&&e===i.length-1||"right"===c&&0===t}else{const e=h[0]||t,n=i.findIndex(t=>t.accessor===e.accessor);o="left"===c&&n===i.length-1||"right"===c&&0===n}if(o){w=!0;const t=e.filter(t=>!t.pinned);g=mt(t,n),g.forEach(t=>{m.set(t.accessor,ft(t))})}}}const x=h.reduce((t,e)=>t+l(e),0),b=null!==(a=null==r?void 0:r.offsetWidth)&&void 0!==a?a:h.reduce((t,e)=>t+ft(e),0);if(In({childrenToResize:h,collapsedHeaders:n,containerWidth:d,delta:x-b,headers:e,initialWidthsMap:u,isParentResize:h.length>1,resizedHeader:h.length>0?h[h.length-1]:t,reverse:s,rootPinned:c,sectionHeaders:v,sectionWidth:p,startWidth:b}),w&&g.length>0){const t=h.reduce((t,e)=>{const n=u.get(e.accessor)||0;return t+(("number"==typeof e.width?e.width:n)-n)},0),e=Math.max(0,f-t),n=Array.from(m.values()).reduce((t,e)=>t+e,0);if(e>0&&n>0){const t=e/n;let i=0;g.forEach((n,o)=>{const s=m.get(n.accessor)||100;o===g.length-1?n.width=e-i:(n.width=Math.round(s*t),i+=n.width)})}}const y=new Map;h.forEach(t=>{"number"==typeof t.width&&y.set(t.accessor,t.width)}),w&&g.forEach(t=>{"number"==typeof t.width&&y.set(t.accessor,t.width)}),Cn(e,n,y)})({header:i,headers:t,collapsedHeaders:e.collapsedHeaders,containerWidth:e.containerWidth,mainBodyRef:e.mainBodyRef,reverse:e.reverse,headerCellElement:n,getTargetLeafWidth:t=>gt(t.accessor,r(t))});const o=[...t];return e.setHeaders(o),void(e.onColumnWidthChange&&e.onColumnWidthChange(o))}const i=gt(t.accessor,r(t)),o=fn(e.headers,t.accessor);if(!o)return;const s=((t,e)=>{let n=t;for(let t=0;e.length-1>t;t++)n=n[e[t]].children;return n})(e.headers,o),a=o[o.length-1],d=s.map((t,e)=>e===a?Object.assign(Object.assign({},t),{width:i}):t),c=((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})(e.headers,o,d);c.forEach(t=>vt(t));const h=d[a],u=new Map;h&&"number"==typeof h.width&&u.set(h.accessor+"",h.width),Cn(c,e.collapsedHeaders,u),e.setHeaders(c),e.onColumnWidthChange&&e.onColumnWidthChange(c)})())};return y(o,"mousedown",n=>{var i;if(n.detail>=2)return n.preventDefault(),void d();const o=null===(i=document.getElementById(J({accessor:t.accessor,rowId:"header"})))||void 0===i?void 0:i.offsetWidth;b(()=>{const{headers:t,header:i}=l();Mn({autoExpandColumns:e.autoExpandColumns,collapsedHeaders:e.collapsedHeaders,containerWidth:e.containerWidth,event:n,forceUpdate:e.forceUpdate,header:i,headers:t,mainBodyRef:e.mainBodyRef,onColumnWidthChange:e.onColumnWidthChange,pinnedLeftRef:e.pinnedLeftRef,pinnedRightRef:e.pinnedRightRef,reverse:e.reverse,setHeaders:e.setHeaders,setIsResizing:e.setIsResizing,startWidth:null!=o?o:$})},10)}),y(o,"touchstart",n=>{var i;const o=n,s=null===(i=document.getElementById(J({accessor:t.accessor,rowId:"header"})))||void 0===i?void 0:i.offsetWidth;b(()=>{const{headers:t,header:n}=l();Mn({autoExpandColumns:e.autoExpandColumns,collapsedHeaders:e.collapsedHeaders,containerWidth:e.containerWidth,event:o,forceUpdate:e.forceUpdate,header:n,headers:t,mainBodyRef:e.mainBodyRef,onColumnWidthChange:e.onColumnWidthChange,pinnedLeftRef:e.pinnedLeftRef,pinnedRightRef:e.pinnedRightRef,reverse:e.reverse,setHeaders:e.setHeaders,setIsResizing:e.setIsResizing,startWidth:null!=s?s:$})},10)}),y(o,"dblclick",d),o},An=(t,e,n)=>{const i=document.createElement("input");return i.type="text",i.className="st-header-edit-input",i.value=t.label||"",y(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=On(t,e,o);s.replaceChild(i,n)}if(e.headerRegistry&&!t.isSelectionColumn){const n=e.headerRegistry.get(t.accessor+"");n&&n.setEditing(!1)}}),y(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},On=(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){const t=(t=>{const e=!!t.areAllRowsSelected&&t.areAllRowsSelected();return xe({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)};y(s,"mouseenter",i),y(s,"mouseleave",o)}return s},Wn=(t,e,n,i)=>{const{columnReordering:o,draggedHeaderRef:s,hoveredHeaderRef:r}=i;!o||n.disableReorder||n.isSelectionColumn&&i.enableRowSelection||(t.setAttribute("draggable","true"),y(t,"dragstart",t=>{s.current=n,v(Date.now()),e.classList.add("st-dragging")}),y(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(Pe(i.getHeaders()))},10)}),y(e,"dragover",t=>{const e=t;e.preventDefault(),s.current&&b(()=>{const t=i.getHeaders();if(!t)return;const{screenX:o,screenY:l}=e,a=Math.sqrt(Math.pow(o-p.screenX,2)+Math.pow(l-p.screenY,2));r.current=n;const d=s.current;if(!d)return;let c,h=!1;if(wn(d,t)!==wn(n,t)){const e=function({headers:t,draggedHeader:e,hoveredHeader:n}){const i=Pe(t);let o=!1;try{const t=wn(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=fn(t,d.accessor),i=fn(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((w=e).length!==(m=r).length||1!==w.length&&!w.slice(0,-1).every((t,e)=>t===m[e]))return;const l=mn(t,e,r);c=l.newHeaders,h=l.emergencyBreak}var w,m;if(n.accessor===d.accessor||10>a||JSON.stringify(c)===JSON.stringify(t)||h)return;const g=i.essentialAccessors;if(g&&g.size>0&&!Ne(c,g))return;const x=Date.now();JSON.stringify(c)===JSON.stringify(f)&&(150>x-u||40>a)||(v(x),p={screenX:o,screenY:l},f=t,i.onTableHeaderDragEnd(c))},50)}),y(document.documentElement,"dragover",t=>{t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="move")}))},Pn=(e,n,i)=>{var o,s;const{header:r,colIndex:l,parentHeader:a}=e,{collapsedHeaders:d,columnBorders:c,columnReordering:h,enableHeaderEditing:u,selectedColumns:p,columnsWithSelectedCells:f,draggedHeaderRef:v,hoveredHeaderRef:w}=n,m=r.isSelectionColumn&&n.enableRowSelection,g=!!(null==r?void 0:r.isSortable),x=d.has(r.accessor),b=!(!r.children||0===r.children.length)&&(!x||r.children.some(e=>{const n=e.showWhen||t;return"parentCollapsed"===n||"always"===n})),y=null==a?void 0:a.singleRowChildren,R=b&&!r.singleRowChildren,C=!!c&&(r.children&&0!==r.children.length?j(r,l).includes(n.lastHeaderIndex):l===n.lastHeaderIndex),S=!(!n.selectableColumns||m)&&j(r,l).some(t=>p.has(t)),I=!m&&j(r,l).some(t=>f.has(t));return["st-header-cell",r.accessor===(null===(o=w.current)||void 0===o?void 0:o.accessor)?"st-hovered":"",(null===(s=v.current)||void 0===s?void 0:s.accessor)===r.accessor?"st-dragging":"",g?"clickable":"",h&&!g?"columnReordering":"",R?"parent":"",y?"st-sub-header":"",C?"st-last-column":"",u&&!m?"st-header-editable":"",S?"st-header-selected":"",I&&!S?"st-header-has-highlighted-cell":"",i?"st-no-resize":""].filter(Boolean).join(" ")},$n=(t,e,n,i,o)=>{const s=On(e,i),r=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:s}});t.innerHTML="",r instanceof HTMLElement?t.appendChild(r):t.appendChild(s)},Fn=(t,e,n,s=0)=>{var r,l;const a=n.pinned?n.containerWidth:null!==(r=n.mainSectionViewportWidth)&&void 0!==r?r:n.containerWidth||(null===(l=t.parentElement)||void 0===l?void 0:l.clientWidth)||t.clientWidth||0,d=n.pinned?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,s,a),c=(t=>0===t.length?-1:Math.max(...t.map(t=>t.colIndex)))(e),h=m(t),u=new Set(d.map(t=>J({accessor:t.header.accessor,rowId:"header"}))),p=new Map,f=Array.from(new Set(e.map(t=>Math.round(t.top)))).sort((t,e)=>t-e);f.forEach((t,e)=>p.set(t,e));const v=t=>"header-band-"+Math.round(t.top),w=t=>{var e;return(null!==(e=p.get(Math.round(t.top)))&&void 0!==e?e:0)+1},g=x(t),b=n.animationCoordinator&&n.accordionAxis?n.accordionAxis:null,C="horizontal"===b?(t=>{const e=new Set,n=t=>{var i;for(const o of t)o.hide||o.excludeFromRender||(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 S=!1;h.forEach((e,i)=>{var o,s;if(!u.has(i)){g.delete(i);const r=null!==(o=e.getAttribute("data-accessor"))&&void 0!==o?o:"",l=null!==(s=null==C?void 0:C.has(r))&&void 0!==s&&s;"horizontal"===b&&n.animationCoordinator&&!l&&n.animationCoordinator.shouldRetain(i)?n.animationCoordinator.shrinkOutCell({cellId:i,element:e,container:t,axis:b}):e.remove(),h.delete(i),S=!0}}),S&&R(t);const I=[];d.forEach(e=>{const o=J({accessor:e.header.accessor,rowId:"header"}),s=!(!n.autoExpandColumns||n.pinned||e.colIndex!==c);if(h.has(o)){const r=h.get(o);i(t,v(e),w(e)),r.setAttribute("aria-colindex",e.colIndex+1+""),e.header.children&&e.header.children.length>0&&r.setAttribute("aria-colspan",U(e.header,n.headers,n.collapsedHeaders)+"");const l=g.get(o);if(!l||l.left!==e.left||l.top!==e.top||l.width!==e.width||l.height!==e.height){r.style.left=e.left+"px",r.style.top=e.top+"px";const t=r.dataset.stAccordionGrow;"horizontal"!==t&&(r.style.width=e.width+"px"),"vertical"!==t&&(r.style.height=e.height+"px"),g.set(o,{left:e.left,top:e.top,width:e.width,height:e.height})}e.header.isSelectionColumn&&n.enableRowSelection&&"function"==typeof n.areAllRowsSelected&&((t,e)=>{ge(t,e)})(r,n.areAllRowsSelected());const a=Pn(e,n,s);if(r.className!==a&&(r.className=a),K(e.header)){const t=n.collapsedHeaders.has(e.header.accessor);r.setAttribute("aria-expanded",!t+""),((t,e,n)=>{ye(t,!e,{ariaLabelWhenExpanded:n?`Collapse ${n} column`:"Collapse column",ariaLabelWhenCollapsed:n?`Expand ${n} column`:"Expand column",syncAriaExpanded:!0})})(r,t,e.header.label)}const d=`${n.sort&&n.sort.key.accessor===e.header.accessor?n.sort.direction:"none"}|${n.filters&&n.filters[e.header.accessor]?"1":"0"}`;r.dataset.stIconState!==d&&(((t,e,n,i)=>{const o=Ye(e,n),s=un(e,n),r=pn(e,n);if(e.headerRenderer){const l=t.querySelector(".st-header-label");return void(l&&$n(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))}})(r,e.header,n,e.colIndex),r.dataset.stIconState=d)}else I.push({cell:e,cellId:o,isLastMainAutoExpandColumn:s})});const H=n.animationCoordinator&&n.accordionAxis?n.accordionAxis:null,M=[];I.forEach(({cell:e,cellId:o,isLastMainAutoExpandColumn:s})=>{const r=((t,e,n)=>{var i,o,s;const{header:r,colIndex:l}=t,{reverse:a}=e,d=r.isSelectionColumn&&e.enableRowSelection,c=Pn(t,e,n),h=document.createElement("div");if(h.className=c,h.id=J({accessor:r.accessor,rowId:"header"}),h.setAttribute("data-accessor",r.accessor+""),h.setAttribute("role","columnheader"),h.setAttribute("aria-colindex",l+1+""),r.children&&r.children.length>0){const t=U(r,e.headers,e.collapsedHeaders);h.setAttribute("aria-colspan",t+"")}if(K(r)){const t=null!==(o=null===(i=e.getCollapsedHeaders)||void 0===i?void 0:i.call(e))&&void 0!==o?o:e.collapsedHeaders;h.setAttribute("aria-expanded",!t.has(r.accessor)+"")}r.isSortable&&((null===(s=e.sort)||void 0===s?void 0:s.key.accessor)===r.accessor?h.setAttribute("aria-sort","asc"===e.sort.direction?"ascending":"descending"):h.setAttribute("aria-sort","none"));const u=((t,e)=>{const n=[];return t.type&&"other"!==t.type&&n.push(t.type+" column"),t.isSortable&&n.push("sortable"),e&&n.push("filterable"),t.tooltip&&n.push(t.tooltip),n.join(", ")})(r,!!r.filterable);if(u){const t="header-desc-"+r.accessor;h.setAttribute("aria-describedby",t);const e=document.createElement("span");e.id=t,e.className="st-sr-only",e.textContent=u,h.appendChild(e)}h.style.position="absolute",h.style.left=t.left+"px",h.style.top=t.top+"px",h.style.width=t.width+"px",h.style.height=t.height+"px";const p=Ye(r,e),f=un(r,e),v=pn(r,e),w=a!==("right"===e.pinned);if(w){const t=Tn(r,e,n);t&&h.appendChild(t)}r.headerRenderer||"right"!==r.align||(v&&h.appendChild(v),f&&h.appendChild(f),p&&h.appendChild(p));const m=document.createElement("div");if(m.className="st-header-label",r.headerRenderer)$n(m,r,l,e,{sortIcon:p,filterIcon:f,collapseIcon:v});else{const t=On(r,e);m.appendChild(t)}if(y(m,"click",t=>{d||((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(J({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=An(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.isSortable&&i.onSort(e.accessor)}})(t,r,l,e)}),y(m,"dblclick",t=>{d||((t,e,n)=>{e.isSelectionColumn||n.selectableColumns&&e.isSortable&&n.onSort(e.accessor)})(0,r,e)}),Wn(m,h,r,e),h.appendChild(m),r.headerRenderer||"right"===r.align||(v&&h.appendChild(v),f&&h.appendChild(f),p&&h.appendChild(p)),!w){const t=Tn(r,e,n);t&&h.appendChild(t)}return e.headerRegistry&&!r.isSelectionColumn&&e.headerRegistry.set(r.accessor+"",{setEditing:t=>{if(t){const t=m.querySelector(".st-header-label-text");if(t){t.innerHTML="";const n=An(r,e,t);t.appendChild(n)}}}}),h})(e,n,s);r.dataset.stIconState=`${n.sort&&n.sort.key.accessor===e.header.accessor?n.sort.direction:"none"}|${n.filters&&n.filters[e.header.accessor]?"1":"0"}`,H&&n.animationCoordinator&&!n.animationCoordinator.hasSnapshotEntry(o)&&!n.animationCoordinator.wasRenderableBeforeAccordion(e.header.accessor+"")&&("vertical"===H?r.style.height="0px":r.style.width="0px",r.dataset.stAccordionGrow=H,M.push({element:r,cell:e})),i(t,v(e),w(e)).appendChild(r),h.set(o,r),g.set(o,{left:e.left,top:e.top,width:e.width,height:e.height})}),H&&M.length>0&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{for(const{element:t,cell:e}of M)t.isConnected&&("vertical"===H?t.style.height=e.height+"px":t.style.width=e.width+"px",delete t.dataset.stAccordionGrow)})}),n.pinned||(t.dataset.lastScrollLeft=s+""),d.forEach(t=>{const e=h.get(J({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")}),o(t)},Ln=(t,e)=>{t.style.left="0",t.style.width="number"!=typeof e||0>e?"100%":e+"px"},Dn=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:Bt({position:n,rowHeight:i,heightOffsets:s,customTheme:r});Ln(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},Bn=new WeakMap,jn=new WeakMap,zn=t=>(jn.has(t)||jn.set(t,new Map),jn.get(t)),Nn=(t,n,s,r=0,l,a,c,h)=>{var u,p,f,v,w,m,g,x;const b=s.pinned?null!==(p=null!==(u=s.containerWidth)&&void 0!==u?u:t.clientWidth)&&void 0!==p?p:0:null!==(w=null!==(v=null!==(f=s.mainSectionViewportWidth)&&void 0!==f?f:s.containerWidth)&&void 0!==v?v:t.clientWidth)&&void 0!==w?w:0,y=s.pinned?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,r,b),R=d(t),C=(t=>(Bn.has(t)||Bn.set(t,new Map),Bn.get(t)))(t),S=new Set(y.map(t=>{var e;return J({accessor:t.header.accessor,rowId:null!==(e=t.stableRowKey)&&void 0!==e?e:t.rowId})}));let I=null;if(c)if(h)I=h;else{I=new Map;for(const t of n){const e=J({accessor:t.header.accessor,rowId:null!==(m=t.stableRowKey)&&void 0!==m?m:t.rowId});I.set(e,{left:t.left,top:t.top,width:t.width,height:t.height})}}const H=c&&s.accordionAxis?s.accordionAxis:null,M="horizontal"===H?(t=>{const e=new Set,n=t=>{var i;for(const o of t)o.hide||o.excludeFromRender||(e.add(o.accessor+""),(null===(i=o.children)||void 0===i?void 0:i.length)&&n(o.children))};return n(t),e})(s.headers):null,k=(null==l?void 0:l.length)?new Set(l.map(t=>t.position)):new Set(y.map(t=>t.rowIndex));R.forEach((e,n)=>{var i,o,r;if(!S.has(n)){const l=e.getAttribute("data-row-id");l&&Ee(l,e);const a=null==I?void 0:I.get(n);if(c&&c.shouldRetain(n)&&a)return c.retainCell({cellId:n,element:e,container:t,newPosition:a}),void R.delete(n);if(c&&"horizontal"===H&&c.shouldRetain(n)){const s=null!==(i=e.getAttribute("data-accessor"))&&void 0!==i?i:"";if(null===(o=null==M?void 0:M.has(s))||void 0===o||!o)return c.shrinkOutCell({cellId:n,element:e,container:t,axis:H}),void R.delete(n)}((t,e)=>{const n=Ie.get(t);void 0!==n&&(null==e||e.delete(n),Ie.delete(t))})(e,s.cellRegistry),null===(r=s.onRendererHostDiscard)||void 0===r||r.call(s,e),e.remove(),R.delete(n)}});const E=zn(t);C.forEach((t,e)=>{k.has(e)||(t.remove(),C.delete(e),E.delete(e))});const T=null!==(g=s.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+T+1,W=(t,e)=>{var n;s.enableRowSelection?t.setAttribute("aria-selected",(null===(n=s.isRowSelected)||void 0===n?void 0:n.call(s,e.rowId))?"true":"false"):t.hasAttribute("aria-selected")&&t.removeAttribute("aria-selected")},P=!!s.rowGrouping&&s.rowGrouping.length>0,$=t=>{var e;return(null!==(e=t.stableRowKey)&&void 0!==e?e:et(t.rowId))+""},F=new Map;if(P&&l&&l.length>0){const t=new Map;for(const e of l){const n=null!==(x=e.rowIndexPath)&&void 0!==x?x:[],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 i=F.get($(n));i&&(t.setAttribute("aria-posinset",i.posinset+""),t.setAttribute("aria-setsize",i.setsize+""));const{expandable:o,expanded:r}=(t=>{var e;const n=t.depth,i=null===(e=s.rowGrouping)||void 0===e?void 0:e[n],o=!!i&<(t.row,i),r=!!s.rowGrouping&&s.rowGrouping.length>n,l=!s.canExpandRowGroup||s.canExpandRowGroup(t.row);return o&&r&&l||s.onRowGroupExpand&&r&&l?{expandable:!0,expanded:at(st(t),n,new Set(s.expandedDepths),s.expandedRows,s.collapsedRows)}:{expandable:!1,expanded:!1}})(n);o?t.setAttribute("aria-expanded",r+""):t.hasAttribute("aria-expanded")&&t.removeAttribute("aria-expanded")},D=[],B=new Set;y.forEach(e=>{var n,o,r,l,d;const c=J({accessor:e.header.accessor,rowId:null!==(n=e.stableRowKey)&&void 0!==n?n:e.rowId});if(!B.has(c))if(B.add(c),R.has(c)){const n=R.get(c),h=i(t,A(e),O(e));if(W(h,e),L(h,e),a)((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(We(n,e,s),e.header.isSelectionColumn&&s.enableRowSelection&&s.isRowSelected){const t=s.isRowSelected(e.rowId);ge(n,t)}if(e.header.expandable){const t=new Set(s.expandedDepths),i=null!==(r=null===(o=s.getExpandedRows)||void 0===o?void 0:o.call(s))&&void 0!==r?r:s.expandedRows,a=null!==(d=null===(l=s.getCollapsedRows)||void 0===l?void 0:l.call(s))&&void 0!==d?d:s.collapsedRows,c=at(st(e.tableRow),e.depth,t,i,a);ye(n,c)}}}else D.push({cell:e,cellId:c})});const j=[];D.forEach(({cell:e,cellId:n})=>{const o=null==c?void 0:c.claimRetainedForReuse(n,t);if(o){We(o,e,s);const r=i(t,A(e),O(e));return W(r,e),L(r,e),o.parentElement!==r&&r.appendChild(o),void R.set(n,o)}const r=Oe(e,s);H&&c&&!c.hasSnapshotEntry(n)&&!c.wasRenderableBeforeAccordion(e.header.accessor+"")&&("vertical"===H?r.style.height="0px":r.style.width="0px",r.dataset.stAccordionGrow=H,j.push({element:r,cell:e}));const l=i(t,A(e),O(e));W(l,e),L(l,e),l.appendChild(r),R.set(n,r)}),H&&j.length>0&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{for(const{element:t,cell:e}of j)t.isConnected&&("vertical"===H?t.style.height=e.height+"px":t.style.width=e.width+"px",delete t.dataset.stAccordionGrow)})}),((t,n,i,o,s)=>{const r=zn(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=Bt({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)&&(Ln(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=Dn({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,s,C,l),o(t)};function qn(t,e){return t?"string"==typeof t?t:t instanceof HTMLElement?t.cloneNode(!0):"function"==typeof t?t(e):null:null}function Vn(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?jt({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:et(r.rowId);for(const e of t.headerPositions){const n=J({accessor:e.accessor,rowId:l});i.set(n,{left:e.left,top:o,width:e.width,height:t.rowHeight})}}return i}class Gn{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),p=u.length>0?Math.max(...u.map(t=>t.colIndex))+1:a;this.nextColIndexMap.set(d,p);const f=this.getCachedContext("header-"+d,r,i,l),v=c.scrollLeft;return Fn(c,u,f,v),i||v===c.scrollLeft||(c.scrollLeft=v),!i&&c&&(c.__renderHeaderCells=(t,e)=>{if(!c)return;const n=void 0!==e?Object.assign(Object.assign({},f),{columnsWithSelectedCells:e.columnsWithSelectedCells,selectedColumns:e.selectedColumns}):f;Fn(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:p,totalRowCount:f,startColIndex:v=0,positionOnly:w=!1,fullTableRows:m,renderedStartIndex:g,renderedEndIndex:x,allFlattenedRows:b,pageStartIndex:y,animationCoordinator:R}=t,C=d||"main";let S=this.bodySections.get(C);S||(S=document.createElement("div"),S.className="left"===d?"st-body-pinned-left":"right"===d?"st-body-pinned-right":"st-body-main",this.bodySections.set(C,S));const I=r.filter(t=>"left"===d?"left"===t.pinned:"right"===d?"right"===t.pinned:!t.pinned);if(0===I.length)return S.style.display="none",S;S.style.display="";const H=((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!==f?f:l.length,u,p,null!==(n=c.customTheme)&&void 0!==n?n:e);S.style.cssText=`\n position: relative;\n ${void 0!==h?`width: ${h}px;`:""}\n ${d?"":"flex-grow: 1;"}\n height: ${H}px;\n `;const M=this.getCachedBodyCells(C,I,l,a,u,p,null!==(i=c.customTheme)&&void 0!==i?i:e,v,m,g,x),k=null!==(o=null!=b?b:m)&&void 0!==o?o:l;this.captureSnapshotConfig(C,I,a,k,u,p,null!==(s=c.customTheme)&&void 0!==s?s:e,void 0!==b?null!=y?y:0:void 0);const E=R?this.getFullSectionLayout(C):null,T=l.filter(t=>!t.nestedTable&&!t.stateIndicator).length;this.nextColIndexMap.set(C,M.length>0&&T>0?v+M.length/T:v);const A=this.getCachedContext("body-"+C,c,d,h);return Nn(S,M,A,S.scrollLeft,l,w,R,null!=E?E:void 0),this.renderNestedGridRows(S,C,l,d,A,R),d||this.renderStateRows(S,C,l,A,R),!d&&S&&(S.__renderBodyCells=t=>{S&&Nn(S,M,A,t,l,!0)}),S}renderNestedGridRows(t,e,n,i,o,s){var r,l;const a=null!==(r=null==s?void 0:s.isEnabled())&&void 0!==r&&r,d=a?`transform ${s.getDuration()}ms ${s.getEasing()}, height ${s.getDuration()}ms ${s.getEasing()}`:"",c=n.filter(t=>t.nestedTable),h=new Set(c.map(t=>st(t)));let u=this.nestedGridRowsMap.get(e);u||(u=new Map,this.nestedGridRowsMap.set(e,u)),u.forEach((t,e)=>{var n;h.has(e)||(null===(n=t.cleanup)||void 0===n||n.call(t),t.element.remove(),u.delete(e))});const p={rowHeight:o.rowHeight,heightOffsets:o.heightOffsets,customTheme:null!==(l=o.customTheme)&&void 0!==l?l:{},theme:o.theme,rowGrouping:o.rowGrouping,depth:0,loadingStateRenderer:o.loadingStateRenderer,errorStateRenderer:o.errorStateRenderer,emptyStateRenderer:o.emptyStateRenderer,icons:o.icons,createNestedTable:o.createNestedTable};c.forEach(n=>{var s,r,l,c,h,f,v;const w=st(n),m=u.get(w);if(m){const t=jt({position:n.position,rowHeight:o.rowHeight,heightOffsets:o.heightOffsets,customTheme:null!==(s=o.customTheme)&&void 0!==s?s:{}}),e=_({calculatedHeight:n.nestedTable.calculatedHeight,customHeight:null===(r=n.nestedTable.expandableHeader.nestedTable)||void 0===r?void 0:r.height,customTheme:null!==(l=o.customTheme)&&void 0!==l?l:{}}),i=m.lastTop!==t,a=m.lastWrapperHeight!==e;return(i||a)&&(m.element.style.transition=d,i&&(m.element.style.transform=`translate3d(0, ${t}px, 0)`),a&&(m.element.style.height=e+"px"),m.lastTop=t,m.lastWrapperHeight=e),m.element.dataset.index=n.position+"",void(m.lastPosition=n.position)}const g=this.stateRowsMap.get(e),x=g&&g.has(w)?o.rowHeight:0,b=_({calculatedHeight:n.nestedTable.calculatedHeight,customHeight:null===(c=n.nestedTable.expandableHeader.nestedTable)||void 0===c?void 0:c.height,customTheme:null!==(h=o.customTheme)&&void 0!==h?h:{}}),y=jt({position:n.position,rowHeight:o.rowHeight,heightOffsets:o.heightOffsets,customTheme:null!==(f=o.customTheme)&&void 0!==f?f:{}});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=_({calculatedHeight:n.calculatedHeight,customHeight:null==i?void 0:i.height,customTheme:e.customTheme}),s=jt({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:o.rowHeight,heightOffsets:o.heightOffsets,customTheme:null!==(v=o.customTheme)&&void 0!==v?v:{}});a&&x!==b&&(e.style.height=x+"px"),t.appendChild(e),u.set(w,{element:e,lastPosition:n.position,lastTop:y,lastWrapperHeight:b}),a&&x!==b&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transition=d,e.style.height=b+"px"})})}else{p.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:o,customTheme:s,theme:r,rowGrouping:l,depth:a,loadingStateRenderer:d,errorStateRenderer:c,emptyStateRenderer:h,icons:u}=e,{parentRow:p,expandableHeader:f,childAccessor:v,calculatedHeight:w}=n,m=f.nestedTable;if(!m)throw Error("createNestedGridRow: expandableHeader.nestedTable is missing");const g=X(p,v),x=Array.isArray(g)?g:[],b=l&&l[a+1]?l.slice(a+1):void 0,y=m.customTheme?Object.assign(Object.assign({},s),m.customTheme):s,R=(({calculatedHeight:t,customHeight:e,customTheme:n})=>e?"string"==typeof e?e:e+"px":t-n.nestedGridPaddingTop-n.nestedGridPaddingBottom+"px")({calculatedHeight:w,customHeight:m.height,customTheme:s}),C=_({calculatedHeight:w,customHeight:m.height,customTheme:s}),S=jt({position:t.position,rowHeight:i,heightOffsets:o,customTheme:s}),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, ${S}px, 0)`,I.style.height=C+"px",I.style.paddingTop=s.nestedGridPaddingTop+"px",I.style.paddingBottom=s.nestedGridPaddingBottom+"px",I.style.paddingLeft=s.nestedGridPaddingLeft+"px",I.style.paddingRight=s.nestedGridPaddingRight+"px",I.style.boxSizing="border-box";const H=document.createElement("div");H.setAttribute("role","gridcell"),H.style.height="100%",H.style.width="100%",I.appendChild(H);const M=Object.assign(Object.assign({},m),{defaultHeaders:m.defaultHeaders,rows:x,theme:r,customTheme:y,height:R,rowGrouping:b,loadingStateRenderer:d,errorStateRenderer:c,emptyStateRenderer:h,icons:u});if(!e.createNestedTable)throw Error("createNestedGridRow: context.createNestedTable factory was not provided");const k=e.createNestedTable(H,M);k.mount();const E=()=>{k.destroy()};return I.__nestedTableCleanup=E,{element:I,cleanup:E}}(n,p);a&&x!==b&&(e.style.height=x+"px",e.style.overflow="hidden"),t.appendChild(e),u.set(w,{element:e,cleanup:i,lastPosition:n.position,lastTop:y,lastWrapperHeight:b}),a&&x!==b&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transition=d,e.style.height=b+"px"})})}})}renderStateRows(t,e,n,i,o){var s,r;const l=n.filter(t=>t.stateIndicator),a=new Set(l.map(t=>st(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=st(e),r=jt({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, ${jt({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=qn(e.loadingStateRenderer,{parentRow:i.parentRow}):i.state.error&&e.errorStateRenderer?r=qn(e.errorStateRenderer,{error:i.state.error,parentRow:i.parentRow}):i.state.isEmpty&&e.emptyStateRenderer&&(r=qn(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(t.hide||t.excludeFromRender)return 0;const c=e.has(t.accessor);if(t.children&&t.children.length>0){const e=t.children.filter(t=>{const e=t.showWhen||"parentExpanded";return c?"parentCollapsed"===e||"always"===e:"parentExpanded"===e||"always"===e});if(t.singleRowChildren){const c="number"==typeof t.width?t.width:150;s.push({header:t,left:l,top: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 p=0;return e.forEach(e=>{p+=a(e,o+1,t)}),s.push({header:t,left:h,top:o*i,width:p,height:i,colIndex:u,parentHeader:d}),p}{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?jt({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:et(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(t.hide||t.excludeFromRender)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}createHeadersHash(t){const e=t=>{let n=`${t.accessor}:${t.width}:${t.pinned||""}:${t.hide||""}`;return t.children&&t.children.length>0&&(n+=`:children[${t.children.map(e).join(",")}]`),n};return t.map(e).join("|")}createHeightOffsetsHash(t){return t&&0!==t.length?t.map(([t,e])=>`${t}:${e}`).join("|"):""}createContextHash(t){let e=["columnBorders","enableRowSelection","cellUpdateFlash","useOddColumnBackground","useHoverRowBackground","useOddEvenRowBackground","rowHeight","containerWidth"].map(e=>`${e}:${t[e]}`).join("|");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),p=null!=a&&null!=d&&null!=c,f=this.bodyCellsCache.get(t),v=f&&f.deps.headersHash===h&&f.deps.collapsedHeadersSize===i.size&&f.deps.rowHeight===o&&f.deps.heightOffsetsHash===u&&(p?f.deps.fullTableRowsRef===a&&void 0!==f.deps.bandStart&&void 0!==f.deps.bandEnd&&((t,e)=>d>=t&&e>=c)(f.deps.bandStart,f.deps.bandEnd):f.deps.rowsRef===n);if(v&&f){if(!p)return f.cells;const t=new Map;n.forEach((e,n)=>{t.set(e.position,n)});const e=[];for(const n of f.cells){const 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(p){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 x=this.calculateAbsoluteBodyCells(e,w,i,o,s,r,l);if(this.bodyCellsCache.set(t,{cells:x,deps:Object.assign({headersHash:h,rowsRef:w,collapsedHeadersSize:i.size,rowHeight:o,heightOffsetsHash:u},p&&{fullTableRowsRef:a,bandStart:m,bandEnd:g})}),!p)return x;const b=new Map;n.forEach((t,e)=>{b.set(t.position,e)});const y=[];for(const t of x){const e=b.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=>{((t,e)=>{if(t){const n=d(t);n.forEach(t=>{null==e||e(t),t.remove()}),n.clear(),s(t)}})(t,this.onRendererHostDiscard)}),this.headerSections.forEach(t=>{(t=>{if(h=0,t){const e=m(t);e.forEach(t=>{t.remove()}),e.clear(),x(t).clear(),R(t),s(t)}})(t)}))}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,Vn(e))}),t}getFullSectionLayout(t){const e=this.bodySectionSnapshots.get(t);return e?Vn(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})}cleanup(){this.headerSections.clear(),this.bodySections.clear(),this.bodyCellsCache.clear(),this.headerCellsCache.clear(),this.contextCache.clear(),this.bodySectionSnapshots.clear(),this.nextColIndexMap.clear()}}const Kn=(t,e)=>{"string"==typeof e?t.innerHTML=e:(t.innerHTML="",t.appendChild(e.cloneNode(!0)))},Un=(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(Un([t],e,n),!1===t.hide){o=!0;break}(t||o)&&(i.hide=!1)}},Jn=t=>t.every(t=>t.hide),_n=t=>{t.forEach(t=>{t.children&&t.children.length>0&&(_n(t.children),Jn(t.children)&&(t.hide=!0))})},Yn=(t,e)=>{const n=e.toLowerCase();return!!t.label.toLowerCase().includes(n)||!(!t.children||0>=t.children.length)&&t.children.some(t=>Yn(t,e))},Xn=(t,e,n)=>{if(!e.trim())return t;const i=n||Yn;return t.filter(t=>!t.isSelectionColumn&&!t.excludeFromRender&&i(t,e))};function Qn(t,e,n,i){e&&t.appendChild(e),t.appendChild(n),i&&t.appendChild(i)}function Zn(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 ti=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:p}=e,f="",v=null,w=null,m=!1;const g=new Set,x=t=>{t.forEach(t=>{t.children&&t.children.length>0&&(g.add(t.accessor),x(t.children))})};x(n);let b=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 C=null,S=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=>{f=t.target.value,P()}),n.appendChild(i),e.appendChild(n),{wrapper:e,input:i}}(s);S=t.wrapper,C=t.input}const I=document.createElement("div");I.className="st-column-editor-lists";let H=null;p&&(H=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}(p));let M=l.customRenderer;M?Zn(R,M,n,S,I,H,p):Qn(R,S,I,H),y.appendChild(R);const k=t=>{v=t,null!==t?m=!0:(m=!1,P())},E=()=>{w=null},T=t=>{w=t,m?O():P()},A=t=>{const e=b;b=t,P(e)},O=()=>{I.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,p)=>{if(0===t.length)return;const m=t.filter(t=>!t.isSelectionColumn&&!t.excludeFromRender);if(0===(o?Xn(m,f,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 x=((t,e)=>{const n=o?Xn(t,f,r):t,i=[],s=o&&f.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||b.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);x.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:p,hoveredSeparator:f,panelSection:v,rowIndex:w,setDraggingRow:m,setExpandedHeaders:g,setHoveredSeparator:x,headers:b,setHeaders:y,onColumnVisibilityChange:R,onColumnOrderChange:C,previousExpandedHeaders:S}=t,I=null!==(e=t.essentialAccessors)&&void 0!==e?e:new Set,H=!1!==t.columnEditorConfig.allowColumnPinning,M=je(p,I),k=!M,E=document.createDocumentFragment(),T=16*s+"px",A=p.children&&p.children.length>0,O=!(p.hide||A&&p.children&&Jn(p.children)),W=c.has(p.accessor),P=u||W,$=null!==f&&f.panelSection===(null!=v?v:"main");let F;if(0===w){const t=document.createElement("div");t.className="st-column-editor-drag-separator",t.style.opacity=$&&-1===f.index?"1":"0",E.appendChild(t)}const L=document.createElement("div");L.className="st-header-checkbox-item",L.style.paddingLeft=T,L.draggable=!0;const D=t=>!(I.size>0&&!Ne(t,I)||(null==C||C(t),y(t),0)),B=t=>{if(t.stopPropagation(),u)return;const e=new Set(c);W?e.delete(p.accessor):e.add(p.accessor),g(e)};let j;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===v){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});x(null===i?null:{panelSection:null!=v?v:"main",index:i})}}),L.addEventListener("dragend",()=>{const t=a?a():l,e=d?d():f,n=()=>{m(null),x(null)};if(!t||null===e||t.panelSection!==v)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=fn(b,t.header.accessor),r=fn(b,o.header.accessor);if(!s||!r)return void n();const{newHeaders:c,emergencyBreak:u}=mn(b,s,r);u||D(c),n()}),r){const e=document.createElement("div");if(e.className="st-header-icon-container",A){const t=void 0!==S?u||S.has(p.accessor):P,n=!u&&void 0!==S&&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 ${p.label} column`:`Expand ${p.label} column`),o.appendChild(ae("st-expand-icon")),o.addEventListener("click",B),o.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),B(t))}),e.appendChild(o),j=o,n&&(F=()=>{ye(L,P,{ariaLabelWhenExpanded:`Collapse ${p.label} column`,ariaLabelWhenCollapsed:`Expand ${p.label} column`,syncAriaExpanded:!0})})}t.columnEditorConfig.rowRenderer||L.appendChild(e)}const z=xe({checked:O,onChange:t=>{if(!k)return;p.hide=!t,t?(Un(i,p.accessor),A&&p.children&&p.children.length>0&&p.children.every(t=>!0===t.hide)&&p.children[0]&&(p.children[0].hide=!1,Un(i,p.children[0].accessor))):_n(i);const e=[...b];if(y(Pe(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 N=document.createElement("div");N.className="st-drag-icon-container";const q=null===(n=t.icons)||void 0===n?void 0:n.drag;"string"==typeof q?N.innerHTML=q:q instanceof HTMLElement||q instanceof SVGSVGElement?N.appendChild(q.cloneNode(!0)):N.innerHTML='<svg\n aria-hidden="true"\n role="img"\n xmlns="http://www.w3.org/2000/svg"\n viewBox="0 0 16 10"\n style="height: 10px; width: 16px;"\n>\n <circle cx="3" cy="3" r="1.5" fill="currentColor" />\n <circle cx="8" cy="3" r="1.5" fill="currentColor" />\n <circle cx="13" cy="3" r="1.5" fill="currentColor" />\n <circle cx="3" cy="7" r="1.5" fill="currentColor" />\n <circle cx="8" cy="7" r="1.5" fill="currentColor" />\n <circle cx="13" cy="7" r="1.5" fill="currentColor" />\n</svg>';const V=document.createElement("div");V.className="st-column-label-container",V.textContent=p.label;const G="left"===p.pinned||"right"===p.pinned?p.pinned:null,K=!!G&&!M,U=!G&&"main"===v,J=!G&&"main"===v,_=()=>{const t=Ue(b,p.accessor,"left",I);t&&D(t)},Y=()=>{const t=Ue(b,p.accessor,"right",I);t&&D(t)},X=()=>{const t=Ue(b,p.accessor,"main",I);t&&D(t)},{rowRenderer:Q}=t.columnEditorConfig;if(Q){const t=Q({accessor:p.accessor,header:p,components:{expandIcon:j,checkbox:z.element,dragIcon:N,labelContent:V},panelSection:v,isEssential:M,canToggleVisibility:k,allowColumnPinning:H,pinControl:H&&0===s?{pinnedSide:G,canPinLeft:U,canPinRight:J,canUnpin:K,pinLeft:_,pinRight:Y,unpin:X}:void 0});t instanceof HTMLElement?L.appendChild(t):"string"==typeof t&&(L.innerHTML=t)}else if(L.appendChild(z.element),L.appendChild(N),L.appendChild(V),H&&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=M;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(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(),_()}),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(),Y()}),t.appendChild(e)}}L.appendChild(t)}E.appendChild(L);const Z=document.createElement("div");return Z.className="st-column-editor-drag-separator",Z.style.opacity=$&&f.index===w?"1":"0",E.appendChild(Z),{fragment:E,scheduleExpandIconAnimation:F}})({allHeaders:n,clearHoverSeparator:E,depth:t.depth,doesAnyHeaderHaveChildren:y,draggingRow:v,getDraggingRow:()=>v,getHoveredSeparator:()=>w,expandedHeaders:b,flattenedHeaders:x,forceExpanded:o&&f.trim().length>0,header:t.header,hoveredSeparator:w,panelSection:e,rowIndex:t.visualIndex,setDraggingRow:k,setExpandedHeaders:A,setHoveredSeparator:T,columnEditorConfig:l,icons:a,essentialAccessors:null!=d?d:new Set,headers:n,setHeaders:c,onColumnVisibilityChange:h,onColumnOrderChange:u,previousExpandedHeaders:p});g.appendChild(s.fragment),null===(i=s.scheduleExpandIconAnimation)||void 0===i||i.call(s)})},P=t=>{I.innerHTML="";const e=!1!==l.allowColumnPinning,{pinnedLeft:i,unpinned:o,pinnedRight:s}=Be(n);if(e)W(i,"left","Pinned Left",I,t),W(o,"main","Main",I,t),W(s,"right","Pinned Right",I,t);else{const e=[...i,...o,...s];W(e,"main",null,I,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&&(p=t.resetColumns);let e=!1;if(void 0!==t.columnEditorConfig){const n=t.columnEditorConfig.customRenderer;n!==M&&(M=n,e=!0),l=t.columnEditorConfig}void 0!==t.open&&(i=t.open,i?y.classList.add("open"):y.classList.remove("open")),C&&void 0!==t.searchPlaceholder&&(C.placeholder=t.searchPlaceholder),e&&(R.innerHTML="",M?Zn(R,M,n,S,I,H,p):Qn(R,S,I,H)),P()},destroy:()=>{C&&(C.removeEventListener("input",()=>{}),C.removeEventListener("click",()=>{})),y.removeEventListener("click",()=>{}),y.remove()}}},ei=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:p,sectionScrollController:f,startColIndex:v,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(t.hide||t.excludeFromRender)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),x=new Map;let b=0;g.forEach(t=>{const e="number"==typeof t.width?t.width:150;x.set(t.accessor,{left:b,width:e}),b+=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,p=document.createElement("div");p.className="st-row st-sticky-parent",p.style.position="absolute",p.style.top="0px",p.style.left="0",p.style.right="0",p.style.height=r+"px",p.style.transform=`translateY(${h}px)`,p.style.zIndex=u+"",p.setAttribute("data-index",t.position+""),g.forEach((e,n)=>{var i,o;const s=x.get(e.accessor),l=v+n,a={header:e,row:t.row,rowIndex:w(t),colIndex:l,rowId:et(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=Oe(a,d);p.appendChild(c)}),m.appendChild(p);const f=Dn({position:(e+1)*(r+1)-1+c,rowHeight:r,displayStrongBorder:!1,heightOffsets:l,customTheme:a,isSticky:!0,sectionWidthPx:y});m.appendChild(f)}),f&&p&&f.registerPane("pinned-left"===p?"pinned-left":"pinned-right"===p?"pinned-right":"main",m,"sticky"),m},ni=(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 ii{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 Gn}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)}getCurrentBodyLayouts(){return this.sectionRenderer.getCurrentBodyLayouts()}renderHeader(t,e,n,i){var o,s,r,l,a,d,c,h,u,p,f,v;if(!t||i.config.hideHeader)return;t.style.height=e+"px";const w=$e(i.effectiveHeaders,"left")||$e(i.effectiveHeaders,void 0)||$e(i.effectiveHeaders,"right");t.style.minHeight=w?"":e+"px";const m=t.parentElement;m&&(m.setAttribute("aria-rowcount",1+i.localRows.length+""),m.setAttribute("aria-colcount",i.effectiveHeaders.length+""),i.config.enableRowSelection?m.setAttribute("aria-multiselectable","true"):m.removeAttribute("aria-multiselectable"));const g=null!==(s=null===(o=i.dimensionManager)||void 0===o?void 0:o.getState())&&void 0!==s?s:{containerWidth:0,calculatedHeaderHeight:i.customTheme.headerHeight,maxHeaderDepth:1},{mainWidth:x,leftWidth:b,rightWidth:y}=yn({headers:i.effectiveHeaders,containerWidth:g.containerWidth,collapsedHeaders:i.collapsedHeaders}),R=null===(r=i.sortManager)||void 0===r?void 0:r.getState(),C=null===(l=i.filterManager)||void 0===l?void 0:l.getState(),S=null!==(d=null===(a=i.rowSelectionManager)||void 0===a?void 0:a.getSelectedRowCount())&&void 0!==d?d:0,I={reverse:!1,collapsedHeaders:i.collapsedHeaders,getCollapsedHeaders:i.getCollapsedHeaders,columnBorders:null!==(c=i.config.columnBorders)&&void 0!==c&&c,columnReordering:null!==(h=i.config.columnReordering)&&void 0!==h&&h,columnResizing:null!==(u=i.config.columnResizing)&&void 0!==u&&u,containerWidth:g.containerWidth,mainSectionContainerWidth:x,mainSectionViewportWidth:bn({containerWidth:g.containerWidth,leftWidth:b,rightWidth:y}),enableHeaderEditing:i.config.enableHeaderEditing,enableRowSelection:i.config.enableRowSelection,selectedRowCount:S,filters:null!==(p=null==C?void 0:C.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!==(f=null==R?void 0:R.sort)&&void 0!==f?f:null,autoExpandColumns:null!==(v=i.config.autoExpandColumns)&&void 0!==v&&v,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},H=i.effectiveHeaders.filter(t=>"left"===t.pinned),M=i.effectiveHeaders.filter(t=>!t.pinned),k=i.effectiveHeaders.filter(t=>"right"===t.pinned);let E=0;const T=[];if(H.length>0){const e=this.sectionRenderer.renderHeaderSection({headers:i.effectiveHeaders,collapsedHeaders:i.collapsedHeaders,pinned:"left",maxHeaderDepth:n,headerHeight:i.customTheme.headerHeight,context:I,sectionWidth:b,startColIndex:E});i.pinnedLeftHeaderRef.current=e,T.push(e),t.appendChild(e),E=this.sectionRenderer.getNextColIndex("left")}if(M.length>0){const e=this.sectionRenderer.renderHeaderSection({headers:i.effectiveHeaders,collapsedHeaders:i.collapsedHeaders,maxHeaderDepth:n,headerHeight:i.customTheme.headerHeight,context:I,sectionWidth:x,startColIndex:E});i.mainHeaderRef.current=e,T.push(e),t.appendChild(e),E=this.sectionRenderer.getNextColIndex("main")}if(k.length>0){const e=this.sectionRenderer.renderHeaderSection({headers:i.effectiveHeaders,collapsedHeaders:i.collapsedHeaders,pinned:"right",maxHeaderDepth:n,headerHeight:i.customTheme.headerHeight,context:I,sectionWidth:y,startColIndex:E});i.pinnedRightHeaderRef.current=e,T.push(e),t.appendChild(e)}Array.from(t.children).forEach(t=>{T.includes(t)||t.remove()})}renderBody(t,e,n){var i,o,s,r,l,a,d,c,h,u,p,f,v,w,m,g,x,b,y,R,C,S,I;if(!t)return;if($e(n.effectiveHeaders,"left")||$e(n.effectiveHeaders,void 0)||$e(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 H=e.rowsToRender||e.currentTableRows,M=!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}),M){t.innerHTML="";const e=document.createElement("div");return e.className="st-empty-state-wrapper","string"==typeof n.config.tableEmptyStateRenderer?e.textContent=n.config.tableEmptyStateRenderer:n.config.tableEmptyStateRenderer instanceof HTMLElement?e.appendChild(n.config.tableEmptyStateRenderer.cloneNode(!0)):e.innerHTML="<div class='st-empty-state'>No rows to display</div>",void t.appendChild(e)}const k=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:E,leftWidth:T,rightWidth:A}=yn({headers:n.effectiveHeaders,containerWidth:k.containerWidth,collapsedHeaders:n.collapsedHeaders}),O=null!==(d=null===(a=n.rowSelectionManager)||void 0===a?void 0:a.getSelectedRowCount())&&void 0!==d?d:0,W=null!==(c=k.maxHeaderDepth)&&void 0!==c?c:1,P=null===(h=z(n.effectiveHeaders).find(t=>!t.isSelectionColumn))||void 0===h?void 0:h.accessor,$={collapsedHeaders:n.collapsedHeaders,collapsedRows:n.getCollapsedRows(),expandedRows:n.getExpandedRows(),expandedDepths:Array.from(n.expandedDepths),selectedColumns:null!==(p=null===(u=n.selectionManager)||void 0===u?void 0:u.getSelectedColumns())&&void 0!==p?p:new Set,rowsWithSelectedCells:null!==(v=null===(f=n.selectionManager)||void 0===f?void 0:f.getRowsWithSelectedCells())&&void 0!==v?v:new Set,columnBorders:null!==(w=n.config.columnBorders)&&void 0!==w&&w,enableRowSelection:n.config.enableRowSelection,selectedRowCount:O,cellUpdateFlash:n.config.cellUpdateFlash,useOddColumnBackground:n.config.useOddColumnBackground,useHoverRowBackground:null===(m=n.config.useHoverRowBackground)||void 0===m||m,useOddEvenRowBackground:n.config.useOddEvenRowBackground,rowGrouping:n.config.rowGrouping,headers:n.effectiveHeaders,rowHeaderAccessor:P,rowHeight:n.customTheme.rowHeight,maxHeaderDepth:W,heightOffsets:e.paginatedHeightOffsets,customTheme:n.customTheme,containerWidth:k.containerWidth,mainSectionContainerWidth:E,mainSectionViewportWidth:bn({containerWidth:k.containerWidth,leftWidth:T,rightWidth:A}),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)},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!==(g=n.config.theme)&&void 0!==g?g:"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},F=n.effectiveHeaders.filter(t=>"left"===t.pinned),L=n.effectiveHeaders.filter(t=>!t.pinned),D=n.effectiveHeaders.filter(t=>"right"===t.pinned);let B=0;const j=[],N=n.positionOnlyBody?void 0:n.animationCoordinator;if(F.length>0){const i=this.sectionRenderer.renderBodySection({headers:n.effectiveHeaders,rows:H,collapsedHeaders:n.collapsedHeaders,pinned:"left",context:$,sectionWidth:T,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,totalRowCount:e.currentTableRows.length,startColIndex:B,positionOnly:n.positionOnlyBody,fullTableRows:e.currentTableRows,renderedStartIndex:e.renderedStartIndex,renderedEndIndex:e.renderedEndIndex,allFlattenedRows:e.allFlattenedRows,pageStartIndex:e.pageStartIndex,animationCoordinator:N});n.pinnedLeftRef.current=i,j.push(i),i.parentElement!==t&&t.insertBefore(i,t.firstChild),B=this.sectionRenderer.getNextColIndex("left")}if(L.length>0){const i=this.sectionRenderer.renderBodySection({headers:n.effectiveHeaders,rows:H,collapsedHeaders:n.collapsedHeaders,context:$,sectionWidth:E,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,totalRowCount:e.currentTableRows.length,startColIndex:B,positionOnly:n.positionOnlyBody,fullTableRows:e.currentTableRows,renderedStartIndex:e.renderedStartIndex,renderedEndIndex:e.renderedEndIndex,allFlattenedRows:e.allFlattenedRows,pageStartIndex:e.pageStartIndex,animationCoordinator:N});if(n.mainBodyRef.current=i,j.push(i),i.parentElement!==t){const e=n.pinnedRightRef.current;e&&e.parentElement===t?t.insertBefore(i,e):t.appendChild(i)}B=this.sectionRenderer.getNextColIndex("main")}if(D.length>0){const i=this.sectionRenderer.renderBodySection({headers:n.effectiveHeaders,rows:H,collapsedHeaders:n.collapsedHeaders,pinned:"right",context:$,sectionWidth:A,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,totalRowCount:e.currentTableRows.length,startColIndex:B,positionOnly:n.positionOnlyBody,fullTableRows:e.currentTableRows,renderedStartIndex:e.renderedStartIndex,renderedEndIndex:e.renderedEndIndex,allFlattenedRows:e.allFlattenedRows,pageStartIndex:e.pageStartIndex,animationCoordinator:N});n.pinnedRightRef.current=i,j.push(i),i.parentElement!==t&&t.appendChild(i)}if(n.config.enableStickyParents&&e.stickyParents&&e.stickyParents.length>0){this.stickyParentsContainer&&(ni(this.stickyParentsContainer,null!==(x=n.sectionScrollController)&&void 0!==x?x:null),this.stickyParentsContainer=null);const i=n.externalScrollActive?null!==(b=n.stickyParentsScrollTop)&&void 0!==b?b:0:null!==(R=null===(y=n.mainBodyRef.current)||void 0===y?void 0:y.scrollTop)&&void 0!==R?R:0,o=t.offsetWidth-t.clientWidth,s={left:0,main:F.length>0?this.sectionRenderer.getNextColIndex("left"):0,right:L.length>0?this.sectionRenderer.getNextColIndex("main"):F.length>0?this.sectionRenderer.getNextColIndex("left"):0},r=H.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:et(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:et(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 p=0;for(const t of e){if(!(null===(l=t.parentIndices)||void 0===l?void 0:l.includes(u)))break;p++}if(0===p)return{treeTransitionOffset:0,offsetStartIndex:c};const f=e[0];let v;return v=n?n.rowTopPositions[f.position]:f.position*(i+o.rowSeparatorWidth),{treeTransitionOffset:-((h+1-p)*i+Math.max(0,s-v)),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.editColumns?"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=ei({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 p=ei({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(p),t.pinnedRightColumns.length>0){const o=ei({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:k.calculatedHeaderHeight,heightMap:e.heightMap,partiallyVisibleRows:e.partiallyVisibleRows||[],pinnedLeftColumns:F,pinnedLeftWidth:T,pinnedRightColumns:D,pinnedRightWidth:A,scrollTop:i,scrollbarWidth:o,stickyParents:e.stickyParents,stickySectionColStart:s,stickyBodyRowIndexByRowKey:l,externalScrollActive:n.externalScrollActive},{collapsedHeaders:n.collapsedHeaders,customTheme:n.customTheme,editColumns:null!==(C=n.config.editColumns)&&void 0!==C&&C,headers:n.effectiveHeaders,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,cellRenderContext:$,sectionScrollController:null!==(S=n.sectionScrollController)&&void 0!==S?S: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&&(ni(this.stickyParentsContainer,null!==(I=n.sectionScrollController)&&void 0!==I?I:null),this.stickyParentsContainer=null);Array.from(t.children).forEach(t=>{j.includes(t)||t.remove()})}renderFooter(t,e,n,i,o){var s,r,l,a,d,c,h,u,p,f,v,w;if(!t)return;const m=!!o.config.footerRenderer,g=o.config.shouldPaginate&&!o.config.hideFooter;if(m||(this.lastCustomFooterRenderer=null,this.lastCustomFooterKey=null),!m&&!g)return void(t.innerHTML="");const x=null!==(s=o.config.rowsPerPage)&&void 0!==s?s:10,b=Math.ceil(e/x);if(m){const s=(n-1)*x+1,d=Math.min(n*x,e),c=`${n}|${e}|${x}|${b}|${o.config.hideFooter?1:0}`;if(t.childNodes.length>0&&this.lastCustomFooterRenderer===o.config.footerRenderer&&this.lastCustomFooterKey===c)return void(this.footerInstance=null);this.lastCustomFooterRenderer=o.config.footerRenderer,this.lastCustomFooterKey=c;const h=null!==(r=o.config.serverSidePagination)&&void 0!==r&&r,u=t=>{if(h&&o.config.onPageChange)return o.config.onPageChange(t)},p=o.config.footerRenderer({currentPage:n,endRow:d,hasNextPage:b>n,hasPrevPage:n>1,nextIcon:null===(l=o.resolvedIcons)||void 0===l?void 0:l.next,onNextPage:async()=>{b>n&&(i(n+1),o.config.onNextPage&&await o.config.onNextPage(n+1),await u(n+1))},onPageChange:t=>{i(t),u(t)},onPrevPage:()=>{n>1&&(i(n-1),u(n-1))},prevIcon:null===(a=o.resolvedIcons)||void 0===a?void 0:a.prev,rowsPerPage:x,startRow:s,totalPages:b,totalRows:e});return t.innerHTML="",p instanceof HTMLElement?t.appendChild(p):"string"==typeof p&&(t.innerHTML=p),void(this.footerInstance=null)}if(this.footerInstance)this.footerInstance.update({currentPage:n,hideFooter:null!==(d=o.config.hideFooter)&&void 0!==d&&d,onPageChange:i,onNextPage:o.config.onNextPage,onUserPageChange:o.config.onPageChange,rowsPerPage:x,shouldPaginate:null!==(c=o.config.shouldPaginate)&&void 0!==c&&c,totalPages:b,totalRows:e,prevIcon:null===(h=o.resolvedIcons)||void 0===h?void 0:h.prev,nextIcon:null===(u=o.resolvedIcons)||void 0===u?void 0:u.next});else{t.innerHTML="";const s=(t=>{let{currentPage:e,hideFooter:n,onPageChange:i,onNextPage:o,onUserPageChange:s,rowsPerPage:r,shouldPaginate:l,totalPages:a,totalRows:d,prevIcon:c,nextIcon:h}=t,u=!0;if(n||!l)return{element:document.createElement("div"),update:()=>{},destroy:()=>{}};const p=document.createElement("div");p.className="st-footer";const f=()=>{p.innerHTML="";const t=e>1,n=a>e,l=e===a,v=Math.min((e-1)*r+1,d),w=Math.min(e*r,d),m=!t,g=!n&&!o||!u&&l,x=document.createElement("div");x.className="st-footer-info";const b=document.createElement("span");b.className="st-footer-results-text",b.textContent=`Showing ${v} to ${w} of ${d.toLocaleString()} results`,x.appendChild(b),p.appendChild(x);const y=document.createElement("div");y.className="st-footer-pagination";const R=((t,e)=>{if(15>=e)return Array.from({length:e},(t,e)=>e+1);const n=[];let 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),C=[];R.forEach((t,n)=>{if(0>t){const t=document.createElement("span");t.className="st-page-ellipsis",t.textContent="...",y.appendChild(t)}else{const 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),C.push({button:o,page:t,afterEllipsis:r})}}),C.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 S=document.createElement("button");S.className="st-next-prev-btn "+(m?"disabled":""),S.disabled=m,S.setAttribute("aria-label","Go to previous page"),c?Kn(S,c):S.innerHTML='<svg\n class="st-next-prev-icon"\n viewBox="0 0 24 24"\n width="24"\n height="24"\n xmlns="http://www.w3.org/2000/svg"\n>\n <path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z" />\n</svg>',S.addEventListener("click",async()=>{const t=e-1;1>t||(i(t),s&&await s(t))}),y.appendChild(S);const I=document.createElement("button");I.className="st-next-prev-btn "+(g?"disabled":""),I.disabled=g,I.setAttribute("aria-label","Go to next page"),h?Kn(I,h):I.innerHTML='<svg\n class="st-next-prev-icon"\n viewBox="0 0 24 24"\n width="24"\n height="24"\n xmlns="http://www.w3.org/2000/svg"\n>\n <path d="M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z" />\n</svg>',I.addEventListener("click",async()=>{const t=e+1;if(o&&e===a&&!await o(e))return u=!1,void f();t>a&&!o||(i(t),s&&await s(t))}),y.appendChild(I),p.appendChild(y)};return f(),{element:p,update:t=>{void 0!==t.currentPage&&(e=t.currentPage),void 0!==t.hideFooter&&(n=t.hideFooter),void 0!==t.onPageChange&&(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.shouldPaginate&&(l=t.shouldPaginate),void 0!==t.totalPages&&(a=t.totalPages),void 0!==t.totalRows&&(d=t.totalRows),void 0!==t.prevIcon&&(c=t.prevIcon),void 0!==t.nextIcon&&(h=t.nextIcon),n||!l?p.style.display="none":(p.style.display="flex",f())},destroy:()=>{p.remove()}}})({currentPage:n,hideFooter:null!==(p=o.config.hideFooter)&&void 0!==p&&p,onPageChange:i,onNextPage:o.config.onNextPage,onUserPageChange:o.config.onPageChange,rowsPerPage:x,shouldPaginate:null!==(f=o.config.shouldPaginate)&&void 0!==f&&f,totalPages:b,totalRows:e,prevIcon:null===(v=o.resolvedIcons)||void 0===v?void 0:v.prev,nextIcon:null===(w=o.resolvedIcons)||void 0===w?void 0:w.next});this.footerInstance=s,t.appendChild(s.element)}}renderColumnEditor(t,e,n,i,o){if(!t)return;if(!o.config.editColumns)return void(this.columnEditorInstance&&(this.columnEditorInstance.destroy(),this.columnEditorInstance=null));const s=()=>{const t=o.config.defaultHeaders;if(t){const e=t.map(t=>Object.assign({},t));o.setHeaders(e),o.onRender()}};if(this.columnEditorInstance)this.columnEditorInstance.update({columnEditorText:i.text,editColumns:o.config.editColumns,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,editColumns:n,headers:i,open:o,searchEnabled:s,searchPlaceholder:r,searchFunction:l,columnEditorConfig:a,icons:d,essentialAccessors:c,resetColumns:h,setHeaders:u,onColumnVisibilityChange:p,onColumnOrderChange:f,setOpen:v}=t;if(!n)return{element:document.createElement("div"),update:()=>{},destroy:()=>{}};const w=document.createElement("div");w.className="st-column-editor "+(o?"open":""),w.style.width="29.5px";const m=t=>{v(!o)},g=document.createElement("div");g.className="st-column-editor-text",g.textContent=e,w.addEventListener("click",m),w.appendChild(g);const x=ti({headers:i,open:o,searchEnabled:s,searchPlaceholder:r,searchFunction:l,columnEditorConfig:a,icons:d,essentialAccessors:c,resetColumns:h,setHeaders:u,onColumnVisibilityChange:p,onColumnOrderChange:f});w.appendChild(x.element);const b={update:t=>{void 0!==t.open&&(o=t.open,t.open?w.classList.add("open"):w.classList.remove("open")),void 0!==t.setOpen&&(v=t.setOpen),void 0!==t.columnEditorText&&(g.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.removeEventListener("click",m),x.destroy(),w.remove()}};return w.__columnEditor=b,Object.assign({element:w},b)})({columnEditorText:i.text,editColumns:o.config.editColumns,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;if(t&&l.mainBodyRef.current&&r)return l.mainBodyRef.current.scrollWidth-l.mainBodyRef.current.clientWidth>1?void(this.horizontalScrollbarRef.current&&t.contains(this.horizontalScrollbarRef.current)?gn(this.horizontalScrollbarRef.current,{mainBodyRef:l.mainBodyRef.current,mainBodyWidth:e,pinnedLeftWidth:n,pinnedRightWidth:i,pinnedLeftContentWidth:o,pinnedRightContentWidth:s,tableBodyContainerRef:r,editColumns:null!==(a=l.config.editColumns)&&void 0!==a&&a,sectionScrollController:null!==(d=l.sectionScrollController)&&void 0!==d?d:void 0}):(null!==this.scrollbarTimeoutId&&(clearTimeout(this.scrollbarTimeoutId),this.scrollbarTimeoutId=null),this.scrollbarTimeoutId=window.setTimeout(()=>{var a,d,c,h;if(!l.mainBodyRef.current||!r||!t)return;if(this.horizontalScrollbarRef.current&&t.contains(this.horizontalScrollbarRef.current))return gn(this.horizontalScrollbarRef.current,{mainBodyRef:l.mainBodyRef.current,mainBodyWidth:e,pinnedLeftWidth:n,pinnedRightWidth:i,pinnedLeftContentWidth:o,pinnedRightContentWidth:s,tableBodyContainerRef:r,editColumns:null!==(a=l.config.editColumns)&&void 0!==a&&a,sectionScrollController:null!==(d=l.sectionScrollController)&&void 0!==d?d:void 0}),void(this.scrollbarTimeoutId=null);this.sectionScrollController=null!==(c=l.sectionScrollController)&&void 0!==c?c:null;const u=(t=>{const{mainBodyRef:e,mainBodyWidth:n,pinnedLeftWidth:i,pinnedRightWidth:o,pinnedLeftContentWidth:s,pinnedRightContentWidth:r,tableBodyContainerRef:l,editColumns:a,sectionScrollController:d}=t;if(1>=e.scrollWidth-e.clientWidth)return null;const c=a?P:0,h=(a?o+1:o)+(l.scrollHeight>l.clientHeight?l.offsetWidth-l.clientWidth:0),u=document.createElement("div");if(u.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),u.appendChild(t),null==d||d.registerPane("pinned-left",t,"scrollbar")}if(n>0){const t=document.createElement("div");t.className="st-horizontal-scrollbar-middle";const e=document.createElement("div");e.style.width=n+"px",t.appendChild(e),u.appendChild(t),null==d||d.registerPane("main",t,"scrollbar")}if(o>0){const t=document.createElement("div");t.className="st-horizontal-scrollbar-right",t.style.width=h+"px";const e=document.createElement("div");e.style.width=r+"px",t.appendChild(e),u.appendChild(t),null==d||d.registerPane("pinned-right",t,"scrollbar")}if(c>0){const t=document.createElement("div");t.style.width=c-1.5+"px",t.style.height="100%",t.style.flexShrink="0",u.appendChild(t)}return u})({mainBodyRef:l.mainBodyRef.current,mainBodyWidth:e,pinnedLeftWidth:n,pinnedRightWidth:i,pinnedLeftContentWidth:o,pinnedRightContentWidth:s,tableBodyContainerRef:r,editColumns:null!==(h=l.config.editColumns)&&void 0!==h&&h,sectionScrollController:this.sectionScrollController});if(u){const e=t.querySelector(".st-content-wrapper");e&&e.nextSibling?t.insertBefore(u,e.nextSibling):t.appendChild(u),this.horizontalScrollbarRef.current=u}this.scrollbarTimeoutId=null},1))):(this.horizontalScrollbarRef.current&&(xn(this.horizontalScrollbarRef.current,l.sectionScrollController),this.horizontalScrollbarRef.current=null),void(null!==this.scrollbarTimeoutId&&(clearTimeout(this.scrollbarTimeoutId),this.scrollbarTimeoutId=null)))}cleanup(){var t,e;this.sectionRenderer.cleanup(),null===(t=this.footerInstance)||void 0===t||t.destroy(),null===(e=this.columnEditorInstance)||void 0===e||e.destroy(),null!==this.scrollbarTimeoutId&&(clearTimeout(this.scrollbarTimeoutId),this.scrollbarTimeoutId=null),this.horizontalScrollbarRef.current&&(xn(this.horizontalScrollbarRef.current,this.sectionScrollController),this.horizontalScrollbarRef.current=null),this.stickyParentsContainer&&(ni(this.stickyParentsContainer,this.sectionScrollController),this.stickyParentsContainer=null),this.sectionScrollController=null}}function oi(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:p=40,customTheme:f}=t;if(!n||0===n.length){const t=e.map((t,e)=>{const n=[e],o=[e];return{row:t,depth:0,displayPosition:e,groupingKey:void 0,position:e,rowId:tt({row:t,getRowId:i,depth:0,index:e,rowPath:n,rowIndexPath:o,groupingKey:void 0}),rowPath:n,rowIndexPath:o,absoluteRowIndex:e,isLastGroupRow:!1,stableRowKey:ot({getRowId:i,row:t,depth:0,index:e,rowPath:n,rowIndexPath:o,groupingKey:void 0,parentStableKey:null})}});return{flattenedRows:t,heightOffsets:[],paginatableRows:t,parentEndPositions:e.map((t,e)=>e+1)}}const v=[],w=[],m=[],g=[];let x=0;const b=(t,e,y=[],R=[],C=[],S=null)=>{t.forEach((t,I)=>{var H,M;const k=n[e],E=v.length,T=[...y,I],A=[...R,I],O=tt({row:t,getRowId:i,depth:e,index:I,rowPath:T,rowIndexPath:A,groupingKey:k}),W=ot({getRowId:i,row:t,depth:e,index:I,rowPath:T,rowIndexPath:A,groupingKey:k,parentStableKey:S}),P=v.length,$={row:t,depth:e,displayPosition:x,groupingKey:k,position:E,isLastGroupRow:!1,rowId:O,rowPath:T,rowIndexPath:A,absoluteRowIndex:E,parentIndices:C.length>0?[...C]:void 0,stableRowKey:W};v.push($),w.push($),x++;const F=st({stableRowKey:W,rowId:O});if(at(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 Z(n)?n:[]})(t,k),o=h.find(t=>t.expandable&&t.nestedTable);if((null==o?void 0:o.nestedTable)&&i.length>0){const n=v.length,s=(null===(H=o.nestedTable.customTheme)||void 0===H?void 0:H.rowHeight)||u,r=(null===(M=o.nestedTable.customTheme)||void 0===M?void 0:M.headerHeight)||p,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:f}),a=_({calculatedHeight:l,customHeight:o.nestedTable.height,customTheme:f});m.push([n,a-u]);const d=[...T,k];v.push({row:{},depth:e+1,displayPosition:x-1,groupingKey:k,position:n,isLastGroupRow:!1,rowId:d,rowPath:d,rowIndexPath:A,stableRowKey:rt(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=v.length,o=[...T,k];v.push({row:{},depth:e+1,displayPosition:x-1,groupingKey:k,position:i,isLastGroupRow:!1,rowId:o,rowPath:o,rowIndexPath:A,stableRowKey:rt(F,k),stateIndicator:{parentRowId:F,parentRow:t,state:n},absoluteRowIndex:i,parentIndices:[...C,P]})}else if(n.loading&&!a){const t=v.length,n=[...T,k,"loading-skeleton"];v.push({row:{},depth:e+1,displayPosition:x-1,groupingKey:k,position:t,isLastGroupRow:!1,rowId:n,rowPath:n,rowIndexPath:A,isLoadingSkeleton:!0,absoluteRowIndex:t,parentIndices:[...C,P]})}}else if(i.length>0){const t=[...T,k],n=[...A];b(i,e+1,t,n,[...C,P],W)}}0===e&&g.push(v.length)})};return b(e,0,[],[],[]),g.forEach((t,e)=>{const n=t-1;n>=0&&v.length>n&&(v[n].isLastGroupRow=!0)}),{flattenedRows:v,heightOffsets:m,paginatableRows:w,parentEndPositions:g}}class si{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 ii}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)}computeEffectiveHeaders(t,e,n,i){var o;let s=[...t];return e.enableRowSelection&&!(null===(o=null==t?void 0:t[0])||void 0===o?void 0:o.isSelectionColumn)&&(s=[{accessor:"__row_selection__",label:"",width:n.selectionColumnWidth,isEditable:!1,type:"boolean",pinned:"left",isSelectionColumn:!0,isSortable:!1,filterable:!1,align:"center"},...s]),null!=i&&i>0?pt(s,{containerWidth:i}):pt(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,p,f,v,w,m,g,x,b;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:C,maxHeaderDepth:S}=y,I=0===t.collapsedHeaders.size?"":[...t.collapsedHeaders].map(String).sort().join("\0");let H;t.positionOnlyBody&&!0!==t.config.autoExpandColumns&&this.scrollRafHeadersMemo&&this.scrollRafHeadersMemo.headersRef===t.headers&&this.scrollRafHeadersMemo.containerWidth===R&&this.scrollRafHeadersMemo.collapsedKey===I?H=this.scrollRafHeadersMemo.effectiveHeaders:(H=this.computeEffectiveHeaders(t.headers,t.config,t.customTheme,R),this.scrollRafHeadersMemo=!0!==t.config.autoExpandColumns?{headersRef:t.headers,containerWidth:R,collapsedKey:I,effectiveHeaders:H}:null);const{leftWidth:M,rightWidth:k}=yn({headers:H,containerWidth:R,collapsedHeaders:t.collapsedHeaders});t.config.autoExpandColumns&&R>0&&(H=Rt(H,{autoExpandColumns:!0,containerWidth:R,pinnedLeftWidth:M,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 E=t.localRows;if(t.sortManager?E=t.sortManager.getSortedRows():t.filterManager&&(E=t.filterManager.getFilteredRows()),this.lastRowsRef!==E&&(this.invalidateCache("body"),this.invalidateCache("context"),this.lastRowsRef=E),t.internalIsLoading&&0===E.length){let n=t.config.shouldPaginate&&null!==(o=t.config.rowsPerPage)&&void 0!==o?o:10;e.isMainSectionScrollable&&(n+=1),E=Array.from({length:n},()=>({}))}const T=null===(s=t.sortManager)||void 0===s?void 0:s.getState(),A=null===(r=t.filterManager)||void 0===r?void 0:r.getState(),O=(null==T?void 0:T.sort)?`${T.sort.key.accessor}-${T.sort.direction}`:"none",P=JSON.stringify((null==A?void 0:A.filters)||{}),$=t.config.quickFilter,F=$?`${null!==(l=$.text)&&void 0!==l?l:""}|${null!==(a=$.mode)&&void 0!==a?a:"simple"}`:"",L=this.flattenedRowsCache&&this.flattenedRowsCache.deps.rowsRef===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,B,j;L&&this.flattenedRowsCache?(D=this.flattenedRowsCache.aggregatedRows,B=this.flattenedRowsCache.quickFilteredRows,j=this.flattenedRowsCache.flattenResult):(D=t.sortManager?E:Tt({rows:E,headers:t.headers,rowGrouping:t.config.rowGrouping}),B=(({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=>!t.hide&&!t.excludeFromRender&&(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=X(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=X(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:H,quickFilter:t.config.quickFilter}),j=oi({rows:B,rowGrouping:t.config.rowGrouping,getRowId:t.config.getRowId,expandedRows:t.expandedRows,collapsedRows:t.collapsedRows,expandedDepths:t.expandedDepths,rowStateMap:t.rowStateMap,hasLoadingRenderer:!!t.config.loadingStateRenderer,hasErrorRenderer:!!t.config.errorStateRenderer,hasEmptyRenderer:!!t.config.emptyStateRenderer,headers:H,rowHeight:t.customTheme.rowHeight,headerHeight:t.customTheme.headerHeight,customTheme:t.customTheme}),this.flattenedRowsCache={aggregatedRows:D,quickFilteredRows:B,flattenResult:j,deps:{rowsRef: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=(({height:t,maxHeight:e,rowHeight:n,totalRowCount:i,headerHeight:o,footerHeight:s,externalViewportHeight:r})=>{if(e){const t=St(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=St(t);return 0!==l?Math.max(0,l-n):void 0})({height:t.config.height,maxHeight:t.config.maxHeight,rowHeight:t.customTheme.rowHeight,shouldPaginate:null!==(d=t.config.shouldPaginate)&&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:j.paginatableRows.length,headerHeight:C,footerHeight:!t.config.shouldPaginate&&!t.config.footerRenderer||t.config.hideFooter?void 0:t.customTheme.footerHeight,externalViewportHeight:t.externalViewportHeight}),N=null!==(u=t.config.shouldPaginate)&&void 0!==u&&u,q=null!==(p=t.config.rowsPerPage)&&void 0!==p?p:10,V=null!==(f=t.config.serverSidePagination)&&void 0!==f&&f,G=null!==(v=t.config.totalRowCount)&&void 0!==v?v:j.paginatableRows.length,K=null!==(m=null===(w=t.config.rowGrouping)||void 0===w?void 0:w.join("\0"))&&void 0!==m?m:"",U=null!==(x=null===(g=j.heightOffsets)||void 0===g?void 0:g.length)&&void 0!==x?x:0;let J=0;if(j.heightOffsets)for(const[,t]of j.heightOffsets)J+=t;const _=null!==(b=t.config.enableStickyParents)&&void 0!==b&&b,Y=void 0===z?"":`${L?1:0}|${z}|${e.currentPage}|${q}|${N}|${V}|${t.customTheme.rowHeight}|${C}|${G}|${_}|${K}|${j.flattenedRows.length}|${U}|${J}`;let Q;return t.positionOnlyBody&&void 0!==z&&null!==this.processRowsScrollReuseKey&&null!==this.processRowsScrollReuseBase&&this.processRowsScrollReuseKey===Y&&this.processRowsScrollReuseBase?Q=function(t,e){const{contentHeight:n,rowHeight:i,scrollDirection:o="none",scrollTop:s,enableStickyParents:r,rowGrouping:l}=e,a=W(i),{currentTableRows:d,paginatedHeightOffsets:c,heightMap:h}=t;let u,p,f,v,w=0,m=d.length;if(void 0===n)u=d,p=[],f=u,v=[];else{const t=Dt({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=qt(d,t.rendered.rows,t.fullyVisible.rows,t.partiallyVisible.rows,l);p=e.stickyParents,f=e.regularRows,v=t.partiallyVisible.rows}else p=[],f=t.rendered.rows,v=[];else p=[],f=u,v=[]}return{currentTableRows:d,rowsToRender:u,renderedStartIndex:w,renderedEndIndex:m,stickyParents:p,regularRows:f,partiallyVisibleRows:v,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:_,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:p,shouldPaginate:f,rowGrouping:v}=t,w=W(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,f,p);let g=0;if(f&&!p){const t=(i-1)*c;g=0===t?0:null!==(e=a[t-1])&&void 0!==e?e:0}const x=l&&0!==l.length&&f&&!p?(()=>{const t=new Map;return m.forEach(e=>{e.nestedTable&&t.set(e.absoluteRowIndex,e.position)}),l.filter(([e])=>t.has(e)).map(([e,n])=>[t.get(e),n])})():l,b=x&&x.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,x,o):void 0;let y,R,C,S,I=0,H=m.length;if(void 0===n)y=m,R=[],C=y,S=[];else{const t=Dt({bufferRowCount:w,contentHeight:n,tableRows:m,rowHeight:d,scrollTop:u,scrollDirection:h,heightMap:b});if(y=t.rendered.rows,I=t.rendered.startIndex,H=t.rendered.endIndex,s)if(v){const e=qt(m,t.rendered.rows,t.fullyVisible.rows,t.partiallyVisible.rows,v);R=e.stickyParents,C=e.regularRows,S=t.partiallyVisible.rows}else R=[],C=t.rendered.rows,S=[];else R=[],C=y,S=[]}return{currentTableRows:m,rowsToRender:y,renderedStartIndex:I,renderedEndIndex:H,stickyParents:R,regularRows:C,partiallyVisibleRows:S,paginatedHeightOffsets:x,heightMap:b,allFlattenedRows:r,pageStartIndex:g}}({flattenedRows:j.flattenedRows,paginatableRows:j.paginatableRows,parentEndPositions:j.parentEndPositions,currentPage:e.currentPage,rowsPerPage:q,shouldPaginate:N,serverSidePagination:V,contentHeight:z,rowHeight:t.customTheme.rowHeight,scrollTop:e.scrollTop,scrollDirection:e.scrollDirection,heightOffsets:j.heightOffsets,customTheme:t.customTheme,enableStickyParents:_,rowGrouping:t.config.rowGrouping}),void 0!==z?(this.processRowsScrollReuseKey=Y,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:H,calculatedHeaderHeight:C,maxHeaderDepth:S,flattenResult:j,processedResult:Q}}render(t,e,n,i,o){var s,r,l,a,d,c,h,u,p;const f=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,v=this.buildRowModelSnapshot(n,i);if(!v)return;const{dimensionState:w,containerWidth:m,effectiveHeaders:g,calculatedHeaderHeight:x,maxHeaderDepth:b,flattenResult:y,processedResult:R}=v;this.lastProcessedResult=R;const C=!0===n.positionOnlyBody;if(C&&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:S,leftWidth:I,rightWidth:H,leftContentWidth:M,rightContentWidth:k}=yn({headers:g,containerWidth:m,collapsedHeaders:n.collapsedHeaders}),E=m-I-H;if(!C){const e=t=>"number"==typeof t?t+"px":t,o=t.rootElement.style;if(n.config.maxHeight){const t=e(n.config.maxHeight);o.maxHeight=t,o.height=void 0===w.contentHeight?"auto":t}else o.removeProperty("max-height"),n.config.height?o.height=e(n.config.height):o.removeProperty("height");t.rootElement.classList.toggle("st-external-scroll",void 0!==n.externalViewportHeight);const{customTheme:s}=n;o.setProperty("--st-main-section-width",E+"px"),o.setProperty("--st-scrollbar-width",i.scrollbarWidth+"px"),o.setProperty("--st-editor-width",(n.config.editColumns?P:0)+"px"),o.setProperty("--st-border-width",s.borderWidth+"px"),o.setProperty("--st-footer-height",s.footerHeight+"px"),o.setProperty("--st-calculated-header-height",x+"px");const r=null!==(u=n.config.columnResizing)&&void 0!==u&&u;t.content.className="st-content "+(r?"st-resizeable":"st-not-resizeable"),t.content.style.width=n.config.editColumns?"calc(100% - 29.5px)":"100%",this.renderHeader(t.headerContainer,x,b,g,n)}this.renderBody(t.bodyContainer,R,g,n,i),this.lastScrollRafPaintedRange=C?{start:R.renderedStartIndex,end:R.renderedEndIndex}:null,this.registerSectionPanes(n);const T=n.sectionScrollController;T&&(T.setSectionScrollLeft("main",f),null!=n.pinnedLeftRef.current&&T.setSectionScrollLeft("pinned-left",n.pinnedLeftRef.current.scrollLeft),null!=n.pinnedRightRef.current&&T.setSectionScrollLeft("pinned-right",n.pinnedRightRef.current.scrollLeft),T.restoreAll()),C||(this.renderFooter(t.footerContainer,null!==(p=n.config.totalRowCount)&&void 0!==p?p:y.paginatableRows.length,i.currentPage,g,n),this.renderColumnEditor(t.contentWrapper,i.columnEditorOpen,o,g,n),this.renderHorizontalScrollbar(t.wrapperContainer,S,I,H,M,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||!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,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,setIsResizing:e.setIsResizing,setHeaders:e.setHeaders,setCollapsedHeaders:e.setCollapsedHeaders,setCollapsedRows:e.setCollapsedRows,setExpandedRows:e.setExpandedRows,setRowStateMap:e.setRowStateMap,getCollapsedRows:e.getCollapsedRows,getCollapsedHeaders:e.getCollapsedHeaders,getExpandedRows:e.getExpandedRows,getHeaders:e.getHeaders,getRowStateMap:e.getRowStateMap,positionOnlyBody:e.positionOnlyBody,essentialAccessors:e.essentialAccessors}}cleanup(){this.tableRenderer.cleanup()}}const ri=t=>{if(null==t)return"";const e=t+"";return e.includes(",")||e.includes('"')||e.includes("\n")||e.includes("\r")?`"${e.replace(/"/g,'""')}"`:e};class li{static createAPI(t){const e=()=>{var e;return(null===(e=t.getCachedFlattenResult)||void 0===e?void 0:e.call(t))||oi({rows:t.localRows,rowGrouping:t.config.rowGrouping,getRowId:t.config.getRowId,expandedRows:t.expandedRows,collapsedRows:t.collapsedRows,expandedDepths:t.expandedDepths,rowStateMap:t.rowStateMap,hasLoadingRenderer:!!t.config.loadingStateRenderer,hasErrorRenderer:!!t.config.errorStateRenderer,hasEmptyRenderer:!!t.config.emptyStateRenderer,headers:t.effectiveHeaders,rowHeight:t.customTheme.rowHeight,headerHeight:t.customTheme.headerHeight,customTheme:t.customTheme})},n=new Map;let i=!1,o=!1;const s=()=>{if(i=!1,0===n.size)return;let e=!1;n.forEach((i,o)=>{var s,r;if(null===(s=t.isCellAnimating)||void 0===s?void 0:s.call(t,o))return void(e=!0);const l=null===(r=t.cellRegistry)||void 0===r?void 0:r.get(o);l&&l.updateContent(i),n.delete(o)}),e&&n.size>0&&l()},r=()=>{i||(i=!0,queueMicrotask(s))},l=()=>{o||(o=!0,setTimeout(()=>{o=!1,n.size>0&&r()},120))};let a=null;return{updateData:e=>{var i;const{rowIndex:o,accessor:s,newValue:l}=e;if(o>=0&&t.localRows.length>o){const e=t.localRows[o];e[s]=l;const d=(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(!a||a.rowsRef!==o){const t=new WeakMap;for(const e of o)e.row&&t.set(e.row,e);a={rowsRef:o,map:t}}return a.map.get(e)}})(e),c=d?null!==(i=d.stableRowKey)&&void 0!==i?i:et(d.rowId):ot({getRowId:t.config.getRowId,row:e,depth:0,index:o,rowPath:[o],rowIndexPath:[o]}),h=J({accessor:s,rowId:c});n.set(h,l),r()}},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=>ri(t.label)).join(","),s=t.map((t,e)=>{const n=t.row;return i.map((t,i)=>{const o=X(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 ri(r)}if(!1!==t.useFormattedValueForCSV&&t.valueFormatter){const s=t.valueFormatter({accessor:t.accessor,colIndex:i,row:n,rowIndex:e,value:o});return ri(s)}return ri(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:()=>Ve(t.headers),applyPinnedState:async e=>{const n=Ke(t.headers,e,t.essentialAccessors);n&&(t.setHeaders(n),t.onRender())},resetColumns:()=>{t.setHeaders(Pe(t.config.defaultHeaders)),t.onRender()},getFilterState:()=>{var e,n;return null!==(n=null===(e=t.filterManager)||void 0===e?void 0:e.getFilters())&&void 0!==n?n:{}},applyFilter:async e=>{t.filterManager&&t.filterManager.updateFilter(e)},clearFilter:async e=>{t.filterManager&&t.filterManager.clearFilter(e)},clearAllFilters:async()=>{t.filterManager&&t.filterManager.clearAllFilters()},getCurrentPage:()=>t.getCurrentPage(),getTotalPages:()=>{var n,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.config.rowGrouping)||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.config.rowGrouping)||void 0===n?void 0:n[e]},getGroupingDepth:e=>{var n,i;return null!==(i=null===(n=t.config.rowGrouping)||void 0===n?void 0:n.indexOf(e))&&void 0!==i?i:-1},toggleColumnEditor:e=>{t.config.editColumns&&(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 je(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)}}}}const ai=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}},di=()=>"undefined"!=typeof window&&window.innerHeight>0?window.innerHeight:1/0,ci=(t,e)=>{if(!t||!e)return null;const n=ai(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),di());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 hi{constructor(t,e){var n,i;this.draggedHeaderRef={current:null},this.hoveredHeaderRef={current:null},this.localRows=[],this.headers=[],this.essentialAccessors=new Set,this.autoSizeAccessors=new Set,this.pendingAutoSize=new Set,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.headerRegistry=new Map,this.rowIndexMap=new Map,this.autoScaleManager=null,this.dimensionManager=null,this.scrollManager=null,this.sectionScrollController=null,this.sortManager=null,this.filterManager=null,this.selectionManager=null,this.rowSelectionManager=null,this.windowResizeManager=null,this.handleOutsideClickManager=null,this.scrollbarVisibilityManager=null,this.expandedDepthsManager=null,this.ariaAnnouncementManager=null,this.mounted=!1,this.scrollRafId=null,this.scrollEndTimeoutId=null,this.lastScrollTop=0,this.isUpdating=!1,this.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=e,this.customTheme=Je.mergeCustomTheme(e),this.mergedColumnEditorConfig=Je.mergeColumnEditorConfig(e),this.resolvedIcons=Je.resolveIcons(e),this.localRows=[...e.rows],this.headers=[...e.defaultHeaders],this.essentialAccessors=Je.buildEssentialAccessors(this.headers),this.columnEditorOpen=null!==(n=e.editColumnsInitOpen)&&void 0!==n&&n,this.internalIsLoading=null!==(i=e.isLoading)&&void 0!==i&&i,this.collapsedHeaders=Je.getInitialCollapsedHeaders(e.defaultHeaders),this.expandedDepths=Je.getInitialExpandedDepths(e),this.autoSizeAccessors=this.computeAutoSizeAccessors(),this.pendingAutoSize=new Set(this.autoSizeAccessors),this.domManager=new _e,this.renderOrchestrator=new si,this.animationCoordinator=new k,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=tt({row:t,getRowId:this.config.getRowId,depth:0,index:e,rowPath:[e],rowIndexPath:[e]}),i=et(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(t.hide||t.excludeFromRender)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=ci(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(i.hide||i.excludeFromRender)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;if(!this.animationCoordinator.isEnabled())return;if(null===t)return;this.captureAnimationSnapshot(),this.animationCoordinator.setAccordionPreVisibleAccessors("horizontal"===t?this.collectAccordionRenderableAccessors():null),this.pendingAccordionAxis=t;const i=this.animationCoordinator.getDuration(),o=this.animationCoordinator.getEasing(),s=null!==(n=null===(e=this.domManager.getElements())||void 0===e?void 0:e.rootElement)&&void 0!==n?n:this.container;s.style.setProperty(Le,i+"ms"),s.style.setProperty(De,o),s.classList.add(Fe),null!==this.accordionCleanupTimerId&&window.clearTimeout(this.accordionCleanupTimerId),this.accordionCleanupTimerId=window.setTimeout(()=>{s.classList.remove(Fe),s.style.removeProperty(Le),s.style.removeProperty(De),this.accordionCleanupTimerId=null},i+80)}initializeManagers(){var t,e,n;this.ariaAnnouncementManager=new oe,this.ariaAnnouncementManager.subscribe(t=>{this.announcement=t,this.updateAriaLiveRegion()}),this.expandedDepthsManager=new ie(null===(t=this.config.expandAll)||void 0===t||t,this.config.rowGrouping),this.expandedDepthsManager.subscribe(t=>{this.beginAccordionAnimation("vertical"),this.expandedDepths=t,this.render("expandedDepthsManager")});const i=t=>{this.ariaAnnouncementManager&&this.ariaAnnouncementManager.announce(t)};this.sortManager=new At({headers:this.headers,tableRows:this.localRows,externalSortHandling:this.config.externalSortHandling||!1,onSortChange:this.config.onSortChange,rowGrouping:this.config.rowGrouping,initialSortColumn:this.config.initialSortColumn,initialSortDirection:this.config.initialSortDirection,announce:i}),this.sortManager.subscribe(t=>{this.captureAnimationSnapshot(),this.render("sortManager")}),this.filterManager=new $t({rows:this.localRows,headers:this.headers,externalFilterHandling:this.config.externalFilterHandling||!1,onFilterChange:this.config.onFilterChange,announce:i}),this.filterManager.subscribe(t=>{this.sortManager&&this.sortManager.updateConfig({tableRows:t.filteredRows}),this.render("filterManager")}),this.selectionManager=new Yt({selectableCells:null!==(e=this.config.selectableCells)&&void 0!==e&&e,selectableColumns:null!==(n=this.config.selectableColumns)&&void 0!==n&&n,headers:this.headers,tableRows:[],onCellEdit:this.config.onCellEdit,cellRegistry:this.cellRegistry,collapsedHeaders:this.collapsedHeaders,rowHeight:this.customTheme.rowHeight,enableRowSelection:this.config.enableRowSelection,copyHeadersToClipboard:this.config.copyHeadersToClipboard,customTheme:this.customTheme,tableRoot:this.container,onSelectionDragEnd:()=>{this.renderOrchestrator.invalidateCache("context"),this.renderOrchestrator.invalidateCache("body"),this.render("selectionDragEnd")}})}mount(){this.mounted?console.warn("SimpleTableVanilla: Table is already mounted"):(this.domManager.createDOMStructure(this.container,this.config),this.mounted=!0,this.setupManagers())}setupManagers(){var t,e,n;const i=this.domManager.getRefs(),o=this.domManager.getElements();if(!i.tableBodyContainerRef.current||!o)return;this.scrollbarWidth=se(i.tableBodyContainerRef.current);const s=this.renderOrchestrator.computeEffectiveHeaders(this.headers,this.config,this.customTheme);this.dimensionManager=new It({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.shouldPaginate&&!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.onGridReady&&this.config.onGridReady())}),this.scrollManager=new Ht({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 Mt({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 Ct({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 ee({headerContainer:i.headerContainerRef.current,mainSection:i.tableBodyContainerRef.current,scrollbarWidth:this.scrollbarWidth}),this.scrollbarVisibilityManager.subscribe(t=>{this.isMainSectionScrollable=t,i.tableBodyContainerRef.current&&(this.scrollbarWidth=se(i.tableBodyContainerRef.current)),this.render("scrollbarVisibilityManager")})),this.windowResizeManager=new Zt,this.windowResizeManager.addCallback(()=>{var t;if(i.tableBodyContainerRef.current){const e=se(i.tableBodyContainerRef.current);this.scrollbarWidth=e,null===(t=this.scrollbarVisibilityManager)||void 0===t||t.setScrollbarWidth(e)}this.render("scrollbarWidth-change")}),this.config.enableRowSelection&&(this.rowSelectionManager=new Qt({tableRows:[],onRowSelectionChange:this.config.onRowSelectionChange,enableRowSelection:!0}),this.rowSelectionManager.subscribe(()=>{this.render("rowSelectionManager")})),this.selectionManager&&(this.handleOutsideClickManager=new te({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&&hi.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=ci(this.resolvedScrollParent,n);if(!i)return;let o=i.visibleViewportHeight;o>0||(o=(()=>{const t=ai(this.resolvedScrollParent);return t?Math.min(t.height,di()):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=ci(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)}getRenderContext(){const t=this.domManager.getRefs();return{accordionAxis:this.pendingAccordionAxis,config:this.config,customTheme:this.customTheme,resolvedIcons:this.resolvedIcons,effectiveHeaders:[],essentialAccessors:this.essentialAccessors,headers:this.headers,localRows:this.localRows,collapsedHeaders:this.collapsedHeaders,collapsedRows:this.collapsedRows,expandedRows:this.expandedRows,expandedDepths:this.expandedDepths,isResizing:this.isResizing,internalIsLoading:this.internalIsLoading,createNestedTable:(t,e)=>new hi(t,e),cellRegistry:this.cellRegistry,headerRegistry:this.headerRegistry,draggedHeaderRef:this.draggedHeaderRef,hoveredHeaderRef:this.hoveredHeaderRef,mainBodyRef:t.mainBodyRef,pinnedLeftRef:t.pinnedLeftRef,pinnedRightRef:t.pinnedRightRef,mainHeaderRef:t.mainHeaderRef,pinnedLeftHeaderRef:t.pinnedLeftHeaderRef,pinnedRightHeaderRef:t.pinnedRightHeaderRef,dimensionManager:this.dimensionManager,scrollManager:this.scrollManager,sectionScrollController:this.sectionScrollController,sortManager:this.sortManager,filterManager:this.filterManager,selectionManager:this.selectionManager,rowSelectionManager:this.rowSelectionManager,rowStateMap:this.rowStateMap,positionOnlyBody:this._positionOnlyBody,externalViewportHeight:this.externalViewportHeight>0?this.externalViewportHeight:void 0,onRender:()=>this.render("resizeHandler-onRender"),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=Pe(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,getRowStateMap:()=>this.rowStateMap,setColumnEditorOpen:t=>{this.columnEditorOpen=t},setCurrentPage:t=>{t!==this.currentPage&&this.config.shouldPaginate&&!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;if(this.config.autoExpandColumns)return t;const e=mt(this.headers,this.collapsedHeaders);for(const n of e)this.isAutoSizeLeaf(n)&&t.add(n.accessor);return t}getAutoSizeStyleRoot(){var t,e;const n=null===(t=this.domManager.getRefs().mainBodyRef)||void 0===t?void 0:t.current;return n?null!==(e=n.closest(".simple-table-root"))&&void 0!==e?e:n:null}getAutoSizeRows(){if(this.config.shouldPaginate&&!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}applyMeasuredWidths(t){const e=n=>{const i=Object.assign({},n);return n.children&&n.children.length>0?i.children=n.children.map(e):t.has(n.accessor)&&(i.width=t.get(n.accessor)),i};this.headers=this.headers.map(e)}maybeAutoSizeColumns(){if(!this.isAutoSizing&&0!==this.pendingAutoSize.size)if(this.config.autoExpandColumns)this.pendingAutoSize.clear();else if([...this.pendingAutoSize].some(t=>document.getElementById(J({accessor:t,rowId:"header"})))){this.isAutoSizing=!0;try{const t=this.getAutoSizeStyleRoot(),e=mt(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 r=gt(e,{rows:i,header:s,styleRoot:t,theme:this.config.theme,autoSizeMode:s.autoSizeMode});o.set(e,r)}if(this.pendingAutoSize.clear(),0===o.size)return;this.applyMeasuredWidths(o),this.renderOrchestrator.invalidateCache("header");const s=this.domManager.getElements(),r=this.domManager.getRefs();s&&this.renderOrchestrator.render(s,r,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&&this.animationCoordinator.play({containers:this.getAnimatableContainers()}),this.maybeScheduleUnvirtualizedRowsWarning())}maybeScheduleUnvirtualizedRowsWarning(){var t,e,n;(()=>{try{return"undefined"!=typeof process&&!!process.env&&"production"!==process.env.NODE_ENV}catch(t){return!1}})()&&(this.hasWarnedUnvirtualizedRows||null===this.unvirtualizedRowsCheckTimeoutId&&"undefined"!=typeof window&&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(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,s,r,l,a;if(this.isUpdating=!0,this.config=Object.assign(Object.assign({},this.config),t),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.sortManager&&this.sortManager.updateConfig({tableRows:this.localRows}),this.autoSizeAccessors.forEach(t=>this.pendingAutoSize.add(t))),void 0===t.rows&&void 0===t.totalRowCount||null===(n=this.dimensionManager)||void 0===n||n.updateConfig({totalRowCount:null!==(i=this.config.totalRowCount)&&void 0!==i?i:this.localRows.length}),void 0!==t.defaultHeaders&&(this.captureAnimationSnapshot(),this.headers=[...t.defaultHeaders],this.essentialAccessors=Je.buildEssentialAccessors(this.headers),this.autoSizeAccessors=this.computeAutoSizeAccessors(),this.pendingAutoSize=new Set(this.autoSizeAccessors),this.filterManager&&this.filterManager.updateConfig({headers: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})}if(void 0!==t.isLoading&&(this.internalIsLoading=t.isLoading),void 0!==t.theme&&this.domManager.updateTheme(t.theme),void 0!==t.footerPosition&&this.domManager.syncFooterPosition(this.config.footerPosition),void 0!==t.customTheme){const t=this.customTheme;this.customTheme=Je.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===(o=this.dimensionManager)||void 0===o||o.updateConfig({headerHeight:this.customTheme.headerHeight,rowHeight:this.customTheme.rowHeight,footerHeight:!this.config.shouldPaginate&&!this.config.footerRenderer||this.config.hideFooter?void 0:this.customTheme.footerHeight}),this.config.shouldPaginate&&t.rowHeight!==this.customTheme.rowHeight&&(this.currentPage=1),this.renderOrchestrator.invalidateCache("all"))}void 0===t.selectableColumns&&void 0===t.selectableCells||!this.selectionManager||this.selectionManager.updateConfig({selectableColumns:null!==(s=this.config.selectableColumns)&&void 0!==s&&s,selectableCells:null!==(r=this.config.selectableCells)&&void 0!==r&&r}),void 0===t.height&&void 0===t.maxHeight||null===(l=this.dimensionManager)||void 0===l||l.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!==(a=this.config.infiniteScrollThreshold)&&void 0!==a?a:200}),this.isUpdating=!1,this.render("update")}updateConfig(t){this.update(t)}destroy(){var t,e,n,i,o,s,r,l,a,d,c,h,u,p,f;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 v=this.domManager.getElements();(null==v?void 0:v.bodyContainer)&&(this.ensureBodyScrollListenerDetached(v.bodyContainer),this.bodyContainerMouseLeaveListener&&(v.bodyContainer.removeEventListener("mouseleave",this.bodyContainerMouseLeaveListener),this.bodyContainerMouseLeaveListener=null)),null!==this.accordionCleanupTimerId&&(window.clearTimeout(this.accordionCleanupTimerId),this.accordionCleanupTimerId=null);const w=null!==(e=null===(t=this.domManager.getElements())||void 0===t?void 0:t.rootElement)&&void 0!==e?e:this.container;w.classList.remove(Fe),w.style.removeProperty(Le),w.style.removeProperty(De),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.rowSelectionManager)||void 0===l||l.destroy(),null===(a=this.selectionManager)||void 0===a||a.destroy(),null===(d=this.autoScaleManager)||void 0===d||d.destroy(),null===(c=this.windowResizeManager)||void 0===c||c.destroy(),null===(h=this.handleOutsideClickManager)||void 0===h||h.destroy(),null===(u=this.scrollbarVisibilityManager)||void 0===u||u.destroy(),null===(p=this.expandedDepthsManager)||void 0===p||p.destroy(),null===(f=this.ariaAnnouncementManager)||void 0===f||f.destroy(),this.animationCoordinator.destroy(),this.cellRegistry.clear(),this.headerRegistry.clear(),w.querySelectorAll("[data-row-id]").forEach(t=>{const e=t.getAttribute("data-row-id");e&&Ee(e,t)}),this.renderOrchestrator.cleanup(),this.domManager.destroy(this.container)}getAPI(){const t=this.renderOrchestrator.computeEffectiveHeaders(this.headers,this.config,this.customTheme),e=this;return li.createAPI({config:this.config,localRows:this.localRows,effectiveHeaders:t,get headers(){return e.headers},essentialAccessors:this.essentialAccessors,customTheme:this.customTheme,currentPage:this.currentPage,getCurrentPage:()=>this.currentPage,get expandedRows(){return e.expandedRows},get collapsedRows(){return e.collapsedRows},get expandedDepths(){return e.expandedDepths},clearExpandedRows:()=>{e.expandedRows=new Map},clearCollapsedRows:()=>{e.collapsedRows=new Map},rowStateMap:this.rowStateMap,headerRegistry:this.headerRegistry,cellRegistry:this.cellRegistry,isCellAnimating:t=>this.animationCoordinator.isInFlight(t),get columnEditorOpen(){return e.columnEditorOpen},getCachedFlattenResult:()=>this.renderOrchestrator.getCachedFlattenResult(),getCachedProcessedResult:()=>this.renderOrchestrator.getLastProcessedResult(),expandedDepthsManager:this.expandedDepthsManager,selectionManager:this.selectionManager,sortManager:this.sortManager,filterManager:this.filterManager,onRender:()=>this.render("columnEditor-onRender"),setHeaders:t=>{this.didColumnVisibilityChange(t)?this.beginAccordionAnimation("horizontal"):this.captureAnimationSnapshot(),this.headers=Pe(t),this.renderOrchestrator.invalidateCache("header")},setCurrentPage:t=>{this.currentPage=t},setColumnEditorOpen:t=>{this.columnEditorOpen=t,this.render("columnEditor-toggle")}})}}hi.EXTERNAL_SCROLL_MAX_RETRIES=60,exports.SimpleTableVanilla=hi,exports.asRows=function(t){return t};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|