simple-table-core 3.8.9 → 3.9.1

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/index.es.js CHANGED
@@ -1,2 +1,2 @@
1
- const t="parentExpanded",e={rowHeight:32,headerHeight:32,footerHeight:49,rowSeparatorWidth:1,borderWidth:1,pinnedBorderWidth:1,nestedGridBorderWidth:2,nestedGridPaddingTop:8,nestedGridPaddingBottom:8,nestedGridPaddingLeft:8,nestedGridPaddingRight:8,nestedGridMaxHeight:400,selectionColumnWidth:42},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())},S=.5,C="st-cell-animating-out",I="data-animating-out",M="data-shrinking-out",H=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=W()}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;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){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(C),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(M)?(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(C),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(C),i.setAttribute(I,"true"),i.setAttribute(M,"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(M))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)&&S>Math.abs(h.styleTop-p)&&S>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;S>Math.abs(y)&&S>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)}),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.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},W=()=>{if("undefined"==typeof window||"function"!=typeof window.matchMedia)return!1;try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch(t){return!1}},O=t=>Math.ceil(800/(t+1)),F=29.5,P=150,$=["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},N=t=>t.flatMap(t=>t.children&&0!==t.children.length?N(t.children):[t]),z=t=>t.flatMap(t=>{const e=[t];return t.children&&t.children.length>0&&e.push(...z(t.children)),e}),V=(t=0)=>t?t+1:0,q=(t,e)=>{const n=z(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=q(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=N(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(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:D,mt=(t,e)=>{const n=[];return t.forEach(t=>{t.hide||n.push(...dt(t,e))}),n},gt=t=>t instanceof HTMLElement?t:document.body,xt=t=>t.replace(/["\\]/g,"\\$&"),bt=(t,e)=>{const n=document.createElement("span");n.style.visibility="hidden",n.style.position="absolute",n.style.whiteSpace="nowrap",n.style.width="auto";const i=window.getComputedStyle(e);n.style.font=i.font,n.style.fontSize=i.fontSize,n.style.fontWeight=i.fontWeight,n.style.fontFamily=i.fontFamily,n.style.letterSpacing=i.letterSpacing,n.style.padding=i.padding,n.textContent=t,document.body.appendChild(n);const o=n.offsetWidth;return document.body.removeChild(n),o},yt=(t,e)=>{var n,i,o,s,r,l;const{rows:a,header:d,maxWidth:c=L,headSampleSize:h,stridedSampleSize:u,sampleSize:p,outlierPercentile:f,outlierThreshold:v,autoSizeMode:w=(null!==(n=null==d?void 0:d.autoSizeMode)&&void 0!==n?n:"content"),theme:m,styleRoot:g,sortIcon:x}=e||{},b=null!==(i=null!=h?h:p)&&void 0!==i?i:25,y=null!=u?u:null!=p?0:75,R=null!=g?g:document,S=J({accessor:t,rowId:"header"}),C=R instanceof HTMLElement?R.querySelector(`[id="${xt(S)}"]`):document.getElementById(S),I=null!=C?C:R.querySelector(".st-header-cell");if(!I)return P;const M=window.getComputedStyle(I),H=parseFloat(M.paddingLeft)||0,k=parseFloat(M.paddingRight)||0,E=parseFloat(M.gap)||0;let T=H+k;const A=null==C?void 0:C.querySelector(".st-header-label");let W=!1;if(A){const t=A.querySelector(".st-header-label-text");if((null==d?void 0:d.headerRenderer)||!t){const t=((t,e)=>{const n=document.createElement("div");n.style.visibility="hidden",n.style.position="absolute",n.style.top="-99999px",n.style.left="-99999px",n.style.whiteSpace="nowrap",n.style.width="max-content";const i=t.cloneNode(!0);i.style.flex="none",i.style.width="max-content",i.style.minWidth="0",i.style.maxWidth="none",i.style.overflow="visible",i.style.height="auto";const o=window.getComputedStyle(t);i.style.font=o.font,i.style.fontSize=o.fontSize,i.style.fontWeight=o.fontWeight,i.style.fontFamily=o.fontFamily,i.style.letterSpacing=o.letterSpacing,n.appendChild(i);const s=gt(e);s.appendChild(n);const r=n.offsetWidth;return s.removeChild(n),r})(A,R);if(1>t){if(null==d?void 0:d.label){const t=null!==(o=R.querySelector(".st-header-label-text"))&&void 0!==o?o:A;T+=bt(d.label+"",t)}}else T+=t,W=!!A.querySelector('.st-icon-container[aria-label^="Sort"]')}else T+=bt(null!==(s=t.textContent)&&void 0!==s?s:"",t)}else if(null==d?void 0:d.label){const t=null!==(r=R.querySelector(".st-header-label-text"))&&void 0!==r?r:I;T+=bt(d.label+"",t)}const O=C?Array.from(C.children):[];let F=1;for(let t=0;O.length>t;t++){const e=O[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&&(T+=(e.offsetWidth||0)+(parseFloat(n.marginLeft)||0)+(parseFloat(n.marginRight)||0),F++,(null===(l=e.getAttribute("aria-label"))||void 0===l?void 0:l.startsWith("Sort"))&&(W=!0))}(null==d?void 0:d.isSortable)&&!W&&x&&(T+=((t,e)=>{const n=document.createElement("div");n.className="st-icon-container",n.style.visibility="hidden",n.style.position="absolute",n.style.top="-99999px",n.style.left="-99999px","string"==typeof t?n.innerHTML=t:n.appendChild(t.cloneNode(!0));const i=gt(e);i.appendChild(n);const o=window.getComputedStyle(n),s=n.offsetWidth+(parseFloat(o.marginLeft)||0)+(parseFloat(o.marginRight)||0);return i.removeChild(n),s})(x,R),F++),E>0&&F>1&&(T+=E*(F-1));let B=0;const j=d&&d.type&&$.includes(d.type);if(a&&a.length>0&&!j&&"header"!==w){const e=document.createElement("div");e.style.visibility="hidden",e.style.position="absolute",e.style.top="-99999px",e.style.left="-99999px",e.style.whiteSpace="nowrap",e.style.width="auto",e.style.display="inline-block";let n=0,i=0;const o=R.querySelector(".st-cell-content");if(o){const t=window.getComputedStyle(o);e.style.font=t.font,e.style.fontSize=t.fontSize,e.style.fontFamily=t.fontFamily,n=parseFloat(t.paddingLeft)||0,i=parseFloat(t.paddingRight)||0}document.body.appendChild(e);const s=[],r=t=>(e.textContent=t,e.offsetWidth+n+i),l=((t,e,n)=>{if(0>=t)return[];const i=Math.max(0,Math.floor(e)),o=Math.max(0,Math.floor(n));if(i+o>=t)return Array.from({length:t},(t,e)=>e);const s=new Set;for(let e=0;Math.min(i,t)>e;e++)s.add(e);const r=i,l=t-r;if(o>0&&l>0){const e=Math.max(1,Math.floor(l/o));for(let n=0;o>n;n++){const i=r+n*e;if(i>=t)break;s.add(i)}s.add(t-1)}return Array.from(s).sort((t,e)=>t-e)})(a.length,b,y);for(const o of l){const l=a[o];let c;c=(null==d?void 0:d.valueGetter)?d.valueGetter({accessor:t,row:l,rowIndex:o}):X(l,t);let h=c;(null==d?void 0:d.valueFormatter)&&null!=c&&(h=d.valueFormatter({accessor:t,colIndex:0,row:l,rowIndex:o,value:c}));let u=-1;if(null==d?void 0:d.cellRenderer)try{const s=d.cellRenderer({accessor:t,colIndex:0,row:l,rowIndex:o,theme:m,value:c,formattedValue:h});if("string"==typeof s||"number"==typeof s)u=r(s+"");else if(s instanceof Node){e.textContent="",e.appendChild(s);const t=e.offsetWidth+n+i;e.textContent="",u=t>n+i?t:-1}}catch(t){u=-1}0>u&&(u=r(null!=h?h+"":"")),s.push(u)}document.body.removeChild(e),(null==d?void 0:d.cellRenderer)&&R.querySelectorAll(`.st-cell[data-accessor="${xt(t+"")}"] .st-cell-content`).forEach(t=>{const e=t;if(e.querySelector(".st-loading-skeleton"))return;const o=((t,e)=>{const n=document.createElement("div");n.style.visibility="hidden",n.style.position="absolute",n.style.top="-99999px",n.style.left="-99999px",n.style.whiteSpace="nowrap",n.style.width="max-content";const i=t.cloneNode(!0);i.style.flex="none",i.style.width="max-content",i.style.minWidth="0",i.style.maxWidth="none",i.style.overflow="visible",i.style.padding="0";const o=window.getComputedStyle(t);i.style.font=o.font,i.style.fontSize=o.fontSize,i.style.fontFamily=o.fontFamily,i.style.letterSpacing=o.letterSpacing,n.appendChild(i);const s=gt(e);s.appendChild(n);const r=n.offsetWidth;return s.removeChild(n),r})(e,R);o>0&&s.push(o+n+i)}),B=((t,e)=>{var n,i,o;if(0===t.length)return 0;const s=Math.max(...t),r=null!==(n=null==e?void 0:e.percentile)&&void 0!==n?n:95,l=null!==(i=null==e?void 0:e.threshold)&&void 0!==i?i:.5;if((null!==(o=null==e?void 0:e.minSampleForClip)&&void 0!==o?o:20)>t.length)return s;const a=((t,e)=>{if(0===t.length)return 0;if(1===t.length)return t[0];const n=[...t].sort((t,e)=>t-e),i=Math.min(100,Math.max(0,e))/100*(n.length-1),o=Math.floor(i),s=Math.ceil(i);return o===s?n[o]:n[o]+(n[s]-n[o])*(i-o)})(t,r);return a>0&&s>a*(1+l)?a:s})(s,{percentile:f,threshold:v})}let N="header"===w?T:Math.max(T,B);j&&(N=Math.max(N,150));const z="number"==typeof(null==d?void 0:d.maxWidth)?d.maxWidth:"string"==typeof(null==d?void 0:d.maxWidth)&&parseFloat(d.maxWidth+"")||void 0,V=null!=z?z:c;return N>V&&(N=V),Math.max(N+2,"number"==typeof(null==d?void 0:d.minWidth)?d.minWidth:"string"==typeof(null==d?void 0:d.minWidth)&&parseFloat(d.minWidth+"")||D,D)};class Rt{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 St=t=>"number"==typeof t.width?t.width:"string"==typeof t.width&&t.width.endsWith("px")?parseFloat(t.width):150,Ct=(t,e)=>{const n=new Map,i=t.map(St),o=i.reduce((t,e)=>t+e,0);if(0===o)return n;const s=e/o;if(.01>s-1)return n;const r=t.map((t,e)=>{const n="number"==typeof t.maxWidth?t.maxWidth:"string"==typeof t.maxWidth?parseFloat(t.maxWidth):NaN;return Number.isFinite(n)&&n>0?Math.max(n,i[e]):1/0}),l=new Map;let a=s;for(;;){const t=i.map((t,e)=>e).filter(t=>!l.has(t));if(0===t.length)break;const n=Array.from(l.values()).reduce((t,e)=>t+e,0),o=t.reduce((t,e)=>t+i[e],0);a=Math.max(1,(e-n)/o);const s=t.filter(t=>i[t]*a>r[t]);if(0===s.length)break;s.forEach(t=>l.set(t,r[t]))}const d=t.map((t,e)=>{const n=l.get(e);return Math.round(void 0!==n?n:i[e]*a)});let c=-1;for(let e=t.length-1;e>=0;e--)if(!l.has(e)){c=e;break}if(c>=0){const t=d.reduce((t,e,n)=>n===c?t:t+e,0);d[c]=Math.round(Math.min(Math.max(e-t,i[c]),r[c]))}return t.forEach((t,e)=>{n.set(t.accessor,d[e])}),n},It=(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=new Map;if(u.length>0&&Ct(u,o).forEach((t,e)=>v.set(e,t)),p.length>0&&Ct(p,s).forEach((t,e)=>v.set(e,t)),f.length>0&&a>0&&Ct(f,a).forEach((t,e)=>v.set(e,t)),0===v.size)return t;const w=(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=>w(t,i)),s=v.get(t.accessor);return Object.assign(Object.assign({},t),void 0!==s?{width:s,children:o}:{children:o})};return t.map(t=>w(t,t.pinned))};class Mt{constructor(t,e){var n;this.config=t,this.onHeadersUpdate=e,this.isResizingTracker=new Rt(null!==(n=t.isResizing)&&void 0!==n&&n),this.containerWidthTracker=new Rt(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 It(t,this.config)}setHeaders(t,e){const n="function"==typeof t?t(e):t;return this.applyAutoScale(n)}destroy(){this.onHeadersUpdate=()=>{}}}const Ht=(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 kt{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 Ht(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 Et{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 Tt{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 At={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)=>At.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?At.string(t,e,n):"number"==typeof t&&"number"==typeof e?At.number(t,e,n):"boolean"==typeof t&&"boolean"==typeof e?At.boolean(t,e,n):At.string(t+"",e+"",n)},Wt=({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 At.number(o,s,i)}return"date"===n?At.date(t+"",e+"",i):"boolean"===n?At.boolean(!!t,!!e,i):"enum"===n?At.enum(t+"",e+"",i):At.string(t+"",e+"",i)})(i,a,s,r)})})({rows:e,sortColumn:n,headers:t}),Ot=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=>z(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 Ft{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=z(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=Wt({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=Ot({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}):Wt({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 Pt=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)},$t=t=>new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0),Lt=t=>{if(!t)return new Date;if("string"==typeof t)return Pt(t);if("number"==typeof t){const e=new Date(t);return isNaN(e.getTime())?new Date:$t(e)}return t instanceof Date?$t(t):new Date};class Dt{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=z(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=Lt(t),s=Lt((i||"")+""),r=$t(e),l=$t(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=>$t(Lt((t||"")+"")));return r>=t&&e>=r}return!1;case"notBetween":if(o&&2===o.length){const[t,e]=o.map(t=>$t(Lt((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 Bt=(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},jt=(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},Nt=({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=Bt(Math.max(0,i-c),r);let f=Bt(u,r)+1;f=Math.min(o.length,f);const v=i,w=i+e;let m=Bt(v,r);v>a[m]&&(m=Math.min(m+1,o.length));let g=Bt(w,r);g=Math.min(o.length,g);const x=i+e,b=Bt(i,r);let y=Bt(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)}}},zt=({position:t,rowHeight:e,heightOffsets:n,customTheme:i})=>t*(e+i.rowSeparatorWidth)-i.rowSeparatorWidth+jt(t,n),Vt=({position:t,rowHeight:e,heightOffsets:n,customTheme:i})=>t*(e+i.rowSeparatorWidth)+jt(t,n),qt=(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},Gt=new Map,Kt=(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=Gt.get(f);if(v&&v.firstVisiblePosition===h&&v.renderedStartPosition===u&&v.renderedEndPosition===p)return v.result;const w=Ut({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:i,partiallyVisibleRowIndex:0,recursionDepth:0,stickyParents:[],rowGrouping:o});if(Gt.set(f,{result:w,firstVisiblePosition:h,renderedStartPosition:u,renderedEndPosition:p}),Gt.size>50){const t=Gt.keys().next().value;void 0!==t&&Gt.delete(t)}return w},Ut=({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){qt(a,t)&&(r.push(a),d++);const e=i[o+=d];e&&(a=e)}}else if(qt(a,t))return r.push(a),o++,Ut({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:i,partiallyVisibleRowIndex:o,recursionDepth:s+1,stickyParents:r,rowGrouping:l});return qt(a,t)?Ut({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:i,partiallyVisibleRowIndex:o,recursionDepth:s+1,stickyParents:r,rowGrouping:l}):{stickyParents:r,regularRows:e}},Jt=(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)}},_t=(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=Nt({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 Jt(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&&Jt(e,o,s)},100);Jt(d,o,s)},Yt=({rowIndex:t,colIndex:e,rowId:n})=>`${t}-${e}-${n}`;function Xt(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(Yt({colIndex:e,rowIndex:t,rowId:s}))}return o}function Qt(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 Zt{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=Yt({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 z(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 Zt.HEADER_SELECTION_CLASSES)i.classList.remove(t);continue}if(l.isSelectionColumn&&this.config.enableRowSelection){for(const t of Zt.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 Zt.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 Zt.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 Zt.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 Zt.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=Yt({rowIndex:o,colIndex:t,rowId:i});if(this.selectedCells.has(e))return!0}const s=Yt({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=Yt({colIndex:t,rowIndex:e,rowId:n});return this.copyFlashCells.has(i)}isWarningFlashing({colIndex:t,rowIndex:e,rowId:n}){const i=Yt({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=Yt(t);this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.selectedCells=new Set([e]),this.initialFocusedCell=t,this.updateDerivedState(),this.updateAllCellClasses(),setTimeout(()=>_t(t,this.config.rowHeight,this.config.customTheme,this.config.tableRows),0)}}selectCellRange(t,e){this.fullTableSelected=!1;const n=Xt(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(()=>_t(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=Xt(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 Qt(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 Qt(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=Yt({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)}}}Zt.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"],Zt.HEADER_SELECTION_CLASSES=["st-header-selected","st-header-has-highlighted-cell"];const te=(t,e)=>t.filter(t=>!(!t||!t.rowId)&&e.has(et(t.rowId))).map(t=>t.row);class ee{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:te(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 ne{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 ie{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 oe{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 se=(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 re{constructor(t,e){this.observers=new Set,this.expandedDepths=se(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 le{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 ae(t){return t?t.offsetWidth-t.clientWidth:0}const de=(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},ce=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},he=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},ue=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},pe=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},fe=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},ve=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},we=(t,e)=>new Date(t,e+1,0).getDate(),me=["January","February","March","April","May","June","July","August","September","October","November","December"],ge=["Su","Mo","Tu","We","Th","Fr","Sa"],xe=(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=de(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=de(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?Pt(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:ce("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:he("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",ge.forEach(t=>{const e=document.createElement("div");e.className="st-datepicker-weekday",e.textContent=t,R.appendChild(e)});const S=document.createElement("div");S.className="st-datepicker-footer";const C=document.createElement("button");C.className="st-datepicker-today-btn",C.textContent="Today",l(C,"click",()=>{const t=new Date,e=new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0);I(e)}),S.appendChild(C),v.appendChild(w),v.appendChild(R),v.appendChild(S);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()},M=()=>{var t,e,n;for(x.textContent=`${me[f]} ${p}`;R.children.length>7;)null===(t=R.lastElementChild)||void 0===t||t.remove();const i=we(p,f),o=new Date(p,f,1).getDay(),s=we(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=me[f-1])&&void 0!==e?e:me[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",`${me[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=me[f+1])&&void 0!==n?n:me[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--),M()}),l(b,"click",()=>{f++,f>11&&(f=0,p++),M()}),M();const H=J({accessor:a.accessor,rowId:null!==(r=t.stableRowKey)&&void 0!==r?r:t.rowId}),k=document.getElementById(H);return h=de(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)};let be=0;const ye=()=>{const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("aria-hidden","true"),t.setAttribute("role","img"),t.setAttribute("xmlns","http://www.w3.org/2000/svg"),t.setAttribute("viewBox","0 0 448 512"),t.setAttribute("class","st-checkbox-checkmark"),t.style.height="10px";const e=document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttribute("d","M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"),t.appendChild(e),t},Re=(t,e)=>{const n=t.querySelector(".st-checkbox-input"),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(ye()))},Se=({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(ye());const r=()=>{const t=o.checked;o.setAttribute("aria-checked",""+t),t?(s.classList.add("st-checked"),s.appendChild(ye())):(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(ye())):(s.classList.remove("st-checked"),s.innerHTML=""))},destroy:()=>{o.removeEventListener("change",r)}}},Ce=new WeakMap,Ie=(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+"")})})},Me=(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)?Lt(t).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):null==t?"":t+""},He=(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)=>Se({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&&lt(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?Ce.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="st-line-area-gradient-"+ ++be,u=document.createElementNS("http://www.w3.org/2000/svg","svg");u.setAttribute("width",n+""),u.setAttribute("height",i+""),u.setAttribute("preserveAspectRatio","none"),u.setAttribute("class",("st-line-area-chart "+a).trim()),u.style.display="block";let p="number"==typeof n?n:100;const f=()=>{u.innerHTML="";const t=p,n=i;u.setAttribute("viewBox",`0 0 ${t} ${n}`);const a=void 0!==d?d:Math.min(...e),f=(void 0!==c?c:Math.max(...e))-a||1,v=l/2+.5,w=Math.max(1,t-2*v),m=Math.max(1,n-2*v),g=e.map((t,n)=>({x:1===e.length?v+w/2:v+n/(e.length-1)*w,y:v+m-(t-a)/f*m})),x=g.map((t,e)=>`${0===e?"M":"L"} ${t.x.toFixed(2)},${t.y.toFixed(2)}`).join(" "),b=g[0].x,y=`${x} L ${g[g.length-1].x.toFixed(2)},${n} L ${b.toFixed(2)},${n} Z`,R=s||"var(--st-chart-fill-color)",S=document.createElementNS("http://www.w3.org/2000/svg","defs"),C=document.createElementNS("http://www.w3.org/2000/svg","linearGradient");C.setAttribute("id",h),C.setAttribute("x1","0"),C.setAttribute("y1","0"),C.setAttribute("x2","0"),C.setAttribute("y2","1");const I=document.createElementNS("http://www.w3.org/2000/svg","stop");I.setAttribute("offset","0%"),I.style.stopColor=R,I.setAttribute("stop-opacity",r+"");const M=document.createElementNS("http://www.w3.org/2000/svg","stop");M.setAttribute("offset","100%"),M.style.stopColor=R,M.setAttribute("stop-opacity",.15*r+""),C.appendChild(I),C.appendChild(M),S.appendChild(C),u.appendChild(S);const H=document.createElementNS("http://www.w3.org/2000/svg","path");H.setAttribute("d",y),H.setAttribute("fill",`url(#${h})`),H.setAttribute("stroke","none");const k=document.createElementNS("http://www.w3.org/2000/svg","path");k.setAttribute("d",x),k.setAttribute("fill","none"),k.setAttribute("stroke",o||"var(--st-chart-color)"),k.setAttribute("stroke-width",l+""),k.setAttribute("stroke-linecap","round"),k.setAttribute("stroke-linejoin","round"),u.appendChild(H),u.appendChild(k)};f();const v="undefined"!=typeof ResizeObserver?new ResizeObserver(t=>{var e,n;const i=null!==(n=null===(e=t[0])||void 0===e?void 0:e.contentRect.width)&&void 0!==n?n:0;i>0&&Math.abs(i-p)>=.5&&(p=i,f())}):null;return null==v||v.observe(u),{element:u,update:t=>{void 0===t.data||(e=t.data,e&&0!==e.length)?(void 0!==t.width&&(n=t.width,u.setAttribute("width",n+""),"number"==typeof n&&(p=n)),void 0!==t.height&&(i=t.height,u.setAttribute("height",i+"")),void 0!==t.color&&(o=t.color),void 0!==t.fillColor&&(s=t.fillColor),void 0!==t.fillOpacity&&(r=t.fillOpacity),void 0!==t.strokeWidth&&(l=t.strokeWidth),void 0!==t.className&&(a=t.className,u.setAttribute("class",("st-line-area-chart "+a).trim())),void 0!==t.min&&(d=t.min),void 0!==t.max&&(c=t.max),f()):u.innerHTML=""},destroy:()=>{null==v||v.disconnect(),u.remove()}}})(Object.assign({data:t,width:"100%",height:30},o.chartOptions));return void((null==e?void 0:e.element)&&n.appendChild(e.element))}}else if("barChart"===o.type&&Array.isArray(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=document.createElementNS("http://www.w3.org/2000/svg","svg");d.setAttribute("width",n+""),d.setAttribute("height",i+""),d.setAttribute("preserveAspectRatio","none"),d.setAttribute("class",("st-bar-chart "+r).trim()),d.style.display="block";let c="number"==typeof n?n:100;const h=()=>{d.innerHTML="";const t=c,n=i;d.setAttribute("viewBox",`0 0 ${t} ${n}`);const r=void 0!==l?l:Math.min(...e),h=void 0!==a?a:Math.max(...e),u=h-r||1,p=e.length;let f=Math.max(0,s);p>1&&1>(t-f*(p-1))/p&&(f=Math.max(0,Math.floor((t-p)/(p-1))));const v=(t-f*(p-1))/p,w=v+f,m=0>r,g=m?n*(h/u):n;e.forEach((t,e)=>{let i,s;m?0>t?(i=g,s=g+Math.abs(t)/u*n):(i=g-t/u*n,s=g):(i=n-(t-r)/u*n,s=n);const l=Math.round(e*w),a=Math.max(l+1,Math.round(e*w+v)),c=Math.round(i),h=Math.max(c+1,Math.round(s)),p=document.createElementNS("http://www.w3.org/2000/svg","rect");p.setAttribute("x",l+""),p.setAttribute("y",c+""),p.setAttribute("width",a-l+""),p.setAttribute("height",h-c+""),p.setAttribute("fill",o||"var(--st-chart-color)"),p.setAttribute("rx",Math.min(1,(a-l)/3)+""),d.appendChild(p)})};h();const u="undefined"!=typeof ResizeObserver?new ResizeObserver(t=>{var e,n;const i=null!==(n=null===(e=t[0])||void 0===e?void 0:e.contentRect.width)&&void 0!==n?n:0;i>0&&Math.abs(i-c)>=.5&&(c=i,h())}):null;return null==u||u.observe(d),{element:d,update:t=>{void 0===t.data||(e=t.data,e&&0!==e.length)?(void 0!==t.width&&(n=t.width,d.setAttribute("width",n+""),"number"==typeof n&&(c=n)),void 0!==t.height&&(i=t.height,d.setAttribute("height",i+"")),void 0!==t.color&&(o=t.color),void 0!==t.gap&&(s=t.gap),void 0!==t.className&&(r=t.className,d.setAttribute("class",("st-bar-chart "+r).trim())),void 0!==t.min&&(l=t.min),void 0!==t.max&&(a=t.max),h()):d.innerHTML=""},destroy:()=>{null==u||u.disconnect(),d.remove()}}})(Object.assign({data:t,width:"100%",height:30},o.chartOptions));return void((null==e?void 0:e.element)&&n.appendChild(e.element))}}if(o.cellRenderer){try{const 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=Me(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=Me(h,o,a,s,r);if(null!==e){const t=document.createTextNode(e);n.appendChild(t)}}return}const m=Me(h,o,a,s,r);if(null!==m){const t=document.createTextNode(m);n.appendChild(t)}},ke=new Map,Ee=new WeakMap,Te=new WeakMap;let Ae=null;const We=(t,e)=>{ke.has(t)||ke.set(t,new Set),ke.get(t).add(e)},Oe=(t,e)=>{const n=ke.get(t);n&&(n.delete(e),0===n.size&&ke.delete(t))},Fe=(t,e)=>{const n=ke.get(t);n&&n.forEach(t=>{e?t.classList.add("st-row-hovered"):t.classList.remove("st-row-hovered")})},Pe=(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(" ")},$e=(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=Pe(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=Ce.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=xe(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)xe(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"),He(t,l,e),v.appendChild(e)}};x(),t.header.expandable||Te.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};Ce.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});Ee.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=Ce.get(v))||void 0===n?void 0:n.context)&&void 0!==i?i:e;Te.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=Ce.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+"";We(t,v);const e=()=>{var e;const n=null!==(e=v.getAttribute("data-row-id"))&&void 0!==e?e:t;null!==Ae&&Ae!==n&&Fe(Ae,!1),Fe(n,!0),Ae=n},n=()=>{var e;const n=null!==(e=v.getAttribute("data-row-id"))&&void 0!==e?e:t;Fe(n,!1),Ae===n&&(Ae=null)};l(v,"mouseenter",e),l(v,"mouseleave",n)}return v},Le=(t,e,n)=>{var i,o,s,r;const{rowIndex:l,colIndex:a,rowId:d}=e,c={rowIndex:l,colIndex:a,rowId:d};t.className=Pe(e,n);const h=n.isInitialFocusedCell(c);t.setAttribute("tabindex",h?"0":"-1"),t.style.left=e.left+"px",t.style.top=e.top+"px";const u=t.dataset.stAccordionGrow;"horizontal"!==u&&(t.style.width=e.width+"px"),"vertical"!==u&&(t.style.height=e.height+"px"),t.setAttribute("data-row-index",l+""),t.setAttribute("data-col-index",a+"");const p=null!==(i=n.maxHeaderDepth)&&void 0!==i?i:1;t.setAttribute("aria-rowindex",e.tableRow.position+p+1+""),t.setAttribute("aria-colindex",a+1+""),n.enableRowSelection?t.setAttribute("aria-selected",(null===(o=n.isRowSelected)||void 0===o?void 0:o.call(n,d))?"true":"false"):t.hasAttribute("aria-selected")&&t.removeAttribute("aria-selected");const f=void 0!==n.rowHeaderAccessor&&e.header.accessor===n.rowHeaderAccessor?"rowheader":"gridcell";t.getAttribute("role")!==f&&t.setAttribute("role",f);const v=t.getAttribute("data-row-id"),w=d+"";v&&v!==w&&(Oe(v,t),We(w,t)),t.setAttribute("data-row-id",w),t.setAttribute("data-accessor",e.header.accessor+"");const m=Ce.get(t);if(m?(m.row=e.row,m.tableRow=e.tableRow,m.context=n):Ce.set(t,{row:e.row,tableRow:e.tableRow,context:n}),e.header.expandable){const i=t.querySelector(".st-cell-content");i&&!(!n.isLoading&&!e.tableRow.isLoadingSkeleton)!=(null!==i.querySelector(".st-loading-skeleton"))&&(null===(s=n.onRendererHostDiscard)||void 0===s||s.call(n,i),i.innerHTML="",He(e,n,i))}else{const i=t.querySelector(".st-cell-content");if(i){const o=Te.get(t),s=X(e.row,e.header.accessor),l=!(!n.isLoading&&!e.tableRow.isLoadingSkeleton);void 0!==o&&o.row===e.row&&o.value===s&&o.theme===n.theme&&o.skeleton===l||(Te.set(t,{row:e.row,value:s,theme:n.theme,skeleton:l}),null===(r=n.onRendererHostDiscard)||void 0===r||r.call(n,i),i.innerHTML="",He(e,n,i))}}},De=t=>{if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map(De);const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=De(t[n]));return e},Be=(t,e)=>t.filter(t=>t.pinned===e).some(t=>!t.hide&&!t.excludeFromRender),je="st-accordion-animating",Ne="--st-accordion-duration",ze="--st-accordion-easing";function Ve(t){return{pinnedLeft:t.filter(t=>"left"===t.pinned),unpinned:t.filter(t=>!t.pinned),pinnedRight:t.filter(t=>"right"===t.pinned)}}function qe(t,e){return!0===t.isEssential||e.has(t.accessor+"")}function Ge(t,e){let n=!1;for(const i of t){if(i.isSelectionColumn||i.excludeFromRender)continue;const t=qe(i,e);if(t&&n)return!1;t||(n=!0)}return!0}function Ke(t,e){var n;const{pinnedLeft:i,unpinned:o,pinnedRight:s}=Ve(t);if(!Ge(i,e))return!1;if(!Ge(o,e))return!1;if(!Ge(s,e))return!1;for(const i of t)if((null===(n=i.children)||void 0===n?void 0:n.length)&&!Ue(i.children,e))return!1;return!0}function Ue(t,e){var n;if(!Ge(t,e))return!1;for(const i of t)if((null===(n=i.children)||void 0===n?void 0:n.length)&&!Ue(i.children,e))return!1;return!0}function Je(t){const{pinnedLeft:e,unpinned:n,pinnedRight:i}=Ve(t);return{left:e.map(t=>t.accessor),main:n.map(t=>t.accessor),right:i.map(t=>t.accessor)}}function _e(t,e,n){return[...t.filter(t=>qe(e.get(t+""),n)),...t.filter(t=>!qe(e.get(t+""),n))]}function Ye(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=_e(e.left,s,n),l=_e(e.main,s,n),a=_e(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 Xe(t,e,n,i){const o=e+"",s=Je(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&&(!qe(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),Ye(t,{left:r,main:l,right:a},i)):null}class Qe{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:fe("st-drag-icon"),expand:he("st-expand-icon"),filter:ve("st-header-icon"),headerCollapse:he("st-header-icon"),headerExpand:ce("st-header-icon"),next:he("st-next-prev-icon"),prev:ce("st-next-prev-icon"),sortDown:pe("st-header-icon"),sortUp:ue("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 se(null===(e=t.expandAll)||void 0===e||e,t.rowGrouping)}}class Ze{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 tn=(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},en={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"},nn={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"]},on=["equals","notEquals","isEmpty","isNotEmpty"],sn=(t,e)=>{var n;const i=null!==(n=nn[t])&&void 0!==n?n:on;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},rn=t=>!["between","notBetween","in","notIn","isEmpty","isNotEmpty"].includes(t),ln=t=>["between","notBetween","in","notIn"].includes(t),an=t=>["isEmpty","isNotEmpty"].includes(t),dn=t=>{var e;return null!==(e=null==t?void 0:t.closest(".simple-table-root"))&&void 0!==e?e:null},cn=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=dn(g))&&void 0!==e?e:dn(null!=r?r:null))&&void 0!==n?n:dn(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)&&(S(!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}S(!1),null==a||a()}},y=t=>{"Escape"===t.key&&d&&(S(!1),null==a||a())},R=t=>{"Enter"===t.key&&b(t)},S=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?S(!0):m.style.display="none",{element:m,update:t=>{void 0!==t.anchorElement&&(g=t.anchorElement),void 0!==t.open&&S(t.open),void 0!==t.children&&(m.innerHTML="",m.appendChild(t.children)),void 0!==t.width&&(h=t.width,m.style.width=h?h+"px":"auto"),void 0!==t.maxWidth&&(u=t.maxWidth,m.style.maxWidth=u?u+"px":""),void 0!==t.overflow&&(c=t.overflow,m.style.overflow=v?"visible":c),void 0!==t.allowDescendantOverflow&&(v=t.allowDescendantOverflow,m.classList.toggle(w,v),m.style.overflow=v?"visible":c)},destroy:()=>{S(!1),m.remove()},setOpen:S}},hn=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=cn({children:m,containerRef:l,mainBodyRef:a,anchorElement:u,onClose:()=>{C(!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),C(!1),c=-1,g()},R=()=>{if(!r){if(C(!d),d)c=-1;else{const t=i.findIndex(t=>t.value===e);c=0>t?0:t}g()}},S=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),C(!1),c=-1,g()}break;case"Escape":t.preventDefault(),C(!1),c=-1,g()}},C=t=>{d=t,u.setAttribute("aria-expanded",""+d),d?(h.classList.add("st-custom-select-open"),document.addEventListener("keydown",S)):(h.classList.remove("st-custom-select-open"),document.removeEventListener("keydown",S)),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",S),x.destroy(),h.remove()},setOpen:C}},un=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()}}},pn=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()}}},fn=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()}}},vn=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=sn("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=hn({value:d,onChange:t=>{d=t,x()},options:l.map(t=>({value:t,label:en[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},rn(d)&&{value:c});i(t)},g=()=>an(d)||""!==c.trim(),x=()=>{f&&(f.remove(),f=null),v&&(v.destroy(),v=null),rn(d)&&(f=document.createElement("div"),f.className="st-filter-section",v=un({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=pn({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=sn("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=hn({value:h,onChange:t=>{h=t,I()},options:d.map(t=>({value:t,label:en[t]})),containerRef:l,mainBodyRef:a});w.appendChild(m.element),v.appendChild(w);let g=null,x=null,b=null,y=null,R=null;const S=()=>{const t={accessor:i.accessor,operator:h};rn(h)?t.value=parseFloat(u):ln(h)&&(t.values=[parseFloat(p),parseFloat(f)]),s(t)},C=()=>!!an(h)||(rn(h)?""!==u.trim():!!ln(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),rn(h)?(g=document.createElement("div"),g.className="st-filter-section",x=un({type:"number",value:u,onChange:t=>{u=t,R&&R.update({canApply:C()})},onEnter:S,placeholder:"Enter number...",autoFocus:!0}),g.appendChild(x.element),v.insertBefore(g,v.lastChild)):ln(h)&&(g=document.createElement("div"),g.className="st-filter-section",b=un({type:"number",value:p,onChange:t=>{p=t,R&&R.update({canApply:C()})},onEnter:S,placeholder:"From...",autoFocus:!0}),b.element.classList.add("st-filter-input-range-from"),y=un({type:"number",value:f,onChange:t=>{f=t,R&&R.update({canApply:C()})},onEnter:S,placeholder:"To..."}),g.appendChild(b.element),g.appendChild(y.element),v.insertBefore(g,v.lastChild)),R&&R.update({canApply:C()})};return R=pn({onApply:S,onClear:r,canApply:C(),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:C()}),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=sn("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=hn({value:d,onChange:t=>{d=t,x()},options:l.map(t=>({value:t,label:en[t]})),containerRef:s,mainBodyRef:r});u.appendChild(p.element),h.appendChild(u);let f=null,v=null,w=null;const m=()=>an(d)||""!==c,g=[{value:"true",label:"True"},{value:"false",label:"False"}],x=()=>{f&&(f.remove(),f=null),v&&(v.destroy(),v=null),rn(d)&&(f=document.createElement("div"),f.className="st-filter-section",v=hn({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=pn({onApply:()=>{const t={accessor:e.accessor,operator:d};rn(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=sn("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=hn({value:h,onChange:t=>{h=t,W()},options:d.map(t=>({value:t,label:en[t]})),containerRef:l,mainBodyRef:a});w.appendChild(m.element),v.appendChild(w);let g=null,x=null,b=null,y=null,R=null,S=null,C=null,I=null,M=null,H=null,k=null;const E=()=>!!an(h)||(rn(h)?""!==u.trim():!!ln(h)&&""!==p.trim()&&""!==f.trim()),T=t=>{if(!t)return"";const e=Lt(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?Lt(t):new Date,c=fn({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=cn({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),S&&(S.destroy(),S=null),C&&(C.destroy(),C=null),I&&(I.destroy(),I=null),M&&(M.destroy(),M=null),H&&(H.destroy(),H=null),rn(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(ln(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,S=t.picker,M=t.dropdown,y=e.container,C=e.picker,H=e.dropdown,g.appendChild(b),g.appendChild(y),v.insertBefore(g,v.lastChild)}k&&k.update({canApply:E()})};return k=pn({onApply:()=>{const t={accessor:i.accessor,operator:h};rn(h)?t.value=u:ln(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(),S&&S.destroy(),C&&C.destroy(),I&&I.destroy(),M&&M.destroy(),H&&H.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=Se({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=un({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=Se({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=pn({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)}},wn=(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=vn({header:t,currentFilter:r,onApplyFilter:n,onClearFilter:s,containerRef:a,mainBodyRef:a}),u=cn({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},mn=(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},gn=(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=gn(o.children,e,[...n,i]);if(t)return t}}return null},xn=(t,e)=>{if(t.pinned)return t.pinned;const n=q(e,t.accessor);return n?xn(n,e):void 0},bn=(t,e)=>{const n=xn(t,e);return"left"===n?"left":"right"===n?"right":"main"};function yn(t,e,n){const i=De(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 Rn=(t,e)=>{const{mainBodyWidth:n,pinnedLeftWidth:i,pinnedRightWidth:o,pinnedLeftContentWidth:s,pinnedRightContentWidth:r,tableBodyContainerRef:l,editColumns:a}=e,d=a?F: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")}},Sn=(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()},Cn=({containerWidth:t,leftWidth:e,rightWidth:n})=>t>0?Math.max(0,t-e-n):void 0,In=({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:V(i),rightWidth:V(o),mainWidth:s,leftContentWidth:r,rightContentWidth:l}},Mn=(t,e)=>{if(t.pinned)return t.pinned;const n=q(e,t.accessor);return n?Mn(n,e):void 0},Hn=(e,n,i)=>{var o;const s=[],r=[],l=[];e.forEach(t=>{if(t.hide)return;const n=Mn(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=In({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"),S=null==R?void 0:R.querySelector(".st-horizontal-scrollbar-container"),C=null==R?void 0:R.querySelector(".st-body-main"),I=!!(null==R?void 0:R.querySelector(".st-column-editor"));S&&C&&f&&C.scrollWidth-C.clientWidth>1&&Rn(S,{mainBodyRef:C,mainBodyWidth:x,pinnedLeftWidth:m,pinnedRightWidth:g,pinnedLeftContentWidth:b,pinnedRightContentWidth:y,tableBodyContainerRef:f,editColumns:I})},kn=({columnsToShrink:t,totalCompensation:e,initialWidthsMap:n,shrinkFloors:i})=>{if(0>e){const i=Math.abs(e),o=t.reduce((t,e)=>t+(n.get(e.accessor)||100),0);if(0===o)return;return void t.forEach((e,s)=>{const r=n.get(e.accessor)||100;let l=i*(r/o);if(s===t.length-1){const e=t.slice(0,s).reduce((t,e)=>{const i=n.get(e.accessor)||100;return t+(("number"==typeof e.width?e.width:100)-i)},0);l=i-e}e.width=r+l})}let o=e;for(;o>.5;){const e=t.map(t=>{var e;const o=n.get(t.accessor)||100,s=Math.max(null!==(e=null==i?void 0:i.get(t.accessor))&&void 0!==e?e:D,D),r=Math.min(s,o);return{column:t,headroom:Math.max(0,o-r),initialWidth:o,minWidth:r}}).filter(t=>t.headroom>0);if(0>=e.length)break;{const t=e.reduce((t,e)=>t+e.headroom,0);let n=0;const i=o;e.forEach((o,s)=>{let r=i*(o.headroom/t);r=Math.min(r,o.headroom),s===e.length-1&&(r=Math.min(i-n,o.headroom)),o.column.width=o.initialWidth-r,n+=r}),o-=n}}},En=({childrenToResize:t=[],collapsedHeaders:e,containerWidth:n,delta:i,headers:o,initialWidthsMap:s,isParentResize:r=!1,resizedHeader:l,reverse:a,rootPinned:d,sectionHeaders:c,sectionWidth:h,sectionViewportWidth:u=0,shrinkFloors:p,startWidth:f})=>{const v=t=>t.reduce((t,e)=>{const n=s.get(e.accessor)||100;return t+Math.max(0,n-(t=>{var e;const n=s.get(t.accessor)||100,i=Math.max(null!==(e=null==p?void 0:p.get(t.accessor))&&void 0!==e?e:D,D);return Math.min(i,n)})(e))},0),w=t=>{if(!d||0>=n||0>=t)return t;const e=o.some(t=>"left"===t.pinned&&!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,m=r===n.length-1;let g;g="left"===d&&m||"right"===d&&l?[]:l?n.slice(r+1):m||a?n.slice(0,o):n.slice(r+1);const x=Array.from(s.values()).reduce((t,e)=>t+e,0),b=!d&&u>0?u:h>0?Math.max(h,x):x+Math.abs(i)+1;if(i>0){const e=Math.max(0,b-x),n=Math.max(0,i-e),o=g.length>0?v(g):0,r=Math.min(n,o);let l;l=d?0===g.length?w(i):Math.min(i,w(e)+r):i;const a=(f+l)/t.reduce((t,e)=>t+(s.get(e.accessor)||100),0);t.forEach(t=>{const e=s.get(t.accessor)||100;t.width=Math.max(e*a,D)}),r>0&&g.length>0&&kn({columnsToShrink:g,totalCompensation:r,initialWidthsMap:s,shrinkFloors:p})}else{const e=t.reduce((t,e)=>t+(s.get(e.accessor)||100),0),n=Math.max(f+i,D*t.length),o=n/e;t.forEach(t=>{const e=s.get(t.accessor)||100;t.width=Math.max(e*o,D)});const r=Math.max(0,f-n-Math.max(0,x-b));r>0&&g.length>0&&kn({columnsToShrink:g,totalCompensation:-r,initialWidthsMap:s})}return}const m=mt(c,e),g=m.findIndex(t=>t.accessor===l.accessor);if(-1===g)return;const x=0===g,b=g===m.length-1;let y;if(y="left"===d&&b||"right"===d&&x?[]:x?m.slice(g+1):b||a?m.slice(0,g):m.slice(g+1),0===y.length){const t=i>0?w(i):i;return void(l.width=Math.max(f+t,D))}const R=Array.from(s.values()).reduce((t,e)=>t+e,0),S=!d&&u>0?u:h>0?Math.max(h,R):R+Math.abs(i)+1;if(i>0){const t=Math.max(0,S-R);if(t>=i){const t=w(i);return void(l.width=f+t)}const e=i-t,n=v(y),o=Math.min(e,n);if(d){const e=w(t)+o;l.width=f+e}else l.width=f+i;o>0&&kn({columnsToShrink:y,totalCompensation:o,initialWidthsMap:s,shrinkFloors:p})}else{const t=Math.max(f+i,D),e=f-t;l.width=t;const n=Math.max(0,e-Math.max(0,R-S));n>0&&kn({columnsToShrink:y,totalCompensation:-n,initialWidthsMap:s})}},Tn=({mainLeafHeaders:t,mainInitialWidths:e,newMainAvailable:n,shrinkFloors:i})=>{const o=Array.from(e.values()).reduce((t,e)=>t+e,0);if(0>=n||0>=o)return;const s=n/o;if(s>=1){let i=0;return void t.forEach((o,r)=>{const l=e.get(o.accessor)||100;r===t.length-1?o.width=n-i:(o.width=Math.round(l*s),i+=o.width)})}t.forEach(t=>{var n;const o=e.get(t.accessor)||100,r=Math.min(Math.max(null!==(n=null==i?void 0:i.get(t.accessor))&&void 0!==n?n:D,D),o);t.width=Math.max(Math.round(o*s),r)})},An=(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},Wn=({autoExpandColumns:t,collapsedHeaders:e,containerWidth:n,event:i,header:o,headers:s,mainBodyRef:r,onColumnWidthChange:l,onAutoExpandNaturalWidths:a,reverse:d=!1,setHeaders:c,setIsResizing:h,shrinkFloors:u,startWidth:p})=>{i.preventDefault();const f="clientX"in i?i.clientX:i.touches[0].clientX,v="touches"in i;if(!o||o.hide)return;const w=An(n,r);h(!0);const m=Mn(o,s),g=wt(o);let x;if(o.children&&o.children.length>0){const t=dt(o,e);x=t.length>0?t:[o]}else x=[o];const b=new Map;let y=0,R=0;if(t){const t=s.filter(t=>t.pinned===m);if(mt(t,e).forEach(t=>{const e=ft(t);b.set(t.accessor,e)}),w>0){const{leftWidth:t,rightWidth:n,mainWidth:i}=In({headers:s,containerWidth:w,collapsedHeaders:e});y="left"===m?t:"right"===m?n:i;const o=Math.max(0,w-t-n),l=null!=(null==r?void 0:r.current)&&r.current.clientWidth>0?r.current.clientWidth:0;R=l>0?Math.min(o,l):o}}let S=!1;const C=new Map;let I=[];if(t&&m&&w>0){const t=mt(s.filter(t=>t.pinned===m),e);if(t.length>0){let n=!1;if(x.length>1){const e=t.findIndex(t=>t.accessor===x[0].accessor),i=t.findIndex(t=>t.accessor===x[x.length-1].accessor);n="left"===m&&i===t.length-1||"right"===m&&0===e}else{const e=x[0]||o,i=t.findIndex(t=>t.accessor===e.accessor);n="left"===m&&i===t.length-1||"right"===m&&0===i}if(n){S=!0;const t=s.filter(t=>!t.pinned);I=mt(t,e),I.forEach(t=>{C.set(t.accessor,ft(t))})}}}const M=(n,i=!1)=>{const r="right"===m?f-n:n-f;if(t){const t=s.filter(t=>t.pinned===m);if(En({childrenToResize:x,collapsedHeaders:e,containerWidth:w,delta:r,headers:s,initialWidthsMap:b,isParentResize:x.length>1,resizedHeader:x.length>0?x[x.length-1]:o,reverse:d,rootPinned:m,sectionHeaders:t,sectionWidth:y,sectionViewportWidth:m?y:R,shrinkFloors:u,startWidth:p}),S&&I.length>0){const t=x.reduce((t,e)=>{const n=b.get(e.accessor)||0;return t+(("number"==typeof e.width?e.width:n)-n)},0);Tn({mainLeafHeaders:I,mainInitialWidths:C,newMainAvailable:Math.max(0,R-t),shrinkFloors:u})}}else{const t=(({header:t,headers:e,collapsedHeaders:n})=>{const i=document.querySelector(".st-body-container");if(!i||0===i.clientWidth)return 1e3;const o=i.clientWidth;if(!t.pinned)return 1/0;const s=e.some(t=>"left"===t.pinned&&!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});x.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:x,minWidth:g,startWidth:p,maxWidth:t}):x[0].width=Math.max(Math.min(p+r,t),g),s.forEach(t=>{vt(t)})}if(i){if(t&&a){const t=new Map;x.forEach(e=>{"number"==typeof e.width&&t.set(e.accessor,e.width)}),t.size>0&&a(t)}const n=[...s];c(n);const i=new Map;x.forEach(t=>{"number"==typeof t.width&&i.set(t.accessor,t.width)}),S&&I.forEach(t=>{"number"==typeof t.width&&i.set(t.accessor,t.width)}),Hn(s,e,i)}else Hn(s,e)};let H=null,k=null,E=f;const T=t=>{E=t,k=t,null===H&&(H=requestAnimationFrame(()=>{null!==k&&(M(k,!1),k=null),H=null}))};if(v){const t=t=>{T(t.touches[0].clientX)},e=()=>{document.removeEventListener("touchmove",t),document.removeEventListener("touchend",e),null!==H&&(cancelAnimationFrame(H),H=null),M(E,!0),h(!1),l&&l([...s])};document.addEventListener("touchmove",t),document.addEventListener("touchend",e)}else{const t=t=>{T(t.clientX)},e=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",e),null!==H&&(cancelAnimationFrame(H),H=null),M(E,!0),h(!1),l&&l([...s])};document.addEventListener("mousemove",t),document.addEventListener("mouseup",e)}},On=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},Fn=(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=Fn(i.children,e);if(t)return t}}},Pn=(t,e)=>{const{columnResizing:n}=e;if(!n||t.isSelectionColumn&&e.enableRowSelection)return null;const i=document.createElement("div");i.className="st-header-resize-handle-container",i.setAttribute("role","separator"),i.setAttribute("aria-label",`Resize ${t.label} column`),i.setAttribute("aria-orientation","vertical");const o=document.createElement("div");o.className="st-header-resize-handle",i.appendChild(o);const s=t=>({rows:e.rows,header:t,styleRoot:On(e),autoSizeMode:t.autoSizeMode,sortIcon:e.icons.sortUp}),r=()=>{var n,i,o;const s=null!==(i=null===(n=e.getCollapsedHeaders)||void 0===n?void 0:n.call(e))&&void 0!==i?i:e.collapsedHeaders,r=e.getHeaders();return((t,e)=>{const n=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)}})(r,s),{headers:r,header:null!==(o=Fn(r,t.accessor))&&void 0!==o?o:t,collapsedHeaders:s}};let l=0;const a=()=>{const n=Date.now();120>n-l||(l=n,(()=>{var n;const i=document.getElementById(J({accessor:t.accessor,rowId:"header"}));if(e.autoExpandColumns){const{headers:t,header:o,collapsedHeaders:l}=r();(({header:t,headers:e,collapsedHeaders:n,containerWidth:i,mainBodyRef:o,reverse:s,headerCellElement:r,getTargetLeafWidth:l,onAutoExpandNaturalWidths:a,shrinkFloors:d})=>{var c;if(!t||t.hide)return;const h=An(i,o),u=Mn(t,e);let p;if(t.children&&t.children.length>0){const e=dt(t,n);p=e.length>0?e:[t]}else p=[t];const f=new Map;let v=0,w=0;const m=e.filter(t=>t.pinned===u);if(mt(m,n).forEach(t=>{const e=ft(t);f.set(t.accessor,e)}),h>0){const{leftWidth:t,rightWidth:i,mainWidth:s}=In({headers:e,containerWidth:h,collapsedHeaders:n});v="left"===u?t:"right"===u?i:s;const r=Math.max(0,h-t-i),l=null!=(null==o?void 0:o.current)&&o.current.clientWidth>0?o.current.clientWidth:0;w=l>0?Math.min(r,l):r}let g=!1;const x=new Map;let b=[];if(u&&h>0){const i=mt(e.filter(t=>t.pinned===u),n);if(i.length>0){let o=!1;if(p.length>1){const t=i.findIndex(t=>t.accessor===p[0].accessor),e=i.findIndex(t=>t.accessor===p[p.length-1].accessor);o="left"===u&&e===i.length-1||"right"===u&&0===t}else{const e=p[0]||t,n=i.findIndex(t=>t.accessor===e.accessor);o="left"===u&&n===i.length-1||"right"===u&&0===n}if(o){g=!0;const t=e.filter(t=>!t.pinned);b=mt(t,n),b.forEach(t=>{x.set(t.accessor,ft(t))})}}}const y=p.reduce((t,e)=>t+l(e),0),R=null!==(c=null==r?void 0:r.offsetWidth)&&void 0!==c?c:p.reduce((t,e)=>t+ft(e),0);if(En({childrenToResize:p,collapsedHeaders:n,containerWidth:h,delta:y-R,headers:e,initialWidthsMap:f,isParentResize:p.length>1,resizedHeader:p.length>0?p[p.length-1]:t,reverse:s,rootPinned:u,sectionHeaders:m,sectionWidth:v,sectionViewportWidth:u?v:w,shrinkFloors:d,startWidth:R}),g&&b.length>0){const t=p.reduce((t,e)=>{const n=f.get(e.accessor)||0;return t+(("number"==typeof e.width?e.width:n)-n)},0);Tn({mainLeafHeaders:b,mainInitialWidths:x,newMainAvailable:Math.max(0,w-t),shrinkFloors:d})}if(a){const t=new Map;p.forEach(e=>{"number"==typeof e.width&&t.set(e.accessor,e.width)}),t.size>0&&a(t)}const S=new Map;p.forEach(t=>{"number"==typeof t.width&&S.set(t.accessor,t.width)}),g&&b.forEach(t=>{"number"==typeof t.width&&S.set(t.accessor,t.width)}),Hn(e,n,S)})({header:o,headers:t,collapsedHeaders:l,containerWidth:e.containerWidth,mainBodyRef:e.mainBodyRef,reverse:e.reverse,headerCellElement:i,getTargetLeafWidth:t=>yt(t.accessor,s(t)),onAutoExpandNaturalWidths:e.onAutoExpandNaturalWidths,shrinkFloors:null===(n=e.getShrinkFloors)||void 0===n?void 0:n.call(e)});const a=[...t];return e.setHeaders(a),void(e.onColumnWidthChange&&e.onColumnWidthChange(a))}const{headers:o,header:l,collapsedHeaders:a}=r(),d=yt(l.accessor,s(l)),c=gn(o,l.accessor);if(!c)return;const h=((t,e)=>{let n=t;for(let t=0;e.length-1>t;t++)n=n[e[t]].children;return n})(o,c),u=c[c.length-1],p=h.map((t,e)=>e===u?Object.assign(Object.assign({},t),{width:d}):t),f=((t,e,n)=>{if(1===e.length)return n;let i=t;for(let t=0;e.length-2>t;t++)i=i[e[t]].children;return i[e[e.length-2]].children=n,t})(o,c,p);f.forEach(t=>vt(t));const v=p[u],w=new Map;v&&"number"==typeof v.width&&w.set(v.accessor+"",v.width),Hn(f,a,w),e.setHeaders(f),e.onColumnWidthChange&&e.onColumnWidthChange(f)})())};return y(i,"mousedown",n=>{var i;if(n.detail>=2)return n.preventDefault(),void a();const o=null===(i=document.getElementById(J({accessor:t.accessor,rowId:"header"})))||void 0===i?void 0:i.offsetWidth;b(()=>{var t;const{headers:i,header:s,collapsedHeaders:l}=r();Wn({autoExpandColumns:e.autoExpandColumns,collapsedHeaders:l,containerWidth:e.containerWidth,event:n,forceUpdate:e.forceUpdate,header:s,headers:i,mainBodyRef:e.mainBodyRef,onColumnWidthChange:e.onColumnWidthChange,onAutoExpandNaturalWidths:e.onAutoExpandNaturalWidths,pinnedLeftRef:e.pinnedLeftRef,pinnedRightRef:e.pinnedRightRef,reverse:e.reverse,setHeaders:e.setHeaders,setIsResizing:e.setIsResizing,shrinkFloors:null===(t=e.getShrinkFloors)||void 0===t?void 0:t.call(e),startWidth:null!=o?o:P})},10)}),y(i,"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(()=>{var t;const{headers:n,header:i,collapsedHeaders:l}=r();Wn({autoExpandColumns:e.autoExpandColumns,collapsedHeaders:l,containerWidth:e.containerWidth,event:o,forceUpdate:e.forceUpdate,header:i,headers:n,mainBodyRef:e.mainBodyRef,onColumnWidthChange:e.onColumnWidthChange,onAutoExpandNaturalWidths:e.onAutoExpandNaturalWidths,pinnedLeftRef:e.pinnedLeftRef,pinnedRightRef:e.pinnedRightRef,reverse:e.reverse,setHeaders:e.setHeaders,setIsResizing:e.setIsResizing,shrinkFloors:null===(t=e.getShrinkFloors)||void 0===t?void 0:t.call(e),startWidth:null!=s?s:P})},10)}),y(i,"dblclick",a),i},$n=(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=Ln(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},Ln=(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 Se({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},Dn=(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(De(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(bn(d,t)!==bn(n,t)){const e=function({headers:t,draggedHeader:e,hoveredHeader:n}){const i=De(t);let o=!1;try{const t=bn(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=gn(t,d.accessor),i=gn(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=yn(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&&!Ke(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")}))},Bn=(e,n)=>{var i,o;const{header:s,colIndex:r,parentHeader:l}=e,{collapsedHeaders:a,columnBorders:d,columnReordering:c,enableHeaderEditing:h,selectedColumns:u,columnsWithSelectedCells:p,draggedHeaderRef:f,hoveredHeaderRef:v}=n,w=s.isSelectionColumn&&n.enableRowSelection,m=!!(null==s?void 0:s.isSortable),g=a.has(s.accessor),x=!(!s.children||0===s.children.length)&&(!g||s.children.some(e=>{const n=e.showWhen||t;return"parentCollapsed"===n||"always"===n})),b=null==l?void 0:l.singleRowChildren,y=x&&!s.singleRowChildren,R=!!d&&(s.children&&0!==s.children.length?j(s,r).includes(n.lastHeaderIndex):r===n.lastHeaderIndex),S=!(!n.selectableColumns||w)&&j(s,r).some(t=>u.has(t)),C=!w&&j(s,r).some(t=>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":"",S?"st-header-selected":"",C&&!S?"st-header-has-highlighted-cell":""].filter(Boolean).join(" ")},jn=(t,e,n,i,o)=>{const s=Ln(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)},Nn=(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);(t=>{0===t.length||t.map(t=>t.colIndex)})(e);const c=m(t),h=new Set(d.map(t=>J({accessor:t.header.accessor,rowId:"header"}))),u=new Map,p=Array.from(new Set(e.map(t=>Math.round(t.top)))).sort((t,e)=>t-e);p.forEach((t,e)=>u.set(t,e));const f=t=>"header-band-"+Math.round(t.top),v=t=>{var e;return(null!==(e=u.get(Math.round(t.top)))&&void 0!==e?e:0)+1},w=x(t),g=n.animationCoordinator&&n.accordionAxis?n.accordionAxis:null,b="horizontal"===g?(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;c.forEach((e,i)=>{var o,s;if(!h.has(i)){w.delete(i);const r=null!==(o=e.getAttribute("data-accessor"))&&void 0!==o?o:"",l=null!==(s=null==b?void 0:b.has(r))&&void 0!==s&&s;"horizontal"===g&&n.animationCoordinator&&!l&&n.animationCoordinator.shouldRetain(i)?n.animationCoordinator.shrinkOutCell({cellId:i,element:e,container:t,axis:g}):e.remove(),c.delete(i),S=!0}}),S&&R(t);const C=[];d.forEach(e=>{const o=J({accessor:e.header.accessor,rowId:"header"});if(c.has(o)){const s=c.get(o);i(t,f(e),v(e)),s.setAttribute("aria-colindex",e.colIndex+1+""),e.header.children&&e.header.children.length>0&&s.setAttribute("aria-colspan",U(e.header,n.headers,n.collapsedHeaders)+"");const r=w.get(o);if(!r||r.left!==e.left||r.top!==e.top||r.width!==e.width||r.height!==e.height){s.style.left=e.left+"px",s.style.top=e.top+"px";const t=s.dataset.stAccordionGrow;"horizontal"!==t&&(s.style.width=e.width+"px"),"vertical"!==t&&(s.style.height=e.height+"px"),w.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)=>{Re(t,e)})(s,n.areAllRowsSelected());const l=Bn(e,n);if(s.className!==l&&(s.className=l),K(e.header)){const t=n.collapsedHeaders.has(e.header.accessor);s.setAttribute("aria-expanded",!t+""),((t,e,n)=>{Ie(t,!e,{ariaLabelWhenExpanded:n?`Collapse ${n} column`:"Collapse column",ariaLabelWhenCollapsed:n?`Expand ${n} column`:"Expand column",syncAriaExpanded:!0})})(s,t,e.header.label)}const a=`${n.sort&&n.sort.key.accessor===e.header.accessor?n.sort.direction:"none"}|${n.filters&&n.filters[e.header.accessor]?"1":"0"}`;s.dataset.stIconState!==a&&(((t,e,n,i)=>{const o=tn(e,n),s=wn(e,n),r=mn(e,n);if(e.headerRenderer){const l=t.querySelector(".st-header-label");return void(l&&jn(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))}})(s,e.header,n,e.colIndex),s.dataset.stIconState=a)}else C.push({cell:e,cellId:o})});const I=n.animationCoordinator&&n.accordionAxis?n.accordionAxis:null,M=[];C.forEach(({cell:e,cellId:o})=>{const s=((t,e)=>{var n,i,o;const{header:s,colIndex:r}=t,{reverse:l}=e,a=s.isSelectionColumn&&e.enableRowSelection,d=Bn(t,e),c=document.createElement("div");if(c.className=d,c.id=J({accessor:s.accessor,rowId:"header"}),c.setAttribute("data-accessor",s.accessor+""),c.setAttribute("role","columnheader"),c.setAttribute("aria-colindex",r+1+""),s.children&&s.children.length>0){const t=U(s,e.headers,e.collapsedHeaders);c.setAttribute("aria-colspan",t+"")}if(K(s)){const t=null!==(i=null===(n=e.getCollapsedHeaders)||void 0===n?void 0:n.call(e))&&void 0!==i?i:e.collapsedHeaders;c.setAttribute("aria-expanded",!t.has(s.accessor)+"")}s.isSortable&&((null===(o=e.sort)||void 0===o?void 0:o.key.accessor)===s.accessor?c.setAttribute("aria-sort","asc"===e.sort.direction?"ascending":"descending"):c.setAttribute("aria-sort","none"));const h=((t,e)=>{const n=[];return t.type&&"other"!==t.type&&n.push(t.type+" column"),t.isSortable&&n.push("sortable"),e&&n.push("filterable"),t.tooltip&&n.push(t.tooltip),n.join(", ")})(s,!!s.filterable);if(h){const t="header-desc-"+s.accessor;c.setAttribute("aria-describedby",t);const e=document.createElement("span");e.id=t,e.className="st-sr-only",e.textContent=h,c.appendChild(e)}c.style.position="absolute",c.style.left=t.left+"px",c.style.top=t.top+"px",c.style.width=t.width+"px",c.style.height=t.height+"px";const u=tn(s,e),p=wn(s,e),f=mn(s,e),v=l!==("right"===e.pinned);if(v){const t=Pn(s,e);t&&c.appendChild(t)}s.headerRenderer||"right"!==s.align||(f&&c.appendChild(f),p&&c.appendChild(p),u&&c.appendChild(u));const w=document.createElement("div");if(w.className="st-header-label",s.headerRenderer)jn(w,s,r,e,{sortIcon:u,filterIcon:p,collapseIcon:f});else{const t=Ln(s,e);w.appendChild(t)}if(y(w,"click",t=>{a||((t,e,n,i)=>{if(!e.isSelectionColumn){if(i.selectableColumns){const o=j(e,n),s=o.some(t=>i.selectedColumns.has(t));if(i.enableHeaderEditing&&s&&!t.shiftKey){const t=document.getElementById(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=$n(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,s,r,e)}),y(w,"dblclick",t=>{a||((t,e,n)=>{e.isSelectionColumn||n.selectableColumns&&e.isSortable&&n.onSort(e.accessor)})(0,s,e)}),Dn(w,c,s,e),c.appendChild(w),s.headerRenderer||"right"===s.align||(f&&c.appendChild(f),p&&c.appendChild(p),u&&c.appendChild(u)),!v){const t=Pn(s,e);t&&c.appendChild(t)}return e.headerRegistry&&!s.isSelectionColumn&&e.headerRegistry.set(s.accessor+"",{setEditing:t=>{if(t){const t=w.querySelector(".st-header-label-text");if(t){t.innerHTML="";const n=$n(s,e,t);t.appendChild(n)}}}}),c})(e,n);s.dataset.stIconState=`${n.sort&&n.sort.key.accessor===e.header.accessor?n.sort.direction:"none"}|${n.filters&&n.filters[e.header.accessor]?"1":"0"}`,I&&n.animationCoordinator&&!n.animationCoordinator.hasSnapshotEntry(o)&&!n.animationCoordinator.wasRenderableBeforeAccordion(e.header.accessor+"")&&("vertical"===I?s.style.height="0px":s.style.width="0px",s.dataset.stAccordionGrow=I,M.push({element:s,cell:e})),i(t,f(e),v(e)).appendChild(s),c.set(o,s),w.set(o,{left:e.left,top:e.top,width:e.width,height:e.height})}),I&&M.length>0&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{for(const{element:t,cell:e}of M)t.isConnected&&("vertical"===I?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=c.get(J({accessor:t.header.accessor,rowId:"header"}));if(!e)return;const n=(t=>{const e=t.top,n=t.top+t.height,i=p.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)},zn=(t,e)=>{t.style.left="0",t.style.width="number"!=typeof e||0>e?"100%":e+"px"},Vn=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:zt({position:n,rowHeight:i,heightOffsets:s,customTheme:r});zn(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},qn=new WeakMap,Gn=new WeakMap,Kn=t=>(Gn.has(t)||Gn.set(t,new Map),Gn.get(t)),Un=(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),S=(t=>(qn.has(t)||qn.set(t,new Map),qn.get(t)))(t),C=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 M=c&&s.accordionAxis?s.accordionAxis:null,H="horizontal"===M?(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(!C.has(n)){const l=e.getAttribute("data-row-id");l&&Oe(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"===M&&c.shouldRetain(n)){const s=null!==(i=e.getAttribute("data-accessor"))&&void 0!==i?i:"";if(null===(o=null==H?void 0:H.has(s))||void 0===o||!o)return c.shrinkOutCell({cellId:n,element:e,container:t,axis:M}),void R.delete(n)}((t,e)=>{const n=Ee.get(t);void 0!==n&&(null==e||e.delete(n),Ee.delete(t))})(e,s.cellRegistry),null===(r=s.onRendererHostDiscard)||void 0===r||r.call(s,e),e.remove(),R.delete(n)}});const E=Kn(t);S.forEach((t,e)=>{k.has(e)||(t.remove(),S.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")},F=!!s.rowGrouping&&s.rowGrouping.length>0,P=t=>{var e;return(null!==(e=t.stableRowKey)&&void 0!==e?e:et(t.rowId))+""},$=new Map;if(F&&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)=>{$.set(P(e),{posinset:n+1,setsize:t.length})})})}const L=(t,e)=>{if(!F)return;const n=e.tableRow;t.setAttribute("aria-level",n.depth+1+"");const i=$.get(P(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&&lt(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),W(e));if(O(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(Le(n,e,s),e.header.isSelectionColumn&&s.enableRowSelection&&s.isRowSelected){const t=s.isRowSelected(e.rowId);Re(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);Ie(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){Le(o,e,s);const r=i(t,A(e),W(e));return O(r,e),L(r,e),o.parentElement!==r&&r.appendChild(o),void R.set(n,o)}const r=$e(e,s);M&&c&&!c.hasSnapshotEntry(n)&&!c.wasRenderableBeforeAccordion(e.header.accessor+"")&&("vertical"===M?r.style.height="0px":r.style.width="0px",r.dataset.stAccordionGrow=M,j.push({element:r,cell:e}));const l=i(t,A(e),W(e));O(l,e),L(l,e),l.appendChild(r),R.set(n,r)}),M&&j.length>0&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{for(const{element:t,cell:e}of j)t.isConnected&&("vertical"===M?t.style.height=e.height+"px":t.style.width=e.width+"px",delete t.dataset.stAccordionGrow)})}),((t,n,i,o,s)=>{const r=Kn(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=zt({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)&&(zn(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=Vn({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,S,l),o(t)};function Jn(t,e){return t?"string"==typeof t?t:t instanceof HTMLElement?t.cloneNode(!0):"function"==typeof t?t(e):null:null}function _n(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?Vt({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 Yn{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 Nn(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;Nn(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,S=d||"main";let C=this.bodySections.get(S);C||(C=document.createElement("div"),C.className="left"===d?"st-body-pinned-left":"right"===d?"st-body-pinned-right":"st-body-main",this.bodySections.set(S,C));const I=r.filter(t=>"left"===d?"left"===t.pinned:"right"===d?"right"===t.pinned:!t.pinned);if(0===I.length)return C.style.display="none",C;C.style.display="";const M=((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);C.style.cssText=`\n position: relative;\n ${void 0!==h?`width: ${h}px;`:""}\n ${d?"":"flex-grow: 1;"}\n height: ${M}px;\n `;const H=this.getCachedBodyCells(S,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(S,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(S):null,T=l.filter(t=>!t.nestedTable&&!t.stateIndicator).length;this.nextColIndexMap.set(S,H.length>0&&T>0?v+H.length/T:v);const A=this.getCachedContext("body-"+S,c,d,h);return Un(C,H,A,C.scrollLeft,l,w,R,null!=E?E:void 0),this.renderNestedGridRows(C,S,l,d,A,R),d||this.renderStateRows(C,S,l,A,R),!d&&C&&(C.__renderBodyCells=t=>{C&&Un(C,H,A,t,l,!0)}),C}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=Vt({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=Vt({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=Vt({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}),S=_({calculatedHeight:w,customHeight:m.height,customTheme:s}),C=Vt({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, ${C}px, 0)`,I.style.height=S+"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 M=document.createElement("div");M.setAttribute("role","gridcell"),M.style.height="100%",M.style.width="100%",I.appendChild(M);const H=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(M,H);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=Vt({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, ${Vt({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=Jn(e.loadingStateRenderer,{parentRow:i.parentRow}):i.state.error&&e.errorStateRenderer?r=Jn(e.errorStateRenderer,{error:i.state.error,parentRow:i.parentRow}):i.state.isEmpty&&e.emptyStateRenderer&&(r=Jn(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?Vt({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,_n(e))}),t}getFullSectionLayout(t){const e=this.bodySectionSnapshots.get(t);return e?_n(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 Xn=(t,e)=>{"string"==typeof e?t.innerHTML=e:(t.innerHTML="",t.appendChild(e.cloneNode(!0)))},Qn=(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(Qn([t],e,n),!1===t.hide){o=!0;break}(t||o)&&(i.hide=!1)}},Zn=t=>t.every(t=>t.hide),ti=t=>{t.forEach(t=>{t.children&&t.children.length>0&&(ti(t.children),Zn(t.children)&&(t.hide=!0))})},ei=(t,e)=>{const n=e.toLowerCase();return!!t.label.toLowerCase().includes(n)||!(!t.children||0>=t.children.length)&&t.children.some(t=>ei(t,e))},ni=(t,e,n)=>{if(!e.trim())return t;const i=n||ei;return t.filter(t=>!t.isSelectionColumn&&!t.excludeFromRender&&i(t,e))};function ii(t,e,n,i){e&&t.appendChild(e),t.appendChild(n),i&&t.appendChild(i)}function oi(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 si=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 S=null,C=null;if(o){const t=function(t){const e=document.createElement("div");e.className="st-column-editor-search-wrapper";const n=document.createElement("div");n.className="st-column-editor-search";const i=document.createElement("input");return i.type="text",i.value="",i.placeholder=t,i.className="st-filter-input",i.addEventListener("click",t=>t.stopPropagation()),i.addEventListener("input",t=>{f=t.target.value,F()}),n.appendChild(i),e.appendChild(n),{wrapper:e,input:i}}(s);C=t.wrapper,S=t.input}const I=document.createElement("div");I.className="st-column-editor-lists";let M=null;p&&(M=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 H=l.customRenderer;H?oi(R,H,n,C,I,M,p):ii(R,C,I,M),y.appendChild(R);const k=t=>{v=t,null!==t?m=!0:(m=!1,F())},E=()=>{w=null},T=t=>{w=t,m?W():F()},A=t=>{const e=b;b=t,F(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?ni(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?ni(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:S,previousExpandedHeaders:C}=t,I=null!==(e=t.essentialAccessors)&&void 0!==e?e:new Set,M=!1!==t.columnEditorConfig.allowColumnPinning,H=qe(p,I),k=!H,E=document.createDocumentFragment(),T=16*s+"px",A=p.children&&p.children.length>0,W=!(p.hide||A&&p.children&&Zn(p.children)),O=c.has(p.accessor),F=u||O,P=null!==f&&f.panelSection===(null!=v?v:"main");let $;if(0===w){const t=document.createElement("div");t.className="st-column-editor-drag-separator",t.style.opacity=P&&-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&&!Ke(t,I)||(null==S||S(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=gn(b,t.header.accessor),r=gn(b,o.header.accessor);if(!s||!r)return void n();const{newHeaders:c,emergencyBreak:u}=yn(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!==C?u||C.has(p.accessor):F,n=!u&&void 0!==C&&t!==F,i=n?t:F,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(he("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&&($=()=>{Ie(L,F,{ariaLabelWhenExpanded:`Collapse ${p.label} column`,ariaLabelWhenCollapsed:`Expand ${p.label} column`,syncAriaExpanded:!0})})}t.columnEditorConfig.rowRenderer||L.appendChild(e)}const N=Se({checked:W,onChange:t=>{if(!k)return;p.hide=!t,t?(Qn(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,Qn(i,p.children[0].accessor))):ti(i);const e=[...b];if(y(De(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||(N.element.classList.add("st-checkbox-disabled"),N.element.style.pointerEvents="none");const z=document.createElement("div");z.className="st-drag-icon-container";const V=null===(n=t.icons)||void 0===n?void 0:n.drag;"string"==typeof V?z.innerHTML=V:V instanceof HTMLElement||V instanceof SVGSVGElement?z.appendChild(V.cloneNode(!0)):z.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 q=document.createElement("div");q.className="st-column-label-container",q.textContent=p.label;const G="left"===p.pinned||"right"===p.pinned?p.pinned:null,K=!!G&&!H,U=!G&&"main"===v,J=!G&&"main"===v,_=()=>{const t=Xe(b,p.accessor,"left",I);t&&D(t)},Y=()=>{const t=Xe(b,p.accessor,"right",I);t&&D(t)},X=()=>{const t=Xe(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:N.element,dragIcon:z,labelContent:q},panelSection:v,isEssential:H,canToggleVisibility:k,allowColumnPinning:M,pinControl:M&&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(N.element),L.appendChild(z),L.appendChild(q),M&&0===s){const t=document.createElement("div");if(t.className="st-column-pin-side-group",t.addEventListener("mousedown",t=>{t.stopPropagation()}),t.addEventListener("dragstart",t=>{t.preventDefault(),t.stopPropagation()}),G){const e=document.createElement("div"),n=H;e.className="st-column-pin-btn st-column-pin-side st-column-pin-pinned-active"+(n?" st-column-pin-pinned-essential":""),e.textContent="left"===G?"L":"R",e.title=n?"Essential column — cannot be unpinned":"Unpin column",K&&e.addEventListener("click",t=>{t.stopPropagation(),X()}),t.appendChild(e)}else{if(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=P&&f.index===w?"1":"0",E.appendChild(Z),{fragment:E,scheduleExpandIconAnimation:$}})({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)})},F=t=>{I.innerHTML="";const e=!1!==l.allowColumnPinning,{pinnedLeft:i,unpinned:o,pinnedRight:s}=Ve(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 F(),{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!==H&&(H=n,e=!0),l=t.columnEditorConfig}void 0!==t.open&&(i=t.open,i?y.classList.add("open"):y.classList.remove("open")),S&&void 0!==t.searchPlaceholder&&(S.placeholder=t.searchPlaceholder),e&&(R.innerHTML="",H?oi(R,H,n,C,I,M,p):ii(R,C,I,M)),F()},destroy:()=>{S&&(S.removeEventListener("input",()=>{}),S.removeEventListener("click",()=>{})),y.removeEventListener("click",()=>{}),y.remove()}}},ri=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=$e(a,d);p.appendChild(c)}),m.appendChild(p);const f=Vn({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},li=(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 ai{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 Yn}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=Be(i.effectiveHeaders,"left")||Be(i.effectiveHeaders,void 0)||Be(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}=In({headers:i.effectiveHeaders,containerWidth:g.containerWidth,collapsedHeaders:i.collapsedHeaders}),R=null===(r=i.sortManager)||void 0===r?void 0:r.getState(),S=null===(l=i.filterManager)||void 0===l?void 0:l.getState(),C=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:Cn({containerWidth:g.containerWidth,leftWidth:b,rightWidth:y}),enableHeaderEditing:i.config.enableHeaderEditing,enableRowSelection:i.config.enableRowSelection,selectedRowCount:C,filters:null!==(p=null==S?void 0:S.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,getShrinkFloors:i.getShrinkFloors,onAutoExpandNaturalWidths:i.onAutoExpandNaturalWidths,essentialAccessors:i.essentialAccessors,selectableColumns:i.config.selectableColumns,headers:i.effectiveHeaders,rows:i.localRows,headerHeight:i.customTheme.headerHeight,lastHeaderIndex:i.effectiveHeaders.length-1,onSort:t=>{i.sortManager&&i.sortManager.updateSort({accessor:t})},handleApplyFilter:t=>{i.filterManager&&i.filterManager.updateFilter(t)},handleClearFilter:t=>{i.filterManager&&i.filterManager.clearFilter(t)},getHeaders:()=>i.getHeaders(),handleSelectAll:t=>{var e;null===(e=i.rowSelectionManager)||void 0===e||e.handleSelectAll(t)},setCollapsedHeaders:t=>{if("function"==typeof t){const e=i.getCollapsedHeaders?i.getCollapsedHeaders():i.collapsedHeaders;i.setCollapsedHeaders(t(e))}else i.setCollapsedHeaders(t);i.onRender()},setHeaders:t=>{i.setHeaders("function"==typeof t?t(i.getHeaders()):t),i.onRender()},setIsResizing:t=>{i.setIsResizing("function"==typeof t?t(i.isResizing):t)},onColumnWidthChange:i.config.onColumnWidthChange,onColumnOrderChange:i.config.onColumnOrderChange,onTableHeaderDragEnd:t=>{i.setHeaders(t),i.onRender()},onHeaderEdit:i.config.onHeaderEdit,onColumnSelect:i.config.onColumnSelect,selectColumns:i.selectionManager&&i.config.selectableColumns?(t,e)=>{i.selectionManager.selectColumns(t,e),i.onRender()}:t=>{},setSelectedColumns:i.selectionManager&&i.config.selectableColumns?t=>{const e=i.selectionManager.getSelectedColumns(),n="function"==typeof t?t(e):t;i.selectionManager.setSelectedColumns(n),i.onRender()}:t=>{},setSelectedCells:i.selectionManager?t=>{var e;const n=i.selectionManager.getSelectedCells(),o="function"==typeof t?t(n):t;i.selectionManager.setSelectedCells(o instanceof Set?o:new Set),null===(e=i.onRender)||void 0===e||e.call(i)}:t=>{},setInitialFocusedCell:i.selectionManager?t=>{var e;i.selectionManager.setInitialFocusedCell(null!=t?t:null),null===(e=i.onRender)||void 0===e||e.call(i)}:t=>{},areAllRowsSelected:()=>{var t,e;return null!==(e=null===(t=i.rowSelectionManager)||void 0===t?void 0:t.areAllRowsSelected())&&void 0!==e&&e},draggedHeaderRef:i.draggedHeaderRef,hoveredHeaderRef:i.hoveredHeaderRef,headerRegistry:i.headerRegistry,forceUpdate:()=>i.onRender(),mainBodyRef:i.mainBodyRef,pinnedLeftRef:i.pinnedLeftRef,pinnedRightRef:i.pinnedRightRef,accordionAxis:i.accordionAxis,animationCoordinator:i.animationCoordinator},M=i.effectiveHeaders.filter(t=>"left"===t.pinned),H=i.effectiveHeaders.filter(t=>!t.pinned),k=i.effectiveHeaders.filter(t=>"right"===t.pinned);let E=0;const T=[];if(M.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(H.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,S,C,I;if(!t)return;if(Be(n.effectiveHeaders,"left")||Be(n.effectiveHeaders,void 0)||Be(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 M=e.rowsToRender||e.currentTableRows,H=!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}),H){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}=In({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,F=null===(h=N(n.effectiveHeaders).find(t=>!t.isSelectionColumn))||void 0===h?void 0:h.accessor,P={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:F,rowHeight:n.customTheme.rowHeight,maxHeaderDepth:O,heightOffsets:e.paginatedHeightOffsets,customTheme:n.customTheme,containerWidth:k.containerWidth,mainSectionContainerWidth:E,mainSectionViewportWidth:Cn({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},$=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=[],z=n.positionOnlyBody?void 0:n.animationCoordinator;if($.length>0){const i=this.sectionRenderer.renderBodySection({headers:n.effectiveHeaders,rows:M,collapsedHeaders:n.collapsedHeaders,pinned:"left",context:P,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:z});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:M,collapsedHeaders:n.collapsedHeaders,context:P,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:z});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:M,collapsedHeaders:n.collapsedHeaders,pinned:"right",context:P,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:z});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&&(li(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:$.length>0?this.sectionRenderer.getNextColIndex("left"):0,right:L.length>0?this.sectionRenderer.getNextColIndex("main"):$.length>0?this.sectionRenderer.getNextColIndex("left"):0},r=M.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=ri({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=ri({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=ri({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:$,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!==(S=n.config.editColumns)&&void 0!==S&&S,headers:n.effectiveHeaders,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,cellRenderContext:P,sectionScrollController:null!==(C=n.sectionScrollController)&&void 0!==C?C: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&&(li(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),S=[];R.forEach((t,n)=>{if(0>t){const t=document.createElement("span");t.className="st-page-ellipsis",t.textContent="...",y.appendChild(t)}else{const o=document.createElement("button"),r=n>0&&0>R[n-1];o.className=["st-page-btn",e===t?"active":""].filter(Boolean).join(" "),o.textContent=""+t,o.setAttribute("aria-label","Go to page "+t),e===t&&o.setAttribute("aria-current","page"),o.addEventListener("click",()=>(async t=>{1>t||t>a||(i(t),s&&await s(t))})(t)),y.appendChild(o),S.push({button:o,page:t,afterEllipsis:r})}}),S.forEach((t,n)=>{const{button:i,page:o,afterEllipsis:s}=t,r=n+1,l=e===o,a=i.previousElementSibling,d=i.nextElementSibling,c=null!==a&&a.classList.contains("st-page-btn")&&a.classList.contains("active")||null!==d&&d.classList.contains("st-page-btn")&&d.classList.contains("active");r>9&&!(l||s||c)&&i.classList.add("st-page-btn--compact-hidden")});const C=document.createElement("button");C.className="st-next-prev-btn "+(m?"disabled":""),C.disabled=m,C.setAttribute("aria-label","Go to previous page"),c?Xn(C,c):C.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>',C.addEventListener("click",async()=>{const t=e-1;1>t||(i(t),s&&await s(t))}),y.appendChild(C);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?Xn(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.getPristineDefaultHeaders();t&&(o.setHeaders(De(t)),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=si({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)?Rn(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 Rn(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?F: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&&(Sn(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&&(Sn(this.horizontalScrollbarRef.current,this.sectionScrollController),this.horizontalScrollbarRef.current=null),this.stickyParentsContainer&&(li(this.stickyParentsContainer,this.sectionScrollController),this.stickyParentsContainer=null),this.sectionScrollController=null}}function di(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=[],S=[],C=null)=>{t.forEach((t,I)=>{var M,H;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:C}),F=v.length,P={row:t,depth:e,displayPosition:x,groupingKey:k,position:E,isLastGroupRow:!1,rowId:W,rowPath:T,rowIndexPath:A,absoluteRowIndex:E,parentIndices:S.length>0?[...S]:void 0,stableRowKey:O};v.push(P),w.push(P),x++;const $=st({stableRowKey:O,rowId:W});if(at($,e,r,o,s)&&n.length>e){const n=null==l?void 0:l.get($),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===(M=o.nestedTable.customTheme)||void 0===M?void 0:M.rowHeight)||u,r=(null===(H=o.nestedTable.customTheme)||void 0===H?void 0:H.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($,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($,k),stateIndicator:{parentRowId:$,parentRow:t,state:n},absoluteRowIndex:i,parentIndices:[...S,F]})}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:[...S,F]})}}else if(i.length>0){const t=[...T,k],n=[...A];b(i,e+1,t,n,[...S,F],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 ci{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 ai}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:S,maxHeaderDepth:C}=y,I=0===t.collapsedHeaders.size?"":[...t.collapsedHeaders].map(String).sort().join("\0");let M;t.positionOnlyBody&&!0!==t.config.autoExpandColumns&&this.scrollRafHeadersMemo&&this.scrollRafHeadersMemo.headersRef===t.headers&&this.scrollRafHeadersMemo.containerWidth===R&&this.scrollRafHeadersMemo.collapsedKey===I?M=this.scrollRafHeadersMemo.effectiveHeaders:(M=this.computeEffectiveHeaders(t.headers,t.config,t.customTheme,R),this.scrollRafHeadersMemo=!0!==t.config.autoExpandColumns?{headersRef:t.headers,containerWidth:R,collapsedKey:I,effectiveHeaders:M}:null);const{leftWidth:H,rightWidth:k}=In({headers:M,containerWidth:R,collapsedHeaders:t.collapsedHeaders});t.config.autoExpandColumns&&R>0&&(M=It(M,{autoExpandColumns:!0,containerWidth:R,pinnedLeftWidth:H,pinnedRightWidth:k,mainBodyRef:null!==(n=t.mainBodyRef)&&void 0!==n?n:{current:null},isResizing:null!==(i=t.isResizing)&&void 0!==i&&i,collapsedHeaders:t.collapsedHeaders}));let 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(),W=(null==T?void 0:T.sort)?`${T.sort.key.accessor}-${T.sort.direction}`:"none",F=JSON.stringify((null==A?void 0:A.filters)||{}),P=t.config.quickFilter,$=P?`${null!==(l=P.text)&&void 0!==l?l:""}|${null!==(a=P.mode)&&void 0!==a?a:"simple"}`:"",L=this.flattenedRowsCache&&this.flattenedRowsCache.deps.rowsRef===E&&this.flattenedRowsCache.deps.quickFilterKey===$&&this.flattenedRowsCache.deps.expandedRowsSize===t.expandedRows.size&&this.flattenedRowsCache.deps.collapsedRowsSize===t.collapsedRows.size&&this.flattenedRowsCache.deps.expandedDepthsSize===t.expandedDepths.size&&this.flattenedRowsCache.deps.rowStateMapSize===t.rowStateMap.size&&this.flattenedRowsCache.deps.sortKey===W&&this.flattenedRowsCache.deps.filterKey===F;let D,B,j;L&&this.flattenedRowsCache?(D=this.flattenedRowsCache.aggregatedRows,B=this.flattenedRowsCache.quickFilteredRows,j=this.flattenedRowsCache.flattenResult):(D=t.sortManager?E:Ot({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:M,quickFilter:t.config.quickFilter}),j=di({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:M,rowHeight:t.customTheme.rowHeight,headerHeight:t.customTheme.headerHeight,customTheme:t.customTheme}),this.flattenedRowsCache={aggregatedRows:D,quickFilteredRows:B,flattenResult:j,deps:{rowsRef:E,quickFilterKey:$,expandedRowsSize:t.expandedRows.size,collapsedRowsSize:t.collapsedRows.size,expandedDepthsSize:t.expandedDepths.size,rowStateMapSize:t.rowStateMap.size,sortKey:W,filterKey:F}});const N=(({height:t,maxHeight:e,rowHeight:n,totalRowCount:i,headerHeight:o,footerHeight:s,externalViewportHeight:r})=>{if(e){const t=Ht(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=Ht(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:S,footerHeight:!t.config.shouldPaginate&&!t.config.footerRenderer||t.config.hideFooter?void 0:t.customTheme.footerHeight,externalViewportHeight:t.externalViewportHeight}),z=null!==(u=t.config.shouldPaginate)&&void 0!==u&&u,V=null!==(p=t.config.rowsPerPage)&&void 0!==p?p:10,q=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===N?"":`${L?1:0}|${N}|${e.currentPage}|${V}|${z}|${q}|${t.customTheme.rowHeight}|${S}|${G}|${_}|${K}|${j.flattenedRows.length}|${U}|${J}`;let Q;return t.positionOnlyBody&&void 0!==N&&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=O(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=Nt({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=Kt(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:N,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=O(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,S,C,I=0,M=m.length;if(void 0===n)y=m,R=[],S=y,C=[];else{const t=Nt({bufferRowCount:w,contentHeight:n,tableRows:m,rowHeight:d,scrollTop:u,scrollDirection:h,heightMap:b});if(y=t.rendered.rows,I=t.rendered.startIndex,M=t.rendered.endIndex,s)if(v){const e=Kt(m,t.rendered.rows,t.fullyVisible.rows,t.partiallyVisible.rows,v);R=e.stickyParents,S=e.regularRows,C=t.partiallyVisible.rows}else R=[],S=t.rendered.rows,C=[];else R=[],S=y,C=[]}return{currentTableRows:m,rowsToRender:y,renderedStartIndex:I,renderedEndIndex:M,stickyParents:R,regularRows:S,partiallyVisibleRows:C,paginatedHeightOffsets:x,heightMap:b,allFlattenedRows:r,pageStartIndex:g}}({flattenedRows:j.flattenedRows,paginatableRows:j.paginatableRows,parentEndPositions:j.parentEndPositions,currentPage:e.currentPage,rowsPerPage:V,shouldPaginate:z,serverSidePagination:q,contentHeight:N,rowHeight:t.customTheme.rowHeight,scrollTop:e.scrollTop,scrollDirection:e.scrollDirection,heightOffsets:j.heightOffsets,customTheme:t.customTheme,enableStickyParents:_,rowGrouping:t.config.rowGrouping}),void 0!==N?(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:M,calculatedHeaderHeight:S,maxHeaderDepth:C,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 S=!0===n.positionOnlyBody;if(S&&null!==this.lastScrollRafPaintedRange&&R.renderedStartIndex===this.lastScrollRafPaintedRange.start&&R.renderedEndIndex===this.lastScrollRafPaintedRange.end)return;null===(h=n.rowSelectionManager)||void 0===h||h.updateConfig({tableRows:R.currentTableRows});const{mainWidth:C,leftWidth:I,rightWidth:M,leftContentWidth:H,rightContentWidth:k}=In({headers:g,containerWidth:m,collapsedHeaders:n.collapsedHeaders}),E=m-I-M;if(!S){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?F: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=S?{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()),S||(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,C,I,M,H,k,e.tableBodyContainerRef.current,g,n))}renderHeader(t,e,n,i,o){if(o.config.hideHeader)return;const s=this.buildRendererDeps(i,o);this.tableRenderer.renderHeader(t,e,n,s)}renderBody(t,e,n,i,o){const s=this.buildRendererDeps(n,i,o);this.tableRenderer.renderBody(t,e,s)}renderFooter(t,e,n,i,o){const s=this.buildRendererDeps(i,o);this.tableRenderer.renderFooter(t,e,n,t=>{o.setCurrentPage(t),o.onRender()},s)}renderColumnEditor(t,e,n,i,o){const s=this.buildRendererDeps(i,o);this.tableRenderer.renderColumnEditor(t,e,t=>{o.setColumnEditorOpen(t),o.onRender()},n,s)}renderHorizontalScrollbar(t,e,n,i,o,s,r,l,a){if(!a.mainBodyRef.current||!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,getShrinkFloors:e.getShrinkFloors,onAutoExpandNaturalWidths:e.onAutoExpandNaturalWidths,setIsResizing:e.setIsResizing,setHeaders:e.setHeaders,setCollapsedHeaders:e.setCollapsedHeaders,setCollapsedRows:e.setCollapsedRows,setExpandedRows:e.setExpandedRows,setRowStateMap:e.setRowStateMap,getCollapsedRows:e.getCollapsedRows,getCollapsedHeaders:e.getCollapsedHeaders,getExpandedRows:e.getExpandedRows,getHeaders:e.getHeaders,getPristineDefaultHeaders:e.getPristineDefaultHeaders,getRowStateMap:e.getRowStateMap,positionOnlyBody:e.positionOnlyBody,essentialAccessors:e.essentialAccessors}}cleanup(){this.tableRenderer.cleanup()}}const hi=t=>{if(null==t)return"";const e=t+"";return e.includes(",")||e.includes('"')||e.includes("\n")||e.includes("\r")?`"${e.replace(/"/g,'""')}"`:e};class ui{static createAPI(t){const e=()=>{var e;return(null===(e=t.getCachedFlattenResult)||void 0===e?void 0:e.call(t))||di({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=>hi(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 hi(r)}if(!1!==t.useFormattedValueForCSV&&t.valueFormatter){const s=t.valueFormatter({accessor:t.accessor,colIndex:i,row:n,rowIndex:e,value:o});return hi(s)}return hi(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:()=>Je(t.headers),applyPinnedState:async e=>{const n=Ye(t.headers,e,t.essentialAccessors);n&&(t.setHeaders(n),t.onRender())},resetColumns:()=>{t.setHeaders(De(t.getPristineDefaultHeaders())),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 qe(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 pi=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}},fi=()=>"undefined"!=typeof window&&window.innerHeight>0?window.innerHeight:1/0,vi=(t,e)=>{if(!t||!e)return null;const n=pi(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),fi());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 wi{constructor(t,e){var n,i;this.draggedHeaderRef={current:null},this.hoveredHeaderRef={current:null},this.localRows=[],this.headers=[],this.pristineDefaultHeaders=[],this.essentialAccessors=new Set,this.autoSizeAccessors=new Set,this.pendingAutoSize=new Set,this.naturalWidths=new Map,this.isAutoSizing=!1,this.currentPage=1,this.scrollTop=0,this.scrollDirection="none",this.isResizing=!1,this.isScrolling=!1,this._positionOnlyBody=!1,this.firstRenderDone=!1,this.internalIsLoading=!1,this.scrollbarWidth=0,this.isMainSectionScrollable=!1,this.columnEditorOpen=!1,this.collapsedHeaders=new Set,this.expandedDepths=new Set,this.expandedRows=new Map,this.collapsedRows=new Map,this.rowStateMap=new Map,this.announcement="",this.cellRegistry=new Map,this.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=Qe.mergeCustomTheme(e),this.mergedColumnEditorConfig=Qe.mergeColumnEditorConfig(e),this.resolvedIcons=Qe.resolveIcons(e),this.localRows=[...e.rows],this.headers=[...e.defaultHeaders],this.pristineDefaultHeaders=De(e.defaultHeaders),this.essentialAccessors=Qe.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=Qe.getInitialCollapsedHeaders(e.defaultHeaders),this.expandedDepths=Qe.getInitialExpandedDepths(e),this.autoSizeAccessors=this.computeAutoSizeAccessors(),this.pendingAutoSize=new Set(this.autoSizeAccessors),this.domManager=new Ze,this.renderOrchestrator=new ci,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=vi(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(Ne,i+"ms"),s.style.setProperty(ze,o),s.classList.add(je),null!==this.accordionCleanupTimerId&&window.clearTimeout(this.accordionCleanupTimerId),this.accordionCleanupTimerId=window.setTimeout(()=>{s.classList.remove(je),s.style.removeProperty(Ne),s.style.removeProperty(ze),this.accordionCleanupTimerId=null},i+80)}initializeManagers(){var t,e,n;this.ariaAnnouncementManager=new le,this.ariaAnnouncementManager.subscribe(t=>{this.announcement=t,this.updateAriaLiveRegion()}),this.expandedDepthsManager=new re(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 Ft({headers:this.headers,tableRows:this.localRows,externalSortHandling:this.config.externalSortHandling||!1,onSortChange:t=>{var e,n;return null===(n=(e=this.config).onSortChange)||void 0===n?void 0:n.call(e,t)},rowGrouping: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 Dt({rows:this.localRows,headers:this.headers,externalFilterHandling:this.config.externalFilterHandling||!1,onFilterChange:t=>{var e,n;return null===(n=(e=this.config).onFilterChange)||void 0===n?void 0:n.call(e,t)},announce:i}),this.filterManager.subscribe(t=>{this.sortManager&&this.sortManager.updateConfig({tableRows:t.filteredRows}),this.render("filterManager")}),this.selectionManager=new Zt({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:t=>{var e,n;return null===(n=(e=this.config).onCellEdit)||void 0===n?void 0:n.call(e,t)},cellRegistry:this.cellRegistry,collapsedHeaders:this.collapsedHeaders,rowHeight:this.customTheme.rowHeight,enableRowSelection: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=ae(i.tableBodyContainerRef.current);const s=this.renderOrchestrator.computeEffectiveHeaders(this.headers,this.config,this.customTheme);this.dimensionManager=new kt({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 Et({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 Tt({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 Mt({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 oe({headerContainer:i.headerContainerRef.current,mainSection:i.tableBodyContainerRef.current,scrollbarWidth:this.scrollbarWidth}),this.scrollbarVisibilityManager.subscribe(t=>{this.isMainSectionScrollable=t,i.tableBodyContainerRef.current&&(this.scrollbarWidth=ae(i.tableBodyContainerRef.current)),this.render("scrollbarVisibilityManager")})),this.windowResizeManager=new ne,this.windowResizeManager.addCallback(()=>{var t;if(i.tableBodyContainerRef.current){const e=ae(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 ee({tableRows:[],onRowSelectionChange:this.config.onRowSelectionChange,enableRowSelection:!0}),this.rowSelectionManager.subscribe(()=>{this.render("rowSelectionManager")})),this.selectionManager&&(this.handleOutsideClickManager=new ie({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&&wi.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=vi(this.resolvedScrollParent,n);if(!i)return;let o=i.visibleViewportHeight;o>0||(o=(()=>{const t=pi(this.resolvedScrollParent);return t?Math.min(t.height,fi()):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=vi(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 wi(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"),getShrinkFloors:()=>this.getShrinkFloors(),onAutoExpandNaturalWidths:t=>this.recordNaturalWidths(t),setIsResizing:t=>{var e,n,i,o,s,r,l,a;if(this.isResizing=t,this.autoScaleManager&&!1===t){const t=this.domManager.getRefs(),d=null!==(a=null!==(r=null!==(i=null===(n=null===(e=t.tableBodyContainerRef)||void 0===e?void 0:e.current)||void 0===n?void 0:n.clientWidth)&&void 0!==i?i:null===(s=null===(o=t.mainBodyRef)||void 0===o?void 0:o.current)||void 0===s?void 0:s.clientWidth)&&void 0!==r?r:null===(l=this.dimensionManager)||void 0===l?void 0:l.getState().containerWidth)&&void 0!==a?a:0;this.autoScaleManager.updateConfig({isResizing:!1,containerWidth:d})}},setHeaders:t=>{this.didColumnVisibilityChange(t)?this.beginAccordionAnimation("horizontal"):this.captureAnimationSnapshot(),this.headers=De(t),this.renderOrchestrator.invalidateCache("header")},animationCoordinator:this.animationCoordinator,setCollapsedHeaders:t=>{this.beginAccordionAnimation("horizontal"),this.collapsedHeaders=t},setCollapsedRows:t=>{this.beginAccordionAnimation("vertical"),this.collapsedRows="function"==typeof t?t(this.collapsedRows):t,this.render("expansion")},setExpandedRows:t=>{this.beginAccordionAnimation("vertical"),this.expandedRows="function"==typeof t?t(this.expandedRows):t,this.render("expansion")},setRowStateMap:t=>{this.beginAccordionAnimation("vertical"),this.rowStateMap="function"==typeof t?t(this.rowStateMap):t,this.render("rowStateMap")},getCollapsedRows:()=>this.collapsedRows,getCollapsedHeaders:()=>this.collapsedHeaders,getExpandedRows:()=>this.expandedRows,getHeaders:()=>this.headers,getPristineDefaultHeaders:()=>this.pristineDefaultHeaders,getRowStateMap:()=>this.rowStateMap,setColumnEditorOpen:t=>{this.columnEditorOpen=t},setCurrentPage:t=>{t!==this.currentPage&&this.config.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,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}getShrinkFloors(){var t;const e=new Map,n=t=>{if(t.children&&t.children.length>0&&t.children.forEach(n),"number"==typeof t.width)e.set(t.accessor+"",t.width);else if("string"==typeof t.width&&t.width.trim().endsWith("px")){const n=parseFloat(t.width);Number.isFinite(n)&&e.set(t.accessor+"",n)}};this.pristineDefaultHeaders.forEach(n);const i=new Map,o=mt(this.headers,this.collapsedHeaders);for(const n of o){const o=n.accessor+"",s=null!==(t=this.naturalWidths.get(o))&&void 0!==t?t:e.get(o);i.set(o,Math.max(null!=s?s:0,wt(n)))}return i}recordNaturalWidths(t){t.forEach((t,e)=>this.naturalWidths.set(e,t))}applyMeasuredWidths(t){const e=n=>{const i=Object.assign({},n);return 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),t.forEach((t,e)=>this.naturalWidths.set(e+"",t))}maybeAutoSizeColumns(){if(this.isAutoSizing||0===this.pendingAutoSize.size)return;const t=this.getAutoSizeStyleRoot();if(t instanceof HTMLElement&&t.querySelector(".st-header-cell")){this.isAutoSizing=!0;try{const e=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=yt(e,{rows:i,header:s,styleRoot:t,theme:this.config.theme,autoSizeMode:s.autoSizeMode,sortIcon:this.resolvedIcons.sortUp});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.pristineDefaultHeaders=De(t.defaultHeaders),this.essentialAccessors=Qe.buildEssentialAccessors(this.headers),this.autoSizeAccessors=this.computeAutoSizeAccessors(),this.pendingAutoSize=new Set(this.autoSizeAccessors),this.naturalWidths.clear(),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=Qe.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(je),w.style.removeProperty(Ne),w.style.removeProperty(ze),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&&Oe(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 ui.createAPI({config:this.config,localRows:this.localRows,effectiveHeaders:t,get headers(){return e.headers},getPristineDefaultHeaders:()=>e.pristineDefaultHeaders,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=De(t),this.renderOrchestrator.invalidateCache("header")},setCurrentPage:t=>{this.currentPage=t},setColumnEditorOpen:t=>{this.columnEditorOpen=t,this.render("columnEditor-toggle")}})}}function mi(t){return t}wi.EXTERNAL_SCROLL_MAX_RETRIES=60;export{wi as SimpleTableVanilla,mi as asRows};
1
+ const t="parentExpanded",e={rowHeight:32,headerHeight:32,footerHeight:49,rowSeparatorWidth:1,borderWidth:1,pinnedBorderWidth:1,nestedGridBorderWidth:2,nestedGridPaddingTop:8,nestedGridPaddingBottom:8,nestedGridPaddingLeft:8,nestedGridPaddingRight:8,nestedGridMaxHeight:400,selectionColumnWidth:42},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())},S=.5,C="st-cell-animating-out",I="data-animating-out",M="data-shrinking-out",H=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=F()}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;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)}shouldAnimateVerticalTransition(t){const e=this.getScrollerMetrics(t.container),n=A(t.beforeTop,t.cellHeight,e),i=A(t.afterTop,t.cellHeight,e);return n||i}shouldAnimateHorizontalTransition(t){const e=this.getScrollerMetrics(t.container),n=W(t.beforeLeft,t.cellWidth,e),i=W(t.afterLeft,t.cellWidth,e);return n||i}shouldAnimateTransition(t){const e=Math.abs(t.beforeTop-t.afterTop)>=S,n=Math.abs(t.beforeLeft-t.afterLeft)>=S;return!(!e||!this.shouldAnimateVerticalTransition({beforeTop:t.beforeTop,afterTop:t.afterTop,cellHeight:t.cellHeight,container:t.container}))||!(!n||!this.shouldAnimateHorizontalTransition({beforeLeft:t.beforeLeft,afterLeft:t.afterLeft,cellWidth:t.cellWidth,container:t.container}))}shouldMountIncomingCell(t){var e;const n=null===(e=this.snapshot)||void 0===e?void 0:e.get(t.cellId);if(!n)return!0;const i=this.getScrollerMetrics(t.container),o=A(n.styleTop,t.cellHeight,i),s=A(t.afterTop,t.cellHeight,i),r=W(n.styleLeft,t.cellWidth,i),l=W(t.afterLeft,t.cellWidth,i);return o||s||r||l}isCellRenderedInScrollerViewport(t,e){const n=t.getBoundingClientRect();if(0===n.width&&0===n.height)return!1;const i=e.getBoundingClientRect(),o=n.right>i.left&&i.right>n.left,s=this.externalVerticalScroll?null:e.parentElement;if(!s)return o;const r=s.getBoundingClientRect();return o&&n.bottom>r.top&&r.bottom>n.top}shouldRetainDomCellAtScrollExtrema(t,e){var n;const i=null===(n=this.snapshot)||void 0===n?void 0:n.get(t);if(!i||null===i.sourceContainer)return!1;const o=this.getScrollerMetrics(e);if(o.clientHeight>=o.scrollHeight)return!1;const s=o.scrollTop+o.clientHeight>=o.scrollHeight-1,r=1>=o.scrollTop;if(!s&&!r)return!1;const l=o.clientHeight;return!(!s||o.scrollTop-l>i.styleTop)||!(!r||i.styleTop>o.scrollTop+l)}retainCell(t){var e;const{cellId:n,element:i,container:o,newPosition:s}=t,r=E(i.style.top),l=E(i.style.left),a=this.getScrollerMetrics(o),d=O(s.top,r,s.height,a,"y"),c=O(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(C),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(M)?(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(C),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(C),i.setAttribute(I,"true"),i.setAttribute(M,"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(M))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)&&S>Math.abs(h.styleTop-p)&&S>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:O(h.top,p,v,m,"y"),x=f||!m?h.left:O(h.left,u,w,m,"x"),b=null!=m?m:this.getScrollerMetrics(a),y=E(t.style.height)||t.offsetHeight||v||0;let R=g;const C=!!b&&A(p,y,b);if(!l&&b&&C){const t=b.scrollTop,e=b.scrollTop+b.clientHeight;(l||null!==h.sourceContainer||h.fromDom||Math.abs(g-p)>=S&&!A(g,y,b))&&A(g,y,b)||(R=g>p?e:t-y)}let I=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);I=t.left-h.sourceContainerLeft}let H=x-u-I,k=R-p-0;S>Math.abs(H)&&S>Math.abs(k)?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:H,dy:k,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.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)=>{const i=n.clientHeight;return 0>=i||i>=n.scrollHeight||t>=n.scrollTop&&n.scrollTop+i>t},W=(t,e,n)=>{const i=n.clientWidth;return 0>=i||i>=n.scrollWidth||t>=n.scrollLeft&&n.scrollLeft+i>t},O=(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},F=()=>{if("undefined"==typeof window||"function"!=typeof window.matchMedia)return!1;try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch(t){return!1}},P=t=>Math.ceil(800/(t+1)),$=29.5,L=150,D=["lineAreaChart","barChart"],B=500,j=40,z=(t,e,n)=>e&&n?480>t?.25:768>t?.3:.4:(t=>480>t?.4:768>t?.5:.6)(t),N=(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},V=t=>t.flatMap(t=>t.children&&0!==t.children.length?V(t.children):[t]),q=t=>t.flatMap(t=>{const e=[t];return t.children&&t.children.length>0&&e.push(...q(t.children)),e}),G=(t=0)=>t?t+1:0,K=(t,e)=>{const n=q(t);for(const t of n)if(t.children&&t.children.length>0&&t.children.some(t=>t.accessor===e))return t;return null},U=(e,n,i)=>{const o=K(n,e.accessor);if(o){const n=i.has(o.accessor),s=e.showWhen||t;return n?"parentExpanded"===s:"parentCollapsed"===s}return!1},J=t=>{var e;return!(!(null===(e=t.children)||void 0===e?void 0:e.length)||!t.collapsible)},_=(t,e,n)=>{if(!t.children||0===t.children.length)return 1;const i=V(t.children);let o=0;for(const t of i)t.hide||U(t,e,n)||(o+=1);return o},Y=({accessor:t,rowId:e})=>`${e}-${t}`,X=({calculatedHeight:t,customHeight:e,customTheme:n})=>e?("string"==typeof e?parseFloat(e):e)+n.nestedGridPaddingTop+n.nestedGridPaddingBottom:t,Q=t=>{const e=t.match(/^(.+?)\[(\d+)\]$/);return e?{key:e[1],index:parseInt(e[2],10)}:{key:t,index:null}},Z=(t,e)=>{const n=e+"";return n.includes(".")||n.includes("[")?n.split(".").reduce((t,e)=>{if(null==t)return;const{key:n,index:i}=Q(e);let o=t[n];return null!==i&&Array.isArray(o)&&(o=o[i]),o},t):t[e]},tt=(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}=Q(o[t]);if(null==s[e]){const n=Q(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}=Q(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},et=t=>Array.isArray(t)&&t.length>0&&"object"==typeof t[0]&&null!==t[0],nt=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},it=t=>t.join("-"),ot=new WeakMap;let st=0;const rt=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=ot.get(t);if(void 0!==e)return e;const n="__row_"+ ++st;return ot.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("/")},lt=t=>t.stableRowKey?t.stableRowKey:it(t.rowId),at=(t,e)=>`${t+""}nested-chrome${(null!=e?e:"")+""}`,dt=(t,e)=>!!e&&et(t[e]),ct=(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},ht=(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=>ht(t,n))]:0===i.length?[e]:i.flatMap(t=>ht(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=>ht(t,n))]:i.flatMap(t=>ht(t,n))};function ut(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 pt(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 ft(t,e){const n=t.map(t=>ut(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(L,"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:L);else a.set(t.accessor,L)}),a}function vt(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=pt(t);i=ft(e,n)}else{const e=pt(t),n=e.map(t=>ut(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=ft(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 wt=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(Y({accessor:t.accessor,rowId:"header"}));return(null==e?void 0:e.offsetWidth)||L}},mt=t=>{var e;const n=t.width;"string"==typeof n&&n.includes("fr")&&(t.width=(null===(e=document.getElementById(Y({accessor:t.accessor,rowId:"header"})))||void 0===e?void 0:e.offsetWidth)||L),t.children&&t.children.length>0&&t.children.forEach(t=>{mt(t)})},gt=t=>"number"==typeof t.minWidth?t.minWidth:j,xt=(t,e)=>{const n=[];return t.forEach(t=>{t.hide||n.push(...ht(t,e))}),n},bt=t=>t instanceof HTMLElement?t:document.body,yt=t=>t.replace(/["\\]/g,"\\$&"),Rt=(t,e)=>{const n=document.createElement("span");n.style.visibility="hidden",n.style.position="absolute",n.style.whiteSpace="nowrap",n.style.width="auto";const i=window.getComputedStyle(e);n.style.font=i.font,n.style.fontSize=i.fontSize,n.style.fontWeight=i.fontWeight,n.style.fontFamily=i.fontFamily,n.style.letterSpacing=i.letterSpacing,n.style.padding=i.padding,n.textContent=t,document.body.appendChild(n);const o=n.offsetWidth;return document.body.removeChild(n),o},St=(t,e)=>{var n,i,o,s,r,l;const{rows:a,header:d,maxWidth:c=B,headSampleSize:h,stridedSampleSize:u,sampleSize:p,outlierPercentile:f,outlierThreshold:v,autoSizeMode:w=(null!==(n=null==d?void 0:d.autoSizeMode)&&void 0!==n?n:"content"),theme:m,styleRoot:g,sortIcon:x}=e||{},b=null!==(i=null!=h?h:p)&&void 0!==i?i:25,y=null!=u?u:null!=p?0:75,R=null!=g?g:document,S=Y({accessor:t,rowId:"header"}),C=R instanceof HTMLElement?R.querySelector(`[id="${yt(S)}"]`):document.getElementById(S),I=null!=C?C:R.querySelector(".st-header-cell");if(!I)return L;const M=window.getComputedStyle(I),H=parseFloat(M.paddingLeft)||0,k=parseFloat(M.paddingRight)||0,E=parseFloat(M.gap)||0;let T=H+k;const A=null==C?void 0:C.querySelector(".st-header-label");let W=!1;if(A){const t=A.querySelector(".st-header-label-text");if((null==d?void 0:d.headerRenderer)||!t){const t=((t,e)=>{const n=document.createElement("div");n.style.visibility="hidden",n.style.position="absolute",n.style.top="-99999px",n.style.left="-99999px",n.style.whiteSpace="nowrap",n.style.width="max-content";const i=t.cloneNode(!0);i.style.flex="none",i.style.width="max-content",i.style.minWidth="0",i.style.maxWidth="none",i.style.overflow="visible",i.style.height="auto";const o=window.getComputedStyle(t);i.style.font=o.font,i.style.fontSize=o.fontSize,i.style.fontWeight=o.fontWeight,i.style.fontFamily=o.fontFamily,i.style.letterSpacing=o.letterSpacing,n.appendChild(i);const s=bt(e);s.appendChild(n);const r=n.offsetWidth;return s.removeChild(n),r})(A,R);if(1>t){if(null==d?void 0:d.label){const t=null!==(o=R.querySelector(".st-header-label-text"))&&void 0!==o?o:A;T+=Rt(d.label+"",t)}}else T+=t,W=!!A.querySelector('.st-icon-container[aria-label^="Sort"]')}else T+=Rt(null!==(s=t.textContent)&&void 0!==s?s:"",t)}else if(null==d?void 0:d.label){const t=null!==(r=R.querySelector(".st-header-label-text"))&&void 0!==r?r:I;T+=Rt(d.label+"",t)}const O=C?Array.from(C.children):[];let F=1;for(let t=0;O.length>t;t++){const e=O[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&&(T+=(e.offsetWidth||0)+(parseFloat(n.marginLeft)||0)+(parseFloat(n.marginRight)||0),F++,(null===(l=e.getAttribute("aria-label"))||void 0===l?void 0:l.startsWith("Sort"))&&(W=!0))}(null==d?void 0:d.isSortable)&&!W&&x&&(T+=((t,e)=>{const n=document.createElement("div");n.className="st-icon-container",n.style.visibility="hidden",n.style.position="absolute",n.style.top="-99999px",n.style.left="-99999px","string"==typeof t?n.innerHTML=t:n.appendChild(t.cloneNode(!0));const i=bt(e);i.appendChild(n);const o=window.getComputedStyle(n),s=n.offsetWidth+(parseFloat(o.marginLeft)||0)+(parseFloat(o.marginRight)||0);return i.removeChild(n),s})(x,R),F++),E>0&&F>1&&(T+=E*(F-1));let P=0;const $=d&&d.type&&D.includes(d.type);if(a&&a.length>0&&!$&&"header"!==w){const e=document.createElement("div");e.style.visibility="hidden",e.style.position="absolute",e.style.top="-99999px",e.style.left="-99999px",e.style.whiteSpace="nowrap",e.style.width="auto",e.style.display="inline-block";let n=0,i=0;const o=R.querySelector(".st-cell-content");if(o){const t=window.getComputedStyle(o);e.style.font=t.font,e.style.fontSize=t.fontSize,e.style.fontFamily=t.fontFamily,n=parseFloat(t.paddingLeft)||0,i=parseFloat(t.paddingRight)||0}document.body.appendChild(e);const s=[],r=t=>(e.textContent=t,e.offsetWidth+n+i),l=((t,e,n)=>{if(0>=t)return[];const i=Math.max(0,Math.floor(e)),o=Math.max(0,Math.floor(n));if(i+o>=t)return Array.from({length:t},(t,e)=>e);const s=new Set;for(let e=0;Math.min(i,t)>e;e++)s.add(e);const r=i,l=t-r;if(o>0&&l>0){const e=Math.max(1,Math.floor(l/o));for(let n=0;o>n;n++){const i=r+n*e;if(i>=t)break;s.add(i)}s.add(t-1)}return Array.from(s).sort((t,e)=>t-e)})(a.length,b,y);for(const o of l){const l=a[o];let c;c=(null==d?void 0:d.valueGetter)?d.valueGetter({accessor:t,row:l,rowIndex:o}):Z(l,t);let h=c;(null==d?void 0:d.valueFormatter)&&null!=c&&(h=d.valueFormatter({accessor:t,colIndex:0,row:l,rowIndex:o,value:c}));let u=-1;if(null==d?void 0:d.cellRenderer)try{const s=d.cellRenderer({accessor:t,colIndex:0,row:l,rowIndex:o,theme:m,value:c,formattedValue:h});if("string"==typeof s||"number"==typeof s)u=r(s+"");else if(s instanceof Node){e.textContent="",e.appendChild(s);const t=e.offsetWidth+n+i;e.textContent="",u=t>n+i?t:-1}}catch(t){u=-1}0>u&&(u=r(null!=h?h+"":"")),s.push(u)}document.body.removeChild(e),(null==d?void 0:d.cellRenderer)&&R.querySelectorAll(`.st-cell[data-accessor="${yt(t+"")}"] .st-cell-content`).forEach(t=>{const e=t;if(e.querySelector(".st-loading-skeleton"))return;const o=((t,e)=>{const n=document.createElement("div");n.style.visibility="hidden",n.style.position="absolute",n.style.top="-99999px",n.style.left="-99999px",n.style.whiteSpace="nowrap",n.style.width="max-content";const i=t.cloneNode(!0);i.style.flex="none",i.style.width="max-content",i.style.minWidth="0",i.style.maxWidth="none",i.style.overflow="visible",i.style.padding="0";const o=window.getComputedStyle(t);i.style.font=o.font,i.style.fontSize=o.fontSize,i.style.fontFamily=o.fontFamily,i.style.letterSpacing=o.letterSpacing,n.appendChild(i);const s=bt(e);s.appendChild(n);const r=n.offsetWidth;return s.removeChild(n),r})(e,R);o>0&&s.push(o+n+i)}),P=((t,e)=>{var n,i,o;if(0===t.length)return 0;const s=Math.max(...t),r=null!==(n=null==e?void 0:e.percentile)&&void 0!==n?n:95,l=null!==(i=null==e?void 0:e.threshold)&&void 0!==i?i:.5;if((null!==(o=null==e?void 0:e.minSampleForClip)&&void 0!==o?o:20)>t.length)return s;const a=((t,e)=>{if(0===t.length)return 0;if(1===t.length)return t[0];const n=[...t].sort((t,e)=>t-e),i=Math.min(100,Math.max(0,e))/100*(n.length-1),o=Math.floor(i),s=Math.ceil(i);return o===s?n[o]:n[o]+(n[s]-n[o])*(i-o)})(t,r);return a>0&&s>a*(1+l)?a:s})(s,{percentile:f,threshold:v})}let z="header"===w?T:Math.max(T,P);$&&(z=Math.max(z,150));const N="number"==typeof(null==d?void 0:d.maxWidth)?d.maxWidth:"string"==typeof(null==d?void 0:d.maxWidth)&&parseFloat(d.maxWidth+"")||void 0,V=null!=N?N:c;return z>V&&(z=V),Math.max(z+2,"number"==typeof(null==d?void 0:d.minWidth)?d.minWidth:"string"==typeof(null==d?void 0:d.minWidth)&&parseFloat(d.minWidth+"")||j,j)};class Ct{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 It=t=>"number"==typeof t.width?t.width:"string"==typeof t.width&&t.width.endsWith("px")?parseFloat(t.width):150,Mt=(t,e)=>{const n=new Map,i=t.map(It),o=i.reduce((t,e)=>t+e,0);if(0===o)return n;const s=e/o;if(.01>s-1)return n;const r=t.map((t,e)=>{const n="number"==typeof t.maxWidth?t.maxWidth:"string"==typeof t.maxWidth?parseFloat(t.maxWidth):NaN;return Number.isFinite(n)&&n>0?Math.max(n,i[e]):1/0}),l=new Map;let a=s;for(;;){const t=i.map((t,e)=>e).filter(t=>!l.has(t));if(0===t.length)break;const n=Array.from(l.values()).reduce((t,e)=>t+e,0),o=t.reduce((t,e)=>t+i[e],0);a=Math.max(1,(e-n)/o);const s=t.filter(t=>i[t]*a>r[t]);if(0===s.length)break;s.forEach(t=>l.set(t,r[t]))}const d=t.map((t,e)=>{const n=l.get(e);return Math.round(void 0!==n?n:i[e]*a)});let c=-1;for(let e=t.length-1;e>=0;e--)if(!l.has(e)){c=e;break}if(c>=0){const t=d.reduce((t,e,n)=>n===c?t:t+e,0);d[c]=Math.round(Math.min(Math.max(e-t,i[c]),r[c]))}return t.forEach((t,e)=>{n.set(t.accessor,d[e])}),n},Ht=(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=xt(d,l),p=xt(c,l),f=xt(h,l),v=new Map;if(u.length>0&&Mt(u,o).forEach((t,e)=>v.set(e,t)),p.length>0&&Mt(p,s).forEach((t,e)=>v.set(e,t)),f.length>0&&a>0&&Mt(f,a).forEach((t,e)=>v.set(e,t)),0===v.size)return t;const w=(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=>w(t,i)),s=v.get(t.accessor);return Object.assign(Object.assign({},t),void 0!==s?{width:s,children:o}:{children:o})};return t.map(t=>w(t,t.pinned))};class kt{constructor(t,e){var n;this.config=t,this.onHeadersUpdate=e,this.isResizingTracker=new Ct(null!==(n=t.isResizing)&&void 0!==n&&n),this.containerWidthTracker=new Ct(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 Ht(t,this.config)}setHeaders(t,e){const n="function"==typeof t?t(e):t;return this.applyAutoScale(n)}destroy(){this.onHeadersUpdate=()=>{}}}const Et=(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 Tt{constructor(t){this.subscribers=new Set,this.resizeObserver=null,this.rafId=null,this.resizeNotifyDebounceId=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 Et(t,e)}calculateContentHeight(){const{height:t,maxHeight:e,rowHeight:n,totalRowCount:i,headerHeight:o,footerHeight:s,externalViewportHeight:r}=this.config;if(e){const t=this.convertHeightToPixels(e);if(0===t)return;const r=o||n;if(t>=r+i*n+(s||0))return;return Math.max(0,t-r)}if(!t&&void 0!==r&&r>0)return Math.max(0,r-(o||n));if(!t)return;const l=this.convertHeightToPixels(t);return 0!==l?Math.max(0,l-n):void 0}cancelPendingResizeNotify(){null!==this.resizeNotifyDebounceId&&(clearTimeout(this.resizeNotifyDebounceId),this.resizeNotifyDebounceId=null)}scheduleResizeNotify(){this.cancelPendingResizeNotify(),this.resizeNotifyDebounceId=setTimeout(()=>{this.resizeNotifyDebounceId=null,this.notifySubscribers()},50)}observeContainer(t){this.resizeObserver=new ResizeObserver(()=>{null!==this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=requestAnimationFrame(()=>{this.rafId=null;const e=t.clientWidth,n=e!==this.state.containerWidth;n&&(this.state=Object.assign(Object.assign({},this.state),{containerWidth:e})),this.initialNotifyPending?(this.initialNotifyPending=!1,this.cancelPendingResizeNotify(),this.notifySubscribers()):n&&this.scheduleResizeNotify()})}),this.resizeObserver.observe(t),this.applyContainerWidthSync(t)}applyContainerWidthSync(t){const e=t.clientWidth;e>0&&e!==this.state.containerWidth&&(this.state=Object.assign(Object.assign({},this.state),{containerWidth:e}),this.initialNotifyPending=!0)}updateConfig(t){const e=this.config.effectiveHeaders,n=this.config.containerElement;this.config=Object.assign(Object.assign({},this.config),t);let i=!1;if(t.effectiveHeaders&&t.effectiveHeaders!==e){const t=this.calculateMaxHeaderDepth(),e=this.calculateHeaderHeight(t);this.state=Object.assign(Object.assign({},this.state),{maxHeaderDepth:t,calculatedHeaderHeight:e}),i=!0}if("height"in t||"maxHeight"in t||void 0!==t.totalRowCount||void 0!==t.externalViewportHeight){const t=this.calculateContentHeight();this.state=Object.assign(Object.assign({},this.state),{contentHeight:t}),i=!0}if(t.containerElement&&t.containerElement!==n&&(this.resizeObserver&&n&&this.resizeObserver.unobserve(n),this.observeContainer(t.containerElement),i=!0),void 0!==t.rowHeight||void 0!==t.headerHeight||void 0!==t.footerHeight){const t=this.calculateHeaderHeight(this.state.maxHeaderDepth),e=this.calculateContentHeight();this.state=Object.assign(Object.assign({},this.state),{calculatedHeaderHeight:t,contentHeight:e}),i=!0}i&&this.notifySubscribers()}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}notifySubscribers(){this.subscribers.forEach(t=>t(this.state))}getState(){return this.state}getContainerWidth(){return this.state.containerWidth}getCalculatedHeaderHeight(){return this.state.calculatedHeaderHeight}getMaxHeaderDepth(){return this.state.maxHeaderDepth}getContentHeight(){return this.state.contentHeight}destroy(){null!==this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.cancelPendingResizeNotify(),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.subscribers.clear()}}class At{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 Wt{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 Ot={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)=>Ot.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?Ot.string(t,e,n):"number"==typeof t&&"number"==typeof e?Ot.number(t,e,n):"boolean"==typeof t&&"boolean"==typeof e?Ot.boolean(t,e,n):Ot.string(t+"",e+"",n)},Ft=({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=Z(e,l),a=Z(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 Ot.number(o,s,i)}return"date"===n?Ot.date(t+"",e+"",i):"boolean"===n?Ot.boolean(!!t,!!e,i):"enum"===n?Ot.enum(t+"",e+"",i):Ot.string(t+"",e+"",i)})(i,a,s,r)})})({rows:e,sortColumn:n,headers:t}),Pt=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=>q(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&&et(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&&et(n))s(n);else{const n=Z(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&&tt(a,t.accessor,e)}),a}return t});return l(r)};class $t{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=q(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=Ft({headers:e,rows:n,sortColumn:i});return t&&0!==t.length?o.map(n=>{const o=t[0],s=n[o];if(et(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=Pt({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}):Ft({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 Lt=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)},Dt=t=>new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0),Bt=t=>{if(!t)return new Date;if("string"==typeof t)return Lt(t);if("number"==typeof t){const e=new Date(t);return isNaN(e.getTime())?new Date:Dt(e)}return t instanceof Date?Dt(t):new Date};class jt{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=q(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=Bt(t),s=Bt((i||"")+""),r=Dt(e),l=Dt(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=>Dt(Bt((t||"")+"")));return r>=t&&e>=r}return!1;case"notBetween":if(o&&2===o.length){const[t,e]=o.map(t=>Dt(Bt((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}})(Z(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 zt=(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},Nt=(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},Vt=({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=zt(Math.max(0,i-c),r);let f=zt(u,r)+1;f=Math.min(o.length,f);const v=i,w=i+e;let m=zt(v,r);v>a[m]&&(m=Math.min(m+1,o.length));let g=zt(w,r);g=Math.min(o.length,g);const x=i+e,b=zt(i,r);let y=zt(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)}}},qt=({position:t,rowHeight:e,heightOffsets:n,customTheme:i})=>t*(e+i.rowSeparatorWidth)-i.rowSeparatorWidth+Nt(t,n),Gt=({position:t,rowHeight:e,heightOffsets:n,customTheme:i})=>t*(e+i.rowSeparatorWidth)+Nt(t,n),Kt=(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},Ut=new Map,Jt=(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=Ut.get(f);if(v&&v.firstVisiblePosition===h&&v.renderedStartPosition===u&&v.renderedEndPosition===p)return v.result;const w=_t({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:i,partiallyVisibleRowIndex:0,recursionDepth:0,stickyParents:[],rowGrouping:o});if(Ut.set(f,{result:w,firstVisiblePosition:h,renderedStartPosition:u,renderedEndPosition:p}),Ut.size>50){const t=Ut.keys().next().value;void 0!==t&&Ut.delete(t)}return w},_t=({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=>it(t.rowId)===it(i.rowId))||(r.push(i),d++)}}if(r.length>0){Kt(a,t)&&(r.push(a),d++);const e=i[o+=d];e&&(a=e)}}else if(Kt(a,t))return r.push(a),o++,_t({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:i,partiallyVisibleRowIndex:o,recursionDepth:s+1,stickyParents:r,rowGrouping:l});return Kt(a,t)?_t({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:i,partiallyVisibleRowIndex:o,recursionDepth:s+1,stickyParents:r,rowGrouping:l}):{stickyParents:r,regularRows:e}},Yt=(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)}},Xt=(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=>it(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=Vt({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 Yt(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&&Yt(e,o,s)},100);Yt(d,o,s)},Qt=({rowIndex:t,colIndex:e,rowId:n})=>`${t}-${e}-${n}`;function Zt(t,e,n,i){const o=new Set,s=new Map;n.forEach((t,e)=>{const n=it(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=it(n[t].rowId);o.add(Qt({colIndex:e,rowIndex:t,rowId:s}))}return o}function te(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 ee{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=>ht(t,this.config.collapsedHeaders)),this.rowIdToTableIndex.clear(),this.config.tableRows.forEach((t,e)=>{this.rowIdToTableIndex.set(it(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(it(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(`${it(e.rowId)}\t${t}`),this.rowsWithSelectedCells.add(it(e.rowId))})})}updateRowIdAndSelectionLookupOnly(){this.rowIdToTableIndex.clear(),this.config.tableRows.forEach((t,e)=>{this.rowIdToTableIndex.set(it(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(`${it(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?it(o.rowId):null)!==i){const t=this.config.tableRows.findIndex(t=>it(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=it(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=it(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=it(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=it(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=it(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=it(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=it(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=it(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=it(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=it(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=it(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=it(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=it(this.config.tableRows[i].rowId);this.selectCellRange(this.startCell,{rowIndex:i,colIndex:n,rowId:t})}else{const t=it(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=it(this.config.tableRows[i].rowId);this.selectCellRange(this.startCell,{rowIndex:i,colIndex:n,rowId:t})}else{const t=it(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=Z(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=>it(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=it(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(tt(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=it(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(Z(c.row,h.accessor))?[]:""),tt(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=it(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=Qt({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 q(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 ee.HEADER_SELECTION_CLASSES)i.classList.remove(t);continue}if(l.isSelectionColumn&&this.config.enableRowSelection){for(const t of ee.HEADER_SELECTION_CLASSES)i.classList.remove(t);continue}const a=N(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 ee.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 ee.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 ee.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 ee.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=Qt({rowIndex:o,colIndex:t,rowId:i});if(this.selectedCells.has(e))return!0}const s=Qt({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?it(r.rowId):null,a=this.config.tableRows[o+1],d=a?it(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=Qt({colIndex:t,rowIndex:e,rowId:n});return this.copyFlashCells.has(i)}isWarningFlashing({colIndex:t,rowIndex:e,rowId:n}){const i=Qt({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=Qt(t);this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.selectedCells=new Set([e]),this.initialFocusedCell=t,this.updateDerivedState(),this.updateAllCellClasses(),setTimeout(()=>Xt(t,this.config.rowHeight,this.config.customTheme,this.config.tableRows),0)}}selectCellRange(t,e){this.fullTableSelected=!1;const n=Zt(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(()=>Xt(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=Zt(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 te(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 te(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=Qt({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)}}}ee.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"],ee.HEADER_SELECTION_CLASSES=["st-header-selected","st-header-has-highlighted-cell"];const ne=(t,e)=>t.filter(t=>!(!t||!t.rowId)&&e.has(it(t.rowId))).map(t=>t.row);class ie{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:ne(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(it(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=>it(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=>it(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=>it(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=>it(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 oe{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 se{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 re{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 le=(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 ae{constructor(t,e){this.observers=new Set,this.expandedDepths=le(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 de{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 ce(t){return t?t.offsetWidth-t.clientWidth:0}const he=(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},ue=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},pe=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},fe=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},ve=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},we=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},me=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},ge=(t,e)=>new Date(t,e+1,0).getDate(),xe=["January","February","March","April","May","June","July","August","September","October","November","December"],be=["Su","Mo","Tu","We","Th","Fr","Sa"],ye=(t,e,n)=>{const{header:i,row:o}=t,s=Z(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=>{tt(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=Y({accessor:s.accessor,rowId:null!==(o=t.stableRowKey)&&void 0!==o?o:t.rowId}),w=document.getElementById(v);return d=he(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=>{tt(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=Y({accessor:s.accessor,rowId:null!==(o=t.stableRowKey)&&void 0!==o?o:t.rowId}),w=document.getElementById(v);return c=he(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?Lt(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:ue("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:pe("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",be.forEach(t=>{const e=document.createElement("div");e.className="st-datepicker-weekday",e.textContent=t,R.appendChild(e)});const S=document.createElement("div");S.className="st-datepicker-footer";const C=document.createElement("button");C.className="st-datepicker-today-btn",C.textContent="Today",l(C,"click",()=>{const t=new Date,e=new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0);I(e)}),S.appendChild(C),v.appendChild(w),v.appendChild(R),v.appendChild(S);const I=t=>{const n=t.toISOString().split("T")[0];tt(d,a.accessor,n),e.onCellEdit&&e.onCellEdit({accessor:a.accessor,newValue:n,row:d,rowIndex:c}),h.remove(),i()},M=()=>{var t,e,n;for(x.textContent=`${xe[f]} ${p}`;R.children.length>7;)null===(t=R.lastElementChild)||void 0===t||t.remove();const i=ge(p,f),o=new Date(p,f,1).getDay(),s=ge(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=xe[f-1])&&void 0!==e?e:xe[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",`${xe[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=xe[f+1])&&void 0!==n?n:xe[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--),M()}),l(b,"click",()=>{f++,f>11&&(f=0,p++),M()}),M();const H=Y({accessor:a.accessor,rowId:null!==(r=t.stableRowKey)&&void 0!==r?r:t.rowId}),k=document.getElementById(H);return h=he(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}tt(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)};let Re=0;const Se=()=>{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},Ce=(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(Se()))},Ie=({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(Se());const r=()=>{const t=o.checked;o.setAttribute("aria-checked",""+t),t?(s.classList.add("st-checked"),s.appendChild(Se())):(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(Se())):(s.classList.remove("st-checked"),s.innerHTML=""))},destroy:()=>{o.removeEventListener("change",r)}}},Me=new WeakMap,He=(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+"")})})},ke=(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)?Bt(t).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):null==t?"":t+""},Ee=(t,e,n)=>{var i;const{header:o,row:s,rowIndex:r,colIndex:a,depth:d,rowId:c}=t,h=Z(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)=>Ie({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&&dt(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=lt(t.tableRow),s=((t,e,n)=>{const i=document.createElement("div");i.className="st-icon-container st-expand-icon-container "+(n?"expanded":"collapsed"),i.setAttribute("role","button"),i.setAttribute("aria-label",n?"Collapse row":"Expand row"),i.setAttribute("aria-expanded",n+""),i.setAttribute("tabindex","0");const o=e.icons.expand;o&&("string"==typeof o?i.innerHTML=o:(o instanceof HTMLElement||o instanceof SVGSVGElement)&&i.appendChild(o.cloneNode(!0)));const s=n=>{var o,s;n.stopPropagation();const r=i.closest("[data-row-id]"),l=r?Me.get(r):void 0,a=null!==(o=null==l?void 0:l.tableRow)&&void 0!==o?o:t.tableRow,d=null!==(s=null==l?void 0:l.row)&&void 0!==s?s:t.row,c=lt(a),h=a.depth,u=new Set(e.expandedDepths),p=e.getExpandedRows?e.getExpandedRows():e.expandedRows,f=e.getCollapsedRows?e.getCollapsedRows():e.collapsedRows,v=ct(c,h,u,p,f),w=!v;if(v?(e.setCollapsedRows(t=>{const e=new Map(t);return e.set(c,h),e}),e.setExpandedRows(t=>{const e=new Map(t);return e.delete(c),e}),e.setRowStateMap(t=>{const e=new Map(t);return e.delete(c),e})):(e.setExpandedRows(t=>{const e=new Map(t);return e.set(c,h),e}),e.setCollapsedRows(t=>{const e=new Map(t);return e.delete(c),e})),e.onRowGroupExpand&&a.rowIndexPath&&e.rowGrouping){const n=t.header.pinned,i=t=>{setTimeout(()=>{e.setRowStateMap(e=>{const i=new Map(e),o=i.get(c)||{};return i.set(c,Object.assign(Object.assign({},o),{loading:t,triggerSection:n})),i})},0)},o=t=>{e.setRowStateMap(e=>{const i=new Map(e),o=i.get(c)||{};return i.set(c,Object.assign(Object.assign({},o),{error:t,loading:!1,triggerSection:n})),i})},s=(t,i)=>{e.setRowStateMap(e=>{const i=new Map(e),o=i.get(c)||{};return i.set(c,Object.assign(Object.assign({},o),{isEmpty:t,loading:!1,triggerSection:n})),i})};e.onRowGroupExpand({row:d,depth:h,event:{stopPropagation:()=>{},preventDefault:()=>{}},groupingKey:e.rowGrouping[h],isExpanded:w,rowIndexPath:a.rowIndexPath,rowIdPath:a.rowPath,groupingKeys:e.rowGrouping,setLoading:i,setError:o,setEmpty:s})}};return l(i,"click",s),l(i,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),s(t))}),i})(t,e,ct(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="st-line-area-gradient-"+ ++Re,u=document.createElementNS("http://www.w3.org/2000/svg","svg");u.setAttribute("width",n+""),u.setAttribute("height",i+""),u.setAttribute("preserveAspectRatio","none"),u.setAttribute("class",("st-line-area-chart "+a).trim()),u.style.display="block";let p="number"==typeof n?n:100;const f=()=>{u.innerHTML="";const t=p,n=i;u.setAttribute("viewBox",`0 0 ${t} ${n}`);const a=void 0!==d?d:Math.min(...e),f=(void 0!==c?c:Math.max(...e))-a||1,v=l/2+.5,w=Math.max(1,t-2*v),m=Math.max(1,n-2*v),g=e.map((t,n)=>({x:1===e.length?v+w/2:v+n/(e.length-1)*w,y:v+m-(t-a)/f*m})),x=g.map((t,e)=>`${0===e?"M":"L"} ${t.x.toFixed(2)},${t.y.toFixed(2)}`).join(" "),b=g[0].x,y=`${x} L ${g[g.length-1].x.toFixed(2)},${n} L ${b.toFixed(2)},${n} Z`,R=s||"var(--st-chart-fill-color)",S=document.createElementNS("http://www.w3.org/2000/svg","defs"),C=document.createElementNS("http://www.w3.org/2000/svg","linearGradient");C.setAttribute("id",h),C.setAttribute("x1","0"),C.setAttribute("y1","0"),C.setAttribute("x2","0"),C.setAttribute("y2","1");const I=document.createElementNS("http://www.w3.org/2000/svg","stop");I.setAttribute("offset","0%"),I.style.stopColor=R,I.setAttribute("stop-opacity",r+"");const M=document.createElementNS("http://www.w3.org/2000/svg","stop");M.setAttribute("offset","100%"),M.style.stopColor=R,M.setAttribute("stop-opacity",.15*r+""),C.appendChild(I),C.appendChild(M),S.appendChild(C),u.appendChild(S);const H=document.createElementNS("http://www.w3.org/2000/svg","path");H.setAttribute("d",y),H.setAttribute("fill",`url(#${h})`),H.setAttribute("stroke","none");const k=document.createElementNS("http://www.w3.org/2000/svg","path");k.setAttribute("d",x),k.setAttribute("fill","none"),k.setAttribute("stroke",o||"var(--st-chart-color)"),k.setAttribute("stroke-width",l+""),k.setAttribute("stroke-linecap","round"),k.setAttribute("stroke-linejoin","round"),u.appendChild(H),u.appendChild(k)};f();const v="undefined"!=typeof ResizeObserver?new ResizeObserver(t=>{var e,n;const i=null!==(n=null===(e=t[0])||void 0===e?void 0:e.contentRect.width)&&void 0!==n?n:0;i>0&&Math.abs(i-p)>=.5&&(p=i,f())}):null;return null==v||v.observe(u),{element:u,update:t=>{void 0===t.data||(e=t.data,e&&0!==e.length)?(void 0!==t.width&&(n=t.width,u.setAttribute("width",n+""),"number"==typeof n&&(p=n)),void 0!==t.height&&(i=t.height,u.setAttribute("height",i+"")),void 0!==t.color&&(o=t.color),void 0!==t.fillColor&&(s=t.fillColor),void 0!==t.fillOpacity&&(r=t.fillOpacity),void 0!==t.strokeWidth&&(l=t.strokeWidth),void 0!==t.className&&(a=t.className,u.setAttribute("class",("st-line-area-chart "+a).trim())),void 0!==t.min&&(d=t.min),void 0!==t.max&&(c=t.max),f()):u.innerHTML=""},destroy:()=>{null==v||v.disconnect(),u.remove()}}})(Object.assign({data:t,width:"100%",height:30},o.chartOptions));return void((null==e?void 0:e.element)&&n.appendChild(e.element))}}else if("barChart"===o.type&&Array.isArray(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=document.createElementNS("http://www.w3.org/2000/svg","svg");d.setAttribute("width",n+""),d.setAttribute("height",i+""),d.setAttribute("preserveAspectRatio","none"),d.setAttribute("class",("st-bar-chart "+r).trim()),d.style.display="block";let c="number"==typeof n?n:100;const h=()=>{d.innerHTML="";const t=c,n=i;d.setAttribute("viewBox",`0 0 ${t} ${n}`);const r=void 0!==l?l:Math.min(...e),h=void 0!==a?a:Math.max(...e),u=h-r||1,p=e.length;let f=Math.max(0,s);p>1&&1>(t-f*(p-1))/p&&(f=Math.max(0,Math.floor((t-p)/(p-1))));const v=(t-f*(p-1))/p,w=v+f,m=0>r,g=m?n*(h/u):n;e.forEach((t,e)=>{let i,s;m?0>t?(i=g,s=g+Math.abs(t)/u*n):(i=g-t/u*n,s=g):(i=n-(t-r)/u*n,s=n);const l=Math.round(e*w),a=Math.max(l+1,Math.round(e*w+v)),c=Math.round(i),h=Math.max(c+1,Math.round(s)),p=document.createElementNS("http://www.w3.org/2000/svg","rect");p.setAttribute("x",l+""),p.setAttribute("y",c+""),p.setAttribute("width",a-l+""),p.setAttribute("height",h-c+""),p.setAttribute("fill",o||"var(--st-chart-color)"),p.setAttribute("rx",Math.min(1,(a-l)/3)+""),d.appendChild(p)})};h();const u="undefined"!=typeof ResizeObserver?new ResizeObserver(t=>{var e,n;const i=null!==(n=null===(e=t[0])||void 0===e?void 0:e.contentRect.width)&&void 0!==n?n:0;i>0&&Math.abs(i-c)>=.5&&(c=i,h())}):null;return null==u||u.observe(d),{element:d,update:t=>{void 0===t.data||(e=t.data,e&&0!==e.length)?(void 0!==t.width&&(n=t.width,d.setAttribute("width",n+""),"number"==typeof n&&(c=n)),void 0!==t.height&&(i=t.height,d.setAttribute("height",i+"")),void 0!==t.color&&(o=t.color),void 0!==t.gap&&(s=t.gap),void 0!==t.className&&(r=t.className,d.setAttribute("class",("st-bar-chart "+r).trim())),void 0!==t.min&&(l=t.min),void 0!==t.max&&(a=t.max),h()):d.innerHTML=""},destroy:()=>{null==u||u.disconnect(),d.remove()}}})(Object.assign({data:t,width:"100%",height:30},o.chartOptions));return void((null==e?void 0:e.element)&&n.appendChild(e.element))}}if(o.cellRenderer){try{const 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=ke(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=ke(h,o,a,s,r);if(null!==e){const t=document.createTextNode(e);n.appendChild(t)}}return}const m=ke(h,o,a,s,r);if(null!==m){const t=document.createTextNode(m);n.appendChild(t)}},Te=new Map,Ae=new WeakMap,We=new WeakMap;let Oe=null;const Fe=(t,e)=>{Te.has(t)||Te.set(t,new Set),Te.get(t).add(e)},Pe=(t,e)=>{const n=Te.get(t);n&&(n.delete(e),0===n.size&&Te.delete(t))},$e=(t,e)=>{const n=Te.get(t);n&&n.forEach(t=>{e?t.classList.add("st-row-hovered"):t.classList.remove("st-row-hovered")})},Le=(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(" ")},De=(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=Le(t,e),v=document.createElement("div");v.className=f,v.id=Y({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=Me.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=ye(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)ye(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"),Ee(t,l,e),v.appendChild(e)}};x(),t.header.expandable||We.set(v,{row:t.row,value:Z(r,s.accessor),theme:e.theme,skeleton:!(!e.isLoading&&!t.tableRow.isLoadingSkeleton)});const b={row:r,tableRow:t.tableRow,context:e};Me.set(v,b);const y=()=>{var n;if(e.cellRegistry&&!h){const i=Y({accessor:s.accessor,rowId:null!==(n=t.stableRowKey)&&void 0!==n?n:c});Ae.set(v,i),e.cellRegistry.set(i,{updateContent:t=>{var n,i;if(!m){if(tt(b.row,s.accessor,t),x(),!s.expandable){const t=null!==(i=null===(n=Me.get(v))||void 0===n?void 0:n.context)&&void 0!==i?i:e;We.set(v,{row:b.row,value:Z(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=Me.get(v))||void 0===n?void 0:n.row)&&void 0!==i?i:r,u=Z(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+"";Fe(t,v);const e=()=>{var e;const n=null!==(e=v.getAttribute("data-row-id"))&&void 0!==e?e:t;null!==Oe&&Oe!==n&&$e(Oe,!1),$e(n,!0),Oe=n},n=()=>{var e;const n=null!==(e=v.getAttribute("data-row-id"))&&void 0!==e?e:t;$e(n,!1),Oe===n&&(Oe=null)};l(v,"mouseenter",e),l(v,"mouseleave",n)}return v},Be=(t,e,n)=>{var i,o,s,r;const{rowIndex:l,colIndex:a,rowId:d}=e,c={rowIndex:l,colIndex:a,rowId:d};t.className=Le(e,n);const h=n.isInitialFocusedCell(c);t.setAttribute("tabindex",h?"0":"-1"),t.style.left=e.left+"px",t.style.top=e.top+"px";const u=t.dataset.stAccordionGrow;"horizontal"!==u&&(t.style.width=e.width+"px"),"vertical"!==u&&(t.style.height=e.height+"px"),t.setAttribute("data-row-index",l+""),t.setAttribute("data-col-index",a+"");const p=null!==(i=n.maxHeaderDepth)&&void 0!==i?i:1;t.setAttribute("aria-rowindex",e.tableRow.position+p+1+""),t.setAttribute("aria-colindex",a+1+""),n.enableRowSelection?t.setAttribute("aria-selected",(null===(o=n.isRowSelected)||void 0===o?void 0:o.call(n,d))?"true":"false"):t.hasAttribute("aria-selected")&&t.removeAttribute("aria-selected");const f=void 0!==n.rowHeaderAccessor&&e.header.accessor===n.rowHeaderAccessor?"rowheader":"gridcell";t.getAttribute("role")!==f&&t.setAttribute("role",f);const v=t.getAttribute("data-row-id"),w=d+"";v&&v!==w&&(Pe(v,t),Fe(w,t)),t.setAttribute("data-row-id",w),t.setAttribute("data-accessor",e.header.accessor+"");const m=Me.get(t);if(m?(m.row=e.row,m.tableRow=e.tableRow,m.context=n):Me.set(t,{row:e.row,tableRow:e.tableRow,context:n}),e.header.expandable){const i=t.querySelector(".st-cell-content");i&&!(!n.isLoading&&!e.tableRow.isLoadingSkeleton)!=(null!==i.querySelector(".st-loading-skeleton"))&&(null===(s=n.onRendererHostDiscard)||void 0===s||s.call(n,i),i.innerHTML="",Ee(e,n,i))}else{const i=t.querySelector(".st-cell-content");if(i){const o=We.get(t),s=Z(e.row,e.header.accessor),l=!(!n.isLoading&&!e.tableRow.isLoadingSkeleton);void 0!==o&&o.row===e.row&&o.value===s&&o.theme===n.theme&&o.skeleton===l||(We.set(t,{row:e.row,value:s,theme:n.theme,skeleton:l}),null===(r=n.onRendererHostDiscard)||void 0===r||r.call(n,i),i.innerHTML="",Ee(e,n,i))}}},je=t=>{if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map(je);const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=je(t[n]));return e},ze=(t,e)=>t.filter(t=>t.pinned===e).some(t=>!t.hide&&!t.excludeFromRender),Ne="st-accordion-animating",Ve="--st-accordion-duration",qe="--st-accordion-easing";function Ge(t){return{pinnedLeft:t.filter(t=>"left"===t.pinned),unpinned:t.filter(t=>!t.pinned),pinnedRight:t.filter(t=>"right"===t.pinned)}}function Ke(t,e){return!0===t.isEssential||e.has(t.accessor+"")}function Ue(t,e){let n=!1;for(const i of t){if(i.isSelectionColumn||i.excludeFromRender)continue;const t=Ke(i,e);if(t&&n)return!1;t||(n=!0)}return!0}function Je(t,e){var n;const{pinnedLeft:i,unpinned:o,pinnedRight:s}=Ge(t);if(!Ue(i,e))return!1;if(!Ue(o,e))return!1;if(!Ue(s,e))return!1;for(const i of t)if((null===(n=i.children)||void 0===n?void 0:n.length)&&!_e(i.children,e))return!1;return!0}function _e(t,e){var n;if(!Ue(t,e))return!1;for(const i of t)if((null===(n=i.children)||void 0===n?void 0:n.length)&&!_e(i.children,e))return!1;return!0}function Ye(t){const{pinnedLeft:e,unpinned:n,pinnedRight:i}=Ge(t);return{left:e.map(t=>t.accessor),main:n.map(t=>t.accessor),right:i.map(t=>t.accessor)}}function Xe(t,e,n){return[...t.filter(t=>Ke(e.get(t+""),n)),...t.filter(t=>!Ke(e.get(t+""),n))]}function Qe(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=Xe(e.left,s,n),l=Xe(e.main,s,n),a=Xe(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 Ze(t,e,n,i){const o=e+"",s=Ye(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&&(!Ke(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),Qe(t,{left:r,main:l,right:a},i)):null}class tn{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:we("st-drag-icon"),expand:pe("st-expand-icon"),filter:me("st-header-icon"),headerCollapse:pe("st-header-icon"),headerExpand:ue("st-header-icon"),next:pe("st-next-prev-icon"),prev:ue("st-next-prev-icon"),sortDown:ve("st-header-icon"),sortUp:fe("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 le(null===(e=t.expandAll)||void 0===e||e,t.rowGrouping)}}class en{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 nn=(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},on={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"},sn={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"]},rn=["equals","notEquals","isEmpty","isNotEmpty"],ln=(t,e)=>{var n;const i=null!==(n=sn[t])&&void 0!==n?n:rn;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},an=t=>!["between","notBetween","in","notIn","isEmpty","isNotEmpty"].includes(t),dn=t=>["between","notBetween","in","notIn"].includes(t),cn=t=>["isEmpty","isNotEmpty"].includes(t),hn=t=>{var e;return null!==(e=null==t?void 0:t.closest(".simple-table-root"))&&void 0!==e?e:null},un=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=hn(g))&&void 0!==e?e:hn(null!=r?r:null))&&void 0!==n?n:hn(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)&&(S(!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}S(!1),null==a||a()}},y=t=>{"Escape"===t.key&&d&&(S(!1),null==a||a())},R=t=>{"Enter"===t.key&&b(t)},S=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?S(!0):m.style.display="none",{element:m,update:t=>{void 0!==t.anchorElement&&(g=t.anchorElement),void 0!==t.open&&S(t.open),void 0!==t.children&&(m.innerHTML="",m.appendChild(t.children)),void 0!==t.width&&(h=t.width,m.style.width=h?h+"px":"auto"),void 0!==t.maxWidth&&(u=t.maxWidth,m.style.maxWidth=u?u+"px":""),void 0!==t.overflow&&(c=t.overflow,m.style.overflow=v?"visible":c),void 0!==t.allowDescendantOverflow&&(v=t.allowDescendantOverflow,m.classList.toggle(w,v),m.style.overflow=v?"visible":c)},destroy:()=>{S(!1),m.remove()},setOpen:S}},pn=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=un({children:m,containerRef:l,mainBodyRef:a,anchorElement:u,onClose:()=>{C(!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),C(!1),c=-1,g()},R=()=>{if(!r){if(C(!d),d)c=-1;else{const t=i.findIndex(t=>t.value===e);c=0>t?0:t}g()}},S=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),C(!1),c=-1,g()}break;case"Escape":t.preventDefault(),C(!1),c=-1,g()}},C=t=>{d=t,u.setAttribute("aria-expanded",""+d),d?(h.classList.add("st-custom-select-open"),document.addEventListener("keydown",S)):(h.classList.remove("st-custom-select-open"),document.removeEventListener("keydown",S)),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",S),x.destroy(),h.remove()},setOpen:C}},fn=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()}}},vn=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()}}},wn=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()}}},mn=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=ln("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=pn({value:d,onChange:t=>{d=t,x()},options:l.map(t=>({value:t,label:on[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},an(d)&&{value:c});i(t)},g=()=>cn(d)||""!==c.trim(),x=()=>{f&&(f.remove(),f=null),v&&(v.destroy(),v=null),an(d)&&(f=document.createElement("div"),f.className="st-filter-section",v=fn({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=vn({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=ln("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=pn({value:h,onChange:t=>{h=t,I()},options:d.map(t=>({value:t,label:on[t]})),containerRef:l,mainBodyRef:a});w.appendChild(m.element),v.appendChild(w);let g=null,x=null,b=null,y=null,R=null;const S=()=>{const t={accessor:i.accessor,operator:h};an(h)?t.value=parseFloat(u):dn(h)&&(t.values=[parseFloat(p),parseFloat(f)]),s(t)},C=()=>!!cn(h)||(an(h)?""!==u.trim():!!dn(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),an(h)?(g=document.createElement("div"),g.className="st-filter-section",x=fn({type:"number",value:u,onChange:t=>{u=t,R&&R.update({canApply:C()})},onEnter:S,placeholder:"Enter number...",autoFocus:!0}),g.appendChild(x.element),v.insertBefore(g,v.lastChild)):dn(h)&&(g=document.createElement("div"),g.className="st-filter-section",b=fn({type:"number",value:p,onChange:t=>{p=t,R&&R.update({canApply:C()})},onEnter:S,placeholder:"From...",autoFocus:!0}),b.element.classList.add("st-filter-input-range-from"),y=fn({type:"number",value:f,onChange:t=>{f=t,R&&R.update({canApply:C()})},onEnter:S,placeholder:"To..."}),g.appendChild(b.element),g.appendChild(y.element),v.insertBefore(g,v.lastChild)),R&&R.update({canApply:C()})};return R=vn({onApply:S,onClear:r,canApply:C(),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:C()}),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=ln("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=pn({value:d,onChange:t=>{d=t,x()},options:l.map(t=>({value:t,label:on[t]})),containerRef:s,mainBodyRef:r});u.appendChild(p.element),h.appendChild(u);let f=null,v=null,w=null;const m=()=>cn(d)||""!==c,g=[{value:"true",label:"True"},{value:"false",label:"False"}],x=()=>{f&&(f.remove(),f=null),v&&(v.destroy(),v=null),an(d)&&(f=document.createElement("div"),f.className="st-filter-section",v=pn({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=vn({onApply:()=>{const t={accessor:e.accessor,operator:d};an(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=ln("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=pn({value:h,onChange:t=>{h=t,W()},options:d.map(t=>({value:t,label:on[t]})),containerRef:l,mainBodyRef:a});w.appendChild(m.element),v.appendChild(w);let g=null,x=null,b=null,y=null,R=null,S=null,C=null,I=null,M=null,H=null,k=null;const E=()=>!!cn(h)||(an(h)?""!==u.trim():!!dn(h)&&""!==p.trim()&&""!==f.trim()),T=t=>{if(!t)return"";const e=Bt(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?Bt(t):new Date,c=wn({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=un({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),S&&(S.destroy(),S=null),C&&(C.destroy(),C=null),I&&(I.destroy(),I=null),M&&(M.destroy(),M=null),H&&(H.destroy(),H=null),an(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(dn(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,S=t.picker,M=t.dropdown,y=e.container,C=e.picker,H=e.dropdown,g.appendChild(b),g.appendChild(y),v.insertBefore(g,v.lastChild)}k&&k.update({canApply:E()})};return k=vn({onApply:()=>{const t={accessor:i.accessor,operator:h};an(h)?t.value=u:dn(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(),S&&S.destroy(),C&&C.destroy(),I&&I.destroy(),M&&M.destroy(),H&&H.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=Ie({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=fn({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=Ie({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=vn({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)}},gn=(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=mn({header:t,currentFilter:r,onApplyFilter:n,onClearFilter:s,containerRef:a,mainBodyRef:a}),u=un({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},xn=(t,e)=>{var n,i;const{icons:o}=e;if(!J(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},bn=(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=bn(o.children,e,[...n,i]);if(t)return t}}return null},yn=(t,e)=>{if(t.pinned)return t.pinned;const n=K(e,t.accessor);return n?yn(n,e):void 0},Rn=(t,e)=>{const n=yn(t,e);return"left"===n?"left":"right"===n?"right":"main"};function Sn(t,e,n){const i=je(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 Cn=(t,e)=>{const{mainBodyWidth:n,pinnedLeftWidth:i,pinnedRightWidth:o,pinnedLeftContentWidth:s,pinnedRightContentWidth:r,tableBodyContainerRef:l,editColumns:a}=e,d=a?$: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")}},In=(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()},Mn=({containerWidth:t,leftWidth:e,rightWidth:n})=>t>0?Math.max(0,t-e-n):void 0,Hn=({headers:t,containerWidth:e,collapsedHeaders:n})=>{let i=0,o=0,s=0;t.forEach(t=>{if(t.hide)return;const e=ht(t,n).reduce((t,e)=>t+wt(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*z(e,i>0,o>0);i>t&&(i=t),o>t&&(o=t)}return{leftWidth:G(i),rightWidth:G(o),mainWidth:s,leftContentWidth:r,rightContentWidth:l}},kn=(t,e)=>{if(t.pinned)return t.pinned;const n=K(e,t.accessor);return n?kn(n,e):void 0},En=(e,n,i)=>{var o;const s=[],r=[],l=[];e.forEach(t=>{if(t.hide)return;const n=kn(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:wt(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:wt(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=Y({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=Hn({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"),S=null==R?void 0:R.querySelector(".st-horizontal-scrollbar-container"),C=null==R?void 0:R.querySelector(".st-body-main"),I=!!(null==R?void 0:R.querySelector(".st-column-editor"));S&&C&&f&&C.scrollWidth-C.clientWidth>1&&Cn(S,{mainBodyRef:C,mainBodyWidth:x,pinnedLeftWidth:m,pinnedRightWidth:g,pinnedLeftContentWidth:b,pinnedRightContentWidth:y,tableBodyContainerRef:f,editColumns:I})},Tn=({columnsToShrink:t,totalCompensation:e,initialWidthsMap:n,shrinkFloors:i})=>{if(0>e){const i=Math.abs(e),o=t.reduce((t,e)=>t+(n.get(e.accessor)||100),0);if(0===o)return;return void t.forEach((e,s)=>{const r=n.get(e.accessor)||100;let l=i*(r/o);if(s===t.length-1){const e=t.slice(0,s).reduce((t,e)=>{const i=n.get(e.accessor)||100;return t+(("number"==typeof e.width?e.width:100)-i)},0);l=i-e}e.width=r+l})}let o=e;for(;o>.5;){const e=t.map(t=>{var e;const o=n.get(t.accessor)||100,s=Math.max(null!==(e=null==i?void 0:i.get(t.accessor))&&void 0!==e?e:j,j),r=Math.min(s,o);return{column:t,headroom:Math.max(0,o-r),initialWidth:o,minWidth:r}}).filter(t=>t.headroom>0);if(0>=e.length)break;{const t=e.reduce((t,e)=>t+e.headroom,0);let n=0;const i=o;e.forEach((o,s)=>{let r=i*(o.headroom/t);r=Math.min(r,o.headroom),s===e.length-1&&(r=Math.min(i-n,o.headroom)),o.column.width=o.initialWidth-r,n+=r}),o-=n}}},An=({childrenToResize:t=[],collapsedHeaders:e,containerWidth:n,delta:i,headers:o,initialWidthsMap:s,isParentResize:r=!1,resizedHeader:l,reverse:a,rootPinned:d,sectionHeaders:c,sectionWidth:h,sectionViewportWidth:u=0,shrinkFloors:p,startWidth:f})=>{const v=t=>t.reduce((t,e)=>{const n=s.get(e.accessor)||100;return t+Math.max(0,n-(t=>{var e;const n=s.get(t.accessor)||100,i=Math.max(null!==(e=null==p?void 0:p.get(t.accessor))&&void 0!==e?e:j,j);return Math.min(i,n)})(e))},0),w=t=>{if(!d||0>=n||0>=t)return t;const e=o.some(t=>"left"===t.pinned&&!t.hide),i=o.some(t=>"right"===t.pinned&&!t.hide),r=((t,e,n)=>t*z(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=xt(c,e),o=n.findIndex(e=>e.accessor===t[0].accessor),r=n.findIndex(e=>e.accessor===t[t.length-1].accessor);if(-1===o||-1===r)return;const l=0===o,m=r===n.length-1;let g;g="left"===d&&m||"right"===d&&l?[]:l?n.slice(r+1):m||a?n.slice(0,o):n.slice(r+1);const x=Array.from(s.values()).reduce((t,e)=>t+e,0),b=!d&&u>0?u:h>0?Math.max(h,x):x+Math.abs(i)+1;if(i>0){const e=Math.max(0,b-x),n=Math.max(0,i-e),o=g.length>0?v(g):0,r=Math.min(n,o);let l;l=d?0===g.length?w(i):Math.min(i,w(e)+r):i;const a=(f+l)/t.reduce((t,e)=>t+(s.get(e.accessor)||100),0);t.forEach(t=>{const e=s.get(t.accessor)||100;t.width=Math.max(e*a,j)}),r>0&&g.length>0&&Tn({columnsToShrink:g,totalCompensation:r,initialWidthsMap:s,shrinkFloors:p})}else{const e=t.reduce((t,e)=>t+(s.get(e.accessor)||100),0),n=Math.max(f+i,j*t.length),o=n/e;t.forEach(t=>{const e=s.get(t.accessor)||100;t.width=Math.max(e*o,j)});const r=Math.max(0,f-n-Math.max(0,x-b));r>0&&g.length>0&&Tn({columnsToShrink:g,totalCompensation:-r,initialWidthsMap:s})}return}const m=xt(c,e),g=m.findIndex(t=>t.accessor===l.accessor);if(-1===g)return;const x=0===g,b=g===m.length-1;let y;if(y="left"===d&&b||"right"===d&&x?[]:x?m.slice(g+1):b||a?m.slice(0,g):m.slice(g+1),0===y.length){const t=i>0?w(i):i;return void(l.width=Math.max(f+t,j))}const R=Array.from(s.values()).reduce((t,e)=>t+e,0),S=!d&&u>0?u:h>0?Math.max(h,R):R+Math.abs(i)+1;if(i>0){const t=Math.max(0,S-R);if(t>=i){const t=w(i);return void(l.width=f+t)}const e=i-t,n=v(y),o=Math.min(e,n);if(d){const e=w(t)+o;l.width=f+e}else l.width=f+i;o>0&&Tn({columnsToShrink:y,totalCompensation:o,initialWidthsMap:s,shrinkFloors:p})}else{const t=Math.max(f+i,j),e=f-t;l.width=t;const n=Math.max(0,e-Math.max(0,R-S));n>0&&Tn({columnsToShrink:y,totalCompensation:-n,initialWidthsMap:s})}},Wn=({mainLeafHeaders:t,mainInitialWidths:e,newMainAvailable:n,shrinkFloors:i})=>{const o=Array.from(e.values()).reduce((t,e)=>t+e,0);if(0>=n||0>=o)return;const s=n/o;if(s>=1){let i=0;return void t.forEach((o,r)=>{const l=e.get(o.accessor)||100;r===t.length-1?o.width=n-i:(o.width=Math.round(l*s),i+=o.width)})}t.forEach(t=>{var n;const o=e.get(t.accessor)||100,r=Math.min(Math.max(null!==(n=null==i?void 0:i.get(t.accessor))&&void 0!==n?n:j,j),o);t.width=Math.max(Math.round(o*s),r)})},On=(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},Fn=({autoExpandColumns:t,collapsedHeaders:e,containerWidth:n,event:i,header:o,headers:s,mainBodyRef:r,onColumnWidthChange:l,onAutoExpandNaturalWidths:a,reverse:d=!1,setHeaders:c,setIsResizing:h,shrinkFloors:u,startWidth:p})=>{i.preventDefault();const f="clientX"in i?i.clientX:i.touches[0].clientX,v="touches"in i;if(!o||o.hide)return;const w=On(n,r);h(!0);const m=kn(o,s),g=gt(o);let x;if(o.children&&o.children.length>0){const t=ht(o,e);x=t.length>0?t:[o]}else x=[o];const b=new Map;let y=0,R=0;if(t){const t=s.filter(t=>t.pinned===m);if(xt(t,e).forEach(t=>{const e=wt(t);b.set(t.accessor,e)}),w>0){const{leftWidth:t,rightWidth:n,mainWidth:i}=Hn({headers:s,containerWidth:w,collapsedHeaders:e});y="left"===m?t:"right"===m?n:i;const o=Math.max(0,w-t-n),l=null!=(null==r?void 0:r.current)&&r.current.clientWidth>0?r.current.clientWidth:0;R=l>0?Math.min(o,l):o}}let S=!1;const C=new Map;let I=[];if(t&&m&&w>0){const t=xt(s.filter(t=>t.pinned===m),e);if(t.length>0){let n=!1;if(x.length>1){const e=t.findIndex(t=>t.accessor===x[0].accessor),i=t.findIndex(t=>t.accessor===x[x.length-1].accessor);n="left"===m&&i===t.length-1||"right"===m&&0===e}else{const e=x[0]||o,i=t.findIndex(t=>t.accessor===e.accessor);n="left"===m&&i===t.length-1||"right"===m&&0===i}if(n){S=!0;const t=s.filter(t=>!t.pinned);I=xt(t,e),I.forEach(t=>{C.set(t.accessor,wt(t))})}}}const M=(n,i=!1)=>{const r="right"===m?f-n:n-f;if(t){const t=s.filter(t=>t.pinned===m);if(An({childrenToResize:x,collapsedHeaders:e,containerWidth:w,delta:r,headers:s,initialWidthsMap:b,isParentResize:x.length>1,resizedHeader:x.length>0?x[x.length-1]:o,reverse:d,rootPinned:m,sectionHeaders:t,sectionWidth:y,sectionViewportWidth:m?y:R,shrinkFloors:u,startWidth:p}),S&&I.length>0){const t=x.reduce((t,e)=>{const n=b.get(e.accessor)||0;return t+(("number"==typeof e.width?e.width:n)-n)},0);Wn({mainLeafHeaders:I,mainInitialWidths:C,newMainAvailable:Math.max(0,R-t),shrinkFloors:u})}}else{const t=(({header:t,headers:e,collapsedHeaders:n})=>{const i=document.querySelector(".st-body-container");if(!i||0===i.clientWidth)return 1e3;const o=i.clientWidth;if(!t.pinned)return 1/0;const s=e.some(t=>"left"===t.pinned&&!t.hide),r=e.some(t=>"right"===t.pinned&&!t.hide),l=o*z(o,s,r)-e.filter(e=>e.pinned===t.pinned&&e.accessor!==t.accessor).reduce((t,e)=>e.hide?t:t+ht(e,n).reduce((t,e)=>t+wt(e),0),0),a=gt(t);return a>l?(console.warn(`Header ${t.accessor} exceeds pinned section width limit`),a):l})({header:o,headers:s,collapsedHeaders:e});x.length>1?(({delta:t,leafHeaders:e,minWidth:n,startWidth:i,maxWidth:o})=>{const s=e.reduce((t,e)=>Math.min(t,gt(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:x,minWidth:g,startWidth:p,maxWidth:t}):x[0].width=Math.max(Math.min(p+r,t),g),s.forEach(t=>{mt(t)})}if(i){if(t&&a){const t=new Map;x.forEach(e=>{"number"==typeof e.width&&t.set(e.accessor,e.width)}),t.size>0&&a(t)}const n=[...s];c(n);const i=new Map;x.forEach(t=>{"number"==typeof t.width&&i.set(t.accessor,t.width)}),S&&I.forEach(t=>{"number"==typeof t.width&&i.set(t.accessor,t.width)}),En(s,e,i)}else En(s,e)};let H=null,k=null,E=f;const T=t=>{E=t,k=t,null===H&&(H=requestAnimationFrame(()=>{null!==k&&(M(k,!1),k=null),H=null}))};if(v){const t=t=>{T(t.touches[0].clientX)},e=()=>{document.removeEventListener("touchmove",t),document.removeEventListener("touchend",e),null!==H&&(cancelAnimationFrame(H),H=null),M(E,!0),h(!1),l&&l([...s])};document.addEventListener("touchmove",t),document.addEventListener("touchend",e)}else{const t=t=>{T(t.clientX)},e=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",e),null!==H&&(cancelAnimationFrame(H),H=null),M(E,!0),h(!1),l&&l([...s])};document.addEventListener("mousemove",t),document.addEventListener("mouseup",e)}},Pn=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},$n=(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=$n(i.children,e);if(t)return t}}},Ln=(t,e)=>{const{columnResizing:n}=e;if(!n||t.isSelectionColumn&&e.enableRowSelection)return null;const i=document.createElement("div");i.className="st-header-resize-handle-container",i.setAttribute("role","separator"),i.setAttribute("aria-label",`Resize ${t.label} column`),i.setAttribute("aria-orientation","vertical");const o=document.createElement("div");o.className="st-header-resize-handle",i.appendChild(o);const s=t=>({rows:e.rows,header:t,styleRoot:Pn(e),autoSizeMode:t.autoSizeMode,sortIcon:e.icons.sortUp}),r=()=>{var n,i,o;const s=null!==(i=null===(n=e.getCollapsedHeaders)||void 0===n?void 0:n.call(e))&&void 0!==i?i:e.collapsedHeaders,r=e.getHeaders();return((t,e)=>{const n=xt(t,e);for(const t of n){const e=document.getElementById(Y({accessor:t.accessor,rowId:"header"})),n=null==e?void 0:e.offsetWidth;null!=n&&n>0&&(t.width=n)}})(r,s),{headers:r,header:null!==(o=$n(r,t.accessor))&&void 0!==o?o:t,collapsedHeaders:s}};let l=0;const a=()=>{const n=Date.now();120>n-l||(l=n,(()=>{var n;const i=document.getElementById(Y({accessor:t.accessor,rowId:"header"}));if(e.autoExpandColumns){const{headers:t,header:o,collapsedHeaders:l}=r();(({header:t,headers:e,collapsedHeaders:n,containerWidth:i,mainBodyRef:o,reverse:s,headerCellElement:r,getTargetLeafWidth:l,onAutoExpandNaturalWidths:a,shrinkFloors:d})=>{var c;if(!t||t.hide)return;const h=On(i,o),u=kn(t,e);let p;if(t.children&&t.children.length>0){const e=ht(t,n);p=e.length>0?e:[t]}else p=[t];const f=new Map;let v=0,w=0;const m=e.filter(t=>t.pinned===u);if(xt(m,n).forEach(t=>{const e=wt(t);f.set(t.accessor,e)}),h>0){const{leftWidth:t,rightWidth:i,mainWidth:s}=Hn({headers:e,containerWidth:h,collapsedHeaders:n});v="left"===u?t:"right"===u?i:s;const r=Math.max(0,h-t-i),l=null!=(null==o?void 0:o.current)&&o.current.clientWidth>0?o.current.clientWidth:0;w=l>0?Math.min(r,l):r}let g=!1;const x=new Map;let b=[];if(u&&h>0){const i=xt(e.filter(t=>t.pinned===u),n);if(i.length>0){let o=!1;if(p.length>1){const t=i.findIndex(t=>t.accessor===p[0].accessor),e=i.findIndex(t=>t.accessor===p[p.length-1].accessor);o="left"===u&&e===i.length-1||"right"===u&&0===t}else{const e=p[0]||t,n=i.findIndex(t=>t.accessor===e.accessor);o="left"===u&&n===i.length-1||"right"===u&&0===n}if(o){g=!0;const t=e.filter(t=>!t.pinned);b=xt(t,n),b.forEach(t=>{x.set(t.accessor,wt(t))})}}}const y=p.reduce((t,e)=>t+l(e),0),R=null!==(c=null==r?void 0:r.offsetWidth)&&void 0!==c?c:p.reduce((t,e)=>t+wt(e),0);if(An({childrenToResize:p,collapsedHeaders:n,containerWidth:h,delta:y-R,headers:e,initialWidthsMap:f,isParentResize:p.length>1,resizedHeader:p.length>0?p[p.length-1]:t,reverse:s,rootPinned:u,sectionHeaders:m,sectionWidth:v,sectionViewportWidth:u?v:w,shrinkFloors:d,startWidth:R}),g&&b.length>0){const t=p.reduce((t,e)=>{const n=f.get(e.accessor)||0;return t+(("number"==typeof e.width?e.width:n)-n)},0);Wn({mainLeafHeaders:b,mainInitialWidths:x,newMainAvailable:Math.max(0,w-t),shrinkFloors:d})}if(a){const t=new Map;p.forEach(e=>{"number"==typeof e.width&&t.set(e.accessor,e.width)}),t.size>0&&a(t)}const S=new Map;p.forEach(t=>{"number"==typeof t.width&&S.set(t.accessor,t.width)}),g&&b.forEach(t=>{"number"==typeof t.width&&S.set(t.accessor,t.width)}),En(e,n,S)})({header:o,headers:t,collapsedHeaders:l,containerWidth:e.containerWidth,mainBodyRef:e.mainBodyRef,reverse:e.reverse,headerCellElement:i,getTargetLeafWidth:t=>St(t.accessor,s(t)),onAutoExpandNaturalWidths:e.onAutoExpandNaturalWidths,shrinkFloors:null===(n=e.getShrinkFloors)||void 0===n?void 0:n.call(e)});const a=[...t];return e.setHeaders(a),void(e.onColumnWidthChange&&e.onColumnWidthChange(a))}const{headers:o,header:l,collapsedHeaders:a}=r(),d=St(l.accessor,s(l)),c=bn(o,l.accessor);if(!c)return;const h=((t,e)=>{let n=t;for(let t=0;e.length-1>t;t++)n=n[e[t]].children;return n})(o,c),u=c[c.length-1],p=h.map((t,e)=>e===u?Object.assign(Object.assign({},t),{width:d}):t),f=((t,e,n)=>{if(1===e.length)return n;let i=t;for(let t=0;e.length-2>t;t++)i=i[e[t]].children;return i[e[e.length-2]].children=n,t})(o,c,p);f.forEach(t=>mt(t));const v=p[u],w=new Map;v&&"number"==typeof v.width&&w.set(v.accessor+"",v.width),En(f,a,w),e.setHeaders(f),e.onColumnWidthChange&&e.onColumnWidthChange(f)})())};return y(i,"mousedown",n=>{var i;if(n.detail>=2)return n.preventDefault(),void a();const o=null===(i=document.getElementById(Y({accessor:t.accessor,rowId:"header"})))||void 0===i?void 0:i.offsetWidth;b(()=>{var t;const{headers:i,header:s,collapsedHeaders:l}=r();Fn({autoExpandColumns:e.autoExpandColumns,collapsedHeaders:l,containerWidth:e.containerWidth,event:n,forceUpdate:e.forceUpdate,header:s,headers:i,mainBodyRef:e.mainBodyRef,onColumnWidthChange:e.onColumnWidthChange,onAutoExpandNaturalWidths:e.onAutoExpandNaturalWidths,pinnedLeftRef:e.pinnedLeftRef,pinnedRightRef:e.pinnedRightRef,reverse:e.reverse,setHeaders:e.setHeaders,setIsResizing:e.setIsResizing,shrinkFloors:null===(t=e.getShrinkFloors)||void 0===t?void 0:t.call(e),startWidth:null!=o?o:L})},10)}),y(i,"touchstart",n=>{var i;const o=n,s=null===(i=document.getElementById(Y({accessor:t.accessor,rowId:"header"})))||void 0===i?void 0:i.offsetWidth;b(()=>{var t;const{headers:n,header:i,collapsedHeaders:l}=r();Fn({autoExpandColumns:e.autoExpandColumns,collapsedHeaders:l,containerWidth:e.containerWidth,event:o,forceUpdate:e.forceUpdate,header:i,headers:n,mainBodyRef:e.mainBodyRef,onColumnWidthChange:e.onColumnWidthChange,onAutoExpandNaturalWidths:e.onAutoExpandNaturalWidths,pinnedLeftRef:e.pinnedLeftRef,pinnedRightRef:e.pinnedRightRef,reverse:e.reverse,setHeaders:e.setHeaders,setIsResizing:e.setIsResizing,shrinkFloors:null===(t=e.getShrinkFloors)||void 0===t?void 0:t.call(e),startWidth:null!=s?s:L})},10)}),y(i,"dblclick",a),i},Dn=(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=Bn(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},Bn=(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 Ie({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},jn=(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(je(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(Rn(d,t)!==Rn(n,t)){const e=function({headers:t,draggedHeader:e,hoveredHeader:n}){const i=je(t);let o=!1;try{const t=Rn(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=bn(t,d.accessor),i=bn(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=Sn(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&&!Je(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")}))},zn=(e,n)=>{var i,o;const{header:s,colIndex:r,parentHeader:l}=e,{collapsedHeaders:a,columnBorders:d,columnReordering:c,enableHeaderEditing:h,selectedColumns:u,columnsWithSelectedCells:p,draggedHeaderRef:f,hoveredHeaderRef:v}=n,w=s.isSelectionColumn&&n.enableRowSelection,m=!!(null==s?void 0:s.isSortable),g=a.has(s.accessor),x=!(!s.children||0===s.children.length)&&(!g||s.children.some(e=>{const n=e.showWhen||t;return"parentCollapsed"===n||"always"===n})),b=null==l?void 0:l.singleRowChildren,y=x&&!s.singleRowChildren,R=!!d&&(s.children&&0!==s.children.length?N(s,r).includes(n.lastHeaderIndex):r===n.lastHeaderIndex),S=!(!n.selectableColumns||w)&&N(s,r).some(t=>u.has(t)),C=!w&&N(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":"",S?"st-header-selected":"",C&&!S?"st-header-has-highlighted-cell":""].filter(Boolean).join(" ")},Nn=(t,e,n,i,o)=>{const s=Bn(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)},Vn=(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);(t=>{0===t.length||t.map(t=>t.colIndex)})(e);const c=m(t),h=new Set(d.map(t=>Y({accessor:t.header.accessor,rowId:"header"}))),u=new Map,p=Array.from(new Set(e.map(t=>Math.round(t.top)))).sort((t,e)=>t-e);p.forEach((t,e)=>u.set(t,e));const f=t=>"header-band-"+Math.round(t.top),v=t=>{var e;return(null!==(e=u.get(Math.round(t.top)))&&void 0!==e?e:0)+1},w=x(t),g=n.animationCoordinator&&n.accordionAxis?n.accordionAxis:null,b="horizontal"===g?(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;c.forEach((e,i)=>{var o,s;if(!h.has(i)){w.delete(i);const r=null!==(o=e.getAttribute("data-accessor"))&&void 0!==o?o:"",l=null!==(s=null==b?void 0:b.has(r))&&void 0!==s&&s;"horizontal"===g&&n.animationCoordinator&&!l&&n.animationCoordinator.shouldRetain(i)?n.animationCoordinator.shrinkOutCell({cellId:i,element:e,container:t,axis:g}):e.remove(),c.delete(i),S=!0}}),S&&R(t);const C=[];d.forEach(e=>{const o=Y({accessor:e.header.accessor,rowId:"header"});if(c.has(o)){const s=c.get(o);i(t,f(e),v(e)),s.setAttribute("aria-colindex",e.colIndex+1+""),e.header.children&&e.header.children.length>0&&s.setAttribute("aria-colspan",_(e.header,n.headers,n.collapsedHeaders)+"");const r=w.get(o);if(!r||r.left!==e.left||r.top!==e.top||r.width!==e.width||r.height!==e.height){s.style.left=e.left+"px",s.style.top=e.top+"px";const t=s.dataset.stAccordionGrow;"horizontal"!==t&&(s.style.width=e.width+"px"),"vertical"!==t&&(s.style.height=e.height+"px"),w.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)=>{Ce(t,e)})(s,n.areAllRowsSelected());const l=zn(e,n);if(s.className!==l&&(s.className=l),J(e.header)){const t=n.collapsedHeaders.has(e.header.accessor);s.setAttribute("aria-expanded",!t+""),((t,e,n)=>{He(t,!e,{ariaLabelWhenExpanded:n?`Collapse ${n} column`:"Collapse column",ariaLabelWhenCollapsed:n?`Expand ${n} column`:"Expand column",syncAriaExpanded:!0})})(s,t,e.header.label)}const a=`${n.sort&&n.sort.key.accessor===e.header.accessor?n.sort.direction:"none"}|${n.filters&&n.filters[e.header.accessor]?"1":"0"}`;s.dataset.stIconState!==a&&(((t,e,n,i)=>{const o=nn(e,n),s=gn(e,n),r=xn(e,n);if(e.headerRenderer){const l=t.querySelector(".st-header-label");return void(l&&Nn(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))}})(s,e.header,n,e.colIndex),s.dataset.stIconState=a)}else C.push({cell:e,cellId:o})});const I=n.animationCoordinator&&n.accordionAxis?n.accordionAxis:null,M=[];C.forEach(({cell:e,cellId:o})=>{const s=((t,e)=>{var n,i,o;const{header:s,colIndex:r}=t,{reverse:l}=e,a=s.isSelectionColumn&&e.enableRowSelection,d=zn(t,e),c=document.createElement("div");if(c.className=d,c.id=Y({accessor:s.accessor,rowId:"header"}),c.setAttribute("data-accessor",s.accessor+""),c.setAttribute("role","columnheader"),c.setAttribute("aria-colindex",r+1+""),s.children&&s.children.length>0){const t=_(s,e.headers,e.collapsedHeaders);c.setAttribute("aria-colspan",t+"")}if(J(s)){const t=null!==(i=null===(n=e.getCollapsedHeaders)||void 0===n?void 0:n.call(e))&&void 0!==i?i:e.collapsedHeaders;c.setAttribute("aria-expanded",!t.has(s.accessor)+"")}s.isSortable&&((null===(o=e.sort)||void 0===o?void 0:o.key.accessor)===s.accessor?c.setAttribute("aria-sort","asc"===e.sort.direction?"ascending":"descending"):c.setAttribute("aria-sort","none"));const h=((t,e)=>{const n=[];return t.type&&"other"!==t.type&&n.push(t.type+" column"),t.isSortable&&n.push("sortable"),e&&n.push("filterable"),t.tooltip&&n.push(t.tooltip),n.join(", ")})(s,!!s.filterable);if(h){const t="header-desc-"+s.accessor;c.setAttribute("aria-describedby",t);const e=document.createElement("span");e.id=t,e.className="st-sr-only",e.textContent=h,c.appendChild(e)}c.style.position="absolute",c.style.left=t.left+"px",c.style.top=t.top+"px",c.style.width=t.width+"px",c.style.height=t.height+"px";const u=nn(s,e),p=gn(s,e),f=xn(s,e),v=l!==("right"===e.pinned);if(v){const t=Ln(s,e);t&&c.appendChild(t)}s.headerRenderer||"right"!==s.align||(f&&c.appendChild(f),p&&c.appendChild(p),u&&c.appendChild(u));const w=document.createElement("div");if(w.className="st-header-label",s.headerRenderer)Nn(w,s,r,e,{sortIcon:u,filterIcon:p,collapseIcon:f});else{const t=Bn(s,e);w.appendChild(t)}if(y(w,"click",t=>{a||((t,e,n,i)=>{if(!e.isSelectionColumn){if(i.selectableColumns){const o=N(e,n),s=o.some(t=>i.selectedColumns.has(t));if(i.enableHeaderEditing&&s&&!t.shiftKey){const t=document.getElementById(Y({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=Dn(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,s,r,e)}),y(w,"dblclick",t=>{a||((t,e,n)=>{e.isSelectionColumn||n.selectableColumns&&e.isSortable&&n.onSort(e.accessor)})(0,s,e)}),jn(w,c,s,e),c.appendChild(w),s.headerRenderer||"right"===s.align||(f&&c.appendChild(f),p&&c.appendChild(p),u&&c.appendChild(u)),!v){const t=Ln(s,e);t&&c.appendChild(t)}return e.headerRegistry&&!s.isSelectionColumn&&e.headerRegistry.set(s.accessor+"",{setEditing:t=>{if(t){const t=w.querySelector(".st-header-label-text");if(t){t.innerHTML="";const n=Dn(s,e,t);t.appendChild(n)}}}}),c})(e,n);s.dataset.stIconState=`${n.sort&&n.sort.key.accessor===e.header.accessor?n.sort.direction:"none"}|${n.filters&&n.filters[e.header.accessor]?"1":"0"}`,I&&n.animationCoordinator&&!n.animationCoordinator.hasSnapshotEntry(o)&&!n.animationCoordinator.wasRenderableBeforeAccordion(e.header.accessor+"")&&("vertical"===I?s.style.height="0px":s.style.width="0px",s.dataset.stAccordionGrow=I,M.push({element:s,cell:e})),i(t,f(e),v(e)).appendChild(s),c.set(o,s),w.set(o,{left:e.left,top:e.top,width:e.width,height:e.height})}),I&&M.length>0&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{for(const{element:t,cell:e}of M)t.isConnected&&("vertical"===I?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=c.get(Y({accessor:t.header.accessor,rowId:"header"}));if(!e)return;const n=(t=>{const e=t.top,n=t.top+t.height,i=p.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)},qn=(t,e)=>{t.style.left="0",t.style.width="number"!=typeof e||0>e?"100%":e+"px"},Gn=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:qt({position:n,rowHeight:i,heightOffsets:s,customTheme:r});qn(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},Kn=new WeakMap,Un=new WeakMap,Jn=t=>(Un.has(t)||Un.set(t,new Map),Un.get(t)),_n=(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),S=(t=>(Kn.has(t)||Kn.set(t,new Map),Kn.get(t)))(t),C=new Set(y.map(t=>{var e;return Y({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=Y({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 M=c&&s.accordionAxis?s.accordionAxis:null,H="horizontal"===M?(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(!C.has(n)){const l=e.getAttribute("data-row-id");l&&Pe(l,e);const a=null==I?void 0:I.get(n);if(c&&c.shouldRetain(n)&&a&&(c.shouldAnimateTransition({beforeTop:parseFloat(e.style.top||"0"),afterTop:a.top,beforeLeft:parseFloat(e.style.left||"0"),afterLeft:a.left,cellHeight:a.height||parseFloat(e.style.height||"0"),cellWidth:a.width||parseFloat(e.style.width||"0"),container:t})||c.isCellRenderedInScrollerViewport(e,t)||c.shouldRetainDomCellAtScrollExtrema(n,t)))return c.retainCell({cellId:n,element:e,container:t,newPosition:a}),void R.delete(n);if(c&&"horizontal"===M&&c.shouldRetain(n)){const s=null!==(i=e.getAttribute("data-accessor"))&&void 0!==i?i:"";if(null===(o=null==H?void 0:H.has(s))||void 0===o||!o)return c.shrinkOutCell({cellId:n,element:e,container:t,axis:M}),void R.delete(n)}((t,e)=>{const n=Ae.get(t);void 0!==n&&(null==e||e.delete(n),Ae.delete(t))})(e,s.cellRegistry),null===(r=s.onRendererHostDiscard)||void 0===r||r.call(s,e),e.remove(),R.delete(n)}});const E=Jn(t);S.forEach((t,e)=>{k.has(e)||(t.remove(),S.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")},F=!!s.rowGrouping&&s.rowGrouping.length>0,P=t=>{var e;return(null!==(e=t.stableRowKey)&&void 0!==e?e:it(t.rowId))+""},$=new Map;if(F&&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)=>{$.set(P(e),{posinset:n+1,setsize:t.length})})})}const L=(t,e)=>{if(!F)return;const n=e.tableRow;t.setAttribute("aria-level",n.depth+1+"");const i=$.get(P(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&&dt(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:ct(lt(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 h=Y({accessor:e.header.accessor,rowId:null!==(n=e.stableRowKey)&&void 0!==n?n:e.rowId});if(!B.has(h))if(B.add(h),R.has(h)){const n=R.get(h),c=i(t,A(e),W(e));if(O(c,e),L(c,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(Be(n,e,s),e.header.isSelectionColumn&&s.enableRowSelection&&s.isRowSelected){const t=s.isRowSelected(e.rowId);Ce(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=ct(lt(e.tableRow),e.depth,t,i,a);He(n,c)}}}else{if(c&&c.hasSnapshotEntry(h)&&!c.shouldMountIncomingCell({cellId:h,afterTop:e.top,afterLeft:e.left,cellHeight:e.height,cellWidth:e.width,container:t}))return;D.push({cell:e,cellId:h})}});const j=[];D.forEach(({cell:e,cellId:n})=>{const o=null==c?void 0:c.claimRetainedForReuse(n,t);if(o){Be(o,e,s);const r=i(t,A(e),W(e));return O(r,e),L(r,e),o.parentElement!==r&&r.appendChild(o),void R.set(n,o)}const r=De(e,s);M&&c&&!c.hasSnapshotEntry(n)&&!c.wasRenderableBeforeAccordion(e.header.accessor+"")&&("vertical"===M?r.style.height="0px":r.style.width="0px",r.dataset.stAccordionGrow=M,j.push({element:r,cell:e}));const l=i(t,A(e),W(e));O(l,e),L(l,e),l.appendChild(r),R.set(n,r)}),M&&j.length>0&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{for(const{element:t,cell:e}of j)t.isConnected&&("vertical"===M?t.style.height=e.height+"px":t.style.width=e.width+"px",delete t.dataset.stAccordionGrow)})}),((t,n,i,o,s)=>{const r=Jn(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=qt({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)&&(qn(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=Gn({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,S,l),o(t)};function Yn(t,e){return t?"string"==typeof t?t:t instanceof HTMLElement?t.cloneNode(!0):"function"==typeof t?t(e):null:null}function Xn(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?Gt({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:it(r.rowId);for(const e of t.headerPositions){const n=Y({accessor:e.accessor,rowId:l});i.set(n,{left:e.left,top:o,width:e.width,height:t.rowHeight})}}return i}class Qn{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 Vn(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;Vn(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,S=d||"main";let C=this.bodySections.get(S);C||(C=document.createElement("div"),C.className="left"===d?"st-body-pinned-left":"right"===d?"st-body-pinned-right":"st-body-main",this.bodySections.set(S,C));const I=r.filter(t=>"left"===d?"left"===t.pinned:"right"===d?"right"===t.pinned:!t.pinned);if(0===I.length)return C.style.display="none",C;C.style.display="";const M=((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);C.style.cssText=`\n position: relative;\n ${void 0!==h?`width: ${h}px;`:""}\n ${d?"":"flex-grow: 1;"}\n height: ${M}px;\n `;const H=this.getCachedBodyCells(S,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(S,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(S):null,T=l.filter(t=>!t.nestedTable&&!t.stateIndicator).length;this.nextColIndexMap.set(S,H.length>0&&T>0?v+H.length/T:v);const A=this.getCachedContext("body-"+S,c,d,h);return _n(C,H,A,C.scrollLeft,l,w,R,null!=E?E:void 0),this.renderNestedGridRows(C,S,l,d,A,R),d||this.renderStateRows(C,S,l,A,R),!d&&C&&(C.__renderBodyCells=t=>{C&&_n(C,H,A,t,l,!0)}),C}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=>lt(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=lt(n),m=u.get(w);if(m){const t=Gt({position:n.position,rowHeight:o.rowHeight,heightOffsets:o.heightOffsets,customTheme:null!==(s=o.customTheme)&&void 0!==s?s:{}}),e=X({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=X({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=Gt({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=X({calculatedHeight:n.calculatedHeight,customHeight:null==i?void 0:i.height,customTheme:e.customTheme}),s=Gt({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=Z(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}),S=X({calculatedHeight:w,customHeight:m.height,customTheme:s}),C=Gt({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, ${C}px, 0)`,I.style.height=S+"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 M=document.createElement("div");M.setAttribute("role","gridcell"),M.style.height="100%",M.style.width="100%",I.appendChild(M);const H=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(M,H);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=>lt(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=lt(e),r=Gt({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, ${Gt({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=Yn(e.loadingStateRenderer,{parentRow:i.parentRow}):i.state.error&&e.errorStateRenderer?r=Yn(e.errorStateRenderer,{error:i.state.error,parentRow:i.parentRow}):i.state.isEmpty&&e.emptyStateRenderer&&(r=Yn(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?Gt({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:it(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,Xn(e))}),t}getFullSectionLayout(t){const e=this.bodySectionSnapshots.get(t);return e?Xn(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 Zn=(t,e)=>{"string"==typeof e?t.innerHTML=e:(t.innerHTML="",t.appendChild(e.cloneNode(!0)))},ti=(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(ti([t],e,n),!1===t.hide){o=!0;break}(t||o)&&(i.hide=!1)}},ei=t=>t.every(t=>t.hide),ni=t=>{t.forEach(t=>{t.children&&t.children.length>0&&(ni(t.children),ei(t.children)&&(t.hide=!0))})},ii=(t,e)=>{const n=e.toLowerCase();return!!t.label.toLowerCase().includes(n)||!(!t.children||0>=t.children.length)&&t.children.some(t=>ii(t,e))},oi=(t,e,n)=>{if(!e.trim())return t;const i=n||ii;return t.filter(t=>!t.isSelectionColumn&&!t.excludeFromRender&&i(t,e))};function si(t,e,n,i){e&&t.appendChild(e),t.appendChild(n),i&&t.appendChild(i)}function ri(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 li=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 S=null,C=null;if(o){const t=function(t){const e=document.createElement("div");e.className="st-column-editor-search-wrapper";const n=document.createElement("div");n.className="st-column-editor-search";const i=document.createElement("input");return i.type="text",i.value="",i.placeholder=t,i.className="st-filter-input",i.addEventListener("click",t=>t.stopPropagation()),i.addEventListener("input",t=>{f=t.target.value,F()}),n.appendChild(i),e.appendChild(n),{wrapper:e,input:i}}(s);C=t.wrapper,S=t.input}const I=document.createElement("div");I.className="st-column-editor-lists";let M=null;p&&(M=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 H=l.customRenderer;H?ri(R,H,n,C,I,M,p):si(R,C,I,M),y.appendChild(R);const k=t=>{v=t,null!==t?m=!0:(m=!1,F())},E=()=>{w=null},T=t=>{w=t,m?W():F()},A=t=>{const e=b;b=t,F(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?oi(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?oi(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:S,previousExpandedHeaders:C}=t,I=null!==(e=t.essentialAccessors)&&void 0!==e?e:new Set,M=!1!==t.columnEditorConfig.allowColumnPinning,H=Ke(p,I),k=!H,E=document.createDocumentFragment(),T=16*s+"px",A=p.children&&p.children.length>0,W=!(p.hide||A&&p.children&&ei(p.children)),O=c.has(p.accessor),F=u||O,P=null!==f&&f.panelSection===(null!=v?v:"main");let $;if(0===w){const t=document.createElement("div");t.className="st-column-editor-drag-separator",t.style.opacity=P&&-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&&!Je(t,I)||(null==S||S(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=bn(b,t.header.accessor),r=bn(b,o.header.accessor);if(!s||!r)return void n();const{newHeaders:c,emergencyBreak:u}=Sn(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!==C?u||C.has(p.accessor):F,n=!u&&void 0!==C&&t!==F,i=n?t:F,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(pe("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&&($=()=>{He(L,F,{ariaLabelWhenExpanded:`Collapse ${p.label} column`,ariaLabelWhenCollapsed:`Expand ${p.label} column`,syncAriaExpanded:!0})})}t.columnEditorConfig.rowRenderer||L.appendChild(e)}const z=Ie({checked:W,onChange:t=>{if(!k)return;p.hide=!t,t?(ti(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,ti(i,p.children[0].accessor))):ni(i);const e=[...b];if(y(je(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 V=null===(n=t.icons)||void 0===n?void 0:n.drag;"string"==typeof V?N.innerHTML=V:V instanceof HTMLElement||V instanceof SVGSVGElement?N.appendChild(V.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 q=document.createElement("div");q.className="st-column-label-container",q.textContent=p.label;const G="left"===p.pinned||"right"===p.pinned?p.pinned:null,K=!!G&&!H,U=!G&&"main"===v,J=!G&&"main"===v,_=()=>{const t=Ze(b,p.accessor,"left",I);t&&D(t)},Y=()=>{const t=Ze(b,p.accessor,"right",I);t&&D(t)},X=()=>{const t=Ze(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:q},panelSection:v,isEssential:H,canToggleVisibility:k,allowColumnPinning:M,pinControl:M&&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(q),M&&0===s){const t=document.createElement("div");if(t.className="st-column-pin-side-group",t.addEventListener("mousedown",t=>{t.stopPropagation()}),t.addEventListener("dragstart",t=>{t.preventDefault(),t.stopPropagation()}),G){const e=document.createElement("div"),n=H;e.className="st-column-pin-btn st-column-pin-side st-column-pin-pinned-active"+(n?" st-column-pin-pinned-essential":""),e.textContent="left"===G?"L":"R",e.title=n?"Essential column — cannot be unpinned":"Unpin column",K&&e.addEventListener("click",t=>{t.stopPropagation(),X()}),t.appendChild(e)}else{if(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=P&&f.index===w?"1":"0",E.appendChild(Z),{fragment:E,scheduleExpandIconAnimation:$}})({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)})},F=t=>{I.innerHTML="";const e=!1!==l.allowColumnPinning,{pinnedLeft:i,unpinned:o,pinnedRight:s}=Ge(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 F(),{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!==H&&(H=n,e=!0),l=t.columnEditorConfig}void 0!==t.open&&(i=t.open,i?y.classList.add("open"):y.classList.remove("open")),S&&void 0!==t.searchPlaceholder&&(S.placeholder=t.searchPlaceholder),e&&(R.innerHTML="",H?ri(R,H,n,C,I,M,p):si(R,C,I,M)),F()},destroy:()=>{S&&(S.removeEventListener("input",()=>{}),S.removeEventListener("click",()=>{})),y.removeEventListener("click",()=>{}),y.remove()}}},ai=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:it(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=De(a,d);p.appendChild(c)}),m.appendChild(p);const f=Gn({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},di=(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 ci{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 Qn}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=ze(i.effectiveHeaders,"left")||ze(i.effectiveHeaders,void 0)||ze(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}=Hn({headers:i.effectiveHeaders,containerWidth:g.containerWidth,collapsedHeaders:i.collapsedHeaders}),R=null===(r=i.sortManager)||void 0===r?void 0:r.getState(),S=null===(l=i.filterManager)||void 0===l?void 0:l.getState(),C=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:Mn({containerWidth:g.containerWidth,leftWidth:b,rightWidth:y}),enableHeaderEditing:i.config.enableHeaderEditing,enableRowSelection:i.config.enableRowSelection,selectedRowCount:C,filters:null!==(p=null==S?void 0:S.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,getShrinkFloors:i.getShrinkFloors,onAutoExpandNaturalWidths:i.onAutoExpandNaturalWidths,essentialAccessors:i.essentialAccessors,selectableColumns:i.config.selectableColumns,headers:i.effectiveHeaders,rows:i.localRows,headerHeight:i.customTheme.headerHeight,lastHeaderIndex:i.effectiveHeaders.length-1,onSort:t=>{i.sortManager&&i.sortManager.updateSort({accessor:t})},handleApplyFilter:t=>{i.filterManager&&i.filterManager.updateFilter(t)},handleClearFilter:t=>{i.filterManager&&i.filterManager.clearFilter(t)},getHeaders:()=>i.getHeaders(),handleSelectAll:t=>{var e;null===(e=i.rowSelectionManager)||void 0===e||e.handleSelectAll(t)},setCollapsedHeaders:t=>{if("function"==typeof t){const e=i.getCollapsedHeaders?i.getCollapsedHeaders():i.collapsedHeaders;i.setCollapsedHeaders(t(e))}else i.setCollapsedHeaders(t);i.onRender()},setHeaders:t=>{i.setHeaders("function"==typeof t?t(i.getHeaders()):t),i.onRender()},setIsResizing:t=>{i.setIsResizing("function"==typeof t?t(i.isResizing):t)},onColumnWidthChange:i.config.onColumnWidthChange,onColumnOrderChange:i.config.onColumnOrderChange,onTableHeaderDragEnd:t=>{i.setHeaders(t),i.onRender()},onHeaderEdit:i.config.onHeaderEdit,onColumnSelect:i.config.onColumnSelect,selectColumns:i.selectionManager&&i.config.selectableColumns?(t,e)=>{i.selectionManager.selectColumns(t,e),i.onRender()}:t=>{},setSelectedColumns:i.selectionManager&&i.config.selectableColumns?t=>{const e=i.selectionManager.getSelectedColumns(),n="function"==typeof t?t(e):t;i.selectionManager.setSelectedColumns(n),i.onRender()}:t=>{},setSelectedCells:i.selectionManager?t=>{var e;const n=i.selectionManager.getSelectedCells(),o="function"==typeof t?t(n):t;i.selectionManager.setSelectedCells(o instanceof Set?o:new Set),null===(e=i.onRender)||void 0===e||e.call(i)}:t=>{},setInitialFocusedCell:i.selectionManager?t=>{var e;i.selectionManager.setInitialFocusedCell(null!=t?t:null),null===(e=i.onRender)||void 0===e||e.call(i)}:t=>{},areAllRowsSelected:()=>{var t,e;return null!==(e=null===(t=i.rowSelectionManager)||void 0===t?void 0:t.areAllRowsSelected())&&void 0!==e&&e},draggedHeaderRef:i.draggedHeaderRef,hoveredHeaderRef:i.hoveredHeaderRef,headerRegistry:i.headerRegistry,forceUpdate:()=>i.onRender(),mainBodyRef:i.mainBodyRef,pinnedLeftRef:i.pinnedLeftRef,pinnedRightRef:i.pinnedRightRef,accordionAxis:i.accordionAxis,animationCoordinator:i.animationCoordinator},M=i.effectiveHeaders.filter(t=>"left"===t.pinned),H=i.effectiveHeaders.filter(t=>!t.pinned),k=i.effectiveHeaders.filter(t=>"right"===t.pinned);let E=0;const T=[];if(M.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(H.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,S,C,I;if(!t)return;if(ze(n.effectiveHeaders,"left")||ze(n.effectiveHeaders,void 0)||ze(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 M=e.rowsToRender||e.currentTableRows,H=!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}),H){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}=Hn({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,F=null===(h=V(n.effectiveHeaders).find(t=>!t.isSelectionColumn))||void 0===h?void 0:h.accessor,P={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:F,rowHeight:n.customTheme.rowHeight,maxHeaderDepth:O,heightOffsets:e.paginatedHeightOffsets,customTheme:n.customTheme,containerWidth:k.containerWidth,mainSectionContainerWidth:E,mainSectionViewportWidth:Mn({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},$=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=[],z=n.positionOnlyBody?void 0:n.animationCoordinator;if($.length>0){const i=this.sectionRenderer.renderBodySection({headers:n.effectiveHeaders,rows:M,collapsedHeaders:n.collapsedHeaders,pinned:"left",context:P,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:z});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:M,collapsedHeaders:n.collapsedHeaders,context:P,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:z});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:M,collapsedHeaders:n.collapsedHeaders,pinned:"right",context:P,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:z});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&&(di(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:$.length>0?this.sectionRenderer.getNextColIndex("left"):0,right:L.length>0?this.sectionRenderer.getNextColIndex("main"):$.length>0?this.sectionRenderer.getNextColIndex("left"):0},r=M.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:it(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:it(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=ai({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=ai({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=ai({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:$,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!==(S=n.config.editColumns)&&void 0!==S&&S,headers:n.effectiveHeaders,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,cellRenderContext:P,sectionScrollController:null!==(C=n.sectionScrollController)&&void 0!==C?C: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&&(di(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),S=[];R.forEach((t,n)=>{if(0>t){const t=document.createElement("span");t.className="st-page-ellipsis",t.textContent="...",y.appendChild(t)}else{const o=document.createElement("button"),r=n>0&&0>R[n-1];o.className=["st-page-btn",e===t?"active":""].filter(Boolean).join(" "),o.textContent=""+t,o.setAttribute("aria-label","Go to page "+t),e===t&&o.setAttribute("aria-current","page"),o.addEventListener("click",()=>(async t=>{1>t||t>a||(i(t),s&&await s(t))})(t)),y.appendChild(o),S.push({button:o,page:t,afterEllipsis:r})}}),S.forEach((t,n)=>{const{button:i,page:o,afterEllipsis:s}=t,r=n+1,l=e===o,a=i.previousElementSibling,d=i.nextElementSibling,c=null!==a&&a.classList.contains("st-page-btn")&&a.classList.contains("active")||null!==d&&d.classList.contains("st-page-btn")&&d.classList.contains("active");r>9&&!(l||s||c)&&i.classList.add("st-page-btn--compact-hidden")});const C=document.createElement("button");C.className="st-next-prev-btn "+(m?"disabled":""),C.disabled=m,C.setAttribute("aria-label","Go to previous page"),c?Zn(C,c):C.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>',C.addEventListener("click",async()=>{const t=e-1;1>t||(i(t),s&&await s(t))}),y.appendChild(C);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?Zn(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.getPristineDefaultHeaders();t&&(o.setHeaders(je(t)),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=li({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)?Cn(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 Cn(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?$: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&&(In(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&&(In(this.horizontalScrollbarRef.current,this.sectionScrollController),this.horizontalScrollbarRef.current=null),this.stickyParentsContainer&&(di(this.stickyParentsContainer,this.sectionScrollController),this.stickyParentsContainer=null),this.sectionScrollController=null}}function hi(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:nt({row:t,getRowId:i,depth:0,index:e,rowPath:n,rowIndexPath:o,groupingKey:void 0}),rowPath:n,rowIndexPath:o,absoluteRowIndex:e,isLastGroupRow:!1,stableRowKey:rt({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=[],S=[],C=null)=>{t.forEach((t,I)=>{var M,H;const k=n[e],E=v.length,T=[...y,I],A=[...R,I],W=nt({row:t,getRowId:i,depth:e,index:I,rowPath:T,rowIndexPath:A,groupingKey:k}),O=rt({getRowId:i,row:t,depth:e,index:I,rowPath:T,rowIndexPath:A,groupingKey:k,parentStableKey:C}),F=v.length,P={row:t,depth:e,displayPosition:x,groupingKey:k,position:E,isLastGroupRow:!1,rowId:W,rowPath:T,rowIndexPath:A,absoluteRowIndex:E,parentIndices:S.length>0?[...S]:void 0,stableRowKey:O};v.push(P),w.push(P),x++;const $=lt({stableRowKey:O,rowId:W});if(ct($,e,r,o,s)&&n.length>e){const n=null==l?void 0:l.get($),i=((t,e)=>{const n=t[e];return et(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===(M=o.nestedTable.customTheme)||void 0===M?void 0:M.rowHeight)||u,r=(null===(H=o.nestedTable.customTheme)||void 0===H?void 0:H.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=X({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:at($,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:at($,k),stateIndicator:{parentRowId:$,parentRow:t,state:n},absoluteRowIndex:i,parentIndices:[...S,F]})}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:[...S,F]})}}else if(i.length>0){const t=[...T,k],n=[...A];b(i,e+1,t,n,[...S,F],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 ui{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 ci}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?vt(s,{containerWidth:i}):vt(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:S,maxHeaderDepth:C}=y,I=0===t.collapsedHeaders.size?"":[...t.collapsedHeaders].map(String).sort().join("\0");let M;t.positionOnlyBody&&!0!==t.config.autoExpandColumns&&this.scrollRafHeadersMemo&&this.scrollRafHeadersMemo.headersRef===t.headers&&this.scrollRafHeadersMemo.containerWidth===R&&this.scrollRafHeadersMemo.collapsedKey===I?M=this.scrollRafHeadersMemo.effectiveHeaders:(M=this.computeEffectiveHeaders(t.headers,t.config,t.customTheme,R),this.scrollRafHeadersMemo=!0!==t.config.autoExpandColumns?{headersRef:t.headers,containerWidth:R,collapsedKey:I,effectiveHeaders:M}:null);const{leftWidth:H,rightWidth:k}=Hn({headers:M,containerWidth:R,collapsedHeaders:t.collapsedHeaders});t.config.autoExpandColumns&&R>0&&(M=Ht(M,{autoExpandColumns:!0,containerWidth:R,pinnedLeftWidth:H,pinnedRightWidth:k,mainBodyRef:null!==(n=t.mainBodyRef)&&void 0!==n?n:{current:null},isResizing:null!==(i=t.isResizing)&&void 0!==i&&i,collapsedHeaders:t.collapsedHeaders}));let 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(),W=(null==T?void 0:T.sort)?`${T.sort.key.accessor}-${T.sort.direction}`:"none",O=JSON.stringify((null==A?void 0:A.filters)||{}),F=t.config.quickFilter,$=F?`${null!==(l=F.text)&&void 0!==l?l:""}|${null!==(a=F.mode)&&void 0!==a?a:"simple"}`:"",L=this.flattenedRowsCache&&this.flattenedRowsCache.deps.rowsRef===E&&this.flattenedRowsCache.deps.quickFilterKey===$&&this.flattenedRowsCache.deps.expandedRowsSize===t.expandedRows.size&&this.flattenedRowsCache.deps.collapsedRowsSize===t.collapsedRows.size&&this.flattenedRowsCache.deps.expandedDepthsSize===t.expandedDepths.size&&this.flattenedRowsCache.deps.rowStateMapSize===t.rowStateMap.size&&this.flattenedRowsCache.deps.sortKey===W&&this.flattenedRowsCache.deps.filterKey===O;let D,B,j;L&&this.flattenedRowsCache?(D=this.flattenedRowsCache.aggregatedRows,B=this.flattenedRowsCache.quickFilteredRows,j=this.flattenedRowsCache.flattenResult):(D=t.sortManager?E:Pt({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=Z(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=Z(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:M,quickFilter:t.config.quickFilter}),j=hi({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:M,rowHeight:t.customTheme.rowHeight,headerHeight:t.customTheme.headerHeight,customTheme:t.customTheme}),this.flattenedRowsCache={aggregatedRows:D,quickFilteredRows:B,flattenResult:j,deps:{rowsRef:E,quickFilterKey:$,expandedRowsSize:t.expandedRows.size,collapsedRowsSize:t.collapsedRows.size,expandedDepthsSize:t.expandedDepths.size,rowStateMapSize:t.rowStateMap.size,sortKey:W,filterKey:O}});const z=(({height:t,maxHeight:e,rowHeight:n,totalRowCount:i,headerHeight:o,footerHeight:s,externalViewportHeight:r})=>{if(e){const t=Et(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=Et(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:S,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,V=null!==(p=t.config.rowsPerPage)&&void 0!==p?p:10,q=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}|${V}|${N}|${q}|${t.customTheme.rowHeight}|${S}|${G}|${_}|${K}|${j.flattenedRows.length}|${U}|${J}`;let X;return t.positionOnlyBody&&void 0!==z&&null!==this.processRowsScrollReuseKey&&null!==this.processRowsScrollReuseBase&&this.processRowsScrollReuseKey===Y&&this.processRowsScrollReuseBase?X=function(t,e){const{contentHeight:n,rowHeight:i,scrollDirection:o="none",scrollTop:s,enableStickyParents:r,rowGrouping:l}=e,a=P(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=Vt({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=Jt(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}):(X=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=P(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,S,C,I=0,M=m.length;if(void 0===n)y=m,R=[],S=y,C=[];else{const t=Vt({bufferRowCount:w,contentHeight:n,tableRows:m,rowHeight:d,scrollTop:u,scrollDirection:h,heightMap:b});if(y=t.rendered.rows,I=t.rendered.startIndex,M=t.rendered.endIndex,s)if(v){const e=Jt(m,t.rendered.rows,t.fullyVisible.rows,t.partiallyVisible.rows,v);R=e.stickyParents,S=e.regularRows,C=t.partiallyVisible.rows}else R=[],S=t.rendered.rows,C=[];else R=[],S=y,C=[]}return{currentTableRows:m,rowsToRender:y,renderedStartIndex:I,renderedEndIndex:M,stickyParents:R,regularRows:S,partiallyVisibleRows:C,paginatedHeightOffsets:x,heightMap:b,allFlattenedRows:r,pageStartIndex:g}}({flattenedRows:j.flattenedRows,paginatableRows:j.paginatableRows,parentEndPositions:j.parentEndPositions,currentPage:e.currentPage,rowsPerPage:V,shouldPaginate:N,serverSidePagination:q,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:X.currentTableRows,paginatedHeightOffsets:X.paginatedHeightOffsets,heightMap:X.heightMap,allFlattenedRows:X.allFlattenedRows,pageStartIndex:X.pageStartIndex}):(this.processRowsScrollReuseKey=null,this.processRowsScrollReuseBase=null)),{dimensionState:y,containerWidth:R,effectiveHeaders:M,calculatedHeaderHeight:S,maxHeaderDepth:C,flattenResult:j,processedResult:X}}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 S=!0===n.positionOnlyBody;if(S&&null!==this.lastScrollRafPaintedRange&&R.renderedStartIndex===this.lastScrollRafPaintedRange.start&&R.renderedEndIndex===this.lastScrollRafPaintedRange.end)return;null===(h=n.rowSelectionManager)||void 0===h||h.updateConfig({tableRows:R.currentTableRows});const{mainWidth:C,leftWidth:I,rightWidth:M,leftContentWidth:H,rightContentWidth:k}=Hn({headers:g,containerWidth:m,collapsedHeaders:n.collapsedHeaders}),E=m-I-M;if(!S){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?$: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=S?{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()),S||(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,C,I,M,H,k,e.tableBodyContainerRef.current,g,n))}renderHeader(t,e,n,i,o){if(o.config.hideHeader)return;const s=this.buildRendererDeps(i,o);this.tableRenderer.renderHeader(t,e,n,s)}renderBody(t,e,n,i,o){const s=this.buildRendererDeps(n,i,o);this.tableRenderer.renderBody(t,e,s)}renderFooter(t,e,n,i,o){const s=this.buildRendererDeps(i,o);this.tableRenderer.renderFooter(t,e,n,t=>{o.setCurrentPage(t),o.onRender()},s)}renderColumnEditor(t,e,n,i,o){const s=this.buildRendererDeps(i,o);this.tableRenderer.renderColumnEditor(t,e,t=>{o.setColumnEditorOpen(t),o.onRender()},n,s)}renderHorizontalScrollbar(t,e,n,i,o,s,r,l,a){if(!a.mainBodyRef.current||!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,getShrinkFloors:e.getShrinkFloors,onAutoExpandNaturalWidths:e.onAutoExpandNaturalWidths,setIsResizing:e.setIsResizing,setHeaders:e.setHeaders,setCollapsedHeaders:e.setCollapsedHeaders,setCollapsedRows:e.setCollapsedRows,setExpandedRows:e.setExpandedRows,setRowStateMap:e.setRowStateMap,getCollapsedRows:e.getCollapsedRows,getCollapsedHeaders:e.getCollapsedHeaders,getExpandedRows:e.getExpandedRows,getHeaders:e.getHeaders,getPristineDefaultHeaders:e.getPristineDefaultHeaders,getRowStateMap:e.getRowStateMap,positionOnlyBody:e.positionOnlyBody,essentialAccessors:e.essentialAccessors}}cleanup(){this.tableRenderer.cleanup()}}const pi=t=>{if(null==t)return"";const e=t+"";return e.includes(",")||e.includes('"')||e.includes("\n")||e.includes("\r")?`"${e.replace(/"/g,'""')}"`:e};class fi{static createAPI(t){const e=()=>{var e;return(null===(e=t.getCachedFlattenResult)||void 0===e?void 0:e.call(t))||hi({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:it(d.rowId):rt({getRowId:t.config.getRowId,row:e,depth:0,index:o,rowPath:[o],rowIndexPath:[o]}),h=Y({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=>pi(t.label)).join(","),s=t.map((t,e)=>{const n=t.row;return i.map((t,i)=>{const o=Z(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 pi(r)}if(!1!==t.useFormattedValueForCSV&&t.valueFormatter){const s=t.valueFormatter({accessor:t.accessor,colIndex:i,row:n,rowIndex:e,value:o});return pi(s)}return pi(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:()=>Ye(t.headers),applyPinnedState:async e=>{const n=Qe(t.headers,e,t.essentialAccessors);n&&(t.setHeaders(n),t.onRender())},resetColumns:()=>{t.setHeaders(je(t.getPristineDefaultHeaders())),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 Ke(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 vi=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}},wi=()=>"undefined"!=typeof window&&window.innerHeight>0?window.innerHeight:1/0,mi=(t,e)=>{if(!t||!e)return null;const n=vi(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),wi());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 gi{constructor(t,e){var n,i;this.draggedHeaderRef={current:null},this.hoveredHeaderRef={current:null},this.localRows=[],this.headers=[],this.pristineDefaultHeaders=[],this.essentialAccessors=new Set,this.autoSizeAccessors=new Set,this.pendingAutoSize=new Set,this.naturalWidths=new Map,this.isAutoSizing=!1,this.currentPage=1,this.scrollTop=0,this.scrollDirection="none",this.isResizing=!1,this.isScrolling=!1,this._positionOnlyBody=!1,this.firstRenderDone=!1,this.internalIsLoading=!1,this.scrollbarWidth=0,this.isMainSectionScrollable=!1,this.columnEditorOpen=!1,this.collapsedHeaders=new Set,this.expandedDepths=new Set,this.expandedRows=new Map,this.collapsedRows=new Map,this.rowStateMap=new Map,this.announcement="",this.cellRegistry=new Map,this.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=tn.mergeCustomTheme(e),this.mergedColumnEditorConfig=tn.mergeColumnEditorConfig(e),this.resolvedIcons=tn.resolveIcons(e),this.localRows=[...e.rows],this.headers=[...e.defaultHeaders],this.pristineDefaultHeaders=je(e.defaultHeaders),this.essentialAccessors=tn.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=tn.getInitialCollapsedHeaders(e.defaultHeaders),this.expandedDepths=tn.getInitialExpandedDepths(e),this.autoSizeAccessors=this.computeAutoSizeAccessors(),this.pendingAutoSize=new Set(this.autoSizeAccessors),this.domManager=new en,this.renderOrchestrator=new ui,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=nt({row:t,getRowId:this.config.getRowId,depth:0,index:e,rowPath:[e],rowIndexPath:[e]}),i=it(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=mi(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,i,o;if(!this.animationCoordinator.isEnabled())return;if(null===t)return;if("vertical"===t&&(null!==(n=null===(e=this.config.rowGrouping)||void 0===e?void 0:e.length)&&void 0!==n?n:0)>0)return;this.captureAnimationSnapshot(),this.animationCoordinator.setAccordionPreVisibleAccessors("horizontal"===t?this.collectAccordionRenderableAccessors():null),this.pendingAccordionAxis=t;const s=this.animationCoordinator.getDuration(),r=this.animationCoordinator.getEasing(),l=null!==(o=null===(i=this.domManager.getElements())||void 0===i?void 0:i.rootElement)&&void 0!==o?o:this.container;l.style.setProperty(Ve,s+"ms"),l.style.setProperty(qe,r),l.classList.add(Ne),null!==this.accordionCleanupTimerId&&window.clearTimeout(this.accordionCleanupTimerId),this.accordionCleanupTimerId=window.setTimeout(()=>{l.classList.remove(Ne),l.style.removeProperty(Ve),l.style.removeProperty(qe),this.accordionCleanupTimerId=null},s+80)}initializeManagers(){var t,e,n;this.ariaAnnouncementManager=new de,this.ariaAnnouncementManager.subscribe(t=>{this.announcement=t,this.updateAriaLiveRegion()}),this.expandedDepthsManager=new ae(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 $t({headers:this.headers,tableRows:this.localRows,externalSortHandling:this.config.externalSortHandling||!1,onSortChange:t=>{var e,n;return null===(n=(e=this.config).onSortChange)||void 0===n?void 0:n.call(e,t)},rowGrouping: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 jt({rows:this.localRows,headers:this.headers,externalFilterHandling:this.config.externalFilterHandling||!1,onFilterChange:t=>{var e,n;return null===(n=(e=this.config).onFilterChange)||void 0===n?void 0:n.call(e,t)},announce:i}),this.filterManager.subscribe(t=>{this.sortManager&&this.sortManager.updateConfig({tableRows:t.filteredRows}),this.render("filterManager")}),this.selectionManager=new ee({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:t=>{var e,n;return null===(n=(e=this.config).onCellEdit)||void 0===n?void 0:n.call(e,t)},cellRegistry:this.cellRegistry,collapsedHeaders:this.collapsedHeaders,rowHeight:this.customTheme.rowHeight,enableRowSelection: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=ce(i.tableBodyContainerRef.current);const s=this.renderOrchestrator.computeEffectiveHeaders(this.headers,this.config,this.customTheme);this.dimensionManager=new Tt({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 At({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 Wt({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 kt({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 re({headerContainer:i.headerContainerRef.current,mainSection:i.tableBodyContainerRef.current,scrollbarWidth:this.scrollbarWidth}),this.scrollbarVisibilityManager.subscribe(t=>{this.isMainSectionScrollable=t,i.tableBodyContainerRef.current&&(this.scrollbarWidth=ce(i.tableBodyContainerRef.current)),this.render("scrollbarVisibilityManager")})),this.windowResizeManager=new oe,this.windowResizeManager.addCallback(()=>{var t;if(i.tableBodyContainerRef.current){const e=ce(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 ie({tableRows:[],onRowSelectionChange:this.config.onRowSelectionChange,enableRowSelection:!0}),this.rowSelectionManager.subscribe(()=>{this.render("rowSelectionManager")})),this.selectionManager&&(this.handleOutsideClickManager=new se({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&&gi.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=mi(this.resolvedScrollParent,n);if(!i)return;let o=i.visibleViewportHeight;o>0||(o=(()=>{const t=vi(this.resolvedScrollParent);return t?Math.min(t.height,wi()):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=mi(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 gi(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"),getShrinkFloors:()=>this.getShrinkFloors(),onAutoExpandNaturalWidths:t=>this.recordNaturalWidths(t),setIsResizing:t=>{var e,n,i,o,s,r,l,a;if(this.isResizing=t,this.autoScaleManager&&!1===t){const t=this.domManager.getRefs(),d=null!==(a=null!==(r=null!==(i=null===(n=null===(e=t.tableBodyContainerRef)||void 0===e?void 0:e.current)||void 0===n?void 0:n.clientWidth)&&void 0!==i?i:null===(s=null===(o=t.mainBodyRef)||void 0===o?void 0:o.current)||void 0===s?void 0:s.clientWidth)&&void 0!==r?r:null===(l=this.dimensionManager)||void 0===l?void 0:l.getState().containerWidth)&&void 0!==a?a:0;this.autoScaleManager.updateConfig({isResizing:!1,containerWidth:d})}},setHeaders:t=>{this.didColumnVisibilityChange(t)?this.beginAccordionAnimation("horizontal"):this.captureAnimationSnapshot(),this.headers=je(t),this.renderOrchestrator.invalidateCache("header")},animationCoordinator:this.animationCoordinator,setCollapsedHeaders:t=>{this.beginAccordionAnimation("horizontal"),this.collapsedHeaders=t},setCollapsedRows:t=>{this.beginAccordionAnimation("vertical"),this.collapsedRows="function"==typeof t?t(this.collapsedRows):t,this.render("expansion")},setExpandedRows:t=>{this.beginAccordionAnimation("vertical"),this.expandedRows="function"==typeof t?t(this.expandedRows):t,this.render("expansion")},setRowStateMap:t=>{this.beginAccordionAnimation("vertical"),this.rowStateMap="function"==typeof t?t(this.rowStateMap):t,this.render("rowStateMap")},getCollapsedRows:()=>this.collapsedRows,getCollapsedHeaders:()=>this.collapsedHeaders,getExpandedRows:()=>this.expandedRows,getHeaders:()=>this.headers,getPristineDefaultHeaders:()=>this.pristineDefaultHeaders,getRowStateMap:()=>this.rowStateMap,setColumnEditorOpen:t=>{this.columnEditorOpen=t},setCurrentPage:t=>{t!==this.currentPage&&this.config.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,e=xt(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}getShrinkFloors(){var t;const e=new Map,n=t=>{if(t.children&&t.children.length>0&&t.children.forEach(n),"number"==typeof t.width)e.set(t.accessor+"",t.width);else if("string"==typeof t.width&&t.width.trim().endsWith("px")){const n=parseFloat(t.width);Number.isFinite(n)&&e.set(t.accessor+"",n)}};this.pristineDefaultHeaders.forEach(n);const i=new Map,o=xt(this.headers,this.collapsedHeaders);for(const n of o){const o=n.accessor+"",s=null!==(t=this.naturalWidths.get(o))&&void 0!==t?t:e.get(o);i.set(o,Math.max(null!=s?s:0,gt(n)))}return i}recordNaturalWidths(t){t.forEach((t,e)=>this.naturalWidths.set(e,t))}applyMeasuredWidths(t){const e=n=>{const i=Object.assign({},n);return 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),t.forEach((t,e)=>this.naturalWidths.set(e+"",t))}maybeAutoSizeColumns(){if(this.isAutoSizing||0===this.pendingAutoSize.size)return;const t=this.getAutoSizeStyleRoot();if(t instanceof HTMLElement&&t.querySelector(".st-header-cell")){this.isAutoSizing=!0;try{const e=xt(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=St(e,{rows:i,header:s,styleRoot:t,theme:this.config.theme,autoSizeMode:s.autoSizeMode,sortIcon:this.resolvedIcons.sortUp});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.pristineDefaultHeaders=je(t.defaultHeaders),this.essentialAccessors=tn.buildEssentialAccessors(this.headers),this.autoSizeAccessors=this.computeAutoSizeAccessors(),this.pendingAutoSize=new Set(this.autoSizeAccessors),this.naturalWidths.clear(),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=tn.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(Ne),w.style.removeProperty(Ve),w.style.removeProperty(qe),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&&Pe(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 fi.createAPI({config:this.config,localRows:this.localRows,effectiveHeaders:t,get headers(){return e.headers},getPristineDefaultHeaders:()=>e.pristineDefaultHeaders,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=je(t),this.renderOrchestrator.invalidateCache("header")},setCurrentPage:t=>{this.currentPage=t},setColumnEditorOpen:t=>{this.columnEditorOpen=t,this.render("columnEditor-toggle")}})}}function xi(t){return t}gi.EXTERNAL_SCROLL_MAX_RETRIES=60;export{gi as SimpleTableVanilla,xi as asRows};
2
2
  //# sourceMappingURL=index.es.js.map