simple-table-core 1.0.11 → 1.0.13

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.
Files changed (34) hide show
  1. package/README.md +21 -42
  2. package/dist/components/simple-table/RenderCells.d.ts +1 -2
  3. package/dist/components/simple-table/SimpleTable.d.ts +3 -0
  4. package/dist/components/simple-table/TableHeader.d.ts +1 -1
  5. package/dist/components/simple-table/TableHeaderCell.d.ts +0 -1
  6. package/dist/components/simple-table/TableHeaderSection.d.ts +1 -1
  7. package/dist/components/simple-table/TableHorizontalScrollbar.d.ts +2 -3
  8. package/dist/components/simple-table/TableRow.d.ts +1 -2
  9. package/dist/components/simple-table/TableSection.d.ts +1 -2
  10. package/dist/components/simple-table/table-column-editor/ColumnEditorCheckbox.d.ts +2 -9
  11. package/dist/components/simple-table/table-column-editor/TableColumnEditor.d.ts +1 -8
  12. package/dist/components/simple-table/table-column-editor/TableColumnEditorPopout.d.ts +1 -8
  13. package/dist/components/simple-table/table-column-editor/columnEditorUtils.d.ts +3 -9
  14. package/dist/context/TableContext.d.ts +4 -7
  15. package/dist/hooks/useDragHandler.d.ts +1 -1
  16. package/dist/hooks/useSortableData.d.ts +0 -2
  17. package/dist/index.d.ts +2 -1
  18. package/dist/index.es.js +1 -1
  19. package/dist/index.js +1 -1
  20. package/dist/styles.css +1 -1
  21. package/dist/types/DragHandlerProps.d.ts +1 -1
  22. package/dist/types/HandleResizeStartProps.d.ts +2 -4
  23. package/dist/types/HeaderObject.d.ts +5 -0
  24. package/dist/types/SharedTableProps.d.ts +1 -2
  25. package/dist/types/TableCellProps.d.ts +1 -1
  26. package/dist/types/TableHeaderProps.d.ts +1 -2
  27. package/dist/types/TableHeaderSectionProps.d.ts +1 -2
  28. package/dist/types/TableRowProps.d.ts +0 -2
  29. package/dist/utils/cellUtils.d.ts +1 -2
  30. package/dist/utils/columnIndicesUtils.d.ts +2 -5
  31. package/dist/utils/columnUtils.d.ts +1 -2
  32. package/dist/utils/generalUtils.d.ts +3 -0
  33. package/dist/utils/resizeUtils.d.ts +2 -16
  34. package/package.json +8 -5
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");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=t(n),o=function(){return o=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},o.apply(this,arguments)};function i(e,n,t,r){return new(t||(t=Promise))((function(o,i){function a(e){try{l(r.next(e))}catch(e){i(e)}}function s(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,s)}l((r=r.apply(e,n||[])).next())}))}function a(e,n){var t,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(i=0)),i;)try{if(t=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,r=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){i.label=s[1];break}if(6===s[0]&&i.label<o[1]){i.label=o[1],o=s;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(s);break}o[2]&&i.ops.pop(),i.trys.pop();continue}s=n.call(e,i)}catch(e){s=[6,e],r=0}finally{t=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function s(e,n,t){if(t||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return e.concat(r||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var l=function(e){var n=e.accessor,t=e.rowIndex;return"cell-".concat(n,"-").concat(t)},c=function(e){var n=e.hiddenColumns,t=e.header,r=e.pinned;return n[t.accessor]?null:!r&&!t.pinned||t.pinned===r||null},u=function(e){var n=e.rowId,t=e.accessor;return"".concat(n,"-").concat(t)},d=function(e){return e.hide?[]:e.children&&0!==e.children.length?e.children.flatMap((function(e){return d(e)})):[e]},h=function(e){if(e.hide)return 0;if("number"==typeof e.width)return e.width;if("string"==typeof e.width&&e.width.endsWith("px"))return parseFloat(e.width);var n=document.getElementById(l({accessor:e.accessor,rowIndex:0}));return(null==n?void 0:n.offsetWidth)||150},f=function(e){var n,t=e.width;"string"==typeof t&&t.includes("fr")&&(e.width=(null===(n=document.getElementById(l({accessor:e.accessor,rowIndex:0})))||void 0===n?void 0:n.offsetWidth)||150),e.children&&e.children.forEach((function(e){f(e)}))},v=function(e){return"number"==typeof e.minWidth?e.minWidth:40},p=function(e,n,t){return t&&void 0!==e[t]?e[t]:n},m=function(e){var n=e.depth,t=void 0===n?0:n,r=e.expandAll,o=void 0!==r&&r,i=e.expandedRows,a=e.rowGrouping,s=void 0===a?[]:a,l=e.rowIdAccessor,c=e.rows,u=[],d=function(e,n,t){void 0===t&&(t=0);var r=t;return e.forEach((function(t,a){var c=p(t,a,l),h=s[n],f=0===n&&a===e.length-1;u.push({row:t,depth:n,groupingKey:h,position:r,isLastGroupRow:f}),r++;var v=String(c);if((o?!i.has(v):i.has(v))&&n<s.length){var m=function(e,n){var t=e[n];return Array.isArray(t)?t:[]}(t,h);m.length>0&&(r=d(m,n+1,r))}})),r};return d(c,t),u},g=function(e){var n=e.rowIndex,t=e.colIndex,r=e.rowId;return"".concat(n,"-").concat(t,"-").concat(r)},w=n.createContext(void 0),x=function(n){var t=n.children,r=n.value;return e.jsx(w.Provider,o({value:r},{children:t}))},C=function(){var e=n.useContext(w);if(void 0===e)throw new Error("useTableContext must be used within a TableProvider");return e},b=function(t){var r=t.currentPage,s=t.hideFooter,l=t.onPageChange,c=t.onNextPage,u=t.shouldPaginate,d=t.totalPages,h=C(),f=h.nextIcon,v=h.prevIcon,p=n.useState(!0),m=p[0],g=p[1],w=!(r>1),x=!(r<d)&&!c||!m&&r===d;if(s||!u)return null;var b=function(){if(d<=15)return Array.from({length:d},(function(e,n){return n+1}));var e,n,t=[],o=15;if(r<=Math.ceil(7.5))e=1,n=14;else if(r>=d-Math.floor(7.5))e=Math.max(1,d-o+1),n=d;else{var i=Math.floor(7);e=r-i,n=r+(o-i-1)}for(var a=e;a<=n;a++)t.push(a);return n<d-1&&(t.push(-1),t.push(d)),t}();return e.jsxs("div",o({className:"st-footer"},{children:[e.jsx("button",o({className:"st-next-prev-btn ".concat(w?"disabled":""),onClick:function(){var e=r-1;e>=1&&l(e)},disabled:w},{children:v})),e.jsx("button",o({className:"st-next-prev-btn ".concat(x?"disabled":""),onClick:function(){return i(void 0,void 0,void 0,(function(){var e,n;return a(this,(function(t){switch(t.label){case 0:return e=r===d,n=r+1,c&&e?[4,c(r)]:[3,2];case 1:if(!t.sent())return g(!1),[2];t.label=2;case 2:return(n<=d||c)&&l(n),[2]}}))}))},disabled:x},{children:f})),b.map((function(n,t){return n<0?e.jsx("span",o({className:"st-page-ellipsis"},{children:"..."}),"ellipsis-".concat(n)):e.jsx("button",o({onClick:function(){return function(e){e>=1&&e<=d&&l(e)}(n)},className:"st-page-btn ".concat(r===n?"active":"")},{children:n}),"page-".concat(n))}))]}))},y=function(n){var t=n.className;return e.jsx("svg",o({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"})}))},I=function(n){var t=n.className;return e.jsx("svg",o({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(e){return e.position*(e.rowHeight+1)-1},j=function(e){return e.position*(e.rowHeight+1)},R=function(t){var r=t.children,i=t.onClose,a=t.open,s=t.overflow,l=void 0===s?"auto":s,c=t.setOpen,u=t.width,d=t.containerRef,h=t.positioning,f=void 0===h?"fixed":h,v=C().mainBodyRef,p=n.useRef(null),m=n.useRef(null),g=n.useState("bottom-left"),w=g[0],x=g[1],b=n.useState({}),y=b[0],I=b[1],S=n.useState(!1),j=S[0],R=S[1];return n.useEffect((function(){a&&p.current?(R(!1),!m.current&&p.current.parentElement&&(m.current=p.current.parentElement),requestAnimationFrame((function(){if(p.current&&m.current){var e,n=p.current,t=m.current.getBoundingClientRect(),r=n.offsetHeight,o=u||n.offsetWidth,i=(e=(null==d?void 0:d.current)?d.current.getBoundingClientRect():(null==v?void 0:v.current)?v.current.getBoundingClientRect():{top:0,right:window.innerWidth,bottom:window.innerHeight,left:0,width:window.innerWidth,height:window.innerHeight,x:0,y:0,toJSON:function(){}}).bottom-t.bottom,a=t.top-e.top,s="bottom",l={};(r>i&&r<=a||r>i&&a>i)&&(s="top");var c="left";o>e.right-t.right+t.width&&(c="right"),"fixed"===f?("bottom"===s?l.top=t.bottom+4:l.bottom=window.innerHeight-t.top+4,"left"===c?l.left=t.left:l.right=window.innerWidth-t.right):("bottom"===s?l.top=t.height+4:l.bottom=t.height+4,"left"===c?l.left=0:l.right=0),x("".concat(s,"-").concat(c)),I(l),R(!0)}}))):a||R(!1)}),[a,u,d,v,f]),n.useEffect((function(){var e=function(e){if(a&&p.current){var n=e.target;p.current&&!p.current.contains(n)&&(c(!1),null==i||i())}};return a&&window.addEventListener("scroll",e,!0),function(){window.removeEventListener("scroll",e,!0)}}),[a,i,c]),n.useEffect((function(){var e=function(e){p.current&&!p.current.contains(e.target)&&(c(!1),null==i||i())};return a&&document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}}),[i,a,c]),n.useEffect((function(){var e=function(e){"Escape"===e.key&&a&&(c(!1),null==i||i())};return a&&document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[i,a,c]),a?e.jsx("div",o({ref:p,className:"st-dropdown-content st-dropdown-".concat(w),onClick:function(e){return e.stopPropagation()},style:o(o({position:f,width:u?"".concat(u,"px"):"auto",visibility:j?"visible":"hidden"},y),{overflow:l})},{children:r})):null},E=function(n){var t=n.children,r=n.onClick,i=n.isSelected,a=void 0!==i&&i,s=n.disabled,l=void 0!==s&&s,c=n.className,u=void 0===c?"":c;return e.jsx("div",o({className:"st-dropdown-item ".concat(a?"selected":""," ").concat(l?"disabled":""," ").concat(u),onClick:function(){!l&&r&&r()},role:"option","aria-selected":a,"aria-disabled":l},{children:t}))},k=function(t){var r=t.onBlur,i=t.onChange,a=t.open,s=t.setOpen,l=t.value,c=n.useState(l),u=c[0],d=c[1],h=function(e){d(e),i(e),s(!1),r()};return e.jsxs(R,o({open:a,onClose:function(){r()},setOpen:s,width:120},{children:[e.jsx(E,o({isSelected:!0===u,onClick:function(){return h(!0)}},{children:"True"})),e.jsx(E,o({isSelected:!1===u,onClick:function(){return h(!1)}},{children:"False"}))]}))},N=function(t){var r=t.defaultValue,o=t.onBlur,i=t.onChange,a=n.useRef(null);return e.jsx("input",{className:"editable-cell-input",ref:a,autoFocus:!0,type:"text",defaultValue:null!=r?r:"",onBlur:o,onChange:function(e){var n=e.target.value;i(n)},onKeyDown:function(e){e.stopPropagation(),"Enter"!==e.key&&"Escape"!==e.key||o()},onMouseDown:function(e){e.stopPropagation()}})},F=function(t){var r=t.defaultValue,o=t.onBlur,i=t.onChange,a=n.useRef(null);return e.jsx("input",{className:"editable-cell-input",ref:a,autoFocus:!0,defaultValue:r.toString(),onBlur:o,onChange:function(e){var n=e.target.value;/^\d*\.?\d*$/.test(n)&&i(n)},onKeyDown:function(e){e.stopPropagation(),"Enter"!==e.key&&"Escape"!==e.key||o()},onMouseDown:function(e){e.stopPropagation()}})},M=function(t){var r,i,a=t.onChange,s=t.onClose,l=t.value,c=C(),u=c.nextIcon,d=c.prevIcon,h=n.useState(l||new Date),f=h[0],v=h[1],p=n.useState("days"),m=p[0],g=p[1],w=function(e,n){return new Date(e,n+1,0).getDate()};return e.jsxs("div",o({className:"st-datepicker"},{children:[e.jsxs("div",o({className:"st-datepicker-header"},{children:["days"===m&&e.jsxs(e.Fragment,{children:[e.jsx("button",o({onClick:function(){v(new Date(f.getFullYear(),f.getMonth()-1,1))},className:"st-datepicker-nav-btn"},{children:d})),e.jsxs("div",o({className:"st-datepicker-header-label",onClick:function(){return g("months")}},{children:[(i=f,i.toLocaleString("default",{month:"long"}))," ",f.getFullYear()]})),e.jsx("button",o({onClick:function(){v(new Date(f.getFullYear(),f.getMonth()+1,1))},className:"st-datepicker-nav-btn"},{children:u}))]}),"months"===m&&e.jsx("div",o({className:"st-datepicker-header-label",onClick:function(){return g("years")}},{children:f.getFullYear()})),"years"===m&&e.jsx("div",o({className:"st-datepicker-header-label"},{children:"Select Year"}))]})),e.jsxs("div",o({className:"st-datepicker-grid st-datepicker-".concat(m,"-grid")},{children:["days"===m&&function(){var n=[],t=f.getFullYear(),r=f.getMonth(),i=w(t,r),c=function(e,n){return new Date(e,n,1).getDay()}(t,r),u=w(t,r-1);["Su","Mo","Tu","We","Th","Fr","Sa"].forEach((function(t,r){n.push(e.jsx("div",o({className:"st-datepicker-weekday"},{children:t}),"header-".concat(r)))}));for(var d=function(t){var r=u-c+t+1;n.push(e.jsx("div",o({className:"st-datepicker-day other-month",onClick:function(){return function(e){var n=new Date(f.getFullYear(),f.getMonth()-1,e);v(n),a(n),null==s||s()}(r)}},{children:r}),"prev-".concat(r)))},h=0;h<c;h++)d(h);for(var p=function(i){var c=i===(new Date).getDate()&&r===(new Date).getMonth()&&t===(new Date).getFullYear(),u=i===new Date(l).getDate()&&r===new Date(l).getMonth()&&t===new Date(l).getFullYear();n.push(e.jsx("div",o({className:"st-datepicker-day ".concat(c?"today":""," ").concat(u?"selected":""),onClick:function(){return function(e){var n=new Date(f.getFullYear(),f.getMonth(),e);v(n),a(n),null==s||s()}(i)}},{children:i}),"day-".concat(i)))},m=1;m<=i;m++)p(m);var g=35-(c+i),x=function(t){n.push(e.jsx("div",o({className:"st-datepicker-day other-month",onClick:function(){return function(e){var n=new Date(f.getFullYear(),f.getMonth()+1,e);v(n),a(n),null==s||s()}(t)}},{children:t}),"next-".concat(t)))};for(m=1;m<=g;m++)x(m);return n}(),"months"===m&&(r=[],Array.from({length:12},(function(e,n){return new Date(2e3,n,1).toLocaleString("default",{month:"short"})})).forEach((function(n,t){var i=t===f.getMonth();r.push(e.jsx("div",o({className:"st-datepicker-month ".concat(i?"selected":""),onClick:function(){return function(e){v(new Date(f.getFullYear(),e,1)),g("days")}(t)}},{children:n}),"month-".concat(t)))})),r),"years"===m&&function(){for(var n=[],t=f.getFullYear(),r=t-6,i=function(r){var i=r===t;n.push(e.jsx("div",o({className:"st-datepicker-year ".concat(i?"selected":""),onClick:function(){return function(e){v(new Date(e,f.getMonth(),1)),g("months")}(r)}},{children:r}),"year-".concat(r)))},a=r;a<r+12;a++)i(a);return n}()]})),e.jsx("div",o({className:"st-datepicker-footer"},{children:e.jsx("button",o({className:"st-datepicker-today-btn",onClick:function(){var e=new Date;v(e),a(e),null==s||s()}},{children:"Today"}))}))]}))},W=function(e){if(!e)return new Date;var n=e.toString().split("-").map(Number),t=n[0],r=n[1],o=n[2],i=new Date;return i.setFullYear(t),i.setMonth(r-1),i.setDate(o),isNaN(i.getTime())?new Date:i},D=function(t){var r=t.onBlur,i=t.onChange,a=t.open,s=t.setOpen,l=t.value;n.useEffect((function(){var e=setTimeout((function(){var e=document.querySelector(".st-dropdown-container");e instanceof HTMLElement&&e.focus()}),0);return function(){return clearTimeout(e)}}),[]);var c=function(){r()};return e.jsx(R,o({open:a,onClose:c,setOpen:s,width:280},{children:e.jsx(M,{value:W(l),onChange:function(e){var n=e.toISOString().split("T")[0];i(n),s(!1),r()},onClose:c})}))},T=function(t){var r=t.onBlur,i=t.onChange,a=t.open,s=t.options,l=t.setOpen,c=t.value,u=n.useState(c||""),d=u[0],h=u[1];return e.jsx(R,o({open:a,onClose:function(){r()},setOpen:l,width:150},{children:e.jsx("div",o({className:"st-enum-dropdown-content"},{children:s.map((function(n){return e.jsx(E,o({isSelected:d===n.value,onClick:function(){return e=n.value,h(e),i(e),l(!1),void r();var e}},{children:n.label}),n.value)}))}))}))},L=function(n){var t=n.enumOptions,r=void 0===t?[]:t,o=n.onChange,i=n.setIsEditing,a=n.type,s=void 0===a?"string":a,l=n.value,c=function(){i(!1)};if("boolean"===s&&"boolean"==typeof l)return e.jsx(k,{onBlur:c,onChange:function(e){return o(e)},open:!0,setOpen:i,value:l});if("date"===s)return e.jsx(D,{onBlur:c,onChange:o,open:!0,setOpen:i,value:l});if("enum"===s){var u="string"==typeof l?l:"";return e.jsx(T,{onBlur:c,onChange:o,open:!0,options:r,setOpen:i,value:u})}if("number"===s&&"number"==typeof l)return e.jsx(F,{defaultValue:l,onBlur:c,onChange:function(e){var n=""===e?0:parseFloat(e);o(isNaN(n)?0:n)}});var d=null==l?"":String(l);return e.jsx(N,{defaultValue:d,onBlur:c,onChange:o})},H=0,B=function(){return function(e){var n=e.callback,t=e.callbackProps,r=e.limit,o=Date.now();(0===H||o-H>=r)&&(H=o,n(t))}},A=function(e){if(null===e||"object"!=typeof e)return e;if(Array.isArray(e))return e.map(A);var n={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=A(e[t]));return n},O=Date.now(),P={screenX:0,screenY:0},q=function(e,n,t){void 0===t&&(t=[]);for(var r=0;r<e.length;r++){var o=e[r];if(o.accessor===n)return s(s([],t,!0),[r],!1);if(o.children&&o.children.length>0){var i=q(o.children,n,s(s([],t,!0),[r],!1));if(i)return i}}return null};var z=function(e){var t,r,o=e.draggedHeaderRef,i=e.headersRef,a=e.hoveredHeaderRef,s=e.onColumnOrderChange,l=e.onTableHeaderDragEnd,c=(t=i.current,r=n.useRef(t),n.useEffect((function(){JSON.stringify(r.current)!==JSON.stringify(t)&&(r.current=t)}),[t]),r.current);return{handleDragStart:function(e){o.current=e,O=Date.now()},handleDragOver:function(e){var n,t,r=e.event,s=e.hoveredHeader;if(r.preventDefault(),i.current){var u=r.currentTarget.getAnimations().some((function(e){return"running"===e.playState})),d=r.screenX,h=r.screenY,f=Math.sqrt(Math.pow(d-P.screenX,2)+Math.pow(h-P.screenY,2));a.current=s;var v=i.current,p=q(v,(null===(n=o.current)||void 0===n?void 0:n.accessor)||""),m=q(v,s.accessor);if(p&&m){var g=p.length,w=m.length,x=m;if(g!==w){var C=w-g;C>0&&(x=m.slice(0,-C))}console.log("targetHoveredIndexPath",x);var b=function(e,n,t){var r=A(e),o=!1;function i(e,n){for(var t=e,r=0;r<n.length-1;r++)t=t[n[r]].children;return t[n[n.length-1]]}function a(e,n,t){for(var r=e,i=0;i<n.length-1;i++){if(!r[n[i]].children){o=!0;break}r=r[n[i]].children}r[n[n.length-1]]=t}var s=i(r,n);return a(r,n,i(r,t)),a(r,t,s),{newHeaders:r,emergencyBreak:o}}(v,p,x),y=b.newHeaders,I=b.emergencyBreak;if(!(u||s.accessor===(null===(t=o.current)||void 0===t?void 0:t.accessor)||null===o.current||f<10||0===p.length||0===x.length||JSON.stringify(y)===JSON.stringify(i.current)||I)){var S=Date.now();JSON.stringify(y)===JSON.stringify(c)&&(S-O<1500||f<40)||(O=S,P={screenX:d,screenY:h},l(y))}}}},handleDragEnd:function(){o.current=null,a.current=null,null==s||s(i.current)}}},U=function(e){var n=e.content,t=e.header;return"boolean"==typeof n?n?"True":"False":"date"===t.type&&null!==n&&("string"==typeof n||"number"==typeof n||"object"==typeof n&&n instanceof Date)?new Date(n).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):n},Y=n.forwardRef((function(t,r){var i=t.borderClass,a=t.colIndex,s=t.header,c=t.isHighlighted,d=t.isInitialFocused,h=t.nestedIndex,f=t.rowIndex,v=t.visibleRow,m=C(),g=m.cellRegistry,w=m.cellUpdateFlash,x=m.draggedHeaderRef,b=m.expandIcon,y=m.expandedRows,I=m.handleMouseDown,S=m.handleMouseOver,j=m.headersRef,R=m.hoveredHeaderRef,E=m.isCopyFlashing,k=m.isWarningFlashing,N=m.onCellEdit,F=m.onTableHeaderDragEnd,M=m.rowGrouping,W=m.rowIdAccessor,D=m.setExpandedRows,T=m.theme,H=m.useOddColumnBackground,A=v.depth,O=v.row,P=n.useState(O[s.accessor]),q=P[0],Y=P[1],K=n.useState(!1),G=K[0],V=K[1],X=n.useState(!1),J=X[0],$=X[1],_=n.useRef(null),Q=p(O,f,W),Z=M&&M[A],ee=!!Z&&function(e,n){if(!n)return!1;var t=e[n];return Array.isArray(t)&&t.length>0}(O,Z),ne=y.has(String(Q)),te=E({rowIndex:f,colIndex:a,rowId:Q}),re=k({rowIndex:f,colIndex:a,rowId:Q}),oe=z({draggedHeaderRef:x,headersRef:j,hoveredHeaderRef:R,onTableHeaderDragEnd:F}).handleDragOver,ie=B(),ae="cell-".concat(f,"-").concat(a),se=u({rowId:Q,accessor:s.accessor});n.useEffect((function(){if(g){var e="".concat(Q,"-").concat(s.accessor);return g.set(e,{updateContent:function(e){q!==e?(Y(e),w&&($(!0),_.current&&clearTimeout(_.current),_.current=setTimeout((function(){$(!1)}),800))):Y(e)}}),function(){g.delete(e),_.current&&clearTimeout(_.current)}}}),[g,w,Q,s.accessor,q]),n.useEffect((function(){if(J){var e=setTimeout((function(){$(!1)}),850);return function(){return clearTimeout(e)}}}),[J]),n.useEffect((function(){Y(O[s.accessor])}),[O,s.accessor]);var le="boolean"===s.type||"date"===s.type||"enum"===s.type,ce=Boolean(null==s?void 0:s.isEditable),ue="st-cell ".concat(A>0&&s.expandable?"st-cell-depth-".concat(A):""," ").concat(c?d?"st-cell-selected-first ".concat(i):"st-cell-selected ".concat(i):""," ").concat(ce?"clickable":""," ").concat(J?d?"st-cell-updating-first":"st-cell-updating":""," ").concat(te?d?"st-cell-copy-flash-first":"st-cell-copy-flash":""," ").concat(re?d?"st-cell-warning-flash-first":"st-cell-warning-flash":""," ").concat(H?h%2==0?"even-column":"odd-column":""),de=n.useCallback((function(e){Y(e),O[s.accessor]=e,null==N||N({accessor:s.accessor,newValue:e,row:O,rowIndex:f})}),[s.accessor,N,O,f]),he=n.useCallback((function(){D((function(e){var n=new Set(e),t=String(Q);return n.has(t)?n.delete(t):n.add(t),n}))}),[Q,D]);return G&&!le?e.jsx("div",o({className:"st-cell-editing",id:l({accessor:s.accessor,rowIndex:f+1}),onMouseDown:function(e){return e.stopPropagation()},onKeyDown:function(e){return e.stopPropagation()}},{children:e.jsx(L,{enumOptions:s.enumOptions,onChange:de,setIsEditing:V,type:s.type,value:q})})):e.jsxs("div",o({className:ue,id:ae,onDoubleClick:function(){return s.isEditable&&V(!0)},onMouseDown:function(){G||I({rowIndex:f,colIndex:a,rowId:Q})},onMouseOver:function(){G||S({rowIndex:f,colIndex:a,rowId:Q})},onDragOver:function(e){return ie({callback:oe,callbackProps:{event:e,hoveredHeader:s},limit:50})},onKeyDown:function(e){G||"F2"!==e.key&&"Enter"!==e.key||!s.isEditable||G||(e.preventDefault(),V(!0))},ref:r,"data-row-index":f,"data-col-index":a,"data-row-id":Q,"data-accessor":s.accessor},{children:[s.expandable&&ee?e.jsx("div",o({className:"st-icon-container st-expand-icon-container ".concat(ne?"expanded":"collapsed"),onClick:he},{children:b})):null,e.jsx("span",o({className:"st-cell-content ".concat("right"===s.align?"right-aligned":"center"===s.align?"center-aligned":"left-aligned")},{children:e.jsx("span",{children:s.cellRenderer?s.cellRenderer({accessor:s.accessor,colIndex:a,row:O,theme:T}):U({content:q,header:s})})})),G&&le&&e.jsx(L,{enumOptions:s.enumOptions,onChange:de,setIsEditing:V,type:s.type,value:q})]}),se)})),K=function(n){var t=n.columnIndexStart,r=n.columnIndices,o=n.headers,i=n.hiddenColumns,a=n.pinned,s=n.rowIndex,u=n.rowIndices,d=n.visibleRow,h=o.filter((function(e){return c({hiddenColumns:i,header:e,pinned:a})}));return e.jsx(e.Fragment,{children:h.map((function(n,c){return e.jsx(G,{columnIndices:r,header:n,headers:o,hiddenColumns:i,nestedIndex:c+(null!=t?t:0),pinned:a,rowIndex:s,rowIndices:u,visibleRow:d},l({accessor:n.accessor,rowIndex:s+1}))}))})},G=function(t){var r=t.columnIndices,o=t.header,i=t.headers,a=t.hiddenColumns,s=t.nestedIndex,u=t.pinned,d=t.rowIndex,h=t.rowIndices,f=t.visibleRow,v=r[o.accessor],m=C(),g=m.getBorderClass,w=m.isSelected,x=m.isInitialFocusedCell,b=m.rowIdAccessor;if(o.children){var y=o.children.filter((function(e){return c({hiddenColumns:a,header:e,pinned:u})}));return e.jsx(n.Fragment,{children:y.map((function(n){return e.jsx(G,{columnIndices:r,header:n,headers:i,hiddenColumns:a,nestedIndex:s,pinned:u,rowIndex:d,rowIndices:h,visibleRow:f},l({accessor:n.accessor,rowIndex:d+1}))}))})}var I=p(f.row,d,b),S={rowIndex:d,colIndex:v,rowId:I},j=g(S),R=w(S),E=x(S);return e.jsx(Y,{borderClass:j,colIndex:v,header:o,isHighlighted:R,isInitialFocused:E,nestedIndex:s,rowIndex:d,visibleRow:f},l({accessor:o.accessor,rowIndex:d+1}))},V=function(n){var t=n.columnIndices,r=n.columnIndexStart,i=n.gridTemplateColumns,a=n.headers,s=n.hiddenColumns,l=n.hoveredIndex,c=n.index,u=n.pinned,d=n.rowHeight,h=n.rowIndices,f=n.setHoveredIndex,v=n.visibleRow,p=C().useHoverRowBackground,m=v.position,g=m%2==0;return e.jsx("div",o({className:"st-row ".concat(g?"even":"odd"," ").concat(l===c&&p?"hovered":""),onMouseEnter:function(){f(c)},style:{gridTemplateColumns:i,top:j({position:m,rowHeight:d}),height:"".concat(d,"px")}},{children:e.jsx(K,{columnIndexStart:r,columnIndices:t,headers:a,hiddenColumns:s,pinned:u,rowIndex:m,rowIndices:h,visibleRow:v},c)}))},X=function(t){var r=t.displayStrongBorder,i=t.position,a=t.rowHeight,s=t.templateColumns,l=t.rowIndex,c=n.useRef(null);return e.jsx("div",o({className:"st-row-separator ".concat(r?"st-last-group-row":""),onMouseDown:function(e){if(void 0!==l){for(var n=e.currentTarget.getBoundingClientRect(),t=e.clientX-n.left,r=s.split(" ").map((function(e){if(e.includes("px"))return parseFloat(e);if(e.includes("fr")){var t=s.split(" ").filter((function(e){return e.includes("fr")})).length;return n.width/t}return 100})),o=0,i=0,a=0;a<r.length;a++){if(t<=o+r[a]){i=a;break}o+=r[a],i=a}var u="cell-".concat(l+1,"-").concat(i+1),d=document.getElementById(u);if(d){c.current=d;var h=new MouseEvent("mousedown",{bubbles:!0,cancelable:!0,view:window,button:0});d.dispatchEvent(h)}}},onMouseUp:function(){if(c.current){var e=new MouseEvent("mouseup",{bubbles:!0,cancelable:!0,view:window,button:0});c.current.dispatchEvent(e),c.current=null}},style:{gridTemplateColumns:s,top:S({position:i,rowHeight:a})}},{children:e.jsx("div",{style:{gridColumn:"1 / -1"}})}))},J=n.createContext(void 0),$=["default"],_=function(e){var t=e.childRef,r=e.children,o=function(){var e=n.useContext(J);if(!e)throw new Error("useScrollSyncContext must be used within a ScrollSyncProvider");return e}(),i=o.registerPane,a=o.unregisterPane;return n.useEffect((function(){return t.current&&i(t.current,$),function(){t.current&&a(t.current,$)}}),[t,i,a]),n.cloneElement(r,{ref:function(e){t.current=e}})},Q=function(n){var t=n.condition,r=n.wrapper,o=n.children;return e.jsx(e.Fragment,{children:t?r(o):e.jsx(e.Fragment,{children:o})})},Z=function(t){var r=t.columnIndexStart,i=t.columnIndices,a=t.headers,s=t.hiddenColumns,l=t.hoveredIndex,c=t.pinned,u=t.ref,d=t.rowHeight,h=t.rowIndices,f=t.setHoveredIndex,v=t.templateColumns,p=t.totalHeight,m=t.visibleRows,g=t.width,w=c?"st-body-pinned-".concat(c):"st-body-main";return e.jsx(Q,o({condition:!c,wrapper:function(n){return e.jsx(_,o({childRef:u},{children:n}))}},{children:e.jsx("div",o({className:w,ref:u,style:o({position:"relative",height:"".concat(p,"px"),width:g},!c&&{flexGrow:1})},{children:m.map((function(t,o){return e.jsxs(n.Fragment,{children:[0!==o&&e.jsx(X,{displayStrongBorder:t.isLastGroupRow,position:t.position,rowHeight:d,templateColumns:v,rowIndex:o-1}),e.jsx(V,{columnIndexStart:r,columnIndices:i,gridTemplateColumns:v,headers:a,hiddenColumns:s,hoveredIndex:l,index:o,pinned:c,rowHeight:d,rowIndices:h,setHoveredIndex:f,visibleRow:t})]},t.position)}))}))}))};function ee(e){var n=e.headersRef,t=e.hiddenColumns,r=e.pinnedLeftColumns,o=e.pinnedRightColumns,i={},a=0,s=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 c({hiddenColumns:t,header:e})})).forEach((function(e,n){s(e,0===n)}))};return r.forEach((function(e,n){s(e,0===n)})),n.current.filter((function(e){return!e.pinned&&c({hiddenColumns:t,header:e})})).forEach((function(e,n){var t=0===n&&0===r.length;s(e,t)})),o.forEach((function(e){s(e,!1)})),i}var ne=function(t){var r=t.headerContainerRef,i=t.mainTemplateColumns,a=t.pinnedLeftColumns,s=t.pinnedLeftTemplateColumns,l=t.pinnedLeftWidth,c=t.pinnedRightColumns,u=t.pinnedRightTemplateColumns,d=t.pinnedRightWidth,h=t.setScrollTop,f=t.tableRows,v=t.visibleRows,m=C(),g=m.headersRef,w=m.hiddenColumns,x=m.mainBodyRef,b=m.rowHeight,y=m.rowIdAccessor,I=m.scrollbarWidth,S=m.tableBodyContainerRef,j=n.useState(null),R=j[0],E=j[1];!function(e){var t=e.headerContainerRef,r=e.mainSectionRef,o=e.scrollbarWidth,i=n.useState(!1),a=i[0],s=i[1];n.useEffect((function(){var e=null==t?void 0:t.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")}}),[t,a,o]),n.useEffect((function(){var e=null==t?void 0:t.current,n=null==r?void 0:r.current;if(n&&e){var o=function(){if(n){var e=n.scrollHeight>n.clientHeight;s(e)}};o();var i=new ResizeObserver((function(){o()}));return i.observe(n),function(){n&&i.unobserve(n)}}}),[t,r])}({headerContainerRef:r,mainSectionRef:S,scrollbarWidth:I});var k=n.useRef(null),N=function(e){return e.length}(f),F=N*(b+1)-1,M=n.useMemo((function(){return ee({headersRef:g,hiddenColumns:w,pinnedLeftColumns:a,pinnedRightColumns:c})}),[g,w,a,c]),W=n.useMemo((function(){var e={};return v.forEach((function(n,t){var r=String(p(n.row,t,y));e[r]=t})),e}),[v,y]),D={columnIndices:M,headerContainerRef:r,headers:g.current,hiddenColumns:w,hoveredIndex:R,rowHeight:b,rowIndices:W,setHoveredIndex:E,visibleRows:v};return e.jsxs("div",o({className:"st-body-container",onMouseLeave:function(){return E(null)},onScroll:function(e){var n=e.currentTarget.scrollTop;k.current&&cancelAnimationFrame(k.current),k.current=requestAnimationFrame((function(){h(n)}))},ref:S},{children:[a.length>0&&e.jsx(Z,o({},D,{pinned:"left",templateColumns:s,totalHeight:F,width:l})),e.jsx(Z,o({},D,{columnIndexStart:a.length,ref:x,templateColumns:i,totalHeight:F})),c.length>0&&e.jsx(Z,o({},D,{columnIndexStart:a.length+i.length,pinned:"right",templateColumns:u,totalHeight:F,width:d}))]}))},te=function(e){return void 0===e&&(e=0),e?e+1:0},re=function(e){var n=e.header,t=e.headers,r=e.newWidth,o=e.setMainBodyWidth,i=e.setPinnedLeftWidth,a=e.setPinnedRightWidth,s=function(e){var n=e.header,t=e.headers,r=e.newWidth,o=n.pinned,i=0;return t.forEach((function(e){e.hide||e.pinned!==o||(e.accessor===n.accessor?i+=r:d(e).forEach((function(e){e.hide||(e.accessor===n.accessor?i+=r:i+=h(e))})))})),n.pinned?te(i):i}({header:n,headers:t,newWidth:r});"left"===n.pinned?i(s):"right"===n.pinned?a(s):n.pinned||o(s)},oe=function(e){var n=e.event,t=e.forceUpdate,r=e.gridColumnEnd,o=e.gridColumnStart,i=e.header,a=e.headersRef,s=e.setMainBodyWidth,l=e.setPinnedLeftWidth,c=e.setPinnedRightWidth,u=e.startWidth;n.preventDefault();var h="clientX"in n?n.clientX:n.touches[0].clientX,p="touches"in n;if(i&&!i.hide){var m=v(i),g=r-o>1,w=g?d(i):[i],x=function(e){var n="right"===i.pinned?h-e:e-h;if(g&&w.length>1)ie({delta:n,header:i,headersRef:a,leafHeaders:w,minWidth:m,setMainBodyWidth:s,setPinnedLeftWidth:l,setPinnedRightWidth:c,startWidth:u});else{var r=Math.max(u+n,m);i.width=r,re({header:i,headers:a.current,newWidth:r,setMainBodyWidth:s,setPinnedLeftWidth:l,setPinnedRightWidth:c})}a.current.forEach((function(e){f(e)})),t()};if(p){var C=function(e){var n=e.touches[0];x(n.clientX)},b=function(){document.removeEventListener("touchmove",C),document.removeEventListener("touchend",b)};document.addEventListener("touchmove",C),document.addEventListener("touchend",b)}else{var y=function(e){x(e.clientX)},I=function(){document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",I)};document.addEventListener("mousemove",y),document.addEventListener("mouseup",I)}}},ie=function(e){var n=e.delta,t=e.header,r=e.headersRef,o=e.leafHeaders,i=e.minWidth,a=e.setMainBodyWidth,s=e.setPinnedLeftWidth,l=e.setPinnedRightWidth,c=e.startWidth,u=o.reduce((function(e,n){return Math.min(e,v(n))}),40),d=o.reduce((function(e,n){return e+("number"==typeof n.width?n.width:150)}),0),h=Math.max(c+n,u);re({header:t,headers:r.current,newWidth:h,setMainBodyWidth:a,setPinnedLeftWidth:s,setPinnedRightWidth:l});var f=h-d;o.forEach((function(e){var n="number"==typeof e.width?e.width:150,t=f*(n/d),r=Math.max(n+t,i);e.width=r}))},ae=function(n){var t=n.className,r=n.style;return e.jsx("svg",o({"aria-hidden":"true",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",className:t,style:o({height:"1em"},r)},{children:e.jsx("path",{d:"M3.9 54.9C10.5 40.9 24.5 32 40 32l432 0c15.5 0 29.5 8.9 36.1 22.9s4.6 30.5-5.2 42.5L320 320.9 320 448c0 12.1-6.8 23.2-17.7 28.6s-23.8 4.3-33.5-3l-64-48c-8.1-6-12.8-15.5-12.8-25.6l0-79.1L9 97.3C-.7 85.4-2.8 68.8 3.9 54.9z"})}))},se={equals:"Equals",notEquals:"Not equals",contains:"Contains",notContains:"Does not contain",startsWith:"Starts with",endsWith:"Ends with",greaterThan:"Greater than",lessThan:"Less than",greaterThanOrEqual:"Greater than or equal",lessThanOrEqual:"Less than or equal",between:"Between",notBetween:"Not between",before:"Before",after:"After",in:"Is one of",notIn:"Is not one of",isEmpty:"Is empty",isNotEmpty:"Is not empty"},le=function(e){switch(e){case"string":return["equals","notEquals","contains","notContains","startsWith","endsWith","isEmpty","isNotEmpty"];case"number":return["equals","notEquals","greaterThan","lessThan","greaterThanOrEqual","lessThanOrEqual","between","notBetween","isEmpty","isNotEmpty"];case"boolean":return["equals","isEmpty","isNotEmpty"];case"date":return["equals","notEquals","before","after","between","notBetween","isEmpty","isNotEmpty"];case"enum":return["in","notIn","isEmpty","isNotEmpty"];default:return["equals","notEquals","isEmpty","isNotEmpty"]}},ce=function(e){return!["between","notBetween","in","notIn","isEmpty","isNotEmpty"].includes(e)},ue=function(e){return["between","notBetween","in","notIn"].includes(e)},de=function(e){return["isEmpty","isNotEmpty"].includes(e)},he=function(n){var t=n.children;return e.jsx("div",o({className:"st-filter-container"},{children:t}))},fe=function(){return e.jsx("svg",o({className:"st-custom-select-arrow",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}))},ve=function(t){var r=t.value,i=t.onChange,a=t.options,s=t.placeholder,l=void 0===s?"Select...":s,c=t.className,u=void 0===c?"":c,d=t.disabled,h=void 0!==d&&d,f=n.useState(!1),v=f[0],p=f[1],m=n.useState(-1),g=m[0],w=m[1],x=n.useRef(null),C=a.find((function(e){return e.value===r}));n.useEffect((function(){var e=function(e){if(v)switch(e.key){case"ArrowDown":e.preventDefault(),w((function(e){return e<a.length-1?e+1:0}));break;case"ArrowUp":e.preventDefault(),w((function(e){return e>0?e-1:a.length-1}));break;case"Enter":e.preventDefault(),g>=0&&(i(a[g].value),p(!1),w(-1));break;case"Escape":e.preventDefault(),p(!1),w(-1)}};if(v)return document.addEventListener("keydown",e),function(){return document.removeEventListener("keydown",e)}}),[v,g,a,i]);return e.jsxs("div",o({ref:x,className:"st-custom-select ".concat(u," ").concat(h?"st-custom-select-disabled":""," ").concat(v?"st-custom-select-open":"").trim()},{children:[e.jsxs("button",o({type:"button",className:"st-custom-select-trigger",onClick:function(){if(!h)if(p(!v),v)w(-1);else{var e=a.findIndex((function(e){return e.value===r}));w(e>=0?e:0)}},disabled:h,"aria-haspopup":"listbox","aria-expanded":v,"aria-labelledby":"select-label"},{children:[e.jsx("span",o({className:"st-custom-select-value"},{children:C?C.label:l})),e.jsx(fe,{})]})),e.jsx(R,o({open:v,setOpen:p,onClose:function(){p(!1),w(-1)},positioning:"absolute",overflow:"auto"},{children:e.jsx("div",o({className:"st-custom-select-options",role:"listbox"},{children:a.map((function(n,t){return e.jsx("div",o({className:"st-custom-select-option ".concat(n.value===r?"st-custom-select-option-selected":""," ").concat(t===g?"st-custom-select-option-focused":"").trim(),role:"option","aria-selected":n.value===r,onClick:function(){return e=n.value,i(e),p(!1),void w(-1);var e}},{children:n.label}),n.value)}))}))}))]}))},pe=function(n){var t=n.value,r=n.onChange,i=n.operators.map((function(e){return{value:e,label:se[e]}}));return e.jsx("div",o({className:"st-filter-section"},{children:e.jsx(ve,{value:t,onChange:function(e){r(e)},options:i})}))},me=function(n){var t=n.type,r=void 0===t?"text":t,o=n.value,i=n.onChange,a=n.placeholder,s=n.autoFocus,l=void 0!==s&&s,c=n.className,u=void 0===c?"":c;return e.jsx("input",{type:r,value:o,onChange:function(e){return i(e.target.value)},placeholder:a,autoFocus:l,className:"st-filter-input ".concat(u).trim()})},ge=function(n){var t=n.children,r=n.className,i=void 0===r?"":r;return e.jsx("div",o({className:"st-filter-section ".concat(i).trim()},{children:t}))},we=function(n){var t=n.onApply,r=n.onClear,i=n.canApply,a=n.showClear;return e.jsxs("div",o({className:"st-filter-actions"},{children:[e.jsx("button",o({onClick:t,disabled:!i,className:"st-filter-button st-filter-button-apply ".concat(i?"":"st-filter-button-disabled")},{children:"Apply"})),a&&r&&e.jsx("button",o({onClick:r,className:"st-filter-button st-filter-button-clear"},{children:"Clear"}))]}))},xe=function(t){var r=t.header,i=t.currentFilter,a=t.onApplyFilter,s=t.onClearFilter,l=n.useState((null==i?void 0:i.operator)||"contains"),c=l[0],u=l[1],d=n.useState(String((null==i?void 0:i.value)||"")),h=d[0],f=d[1],v=le("string");n.useEffect((function(){i?(u(i.operator),f(String(i.value||""))):(u("contains"),f(""))}),[i]);var p=de(c)||h.trim();return e.jsxs(he,{children:[e.jsx(pe,{value:c,onChange:u,operators:v}),ce(c)&&e.jsx(ge,{children:e.jsx(me,{type:"text",value:h,onChange:f,placeholder:"Filter...",autoFocus:!0})}),e.jsx(we,{onApply:function(){var e=o({accessor:r.accessor,operator:c},ce(c)&&{value:h});a(e)},onClear:s,canApply:!!p,showClear:!!i})]})},Ce=function(t){var r,o,i=t.header,a=t.currentFilter,s=t.onApplyFilter,l=t.onClearFilter,c=n.useState((null==a?void 0:a.operator)||"equals"),u=c[0],d=c[1],h=n.useState(String((null==a?void 0:a.value)||"")),f=h[0],v=h[1],p=n.useState(String((null===(r=null==a?void 0:a.values)||void 0===r?void 0:r[0])||"")),m=p[0],g=p[1],w=n.useState(String((null===(o=null==a?void 0:a.values)||void 0===o?void 0:o[1])||"")),x=w[0],C=w[1],b=le("number");n.useEffect((function(){var e,n;a?(d(a.operator),v(String(a.value||"")),g(String((null===(e=a.values)||void 0===e?void 0:e[0])||"")),C(String((null===(n=a.values)||void 0===n?void 0:n[1])||""))):(d("equals"),v(""),g(""),C(""))}),[a]);return e.jsxs(he,{children:[e.jsx(pe,{value:u,onChange:d,operators:b}),ce(u)&&e.jsx(ge,{children:e.jsx(me,{type:"number",value:f,onChange:v,placeholder:"Enter number...",autoFocus:!0})}),ue(u)&&e.jsxs(ge,{children:[e.jsx(me,{type:"number",value:m,onChange:g,placeholder:"From...",autoFocus:!0,className:"st-filter-input-range-from"}),e.jsx(me,{type:"number",value:x,onChange:C,placeholder:"To..."})]}),e.jsx(we,{onApply:function(){var e={accessor:i.accessor,operator:u};ce(u)?e.value=parseFloat(f):ue(u)&&(e.values=[parseFloat(m.toString()),parseFloat(x.toString())]),s(e)},onClear:l,canApply:!!de(u)||(ce(u)?""!==f.trim():!!ue(u)&&""!==String(m).trim()&&""!==String(x).trim()),showClear:!!a})]})},be=function(n){var t=n.value,r=n.onChange,o=n.options,i=n.className,a=void 0===i?"":i,s=n.placeholder;return e.jsx(ve,{value:t,onChange:r,options:o,className:a,placeholder:s})},ye=function(t){var r=t.header,o=t.currentFilter,i=t.onApplyFilter,a=t.onClearFilter,s=n.useState((null==o?void 0:o.operator)||"equals"),l=s[0],c=s[1],u=n.useState(void 0!==(null==o?void 0:o.value)?String(o.value):"true"),d=u[0],h=u[1],f=le("boolean");n.useEffect((function(){o?(c(o.operator),h(void 0!==o.value?String(o.value):"true")):(c("equals"),h("true"))}),[o]);var v=de(l)||""!==d;return e.jsxs(he,{children:[e.jsx(pe,{value:l,onChange:c,operators:f}),ce(l)&&e.jsx(ge,{children:e.jsx(be,{value:d,onChange:h,options:[{value:"true",label:"True"},{value:"false",label:"False"}]})}),e.jsx(we,{onApply:function(){var e={accessor:r.accessor,operator:l};ce(l)&&(e.value="true"===d),i(e)},onClear:a,canApply:v,showClear:!!o})]})},Ie=function(t){var r,i,a=t.header,s=t.currentFilter,l=t.onApplyFilter,c=t.onClearFilter,u=n.useState((null==s?void 0:s.operator)||"equals"),d=u[0],h=u[1],f=n.useState((null==s?void 0:s.value)?String(s.value):""),v=f[0],p=f[1],m=n.useState((null===(r=null==s?void 0:s.values)||void 0===r?void 0:r[0])?String(s.values[0]):""),g=m[0],w=m[1],x=n.useState(String((null===(i=null==s?void 0:s.values)||void 0===i?void 0:i[1])||"")),C=x[0],b=x[1],y=le("date");n.useEffect((function(){var e,n;s?(h(s.operator),p(String(s.value||"")),w(String((null===(e=s.values)||void 0===e?void 0:e[0])||"")),b(String((null===(n=s.values)||void 0===n?void 0:n[1])||""))):(h("equals"),p(""),w(""),b(""))}),[s]);var I=function(t){var r=t.value,i=t.onChange,a=t.placeholder,s=t.autoFocus,l=t.className,c=n.useState(!1),u=c[0],d=c[1],h=n.useState(""),f=h[0],v=h[1],p=n.useRef(null);n.useEffect((function(){if(r){var e=new Date(r);isNaN(e.getTime())||v(e.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}))}else v("")}),[r]),n.useEffect((function(){s&&p.current&&p.current.focus()}),[s]);var m=r?new Date(r):new Date;return e.jsxs("div",o({className:"st-date-input-container",style:{position:"relative"}},{children:[e.jsx("input",{ref:p,type:"text",value:f,placeholder:a,onClick:function(){d(!u)},onKeyDown:function(e){"Enter"===e.key||" "===e.key?(e.preventDefault(),d(!u)):"Escape"===e.key&&d(!1)},readOnly:!0,className:"st-filter-input ".concat(l||""),style:{cursor:"pointer"}}),e.jsx(R,o({open:u,setOpen:d,onClose:function(){d(!1)},positioning:"absolute",overflow:"visible"},{children:e.jsx(M,{value:m,onChange:function(e){var n=e.toISOString().split("T")[0];i(n),d(!1)},onClose:function(){return d(!1)}})}))]}))};return e.jsxs(he,{children:[e.jsx(pe,{value:d,onChange:h,operators:y}),ce(d)&&e.jsx(ge,{children:e.jsx(I,{value:v,onChange:p,placeholder:"Select date...",autoFocus:!0})}),ue(d)&&e.jsxs(ge,{children:[e.jsx(I,{value:g,onChange:w,placeholder:"From date...",autoFocus:!0,className:"st-filter-input-range-from"}),e.jsx(I,{value:C,onChange:b,placeholder:"To date..."})]}),e.jsx(we,{onApply:function(){var e={accessor:a.accessor,operator:d};ce(d)?e.value=v:ue(d)&&(e.values=[g,C]),l(e)},onClear:c,canApply:!!de(d)||(ce(d)?""!==v.trim():!!ue(d)&&""!==g.trim()&&""!==C.trim()),showClear:!!s})]})},Se=function(n){var t=n.className,r=n.style;return e.jsx("svg",o({"aria-hidden":"true",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",className:t,style:o({height:"10px"},r)},{children:e.jsx("path",{d:"M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"})}))},je=function(n){var t=n.checked,r=void 0!==t&&t,i=n.children,a=n.onChange;return e.jsxs("label",o({className:"st-checkbox-label"},{children:[e.jsx("input",{checked:r,className:"st-checkbox-input",onChange:function(){a&&a(!r)},type:"checkbox"}),e.jsx("span",o({className:"st-checkbox-custom ".concat(r?"st-checked":"")},{children:r&&e.jsx(Se,{className:"st-checkbox-checkmark"})})),i]}))},Re=function(t){var r=t.header,i=t.currentFilter,a=t.onApplyFilter,l=t.onClearFilter,c=n.useMemo((function(){return r.enumOptions||[]}),[r.enumOptions]),u=n.useMemo((function(){return c.map((function(e){return e.value}))}),[c]),d=n.useState((null==i?void 0:i.values)?i.values.map(String):u),h=d[0],f=d[1];n.useEffect((function(){f(i?i.values?i.values.map(String):[]:u)}),[i,u]);var v=h.length===u.length;return e.jsxs(he,{children:[e.jsx(ge,{children:e.jsxs("div",o({className:"st-enum-filter-options"},{children:[e.jsx("div",o({className:"st-enum-select-all"},{children:e.jsx(je,o({checked:v,onChange:function(e){f(e?u:[])}},{children:e.jsx("span",o({className:"st-enum-option-label st-enum-select-all-label"},{children:"Select All"}))}))})),c.map((function(n){return e.jsx(je,o({checked:h.includes(n.value),onChange:function(){return e=n.value,void f((function(n){return n.includes(e)?n.filter((function(n){return n!==e})):s(s([],n,!0),[e],!1)}));var e}},{children:e.jsx("span",o({className:"st-enum-option-label"},{children:n.label}))}),n.value)}))]}))}),e.jsx(we,{onApply:function(){if(h.length!==u.length){var e={accessor:r.accessor,operator:"in",values:h};a(e)}else l()},onClear:l,canApply:0!==h.length&&h.length!==u.length,showClear:!!i})]})},Ee=function(n){var t=n.header,r=n.currentFilter,o=n.onApplyFilter,i=n.onClearFilter;return e.jsx(e.Fragment,{children:function(){switch(t.type){case"number":return e.jsx(Ce,{header:t,currentFilter:r,onApplyFilter:o,onClearFilter:i});case"boolean":return e.jsx(ye,{header:t,currentFilter:r,onApplyFilter:o,onClearFilter:i});case"date":return e.jsx(Ie,{header:t,currentFilter:r,onApplyFilter:o,onClearFilter:i});case"enum":return e.jsx(Re,{header:t,currentFilter:r,onApplyFilter:o,onClearFilter:i});default:return e.jsx(xe,{header:t,currentFilter:r,onApplyFilter:o,onClearFilter:i})}}()})},ke=n.forwardRef((function(t,r){var i,a,c=t.colIndex,u=t.forceHeadersUpdate,d=t.gridColumnEnd,h=t.gridColumnStart,f=t.gridRowEnd,v=t.gridRowStart,p=t.header,m=t.reverse,g=t.sort,w=n.useState(!1),x=w[0],b=w[1],y=C(),I=y.columnReordering,S=y.columnResizing,j=y.draggedHeaderRef,E=y.filters,k=y.forceUpdate,N=y.handleApplyFilter,F=y.handleClearFilter,M=y.headersRef,W=y.hoveredHeaderRef,D=y.onColumnOrderChange,T=y.onSort,L=y.onTableHeaderDragEnd,H=y.rowHeight,A=y.selectColumns,O=y.selectableColumns,P=y.setInitialFocusedCell,q=y.setMainBodyWidth,U=y.setPinnedLeftWidth,Y=y.setPinnedRightWidth,K=y.setSelectedCells,G=y.setSelectedColumns,V=y.sortDownIcon,X=y.sortUpIcon,J=Boolean(null==p?void 0:p.isSortable),$=Boolean(null==p?void 0:p.filterable),_=E[p.accessor],Q="st-header-cell ".concat(p.accessor===(null===(i=W.current)||void 0===i?void 0:i.accessor)?"st-hovered":""," ").concat((null===(a=j.current)||void 0===a?void 0:a.accessor)===p.accessor?"st-dragging":""," ").concat(J?"clickable":""," ").concat(I&&!J?"columnReordering":""," ").concat(p.children?"parent":""),Z=z({draggedHeaderRef:j,headersRef:M,hoveredHeaderRef:W,onColumnOrderChange:D,onTableHeaderDragEnd:L}),ee=Z.handleDragStart,ne=Z.handleDragEnd,te=Z.handleDragOver,re=B(),ie=function(e){var n=e.event,t=e.header;if(O){var r=function(e,n){if(!e.children||0===e.children.length)return[n];var t=[],r=function(e,n){if(!e.children||0===e.children.length)return t.push(n),n+1;for(var o=n,i=0,a=e.children;i<a.length;i++){var s=a[i];o=r(s,o)}return o};return r(e,n),t}(t,c);return n.shiftKey&&A?G((function(e){if(0===e.size)return new Set(r);var n=r[0],t=Array.from(e).sort((function(e,n){return e-n})),o=t[0],i=Math.abs(n-o);t.forEach((function(e){var t=Math.abs(n-e);t<i&&(i=t,o=e)}));var a,l,c,u,d=s(s([],(a=o,l=n,c=Math.min(a,l),u=Math.max(a,l),Array.from({length:u-c+1},(function(e,n){return c+n}))),!0),r,!0);return new Set(s(s([],Array.from(e),!0),d,!0))})):A&&A(r),K(new Set),void P(null)}t.isSortable&&T(c,t.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)}}),[]),!p)return null;var se=S&&e.jsx("div",o({className:"st-header-resize-handle-container",onMouseDown:function(e){var n;re({callback:oe,callbackProps:{event:e.nativeEvent,forceUpdate:k,gridColumnEnd:d,gridColumnStart:h,header:p,headersRef:M,setMainBodyWidth:q,setPinnedLeftWidth:U,setPinnedRightWidth:Y,startWidth:"object"==typeof r&&null!==r&&"current"in r?null===(n=r.current)||void 0===n?void 0:n.offsetWidth:void 0},limit:10})},onTouchStart:function(e){var n;re({callback:oe,callbackProps:{event:e,forceUpdate:k,gridColumnEnd:d,gridColumnStart:h,header:p,headersRef:M,setMainBodyWidth:q,setPinnedLeftWidth:U,setPinnedRightWidth:Y,startWidth:"object"==typeof r&&null!==r&&"current"in r?null===(n=r.current)||void 0===n?void 0:n.offsetWidth:void 0},limit:10})}},{children:e.jsx("div",{className:"st-header-resize-handle"})})),le=g&&g.key.accessor===p.accessor&&e.jsxs("div",o({className:"st-icon-container",onClick:function(e){return ie({event:e,header:p})}},{children:["ascending"===g.direction&&X&&X,"descending"===g.direction&&V&&V]})),ce=$&&e.jsxs("div",o({className:"st-icon-container",onClick:function(e){e.stopPropagation(),b(!x)}},{children:[e.jsx(ae,{className:"st-header-icon",style:{fill:_?"var(--st-button-active-background-color)":"var(--st-header-icon-color)"}}),e.jsx(R,o({open:x,overflow:"visible",setOpen:b,onClose:function(){return b(!1)}},{children:e.jsx(Ee,{header:p,currentFilter:_,onApplyFilter:function(e){N(e),b(!1)},onClearFilter:function(){F(p.accessor),b(!1)}})}))]}));return e.jsxs("div",o({className:Q,id:l({accessor:p.accessor,rowIndex:0}),onDragOver:function(e){re({callback:te,callbackProps:{event:e,hoveredHeader:p},limit:50})},ref:r,style:o(o({gridRowStart:v,gridRowEnd:f,gridColumnStart:h,gridColumnEnd:d},d-h>1?{}:{width:p.width}),f-v>1?{}:{height:H})},{children:[m&&se,"right"===p.align&&ce,"right"===p.align&&le,e.jsx("div",o({className:"st-header-label",draggable:I&&!p.disableReorder,onClick:function(e){return ie({event:e,header:p})},onDragEnd:function(e){e.preventDefault(),ne(),u()},onDragStart:function(e){I&&p&&function(e){ee(e)}(p)}},{children:e.jsx("span",o({className:"st-header-label-text ".concat("right"===p.align?"right-aligned":"center"===p.align?"center-aligned":"left-aligned")},{children:null==p?void 0:p.label}))})),"right"!==p.align&&le,"right"!==p.align&&ce,!m&&se]}))})),Ne=function(t){var r=t.columnIndices,i=t.gridTemplateColumns,a=t.handleScroll,s=t.headersRef,l=t.hiddenColumns,u=t.maxDepth,d=t.pinned,h=t.sectionRef,f=t.sort,v=n.useReducer((function(e){return e+1}),0)[1],p=n.useMemo((function(){var e=[],n=1,t=function(o,i,a){var s,h;if(void 0===a&&(a=!1),!c({hiddenColumns:l,header:o,pinned:d}))return 0;a||n++;var f=null!==(h=null===(s=o.children)||void 0===s?void 0:s.filter((function(e){return c({hiddenColumns:l,header:e,pinned:d})})).length)&&void 0!==h?h:0,v=n,p=f>0?v+f:v+1,m=i,g=f>0?i+1:u+1;if(e.push({header:o,gridColumnStart:v,gridColumnEnd:p,gridRowStart:m,gridRowEnd:g,colIndex:r[o.accessor]}),o.children){var w=!0;o.children.forEach((function(e){c({hiddenColumns:l,header:e,pinned:d})&&(t(e,i+1,w),w=!1)}))}return p-v},o=s.current.filter((function(e){return c({hiddenColumns:l,header:e,pinned:d})})),i=!0;return o.forEach((function(e){t(e,1,i),i=!1})),e}),[s,l,u,d,r]);return e.jsx(Q,o({condition:!d,wrapper:function(n){return e.jsx(_,o({childRef:h},{children:n}))}},{children:e.jsx("div",o({className:"st-header-".concat(d?"pinned-".concat(d):"main")},a&&{onScroll:a},{ref:h,style:{gridTemplateColumns:i,display:"grid",position:"relative"}},{children:e.jsx(e.Fragment,{children:p.map((function(t){return e.jsx(ke,{colIndex:t.colIndex,forceHeadersUpdate:v,gridColumnEnd:t.gridColumnEnd,gridColumnStart:t.gridColumnStart,gridRowEnd:t.gridRowEnd,gridRowStart:t.gridRowStart,header:t.header,ref:n.createRef(),reverse:"right"===d,sort:f},t.header.accessor)}))})}))}))},Fe=function(e){var n;return(null===(n=e.children)||void 0===n?void 0:n.length)?1+Math.max.apply(Math,e.children.map(Fe)):1},Me=function(t){var r=t.centerHeaderRef,i=t.headerContainerRef,a=t.headersRef,s=t.hiddenColumns,l=t.mainTemplateColumns,u=t.pinnedLeftColumns,d=t.pinnedLeftTemplateColumns,h=t.pinnedRightColumns,f=t.pinnedRightTemplateColumns,v=t.sort,p=C(),m=p.pinnedLeftRef,g=p.pinnedRightRef,w=p.setPinnedLeftWidth,x=p.setPinnedRightWidth,b=n.useMemo((function(){return ee({headersRef:a,hiddenColumns:s,pinnedLeftColumns:u,pinnedRightColumns:h})}),[a,s,u,h]),y=n.useMemo((function(){var e=a.current,n=0;return e.forEach((function(e){if(c({hiddenColumns:s,header:e})){var t=Fe(e);n=Math.max(n,t)}})),{maxDepth:n}}),[a,s]).maxDepth;return n.useLayoutEffect((function(){requestAnimationFrame((function(){var e,n;w(te(null===(e=m.current)||void 0===e?void 0:e.clientWidth)),x(te(null===(n=g.current)||void 0===n?void 0:n.clientWidth))}))}),[m,g,w,x]),e.jsxs("div",o({className:"st-header-container",ref:i},{children:[u.length>0&&e.jsx(Ne,{columnIndices:b,gridTemplateColumns:d,handleScroll:void 0,headersRef:a,hiddenColumns:s,maxDepth:y,pinned:"left",sectionRef:m,sort:v}),e.jsx(Ne,{columnIndices:b,gridTemplateColumns:l,handleScroll:void 0,headersRef:a,hiddenColumns:s,maxDepth:y,sectionRef:r,sort:v}),h.length>0&&e.jsx(Ne,{columnIndices:b,gridTemplateColumns:f,handleScroll:void 0,headersRef:a,hiddenColumns:s,maxDepth:y,pinned:"right",sectionRef:g,sort:v})]}))},We=function(e){var n=e.headers,t=e.hiddenColumns,r=function(e){var n=e.headers,o=e.flattenedHeaders;return n.forEach((function(e){!0!==t[e.accessor]&&(e.children?r({headers:e.children,flattenedHeaders:o}):o.push(e))})),o},o=r({headers:n,flattenedHeaders:[]});return"".concat(o.map((function(e){return function(e){var n=e.minWidth,t=e.width;return"number"==typeof t&&(t="".concat(t,"px")),n&&"number"==typeof n&&(n="".concat(n,"px")),void 0!==n?"string"==typeof t&&t.endsWith("fr")?"minmax(".concat(n,", ").concat(t,")"):"max(".concat(n,", ").concat(t,")"):t}(e)})).join(" "))},De=function(t){var r=t.pinnedLeftWidth,i=t.pinnedRightWidth,a=t.setScrollTop,s=t.sort,l=t.tableRows,c=t.visibleRows,u=C(),d=u.columnResizing,h=u.editColumns,f=u.headersRef,v=u.hiddenColumns,p=n.useRef(null),m=n.useRef(null),g=f.current.filter((function(e){return!e.pinned})),w=f.current.filter((function(e){return"left"===e.pinned})),x=f.current.filter((function(e){return"right"===e.pinned})),b=n.useMemo((function(){return We({headers:w,hiddenColumns:v})}),[w,v]),y=n.useMemo((function(){return We({headers:g,hiddenColumns:v})}),[g,v]),I=n.useMemo((function(){return We({headers:x,hiddenColumns:v})}),[x,v]),S={centerHeaderRef:m,headerContainerRef:p,headersRef:f,hiddenColumns:v,mainTemplateColumns:y,pinnedLeftColumns:w,pinnedLeftTemplateColumns:b,pinnedRightColumns:x,pinnedRightTemplateColumns:I,sort:s},j={tableRows:l,headerContainerRef:p,mainTemplateColumns:y,pinnedLeftColumns:w,pinnedLeftTemplateColumns:b,pinnedLeftWidth:r,pinnedRightColumns:x,pinnedRightTemplateColumns:I,pinnedRightWidth:i,setScrollTop:a,visibleRows:c};return e.jsxs("div",o({className:"st-content ".concat(d?"st-resizeable":"st-not-resizeable"),style:{width:h?"calc(100% - 27.5px)":"100%"}},{children:[e.jsx(Me,o({},S)),e.jsx(ne,o({},j))]}))},Te=function(t){var r,i,a=t.mainBodyWidth,s=t.mainBodyRef,l=t.pinnedLeftWidth,c=t.pinnedRightWidth,u=t.setMainBodyWidth,d=t.tableBodyContainerRef,h=C().editColumns,f=n.useState(!1),v=f[0],p=f[1],m=n.useRef(null),g=d.current&&d.current.scrollHeight>d.current.clientHeight,w=h?28:0,x=(h?c+1:c)+(d.current&&g?d.current.offsetWidth-d.current.clientWidth:0);return n.useEffect((function(){setTimeout((function(){!function(){var e;if(s.current){var n=null===(e=s.current)||void 0===e?void 0:e.scrollWidth;u(n||0)}}()}),1)}),[s,u]),n.useEffect((function(){setTimeout((function(){!function(){if(s.current){var e=s.current.clientWidth;p(a>e)}}()}),1)}),[s,a,u]),v?e.jsxs("div",o({className:"st-horizontal-scrollbar-container"},{children:[l>0&&e.jsx("div",{className:"st-horizontal-scrollbar-left",style:{flexShrink:0,width:l,height:null===(r=m.current)||void 0===r?void 0:r.offsetHeight}}),a>0&&e.jsx(_,o({childRef:m},{children:e.jsx("div",o({className:"st-horizontal-scrollbar-middle",ref:m,style:{flexGrow:1}},{children:e.jsx("div",{style:{width:a,height:".3px"}})}))})),c>0&&e.jsx("div",{className:"st-horizontal-scrollbar-right",style:{flexShrink:0,minWidth:x,height:null===(i=m.current)||void 0===i?void 0:i.offsetHeight}}),w>0&&e.jsx("div",{style:{width:w-1.5,height:"100%",flexShrink:0}})]})):null},Le={string:function(e,n,t){if(e===n)return 0;var r=e.localeCompare(n);return"ascending"===t?r:-r},number:function(e,n,t){if(e===n)return 0;var r=e-n;return"ascending"===t?r:-r},boolean:function(e,n,t){if(e===n)return 0;var r=e===n?0:e?-1:1;return"ascending"===t?r:-r},date:function(e,n,t){var r=new Date(e),o=new Date(n);if(r.getTime()===o.getTime())return 0;var i=r.getTime()-o.getTime();return"ascending"===t?i:-i},enum:function(e,n,t){return Le.string(e,n,t)},default:function(e,n,t){return e===n?0:null==e?"ascending"===t?-1:1:null==n?"ascending"===t?1:-1:"string"==typeof e&&"string"==typeof n?Le.string(e,n,t):"number"==typeof e&&"number"==typeof n?Le.number(e,n,t):"boolean"==typeof e&&"boolean"==typeof n?Le.boolean(e,n,t):Le.string(String(e),String(n),t)}},He=function(e,n,t){var r=t.find((function(e){return e.accessor===n.key.accessor})),o=(null==r?void 0:r.type)||"string",i=n.direction;return s([],e,!0).sort((function(e,t){var r=n.key.accessor;return function(e,n,t,r){if(void 0===t&&(t="string"),null==e||""===e)return"ascending"===r?-1:1;if(null==n||""===n)return"ascending"===r?1:-1;if("number"===t){var o=function(e){var n;if("number"==typeof e)return e;var t=String(e);if("string"==typeof t){var r=t.replace(/[$,]/g,"").match(/^([-+]?\d*\.?\d+)([TBMKtbmk])?/);if(r){var o=parseFloat(r[1]),i=null===(n=r[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(t)||0},i=o(e),a=o(n);return Le.number(i,a,r)}return"date"===t?Le.date(String(e),String(n),r):"boolean"===t?Le.boolean(Boolean(e),Boolean(n),r):"enum"===t?Le.enum(String(e),String(n),r):Le.string(String(e),String(n),r)}(e[r],t[r],o,i)}))},Be=function(e){var t=e.headers,r=e.tableRows,o=n.useState(null),i=o[0],a=o[1],s=n.useMemo((function(){var e={};return t.forEach((function(n){!0===n.hide&&(e[n.accessor]=!0)})),e}),[t]),l=n.useState(s),c=l[0],u=l[1],d=n.useMemo((function(){if(!i)return r;var e=function(e,n,t){return{sortedData:He(n,t,e),newSortConfig:t}}(t,r,i).sortedData;return e}),[r,i,t]);return{hiddenColumns:c,setHiddenColumns:u,setSort:a,sort:i,sortedRows:d,updateSort:function(e,n){var r=function(e){for(var t=0,o=e;t<o.length;t++){var i=o[t];if(i.accessor===n)return i;if(i.children&&i.children.length>0){var a=r(i.children);if(a)return a}}},o=r(t);o&&a((function(e){return e&&e.key.accessor===n?"ascending"===e.direction?{key:o,direction:"descending"}:null:{key:o,direction:"ascending"}}))}}},Ae=function(e,n,t,r){void 0===r&&(r=new Set);for(var o=0,i=e;o<i.length;o++){var a=i[o];if(!r.has(a.accessor)&&(r.add(a.accessor),a.children&&a.children.length>0)){var s=a.children.some((function(e){return e.accessor===n})),l=!1;if(!s)for(var c=0,u=a.children;c<u.length;c++){var d=u[c];if(Ae([d],n,t,r),!1===t[d.accessor]){l=!0;break}}(s||l)&&(t[a.accessor]=!1)}}},Oe=function(e,n){return e.every((function(e){return!0===n[e.accessor]}))},Pe=function(e,n){e.forEach((function(e){e.children&&e.children.length>0&&(Pe(e.children,n),Oe(e.children,n)&&(n[e.accessor]=!0))}))},qe=function(t){var r=t.allHeaders,i=t.depth,a=void 0===i?0:i,s=t.header,l=t.hiddenColumns,c=t.setHiddenColumns,u=n.useState(!0),f=u[0],v=u[1],p=C(),m=p.expandIcon,g=p.headersRef,w=p.setMainBodyWidth,x=p.setPinnedLeftWidth,b=p.setPinnedRightWidth,y="".concat(16*a,"px"),I=s.children&&s.children.length>0,S=l[s.accessor]||I&&s.children&&Oe(s.children,l);return e.jsxs(e.Fragment,{children:[e.jsxs("div",o({className:"st-header-checkbox-item",style:{paddingLeft:y}},{children:[e.jsx("div",o({className:"st-header-icon-container"},{children:I?e.jsx("div",o({className:"st-collapsible-header-icon st-expand-icon-container ".concat(f?"expanded":"collapsed"),onClick:function(e){e.stopPropagation(),v(!f)}},{children:m})):null})),e.jsx(je,o({checked:S,onChange:function(e){var n=o({},l);(n[s.accessor]=e,e)?Pe(r,n):(Ae(r,s.accessor,n),I&&s.children&&s.children.length>0&&s.children.every((function(e){return!0===l[e.accessor]}))&&s.children[0]&&(n[s.children[0].accessor]=!1,Ae(r,s.children[0].accessor,n)));c(n),g.current.forEach((function(e){e.hide=!0===n[e.accessor]})),function(e){var n=e.headers,t=e.setMainBodyWidth,r=e.setPinnedLeftWidth,o=e.setPinnedRightWidth,i=0,a=0,s=0;n.forEach((function(e){if(!e.hide){var n=d(e).reduce((function(e,n){return e+h(n)}),0);"left"===e.pinned?i+=n:"right"===e.pinned?a+=n:s+=n}}));var l=te(i),c=te(a);r(l),o(c),t(s)}({headers:g.current,setMainBodyWidth:w,setPinnedLeftWidth:x,setPinnedRightWidth:b})}},{children:s.label}))]})),I&&f&&s.children&&e.jsx("div",o({className:"st-nested-headers"},{children:s.children.map((function(n,t){return e.jsx(qe,{allHeaders:r,depth:a+1,header:n,hiddenColumns:l,setHiddenColumns:c},"".concat(n.accessor,"-").concat(t))}))}))]})},ze=function(n){var t=n.headers,r=n.open,i=n.position,a=n.setHiddenColumns,s=n.hiddenColumns,l="left"===i?"left":"";return e.jsx("div",o({className:"st-column-editor-popout ".concat(r?"open":""," ").concat(l),onClick:function(e){return e.stopPropagation()}},{children:e.jsx("div",o({className:"st-column-editor-popout-content"},{children:t.map((function(n,r){return e.jsx(qe,{header:n,hiddenColumns:s,setHiddenColumns:a,allHeaders:t},"".concat(n.accessor,"-").concat(r))}))}))}))},Ue=function(t){var r=t.columnEditorText,i=t.editColumns,a=t.editColumnsInitOpen,s=t.headers,l=t.hiddenColumns,c=t.position,u=void 0===c?"right":c,d=t.setHiddenColumns,h=n.useState(a),f=h[0],v=h[1];return i?e.jsxs("div",o({className:"st-column-editor ".concat(f?"open":""," ").concat(u),onClick:function(){return function(e){v(e)}(!f)},style:{width:28}},{children:[e.jsx("div",o({className:"st-column-editor-text"},{children:r})),e.jsx(ze,{headers:s,open:f,position:u,setHiddenColumns:d,hiddenColumns:l})]})):null},Ye=function(n){var t=n.className;return e.jsx("svg",o({"aria-hidden":"true",focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 320 512",className:t,style:{height:"1em"}},{children:e.jsx("path",{d:"M22 334.5c-3.8 8.8-2 19 4.6 26l116 144c4.5 4.8 10.8 7.5 17.4 7.5s12.9-2.7 17.4-7.5l116-144c6.6-7 8.4-17.2 4.6-26s-12.5-14.5-22-14.5l-72 0 0-288c0-17.7-14.3-32-32-32L148 0C130.3 0 116 14.3 116 32l0 288-72 0c-9.6 0-18.2 5.7-22 14.5z"})}))},Ke=function(n){var t=n.className;return e.jsx("svg",o({"aria-hidden":"true",focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 320 512",className:t,style:{height:"1em"}},{children:e.jsx("path",{d:"M298 177.5c3.8-8.8 2-19-4.6-26l-116-144C172.9 2.7 166.6 0 160 0s-12.9 2.7-17.4 7.5l-116 144c-6.6 7-8.4 17.2-4.6 26S34.4 192 44 192l72 0 0 288c0 17.7 14.3 32 32 32l24 0c17.7 0 32-14.3 32-32l0-288 72 0c9.6 0 18.2-5.7 22-14.5z"})}))},Ge=function(t){var i=t.children,a=n.useRef({}),s=n.useCallback((function(e,n){return!!a.current[n]&&a.current[n].find((function(n){return n===e}))}),[]),l=n.useCallback((function(e,n){var t=e.clientWidth,r=e.scrollLeft;e.scrollWidth-t>0&&(n.scrollLeft=r)}),[]),c=n.useCallback((function(e){e.onscroll=null}),[]),u=n.useCallback((function(e,n){e.onscroll=function(){window.requestAnimationFrame((function(){n.forEach((function(n){var t;null===(t=a.current[n])||void 0===t||t.forEach((function(n){e!==n&&(c(n),l(e,n),window.requestAnimationFrame((function(){var e=Object.keys(a.current).filter((function(e){return a.current[e].includes(n)}));u(n,e)})))}))}))}))}}),[c,l]),d=n.useCallback((function(e,n){n.forEach((function(n){a.current[n]||(a.current[n]=[]),s(e,n)||(a.current[n].length>0&&l(a.current[n][0],e),a.current[n].push(e))})),u(e,n)}),[s,l,u]),h=n.useCallback((function(e,n){n.forEach((function(n){if(s(e,n)){c(e);var t=a.current[n].indexOf(e);-1!==t&&a.current[n].splice(t,1)}}))}),[s,c]);return e.jsx(J.Provider,o({value:{registerPane:d,unregisterPane:h}},{children:r.default.Children.only(i)}))},Ve=function(e,n){var t=n.find((function(n){return n.accessor===e.accessor})),r=(null==t?void 0:t.label)||e.accessor,o=se[e.operator],i="";return void 0!==e.value?i="boolean"==typeof e.value?e.value?"True":"False":String(e.value):e.values&&Array.isArray(e.values)&&("between"===e.operator||"notBetween"===e.operator?i="".concat(e.values[0]," - ").concat(e.values[1]):"in"!==e.operator&&"notIn"!==e.operator||(i=e.values.join(", "))),"isEmpty"===e.operator||"isNotEmpty"===e.operator?"".concat(r,": ").concat(o):"".concat(r,": ").concat(o," ").concat(i)},Xe=function(){var n=C(),t=n.filters,r=n.handleClearFilter,i=n.headersRef,a=Object.values(t);return 0===a.length||a.length>0?null:e.jsx("div",o({className:"st-filter-bar"},{children:e.jsx("div",o({className:"st-filter-bar-content"},{children:e.jsx("div",o({className:"st-filter-chips"},{children:a.map((function(n){return e.jsxs("div",o({className:"st-filter-chip"},{children:[e.jsx("span",o({className:"st-filter-chip-text"},{children:Ve(n,i.current)})),e.jsx("button",o({className:"st-filter-chip-remove",onClick:function(){return r(n.accessor)},"aria-label":"Remove filter for ".concat(n.accessor)},{children:"×"}))]}),n.accessor)}))}))}))}))},Je=function(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())},$e=function(e){var t=e.rows,r=n.useState({}),i=r[0],a=r[1],s=n.useMemo((function(){return 0===Object.keys(i).length?t:t.filter((function(e){return Object.values(i).every((function(n){try{return function(e,n){var t=n.operator,r=n.value,o=n.values;if(null==e)return"isEmpty"===t;if("isEmpty"===t)return!e||""===String(e).trim();if("isNotEmpty"===t)return e&&""!==String(e).trim();if("string"==typeof e||"contains"===t||"notContains"===t||"startsWith"===t||"endsWith"===t){var i=String(e).toLowerCase(),a=r?String(r).toLowerCase():"";switch(t){case"equals":return i===a;case"notEquals":return i!==a;case"contains":return i.includes(a);case"notContains":return!i.includes(a);case"startsWith":return i.startsWith(a);case"endsWith":return i.endsWith(a)}}if("number"==typeof e||!isNaN(Number(e))){var s=Number(e),l=Number(r);switch(t){case"equals":return s===l;case"notEquals":return s!==l;case"greaterThan":return s>l;case"lessThan":return s<l;case"greaterThanOrEqual":return s>=l;case"lessThanOrEqual":return s<=l;case"between":if(o&&2===o.length){var c=o.map(Number),u=c[0],d=c[1];return s>=u&&s<=d}return!1;case"notBetween":if(o&&2===o.length){var h=o.map(Number);return u=h[0],d=h[1],s<u||s>d}return!0}}if(e instanceof Date||!isNaN(Date.parse(e))){var f=new Date(e),v=new Date(String(r||"")),p=Je(f),m=Je(v);switch(t){case"equals":return p.getTime()===m.getTime();case"notEquals":return p.getTime()!==m.getTime();case"before":return p<m;case"after":return p>m;case"between":if(o&&2===o.length){var g=o.map((function(e){return Je(new Date(String(e||"")))})),w=g[0],x=g[1];return p>=w&&p<=x}return!1;case"notBetween":if(o&&2===o.length){var C=o.map((function(e){return Je(new Date(String(e||"")))}));return w=C[0],x=C[1],p<w||p>x}return!0}}if("boolean"==typeof e){var b=Boolean(r);if("equals"===t)return e===b}if("in"===t||"notIn"===t){if(o&&Array.isArray(o)){var y=String(e),I=o.includes(y);return"in"===t?I:!I}return!1}var S=String(e).toLowerCase(),j=r?String(r).toLowerCase():"";switch(t){case"equals":return S===j;case"notEquals":return S!==j;default:return!0}}(e[n.accessor],n)}catch(e){return console.warn("Filter error for accessor ".concat(n.accessor,":"),e),!0}}))}))}),[t,i]),l=n.useCallback((function(e){a((function(n){var t;return o(o({},n),((t={})[e.accessor]=e,t))}))}),[]),c=n.useCallback((function(e){a((function(n){var t=o({},n);return delete t[e],t}))}),[]),u=n.useCallback((function(){a({})}),[]);return{filters:i,filteredRows:s,handleApplyFilter:l,handleClearFilter:c,handleClearAllFilters:u}},_e=function(t){var r=t.allowAnimations,s=void 0!==r&&r,l=t.cellUpdateFlash,c=void 0!==l&&l,h=t.columnEditorPosition,f=void 0===h?"right":h,v=t.columnEditorText,w=void 0===v?"Columns":v,C=t.columnReordering,S=void 0!==C&&C,j=t.columnResizing,R=void 0!==j&&j,E=t.defaultHeaders,k=t.editColumns,N=void 0!==k&&k,F=t.editColumnsInitOpen,M=void 0!==F&&F,W=t.expandAll,D=void 0===W||W,T=t.expandIcon,L=void 0===T?e.jsx(I,{className:"st-expand-icon"}):T,H=t.height,B=t.hideFooter,A=void 0!==B&&B,O=t.nextIcon,P=void 0===O?e.jsx(I,{className:"st-next-prev-icon"}):O,q=t.onCellEdit,z=t.onColumnOrderChange,U=t.onGridReady,Y=t.onNextPage,K=t.prevIcon,G=void 0===K?e.jsx(y,{className:"st-next-prev-icon"}):K,V=t.rowGrouping,X=t.rowHeight,J=void 0===X?32:X,$=t.rowIdAccessor,_=t.rows,Q=t.rowsPerPage,Z=void 0===Q?10:Q,ee=t.selectableCells,ne=void 0!==ee&&ee,te=t.selectableColumns,re=void 0!==te&&te,oe=t.shouldPaginate,ie=void 0!==oe&&oe,ae=t.sortDownIcon,se=void 0===ae?e.jsx(Ye,{className:"st-header-icon"}):ae,le=t.sortUpIcon,ce=void 0===le?e.jsx(Ke,{className:"st-header-icon"}):le,ue=t.tableRef,de=t.theme,he=void 0===de?"light":de,fe=t.useHoverRowBackground,ve=void 0===fe||fe,pe=t.useOddEvenRowBackground,me=void 0===pe||pe,ge=t.useOddColumnBackground,we=void 0!==ge&&ge;we&&(me=!1);var xe=n.useRef(null),Ce=n.useRef(E),be=n.useRef(null),ye=n.useRef(null),Ie=n.useRef(null),Se=n.useRef(null),je=n.useRef(null),Re=n.useState(1),Ee=Re[0],ke=Re[1],Ne=n.useState(0),Fe=Ne[0],Me=Ne[1],We=n.useState(0),Le=We[0],He=We[1],Ae=n.useState(0),Oe=Ae[0],Pe=Ae[1],qe=n.useState(0),ze=qe[0],Ve=qe[1],Je=n.useState(0),_e=Je[0],Qe=Je[1],Ze=n.useState(new Set),en=Ze[0],nn=Ze[1],tn=$e({rows:_}),rn=tn.filters,on=tn.filteredRows,an=tn.handleApplyFilter,sn=tn.handleClearFilter,ln=tn.handleClearAllFilters,cn=Be({headers:Ce.current,tableRows:on}),un=cn.sort,dn=cn.sortedRows,hn=cn.hiddenColumns,fn=cn.setHiddenColumns,vn=cn.updateSort;n.useEffect((function(){null==U||U()}),[U]);var pn=n.useMemo((function(){if(!ie)return dn;var e=(Ee-1)*Z,n=e+Z;return dn.slice(e,n)}),[Ee,Z,ie,dn]),mn=n.useMemo((function(){return V&&0!==V.length?m({rows:pn,rowGrouping:V,rowIdAccessor:$,expandedRows:en,expandAll:D}):pn.map((function(e,n){return{row:e,depth:0,groupingKey:void 0,position:n,isLastGroupRow:!1}}))}),[pn,V,$,en,D]),gn=function(e){var t=e.height,r=e.rowHeight;return n.useMemo((function(){var e;if(!t)return window.innerHeight-r;var n=document.querySelector(".simple-table-root"),o=0;if(t.endsWith("px"))o=parseInt(t,10);else if(t.endsWith("vh")){var i=parseInt(t,10);o=window.innerHeight*i/100}else if(t.endsWith("%")){var a=parseInt(t,10);o=((null===(e=null==n?void 0:n.parentElement)||void 0===e?void 0:e.clientHeight)||window.innerHeight)*a/100}else o=window.innerHeight;return Math.max(0,o-r)}),[t,r])}({height:H,rowHeight:J}),wn=n.useMemo((function(){return function(e){var n=e.bufferRowCount,t=e.contentHeight,r=e.tableRows,o=e.rowHeight,i=e.scrollTop,a=o+1,s=Math.max(0,i-a*n),l=i+t+a*n,c=Math.max(0,Math.floor(s/a)),u=Math.min(r.length,Math.ceil(l/a));return r.slice(c,u)}({bufferRowCount:5,contentHeight:gn,tableRows:mn,rowHeight:J,scrollTop:ze})}),[gn,J,mn,ze]),xn=n.useRef(new Map),Cn=n.useReducer((function(e){return e+1}),0)[1],bn=function(e){var t=e.selectableCells,r=e.headers,o=e.tableRows,s=e.rowIdAccessor,l=e.onCellEdit,c=e.cellRegistry,u=n.useState(new Set),h=u[0],f=u[1],v=n.useState(new Set),m=v[0],w=v[1],x=n.useState(null),C=x[0],b=x[1],y=n.useState(null),I=y[0],S=y[1],j=n.useState(new Set),R=j[0],E=j[1],k=n.useState(new Set),N=k[0],F=k[1],M=n.useRef(!1),W=n.useRef(null),D=n.useMemo((function(){return r.flatMap(d)}),[r]),T=n.useCallback((function(){var e=D.filter((function(e){return!e.hide})),n=new Map;e.forEach((function(e,t){n.set(t,e.accessor)}));var t=Array.from(h).reduce((function(e,t){var r,i=t.split("-").map(Number),a=i[0],s=i[1];e[a]||(e[a]=[]);var l=n.get(s);return l&&(null===(r=o[a])||void 0===r?void 0:r.row)?e[a][s]=o[a].row[l]:e[a][s]="",e}),{}),r=Object.values(t).map((function(e){return Object.values(e).join("\t")})).join("\n");h.size>0&&(navigator.clipboard.writeText(r),E(new Set(h)),setTimeout((function(){E(new Set)}),800))}),[D,h,o]),L=n.useCallback((function(){return i(void 0,void 0,void 0,(function(){var e,n,t,r,i,u,d,h;return a(this,(function(a){switch(a.label){case 0:if(!I)return[2];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,navigator.clipboard.readText()];case 2:return(e=a.sent())?0===(n=e.split("\n").filter((function(e){return e.length>0}))).length?[2]:(t=D.filter((function(e){return!e.hide})),r=new Set,i=new Set,u=I.rowIndex,d=I.colIndex,n.forEach((function(e,n){e.split("\t").forEach((function(e,a){var h=u+n,f=d+a;if(!(h>=o.length||f>=t.length)){var v=o[h],m=t[f],w=p(v.row,h,s);if(null==m?void 0:m.isEditable){var x=e;if("number"===m.type){var C=Number(e);isNaN(C)||(x=C)}else if("boolean"===m.type)x="true"===e.toLowerCase()||"1"===e;else if("date"===m.type){var b=new Date(e);isNaN(b.getTime())||(x=b)}if(v.row[m.accessor]=x,c){var y="".concat(w,"-").concat(m.accessor),I=c.get(y);I&&I.updateContent(x)}null==l||l({accessor:m.accessor,newValue:x,row:v.row,rowIndex:h});var S=g({colIndex:f,rowIndex:h,rowId:w});r.add(S)}else{var j=g({colIndex:f,rowIndex:h,rowId:w});i.add(j)}}}))})),r.size>0&&(E(r),setTimeout((function(){E(new Set)}),800)),i.size>0&&(F(i),setTimeout((function(){F(new Set)}),800)),[3,4]):[2];case 3:return h=a.sent(),console.warn("Failed to paste from clipboard:",h),[3,4];case 4:return[2]}}))}))}),[I,D,o,s,l,c]),H=n.useCallback((function(){if(0!==h.size){var e=D.filter((function(e){return!e.hide})),n=new Map;e.forEach((function(e,t){n.set(t,e.accessor)}));var t=new Set,r=new Set;Array.from(h).forEach((function(n){var i=n.split("-").map(Number),a=i[0],u=i[1];if(!(a>=o.length||u>=e.length)){var d=o[a],h=e[u],f=p(d.row,a,s);if(null==h?void 0:h.isEditable){var v=null;if(v="string"===h.type?"":"number"===h.type?null:"boolean"!==h.type&&("date"===h.type?null:""),d.row[h.accessor]=v,c){var m="".concat(f,"-").concat(h.accessor),g=c.get(m);g&&g.updateContent(v)}null==l||l({accessor:h.accessor,newValue:v,row:d.row,rowIndex:a}),t.add(n)}else r.add(n)}})),t.size>0&&(E(t),setTimeout((function(){E(new Set)}),800)),r.size>0&&(F(r),setTimeout((function(){F(new Set)}),800))}}),[h,D,o,s,l,c]),B=n.useCallback((function(e,n){for(var t=new Set,r=Math.min(e.rowIndex,n.rowIndex),i=Math.max(e.rowIndex,n.rowIndex),a=Math.min(e.colIndex,n.colIndex),l=Math.max(e.colIndex,n.colIndex),c=r;c<=i;c++)for(var u=a;u<=l;u++)if(c>=0&&c<o.length){var d=p(o[c].row,c,s);t.add(g({colIndex:u,rowIndex:c,rowId:d}))}w(new Set),b(null),f(t)}),[o,s,w,b,f]),A=n.useCallback((function(e){if(e.rowIndex>=0&&e.rowIndex<o.length&&e.colIndex>=0&&e.colIndex<D.length){var n=g(e);w(new Set),b(null),f(new Set([n])),S(e)}}),[D.length,o.length,w,b,f,S]),O=n.useCallback((function(e,n){void 0===n&&(n=!1),f(new Set),S(null),w((function(t){var r=new Set(n?t:[]);return e.forEach((function(e){return r.add(e)})),r})),e.length>0&&b(e[e.length-1])}),[f,S,w,b]);n.useEffect((function(){var e=function(e){var n;if(t&&I){var r=I.rowIndex,i=I.colIndex,a=I.rowId;if(!e.ctrlKey&&!e.metaKey||"c"!==e.key){if((e.ctrlKey||e.metaKey)&&"v"===e.key)return e.preventDefault(),void L();if("Delete"===e.key||"Backspace"===e.key)return e.preventDefault(),void H();if(p(null===(n=o[r])||void 0===n?void 0:n.row,r,s)!==a){var l=o.findIndex((function(e,n){return p(e.row,n,s)===a}));if(-1===l)return;r=l}if("ArrowUp"===e.key){if(e.preventDefault(),r>0){var c=p(o[r-1].row,r-1,s);A({rowIndex:r-1,colIndex:i,rowId:c})}}else"ArrowDown"===e.key?(e.preventDefault(),r<o.length-1&&(c=p(o[r+1].row,r+1,s),A({rowIndex:r+1,colIndex:i,rowId:c}))):"ArrowLeft"===e.key||"Tab"===e.key&&e.shiftKey?(e.preventDefault(),i>0&&(c=p(o[r].row,r,s),A({rowIndex:r,colIndex:i-1,rowId:c}))):"ArrowRight"===e.key||"Tab"===e.key?(e.preventDefault(),i<D.length-1&&(c=p(o[r].row,r,s),A({rowIndex:r,colIndex:i+1,rowId:c}))):"Escape"===e.key&&(f(new Set),w(new Set),b(null),W.current=null,S(null))}else T()}};return document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[T,D.length,I,s,B,A,t,o,L,H]);var P=n.useCallback((function(e){var n=e.colIndex,t=e.rowIndex,r=e.rowId,o=g({colIndex:n,rowIndex:t,rowId:r}),i=h.has(o),a=m.has(n);return i||a}),[h,m]),q=n.useCallback((function(e){var n=e.colIndex,t=e.rowIndex,r=e.rowId,i=[],a=o[t-1]?p(o[t-1].row,t-1,s):null,l=o[t+1]?p(o[t+1].row,t+1,s):null,c=null!==a?{colIndex:n,rowIndex:t-1,rowId:a}:null,u=null!==l?{colIndex:n,rowIndex:t+1,rowId:l}:null,d={colIndex:n-1,rowIndex:t,rowId:r},h={colIndex:n+1,rowIndex:t,rowId:r};return(!c||!P(c)||m.has(n)&&0===t)&&i.push("st-selected-top-border"),(!u||!P(u)||m.has(n)&&t===o.length-1)&&i.push("st-selected-bottom-border"),P(d)||i.push("st-selected-left-border"),P(h)||i.push("st-selected-right-border"),i.join(" ")}),[P,o,m,s]),z=n.useMemo((function(){return I?function(e){var n=e.rowIndex,t=e.colIndex,r=e.rowId;return n===I.rowIndex&&t===I.colIndex&&r===I.rowId}:function(){return!1}}),[I]),U=n.useCallback((function(e){var n=e.colIndex,t=e.rowIndex,r=e.rowId,o=g({colIndex:n,rowIndex:t,rowId:r});return R.has(o)}),[R]),Y=n.useCallback((function(e){var n=e.colIndex,t=e.rowIndex,r=e.rowId,o=g({colIndex:n,rowIndex:t,rowId:r});return N.has(o)}),[N]);return{getBorderClass:q,handleMouseDown:function(e){var n=e.colIndex,r=e.rowIndex,o=e.rowId;t&&(M.current=!0,W.current={rowIndex:r,colIndex:n,rowId:o},setTimeout((function(){w(new Set),b(null);var e=g({colIndex:n,rowIndex:r,rowId:o});f(new Set([e])),S({rowIndex:r,colIndex:n,rowId:o})}),0))},handleMouseOver:function(e){var n=e.colIndex,r=e.rowIndex;if(e.rowId,t&&M.current&&W.current){for(var i=new Set,a=Math.min(W.current.rowIndex,r),l=Math.max(W.current.rowIndex,r),c=Math.min(W.current.colIndex,n),u=Math.max(W.current.colIndex,n),d=a;d<=l;d++)for(var h=c;h<=u;h++)if(d>=0&&d<o.length){var v=p(o[d].row,d,s);i.add(g({colIndex:h,rowIndex:d,rowId:v}))}f(i)}},handleMouseUp:function(){M.current=!1},isCopyFlashing:U,isWarningFlashing:Y,isInitialFocusedCell:z,isSelected:P,lastSelectedColumnIndex:C,pasteFromClipboard:L,selectColumns:O,selectedCells:h,selectedColumns:m,setInitialFocusedCell:S,setSelectedCells:f,setSelectedColumns:w,deleteSelectedCells:H}}({selectableCells:ne,headers:Ce.current,tableRows:mn,rowIdAccessor:$,onCellEdit:q,cellRegistry:xn.current}),yn=bn.getBorderClass,In=bn.handleMouseDown,Sn=bn.handleMouseOver,jn=bn.handleMouseUp,Rn=bn.isCopyFlashing,En=bn.isInitialFocusedCell,kn=bn.isSelected,Nn=bn.isWarningFlashing,Fn=bn.selectColumns,Mn=bn.selectedCells,Wn=bn.selectedColumns,Dn=bn.setInitialFocusedCell,Tn=bn.setSelectedCells,Ln=bn.setSelectedColumns,Hn=n.useCallback((function(e,n){vn(e,n)}),[vn]),Bn=n.useCallback((function(e){Ce.current=e,Cn()}),[]);return function(e){var t=e.selectableColumns,r=e.selectedCells,o=e.selectedColumns,i=e.setSelectedCells,a=e.setSelectedColumns;n.useEffect((function(){var e=function(e){var n=e.target;n.closest(".st-cell")||t&&(n.classList.contains("st-header-cell")||n.classList.contains("st-header-label"))||(r.size>0&&i(new Set),o.size>0&&a(new Set))};return document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}}),[t,r,o,i,a])}({selectableColumns:re,selectedCells:Mn,selectedColumns:Wn,setSelectedCells:Tn,setSelectedColumns:Ln}),n.useLayoutEffect((function(){if(je.current){var e=je.current.offsetWidth-je.current.clientWidth;Qe(e)}}),[]),function(e){var t=e.forceUpdate,r=e.tableBodyContainerRef,o=e.setScrollbarWidth;n.useLayoutEffect((function(){var e=function(){if(t(),r.current){var e=r.current.offsetWidth-r.current.clientWidth;o(e)}};return window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[t,r,o])}({forceUpdate:Cn,tableBodyContainerRef:je,setScrollbarWidth:Qe}),n.useEffect((function(){ue&&(ue.current={updateData:function(e){var n=e.accessor,t=e.rowIndex,r=e.newValue,o=null==_?void 0:_[t];if(o){var i=p(o,t,$),a=u({rowId:i,accessor:n}),s=xn.current.get(a);s&&s.updateContent(r),void 0!==o[n]&&(o[n]=r)}}})}),[ue,_,$]),e.jsx(x,o({value:{allowAnimations:s,cellRegistry:xn.current,cellUpdateFlash:c,columnReordering:S,columnResizing:R,draggedHeaderRef:xe,editColumns:N,expandIcon:L,expandedRows:en,filters:rn,tableRows:mn,forceUpdate:Cn,getBorderClass:yn,handleApplyFilter:an,handleClearFilter:sn,handleClearAllFilters:ln,handleMouseDown:In,handleMouseOver:Sn,headersRef:Ce,hiddenColumns:hn,hoveredHeaderRef:be,isCopyFlashing:Rn,isInitialFocusedCell:En,isSelected:kn,isWarningFlashing:Nn,mainBodyRef:ye,nextIcon:P,onCellEdit:q,onColumnOrderChange:z,onSort:Hn,onTableHeaderDragEnd:Bn,pinnedLeftRef:Ie,pinnedRightRef:Se,prevIcon:G,rowGrouping:V,rowHeight:J,rowIdAccessor:$,scrollbarWidth:_e,selectColumns:Fn,selectableColumns:re,setExpandedRows:nn,setInitialFocusedCell:Dn,setMainBodyWidth:Me,setPinnedLeftWidth:He,setPinnedRightWidth:Pe,setSelectedCells:Tn,setSelectedColumns:Ln,shouldPaginate:ie,sortDownIcon:se,sortUpIcon:ce,tableBodyContainerRef:je,theme:he,useHoverRowBackground:ve,useOddColumnBackground:we,useOddEvenRowBackground:me}},{children:e.jsx("div",o({className:"simple-table-root st-wrapper theme-".concat(he),style:H?{height:H}:{}},{children:e.jsx(Ge,{children:e.jsxs("div",o({className:"st-wrapper-container"},{children:[e.jsx(Xe,{}),e.jsxs("div",o({className:"st-content-wrapper",onMouseUp:jn,onMouseLeave:jn},{children:[e.jsx(De,{tableRows:mn,pinnedLeftWidth:Le,pinnedRightWidth:Oe,setScrollTop:Ve,sort:un,visibleRows:wn}),e.jsx(Ue,{columnEditorText:w,editColumns:N,editColumnsInitOpen:M,headers:Ce.current,hiddenColumns:hn,position:f,setHiddenColumns:fn})]})),e.jsx(Te,{mainBodyRef:ye,mainBodyWidth:Fe,pinnedLeftWidth:Le,pinnedRightWidth:Oe,setMainBodyWidth:Me,tableBodyContainerRef:je}),e.jsx(b,{currentPage:Ee,hideFooter:A,onPageChange:ke,onNextPage:Y,shouldPaginate:ie,totalPages:Math.ceil(on.length/Z)})]}))})}))}))};exports.SimpleTable=function(t){var r=n.useState(!1),i=r[0],a=r[1];return n.useEffect((function(){a(!0)}),[]),i?e.jsx(_e,o({},t)):null};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("react");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=t(n),o=function(){return o=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},o.apply(this,arguments)};function a(e,n,t,r){return new(t||(t=Promise))(function(o,a){function i(e){try{s(r.next(e))}catch(e){a(e)}}function l(e){try{s(r.throw(e))}catch(e){a(e)}}function s(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t(function(e){e(n)})).then(i,l)}s((r=r.apply(e,n||[])).next())})}function i(e,n){var t,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=l(0),i.throw=l(1),i.return=l(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(l){return function(s){return function(l){if(t)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(a=0)),a;)try{if(t=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return a.label++,{value:l[1],done:!1};case 5:a.label++,r=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==l[0]&&2!==l[0])){a=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){a.label=l[1];break}if(6===l[0]&&a.label<o[1]){a.label=o[1],o=l;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(l);break}o[2]&&a.ops.pop(),a.trys.pop();continue}l=n.call(e,a)}catch(e){l=[6,e],r=0}finally{t=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,s])}}}function l(e,n,t){if(t||2===arguments.length)for(var r,o=0,a=n.length;o<a;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return e.concat(r||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var s=function(e){var n=e.accessor,t=e.rowIndex;return"cell-".concat(n,"-").concat(t)},c=function(e){var n=e.header,t=e.pinned;return n.hide?null:!t&&!n.pinned||n.pinned===t||null},u=function(e){var n=e.rowId,t=e.accessor;return"".concat(n,"-").concat(t)},d=function(e){return e.hide?[]:e.children&&0!==e.children.length?e.children.flatMap(function(e){return d(e)}):[e]},f=function(e){var n,t=e.width;"string"==typeof t&&t.includes("fr")&&(e.width=(null===(n=document.getElementById(s({accessor:e.accessor,rowIndex:0})))||void 0===n?void 0:n.offsetWidth)||150),e.children&&e.children.forEach(function(e){f(e)})},h=function(e){return"number"==typeof e.minWidth?e.minWidth:40},v=function(e,n,t){return t&&void 0!==e[t]?e[t]:n},p=function(e){var n=e.depth,t=void 0===n?0:n,r=e.expandAll,o=void 0!==r&&r,a=e.expandedRows,i=e.rowGrouping,l=void 0===i?[]:i,s=e.rowIdAccessor,c=e.rows,u=[],d=function(e,n,t){void 0===t&&(t=0);var r=t;return e.forEach(function(t,i){var c=v(t,i,s),f=l[n],h=0===n&&i===e.length-1;u.push({row:t,depth:n,groupingKey:f,position:r,isLastGroupRow:h}),r++;var p=String(c);if((o?!a.has(p):a.has(p))&&n<l.length){var m=function(e,n){var t=e[n];return Array.isArray(t)?t:[]}(t,f);m.length>0&&(r=d(m,n+1,r))}}),r};return d(c,t),u},m=function(e){var n=e.rowIndex,t=e.colIndex,r=e.rowId;return"".concat(n,"-").concat(t,"-").concat(r)},g=n.createContext(void 0),w=function(n){var t=n.children,r=n.value;return e.jsx(g.Provider,o({value:r},{children:t}))},x=function(){var e=n.useContext(g);if(void 0===e)throw new Error("useTableContext must be used within a TableProvider");return e},b=function(t){var r=t.currentPage,l=t.hideFooter,s=t.onPageChange,c=t.onNextPage,u=t.shouldPaginate,d=t.totalPages,f=x(),h=f.nextIcon,v=f.prevIcon,p=n.useState(!0),m=p[0],g=p[1],w=!(r>1),b=!(r<d)&&!c||!m&&r===d;if(l||!u)return null;var C=function(){if(d<=15)return Array.from({length:d},function(e,n){return n+1});var e,n,t=[],o=15;if(r<=Math.ceil(7.5))e=1,n=14;else if(r>=d-Math.floor(7.5))e=Math.max(1,d-o+1),n=d;else{var a=Math.floor(7);e=r-a,n=r+(o-a-1)}for(var i=e;i<=n;i++)t.push(i);return n<d-1&&(t.push(-1),t.push(d)),t}();return e.jsxs("div",o({className:"st-footer"},{children:[e.jsx("button",o({className:"st-next-prev-btn ".concat(w?"disabled":""),onClick:function(){var e=r-1;e>=1&&s(e)},disabled:w},{children:v})),e.jsx("button",o({className:"st-next-prev-btn ".concat(b?"disabled":""),onClick:function(){return a(void 0,void 0,void 0,function(){var e,n;return i(this,function(t){switch(t.label){case 0:return e=r===d,n=r+1,c&&e?[4,c(r)]:[3,2];case 1:if(!t.sent())return g(!1),[2];t.label=2;case 2:return(n<=d||c)&&s(n),[2]}})})},disabled:b},{children:h})),C.map(function(n,t){return n<0?e.jsx("span",o({className:"st-page-ellipsis"},{children:"..."}),"ellipsis-".concat(n)):e.jsx("button",o({onClick:function(){return function(e){e>=1&&e<=d&&s(e)}(n)},className:"st-page-btn ".concat(r===n?"active":"")},{children:n}),"page-".concat(n))})]}))},C=function(n){var t=n.className;return e.jsx("svg",o({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"})}))},y=function(n){var t=n.className;return e.jsx("svg",o({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"})}))},I=function(e){return e.position*(e.rowHeight+1)-1},S=function(e){return e.position*(e.rowHeight+1)},j=function(t){var r=t.children,a=t.onClose,i=t.open,l=t.overflow,s=void 0===l?"auto":l,c=t.setOpen,u=t.width,d=t.containerRef,f=t.positioning,h=void 0===f?"fixed":f,v=x().mainBodyRef,p=n.useRef(null),m=n.useRef(null),g=n.useState("bottom-left"),w=g[0],b=g[1],C=n.useState({}),y=C[0],I=C[1],S=n.useState(!1),j=S[0],E=S[1];return n.useEffect(function(){i&&p.current?(E(!1),!m.current&&p.current.parentElement&&(m.current=p.current.parentElement),requestAnimationFrame(function(){if(p.current&&m.current){var e,n=p.current,t=m.current.getBoundingClientRect(),r=n.offsetHeight,o=u||n.offsetWidth,a=(e=(null==d?void 0:d.current)?d.current.getBoundingClientRect():(null==v?void 0:v.current)?v.current.getBoundingClientRect():{top:0,right:window.innerWidth,bottom:window.innerHeight,left:0,width:window.innerWidth,height:window.innerHeight,x:0,y:0,toJSON:function(){}}).bottom-t.bottom,i=t.top-e.top,l="bottom",s={};(r>a&&r<=i||r>a&&i>a)&&(l="top");var c="left";o>e.right-t.right+t.width&&(c="right"),"fixed"===h?("bottom"===l?s.top=t.bottom+4:s.bottom=window.innerHeight-t.top+4,"left"===c?s.left=t.left:s.right=window.innerWidth-t.right):("bottom"===l?s.top=t.height+4:s.bottom=t.height+4,"left"===c?s.left=0:s.right=0),b("".concat(l,"-").concat(c)),I(s),E(!0)}})):i||E(!1)},[i,u,d,v,h]),n.useEffect(function(){var e=function(e){if(i&&p.current){var n=e.target;p.current&&!p.current.contains(n)&&(c(!1),null==a||a())}};return i&&window.addEventListener("scroll",e,!0),function(){window.removeEventListener("scroll",e,!0)}},[i,a,c]),n.useEffect(function(){var e=function(e){p.current&&!p.current.contains(e.target)&&(c(!1),null==a||a())};return i&&document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}},[a,i,c]),n.useEffect(function(){var e=function(e){"Escape"===e.key&&i&&(c(!1),null==a||a())};return i&&document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}},[a,i,c]),i?e.jsx("div",o({ref:p,className:"st-dropdown-content st-dropdown-".concat(w),onClick:function(e){return e.stopPropagation()},style:o(o({position:h,width:u?"".concat(u,"px"):"auto",visibility:j?"visible":"hidden"},y),{overflow:s})},{children:r})):null},E=function(n){var t=n.children,r=n.onClick,a=n.isSelected,i=void 0!==a&&a,l=n.disabled,s=void 0!==l&&l,c=n.className,u=void 0===c?"":c;return e.jsx("div",o({className:"st-dropdown-item ".concat(i?"selected":""," ").concat(s?"disabled":""," ").concat(u),onClick:function(){!s&&r&&r()},role:"option","aria-selected":i,"aria-disabled":s},{children:t}))},R=function(t){var r=t.onBlur,a=t.onChange,i=t.open,l=t.setOpen,s=t.value,c=n.useState(s),u=c[0],d=c[1],f=function(e){d(e),a(e),l(!1),r()};return e.jsxs(j,o({open:i,onClose:function(){r()},setOpen:l,width:120},{children:[e.jsx(E,o({isSelected:!0===u,onClick:function(){return f(!0)}},{children:"True"})),e.jsx(E,o({isSelected:!1===u,onClick:function(){return f(!1)}},{children:"False"}))]}))},k=function(t){var r=t.defaultValue,o=t.onBlur,a=t.onChange,i=n.useRef(null);return e.jsx("input",{className:"editable-cell-input",ref:i,autoFocus:!0,type:"text",defaultValue:null!=r?r:"",onBlur:o,onChange:function(e){var n=e.target.value;a(n)},onKeyDown:function(e){e.stopPropagation(),"Enter"!==e.key&&"Escape"!==e.key||o()},onMouseDown:function(e){e.stopPropagation()}})},N=function(t){var r=t.defaultValue,o=t.onBlur,a=t.onChange,i=n.useRef(null);return e.jsx("input",{className:"editable-cell-input",ref:i,autoFocus:!0,defaultValue:r.toString(),onBlur:o,onChange:function(e){var n=e.target.value;/^\d*\.?\d*$/.test(n)&&a(n)},onKeyDown:function(e){e.stopPropagation(),"Enter"!==e.key&&"Escape"!==e.key||o()},onMouseDown:function(e){e.stopPropagation()}})},F=function(t){var r,a,i=t.onChange,l=t.onClose,s=t.value,c=x(),u=c.nextIcon,d=c.prevIcon,f=n.useState(s||new Date),h=f[0],v=f[1],p=n.useState("days"),m=p[0],g=p[1],w=function(e,n){return new Date(e,n+1,0).getDate()};return e.jsxs("div",o({className:"st-datepicker"},{children:[e.jsxs("div",o({className:"st-datepicker-header"},{children:["days"===m&&e.jsxs(e.Fragment,{children:[e.jsx("button",o({onClick:function(){v(new Date(h.getFullYear(),h.getMonth()-1,1))},className:"st-datepicker-nav-btn"},{children:d})),e.jsxs("div",o({className:"st-datepicker-header-label",onClick:function(){return g("months")}},{children:[(a=h,a.toLocaleString("default",{month:"long"}))," ",h.getFullYear()]})),e.jsx("button",o({onClick:function(){v(new Date(h.getFullYear(),h.getMonth()+1,1))},className:"st-datepicker-nav-btn"},{children:u}))]}),"months"===m&&e.jsx("div",o({className:"st-datepicker-header-label",onClick:function(){return g("years")}},{children:h.getFullYear()})),"years"===m&&e.jsx("div",o({className:"st-datepicker-header-label"},{children:"Select Year"}))]})),e.jsxs("div",o({className:"st-datepicker-grid st-datepicker-".concat(m,"-grid")},{children:["days"===m&&function(){var n=[],t=h.getFullYear(),r=h.getMonth(),a=w(t,r),c=function(e,n){return new Date(e,n,1).getDay()}(t,r),u=w(t,r-1);["Su","Mo","Tu","We","Th","Fr","Sa"].forEach(function(t,r){n.push(e.jsx("div",o({className:"st-datepicker-weekday"},{children:t}),"header-".concat(r)))});for(var d=function(t){var r=u-c+t+1;n.push(e.jsx("div",o({className:"st-datepicker-day other-month",onClick:function(){return function(e){var n=new Date(h.getFullYear(),h.getMonth()-1,e);v(n),i(n),null==l||l()}(r)}},{children:r}),"prev-".concat(r)))},f=0;f<c;f++)d(f);for(var p=function(a){var c=a===(new Date).getDate()&&r===(new Date).getMonth()&&t===(new Date).getFullYear(),u=a===new Date(s).getDate()&&r===new Date(s).getMonth()&&t===new Date(s).getFullYear();n.push(e.jsx("div",o({className:"st-datepicker-day ".concat(c?"today":""," ").concat(u?"selected":""),onClick:function(){return function(e){var n=new Date(h.getFullYear(),h.getMonth(),e);v(n),i(n),null==l||l()}(a)}},{children:a}),"day-".concat(a)))},m=1;m<=a;m++)p(m);var g=35-(c+a),x=function(t){n.push(e.jsx("div",o({className:"st-datepicker-day other-month",onClick:function(){return function(e){var n=new Date(h.getFullYear(),h.getMonth()+1,e);v(n),i(n),null==l||l()}(t)}},{children:t}),"next-".concat(t)))};for(m=1;m<=g;m++)x(m);return n}(),"months"===m&&(r=[],Array.from({length:12},function(e,n){return new Date(2e3,n,1).toLocaleString("default",{month:"short"})}).forEach(function(n,t){var a=t===h.getMonth();r.push(e.jsx("div",o({className:"st-datepicker-month ".concat(a?"selected":""),onClick:function(){return function(e){v(new Date(h.getFullYear(),e,1)),g("days")}(t)}},{children:n}),"month-".concat(t)))}),r),"years"===m&&function(){for(var n=[],t=h.getFullYear(),r=t-6,a=function(r){var a=r===t;n.push(e.jsx("div",o({className:"st-datepicker-year ".concat(a?"selected":""),onClick:function(){return function(e){v(new Date(e,h.getMonth(),1)),g("months")}(r)}},{children:r}),"year-".concat(r)))},i=r;i<r+12;i++)a(i);return n}()]})),e.jsx("div",o({className:"st-datepicker-footer"},{children:e.jsx("button",o({className:"st-datepicker-today-btn",onClick:function(){var e=new Date;v(e),i(e),null==l||l()}},{children:"Today"}))}))]}))},D=function(e){if(!e)return new Date;var n=e.toString().split("-").map(Number),t=n[0],r=n[1],o=n[2],a=new Date;return a.setFullYear(t),a.setMonth(r-1),a.setDate(o),isNaN(a.getTime())?new Date:a},M=function(t){var r=t.onBlur,a=t.onChange,i=t.open,l=t.setOpen,s=t.value;n.useEffect(function(){var e=setTimeout(function(){var e=document.querySelector(".st-dropdown-container");e instanceof HTMLElement&&e.focus()},0);return function(){return clearTimeout(e)}},[]);var c=function(){r()};return e.jsx(j,o({open:i,onClose:c,setOpen:l,width:280},{children:e.jsx(F,{value:D(s),onChange:function(e){var n=e.toISOString().split("T")[0];a(n),l(!1),r()},onClose:c})}))},T=function(t){var r=t.onBlur,a=t.onChange,i=t.open,l=t.options,s=t.setOpen,c=t.value,u=n.useState(c||""),d=u[0],f=u[1];return e.jsx(j,o({open:i,onClose:function(){r()},setOpen:s,width:150},{children:e.jsx("div",o({className:"st-enum-dropdown-content"},{children:l.map(function(n){return e.jsx(E,o({isSelected:d===n.value,onClick:function(){return e=n.value,f(e),a(e),s(!1),void r();var e}},{children:n.label}),n.value)})}))}))},H=function(n){var t=n.enumOptions,r=void 0===t?[]:t,o=n.onChange,a=n.setIsEditing,i=n.type,l=void 0===i?"string":i,s=n.value,c=function(){a(!1)};if("boolean"===l&&"boolean"==typeof s)return e.jsx(R,{onBlur:c,onChange:function(e){return o(e)},open:!0,setOpen:a,value:s});if("date"===l)return e.jsx(M,{onBlur:c,onChange:o,open:!0,setOpen:a,value:s});if("enum"===l){var u="string"==typeof s?s:"";return e.jsx(T,{onBlur:c,onChange:o,open:!0,options:r,setOpen:a,value:u})}if("number"===l&&"number"==typeof s)return e.jsx(N,{defaultValue:s,onBlur:c,onChange:function(e){var n=""===e?0:parseFloat(e);o(isNaN(n)?0:n)}});var d=null==s?"":String(s);return e.jsx(k,{defaultValue:d,onBlur:c,onChange:o})},L=0,A=function(){return function(e){var n=e.callback,t=e.callbackProps,r=e.limit,o=Date.now();(0===L||o-L>=r)&&(L=o,n(t))}},W=function(e){if(null===e||"object"!=typeof e)return e;if(Array.isArray(e))return e.map(W);var n={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=W(e[t]));return n},B=function(e,n){return e.filter(function(e){return e.pinned===n}).some(function(e){return!e.hide})},O=Date.now(),q={screenX:0,screenY:0},P=function(e,n,t){void 0===t&&(t=[]);for(var r=0;r<e.length;r++){var o=e[r];if(o.accessor===n)return l(l([],t,!0),[r],!1);if(o.children&&o.children.length>0){var a=P(o.children,n,l(l([],t,!0),[r],!1));if(a)return a}}return null},z=function(e){return"left"===e.pinned?"left":"right"===e.pinned?"right":"main"};function Y(e,n,t){var r,a,i=W(e),l=!1;try{var s=z(t),c=i.findIndex(function(e){return e.accessor===n.accessor}),u=i.findIndex(function(e){return e.accessor===t.accessor});if(-1===c||-1===u)return{newHeaders:i,emergencyBreak:l=!0};var d=i.splice(c,1)[0],f=(r=s,a=o({},d),"left"===r?a.pinned="left":"right"===r?a.pinned="right":delete a.pinned,a),h=u;i.splice(h,0,f)}catch(e){console.error("Error in insertHeaderAcrossSections:",e),l=!0}return{newHeaders:i,emergencyBreak:l}}var U=function(e){var t,r,o=e.draggedHeaderRef,a=e.headers,i=e.hoveredHeaderRef,s=e.onColumnOrderChange,c=e.onTableHeaderDragEnd,u=x().setHeaders,d=(t=a,r=n.useRef(t),n.useEffect(function(){JSON.stringify(r.current)!==JSON.stringify(t)&&(r.current=t)},[t]),r.current);return{handleDragStart:function(e){o.current=e,O=Date.now()},handleDragOver:function(e){var n=e.event,t=e.hoveredHeader;if(n.preventDefault(),a&&o.current){var r=n.currentTarget.getAnimations().some(function(e){return"running"===e.playState}),l=n.screenX,s=n.screenY,u=Math.sqrt(Math.pow(l-q.screenX,2)+Math.pow(s-q.screenY,2));i.current=t;var f,h=o.current,v=!1;if(z(h)!==z(t)){f=(y=Y(a,h,t)).newHeaders,v=y.emergencyBreak}else{var p=a,m=P(p,h.accessor),g=P(p,t.accessor);if(!m||!g)return;var w=m.length,x=g.length,b=g;if(w!==x){var C=x-w;C>0&&(b=g.slice(0,-C))}var y=function(e,n,t){var r=W(e),o=!1;function a(e,n){for(var t=e,r=0;r<n.length-1;r++)t=t[n[r]].children;return t[n[n.length-1]]}function i(e,n,t){for(var r=e,a=0;a<n.length-1;a++){if(!r[n[a]].children){o=!0;break}r=r[n[a]].children}r[n[n.length-1]]=t}var l=a(r,n);return i(r,n,a(r,t)),i(r,t,l),{newHeaders:r,emergencyBreak:o}}(p,m,b);f=y.newHeaders,v=y.emergencyBreak}if(!(r||t.accessor===h.accessor||u<10||JSON.stringify(f)===JSON.stringify(a)||v)){var I=Date.now();JSON.stringify(f)===JSON.stringify(d)&&(I-O<1500||u<40)||(O=I,q={screenX:l,screenY:s},c(f))}}},handleDragEnd:function(){o.current=null,i.current=null,setTimeout(function(){u(function(e){return l([],e,!0)}),null==s||s(a)},10)}}},K=function(e){var n=e.content,t=e.header;return"boolean"==typeof n?n?"True":"False":"date"===t.type&&null!==n&&("string"==typeof n||"number"==typeof n||"object"==typeof n&&n instanceof Date)?new Date(n).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):n},G=n.forwardRef(function(t,r){var a=t.borderClass,i=t.colIndex,l=t.header,c=t.isHighlighted,d=t.isInitialFocused,f=t.nestedIndex,h=t.rowIndex,p=t.visibleRow,m=x(),g=m.cellRegistry,w=m.cellUpdateFlash,b=m.draggedHeaderRef,C=m.expandIcon,y=m.expandedRows,I=m.handleMouseDown,S=m.handleMouseOver,j=m.headers,E=m.hoveredHeaderRef,R=m.isCopyFlashing,k=m.isWarningFlashing,N=m.onCellEdit,F=m.onTableHeaderDragEnd,D=m.rowGrouping,M=m.rowIdAccessor,T=m.setExpandedRows,L=m.theme,W=m.useOddColumnBackground,B=p.depth,O=p.row,q=n.useState(O[l.accessor]),P=q[0],z=q[1],Y=n.useState(!1),G=Y[0],V=Y[1],X=n.useState(!1),J=X[0],$=X[1],_=n.useRef(null),Q=v(O,h,M),Z=D&&D[B],ee=!!Z&&function(e,n){if(!n)return!1;var t=e[n];return Array.isArray(t)&&t.length>0}(O,Z),ne=y.has(String(Q)),te=R({rowIndex:h,colIndex:i,rowId:Q}),re=k({rowIndex:h,colIndex:i,rowId:Q}),oe=U({draggedHeaderRef:b,headers:j,hoveredHeaderRef:E,onTableHeaderDragEnd:F}).handleDragOver,ae=A(),ie="cell-".concat(h,"-").concat(i),le=u({rowId:Q,accessor:l.accessor});n.useEffect(function(){if(g){var e="".concat(Q,"-").concat(l.accessor);return g.set(e,{updateContent:function(e){P!==e?(z(e),w&&($(!0),_.current&&clearTimeout(_.current),_.current=setTimeout(function(){$(!1)},800))):z(e)}}),function(){g.delete(e),_.current&&clearTimeout(_.current)}}},[g,w,Q,l.accessor,P]),n.useEffect(function(){if(J){var e=setTimeout(function(){$(!1)},850);return function(){return clearTimeout(e)}}},[J]),n.useEffect(function(){z(O[l.accessor])},[O,l.accessor]);var se="boolean"===l.type||"date"===l.type||"enum"===l.type,ce=Boolean(null==l?void 0:l.isEditable),ue="st-cell ".concat(B>0&&l.expandable?"st-cell-depth-".concat(B):""," ").concat(c?d?"st-cell-selected-first ".concat(a):"st-cell-selected ".concat(a):""," ").concat(ce?"clickable":""," ").concat(J?d?"st-cell-updating-first":"st-cell-updating":""," ").concat(te?d?"st-cell-copy-flash-first":"st-cell-copy-flash":""," ").concat(re?d?"st-cell-warning-flash-first":"st-cell-warning-flash":""," ").concat(W?f%2==0?"even-column":"odd-column":""),de=n.useCallback(function(e){z(e),O[l.accessor]=e,null==N||N({accessor:l.accessor,newValue:e,row:O,rowIndex:h})},[l.accessor,N,O,h]),fe=n.useCallback(function(){T(function(e){var n=new Set(e),t=String(Q);return n.has(t)?n.delete(t):n.add(t),n})},[Q,T]);return G&&!se?e.jsx("div",o({className:"st-cell-editing",id:s({accessor:l.accessor,rowIndex:h+1}),onMouseDown:function(e){return e.stopPropagation()},onKeyDown:function(e){return e.stopPropagation()}},{children:e.jsx(H,{enumOptions:l.enumOptions,onChange:de,setIsEditing:V,type:l.type,value:P})})):e.jsxs("div",o({className:ue,id:ie,onDoubleClick:function(){return l.isEditable&&V(!0)},onMouseDown:function(){G||I({rowIndex:h,colIndex:i,rowId:Q})},onMouseOver:function(){G||S({rowIndex:h,colIndex:i,rowId:Q})},onDragOver:function(e){return ae({callback:oe,callbackProps:{event:e,hoveredHeader:l},limit:50})},onKeyDown:function(e){G||"F2"!==e.key&&"Enter"!==e.key||!l.isEditable||G||(e.preventDefault(),V(!0))},ref:r,"data-row-index":h,"data-col-index":i,"data-row-id":Q,"data-accessor":l.accessor},{children:[l.expandable&&ee?e.jsx("div",o({className:"st-icon-container st-expand-icon-container ".concat(ne?"expanded":"collapsed"),onClick:fe},{children:C})):null,e.jsx("span",o({className:"st-cell-content ".concat("right"===l.align?"right-aligned":"center"===l.align?"center-aligned":"left-aligned")},{children:e.jsx("span",{children:l.cellRenderer?l.cellRenderer({accessor:l.accessor,colIndex:i,row:O,theme:L}):K({content:P,header:l})})})),G&&se&&e.jsx(H,{enumOptions:l.enumOptions,onChange:de,setIsEditing:V,type:l.type,value:P})]}),le)}),V=function(n){var t=n.columnIndexStart,r=n.columnIndices,o=n.headers,a=n.pinned,i=n.rowIndex,l=n.rowIndices,u=n.visibleRow,d=o.filter(function(e){return c({header:e,pinned:a})});return e.jsx(e.Fragment,{children:d.map(function(n,c){return e.jsx(X,{columnIndices:r,header:n,headers:o,nestedIndex:c+(null!=t?t:0),pinned:a,rowIndex:i,rowIndices:l,visibleRow:u},s({accessor:n.accessor,rowIndex:i+1}))})})},X=function(t){var r=t.columnIndices,o=t.header,a=t.headers,i=t.nestedIndex,l=t.pinned,u=t.rowIndex,d=t.rowIndices,f=t.visibleRow,h=r[o.accessor],p=x(),m=p.getBorderClass,g=p.isSelected,w=p.isInitialFocusedCell,b=p.rowIdAccessor;if(o.children){var C=o.children.filter(function(e){return c({header:e,pinned:l})});return e.jsx(n.Fragment,{children:C.map(function(n){return e.jsx(X,{columnIndices:r,header:n,headers:a,nestedIndex:i,pinned:l,rowIndex:u,rowIndices:d,visibleRow:f},s({accessor:n.accessor,rowIndex:u+1}))})})}var y=v(f.row,u,b),I={rowIndex:u,colIndex:h,rowId:y},S=m(I),j=g(I),E=w(I);return e.jsx(G,{borderClass:S,colIndex:h,header:o,isHighlighted:j,isInitialFocused:E,nestedIndex:i,rowIndex:u,visibleRow:f},s({accessor:o.accessor,rowIndex:u+1}))},J=function(n){var t=n.columnIndices,r=n.columnIndexStart,a=n.gridTemplateColumns,i=n.headers,l=n.hoveredIndex,s=n.index,c=n.pinned,u=n.rowHeight,d=n.rowIndices,f=n.setHoveredIndex,h=n.visibleRow,v=x().useHoverRowBackground,p=h.position,m=p%2==0;return e.jsx("div",o({className:"st-row ".concat(m?"even":"odd"," ").concat(l===s&&v?"hovered":""),onMouseEnter:function(){f(s)},style:{gridTemplateColumns:a,top:S({position:p,rowHeight:u}),height:"".concat(u,"px")}},{children:e.jsx(V,{columnIndexStart:r,columnIndices:t,headers:i,pinned:c,rowIndex:p,rowIndices:d,visibleRow:h},s)}))},$=function(t){var r=t.displayStrongBorder,a=t.position,i=t.rowHeight,l=t.templateColumns,s=t.rowIndex,c=n.useRef(null);return e.jsx("div",o({className:"st-row-separator ".concat(r?"st-last-group-row":""),onMouseDown:function(e){if(void 0!==s){for(var n=e.currentTarget.getBoundingClientRect(),t=e.clientX-n.left,r=l.split(" ").map(function(e){if(e.includes("px"))return parseFloat(e);if(e.includes("fr")){var t=l.split(" ").filter(function(e){return e.includes("fr")}).length;return n.width/t}return 100}),o=0,a=0,i=0;i<r.length;i++){if(t<=o+r[i]){a=i;break}o+=r[i],a=i}var u="cell-".concat(s+1,"-").concat(a+1),d=document.getElementById(u);if(d){c.current=d;var f=new MouseEvent("mousedown",{bubbles:!0,cancelable:!0,view:window,button:0});d.dispatchEvent(f)}}},onMouseUp:function(){if(c.current){var e=new MouseEvent("mouseup",{bubbles:!0,cancelable:!0,view:window,button:0});c.current.dispatchEvent(e),c.current=null}},style:{gridTemplateColumns:l,top:I({position:a,rowHeight:i})}},{children:e.jsx("div",{style:{gridColumn:"1 / -1"}})}))},_=n.createContext(void 0),Q=["default"],Z=function(e){var t=e.childRef,r=e.children,o=function(){var e=n.useContext(_);if(!e)throw new Error("useScrollSyncContext must be used within a ScrollSyncProvider");return e}(),a=o.registerPane,i=o.unregisterPane;return n.useEffect(function(){return t.current&&a(t.current,Q),function(){t.current&&i(t.current,Q)}},[t,a,i]),n.cloneElement(r,{ref:function(e){t.current=e}})},ee=function(n){var t=n.condition,r=n.wrapper,o=n.children;return e.jsx(e.Fragment,{children:t?r(o):e.jsx(e.Fragment,{children:o})})},ne=function(t){var r=t.columnIndexStart,a=t.columnIndices,i=t.headers,l=t.hoveredIndex,s=t.pinned,c=t.ref,u=t.rowHeight,d=t.rowIndices,f=t.setHoveredIndex,h=t.templateColumns,v=t.totalHeight,p=t.visibleRows,m=t.width,g=s?"st-body-pinned-".concat(s):"st-body-main";return n.useMemo(function(){return B(i,s)},[i,s])?e.jsx(ee,o({condition:!s,wrapper:function(n){return e.jsx(Z,o({childRef:c},{children:n}))}},{children:e.jsx("div",o({className:g,ref:c,style:o({position:"relative",height:"".concat(v,"px"),width:m},!s&&{flexGrow:1})},{children:p.map(function(t,o){return e.jsxs(n.Fragment,{children:[0!==o&&e.jsx($,{displayStrongBorder:t.isLastGroupRow,position:t.position,rowHeight:u,templateColumns:h,rowIndex:o-1}),e.jsx(J,{columnIndexStart:r,columnIndices:a,gridTemplateColumns:h,headers:i,hoveredIndex:l,index:o,pinned:s,rowHeight:u,rowIndices:d,setHoveredIndex:f,visibleRow:t})]},t.position)})}))})):null};function te(e){var n=e.headers,t=e.pinnedLeftColumns,r=e.pinnedRightColumns,o={},a=0,i=function(e,n){void 0===n&&(n=!1),n||a++,o[e.accessor]=a,e.children&&e.children.length>0&&e.children.filter(function(e){return c({header:e})}).forEach(function(e,n){i(e,0===n)})};return t.forEach(function(e,n){i(e,0===n)}),n.filter(function(e){return!e.pinned&&c({header:e})}).forEach(function(e,n){var r=0===n&&0===t.length;i(e,r)}),r.forEach(function(e){i(e,!1)}),o}var re=function(t){var r=t.headerContainerRef,a=t.mainTemplateColumns,i=t.pinnedLeftColumns,l=t.pinnedLeftTemplateColumns,s=t.pinnedLeftWidth,c=t.pinnedRightColumns,u=t.pinnedRightTemplateColumns,d=t.pinnedRightWidth,f=t.setScrollTop,h=t.tableRows,p=t.visibleRows,m=x(),g=m.headers,w=m.mainBodyRef,b=m.rowHeight,C=m.rowIdAccessor,y=m.scrollbarWidth,I=m.tableBodyContainerRef,S=n.useState(null),j=S[0],E=S[1];!function(e){var t=e.headerContainerRef,r=e.mainSectionRef,o=e.scrollbarWidth,a=n.useState(!1),i=a[0],l=a[1];n.useEffect(function(){var e=null==t?void 0:t.current;if(i&&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")}},[t,i,o]),n.useEffect(function(){var e=null==t?void 0:t.current,n=null==r?void 0:r.current;if(n&&e){var o=function(){if(n){var e=n.scrollHeight>n.clientHeight;l(e)}};o();var a=new ResizeObserver(function(){o()});return a.observe(n),function(){n&&a.unobserve(n)}}},[t,r])}({headerContainerRef:r,mainSectionRef:I,scrollbarWidth:y});var R=n.useRef(null),k=function(e){return e.length}(h),N=k*(b+1)-1,F=n.useMemo(function(){return te({headers:g,pinnedLeftColumns:i,pinnedRightColumns:c})},[g,i,c]),D=n.useMemo(function(){var e={};return p.forEach(function(n,t){var r=String(v(n.row,t,C));e[r]=t}),e},[p,C]),M={columnIndices:F,headerContainerRef:r,headers:g,hoveredIndex:j,rowHeight:b,rowIndices:D,setHoveredIndex:E,visibleRows:p};return e.jsxs("div",o({className:"st-body-container",onMouseLeave:function(){return E(null)},onScroll:function(e){var n=e.currentTarget.scrollTop;R.current&&cancelAnimationFrame(R.current),R.current=requestAnimationFrame(function(){f(n)})},ref:I},{children:[e.jsx(ne,o({},M,{pinned:"left",templateColumns:l,totalHeight:N,width:s})),e.jsx(ne,o({},M,{columnIndexStart:i.length,ref:w,templateColumns:a,totalHeight:N})),e.jsx(ne,o({},M,{columnIndexStart:i.length+a.length,pinned:"right",templateColumns:u,totalHeight:N,width:d}))]}))},oe=function(e){return void 0===e&&(e=0),e?e+1:0},ae=function(e){var n=e.event,t=e.gridColumnEnd,r=e.gridColumnStart,o=e.header,a=e.headers,i=e.setHeaders,s=e.startWidth;n.preventDefault();var c="clientX"in n?n.clientX:n.touches[0].clientX,u="touches"in n;if(o&&!o.hide){var v=h(o),p=t-r>1,m=p?d(o):[o],g=function(e){var n="right"===o.pinned?c-e:e-c;if(p&&m.length>1)ie({delta:n,leafHeaders:m,minWidth:v,startWidth:s});else{var t=Math.max(s+n,v);o.width=t}a.forEach(function(e){f(e)});var r=l([],a,!0);i(r)};if(u){var w=function(e){var n=e.touches[0];g(n.clientX)},x=function(){document.removeEventListener("touchmove",w),document.removeEventListener("touchend",x)};document.addEventListener("touchmove",w),document.addEventListener("touchend",x)}else{var b=function(e){g(e.clientX)},C=function(){document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",C)};document.addEventListener("mousemove",b),document.addEventListener("mouseup",C)}}},ie=function(e){var n=e.delta,t=e.leafHeaders,r=e.minWidth,o=e.startWidth,a=t.reduce(function(e,n){return Math.min(e,h(n))},40),i=t.reduce(function(e,n){return e+("number"==typeof n.width?n.width:150)},0),l=Math.max(o+n,a)-i;t.forEach(function(e){var n="number"==typeof e.width?e.width:150,t=l*(n/i),o=Math.max(n+t,r);e.width=o})},le=function(e){var n=e.headers,t=0,r=0,o=0;return n.forEach(function(e){if(!e.hide){var n=d(e).reduce(function(e,n){return e+function(e){if(e.hide)return 0;if("number"==typeof e.width)return e.width;if("string"==typeof e.width&&e.width.endsWith("px"))return parseFloat(e.width);var n=document.getElementById(s({accessor:e.accessor,rowIndex:0}));return(null==n?void 0:n.offsetWidth)||150}(n)},0);"left"===e.pinned?t+=n:"right"===e.pinned?r+=n:o+=n}}),{leftWidth:oe(t),rightWidth:oe(r),mainWidth:o}},se=function(n){var t=n.className,r=n.style;return e.jsx("svg",o({"aria-hidden":"true",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",className:t,style:o({height:"1em"},r)},{children:e.jsx("path",{d:"M3.9 54.9C10.5 40.9 24.5 32 40 32l432 0c15.5 0 29.5 8.9 36.1 22.9s4.6 30.5-5.2 42.5L320 320.9 320 448c0 12.1-6.8 23.2-17.7 28.6s-23.8 4.3-33.5-3l-64-48c-8.1-6-12.8-15.5-12.8-25.6l0-79.1L9 97.3C-.7 85.4-2.8 68.8 3.9 54.9z"})}))},ce={equals:"Equals",notEquals:"Not equals",contains:"Contains",notContains:"Does not contain",startsWith:"Starts with",endsWith:"Ends with",greaterThan:"Greater than",lessThan:"Less than",greaterThanOrEqual:"Greater than or equal",lessThanOrEqual:"Less than or equal",between:"Between",notBetween:"Not between",before:"Before",after:"After",in:"Is one of",notIn:"Is not one of",isEmpty:"Is empty",isNotEmpty:"Is not empty"},ue=function(e){switch(e){case"string":return["equals","notEquals","contains","notContains","startsWith","endsWith","isEmpty","isNotEmpty"];case"number":return["equals","notEquals","greaterThan","lessThan","greaterThanOrEqual","lessThanOrEqual","between","notBetween","isEmpty","isNotEmpty"];case"boolean":return["equals","isEmpty","isNotEmpty"];case"date":return["equals","notEquals","before","after","between","notBetween","isEmpty","isNotEmpty"];case"enum":return["in","notIn","isEmpty","isNotEmpty"];default:return["equals","notEquals","isEmpty","isNotEmpty"]}},de=function(e){return!["between","notBetween","in","notIn","isEmpty","isNotEmpty"].includes(e)},fe=function(e){return["between","notBetween","in","notIn"].includes(e)},he=function(e){return["isEmpty","isNotEmpty"].includes(e)},ve=function(n){var t=n.children;return e.jsx("div",o({className:"st-filter-container"},{children:t}))},pe=function(){return e.jsx("svg",o({className:"st-custom-select-arrow",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}))},me=function(t){var r=t.value,a=t.onChange,i=t.options,l=t.placeholder,s=void 0===l?"Select...":l,c=t.className,u=void 0===c?"":c,d=t.disabled,f=void 0!==d&&d,h=n.useState(!1),v=h[0],p=h[1],m=n.useState(-1),g=m[0],w=m[1],x=n.useRef(null),b=i.find(function(e){return e.value===r});n.useEffect(function(){var e=function(e){if(v)switch(e.key){case"ArrowDown":e.preventDefault(),w(function(e){return e<i.length-1?e+1:0});break;case"ArrowUp":e.preventDefault(),w(function(e){return e>0?e-1:i.length-1});break;case"Enter":e.preventDefault(),g>=0&&(a(i[g].value),p(!1),w(-1));break;case"Escape":e.preventDefault(),p(!1),w(-1)}};if(v)return document.addEventListener("keydown",e),function(){return document.removeEventListener("keydown",e)}},[v,g,i,a]);return e.jsxs("div",o({ref:x,className:"st-custom-select ".concat(u," ").concat(f?"st-custom-select-disabled":""," ").concat(v?"st-custom-select-open":"").trim()},{children:[e.jsxs("button",o({type:"button",className:"st-custom-select-trigger",onClick:function(){if(!f)if(p(!v),v)w(-1);else{var e=i.findIndex(function(e){return e.value===r});w(e>=0?e:0)}},disabled:f,"aria-haspopup":"listbox","aria-expanded":v,"aria-labelledby":"select-label"},{children:[e.jsx("span",o({className:"st-custom-select-value"},{children:b?b.label:s})),e.jsx(pe,{})]})),e.jsx(j,o({open:v,setOpen:p,onClose:function(){p(!1),w(-1)},positioning:"absolute",overflow:"auto"},{children:e.jsx("div",o({className:"st-custom-select-options",role:"listbox"},{children:i.map(function(n,t){return e.jsx("div",o({className:"st-custom-select-option ".concat(n.value===r?"st-custom-select-option-selected":""," ").concat(t===g?"st-custom-select-option-focused":"").trim(),role:"option","aria-selected":n.value===r,onClick:function(){return e=n.value,a(e),p(!1),void w(-1);var e}},{children:n.label}),n.value)})}))}))]}))},ge=function(n){var t=n.value,r=n.onChange,a=n.operators.map(function(e){return{value:e,label:ce[e]}});return e.jsx("div",o({className:"st-filter-section"},{children:e.jsx(me,{value:t,onChange:function(e){r(e)},options:a})}))},we=function(n){var t=n.type,r=void 0===t?"text":t,o=n.value,a=n.onChange,i=n.placeholder,l=n.autoFocus,s=void 0!==l&&l,c=n.className,u=void 0===c?"":c;return e.jsx("input",{type:r,value:o,onChange:function(e){return a(e.target.value)},placeholder:i,autoFocus:s,className:"st-filter-input ".concat(u).trim()})},xe=function(n){var t=n.children,r=n.className,a=void 0===r?"":r;return e.jsx("div",o({className:"st-filter-section ".concat(a).trim()},{children:t}))},be=function(n){var t=n.onApply,r=n.onClear,a=n.canApply,i=n.showClear;return e.jsxs("div",o({className:"st-filter-actions"},{children:[e.jsx("button",o({onClick:t,disabled:!a,className:"st-filter-button st-filter-button-apply ".concat(a?"":"st-filter-button-disabled")},{children:"Apply"})),i&&r&&e.jsx("button",o({onClick:r,className:"st-filter-button st-filter-button-clear"},{children:"Clear"}))]}))},Ce=function(t){var r=t.header,a=t.currentFilter,i=t.onApplyFilter,l=t.onClearFilter,s=n.useState((null==a?void 0:a.operator)||"contains"),c=s[0],u=s[1],d=n.useState(String((null==a?void 0:a.value)||"")),f=d[0],h=d[1],v=ue("string");n.useEffect(function(){a?(u(a.operator),h(String(a.value||""))):(u("contains"),h(""))},[a]);var p=he(c)||f.trim();return e.jsxs(ve,{children:[e.jsx(ge,{value:c,onChange:u,operators:v}),de(c)&&e.jsx(xe,{children:e.jsx(we,{type:"text",value:f,onChange:h,placeholder:"Filter...",autoFocus:!0})}),e.jsx(be,{onApply:function(){var e=o({accessor:r.accessor,operator:c},de(c)&&{value:f});i(e)},onClear:l,canApply:!!p,showClear:!!a})]})},ye=function(t){var r,o,a=t.header,i=t.currentFilter,l=t.onApplyFilter,s=t.onClearFilter,c=n.useState((null==i?void 0:i.operator)||"equals"),u=c[0],d=c[1],f=n.useState(String((null==i?void 0:i.value)||"")),h=f[0],v=f[1],p=n.useState(String((null===(r=null==i?void 0:i.values)||void 0===r?void 0:r[0])||"")),m=p[0],g=p[1],w=n.useState(String((null===(o=null==i?void 0:i.values)||void 0===o?void 0:o[1])||"")),x=w[0],b=w[1],C=ue("number");n.useEffect(function(){var e,n;i?(d(i.operator),v(String(i.value||"")),g(String((null===(e=i.values)||void 0===e?void 0:e[0])||"")),b(String((null===(n=i.values)||void 0===n?void 0:n[1])||""))):(d("equals"),v(""),g(""),b(""))},[i]);return e.jsxs(ve,{children:[e.jsx(ge,{value:u,onChange:d,operators:C}),de(u)&&e.jsx(xe,{children:e.jsx(we,{type:"number",value:h,onChange:v,placeholder:"Enter number...",autoFocus:!0})}),fe(u)&&e.jsxs(xe,{children:[e.jsx(we,{type:"number",value:m,onChange:g,placeholder:"From...",autoFocus:!0,className:"st-filter-input-range-from"}),e.jsx(we,{type:"number",value:x,onChange:b,placeholder:"To..."})]}),e.jsx(be,{onApply:function(){var e={accessor:a.accessor,operator:u};de(u)?e.value=parseFloat(h):fe(u)&&(e.values=[parseFloat(m.toString()),parseFloat(x.toString())]),l(e)},onClear:s,canApply:!!he(u)||(de(u)?""!==h.trim():!!fe(u)&&""!==String(m).trim()&&""!==String(x).trim()),showClear:!!i})]})},Ie=function(n){var t=n.value,r=n.onChange,o=n.options,a=n.className,i=void 0===a?"":a,l=n.placeholder;return e.jsx(me,{value:t,onChange:r,options:o,className:i,placeholder:l})},Se=function(t){var r=t.header,o=t.currentFilter,a=t.onApplyFilter,i=t.onClearFilter,l=n.useState((null==o?void 0:o.operator)||"equals"),s=l[0],c=l[1],u=n.useState(void 0!==(null==o?void 0:o.value)?String(o.value):"true"),d=u[0],f=u[1],h=ue("boolean");n.useEffect(function(){o?(c(o.operator),f(void 0!==o.value?String(o.value):"true")):(c("equals"),f("true"))},[o]);var v=he(s)||""!==d;return e.jsxs(ve,{children:[e.jsx(ge,{value:s,onChange:c,operators:h}),de(s)&&e.jsx(xe,{children:e.jsx(Ie,{value:d,onChange:f,options:[{value:"true",label:"True"},{value:"false",label:"False"}]})}),e.jsx(be,{onApply:function(){var e={accessor:r.accessor,operator:s};de(s)&&(e.value="true"===d),a(e)},onClear:i,canApply:v,showClear:!!o})]})},je=function(t){var r,a,i=t.header,l=t.currentFilter,s=t.onApplyFilter,c=t.onClearFilter,u=n.useState((null==l?void 0:l.operator)||"equals"),d=u[0],f=u[1],h=n.useState((null==l?void 0:l.value)?String(l.value):""),v=h[0],p=h[1],m=n.useState((null===(r=null==l?void 0:l.values)||void 0===r?void 0:r[0])?String(l.values[0]):""),g=m[0],w=m[1],x=n.useState(String((null===(a=null==l?void 0:l.values)||void 0===a?void 0:a[1])||"")),b=x[0],C=x[1],y=ue("date");n.useEffect(function(){var e,n;l?(f(l.operator),p(String(l.value||"")),w(String((null===(e=l.values)||void 0===e?void 0:e[0])||"")),C(String((null===(n=l.values)||void 0===n?void 0:n[1])||""))):(f("equals"),p(""),w(""),C(""))},[l]);var I=function(t){var r=t.value,a=t.onChange,i=t.placeholder,l=t.autoFocus,s=t.className,c=n.useState(!1),u=c[0],d=c[1],f=n.useState(""),h=f[0],v=f[1],p=n.useRef(null);n.useEffect(function(){if(r){var e=new Date(r);isNaN(e.getTime())||v(e.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}))}else v("")},[r]),n.useEffect(function(){l&&p.current&&p.current.focus()},[l]);var m=r?new Date(r):new Date;return e.jsxs("div",o({className:"st-date-input-container",style:{position:"relative"}},{children:[e.jsx("input",{ref:p,type:"text",value:h,placeholder:i,onClick:function(){d(!u)},onKeyDown:function(e){"Enter"===e.key||" "===e.key?(e.preventDefault(),d(!u)):"Escape"===e.key&&d(!1)},readOnly:!0,className:"st-filter-input ".concat(s||""),style:{cursor:"pointer"}}),e.jsx(j,o({open:u,setOpen:d,onClose:function(){d(!1)},positioning:"absolute",overflow:"visible"},{children:e.jsx(F,{value:m,onChange:function(e){var n=e.toISOString().split("T")[0];a(n),d(!1)},onClose:function(){return d(!1)}})}))]}))};return e.jsxs(ve,{children:[e.jsx(ge,{value:d,onChange:f,operators:y}),de(d)&&e.jsx(xe,{children:e.jsx(I,{value:v,onChange:p,placeholder:"Select date...",autoFocus:!0})}),fe(d)&&e.jsxs(xe,{children:[e.jsx(I,{value:g,onChange:w,placeholder:"From date...",autoFocus:!0,className:"st-filter-input-range-from"}),e.jsx(I,{value:b,onChange:C,placeholder:"To date..."})]}),e.jsx(be,{onApply:function(){var e={accessor:i.accessor,operator:d};de(d)?e.value=v:fe(d)&&(e.values=[g,b]),s(e)},onClear:c,canApply:!!he(d)||(de(d)?""!==v.trim():!!fe(d)&&""!==g.trim()&&""!==b.trim()),showClear:!!l})]})},Ee=function(n){var t=n.className,r=n.style;return e.jsx("svg",o({"aria-hidden":"true",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",className:t,style:o({height:"10px"},r)},{children:e.jsx("path",{d:"M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"})}))},Re=function(n){var t=n.checked,r=void 0!==t&&t,a=n.children,i=n.onChange;return e.jsxs("label",o({className:"st-checkbox-label"},{children:[e.jsx("input",{checked:r,className:"st-checkbox-input",onChange:function(){i&&i(!r)},type:"checkbox"}),e.jsx("span",o({className:"st-checkbox-custom ".concat(r?"st-checked":"")},{children:r&&e.jsx(Ee,{className:"st-checkbox-checkmark"})})),a]}))},ke=function(t){var r=t.header,a=t.currentFilter,i=t.onApplyFilter,s=t.onClearFilter,c=n.useMemo(function(){return r.enumOptions||[]},[r.enumOptions]),u=n.useMemo(function(){return c.map(function(e){return e.value})},[c]),d=n.useState((null==a?void 0:a.values)?a.values.map(String):u),f=d[0],h=d[1];n.useEffect(function(){h(a?a.values?a.values.map(String):[]:u)},[a,u]);var v=f.length===u.length;return e.jsxs(ve,{children:[e.jsx(xe,{children:e.jsxs("div",o({className:"st-enum-filter-options"},{children:[e.jsx("div",o({className:"st-enum-select-all"},{children:e.jsx(Re,o({checked:v,onChange:function(e){h(e?u:[])}},{children:e.jsx("span",o({className:"st-enum-option-label st-enum-select-all-label"},{children:"Select All"}))}))})),c.map(function(n){return e.jsx(Re,o({checked:f.includes(n.value),onChange:function(){return e=n.value,void h(function(n){return n.includes(e)?n.filter(function(n){return n!==e}):l(l([],n,!0),[e],!1)});var e}},{children:e.jsx("span",o({className:"st-enum-option-label"},{children:n.label}))}),n.value)})]}))}),e.jsx(be,{onApply:function(){if(f.length!==u.length){var e={accessor:r.accessor,operator:"in",values:f};i(e)}else s()},onClear:s,canApply:0!==f.length&&f.length!==u.length,showClear:!!a})]})},Ne=function(n){var t=n.header,r=n.currentFilter,o=n.onApplyFilter,a=n.onClearFilter;return e.jsx(e.Fragment,{children:function(){switch(t.type){case"number":return e.jsx(ye,{header:t,currentFilter:r,onApplyFilter:o,onClearFilter:a});case"boolean":return e.jsx(Se,{header:t,currentFilter:r,onApplyFilter:o,onClearFilter:a});case"date":return e.jsx(je,{header:t,currentFilter:r,onApplyFilter:o,onClearFilter:a});case"enum":return e.jsx(ke,{header:t,currentFilter:r,onApplyFilter:o,onClearFilter:a});default:return e.jsx(Ce,{header:t,currentFilter:r,onApplyFilter:o,onClearFilter:a})}}()})},Fe=n.forwardRef(function(t,r){var a,i,c=t.colIndex,u=t.gridColumnEnd,d=t.gridColumnStart,f=t.gridRowEnd,h=t.gridRowStart,v=t.header,p=t.reverse,m=t.sort,g=n.useState(!1),w=g[0],b=g[1],C=x(),y=C.columnReordering,I=C.columnResizing,S=C.draggedHeaderRef,E=C.filters,R=C.handleApplyFilter,k=C.handleClearFilter,N=C.headers,F=C.hoveredHeaderRef,D=C.onColumnOrderChange,M=C.onSort,T=C.onTableHeaderDragEnd,H=C.rowHeight,L=C.selectColumns,W=C.selectableColumns,B=C.setHeaders,O=C.setInitialFocusedCell,q=C.setSelectedCells,P=C.setSelectedColumns,z=C.sortDownIcon,Y=C.sortUpIcon,K=Boolean(null==v?void 0:v.isSortable),G=Boolean(null==v?void 0:v.filterable),V=E[v.accessor],X="st-header-cell ".concat(v.accessor===(null===(a=F.current)||void 0===a?void 0:a.accessor)?"st-hovered":""," ").concat((null===(i=S.current)||void 0===i?void 0:i.accessor)===v.accessor?"st-dragging":""," ").concat(K?"clickable":""," ").concat(y&&!K?"columnReordering":""," ").concat(v.children?"parent":""),J=U({draggedHeaderRef:S,headers:N,hoveredHeaderRef:F,onColumnOrderChange:D,onTableHeaderDragEnd:T}),$=J.handleDragStart,_=J.handleDragEnd,Q=J.handleDragOver,Z=A(),ee=function(e){var n=e.event,t=e.header;if(W){var r=function(e,n){if(!e.children||0===e.children.length)return[n];var t=[],r=function(e,n){if(!e.children||0===e.children.length)return t.push(n),n+1;for(var o=n,a=0,i=e.children;a<i.length;a++){var l=i[a];o=r(l,o)}return o};return r(e,n),t}(t,c);return n.shiftKey&&L?P(function(e){if(0===e.size)return new Set(r);var n=r[0],t=Array.from(e).sort(function(e,n){return e-n}),o=t[0],a=Math.abs(n-o);t.forEach(function(e){var t=Math.abs(n-e);t<a&&(a=t,o=e)});var i,s,c,u,d=l(l([],(i=o,s=n,c=Math.min(i,s),u=Math.max(i,s),Array.from({length:u-c+1},function(e,n){return c+n})),!0),r,!0);return new Set(l(l([],Array.from(e),!0),d,!0))}):L&&L(r),q(new Set),void O(null)}t.isSortable&&M(c,t.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)}},[]),!v)return null;var ne=I&&e.jsx("div",o({className:"st-header-resize-handle-container",onMouseDown:function(e){var n;Z({callback:ae,callbackProps:{event:e.nativeEvent,gridColumnEnd:u,gridColumnStart:d,header:v,headers:N,setHeaders:B,startWidth:"object"==typeof r&&null!==r&&"current"in r?null===(n=r.current)||void 0===n?void 0:n.offsetWidth:void 0},limit:10})},onTouchStart:function(e){var n;Z({callback:ae,callbackProps:{event:e,gridColumnEnd:u,gridColumnStart:d,header:v,headers:N,setHeaders:B,startWidth:"object"==typeof r&&null!==r&&"current"in r?null===(n=r.current)||void 0===n?void 0:n.offsetWidth:void 0},limit:10})}},{children:e.jsx("div",{className:"st-header-resize-handle"})})),te=m&&m.key.accessor===v.accessor&&e.jsxs("div",o({className:"st-icon-container",onClick:function(e){return ee({event:e,header:v})}},{children:["ascending"===m.direction&&Y&&Y,"descending"===m.direction&&z&&z]})),re=G&&e.jsxs("div",o({className:"st-icon-container",onClick:function(e){e.stopPropagation(),b(!w)}},{children:[e.jsx(se,{className:"st-header-icon",style:{fill:V?"var(--st-button-active-background-color)":"var(--st-header-icon-color)"}}),e.jsx(j,o({open:w,overflow:"visible",setOpen:b,onClose:function(){return b(!1)}},{children:e.jsx(Ne,{header:v,currentFilter:V,onApplyFilter:function(e){R(e),b(!1)},onClearFilter:function(){k(v.accessor),b(!1)}})}))]}));return e.jsxs("div",o({className:X,id:s({accessor:v.accessor,rowIndex:0}),onDragOver:function(e){Z({callback:Q,callbackProps:{event:e,hoveredHeader:v},limit:50})},ref:r,style:o(o({gridRowStart:h,gridRowEnd:f,gridColumnStart:d,gridColumnEnd:u},u-d>1?{}:{width:v.width}),f-h>1?{}:{height:H})},{children:[p&&ne,"right"===v.align&&re,"right"===v.align&&te,e.jsx("div",o({className:"st-header-label",draggable:y&&!v.disableReorder,onClick:function(e){return ee({event:e,header:v})},onDragEnd:function(e){e.preventDefault(),_()},onDragStart:function(e){y&&v&&function(e){$(e)}(v)}},{children:e.jsx("span",o({className:"st-header-label-text ".concat("right"===v.align?"right-aligned":"center"===v.align?"center-aligned":"left-aligned")},{children:v.headerRenderer?v.headerRenderer({accessor:v.accessor,colIndex:c,header:v}):null==v?void 0:v.label}))})),"right"!==v.align&&te,"right"!==v.align&&re,!p&&ne]}))}),De=function(t){var r=t.columnIndices,a=t.gridTemplateColumns,i=t.handleScroll,l=t.headers,s=t.maxDepth,u=t.pinned,d=t.sectionRef,f=t.sort,h=n.useMemo(function(){var e=[],n=1,t=function(o,a,i){var l,d;if(void 0===i&&(i=!1),!c({header:o,pinned:u}))return 0;i||n++;var f=null!==(d=null===(l=o.children)||void 0===l?void 0:l.filter(function(e){return c({header:e,pinned:u})}).length)&&void 0!==d?d:0,h=n,v=f>0?h+f:h+1,p=a,m=f>0?a+1:s+1;if(e.push({header:o,gridColumnStart:h,gridColumnEnd:v,gridRowStart:p,gridRowEnd:m,colIndex:r[o.accessor]}),o.children){var g=!0;o.children.forEach(function(e){c({header:e,pinned:u})&&(t(e,a+1,g),g=!1)})}return v-h},o=l.filter(function(e){return c({header:e,pinned:u})}),a=!0;return o.forEach(function(e){t(e,1,a),a=!1}),e},[l,s,u,r]);return e.jsx(ee,o({condition:!u,wrapper:function(n){return e.jsx(Z,o({childRef:d},{children:n}))}},{children:e.jsx("div",o({className:"st-header-".concat(u?"pinned-".concat(u):"main")},i&&{onScroll:i},{ref:d,style:{gridTemplateColumns:a,display:"grid",position:"relative"}},{children:e.jsx(e.Fragment,{children:h.map(function(t){return e.jsx(Fe,{colIndex:t.colIndex,gridColumnEnd:t.gridColumnEnd,gridColumnStart:t.gridColumnStart,gridRowEnd:t.gridRowEnd,gridRowStart:t.gridRowStart,header:t.header,ref:n.createRef(),reverse:"right"===u,sort:f},t.header.accessor)})})}))}))},Me=function(e){var n;return(null===(n=e.children)||void 0===n?void 0:n.length)?1+Math.max.apply(Math,e.children.map(Me)):1},Te=function(t){var r=t.centerHeaderRef,a=t.headerContainerRef,i=t.headers,l=t.mainTemplateColumns,s=t.pinnedLeftColumns,u=t.pinnedLeftTemplateColumns,d=t.pinnedRightColumns,f=t.pinnedRightTemplateColumns,h=t.sort,v=x(),p=v.pinnedLeftRef,m=v.pinnedRightRef,g=n.useMemo(function(){return te({headers:i,pinnedLeftColumns:s,pinnedRightColumns:d})},[i,s,d]),w=n.useMemo(function(){var e=0;return i.forEach(function(n){if(c({header:n})){var t=Me(n);e=Math.max(e,t)}}),{maxDepth:e}},[i]).maxDepth;return e.jsxs("div",o({className:"st-header-container",ref:a},{children:[B(i,"left")&&e.jsx(De,{columnIndices:g,gridTemplateColumns:u,handleScroll:void 0,headers:i,maxDepth:w,pinned:"left",sectionRef:p,sort:h}),e.jsx(De,{columnIndices:g,gridTemplateColumns:l,handleScroll:void 0,headers:i,maxDepth:w,sectionRef:r,sort:h}),B(i,"right")&&e.jsx(De,{columnIndices:g,gridTemplateColumns:f,handleScroll:void 0,headers:i,maxDepth:w,pinned:"right",sectionRef:m,sort:h})]}))},He=function(e){var n=e.headers,t=function(e){var n=e.headers,r=e.flattenedHeaders;return n.forEach(function(e){e.hide||(e.children?t({headers:e.children,flattenedHeaders:r}):r.push(e))}),r},r=t({headers:n,flattenedHeaders:[]});return"".concat(r.map(function(e){return function(e){var n=e.minWidth,t=e.width;return"number"==typeof t&&(t="".concat(t,"px")),n&&"number"==typeof n&&(n="".concat(n,"px")),void 0!==n?"string"==typeof t&&t.endsWith("fr")?"minmax(".concat(n,", ").concat(t,")"):"max(".concat(n,", ").concat(t,")"):t}(e)}).join(" "))},Le=function(t){var r=t.pinnedLeftWidth,a=t.pinnedRightWidth,i=t.setScrollTop,l=t.sort,s=t.tableRows,c=t.visibleRows,u=x(),d=u.columnResizing,f=u.editColumns,h=u.headers,v=n.useRef(null),p=n.useRef(null),m=h.filter(function(e){return!e.pinned}),g=h.filter(function(e){return"left"===e.pinned}),w=h.filter(function(e){return"right"===e.pinned}),b=n.useMemo(function(){return He({headers:g})},[g]),C=n.useMemo(function(){return He({headers:m})},[m]),y=n.useMemo(function(){return He({headers:w})},[w]),I={centerHeaderRef:p,headerContainerRef:v,headers:h,mainTemplateColumns:C,pinnedLeftColumns:g,pinnedLeftTemplateColumns:b,pinnedRightColumns:w,pinnedRightTemplateColumns:y,sort:l},S={tableRows:s,headerContainerRef:v,mainTemplateColumns:C,pinnedLeftColumns:g,pinnedLeftTemplateColumns:b,pinnedLeftWidth:r,pinnedRightColumns:w,pinnedRightTemplateColumns:y,pinnedRightWidth:a,setScrollTop:i,visibleRows:c};return e.jsxs("div",o({className:"st-content ".concat(d?"st-resizeable":"st-not-resizeable"),style:{width:f?"calc(100% - 27.5px)":"100%"}},{children:[e.jsx(Te,o({},I)),e.jsx(re,o({},S))]}))},Ae=function(t){var r,a,i=t.mainBodyWidth,l=t.mainBodyRef,s=t.pinnedLeftWidth,c=t.pinnedRightWidth,u=t.tableBodyContainerRef,d=x().editColumns,f=n.useState(!1),h=f[0],v=f[1],p=n.useRef(null),m=u.current&&u.current.scrollHeight>u.current.clientHeight,g=d?28:0,w=(d?c+1:c)+(u.current&&m?u.current.offsetWidth-u.current.clientWidth:0);return n.useEffect(function(){setTimeout(function(){!function(){if(l.current){var e=l.current.clientWidth;v(i>e)}}()},1)},[l,i]),h?e.jsxs("div",o({className:"st-horizontal-scrollbar-container"},{children:[s>0&&e.jsx("div",{className:"st-horizontal-scrollbar-left",style:{flexShrink:0,width:s,height:null===(r=p.current)||void 0===r?void 0:r.offsetHeight}}),i>0&&e.jsx(Z,o({childRef:p},{children:e.jsx("div",o({className:"st-horizontal-scrollbar-middle",ref:p,style:{flexGrow:1}},{children:e.jsx("div",{style:{width:i,height:".3px"}})}))})),c>0&&e.jsx("div",{className:"st-horizontal-scrollbar-right",style:{flexShrink:0,minWidth:w,height:null===(a=p.current)||void 0===a?void 0:a.offsetHeight}}),g>0&&e.jsx("div",{style:{width:g-1.5,height:"100%",flexShrink:0}})]})):null},We={string:function(e,n,t){if(e===n)return 0;var r=e.localeCompare(n);return"ascending"===t?r:-r},number:function(e,n,t){if(e===n)return 0;var r=e-n;return"ascending"===t?r:-r},boolean:function(e,n,t){if(e===n)return 0;var r=e===n?0:e?-1:1;return"ascending"===t?r:-r},date:function(e,n,t){var r=new Date(e),o=new Date(n);if(r.getTime()===o.getTime())return 0;var a=r.getTime()-o.getTime();return"ascending"===t?a:-a},enum:function(e,n,t){return We.string(e,n,t)},default:function(e,n,t){return e===n?0:null==e?"ascending"===t?-1:1:null==n?"ascending"===t?1:-1:"string"==typeof e&&"string"==typeof n?We.string(e,n,t):"number"==typeof e&&"number"==typeof n?We.number(e,n,t):"boolean"==typeof e&&"boolean"==typeof n?We.boolean(e,n,t):We.string(String(e),String(n),t)}},Be=function(e,n,t){var r=t.find(function(e){return e.accessor===n.key.accessor}),o=(null==r?void 0:r.type)||"string",a=n.direction;return l([],e,!0).sort(function(e,t){var r=n.key.accessor;return function(e,n,t,r){if(void 0===t&&(t="string"),null==e||""===e)return"ascending"===r?-1:1;if(null==n||""===n)return"ascending"===r?1:-1;if("number"===t){var o=function(e){var n;if("number"==typeof e)return e;var t=String(e);if("string"==typeof t){var r=t.replace(/[$,]/g,"").match(/^([-+]?\d*\.?\d+)([TBMKtbmk])?/);if(r){var o=parseFloat(r[1]),a=null===(n=r[2])||void 0===n?void 0:n.toUpperCase();return"T"===a?o*=1e12:"B"===a?o*=1e9:"M"===a?o*=1e6:"K"===a&&(o*=1e3),o}}return parseFloat(t)||0},a=o(e),i=o(n);return We.number(a,i,r)}return"date"===t?We.date(String(e),String(n),r):"boolean"===t?We.boolean(Boolean(e),Boolean(n),r):"enum"===t?We.enum(String(e),String(n),r):We.string(String(e),String(n),r)}(e[r],t[r],o,a)})},Oe=function(e){var t=e.headers,r=e.tableRows,o=n.useState(null),a=o[0],i=o[1],l=n.useMemo(function(){if(!a)return r;var e=function(e,n,t){return{sortedData:Be(n,t,e),newSortConfig:t}}(t,r,a).sortedData;return e},[r,a,t]);return{setSort:i,sort:a,sortedRows:l,updateSort:function(e,n){var r=function(e){for(var t=0,o=e;t<o.length;t++){var a=o[t];if(a.accessor===n)return a;if(a.children&&a.children.length>0){var i=r(a.children);if(i)return i}}},o=r(t);o&&i(function(e){return e&&e.key.accessor===n?"ascending"===e.direction?{key:o,direction:"descending"}:null:{key:o,direction:"ascending"}})}}},qe=function(e,n,t){void 0===t&&(t=new Set);for(var r=0,o=e;r<o.length;r++){var a=o[r];if(!t.has(a.accessor)&&(t.add(a.accessor),a.children&&a.children.length>0)){var i=a.children.some(function(e){return e.accessor===n}),l=!1;if(!i)for(var s=0,c=a.children;s<c.length;s++){var u=c[s];if(qe([u],n,t),!1===u.hide){l=!0;break}}(i||l)&&(a.hide=!1)}}},Pe=function(e){return e.every(function(e){return e.hide})},ze=function(e){e.forEach(function(e){e.children&&e.children.length>0&&(ze(e.children),Pe(e.children)&&(e.hide=!0))})},Ye=function(t){var r=t.allHeaders,a=t.depth,i=void 0===a?0:a,s=t.doesAnyHeaderHaveChildren,c=t.header,u=n.useState(!0),d=u[0],f=u[1],h=x(),v=h.expandIcon,p=h.headers,m=h.setHeaders,g=s?"".concat(16*i,"px"):"8px",w=c.children&&c.children.length>0,b=c.hide||w&&c.children&&Pe(c.children);return e.jsxs(e.Fragment,{children:[e.jsxs("div",o({className:"st-header-checkbox-item",style:{paddingLeft:g}},{children:[s&&e.jsx("div",o({className:"st-header-icon-container"},{children:w?e.jsx("div",o({className:"st-collapsible-header-icon st-expand-icon-container ".concat(d?"expanded":"collapsed"),onClick:function(e){e.stopPropagation(),f(!d)}},{children:v})):null})),e.jsx(Re,o({checked:b,onChange:function(e){(c.hide=e,e)?ze(r):(qe(r,c.accessor),w&&c.children&&c.children.length>0&&c.children.every(function(e){return!0===e.hide})&&c.children[0]&&(c.children[0].hide=!1,qe(r,c.children[0].accessor)));m(l([],p,!0))}},{children:c.label}))]})),w&&d&&c.children&&e.jsx("div",o({className:"st-nested-headers"},{children:c.children.map(function(n,t){return e.jsx(Ye,{allHeaders:r,depth:i+1,doesAnyHeaderHaveChildren:s,header:n},"".concat(n.accessor,"-").concat(t))})}))]})},Ue=function(t){var r=t.headers,a=t.open,i="left"===t.position?"left":"",l=n.useMemo(function(){return r.filter(function(e){return!e.hide}).some(function(e){return e.children&&e.children.length>0})},[r]);return e.jsx("div",o({className:"st-column-editor-popout ".concat(a?"open":""," ").concat(i),onClick:function(e){return e.stopPropagation()}},{children:e.jsx("div",o({className:"st-column-editor-popout-content"},{children:r.map(function(n,t){return e.jsx(Ye,{doesAnyHeaderHaveChildren:l,header:n,allHeaders:r},"".concat(n.accessor,"-").concat(t))})}))}))},Ke=function(t){var r=t.columnEditorText,a=t.editColumns,i=t.editColumnsInitOpen,l=t.headers,s=t.position,c=void 0===s?"right":s,u=n.useState(i),d=u[0],f=u[1];return a?e.jsxs("div",o({className:"st-column-editor ".concat(d?"open":""," ").concat(c),onClick:function(){return function(e){f(e)}(!d)},style:{width:28}},{children:[e.jsx("div",o({className:"st-column-editor-text"},{children:r})),e.jsx(Ue,{headers:l,open:d,position:c})]})):null},Ge=function(n){var t=n.className;return e.jsx("svg",o({"aria-hidden":"true",focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 320 512",className:t,style:{height:"1em"}},{children:e.jsx("path",{d:"M22 334.5c-3.8 8.8-2 19 4.6 26l116 144c4.5 4.8 10.8 7.5 17.4 7.5s12.9-2.7 17.4-7.5l116-144c6.6-7 8.4-17.2 4.6-26s-12.5-14.5-22-14.5l-72 0 0-288c0-17.7-14.3-32-32-32L148 0C130.3 0 116 14.3 116 32l0 288-72 0c-9.6 0-18.2 5.7-22 14.5z"})}))},Ve=function(n){var t=n.className;return e.jsx("svg",o({"aria-hidden":"true",focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 320 512",className:t,style:{height:"1em"}},{children:e.jsx("path",{d:"M298 177.5c3.8-8.8 2-19-4.6-26l-116-144C172.9 2.7 166.6 0 160 0s-12.9 2.7-17.4 7.5l-116 144c-6.6 7-8.4 17.2-4.6 26S34.4 192 44 192l72 0 0 288c0 17.7 14.3 32 32 32l24 0c17.7 0 32-14.3 32-32l0-288 72 0c9.6 0 18.2-5.7 22-14.5z"})}))},Xe=function(t){var a=t.children,i=n.useRef({}),l=n.useCallback(function(e,n){return!!i.current[n]&&i.current[n].find(function(n){return n===e})},[]),s=n.useCallback(function(e,n){var t=e.clientWidth,r=e.scrollLeft;e.scrollWidth-t>0&&(n.scrollLeft=r)},[]),c=n.useCallback(function(e){e.onscroll=null},[]),u=n.useCallback(function(e,n){e.onscroll=function(){window.requestAnimationFrame(function(){n.forEach(function(n){var t;null===(t=i.current[n])||void 0===t||t.forEach(function(n){e!==n&&(c(n),s(e,n),window.requestAnimationFrame(function(){var e=Object.keys(i.current).filter(function(e){return i.current[e].includes(n)});u(n,e)}))})})})}},[c,s]),d=n.useCallback(function(e,n){n.forEach(function(n){i.current[n]||(i.current[n]=[]),l(e,n)||(i.current[n].length>0&&s(i.current[n][0],e),i.current[n].push(e))}),u(e,n)},[l,s,u]),f=n.useCallback(function(e,n){n.forEach(function(n){if(l(e,n)){c(e);var t=i.current[n].indexOf(e);-1!==t&&i.current[n].splice(t,1)}})},[l,c]);return e.jsx(_.Provider,o({value:{registerPane:d,unregisterPane:f}},{children:r.default.Children.only(a)}))},Je=function(e,n){var t=n.find(function(n){return n.accessor===e.accessor}),r=(null==t?void 0:t.label)||e.accessor,o=ce[e.operator],a="";return void 0!==e.value?a="boolean"==typeof e.value?e.value?"True":"False":String(e.value):e.values&&Array.isArray(e.values)&&("between"===e.operator||"notBetween"===e.operator?a="".concat(e.values[0]," - ").concat(e.values[1]):"in"!==e.operator&&"notIn"!==e.operator||(a=e.values.join(", "))),"isEmpty"===e.operator||"isNotEmpty"===e.operator?"".concat(r,": ").concat(o):"".concat(r,": ").concat(o," ").concat(a)},$e=function(){var n=x(),t=n.filters,r=n.handleClearFilter,a=n.headers,i=Object.values(t);return 0===i.length||i.length>0?null:e.jsx("div",o({className:"st-filter-bar"},{children:e.jsx("div",o({className:"st-filter-bar-content"},{children:e.jsx("div",o({className:"st-filter-chips"},{children:i.map(function(n){return e.jsxs("div",o({className:"st-filter-chip"},{children:[e.jsx("span",o({className:"st-filter-chip-text"},{children:Je(n,a)})),e.jsx("button",o({className:"st-filter-chip-remove",onClick:function(){return r(n.accessor)},"aria-label":"Remove filter for ".concat(n.accessor)},{children:"×"}))]}),n.accessor)})}))}))}))},_e=function(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())},Qe=function(e){var t=e.rows,r=n.useState({}),a=r[0],i=r[1],l=n.useMemo(function(){return 0===Object.keys(a).length?t:t.filter(function(e){return Object.values(a).every(function(n){try{return function(e,n){var t=n.operator,r=n.value,o=n.values;if(null==e)return"isEmpty"===t;if("isEmpty"===t)return!e||""===String(e).trim();if("isNotEmpty"===t)return e&&""!==String(e).trim();if("string"==typeof e||"contains"===t||"notContains"===t||"startsWith"===t||"endsWith"===t){var a=String(e).toLowerCase(),i=r?String(r).toLowerCase():"";switch(t){case"equals":return a===i;case"notEquals":return a!==i;case"contains":return a.includes(i);case"notContains":return!a.includes(i);case"startsWith":return a.startsWith(i);case"endsWith":return a.endsWith(i)}}if("number"==typeof e||!isNaN(Number(e))){var l=Number(e),s=Number(r);switch(t){case"equals":return l===s;case"notEquals":return l!==s;case"greaterThan":return l>s;case"lessThan":return l<s;case"greaterThanOrEqual":return l>=s;case"lessThanOrEqual":return l<=s;case"between":if(o&&2===o.length){var c=o.map(Number),u=c[0],d=c[1];return l>=u&&l<=d}return!1;case"notBetween":if(o&&2===o.length){var f=o.map(Number);return u=f[0],d=f[1],l<u||l>d}return!0}}if(e instanceof Date||!isNaN(Date.parse(e))){var h=new Date(e),v=new Date(String(r||"")),p=_e(h),m=_e(v);switch(t){case"equals":return p.getTime()===m.getTime();case"notEquals":return p.getTime()!==m.getTime();case"before":return p<m;case"after":return p>m;case"between":if(o&&2===o.length){var g=o.map(function(e){return _e(new Date(String(e||"")))}),w=g[0],x=g[1];return p>=w&&p<=x}return!1;case"notBetween":if(o&&2===o.length){var b=o.map(function(e){return _e(new Date(String(e||"")))});return w=b[0],x=b[1],p<w||p>x}return!0}}if("boolean"==typeof e){var C=Boolean(r);if("equals"===t)return e===C}if("in"===t||"notIn"===t){if(o&&Array.isArray(o)){var y=String(e),I=o.includes(y);return"in"===t?I:!I}return!1}var S=String(e).toLowerCase(),j=r?String(r).toLowerCase():"";switch(t){case"equals":return S===j;case"notEquals":return S!==j;default:return!0}}(e[n.accessor],n)}catch(e){return console.warn("Filter error for accessor ".concat(n.accessor,":"),e),!0}})})},[t,a]),s=n.useCallback(function(e){i(function(n){var t;return o(o({},n),((t={})[e.accessor]=e,t))})},[]),c=n.useCallback(function(e){i(function(n){var t=o({},n);return delete t[e],t})},[]),u=n.useCallback(function(){i({})},[]);return{filters:a,filteredRows:l,handleApplyFilter:s,handleClearFilter:c,handleClearAllFilters:u}},Ze=function(t){var r=t.allowAnimations,l=void 0!==r&&r,s=t.cellUpdateFlash,c=void 0!==s&&s,f=t.columnEditorPosition,h=void 0===f?"right":f,g=t.columnEditorText,x=void 0===g?"Columns":g,I=t.columnReordering,S=void 0!==I&&I,j=t.columnResizing,E=void 0!==j&&j,R=t.defaultHeaders,k=t.editColumns,N=void 0!==k&&k,F=t.editColumnsInitOpen,D=void 0!==F&&F,M=t.expandAll,T=void 0===M||M,H=t.expandIcon,L=void 0===H?e.jsx(y,{className:"st-expand-icon"}):H,A=t.externalFilterHandling,W=void 0!==A&&A,B=t.height,O=t.hideFooter,q=void 0!==O&&O,P=t.nextIcon,z=void 0===P?e.jsx(y,{className:"st-next-prev-icon"}):P,Y=t.onCellEdit,U=t.onColumnOrderChange,K=t.onFilterChange,G=t.onGridReady,V=t.onNextPage,X=t.prevIcon,J=void 0===X?e.jsx(C,{className:"st-next-prev-icon"}):X,$=t.rowGrouping,_=t.rowHeight,Q=void 0===_?32:_,Z=t.rowIdAccessor,ee=t.rows,ne=t.rowsPerPage,te=void 0===ne?10:ne,re=t.selectableCells,oe=void 0!==re&&re,ae=t.selectableColumns,ie=void 0!==ae&&ae,se=t.shouldPaginate,ce=void 0!==se&&se,ue=t.sortDownIcon,de=void 0===ue?e.jsx(Ge,{className:"st-header-icon"}):ue,fe=t.sortUpIcon,he=void 0===fe?e.jsx(Ve,{className:"st-header-icon"}):fe,ve=t.tableRef,pe=t.theme,me=void 0===pe?"light":pe,ge=t.useHoverRowBackground,we=void 0===ge||ge,xe=t.useOddEvenRowBackground,be=void 0===xe||xe,Ce=t.useOddColumnBackground,ye=void 0!==Ce&&Ce;ye&&(be=!1);var Ie=n.useReducer(function(e){return e+1},0)[1],Se=n.useRef(null),je=n.useRef(null),Ee=n.useRef(null),Re=n.useRef(null),ke=n.useRef(null),Ne=n.useRef(null),Fe=n.useState(1),De=Fe[0],Me=Fe[1],Te=n.useState(R),He=Te[0],We=Te[1];n.useEffect(function(){We(R)},[R]);var Be=n.useState(0),qe=Be[0],Pe=Be[1],ze=n.useState(0),Ye=ze[0],Ue=ze[1],Je=n.useState(new Set),_e=Je[0],Ze=Je[1],en=Qe({rows:ee}),nn=en.filters,tn=en.filteredRows,rn=en.handleApplyFilter,on=en.handleClearFilter,an=en.handleClearAllFilters,ln=n.useCallback(function(e){W||rn(e),null==K||K(e)},[W,K,rn]),sn=Oe({headers:He,tableRows:tn}),cn=sn.sort,un=sn.sortedRows,dn=sn.updateSort,fn=n.useMemo(function(){var e=le({headers:He});return{mainBodyWidth:e.mainWidth,pinnedLeftWidth:e.leftWidth,pinnedRightWidth:e.rightWidth}},[He]),hn=fn.mainBodyWidth,vn=fn.pinnedLeftWidth,pn=fn.pinnedRightWidth;n.useEffect(function(){null==G||G()},[G]);var mn=n.useMemo(function(){if(!ce)return un;var e=(De-1)*te,n=e+te;return un.slice(e,n)},[De,te,ce,un]),gn=n.useMemo(function(){return $&&0!==$.length?p({rows:mn,rowGrouping:$,rowIdAccessor:Z,expandedRows:_e,expandAll:T}):mn.map(function(e,n){return{row:e,depth:0,groupingKey:void 0,position:n,isLastGroupRow:!1}})},[mn,$,Z,_e,T]),wn=function(e){var t=e.height,r=e.rowHeight;return n.useMemo(function(){var e;if(!t)return window.innerHeight-r;var n=document.querySelector(".simple-table-root"),o=0;if(t.endsWith("px"))o=parseInt(t,10);else if(t.endsWith("vh")){var a=parseInt(t,10);o=window.innerHeight*a/100}else if(t.endsWith("%")){var i=parseInt(t,10);o=((null===(e=null==n?void 0:n.parentElement)||void 0===e?void 0:e.clientHeight)||window.innerHeight)*i/100}else o=window.innerHeight;return Math.max(0,o-r)},[t,r])}({height:B,rowHeight:Q}),xn=n.useMemo(function(){return function(e){var n=e.bufferRowCount,t=e.contentHeight,r=e.tableRows,o=e.rowHeight,a=e.scrollTop,i=o+1,l=Math.max(0,a-i*n),s=a+t+i*n,c=Math.max(0,Math.floor(l/i)),u=Math.min(r.length,Math.ceil(s/i));return r.slice(c,u)}({bufferRowCount:5,contentHeight:wn,tableRows:gn,rowHeight:Q,scrollTop:qe})},[wn,Q,gn,qe]),bn=n.useRef(new Map),Cn=function(e){var t=e.selectableCells,r=e.headers,o=e.tableRows,l=e.rowIdAccessor,s=e.onCellEdit,c=e.cellRegistry,u=n.useState(new Set),f=u[0],h=u[1],p=n.useState(new Set),g=p[0],w=p[1],x=n.useState(null),b=x[0],C=x[1],y=n.useState(null),I=y[0],S=y[1],j=n.useState(new Set),E=j[0],R=j[1],k=n.useState(new Set),N=k[0],F=k[1],D=n.useRef(!1),M=n.useRef(null),T=n.useMemo(function(){return r.flatMap(d)},[r]),H=n.useCallback(function(){var e=T.filter(function(e){return!e.hide}),n=new Map;e.forEach(function(e,t){n.set(t,e.accessor)});var t=Array.from(f).reduce(function(e,t){var r,a=t.split("-").map(Number),i=a[0],l=a[1];e[i]||(e[i]=[]);var s=n.get(l);return s&&(null===(r=o[i])||void 0===r?void 0:r.row)?e[i][l]=o[i].row[s]:e[i][l]="",e},{}),r=Object.values(t).map(function(e){return Object.values(e).join("\t")}).join("\n");f.size>0&&(navigator.clipboard.writeText(r),R(new Set(f)),setTimeout(function(){R(new Set)},800))},[T,f,o]),L=n.useCallback(function(){return a(void 0,void 0,void 0,function(){var e,n,t,r,a,u,d,f;return i(this,function(i){switch(i.label){case 0:if(!I)return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,navigator.clipboard.readText()];case 2:return(e=i.sent())?0===(n=e.split("\n").filter(function(e){return e.length>0})).length?[2]:(t=T.filter(function(e){return!e.hide}),r=new Set,a=new Set,u=I.rowIndex,d=I.colIndex,n.forEach(function(e,n){e.split("\t").forEach(function(e,i){var f=u+n,h=d+i;if(!(f>=o.length||h>=t.length)){var p=o[f],g=t[h],w=v(p.row,f,l);if(null==g?void 0:g.isEditable){var x=e;if("number"===g.type){var b=Number(e);isNaN(b)||(x=b)}else if("boolean"===g.type)x="true"===e.toLowerCase()||"1"===e;else if("date"===g.type){var C=new Date(e);isNaN(C.getTime())||(x=C)}if(p.row[g.accessor]=x,c){var y="".concat(w,"-").concat(g.accessor),I=c.get(y);I&&I.updateContent(x)}null==s||s({accessor:g.accessor,newValue:x,row:p.row,rowIndex:f});var S=m({colIndex:h,rowIndex:f,rowId:w});r.add(S)}else{var j=m({colIndex:h,rowIndex:f,rowId:w});a.add(j)}}})}),r.size>0&&(R(r),setTimeout(function(){R(new Set)},800)),a.size>0&&(F(a),setTimeout(function(){F(new Set)},800)),[3,4]):[2];case 3:return f=i.sent(),console.warn("Failed to paste from clipboard:",f),[3,4];case 4:return[2]}})})},[I,T,o,l,s,c]),A=n.useCallback(function(){if(0!==f.size){var e=T.filter(function(e){return!e.hide}),n=new Map;e.forEach(function(e,t){n.set(t,e.accessor)});var t=new Set,r=new Set;Array.from(f).forEach(function(n){var a=n.split("-").map(Number),i=a[0],u=a[1];if(!(i>=o.length||u>=e.length)){var d=o[i],f=e[u],h=v(d.row,i,l);if(null==f?void 0:f.isEditable){var p=null;if(p="string"===f.type?"":"number"===f.type?null:"boolean"!==f.type&&("date"===f.type?null:""),d.row[f.accessor]=p,c){var m="".concat(h,"-").concat(f.accessor),g=c.get(m);g&&g.updateContent(p)}null==s||s({accessor:f.accessor,newValue:p,row:d.row,rowIndex:i}),t.add(n)}else r.add(n)}}),t.size>0&&(R(t),setTimeout(function(){R(new Set)},800)),r.size>0&&(F(r),setTimeout(function(){F(new Set)},800))}},[f,T,o,l,s,c]),W=n.useCallback(function(e,n){for(var t=new Set,r=Math.min(e.rowIndex,n.rowIndex),a=Math.max(e.rowIndex,n.rowIndex),i=Math.min(e.colIndex,n.colIndex),s=Math.max(e.colIndex,n.colIndex),c=r;c<=a;c++)for(var u=i;u<=s;u++)if(c>=0&&c<o.length){var d=v(o[c].row,c,l);t.add(m({colIndex:u,rowIndex:c,rowId:d}))}w(new Set),C(null),h(t)},[o,l,w,C,h]),B=n.useCallback(function(e){if(e.rowIndex>=0&&e.rowIndex<o.length&&e.colIndex>=0&&e.colIndex<T.length){var n=m(e);w(new Set),C(null),h(new Set([n])),S(e)}},[T.length,o.length,w,C,h,S]),O=n.useCallback(function(e,n){void 0===n&&(n=!1),h(new Set),S(null),w(function(t){var r=new Set(n?t:[]);return e.forEach(function(e){return r.add(e)}),r}),e.length>0&&C(e[e.length-1])},[h,S,w,C]);n.useEffect(function(){var e=function(e){var n;if(t&&I){var r=I.rowIndex,a=I.colIndex,i=I.rowId;if(!e.ctrlKey&&!e.metaKey||"c"!==e.key){if((e.ctrlKey||e.metaKey)&&"v"===e.key)return e.preventDefault(),void L();if("Delete"===e.key||"Backspace"===e.key)return e.preventDefault(),void A();if(v(null===(n=o[r])||void 0===n?void 0:n.row,r,l)!==i){var s=o.findIndex(function(e,n){return v(e.row,n,l)===i});if(-1===s)return;r=s}if("ArrowUp"===e.key){if(e.preventDefault(),r>0){var c=v(o[r-1].row,r-1,l);B({rowIndex:r-1,colIndex:a,rowId:c})}}else"ArrowDown"===e.key?(e.preventDefault(),r<o.length-1&&(c=v(o[r+1].row,r+1,l),B({rowIndex:r+1,colIndex:a,rowId:c}))):"ArrowLeft"===e.key||"Tab"===e.key&&e.shiftKey?(e.preventDefault(),a>0&&(c=v(o[r].row,r,l),B({rowIndex:r,colIndex:a-1,rowId:c}))):"ArrowRight"===e.key||"Tab"===e.key?(e.preventDefault(),a<T.length-1&&(c=v(o[r].row,r,l),B({rowIndex:r,colIndex:a+1,rowId:c}))):"Escape"===e.key&&(h(new Set),w(new Set),C(null),M.current=null,S(null))}else H()}};return document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}},[H,T.length,I,l,W,B,t,o,L,A]);var q=n.useCallback(function(e){var n=e.colIndex,t=e.rowIndex,r=e.rowId,o=m({colIndex:n,rowIndex:t,rowId:r}),a=f.has(o),i=g.has(n);return a||i},[f,g]),P=n.useCallback(function(e){var n=e.colIndex,t=e.rowIndex,r=e.rowId,a=[],i=o[t-1]?v(o[t-1].row,t-1,l):null,s=o[t+1]?v(o[t+1].row,t+1,l):null,c=null!==i?{colIndex:n,rowIndex:t-1,rowId:i}:null,u=null!==s?{colIndex:n,rowIndex:t+1,rowId:s}:null,d={colIndex:n-1,rowIndex:t,rowId:r},f={colIndex:n+1,rowIndex:t,rowId:r};return(!c||!q(c)||g.has(n)&&0===t)&&a.push("st-selected-top-border"),(!u||!q(u)||g.has(n)&&t===o.length-1)&&a.push("st-selected-bottom-border"),q(d)||a.push("st-selected-left-border"),q(f)||a.push("st-selected-right-border"),a.join(" ")},[q,o,g,l]),z=n.useMemo(function(){return I?function(e){var n=e.rowIndex,t=e.colIndex,r=e.rowId;return n===I.rowIndex&&t===I.colIndex&&r===I.rowId}:function(){return!1}},[I]),Y=n.useCallback(function(e){var n=e.colIndex,t=e.rowIndex,r=e.rowId,o=m({colIndex:n,rowIndex:t,rowId:r});return E.has(o)},[E]),U=n.useCallback(function(e){var n=e.colIndex,t=e.rowIndex,r=e.rowId,o=m({colIndex:n,rowIndex:t,rowId:r});return N.has(o)},[N]);return{getBorderClass:P,handleMouseDown:function(e){var n=e.colIndex,r=e.rowIndex,o=e.rowId;t&&(D.current=!0,M.current={rowIndex:r,colIndex:n,rowId:o},setTimeout(function(){w(new Set),C(null);var e=m({colIndex:n,rowIndex:r,rowId:o});h(new Set([e])),S({rowIndex:r,colIndex:n,rowId:o})},0))},handleMouseOver:function(e){var n=e.colIndex,r=e.rowIndex;if(e.rowId,t&&D.current&&M.current){for(var a=new Set,i=Math.min(M.current.rowIndex,r),s=Math.max(M.current.rowIndex,r),c=Math.min(M.current.colIndex,n),u=Math.max(M.current.colIndex,n),d=i;d<=s;d++)for(var f=c;f<=u;f++)if(d>=0&&d<o.length){var p=v(o[d].row,d,l);a.add(m({colIndex:f,rowIndex:d,rowId:p}))}h(a)}},handleMouseUp:function(){D.current=!1},isCopyFlashing:Y,isWarningFlashing:U,isInitialFocusedCell:z,isSelected:q,lastSelectedColumnIndex:b,pasteFromClipboard:L,selectColumns:O,selectedCells:f,selectedColumns:g,setInitialFocusedCell:S,setSelectedCells:h,setSelectedColumns:w,deleteSelectedCells:A}}({selectableCells:oe,headers:He,tableRows:gn,rowIdAccessor:Z,onCellEdit:Y,cellRegistry:bn.current}),yn=Cn.getBorderClass,In=Cn.handleMouseDown,Sn=Cn.handleMouseOver,jn=Cn.handleMouseUp,En=Cn.isCopyFlashing,Rn=Cn.isInitialFocusedCell,kn=Cn.isSelected,Nn=Cn.isWarningFlashing,Fn=Cn.selectColumns,Dn=Cn.selectedCells,Mn=Cn.selectedColumns,Tn=Cn.setInitialFocusedCell,Hn=Cn.setSelectedCells,Ln=Cn.setSelectedColumns,An=n.useCallback(function(e,n){dn(e,n)},[dn]),Wn=n.useCallback(function(e){We(e)},[]);return function(e){var t=e.selectableColumns,r=e.selectedCells,o=e.selectedColumns,a=e.setSelectedCells,i=e.setSelectedColumns;n.useEffect(function(){var e=function(e){var n=e.target;n.closest(".st-cell")||t&&(n.classList.contains("st-header-cell")||n.classList.contains("st-header-label"))||(r.size>0&&a(new Set),o.size>0&&i(new Set))};return document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}},[t,r,o,a,i])}({selectableColumns:ie,selectedCells:Dn,selectedColumns:Mn,setSelectedCells:Hn,setSelectedColumns:Ln}),n.useLayoutEffect(function(){if(Ne.current){var e=Ne.current.offsetWidth-Ne.current.clientWidth;Ue(e)}},[]),function(e){var t=e.forceUpdate,r=e.tableBodyContainerRef,o=e.setScrollbarWidth;n.useLayoutEffect(function(){var e=function(){if(t(),r.current){var e=r.current.offsetWidth-r.current.clientWidth;o(e)}};return window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}},[t,r,o])}({forceUpdate:Ie,tableBodyContainerRef:Ne,setScrollbarWidth:Ue}),n.useEffect(function(){ve&&(ve.current={updateData:function(e){var n=e.accessor,t=e.rowIndex,r=e.newValue,o=null==ee?void 0:ee[t];if(o){var a=v(o,t,Z),i=u({rowId:a,accessor:n}),l=bn.current.get(i);l&&l.updateContent(r),void 0!==o[n]&&(o[n]=r)}}})},[ve,ee,Z]),e.jsx(w,o({value:{allowAnimations:l,cellRegistry:bn.current,cellUpdateFlash:c,columnReordering:S,columnResizing:E,draggedHeaderRef:Se,editColumns:N,expandIcon:L,expandedRows:_e,filters:nn,tableRows:gn,forceUpdate:Ie,getBorderClass:yn,handleApplyFilter:ln,handleClearFilter:on,handleClearAllFilters:an,handleMouseDown:In,handleMouseOver:Sn,headers:He,hoveredHeaderRef:je,isCopyFlashing:En,isInitialFocusedCell:Rn,isSelected:kn,isWarningFlashing:Nn,mainBodyRef:Ee,nextIcon:z,onCellEdit:Y,onColumnOrderChange:U,onSort:An,onTableHeaderDragEnd:Wn,pinnedLeftRef:Re,pinnedRightRef:ke,prevIcon:J,rowGrouping:$,rowHeight:Q,rowIdAccessor:Z,scrollbarWidth:Ye,selectColumns:Fn,selectableColumns:ie,setExpandedRows:Ze,setHeaders:We,setInitialFocusedCell:Tn,setSelectedCells:Hn,setSelectedColumns:Ln,shouldPaginate:ce,sortDownIcon:de,sortUpIcon:he,tableBodyContainerRef:Ne,theme:me,useHoverRowBackground:we,useOddColumnBackground:ye,useOddEvenRowBackground:be}},{children:e.jsx("div",o({className:"simple-table-root st-wrapper theme-".concat(me),style:B?{height:B}:{}},{children:e.jsx(Xe,{children:e.jsxs("div",o({className:"st-wrapper-container"},{children:[e.jsx($e,{}),e.jsxs("div",o({className:"st-content-wrapper",onMouseUp:jn,onMouseLeave:jn},{children:[e.jsx(Le,{tableRows:gn,pinnedLeftWidth:vn,pinnedRightWidth:pn,setScrollTop:Pe,sort:cn,visibleRows:xn}),e.jsx(Ke,{columnEditorText:x,editColumns:N,editColumnsInitOpen:D,headers:He,position:h})]})),e.jsx(Ae,{mainBodyRef:Ee,mainBodyWidth:hn,pinnedLeftWidth:vn,pinnedRightWidth:pn,tableBodyContainerRef:Ne}),e.jsx(b,{currentPage:De,hideFooter:q,onPageChange:Me,onNextPage:V,shouldPaginate:ce,totalPages:Math.ceil(tn.length/te)})]}))})}))}))};exports.SimpleTable=function(t){var r=n.useState(!1),a=r[0],i=r[1];return n.useEffect(function(){i(!0)},[]),a?e.jsx(Ze,o({},t)):null};
2
2
  //# sourceMappingURL=index.js.map