simple-table-core 0.7.62 → 0.7.64

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.
@@ -7,15 +7,15 @@ import RowIndices from "../../types/RowIndices";
7
7
  interface TableRowProps {
8
8
  columnIndices: ColumnIndices;
9
9
  gridTemplateColumns: string;
10
+ headers: HeaderObject[];
11
+ hiddenColumns: Record<string, boolean>;
10
12
  index: number;
13
+ isWidthDragging: boolean;
14
+ onExpandRowClick: (rowId: RowId) => void;
11
15
  pinned?: Pinned;
12
16
  rowHeight: number;
13
17
  rowIndices: RowIndices;
14
18
  visibleRow: VisibleRow;
15
- headers: HeaderObject[];
16
- hiddenColumns: Record<string, boolean>;
17
- isWidthDragging: boolean;
18
- onExpandRowClick: (rowId: RowId) => void;
19
19
  }
20
20
  declare const TableRow: ({ columnIndices, gridTemplateColumns, headers, hiddenColumns, index, isWidthDragging, onExpandRowClick, pinned, rowHeight, rowIndices, visibleRow, }: TableRowProps) => import("react/jsx-runtime").JSX.Element;
21
21
  export default TableRow;
@@ -7,7 +7,6 @@ import ColumnIndices from "../../types/ColumnIndices";
7
7
  import RowIndices from "../../types/RowIndices";
8
8
  interface TableSectionProps {
9
9
  columnIndices: ColumnIndices;
10
- headerContainerRef: RefObject<HTMLDivElement | null>;
11
10
  headers: HeaderObject[];
12
11
  hiddenColumns: Record<string, boolean>;
13
12
  isWidthDragging: boolean;
@@ -21,5 +20,5 @@ interface TableSectionProps {
21
20
  visibleRows: VisibleRow[];
22
21
  width?: number;
23
22
  }
24
- declare const TableSection: ({ columnIndices, headerContainerRef, headers, hiddenColumns, isWidthDragging, onExpandRowClick, pinned, rowHeight, rowIndices, sectionRef, templateColumns, totalHeight, visibleRows, width, }: TableSectionProps) => import("react/jsx-runtime").JSX.Element;
23
+ declare const TableSection: ({ columnIndices, headers, hiddenColumns, isWidthDragging, onExpandRowClick, pinned, rowHeight, rowIndices, sectionRef, templateColumns, totalHeight, visibleRows, width, }: TableSectionProps) => import("react/jsx-runtime").JSX.Element;
25
24
  export default TableSection;
package/dist/index.es.js CHANGED
@@ -1,2 +1,2 @@
1
- import{jsxs as e,jsx as n,Fragment as r}from"react/jsx-runtime";import{useState as t,useRef as o,useCallback as i,useEffect as a,useMemo as l,createContext as d,useContext as c,forwardRef as s,useLayoutEffect as u,Fragment as h,useReducer as f,createRef as v}from"react";var g=function(){return g=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var o in n=arguments[r])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},g.apply(this,arguments)};function w(e,n,r){if(r||2===arguments.length)for(var t,o=0,i=n.length;o<i;o++)!t&&o in n||(t||(t=Array.prototype.slice.call(n,0,o)),t[o]=n[o]);return e.concat(t||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var m=function(e){var n=e.rowIndex,r=e.colIndex,t=e.rowId;return"".concat(n,"-").concat(r,"-").concat(t)},p=function(r){var t=r.currentPage,o=r.hideFooter,i=r.nextIcon,a=r.onPageChange,l=r.onNextPage,d=r.onPreviousPage,c=r.prevIcon,s=r.shouldPaginate,u=r.totalPages;if(o||!s)return null;var h=!(t>1)&&!d,f=!(t<u)&&!l;return e("div",g({className:"st-footer"},{children:[n("button",g({className:"st-next-prev-btn ".concat(h?"disabled":""),onClick:function(){var e=t-1;e>=1&&a(e),d&&d(e-1)},disabled:h},{children:c})),n("button",g({className:"st-next-prev-btn ".concat(f?"disabled":""),onClick:function(){var e=t+1;(e<=u||l)&&a(e),l&&l(t)},disabled:f},{children:i})),Array.from({length:u},(function(e,r){return n("button",g({onClick:function(){var e;(e=r+1)>=1&&e<=u&&(a(e),e>t&&l?l(e-1):e<t&&d&&d(e-1))},className:"st-page-btn ".concat(t===r+1?"active":"")},{children:r+1}),r)}))]}))},C=function(e){var r=e.className;return n("svg",g({className:r,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:n("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})}))},I=function(e){var r=e.className;return n("svg",g({className:r,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:n("path",{d:"M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z"})}))},x=function(e){var r=e.className;return n("svg",g({className:r,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:n("path",{d:"M5.41 11.41L10 6.83l4.59 4.58L16 10l-6-6-6 6z"})}))},R=function(e){var r=e.className;return n("svg",g({className:r,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:n("path",{d:"M5.41 7.59L10 12.17l4.59-4.58L16 9l-6 6-6-6z"})}))},b=function(e){return e.position*(e.rowHeight+1)-1},y=function(e){return e.position*(e.rowHeight+1)},M=function(e){var n=e.accessor,r=e.rowIndex;return"cell-".concat(n,"-").concat(r)},S=function(e){var n=e.hiddenColumns,r=e.header,t=e.pinned;return n[r.accessor]?null:!t&&!r.pinned||r.pinned===t||null},E=function(e){var n=e.rowId,r=e.accessor;return"".concat(n,"-").concat(r)},D=function(r){var t=r.value,o=r.onBlur,i=r.onChange;return e("select",g({value:t.toString(),onBlur:o,onChange:function(e){var n=e.target.value;i("true"===n)}},{children:[n("option",g({value:"true"},{children:"True"})),n("option",g({value:"false"},{children:"False"}))]}))},H=function(e){var r=e.defaultValue,t=e.onBlur,i=e.onChange,a=o(null);return n("input",{className:"editable-cell-input",ref:a,autoFocus:!0,type:"text",defaultValue:null!=r?r:"",onBlur:t,onChange:function(e){var n=e.target.value;i(n)}})},k=function(e){var r=e.defaultValue,t=e.onBlur,i=e.onChange,a=o(null);return n("input",{className:"editable-cell-input",ref:a,autoFocus:!0,defaultValue:r.toString(),onBlur:t,onChange:function(e){var n=e.target.value;/^\d*\.?\d*$/.test(n)&&i(n)}})},N=function(e){var t=e.onChange,o=e.setIsEditing,i=e.value,a=function(e){null==t||t(e)},l=function(){o(!1)};return n(r,{children:"string"==typeof i||null==i?n(H,{defaultValue:i,onBlur:l,onChange:a}):"boolean"==typeof i?n(D,{onBlur:l,onChange:a,value:i}):"number"==typeof i?n(k,{defaultValue:i,onBlur:l,onChange:a}):null})},T=0,L=function(){return function(e){var n=e.callback,r=e.callbackProps,t=e.limit,o=Date.now();(0===T||o-T>=t)&&(T=o,n(r))}},O=Date.now(),W={screenX:0,screenY:0},B=function(e,n,r){void 0===r&&(r=[]);for(var t=0;t<e.length;t++){var o=e[t];if(o.accessor===n)return w(w([],r,!0),[t],!1);if(o.children&&o.children.length>0){var i=B(o.children,n,w(w([],r,!0),[t],!1));if(i)return i}}return null};var P=function(e){var n,r,t=e.draggedHeaderRef,i=e.headersRef,l=e.hoveredHeaderRef,d=e.onColumnOrderChange,c=e.onTableHeaderDragEnd,s=(n=i.current,r=o(n),a((function(){JSON.stringify(r.current)!==JSON.stringify(n)&&(r.current=n)}),[n]),r.current);return{handleDragStart:function(e){t.current=e,O=Date.now()},handleDragOver:function(e){var n,r,o=e.event,a=e.hoveredHeader;if(o.preventDefault(),i.current){var d=o.currentTarget.getAnimations().some((function(e){return"running"===e.playState})),u=o.screenX,h=o.screenY,f=Math.sqrt(Math.pow(u-W.screenX,2)+Math.pow(h-W.screenY,2));l.current=a;var v=i.current,g=B(v,(null===(n=t.current)||void 0===n?void 0:n.accessor)||""),w=B(v,a.accessor);if(g&&w){var m=g.length,p=w.length,C=w;if(m!==p){var I=p-m;I>0&&(C=w.slice(0,-I))}var x=function(e,n,r){var t=JSON.parse(JSON.stringify(e)),o=!1;function i(e,n){for(var r=e,t=0;t<n.length-1;t++)r=r[n[t]].children;return r[n[n.length-1]]}function a(e,n,r){for(var t=e,i=0;i<n.length-1;i++){if(!t[n[i]].children){o=!0;break}t=t[n[i]].children}t[n[n.length-1]]=r}var l=i(t,n);return a(t,n,i(t,r)),a(t,r,l),{newHeaders:t,emergencyBreak:o}}(v,g,C),R=x.newHeaders,b=x.emergencyBreak;if(!(d||a.accessor===(null===(r=t.current)||void 0===r?void 0:r.accessor)||null===t.current||f<10||0===g.length||0===C.length||JSON.stringify(R)===JSON.stringify(i.current)||b)){var y=Date.now();JSON.stringify(R)===JSON.stringify(s)&&(y-O<1500||f<40)||(O=y,W={screenX:u,screenY:h},c(R))}}}},handleDragEnd:function(){t.current=null,l.current=null,null==d||d(i.current)}}},F=d(void 0),A=function(e){var r=e.children,t=e.value;return n(F.Provider,g({value:t},{children:r}))},z=function(){var e=c(F);if(void 0===e)throw new Error("useTableContext must be used within a TableProvider");return e},U=s((function(r,l){var d,c,s=r.borderClass,u=r.colIndex,h=r.header,f=r.isHighlighted,v=r.isInitialFocused,w=r.onExpandRowClick,m=r.rowIndex,p=r.visibleRow,C=z(),I=C.cellRegistry,x=C.cellUpdateFlash,R=C.collapseIcon,b=C.draggedHeaderRef,y=C.expandIcon,S=C.handleMouseDown,D=C.handleMouseOver,H=C.headersRef,k=C.hoveredHeaderRef,T=C.onCellEdit,O=C.onTableHeaderDragEnd,W=p.depth,B=p.row,F=t(B.rowData[h.accessor]),A=F[0],U=F[1],j=t(!1),J=j[0],V=j[1],K=t(!1),X=K[0],q=K[1],Y=o(null),$=P({draggedHeaderRef:b,headersRef:H,hoveredHeaderRef:k,onTableHeaderDragEnd:O}).handleDragOver,G=L(),_="cell-".concat(m,"-").concat(u),Q=E({rowId:B.rowMeta.rowId,accessor:h.accessor});a((function(){if(I){var e="".concat(B.rowMeta.rowId,"-").concat(h.accessor);return I.set(e,{updateContent:function(e){A!==e?(U(e),x&&(q(!0),Y.current&&clearTimeout(Y.current),Y.current=setTimeout((function(){q(!1)}),800))):U(e)}}),function(){I.delete(e),Y.current&&clearTimeout(Y.current)}}}),[I,x,B.rowMeta.rowId,h.accessor,A]),a((function(){if(X){var e=setTimeout((function(){q(!1)}),850);return function(){return clearTimeout(e)}}}),[X]),a((function(){U(B.rowData[h.accessor])}),[B.rowData,h.accessor]);var Z=Boolean(null===(c=null===(d=B.rowMeta)||void 0===d?void 0:d.children)||void 0===c?void 0:c.length),ee=Boolean(null==h?void 0:h.isEditable),ne=p.position%2==0,re="st-cell ".concat(W>0&&h.expandable?"st-cell-depth-".concat(W):""," ").concat(f?v?"st-cell-selected-first ".concat(s):"st-cell-selected ".concat(s):""," ").concat(ne?"st-cell-odd-row":"st-cell-even-row"," ").concat(ee?"clickable":""," ").concat(X?"st-cell-updating":""),te=i((function(e){U(e),null==T||T({accessor:h.accessor,newValue:e,row:B})}),[h.accessor,T,B]);return J?n("div",g({className:"st-cell-editing ".concat(ne?"st-cell-odd-row":"st-cell-even-row"),id:M({accessor:h.accessor,rowIndex:m+1})},{children:n(N,{onChange:te,setIsEditing:V,value:A})})):e("div",g({className:re,id:_,onDoubleClick:function(){return h.isEditable&&V(!0)},onMouseDown:function(){return S({rowIndex:m,colIndex:u,rowId:B.rowMeta.rowId})},onMouseOver:function(){return D({rowIndex:m,colIndex:u,rowId:B.rowMeta.rowId})},onDragOver:function(e){return G({callback:$,callbackProps:{event:e,hoveredHeader:h},limit:50})},onKeyDown:function(e){"F2"!==e.key&&"Enter"!==e.key||!h.isEditable||J||(e.preventDefault(),V(!0))},ref:l,"data-row-index":m,"data-col-index":u,"data-row-id":B.rowMeta.rowId,"data-accessor":h.accessor},{children:[h.expandable&&Z?B.rowMeta.isExpanded?n("div",g({className:"st-sort-icon-container",onClick:function(){return w(B.rowMeta.rowId)},onMouseDown:function(e){e.stopPropagation()}},{children:R})):n("div",g({className:"st-sort-icon-container",onClick:function(){return w(B.rowMeta.rowId)},onMouseDown:function(e){e.stopPropagation()}},{children:y})):null,n("span",g({className:"st-cell-content ".concat("right"===h.align?"right-aligned":"center"===h.align?"center-aligned":"")},{children:h.cellRenderer?h.cellRenderer({accessor:h.accessor,colIndex:u,row:B}):A}))]}),Q)})),j=function(e){var t=e.children,o=function(e,n){var r={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(r[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(t=Object.getOwnPropertySymbols(e);o<t.length;o++)n.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(e,t[o])&&(r[t[o]]=e[t[o]])}return r}(e,["children"]);return z().allowAnimations?n(J,g({},o,{children:t})):n(r,{children:t})},J=function(e){var i=e.children,l=e.isBody,d=e.pauseAnimation,c=e.rowIndex,s=o(!1),h=z(),f=h.draggedHeaderRef,v=h.headersRef,g=h.mainBodyRef,w=h.shouldPaginate,m=t({}),p=m[0],C=m[1],I=o({}),x=v.current;return u((function(){if(x){var e=function(e){var n=e.currentHeaders,r=e.draggedHeaderRef,t=e.rowIndex,o={};return n.forEach((function(e){var n;if(e){var i=document.getElementById(M({accessor:e.accessor,rowIndex:t}));if(i){var a=i.getAnimations().some((function(e){return"running"===e.playState})),l=i.getBoundingClientRect();a&&(null===(n=null==r?void 0:r.current)||void 0===n?void 0:n.accessor)!==e.accessor?o[e.accessor]=!1:o[e.accessor]=l}}})),o}({currentHeaders:x,draggedHeaderRef:f,rowIndex:c});JSON.stringify(e)!==JSON.stringify(p)&&(I.current=p,C(e))}}),[p,x,f,l,c]),u((function(){var e=g.current,n=function(){s.current=!0},r=function(){s.current=!1};return null==e||e.addEventListener("scroll",n),null==e||e.addEventListener("scrollend",r),function(){null==e||e.removeEventListener("scroll",n),null==e||e.removeEventListener("scrollend",r)}}),[f,g]),a((function(){d||s.current||Object.keys(I.current).length&&x&&x.forEach((function(e){var n=document.getElementById(M({accessor:e.accessor,rowIndex:c}));if(n){var r=I.current[e.accessor],t=p[e.accessor];if(r&&t){var o=r.left-t.left,i=w?0:r.top-t.top,a=Math.abs(o),l=Math.abs(i);(a>10||l>10)&&requestAnimationFrame((function(){n.style.transform="translate(".concat(o,"px, ").concat(i,"px)"),n.style.transition="transform 0s",requestAnimationFrame((function(){n.style.transform="",n.style.transition="transform ".concat(400,"ms ease-out")}))}))}}}))}),[p,x,l,d,I,c,w]),n(r,{children:i})},V=function(e){var r=e.columnIndices,t=e.headers,o=e.hiddenColumns,i=e.isWidthDragging,a=e.onExpandRowClick,l=e.pinned,d=e.rowIndex,c=e.rowIndices,s=e.visibleRow,u=t.filter((function(e){return S({hiddenColumns:o,header:e,pinned:l})}));return n(j,g({isBody:!0,pauseAnimation:i,rowIndex:d+1},{children:u.map((function(e){return n(K,{columnIndices:r,header:e,headers:t,hiddenColumns:o,onExpandRowClick:a,pinned:l,rowIndex:d,rowIndices:c,visibleRow:s},M({accessor:e.accessor,rowIndex:d+1}))}))}))},K=function(e){var r=e.columnIndices,t=e.header,o=e.headers,i=e.hiddenColumns,a=e.onExpandRowClick,l=e.pinned,d=e.rowIndex,c=e.rowIndices,s=e.visibleRow,u=r[t.accessor],f=z(),v=f.getBorderClass,g=f.isSelected,w=f.isInitialFocusedCell;if(t.children){var m=t.children.filter((function(e){return S({hiddenColumns:i,header:e,pinned:l})}));return n(h,{children:m.map((function(e){return n(K,{columnIndices:r,header:e,headers:o,hiddenColumns:i,onExpandRowClick:a,pinned:l,rowIndex:d,rowIndices:c,visibleRow:s},M({accessor:e.accessor,rowIndex:d+1}))}))})}var p={rowIndex:d,colIndex:u,rowId:s.row.rowMeta.rowId},C=v(p),I=g(p),x=w(p);return n(U,{borderClass:C,colIndex:u,header:t,isHighlighted:I,isInitialFocused:x,onExpandRowClick:a,rowIndex:d,visibleRow:s},M({accessor:t.accessor,rowIndex:d+1}))},X=function(e){var r=e.columnIndices,t=e.gridTemplateColumns,o=e.headers,i=e.hiddenColumns,a=e.index,l=e.isWidthDragging,d=e.onExpandRowClick,c=e.pinned,s=e.rowHeight,u=e.rowIndices,h=e.visibleRow,f=h.position,v=a;return n("div",g({className:"st-table-row",style:{gridTemplateColumns:t,top:y({position:f,rowHeight:s}),height:"".concat(s,"px")}},{children:n(V,{columnIndices:r,headers:o,hiddenColumns:i,isWidthDragging:l,onExpandRowClick:d,pinned:c,rowIndex:v,rowIndices:u,visibleRow:h},a)}))},q=function(e){var r=e.displayStrongBorder,t=e.position,o=e.rowHeight,i=e.templateColumns;return n("div",g({className:"st-row-separator ".concat(r?"st-last-group-row":""),style:{display:"grid",gridTemplateColumns:i,position:"absolute",top:b({position:t,rowHeight:o}),minWidth:"100%"}},{children:n("div",{style:{gridColumn:"1 / -1"}})}))},Y=function(r){var t=r.columnIndices;r.headerContainerRef;var o=r.headers,i=r.hiddenColumns,a=r.isWidthDragging,l=r.onExpandRowClick,d=r.pinned,c=r.rowHeight,s=r.rowIndices,u=r.sectionRef,f=r.templateColumns,v=r.totalHeight,w=r.visibleRows,m=r.width,p=d?"st-table-body-pinned-".concat(d):"st-table-body-main";return n("div",g({className:p,ref:u,style:{position:"relative",height:"".concat(v,"px"),width:m}},{children:w.map((function(r,u){var v,g,m,p,C=Boolean(null===(g=null===(v=r.row.rowMeta)||void 0===v?void 0:v.children)||void 0===g?void 0:g.length),I=null===(p=null===(m=w[u-1])||void 0===m?void 0:m.row.rowMeta)||void 0===p?void 0:p.isExpanded;return e(h,{children:[n(X,{columnIndices:t,gridTemplateColumns:f,headers:o,hiddenColumns:i,index:u,isWidthDragging:a,onExpandRowClick:l,pinned:d,rowHeight:c,rowIndices:s,visibleRow:r}),0!==u&&n(q,{displayStrongBorder:C&&I,position:r.position,rowHeight:c,templateColumns:f})]},u)}))}))};function $(e){var n=e.headersRef,r=e.hiddenColumns,t=e.pinnedLeftColumns,o=e.pinnedRightColumns,i={},a=0,l=function(e,n){void 0===n&&(n=!1),n||a++,i[e.accessor]=a,e.children&&e.children.length>0&&e.children.filter((function(e){return S({hiddenColumns:r,header:e})})).forEach((function(e,n){l(e,0===n)}))};return t.forEach((function(e,n){l(e,0===n)})),n.current.filter((function(e){return!e.pinned&&S({hiddenColumns:r,header:e})})).forEach((function(e,n){var r=0===n&&0===t.length;l(e,r)})),o.forEach((function(e){l(e,!1)})),i}var G=function(r){var i,d,c,s,u,h=r.centerHeaderRef,f=r.flattenedRows,v=r.headerContainerRef,w=r.isWidthDragging,m=r.mainTemplateColumns,p=r.pinnedLeftColumns,C=r.pinnedLeftHeaderRef,I=r.pinnedLeftTemplateColumns,x=r.pinnedRightColumns,R=r.pinnedRightHeaderRef,b=r.pinnedRightTemplateColumns,y=r.setFlattenedRows,M=r.setScrollTop,S=r.visibleRows,E=z(),D=E.rowHeight,H=E.scrollbarWidth,k=E.mainBodyRef,N=E.pinnedLeftRef,T=E.pinnedRightRef,L=E.tableBodyContainerRef,O=E.hiddenColumns,W=E.headersRef;!function(e){var n=e.headerContainerRef,r=e.mainSectionRef,o=e.scrollbarWidth,i=t(!1),l=i[0],d=i[1];a((function(){var e=null==n?void 0:n.current;if(l&&e)return e.classList.add("st-header-scroll-padding"),e.style.setProperty("--st-after-width","".concat(o,"px")),function(){e.classList.remove("st-header-scroll-padding")}}),[n,l,o]),a((function(){var e=null==n?void 0:n.current,t=null==r?void 0:r.current;if(t&&e){var o=function(){if(t){var e=t.scrollHeight>t.clientHeight;d(e)}};o();var i=new ResizeObserver((function(){o()}));return i.observe(t),function(){t&&i.unobserve(t)}}}),[n,r])}({headerContainerRef:v,mainSectionRef:L,scrollbarWidth:H});var B,P,F=o(null),A=(B=0,(P=function(e){e.forEach((function(e){B+=1,e.rowMeta.isExpanded&&e.rowMeta.children&&P(e.rowMeta.children)}))})(f),B)*(D+1)-1,U=l((function(){return $({headersRef:W,hiddenColumns:O,pinnedLeftColumns:p,pinnedRightColumns:x})}),[W,O,p,x]),j=l((function(){var e={};return S.forEach((function(n,r){var t=String(n.row.rowMeta.rowId);e[t]=r})),e}),[S]),J=function(e){var n=function(r){return r.rowMeta.rowId===e&&r.rowMeta.children?g(g({},r),{rowMeta:g(g({},r.rowMeta),{isExpanded:!r.rowMeta.isExpanded})}):r.rowMeta.children?g(g({},r),{rowMeta:g(g({},r.rowMeta),{children:r.rowMeta.children.map(n)})}):r};y((function(e){return e.map(n)}))},V=(null===(i=C.current)||void 0===i?void 0:i.clientWidth)?(null===(d=C.current)||void 0===d?void 0:d.clientWidth)+1:0,K=null===(c=h.current)||void 0===c?void 0:c.clientWidth,X=(null===(s=R.current)||void 0===s?void 0:s.clientWidth)?(null===(u=R.current)||void 0===u?void 0:u.clientWidth)+1:0,q={headerContainerRef:v,headers:W.current,hiddenColumns:O,isWidthDragging:w,rowHeight:D,visibleRows:S,columnIndices:U,rowIndices:j};return e("div",g({className:"st-table-body-container",ref:L,onScroll:function(e){var n=e.currentTarget.scrollTop;F.current&&cancelAnimationFrame(F.current),F.current=requestAnimationFrame((function(){M(n)}))}},{children:[p.length>0&&n(Y,g({},q,{onExpandRowClick:J,pinned:"left",sectionRef:N,templateColumns:I,totalHeight:A,width:V})),n(Y,g({},q,{onExpandRowClick:J,sectionRef:k,templateColumns:m,totalHeight:A,width:K})),x.length>0&&n(Y,g({},q,{onExpandRowClick:J,pinned:"right",sectionRef:T,templateColumns:b,totalHeight:A,width:X}))]}))},_=function(e,n){a((function(){if(e.current){var r=e.current,t=function(){var e,t=null==r?void 0:r.scrollLeft;void 0!==t&&(null===(e=n.current)||void 0===e||e.scrollTo(t,0))};return r.addEventListener("scroll",t),function(){null==r||r.removeEventListener("scroll",t)}}}),[e,n])},Q={string:function(e,n,r){if(e===n)return 0;var t=e.localeCompare(n);return"ascending"===r?t:-t},number:function(e,n,r){if(e===n)return 0;var t=e-n;return"ascending"===r?t:-t},boolean:function(e,n,r){if(e===n)return 0;var t=e===n?0:e?-1:1;return"ascending"===r?t:-t},date:function(e,n,r){var t=new Date(e),o=new Date(n);if(t.getTime()===o.getTime())return 0;var i=t.getTime()-o.getTime();return"ascending"===r?i:-i},enum:function(e,n,r){return Q.string(e,n,r)},default:function(e,n,r){return e===n?0:null==e?"ascending"===r?-1:1:null==n?"ascending"===r?1:-1:"string"==typeof e&&"string"==typeof n?Q.string(e,n,r):"number"==typeof e&&"number"==typeof n?Q.number(e,n,r):"boolean"==typeof e&&"boolean"==typeof n?Q.boolean(e,n,r):Q.string(String(e),String(n),r)}},Z=function(e,n,r,t){if(void 0===r&&(r="string"),null==e||""===e)return"ascending"===t?-1:1;if(null==n||""===n)return"ascending"===t?1:-1;if("number"===r){var o=function(e){var n;if("number"==typeof e)return e;var r=String(e);if("string"==typeof r){var t=r.replace(/[$,]/g,"").match(/^([-+]?\d*\.?\d+)([TBMKtbmk])?/);if(t){var o=parseFloat(t[1]),i=null===(n=t[2])||void 0===n?void 0:n.toUpperCase();return"T"===i?o*=1e12:"B"===i?o*=1e9:"M"===i?o*=1e6:"K"===i&&(o*=1e3),o}}return parseFloat(r)||0},i=o(e),a=o(n);return Q.number(i,a,t)}return"date"===r?Q.date(String(e),String(n),t):"boolean"===r?Q.boolean(Boolean(e),Boolean(n),t):"enum"===r?Q.enum(String(e),String(n),t):Q.string(String(e),String(n),t)},ee=function(e,n,r){var t=r.find((function(e){return e.accessor===n.key.accessor})),o=(null==t?void 0:t.type)||"string",i=n.direction,a=new Map,l=new Map,d="";e.forEach((function(e){var r;if(e.rowData&&!e.rowData[n.key.accessor]&&void 0!==e.rowMeta.isExpanded){var t=(e.rowData.sector||"group_".concat(a.size)).toString();d=t,l.set(d,e),a.has(d)||a.set(d,[])}else if(d){var o=a.get(d)||[];o.push(e),a.set(d,o)}else{var i="default";a.has(i)||a.set(i,[]),null===(r=a.get(i))||void 0===r||r.push(e)}}));var c=[];return a.forEach((function(e,t){if(l.has(t)){var a=l.get(t);a.rowMeta.children&&a.rowMeta.children.length>0&&(a.rowMeta.children=ne(a.rowMeta.children,n,r)),c.push(a)}var d=w([],e,!0).sort((function(e,r){if(!(null==e?void 0:e.rowData)||!(null==r?void 0:r.rowData))return 0;var t=n.key.accessor,a=e.rowData[t],l=r.rowData[t];return Z(a,l,o,i)}));c.push.apply(c,d.map((function(e){var t=g({},e);if(t.rowMeta.children&&t.rowMeta.children.length>0){var o=ne(t.rowMeta.children,n,r);t.rowMeta=g(g({},t.rowMeta),{children:o})}return t})))})),c},ne=function(e,n,r){var t=r.find((function(e){return e.accessor===n.key.accessor})),o=(null==t?void 0:t.type)||"string",i=n.direction;return w([],e,!0).sort((function(e,r){if(!(null==e?void 0:e.rowData)||!(null==r?void 0:r.rowData))return 0;var t=n.key.accessor,a=e.rowData[t],l=r.rowData[t];return Z(a,l,o,i)})).map((function(e){return e.rowMeta.children&&e.rowMeta.children.length>0?g(g({},e),{rowMeta:g(g({},e.rowMeta),{children:ne(e.rowMeta.children,n,r)})}):e}))},re=function(e){e.colIndex;var n=e.event,r=e.forceUpdate,t=e.header;e.headersRef;var o=e.gridColumnEnd,i=e.gridColumnStart,a=e.setIsWidthDragging,l=e.startWidth;a(!0),n.preventDefault();var d=n.clientX;if(t){var c="number"==typeof t.minWidth?t.minWidth:40,s=function(e){return e.children&&0!==e.children.length?e.children.flatMap((function(e){return s(e)})):[e]},u=o-i>1,h=u?s(t):[t],f=h.map((function(e){return"number"==typeof e.width?e.width:parseInt(String(e.width),10)||150})).reduce((function(e,n){return e+n}),0),v=function(e){var n=e.clientX-d;if(u&&h.length>1){for(var o=Math.max(f+n,h.length*c),i=Math.max(Math.floor(o/h.length),c),a=0;a<h.length-1;a++)h[a].width=i;var s=i*(h.length-1),v=Math.max(o-s,c);h[h.length-1].width=v}else{var g=Math.max(l+n,c);t.width=g}r()},g=function(){document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",g),a(!1)};document.addEventListener("mousemove",v),document.addEventListener("mouseup",g)}},te=s((function(r,t){var o,i,l=r.colIndex,d=r.forceHeadersUpdate,c=r.gridColumnEnd,s=r.gridColumnStart,u=r.gridRowEnd,h=r.gridRowStart,f=r.header,v=r.reverse,m=r.sort,p=z(),C=p.columnReordering,I=p.columnResizing,x=p.draggedHeaderRef,R=p.forceUpdate,b=p.headersRef,y=p.hoveredHeaderRef,S=p.onColumnOrderChange,E=p.onSort,D=p.onTableHeaderDragEnd,H=p.rowHeight,k=p.selectColumns,N=p.selectableColumns,T=p.setInitialFocusedCell,O=p.setIsWidthDragging,W=p.setSelectedCells,B=p.setSelectedColumns,F=p.sortDownIcon,A=p.sortUpIcon,U=Boolean(null==f?void 0:f.isSortable),j="st-header-cell ".concat(f.accessor===(null===(o=y.current)||void 0===o?void 0:o.accessor)?"st-hovered":""," ").concat((null===(i=x.current)||void 0===i?void 0:i.accessor)===f.accessor?"st-dragging":""," ").concat(U?"clickable":""," ").concat(C&&!U?"columnReordering":""," ").concat("right"===(null==f?void 0:f.align)?"right-aligned":"center"===(null==f?void 0:f.align)?"center-aligned":""),J=P({draggedHeaderRef:x,headersRef:b,hoveredHeaderRef:y,onColumnOrderChange:S,onTableHeaderDragEnd:D}),V=J.handleDragStart,K=J.handleDragEnd,X=J.handleDragOver,q=L(),Y=function(e){var n=e.event,r=e.header;if(N){var t=function(e,n){if(!e.children||0===e.children.length)return[n];var r=[],t=function(e,n){if(!e.children||0===e.children.length)return r.push(n),n+1;for(var o=n,i=0,a=e.children;i<a.length;i++){var l=a[i];o=t(l,o)}return o};return t(e,n),r}(r,l);return n.shiftKey&&k?B((function(e){if(0===e.size)return new Set(t);var n=t[0],r=Array.from(e).sort((function(e,n){return e-n})),o=r[0],i=Math.abs(n-o);r.forEach((function(e){var r=Math.abs(n-e);r<i&&(i=r,o=e)}));var a,l,d,c,s=w(w([],(a=o,l=n,d=Math.min(a,l),c=Math.max(a,l),Array.from({length:c-d+1},(function(e,n){return d+n}))),!0),t,!0);return new Set(w(w([],Array.from(e),!0),s,!0))})):k&&k(t),W(new Set),void T(null)}r.isSortable&&E(l,r.accessor)};if(a((function(){var e=function(e){e.preventDefault(),e.dataTransfer.dropEffect="move"};return document.addEventListener("dragover",e),function(){document.removeEventListener("dragover",e)}}),[]),!f)return null;var $=I&&n("div",{className:"st-header-resize-handle",onMouseDown:function(e){var n;q({callback:re,callbackProps:{colIndex:l,event:e,forceUpdate:R,header:f,headersRef:b,gridColumnEnd:c,gridColumnStart:s,setIsWidthDragging:O,startWidth:"object"==typeof t&&null!==t&&"current"in t?null===(n=t.current)||void 0===n?void 0:n.offsetWidth:void 0},limit:10})}}),G=m&&m.key.accessor===f.accessor&&e("div",g({className:"st-sort-icon-container",onClick:function(e){return Y({event:e,header:f})}},{children:["ascending"===m.direction&&A&&A,"descending"===m.direction&&F&&F]}));return e("div",g({className:j,id:M({accessor:f.accessor,rowIndex:0}),onDragOver:function(e){q({callback:X,callbackProps:{event:e,hoveredHeader:f},limit:50})},ref:t,style:g(g({gridRowStart:h,gridRowEnd:u,gridColumnStart:s,gridColumnEnd:c},c-s>1?{}:{width:f.width}),u-h>1?{}:{height:H})},{children:[v&&$,e("div",g({className:"st-header-label ".concat("right"===f.align?"right-aligned":"center"===f.align?"center-aligned":""),draggable:C&&!f.disableReorder,onClick:function(e){return Y({event:e,header:f})},onDragEnd:function(e){e.preventDefault(),K(),d()},onDragStart:function(e){C&&f&&function(e){V(e)}(f)}},{children:["right"===f.align&&G,null==f?void 0:f.label,"right"!==f.align&&G]})),!v&&$]}))})),oe=function(e){var r=e.columnIndices,t=e.gridTemplateColumns,o=e.handleScroll,i=e.headersRef,a=e.hiddenColumns,d=e.maxDepth,c=e.pinned,s=e.sectionRef,u=e.sort,h=f((function(e){return e+1}),0)[1],w=l((function(){var e=[],n=1,t=function(o,i,l){var s,u;if(void 0===l&&(l=!1),!S({hiddenColumns:a,header:o,pinned:c}))return 0;l||n++;var h=null!==(u=null===(s=o.children)||void 0===s?void 0:s.filter((function(e){return S({hiddenColumns:a,header:e,pinned:c})})).length)&&void 0!==u?u:0,f=n,v=h>0?f+h:f+1,g=i,w=h>0?i+1:d+1;if(e.push({header:o,gridColumnStart:f,gridColumnEnd:v,gridRowStart:g,gridRowEnd:w,colIndex:r[o.accessor]}),o.children){var m=!0;o.children.forEach((function(e){S({hiddenColumns:a,header:e,pinned:c})&&(t(e,i+1,m),m=!1)}))}return v-f},o=i.current.filter((function(e){return S({hiddenColumns:a,header:e,pinned:c})})),l=!0;return o.forEach((function(e){t(e,1,l),l=!1})),e}),[i,a,d,c,r]);return n("div",g({className:"st-header-".concat(c?"pinned-".concat(c):"main")},o&&{onScroll:o},{ref:s,style:{gridTemplateColumns:t,display:"grid",position:"relative"}},{children:n(j,g({rowIndex:0},{children:w.map((function(e){return n(te,{colIndex:e.colIndex,forceHeadersUpdate:h,gridColumnEnd:e.gridColumnEnd,gridColumnStart:e.gridColumnStart,gridRowEnd:e.gridRowEnd,gridRowStart:e.gridRowStart,header:e.header,ref:v(),reverse:"right"===c,sort:u},e.header.accessor)}))}))}))},ie=function(e){var n;return(null===(n=e.children)||void 0===n?void 0:n.length)?1+Math.max.apply(Math,e.children.map(ie)):1},ae=function(r){var t=r.centerHeaderRef,o=r.headerContainerRef,i=r.headersRef,a=r.hiddenColumns,d=r.mainTemplateColumns,c=r.pinnedLeftColumns,s=r.pinnedLeftHeaderRef,u=r.pinnedLeftTemplateColumns,h=r.pinnedRightColumns,f=r.pinnedRightHeaderRef,v=r.pinnedRightTemplateColumns,w=r.sort,m=z().mainBodyRef;_(m,t);var p=l((function(){return $({headersRef:i,hiddenColumns:a,pinnedLeftColumns:c,pinnedRightColumns:h})}),[i,a,c,h]),C=l((function(){var e=i.current,n=0;return e.forEach((function(e){if(S({hiddenColumns:a,header:e})){var r=ie(e);n=Math.max(n,r)}})),{maxDepth:n}}),[i,a]).maxDepth;return e("div",g({className:"st-header-container",ref:o},{children:[c.length>0&&n(oe,{columnIndices:p,gridTemplateColumns:u,handleScroll:void 0,headersRef:i,hiddenColumns:a,maxDepth:C,pinned:"left",sectionRef:s,sort:w}),n(oe,{columnIndices:p,gridTemplateColumns:d,handleScroll:function(e){var n,r,o=null===(n=t.current)||void 0===n?void 0:n.scrollLeft;void 0!==o&&(null===(r=m.current)||void 0===r||r.scrollTo(o,0))},headersRef:i,hiddenColumns:a,maxDepth:C,sectionRef:t,sort:w}),h.length>0&&n(oe,{columnIndices:p,gridTemplateColumns:v,handleScroll:void 0,headersRef:i,hiddenColumns:a,maxDepth:C,pinned:"right",sectionRef:f,sort:w})]}))},le=function(e){var n=e.headers,r=e.hiddenColumns,t=function(e){var n=e.headers,o=e.flattenedHeaders;return n.forEach((function(e){!0!==r[e.accessor]&&(e.children?t({headers:e.children,flattenedHeaders:o}):o.push(e))})),o},o=t({headers:n,flattenedHeaders:[]});return"".concat(o.map((function(e){return function(e){var n=e.minWidth,r=e.width;return"number"==typeof r&&(r="".concat(r,"px")),n&&"number"==typeof n&&(n="".concat(n,"px")),void 0!==n?"minmax(".concat(n,", ").concat(r,")"):r}(e)})).join(" "))},de=function(r){var t=r.flattenedRows,i=r.isWidthDragging,a=r.setFlattenedRows,d=r.setScrollTop,c=r.sort,s=r.visibleRows,u=z(),h=u.editColumns,f=u.headersRef,v=u.hiddenColumns,w=o(null),m=o(null),p=o(null),C=o(null),I=f.current.filter((function(e){return!e.pinned})),x=f.current.filter((function(e){return"left"===e.pinned})),R=f.current.filter((function(e){return"right"===e.pinned})),b=l((function(){return le({headers:x,hiddenColumns:v})}),[x,v]),y=l((function(){return le({headers:I,hiddenColumns:v})}),[I,v]),M=l((function(){return le({headers:R,hiddenColumns:v})}),[R,v]),S={centerHeaderRef:p,flattenedRows:t,headerContainerRef:w,isWidthDragging:i,mainTemplateColumns:y,pinnedLeftColumns:x,pinnedLeftHeaderRef:m,pinnedLeftTemplateColumns:b,pinnedRightColumns:R,pinnedRightHeaderRef:C,pinnedRightTemplateColumns:M,setFlattenedRows:a,setScrollTop:d,visibleRows:s};return e("div",g({className:"st-table-content",style:{width:h?"calc(100% - 27.5px)":"100%"}},{children:[n(ae,g({},{centerHeaderRef:p,headerContainerRef:w,headersRef:f,hiddenColumns:v,mainTemplateColumns:y,pinnedLeftColumns:x,pinnedLeftHeaderRef:m,pinnedLeftTemplateColumns:b,pinnedRightColumns:R,pinnedRightHeaderRef:C,pinnedRightTemplateColumns:M,sort:c})),n(G,g({},S))]}))},ce=function(e){var n=e.callback,r=e.ref,t=e.widthAttribute;a((function(){var e=r.current;if(e){var o=function(){n(e[t]||0)};o();var i=new ResizeObserver((function(){o()}));return i.observe(e),function(){return i.disconnect()}}}),[n,r,t])},se=function(r){var i,a,l=r.mainBodyRef,d=r.pinnedLeftRef,c=r.pinnedRightRef,s=r.tableContentWidth,u=t(0),h=u[0],f=u[1],v=t(0),w=v[0],m=v[1],p=t(0),C=p[0],I=p[1],x=o(null);return ce({widthAttribute:"offsetWidth",callback:f,ref:d}),ce({widthAttribute:"scrollWidth",callback:I,ref:l}),ce({widthAttribute:"offsetWidth",callback:m,ref:c}),_(l,x),!l.current||l.current.scrollWidth<=l.current.clientWidth?null:e("div",g({className:"st-horizontal-scrollbar-container",style:{width:s}},{children:[h>0&&n("div",{className:"st-horizontal-scrollbar-left",style:{flexShrink:0,width:h,height:null===(i=x.current)||void 0===i?void 0:i.offsetHeight}}),C>0&&n("div",g({className:"st-horizontal-scrollbar-middle",onScroll:function(e){var n=e.target.scrollLeft;void 0!==n&&l.current&&l.current.scrollTo({left:n,behavior:"auto"})},ref:x},{children:n("div",{style:{width:C,height:".3px"}})})),w>0&&n("div",{className:"st-horizontal-scrollbar-right",style:{flexShrink:0,minWidth:w,height:null===(a=x.current)||void 0===a?void 0:a.offsetHeight}})]}))},ue=function(e){var n=e.headers,r=e.tableRows,o=t(null),i=o[0],a=o[1],d=l((function(){var e={};return n.forEach((function(n){!0===n.hide&&(e[n.accessor]=!0)})),e}),[n]),c=t(d),s=c[0],u=c[1],h=l((function(){if(!i)return r;var e=function(e,n,r){return{sortedData:ee(n,r,e),newSortConfig:r}}(n,r,i).sortedData;return e}),[r,i,n]);return{sort:i,setSort:a,updateSort:function(e,r){var t=function(e){for(var n=0,o=e;n<o.length;n++){var i=o[n];if(i.accessor===r)return i;if(i.children&&i.children.length>0){var a=t(i.children);if(a)return a}}},o=t(n);o&&a((function(e){return e&&e.key.accessor===r?"ascending"===e.direction?{key:o,direction:"descending"}:null:{key:o,direction:"ascending"}}))},sortedRows:h,hiddenColumns:s,setHiddenColumns:u}},he=function(r){var o=r.checked,i=void 0!==o&&o,a=r.children,l=r.onChange,d=t(i),c=d[0],s=d[1];return e("label",g({className:"st-checkbox-label"},{children:[n("input",{checked:c,className:"st-checkbox-input",onChange:function(){var e=!c;s(e),l&&l(e)},type:"checkbox"}),n("span",g({className:"st-checkbox-custom ".concat(c?"st-checked":"")},{children:c&&n("span",{className:"st-checkbox-checkmark"})})),a]}))},fe=function(e){var r=e.headers,t=e.open,o=e.position;e.setOpen;var i=e.setHiddenColumns,a=e.hiddenColumns,l="left"===o?"left":"";return n("div",g({className:"st-column-editor-popout ".concat(t?"open":""," ").concat(l),onClick:function(e){return e.stopPropagation()}},{children:n("div",g({className:"st-column-editor-popout-content"},{children:r.map((function(e,r){return n(he,g({checked:a[e.accessor],onChange:function(n){var r;return i(g(g({},a),((r={})[e.accessor]=n,r)))}},{children:e.label}),r)}))}))}))},ve=function(r){var o=r.columnEditorText,i=r.editColumns,a=r.editColumnsInitOpen,l=r.headers,d=r.position,c=void 0===d?"right":d,s=r.setHiddenColumns,u=r.hiddenColumns,h=t(a),f=h[0],v=h[1];return i?e("div",g({className:"st-column-editor ".concat(f?"open":""," ").concat(c),onClick:function(){return function(e){v(e)}(!f)}},{children:[n("div",g({className:"st-column-editor-text"},{children:o})),n(fe,{headers:l,open:f,position:c,setOpen:v,setHiddenColumns:s,hiddenColumns:u})]})):null},ge=function(r){var d=r.allowAnimations,c=void 0!==d&&d,s=r.cellUpdateFlash,h=void 0!==s&&s,v=r.collapseIcon,w=void 0===v?n(R,{className:"st-sort-icon"}):v,b=r.columnEditorPosition,y=void 0===b?"right":b,M=r.columnEditorText,S=void 0===M?"Columns":M,D=r.columnReordering,H=void 0!==D&&D,k=r.columnResizing,N=void 0!==k&&k,T=r.defaultHeaders,L=r.editColumns,O=void 0!==L&&L,W=r.editColumnsInitOpen,B=void 0!==W&&W,P=r.expandIcon,F=void 0===P?n(I,{className:"st-sort-icon"}):P,z=r.height,U=r.hideFooter,j=void 0!==U&&U,J=r.nextIcon,V=void 0===J?n(I,{className:"st-next-prev-icon"}):J,K=r.onCellEdit,X=r.onColumnOrderChange,q=r.onNextPage,Y=r.onPreviousPage,$=r.prevIcon,G=void 0===$?n(C,{className:"st-next-prev-icon"}):$,_=r.rowHeight,Q=void 0===_?40:_,Z=r.rows,ee=r.rowsPerPage,ne=void 0===ee?10:ee,re=r.selectableCells,te=void 0!==re&&re,oe=r.selectableColumns,ie=void 0!==oe&&oe,ae=r.shouldPaginate,le=void 0!==ae&&ae,ce=r.sortDownIcon,he=void 0===ce?n(R,{className:"st-sort-icon"}):ce,fe=r.sortUpIcon,ge=void 0===fe?n(x,{className:"st-sort-icon"}):fe,we=r.tableRef,me=r.theme,pe=void 0===me?"light":me,Ce=r.totalPages,Ie=o(null),xe=o(T),Re=o(null),be=o(null),ye=o(null),Me=o(null),Se=o(null),Ee=t(!1),De=Ee[0],He=Ee[1],ke=t(1),Ne=ke[0],Te=ke[1],Le=t(0),Oe=Le[0],We=Le[1],Be=t(0),Pe=Be[0],Fe=Be[1],Ae=t(0),ze=Ae[0],Ue=Ae[1],je=ue({headers:xe.current,tableRows:Z}),Je=je.sort,Ve=je.sortedRows,Ke=je.hiddenColumns,Xe=je.setHiddenColumns,qe=je.updateSort,Ye=l((function(){if(!le)return Ve;var e=(Ne-1)*ne,n=e+ne;return Ve.slice(e,n)}),[Ne,ne,le,Ve]),$e=t(Ye),Ge=$e[0],_e=$e[1];a((function(){_e(Ye)}),[Ye]);var Qe=l((function(){var e;if(!z)return window.innerHeight-Q;var n=document.querySelector(".simple-table-root"),r=0;if(z.endsWith("px"))r=parseInt(z,10);else if(z.endsWith("vh")){var t=parseInt(z,10);r=window.innerHeight*t/100}else if(z.endsWith("%")){var o=parseInt(z,10);r=((null===(e=null==n?void 0:n.parentElement)||void 0===e?void 0:e.clientHeight)||window.innerHeight)*o/100}else r=window.innerHeight;return Math.max(0,r-Q)}),[z,Q]),Ze=l((function(){return function(e){var n=e.bufferRowCount,r=e.contentHeight,t=e.flattenedRows,o=e.rowHeight,i=e.scrollTop,a=[],l=0,d=Math.max(0,i-o*n),c=i+r+o*n,s=function(e,n){for(var r,t=0,i=e;t<i.length;t++){var u=i[t],h=l*o;if(h>=c)break;h+o>d&&a.push({row:u,depth:n,position:l,isLastGroupRow:Boolean(null===(r=u.rowMeta.children)||void 0===r?void 0:r.length)&&n>1}),l+=1,u.rowMeta.isExpanded&&u.rowMeta.children&&s(u.rowMeta.children,n+1)}};return s(t,0),a}({bufferRowCount:5,contentHeight:Qe,flattenedRows:Ge,rowHeight:Q,scrollTop:ze})}),[Qe,Q,Ge,ze]),en=f((function(e){return e+1}),0)[1],nn=function(e){var n=e.selectableCells,r=e.headers,d=e.visibleRows,c=t(new Set),s=c[0],u=c[1],h=t(new Set),f=h[0],v=h[1],g=t(null),w=g[0],p=g[1],C=t(null),I=C[0],x=C[1],R=o(!1),b=o(null),y=i((function(){var e=Array.from(s).reduce((function(e,n){var t=n.split("-").map(Number),o=t[0],i=t[1];return e[o]||(e[o]=[]),e[o][i]=d[o].row.rowData[r[i].accessor],e}),{}),n=Object.values(e).map((function(e){return Object.values(e).join("\t")})).join("\n");s.size>0&&navigator.clipboard.writeText(n)}),[r,s,d]),M=i((function(e,n){for(var r=new Set,t=Math.min(e.rowIndex,n.rowIndex),o=Math.max(e.rowIndex,n.rowIndex),i=Math.min(e.colIndex,n.colIndex),a=Math.max(e.colIndex,n.colIndex),l=t;l<=o;l++)for(var c=i;c<=a;c++)if(l>=0&&l<d.length){var s=d[l].row.rowMeta.rowId;r.add(m({colIndex:c,rowIndex:l,rowId:s}))}v(new Set),p(null),u(r)}),[d,v,p,u]),S=i((function(e){if(e.rowIndex>=0&&e.rowIndex<d.length&&e.colIndex>=0&&e.colIndex<r.length){var n=m(e);v(new Set),p(null),u(new Set([n])),x(e)}}),[r.length,d.length,v,p,u,x]),E=i((function(e,n){void 0===n&&(n=!1),u(new Set),x(null),v((function(r){var t=new Set(n?r:[]);return e.forEach((function(e){return t.add(e)})),t})),e.length>0&&p(e[e.length-1])}),[u,x,v,p]);a((function(){var e=function(e){if(n&&I){var t=I.rowIndex,o=I.colIndex,i=I.rowId;if(!e.ctrlKey&&!e.metaKey||"c"!==e.key){if(d[t].row.rowMeta.rowId!==i){var a=d.findIndex((function(e){return e.row.rowMeta.rowId===i}));if(-1===a)return;t=a}if("ArrowUp"===e.key){if(e.preventDefault(),t>0){var l={rowIndex:t-1,colIndex:o,rowId:d[t-1].row.rowMeta.rowId};S(l)}}else"ArrowDown"===e.key?(e.preventDefault(),t<d.length-1&&(l={rowIndex:t+1,colIndex:o,rowId:d[t+1].row.rowMeta.rowId},S(l))):"ArrowLeft"===e.key||"Tab"===e.key&&e.shiftKey?(e.preventDefault(),o>0&&(l={rowIndex:t,colIndex:o-1,rowId:d[t].row.rowMeta.rowId},S(l))):"ArrowRight"===e.key||"Tab"===e.key?(e.preventDefault(),o<r.length-1&&(l={rowIndex:t,colIndex:o+1,rowId:d[t].row.rowMeta.rowId},S(l))):"Escape"===e.key&&(u(new Set),v(new Set),p(null),b.current=null,x(null))}else y()}};return document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[y,r.length,I,M,S,n,d]);var D=i((function(e){var n=e.colIndex,r=e.rowIndex,t=e.rowId,o=m({colIndex:n,rowIndex:r,rowId:t}),i=s.has(o),a=f.has(n);return i||a}),[s,f]),H=i((function(e){var n,r,t,o,i,a,l=e.colIndex,c=e.rowIndex,s=e.rowId,u=[],h=null===(t=null===(r=null===(n=d[c-1])||void 0===n?void 0:n.row)||void 0===r?void 0:r.rowMeta)||void 0===t?void 0:t.rowId,v={colIndex:l,rowIndex:c+1,rowId:null===(a=null===(i=null===(o=d[c+1])||void 0===o?void 0:o.row)||void 0===i?void 0:i.rowMeta)||void 0===a?void 0:a.rowId},g={colIndex:l-1,rowIndex:c,rowId:s},w={colIndex:l+1,rowIndex:c,rowId:s};return(!D({colIndex:l,rowIndex:c-1,rowId:h})||f.has(l)&&0===c)&&u.push("st-selected-top-border"),(!D(v)||f.has(l)&&c===d.length-1)&&u.push("st-selected-bottom-border"),D(g)||u.push("st-selected-left-border"),D(w)||u.push("st-selected-right-border"),u.join(" ")}),[D,d,f]),k=l((function(){return I?function(e){var n=e.rowIndex,r=e.colIndex,t=e.rowId;return n===I.rowIndex&&r===I.colIndex&&t===I.rowId}:function(){return!1}}),[I]);return{getBorderClass:H,handleMouseDown:function(e){var r=e.colIndex,t=e.rowIndex,o=e.rowId;if(n){R.current=!0,b.current={rowIndex:t,colIndex:r,rowId:o},v(new Set),p(null);var i=m({colIndex:r,rowIndex:t,rowId:o});u(new Set([i])),x({rowIndex:t,colIndex:r,rowId:o})}},handleMouseOver:function(e){var r=e.colIndex,t=e.rowIndex;if(e.rowId,n&&R.current&&b.current){for(var o=new Set,i=Math.min(b.current.rowIndex,t),a=Math.max(b.current.rowIndex,t),l=Math.min(b.current.colIndex,r),c=Math.max(b.current.colIndex,r),s=i;s<=a;s++)for(var h=l;h<=c;h++)if(s>=0&&s<d.length){var f=d[s].row.rowMeta.rowId;o.add(m({colIndex:h,rowIndex:s,rowId:f}))}u(o)}},handleMouseUp:function(){R.current=!1},isInitialFocusedCell:k,isSelected:D,lastSelectedColumnIndex:w,selectColumns:E,selectedCells:s,selectedColumns:f,setInitialFocusedCell:x,setSelectedCells:u,setSelectedColumns:v}}({selectableCells:te,headers:xe.current,visibleRows:Ze}),rn=nn.handleMouseDown,tn=nn.handleMouseOver,on=nn.handleMouseUp,an=nn.isSelected,ln=nn.getBorderClass,dn=nn.isInitialFocusedCell,cn=nn.setSelectedCells,sn=nn.setSelectedColumns,un=nn.selectColumns,hn=nn.setInitialFocusedCell,fn=i((function(e,n){qe(e,n)}),[qe]),vn=i((function(e){xe.current=e,en()}),[]);a((function(){var e=function(e){var n=e.target;n.closest(".st-cell")||ie&&(n.classList.contains("st-header-cell")||n.classList.contains("st-header-label"))||(cn(new Set),ie&&sn(new Set))};return document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}}),[ie,cn,sn]),u((function(){if(Se.current){var e=Se.current.offsetWidth-Se.current.clientWidth,n=Se.current.clientWidth;We(e),Fe(n)}}),[]),u((function(){var e=function(){if(en(),Se.current){var e=Se.current.offsetWidth-Se.current.clientWidth,n=Se.current.clientWidth;We(e),Fe(n)}};return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}),[]);var gn=o(new Map);return a((function(){we&&(we.current={updateData:function(e){var n,r,t,o,i=e.accessor,a=e.rowIndex,l=e.newValue,d=null===(r=null===(n=null==Z?void 0:Z[a])||void 0===n?void 0:n.rowMeta)||void 0===r?void 0:r.rowId;if(void 0!==d){var c=E({rowId:d,accessor:i}),s=gn.current.get(c);s&&s.updateContent(l),void 0!==(null===(o=null===(t=null==Z?void 0:Z[a])||void 0===t?void 0:t.rowData)||void 0===o?void 0:o[i])&&(Z[a].rowData[i]=l)}}})}),[we,Z]),n(A,g({value:{allowAnimations:c,cellUpdateFlash:h,collapseIcon:w,columnReordering:H,columnResizing:N,draggedHeaderRef:Ie,editColumns:O,expandIcon:F,forceUpdate:en,getBorderClass:ln,handleMouseDown:rn,handleMouseOver:tn,headersRef:xe,hiddenColumns:Ke,hoveredHeaderRef:Re,isInitialFocusedCell:dn,isSelected:an,mainBodyRef:be,onCellEdit:K,onColumnOrderChange:X,onSort:fn,onTableHeaderDragEnd:vn,pinnedLeftRef:ye,pinnedRightRef:Me,rowHeight:Q,scrollbarWidth:Oe,selectColumns:un,selectableColumns:ie,setInitialFocusedCell:hn,setIsWidthDragging:He,setSelectedCells:cn,setSelectedColumns:sn,shouldPaginate:le,sortDownIcon:he,sortUpIcon:ge,tableBodyContainerRef:Se,cellRegistry:gn.current}},{children:e("div",g({className:"simple-table-root st-wrapper theme-".concat(pe),style:z?{height:z}:{}},{children:[e("div",g({className:"st-table-wrapper-container"},{children:[e("div",g({className:"st-table-wrapper",onMouseUp:on,onMouseLeave:on},{children:[n(de,{flattenedRows:Ge,isWidthDragging:De,setFlattenedRows:_e,setScrollTop:Ue,sort:Je,visibleRows:Ze}),n(ve,{columnEditorText:S,editColumns:O,editColumnsInitOpen:B,headers:xe.current,hiddenColumns:Ke,position:y,setHiddenColumns:Xe})]})),n(se,{mainBodyRef:be,pinnedLeftRef:ye,pinnedRightRef:Me,tableContentWidth:Pe})]})),n(p,{currentPage:Ne,hideFooter:j,nextIcon:V,onPageChange:Te,onNextPage:q,onPreviousPage:Y,prevIcon:G,shouldPaginate:le,totalPages:Ce||Math.ceil(Ve.length/ne)})]}))}))};export{ge as SimpleTable};
1
+ import{jsxs as e,jsx as n,Fragment as r}from"react/jsx-runtime";import{useState as t,useRef as o,useCallback as i,useEffect as a,useMemo as l,createContext as d,useContext as c,forwardRef as s,useLayoutEffect as u,Fragment as h,useReducer as f,createRef as v}from"react";var g=function(){return g=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var o in n=arguments[r])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},g.apply(this,arguments)};function m(e,n,r){if(r||2===arguments.length)for(var t,o=0,i=n.length;o<i;o++)!t&&o in n||(t||(t=Array.prototype.slice.call(n,0,o)),t[o]=n[o]);return e.concat(t||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var w=function(e){var n=e.rowIndex,r=e.colIndex,t=e.rowId;return"".concat(n,"-").concat(r,"-").concat(t)},p=function(r){var t=r.currentPage,o=r.hideFooter,i=r.nextIcon,a=r.onPageChange,l=r.onNextPage,d=r.onPreviousPage,c=r.prevIcon,s=r.shouldPaginate,u=r.totalPages;if(o||!s)return null;var h=!(t>1)&&!d,f=!(t<u)&&!l;return e("div",g({className:"st-footer"},{children:[n("button",g({className:"st-next-prev-btn ".concat(h?"disabled":""),onClick:function(){var e=t-1;e>=1&&a(e),d&&d(e-1)},disabled:h},{children:c})),n("button",g({className:"st-next-prev-btn ".concat(f?"disabled":""),onClick:function(){var e=t+1;(e<=u||l)&&a(e),l&&l(t)},disabled:f},{children:i})),Array.from({length:u},(function(e,r){return n("button",g({onClick:function(){var e;(e=r+1)>=1&&e<=u&&(a(e),e>t&&l?l(e-1):e<t&&d&&d(e-1))},className:"st-page-btn ".concat(t===r+1?"active":"")},{children:r+1}),r)}))]}))},C=function(e){var r=e.className;return n("svg",g({className:r,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:n("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})}))},I=function(e){var r=e.className;return n("svg",g({className:r,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:n("path",{d:"M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z"})}))},x=function(e){var r=e.className;return n("svg",g({className:r,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:n("path",{d:"M5.41 11.41L10 6.83l4.59 4.58L16 10l-6-6-6 6z"})}))},R=function(e){var r=e.className;return n("svg",g({className:r,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:n("path",{d:"M5.41 7.59L10 12.17l4.59-4.58L16 9l-6 6-6-6z"})}))},b=function(e){return e.position*(e.rowHeight+1)-1},y=function(e){return e.position*(e.rowHeight+1)},M=function(e){var n=e.accessor,r=e.rowIndex;return"cell-".concat(n,"-").concat(r)},S=function(e){var n=e.hiddenColumns,r=e.header,t=e.pinned;return n[r.accessor]?null:!t&&!r.pinned||r.pinned===t||null},E=function(e){var n=e.rowId,r=e.accessor;return"".concat(n,"-").concat(r)},D=function(r){var t=r.value,o=r.onBlur,i=r.onChange;return e("select",g({value:t.toString(),onBlur:o,onChange:function(e){var n=e.target.value;i("true"===n)}},{children:[n("option",g({value:"true"},{children:"True"})),n("option",g({value:"false"},{children:"False"}))]}))},H=function(e){var r=e.defaultValue,t=e.onBlur,i=e.onChange,a=o(null);return n("input",{className:"editable-cell-input",ref:a,autoFocus:!0,type:"text",defaultValue:null!=r?r:"",onBlur:t,onChange:function(e){var n=e.target.value;i(n)}})},k=function(e){var r=e.defaultValue,t=e.onBlur,i=e.onChange,a=o(null);return n("input",{className:"editable-cell-input",ref:a,autoFocus:!0,defaultValue:r.toString(),onBlur:t,onChange:function(e){var n=e.target.value;/^\d*\.?\d*$/.test(n)&&i(n)}})},N=function(e){var t=e.onChange,o=e.setIsEditing,i=e.value,a=function(e){null==t||t(e)},l=function(){o(!1)};return n(r,{children:"string"==typeof i||null==i?n(H,{defaultValue:i,onBlur:l,onChange:a}):"boolean"==typeof i?n(D,{onBlur:l,onChange:a,value:i}):"number"==typeof i?n(k,{defaultValue:i,onBlur:l,onChange:a}):null})},T=0,L=function(){return function(e){var n=e.callback,r=e.callbackProps,t=e.limit,o=Date.now();(0===T||o-T>=t)&&(T=o,n(r))}},W=Date.now(),O={screenX:0,screenY:0},B=function(e,n,r){void 0===r&&(r=[]);for(var t=0;t<e.length;t++){var o=e[t];if(o.accessor===n)return m(m([],r,!0),[t],!1);if(o.children&&o.children.length>0){var i=B(o.children,n,m(m([],r,!0),[t],!1));if(i)return i}}return null};var P=function(e){var n,r,t=e.draggedHeaderRef,i=e.headersRef,l=e.hoveredHeaderRef,d=e.onColumnOrderChange,c=e.onTableHeaderDragEnd,s=(n=i.current,r=o(n),a((function(){JSON.stringify(r.current)!==JSON.stringify(n)&&(r.current=n)}),[n]),r.current);return{handleDragStart:function(e){t.current=e,W=Date.now()},handleDragOver:function(e){var n,r,o=e.event,a=e.hoveredHeader;if(o.preventDefault(),i.current){var d=o.currentTarget.getAnimations().some((function(e){return"running"===e.playState})),u=o.screenX,h=o.screenY,f=Math.sqrt(Math.pow(u-O.screenX,2)+Math.pow(h-O.screenY,2));l.current=a;var v=i.current,g=B(v,(null===(n=t.current)||void 0===n?void 0:n.accessor)||""),m=B(v,a.accessor);if(g&&m){var w=g.length,p=m.length,C=m;if(w!==p){var I=p-w;I>0&&(C=m.slice(0,-I))}var x=function(e,n,r){var t=JSON.parse(JSON.stringify(e)),o=!1;function i(e,n){for(var r=e,t=0;t<n.length-1;t++)r=r[n[t]].children;return r[n[n.length-1]]}function a(e,n,r){for(var t=e,i=0;i<n.length-1;i++){if(!t[n[i]].children){o=!0;break}t=t[n[i]].children}t[n[n.length-1]]=r}var l=i(t,n);return a(t,n,i(t,r)),a(t,r,l),{newHeaders:t,emergencyBreak:o}}(v,g,C),R=x.newHeaders,b=x.emergencyBreak;if(!(d||a.accessor===(null===(r=t.current)||void 0===r?void 0:r.accessor)||null===t.current||f<10||0===g.length||0===C.length||JSON.stringify(R)===JSON.stringify(i.current)||b)){var y=Date.now();JSON.stringify(R)===JSON.stringify(s)&&(y-W<1500||f<40)||(W=y,O={screenX:u,screenY:h},c(R))}}}},handleDragEnd:function(){t.current=null,l.current=null,null==d||d(i.current)}}},F=d(void 0),A=function(e){var r=e.children,t=e.value;return n(F.Provider,g({value:t},{children:r}))},z=function(){var e=c(F);if(void 0===e)throw new Error("useTableContext must be used within a TableProvider");return e},U=s((function(r,l){var d,c,s=r.borderClass,u=r.colIndex,h=r.header,f=r.isHighlighted,v=r.isInitialFocused,m=r.onExpandRowClick,w=r.rowIndex,p=r.visibleRow,C=z(),I=C.cellRegistry,x=C.cellUpdateFlash,R=C.collapseIcon,b=C.draggedHeaderRef,y=C.expandIcon,S=C.handleMouseDown,D=C.handleMouseOver,H=C.headersRef,k=C.hoveredHeaderRef,T=C.onCellEdit,W=C.onTableHeaderDragEnd,O=p.depth,B=p.row,F=t(B.rowData[h.accessor]),A=F[0],U=F[1],j=t(!1),J=j[0],V=j[1],K=t(!1),X=K[0],q=K[1],Y=o(null),$=P({draggedHeaderRef:b,headersRef:H,hoveredHeaderRef:k,onTableHeaderDragEnd:W}).handleDragOver,G=L(),_="cell-".concat(w,"-").concat(u),Q=E({rowId:B.rowMeta.rowId,accessor:h.accessor});a((function(){if(I){var e="".concat(B.rowMeta.rowId,"-").concat(h.accessor);return I.set(e,{updateContent:function(e){A!==e?(U(e),x&&(q(!0),Y.current&&clearTimeout(Y.current),Y.current=setTimeout((function(){q(!1)}),800))):U(e)}}),function(){I.delete(e),Y.current&&clearTimeout(Y.current)}}}),[I,x,B.rowMeta.rowId,h.accessor,A]),a((function(){if(X){var e=setTimeout((function(){q(!1)}),850);return function(){return clearTimeout(e)}}}),[X]),a((function(){U(B.rowData[h.accessor])}),[B.rowData,h.accessor]);var Z=Boolean(null===(c=null===(d=B.rowMeta)||void 0===d?void 0:d.children)||void 0===c?void 0:c.length),ee=Boolean(null==h?void 0:h.isEditable),ne="st-cell ".concat(O>0&&h.expandable?"st-cell-depth-".concat(O):""," ").concat(f?v?"st-cell-selected-first ".concat(s):"st-cell-selected ".concat(s):""," ").concat(ee?"clickable":""," ").concat(X?"st-cell-updating":""),re=i((function(e){U(e),null==T||T({accessor:h.accessor,newValue:e,row:B})}),[h.accessor,T,B]);return J?n("div",g({className:"st-cell-editing",id:M({accessor:h.accessor,rowIndex:w+1})},{children:n(N,{onChange:re,setIsEditing:V,value:A})})):e("div",g({className:ne,id:_,onDoubleClick:function(){return h.isEditable&&V(!0)},onMouseDown:function(){return S({rowIndex:w,colIndex:u,rowId:B.rowMeta.rowId})},onMouseOver:function(){return D({rowIndex:w,colIndex:u,rowId:B.rowMeta.rowId})},onDragOver:function(e){return G({callback:$,callbackProps:{event:e,hoveredHeader:h},limit:50})},onKeyDown:function(e){"F2"!==e.key&&"Enter"!==e.key||!h.isEditable||J||(e.preventDefault(),V(!0))},ref:l,"data-row-index":w,"data-col-index":u,"data-row-id":B.rowMeta.rowId,"data-accessor":h.accessor},{children:[h.expandable&&Z?B.rowMeta.isExpanded?n("div",g({className:"st-sort-icon-container",onClick:function(){return m(B.rowMeta.rowId)},onMouseDown:function(e){e.stopPropagation()}},{children:R})):n("div",g({className:"st-sort-icon-container",onClick:function(){return m(B.rowMeta.rowId)},onMouseDown:function(e){e.stopPropagation()}},{children:y})):null,n("span",g({className:"st-cell-content ".concat("right"===h.align?"right-aligned":"center"===h.align?"center-aligned":"")},{children:h.cellRenderer?h.cellRenderer({accessor:h.accessor,colIndex:u,row:B}):A}))]}),Q)})),j=function(e){var t=e.children,o=function(e,n){var r={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(r[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(t=Object.getOwnPropertySymbols(e);o<t.length;o++)n.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(e,t[o])&&(r[t[o]]=e[t[o]])}return r}(e,["children"]);return z().allowAnimations?n(J,g({},o,{children:t})):n(r,{children:t})},J=function(e){var i=e.children,l=e.isBody,d=e.pauseAnimation,c=e.rowIndex,s=o(!1),h=z(),f=h.draggedHeaderRef,v=h.headersRef,g=h.mainBodyRef,m=h.shouldPaginate,w=t({}),p=w[0],C=w[1],I=o({}),x=v.current;return u((function(){if(x){var e=function(e){var n=e.currentHeaders,r=e.draggedHeaderRef,t=e.rowIndex,o={};return n.forEach((function(e){var n;if(e){var i=document.getElementById(M({accessor:e.accessor,rowIndex:t}));if(i){var a=i.getAnimations().some((function(e){return"running"===e.playState})),l=i.getBoundingClientRect();a&&(null===(n=null==r?void 0:r.current)||void 0===n?void 0:n.accessor)!==e.accessor?o[e.accessor]=!1:o[e.accessor]=l}}})),o}({currentHeaders:x,draggedHeaderRef:f,rowIndex:c});JSON.stringify(e)!==JSON.stringify(p)&&(I.current=p,C(e))}}),[p,x,f,l,c]),u((function(){var e=g.current,n=function(){s.current=!0},r=function(){s.current=!1};return null==e||e.addEventListener("scroll",n),null==e||e.addEventListener("scrollend",r),function(){null==e||e.removeEventListener("scroll",n),null==e||e.removeEventListener("scrollend",r)}}),[f,g]),a((function(){d||s.current||Object.keys(I.current).length&&x&&x.forEach((function(e){var n=document.getElementById(M({accessor:e.accessor,rowIndex:c}));if(n){var r=I.current[e.accessor],t=p[e.accessor];if(r&&t){var o=r.left-t.left,i=m?0:r.top-t.top,a=Math.abs(o),l=Math.abs(i);(a>10||l>10)&&requestAnimationFrame((function(){n.style.transform="translate(".concat(o,"px, ").concat(i,"px)"),n.style.transition="transform 0s",requestAnimationFrame((function(){n.style.transform="",n.style.transition="transform ".concat(400,"ms ease-out")}))}))}}}))}),[p,x,l,d,I,c,m]),n(r,{children:i})},V=function(e){var r=e.columnIndices,t=e.headers,o=e.hiddenColumns,i=e.isWidthDragging,a=e.onExpandRowClick,l=e.pinned,d=e.rowIndex,c=e.rowIndices,s=e.visibleRow,u=t.filter((function(e){return S({hiddenColumns:o,header:e,pinned:l})}));return n(j,g({isBody:!0,pauseAnimation:i,rowIndex:d+1},{children:u.map((function(e){return n(K,{columnIndices:r,header:e,headers:t,hiddenColumns:o,onExpandRowClick:a,pinned:l,rowIndex:d,rowIndices:c,visibleRow:s},M({accessor:e.accessor,rowIndex:d+1}))}))}))},K=function(e){var r=e.columnIndices,t=e.header,o=e.headers,i=e.hiddenColumns,a=e.onExpandRowClick,l=e.pinned,d=e.rowIndex,c=e.rowIndices,s=e.visibleRow,u=r[t.accessor],f=z(),v=f.getBorderClass,g=f.isSelected,m=f.isInitialFocusedCell;if(t.children){var w=t.children.filter((function(e){return S({hiddenColumns:i,header:e,pinned:l})}));return n(h,{children:w.map((function(e){return n(K,{columnIndices:r,header:e,headers:o,hiddenColumns:i,onExpandRowClick:a,pinned:l,rowIndex:d,rowIndices:c,visibleRow:s},M({accessor:e.accessor,rowIndex:d+1}))}))})}var p={rowIndex:d,colIndex:u,rowId:s.row.rowMeta.rowId},C=v(p),I=g(p),x=m(p);return n(U,{borderClass:C,colIndex:u,header:t,isHighlighted:I,isInitialFocused:x,onExpandRowClick:a,rowIndex:d,visibleRow:s},M({accessor:t.accessor,rowIndex:d+1}))},X=function(e){var r=e.columnIndices,t=e.gridTemplateColumns,o=e.headers,i=e.hiddenColumns,a=e.index,l=e.isWidthDragging,d=e.onExpandRowClick,c=e.pinned,s=e.rowHeight,u=e.rowIndices,h=e.visibleRow,f=h.position;return n("div",g({className:"st-row ".concat(f%2==0?"even":"odd"),style:{gridTemplateColumns:t,top:y({position:f,rowHeight:s}),height:"".concat(s,"px")}},{children:n(V,{columnIndices:r,headers:o,hiddenColumns:i,isWidthDragging:l,onExpandRowClick:d,pinned:c,rowIndex:a,rowIndices:u,visibleRow:h},a)}))},q=function(e){var r=e.displayStrongBorder,t=e.position,o=e.rowHeight,i=e.templateColumns;return n("div",g({className:"st-row-separator ".concat(r?"st-last-group-row":""),style:{display:"grid",gridTemplateColumns:i,position:"absolute",top:b({position:t,rowHeight:o}),minWidth:"100%"}},{children:n("div",{style:{gridColumn:"1 / -1"}})}))},Y=function(r){var t=r.columnIndices,o=r.headers,i=r.hiddenColumns,a=r.isWidthDragging,l=r.onExpandRowClick,d=r.pinned,c=r.rowHeight,s=r.rowIndices,u=r.sectionRef,f=r.templateColumns,v=r.totalHeight,m=r.visibleRows,w=r.width,p=d?"st-body-pinned-".concat(d):"st-body-main";return n("div",g({className:p,ref:u,style:{position:"relative",height:"".concat(v,"px"),width:w}},{children:m.map((function(r,u){var v,g,w,p,C=Boolean(null===(g=null===(v=r.row.rowMeta)||void 0===v?void 0:v.children)||void 0===g?void 0:g.length),I=null===(p=null===(w=m[u-1])||void 0===w?void 0:w.row.rowMeta)||void 0===p?void 0:p.isExpanded;return e(h,{children:[n(X,{columnIndices:t,gridTemplateColumns:f,headers:o,hiddenColumns:i,index:u,isWidthDragging:a,onExpandRowClick:l,pinned:d,rowHeight:c,rowIndices:s,visibleRow:r}),0!==u&&n(q,{displayStrongBorder:C&&I,position:r.position,rowHeight:c,templateColumns:f})]},r.position)}))}))};function $(e){var n=e.headersRef,r=e.hiddenColumns,t=e.pinnedLeftColumns,o=e.pinnedRightColumns,i={},a=0,l=function(e,n){void 0===n&&(n=!1),n||a++,i[e.accessor]=a,e.children&&e.children.length>0&&e.children.filter((function(e){return S({hiddenColumns:r,header:e})})).forEach((function(e,n){l(e,0===n)}))};return t.forEach((function(e,n){l(e,0===n)})),n.current.filter((function(e){return!e.pinned&&S({hiddenColumns:r,header:e})})).forEach((function(e,n){var r=0===n&&0===t.length;l(e,r)})),o.forEach((function(e){l(e,!1)})),i}var G=function(r){var i,d,c,s,u,h=r.centerHeaderRef,f=r.flattenedRows,v=r.headerContainerRef,m=r.isWidthDragging,w=r.mainTemplateColumns,p=r.pinnedLeftColumns,C=r.pinnedLeftHeaderRef,I=r.pinnedLeftTemplateColumns,x=r.pinnedRightColumns,R=r.pinnedRightHeaderRef,b=r.pinnedRightTemplateColumns,y=r.setFlattenedRows,M=r.setScrollTop,S=r.visibleRows,E=z(),D=E.rowHeight,H=E.scrollbarWidth,k=E.mainBodyRef,N=E.pinnedLeftRef,T=E.pinnedRightRef,L=E.tableBodyContainerRef,W=E.hiddenColumns,O=E.headersRef;!function(e){var n=e.headerContainerRef,r=e.mainSectionRef,o=e.scrollbarWidth,i=t(!1),l=i[0],d=i[1];a((function(){var e=null==n?void 0:n.current;if(l&&e)return e.classList.add("st-header-scroll-padding"),e.style.setProperty("--st-after-width","".concat(o,"px")),function(){e.classList.remove("st-header-scroll-padding")}}),[n,l,o]),a((function(){var e=null==n?void 0:n.current,t=null==r?void 0:r.current;if(t&&e){var o=function(){if(t){var e=t.scrollHeight>t.clientHeight;d(e)}};o();var i=new ResizeObserver((function(){o()}));return i.observe(t),function(){t&&i.unobserve(t)}}}),[n,r])}({headerContainerRef:v,mainSectionRef:L,scrollbarWidth:H});var B,P,F=o(null),A=(B=0,(P=function(e){e.forEach((function(e){B+=1,e.rowMeta.isExpanded&&e.rowMeta.children&&P(e.rowMeta.children)}))})(f),B)*(D+1)-1,U=l((function(){return $({headersRef:O,hiddenColumns:W,pinnedLeftColumns:p,pinnedRightColumns:x})}),[O,W,p,x]),j=l((function(){var e={};return S.forEach((function(n,r){var t=String(n.row.rowMeta.rowId);e[t]=r})),e}),[S]),J=function(e){var n=function(r){return r.rowMeta.rowId===e&&r.rowMeta.children?g(g({},r),{rowMeta:g(g({},r.rowMeta),{isExpanded:!r.rowMeta.isExpanded})}):r.rowMeta.children?g(g({},r),{rowMeta:g(g({},r.rowMeta),{children:r.rowMeta.children.map(n)})}):r};y((function(e){return e.map(n)}))},V=(null===(i=C.current)||void 0===i?void 0:i.clientWidth)?(null===(d=C.current)||void 0===d?void 0:d.clientWidth)+1:0,K=null===(c=h.current)||void 0===c?void 0:c.clientWidth,X=(null===(s=R.current)||void 0===s?void 0:s.clientWidth)?(null===(u=R.current)||void 0===u?void 0:u.clientWidth)+1:0,q={headerContainerRef:v,headers:O.current,hiddenColumns:W,isWidthDragging:m,rowHeight:D,visibleRows:S,columnIndices:U,rowIndices:j};return e("div",g({className:"st-body-container",ref:L,onScroll:function(e){var n=e.currentTarget.scrollTop;F.current&&cancelAnimationFrame(F.current),F.current=requestAnimationFrame((function(){M(n)}))}},{children:[p.length>0&&n(Y,g({},q,{onExpandRowClick:J,pinned:"left",sectionRef:N,templateColumns:I,totalHeight:A,width:V})),n(Y,g({},q,{onExpandRowClick:J,sectionRef:k,templateColumns:w,totalHeight:A,width:K})),x.length>0&&n(Y,g({},q,{onExpandRowClick:J,pinned:"right",sectionRef:T,templateColumns:b,totalHeight:A,width:X}))]}))},_=function(e,n){a((function(){if(e.current){var r=e.current,t=function(){var e,t=null==r?void 0:r.scrollLeft;void 0!==t&&(null===(e=n.current)||void 0===e||e.scrollTo(t,0))};return r.addEventListener("scroll",t),function(){null==r||r.removeEventListener("scroll",t)}}}),[e,n])},Q=function(e){var n=e.event,r=e.forceUpdate,t=e.header,o=e.gridColumnEnd,i=e.gridColumnStart,a=e.setIsWidthDragging,l=e.startWidth;a(!0),n.preventDefault();var d=n.clientX;if(t){var c="number"==typeof t.minWidth?t.minWidth:40,s=function(e){return e.children&&0!==e.children.length?e.children.flatMap((function(e){return s(e)})):[e]},u=o-i>1,h=u?s(t):[t],f=function(e){var n=e.clientX-d;if(u&&h.length>1){var o=h.reduce((function(e,n){return Math.min(e,"number"==typeof n.minWidth?n.minWidth:40)}),40),i=h.reduce((function(e,n){return e+("number"==typeof n.width?n.width:150)}),0),a=Math.max(l+n,o)-i;h.forEach((function(e,n){var r="number"==typeof e.width?e.width:150,t=a*(r/i),o=Math.max(r+t,c);e.width=o}))}else{var s=Math.max(l+n,c);t.width=s}r()},v=function(){document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",v),a(!1)};document.addEventListener("mousemove",f),document.addEventListener("mouseup",v)}},Z=s((function(r,t){var o,i,l=r.colIndex,d=r.forceHeadersUpdate,c=r.gridColumnEnd,s=r.gridColumnStart,u=r.gridRowEnd,h=r.gridRowStart,f=r.header,v=r.reverse,w=r.sort,p=z(),C=p.columnReordering,I=p.columnResizing,x=p.draggedHeaderRef,R=p.forceUpdate,b=p.headersRef,y=p.hoveredHeaderRef,S=p.onColumnOrderChange,E=p.onSort,D=p.onTableHeaderDragEnd,H=p.rowHeight,k=p.selectColumns,N=p.selectableColumns,T=p.setInitialFocusedCell,W=p.setIsWidthDragging,O=p.setSelectedCells,B=p.setSelectedColumns,F=p.sortDownIcon,A=p.sortUpIcon,U=Boolean(null==f?void 0:f.isSortable),j="st-header-cell ".concat(f.accessor===(null===(o=y.current)||void 0===o?void 0:o.accessor)?"st-hovered":""," ").concat((null===(i=x.current)||void 0===i?void 0:i.accessor)===f.accessor?"st-dragging":""," ").concat(U?"clickable":""," ").concat(C&&!U?"columnReordering":""," ").concat("right"===(null==f?void 0:f.align)?"right-aligned":"center"===(null==f?void 0:f.align)?"center-aligned":""),J=P({draggedHeaderRef:x,headersRef:b,hoveredHeaderRef:y,onColumnOrderChange:S,onTableHeaderDragEnd:D}),V=J.handleDragStart,K=J.handleDragEnd,X=J.handleDragOver,q=L(),Y=function(e){var n=e.event,r=e.header;if(N){var t=function(e,n){if(!e.children||0===e.children.length)return[n];var r=[],t=function(e,n){if(!e.children||0===e.children.length)return r.push(n),n+1;for(var o=n,i=0,a=e.children;i<a.length;i++){var l=a[i];o=t(l,o)}return o};return t(e,n),r}(r,l);return n.shiftKey&&k?B((function(e){if(0===e.size)return new Set(t);var n=t[0],r=Array.from(e).sort((function(e,n){return e-n})),o=r[0],i=Math.abs(n-o);r.forEach((function(e){var r=Math.abs(n-e);r<i&&(i=r,o=e)}));var a,l,d,c,s=m(m([],(a=o,l=n,d=Math.min(a,l),c=Math.max(a,l),Array.from({length:c-d+1},(function(e,n){return d+n}))),!0),t,!0);return new Set(m(m([],Array.from(e),!0),s,!0))})):k&&k(t),O(new Set),void T(null)}r.isSortable&&E(l,r.accessor)};if(a((function(){var e=function(e){e.preventDefault(),e.dataTransfer.dropEffect="move"};return document.addEventListener("dragover",e),function(){document.removeEventListener("dragover",e)}}),[]),!f)return null;var $=I&&n("div",{className:"st-header-resize-handle",onMouseDown:function(e){var n;q({callback:Q,callbackProps:{event:e.nativeEvent,forceUpdate:R,header:f,gridColumnEnd:c,gridColumnStart:s,setIsWidthDragging:W,startWidth:"object"==typeof t&&null!==t&&"current"in t?null===(n=t.current)||void 0===n?void 0:n.offsetWidth:void 0},limit:10})}}),G=w&&w.key.accessor===f.accessor&&e("div",g({className:"st-sort-icon-container",onClick:function(e){return Y({event:e,header:f})}},{children:["ascending"===w.direction&&A&&A,"descending"===w.direction&&F&&F]}));return e("div",g({className:j,id:M({accessor:f.accessor,rowIndex:0}),onDragOver:function(e){q({callback:X,callbackProps:{event:e,hoveredHeader:f},limit:50})},ref:t,style:g(g({gridRowStart:h,gridRowEnd:u,gridColumnStart:s,gridColumnEnd:c},c-s>1?{}:{width:f.width}),u-h>1?{}:{height:H})},{children:[v&&$,e("div",g({className:"st-header-label ".concat("right"===f.align?"right-aligned":"center"===f.align?"center-aligned":""),draggable:C&&!f.disableReorder,onClick:function(e){return Y({event:e,header:f})},onDragEnd:function(e){e.preventDefault(),K(),d()},onDragStart:function(e){C&&f&&function(e){V(e)}(f)}},{children:["right"===f.align&&G,null==f?void 0:f.label,"right"!==f.align&&G]})),!v&&$]}))})),ee=function(e){var r=e.columnIndices,t=e.gridTemplateColumns,o=e.handleScroll,i=e.headersRef,a=e.hiddenColumns,d=e.maxDepth,c=e.pinned,s=e.sectionRef,u=e.sort,h=f((function(e){return e+1}),0)[1],m=l((function(){var e=[],n=1,t=function(o,i,l){var s,u;if(void 0===l&&(l=!1),!S({hiddenColumns:a,header:o,pinned:c}))return 0;l||n++;var h=null!==(u=null===(s=o.children)||void 0===s?void 0:s.filter((function(e){return S({hiddenColumns:a,header:e,pinned:c})})).length)&&void 0!==u?u:0,f=n,v=h>0?f+h:f+1,g=i,m=h>0?i+1:d+1;if(e.push({header:o,gridColumnStart:f,gridColumnEnd:v,gridRowStart:g,gridRowEnd:m,colIndex:r[o.accessor]}),o.children){var w=!0;o.children.forEach((function(e){S({hiddenColumns:a,header:e,pinned:c})&&(t(e,i+1,w),w=!1)}))}return v-f},o=i.current.filter((function(e){return S({hiddenColumns:a,header:e,pinned:c})})),l=!0;return o.forEach((function(e){t(e,1,l),l=!1})),e}),[i,a,d,c,r]);return n("div",g({className:"st-header-".concat(c?"pinned-".concat(c):"main")},o&&{onScroll:o},{ref:s,style:{gridTemplateColumns:t,display:"grid",position:"relative"}},{children:n(j,g({rowIndex:0},{children:m.map((function(e){return n(Z,{colIndex:e.colIndex,forceHeadersUpdate:h,gridColumnEnd:e.gridColumnEnd,gridColumnStart:e.gridColumnStart,gridRowEnd:e.gridRowEnd,gridRowStart:e.gridRowStart,header:e.header,ref:v(),reverse:"right"===c,sort:u},e.header.accessor)}))}))}))},ne=function(e){var n;return(null===(n=e.children)||void 0===n?void 0:n.length)?1+Math.max.apply(Math,e.children.map(ne)):1},re=function(r){var t=r.centerHeaderRef,o=r.headerContainerRef,i=r.headersRef,a=r.hiddenColumns,d=r.mainTemplateColumns,c=r.pinnedLeftColumns,s=r.pinnedLeftHeaderRef,u=r.pinnedLeftTemplateColumns,h=r.pinnedRightColumns,f=r.pinnedRightHeaderRef,v=r.pinnedRightTemplateColumns,m=r.sort,w=z().mainBodyRef;_(w,t);var p=l((function(){return $({headersRef:i,hiddenColumns:a,pinnedLeftColumns:c,pinnedRightColumns:h})}),[i,a,c,h]),C=l((function(){var e=i.current,n=0;return e.forEach((function(e){if(S({hiddenColumns:a,header:e})){var r=ne(e);n=Math.max(n,r)}})),{maxDepth:n}}),[i,a]).maxDepth;return e("div",g({className:"st-header-container",ref:o},{children:[c.length>0&&n(ee,{columnIndices:p,gridTemplateColumns:u,handleScroll:void 0,headersRef:i,hiddenColumns:a,maxDepth:C,pinned:"left",sectionRef:s,sort:m}),n(ee,{columnIndices:p,gridTemplateColumns:d,handleScroll:function(e){var n,r,o=null===(n=t.current)||void 0===n?void 0:n.scrollLeft;void 0!==o&&(null===(r=w.current)||void 0===r||r.scrollTo(o,0))},headersRef:i,hiddenColumns:a,maxDepth:C,sectionRef:t,sort:m}),h.length>0&&n(ee,{columnIndices:p,gridTemplateColumns:v,handleScroll:void 0,headersRef:i,hiddenColumns:a,maxDepth:C,pinned:"right",sectionRef:f,sort:m})]}))},te=function(e){var n=e.headers,r=e.hiddenColumns,t=function(e){var n=e.headers,o=e.flattenedHeaders;return n.forEach((function(e){!0!==r[e.accessor]&&(e.children?t({headers:e.children,flattenedHeaders:o}):o.push(e))})),o},o=t({headers:n,flattenedHeaders:[]});return"".concat(o.map((function(e){return function(e){var n=e.minWidth,r=e.width;return"number"==typeof r&&(r="".concat(r,"px")),n&&"number"==typeof n&&(n="".concat(n,"px")),void 0!==n?"string"==typeof r&&r.endsWith("fr")?"minmax(".concat(n,", ").concat(r,")"):"max(".concat(n,", ").concat(r,")"):r}(e)})).join(" "))},oe=function(r){var t=r.flattenedRows,i=r.isWidthDragging,a=r.setFlattenedRows,d=r.setScrollTop,c=r.sort,s=r.visibleRows,u=z(),h=u.editColumns,f=u.headersRef,v=u.hiddenColumns,m=o(null),w=o(null),p=o(null),C=o(null),I=f.current.filter((function(e){return!e.pinned})),x=f.current.filter((function(e){return"left"===e.pinned})),R=f.current.filter((function(e){return"right"===e.pinned})),b=l((function(){return te({headers:x,hiddenColumns:v})}),[x,v]),y=l((function(){return te({headers:I,hiddenColumns:v})}),[I,v]),M=l((function(){return te({headers:R,hiddenColumns:v})}),[R,v]),S={centerHeaderRef:p,flattenedRows:t,headerContainerRef:m,isWidthDragging:i,mainTemplateColumns:y,pinnedLeftColumns:x,pinnedLeftHeaderRef:w,pinnedLeftTemplateColumns:b,pinnedRightColumns:R,pinnedRightHeaderRef:C,pinnedRightTemplateColumns:M,setFlattenedRows:a,setScrollTop:d,visibleRows:s};return e("div",g({className:"st-content",style:{width:h?"calc(100% - 27.5px)":"100%"}},{children:[n(re,g({},{centerHeaderRef:p,headerContainerRef:m,headersRef:f,hiddenColumns:v,mainTemplateColumns:y,pinnedLeftColumns:x,pinnedLeftHeaderRef:w,pinnedLeftTemplateColumns:b,pinnedRightColumns:R,pinnedRightHeaderRef:C,pinnedRightTemplateColumns:M,sort:c})),n(G,g({},S))]}))},ie=function(e){var n=e.callback,r=e.ref,t=e.widthAttribute;a((function(){var e=r.current;if(e){var o=function(){n(e[t]||0)};o();var i=new ResizeObserver((function(){o()}));return i.observe(e),function(){return i.disconnect()}}}),[n,r,t])},ae=function(r){var i,a,l,d=r.mainBodyRef,c=r.pinnedLeftRef,s=r.pinnedRightRef,u=r.tableContentWidth,h=t(0),f=h[0],v=h[1],m=t(0),w=m[0],p=m[1],C=o(null);if(ie({widthAttribute:"offsetWidth",callback:v,ref:c}),ie({widthAttribute:"offsetWidth",callback:p,ref:s}),_(d,C),!d.current||d.current.scrollWidth<=d.current.clientWidth)return null;var I=null===(i=d.current)||void 0===i?void 0:i.scrollWidth;return e("div",g({className:"st-horizontal-scrollbar-container",style:{width:u}},{children:[f>0&&n("div",{className:"st-horizontal-scrollbar-left",style:{flexShrink:0,width:f,height:null===(a=C.current)||void 0===a?void 0:a.offsetHeight}}),I>0&&n("div",g({className:"st-horizontal-scrollbar-middle",onScroll:function(e){var n=e.target.scrollLeft;void 0!==n&&d.current&&d.current.scrollTo({left:n,behavior:"auto"})},ref:C},{children:n("div",{style:{width:I,height:".3px"}})})),w>0&&n("div",{className:"st-horizontal-scrollbar-right",style:{flexShrink:0,minWidth:w,height:null===(l=C.current)||void 0===l?void 0:l.offsetHeight}})]}))},le={string:function(e,n,r){if(e===n)return 0;var t=e.localeCompare(n);return"ascending"===r?t:-t},number:function(e,n,r){if(e===n)return 0;var t=e-n;return"ascending"===r?t:-t},boolean:function(e,n,r){if(e===n)return 0;var t=e===n?0:e?-1:1;return"ascending"===r?t:-t},date:function(e,n,r){var t=new Date(e),o=new Date(n);if(t.getTime()===o.getTime())return 0;var i=t.getTime()-o.getTime();return"ascending"===r?i:-i},enum:function(e,n,r){return le.string(e,n,r)},default:function(e,n,r){return e===n?0:null==e?"ascending"===r?-1:1:null==n?"ascending"===r?1:-1:"string"==typeof e&&"string"==typeof n?le.string(e,n,r):"number"==typeof e&&"number"==typeof n?le.number(e,n,r):"boolean"==typeof e&&"boolean"==typeof n?le.boolean(e,n,r):le.string(String(e),String(n),r)}},de=function(e,n,r,t){if(void 0===r&&(r="string"),null==e||""===e)return"ascending"===t?-1:1;if(null==n||""===n)return"ascending"===t?1:-1;if("number"===r){var o=function(e){var n;if("number"==typeof e)return e;var r=String(e);if("string"==typeof r){var t=r.replace(/[$,]/g,"").match(/^([-+]?\d*\.?\d+)([TBMKtbmk])?/);if(t){var o=parseFloat(t[1]),i=null===(n=t[2])||void 0===n?void 0:n.toUpperCase();return"T"===i?o*=1e12:"B"===i?o*=1e9:"M"===i?o*=1e6:"K"===i&&(o*=1e3),o}}return parseFloat(r)||0},i=o(e),a=o(n);return le.number(i,a,t)}return"date"===r?le.date(String(e),String(n),t):"boolean"===r?le.boolean(Boolean(e),Boolean(n),t):"enum"===r?le.enum(String(e),String(n),t):le.string(String(e),String(n),t)},ce=function(e,n,r){var t=r.find((function(e){return e.accessor===n.key.accessor})),o=(null==t?void 0:t.type)||"string",i=n.direction,a=new Map,l=new Map,d="";e.forEach((function(e){var r;if(e.rowData&&!e.rowData[n.key.accessor]&&void 0!==e.rowMeta.isExpanded){var t=(e.rowData.sector||"group_".concat(a.size)).toString();d=t,l.set(d,e),a.has(d)||a.set(d,[])}else if(d){var o=a.get(d)||[];o.push(e),a.set(d,o)}else{var i="default";a.has(i)||a.set(i,[]),null===(r=a.get(i))||void 0===r||r.push(e)}}));var c=[];return a.forEach((function(e,t){if(l.has(t)){var a=l.get(t);a.rowMeta.children&&a.rowMeta.children.length>0&&(a.rowMeta.children=se(a.rowMeta.children,n,r)),c.push(a)}var d=m([],e,!0).sort((function(e,r){if(!(null==e?void 0:e.rowData)||!(null==r?void 0:r.rowData))return 0;var t=n.key.accessor,a=e.rowData[t],l=r.rowData[t];return de(a,l,o,i)}));c.push.apply(c,d.map((function(e){var t=g({},e);if(t.rowMeta.children&&t.rowMeta.children.length>0){var o=se(t.rowMeta.children,n,r);t.rowMeta=g(g({},t.rowMeta),{children:o})}return t})))})),c},se=function(e,n,r){var t=r.find((function(e){return e.accessor===n.key.accessor})),o=(null==t?void 0:t.type)||"string",i=n.direction;return m([],e,!0).sort((function(e,r){if(!(null==e?void 0:e.rowData)||!(null==r?void 0:r.rowData))return 0;var t=n.key.accessor,a=e.rowData[t],l=r.rowData[t];return de(a,l,o,i)})).map((function(e){return e.rowMeta.children&&e.rowMeta.children.length>0?g(g({},e),{rowMeta:g(g({},e.rowMeta),{children:se(e.rowMeta.children,n,r)})}):e}))},ue=function(e){var n=e.headers,r=e.tableRows,o=t(null),i=o[0],a=o[1],d=l((function(){var e={};return n.forEach((function(n){!0===n.hide&&(e[n.accessor]=!0)})),e}),[n]),c=t(d),s=c[0],u=c[1],h=l((function(){if(!i)return r;var e=function(e,n,r){return{sortedData:ce(n,r,e),newSortConfig:r}}(n,r,i).sortedData;return e}),[r,i,n]);return{sort:i,setSort:a,updateSort:function(e,r){var t=function(e){for(var n=0,o=e;n<o.length;n++){var i=o[n];if(i.accessor===r)return i;if(i.children&&i.children.length>0){var a=t(i.children);if(a)return a}}},o=t(n);o&&a((function(e){return e&&e.key.accessor===r?"ascending"===e.direction?{key:o,direction:"descending"}:null:{key:o,direction:"ascending"}}))},sortedRows:h,hiddenColumns:s,setHiddenColumns:u}},he=function(r){var o=r.checked,i=void 0!==o&&o,a=r.children,l=r.onChange,d=t(i),c=d[0],s=d[1];return e("label",g({className:"st-checkbox-label"},{children:[n("input",{checked:c,className:"st-checkbox-input",onChange:function(){var e=!c;s(e),l&&l(e)},type:"checkbox"}),n("span",g({className:"st-checkbox-custom ".concat(c?"st-checked":"")},{children:c&&n("span",{className:"st-checkbox-checkmark"})})),a]}))},fe=function(e){var r=e.headers,t=e.open,o=e.position;e.setOpen;var i=e.setHiddenColumns,a=e.hiddenColumns,l="left"===o?"left":"";return n("div",g({className:"st-column-editor-popout ".concat(t?"open":""," ").concat(l),onClick:function(e){return e.stopPropagation()}},{children:n("div",g({className:"st-column-editor-popout-content"},{children:r.map((function(e,r){return n(he,g({checked:a[e.accessor],onChange:function(n){var r;return i(g(g({},a),((r={})[e.accessor]=n,r)))}},{children:e.label}),r)}))}))}))},ve=function(r){var o=r.columnEditorText,i=r.editColumns,a=r.editColumnsInitOpen,l=r.headers,d=r.position,c=void 0===d?"right":d,s=r.setHiddenColumns,u=r.hiddenColumns,h=t(a),f=h[0],v=h[1];return i?e("div",g({className:"st-column-editor ".concat(f?"open":""," ").concat(c),onClick:function(){return function(e){v(e)}(!f)}},{children:[n("div",g({className:"st-column-editor-text"},{children:o})),n(fe,{headers:l,open:f,position:c,setOpen:v,setHiddenColumns:s,hiddenColumns:u})]})):null},ge=function(r){var d=r.allowAnimations,c=void 0!==d&&d,s=r.cellUpdateFlash,h=void 0!==s&&s,v=r.collapseIcon,m=void 0===v?n(R,{className:"st-sort-icon"}):v,b=r.columnEditorPosition,y=void 0===b?"right":b,M=r.columnEditorText,S=void 0===M?"Columns":M,D=r.columnReordering,H=void 0!==D&&D,k=r.columnResizing,N=void 0!==k&&k,T=r.defaultHeaders,L=r.editColumns,W=void 0!==L&&L,O=r.editColumnsInitOpen,B=void 0!==O&&O,P=r.expandIcon,F=void 0===P?n(I,{className:"st-sort-icon"}):P,z=r.height,U=r.hideFooter,j=void 0!==U&&U,J=r.nextIcon,V=void 0===J?n(I,{className:"st-next-prev-icon"}):J,K=r.onCellEdit,X=r.onColumnOrderChange,q=r.onNextPage,Y=r.onPreviousPage,$=r.prevIcon,G=void 0===$?n(C,{className:"st-next-prev-icon"}):$,_=r.rowHeight,Q=void 0===_?40:_,Z=r.rows,ee=r.rowsPerPage,ne=void 0===ee?10:ee,re=r.selectableCells,te=void 0!==re&&re,ie=r.selectableColumns,le=void 0!==ie&&ie,de=r.shouldPaginate,ce=void 0!==de&&de,se=r.sortDownIcon,he=void 0===se?n(R,{className:"st-sort-icon"}):se,fe=r.sortUpIcon,ge=void 0===fe?n(x,{className:"st-sort-icon"}):fe,me=r.tableRef,we=r.theme,pe=void 0===we?"light":we,Ce=r.totalPages,Ie=o(null),xe=o(T),Re=o(null),be=o(null),ye=o(null),Me=o(null),Se=o(null),Ee=t(!1),De=Ee[0],He=Ee[1],ke=t(1),Ne=ke[0],Te=ke[1],Le=t(0),We=Le[0],Oe=Le[1],Be=t(0),Pe=Be[0],Fe=Be[1],Ae=t(0),ze=Ae[0],Ue=Ae[1],je=ue({headers:xe.current,tableRows:Z}),Je=je.sort,Ve=je.sortedRows,Ke=je.hiddenColumns,Xe=je.setHiddenColumns,qe=je.updateSort,Ye=l((function(){if(!ce)return Ve;var e=(Ne-1)*ne,n=e+ne;return Ve.slice(e,n)}),[Ne,ne,ce,Ve]),$e=t(Ye),Ge=$e[0],_e=$e[1];a((function(){_e(Ye)}),[Ye]);var Qe=l((function(){var e;if(!z)return window.innerHeight-Q;var n=document.querySelector(".simple-table-root"),r=0;if(z.endsWith("px"))r=parseInt(z,10);else if(z.endsWith("vh")){var t=parseInt(z,10);r=window.innerHeight*t/100}else if(z.endsWith("%")){var o=parseInt(z,10);r=((null===(e=null==n?void 0:n.parentElement)||void 0===e?void 0:e.clientHeight)||window.innerHeight)*o/100}else r=window.innerHeight;return Math.max(0,r-Q)}),[z,Q]),Ze=l((function(){return function(e){var n=e.bufferRowCount,r=e.contentHeight,t=e.flattenedRows,o=e.rowHeight,i=e.scrollTop,a=[],l=0,d=Math.max(0,i-o*n),c=i+r+o*n,s=function(e,n){for(var r,t=0,i=e;t<i.length;t++){var u=i[t],h=l*o;if(h>=c)break;h+o>d&&a.push({row:u,depth:n,position:l,isLastGroupRow:Boolean(null===(r=u.rowMeta.children)||void 0===r?void 0:r.length)&&n>1}),l+=1,u.rowMeta.isExpanded&&u.rowMeta.children&&s(u.rowMeta.children,n+1)}};return s(t,0),a}({bufferRowCount:5,contentHeight:Qe,flattenedRows:Ge,rowHeight:Q,scrollTop:ze})}),[Qe,Q,Ge,ze]),en=f((function(e){return e+1}),0)[1],nn=function(e){var n=e.selectableCells,r=e.headers,d=e.visibleRows,c=t(new Set),s=c[0],u=c[1],h=t(new Set),f=h[0],v=h[1],g=t(null),m=g[0],p=g[1],C=t(null),I=C[0],x=C[1],R=o(!1),b=o(null),y=i((function(){var e=Array.from(s).reduce((function(e,n){var t=n.split("-").map(Number),o=t[0],i=t[1];return e[o]||(e[o]=[]),e[o][i]=d[o].row.rowData[r[i].accessor],e}),{}),n=Object.values(e).map((function(e){return Object.values(e).join("\t")})).join("\n");s.size>0&&navigator.clipboard.writeText(n)}),[r,s,d]),M=i((function(e,n){for(var r=new Set,t=Math.min(e.rowIndex,n.rowIndex),o=Math.max(e.rowIndex,n.rowIndex),i=Math.min(e.colIndex,n.colIndex),a=Math.max(e.colIndex,n.colIndex),l=t;l<=o;l++)for(var c=i;c<=a;c++)if(l>=0&&l<d.length){var s=d[l].row.rowMeta.rowId;r.add(w({colIndex:c,rowIndex:l,rowId:s}))}v(new Set),p(null),u(r)}),[d,v,p,u]),S=i((function(e){if(e.rowIndex>=0&&e.rowIndex<d.length&&e.colIndex>=0&&e.colIndex<r.length){var n=w(e);v(new Set),p(null),u(new Set([n])),x(e)}}),[r.length,d.length,v,p,u,x]),E=i((function(e,n){void 0===n&&(n=!1),u(new Set),x(null),v((function(r){var t=new Set(n?r:[]);return e.forEach((function(e){return t.add(e)})),t})),e.length>0&&p(e[e.length-1])}),[u,x,v,p]);a((function(){var e=function(e){if(n&&I){var t=I.rowIndex,o=I.colIndex,i=I.rowId;if(!e.ctrlKey&&!e.metaKey||"c"!==e.key){if(d[t].row.rowMeta.rowId!==i){var a=d.findIndex((function(e){return e.row.rowMeta.rowId===i}));if(-1===a)return;t=a}if("ArrowUp"===e.key){if(e.preventDefault(),t>0){var l={rowIndex:t-1,colIndex:o,rowId:d[t-1].row.rowMeta.rowId};S(l)}}else"ArrowDown"===e.key?(e.preventDefault(),t<d.length-1&&(l={rowIndex:t+1,colIndex:o,rowId:d[t+1].row.rowMeta.rowId},S(l))):"ArrowLeft"===e.key||"Tab"===e.key&&e.shiftKey?(e.preventDefault(),o>0&&(l={rowIndex:t,colIndex:o-1,rowId:d[t].row.rowMeta.rowId},S(l))):"ArrowRight"===e.key||"Tab"===e.key?(e.preventDefault(),o<r.length-1&&(l={rowIndex:t,colIndex:o+1,rowId:d[t].row.rowMeta.rowId},S(l))):"Escape"===e.key&&(u(new Set),v(new Set),p(null),b.current=null,x(null))}else y()}};return document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[y,r.length,I,M,S,n,d]);var D=i((function(e){var n=e.colIndex,r=e.rowIndex,t=e.rowId,o=w({colIndex:n,rowIndex:r,rowId:t}),i=s.has(o),a=f.has(n);return i||a}),[s,f]),H=i((function(e){var n,r,t,o,i,a,l=e.colIndex,c=e.rowIndex,s=e.rowId,u=[],h=null===(t=null===(r=null===(n=d[c-1])||void 0===n?void 0:n.row)||void 0===r?void 0:r.rowMeta)||void 0===t?void 0:t.rowId,v={colIndex:l,rowIndex:c+1,rowId:null===(a=null===(i=null===(o=d[c+1])||void 0===o?void 0:o.row)||void 0===i?void 0:i.rowMeta)||void 0===a?void 0:a.rowId},g={colIndex:l-1,rowIndex:c,rowId:s},m={colIndex:l+1,rowIndex:c,rowId:s};return(!D({colIndex:l,rowIndex:c-1,rowId:h})||f.has(l)&&0===c)&&u.push("st-selected-top-border"),(!D(v)||f.has(l)&&c===d.length-1)&&u.push("st-selected-bottom-border"),D(g)||u.push("st-selected-left-border"),D(m)||u.push("st-selected-right-border"),u.join(" ")}),[D,d,f]),k=l((function(){return I?function(e){var n=e.rowIndex,r=e.colIndex,t=e.rowId;return n===I.rowIndex&&r===I.colIndex&&t===I.rowId}:function(){return!1}}),[I]);return{getBorderClass:H,handleMouseDown:function(e){var r=e.colIndex,t=e.rowIndex,o=e.rowId;if(n){R.current=!0,b.current={rowIndex:t,colIndex:r,rowId:o},v(new Set),p(null);var i=w({colIndex:r,rowIndex:t,rowId:o});u(new Set([i])),x({rowIndex:t,colIndex:r,rowId:o})}},handleMouseOver:function(e){var r=e.colIndex,t=e.rowIndex;if(e.rowId,n&&R.current&&b.current){for(var o=new Set,i=Math.min(b.current.rowIndex,t),a=Math.max(b.current.rowIndex,t),l=Math.min(b.current.colIndex,r),c=Math.max(b.current.colIndex,r),s=i;s<=a;s++)for(var h=l;h<=c;h++)if(s>=0&&s<d.length){var f=d[s].row.rowMeta.rowId;o.add(w({colIndex:h,rowIndex:s,rowId:f}))}u(o)}},handleMouseUp:function(){R.current=!1},isInitialFocusedCell:k,isSelected:D,lastSelectedColumnIndex:m,selectColumns:E,selectedCells:s,selectedColumns:f,setInitialFocusedCell:x,setSelectedCells:u,setSelectedColumns:v}}({selectableCells:te,headers:xe.current,visibleRows:Ze}),rn=nn.handleMouseDown,tn=nn.handleMouseOver,on=nn.handleMouseUp,an=nn.isSelected,ln=nn.getBorderClass,dn=nn.isInitialFocusedCell,cn=nn.setSelectedCells,sn=nn.setSelectedColumns,un=nn.selectColumns,hn=nn.setInitialFocusedCell,fn=i((function(e,n){qe(e,n)}),[qe]),vn=i((function(e){xe.current=e,en()}),[]);a((function(){var e=function(e){var n=e.target;n.closest(".st-cell")||le&&(n.classList.contains("st-header-cell")||n.classList.contains("st-header-label"))||(cn(new Set),le&&sn(new Set))};return document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}}),[le,cn,sn]),u((function(){if(Se.current){var e=Se.current.offsetWidth-Se.current.clientWidth,n=Se.current.clientWidth;Oe(e),Fe(n)}}),[]),u((function(){var e=function(){if(en(),Se.current){var e=Se.current.offsetWidth-Se.current.clientWidth,n=Se.current.clientWidth;Oe(e),Fe(n)}};return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}),[]);var gn=o(new Map);return a((function(){me&&(me.current={updateData:function(e){var n,r,t,o,i=e.accessor,a=e.rowIndex,l=e.newValue,d=null===(r=null===(n=null==Z?void 0:Z[a])||void 0===n?void 0:n.rowMeta)||void 0===r?void 0:r.rowId;if(void 0!==d){var c=E({rowId:d,accessor:i}),s=gn.current.get(c);s&&s.updateContent(l),void 0!==(null===(o=null===(t=null==Z?void 0:Z[a])||void 0===t?void 0:t.rowData)||void 0===o?void 0:o[i])&&(Z[a].rowData[i]=l)}}})}),[me,Z]),n(A,g({value:{allowAnimations:c,cellUpdateFlash:h,collapseIcon:m,columnReordering:H,columnResizing:N,draggedHeaderRef:Ie,editColumns:W,expandIcon:F,forceUpdate:en,getBorderClass:ln,handleMouseDown:rn,handleMouseOver:tn,headersRef:xe,hiddenColumns:Ke,hoveredHeaderRef:Re,isInitialFocusedCell:dn,isSelected:an,mainBodyRef:be,onCellEdit:K,onColumnOrderChange:X,onSort:fn,onTableHeaderDragEnd:vn,pinnedLeftRef:ye,pinnedRightRef:Me,rowHeight:Q,scrollbarWidth:We,selectColumns:un,selectableColumns:le,setInitialFocusedCell:hn,setIsWidthDragging:He,setSelectedCells:cn,setSelectedColumns:sn,shouldPaginate:ce,sortDownIcon:he,sortUpIcon:ge,tableBodyContainerRef:Se,cellRegistry:gn.current}},{children:e("div",g({className:"simple-table-root st-wrapper theme-".concat(pe),style:z?{height:z}:{}},{children:[e("div",g({className:"st-wrapper-container"},{children:[e("div",g({className:"st-content-wrapper",onMouseUp:on,onMouseLeave:on},{children:[n(oe,{flattenedRows:Ge,isWidthDragging:De,setFlattenedRows:_e,setScrollTop:Ue,sort:Je,visibleRows:Ze}),n(ve,{columnEditorText:S,editColumns:W,editColumnsInitOpen:B,headers:xe.current,hiddenColumns:Ke,position:y,setHiddenColumns:Xe})]})),n(ae,{mainBodyRef:be,pinnedLeftRef:ye,pinnedRightRef:Me,tableContentWidth:Pe})]})),n(p,{currentPage:Ne,hideFooter:j,nextIcon:V,onPageChange:Te,onNextPage:q,onPreviousPage:Y,prevIcon:G,shouldPaginate:ce,totalPages:Ce||Math.ceil(Ve.length/ne)})]}))}))};export{ge as SimpleTable};
2
2
  //# sourceMappingURL=index.es.js.map
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("react"),r=function(){return r=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var o in n=arguments[r])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},r.apply(this,arguments)};function t(e,n,r){if(r||2===arguments.length)for(var t,o=0,i=n.length;o<i;o++)!t&&o in n||(t||(t=Array.prototype.slice.call(n,0,o)),t[o]=n[o]);return e.concat(t||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var o=function(e){var n=e.rowIndex,r=e.colIndex,t=e.rowId;return"".concat(n,"-").concat(r,"-").concat(t)},i=function(n){var t=n.currentPage,o=n.hideFooter,i=n.nextIcon,a=n.onPageChange,l=n.onNextPage,s=n.onPreviousPage,d=n.prevIcon,c=n.shouldPaginate,u=n.totalPages;if(o||!c)return null;var f=!(t>1)&&!s,h=!(t<u)&&!l;return e.jsxs("div",r({className:"st-footer"},{children:[e.jsx("button",r({className:"st-next-prev-btn ".concat(f?"disabled":""),onClick:function(){var e=t-1;e>=1&&a(e),s&&s(e-1)},disabled:f},{children:d})),e.jsx("button",r({className:"st-next-prev-btn ".concat(h?"disabled":""),onClick:function(){var e=t+1;(e<=u||l)&&a(e),l&&l(t)},disabled:h},{children:i})),Array.from({length:u},(function(n,o){return e.jsx("button",r({onClick:function(){var e;(e=o+1)>=1&&e<=u&&(a(e),e>t&&l?l(e-1):e<t&&s&&s(e-1))},className:"st-page-btn ".concat(t===o+1?"active":"")},{children:o+1}),o)}))]}))},a=function(n){var t=n.className;return e.jsx("svg",r({className:t,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})}))},l=function(n){var t=n.className;return e.jsx("svg",r({className:t,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{d:"M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z"})}))},s=function(n){var t=n.className;return e.jsx("svg",r({className:t,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{d:"M5.41 11.41L10 6.83l4.59 4.58L16 10l-6-6-6 6z"})}))},d=function(n){var t=n.className;return e.jsx("svg",r({className:t,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{d:"M5.41 7.59L10 12.17l4.59-4.58L16 9l-6 6-6-6z"})}))},c=function(e){return e.position*(e.rowHeight+1)-1},u=function(e){return e.position*(e.rowHeight+1)},f=function(e){var n=e.accessor,r=e.rowIndex;return"cell-".concat(n,"-").concat(r)},h=function(e){var n=e.hiddenColumns,r=e.header,t=e.pinned;return n[r.accessor]?null:!t&&!r.pinned||r.pinned===t||null},v=function(e){var n=e.rowId,r=e.accessor;return"".concat(n,"-").concat(r)},g=function(n){var t=n.value,o=n.onBlur,i=n.onChange;return e.jsxs("select",r({value:t.toString(),onBlur:o,onChange:function(e){var n=e.target.value;i("true"===n)}},{children:[e.jsx("option",r({value:"true"},{children:"True"})),e.jsx("option",r({value:"false"},{children:"False"}))]}))},m=function(r){var t=r.defaultValue,o=r.onBlur,i=r.onChange,a=n.useRef(null);return e.jsx("input",{className:"editable-cell-input",ref:a,autoFocus:!0,type:"text",defaultValue:null!=t?t:"",onBlur:o,onChange:function(e){var n=e.target.value;i(n)}})},w=function(r){var t=r.defaultValue,o=r.onBlur,i=r.onChange,a=n.useRef(null);return e.jsx("input",{className:"editable-cell-input",ref:a,autoFocus:!0,defaultValue:t.toString(),onBlur:o,onChange:function(e){var n=e.target.value;/^\d*\.?\d*$/.test(n)&&i(n)}})},p=function(n){var r=n.onChange,t=n.setIsEditing,o=n.value,i=function(e){null==r||r(e)},a=function(){t(!1)};return e.jsx(e.Fragment,{children:"string"==typeof o||null==o?e.jsx(m,{defaultValue:o,onBlur:a,onChange:i}):"boolean"==typeof o?e.jsx(g,{onBlur:a,onChange:i,value:o}):"number"==typeof o?e.jsx(w,{defaultValue:o,onBlur:a,onChange:i}):null})},x=0,C=function(){return function(e){var n=e.callback,r=e.callbackProps,t=e.limit,o=Date.now();(0===x||o-x>=t)&&(x=o,n(r))}},I=Date.now(),R={screenX:0,screenY:0},b=function(e,n,r){void 0===r&&(r=[]);for(var o=0;o<e.length;o++){var i=e[o];if(i.accessor===n)return t(t([],r,!0),[o],!1);if(i.children&&i.children.length>0){var a=b(i.children,n,t(t([],r,!0),[o],!1));if(a)return a}}return null};var y=function(e){var r,t,o=e.draggedHeaderRef,i=e.headersRef,a=e.hoveredHeaderRef,l=e.onColumnOrderChange,s=e.onTableHeaderDragEnd,d=(r=i.current,t=n.useRef(r),n.useEffect((function(){JSON.stringify(t.current)!==JSON.stringify(r)&&(t.current=r)}),[r]),t.current);return{handleDragStart:function(e){o.current=e,I=Date.now()},handleDragOver:function(e){var n,r,t=e.event,l=e.hoveredHeader;if(t.preventDefault(),i.current){var c=t.currentTarget.getAnimations().some((function(e){return"running"===e.playState})),u=t.screenX,f=t.screenY,h=Math.sqrt(Math.pow(u-R.screenX,2)+Math.pow(f-R.screenY,2));a.current=l;var v=i.current,g=b(v,(null===(n=o.current)||void 0===n?void 0:n.accessor)||""),m=b(v,l.accessor);if(g&&m){var w=g.length,p=m.length,x=m;if(w!==p){var C=p-w;C>0&&(x=m.slice(0,-C))}var y=function(e,n,r){var t=JSON.parse(JSON.stringify(e)),o=!1;function i(e,n){for(var r=e,t=0;t<n.length-1;t++)r=r[n[t]].children;return r[n[n.length-1]]}function a(e,n,r){for(var t=e,i=0;i<n.length-1;i++){if(!t[n[i]].children){o=!0;break}t=t[n[i]].children}t[n[n.length-1]]=r}var l=i(t,n);return a(t,n,i(t,r)),a(t,r,l),{newHeaders:t,emergencyBreak:o}}(v,g,x),M=y.newHeaders,S=y.emergencyBreak;if(!(c||l.accessor===(null===(r=o.current)||void 0===r?void 0:r.accessor)||null===o.current||h<10||0===g.length||0===x.length||JSON.stringify(M)===JSON.stringify(i.current)||S)){var E=Date.now();JSON.stringify(M)===JSON.stringify(d)&&(E-I<1500||h<40)||(I=E,R={screenX:u,screenY:f},s(M))}}}},handleDragEnd:function(){o.current=null,a.current=null,null==l||l(i.current)}}},M=n.createContext(void 0),S=function(n){var t=n.children,o=n.value;return e.jsx(M.Provider,r({value:o},{children:t}))},E=function(){var e=n.useContext(M);if(void 0===e)throw new Error("useTableContext must be used within a TableProvider");return e},j=n.forwardRef((function(t,o){var i,a,l=t.borderClass,s=t.colIndex,d=t.header,c=t.isHighlighted,u=t.isInitialFocused,h=t.onExpandRowClick,g=t.rowIndex,m=t.visibleRow,w=E(),x=w.cellRegistry,I=w.cellUpdateFlash,R=w.collapseIcon,b=w.draggedHeaderRef,M=w.expandIcon,S=w.handleMouseDown,j=w.handleMouseOver,k=w.headersRef,D=w.hoveredHeaderRef,H=w.onCellEdit,N=w.onTableHeaderDragEnd,T=m.depth,L=m.row,O=n.useState(L.rowData[d.accessor]),W=O[0],B=O[1],P=n.useState(!1),F=P[0],A=P[1],z=n.useState(!1),U=z[0],J=z[1],V=n.useRef(null),q=y({draggedHeaderRef:b,headersRef:k,hoveredHeaderRef:D,onTableHeaderDragEnd:N}).handleDragOver,K=C(),X="cell-".concat(g,"-").concat(s),Y=v({rowId:L.rowMeta.rowId,accessor:d.accessor});n.useEffect((function(){if(x){var e="".concat(L.rowMeta.rowId,"-").concat(d.accessor);return x.set(e,{updateContent:function(e){W!==e?(B(e),I&&(J(!0),V.current&&clearTimeout(V.current),V.current=setTimeout((function(){J(!1)}),800))):B(e)}}),function(){x.delete(e),V.current&&clearTimeout(V.current)}}}),[x,I,L.rowMeta.rowId,d.accessor,W]),n.useEffect((function(){if(U){var e=setTimeout((function(){J(!1)}),850);return function(){return clearTimeout(e)}}}),[U]),n.useEffect((function(){B(L.rowData[d.accessor])}),[L.rowData,d.accessor]);var _=Boolean(null===(a=null===(i=L.rowMeta)||void 0===i?void 0:i.children)||void 0===a?void 0:a.length),$=Boolean(null==d?void 0:d.isEditable),G=m.position%2==0,Q="st-cell ".concat(T>0&&d.expandable?"st-cell-depth-".concat(T):""," ").concat(c?u?"st-cell-selected-first ".concat(l):"st-cell-selected ".concat(l):""," ").concat(G?"st-cell-odd-row":"st-cell-even-row"," ").concat($?"clickable":""," ").concat(U?"st-cell-updating":""),Z=n.useCallback((function(e){B(e),null==H||H({accessor:d.accessor,newValue:e,row:L})}),[d.accessor,H,L]);return F?e.jsx("div",r({className:"st-cell-editing ".concat(G?"st-cell-odd-row":"st-cell-even-row"),id:f({accessor:d.accessor,rowIndex:g+1})},{children:e.jsx(p,{onChange:Z,setIsEditing:A,value:W})})):e.jsxs("div",r({className:Q,id:X,onDoubleClick:function(){return d.isEditable&&A(!0)},onMouseDown:function(){return S({rowIndex:g,colIndex:s,rowId:L.rowMeta.rowId})},onMouseOver:function(){return j({rowIndex:g,colIndex:s,rowId:L.rowMeta.rowId})},onDragOver:function(e){return K({callback:q,callbackProps:{event:e,hoveredHeader:d},limit:50})},onKeyDown:function(e){"F2"!==e.key&&"Enter"!==e.key||!d.isEditable||F||(e.preventDefault(),A(!0))},ref:o,"data-row-index":g,"data-col-index":s,"data-row-id":L.rowMeta.rowId,"data-accessor":d.accessor},{children:[d.expandable&&_?L.rowMeta.isExpanded?e.jsx("div",r({className:"st-sort-icon-container",onClick:function(){return h(L.rowMeta.rowId)},onMouseDown:function(e){e.stopPropagation()}},{children:R})):e.jsx("div",r({className:"st-sort-icon-container",onClick:function(){return h(L.rowMeta.rowId)},onMouseDown:function(e){e.stopPropagation()}},{children:M})):null,e.jsx("span",r({className:"st-cell-content ".concat("right"===d.align?"right-aligned":"center"===d.align?"center-aligned":"")},{children:d.cellRenderer?d.cellRenderer({accessor:d.accessor,colIndex:s,row:L}):W}))]}),Y)})),k=function(n){var t=n.children,o=function(e,n){var r={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(r[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(t=Object.getOwnPropertySymbols(e);o<t.length;o++)n.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(e,t[o])&&(r[t[o]]=e[t[o]])}return r}(n,["children"]);return E().allowAnimations?e.jsx(D,r({},o,{children:t})):e.jsx(e.Fragment,{children:t})},D=function(r){var t=r.children,o=r.isBody,i=r.pauseAnimation,a=r.rowIndex,l=n.useRef(!1),s=E(),d=s.draggedHeaderRef,c=s.headersRef,u=s.mainBodyRef,h=s.shouldPaginate,v=n.useState({}),g=v[0],m=v[1],w=n.useRef({}),p=c.current;return n.useLayoutEffect((function(){if(p){var e=function(e){var n=e.currentHeaders,r=e.draggedHeaderRef,t=e.rowIndex,o={};return n.forEach((function(e){var n;if(e){var i=document.getElementById(f({accessor:e.accessor,rowIndex:t}));if(i){var a=i.getAnimations().some((function(e){return"running"===e.playState})),l=i.getBoundingClientRect();a&&(null===(n=null==r?void 0:r.current)||void 0===n?void 0:n.accessor)!==e.accessor?o[e.accessor]=!1:o[e.accessor]=l}}})),o}({currentHeaders:p,draggedHeaderRef:d,rowIndex:a});JSON.stringify(e)!==JSON.stringify(g)&&(w.current=g,m(e))}}),[g,p,d,o,a]),n.useLayoutEffect((function(){var e=u.current,n=function(){l.current=!0},r=function(){l.current=!1};return null==e||e.addEventListener("scroll",n),null==e||e.addEventListener("scrollend",r),function(){null==e||e.removeEventListener("scroll",n),null==e||e.removeEventListener("scrollend",r)}}),[d,u]),n.useEffect((function(){i||l.current||Object.keys(w.current).length&&p&&p.forEach((function(e){var n=document.getElementById(f({accessor:e.accessor,rowIndex:a}));if(n){var r=w.current[e.accessor],t=g[e.accessor];if(r&&t){var o=r.left-t.left,i=h?0:r.top-t.top,l=Math.abs(o),s=Math.abs(i);(l>10||s>10)&&requestAnimationFrame((function(){n.style.transform="translate(".concat(o,"px, ").concat(i,"px)"),n.style.transition="transform 0s",requestAnimationFrame((function(){n.style.transform="",n.style.transition="transform ".concat(400,"ms ease-out")}))}))}}}))}),[g,p,o,i,w,a,h]),e.jsx(e.Fragment,{children:t})},H=function(n){var t=n.columnIndices,o=n.headers,i=n.hiddenColumns,a=n.isWidthDragging,l=n.onExpandRowClick,s=n.pinned,d=n.rowIndex,c=n.rowIndices,u=n.visibleRow,v=o.filter((function(e){return h({hiddenColumns:i,header:e,pinned:s})}));return e.jsx(k,r({isBody:!0,pauseAnimation:a,rowIndex:d+1},{children:v.map((function(n){return e.jsx(N,{columnIndices:t,header:n,headers:o,hiddenColumns:i,onExpandRowClick:l,pinned:s,rowIndex:d,rowIndices:c,visibleRow:u},f({accessor:n.accessor,rowIndex:d+1}))}))}))},N=function(r){var t=r.columnIndices,o=r.header,i=r.headers,a=r.hiddenColumns,l=r.onExpandRowClick,s=r.pinned,d=r.rowIndex,c=r.rowIndices,u=r.visibleRow,v=t[o.accessor],g=E(),m=g.getBorderClass,w=g.isSelected,p=g.isInitialFocusedCell;if(o.children){var x=o.children.filter((function(e){return h({hiddenColumns:a,header:e,pinned:s})}));return e.jsx(n.Fragment,{children:x.map((function(n){return e.jsx(N,{columnIndices:t,header:n,headers:i,hiddenColumns:a,onExpandRowClick:l,pinned:s,rowIndex:d,rowIndices:c,visibleRow:u},f({accessor:n.accessor,rowIndex:d+1}))}))})}var C={rowIndex:d,colIndex:v,rowId:u.row.rowMeta.rowId},I=m(C),R=w(C),b=p(C);return e.jsx(j,{borderClass:I,colIndex:v,header:o,isHighlighted:R,isInitialFocused:b,onExpandRowClick:l,rowIndex:d,visibleRow:u},f({accessor:o.accessor,rowIndex:d+1}))},T=function(n){var t=n.columnIndices,o=n.gridTemplateColumns,i=n.headers,a=n.hiddenColumns,l=n.index,s=n.isWidthDragging,d=n.onExpandRowClick,c=n.pinned,f=n.rowHeight,h=n.rowIndices,v=n.visibleRow,g=v.position,m=l;return e.jsx("div",r({className:"st-table-row",style:{gridTemplateColumns:o,top:u({position:g,rowHeight:f}),height:"".concat(f,"px")}},{children:e.jsx(H,{columnIndices:t,headers:i,hiddenColumns:a,isWidthDragging:s,onExpandRowClick:d,pinned:c,rowIndex:m,rowIndices:h,visibleRow:v},l)}))},L=function(n){var t=n.displayStrongBorder,o=n.position,i=n.rowHeight,a=n.templateColumns;return e.jsx("div",r({className:"st-row-separator ".concat(t?"st-last-group-row":""),style:{display:"grid",gridTemplateColumns:a,position:"absolute",top:c({position:o,rowHeight:i}),minWidth:"100%"}},{children:e.jsx("div",{style:{gridColumn:"1 / -1"}})}))},O=function(t){var o=t.columnIndices;t.headerContainerRef;var i=t.headers,a=t.hiddenColumns,l=t.isWidthDragging,s=t.onExpandRowClick,d=t.pinned,c=t.rowHeight,u=t.rowIndices,f=t.sectionRef,h=t.templateColumns,v=t.totalHeight,g=t.visibleRows,m=t.width,w=d?"st-table-body-pinned-".concat(d):"st-table-body-main";return e.jsx("div",r({className:w,ref:f,style:{position:"relative",height:"".concat(v,"px"),width:m}},{children:g.map((function(r,t){var f,v,m,w,p=Boolean(null===(v=null===(f=r.row.rowMeta)||void 0===f?void 0:f.children)||void 0===v?void 0:v.length),x=null===(w=null===(m=g[t-1])||void 0===m?void 0:m.row.rowMeta)||void 0===w?void 0:w.isExpanded;return e.jsxs(n.Fragment,{children:[e.jsx(T,{columnIndices:o,gridTemplateColumns:h,headers:i,hiddenColumns:a,index:t,isWidthDragging:l,onExpandRowClick:s,pinned:d,rowHeight:c,rowIndices:u,visibleRow:r}),0!==t&&e.jsx(L,{displayStrongBorder:p&&x,position:r.position,rowHeight:c,templateColumns:h})]},t)}))}))};function W(e){var n=e.headersRef,r=e.hiddenColumns,t=e.pinnedLeftColumns,o=e.pinnedRightColumns,i={},a=0,l=function(e,n){void 0===n&&(n=!1),n||a++,i[e.accessor]=a,e.children&&e.children.length>0&&e.children.filter((function(e){return h({hiddenColumns:r,header:e})})).forEach((function(e,n){l(e,0===n)}))};return t.forEach((function(e,n){l(e,0===n)})),n.current.filter((function(e){return!e.pinned&&h({hiddenColumns:r,header:e})})).forEach((function(e,n){var r=0===n&&0===t.length;l(e,r)})),o.forEach((function(e){l(e,!1)})),i}var B=function(t){var o,i,a,l,s,d=t.centerHeaderRef,c=t.flattenedRows,u=t.headerContainerRef,f=t.isWidthDragging,h=t.mainTemplateColumns,v=t.pinnedLeftColumns,g=t.pinnedLeftHeaderRef,m=t.pinnedLeftTemplateColumns,w=t.pinnedRightColumns,p=t.pinnedRightHeaderRef,x=t.pinnedRightTemplateColumns,C=t.setFlattenedRows,I=t.setScrollTop,R=t.visibleRows,b=E(),y=b.rowHeight,M=b.scrollbarWidth,S=b.mainBodyRef,j=b.pinnedLeftRef,k=b.pinnedRightRef,D=b.tableBodyContainerRef,H=b.hiddenColumns,N=b.headersRef;!function(e){var r=e.headerContainerRef,t=e.mainSectionRef,o=e.scrollbarWidth,i=n.useState(!1),a=i[0],l=i[1];n.useEffect((function(){var e=null==r?void 0:r.current;if(a&&e)return e.classList.add("st-header-scroll-padding"),e.style.setProperty("--st-after-width","".concat(o,"px")),function(){e.classList.remove("st-header-scroll-padding")}}),[r,a,o]),n.useEffect((function(){var e=null==r?void 0:r.current,n=null==t?void 0:t.current;if(n&&e){var o=function(){if(n){var e=n.scrollHeight>n.clientHeight;l(e)}};o();var i=new ResizeObserver((function(){o()}));return i.observe(n),function(){n&&i.unobserve(n)}}}),[r,t])}({headerContainerRef:u,mainSectionRef:D,scrollbarWidth:M});var T,L,B=n.useRef(null),P=(T=0,(L=function(e){e.forEach((function(e){T+=1,e.rowMeta.isExpanded&&e.rowMeta.children&&L(e.rowMeta.children)}))})(c),T)*(y+1)-1,F=n.useMemo((function(){return W({headersRef:N,hiddenColumns:H,pinnedLeftColumns:v,pinnedRightColumns:w})}),[N,H,v,w]),A=n.useMemo((function(){var e={};return R.forEach((function(n,r){var t=String(n.row.rowMeta.rowId);e[t]=r})),e}),[R]),z=function(e){var n=function(t){return t.rowMeta.rowId===e&&t.rowMeta.children?r(r({},t),{rowMeta:r(r({},t.rowMeta),{isExpanded:!t.rowMeta.isExpanded})}):t.rowMeta.children?r(r({},t),{rowMeta:r(r({},t.rowMeta),{children:t.rowMeta.children.map(n)})}):t};C((function(e){return e.map(n)}))},U=(null===(o=g.current)||void 0===o?void 0:o.clientWidth)?(null===(i=g.current)||void 0===i?void 0:i.clientWidth)+1:0,J=null===(a=d.current)||void 0===a?void 0:a.clientWidth,V=(null===(l=p.current)||void 0===l?void 0:l.clientWidth)?(null===(s=p.current)||void 0===s?void 0:s.clientWidth)+1:0,q={headerContainerRef:u,headers:N.current,hiddenColumns:H,isWidthDragging:f,rowHeight:y,visibleRows:R,columnIndices:F,rowIndices:A};return e.jsxs("div",r({className:"st-table-body-container",ref:D,onScroll:function(e){var n=e.currentTarget.scrollTop;B.current&&cancelAnimationFrame(B.current),B.current=requestAnimationFrame((function(){I(n)}))}},{children:[v.length>0&&e.jsx(O,r({},q,{onExpandRowClick:z,pinned:"left",sectionRef:j,templateColumns:m,totalHeight:P,width:U})),e.jsx(O,r({},q,{onExpandRowClick:z,sectionRef:S,templateColumns:h,totalHeight:P,width:J})),w.length>0&&e.jsx(O,r({},q,{onExpandRowClick:z,pinned:"right",sectionRef:k,templateColumns:x,totalHeight:P,width:V}))]}))},P=function(e,r){n.useEffect((function(){if(e.current){var n=e.current,t=function(){var e,t=null==n?void 0:n.scrollLeft;void 0!==t&&(null===(e=r.current)||void 0===e||e.scrollTo(t,0))};return n.addEventListener("scroll",t),function(){null==n||n.removeEventListener("scroll",t)}}}),[e,r])},F={string:function(e,n,r){if(e===n)return 0;var t=e.localeCompare(n);return"ascending"===r?t:-t},number:function(e,n,r){if(e===n)return 0;var t=e-n;return"ascending"===r?t:-t},boolean:function(e,n,r){if(e===n)return 0;var t=e===n?0:e?-1:1;return"ascending"===r?t:-t},date:function(e,n,r){var t=new Date(e),o=new Date(n);if(t.getTime()===o.getTime())return 0;var i=t.getTime()-o.getTime();return"ascending"===r?i:-i},enum:function(e,n,r){return F.string(e,n,r)},default:function(e,n,r){return e===n?0:null==e?"ascending"===r?-1:1:null==n?"ascending"===r?1:-1:"string"==typeof e&&"string"==typeof n?F.string(e,n,r):"number"==typeof e&&"number"==typeof n?F.number(e,n,r):"boolean"==typeof e&&"boolean"==typeof n?F.boolean(e,n,r):F.string(String(e),String(n),r)}},A=function(e,n,r,t){if(void 0===r&&(r="string"),null==e||""===e)return"ascending"===t?-1:1;if(null==n||""===n)return"ascending"===t?1:-1;if("number"===r){var o=function(e){var n;if("number"==typeof e)return e;var r=String(e);if("string"==typeof r){var t=r.replace(/[$,]/g,"").match(/^([-+]?\d*\.?\d+)([TBMKtbmk])?/);if(t){var o=parseFloat(t[1]),i=null===(n=t[2])||void 0===n?void 0:n.toUpperCase();return"T"===i?o*=1e12:"B"===i?o*=1e9:"M"===i?o*=1e6:"K"===i&&(o*=1e3),o}}return parseFloat(r)||0},i=o(e),a=o(n);return F.number(i,a,t)}return"date"===r?F.date(String(e),String(n),t):"boolean"===r?F.boolean(Boolean(e),Boolean(n),t):"enum"===r?F.enum(String(e),String(n),t):F.string(String(e),String(n),t)},z=function(e,n,o){var i=o.find((function(e){return e.accessor===n.key.accessor})),a=(null==i?void 0:i.type)||"string",l=n.direction,s=new Map,d=new Map,c="";e.forEach((function(e){var r;if(e.rowData&&!e.rowData[n.key.accessor]&&void 0!==e.rowMeta.isExpanded){var t=(e.rowData.sector||"group_".concat(s.size)).toString();c=t,d.set(c,e),s.has(c)||s.set(c,[])}else if(c){var o=s.get(c)||[];o.push(e),s.set(c,o)}else{var i="default";s.has(i)||s.set(i,[]),null===(r=s.get(i))||void 0===r||r.push(e)}}));var u=[];return s.forEach((function(e,i){if(d.has(i)){var s=d.get(i);s.rowMeta.children&&s.rowMeta.children.length>0&&(s.rowMeta.children=U(s.rowMeta.children,n,o)),u.push(s)}var c=t([],e,!0).sort((function(e,r){if(!(null==e?void 0:e.rowData)||!(null==r?void 0:r.rowData))return 0;var t=n.key.accessor,o=e.rowData[t],i=r.rowData[t];return A(o,i,a,l)}));u.push.apply(u,c.map((function(e){var t=r({},e);if(t.rowMeta.children&&t.rowMeta.children.length>0){var i=U(t.rowMeta.children,n,o);t.rowMeta=r(r({},t.rowMeta),{children:i})}return t})))})),u},U=function(e,n,o){var i=o.find((function(e){return e.accessor===n.key.accessor})),a=(null==i?void 0:i.type)||"string",l=n.direction;return t([],e,!0).sort((function(e,r){if(!(null==e?void 0:e.rowData)||!(null==r?void 0:r.rowData))return 0;var t=n.key.accessor,o=e.rowData[t],i=r.rowData[t];return A(o,i,a,l)})).map((function(e){return e.rowMeta.children&&e.rowMeta.children.length>0?r(r({},e),{rowMeta:r(r({},e.rowMeta),{children:U(e.rowMeta.children,n,o)})}):e}))},J=function(e){e.colIndex;var n=e.event,r=e.forceUpdate,t=e.header;e.headersRef;var o=e.gridColumnEnd,i=e.gridColumnStart,a=e.setIsWidthDragging,l=e.startWidth;a(!0),n.preventDefault();var s=n.clientX;if(t){var d="number"==typeof t.minWidth?t.minWidth:40,c=function(e){return e.children&&0!==e.children.length?e.children.flatMap((function(e){return c(e)})):[e]},u=o-i>1,f=u?c(t):[t],h=f.map((function(e){return"number"==typeof e.width?e.width:parseInt(String(e.width),10)||150})).reduce((function(e,n){return e+n}),0),v=function(e){var n=e.clientX-s;if(u&&f.length>1){for(var o=Math.max(h+n,f.length*d),i=Math.max(Math.floor(o/f.length),d),a=0;a<f.length-1;a++)f[a].width=i;var c=i*(f.length-1),v=Math.max(o-c,d);f[f.length-1].width=v}else{var g=Math.max(l+n,d);t.width=g}r()},g=function(){document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",g),a(!1)};document.addEventListener("mousemove",v),document.addEventListener("mouseup",g)}},V=n.forwardRef((function(o,i){var a,l,s=o.colIndex,d=o.forceHeadersUpdate,c=o.gridColumnEnd,u=o.gridColumnStart,h=o.gridRowEnd,v=o.gridRowStart,g=o.header,m=o.reverse,w=o.sort,p=E(),x=p.columnReordering,I=p.columnResizing,R=p.draggedHeaderRef,b=p.forceUpdate,M=p.headersRef,S=p.hoveredHeaderRef,j=p.onColumnOrderChange,k=p.onSort,D=p.onTableHeaderDragEnd,H=p.rowHeight,N=p.selectColumns,T=p.selectableColumns,L=p.setInitialFocusedCell,O=p.setIsWidthDragging,W=p.setSelectedCells,B=p.setSelectedColumns,P=p.sortDownIcon,F=p.sortUpIcon,A=Boolean(null==g?void 0:g.isSortable),z="st-header-cell ".concat(g.accessor===(null===(a=S.current)||void 0===a?void 0:a.accessor)?"st-hovered":""," ").concat((null===(l=R.current)||void 0===l?void 0:l.accessor)===g.accessor?"st-dragging":""," ").concat(A?"clickable":""," ").concat(x&&!A?"columnReordering":""," ").concat("right"===(null==g?void 0:g.align)?"right-aligned":"center"===(null==g?void 0:g.align)?"center-aligned":""),U=y({draggedHeaderRef:R,headersRef:M,hoveredHeaderRef:S,onColumnOrderChange:j,onTableHeaderDragEnd:D}),V=U.handleDragStart,q=U.handleDragEnd,K=U.handleDragOver,X=C(),Y=function(e){var n=e.event,r=e.header;if(T){var o=function(e,n){if(!e.children||0===e.children.length)return[n];var r=[],t=function(e,n){if(!e.children||0===e.children.length)return r.push(n),n+1;for(var o=n,i=0,a=e.children;i<a.length;i++){var l=a[i];o=t(l,o)}return o};return t(e,n),r}(r,s);return n.shiftKey&&N?B((function(e){if(0===e.size)return new Set(o);var n=o[0],r=Array.from(e).sort((function(e,n){return e-n})),i=r[0],a=Math.abs(n-i);r.forEach((function(e){var r=Math.abs(n-e);r<a&&(a=r,i=e)}));var l,s,d,c,u=t(t([],(l=i,s=n,d=Math.min(l,s),c=Math.max(l,s),Array.from({length:c-d+1},(function(e,n){return d+n}))),!0),o,!0);return new Set(t(t([],Array.from(e),!0),u,!0))})):N&&N(o),W(new Set),void L(null)}r.isSortable&&k(s,r.accessor)};if(n.useEffect((function(){var e=function(e){e.preventDefault(),e.dataTransfer.dropEffect="move"};return document.addEventListener("dragover",e),function(){document.removeEventListener("dragover",e)}}),[]),!g)return null;var _=I&&e.jsx("div",{className:"st-header-resize-handle",onMouseDown:function(e){var n;X({callback:J,callbackProps:{colIndex:s,event:e,forceUpdate:b,header:g,headersRef:M,gridColumnEnd:c,gridColumnStart:u,setIsWidthDragging:O,startWidth:"object"==typeof i&&null!==i&&"current"in i?null===(n=i.current)||void 0===n?void 0:n.offsetWidth:void 0},limit:10})}}),$=w&&w.key.accessor===g.accessor&&e.jsxs("div",r({className:"st-sort-icon-container",onClick:function(e){return Y({event:e,header:g})}},{children:["ascending"===w.direction&&F&&F,"descending"===w.direction&&P&&P]}));return e.jsxs("div",r({className:z,id:f({accessor:g.accessor,rowIndex:0}),onDragOver:function(e){X({callback:K,callbackProps:{event:e,hoveredHeader:g},limit:50})},ref:i,style:r(r({gridRowStart:v,gridRowEnd:h,gridColumnStart:u,gridColumnEnd:c},c-u>1?{}:{width:g.width}),h-v>1?{}:{height:H})},{children:[m&&_,e.jsxs("div",r({className:"st-header-label ".concat("right"===g.align?"right-aligned":"center"===g.align?"center-aligned":""),draggable:x&&!g.disableReorder,onClick:function(e){return Y({event:e,header:g})},onDragEnd:function(e){e.preventDefault(),q(),d()},onDragStart:function(e){x&&g&&function(e){V(e)}(g)}},{children:["right"===g.align&&$,null==g?void 0:g.label,"right"!==g.align&&$]})),!m&&_]}))})),q=function(t){var o=t.columnIndices,i=t.gridTemplateColumns,a=t.handleScroll,l=t.headersRef,s=t.hiddenColumns,d=t.maxDepth,c=t.pinned,u=t.sectionRef,f=t.sort,v=n.useReducer((function(e){return e+1}),0)[1],g=n.useMemo((function(){var e=[],n=1,r=function(t,i,a){var l,u;if(void 0===a&&(a=!1),!h({hiddenColumns:s,header:t,pinned:c}))return 0;a||n++;var f=null!==(u=null===(l=t.children)||void 0===l?void 0:l.filter((function(e){return h({hiddenColumns:s,header:e,pinned:c})})).length)&&void 0!==u?u:0,v=n,g=f>0?v+f:v+1,m=i,w=f>0?i+1:d+1;if(e.push({header:t,gridColumnStart:v,gridColumnEnd:g,gridRowStart:m,gridRowEnd:w,colIndex:o[t.accessor]}),t.children){var p=!0;t.children.forEach((function(e){h({hiddenColumns:s,header:e,pinned:c})&&(r(e,i+1,p),p=!1)}))}return g-v},t=l.current.filter((function(e){return h({hiddenColumns:s,header:e,pinned:c})})),i=!0;return t.forEach((function(e){r(e,1,i),i=!1})),e}),[l,s,d,c,o]);return e.jsx("div",r({className:"st-header-".concat(c?"pinned-".concat(c):"main")},a&&{onScroll:a},{ref:u,style:{gridTemplateColumns:i,display:"grid",position:"relative"}},{children:e.jsx(k,r({rowIndex:0},{children:g.map((function(r){return e.jsx(V,{colIndex:r.colIndex,forceHeadersUpdate:v,gridColumnEnd:r.gridColumnEnd,gridColumnStart:r.gridColumnStart,gridRowEnd:r.gridRowEnd,gridRowStart:r.gridRowStart,header:r.header,ref:n.createRef(),reverse:"right"===c,sort:f},r.header.accessor)}))}))}))},K=function(e){var n;return(null===(n=e.children)||void 0===n?void 0:n.length)?1+Math.max.apply(Math,e.children.map(K)):1},X=function(t){var o=t.centerHeaderRef,i=t.headerContainerRef,a=t.headersRef,l=t.hiddenColumns,s=t.mainTemplateColumns,d=t.pinnedLeftColumns,c=t.pinnedLeftHeaderRef,u=t.pinnedLeftTemplateColumns,f=t.pinnedRightColumns,v=t.pinnedRightHeaderRef,g=t.pinnedRightTemplateColumns,m=t.sort,w=E().mainBodyRef;P(w,o);var p=n.useMemo((function(){return W({headersRef:a,hiddenColumns:l,pinnedLeftColumns:d,pinnedRightColumns:f})}),[a,l,d,f]),x=n.useMemo((function(){var e=a.current,n=0;return e.forEach((function(e){if(h({hiddenColumns:l,header:e})){var r=K(e);n=Math.max(n,r)}})),{maxDepth:n}}),[a,l]).maxDepth;return e.jsxs("div",r({className:"st-header-container",ref:i},{children:[d.length>0&&e.jsx(q,{columnIndices:p,gridTemplateColumns:u,handleScroll:void 0,headersRef:a,hiddenColumns:l,maxDepth:x,pinned:"left",sectionRef:c,sort:m}),e.jsx(q,{columnIndices:p,gridTemplateColumns:s,handleScroll:function(e){var n,r,t=null===(n=o.current)||void 0===n?void 0:n.scrollLeft;void 0!==t&&(null===(r=w.current)||void 0===r||r.scrollTo(t,0))},headersRef:a,hiddenColumns:l,maxDepth:x,sectionRef:o,sort:m}),f.length>0&&e.jsx(q,{columnIndices:p,gridTemplateColumns:g,handleScroll:void 0,headersRef:a,hiddenColumns:l,maxDepth:x,pinned:"right",sectionRef:v,sort:m})]}))},Y=function(e){var n=e.headers,r=e.hiddenColumns,t=function(e){var n=e.headers,o=e.flattenedHeaders;return n.forEach((function(e){!0!==r[e.accessor]&&(e.children?t({headers:e.children,flattenedHeaders:o}):o.push(e))})),o},o=t({headers:n,flattenedHeaders:[]});return"".concat(o.map((function(e){return function(e){var n=e.minWidth,r=e.width;return"number"==typeof r&&(r="".concat(r,"px")),n&&"number"==typeof n&&(n="".concat(n,"px")),void 0!==n?"minmax(".concat(n,", ").concat(r,")"):r}(e)})).join(" "))},_=function(t){var o=t.flattenedRows,i=t.isWidthDragging,a=t.setFlattenedRows,l=t.setScrollTop,s=t.sort,d=t.visibleRows,c=E(),u=c.editColumns,f=c.headersRef,h=c.hiddenColumns,v=n.useRef(null),g=n.useRef(null),m=n.useRef(null),w=n.useRef(null),p=f.current.filter((function(e){return!e.pinned})),x=f.current.filter((function(e){return"left"===e.pinned})),C=f.current.filter((function(e){return"right"===e.pinned})),I=n.useMemo((function(){return Y({headers:x,hiddenColumns:h})}),[x,h]),R=n.useMemo((function(){return Y({headers:p,hiddenColumns:h})}),[p,h]),b=n.useMemo((function(){return Y({headers:C,hiddenColumns:h})}),[C,h]),y={centerHeaderRef:m,headerContainerRef:v,headersRef:f,hiddenColumns:h,mainTemplateColumns:R,pinnedLeftColumns:x,pinnedLeftHeaderRef:g,pinnedLeftTemplateColumns:I,pinnedRightColumns:C,pinnedRightHeaderRef:w,pinnedRightTemplateColumns:b,sort:s},M={centerHeaderRef:m,flattenedRows:o,headerContainerRef:v,isWidthDragging:i,mainTemplateColumns:R,pinnedLeftColumns:x,pinnedLeftHeaderRef:g,pinnedLeftTemplateColumns:I,pinnedRightColumns:C,pinnedRightHeaderRef:w,pinnedRightTemplateColumns:b,setFlattenedRows:a,setScrollTop:l,visibleRows:d};return e.jsxs("div",r({className:"st-table-content",style:{width:u?"calc(100% - 27.5px)":"100%"}},{children:[e.jsx(X,r({},y)),e.jsx(B,r({},M))]}))},$=function(e){var r=e.callback,t=e.ref,o=e.widthAttribute;n.useEffect((function(){var e=t.current;if(e){var n=function(){r(e[o]||0)};n();var i=new ResizeObserver((function(){n()}));return i.observe(e),function(){return i.disconnect()}}}),[r,t,o])},G=function(t){var o,i,a=t.mainBodyRef,l=t.pinnedLeftRef,s=t.pinnedRightRef,d=t.tableContentWidth,c=n.useState(0),u=c[0],f=c[1],h=n.useState(0),v=h[0],g=h[1],m=n.useState(0),w=m[0],p=m[1],x=n.useRef(null);return $({widthAttribute:"offsetWidth",callback:f,ref:l}),$({widthAttribute:"scrollWidth",callback:p,ref:a}),$({widthAttribute:"offsetWidth",callback:g,ref:s}),P(a,x),!a.current||a.current.scrollWidth<=a.current.clientWidth?null:e.jsxs("div",r({className:"st-horizontal-scrollbar-container",style:{width:d}},{children:[u>0&&e.jsx("div",{className:"st-horizontal-scrollbar-left",style:{flexShrink:0,width:u,height:null===(o=x.current)||void 0===o?void 0:o.offsetHeight}}),w>0&&e.jsx("div",r({className:"st-horizontal-scrollbar-middle",onScroll:function(e){var n=e.target.scrollLeft;void 0!==n&&a.current&&a.current.scrollTo({left:n,behavior:"auto"})},ref:x},{children:e.jsx("div",{style:{width:w,height:".3px"}})})),v>0&&e.jsx("div",{className:"st-horizontal-scrollbar-right",style:{flexShrink:0,minWidth:v,height:null===(i=x.current)||void 0===i?void 0:i.offsetHeight}})]}))},Q=function(e){var r=e.headers,t=e.tableRows,o=n.useState(null),i=o[0],a=o[1],l=n.useMemo((function(){var e={};return r.forEach((function(n){!0===n.hide&&(e[n.accessor]=!0)})),e}),[r]),s=n.useState(l),d=s[0],c=s[1],u=n.useMemo((function(){if(!i)return t;var e=function(e,n,r){return{sortedData:z(n,r,e),newSortConfig:r}}(r,t,i).sortedData;return e}),[t,i,r]);return{sort:i,setSort:a,updateSort:function(e,n){var t=function(e){for(var r=0,o=e;r<o.length;r++){var i=o[r];if(i.accessor===n)return i;if(i.children&&i.children.length>0){var a=t(i.children);if(a)return a}}},o=t(r);o&&a((function(e){return e&&e.key.accessor===n?"ascending"===e.direction?{key:o,direction:"descending"}:null:{key:o,direction:"ascending"}}))},sortedRows:u,hiddenColumns:d,setHiddenColumns:c}},Z=function(t){var o=t.checked,i=void 0!==o&&o,a=t.children,l=t.onChange,s=n.useState(i),d=s[0],c=s[1];return e.jsxs("label",r({className:"st-checkbox-label"},{children:[e.jsx("input",{checked:d,className:"st-checkbox-input",onChange:function(){var e=!d;c(e),l&&l(e)},type:"checkbox"}),e.jsx("span",r({className:"st-checkbox-custom ".concat(d?"st-checked":"")},{children:d&&e.jsx("span",{className:"st-checkbox-checkmark"})})),a]}))},ee=function(n){var t=n.headers,o=n.open,i=n.position;n.setOpen;var a=n.setHiddenColumns,l=n.hiddenColumns,s="left"===i?"left":"";return e.jsx("div",r({className:"st-column-editor-popout ".concat(o?"open":""," ").concat(s),onClick:function(e){return e.stopPropagation()}},{children:e.jsx("div",r({className:"st-column-editor-popout-content"},{children:t.map((function(n,t){return e.jsx(Z,r({checked:l[n.accessor],onChange:function(e){var t;return a(r(r({},l),((t={})[n.accessor]=e,t)))}},{children:n.label}),t)}))}))}))},ne=function(t){var o=t.columnEditorText,i=t.editColumns,a=t.editColumnsInitOpen,l=t.headers,s=t.position,d=void 0===s?"right":s,c=t.setHiddenColumns,u=t.hiddenColumns,f=n.useState(a),h=f[0],v=f[1];return i?e.jsxs("div",r({className:"st-column-editor ".concat(h?"open":""," ").concat(d),onClick:function(){return function(e){v(e)}(!h)}},{children:[e.jsx("div",r({className:"st-column-editor-text"},{children:o})),e.jsx(ee,{headers:l,open:h,position:d,setOpen:v,setHiddenColumns:c,hiddenColumns:u})]})):null};exports.SimpleTable=function(t){var c=t.allowAnimations,u=void 0!==c&&c,f=t.cellUpdateFlash,h=void 0!==f&&f,g=t.collapseIcon,m=void 0===g?e.jsx(d,{className:"st-sort-icon"}):g,w=t.columnEditorPosition,p=void 0===w?"right":w,x=t.columnEditorText,C=void 0===x?"Columns":x,I=t.columnReordering,R=void 0!==I&&I,b=t.columnResizing,y=void 0!==b&&b,M=t.defaultHeaders,E=t.editColumns,j=void 0!==E&&E,k=t.editColumnsInitOpen,D=void 0!==k&&k,H=t.expandIcon,N=void 0===H?e.jsx(l,{className:"st-sort-icon"}):H,T=t.height,L=t.hideFooter,O=void 0!==L&&L,W=t.nextIcon,B=void 0===W?e.jsx(l,{className:"st-next-prev-icon"}):W,P=t.onCellEdit,F=t.onColumnOrderChange,A=t.onNextPage,z=t.onPreviousPage,U=t.prevIcon,J=void 0===U?e.jsx(a,{className:"st-next-prev-icon"}):U,V=t.rowHeight,q=void 0===V?40:V,K=t.rows,X=t.rowsPerPage,Y=void 0===X?10:X,$=t.selectableCells,Z=void 0!==$&&$,ee=t.selectableColumns,re=void 0!==ee&&ee,te=t.shouldPaginate,oe=void 0!==te&&te,ie=t.sortDownIcon,ae=void 0===ie?e.jsx(d,{className:"st-sort-icon"}):ie,le=t.sortUpIcon,se=void 0===le?e.jsx(s,{className:"st-sort-icon"}):le,de=t.tableRef,ce=t.theme,ue=void 0===ce?"light":ce,fe=t.totalPages,he=n.useRef(null),ve=n.useRef(M),ge=n.useRef(null),me=n.useRef(null),we=n.useRef(null),pe=n.useRef(null),xe=n.useRef(null),Ce=n.useState(!1),Ie=Ce[0],Re=Ce[1],be=n.useState(1),ye=be[0],Me=be[1],Se=n.useState(0),Ee=Se[0],je=Se[1],ke=n.useState(0),De=ke[0],He=ke[1],Ne=n.useState(0),Te=Ne[0],Le=Ne[1],Oe=Q({headers:ve.current,tableRows:K}),We=Oe.sort,Be=Oe.sortedRows,Pe=Oe.hiddenColumns,Fe=Oe.setHiddenColumns,Ae=Oe.updateSort,ze=n.useMemo((function(){if(!oe)return Be;var e=(ye-1)*Y,n=e+Y;return Be.slice(e,n)}),[ye,Y,oe,Be]),Ue=n.useState(ze),Je=Ue[0],Ve=Ue[1];n.useEffect((function(){Ve(ze)}),[ze]);var qe=n.useMemo((function(){var e;if(!T)return window.innerHeight-q;var n=document.querySelector(".simple-table-root"),r=0;if(T.endsWith("px"))r=parseInt(T,10);else if(T.endsWith("vh")){var t=parseInt(T,10);r=window.innerHeight*t/100}else if(T.endsWith("%")){var o=parseInt(T,10);r=((null===(e=null==n?void 0:n.parentElement)||void 0===e?void 0:e.clientHeight)||window.innerHeight)*o/100}else r=window.innerHeight;return Math.max(0,r-q)}),[T,q]),Ke=n.useMemo((function(){return function(e){var n=e.bufferRowCount,r=e.contentHeight,t=e.flattenedRows,o=e.rowHeight,i=e.scrollTop,a=[],l=0,s=Math.max(0,i-o*n),d=i+r+o*n,c=function(e,n){for(var r,t=0,i=e;t<i.length;t++){var u=i[t],f=l*o;if(f>=d)break;f+o>s&&a.push({row:u,depth:n,position:l,isLastGroupRow:Boolean(null===(r=u.rowMeta.children)||void 0===r?void 0:r.length)&&n>1}),l+=1,u.rowMeta.isExpanded&&u.rowMeta.children&&c(u.rowMeta.children,n+1)}};return c(t,0),a}({bufferRowCount:5,contentHeight:qe,flattenedRows:Je,rowHeight:q,scrollTop:Te})}),[qe,q,Je,Te]),Xe=n.useReducer((function(e){return e+1}),0)[1],Ye=function(e){var r=e.selectableCells,t=e.headers,i=e.visibleRows,a=n.useState(new Set),l=a[0],s=a[1],d=n.useState(new Set),c=d[0],u=d[1],f=n.useState(null),h=f[0],v=f[1],g=n.useState(null),m=g[0],w=g[1],p=n.useRef(!1),x=n.useRef(null),C=n.useCallback((function(){var e=Array.from(l).reduce((function(e,n){var r=n.split("-").map(Number),o=r[0],a=r[1];return e[o]||(e[o]=[]),e[o][a]=i[o].row.rowData[t[a].accessor],e}),{}),n=Object.values(e).map((function(e){return Object.values(e).join("\t")})).join("\n");l.size>0&&navigator.clipboard.writeText(n)}),[t,l,i]),I=n.useCallback((function(e,n){for(var r=new Set,t=Math.min(e.rowIndex,n.rowIndex),a=Math.max(e.rowIndex,n.rowIndex),l=Math.min(e.colIndex,n.colIndex),d=Math.max(e.colIndex,n.colIndex),c=t;c<=a;c++)for(var f=l;f<=d;f++)if(c>=0&&c<i.length){var h=i[c].row.rowMeta.rowId;r.add(o({colIndex:f,rowIndex:c,rowId:h}))}u(new Set),v(null),s(r)}),[i,u,v,s]),R=n.useCallback((function(e){if(e.rowIndex>=0&&e.rowIndex<i.length&&e.colIndex>=0&&e.colIndex<t.length){var n=o(e);u(new Set),v(null),s(new Set([n])),w(e)}}),[t.length,i.length,u,v,s,w]),b=n.useCallback((function(e,n){void 0===n&&(n=!1),s(new Set),w(null),u((function(r){var t=new Set(n?r:[]);return e.forEach((function(e){return t.add(e)})),t})),e.length>0&&v(e[e.length-1])}),[s,w,u,v]);n.useEffect((function(){var e=function(e){if(r&&m){var n=m.rowIndex,o=m.colIndex,a=m.rowId;if(!e.ctrlKey&&!e.metaKey||"c"!==e.key){if(i[n].row.rowMeta.rowId!==a){var l=i.findIndex((function(e){return e.row.rowMeta.rowId===a}));if(-1===l)return;n=l}if("ArrowUp"===e.key){if(e.preventDefault(),n>0){var d={rowIndex:n-1,colIndex:o,rowId:i[n-1].row.rowMeta.rowId};R(d)}}else"ArrowDown"===e.key?(e.preventDefault(),n<i.length-1&&(d={rowIndex:n+1,colIndex:o,rowId:i[n+1].row.rowMeta.rowId},R(d))):"ArrowLeft"===e.key||"Tab"===e.key&&e.shiftKey?(e.preventDefault(),o>0&&(d={rowIndex:n,colIndex:o-1,rowId:i[n].row.rowMeta.rowId},R(d))):"ArrowRight"===e.key||"Tab"===e.key?(e.preventDefault(),o<t.length-1&&(d={rowIndex:n,colIndex:o+1,rowId:i[n].row.rowMeta.rowId},R(d))):"Escape"===e.key&&(s(new Set),u(new Set),v(null),x.current=null,w(null))}else C()}};return document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[C,t.length,m,I,R,r,i]);var y=n.useCallback((function(e){var n=e.colIndex,r=e.rowIndex,t=e.rowId,i=o({colIndex:n,rowIndex:r,rowId:t}),a=l.has(i),s=c.has(n);return a||s}),[l,c]),M=n.useCallback((function(e){var n,r,t,o,a,l,s=e.colIndex,d=e.rowIndex,u=e.rowId,f=[],h=null===(t=null===(r=null===(n=i[d-1])||void 0===n?void 0:n.row)||void 0===r?void 0:r.rowMeta)||void 0===t?void 0:t.rowId,v={colIndex:s,rowIndex:d+1,rowId:null===(l=null===(a=null===(o=i[d+1])||void 0===o?void 0:o.row)||void 0===a?void 0:a.rowMeta)||void 0===l?void 0:l.rowId},g={colIndex:s-1,rowIndex:d,rowId:u},m={colIndex:s+1,rowIndex:d,rowId:u};return(!y({colIndex:s,rowIndex:d-1,rowId:h})||c.has(s)&&0===d)&&f.push("st-selected-top-border"),(!y(v)||c.has(s)&&d===i.length-1)&&f.push("st-selected-bottom-border"),y(g)||f.push("st-selected-left-border"),y(m)||f.push("st-selected-right-border"),f.join(" ")}),[y,i,c]),S=n.useMemo((function(){return m?function(e){var n=e.rowIndex,r=e.colIndex,t=e.rowId;return n===m.rowIndex&&r===m.colIndex&&t===m.rowId}:function(){return!1}}),[m]);return{getBorderClass:M,handleMouseDown:function(e){var n=e.colIndex,t=e.rowIndex,i=e.rowId;if(r){p.current=!0,x.current={rowIndex:t,colIndex:n,rowId:i},u(new Set),v(null);var a=o({colIndex:n,rowIndex:t,rowId:i});s(new Set([a])),w({rowIndex:t,colIndex:n,rowId:i})}},handleMouseOver:function(e){var n=e.colIndex,t=e.rowIndex;if(e.rowId,r&&p.current&&x.current){for(var a=new Set,l=Math.min(x.current.rowIndex,t),d=Math.max(x.current.rowIndex,t),c=Math.min(x.current.colIndex,n),u=Math.max(x.current.colIndex,n),f=l;f<=d;f++)for(var h=c;h<=u;h++)if(f>=0&&f<i.length){var v=i[f].row.rowMeta.rowId;a.add(o({colIndex:h,rowIndex:f,rowId:v}))}s(a)}},handleMouseUp:function(){p.current=!1},isInitialFocusedCell:S,isSelected:y,lastSelectedColumnIndex:h,selectColumns:b,selectedCells:l,selectedColumns:c,setInitialFocusedCell:w,setSelectedCells:s,setSelectedColumns:u}}({selectableCells:Z,headers:ve.current,visibleRows:Ke}),_e=Ye.handleMouseDown,$e=Ye.handleMouseOver,Ge=Ye.handleMouseUp,Qe=Ye.isSelected,Ze=Ye.getBorderClass,en=Ye.isInitialFocusedCell,nn=Ye.setSelectedCells,rn=Ye.setSelectedColumns,tn=Ye.selectColumns,on=Ye.setInitialFocusedCell,an=n.useCallback((function(e,n){Ae(e,n)}),[Ae]),ln=n.useCallback((function(e){ve.current=e,Xe()}),[]);n.useEffect((function(){var e=function(e){var n=e.target;n.closest(".st-cell")||re&&(n.classList.contains("st-header-cell")||n.classList.contains("st-header-label"))||(nn(new Set),re&&rn(new Set))};return document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}}),[re,nn,rn]),n.useLayoutEffect((function(){if(xe.current){var e=xe.current.offsetWidth-xe.current.clientWidth,n=xe.current.clientWidth;je(e),He(n)}}),[]),n.useLayoutEffect((function(){var e=function(){if(Xe(),xe.current){var e=xe.current.offsetWidth-xe.current.clientWidth,n=xe.current.clientWidth;je(e),He(n)}};return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}),[]);var sn=n.useRef(new Map);return n.useEffect((function(){de&&(de.current={updateData:function(e){var n,r,t,o,i=e.accessor,a=e.rowIndex,l=e.newValue,s=null===(r=null===(n=null==K?void 0:K[a])||void 0===n?void 0:n.rowMeta)||void 0===r?void 0:r.rowId;if(void 0!==s){var d=v({rowId:s,accessor:i}),c=sn.current.get(d);c&&c.updateContent(l),void 0!==(null===(o=null===(t=null==K?void 0:K[a])||void 0===t?void 0:t.rowData)||void 0===o?void 0:o[i])&&(K[a].rowData[i]=l)}}})}),[de,K]),e.jsx(S,r({value:{allowAnimations:u,cellUpdateFlash:h,collapseIcon:m,columnReordering:R,columnResizing:y,draggedHeaderRef:he,editColumns:j,expandIcon:N,forceUpdate:Xe,getBorderClass:Ze,handleMouseDown:_e,handleMouseOver:$e,headersRef:ve,hiddenColumns:Pe,hoveredHeaderRef:ge,isInitialFocusedCell:en,isSelected:Qe,mainBodyRef:me,onCellEdit:P,onColumnOrderChange:F,onSort:an,onTableHeaderDragEnd:ln,pinnedLeftRef:we,pinnedRightRef:pe,rowHeight:q,scrollbarWidth:Ee,selectColumns:tn,selectableColumns:re,setInitialFocusedCell:on,setIsWidthDragging:Re,setSelectedCells:nn,setSelectedColumns:rn,shouldPaginate:oe,sortDownIcon:ae,sortUpIcon:se,tableBodyContainerRef:xe,cellRegistry:sn.current}},{children:e.jsxs("div",r({className:"simple-table-root st-wrapper theme-".concat(ue),style:T?{height:T}:{}},{children:[e.jsxs("div",r({className:"st-table-wrapper-container"},{children:[e.jsxs("div",r({className:"st-table-wrapper",onMouseUp:Ge,onMouseLeave:Ge},{children:[e.jsx(_,{flattenedRows:Je,isWidthDragging:Ie,setFlattenedRows:Ve,setScrollTop:Le,sort:We,visibleRows:Ke}),e.jsx(ne,{columnEditorText:C,editColumns:j,editColumnsInitOpen:D,headers:ve.current,hiddenColumns:Pe,position:p,setHiddenColumns:Fe})]})),e.jsx(G,{mainBodyRef:me,pinnedLeftRef:we,pinnedRightRef:pe,tableContentWidth:De})]})),e.jsx(i,{currentPage:ye,hideFooter:O,nextIcon:B,onPageChange:Me,onNextPage:A,onPreviousPage:z,prevIcon:J,shouldPaginate:oe,totalPages:fe||Math.ceil(Be.length/Y)})]}))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("react"),r=function(){return r=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var o in n=arguments[r])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},r.apply(this,arguments)};function t(e,n,r){if(r||2===arguments.length)for(var t,o=0,i=n.length;o<i;o++)!t&&o in n||(t||(t=Array.prototype.slice.call(n,0,o)),t[o]=n[o]);return e.concat(t||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var o=function(e){var n=e.rowIndex,r=e.colIndex,t=e.rowId;return"".concat(n,"-").concat(r,"-").concat(t)},i=function(n){var t=n.currentPage,o=n.hideFooter,i=n.nextIcon,a=n.onPageChange,l=n.onNextPage,d=n.onPreviousPage,s=n.prevIcon,c=n.shouldPaginate,u=n.totalPages;if(o||!c)return null;var f=!(t>1)&&!d,h=!(t<u)&&!l;return e.jsxs("div",r({className:"st-footer"},{children:[e.jsx("button",r({className:"st-next-prev-btn ".concat(f?"disabled":""),onClick:function(){var e=t-1;e>=1&&a(e),d&&d(e-1)},disabled:f},{children:s})),e.jsx("button",r({className:"st-next-prev-btn ".concat(h?"disabled":""),onClick:function(){var e=t+1;(e<=u||l)&&a(e),l&&l(t)},disabled:h},{children:i})),Array.from({length:u},(function(n,o){return e.jsx("button",r({onClick:function(){var e;(e=o+1)>=1&&e<=u&&(a(e),e>t&&l?l(e-1):e<t&&d&&d(e-1))},className:"st-page-btn ".concat(t===o+1?"active":"")},{children:o+1}),o)}))]}))},a=function(n){var t=n.className;return e.jsx("svg",r({className:t,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})}))},l=function(n){var t=n.className;return e.jsx("svg",r({className:t,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{d:"M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z"})}))},d=function(n){var t=n.className;return e.jsx("svg",r({className:t,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{d:"M5.41 11.41L10 6.83l4.59 4.58L16 10l-6-6-6 6z"})}))},s=function(n){var t=n.className;return e.jsx("svg",r({className:t,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{d:"M5.41 7.59L10 12.17l4.59-4.58L16 9l-6 6-6-6z"})}))},c=function(e){return e.position*(e.rowHeight+1)-1},u=function(e){return e.position*(e.rowHeight+1)},f=function(e){var n=e.accessor,r=e.rowIndex;return"cell-".concat(n,"-").concat(r)},h=function(e){var n=e.hiddenColumns,r=e.header,t=e.pinned;return n[r.accessor]?null:!t&&!r.pinned||r.pinned===t||null},v=function(e){var n=e.rowId,r=e.accessor;return"".concat(n,"-").concat(r)},g=function(n){var t=n.value,o=n.onBlur,i=n.onChange;return e.jsxs("select",r({value:t.toString(),onBlur:o,onChange:function(e){var n=e.target.value;i("true"===n)}},{children:[e.jsx("option",r({value:"true"},{children:"True"})),e.jsx("option",r({value:"false"},{children:"False"}))]}))},m=function(r){var t=r.defaultValue,o=r.onBlur,i=r.onChange,a=n.useRef(null);return e.jsx("input",{className:"editable-cell-input",ref:a,autoFocus:!0,type:"text",defaultValue:null!=t?t:"",onBlur:o,onChange:function(e){var n=e.target.value;i(n)}})},w=function(r){var t=r.defaultValue,o=r.onBlur,i=r.onChange,a=n.useRef(null);return e.jsx("input",{className:"editable-cell-input",ref:a,autoFocus:!0,defaultValue:t.toString(),onBlur:o,onChange:function(e){var n=e.target.value;/^\d*\.?\d*$/.test(n)&&i(n)}})},p=function(n){var r=n.onChange,t=n.setIsEditing,o=n.value,i=function(e){null==r||r(e)},a=function(){t(!1)};return e.jsx(e.Fragment,{children:"string"==typeof o||null==o?e.jsx(m,{defaultValue:o,onBlur:a,onChange:i}):"boolean"==typeof o?e.jsx(g,{onBlur:a,onChange:i,value:o}):"number"==typeof o?e.jsx(w,{defaultValue:o,onBlur:a,onChange:i}):null})},x=0,C=function(){return function(e){var n=e.callback,r=e.callbackProps,t=e.limit,o=Date.now();(0===x||o-x>=t)&&(x=o,n(r))}},I=Date.now(),R={screenX:0,screenY:0},b=function(e,n,r){void 0===r&&(r=[]);for(var o=0;o<e.length;o++){var i=e[o];if(i.accessor===n)return t(t([],r,!0),[o],!1);if(i.children&&i.children.length>0){var a=b(i.children,n,t(t([],r,!0),[o],!1));if(a)return a}}return null};var y=function(e){var r,t,o=e.draggedHeaderRef,i=e.headersRef,a=e.hoveredHeaderRef,l=e.onColumnOrderChange,d=e.onTableHeaderDragEnd,s=(r=i.current,t=n.useRef(r),n.useEffect((function(){JSON.stringify(t.current)!==JSON.stringify(r)&&(t.current=r)}),[r]),t.current);return{handleDragStart:function(e){o.current=e,I=Date.now()},handleDragOver:function(e){var n,r,t=e.event,l=e.hoveredHeader;if(t.preventDefault(),i.current){var c=t.currentTarget.getAnimations().some((function(e){return"running"===e.playState})),u=t.screenX,f=t.screenY,h=Math.sqrt(Math.pow(u-R.screenX,2)+Math.pow(f-R.screenY,2));a.current=l;var v=i.current,g=b(v,(null===(n=o.current)||void 0===n?void 0:n.accessor)||""),m=b(v,l.accessor);if(g&&m){var w=g.length,p=m.length,x=m;if(w!==p){var C=p-w;C>0&&(x=m.slice(0,-C))}var y=function(e,n,r){var t=JSON.parse(JSON.stringify(e)),o=!1;function i(e,n){for(var r=e,t=0;t<n.length-1;t++)r=r[n[t]].children;return r[n[n.length-1]]}function a(e,n,r){for(var t=e,i=0;i<n.length-1;i++){if(!t[n[i]].children){o=!0;break}t=t[n[i]].children}t[n[n.length-1]]=r}var l=i(t,n);return a(t,n,i(t,r)),a(t,r,l),{newHeaders:t,emergencyBreak:o}}(v,g,x),M=y.newHeaders,S=y.emergencyBreak;if(!(c||l.accessor===(null===(r=o.current)||void 0===r?void 0:r.accessor)||null===o.current||h<10||0===g.length||0===x.length||JSON.stringify(M)===JSON.stringify(i.current)||S)){var E=Date.now();JSON.stringify(M)===JSON.stringify(s)&&(E-I<1500||h<40)||(I=E,R={screenX:u,screenY:f},d(M))}}}},handleDragEnd:function(){o.current=null,a.current=null,null==l||l(i.current)}}},M=n.createContext(void 0),S=function(n){var t=n.children,o=n.value;return e.jsx(M.Provider,r({value:o},{children:t}))},E=function(){var e=n.useContext(M);if(void 0===e)throw new Error("useTableContext must be used within a TableProvider");return e},j=n.forwardRef((function(t,o){var i,a,l=t.borderClass,d=t.colIndex,s=t.header,c=t.isHighlighted,u=t.isInitialFocused,h=t.onExpandRowClick,g=t.rowIndex,m=t.visibleRow,w=E(),x=w.cellRegistry,I=w.cellUpdateFlash,R=w.collapseIcon,b=w.draggedHeaderRef,M=w.expandIcon,S=w.handleMouseDown,j=w.handleMouseOver,D=w.headersRef,k=w.hoveredHeaderRef,H=w.onCellEdit,N=w.onTableHeaderDragEnd,T=m.depth,L=m.row,W=n.useState(L.rowData[s.accessor]),O=W[0],B=W[1],P=n.useState(!1),F=P[0],A=P[1],z=n.useState(!1),U=z[0],J=z[1],V=n.useRef(null),q=y({draggedHeaderRef:b,headersRef:D,hoveredHeaderRef:k,onTableHeaderDragEnd:N}).handleDragOver,K=C(),X="cell-".concat(g,"-").concat(d),Y=v({rowId:L.rowMeta.rowId,accessor:s.accessor});n.useEffect((function(){if(x){var e="".concat(L.rowMeta.rowId,"-").concat(s.accessor);return x.set(e,{updateContent:function(e){O!==e?(B(e),I&&(J(!0),V.current&&clearTimeout(V.current),V.current=setTimeout((function(){J(!1)}),800))):B(e)}}),function(){x.delete(e),V.current&&clearTimeout(V.current)}}}),[x,I,L.rowMeta.rowId,s.accessor,O]),n.useEffect((function(){if(U){var e=setTimeout((function(){J(!1)}),850);return function(){return clearTimeout(e)}}}),[U]),n.useEffect((function(){B(L.rowData[s.accessor])}),[L.rowData,s.accessor]);var _=Boolean(null===(a=null===(i=L.rowMeta)||void 0===i?void 0:i.children)||void 0===a?void 0:a.length),$=Boolean(null==s?void 0:s.isEditable),G="st-cell ".concat(T>0&&s.expandable?"st-cell-depth-".concat(T):""," ").concat(c?u?"st-cell-selected-first ".concat(l):"st-cell-selected ".concat(l):""," ").concat($?"clickable":""," ").concat(U?"st-cell-updating":""),Q=n.useCallback((function(e){B(e),null==H||H({accessor:s.accessor,newValue:e,row:L})}),[s.accessor,H,L]);return F?e.jsx("div",r({className:"st-cell-editing",id:f({accessor:s.accessor,rowIndex:g+1})},{children:e.jsx(p,{onChange:Q,setIsEditing:A,value:O})})):e.jsxs("div",r({className:G,id:X,onDoubleClick:function(){return s.isEditable&&A(!0)},onMouseDown:function(){return S({rowIndex:g,colIndex:d,rowId:L.rowMeta.rowId})},onMouseOver:function(){return j({rowIndex:g,colIndex:d,rowId:L.rowMeta.rowId})},onDragOver:function(e){return K({callback:q,callbackProps:{event:e,hoveredHeader:s},limit:50})},onKeyDown:function(e){"F2"!==e.key&&"Enter"!==e.key||!s.isEditable||F||(e.preventDefault(),A(!0))},ref:o,"data-row-index":g,"data-col-index":d,"data-row-id":L.rowMeta.rowId,"data-accessor":s.accessor},{children:[s.expandable&&_?L.rowMeta.isExpanded?e.jsx("div",r({className:"st-sort-icon-container",onClick:function(){return h(L.rowMeta.rowId)},onMouseDown:function(e){e.stopPropagation()}},{children:R})):e.jsx("div",r({className:"st-sort-icon-container",onClick:function(){return h(L.rowMeta.rowId)},onMouseDown:function(e){e.stopPropagation()}},{children:M})):null,e.jsx("span",r({className:"st-cell-content ".concat("right"===s.align?"right-aligned":"center"===s.align?"center-aligned":"")},{children:s.cellRenderer?s.cellRenderer({accessor:s.accessor,colIndex:d,row:L}):O}))]}),Y)})),D=function(n){var t=n.children,o=function(e,n){var r={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(r[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(t=Object.getOwnPropertySymbols(e);o<t.length;o++)n.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(e,t[o])&&(r[t[o]]=e[t[o]])}return r}(n,["children"]);return E().allowAnimations?e.jsx(k,r({},o,{children:t})):e.jsx(e.Fragment,{children:t})},k=function(r){var t=r.children,o=r.isBody,i=r.pauseAnimation,a=r.rowIndex,l=n.useRef(!1),d=E(),s=d.draggedHeaderRef,c=d.headersRef,u=d.mainBodyRef,h=d.shouldPaginate,v=n.useState({}),g=v[0],m=v[1],w=n.useRef({}),p=c.current;return n.useLayoutEffect((function(){if(p){var e=function(e){var n=e.currentHeaders,r=e.draggedHeaderRef,t=e.rowIndex,o={};return n.forEach((function(e){var n;if(e){var i=document.getElementById(f({accessor:e.accessor,rowIndex:t}));if(i){var a=i.getAnimations().some((function(e){return"running"===e.playState})),l=i.getBoundingClientRect();a&&(null===(n=null==r?void 0:r.current)||void 0===n?void 0:n.accessor)!==e.accessor?o[e.accessor]=!1:o[e.accessor]=l}}})),o}({currentHeaders:p,draggedHeaderRef:s,rowIndex:a});JSON.stringify(e)!==JSON.stringify(g)&&(w.current=g,m(e))}}),[g,p,s,o,a]),n.useLayoutEffect((function(){var e=u.current,n=function(){l.current=!0},r=function(){l.current=!1};return null==e||e.addEventListener("scroll",n),null==e||e.addEventListener("scrollend",r),function(){null==e||e.removeEventListener("scroll",n),null==e||e.removeEventListener("scrollend",r)}}),[s,u]),n.useEffect((function(){i||l.current||Object.keys(w.current).length&&p&&p.forEach((function(e){var n=document.getElementById(f({accessor:e.accessor,rowIndex:a}));if(n){var r=w.current[e.accessor],t=g[e.accessor];if(r&&t){var o=r.left-t.left,i=h?0:r.top-t.top,l=Math.abs(o),d=Math.abs(i);(l>10||d>10)&&requestAnimationFrame((function(){n.style.transform="translate(".concat(o,"px, ").concat(i,"px)"),n.style.transition="transform 0s",requestAnimationFrame((function(){n.style.transform="",n.style.transition="transform ".concat(400,"ms ease-out")}))}))}}}))}),[g,p,o,i,w,a,h]),e.jsx(e.Fragment,{children:t})},H=function(n){var t=n.columnIndices,o=n.headers,i=n.hiddenColumns,a=n.isWidthDragging,l=n.onExpandRowClick,d=n.pinned,s=n.rowIndex,c=n.rowIndices,u=n.visibleRow,v=o.filter((function(e){return h({hiddenColumns:i,header:e,pinned:d})}));return e.jsx(D,r({isBody:!0,pauseAnimation:a,rowIndex:s+1},{children:v.map((function(n){return e.jsx(N,{columnIndices:t,header:n,headers:o,hiddenColumns:i,onExpandRowClick:l,pinned:d,rowIndex:s,rowIndices:c,visibleRow:u},f({accessor:n.accessor,rowIndex:s+1}))}))}))},N=function(r){var t=r.columnIndices,o=r.header,i=r.headers,a=r.hiddenColumns,l=r.onExpandRowClick,d=r.pinned,s=r.rowIndex,c=r.rowIndices,u=r.visibleRow,v=t[o.accessor],g=E(),m=g.getBorderClass,w=g.isSelected,p=g.isInitialFocusedCell;if(o.children){var x=o.children.filter((function(e){return h({hiddenColumns:a,header:e,pinned:d})}));return e.jsx(n.Fragment,{children:x.map((function(n){return e.jsx(N,{columnIndices:t,header:n,headers:i,hiddenColumns:a,onExpandRowClick:l,pinned:d,rowIndex:s,rowIndices:c,visibleRow:u},f({accessor:n.accessor,rowIndex:s+1}))}))})}var C={rowIndex:s,colIndex:v,rowId:u.row.rowMeta.rowId},I=m(C),R=w(C),b=p(C);return e.jsx(j,{borderClass:I,colIndex:v,header:o,isHighlighted:R,isInitialFocused:b,onExpandRowClick:l,rowIndex:s,visibleRow:u},f({accessor:o.accessor,rowIndex:s+1}))},T=function(n){var t=n.columnIndices,o=n.gridTemplateColumns,i=n.headers,a=n.hiddenColumns,l=n.index,d=n.isWidthDragging,s=n.onExpandRowClick,c=n.pinned,f=n.rowHeight,h=n.rowIndices,v=n.visibleRow,g=v.position,m=g%2==0;return e.jsx("div",r({className:"st-row ".concat(m?"even":"odd"),style:{gridTemplateColumns:o,top:u({position:g,rowHeight:f}),height:"".concat(f,"px")}},{children:e.jsx(H,{columnIndices:t,headers:i,hiddenColumns:a,isWidthDragging:d,onExpandRowClick:s,pinned:c,rowIndex:l,rowIndices:h,visibleRow:v},l)}))},L=function(n){var t=n.displayStrongBorder,o=n.position,i=n.rowHeight,a=n.templateColumns;return e.jsx("div",r({className:"st-row-separator ".concat(t?"st-last-group-row":""),style:{display:"grid",gridTemplateColumns:a,position:"absolute",top:c({position:o,rowHeight:i}),minWidth:"100%"}},{children:e.jsx("div",{style:{gridColumn:"1 / -1"}})}))},W=function(t){var o=t.columnIndices,i=t.headers,a=t.hiddenColumns,l=t.isWidthDragging,d=t.onExpandRowClick,s=t.pinned,c=t.rowHeight,u=t.rowIndices,f=t.sectionRef,h=t.templateColumns,v=t.totalHeight,g=t.visibleRows,m=t.width,w=s?"st-body-pinned-".concat(s):"st-body-main";return e.jsx("div",r({className:w,ref:f,style:{position:"relative",height:"".concat(v,"px"),width:m}},{children:g.map((function(r,t){var f,v,m,w,p=Boolean(null===(v=null===(f=r.row.rowMeta)||void 0===f?void 0:f.children)||void 0===v?void 0:v.length),x=null===(w=null===(m=g[t-1])||void 0===m?void 0:m.row.rowMeta)||void 0===w?void 0:w.isExpanded;return e.jsxs(n.Fragment,{children:[e.jsx(T,{columnIndices:o,gridTemplateColumns:h,headers:i,hiddenColumns:a,index:t,isWidthDragging:l,onExpandRowClick:d,pinned:s,rowHeight:c,rowIndices:u,visibleRow:r}),0!==t&&e.jsx(L,{displayStrongBorder:p&&x,position:r.position,rowHeight:c,templateColumns:h})]},r.position)}))}))};function O(e){var n=e.headersRef,r=e.hiddenColumns,t=e.pinnedLeftColumns,o=e.pinnedRightColumns,i={},a=0,l=function(e,n){void 0===n&&(n=!1),n||a++,i[e.accessor]=a,e.children&&e.children.length>0&&e.children.filter((function(e){return h({hiddenColumns:r,header:e})})).forEach((function(e,n){l(e,0===n)}))};return t.forEach((function(e,n){l(e,0===n)})),n.current.filter((function(e){return!e.pinned&&h({hiddenColumns:r,header:e})})).forEach((function(e,n){var r=0===n&&0===t.length;l(e,r)})),o.forEach((function(e){l(e,!1)})),i}var B=function(t){var o,i,a,l,d,s=t.centerHeaderRef,c=t.flattenedRows,u=t.headerContainerRef,f=t.isWidthDragging,h=t.mainTemplateColumns,v=t.pinnedLeftColumns,g=t.pinnedLeftHeaderRef,m=t.pinnedLeftTemplateColumns,w=t.pinnedRightColumns,p=t.pinnedRightHeaderRef,x=t.pinnedRightTemplateColumns,C=t.setFlattenedRows,I=t.setScrollTop,R=t.visibleRows,b=E(),y=b.rowHeight,M=b.scrollbarWidth,S=b.mainBodyRef,j=b.pinnedLeftRef,D=b.pinnedRightRef,k=b.tableBodyContainerRef,H=b.hiddenColumns,N=b.headersRef;!function(e){var r=e.headerContainerRef,t=e.mainSectionRef,o=e.scrollbarWidth,i=n.useState(!1),a=i[0],l=i[1];n.useEffect((function(){var e=null==r?void 0:r.current;if(a&&e)return e.classList.add("st-header-scroll-padding"),e.style.setProperty("--st-after-width","".concat(o,"px")),function(){e.classList.remove("st-header-scroll-padding")}}),[r,a,o]),n.useEffect((function(){var e=null==r?void 0:r.current,n=null==t?void 0:t.current;if(n&&e){var o=function(){if(n){var e=n.scrollHeight>n.clientHeight;l(e)}};o();var i=new ResizeObserver((function(){o()}));return i.observe(n),function(){n&&i.unobserve(n)}}}),[r,t])}({headerContainerRef:u,mainSectionRef:k,scrollbarWidth:M});var T,L,B=n.useRef(null),P=(T=0,(L=function(e){e.forEach((function(e){T+=1,e.rowMeta.isExpanded&&e.rowMeta.children&&L(e.rowMeta.children)}))})(c),T)*(y+1)-1,F=n.useMemo((function(){return O({headersRef:N,hiddenColumns:H,pinnedLeftColumns:v,pinnedRightColumns:w})}),[N,H,v,w]),A=n.useMemo((function(){var e={};return R.forEach((function(n,r){var t=String(n.row.rowMeta.rowId);e[t]=r})),e}),[R]),z=function(e){var n=function(t){return t.rowMeta.rowId===e&&t.rowMeta.children?r(r({},t),{rowMeta:r(r({},t.rowMeta),{isExpanded:!t.rowMeta.isExpanded})}):t.rowMeta.children?r(r({},t),{rowMeta:r(r({},t.rowMeta),{children:t.rowMeta.children.map(n)})}):t};C((function(e){return e.map(n)}))},U=(null===(o=g.current)||void 0===o?void 0:o.clientWidth)?(null===(i=g.current)||void 0===i?void 0:i.clientWidth)+1:0,J=null===(a=s.current)||void 0===a?void 0:a.clientWidth,V=(null===(l=p.current)||void 0===l?void 0:l.clientWidth)?(null===(d=p.current)||void 0===d?void 0:d.clientWidth)+1:0,q={headerContainerRef:u,headers:N.current,hiddenColumns:H,isWidthDragging:f,rowHeight:y,visibleRows:R,columnIndices:F,rowIndices:A};return e.jsxs("div",r({className:"st-body-container",ref:k,onScroll:function(e){var n=e.currentTarget.scrollTop;B.current&&cancelAnimationFrame(B.current),B.current=requestAnimationFrame((function(){I(n)}))}},{children:[v.length>0&&e.jsx(W,r({},q,{onExpandRowClick:z,pinned:"left",sectionRef:j,templateColumns:m,totalHeight:P,width:U})),e.jsx(W,r({},q,{onExpandRowClick:z,sectionRef:S,templateColumns:h,totalHeight:P,width:J})),w.length>0&&e.jsx(W,r({},q,{onExpandRowClick:z,pinned:"right",sectionRef:D,templateColumns:x,totalHeight:P,width:V}))]}))},P=function(e,r){n.useEffect((function(){if(e.current){var n=e.current,t=function(){var e,t=null==n?void 0:n.scrollLeft;void 0!==t&&(null===(e=r.current)||void 0===e||e.scrollTo(t,0))};return n.addEventListener("scroll",t),function(){null==n||n.removeEventListener("scroll",t)}}}),[e,r])},F=function(e){var n=e.event,r=e.forceUpdate,t=e.header,o=e.gridColumnEnd,i=e.gridColumnStart,a=e.setIsWidthDragging,l=e.startWidth;a(!0),n.preventDefault();var d=n.clientX;if(t){var s="number"==typeof t.minWidth?t.minWidth:40,c=function(e){return e.children&&0!==e.children.length?e.children.flatMap((function(e){return c(e)})):[e]},u=o-i>1,f=u?c(t):[t],h=function(e){var n=e.clientX-d;if(u&&f.length>1){var o=f.reduce((function(e,n){return Math.min(e,"number"==typeof n.minWidth?n.minWidth:40)}),40),i=f.reduce((function(e,n){return e+("number"==typeof n.width?n.width:150)}),0),a=Math.max(l+n,o)-i;f.forEach((function(e,n){var r="number"==typeof e.width?e.width:150,t=a*(r/i),o=Math.max(r+t,s);e.width=o}))}else{var c=Math.max(l+n,s);t.width=c}r()},v=function(){document.removeEventListener("mousemove",h),document.removeEventListener("mouseup",v),a(!1)};document.addEventListener("mousemove",h),document.addEventListener("mouseup",v)}},A=n.forwardRef((function(o,i){var a,l,d=o.colIndex,s=o.forceHeadersUpdate,c=o.gridColumnEnd,u=o.gridColumnStart,h=o.gridRowEnd,v=o.gridRowStart,g=o.header,m=o.reverse,w=o.sort,p=E(),x=p.columnReordering,I=p.columnResizing,R=p.draggedHeaderRef,b=p.forceUpdate,M=p.headersRef,S=p.hoveredHeaderRef,j=p.onColumnOrderChange,D=p.onSort,k=p.onTableHeaderDragEnd,H=p.rowHeight,N=p.selectColumns,T=p.selectableColumns,L=p.setInitialFocusedCell,W=p.setIsWidthDragging,O=p.setSelectedCells,B=p.setSelectedColumns,P=p.sortDownIcon,A=p.sortUpIcon,z=Boolean(null==g?void 0:g.isSortable),U="st-header-cell ".concat(g.accessor===(null===(a=S.current)||void 0===a?void 0:a.accessor)?"st-hovered":""," ").concat((null===(l=R.current)||void 0===l?void 0:l.accessor)===g.accessor?"st-dragging":""," ").concat(z?"clickable":""," ").concat(x&&!z?"columnReordering":""," ").concat("right"===(null==g?void 0:g.align)?"right-aligned":"center"===(null==g?void 0:g.align)?"center-aligned":""),J=y({draggedHeaderRef:R,headersRef:M,hoveredHeaderRef:S,onColumnOrderChange:j,onTableHeaderDragEnd:k}),V=J.handleDragStart,q=J.handleDragEnd,K=J.handleDragOver,X=C(),Y=function(e){var n=e.event,r=e.header;if(T){var o=function(e,n){if(!e.children||0===e.children.length)return[n];var r=[],t=function(e,n){if(!e.children||0===e.children.length)return r.push(n),n+1;for(var o=n,i=0,a=e.children;i<a.length;i++){var l=a[i];o=t(l,o)}return o};return t(e,n),r}(r,d);return n.shiftKey&&N?B((function(e){if(0===e.size)return new Set(o);var n=o[0],r=Array.from(e).sort((function(e,n){return e-n})),i=r[0],a=Math.abs(n-i);r.forEach((function(e){var r=Math.abs(n-e);r<a&&(a=r,i=e)}));var l,d,s,c,u=t(t([],(l=i,d=n,s=Math.min(l,d),c=Math.max(l,d),Array.from({length:c-s+1},(function(e,n){return s+n}))),!0),o,!0);return new Set(t(t([],Array.from(e),!0),u,!0))})):N&&N(o),O(new Set),void L(null)}r.isSortable&&D(d,r.accessor)};if(n.useEffect((function(){var e=function(e){e.preventDefault(),e.dataTransfer.dropEffect="move"};return document.addEventListener("dragover",e),function(){document.removeEventListener("dragover",e)}}),[]),!g)return null;var _=I&&e.jsx("div",{className:"st-header-resize-handle",onMouseDown:function(e){var n;X({callback:F,callbackProps:{event:e.nativeEvent,forceUpdate:b,header:g,gridColumnEnd:c,gridColumnStart:u,setIsWidthDragging:W,startWidth:"object"==typeof i&&null!==i&&"current"in i?null===(n=i.current)||void 0===n?void 0:n.offsetWidth:void 0},limit:10})}}),$=w&&w.key.accessor===g.accessor&&e.jsxs("div",r({className:"st-sort-icon-container",onClick:function(e){return Y({event:e,header:g})}},{children:["ascending"===w.direction&&A&&A,"descending"===w.direction&&P&&P]}));return e.jsxs("div",r({className:U,id:f({accessor:g.accessor,rowIndex:0}),onDragOver:function(e){X({callback:K,callbackProps:{event:e,hoveredHeader:g},limit:50})},ref:i,style:r(r({gridRowStart:v,gridRowEnd:h,gridColumnStart:u,gridColumnEnd:c},c-u>1?{}:{width:g.width}),h-v>1?{}:{height:H})},{children:[m&&_,e.jsxs("div",r({className:"st-header-label ".concat("right"===g.align?"right-aligned":"center"===g.align?"center-aligned":""),draggable:x&&!g.disableReorder,onClick:function(e){return Y({event:e,header:g})},onDragEnd:function(e){e.preventDefault(),q(),s()},onDragStart:function(e){x&&g&&function(e){V(e)}(g)}},{children:["right"===g.align&&$,null==g?void 0:g.label,"right"!==g.align&&$]})),!m&&_]}))})),z=function(t){var o=t.columnIndices,i=t.gridTemplateColumns,a=t.handleScroll,l=t.headersRef,d=t.hiddenColumns,s=t.maxDepth,c=t.pinned,u=t.sectionRef,f=t.sort,v=n.useReducer((function(e){return e+1}),0)[1],g=n.useMemo((function(){var e=[],n=1,r=function(t,i,a){var l,u;if(void 0===a&&(a=!1),!h({hiddenColumns:d,header:t,pinned:c}))return 0;a||n++;var f=null!==(u=null===(l=t.children)||void 0===l?void 0:l.filter((function(e){return h({hiddenColumns:d,header:e,pinned:c})})).length)&&void 0!==u?u:0,v=n,g=f>0?v+f:v+1,m=i,w=f>0?i+1:s+1;if(e.push({header:t,gridColumnStart:v,gridColumnEnd:g,gridRowStart:m,gridRowEnd:w,colIndex:o[t.accessor]}),t.children){var p=!0;t.children.forEach((function(e){h({hiddenColumns:d,header:e,pinned:c})&&(r(e,i+1,p),p=!1)}))}return g-v},t=l.current.filter((function(e){return h({hiddenColumns:d,header:e,pinned:c})})),i=!0;return t.forEach((function(e){r(e,1,i),i=!1})),e}),[l,d,s,c,o]);return e.jsx("div",r({className:"st-header-".concat(c?"pinned-".concat(c):"main")},a&&{onScroll:a},{ref:u,style:{gridTemplateColumns:i,display:"grid",position:"relative"}},{children:e.jsx(D,r({rowIndex:0},{children:g.map((function(r){return e.jsx(A,{colIndex:r.colIndex,forceHeadersUpdate:v,gridColumnEnd:r.gridColumnEnd,gridColumnStart:r.gridColumnStart,gridRowEnd:r.gridRowEnd,gridRowStart:r.gridRowStart,header:r.header,ref:n.createRef(),reverse:"right"===c,sort:f},r.header.accessor)}))}))}))},U=function(e){var n;return(null===(n=e.children)||void 0===n?void 0:n.length)?1+Math.max.apply(Math,e.children.map(U)):1},J=function(t){var o=t.centerHeaderRef,i=t.headerContainerRef,a=t.headersRef,l=t.hiddenColumns,d=t.mainTemplateColumns,s=t.pinnedLeftColumns,c=t.pinnedLeftHeaderRef,u=t.pinnedLeftTemplateColumns,f=t.pinnedRightColumns,v=t.pinnedRightHeaderRef,g=t.pinnedRightTemplateColumns,m=t.sort,w=E().mainBodyRef;P(w,o);var p=n.useMemo((function(){return O({headersRef:a,hiddenColumns:l,pinnedLeftColumns:s,pinnedRightColumns:f})}),[a,l,s,f]),x=n.useMemo((function(){var e=a.current,n=0;return e.forEach((function(e){if(h({hiddenColumns:l,header:e})){var r=U(e);n=Math.max(n,r)}})),{maxDepth:n}}),[a,l]).maxDepth;return e.jsxs("div",r({className:"st-header-container",ref:i},{children:[s.length>0&&e.jsx(z,{columnIndices:p,gridTemplateColumns:u,handleScroll:void 0,headersRef:a,hiddenColumns:l,maxDepth:x,pinned:"left",sectionRef:c,sort:m}),e.jsx(z,{columnIndices:p,gridTemplateColumns:d,handleScroll:function(e){var n,r,t=null===(n=o.current)||void 0===n?void 0:n.scrollLeft;void 0!==t&&(null===(r=w.current)||void 0===r||r.scrollTo(t,0))},headersRef:a,hiddenColumns:l,maxDepth:x,sectionRef:o,sort:m}),f.length>0&&e.jsx(z,{columnIndices:p,gridTemplateColumns:g,handleScroll:void 0,headersRef:a,hiddenColumns:l,maxDepth:x,pinned:"right",sectionRef:v,sort:m})]}))},V=function(e){var n=e.headers,r=e.hiddenColumns,t=function(e){var n=e.headers,o=e.flattenedHeaders;return n.forEach((function(e){!0!==r[e.accessor]&&(e.children?t({headers:e.children,flattenedHeaders:o}):o.push(e))})),o},o=t({headers:n,flattenedHeaders:[]});return"".concat(o.map((function(e){return function(e){var n=e.minWidth,r=e.width;return"number"==typeof r&&(r="".concat(r,"px")),n&&"number"==typeof n&&(n="".concat(n,"px")),void 0!==n?"string"==typeof r&&r.endsWith("fr")?"minmax(".concat(n,", ").concat(r,")"):"max(".concat(n,", ").concat(r,")"):r}(e)})).join(" "))},q=function(t){var o=t.flattenedRows,i=t.isWidthDragging,a=t.setFlattenedRows,l=t.setScrollTop,d=t.sort,s=t.visibleRows,c=E(),u=c.editColumns,f=c.headersRef,h=c.hiddenColumns,v=n.useRef(null),g=n.useRef(null),m=n.useRef(null),w=n.useRef(null),p=f.current.filter((function(e){return!e.pinned})),x=f.current.filter((function(e){return"left"===e.pinned})),C=f.current.filter((function(e){return"right"===e.pinned})),I=n.useMemo((function(){return V({headers:x,hiddenColumns:h})}),[x,h]),R=n.useMemo((function(){return V({headers:p,hiddenColumns:h})}),[p,h]),b=n.useMemo((function(){return V({headers:C,hiddenColumns:h})}),[C,h]),y={centerHeaderRef:m,headerContainerRef:v,headersRef:f,hiddenColumns:h,mainTemplateColumns:R,pinnedLeftColumns:x,pinnedLeftHeaderRef:g,pinnedLeftTemplateColumns:I,pinnedRightColumns:C,pinnedRightHeaderRef:w,pinnedRightTemplateColumns:b,sort:d},M={centerHeaderRef:m,flattenedRows:o,headerContainerRef:v,isWidthDragging:i,mainTemplateColumns:R,pinnedLeftColumns:x,pinnedLeftHeaderRef:g,pinnedLeftTemplateColumns:I,pinnedRightColumns:C,pinnedRightHeaderRef:w,pinnedRightTemplateColumns:b,setFlattenedRows:a,setScrollTop:l,visibleRows:s};return e.jsxs("div",r({className:"st-content",style:{width:u?"calc(100% - 27.5px)":"100%"}},{children:[e.jsx(J,r({},y)),e.jsx(B,r({},M))]}))},K=function(e){var r=e.callback,t=e.ref,o=e.widthAttribute;n.useEffect((function(){var e=t.current;if(e){var n=function(){r(e[o]||0)};n();var i=new ResizeObserver((function(){n()}));return i.observe(e),function(){return i.disconnect()}}}),[r,t,o])},X=function(t){var o,i,a,l=t.mainBodyRef,d=t.pinnedLeftRef,s=t.pinnedRightRef,c=t.tableContentWidth,u=n.useState(0),f=u[0],h=u[1],v=n.useState(0),g=v[0],m=v[1],w=n.useRef(null);if(K({widthAttribute:"offsetWidth",callback:h,ref:d}),K({widthAttribute:"offsetWidth",callback:m,ref:s}),P(l,w),!l.current||l.current.scrollWidth<=l.current.clientWidth)return null;var p=null===(o=l.current)||void 0===o?void 0:o.scrollWidth;return e.jsxs("div",r({className:"st-horizontal-scrollbar-container",style:{width:c}},{children:[f>0&&e.jsx("div",{className:"st-horizontal-scrollbar-left",style:{flexShrink:0,width:f,height:null===(i=w.current)||void 0===i?void 0:i.offsetHeight}}),p>0&&e.jsx("div",r({className:"st-horizontal-scrollbar-middle",onScroll:function(e){var n=e.target.scrollLeft;void 0!==n&&l.current&&l.current.scrollTo({left:n,behavior:"auto"})},ref:w},{children:e.jsx("div",{style:{width:p,height:".3px"}})})),g>0&&e.jsx("div",{className:"st-horizontal-scrollbar-right",style:{flexShrink:0,minWidth:g,height:null===(a=w.current)||void 0===a?void 0:a.offsetHeight}})]}))},Y={string:function(e,n,r){if(e===n)return 0;var t=e.localeCompare(n);return"ascending"===r?t:-t},number:function(e,n,r){if(e===n)return 0;var t=e-n;return"ascending"===r?t:-t},boolean:function(e,n,r){if(e===n)return 0;var t=e===n?0:e?-1:1;return"ascending"===r?t:-t},date:function(e,n,r){var t=new Date(e),o=new Date(n);if(t.getTime()===o.getTime())return 0;var i=t.getTime()-o.getTime();return"ascending"===r?i:-i},enum:function(e,n,r){return Y.string(e,n,r)},default:function(e,n,r){return e===n?0:null==e?"ascending"===r?-1:1:null==n?"ascending"===r?1:-1:"string"==typeof e&&"string"==typeof n?Y.string(e,n,r):"number"==typeof e&&"number"==typeof n?Y.number(e,n,r):"boolean"==typeof e&&"boolean"==typeof n?Y.boolean(e,n,r):Y.string(String(e),String(n),r)}},_=function(e,n,r,t){if(void 0===r&&(r="string"),null==e||""===e)return"ascending"===t?-1:1;if(null==n||""===n)return"ascending"===t?1:-1;if("number"===r){var o=function(e){var n;if("number"==typeof e)return e;var r=String(e);if("string"==typeof r){var t=r.replace(/[$,]/g,"").match(/^([-+]?\d*\.?\d+)([TBMKtbmk])?/);if(t){var o=parseFloat(t[1]),i=null===(n=t[2])||void 0===n?void 0:n.toUpperCase();return"T"===i?o*=1e12:"B"===i?o*=1e9:"M"===i?o*=1e6:"K"===i&&(o*=1e3),o}}return parseFloat(r)||0},i=o(e),a=o(n);return Y.number(i,a,t)}return"date"===r?Y.date(String(e),String(n),t):"boolean"===r?Y.boolean(Boolean(e),Boolean(n),t):"enum"===r?Y.enum(String(e),String(n),t):Y.string(String(e),String(n),t)},$=function(e,n,o){var i=o.find((function(e){return e.accessor===n.key.accessor})),a=(null==i?void 0:i.type)||"string",l=n.direction,d=new Map,s=new Map,c="";e.forEach((function(e){var r;if(e.rowData&&!e.rowData[n.key.accessor]&&void 0!==e.rowMeta.isExpanded){var t=(e.rowData.sector||"group_".concat(d.size)).toString();c=t,s.set(c,e),d.has(c)||d.set(c,[])}else if(c){var o=d.get(c)||[];o.push(e),d.set(c,o)}else{var i="default";d.has(i)||d.set(i,[]),null===(r=d.get(i))||void 0===r||r.push(e)}}));var u=[];return d.forEach((function(e,i){if(s.has(i)){var d=s.get(i);d.rowMeta.children&&d.rowMeta.children.length>0&&(d.rowMeta.children=G(d.rowMeta.children,n,o)),u.push(d)}var c=t([],e,!0).sort((function(e,r){if(!(null==e?void 0:e.rowData)||!(null==r?void 0:r.rowData))return 0;var t=n.key.accessor,o=e.rowData[t],i=r.rowData[t];return _(o,i,a,l)}));u.push.apply(u,c.map((function(e){var t=r({},e);if(t.rowMeta.children&&t.rowMeta.children.length>0){var i=G(t.rowMeta.children,n,o);t.rowMeta=r(r({},t.rowMeta),{children:i})}return t})))})),u},G=function(e,n,o){var i=o.find((function(e){return e.accessor===n.key.accessor})),a=(null==i?void 0:i.type)||"string",l=n.direction;return t([],e,!0).sort((function(e,r){if(!(null==e?void 0:e.rowData)||!(null==r?void 0:r.rowData))return 0;var t=n.key.accessor,o=e.rowData[t],i=r.rowData[t];return _(o,i,a,l)})).map((function(e){return e.rowMeta.children&&e.rowMeta.children.length>0?r(r({},e),{rowMeta:r(r({},e.rowMeta),{children:G(e.rowMeta.children,n,o)})}):e}))},Q=function(e){var r=e.headers,t=e.tableRows,o=n.useState(null),i=o[0],a=o[1],l=n.useMemo((function(){var e={};return r.forEach((function(n){!0===n.hide&&(e[n.accessor]=!0)})),e}),[r]),d=n.useState(l),s=d[0],c=d[1],u=n.useMemo((function(){if(!i)return t;var e=function(e,n,r){return{sortedData:$(n,r,e),newSortConfig:r}}(r,t,i).sortedData;return e}),[t,i,r]);return{sort:i,setSort:a,updateSort:function(e,n){var t=function(e){for(var r=0,o=e;r<o.length;r++){var i=o[r];if(i.accessor===n)return i;if(i.children&&i.children.length>0){var a=t(i.children);if(a)return a}}},o=t(r);o&&a((function(e){return e&&e.key.accessor===n?"ascending"===e.direction?{key:o,direction:"descending"}:null:{key:o,direction:"ascending"}}))},sortedRows:u,hiddenColumns:s,setHiddenColumns:c}},Z=function(t){var o=t.checked,i=void 0!==o&&o,a=t.children,l=t.onChange,d=n.useState(i),s=d[0],c=d[1];return e.jsxs("label",r({className:"st-checkbox-label"},{children:[e.jsx("input",{checked:s,className:"st-checkbox-input",onChange:function(){var e=!s;c(e),l&&l(e)},type:"checkbox"}),e.jsx("span",r({className:"st-checkbox-custom ".concat(s?"st-checked":"")},{children:s&&e.jsx("span",{className:"st-checkbox-checkmark"})})),a]}))},ee=function(n){var t=n.headers,o=n.open,i=n.position;n.setOpen;var a=n.setHiddenColumns,l=n.hiddenColumns,d="left"===i?"left":"";return e.jsx("div",r({className:"st-column-editor-popout ".concat(o?"open":""," ").concat(d),onClick:function(e){return e.stopPropagation()}},{children:e.jsx("div",r({className:"st-column-editor-popout-content"},{children:t.map((function(n,t){return e.jsx(Z,r({checked:l[n.accessor],onChange:function(e){var t;return a(r(r({},l),((t={})[n.accessor]=e,t)))}},{children:n.label}),t)}))}))}))},ne=function(t){var o=t.columnEditorText,i=t.editColumns,a=t.editColumnsInitOpen,l=t.headers,d=t.position,s=void 0===d?"right":d,c=t.setHiddenColumns,u=t.hiddenColumns,f=n.useState(a),h=f[0],v=f[1];return i?e.jsxs("div",r({className:"st-column-editor ".concat(h?"open":""," ").concat(s),onClick:function(){return function(e){v(e)}(!h)}},{children:[e.jsx("div",r({className:"st-column-editor-text"},{children:o})),e.jsx(ee,{headers:l,open:h,position:s,setOpen:v,setHiddenColumns:c,hiddenColumns:u})]})):null};exports.SimpleTable=function(t){var c=t.allowAnimations,u=void 0!==c&&c,f=t.cellUpdateFlash,h=void 0!==f&&f,g=t.collapseIcon,m=void 0===g?e.jsx(s,{className:"st-sort-icon"}):g,w=t.columnEditorPosition,p=void 0===w?"right":w,x=t.columnEditorText,C=void 0===x?"Columns":x,I=t.columnReordering,R=void 0!==I&&I,b=t.columnResizing,y=void 0!==b&&b,M=t.defaultHeaders,E=t.editColumns,j=void 0!==E&&E,D=t.editColumnsInitOpen,k=void 0!==D&&D,H=t.expandIcon,N=void 0===H?e.jsx(l,{className:"st-sort-icon"}):H,T=t.height,L=t.hideFooter,W=void 0!==L&&L,O=t.nextIcon,B=void 0===O?e.jsx(l,{className:"st-next-prev-icon"}):O,P=t.onCellEdit,F=t.onColumnOrderChange,A=t.onNextPage,z=t.onPreviousPage,U=t.prevIcon,J=void 0===U?e.jsx(a,{className:"st-next-prev-icon"}):U,V=t.rowHeight,K=void 0===V?40:V,Y=t.rows,_=t.rowsPerPage,$=void 0===_?10:_,G=t.selectableCells,Z=void 0!==G&&G,ee=t.selectableColumns,re=void 0!==ee&&ee,te=t.shouldPaginate,oe=void 0!==te&&te,ie=t.sortDownIcon,ae=void 0===ie?e.jsx(s,{className:"st-sort-icon"}):ie,le=t.sortUpIcon,de=void 0===le?e.jsx(d,{className:"st-sort-icon"}):le,se=t.tableRef,ce=t.theme,ue=void 0===ce?"light":ce,fe=t.totalPages,he=n.useRef(null),ve=n.useRef(M),ge=n.useRef(null),me=n.useRef(null),we=n.useRef(null),pe=n.useRef(null),xe=n.useRef(null),Ce=n.useState(!1),Ie=Ce[0],Re=Ce[1],be=n.useState(1),ye=be[0],Me=be[1],Se=n.useState(0),Ee=Se[0],je=Se[1],De=n.useState(0),ke=De[0],He=De[1],Ne=n.useState(0),Te=Ne[0],Le=Ne[1],We=Q({headers:ve.current,tableRows:Y}),Oe=We.sort,Be=We.sortedRows,Pe=We.hiddenColumns,Fe=We.setHiddenColumns,Ae=We.updateSort,ze=n.useMemo((function(){if(!oe)return Be;var e=(ye-1)*$,n=e+$;return Be.slice(e,n)}),[ye,$,oe,Be]),Ue=n.useState(ze),Je=Ue[0],Ve=Ue[1];n.useEffect((function(){Ve(ze)}),[ze]);var qe=n.useMemo((function(){var e;if(!T)return window.innerHeight-K;var n=document.querySelector(".simple-table-root"),r=0;if(T.endsWith("px"))r=parseInt(T,10);else if(T.endsWith("vh")){var t=parseInt(T,10);r=window.innerHeight*t/100}else if(T.endsWith("%")){var o=parseInt(T,10);r=((null===(e=null==n?void 0:n.parentElement)||void 0===e?void 0:e.clientHeight)||window.innerHeight)*o/100}else r=window.innerHeight;return Math.max(0,r-K)}),[T,K]),Ke=n.useMemo((function(){return function(e){var n=e.bufferRowCount,r=e.contentHeight,t=e.flattenedRows,o=e.rowHeight,i=e.scrollTop,a=[],l=0,d=Math.max(0,i-o*n),s=i+r+o*n,c=function(e,n){for(var r,t=0,i=e;t<i.length;t++){var u=i[t],f=l*o;if(f>=s)break;f+o>d&&a.push({row:u,depth:n,position:l,isLastGroupRow:Boolean(null===(r=u.rowMeta.children)||void 0===r?void 0:r.length)&&n>1}),l+=1,u.rowMeta.isExpanded&&u.rowMeta.children&&c(u.rowMeta.children,n+1)}};return c(t,0),a}({bufferRowCount:5,contentHeight:qe,flattenedRows:Je,rowHeight:K,scrollTop:Te})}),[qe,K,Je,Te]),Xe=n.useReducer((function(e){return e+1}),0)[1],Ye=function(e){var r=e.selectableCells,t=e.headers,i=e.visibleRows,a=n.useState(new Set),l=a[0],d=a[1],s=n.useState(new Set),c=s[0],u=s[1],f=n.useState(null),h=f[0],v=f[1],g=n.useState(null),m=g[0],w=g[1],p=n.useRef(!1),x=n.useRef(null),C=n.useCallback((function(){var e=Array.from(l).reduce((function(e,n){var r=n.split("-").map(Number),o=r[0],a=r[1];return e[o]||(e[o]=[]),e[o][a]=i[o].row.rowData[t[a].accessor],e}),{}),n=Object.values(e).map((function(e){return Object.values(e).join("\t")})).join("\n");l.size>0&&navigator.clipboard.writeText(n)}),[t,l,i]),I=n.useCallback((function(e,n){for(var r=new Set,t=Math.min(e.rowIndex,n.rowIndex),a=Math.max(e.rowIndex,n.rowIndex),l=Math.min(e.colIndex,n.colIndex),s=Math.max(e.colIndex,n.colIndex),c=t;c<=a;c++)for(var f=l;f<=s;f++)if(c>=0&&c<i.length){var h=i[c].row.rowMeta.rowId;r.add(o({colIndex:f,rowIndex:c,rowId:h}))}u(new Set),v(null),d(r)}),[i,u,v,d]),R=n.useCallback((function(e){if(e.rowIndex>=0&&e.rowIndex<i.length&&e.colIndex>=0&&e.colIndex<t.length){var n=o(e);u(new Set),v(null),d(new Set([n])),w(e)}}),[t.length,i.length,u,v,d,w]),b=n.useCallback((function(e,n){void 0===n&&(n=!1),d(new Set),w(null),u((function(r){var t=new Set(n?r:[]);return e.forEach((function(e){return t.add(e)})),t})),e.length>0&&v(e[e.length-1])}),[d,w,u,v]);n.useEffect((function(){var e=function(e){if(r&&m){var n=m.rowIndex,o=m.colIndex,a=m.rowId;if(!e.ctrlKey&&!e.metaKey||"c"!==e.key){if(i[n].row.rowMeta.rowId!==a){var l=i.findIndex((function(e){return e.row.rowMeta.rowId===a}));if(-1===l)return;n=l}if("ArrowUp"===e.key){if(e.preventDefault(),n>0){var s={rowIndex:n-1,colIndex:o,rowId:i[n-1].row.rowMeta.rowId};R(s)}}else"ArrowDown"===e.key?(e.preventDefault(),n<i.length-1&&(s={rowIndex:n+1,colIndex:o,rowId:i[n+1].row.rowMeta.rowId},R(s))):"ArrowLeft"===e.key||"Tab"===e.key&&e.shiftKey?(e.preventDefault(),o>0&&(s={rowIndex:n,colIndex:o-1,rowId:i[n].row.rowMeta.rowId},R(s))):"ArrowRight"===e.key||"Tab"===e.key?(e.preventDefault(),o<t.length-1&&(s={rowIndex:n,colIndex:o+1,rowId:i[n].row.rowMeta.rowId},R(s))):"Escape"===e.key&&(d(new Set),u(new Set),v(null),x.current=null,w(null))}else C()}};return document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[C,t.length,m,I,R,r,i]);var y=n.useCallback((function(e){var n=e.colIndex,r=e.rowIndex,t=e.rowId,i=o({colIndex:n,rowIndex:r,rowId:t}),a=l.has(i),d=c.has(n);return a||d}),[l,c]),M=n.useCallback((function(e){var n,r,t,o,a,l,d=e.colIndex,s=e.rowIndex,u=e.rowId,f=[],h=null===(t=null===(r=null===(n=i[s-1])||void 0===n?void 0:n.row)||void 0===r?void 0:r.rowMeta)||void 0===t?void 0:t.rowId,v={colIndex:d,rowIndex:s+1,rowId:null===(l=null===(a=null===(o=i[s+1])||void 0===o?void 0:o.row)||void 0===a?void 0:a.rowMeta)||void 0===l?void 0:l.rowId},g={colIndex:d-1,rowIndex:s,rowId:u},m={colIndex:d+1,rowIndex:s,rowId:u};return(!y({colIndex:d,rowIndex:s-1,rowId:h})||c.has(d)&&0===s)&&f.push("st-selected-top-border"),(!y(v)||c.has(d)&&s===i.length-1)&&f.push("st-selected-bottom-border"),y(g)||f.push("st-selected-left-border"),y(m)||f.push("st-selected-right-border"),f.join(" ")}),[y,i,c]),S=n.useMemo((function(){return m?function(e){var n=e.rowIndex,r=e.colIndex,t=e.rowId;return n===m.rowIndex&&r===m.colIndex&&t===m.rowId}:function(){return!1}}),[m]);return{getBorderClass:M,handleMouseDown:function(e){var n=e.colIndex,t=e.rowIndex,i=e.rowId;if(r){p.current=!0,x.current={rowIndex:t,colIndex:n,rowId:i},u(new Set),v(null);var a=o({colIndex:n,rowIndex:t,rowId:i});d(new Set([a])),w({rowIndex:t,colIndex:n,rowId:i})}},handleMouseOver:function(e){var n=e.colIndex,t=e.rowIndex;if(e.rowId,r&&p.current&&x.current){for(var a=new Set,l=Math.min(x.current.rowIndex,t),s=Math.max(x.current.rowIndex,t),c=Math.min(x.current.colIndex,n),u=Math.max(x.current.colIndex,n),f=l;f<=s;f++)for(var h=c;h<=u;h++)if(f>=0&&f<i.length){var v=i[f].row.rowMeta.rowId;a.add(o({colIndex:h,rowIndex:f,rowId:v}))}d(a)}},handleMouseUp:function(){p.current=!1},isInitialFocusedCell:S,isSelected:y,lastSelectedColumnIndex:h,selectColumns:b,selectedCells:l,selectedColumns:c,setInitialFocusedCell:w,setSelectedCells:d,setSelectedColumns:u}}({selectableCells:Z,headers:ve.current,visibleRows:Ke}),_e=Ye.handleMouseDown,$e=Ye.handleMouseOver,Ge=Ye.handleMouseUp,Qe=Ye.isSelected,Ze=Ye.getBorderClass,en=Ye.isInitialFocusedCell,nn=Ye.setSelectedCells,rn=Ye.setSelectedColumns,tn=Ye.selectColumns,on=Ye.setInitialFocusedCell,an=n.useCallback((function(e,n){Ae(e,n)}),[Ae]),ln=n.useCallback((function(e){ve.current=e,Xe()}),[]);n.useEffect((function(){var e=function(e){var n=e.target;n.closest(".st-cell")||re&&(n.classList.contains("st-header-cell")||n.classList.contains("st-header-label"))||(nn(new Set),re&&rn(new Set))};return document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}}),[re,nn,rn]),n.useLayoutEffect((function(){if(xe.current){var e=xe.current.offsetWidth-xe.current.clientWidth,n=xe.current.clientWidth;je(e),He(n)}}),[]),n.useLayoutEffect((function(){var e=function(){if(Xe(),xe.current){var e=xe.current.offsetWidth-xe.current.clientWidth,n=xe.current.clientWidth;je(e),He(n)}};return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}),[]);var dn=n.useRef(new Map);return n.useEffect((function(){se&&(se.current={updateData:function(e){var n,r,t,o,i=e.accessor,a=e.rowIndex,l=e.newValue,d=null===(r=null===(n=null==Y?void 0:Y[a])||void 0===n?void 0:n.rowMeta)||void 0===r?void 0:r.rowId;if(void 0!==d){var s=v({rowId:d,accessor:i}),c=dn.current.get(s);c&&c.updateContent(l),void 0!==(null===(o=null===(t=null==Y?void 0:Y[a])||void 0===t?void 0:t.rowData)||void 0===o?void 0:o[i])&&(Y[a].rowData[i]=l)}}})}),[se,Y]),e.jsx(S,r({value:{allowAnimations:u,cellUpdateFlash:h,collapseIcon:m,columnReordering:R,columnResizing:y,draggedHeaderRef:he,editColumns:j,expandIcon:N,forceUpdate:Xe,getBorderClass:Ze,handleMouseDown:_e,handleMouseOver:$e,headersRef:ve,hiddenColumns:Pe,hoveredHeaderRef:ge,isInitialFocusedCell:en,isSelected:Qe,mainBodyRef:me,onCellEdit:P,onColumnOrderChange:F,onSort:an,onTableHeaderDragEnd:ln,pinnedLeftRef:we,pinnedRightRef:pe,rowHeight:K,scrollbarWidth:Ee,selectColumns:tn,selectableColumns:re,setInitialFocusedCell:on,setIsWidthDragging:Re,setSelectedCells:nn,setSelectedColumns:rn,shouldPaginate:oe,sortDownIcon:ae,sortUpIcon:de,tableBodyContainerRef:xe,cellRegistry:dn.current}},{children:e.jsxs("div",r({className:"simple-table-root st-wrapper theme-".concat(ue),style:T?{height:T}:{}},{children:[e.jsxs("div",r({className:"st-wrapper-container"},{children:[e.jsxs("div",r({className:"st-content-wrapper",onMouseUp:Ge,onMouseLeave:Ge},{children:[e.jsx(q,{flattenedRows:Je,isWidthDragging:Ie,setFlattenedRows:Ve,setScrollTop:Le,sort:Oe,visibleRows:Ke}),e.jsx(ne,{columnEditorText:C,editColumns:j,editColumnsInitOpen:k,headers:ve.current,hiddenColumns:Pe,position:p,setHiddenColumns:Fe})]})),e.jsx(X,{mainBodyRef:me,pinnedLeftRef:we,pinnedRightRef:pe,tableContentWidth:ke})]})),e.jsx(i,{currentPage:ye,hideFooter:W,nextIcon:B,onPageChange:Me,onNextPage:A,onPreviousPage:z,prevIcon:J,shouldPaginate:oe,totalPages:fe||Math.ceil(Be.length/$)})]}))}))};
2
2
  //# sourceMappingURL=index.js.map
package/dist/styles.css CHANGED
@@ -8,4 +8,4 @@
8
8
  --st-blue-900
9
9
  );--st-dragging-background-color:var(--st-blue-300);--st-selected-cell-background-color:var(--st-blue-400);--st-selected-first-cell-background-color:var(--st-blue-300);--st-footer-background-color:var(--st-blue-50);--st-cell-color:var(--st-blue-900);--st-cell-odd-row-color:var(--st-blue-800);--st-edit-cell-shadow:0 1px 2px 0 #0000000d;--st-selected-cell-color:var(--st-blue-900);--st-selected-first-cell-color:var(--st-blue-900);--st-resize-handle-color:var(--st-blue-400);--st-separator-border-color:var(--st-blue-200);--st-last-group-row-separator-border-color:var(--st-blue-400);--st-selected-border-top-color:var(--st-blue-600);--st-selected-border-bottom-color:var(--st-blue-600);--st-selected-border-left-color:var(--st-blue-600);--st-selected-border-right-color:var(--st-blue-600);--st-checkbox-checked-background-color:var(--st-blue-600);--st-checkbox-checked-border-color:var(--st-blue-600);--st-column-editor-background-color:var(--st-blue-50);--st-column-editor-popout-background-color:var(--st-blue-50);--st-button-hover-background-color:var(--st-blue-200);--st-button-active-background-color:var(--st-blue-600);--st-font-family:"Inter",sans-serif;--st-editable-cell-focus-border-color:var(--st-blue-500);--st-cell-flash-color:var(--st-blue-300)}.theme-funky{--st-border-radius:8px;--st-border-width:1px;--st-cell-padding:12px;--st-font-size:0.95rem;--st-font-weight-normal:400;--st-font-weight-bold:600;--st-transition-duration:0.25s;--st-transition-ease:cubic-bezier(0.4,0,0.2,1);--st-opacity-disabled:0.6;--st-spacing-small:6px;--st-spacing-medium:10px;--st-spacing-large:20px;--st-scrollbar-bg-color:var(--st-stone-100);--st-scrollbar-thumb-color:var(--st-violet-500);--st-border-color:var(--st-stone-200);--st-odd-row-background-color:var(--st-amber-50);--st-even-row-background-color:var(--st-amber-100);--st-header-background-color:var(--st-violet-600);--st-header-label-color:var(
10
10
  --st-white
11
- );--st-dragging-background-color:var(--st-violet-50);--st-selected-cell-background-color:var(--st-violet-50);--st-selected-first-cell-background-color:var(--st-violet-100);--st-footer-background-color:var(--st-stone-100);--st-cell-color:var(--st-stone-700);--st-cell-odd-row-color:var(--st-stone-700);--st-edit-cell-shadow:0 4px 6px -1px #7c3aed1a,0 2px 4px -1px #7c3aed0f;--st-selected-cell-color:var(--st-violet-800);--st-selected-first-cell-color:var(--st-violet-800);--st-resize-handle-color:var(--st-violet-400);--st-separator-border-color:var(--st-stone-200);--st-last-group-row-separator-border-color:var(--st-stone-300);--st-selected-border-top-color:var(--st-violet-500);--st-selected-border-bottom-color:var(--st-violet-500);--st-selected-border-left-color:var(--st-violet-500);--st-selected-border-right-color:var(--st-violet-500);--st-checkbox-checked-background-color:var(--st-violet-500);--st-checkbox-checked-border-color:var(--st-violet-600);--st-column-editor-background-color:var(--st-white);--st-column-editor-popout-background-color:var(--st-white);--st-button-hover-background-color:var(--st-violet-50);--st-button-active-background-color:var(--st-violet-600);--st-font-family:"Inter",sans-serif;--st-editable-cell-focus-border-color:var(--st-violet-500);--st-cell-flash-color:var(--st-violet-200)}.simple-table-root,.st-cell,.st-column-editor,.st-column-editor-popout,.st-footer,.st-header-cell,.st-header-container,.st-horizontal-scrollbar-container,.st-horizontal-scrollbar-left,.st-horizontal-scrollbar-middle,.st-horizontal-scrollbar-right,.st-table-body-container,.st-table-body-main,.st-table-body-pinned-left,.st-table-body-pinned-right,.st-table-content,.st-table-wrapper,.st-table-wrapper-container,.st-wrapper{-webkit-box-sizing:border-box;box-sizing:border-box;scrollbar-color:var(--st-scrollbar-thumb-color) var(--st-scrollbar-bg-color);scrollbar-width:thin}.simple-table-root{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:sans-serif;font-family:var(--st-font-family,sans-serif)}.st-wrapper{border:var(--st-border-width) solid var(--st-border-color);border-radius:var(--st-border-radius);max-height:100dvh;overflow:hidden;position:relative}.st-table-wrapper-container{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;height:100%}.st-table-wrapper,.st-table-wrapper-container{display:-webkit-box;display:-ms-flexbox;display:flex;position:relative;width:100%}.st-table-wrapper{-webkit-box-flex:1;-ms-flex:1;flex:1;min-height:0}.st-table-content{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.st-header-container,.st-table-content{display:-webkit-box;display:-ms-flexbox;display:flex}.st-header-container.st-header-scroll-padding:after{-ms-flex-negative:0;background-color:var(--st-header-background-color);border-bottom:var(--st-border-width) solid var(--st-border-color);content:"";display:block;flex-shrink:0;width:default-width;width:var(--st-after-width,default-width)}.st-header-main,.st-header-pinned-left,.st-header-pinned-right{display:grid}.st-header-pinned-left{border-right:var(--st-border-width) solid var(--st-border-color)}.st-header-pinned-right{border-left:var(--st-border-width) solid var(--st-border-color)}.st-header-main{overflow:auto;scrollbar-width:none;width:100%}.st-header-main::-webkit-scrollbar{display:none}.st-table-body-container{background-color:var(--st-even-row-background-color);display:-webkit-box;display:-ms-flexbox;display:flex;height:-webkit-max-content;height:-moz-max-content;height:max-content;overflow:auto;width:100%}.st-table-body-main,.st-table-body-pinned-left,.st-table-body-pinned-right{display:grid;height:-webkit-max-content;height:-moz-max-content;height:max-content}.st-table-body-pinned-left{-ms-flex-negative:0;border-right:var(--st-border-width) solid var(--st-border-color);flex-shrink:0}.st-table-body-main{overflow:auto;scrollbar-width:none}.st-table-body-pinned-right{-ms-flex-negative:0;border-left:var(--st-border-width) solid var(--st-border-color);flex-shrink:0}.st-table-row{display:grid;position:absolute;-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-transition:background .2s ease;transition:background .2s ease;width:100%}.st-header-cell{-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:var(--st-header-background-color);border-bottom:var(--st-border-width) solid var(--st-border-color);border-top:var(--st-border-width) solid #0000;display:-webkit-box;display:-ms-flexbox;display:flex;font-weight:var(--st-font-weight-bold);gap:var(--st-spacing-small);position:sticky;top:0;z-index:1}.st-header-cell.clickable{cursor:pointer}.st-header-cell.draggable{cursor:-webkit-grab;cursor:grab}.st-cell,.st-header-cell{-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:var(--st-slate-800);display:-webkit-box;display:-ms-flexbox;display:flex;gap:var(--st-spacing-small);overflow:hidden}.st-cell.right-aligned,.st-header-cell.right-aligned{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;text-align:right}.st-cell.right-aligned>.st-cell-content,.st-header-cell.right-aligned>.st-header-label{text-align:right}.st-cell.center-aligned,.st-header-cell.center-aligned{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;text-align:center}.st-cell.center-aligned{padding-right:calc(var(--st-cell-padding) + var(--st-spacing-small) + var(--st-resize-handle-width) + var(--st-resize-handle-margin-right))}.st-cell.center-aligned>.st-cell-content,.st-header-cell.center-aligned>.st-header-label{text-align:center}.st-cell.clickable{cursor:pointer}.st-cell,.st-cell-editing,.st-header-cell{height:100%;width:100%}.st-cell-editing{position:relative}.st-header-label{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex}.st-header-label.right-aligned{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;text-align:right}.st-header-label.left-aligned{-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;text-align:left}.st-header-label.center-aligned{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;text-align:center}.st-cell-content,.st-header-label{-webkit-box-flex:1;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;height:100%;overflow:hidden;padding-left:var(--st-cell-padding);text-align:left;text-overflow:ellipsis;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;white-space:nowrap;width:100%}.st-header-label{color:var(--st-header-label-color);padding-right:var(--st-cell-padding)}.st-cell-content{color:var(--st-cell-color);padding-right:calc(var(--st-cell-padding) + var(--st-spacing-small) + var(--st-resize-handle-width) + var(--st-resize-handle-margin-right))}.st-cell-content.right-aligned{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;text-align:right}.st-cell-content.left-aligned{-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;text-align:left}.st-cell-content.center-aligned{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;text-align:center}.st-cell{border:var(--st-border-width) solid #0000;position:relative}.st-cell-depth-1{padding-left:calc(var(--st-cell-padding)*4)}.st-cell-depth-2{padding-left:calc(var(--st-cell-padding)*8)}.st-cell-depth-3{padding-left:calc(var(--st-cell-padding)*12)}.st-cell-depth-4{padding-left:calc(var(--st-cell-padding)*16)}.st-cell-depth-5{padding-left:calc(var(--st-cell-padding)*20)}.st-cell-depth-6{padding-left:calc(var(--st-cell-padding)*24)}.st-cell-depth-7{padding-left:calc(var(--st-cell-padding)*28)}.st-sort-icon-container{-webkit-box-align:center;-ms-flex-align:center;-webkit-box-pack:center;-ms-flex-pack:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;justify-content:center;margin-left:4px}.st-sort-icon{fill:var(--st-slate-500)}.st-header-resize-handle{background-color:var(--st-resize-handle-color);cursor:col-resize;height:calc(100% - 20px);margin-right:var(--st-resize-handle-margin-right);right:0;top:0;width:var(--st-resize-handle-width)}.st-row-separator{background-color:var(--st-separator-border-color);grid-column:1/-1;height:1px}.st-row-separator.st-last-group-row{background-color:var(--st-last-group-row-separator-border-color)}.st-cell-even-row{background-color:var(--st-even-row-background-color)}.st-cell-odd-row:not(.st-cell-selected){background-color:var(--st-odd-row-background-color);color:var(--st-cell-odd-row-color)}.st-cell:not(.st-cell-odd-row):not(.st-cell-selected){color:var(--st-cell-color)}.st-dragging{background-color:var(--st-dragging-background-color)}.st-cell-selected{background-color:var(--st-selected-cell-background-color);color:var(--st-selected-cell-color)}.st-cell-selected-first{background-color:var(--st-selected-first-cell-background-color)!important;border-bottom:var(--st-border-width) solid var(--st-selected-border-bottom-color);border-left:var(--st-border-width) solid var(--st-selected-border-left-color);border-right:var(--st-border-width) solid var(--st-selected-border-right-color);color:var(--st-selected-first-cell-color)}.st-cell-selected-first,.st-selected-top-border{border-top:var(--st-border-width) solid var(--st-selected-border-top-color)}.st-selected-bottom-border{border-bottom:var(--st-border-width) solid var(--st-selected-border-bottom-color)}.st-selected-left-border{border-left:var(--st-border-width) solid var(--st-selected-border-left-color)}.st-selected-right-border{border-right:var(--st-border-width) solid var(--st-selected-border-right-color)}.st-horizontal-scrollbar-container{-ms-flex-negative:0;-webkit-box-align:center;-ms-flex-align:center;align-items:center;border-top:var(--st-border-width) solid var(--st-border-color);display:-webkit-box;display:-ms-flexbox;display:flex;flex-shrink:0}.st-horizontal-scrollbar-left{border-right:var(--st-border-width) solid var(--st-border-color)}.st-horizontal-scrollbar-right{border-left:var(--st-border-width) solid var(--st-border-color)}.st-horizontal-scrollbar-left,.st-horizontal-scrollbar-right{background-color:var(--st-scrollbar-bg-color)}.st-horizontal-scrollbar-middle{overflow:auto}.st-horizontal-scrollbar-middle>div{height:1px}.st-footer{background-color:var(--st-footer-background-color);border-top:var(--st-border-width) solid var(--st-border-color);padding:var(--st-spacing-medium)}.st-footer,.st-next-prev-btn{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex}.st-next-prev-btn{-webkit-box-pack:center;-ms-flex-pack:center;fill:var(--st-slate-600);background-color:initial;border:none;border-radius:var(--st-border-radius);cursor:pointer;justify-content:center;padding:var(--st-spacing-small);-webkit-transition:background-color var(--st-transition-duration) var(--st-transition-ease);transition:background-color var(--st-transition-duration) var(--st-transition-ease)}.disabled>.st-next-prev-icon{fill:var(--st-slate-400);cursor:not-allowed}.st-next-prev-btn:not(.disabled):hover{background-color:var(--st-slate-100)}.st-page-btn{background-color:initial;border:none;border-radius:var(--st-border-radius);color:var(--st-slate-600);cursor:pointer;margin-left:var(--st-spacing-small);padding:var(--st-spacing-small);-webkit-transition:background-color var(--st-transition-duration) var(--st-transition-ease);transition:background-color var(--st-transition-duration) var(--st-transition-ease)}.st-page-btn:hover{background-color:var(--st-button-hover-background-color)}.st-page-btn.active{background-color:var(--st-button-active-background-color);color:#fff}.editable-cell-input{border:var(--st-border-width) solid var(--st-border-color);border-radius:var(--st-border-radius);-webkit-box-shadow:var(--st-edit-cell-shadow-color);box-shadow:var(--st-edit-cell-shadow-color);-webkit-box-sizing:border-box;box-sizing:border-box;font-size:var(--st-font-size);height:100%;left:0;outline:none;padding:var(--st-cell-padding);position:absolute;top:0;width:100%;z-index:1}.editable-cell-input:focus{border:var(--st-border-width) solid var(--st-editable-cell-focus-border-color)}.st-column-editor{-ms-flex-negative:0;background:var(--st-footer-background-color);border-left:var(--st-border-width) solid var(--st-border-color);color:var(--st-slate-500);cursor:pointer;flex-shrink:0;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.st-column-editor-text{padding:var(--st-spacing-medium) var(--st-spacing-small);-webkit-writing-mode:vertical-rl;-ms-writing-mode:tb-rl;writing-mode:vertical-rl;z-index:2}.st-column-editor.open,.st-column-editor.open .st-column-editor-text{background-color:var(--st-column-editor-background-color)}.st-column-editor-popout{background-color:var(--st-column-editor-popout-background-color);height:100%;overflow:hidden;position:absolute;right:calc(100% + 1px);top:0;-webkit-transition:width var(--st-transition-duration) var(--st-transition-ease);transition:width var(--st-transition-duration) var(--st-transition-ease);width:0;z-index:1}.st-column-editor-popout-content{-webkit-box-orient:vertical;-webkit-box-direction:normal;border-left:var(--st-border-width) solid var(--st-border-color);display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:var(--st-spacing-small);height:100%;overflow:auto;padding:var(--st-spacing-medium) var(--st-spacing-small)}.st-column-editor-popout.open{width:200px}.st-column-editor-popout.left{-webkit-transform:translateX(-100%);transform:translateX(-100%)}.st-column-editor-popout.open.left{-webkit-transform:translateX(0);transform:translateX(0)}.st-checkbox-label{-webkit-box-align:center;-ms-flex-align:center;align-items:center;cursor:pointer;display:-webkit-box;display:-ms-flexbox;display:flex;gap:var(--st-spacing-medium)}.st-checkbox-input{display:none}.st-checkbox-custom{-webkit-box-align:center;-ms-flex-align:center;-webkit-box-pack:center;-ms-flex-pack:center;align-items:center;background-color:#fff;border:var(--st-border-width) solid var(--st-slate-300);border-radius:var(--st-border-radius);display:-webkit-box;display:-ms-flexbox;display:flex;height:24px;justify-content:center;-webkit-transition:background-color var(--st-transition-duration) var(--st-transition-ease),border-color var(--st-transition-duration) var(--st-transition-ease);transition:background-color var(--st-transition-duration) var(--st-transition-ease),border-color var(--st-transition-duration) var(--st-transition-ease);width:24px}.st-checkbox-custom.st-checked{background-color:var(--st-checkbox-checked-background-color);border-color:var(--st-checkbox-checked-border-color)}.st-checkbox-checkmark{border:solid #fff;border-width:0 2px 2px 0;height:11px;-webkit-transform:rotate(45deg);transform:rotate(45deg);width:6px}@-webkit-keyframes slide-in-left{0%{-webkit-transform:translateX(-100%);transform:translateX(-100%)}to{-webkit-transform:translateX(0);transform:translateX(0)}}@keyframes slide-in-left{0%{-webkit-transform:translateX(-100%);transform:translateX(-100%)}to{-webkit-transform:translateX(0);transform:translateX(0)}}@-webkit-keyframes slide-in-right{0%{-webkit-transform:translateX(100%);transform:translateX(100%)}to{-webkit-transform:translateX(0);transform:translateX(0)}}@keyframes slide-in-right{0%{-webkit-transform:translateX(100%);transform:translateX(100%)}to{-webkit-transform:translateX(0);transform:translateX(0)}}.st-group-header{-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:var(--st-header-background-color);border-bottom:var(--st-border-width) solid var(--st-border-color);color:var(--st-cell-color);cursor:pointer;display:-webkit-box;display:-ms-flexbox;display:flex;font-weight:var(--st-font-weight-bold);height:40px;-webkit-transition:background-color var(--st-transition-duration) var(--st-transition-ease);transition:background-color var(--st-transition-duration) var(--st-transition-ease);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.st-group-header:hover{background-color:var(--st-button-hover-background-color)}.st-group-header-content{gap:var(--st-spacing-medium)}.st-group-header-content,.st-group-toggle-icon{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex}.st-group-toggle-icon{-webkit-box-pack:center;-ms-flex-pack:center;font-size:.8em;height:16px;justify-content:center;width:16px}.st-group-name{font-weight:var(--st-font-weight-bold)}.st-group-count{color:var(--st-cell-odd-row-color);font-size:.9em}.st-group-header.expanded .st-group-toggle-icon{-webkit-transform:rotate(0deg);transform:rotate(0deg)}.st-group-header.collapsed .st-group-toggle-icon,.st-group-header.expanded .st-group-toggle-icon{-webkit-transition:-webkit-transform var(--st-transition-duration) var(--st-transition-ease);transition:-webkit-transform var(--st-transition-duration) var(--st-transition-ease);transition:transform var(--st-transition-duration) var(--st-transition-ease);transition:transform var(--st-transition-duration) var(--st-transition-ease),-webkit-transform var(--st-transition-duration) var(--st-transition-ease)}.st-group-header.collapsed .st-group-toggle-icon{-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}@-webkit-keyframes cell-flash{0%{background-color:initial}50%{background-color:var(--st-cell-flash-color)}to{background-color:initial}}@keyframes cell-flash{0%{background-color:initial}50%{background-color:var(--st-cell-flash-color)}to{background-color:initial}}.st-cell-updating{-webkit-animation:cell-flash .6s ease-in-out;animation:cell-flash .6s ease-in-out}
11
+ );--st-dragging-background-color:var(--st-violet-50);--st-selected-cell-background-color:var(--st-violet-50);--st-selected-first-cell-background-color:var(--st-violet-100);--st-footer-background-color:var(--st-stone-100);--st-cell-color:var(--st-stone-700);--st-cell-odd-row-color:var(--st-stone-700);--st-edit-cell-shadow:0 4px 6px -1px #7c3aed1a,0 2px 4px -1px #7c3aed0f;--st-selected-cell-color:var(--st-violet-800);--st-selected-first-cell-color:var(--st-violet-800);--st-resize-handle-color:var(--st-violet-400);--st-separator-border-color:var(--st-stone-200);--st-last-group-row-separator-border-color:var(--st-stone-300);--st-selected-border-top-color:var(--st-violet-500);--st-selected-border-bottom-color:var(--st-violet-500);--st-selected-border-left-color:var(--st-violet-500);--st-selected-border-right-color:var(--st-violet-500);--st-checkbox-checked-background-color:var(--st-violet-500);--st-checkbox-checked-border-color:var(--st-violet-600);--st-column-editor-background-color:var(--st-white);--st-column-editor-popout-background-color:var(--st-white);--st-button-hover-background-color:var(--st-violet-50);--st-button-active-background-color:var(--st-violet-600);--st-font-family:"Inter",sans-serif;--st-editable-cell-focus-border-color:var(--st-violet-500);--st-cell-flash-color:var(--st-violet-200)}.simple-table-root,.st-body-container,.st-body-main,.st-body-pinned-left,.st-body-pinned-right,.st-cell,.st-column-editor,.st-column-editor-popout,.st-content,.st-footer,.st-header-cell,.st-header-container,.st-horizontal-scrollbar-container,.st-horizontal-scrollbar-left,.st-horizontal-scrollbar-middle,.st-horizontal-scrollbar-right,.st-wrapper,.st-wrapper-container{-webkit-box-sizing:border-box;box-sizing:border-box;scrollbar-color:var(--st-scrollbar-thumb-color) var(--st-scrollbar-bg-color);scrollbar-width:thin}.simple-table-root{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:sans-serif;font-family:var(--st-font-family,sans-serif)}.st-wrapper{border:var(--st-border-width) solid var(--st-border-color);border-radius:var(--st-border-radius);max-height:100dvh;overflow:hidden;position:relative}.st-wrapper-container{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;height:100%}.st-content-wrapper,.st-wrapper-container{display:-webkit-box;display:-ms-flexbox;display:flex;position:relative;width:100%}.st-content-wrapper{-webkit-box-flex:1;-ms-flex:1;flex:1;min-height:0}.st-content{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.st-content,.st-header-container{display:-webkit-box;display:-ms-flexbox;display:flex}.st-header-container{background-color:var(--st-header-background-color)}.st-header-container.st-header-scroll-padding:after{-ms-flex-negative:0;background-color:var(--st-header-background-color);border-bottom:var(--st-border-width) solid var(--st-border-color);content:"";display:block;flex-shrink:0;width:default-width;width:var(--st-after-width,default-width)}.st-header-main,.st-header-pinned-left,.st-header-pinned-right{display:grid}.st-header-pinned-left{border-right:var(--st-border-width) solid var(--st-border-color)}.st-header-pinned-right{border-left:var(--st-border-width) solid var(--st-border-color)}.st-header-main{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;overflow:auto;scrollbar-width:none}.st-header-main::-webkit-scrollbar{display:none}.st-body-container{background-color:var(--st-even-row-background-color);display:-webkit-box;display:-ms-flexbox;display:flex;height:-webkit-max-content;height:-moz-max-content;height:max-content;overflow:auto;width:100%}.st-body-main,.st-body-pinned-left,.st-body-pinned-right{display:grid;height:-webkit-max-content;height:-moz-max-content;height:max-content}.st-body-pinned-left{-ms-flex-negative:0;border-right:var(--st-border-width) solid var(--st-border-color);flex-shrink:0}.st-body-main{overflow:auto;scrollbar-width:none}.st-body-pinned-right{-ms-flex-negative:0;border-left:var(--st-border-width) solid var(--st-border-color);flex-shrink:0}.st-row{display:grid;min-width:100%;position:absolute;-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-transition:background .2s ease;transition:background .2s ease}.st-row.even{background-color:var(--st-even-row-background-color)}.st-row.odd{background-color:var(--st-odd-row-background-color);color:var(--st-cell-odd-row-color)}.st-header-cell{-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:var(--st-header-background-color);border-bottom:var(--st-border-width) solid var(--st-border-color);border-top:var(--st-border-width) solid #0000;display:-webkit-box;display:-ms-flexbox;display:flex;font-weight:var(--st-font-weight-bold);gap:var(--st-spacing-small);position:sticky;top:0;z-index:1}.st-header-cell.clickable{cursor:pointer}.st-header-cell.draggable{cursor:-webkit-grab;cursor:grab}.st-cell,.st-header-cell{-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:var(--st-slate-800);display:-webkit-box;display:-ms-flexbox;display:flex;gap:var(--st-spacing-small);overflow:hidden}.st-cell.right-aligned,.st-header-cell.right-aligned{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;text-align:right}.st-cell.right-aligned>.st-cell-content,.st-header-cell.right-aligned>.st-header-label{text-align:right}.st-cell.center-aligned,.st-header-cell.center-aligned{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;text-align:center}.st-cell.center-aligned{padding-right:calc(var(--st-cell-padding) + var(--st-spacing-small) + var(--st-resize-handle-width) + var(--st-resize-handle-margin-right))}.st-cell.center-aligned>.st-cell-content,.st-header-cell.center-aligned>.st-header-label{text-align:center}.st-cell.clickable{cursor:pointer}.st-cell,.st-cell-editing,.st-header-cell{height:100%;width:100%}.st-cell-editing{position:relative}.st-header-label{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex}.st-header-label.right-aligned{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;text-align:right}.st-header-label.left-aligned{-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;text-align:left}.st-header-label.center-aligned{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;text-align:center}.st-cell-content,.st-header-label{-webkit-box-flex:1;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;height:100%;overflow:hidden;padding-left:var(--st-cell-padding);text-align:left;text-overflow:ellipsis;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;white-space:nowrap;width:100%}.st-header-label{color:var(--st-header-label-color);padding-right:var(--st-cell-padding)}.st-cell-content{color:var(--st-cell-color);padding-right:calc(var(--st-cell-padding) + var(--st-spacing-small) + var(--st-resize-handle-width) + var(--st-resize-handle-margin-right))}.st-cell-content.right-aligned{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;text-align:right}.st-cell-content.left-aligned{-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;text-align:left}.st-cell-content.center-aligned{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;text-align:center}.st-cell{border:var(--st-border-width) solid #0000;position:relative}.st-cell-depth-1{padding-left:calc(var(--st-cell-padding)*4)}.st-cell-depth-2{padding-left:calc(var(--st-cell-padding)*8)}.st-cell-depth-3{padding-left:calc(var(--st-cell-padding)*12)}.st-cell-depth-4{padding-left:calc(var(--st-cell-padding)*16)}.st-cell-depth-5{padding-left:calc(var(--st-cell-padding)*20)}.st-cell-depth-6{padding-left:calc(var(--st-cell-padding)*24)}.st-cell-depth-7{padding-left:calc(var(--st-cell-padding)*28)}.st-sort-icon-container{-webkit-box-align:center;-ms-flex-align:center;-webkit-box-pack:center;-ms-flex-pack:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;justify-content:center;margin-left:4px}.st-sort-icon{fill:var(--st-slate-500)}.st-header-resize-handle{background-color:var(--st-resize-handle-color);cursor:col-resize;height:calc(100% - 20px);margin-right:var(--st-resize-handle-margin-right);right:0;top:0;width:var(--st-resize-handle-width)}.st-row-separator{background-color:var(--st-separator-border-color);grid-column:1/-1;height:1px}.st-row-separator.st-last-group-row{background-color:var(--st-last-group-row-separator-border-color)}.st-dragging{background-color:var(--st-dragging-background-color)}.st-cell-selected{background-color:var(--st-selected-cell-background-color);color:var(--st-selected-cell-color)}.st-cell-selected-first{background-color:var(--st-selected-first-cell-background-color)!important;border-bottom:var(--st-border-width) solid var(--st-selected-border-bottom-color);border-left:var(--st-border-width) solid var(--st-selected-border-left-color);border-right:var(--st-border-width) solid var(--st-selected-border-right-color);color:var(--st-selected-first-cell-color)}.st-cell-selected-first,.st-selected-top-border{border-top:var(--st-border-width) solid var(--st-selected-border-top-color)}.st-selected-bottom-border{border-bottom:var(--st-border-width) solid var(--st-selected-border-bottom-color)}.st-selected-left-border{border-left:var(--st-border-width) solid var(--st-selected-border-left-color)}.st-selected-right-border{border-right:var(--st-border-width) solid var(--st-selected-border-right-color)}.st-horizontal-scrollbar-container{-ms-flex-negative:0;-webkit-box-align:center;-ms-flex-align:center;align-items:center;border-top:var(--st-border-width) solid var(--st-border-color);display:-webkit-box;display:-ms-flexbox;display:flex;flex-shrink:0}.st-horizontal-scrollbar-left{border-right:var(--st-border-width) solid var(--st-border-color)}.st-horizontal-scrollbar-right{border-left:var(--st-border-width) solid var(--st-border-color)}.st-horizontal-scrollbar-left,.st-horizontal-scrollbar-right{background-color:var(--st-scrollbar-bg-color)}.st-horizontal-scrollbar-middle{min-height:11px;overflow:auto}.st-horizontal-scrollbar-middle>div{height:1px}.st-footer{background-color:var(--st-footer-background-color);border-top:var(--st-border-width) solid var(--st-border-color);padding:var(--st-spacing-medium)}.st-footer,.st-next-prev-btn{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex}.st-next-prev-btn{-webkit-box-pack:center;-ms-flex-pack:center;fill:var(--st-slate-600);background-color:initial;border:none;border-radius:var(--st-border-radius);cursor:pointer;justify-content:center;padding:var(--st-spacing-small);-webkit-transition:background-color var(--st-transition-duration) var(--st-transition-ease);transition:background-color var(--st-transition-duration) var(--st-transition-ease)}.disabled>.st-next-prev-icon{fill:var(--st-slate-400);cursor:not-allowed}.st-next-prev-btn:not(.disabled):hover{background-color:var(--st-slate-100)}.st-page-btn{background-color:initial;border:none;border-radius:var(--st-border-radius);color:var(--st-slate-600);cursor:pointer;margin-left:var(--st-spacing-small);padding:var(--st-spacing-small);-webkit-transition:background-color var(--st-transition-duration) var(--st-transition-ease);transition:background-color var(--st-transition-duration) var(--st-transition-ease)}.st-page-btn:hover{background-color:var(--st-button-hover-background-color)}.st-page-btn.active{background-color:var(--st-button-active-background-color);color:#fff}.editable-cell-input{border:var(--st-border-width) solid var(--st-border-color);border-radius:var(--st-border-radius);-webkit-box-shadow:var(--st-edit-cell-shadow-color);box-shadow:var(--st-edit-cell-shadow-color);-webkit-box-sizing:border-box;box-sizing:border-box;font-size:var(--st-font-size);height:100%;left:0;outline:none;padding:var(--st-cell-padding);position:absolute;top:0;width:100%;z-index:1}.editable-cell-input:focus{border:var(--st-border-width) solid var(--st-editable-cell-focus-border-color)}.st-column-editor{-ms-flex-negative:0;background:var(--st-footer-background-color);border-left:var(--st-border-width) solid var(--st-border-color);color:var(--st-slate-500);cursor:pointer;flex-shrink:0;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.st-column-editor-text{padding:var(--st-spacing-medium) var(--st-spacing-small);-webkit-writing-mode:vertical-rl;-ms-writing-mode:tb-rl;writing-mode:vertical-rl;z-index:2}.st-column-editor.open,.st-column-editor.open .st-column-editor-text{background-color:var(--st-column-editor-background-color)}.st-column-editor-popout{background-color:var(--st-column-editor-popout-background-color);height:100%;overflow:hidden;position:absolute;right:calc(100% + 1px);top:0;-webkit-transition:width var(--st-transition-duration) var(--st-transition-ease);transition:width var(--st-transition-duration) var(--st-transition-ease);width:0;z-index:1}.st-column-editor-popout-content{-webkit-box-orient:vertical;-webkit-box-direction:normal;border-left:var(--st-border-width) solid var(--st-border-color);display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:var(--st-spacing-small);height:100%;overflow:auto;padding:var(--st-spacing-medium) var(--st-spacing-small)}.st-column-editor-popout.open{width:200px}.st-column-editor-popout.left{-webkit-transform:translateX(-100%);transform:translateX(-100%)}.st-column-editor-popout.open.left{-webkit-transform:translateX(0);transform:translateX(0)}.st-checkbox-label{-webkit-box-align:center;-ms-flex-align:center;align-items:center;cursor:pointer;display:-webkit-box;display:-ms-flexbox;display:flex;gap:var(--st-spacing-medium)}.st-checkbox-input{display:none}.st-checkbox-custom{-webkit-box-align:center;-ms-flex-align:center;-webkit-box-pack:center;-ms-flex-pack:center;align-items:center;background-color:#fff;border:var(--st-border-width) solid var(--st-slate-300);border-radius:var(--st-border-radius);display:-webkit-box;display:-ms-flexbox;display:flex;height:24px;justify-content:center;-webkit-transition:background-color var(--st-transition-duration) var(--st-transition-ease),border-color var(--st-transition-duration) var(--st-transition-ease);transition:background-color var(--st-transition-duration) var(--st-transition-ease),border-color var(--st-transition-duration) var(--st-transition-ease);width:24px}.st-checkbox-custom.st-checked{background-color:var(--st-checkbox-checked-background-color);border-color:var(--st-checkbox-checked-border-color)}.st-checkbox-checkmark{border:solid #fff;border-width:0 2px 2px 0;height:11px;-webkit-transform:rotate(45deg);transform:rotate(45deg);width:6px}@-webkit-keyframes slide-in-left{0%{-webkit-transform:translateX(-100%);transform:translateX(-100%)}to{-webkit-transform:translateX(0);transform:translateX(0)}}@keyframes slide-in-left{0%{-webkit-transform:translateX(-100%);transform:translateX(-100%)}to{-webkit-transform:translateX(0);transform:translateX(0)}}@-webkit-keyframes slide-in-right{0%{-webkit-transform:translateX(100%);transform:translateX(100%)}to{-webkit-transform:translateX(0);transform:translateX(0)}}@keyframes slide-in-right{0%{-webkit-transform:translateX(100%);transform:translateX(100%)}to{-webkit-transform:translateX(0);transform:translateX(0)}}.st-group-header{-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:var(--st-header-background-color);border-bottom:var(--st-border-width) solid var(--st-border-color);color:var(--st-cell-color);cursor:pointer;display:-webkit-box;display:-ms-flexbox;display:flex;font-weight:var(--st-font-weight-bold);height:40px;-webkit-transition:background-color var(--st-transition-duration) var(--st-transition-ease);transition:background-color var(--st-transition-duration) var(--st-transition-ease);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.st-group-header:hover{background-color:var(--st-button-hover-background-color)}.st-group-header-content{gap:var(--st-spacing-medium)}.st-group-header-content,.st-group-toggle-icon{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex}.st-group-toggle-icon{-webkit-box-pack:center;-ms-flex-pack:center;font-size:.8em;height:16px;justify-content:center;width:16px}.st-group-name{font-weight:var(--st-font-weight-bold)}.st-group-count{color:var(--st-cell-odd-row-color);font-size:.9em}.st-group-header.expanded .st-group-toggle-icon{-webkit-transform:rotate(0deg);transform:rotate(0deg)}.st-group-header.collapsed .st-group-toggle-icon,.st-group-header.expanded .st-group-toggle-icon{-webkit-transition:-webkit-transform var(--st-transition-duration) var(--st-transition-ease);transition:-webkit-transform var(--st-transition-duration) var(--st-transition-ease);transition:transform var(--st-transition-duration) var(--st-transition-ease);transition:transform var(--st-transition-duration) var(--st-transition-ease),-webkit-transform var(--st-transition-duration) var(--st-transition-ease)}.st-group-header.collapsed .st-group-toggle-icon{-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}@-webkit-keyframes cell-flash{0%{background-color:initial}50%{background-color:var(--st-cell-flash-color)}to{background-color:initial}}@keyframes cell-flash{0%{background-color:initial}50%{background-color:var(--st-cell-flash-color)}to{background-color:initial}}.st-cell-updating{-webkit-animation:cell-flash .6s ease-in-out;animation:cell-flash .6s ease-in-out}
@@ -0,0 +1,11 @@
1
+ import { Dispatch, SetStateAction } from "react";
2
+ import { HeaderObject } from "..";
3
+ export type HandleResizeStartProps = {
4
+ event: MouseEvent;
5
+ forceUpdate: () => void;
6
+ header: HeaderObject;
7
+ gridColumnEnd: number;
8
+ gridColumnStart: number;
9
+ setIsWidthDragging: Dispatch<SetStateAction<boolean>>;
10
+ startWidth: number;
11
+ };
@@ -0,0 +1,2 @@
1
+ import { HandleResizeStartProps } from "../types/HandleResizeStartProps";
2
+ export declare const handleResizeStart: ({ event, forceUpdate, header, gridColumnEnd, gridColumnStart, setIsWidthDragging, startWidth, }: HandleResizeStartProps) => void;
@@ -1,4 +1,3 @@
1
- import { Dispatch, SetStateAction } from "react";
2
1
  import HeaderObject from "../types/HeaderObject";
3
2
  import SortConfig from "../types/SortConfig";
4
3
  import Row from "../types/Row";
@@ -6,14 +5,3 @@ export declare const handleSort: (headers: HeaderObject[], rows: Row[], sortConf
6
5
  sortedData: Row[];
7
6
  newSortConfig: SortConfig;
8
7
  };
9
- export declare const handleResizeStart: ({ colIndex, event, forceUpdate, header, headersRef, gridColumnEnd, gridColumnStart, setIsWidthDragging, startWidth, }: {
10
- colIndex: number;
11
- event: MouseEvent;
12
- forceUpdate: () => void;
13
- header: HeaderObject;
14
- headersRef: React.RefObject<HeaderObject[]>;
15
- gridColumnEnd: number;
16
- gridColumnStart: number;
17
- setIsWidthDragging: Dispatch<SetStateAction<boolean>>;
18
- startWidth: number;
19
- }) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "simple-table-core",
3
- "version": "0.7.62",
3
+ "version": "0.7.64",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.es.js",
6
6
  "types": "dist/index.d.ts",