simple-table-core 1.5.9 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.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){return e<480?.3:e<768?.4:.8},c=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},u=function(e){return e.flatMap(function(e){var n=[e];return e.children&&e.children.length>0&&n.push.apply(n,u(e.children)),n})},d=function(e){return void 0===e&&(e=0),e?e+1:0},f=function(e,n,t){var r=function(e,n){for(var t=0,r=u(e);t<r.length;t++){var o=r[t];if(o.children&&o.children.length>0&&o.children.some(function(e){return e.accessor===n}))return o}return null}(n,e.accessor);return!!r&&(t.has(r.accessor)?"parentExpanded"===e.showWhen:"parentCollapsed"===e.showWhen)},h=function(e){var n=e.accessor,t=e.rowId;return"".concat(t,"-").concat(n)},v=function(e){var n=e.header,t=e.pinned,r=e.headers,o=e.collapsedHeaders;return n.hide||(t||n.pinned)&&n.pinned!==t?null:!(r&&o&&f(n,r,o))||null},p=function(e){var n=e.rowId,t=e.accessor;return"".concat(n,"-").concat(t)},g=function(e,n){return e.hide?[]:e.children&&0!==e.children.length?n&&n.has(e.accessor)?e.children.filter(function(e){return"parentCollapsed"===e.showWhen||"always"===e.showWhen}).flatMap(function(e){return g(e,n)}):e.children.filter(function(e){return"parentExpanded"===e.showWhen||"always"===e.showWhen||!e.showWhen}).flatMap(function(e){return g(e,n)}):[e]},m=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(h({accessor:e.accessor,rowId:"header"}));return(null==n?void 0:n.offsetWidth)||150},w=function(e){var n,t=e.width;"string"==typeof t&&t.includes("fr")&&(e.width=(null===(n=document.getElementById(h({accessor:e.accessor,rowId:"header"})))||void 0===n?void 0:n.offsetWidth)||150),e.children&&e.children.length>0&&e.children.forEach(function(e){w(e)})},x=function(e){return"number"==typeof e.minWidth?e.minWidth:40},y=function(e){return Array.isArray(e)&&e.length>0&&"object"==typeof e[0]&&null!==e[0]},b=function(e){return e.row[e.rowIdAccessor]},C=function(e){var n=e.depth,t=void 0===n?0:n,r=e.expandAll,o=void 0!==r&&r,i=e.unexpandedRows,a=e.rowGrouping,s=void 0===a?[]:a,l=e.rowIdAccessor,c=e.rows,u=e.startingPosition,d=[],f=function(e,n,t){void 0===t&&(t=0);var r=t;return e.forEach(function(t,a){var c=b({row:t,rowIdAccessor:l}),u=s[n],h=0===n&&a===e.length-1;d.push({row:t,depth:n,groupingKey:u,position:r,isLastGroupRow:h}),r++;var v=String(c);if((o?!i.has(v):i.has(v))&&n<s.length){var p=function(e,n){var t=e[n];return y(t)?t:[]}(t,u);p.length>0&&(r=f(p,n+1,r))}}),r};return f(c,t,void 0===u?0:u),d},S=function(e){var n=e.rowIndex,t=e.colIndex,r=e.rowId;return"".concat(n,"-").concat(t,"-").concat(r)},R=n.createContext(void 0),I=function(n){var t=n.children,r=n.value;return e.jsx(R.Provider,o({value:r},{children:t}))},j=function(){var e=n.useContext(R);if(void 0===e)throw new Error("useTableContext must be used within a TableProvider");return e},E=function(t){var r=t.currentPage,s=t.footerRenderer,l=t.hideFooter,c=t.onPageChange,u=t.onNextPage,d=t.rowsPerPage,f=t.shouldPaginate,h=t.totalPages,v=t.totalRows,p=j(),g=p.nextIcon,m=p.prevIcon,w=n.useState(!0),x=w[0],y=w[1],b=!(r>1),C=!(r<h)&&!u||!x&&r===h,S=function(){var e=r-1;e>=1&&c(e)},R=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===h,n=r+1,u&&e?[4,u(r)]:[3,2];case 1:if(!t.sent())return y(!1),[2];t.label=2;case 2:return(n<=h||u)&&c(n),[2]}})})};if(l||!f)return null;if(s){var I=Math.min((r-1)*d+1,v),E=Math.min(r*d,v);return e.jsx(e.Fragment,{children:s({currentPage:r,totalPages:h,rowsPerPage:d,totalRows:v,startRow:I,endRow:E,onPageChange:c,onNextPage:R,onPrevPage:S,hasNextPage:!C,hasPrevPage:!b,nextIcon:g,prevIcon:m})})}var k=function(){if(h<=15)return Array.from({length:h},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>=h-Math.floor(7.5))e=Math.max(1,h-o+1),n=h;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<h-1&&(t.push(-1),t.push(h)),t}();return e.jsxs("div",o({className:"st-footer"},{children:[e.jsx("button",o({className:"st-next-prev-btn ".concat(b?"disabled":""),onClick:S,disabled:b},{children:m})),e.jsx("button",o({className:"st-next-prev-btn ".concat(C?"disabled":""),onClick:R,disabled:C},{children:g})),k.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<=h&&c(e)}(n)},className:"st-page-btn ".concat(r===n?"active":"")},{children:n}),"page-".concat(n))})]}))},k=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"})}))},N=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"})}))},H=function(e){var n=e.bufferRowCount,t=e.contentHeight,r=e.rowHeight,o=e.scrollTop,i=e.tableRows,a=r+1,s=Math.max(0,o-a*n),l=o+t+a*n,c=Math.max(0,Math.floor(s/a)),u=Math.min(i.length,Math.ceil(l/a));return i.slice(c,u)},M=function(e){return e.position*(e.rowHeight+1)-1},A=function(e){return e.position*(e.rowHeight+1)},F=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,f=t.positioning,h=void 0===f?"fixed":f,v=j().mainBodyRef,p=n.useRef(null),g=n.useRef(null),m=n.useState("bottom-left"),w=m[0],x=m[1],y=n.useState({}),b=y[0],C=y[1],S=n.useState(!1),R=S[0],I=S[1];return n.useEffect(function(){a&&p.current?(I(!1),!g.current&&p.current.parentElement&&(g.current=p.current.parentElement),requestAnimationFrame(function(){if(p.current&&g.current){var e,n=p.current,t=g.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"===h?("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)),C(l),I(!0)}})):a||I(!1)},[a,u,d,v,h]),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){if(p.current&&!p.current.contains(e.target)){var n=p.current.parentElement;n&&!n.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:h,width:u?"".concat(u,"px"):"auto",visibility:R?"visible":"hidden"},b),{overflow:l})},{children:r})):null},W=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}))},T=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],f=function(e){d(e),i(e),s(!1),r()};return e.jsxs(F,o({open:a,onClose:function(){r()},setOpen:s,width:120},{children:[e.jsx(W,o({isSelected:!0===u,onClick:function(){return f(!0)}},{children:"True"})),e.jsx(W,o({isSelected:!1===u,onClick:function(){return f(!1)}},{children:"False"}))]}))},D=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()}})},L=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()}})},B=function(t){var r,i,a=t.onChange,s=t.onClose,l=t.value,c=j(),u=c.nextIcon,d=c.prevIcon,f=n.useState(l||new Date),h=f[0],v=f[1],p=n.useState("days"),g=p[0],m=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"===g&&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 m("months")}},{children:[(i=h,i.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"===g&&e.jsx("div",o({className:"st-datepicker-header-label",onClick:function(){return m("years")}},{children:h.getFullYear()})),"years"===g&&e.jsx("div",o({className:"st-datepicker-header-label"},{children:"Select Year"}))]})),e.jsxs("div",o({className:"st-datepicker-grid st-datepicker-".concat(g,"-grid")},{children:["days"===g&&function(){var n=[],t=h.getFullYear(),r=h.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(h.getFullYear(),h.getMonth()-1,e,12,0,0);v(n),a(n),null==s||s()}(r)}},{children:r}),"prev-".concat(r)))},f=0;f<c;f++)d(f);for(var p=function(i){var c=i===(new Date).getDate()&&r===(new Date).getMonth()&&t===(new Date).getFullYear(),u=new Date(l),d=i===u.getDate()&&r===u.getMonth()&&t===u.getFullYear();n.push(e.jsx("div",o({className:"st-datepicker-day ".concat(c?"today":""," ").concat(d?"selected":""),onClick:function(){return function(e){var n=h.getFullYear(),t=h.getMonth(),r=new Date(n,t,e,12,0,0);v(r),a(r),null==s||s()}(i)}},{children:i}),"day-".concat(i)))},g=1;g<=i;g++)p(g);var m=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(h.getFullYear(),h.getMonth()+1,e,12,0,0);v(n),a(n),null==s||s()}(t)}},{children:t}),"next-".concat(t)))};for(g=1;g<=m;g++)x(g);return n}(),"months"===g&&(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===h.getMonth();r.push(e.jsx("div",o({className:"st-datepicker-month ".concat(i?"selected":""),onClick:function(){return function(e){v(new Date(h.getFullYear(),e,1)),m("days")}(t)}},{children:n}),"month-".concat(t)))}),r),"years"===g&&function(){for(var n=[],t=h.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,h.getMonth(),1)),m("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,n=new Date(e.getFullYear(),e.getMonth(),e.getDate(),12,0,0);v(n),a(n),null==s||s()}},{children:"Today"}))}))]}))},O=function(e){if(!e)return new Date;if(/^\d{4}-\d{2}-\d{2}$/.test(e)){var n=e.split("-").map(Number),t=n[0],r=n[1],o=n[2];return new Date(t,r-1,o,12,0,0)}var i=new Date(e);return isNaN(i.getTime())?new Date:new Date(i.getFullYear(),i.getMonth(),i.getDate(),12,0,0)},P=function(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate(),12,0,0)},q=function(e){if(!e)return new Date;if("string"==typeof e)return O(e);if("number"==typeof e){var n=new Date(e);return isNaN(n.getTime())?new Date:P(n)}return e instanceof Date?P(e):new Date},z=function(e){return e?O(e.toString()):new Date},Y=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(F,o({open:a,onClose:c,setOpen:s,width:280},{children:e.jsx(B,{value:z(l),onChange:function(e){var n=e.toISOString().split("T")[0];i(n),s(!1),r()},onClose:c})}))},G=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],f=u[1];return e.jsx(F,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(W,o({isSelected:d===n.value,onClick:function(){return e=n.value,f(e),i(e),l(!1),void r();var e}},{children:n.label}),n.value)})}))}))},U=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(T,{onBlur:c,onChange:function(e){return o(e)},open:!0,setOpen:i,value:l});if("date"===s)return e.jsx(Y,{onBlur:c,onChange:o,open:!0,setOpen:i,value:l});if("enum"===s){var u="string"==typeof l?l:"";return e.jsx(G,{onBlur:c,onChange:o,open:!0,options:r,setOpen:i,value:u})}if("number"===s&&"number"==typeof l)return e.jsx(L,{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(D,{defaultValue:d,onBlur:c,onChange:o})},V=0,K=function(){return function(e){var n=e.callback,t=e.callbackProps,r=e.limit,o=Date.now();(0===V||o-V>=r)&&(V=o,n(t))}},J=function(e){var t=n.useRef(e);return n.useEffect(function(){JSON.stringify(t.current)!==JSON.stringify(e)&&(t.current=e)},[e]),t.current},X=function(e){if(null===e||"object"!=typeof e)return e;if(Array.isArray(e))return e.map(X);var n={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=X(e[t]));return n},_=function(e,n){return e.filter(function(e){return e.pinned===n}).some(function(e){return!e.hide})},$=Date.now(),Q={screenX:0,screenY:0},Z=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=Z(o.children,n,s(s([],t,!0),[r],!1));if(i)return i}}return null},ee=function(e){return"left"===e.pinned?"left":"right"===e.pinned?"right":"main"};function ne(e,n,t){var r,i,a=X(e),s=!1;try{var l=ee(t),c=a.findIndex(function(e){return e.accessor===n.accessor}),u=a.findIndex(function(e){return e.accessor===t.accessor});if(-1===c||-1===u)return{newHeaders:a,emergencyBreak:s=!0};var d=a.splice(c,1)[0],f=(r=l,i=o({},d),"left"===r?i.pinned="left":"right"===r?i.pinned="right":delete i.pinned,i),h=u;a.splice(h,0,f)}catch(e){console.error("Error in insertHeaderAcrossSections:",e),s=!0}return{newHeaders:a,emergencyBreak:s}}var te=function(e){var n=e.draggedHeaderRef,t=e.headers,r=e.hoveredHeaderRef,o=e.onColumnOrderChange,i=e.onTableHeaderDragEnd,a=j().setHeaders,l=J(t);return{handleDragStart:function(e){n.current=e,$=Date.now()},handleDragOver:function(e){var o=e.event,a=e.hoveredHeader;if(o.preventDefault(),t&&n.current){var s=o.currentTarget.getAnimations().some(function(e){return"running"===e.playState}),c=o.screenX,u=o.screenY,d=Math.sqrt(Math.pow(c-Q.screenX,2)+Math.pow(u-Q.screenY,2));r.current=a;var f,h=n.current,v=!1;if(ee(h)!==ee(a)){f=(C=ne(t,h,a)).newHeaders,v=C.emergencyBreak}else{var p=t,g=Z(p,h.accessor),m=Z(p,a.accessor);if(!g||!m)return;var w=g.length,x=m.length,y=m;if(w!==x){var b=x-w;b>0&&(y=m.slice(0,-b))}var C=function(e,n,t){var r=X(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}}(p,g,y);f=C.newHeaders,v=C.emergencyBreak}if(!(s||a.accessor===h.accessor||d<10||JSON.stringify(f)===JSON.stringify(t)||v)){var S=Date.now();JSON.stringify(f)===JSON.stringify(l)&&(S-$<1500||d<40)||($=S,Q={screenX:c,screenY:u},i(f))}}},handleDragEnd:function(){n.current=null,r.current=null,setTimeout(function(){a(function(e){return s([],e,!0)}),null==o||o(t)},10)}}},re=function(){return"undefined"!=typeof window&&window.matchMedia("(prefers-reduced-motion: reduce)").matches},oe={duration:180,easing:"cubic-bezier(0.2, 0.0, 0.2, 1)",delay:0},ie={duration:200,easing:"cubic-bezier(0.2, 0.0, 0.2, 1)",delay:0},ae={duration:150,easing:"ease-out",delay:0},se=function(e){e.style.transition="",e.style.transitionDelay="",e.style.transform="",e.style.top="",e.style.willChange="",e.style.backfaceVisibility="",e.classList.remove("st-animating")},le=function(e,n,t,r){return void 0===t&&(t={}),new Promise(function(r){e.offsetHeight,e.style.transition="transform ".concat(n.duration,"ms ").concat(n.easing),n.delay&&(e.style.transitionDelay="".concat(n.delay,"ms")),e.style.transform="translate3d(0, 0, 0)";var o=function(){se(e),e.removeEventListener("transitionend",o),t.onComplete&&t.onComplete(),r()};e.addEventListener("transitionend",o),setTimeout(o,n.duration+(n.delay||0)+50)})},ce=function(e){var n=e.element,t=e.finalConfig,r=e.fromBounds,s=e.toBounds;return i(void 0,void 0,void 0,function(){var e,i,l;return a(this,function(a){switch(a.label){case 0:return e=function(e,n){var t="x"in e?e.x:e.left,r="y"in e?e.y:e.top;return{x:t-n.x,y:r-n.y}}(r,s),0===e.x&&0===e.y?[2]:re()&&!1!==t.respectReducedMotion?[2]:(i=Math.abs(e.x)>Math.abs(e.y),l=function(e,n){return void 0===e&&(e={}),re()?o(o({},ae),e):o(o({},"column"===n?oe:ie),e)}(t,i?"column":"row"),se(n),function(e,n){e.style.transform="translate3d(".concat(n.x,"px, ").concat(n.y,"px, 0)"),e.style.transition="none",e.style.willChange="transform",e.style.backfaceVisibility="hidden",e.classList.add("st-animating")}(n,e),[4,le(n,l,t)]);case 1:return a.sent(),[2]}})})},ue=function(e){var n=e.element,t=e.options;return i(void 0,void 0,void 0,function(){var e,r,o,i,s,l,c,u,d,f,h,v,p,g,m,w;return a(this,function(a){return e=t.startY,r=t.endY,o=t.finalY,i=t.duration,s=void 0===i?300:i,l=t.easing,c=void 0===l?"cubic-bezier(0.2, 0.0, 0.2, 1)":l,u=t.delay,d=void 0===u?0:u,f=t.onComplete,h=t.respectReducedMotion,v=void 0===h||h,re()&&v?(void 0!==o&&(n.style.transform="",n.style.top="".concat(o,"px")),f&&f(),[2]):(p=n.getBoundingClientRect(),g=p.top,m=e-g,w=r-g,[2,new Promise(function(e){n.style.transition="",n.style.transitionDelay="",n.style.transform="",n.style.willChange="",n.style.backfaceVisibility="",n.classList.remove("st-animating"),n.style.transform="translate3d(0, ".concat(m,"px, 0)"),n.style.transition="none",n.style.willChange="transform",n.style.backfaceVisibility="hidden",n.classList.add("st-animating"),n.offsetHeight,n.style.transition="transform ".concat(s,"ms ").concat(c),d&&(n.style.transitionDelay="".concat(d,"ms")),n.style.transform="translate3d(0, ".concat(w,"px, 0)");var t=function(){n.style.transition="",n.style.transitionDelay="",n.style.transform="",n.style.willChange="",n.style.backfaceVisibility="",n.classList.remove("st-animating"),void 0!==o&&(n.style.top="".concat(o,"px")),n.removeEventListener("transitionend",t),f&&f(),e()};n.addEventListener("transitionend",t),setTimeout(t,s+(d||0)+50)})])})})},de=function(t){var r=t.children,i=t.id,a=t.parentRef,s=t.tableRow,l=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(t[r[o]]=e[r[o]])}return t}(t,["children","id","parentRef","tableRow"]),c=j(),u=c.allowAnimations,d=c.isResizing,f=c.isScrolling,h=c.rowHeight,v=n.useRef(null),p=n.useRef(null),g=J(f),m=J(d);return n.useLayoutEffect(function(){var e,n,t,r;if(u&&v.current&&!d){var i=v.current.getBoundingClientRect(),l=p.current;if(!f)if(!g||f)if(!m||d){if(p.current=i,l){var c=i.x-l.x,w=i.y-l.y;if(!(Math.abs(c)<50&&Math.abs(w)<=5)){if(Math.abs(c)>5||Math.abs(w)>5){var x=o(o({},ie),{onComplete:function(){v.current&&(v.current.style.zIndex="",v.current.style.position="",v.current.style.top="")}}),y=null===(e=null==a?void 0:a.current)||void 0===e?void 0:e.scrollTop,b=null===(n=null==a?void 0:a.current)||void 0===n?void 0:n.clientHeight,C=null===(t=null==a?void 0:a.current)||void 0===t?void 0:t.scrollHeight;if(void 0!==y&&void 0!==b&&void 0!==C){var S=5*h,R=y-S,I=y+b+S,j=l.y>R&&l.y<I,E=i.y>R&&i.y<I,k=i.y<y,N=i.y>y+b,H=null!==(r=null==s?void 0:s.position)&&void 0!==r?r:0,M=.6*h,A=function(e,n,t){var r=Math.min(Math.abs(e-n),Math.abs(e-t));return Math.min(900,Math.max(100,100+80*Math.log10(Math.max(1,r))))};if(j&&!E&&N){var F=y+b+A(i.y,y,y+b)+H%15*M*2.5+H%7*(.4*h);return void ue({element:v.current,options:{startY:l.y,endY:F,finalY:i.y,duration:x.duration,easing:x.easing,onComplete:x.onComplete}})}if(j&&!E&&k){F=y-A(i.y,y,y+b)-H%15*M*2.5-H%7*(.4*h);return void ue({element:v.current,options:{startY:l.y,endY:F,finalY:i.y,duration:x.duration,easing:x.easing,onComplete:x.onComplete}})}if(!j&&E&&l.y>y+b){var W=y+b+A(l.y,y,y+b)+H%10*M*1;return void ue({element:v.current,options:{startY:W,endY:i.y,duration:x.duration,easing:x.easing,onComplete:x.onComplete}})}if(!j&&E&&l.y<y){W=y-A(l.y,y,y+b)-H%10*M*1;return void ue({element:v.current,options:{startY:W,endY:i.y,duration:x.duration,easing:x.easing,onComplete:x.onComplete}})}}ce({element:v.current,fromBounds:l,toBounds:i,finalConfig:x})}}}}else p.current=i;else p.current=i}},[u,d,f,a,g,m,h,null==s?void 0:s.position,s]),e.jsx("div",o({ref:v,"data-animate-id":i,id:String(i)},l,{children:r}))};de.displayName="Animate";var fe=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"})}))},he=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(fe,{className:"st-checkbox-checkmark"})})),i]}))},ve=function(e){var n=e.content,t=e.header;return"boolean"==typeof n?n?"True":"False":Array.isArray(n)?0===n.length?"[]":n.map(function(e){return"object"==typeof e&&null!==e?JSON.stringify(e):String(e)}).join(", "):"date"===t.type&&null!==n&&("string"==typeof n||"number"==typeof n||"object"==typeof n&&n instanceof Date)?q(n).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):n},pe=function(t){var r=t.borderClass,i=t.colIndex,a=t.header,s=t.isHighlighted,l=t.isInitialFocused,c=t.nestedIndex,u=t.rowIndex,d=t.tableRow,f=j(),v=f.cellRegistry,g=f.cellUpdateFlash,m=f.columnBorders,w=f.draggedHeaderRef,x=f.enableRowSelection,C=f.expandIcon,S=f.handleMouseDown,R=f.handleMouseOver,I=f.handleRowSelect,E=f.headers,k=f.hoveredHeaderRef,N=f.isCopyFlashing,H=f.isRowSelected,M=f.isWarningFlashing,A=f.onCellEdit,F=f.onCellClick,W=f.onTableHeaderDragEnd,T=f.rowButtons,D=f.rowGrouping,L=f.rowIdAccessor,B=f.rowsWithSelectedCells,O=f.selectedColumns,P=f.setUnexpandedRows,q=f.tableBodyContainerRef,z=f.theme,Y=f.unexpandedRows,G=f.useOddColumnBackground,V=d.depth,J=d.row,X=n.useState(J[a.accessor]),_=X[0],$=X[1],Q=n.useState(!1),Z=Q[0],ee=Q[1],ne=n.useState(!1),re=ne[0],oe=ne[1],ie=n.useState(!1),ae=ie[0],se=ie[1],le=n.useRef(null),ce=b({row:J,rowIdAccessor:L}),ue=D&&D[V],fe=!!ue&&function(e,n){if(!n)return!1;var t=e[n];return y(t)}(J,ue),pe=!Y.has(String(ce)),ge=N({rowIndex:u,colIndex:i,rowId:ce}),me=M({rowIndex:u,colIndex:i,rowId:ce}),we=n.useMemo(function(){var e,n,t;if(!m)return!1;var r=E.filter(function(e){return"left"===e.pinned}),o=E.filter(function(e){return!e.pinned}),i=E.filter(function(e){return"right"===e.pinned});return"left"===a.pinned?(null===(e=r[r.length-1])||void 0===e?void 0:e.accessor)===a.accessor:"right"===a.pinned?(null===(n=i[i.length-1])||void 0===n?void 0:n.accessor)===a.accessor:(null===(t=o[o.length-1])||void 0===t?void 0:t.accessor)===a.accessor},[m,E,a.accessor,a.pinned]),xe=te({draggedHeaderRef:w,headers:E,hoveredHeaderRef:k,onTableHeaderDragEnd:W}).handleDragOver,ye=K(),be=h({accessor:a.accessor,rowId:ce}),Ce=p({rowId:ce,accessor:a.accessor}),Se=a.isSelectionColumn&&x;n.useEffect(function(){if(v){var e="".concat(ce,"-").concat(a.accessor);return v.set(e,{updateContent:function(e){_!==e?($(e),g&&(oe(!0),le.current&&clearTimeout(le.current),le.current=setTimeout(function(){oe(!1)},800))):$(e)}}),function(){v.delete(e),le.current&&clearTimeout(le.current)}}},[v,g,ce,a.accessor,_]),n.useEffect(function(){if(re){var e=setTimeout(function(){oe(!1)},850);return function(){return clearTimeout(e)}}},[re]),n.useEffect(function(){$(J[a.accessor])},[J,a.accessor]);var Re="boolean"===a.type||"date"===a.type||"enum"===a.type,Ie=Boolean(null==a?void 0:a.isEditable),je=O.has(i),Ee=s&&!je,ke=n.useMemo(function(){return!!Se&&B.has(String(ce))},[Se,B,ce]),Ne="st-cell ".concat(V>0&&a.expandable?"st-cell-depth-".concat(V):""," ").concat(Ee?l?"st-cell-selected-first ".concat(r):"st-cell-selected ".concat(r):""," ").concat(je?l?"st-cell-column-selected-first":"st-cell-column-selected":""," ").concat(Ie?"clickable":""," ").concat(re?l?"st-cell-updating-first":"st-cell-updating":""," ").concat(ge?l?"st-cell-copy-flash-first":"st-cell-copy-flash":""," ").concat(me?l?"st-cell-warning-flash-first":"st-cell-warning-flash":""," ").concat(G?c%2==0?"even-column":"odd-column":""," ").concat(Se?"st-selection-cell":""," ").concat(ke?"st-selection-has-highlighted-cell":""," ").concat(we?"st-last-column":""),He=n.useCallback(function(e){null==e&&(e="number"===a.type?0:"boolean"!==a.type&&""),$(e),J[a.accessor]=e,null==A||A({accessor:a.accessor,newValue:e,row:J,rowIndex:u})},[a.accessor,a.type,A,J,u]),Me=n.useCallback(function(){P(function(e){var n=new Set(e),t=String(ce);return n.has(t)?n.delete(t):n.add(t),n})},[ce,P]);return!Z||Re||Se?e.jsxs(de,o({className:Ne,"data-accessor":a.accessor,"data-col-index":i,"data-row-id":ce,"data-row-index":u,id:be,onClick:function(){F&&!Se&&F({accessor:a.accessor,colIndex:i,row:J,rowId:ce,rowIndex:u,value:_})},onDoubleClick:function(){return a.isEditable&&!Se&&ee(!0)},onDragOver:function(e){Se||ye({callback:xe,callbackProps:{event:e,hoveredHeader:a},limit:50})},onKeyDown:function(e){Z||Se||"F2"!==e.key&&"Enter"!==e.key||!a.isEditable||Z||(e.preventDefault(),ee(!0))},onMouseDown:function(){Z||Se||S({rowIndex:u,colIndex:i,rowId:ce})},onMouseEnter:function(){se(!0)},onMouseLeave:function(){se(!1)},onMouseOver:function(){Z||Se||R({rowIndex:u,colIndex:i,rowId:ce})},parentRef:q,tableRow:d},{children:[a.expandable&&fe?e.jsx("div",o({className:"st-icon-container st-expand-icon-container ".concat(pe?"expanded":"collapsed"),onClick:Me},{children:C})):null,e.jsx("span",o({className:"st-cell-content ".concat("right"===a.align?"right-aligned":"center"===a.align?"center-aligned":"left-aligned")},{children:e.jsx("span",{children:Se?e.jsxs("div",o({className:"st-selection-cell-content"},{children:[e.jsx("div",o({className:"st-selection-control"},{children:ae||H&&H(String(ce))?e.jsx(he,{checked:!!H&&H(String(ce)),onChange:function(e){I&&I(String(ce),e)}}):e.jsx("span",o({className:"st-row-number"},{children:u+1}))})),function(){if(!T||!Se||0===T.length)return null;if(!(ae||H&&H(String(ce))))return null;var n={row:J};return e.jsx("div",o({className:"st-row-buttons"},{children:T.map(function(t,r){return e.jsx("span",o({className:"st-row-button"},{children:t(n)}),r)})}))}()]})):a.cellRenderer?a.cellRenderer({accessor:a.accessor,colIndex:i,row:J,theme:z}):ve({content:_,header:a})})})),Z&&Re&&!Se&&e.jsx(U,{enumOptions:a.enumOptions,onChange:He,setIsEditing:ee,type:a.type,value:_})]}),Ce):e.jsx("div",o({className:"st-cell-editing",id:h({accessor:a.accessor,rowId:ce}),onMouseDown:function(e){return e.stopPropagation()},onKeyDown:function(e){return e.stopPropagation()}},{children:e.jsx(U,{enumOptions:a.enumOptions,onChange:He,setIsEditing:ee,type:a.type,value:_})}))},ge=function(n){var t=n.columnIndexStart,r=n.columnIndices,o=n.headers,i=n.pinned,a=n.rowIndex,s=n.rowIndices,l=n.tableRow,c=j(),u=c.rowIdAccessor,d=c.collapsedHeaders,f=o.filter(function(e){return v({header:e,pinned:i,headers:o,collapsedHeaders:d})});return e.jsx(e.Fragment,{children:f.map(function(n,c){var d=b({row:l.row,rowIdAccessor:u}),f=h({accessor:n.accessor,rowId:d});return e.jsx(me,{columnIndices:r,header:n,headers:o,nestedIndex:c+(null!=t?t:0),pinned:i,rowIndex:a,rowIndices:s,tableRow:l},f)})})},me=function(t){var r=t.columnIndices,o=t.header,i=t.headers,a=t.nestedIndex,s=t.pinned,l=t.rowIndex,c=t.rowIndices,u=t.tableRow,d=r[o.accessor],f=j(),p=f.getBorderClass,g=f.isSelected,m=f.isInitialFocusedCell,w=f.rowIdAccessor,x=f.collapsedHeaders,y=b({row:u.row,rowIdAccessor:w});if(o.children&&o.children.length>0){var C=o.children.filter(function(e){return v({header:e,pinned:s,headers:i,collapsedHeaders:x})});return e.jsx(n.Fragment,{children:C.map(function(n){var t=h({accessor:n.accessor,rowId:y});return e.jsx(me,{columnIndices:r,header:n,headers:i,nestedIndex:a,pinned:s,rowIndex:l,rowIndices:c,tableRow:u},t)})})}var S={rowIndex:l,colIndex:d,rowId:y},R=p(S),I=g(S),E=m(S),k=h({accessor:o.accessor,rowId:y});return e.jsx(pe,{borderClass:R,colIndex:d,header:o,isHighlighted:I,isInitialFocused:E,nestedIndex:a,rowIndex:l,tableRow:u},k)},we=function(n){var t=n.columnIndices,r=n.columnIndexStart,i=n.gridTemplateColumns,a=n.headers,s=n.index,l=n.pinned,c=n.rowHeight,u=n.rowIndices,d=n.setHoveredIndex,f=n.tableRow,h=j(),v=h.useHoverRowBackground,p=h.rowIdAccessor,g=h.isAnimating,m=h.isRowSelected,w=h.useOddEvenRowBackground,x=f.position,y=x%2==0,C=b({row:f.row,rowIdAccessor:p}),S=!!m&&m(String(C));return e.jsx("div",o({className:"st-row ".concat(w?y?"even":"odd":""," ").concat(S?"selected":""),"data-index":s,onMouseEnter:function(){!g&&v&&d(s)},style:{gridTemplateColumns:i,top:A({position:x,rowHeight:c}),height:"".concat(c,"px")}},{children:e.jsx(ge,{columnIndexStart:r,columnIndices:t,headers:a,pinned:l,rowIndex:x,rowIndices:u,tableRow:f},C)}))},xe=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 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:s,top:M({position:i,rowHeight:a})}},{children:e.jsx("div",{style:{gridColumn:"1 / -1"}})}))},ye=n.createContext(void 0),be=function(e){var t=e.childRef,r=e.children,o=e.group,i=void 0===o?"default":o,a=function(){var e=n.useContext(ye);if(!e)throw new Error("useScrollSyncContext must be used within a ScrollSyncProvider");return e}(),s=a.registerPane,l=a.unregisterPane;return n.useEffect(function(){var e=[i];return t.current&&s(t.current,e),function(){t.current&&l(t.current,e)}},[t,s,l,i]),n.cloneElement(r,{ref:function(e){t.current=e}})},Ce=n.forwardRef(function(t,r){var i=t.columnIndexStart,a=t.columnIndices,s=t.headers,l=t.pinned,c=t.rowHeight,u=t.rowIndices,d=t.setHoveredIndex,f=t.templateColumns,h=t.totalHeight,v=t.rowsToRender,p=t.width,g=l?"st-body-pinned-".concat(l):"st-body-main",m=j().rowIdAccessor,w=n.useRef(null);if(n.useImperativeHandle(r,function(){return w.current},[]),!n.useMemo(function(){return _(s,l)},[s,l]))return null;var x=l?"pinned-".concat(l):"default";return e.jsx(be,o({childRef:w,group:x},{children:e.jsx("div",o({className:g,ref:w,style:o({position:"relative",height:"".concat(h,"px"),width:p},!l&&{flexGrow:1})},{children:v.map(function(t,r){var o=b({row:t.row,rowIdAccessor:m});return e.jsxs(n.Fragment,{children:[0!==r&&e.jsx(xe,{displayStrongBorder:t.isLastGroupRow,position:t.position,rowHeight:c,templateColumns:f,rowIndex:r-1}),e.jsx(we,{columnIndexStart:i,columnIndices:a,gridTemplateColumns:f,headers:s,index:r,pinned:l,rowHeight:c,rowIndices:u,setHoveredIndex:d,tableRow:t},o)]},o)})}))}))});function Se(e){var n=e.headers,t=e.pinnedLeftColumns,r=e.pinnedRightColumns,o=e.collapsedHeaders,i={},a=0,l=s(s(s([],t,!0),n,!0),r,!0),c=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 v({header:e,headers:l,collapsedHeaders:o})}).forEach(function(e,n){c(e,0===n)})};return t.forEach(function(e,n){c(e,0===n)}),n.filter(function(e){return!e.pinned&&v({header:e,headers:l,collapsedHeaders:o})}).forEach(function(e,n){var r=0===n&&0===t.length;c(e,r)}),r.forEach(function(e){c(e,!1)}),i}Ce.displayName="TableSection";var Re=function(t){var r=t.mainTemplateColumns,i=t.pinnedLeftColumns,a=t.pinnedLeftTemplateColumns,s=t.pinnedLeftWidth,l=t.pinnedRightColumns,c=t.pinnedRightTemplateColumns,u=t.pinnedRightWidth,d=t.rowsToRender,f=t.setScrollTop,h=t.tableRows,v=j(),p=v.collapsedHeaders,g=v.headerContainerRef,m=v.headers,w=v.isAnimating,x=v.mainBodyRef,y=v.onLoadMore,C=v.rowHeight,S=v.rowIdAccessor,R=v.scrollbarWidth,I=v.setIsScrolling,E=v.shouldPaginate,k=v.tableBodyContainerRef,N=n.useState(!1),H=N[0],M=N[1],A=n.useRef(new Set),F=n.useCallback(function(e){(A.current.forEach(function(e){return e.classList.remove("hovered")}),A.current.clear(),null!==e)&&document.querySelectorAll('.st-body-container .st-row[data-index="'.concat(e,'"]')).forEach(function(e){e.classList.add("hovered"),A.current.add(e)})},[]);n.useEffect(function(){w&&F(null)},[w,F]),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:g,mainSectionRef:k,scrollbarWidth:R}),n.useEffect(function(){return function(){T.current&&clearTimeout(T.current)}},[]);var W=n.useRef(null),T=n.useRef(null),D=n.useRef(0),L=function(e){return e.length}(h),B=L*(C+1)-1,O=n.useMemo(function(){return Se({headers:m,pinnedLeftColumns:i,pinnedRightColumns:l,collapsedHeaders:p})},[m,i,l,p]),P=n.useMemo(function(){var e={};return d.forEach(function(n,t){var r=String(b({row:n.row,rowIdAccessor:S}));e[r]=t}),e},[d,S]),q=n.useCallback(function(e,n){if(y&&!E&&!H){e.scrollHeight-(n+e.clientHeight)<=200&&n>D.current&&(M(!0),y(),setTimeout(function(){M(!1)},1e3))}},[y,E,H]),z={columnIndices:O,headerContainerRef:g,headers:m,rowHeight:C,rowIndices:P,rowsToRender:d,setHoveredIndex:F};return e.jsxs("div",o({className:"st-body-container",onMouseLeave:function(){return F(null)},onScroll:function(e){var n=e.currentTarget,t=n.scrollTop;I(!0),T.current&&clearTimeout(T.current),T.current=setTimeout(function(){I(!1)},150),W.current&&cancelAnimationFrame(W.current),W.current=requestAnimationFrame(function(){f(t),q(n,t),D.current=t})},ref:k},{children:[e.jsx(Ce,o({},z,{pinned:"left",templateColumns:a,totalHeight:B,width:s})),e.jsx(Ce,o({},z,{columnIndexStart:i.length,ref:x,templateColumns:r,totalHeight:B})),e.jsx(Ce,o({},z,{columnIndexStart:i.length+r.length,pinned:"right",templateColumns:c,totalHeight:B,width:u}))]}))},Ie=function(e){var n=e.event;e.gridColumnEnd,e.gridColumnStart;var t=e.header,r=e.headers,o=e.setHeaders,i=e.setIsResizing,a=e.startWidth,c=e.collapsedHeaders;n.preventDefault();var u="clientX"in n?n.clientX:n.touches[0].clientX,d="touches"in n;if(t&&!t.hide){i(!0);var f,h=x(t);if(t.children&&t.children.length>0){var v=g(t,c);f=v.length>0?v:[t]}else f=[t];var p=function(e){var n="right"===t.pinned?u-e:e-u,i=function(e){var n=e.header,t=e.headers,r=e.collapsedHeaders,o=document.querySelector(".st-body-container");if(!o||0===o.clientWidth)return 1e3;var i=o.clientWidth,a=i*l(window.innerWidth);if(!n.pinned)return Math.max(.6*i,600);var s=a-t.filter(function(e){return e.pinned===n.pinned&&e.accessor!==n.accessor}).reduce(function(e,n){return n.hide?e:e+g(n,r).reduce(function(e,n){return e+m(n)},0)},0),c=x(n);return s<c?(console.warn("Header ".concat(n.accessor," exceeds pinned section width limit")),c):s}({header:t,headers:r,collapsedHeaders:c});if(f.length>1)je({delta:n,leafHeaders:f,minWidth:h,startWidth:a,maxWidth:i});else{var d=Math.max(Math.min(a+n,i),h);f[0].width=d}r.forEach(function(e){w(e)});var v=s([],r,!0);o(v)};if(d){var y=function(e){var n=e.touches[0];p(n.clientX)},b=function(){document.removeEventListener("touchmove",y),document.removeEventListener("touchend",b),i(!1)};document.addEventListener("touchmove",y),document.addEventListener("touchend",b)}else{var C=function(e){p(e.clientX)},S=function(){document.removeEventListener("mousemove",C),document.removeEventListener("mouseup",S),i(!1)};document.addEventListener("mousemove",C),document.addEventListener("mouseup",S)}}},je=function(e){var n=e.delta,t=e.leafHeaders,r=e.minWidth,o=e.startWidth,i=e.maxWidth,a=t.reduce(function(e,n){return Math.min(e,x(n))},40),s=t.reduce(function(e,n){return e+("number"==typeof n.width?n.width:150)},0),l=Math.max(Math.min(o+n,i),a)-s;t.forEach(function(e){var n="number"==typeof e.width?e.width:150,t=l*(n/s),o=Math.max(n+t,r);e.width=o})},Ee={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"},ke=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"]}},Ne=function(e){return!["between","notBetween","in","notIn","isEmpty","isNotEmpty"].includes(e)},He=function(e){return["between","notBetween","in","notIn"].includes(e)},Me=function(e){return["isEmpty","isNotEmpty"].includes(e)},Ae=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"})}))},We=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,f=void 0!==d&&d,h=n.useState(!1),v=h[0],p=h[1],g=n.useState(-1),m=g[0],w=g[1],x=n.useRef(null),y=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(),m>=0&&(i(a[m].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,m,a,i]);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=a.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:y?y.label:l})),e.jsx(Fe,{})]})),e.jsx(F,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===m?"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}),t)})}))}))]}))},Te=function(n){var t=n.value,r=n.onChange,i=n.operators.map(function(e){return{value:e,label:Ee[e]}});return e.jsx("div",o({className:"st-filter-section"},{children:e.jsx(We,{value:t,onChange:function(e){r(e)},options:i})}))},De=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,d=n.onEnterPress;return e.jsx("input",{type:r,value:o,onChange:function(e){return i(e.target.value)},onKeyDown:function(e){"Enter"===e.key&&d&&d()},placeholder:a,autoFocus:l,className:"st-filter-input ".concat(u).trim()})},Le=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}))},Be=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"}))]}))},Oe=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)||"")),f=d[0],h=d[1],v=ke("string");n.useEffect(function(){i?(u(i.operator),h(String(i.value||""))):(u("contains"),h(""))},[i]);var p=function(){var e=o({accessor:r.accessor,operator:c},Ne(c)&&{value:f});a(e)},g=Me(c)||f.trim();return e.jsxs(Ae,{children:[e.jsx(Te,{value:c,onChange:u,operators:v}),Ne(c)&&e.jsx(Le,{children:e.jsx(De,{type:"text",value:f,onChange:h,placeholder:"Filter...",autoFocus:!0,onEnterPress:p})}),e.jsx(Be,{onApply:p,onClear:s,canApply:!!g,showClear:!!i})]})},Pe=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],f=n.useState(String((null==a?void 0:a.value)||"")),h=f[0],v=f[1],p=n.useState(String((null===(r=null==a?void 0:a.values)||void 0===r?void 0:r[0])||"")),g=p[0],m=p[1],w=n.useState(String((null===(o=null==a?void 0:a.values)||void 0===o?void 0:o[1])||"")),x=w[0],y=w[1],b=ke("number");n.useEffect(function(){var e,n;a?(d(a.operator),v(String(a.value||"")),m(String((null===(e=a.values)||void 0===e?void 0:e[0])||"")),y(String((null===(n=a.values)||void 0===n?void 0:n[1])||""))):(d("equals"),v(""),m(""),y(""))},[a]);var C=function(){var e={accessor:i.accessor,operator:u};Ne(u)?e.value=parseFloat(h):He(u)&&(e.values=[parseFloat(g.toString()),parseFloat(x.toString())]),s(e)};return e.jsxs(Ae,{children:[e.jsx(Te,{value:u,onChange:d,operators:b}),Ne(u)&&e.jsx(Le,{children:e.jsx(De,{type:"number",value:h,onChange:v,placeholder:"Enter number...",autoFocus:!0,onEnterPress:C})}),He(u)&&e.jsxs(Le,{children:[e.jsx(De,{type:"number",value:g,onChange:m,placeholder:"From...",autoFocus:!0,className:"st-filter-input-range-from",onEnterPress:C}),e.jsx(De,{type:"number",value:x,onChange:y,placeholder:"To...",onEnterPress:C})]}),e.jsx(Be,{onApply:C,onClear:l,canApply:!!Me(u)||(Ne(u)?""!==h.trim():!!He(u)&&""!==String(g).trim()&&""!==String(x).trim()),showClear:!!a})]})},qe=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(We,{value:t,onChange:r,options:o,className:a,placeholder:s})},ze=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],f=u[1],h=ke("boolean");n.useEffect(function(){o?(c(o.operator),f(void 0!==o.value?String(o.value):"true")):(c("equals"),f("true"))},[o]);var v=Me(l)||""!==d;return e.jsxs(Ae,{children:[e.jsx(Te,{value:l,onChange:c,operators:h}),Ne(l)&&e.jsx(Le,{children:e.jsx(qe,{value:d,onChange:f,options:[{value:"true",label:"True"},{value:"false",label:"False"}]})}),e.jsx(Be,{onApply:function(){var e={accessor:r.accessor,operator:l};Ne(l)&&(e.value="true"===d),i(e)},onClear:a,canApply:v,showClear:!!o})]})},Ye=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],f=u[1],h=n.useState((null==s?void 0:s.value)?String(s.value):""),v=h[0],p=h[1],g=n.useState((null===(r=null==s?void 0:s.values)||void 0===r?void 0:r[0])?String(s.values[0]):""),m=g[0],w=g[1],x=n.useState(String((null===(i=null==s?void 0:s.values)||void 0===i?void 0:i[1])||"")),y=x[0],b=x[1],C=ke("date");n.useEffect(function(){var e,n;s?(f(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])||""))):(f("equals"),p(""),w(""),b(""))},[s]);var S=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],f=n.useState(""),h=f[0],v=f[1],p=n.useRef(null);n.useEffect(function(){if(r){var e=q(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 g=r?q(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: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(F,o({open:u,setOpen:d,onClose:function(){d(!1)},positioning:"absolute",overflow:"visible"},{children:e.jsx(B,{value:g,onChange:function(e){var n=e.toISOString().split("T")[0];i(n),d(!1)},onClose:function(){return d(!1)}})}))]}))};return e.jsxs(Ae,{children:[e.jsx(Te,{value:d,onChange:f,operators:C}),Ne(d)&&e.jsx(Le,{children:e.jsx(S,{value:v,onChange:p,placeholder:"Select date...",autoFocus:!0})}),He(d)&&e.jsxs(Le,{children:[e.jsx(S,{value:m,onChange:w,placeholder:"From date...",autoFocus:!0,className:"st-filter-input-range-from"}),e.jsx(S,{value:y,onChange:b,placeholder:"To date..."})]}),e.jsx(Be,{onApply:function(){var e={accessor:a.accessor,operator:d};Ne(d)?e.value=v:He(d)&&(e.values=[m,y]),l(e)},onClear:c,canApply:!!Me(d)||(Ne(d)?""!==v.trim():!!He(d)&&""!==m.trim()&&""!==y.trim()),showClear:!!s})]})},Ge=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),f=d[0],h=d[1],v=n.useState(""),p=v[0],g=v[1],m=n.useMemo(function(){if(!p)return c;var e=p.toLowerCase();return c.filter(function(n){return n.label.toLowerCase().includes(e)})},[c,p]);n.useEffect(function(){h(i?i.values?i.values.map(String):[]:u)},[i,u]);var w=f.length===u.length,x=c.length>10;return e.jsxs(Ae,{children:[e.jsx(Le,{children:e.jsxs("div",o({className:"st-enum-filter-options"},{children:[e.jsx("div",o({className:"st-enum-select-all"},{children:e.jsx(he,o({checked:w,onChange:function(e){h(e?u:[])}},{children:e.jsx("span",o({className:"st-enum-option-label st-enum-select-all-label"},{children:"Select All"}))}))})),x&&e.jsx("div",o({className:"st-enum-search"},{children:e.jsx(De,{type:"text",value:p,onChange:g,placeholder:"Search..."})})),m.map(function(n,t){return e.jsx(he,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}):s(s([],n,!0),[e],!1)});var e}},{children:e.jsx("span",o({className:"st-enum-option-label"},{children:n.label}))}),t)}),p&&0===m.length&&e.jsx("div",o({className:"st-enum-no-results"},{children:"No matching options"}))]}))}),e.jsx(Be,{onApply:function(){if(f.length!==u.length){var e={accessor:r.accessor,operator:"in",values:f};a(e)}else l()},onClear:l,canApply:0!==f.length&&f.length!==u.length,showClear:!!i})]})},Ue=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(Pe,{header:t,currentFilter:r,onApplyFilter:o,onClearFilter:i});case"boolean":return e.jsx(ze,{header:t,currentFilter:r,onApplyFilter:o,onClearFilter:i});case"date":return e.jsx(Ye,{header:t,currentFilter:r,onApplyFilter:o,onClearFilter:i});case"enum":return e.jsx(Ge,{header:t,currentFilter:r,onApplyFilter:o,onClearFilter:i});default:return e.jsx(Oe,{header:t,currentFilter:r,onApplyFilter:o,onClearFilter:i})}}()})},Ve=function(t){var r=t.content,i=t.children,a=t.delay,s=void 0===a?500:a,l=n.useState(!1),c=l[0],u=l[1],d=n.useState({top:0,left:0}),f=d[0],h=d[1],v=n.useRef(null),p=n.useRef(null);if(n.useEffect(function(){return function(){v.current&&clearTimeout(v.current)}},[]),!r||!n.isValidElement(i))return e.jsx(e.Fragment,{children:i});var g=n.cloneElement(i,{ref:p,onMouseEnter:function(){v.current=setTimeout(function(){if(p.current&&r.trim()){var e=p.current.getBoundingClientRect();if(e.width>0&&e.height>0){var n=e.left+e.width/2-100,t=e.bottom+8;n<8?n=8:n+200>window.innerWidth-8&&(n=window.innerWidth-200-8),t+40>window.innerHeight-8&&(t=e.top-40-8),h({top:t,left:n}),u(!0)}}},s)},onMouseLeave:function(){v.current&&(clearTimeout(v.current),v.current=null),u(!1)}});return e.jsxs(e.Fragment,{children:[g,c&&e.jsx("div",o({className:"st-tooltip",style:{position:"fixed",top:"".concat(f.top,"px"),left:"".concat(f.left,"px"),zIndex:1e4}},{children:r}))]})},Ke=function(t){var r,i,a=t.colIndex,l=t.gridColumnEnd,u=t.gridColumnStart,d=t.gridRowEnd,f=t.gridRowStart,v=t.header,p=t.reverse,g=t.sort,m=n.useState(!1),w=m[0],x=m[1],y=n.useState(!1),b=y[0],C=y[1],S=n.useState(v.label||""),R=S[0],I=S[1],E=j(),k=E.activeHeaderDropdown,N=E.areAllRowsSelected,H=E.collapsedHeaders,M=E.columnBorders,A=E.columnReordering,W=E.columnResizing,T=E.columnsWithSelectedCells,L=E.draggedHeaderRef,B=E.enableHeaderEditing,O=E.enableRowSelection,P=E.filterIcon,q=E.filters,z=E.handleApplyFilter,Y=E.handleClearFilter,G=E.handleSelectAll,U=E.headerCollapseIcon,V=E.headerDropdown,J=E.headerExpandIcon,X=E.headerRegistry,_=E.headers,$=E.hoveredHeaderRef,Q=E.onColumnOrderChange,Z=E.onColumnSelect,ee=E.onHeaderEdit,ne=E.onSort,re=E.onTableHeaderDragEnd,oe=E.headerHeight,ie=E.selectColumns,ae=E.selectableColumns,se=E.selectedColumns,le=E.setActiveHeaderDropdown,ce=E.setCollapsedHeaders,ue=E.setHeaders,fe=E.setInitialFocusedCell,ve=E.setIsResizing,pe=E.setSelectedCells,ge=E.setSelectedColumns,me=E.sortDownIcon,we=E.sortUpIcon,xe=Boolean(null==v?void 0:v.isSortable),ye=Boolean(null==v?void 0:v.filterable),be=q[v.accessor],Ce=(null==k?void 0:k.accessor)===v.accessor,Se=v.isSelectionColumn&&O,Re=function(e){var n;return Boolean((null===(n=e.children)||void 0===n?void 0:n.length)&&e.collapsible)}(v),je=H.has(v.accessor),Ee=function(e){var t=e.isOpen,r=e.estimatedHeight,o=void 0===r?200:r,i=e.estimatedWidth,a=void 0===i?250:i,s=e.margin,l=void 0===s?4:s,c=n.useRef(null),u=n.useState({}),d=u[0],f=u[1];return n.useEffect(function(){if(t&&c.current){var e=function(){if(c.current){var e=c.current.getBoundingClientRect(),n=window.innerHeight-e.bottom,t=e.top,r=window.innerWidth-e.right,i="bottom",s={};o>n&&o<=t&&(i="top");var u="left";a>r+e.width&&(u="right"),"bottom"===i?s.top=e.bottom+l:s.bottom=window.innerHeight-e.top+l,"left"===u?s.left=e.left:s.right=window.innerWidth-e.right,f(s)}};requestAnimationFrame(e);var n=function(){return requestAnimationFrame(e)},r=function(){return requestAnimationFrame(e)};return window.addEventListener("resize",n),window.addEventListener("scroll",r,!0),function(){window.removeEventListener("resize",n),window.removeEventListener("scroll",r,!0)}}f({})},[t,o,a,l]),{triggerRef:c,position:d}}({isOpen:Ce,estimatedHeight:200,estimatedWidth:250,margin:4}),ke=Ee.triggerRef,Ne=Ee.position,He=n.useMemo(function(){var e,n,t;if(!M)return!1;var r=_.filter(function(e){return"left"===e.pinned}),o=_.filter(function(e){return!e.pinned}),i=_.filter(function(e){return"right"===e.pinned});return"left"===v.pinned?(null===(e=r[r.length-1])||void 0===e?void 0:e.accessor)===v.accessor:"right"===v.pinned?(null===(n=i[i.length-1])||void 0===n?void 0:n.accessor)===v.accessor:(null===(t=o[o.length-1])||void 0===t?void 0:t.accessor)===v.accessor},[M,_,v.accessor,v.pinned]),Me=n.useMemo(function(){return!(!ae||Se)&&c(v,a).some(function(e){return se.has(e)})},[ae,Se,v,a,se]),Ae=n.useMemo(function(){return!Se&&c(v,a).some(function(e){return T.has(e)})},[Se,v,a,T]),Fe=n.useMemo(function(){return!(!v.children||0===v.children.length)&&(!je||v.children.some(function(e){return"parentCollapsed"===e.showWhen||"always"===e.showWhen}))},[v.children,je]),We="st-header-cell ".concat(v.accessor===(null===(r=$.current)||void 0===r?void 0:r.accessor)?"st-hovered":""," ").concat((null===(i=L.current)||void 0===i?void 0:i.accessor)===v.accessor?"st-dragging":""," ").concat(xe?"clickable":""," ").concat(A&&!xe?"columnReordering":""," ").concat(Fe?"parent":""," ").concat(He?"st-last-column":""," ").concat(B&&!Se?"st-header-editable":""," ").concat(Me?"st-header-selected":""," ").concat(Ae&&!Me?"st-header-has-highlighted-cell":""),Te=te({draggedHeaderRef:L,headers:_,hoveredHeaderRef:$,onColumnOrderChange:Q,onTableHeaderDragEnd:re}),De=Te.handleDragStart,Le=Te.handleDragEnd,Be=Te.handleDragOver,Oe=K();n.useEffect(function(){if(X&&!v.isSelectionColumn){var e=String(v.accessor);return X.set(e,{setEditing:function(e){C(e)}}),function(){X.delete(e)}}},[X,v.accessor,v.isSelectionColumn]),n.useEffect(function(){I(v.label||"")},[v.label]);var Pe=n.useCallback(function(e){I(e);var n=_.map(function(n){return n.accessor===v.accessor?o(o({},n),{label:e}):n});ue(n),ee&&ee(v,e)},[_,ue,ee,v]),qe=n.useCallback(function(){le&&le(null)},[le]),ze=n.useCallback(function(e){e.stopPropagation(),ce(function(e){var n=new Set(e);return je?n.delete(v.accessor):n.add(v.accessor),n})},[ce,je,v.accessor]),Ye=function(e){var n=e.event,t=e.header;if(!t.isSelectionColumn){if(ae){var r=c(t,a),o=r.some(function(e){return se.has(e)});if(B&&o&&!n.shiftKey)return V&&Ce&&qe(),void C(!0);n.shiftKey&&ie?ge(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))}):ie&&ie(r),pe(new Set),fe(null)}Z&&Z(t),!ae&&t.isSortable&&ne(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 Ge=W&&!Se&&e.jsx("div",o({className:"st-header-resize-handle-container",onMouseDown:function(e){var n,t=null===(n=document.getElementById(h({accessor:v.accessor,rowId:"header"})))||void 0===n?void 0:n.offsetWidth;Oe({callback:Ie,callbackProps:{event:e.nativeEvent,gridColumnEnd:l,gridColumnStart:u,header:v,headers:_,setHeaders:ue,setIsResizing:ve,startWidth:t,collapsedHeaders:H},limit:10})},onTouchStart:function(e){var n,t=null===(n=document.getElementById(h({accessor:v.accessor,rowId:"header"})))||void 0===n?void 0:n.offsetWidth;Oe({callback:Ie,callbackProps:{event:e,gridColumnEnd:l,gridColumnStart:u,header:v,headers:_,setHeaders:ue,setIsResizing:ve,startWidth:t,collapsedHeaders:H},limit:10})}},{children:e.jsx("div",{className:"st-header-resize-handle"})})),Ke=g&&g.key.accessor===v.accessor&&e.jsxs("div",o({className:"st-icon-container",onClick:function(e){return Ye({event:e,header:v})}},{children:["ascending"===g.direction&&we&&we,"descending"===g.direction&&me&&me]})),Je=ye&&P&&e.jsxs("div",o({className:"st-icon-container",onClick:function(e){e.stopPropagation(),x(!w)}},{children:[n.cloneElement(P,{style:{fill:be?"var(--st-button-active-background-color)":"var(--st-header-icon-color)"}}),e.jsx(F,o({open:w,overflow:"visible",setOpen:x,onClose:function(){return x(!1)}},{children:e.jsx(Ue,{header:v,currentFilter:be,onApplyFilter:function(e){z(e),x(!1)},onClearFilter:function(){Y(v.accessor),x(!1)}})}))]})),Xe=Re&&!Se&&e.jsx("div",o({className:"st-icon-container st-collapse-icon-container",onClick:ze},{children:je?U:J}));return e.jsxs(de,o({className:We,id:h({accessor:v.accessor,rowId:"header"}),onDragOver:function(e){Se||Oe({callback:Be,callbackProps:{event:e,hoveredHeader:v},limit:50})},style:o({gridRowStart:f,gridRowEnd:d,gridColumnStart:u,gridColumnEnd:l},d-f>1?{}:{height:oe})},{children:[p&&Ge,"right"===v.align&&Xe,"right"===v.align&&Je,"right"===v.align&&Ke,e.jsx("div",o({ref:ke,className:"st-header-label",draggable:A&&!v.disableReorder&&!Se,onClick:function(e){Se||Ye({event:e,header:v})},onDoubleClick:function(e){Se||function(e){e.event;var n=e.header;n.isSelectionColumn||ae&&n.isSortable&&ne(n.accessor)}({event:e,header:v})},onDragEnd:Se?void 0:function(e){e.preventDefault(),Le()},onDragStart:Se?void 0:function(e){A&&v&&function(e){De(e)}(v)}},{children:e.jsx(Ve,o({content:v.tooltip||""},{children:e.jsx("span",o({className:"st-header-label-text ".concat("right"===v.align?"right-aligned":"center"===v.align?"center-aligned":"left-aligned")},{children:Se?e.jsx(he,{checked:!!N&&N(),onChange:function(e){G&&G(e)}}):b?e.jsx(D,{defaultValue:R,onBlur:function(){return C(!1)},onChange:Pe}):v.headerRenderer?v.headerRenderer({accessor:v.accessor,colIndex:a,header:v}):R||(null==v?void 0:v.label)}))}))})),"right"!==v.align&&Ke,"right"!==v.align&&Je,"right"!==v.align&&Xe,!p&&Ge,V&&!Se&&e.jsx("div",o({className:"st-header-dropdown-container"},{children:V({accessor:v.accessor,colIndex:a,header:v,isOpen:Ce,onClose:qe,position:Ne})}))]}))},Je=function(t){var r=t.columnIndices,i=t.gridTemplateColumns,a=t.handleScroll,s=t.headers,l=t.maxDepth,c=t.pinned,u=t.sectionRef,d=t.sort,f=t.width,h=j().collapsedHeaders,p=n.useMemo(function(){var e=[],n=1,t=function(o,i,a){var u,d;if(void 0===a&&(a=!1),!v({header:o,pinned:c,headers:s,collapsedHeaders:h}))return 0;a||n++;var f=null!==(d=null===(u=o.children)||void 0===u?void 0:u.filter(function(e){return v({header:e,pinned:c,headers:s,collapsedHeaders:h})}).length)&&void 0!==d?d:0,p=n,g=f>0?p+f:p+1,m=i,w=f>0?i+1:l+1;if(e.push({header:o,gridColumnStart:p,gridColumnEnd:g,gridRowStart:m,gridRowEnd:w,colIndex:r[o.accessor]}),o.children&&o.children.length>0){var x=!0;o.children.forEach(function(e){v({header:e,pinned:c,headers:s,collapsedHeaders:h})&&(t(e,i+1,x),x=!1)})}return g-p},o=s.filter(function(e){return v({header:e,pinned:c,headers:s,collapsedHeaders:h})}),i=!0;return o.forEach(function(e){t(e,1,i),i=!1}),e},[s,l,c,r,h]),g=c?"pinned-".concat(c):"default";return e.jsx(be,o({childRef:u,group:g},{children:e.jsx("div",o({className:"st-header-".concat(c?"pinned-".concat(c):"main")},a&&{onScroll:a},{ref:u,style:{gridTemplateColumns:i,width:f,position:"relative"}},{children:e.jsx(e.Fragment,{children:p.map(function(n){return e.jsx(Ke,{colIndex:n.colIndex,gridColumnEnd:n.gridColumnEnd,gridColumnStart:n.gridColumnStart,gridRowEnd:n.gridRowEnd,gridRowStart:n.gridRowStart,header:n.header,reverse:"right"===c,sort:d},n.header.accessor)})})}))}))},Xe=function(e){var n;return(null===(n=e.children)||void 0===n?void 0:n.length)?1+Math.max.apply(Math,e.children.map(Xe)):1},_e=function(t){var r=t.centerHeaderRef,i=t.headers,a=t.mainTemplateColumns,l=t.pinnedLeftColumns,c=t.pinnedLeftTemplateColumns,u=t.pinnedRightColumns,d=t.pinnedRightTemplateColumns,f=t.sort,h=t.pinnedLeftWidth,p=t.pinnedRightWidth,g=j(),m=g.headerContainerRef,w=g.pinnedLeftRef,x=g.pinnedRightRef,y=g.collapsedHeaders,b=n.useMemo(function(){return Se({headers:i,pinnedLeftColumns:l,pinnedRightColumns:u,collapsedHeaders:y})},[i,l,u,y]),C=n.useMemo(function(){var e=0,n=s(s(s([],l,!0),i,!0),u,!0);return i.forEach(function(t){if(v({header:t,headers:n,collapsedHeaders:y})){var r=Xe(t);e=Math.max(e,r)}}),{maxDepth:e}},[i,l,u,y]).maxDepth;return e.jsxs("div",o({className:"st-header-container",ref:m},{children:[_(i,"left")&&e.jsx(Je,{columnIndices:b,gridTemplateColumns:c,handleScroll:void 0,headers:i,maxDepth:C,pinned:"left",sectionRef:w,sort:f,width:h}),e.jsx(Je,{columnIndices:b,gridTemplateColumns:a,handleScroll:void 0,headers:i,maxDepth:C,sectionRef:r,sort:f}),_(i,"right")&&e.jsx(Je,{columnIndices:b,gridTemplateColumns:d,handleScroll:void 0,headers:i,maxDepth:C,pinned:"right",sectionRef:x,sort:f,width:p})]}))},$e=function(e){var n=e.headers,t=e.collapsedHeaders,r=function(e){var n=e.headers,o=e.flattenedHeaders;return n.forEach(function(e){if(!e.hide)if(e.children&&e.children.length>0)if(t&&t.has(e.accessor)){var n=e.children.filter(function(e){return"parentCollapsed"===e.showWhen||"always"===e.showWhen});n.length>0?r({headers:n,flattenedHeaders:o}):o.push(e)}else{var i=e.children.filter(function(e){return"parentExpanded"===e.showWhen||"always"===e.showWhen||!e.showWhen});r({headers:i,flattenedHeaders:o})}else 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(" "))},Qe=function(t){var r=t.pinnedLeftWidth,i=t.pinnedRightWidth,a=t.setScrollTop,s=t.sort,l=t.tableRows,c=t.rowsToRender,u=j(),d=u.columnResizing,f=u.editColumns,h=u.headers,v=u.collapsedHeaders,p=n.useRef(null),g=h.filter(function(e){return!e.pinned}),m=h.filter(function(e){return"left"===e.pinned}),w=h.filter(function(e){return"right"===e.pinned}),x=n.useMemo(function(){return $e({headers:m,collapsedHeaders:v})},[m,v]),y=n.useMemo(function(){return $e({headers:g,collapsedHeaders:v})},[g,v]),b=n.useMemo(function(){return $e({headers:w,collapsedHeaders:v})},[w,v]),C={centerHeaderRef:p,headers:h,mainTemplateColumns:y,pinnedLeftColumns:m,pinnedLeftTemplateColumns:x,pinnedRightColumns:w,pinnedRightTemplateColumns:b,sort:s,pinnedLeftWidth:r,pinnedRightWidth:i},S={tableRows:l,mainTemplateColumns:y,pinnedLeftColumns:m,pinnedLeftTemplateColumns:x,pinnedLeftWidth:r,pinnedRightColumns:w,pinnedRightTemplateColumns:b,pinnedRightWidth:i,setScrollTop:a,rowsToRender: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(_e,o({},C)),e.jsx(Re,o({},S))]}))},Ze=function(t){var r=t.mainBodyWidth,i=t.mainBodyRef,a=t.pinnedLeftWidth,s=t.pinnedRightWidth,l=t.pinnedLeftContentWidth,c=t.pinnedRightContentWidth,u=t.tableBodyContainerRef,d=j().editColumns,f=n.useState(!1),h=f[0],v=f[1],p=n.useRef(null),g=n.useRef(null),m=n.useRef(null),w=u.current&&u.current.scrollHeight>u.current.clientHeight,x=d?28:0,y=(d?s+1:s)+(u.current&&w?u.current.offsetWidth-u.current.clientWidth:0);return n.useEffect(function(){setTimeout(function(){!function(){if(i.current){var e=i.current.clientWidth;v(r>e)}}()},1)},[i,r]),h?e.jsxs("div",o({className:"st-horizontal-scrollbar-container"},{children:[a>0&&e.jsx(be,o({childRef:g,group:"pinned-left"},{children:e.jsx("div",o({className:"st-horizontal-scrollbar-left",ref:g,style:{width:a}},{children:e.jsx("div",{style:{width:l}})}))})),r>0&&e.jsx(be,o({childRef:p},{children:e.jsx("div",o({className:"st-horizontal-scrollbar-middle",ref:p},{children:e.jsx("div",{style:{width:r}})}))})),s>0&&e.jsx(be,o({childRef:m,group:"pinned-right"},{children:e.jsx("div",o({className:"st-horizontal-scrollbar-right",ref:m,style:{width:y}},{children:e.jsx("div",{style:{width:c}})}))})),x>0&&e.jsx("div",{style:{width:x-1.5,height:"100%",flexShrink:0}})]})):null},en={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 en.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?en.string(e,n,t):"number"==typeof e&&"number"==typeof n?en.number(e,n,t):"boolean"==typeof e&&"boolean"==typeof n?en.boolean(e,n,t):en.string(String(e),String(n),t)}},nn=function(e){var n=e.rows,t=e.sortColumn,r=e.headers,o=function(e,n){for(var t=0,r=e;t<r.length;t++){var i=r[t];if(i.accessor===n)return i;if(i.children&&i.children.length>0){var a=o(i.children,n);if(a)return a}}},i=o(r,t.key.accessor),a=(null==i?void 0:i.type)||"string",l=t.direction;return s([],n,!0).sort(function(e,n){var r=t.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 en.number(i,a,r)}return"date"===t?en.date(String(e),String(n),r):"boolean"===t?en.boolean(Boolean(e),Boolean(n),r):"enum"===t?en.enum(String(e),String(n),r):en.string(String(e),String(n),r)}(e[r],n[r],a,l)})},tn=function(e){var n=e.headers,t=e.rows,r=e.sortColumn;return nn({rows:t,sortColumn:r,headers:n})},rn=function(e){var n=e.externalSortHandling,t=e.tableRows,r=e.sortColumn,o=e.rowGrouping,i=e.headers,a=e.sortNestedRows;return n?t:r?o&&o.length>0?a({groupingKeys:o,headers:i,rows:t,sortColumn:r}):tn({headers:i,rows:t,sortColumn:r}):t},on=function(e,n,t){void 0===t&&(t=new Set);for(var r=0,o=e;r<o.length;r++){var i=o[r];if(!t.has(i.accessor)&&(t.add(i.accessor),i.children&&i.children.length>0)){var a=i.children.some(function(e){return e.accessor===n}),s=!1;if(!a)for(var l=0,c=i.children;l<c.length;l++){var u=c[l];if(on([u],n,t),!1===u.hide){s=!0;break}}(a||s)&&(i.hide=!1)}}},an=function(e){return e.every(function(e){return e.hide})},sn=function(e){e.forEach(function(e){e.children&&e.children.length>0&&(sn(e.children),an(e.children)&&(e.hide=!0))})},ln=function(t){var r=t.allHeaders,i=t.depth,a=void 0===i?0:i,l=t.doesAnyHeaderHaveChildren,c=t.header,u=t.isCheckedOverride,d=n.useState(!0),f=d[0],h=d[1],v=j(),p=v.expandIcon,g=v.headers,m=v.setHeaders,w=l?"".concat(16*a,"px"):"8px",x=c.children&&c.children.length>0,y=null!=u?u:c.hide||x&&c.children&&an(c.children);return e.jsxs(e.Fragment,{children:[e.jsxs("div",o({className:"st-header-checkbox-item",style:{paddingLeft:w}},{children:[l&&e.jsx("div",o({className:"st-header-icon-container"},{children:x?e.jsx("div",o({className:"st-collapsible-header-icon st-expand-icon-container ".concat(f?"expanded":"collapsed"),onClick:function(e){e.stopPropagation(),h(!f)}},{children:p})):null})),e.jsx(he,o({checked:y,onChange:function(e){(c.hide=e,e)?sn(r):(on(r,c.accessor),x&&c.children&&c.children.length>0&&c.children.every(function(e){return!0===e.hide})&&c.children[0]&&(c.children[0].hide=!1,on(r,c.children[0].accessor)));m(s([],g,!0))}},{children:c.label}))]})),x&&f&&c.children&&e.jsx("div",o({className:"st-nested-headers"},{children:c.children.map(function(n,t){return e.jsx(ln,{allHeaders:r,depth:a+1,doesAnyHeaderHaveChildren:l,header:n,isCheckedOverride:!!y||void 0},"".concat(n.accessor,"-").concat(t))})}))]})},cn=function(t){var r=t.headers,i=t.open,a="left"===t.position?"left":"",s=n.useMemo(function(){return r.some(function(e){return e.children&&e.children.length>0})},[r]);return e.jsx("div",o({className:"st-column-editor-popout ".concat(i?"open":""," ").concat(a),onClick:function(e){return e.stopPropagation()}},{children:e.jsx("div",o({className:"st-column-editor-popout-content"},{children:r.map(function(n,t){return n.isSelectionColumn?null:e.jsx(ln,{doesAnyHeaderHaveChildren:s,header:n,allHeaders:r},"".concat(n.accessor,"-").concat(t))})}))}))},un=function(t){var r=t.columnEditorText,i=t.editColumns,a=t.editColumnsInitOpen,s=t.headers,l=t.position,c=void 0===l?"right":l,u=n.useState(a),d=u[0],f=u[1];return i?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(cn,{headers:s,open:d,position:c})]})):null},dn=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"})}))},fn=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"})}))},hn=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"})}))},vn=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]),f=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(ye.Provider,o({value:{registerPane:d,unregisterPane:f}},{children:r.default.Children.only(i)}))},pn=function(e,n){var t=n.find(function(n){return n.accessor===e.accessor}),r=(null==t?void 0:t.label)||e.accessor,o=Ee[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)},gn=function(){var n=j(),t=n.filters,r=n.handleClearFilter,i=n.headers,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:pn(n,i)})),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)})}))}))}))},mn=function(e){var n=e.externalFilterHandling,t=e.tableRows,r=e.filterState;return n?t:r&&0!==Object.keys(r).length?t.filter(function(e){return Object.values(r).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 f=o.map(Number);return u=f[0],d=f[1],s<u||s>d}return!0}}if(e instanceof Date||!isNaN(Date.parse(e))){var h=q(e),v=q(String(r||"")),p=P(h),g=P(v);switch(t){case"equals":return p.getTime()===g.getTime();case"notEquals":return p.getTime()!==g.getTime();case"before":return p<g;case"after":return p>g;case"between":if(o&&2===o.length){var m=o.map(function(e){return P(q(String(e||"")))}),w=m[0],x=m[1];return p>=w&&p<=x}return!1;case"notBetween":if(o&&2===o.length){var y=o.map(function(e){return P(q(String(e||"")))});return w=y[0],x=y[1],p<w||p>x}return!0}}if("boolean"==typeof e){var b=Boolean(r);if("equals"===t)return e===b}if(Array.isArray(e)){var C=e.map(function(e){return"object"==typeof e&&null!==e?JSON.stringify(e):String(e)}).join(", ");e=C}if("in"===t||"notIn"===t){if(o&&Array.isArray(o)){var S=String(e),R=o.includes(S);return"in"===t?R:!R}return!1}var I=String(e).toLowerCase(),j=r?String(r).toLowerCase():"";switch(t){case"equals":return I===j;case"notEquals":return I!==j;default:return!0}}(e[n.accessor],n)}catch(e){return console.warn("Filter error for accessor ".concat(n.accessor,":"),e),!0}})}):t},wn=function(e){var t=e.rows,r=e.headers,i=e.rowGrouping;return n.useMemo(function(){if(!i||0===i.length)return t;var e=function(e){return u(e).filter(function(e){return e.aggregation})}(r);if(0===e.length)return t;var n=JSON.parse(JSON.stringify(t)),a=function(n,t){return void 0===t&&(t=0),n.map(function(n){var r=i[t],s=i[t+1],l=n[r];if(l&&y(l)){var c=a(l,t+1),u=o({},n);return u[r]=c,e.forEach(function(e){var n=xn(c,e.accessor,e.aggregation,s);void 0!==n&&(u[e.accessor]=n)}),u}return n})};return a(n)},[t,r,i])},xn=function(e,n,t,r){var o=[],i=function(e){e.forEach(function(e){var t=r?e[r]:void 0;r&&t&&y(t)?i(t):void 0!==e[n]&&null!==e[n]&&o.push(e[n])})};if(i(e),0!==o.length){if("custom"===t.type&&t.customFn)return t.customFn(o);var a,s=t.parseValue?o.map(t.parseValue).filter(function(e){return!isNaN(e)}):o.map(function(e){return"number"==typeof e?e:"string"==typeof e?parseFloat(e):NaN}).filter(function(e){return!isNaN(e)});if(0===s.length)return"count"===t.type?o.length:void 0;switch(t.type){case"sum":a=s.reduce(function(e,n){return e+n},0);break;case"average":a=s.reduce(function(e,n){return e+n},0)/s.length;break;case"count":a=o.length;break;case"min":a=Math.min.apply(Math,s);break;case"max":a=Math.max.apply(Math,s);break;default:return}return t.formatResult?t.formatResult(a):a}},yn=function(e){if(null==e)return"";var n=String(e);if(n.includes(",")||n.includes('"')||n.includes("\n")||n.includes("\r")){var t=n.replace(/"/g,'""');return'"'.concat(t,'"')}return n},bn=function(e,n,t){var r=function(e,n){var t=function(e){var n=[],t=function(e){for(var r=0,o=e;r<o.length;r++){var i=o[r];i.hide||i.isSelectionColumn||(i.children&&i.children.length>0?t(i.children):n.push(i))}};return t(e),n}(n);return s([t.map(function(e){return yn(e.label)}).join(",")],e.map(function(e){var n=e.row;return t.map(function(e){var t=n[e.accessor];return yn(t)}).join(",")}),!0).join("\n")}(e,n);!function(e,n){void 0===n&&(n="table-export.csv");var t=new Blob([e],{type:"text/csv;charset=utf-8;"}),r=document.createElement("a"),o=URL.createObjectURL(t);r.setAttribute("href",o),r.setAttribute("download",n),r.style.visibility="hidden",document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(o)}(r,t)},Cn=function(e){var t=e.rows,r=e.rowIdAccessor,o=e.onRowSelectionChange,i=e.enableRowSelection,a=void 0!==i&&i,s=n.useState(new Set),l=s[0],c=s[1],u=n.useCallback(function(e){return!!a&&function(e,n){return n.has(e)}(e,l)},[l,a]),d=n.useCallback(function(){return!!a&&function(e,n,t){return 0!==e.length&&e.every(function(e){return t.has(String(e[n]))})}(t,r,l)},[t,r,l,a]),f=n.useMemo(function(){return a?function(e){return e.size}(l):0},[l,a]),h=n.useMemo(function(){return a?function(e,n,t){return e.filter(function(e){return t.has(String(e[n]))})}(t,r,l):[]},[t,r,l,a]),v=n.useCallback(function(e,n){if(a){var i=function(e,n){var t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}(e,l);if(c(i),o){var s=t.find(function(n){return String(n[r])===e});s&&o({row:s,isSelected:n,selectedRows:i})}}},[l,t,r,o,a]),p=n.useCallback(function(e){var n;a&&(e?(n=function(e,n){return new Set(e.map(function(e){return String(e[n])}))}(t,r),o&&t.forEach(function(e){return o({row:e,isSelected:!0,selectedRows:n})})):(n=new Set,o&&l.forEach(function(e){var i=t.find(function(n){return String(n[r])===e});i&&o({row:i,isSelected:!1,selectedRows:n})})),c(n))},[t,r,o,l,a]),g=n.useCallback(function(e){if(a){var n=u(e);v(e,!n)}},[u,v,a]),m=n.useCallback(function(){if(a){if(o){var e=new Set;l.forEach(function(n){var i=t.find(function(e){return String(e[r])===n});i&&o({row:i,isSelected:!1,selectedRows:e})})}c(new Set)}},[l,t,r,o,a]);return{selectedRows:l,setSelectedRows:c,isRowSelected:u,areAllRowsSelected:d,selectedRowCount:f,selectedRowsData:h,handleRowSelect:v,handleSelectAll:p,handleToggleRow:g,clearSelection:m}},Sn=function(t){var r=t.allowAnimations,c=void 0!==r&&r,u=t.cellUpdateFlash,f=void 0!==u&&u,h=t.className,v=t.columnBorders,w=void 0!==v&&v,x=t.columnEditorPosition,R=void 0===x?"right":x,j=t.columnEditorText,M=void 0===j?"Columns":j,A=t.columnReordering,F=void 0!==A&&A,W=t.columnResizing,T=void 0!==W&&W,D=t.defaultHeaders,L=t.editColumns,B=void 0!==L&&L,O=t.editColumnsInitOpen,P=void 0!==O&&O,q=t.enableHeaderEditing,z=void 0!==q&&q,Y=t.enableRowSelection,G=void 0!==Y&&Y,U=t.expandAll,V=void 0===U||U,K=t.expandIcon,X=void 0===K?e.jsx(N,{className:"st-expand-icon"}):K,_=t.externalFilterHandling,$=void 0!==_&&_,Q=t.externalSortHandling,Z=void 0!==Q&&Q,ee=t.filterIcon,ne=void 0===ee?e.jsx(hn,{className:"st-header-icon"}):ee,te=t.footerRenderer,re=t.headerCollapseIcon,oe=void 0===re?e.jsx(N,{className:"st-header-icon"}):re,ae=t.headerExpandIcon,se=void 0===ae?e.jsx(k,{className:"st-header-icon"}):ae,le=t.headerDropdown,ce=t.headerHeight,ue=t.height,de=t.hideFooter,fe=void 0!==de&&de,he=t.nextIcon,ve=void 0===he?e.jsx(N,{className:"st-next-prev-icon"}):he,pe=t.onCellEdit,ge=t.onCellClick,me=t.onColumnOrderChange,we=t.onColumnSelect,xe=t.onFilterChange,ye=t.onGridReady,be=t.onHeaderEdit,Ce=t.onLoadMore,Se=t.onNextPage,Re=t.onRowSelectionChange,Ie=t.onSortChange,je=t.prevIcon,Ee=void 0===je?e.jsx(k,{className:"st-next-prev-icon"}):je,ke=t.rowButtons,Ne=t.rowGrouping,He=t.rowHeight,Me=void 0===He?32:He,Ae=t.rowIdAccessor,Fe=t.rows,We=t.selectionColumnWidth,Te=void 0===We?42:We,De=t.rowsPerPage,Le=void 0===De?10:De,Be=t.selectableCells,Oe=void 0!==Be&&Be,Pe=t.selectableColumns,qe=void 0!==Pe&&Pe,ze=t.shouldPaginate,Ye=void 0!==ze&&ze,Ge=t.sortDownIcon,Ue=void 0===Ge?e.jsx(dn,{className:"st-header-icon"}):Ge,Ve=t.sortUpIcon,Ke=void 0===Ve?e.jsx(fn,{className:"st-header-icon"}):Ve,Je=t.tableRef,Xe=t.theme,_e=void 0===Xe?"light":Xe,$e=t.useHoverRowBackground,en=void 0===$e||$e,nn=t.useOddEvenRowBackground,on=void 0!==nn&&nn,an=t.useOddColumnBackground,sn=void 0!==an&&an;sn&&(on=!1),w&&(en=!1);var ln=n.useReducer(function(e){return e+1},0)[1],cn=n.useRef(null),pn=n.useRef(null),xn=n.useRef(null),yn=n.useRef(null),Sn=n.useRef(null),Rn=n.useRef(null),In=n.useRef(null),jn=n.useState(1),En=jn[0],kn=jn[1],Nn=n.useState(D),Hn=Nn[0],Mn=Nn[1],An=n.useState(!1),Fn=An[0],Wn=An[1],Tn=n.useState(!1),Dn=Tn[0],Ln=Tn[1],Bn=n.useState(null),On=Bn[0],Pn=Bn[1],qn=n.useState(new Set),zn=qn[0],Yn=qn[1];n.useEffect(function(){Mn(D)},[D]);var Gn=Cn({rows:Fe,rowIdAccessor:Ae,onRowSelectionChange:Re,enableRowSelection:G}),Un=Gn.selectedRows,Vn=Gn.setSelectedRows,Kn=Gn.isRowSelected,Jn=Gn.areAllRowsSelected,Xn=Gn.selectedRowCount,_n=Gn.selectedRowsData,$n=Gn.handleRowSelect,Qn=Gn.handleSelectAll,Zn=Gn.handleToggleRow,et=Gn.clearSelection,nt=n.useMemo(function(){var e,n=s([],Hn,!0);G&&!(null===(e=null==Hn?void 0:Hn[0])||void 0===e?void 0:e.isSelectionColumn)&&(n=s([{accessor:"__row_selection__",label:"",width:Te,isEditable:!1,type:"boolean",pinned:"left",isSelectionColumn:!0,isSortable:!1,filterable:!1,align:"center"}],n,!0));return n},[G,Hn,Te]),tt=n.useState(0),rt=tt[0],ot=tt[1],it=n.useState(new Set),at=it[0],st=it[1],lt=function(e){var t=e.tableBodyContainerRef,r=n.useState(0),o=r[0],i=r[1];return n.useLayoutEffect(function(){if(t.current){var e=t.current.offsetWidth-t.current.clientWidth;i(e)}},[t]),{setScrollbarWidth:i,scrollbarWidth:o,tableBodyContainerRef:t}}({tableBodyContainerRef:Rn}),ct=lt.scrollbarWidth,ut=lt.setScrollbarWidth,dt=n.useState(0),ft=dt[0],ht=dt[1];n.useLayoutEffect(function(){var e=function(){Rn.current&&ht(Rn.current.clientWidth)};e();var n=null;return Rn.current&&(n=new ResizeObserver(e)).observe(Rn.current),function(){n&&n.disconnect()}},[]);var vt=n.useMemo(function(){var e=l(window.innerWidth),n=function(e){var n=e.headers,t=e.containerWidth,r=e.maxPinnedWidthPercent,o=void 0===r?.8:r,i=e.collapsedHeaders,a=0,s=0,l=0;n.forEach(function(e){if(!e.hide){var n=g(e,i).reduce(function(e,n){return e+m(n)},0);"left"===e.pinned?a+=n:"right"===e.pinned?s+=n:l+=n}});var c=a,u=s;if(t&&t>0){var f=t*o;a>f&&(a=f),s>f&&(s=f)}return{leftWidth:d(a),rightWidth:d(s),mainWidth:l,leftContentWidth:c,rightContentWidth:u}}({headers:nt,containerWidth:ft,maxPinnedWidthPercent:e,collapsedHeaders:zn});return{mainBodyWidth:n.mainWidth,pinnedLeftWidth:n.leftWidth,pinnedRightWidth:n.rightWidth,pinnedLeftContentWidth:n.leftContentWidth,pinnedRightContentWidth:n.rightContentWidth}},[nt,ft,zn]),pt=vt.mainBodyWidth,gt=vt.pinnedLeftWidth,mt=vt.pinnedRightWidth,wt=vt.pinnedLeftContentWidth,xt=vt.pinnedRightContentWidth,yt=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("string"==typeof t)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;else o=t;return Math.max(0,o-r)},[t,r])}({height:ue,rowHeight:Me}),bt=wn({rows:Fe,headers:Hn,rowGrouping:Ne}),Ct=function(e){var t=e.rows,r=e.externalFilterHandling,i=e.onFilterChange,a=n.useState({}),s=a[0],l=a[1],c=n.useMemo(function(){return mn({externalFilterHandling:r,tableRows:t,filterState:s})},[t,s,r]),u=n.useCallback(function(e){var n,t=o(o({},s),((n={})[e.accessor]=e,n));l(t),null==i||i(t)},[s,i]),d=n.useCallback(function(e){var n=o({},s);delete n[e],l(n),null==i||i(n)},[s,i]),f=n.useCallback(function(){l({}),null==i||i({})},[i]),h=n.useCallback(function(e){var n,i=o(o({},s),((n={})[e.accessor]=e,n));return mn({externalFilterHandling:r,tableRows:t,filterState:i})},[s,t,r]);return{filteredRows:c,updateFilter:u,clearFilter:d,clearAllFilters:f,filters:s,computeFilteredRowsPreview:h}}({rows:bt,externalFilterHandling:$,onFilterChange:xe}),St=Ct.filters,Rt=Ct.filteredRows,It=Ct.updateFilter,jt=Ct.clearFilter,Et=Ct.clearAllFilters,kt=Ct.computeFilteredRowsPreview,Nt=function(e){var t=e.headers,r=e.tableRows,i=e.externalSortHandling,a=e.onSortChange,s=e.rowGrouping,l=n.useState(null),c=l[0],u=l[1],d=n.useCallback(function(e){var n=e.groupingKeys,t=e.headers,r=e.rows,i=e.sortColumn,a=tn({headers:t,rows:r,sortColumn:i});return n&&0!==n.length?a.map(function(e){var r,a=n[0],s=e[a];if(y(s)){var l=d({rows:s,sortColumn:i,headers:t,groupingKeys:n.slice(1)});return o(o({},e),((r={})[a]=l,r))}return e}):a},[]),f=n.useMemo(function(){return rn({externalSortHandling:i,tableRows:r,sortColumn:c,rowGrouping:s,headers:t,sortNestedRows:d})},[r,c,t,i,s,d]),h=n.useCallback(function(e){var n=function(t){for(var r=0,o=t;r<o.length;r++){var i=o[r];if(i.accessor===e)return i;if(i.children&&i.children.length>0){var a=n(i.children);if(a)return a}}},r=n(t);if(r){var o=null;c&&c.key.accessor===e?"ascending"===c.direction&&(o={key:r,direction:"descending"}):o={key:r,direction:"ascending"},u(o),null==a||a(o)}},[c,t,a]),v=n.useCallback(function(e){var n=function(t){for(var r=0,o=t;r<o.length;r++){var i=o[r];if(i.accessor===e)return i;if(i.children&&i.children.length>0){var a=n(i.children);if(a)return a}}},o=n(t);if(!o)return r;var a=null;return c&&c.key.accessor===e?"ascending"===c.direction&&(a={key:o,direction:"descending"}):a={key:o,direction:"ascending"},rn({externalSortHandling:i,tableRows:r,sortColumn:a,rowGrouping:s,headers:t,sortNestedRows:d})},[c,t,r,i,s,d]);return{sort:c,sortedRows:f,updateSort:h,computeSortedRowsPreview:v}}({headers:Hn,tableRows:Rt,externalSortHandling:Z,onSortChange:Ie,rowGrouping:Ne}),Ht=Nt.sort,Mt=Nt.sortedRows,At=Nt.updateSort,Ft=function(e){var t=e.allowAnimations,r=e.sortedRows,i=e.originalRows,a=e.currentPage,l=e.rowsPerPage,c=e.shouldPaginate,u=e.rowGrouping,d=e.rowIdAccessor,f=e.unexpandedRows,h=e.expandAll,v=e.contentHeight,p=e.rowHeight,g=e.scrollTop,m=e.computeFilteredRowsPreview,w=e.computeSortedRowsPreview,x=n.useState(!1),y=x[0],S=x[1],R=n.useState([]),I=R[0],j=R[1],E=n.useRef([]),k=n.useRef([]),N=n.useRef(new Map),M=n.useRef(null),A=n.useCallback(function(e){var n=c?e.slice((a-1)*l,a*l):e,t=c?(a-1)*l:0;return u&&0!==u.length?C({rows:n,rowGrouping:u,rowIdAccessor:d,unexpandedRows:f,expandAll:h,startingPosition:t}):n.map(function(e,n){return{row:e,depth:0,groupingKey:void 0,position:t+n,isLastGroupRow:!1}})},[a,l,c,u,d,f,h]);n.useMemo(function(){if(0===N.current.size){var e=A(i),n=new Map;e.forEach(function(e){var t=String(b({row:e.row,rowIdAccessor:d}));n.set(t,e.position)}),N.current=n}},[i,A,d]);var F=n.useMemo(function(){return A(r)},[r,A]),W=n.useMemo(function(){return H({bufferRowCount:5,contentHeight:v,tableRows:F,rowHeight:p,scrollTop:g})},[F,v,p,g]),T=n.useCallback(function(e,n){var t=new Set(e.map(function(e){return String(b({row:e.row,rowIdAccessor:d}))})),r=new Set(n.map(function(e){return String(b({row:e.row,rowIdAccessor:d}))}));return{staying:n.filter(function(e){var n=String(b({row:e.row,rowIdAccessor:d}));return t.has(n)}),entering:n.filter(function(e){var n=String(b({row:e.row,rowIdAccessor:d}));return!t.has(n)}),leaving:e.filter(function(e){var n=String(b({row:e.row,rowIdAccessor:d}));return!r.has(n)})}},[d]),D=n.useMemo(function(){if(0===E.current.length)return!1;var e=F.map(function(e){return String(b({row:e.row,rowIdAccessor:d}))}),n=E.current.map(function(e){return String(b({row:e.row,rowIdAccessor:d}))});return e.length!==n.length||!e.every(function(e,t){return e===n[t]})},[F,d]);n.useLayoutEffect(function(){if(!y){if(!t||c)return j([]),E.current=F,void(k.current=W);if(0===E.current.length)return j([]),E.current=F,void(k.current=W);if(!D)return j([]),E.current=F,void(k.current=W);M.current={tableRows:F,visibleRows:W},S(!0)}},[t,F,D,y,c,W]),n.useLayoutEffect(function(){if(y&&M.current&&I.length>0){var e=setTimeout(function(){var e=M.current;S(!1),j([]),E.current=e.tableRows,k.current=e.visibleRows,M.current=null},ie.duration+100);return function(){return clearTimeout(e)}}},[y,I.length]);var L=n.useMemo(function(){if(!t||c)return W;if(I.length>0){var e=new Map;return F.forEach(function(n){var t=String(b({row:n.row,rowIdAccessor:d}));e.set(t,n.position)}),I.map(function(n){var t=String(b({row:n.row,rowIdAccessor:d})),r=e.get(t);return void 0!==r?o(o({},n),{position:r}):n})}return W},[W,I,F,t,c,d]),B=n.useCallback(function(e){if(t&&!c){var n=m(e),r=A(n),o=H({bufferRowCount:5,contentHeight:v,tableRows:r,rowHeight:p,scrollTop:g}),i=T(W,o).entering.map(function(e){var n=String(b({row:e.row,rowIdAccessor:d}));return F.find(function(e){return String(b({row:e.row,rowIdAccessor:d}))===n})||e}).filter(Boolean);i.length>0&&j(s(s([],W,!0),i,!0))}},[t,c,m,A,v,p,g,T,F,W,d]),O=n.useCallback(function(e){if(t&&!c){var n=w(e),r=A(n),o=H({bufferRowCount:5,contentHeight:v,tableRows:r,rowHeight:p,scrollTop:g}),i=T(W,o).entering.map(function(e){var n=String(b({row:e.row,rowIdAccessor:d}));return F.find(function(e){return String(b({row:e.row,rowIdAccessor:d}))===n})||e}).filter(Boolean);i.length>0&&j(s(s([],W,!0),i,!0))}},[t,c,w,A,v,p,g,T,F,W,d]);return{currentTableRows:F,currentVisibleRows:W,isAnimating:y,prepareForFilterChange:B,prepareForSortChange:O,rowsToRender:L}}({allowAnimations:c,sortedRows:Mt,originalRows:bt,currentPage:En,rowsPerPage:Le,shouldPaginate:Ye,rowGrouping:Ne,rowIdAccessor:Ae,unexpandedRows:at,expandAll:V,contentHeight:yt,rowHeight:Me,scrollTop:rt,computeFilteredRowsPreview:kt,computeSortedRowsPreview:Nt.computeSortedRowsPreview}),Wt=Ft.currentTableRows,Tt=Ft.rowsToRender,Dt=Ft.prepareForFilterChange,Lt=Ft.prepareForSortChange,Bt=Ft.isAnimating,Ot=n.useRef(new Map),Pt=n.useRef(new Map),qt=function(e){var t=e.selectableCells,r=e.headers,o=e.tableRows,s=e.rowIdAccessor,l=e.onCellEdit,c=e.cellRegistry,u=e.collapsedHeaders,d=n.useState(new Set),f=d[0],h=d[1],v=n.useState(new Set),p=v[0],m=v[1],w=n.useState(null),x=w[0],y=w[1],C=n.useState(null),R=C[0],I=C[1],j=n.useState(new Set),E=j[0],k=j[1],N=n.useState(new Set),H=N[0],M=N[1],A=n.useRef(!1),F=n.useRef(null),W=n.useMemo(function(){var e=new Set;return f.forEach(function(n){var t=n.split("-");if(t.length>=2){var r=parseInt(t[1],10);isNaN(r)||e.add(r)}}),p.forEach(function(n){e.add(n)}),e},[f,p]),T=n.useMemo(function(){var e=new Set;return f.forEach(function(n){var t=n.split("-");if(t.length>=3){var r=t.slice(2).join("-");e.add(r)}}),p.size>0&&o.forEach(function(n){var t=b({row:n.row,rowIdAccessor:s});e.add(String(t))}),e},[f,p,o,s]),D=n.useMemo(function(){return r.flatMap(function(e){return g(e,u)})},[r,u]),L=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(f).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");f.size>0&&(navigator.clipboard.writeText(r),k(new Set(f)),setTimeout(function(){k(new Set)},800))},[D,f,o]),B=n.useCallback(function(){return i(void 0,void 0,void 0,function(){var e,n,t,r,i,u,d,f;return a(this,function(a){switch(a.label){case 0:if(!R)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=R.rowIndex,d=R.colIndex,n.forEach(function(e,n){e.split("\t").forEach(function(e,a){var f=u+n,h=d+a;if(!(f>=o.length||h>=t.length)){var v=o[f],p=t[h],g=b({row:v.row,rowIdAccessor:s});if(null==p?void 0:p.isEditable){var m=e;if("number"===p.type){var w=Number(e);isNaN(w)||(m=w)}else if("boolean"===p.type)m="true"===e.toLowerCase()||"1"===e;else if("date"===p.type){var x=new Date(e);isNaN(x.getTime())||(m=x)}if(v.row[p.accessor]=m,c){var y="".concat(g,"-").concat(p.accessor),C=c.get(y);C&&C.updateContent(m)}null==l||l({accessor:p.accessor,newValue:m,row:v.row,rowIndex:f});var R=S({colIndex:h,rowIndex:f,rowId:g});r.add(R)}else{var I=S({colIndex:h,rowIndex:f,rowId:g});i.add(I)}}})}),r.size>0&&(k(r),setTimeout(function(){k(new Set)},800)),i.size>0&&(M(i),setTimeout(function(){M(new Set)},800)),[3,4]):[2];case 3:return f=a.sent(),console.warn("Failed to paste from clipboard:",f),[3,4];case 4:return[2]}})})},[R,D,o,s,l,c]),O=n.useCallback(function(){if(0!==f.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(f).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],f=e[u],h=b({row:d.row,rowIdAccessor:s});if(null==f?void 0:f.isEditable){var v=null;if(v="string"===f.type?"":"number"===f.type?null:"boolean"!==f.type&&("date"===f.type?null:Array.isArray(d.row[f.accessor])?[]:""),d.row[f.accessor]=v,c){var p="".concat(h,"-").concat(f.accessor),g=c.get(p);g&&g.updateContent(v)}null==l||l({accessor:f.accessor,newValue:v,row:d.row,rowIndex:a}),t.add(n)}else r.add(n)}}),t.size>0&&(k(t),setTimeout(function(){k(new Set)},800)),r.size>0&&(M(r),setTimeout(function(){M(new Set)},800))}},[f,D,o,s,l,c]),P=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=b({row:o[c].row,rowIdAccessor:s});t.add(S({colIndex:u,rowIndex:c,rowId:d}))}m(new Set),y(null),h(t)},[o,s,m,y,h]),q=n.useCallback(function(e){if(e.rowIndex>=0&&e.rowIndex<o.length&&e.colIndex>=0&&e.colIndex<D.length){var n=S(e);m(new Set),y(null),h(new Set([n])),I(e)}},[D.length,o.length,m,y,h,I]),z=n.useCallback(function(e,n){void 0===n&&(n=!1),h(new Set),I(null),m(function(t){var r=new Set(n?t:[]);return e.forEach(function(e){return r.add(e)}),r}),e.length>0&&y(e[e.length-1])},[h,I,m,y]);n.useEffect(function(){var e=function(e){var n;if(t&&R){var r=R.rowIndex,i=R.colIndex,a=R.rowId;if(!e.ctrlKey&&!e.metaKey||"c"!==e.key){if((e.ctrlKey||e.metaKey)&&"v"===e.key)return e.preventDefault(),void B();if("Delete"===e.key||"Backspace"===e.key)return e.preventDefault(),void O();if(b({row:null===(n=o[r])||void 0===n?void 0:n.row,rowIdAccessor:s})!==a){var l=o.findIndex(function(e,n){return b({row:e.row,rowIdAccessor:s})===a});if(-1===l)return;r=l}if("ArrowUp"===e.key){if(e.preventDefault(),r>0){var c=b({row:o[r-1].row,rowIdAccessor:s});q({rowIndex:r-1,colIndex:i,rowId:c})}}else"ArrowDown"===e.key?(e.preventDefault(),r<o.length-1&&(c=b({row:o[r+1].row,rowIdAccessor:s}),q({rowIndex:r+1,colIndex:i,rowId:c}))):"ArrowLeft"===e.key||"Tab"===e.key&&e.shiftKey?(e.preventDefault(),i>0&&(c=b({row:o[r].row,rowIdAccessor:s}),q({rowIndex:r,colIndex:i-1,rowId:c}))):"ArrowRight"===e.key||"Tab"===e.key?(e.preventDefault(),i<D.length-1&&(c=b({row:o[r].row,rowIdAccessor:s}),q({rowIndex:r,colIndex:i+1,rowId:c}))):"Escape"===e.key&&(h(new Set),m(new Set),y(null),F.current=null,I(null))}else L()}};return document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}},[L,D.length,R,s,P,q,t,o,B,O]);var Y=n.useCallback(function(e){var n=e.colIndex,t=e.rowIndex,r=e.rowId,o=S({colIndex:n,rowIndex:t,rowId:r}),i=f.has(o),a=p.has(n);return i||a},[f,p]),G=n.useCallback(function(e){var n=e.colIndex,t=e.rowIndex,r=e.rowId,i=[],a=o[t-1]?b({row:o[t-1].row,rowIdAccessor:s}):null,l=o[t+1]?b({row:o[t+1].row,rowIdAccessor: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},f={colIndex:n+1,rowIndex:t,rowId:r};return(!c||!Y(c)||p.has(n)&&0===t)&&i.push("st-selected-top-border"),(!u||!Y(u)||p.has(n)&&t===o.length-1)&&i.push("st-selected-bottom-border"),Y(d)||i.push("st-selected-left-border"),Y(f)||i.push("st-selected-right-border"),i.join(" ")},[Y,o,p,s]),U=n.useMemo(function(){return R?function(e){var n=e.rowIndex,t=e.colIndex,r=e.rowId;return n===R.rowIndex&&t===R.colIndex&&r===R.rowId}:function(){return!1}},[R]),V=n.useCallback(function(e){var n=e.colIndex,t=e.rowIndex,r=e.rowId,o=S({colIndex:n,rowIndex:t,rowId:r});return E.has(o)},[E]),K=n.useCallback(function(e){var n=e.colIndex,t=e.rowIndex,r=e.rowId,o=S({colIndex:n,rowIndex:t,rowId:r});return H.has(o)},[H]);return{getBorderClass:G,handleMouseDown:function(e){var n=e.colIndex,r=e.rowIndex,o=e.rowId;t&&(A.current=!0,F.current={rowIndex:r,colIndex:n,rowId:o},setTimeout(function(){m(new Set),y(null);var e=S({colIndex:n,rowIndex:r,rowId:o});h(new Set([e])),I({rowIndex:r,colIndex:n,rowId:o})},0))},handleMouseOver:function(e){var n=e.colIndex,r=e.rowIndex;if(e.rowId,t&&A.current&&F.current){for(var i=new Set,a=Math.min(F.current.rowIndex,r),l=Math.max(F.current.rowIndex,r),c=Math.min(F.current.colIndex,n),u=Math.max(F.current.colIndex,n),d=a;d<=l;d++)for(var f=c;f<=u;f++)if(d>=0&&d<o.length){var v=b({row:o[d].row,rowIdAccessor:s});i.add(S({colIndex:f,rowIndex:d,rowId:v}))}h(i)}},handleMouseUp:function(){A.current=!1},isCopyFlashing:V,isWarningFlashing:K,isInitialFocusedCell:U,isSelected:Y,lastSelectedColumnIndex:x,pasteFromClipboard:B,selectColumns:z,selectedCells:f,selectedColumns:p,setInitialFocusedCell:I,setSelectedCells:h,setSelectedColumns:m,deleteSelectedCells:O,columnsWithSelectedCells:W,rowsWithSelectedCells:T}}({selectableCells:Oe,headers:Hn,tableRows:Wt,rowIdAccessor:Ae,onCellEdit:pe,cellRegistry:Ot.current,collapsedHeaders:zn}),zt=qt.getBorderClass,Yt=qt.handleMouseDown,Gt=qt.handleMouseOver,Ut=qt.handleMouseUp,Vt=qt.isCopyFlashing,Kt=qt.isInitialFocusedCell,Jt=qt.isSelected,Xt=qt.isWarningFlashing,_t=qt.selectColumns,$t=qt.selectedCells,Qt=qt.selectedColumns,Zt=qt.setInitialFocusedCell,er=qt.setSelectedCells,nr=qt.setSelectedColumns,tr=qt.columnsWithSelectedCells,rr=qt.rowsWithSelectedCells,or=n.useCallback(function(e){Lt(e),setTimeout(function(){At(e)},0)},[Lt,At]),ir=n.useCallback(function(e){Mn(e)},[]);!function(e){var t=e.selectableColumns,r=e.selectedCells,o=e.selectedColumns,i=e.setSelectedCells,a=e.setSelectedColumns,s=e.activeHeaderDropdown,l=e.setActiveHeaderDropdown;n.useEffect(function(){var e=function(e){var n=e.target;n.closest(".editable-cell-input")&&n.closest(".st-header-cell")||(s&&l&&(n.closest(".st-header-cell")||n.closest(".dropdown-content")||l(null)),n.closest(".st-cell")||t&&(n.classList.contains("st-header-cell")||n.classList.contains("st-header-label")||n.classList.contains("st-header-label-text"))||(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,s,l])}({selectableColumns:qe,selectedCells:$t,selectedColumns:Qt,setSelectedCells:er,setSelectedColumns:nr,activeHeaderDropdown:On,setActiveHeaderDropdown:Pn}),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:ln,tableBodyContainerRef:Rn,setScrollbarWidth:ut}),function(e){var t=e.onGridReady;n.useEffect(function(){null==t||t()},[t])}({onGridReady:ye}),function(e){var t=e.cellRegistryRef,r=e.currentTableRows,o=e.headerRegistryRef,i=e.headers,a=e.rowIdAccessor,s=e.rows,l=e.tableRef,c=e.visibleRows;n.useEffect(function(){l&&(l.current={updateData:function(e){var n=e.accessor,r=e.rowIndex,o=e.newValue,i=null==s?void 0:s[r];if(i){var l=b({row:i,rowIdAccessor:a}),c=p({rowId:l,accessor:n}),u=t.current.get(c);u&&u.updateContent(o),void 0!==i[n]&&(i[n]=o)}},setHeaderRename:function(e){var n=e.accessor,t=o.current.get(String(n));t&&t.setEditing(!0)},getVisibleRows:function(){return c},exportToCSV:function(e){var n=(void 0===e?{}:e).filename;bn(r,i,n)}})},[t,r,o,i,a,s,l,c])}({cellRegistryRef:Ot,currentTableRows:Wt,headerRegistryRef:Pt,headers:nt,rowIdAccessor:Ae,rows:Fe,tableRef:Je,visibleRows:Tt}),function(e){var t=e.filters,r=e.onFilterChange;n.useEffect(function(){null==r||r(t)},[t,r])}({filters:St,onFilterChange:xe}),function(e){var t=e.sort,r=e.onSortChange,o=J(t);n.useEffect(function(){!t||(null==o?void 0:o.key.accessor)===t.key.accessor&&(null==o?void 0:o.direction)===t.direction?!t&&o&&(null==r||r(null)):null==r||r(t)},[t,o,r])}({sort:Ht,onSortChange:Ie});var ar=n.useCallback(function(e){Dt(e),setTimeout(function(){It(e)},0)},[Dt,It]);return e.jsx(I,o({value:{allowAnimations:c,areAllRowsSelected:Jn,cellRegistry:Ot.current,cellUpdateFlash:f,clearSelection:et,collapsedHeaders:zn,columnBorders:w,columnReordering:F,columnResizing:T,draggedHeaderRef:cn,editColumns:B,enableHeaderEditing:z,enableRowSelection:G,expandIcon:X,filterIcon:ne,filters:St,forceUpdate:ln,getBorderClass:zt,handleApplyFilter:ar,handleClearAllFilters:Et,handleClearFilter:jt,handleMouseDown:Yt,handleMouseOver:Gt,handleRowSelect:$n,handleSelectAll:Qn,handleToggleRow:Zn,headerCollapseIcon:oe,headerContainerRef:In,headerDropdown:le,headerExpandIcon:se,headerRegistry:Pt.current,headers:nt,hoveredHeaderRef:pn,isAnimating:Bt,isCopyFlashing:Vt,isInitialFocusedCell:Kt,isResizing:Fn,isRowSelected:Kn,isScrolling:Dn,isSelected:Jt,isWarningFlashing:Xt,mainBodyRef:xn,nextIcon:ve,onCellEdit:pe,onCellClick:ge,onColumnOrderChange:me,onColumnSelect:we,onLoadMore:Ce,onSort:or,onTableHeaderDragEnd:ir,pinnedLeftRef:yn,pinnedRightRef:Sn,prevIcon:Ee,rowButtons:ke,rowGrouping:Ne,rowHeight:Me,headerHeight:null!=ce?ce:Me,rowIdAccessor:Ae,scrollbarWidth:ct,selectColumns:_t,selectableColumns:qe,selectedColumns:Qt,columnsWithSelectedCells:tr,rowsWithSelectedCells:rr,selectedRows:Un,selectedRowCount:Xn,selectedRowsData:_n,setCollapsedHeaders:Yn,setHeaders:Mn,setInitialFocusedCell:Zt,setIsResizing:Wn,setIsScrolling:Ln,setSelectedCells:er,setSelectedColumns:nr,setSelectedRows:Vn,setUnexpandedRows:st,shouldPaginate:Ye,sortDownIcon:Ue,sortUpIcon:Ke,tableBodyContainerRef:Rn,tableRows:Wt,theme:_e,unexpandedRows:at,useHoverRowBackground:en,useOddColumnBackground:sn,useOddEvenRowBackground:on,activeHeaderDropdown:On,setActiveHeaderDropdown:Pn,onHeaderEdit:be}},{children:e.jsx("div",o({className:"simple-table-root st-wrapper theme-".concat(_e," ").concat(null!=h?h:""," ").concat(w?"st-column-borders":""),style:ue?{height:ue}:{}},{children:e.jsx(vn,{children:e.jsxs("div",o({className:"st-wrapper-container"},{children:[e.jsx(gn,{}),e.jsxs("div",o({className:"st-content-wrapper",onMouseUp:Ut,onMouseLeave:Ut},{children:[e.jsx(Qe,{pinnedLeftWidth:gt,pinnedRightWidth:mt,setScrollTop:ot,sort:Ht,tableRows:Wt,rowsToRender:Tt}),e.jsx(un,{columnEditorText:M,editColumns:B,editColumnsInitOpen:P,headers:Hn,position:R})]})),e.jsx(Ze,{mainBodyRef:xn,mainBodyWidth:pt,pinnedLeftWidth:gt,pinnedRightWidth:mt,pinnedLeftContentWidth:wt,pinnedRightContentWidth:xt,tableBodyContainerRef:Rn}),e.jsx(E,{currentPage:En,footerRenderer:te,hideFooter:fe,onPageChange:kn,onNextPage:Se,rowsPerPage:Le,shouldPaginate:Ye,totalPages:Math.ceil(Mt.length/Le),totalRows:Mt.length})]}))})}))}))};exports.SimpleTable=function(t){var r=n.useState(!1),i=r[0],a=r[1];return n.useEffect(function(){a(!0)},[]),i?e.jsx(Sn,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 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){return e<480?.3:e<768?.4:.8},c=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},u=function(e){return e.flatMap(function(e){var n=[e];return e.children&&e.children.length>0&&n.push.apply(n,u(e.children)),n})},d=function(e){return void 0===e&&(e=0),e?e+1:0},f=function(e,n,t){var r=function(e,n){for(var t=0,r=u(e);t<r.length;t++){var o=r[t];if(o.children&&o.children.length>0&&o.children.some(function(e){return e.accessor===n}))return o}return null}(n,e.accessor);return!!r&&(t.has(r.accessor)?"parentExpanded"===e.showWhen:"parentCollapsed"===e.showWhen)},h=function(e){var n=e.accessor,t=e.rowId;return"".concat(t,"-").concat(n)},v=function(e){var n=e.header,t=e.pinned,r=e.headers,o=e.collapsedHeaders;return n.hide||(t||n.pinned)&&n.pinned!==t?null:!(r&&o&&f(n,r,o))||null},p=function(e){var n=e.rowId,t=e.accessor;return"".concat(n,"-").concat(t)},g=function(e,n){return e.hide?[]:e.children&&0!==e.children.length?n&&n.has(e.accessor)?e.children.filter(function(e){return"parentCollapsed"===e.showWhen||"always"===e.showWhen}).flatMap(function(e){return g(e,n)}):e.children.filter(function(e){return"parentExpanded"===e.showWhen||"always"===e.showWhen||!e.showWhen}).flatMap(function(e){return g(e,n)}):[e]},m=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(h({accessor:e.accessor,rowId:"header"}));return(null==n?void 0:n.offsetWidth)||150},w=function(e){var n,t=e.width;"string"==typeof t&&t.includes("fr")&&(e.width=(null===(n=document.getElementById(h({accessor:e.accessor,rowId:"header"})))||void 0===n?void 0:n.offsetWidth)||150),e.children&&e.children.length>0&&e.children.forEach(function(e){w(e)})},x=function(e){return"number"==typeof e.minWidth?e.minWidth:40},y=function(e){return Array.isArray(e)&&e.length>0&&"object"==typeof e[0]&&null!==e[0]},b=function(e){return e.row[e.rowIdAccessor]},C=function(e){var n=e.depth,t=void 0===n?0:n,r=e.expandAll,o=void 0!==r&&r,i=e.unexpandedRows,a=e.rowGrouping,s=void 0===a?[]:a,l=e.rowIdAccessor,c=e.rows,u=e.displayPositionOffset,d=void 0===u?0:u,f=[],h=function(e,n,t,r){void 0===t&&(t=0),void 0===r&&(r=d);var a=t,c=r;return e.forEach(function(t,r){var u=b({row:t,rowIdAccessor:l}),d=s[n],v=0===n&&r===e.length-1;f.push({row:t,depth:n,displayPosition:c,groupingKey:d,position:a,isLastGroupRow:v}),a++,c++;var p=String(u);if((o?!i.has(p):i.has(p))&&n<s.length){var g=function(e,n){var t=e[n];return y(t)?t:[]}(t,d);g.length>0&&(a=h(g,n+1,a,c))}}),a};return h(c,t,0,d),f},S=function(e){var n=e.rowIndex,t=e.colIndex,r=e.rowId;return"".concat(n,"-").concat(t,"-").concat(r)},R=n.createContext(void 0),I=function(n){var t=n.children,r=n.value;return e.jsx(R.Provider,o({value:r},{children:t}))},j=function(){var e=n.useContext(R);if(void 0===e)throw new Error("useTableContext must be used within a TableProvider");return e},E=function(t){var r=t.currentPage,s=t.footerRenderer,l=t.hideFooter,c=t.onPageChange,u=t.onNextPage,d=t.rowsPerPage,f=t.shouldPaginate,h=t.totalPages,v=t.totalRows,p=j(),g=p.nextIcon,m=p.prevIcon,w=n.useState(!0),x=w[0],y=w[1],b=r>1,C=r<h,S=r===h,R=Math.min((r-1)*d+1,v),I=Math.min(r*d,v),E=!b,k=!C&&!u||!x&&S,N=function(){var e=r-1;e>=1&&c(e)},H=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===h,n=r+1,u&&e?[4,u(r)]:[3,2];case 1:if(!t.sent())return y(!1),[2];t.label=2;case 2:return(n<=h||u)&&c(n),[2]}})})};if(l||!f)return null;if(s)return e.jsx(e.Fragment,{children:s({currentPage:r,totalPages:h,rowsPerPage:d,totalRows:v,startRow:R,endRow:I,onPageChange:c,onNextPage:H,onPrevPage:N,hasNextPage:!k,hasPrevPage:!E,nextIcon:g,prevIcon:m})});var M=function(){if(h<=15)return Array.from({length:h},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>=h-Math.floor(7.5))e=Math.max(1,h-o+1),n=h;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<h-1&&(t.push(-1),t.push(h)),t}();return e.jsxs("div",o({className:"st-footer"},{children:[e.jsx("div",o({className:"st-footer-info"},{children:e.jsxs("span",o({className:"st-footer-results-text"},{children:["Showing ",R," to ",I," of ",v.toLocaleString()," results"]}))})),e.jsxs("div",o({className:"st-footer-pagination"},{children:[M.map(function(n,t){return n<0?e.jsx("span",o({className:"st-page-ellipsis"},{children:"..."}),t):e.jsx("button",o({onClick:function(){return function(e){e>=1&&e<=h&&c(e)}(n)},className:"st-page-btn ".concat(r===n?"active":"")},{children:n}),t)}),e.jsx("button",o({className:"st-next-prev-btn ".concat(E?"disabled":""),onClick:N,disabled:E},{children:m})),e.jsx("button",o({className:"st-next-prev-btn ".concat(k?"disabled":""),onClick:H,disabled:k},{children:g}))]}))]}))},k=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"})}))},N=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"})}))},H=function(e){var n=e.bufferRowCount,t=e.contentHeight,r=e.rowHeight,o=e.scrollTop,i=e.tableRows,a=r+1,s=Math.max(0,o-a*n),l=o+t+a*n,c=Math.max(0,Math.floor(s/a)),u=Math.min(i.length,Math.ceil(l/a));return i.slice(c,u)},M=function(e){return e.position*(e.rowHeight+1)-1},A=function(e){return e.position*(e.rowHeight+1)},F=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,f=t.positioning,h=void 0===f?"fixed":f,v=j().mainBodyRef,p=n.useRef(null),g=n.useRef(null),m=n.useState("bottom-left"),w=m[0],x=m[1],y=n.useState({}),b=y[0],C=y[1],S=n.useState(!1),R=S[0],I=S[1];return n.useEffect(function(){a&&p.current?(I(!1),!g.current&&p.current.parentElement&&(g.current=p.current.parentElement),requestAnimationFrame(function(){if(p.current&&g.current){var e,n=p.current,t=g.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"===h?("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)),C(l),I(!0)}})):a||I(!1)},[a,u,d,v,h]),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){if(p.current&&!p.current.contains(e.target)){var n=p.current.parentElement;n&&!n.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:h,width:u?"".concat(u,"px"):"auto",visibility:R?"visible":"hidden"},b),{overflow:l})},{children:r})):null},W=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}))},T=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],f=function(e){d(e),i(e),s(!1),r()};return e.jsxs(F,o({open:a,onClose:function(){r()},setOpen:s,width:120},{children:[e.jsx(W,o({isSelected:!0===u,onClick:function(){return f(!0)}},{children:"True"})),e.jsx(W,o({isSelected:!1===u,onClick:function(){return f(!1)}},{children:"False"}))]}))},D=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()}})},L=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()}})},B=function(t){var r,i,a=t.onChange,s=t.onClose,l=t.value,c=j(),u=c.nextIcon,d=c.prevIcon,f=n.useState(l||new Date),h=f[0],v=f[1],p=n.useState("days"),g=p[0],m=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"===g&&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 m("months")}},{children:[(i=h,i.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"===g&&e.jsx("div",o({className:"st-datepicker-header-label",onClick:function(){return m("years")}},{children:h.getFullYear()})),"years"===g&&e.jsx("div",o({className:"st-datepicker-header-label"},{children:"Select Year"}))]})),e.jsxs("div",o({className:"st-datepicker-grid st-datepicker-".concat(g,"-grid")},{children:["days"===g&&function(){var n=[],t=h.getFullYear(),r=h.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(h.getFullYear(),h.getMonth()-1,e,12,0,0);v(n),a(n),null==s||s()}(r)}},{children:r}),"prev-".concat(r)))},f=0;f<c;f++)d(f);for(var p=function(i){var c=i===(new Date).getDate()&&r===(new Date).getMonth()&&t===(new Date).getFullYear(),u=new Date(l),d=i===u.getDate()&&r===u.getMonth()&&t===u.getFullYear();n.push(e.jsx("div",o({className:"st-datepicker-day ".concat(c?"today":""," ").concat(d?"selected":""),onClick:function(){return function(e){var n=h.getFullYear(),t=h.getMonth(),r=new Date(n,t,e,12,0,0);v(r),a(r),null==s||s()}(i)}},{children:i}),"day-".concat(i)))},g=1;g<=i;g++)p(g);var m=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(h.getFullYear(),h.getMonth()+1,e,12,0,0);v(n),a(n),null==s||s()}(t)}},{children:t}),"next-".concat(t)))};for(g=1;g<=m;g++)x(g);return n}(),"months"===g&&(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===h.getMonth();r.push(e.jsx("div",o({className:"st-datepicker-month ".concat(i?"selected":""),onClick:function(){return function(e){v(new Date(h.getFullYear(),e,1)),m("days")}(t)}},{children:n}),"month-".concat(t)))}),r),"years"===g&&function(){for(var n=[],t=h.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,h.getMonth(),1)),m("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,n=new Date(e.getFullYear(),e.getMonth(),e.getDate(),12,0,0);v(n),a(n),null==s||s()}},{children:"Today"}))}))]}))},O=function(e){if(!e)return new Date;if(/^\d{4}-\d{2}-\d{2}$/.test(e)){var n=e.split("-").map(Number),t=n[0],r=n[1],o=n[2];return new Date(t,r-1,o,12,0,0)}var i=new Date(e);return isNaN(i.getTime())?new Date:new Date(i.getFullYear(),i.getMonth(),i.getDate(),12,0,0)},P=function(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate(),12,0,0)},q=function(e){if(!e)return new Date;if("string"==typeof e)return O(e);if("number"==typeof e){var n=new Date(e);return isNaN(n.getTime())?new Date:P(n)}return e instanceof Date?P(e):new Date},z=function(e){return e?O(e.toString()):new Date},Y=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(F,o({open:a,onClose:c,setOpen:s,width:280},{children:e.jsx(B,{value:z(l),onChange:function(e){var n=e.toISOString().split("T")[0];i(n),s(!1),r()},onClose:c})}))},G=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],f=u[1];return e.jsx(F,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(W,o({isSelected:d===n.value,onClick:function(){return e=n.value,f(e),i(e),l(!1),void r();var e}},{children:n.label}),n.value)})}))}))},U=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(T,{onBlur:c,onChange:function(e){return o(e)},open:!0,setOpen:i,value:l});if("date"===s)return e.jsx(Y,{onBlur:c,onChange:o,open:!0,setOpen:i,value:l});if("enum"===s){var u="string"==typeof l?l:"";return e.jsx(G,{onBlur:c,onChange:o,open:!0,options:r,setOpen:i,value:u})}if("number"===s&&"number"==typeof l)return e.jsx(L,{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(D,{defaultValue:d,onBlur:c,onChange:o})},V=0,K=function(){return function(e){var n=e.callback,t=e.callbackProps,r=e.limit,o=Date.now();(0===V||o-V>=r)&&(V=o,n(t))}},J=function(e){var t=n.useRef(e);return n.useEffect(function(){JSON.stringify(t.current)!==JSON.stringify(e)&&(t.current=e)},[e]),t.current},X=function(e){if(null===e||"object"!=typeof e)return e;if(Array.isArray(e))return e.map(X);var n={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=X(e[t]));return n},_=function(e,n){return e.filter(function(e){return e.pinned===n}).some(function(e){return!e.hide})},$=Date.now(),Q={screenX:0,screenY:0},Z=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=Z(o.children,n,s(s([],t,!0),[r],!1));if(i)return i}}return null},ee=function(e){return"left"===e.pinned?"left":"right"===e.pinned?"right":"main"};function ne(e,n,t){var r,i,a=X(e),s=!1;try{var l=ee(t),c=a.findIndex(function(e){return e.accessor===n.accessor}),u=a.findIndex(function(e){return e.accessor===t.accessor});if(-1===c||-1===u)return{newHeaders:a,emergencyBreak:s=!0};var d=a.splice(c,1)[0],f=(r=l,i=o({},d),"left"===r?i.pinned="left":"right"===r?i.pinned="right":delete i.pinned,i),h=u;a.splice(h,0,f)}catch(e){console.error("Error in insertHeaderAcrossSections:",e),s=!0}return{newHeaders:a,emergencyBreak:s}}var te=function(e){var n=e.draggedHeaderRef,t=e.headers,r=e.hoveredHeaderRef,o=e.onColumnOrderChange,i=e.onTableHeaderDragEnd,a=j().setHeaders,l=J(t);return{handleDragStart:function(e){n.current=e,$=Date.now()},handleDragOver:function(e){var o=e.event,a=e.hoveredHeader;if(o.preventDefault(),t&&n.current){var s=o.currentTarget.getAnimations().some(function(e){return"running"===e.playState}),c=o.screenX,u=o.screenY,d=Math.sqrt(Math.pow(c-Q.screenX,2)+Math.pow(u-Q.screenY,2));r.current=a;var f,h=n.current,v=!1;if(ee(h)!==ee(a)){f=(C=ne(t,h,a)).newHeaders,v=C.emergencyBreak}else{var p=t,g=Z(p,h.accessor),m=Z(p,a.accessor);if(!g||!m)return;var w=g.length,x=m.length,y=m;if(w!==x){var b=x-w;b>0&&(y=m.slice(0,-b))}var C=function(e,n,t){var r=X(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}}(p,g,y);f=C.newHeaders,v=C.emergencyBreak}if(!(s||a.accessor===h.accessor||d<10||JSON.stringify(f)===JSON.stringify(t)||v)){var S=Date.now();JSON.stringify(f)===JSON.stringify(l)&&(S-$<1500||d<40)||($=S,Q={screenX:c,screenY:u},i(f))}}},handleDragEnd:function(){n.current=null,r.current=null,setTimeout(function(){a(function(e){return s([],e,!0)}),null==o||o(t)},10)}}},re=function(){return"undefined"!=typeof window&&window.matchMedia("(prefers-reduced-motion: reduce)").matches},oe={duration:180,easing:"cubic-bezier(0.2, 0.0, 0.2, 1)",delay:0},ie={duration:200,easing:"cubic-bezier(0.2, 0.0, 0.2, 1)",delay:0},ae={duration:150,easing:"ease-out",delay:0},se=function(e){e.style.transition="",e.style.transitionDelay="",e.style.transform="",e.style.top="",e.style.willChange="",e.style.backfaceVisibility="",e.classList.remove("st-animating")},le=function(e,n,t,r){return void 0===t&&(t={}),new Promise(function(r){e.offsetHeight,e.style.transition="transform ".concat(n.duration,"ms ").concat(n.easing),n.delay&&(e.style.transitionDelay="".concat(n.delay,"ms")),e.style.transform="translate3d(0, 0, 0)";var o=function(){se(e),e.removeEventListener("transitionend",o),t.onComplete&&t.onComplete(),r()};e.addEventListener("transitionend",o),setTimeout(o,n.duration+(n.delay||0)+50)})},ce=function(e){var n=e.element,t=e.finalConfig,r=e.fromBounds,s=e.toBounds;return i(void 0,void 0,void 0,function(){var e,i,l;return a(this,function(a){switch(a.label){case 0:return e=function(e,n){var t="x"in e?e.x:e.left,r="y"in e?e.y:e.top;return{x:t-n.x,y:r-n.y}}(r,s),0===e.x&&0===e.y?[2]:re()&&!1!==t.respectReducedMotion?[2]:(i=Math.abs(e.x)>Math.abs(e.y),l=function(e,n){return void 0===e&&(e={}),re()?o(o({},ae),e):o(o({},"column"===n?oe:ie),e)}(t,i?"column":"row"),se(n),function(e,n){e.style.transform="translate3d(".concat(n.x,"px, ").concat(n.y,"px, 0)"),e.style.transition="none",e.style.willChange="transform",e.style.backfaceVisibility="hidden",e.classList.add("st-animating")}(n,e),[4,le(n,l,t)]);case 1:return a.sent(),[2]}})})},ue=function(e){var n=e.element,t=e.options;return i(void 0,void 0,void 0,function(){var e,r,o,i,s,l,c,u,d,f,h,v,p,g,m,w;return a(this,function(a){return e=t.startY,r=t.endY,o=t.finalY,i=t.duration,s=void 0===i?300:i,l=t.easing,c=void 0===l?"cubic-bezier(0.2, 0.0, 0.2, 1)":l,u=t.delay,d=void 0===u?0:u,f=t.onComplete,h=t.respectReducedMotion,v=void 0===h||h,re()&&v?(void 0!==o&&(n.style.transform="",n.style.top="".concat(o,"px")),f&&f(),[2]):(p=n.getBoundingClientRect(),g=p.top,m=e-g,w=r-g,[2,new Promise(function(e){n.style.transition="",n.style.transitionDelay="",n.style.transform="",n.style.willChange="",n.style.backfaceVisibility="",n.classList.remove("st-animating"),n.style.transform="translate3d(0, ".concat(m,"px, 0)"),n.style.transition="none",n.style.willChange="transform",n.style.backfaceVisibility="hidden",n.classList.add("st-animating"),n.offsetHeight,n.style.transition="transform ".concat(s,"ms ").concat(c),d&&(n.style.transitionDelay="".concat(d,"ms")),n.style.transform="translate3d(0, ".concat(w,"px, 0)");var t=function(){n.style.transition="",n.style.transitionDelay="",n.style.transform="",n.style.willChange="",n.style.backfaceVisibility="",n.classList.remove("st-animating"),void 0!==o&&(n.style.top="".concat(o,"px")),n.removeEventListener("transitionend",t),f&&f(),e()};n.addEventListener("transitionend",t),setTimeout(t,s+(d||0)+50)})])})})},de=function(t){var r=t.children,i=t.id,a=t.parentRef,s=t.tableRow,l=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(t[r[o]]=e[r[o]])}return t}(t,["children","id","parentRef","tableRow"]),c=j(),u=c.allowAnimations,d=c.isResizing,f=c.isScrolling,h=c.rowHeight,v=n.useRef(null),p=n.useRef(null),g=J(f),m=J(d);return n.useLayoutEffect(function(){var e,n,t,r;if(u&&v.current&&!d){var i=v.current.getBoundingClientRect(),l=p.current;if(!f)if(!g||f)if(!m||d){if(p.current=i,l){var c=i.x-l.x,w=i.y-l.y;if(!(Math.abs(c)<50&&Math.abs(w)<=5)){if(Math.abs(c)>5||Math.abs(w)>5){var x=o(o({},ie),{onComplete:function(){v.current&&(v.current.style.zIndex="",v.current.style.position="",v.current.style.top="")}}),y=null===(e=null==a?void 0:a.current)||void 0===e?void 0:e.scrollTop,b=null===(n=null==a?void 0:a.current)||void 0===n?void 0:n.clientHeight,C=null===(t=null==a?void 0:a.current)||void 0===t?void 0:t.scrollHeight;if(void 0!==y&&void 0!==b&&void 0!==C){var S=5*h,R=y-S,I=y+b+S,j=l.y>R&&l.y<I,E=i.y>R&&i.y<I,k=i.y<y,N=i.y>y+b,H=null!==(r=null==s?void 0:s.position)&&void 0!==r?r:0,M=.6*h,A=function(e,n,t){var r=Math.min(Math.abs(e-n),Math.abs(e-t));return Math.min(900,Math.max(100,100+80*Math.log10(Math.max(1,r))))};if(j&&!E&&N){var F=y+b+A(i.y,y,y+b)+H%15*M*2.5+H%7*(.4*h);return void ue({element:v.current,options:{startY:l.y,endY:F,finalY:i.y,duration:x.duration,easing:x.easing,onComplete:x.onComplete}})}if(j&&!E&&k){F=y-A(i.y,y,y+b)-H%15*M*2.5-H%7*(.4*h);return void ue({element:v.current,options:{startY:l.y,endY:F,finalY:i.y,duration:x.duration,easing:x.easing,onComplete:x.onComplete}})}if(!j&&E&&l.y>y+b){var W=y+b+A(l.y,y,y+b)+H%10*M*1;return void ue({element:v.current,options:{startY:W,endY:i.y,duration:x.duration,easing:x.easing,onComplete:x.onComplete}})}if(!j&&E&&l.y<y){W=y-A(l.y,y,y+b)-H%10*M*1;return void ue({element:v.current,options:{startY:W,endY:i.y,duration:x.duration,easing:x.easing,onComplete:x.onComplete}})}}ce({element:v.current,fromBounds:l,toBounds:i,finalConfig:x})}}}}else p.current=i;else p.current=i}},[u,d,f,a,g,m,h,null==s?void 0:s.position,s]),e.jsx("div",o({ref:v,"data-animate-id":i,id:String(i)},l,{children:r}))};de.displayName="Animate";var fe=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"})}))},he=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(fe,{className:"st-checkbox-checkmark"})})),i]}))},ve=function(e){var n=e.content,t=e.header;return"boolean"==typeof n?n?"True":"False":Array.isArray(n)?0===n.length?"[]":n.map(function(e){return"object"==typeof e&&null!==e?JSON.stringify(e):String(e)}).join(", "):"date"===t.type&&null!==n&&("string"==typeof n||"number"==typeof n||"object"==typeof n&&n instanceof Date)?q(n).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):n},pe=function(t){var r=t.borderClass,i=t.colIndex,a=t.displayRowNumber,s=t.header,l=t.isHighlighted,c=t.isInitialFocused,u=t.nestedIndex,d=t.rowIndex,f=t.tableRow,v=j(),g=v.cellRegistry,m=v.cellUpdateFlash,w=v.columnBorders,x=v.draggedHeaderRef,C=v.enableRowSelection,S=v.expandIcon,R=v.handleMouseDown,I=v.handleMouseOver,E=v.handleRowSelect,k=v.headers,N=v.hoveredHeaderRef,H=v.isCopyFlashing,M=v.isRowSelected,A=v.isWarningFlashing,F=v.onCellEdit,W=v.onCellClick,T=v.onTableHeaderDragEnd,D=v.rowButtons,L=v.rowGrouping,B=v.rowIdAccessor,O=v.rowsWithSelectedCells,P=v.selectedColumns,q=v.setUnexpandedRows,z=v.tableBodyContainerRef,Y=v.theme,G=v.unexpandedRows,V=v.useOddColumnBackground,J=f.depth,X=f.row,_=n.useState(X[s.accessor]),$=_[0],Q=_[1],Z=n.useState(!1),ee=Z[0],ne=Z[1],re=n.useState(!1),oe=re[0],ie=re[1],ae=n.useState(!1),se=ae[0],le=ae[1],ce=n.useRef(null),ue=b({row:X,rowIdAccessor:B}),fe=L&&L[J],pe=!!fe&&function(e,n){if(!n)return!1;var t=e[n];return y(t)}(X,fe),ge=!G.has(String(ue)),me=H({rowIndex:d,colIndex:i,rowId:ue}),we=A({rowIndex:d,colIndex:i,rowId:ue}),xe=n.useMemo(function(){var e,n,t;if(!w)return!1;var r=k.filter(function(e){return"left"===e.pinned}),o=k.filter(function(e){return!e.pinned}),i=k.filter(function(e){return"right"===e.pinned});return"left"===s.pinned?(null===(e=r[r.length-1])||void 0===e?void 0:e.accessor)===s.accessor:"right"===s.pinned?(null===(n=i[i.length-1])||void 0===n?void 0:n.accessor)===s.accessor:(null===(t=o[o.length-1])||void 0===t?void 0:t.accessor)===s.accessor},[w,k,s.accessor,s.pinned]),ye=te({draggedHeaderRef:x,headers:k,hoveredHeaderRef:N,onTableHeaderDragEnd:T}).handleDragOver,be=K(),Ce=h({accessor:s.accessor,rowId:ue}),Se=p({rowId:ue,accessor:s.accessor}),Re=s.isSelectionColumn&&C;n.useEffect(function(){if(g){var e="".concat(ue,"-").concat(s.accessor);return g.set(e,{updateContent:function(e){$!==e?(Q(e),m&&(ie(!0),ce.current&&clearTimeout(ce.current),ce.current=setTimeout(function(){ie(!1)},800))):Q(e)}}),function(){g.delete(e),ce.current&&clearTimeout(ce.current)}}},[g,m,ue,s.accessor,$]),n.useEffect(function(){if(oe){var e=setTimeout(function(){ie(!1)},850);return function(){return clearTimeout(e)}}},[oe]),n.useEffect(function(){Q(X[s.accessor])},[X,s.accessor]);var Ie="boolean"===s.type||"date"===s.type||"enum"===s.type,je=Boolean(null==s?void 0:s.isEditable),Ee=P.has(i),ke=l&&!Ee,Ne=n.useMemo(function(){return!!Re&&O.has(String(ue))},[Re,O,ue]),He="st-cell ".concat(J>0&&s.expandable?"st-cell-depth-".concat(J):""," ").concat(ke?c?"st-cell-selected-first ".concat(r):"st-cell-selected ".concat(r):""," ").concat(Ee?c?"st-cell-column-selected-first":"st-cell-column-selected":""," ").concat(je?"clickable":""," ").concat(oe?c?"st-cell-updating-first":"st-cell-updating":""," ").concat(me?c?"st-cell-copy-flash-first":"st-cell-copy-flash":""," ").concat(we?c?"st-cell-warning-flash-first":"st-cell-warning-flash":""," ").concat(V?u%2==0?"even-column":"odd-column":""," ").concat(Re?"st-selection-cell":""," ").concat(Ne?"st-selection-has-highlighted-cell":""," ").concat(xe?"st-last-column":""),Me=n.useCallback(function(e){null==e&&(e="number"===s.type?0:"boolean"!==s.type&&""),Q(e),X[s.accessor]=e,null==F||F({accessor:s.accessor,newValue:e,row:X,rowIndex:d})},[s.accessor,s.type,F,X,d]),Ae=n.useCallback(function(){q(function(e){var n=new Set(e),t=String(ue);return n.has(t)?n.delete(t):n.add(t),n})},[ue,q]);return!ee||Ie||Re?e.jsxs(de,o({className:He,"data-accessor":s.accessor,"data-col-index":i,"data-row-id":ue,"data-row-index":d,id:Ce,onClick:function(){W&&!Re&&W({accessor:s.accessor,colIndex:i,row:X,rowId:ue,rowIndex:d,value:$})},onDoubleClick:function(){return s.isEditable&&!Re&&ne(!0)},onDragOver:function(e){Re||be({callback:ye,callbackProps:{event:e,hoveredHeader:s},limit:50})},onKeyDown:function(e){ee||Re||"F2"!==e.key&&"Enter"!==e.key||!s.isEditable||ee||(e.preventDefault(),ne(!0))},onMouseDown:function(){ee||Re||R({rowIndex:d,colIndex:i,rowId:ue})},onMouseEnter:function(){le(!0)},onMouseLeave:function(){le(!1)},onMouseOver:function(){ee||Re||I({rowIndex:d,colIndex:i,rowId:ue})},parentRef:z,tableRow:f},{children:[s.expandable&&pe?e.jsx("div",o({className:"st-icon-container st-expand-icon-container ".concat(ge?"expanded":"collapsed"),onClick:Ae},{children:S})):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:Re?e.jsxs("div",o({className:"st-selection-cell-content"},{children:[e.jsx("div",o({className:"st-selection-control"},{children:se||M&&M(String(ue))?e.jsx(he,{checked:!!M&&M(String(ue)),onChange:function(e){E&&E(String(ue),e)}}):e.jsx("span",o({className:"st-row-number"},{children:a+1}))})),function(){if(!D||!Re||0===D.length)return null;if(!(se||M&&M(String(ue))))return null;var n={row:X};return e.jsx("div",o({className:"st-row-buttons"},{children:D.map(function(t,r){return e.jsx("span",o({className:"st-row-button"},{children:t(n)}),r)})}))}()]})):s.cellRenderer?s.cellRenderer({accessor:s.accessor,colIndex:i,row:X,theme:Y}):ve({content:$,header:s})})})),ee&&Ie&&!Re&&e.jsx(U,{enumOptions:s.enumOptions,onChange:Me,setIsEditing:ne,type:s.type,value:$})]}),Se):e.jsx("div",o({className:"st-cell-editing",id:h({accessor:s.accessor,rowId:ue}),onMouseDown:function(e){return e.stopPropagation()},onKeyDown:function(e){return e.stopPropagation()}},{children:e.jsx(U,{enumOptions:s.enumOptions,onChange:Me,setIsEditing:ne,type:s.type,value:$})}))},ge=function(n){var t=n.columnIndexStart,r=n.columnIndices,o=n.headers,i=n.pinned,a=n.rowIndex,s=n.displayRowNumber,l=n.rowIndices,c=n.tableRow,u=j(),d=u.rowIdAccessor,f=u.collapsedHeaders,p=o.filter(function(e){return v({header:e,pinned:i,headers:o,collapsedHeaders:f})});return e.jsx(e.Fragment,{children:p.map(function(n,u){var f=b({row:c.row,rowIdAccessor:d}),v=h({accessor:n.accessor,rowId:f});return e.jsx(me,{columnIndices:r,displayRowNumber:s,header:n,headers:o,nestedIndex:u+(null!=t?t:0),pinned:i,rowIndex:a,rowIndices:l,tableRow:c},v)})})},me=function(t){var r=t.columnIndices,o=t.displayRowNumber,i=t.header,a=t.headers,s=t.nestedIndex,l=t.pinned,c=t.rowIndex,u=t.rowIndices,d=t.tableRow,f=r[i.accessor],p=j(),g=p.getBorderClass,m=p.isSelected,w=p.isInitialFocusedCell,x=p.rowIdAccessor,y=p.collapsedHeaders,C=b({row:d.row,rowIdAccessor:x});if(i.children&&i.children.length>0){var S=i.children.filter(function(e){return v({header:e,pinned:l,headers:a,collapsedHeaders:y})});return e.jsx(n.Fragment,{children:S.map(function(n){var t=h({accessor:n.accessor,rowId:C});return e.jsx(me,{columnIndices:r,displayRowNumber:o,header:n,headers:a,nestedIndex:s,pinned:l,rowIndex:c,rowIndices:u,tableRow:d},t)})})}var R={rowIndex:c,colIndex:f,rowId:C},I=g(R),E=m(R),k=w(R),N=h({accessor:i.accessor,rowId:C});return e.jsx(pe,{borderClass:I,colIndex:f,displayRowNumber:o,header:i,isHighlighted:E,isInitialFocused:k,nestedIndex:s,rowIndex:c,tableRow:d},N)},we=function(n){var t=n.columnIndices,r=n.columnIndexStart,i=n.gridTemplateColumns,a=n.headers,s=n.index,l=n.pinned,c=n.rowHeight,u=n.rowIndices,d=n.setHoveredIndex,f=n.tableRow,h=j(),v=h.useHoverRowBackground,p=h.rowIdAccessor,g=h.isAnimating,m=h.isRowSelected,w=h.useOddEvenRowBackground,x=f.position,y=f.displayPosition,C=x%2==0,S=b({row:f.row,rowIdAccessor:p}),R=!!m&&m(String(S));return e.jsx("div",o({className:"st-row ".concat(w?C?"even":"odd":""," ").concat(R?"selected":""),"data-index":s,onMouseEnter:function(){!g&&v&&d(s)},style:{gridTemplateColumns:i,top:A({position:x,rowHeight:c}),height:"".concat(c,"px")}},{children:e.jsx(ge,{columnIndexStart:r,columnIndices:t,displayRowNumber:y,headers:a,pinned:l,rowIndex:x,rowIndices:u,tableRow:f},S)}))},xe=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 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:s,top:M({position:i,rowHeight:a})}},{children:e.jsx("div",{style:{gridColumn:"1 / -1"}})}))},ye=n.createContext(void 0),be=function(e){var t=e.childRef,r=e.children,o=e.group,i=void 0===o?"default":o,a=function(){var e=n.useContext(ye);if(!e)throw new Error("useScrollSyncContext must be used within a ScrollSyncProvider");return e}(),s=a.registerPane,l=a.unregisterPane;return n.useEffect(function(){var e=[i];return t.current&&s(t.current,e),function(){t.current&&l(t.current,e)}},[t,s,l,i]),n.cloneElement(r,{ref:function(e){t.current=e}})},Ce=n.forwardRef(function(t,r){var i=t.columnIndexStart,a=t.columnIndices,s=t.headers,l=t.pinned,c=t.rowHeight,u=t.rowIndices,d=t.setHoveredIndex,f=t.templateColumns,h=t.totalHeight,v=t.rowsToRender,p=t.width,g=l?"st-body-pinned-".concat(l):"st-body-main",m=j().rowIdAccessor,w=n.useRef(null);if(n.useImperativeHandle(r,function(){return w.current},[]),!n.useMemo(function(){return _(s,l)},[s,l]))return null;var x=l?"pinned-".concat(l):"default";return e.jsx(be,o({childRef:w,group:x},{children:e.jsx("div",o({className:g,ref:w,style:o({position:"relative",height:"".concat(h,"px"),width:p},!l&&{flexGrow:1})},{children:v.map(function(t,r){var o=b({row:t.row,rowIdAccessor:m});return e.jsxs(n.Fragment,{children:[0!==r&&e.jsx(xe,{displayStrongBorder:t.isLastGroupRow,position:t.position,rowHeight:c,templateColumns:f,rowIndex:r-1}),e.jsx(we,{columnIndexStart:i,columnIndices:a,gridTemplateColumns:f,headers:s,index:r,pinned:l,rowHeight:c,rowIndices:u,setHoveredIndex:d,tableRow:t},o)]},o)})}))}))});function Se(e){var n=e.headers,t=e.pinnedLeftColumns,r=e.pinnedRightColumns,o=e.collapsedHeaders,i={},a=0,l=s(s(s([],t,!0),n,!0),r,!0),c=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 v({header:e,headers:l,collapsedHeaders:o})}).forEach(function(e,n){c(e,0===n)})};return t.forEach(function(e,n){c(e,0===n)}),n.filter(function(e){return!e.pinned&&v({header:e,headers:l,collapsedHeaders:o})}).forEach(function(e,n){var r=0===n&&0===t.length;c(e,r)}),r.forEach(function(e){c(e,!1)}),i}Ce.displayName="TableSection";var Re=function(t){var r=t.mainTemplateColumns,i=t.pinnedLeftColumns,a=t.pinnedLeftTemplateColumns,s=t.pinnedLeftWidth,l=t.pinnedRightColumns,c=t.pinnedRightTemplateColumns,u=t.pinnedRightWidth,d=t.rowsToRender,f=t.setScrollTop,h=t.tableRows,v=j(),p=v.collapsedHeaders,g=v.headerContainerRef,m=v.headers,w=v.isAnimating,x=v.mainBodyRef,y=v.onLoadMore,C=v.rowHeight,S=v.rowIdAccessor,R=v.scrollbarWidth,I=v.setIsScrolling,E=v.shouldPaginate,k=v.tableBodyContainerRef,N=n.useState(!1),H=N[0],M=N[1],A=n.useRef(new Set),F=n.useCallback(function(e){(A.current.forEach(function(e){return e.classList.remove("hovered")}),A.current.clear(),null!==e)&&document.querySelectorAll('.st-body-container .st-row[data-index="'.concat(e,'"]')).forEach(function(e){e.classList.add("hovered"),A.current.add(e)})},[]);n.useEffect(function(){w&&F(null)},[w,F]),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:g,mainSectionRef:k,scrollbarWidth:R}),n.useEffect(function(){return function(){T.current&&clearTimeout(T.current)}},[]);var W=n.useRef(null),T=n.useRef(null),D=n.useRef(0),L=function(e){return e.length}(h),B=L*(C+1)-1,O=n.useMemo(function(){return Se({headers:m,pinnedLeftColumns:i,pinnedRightColumns:l,collapsedHeaders:p})},[m,i,l,p]),P=n.useMemo(function(){var e={};return d.forEach(function(n,t){var r=String(b({row:n.row,rowIdAccessor:S}));e[r]=t}),e},[d,S]),q=n.useCallback(function(e,n){if(y&&!E&&!H){e.scrollHeight-(n+e.clientHeight)<=200&&n>D.current&&(M(!0),y(),setTimeout(function(){M(!1)},1e3))}},[y,E,H]),z={columnIndices:O,headerContainerRef:g,headers:m,rowHeight:C,rowIndices:P,rowsToRender:d,setHoveredIndex:F};return e.jsxs("div",o({className:"st-body-container",onMouseLeave:function(){return F(null)},onScroll:function(e){var n=e.currentTarget,t=n.scrollTop;I(!0),T.current&&clearTimeout(T.current),T.current=setTimeout(function(){I(!1)},150),W.current&&cancelAnimationFrame(W.current),W.current=requestAnimationFrame(function(){f(t),q(n,t),D.current=t})},ref:k},{children:[e.jsx(Ce,o({},z,{pinned:"left",templateColumns:a,totalHeight:B,width:s})),e.jsx(Ce,o({},z,{columnIndexStart:i.length,ref:x,templateColumns:r,totalHeight:B})),e.jsx(Ce,o({},z,{columnIndexStart:i.length+r.length,pinned:"right",templateColumns:c,totalHeight:B,width:u}))]}))},Ie=function(e){var n=e.event;e.gridColumnEnd,e.gridColumnStart;var t=e.header,r=e.headers,o=e.setHeaders,i=e.setIsResizing,a=e.startWidth,c=e.collapsedHeaders;n.preventDefault();var u="clientX"in n?n.clientX:n.touches[0].clientX,d="touches"in n;if(t&&!t.hide){i(!0);var f,h=x(t);if(t.children&&t.children.length>0){var v=g(t,c);f=v.length>0?v:[t]}else f=[t];var p=function(e){var n="right"===t.pinned?u-e:e-u,i=function(e){var n=e.header,t=e.headers,r=e.collapsedHeaders,o=document.querySelector(".st-body-container");if(!o||0===o.clientWidth)return 1e3;var i=o.clientWidth,a=i*l(window.innerWidth);if(!n.pinned)return Math.max(.6*i,600);var s=a-t.filter(function(e){return e.pinned===n.pinned&&e.accessor!==n.accessor}).reduce(function(e,n){return n.hide?e:e+g(n,r).reduce(function(e,n){return e+m(n)},0)},0),c=x(n);return s<c?(console.warn("Header ".concat(n.accessor," exceeds pinned section width limit")),c):s}({header:t,headers:r,collapsedHeaders:c});if(f.length>1)je({delta:n,leafHeaders:f,minWidth:h,startWidth:a,maxWidth:i});else{var d=Math.max(Math.min(a+n,i),h);f[0].width=d}r.forEach(function(e){w(e)});var v=s([],r,!0);o(v)};if(d){var y=function(e){var n=e.touches[0];p(n.clientX)},b=function(){document.removeEventListener("touchmove",y),document.removeEventListener("touchend",b),i(!1)};document.addEventListener("touchmove",y),document.addEventListener("touchend",b)}else{var C=function(e){p(e.clientX)},S=function(){document.removeEventListener("mousemove",C),document.removeEventListener("mouseup",S),i(!1)};document.addEventListener("mousemove",C),document.addEventListener("mouseup",S)}}},je=function(e){var n=e.delta,t=e.leafHeaders,r=e.minWidth,o=e.startWidth,i=e.maxWidth,a=t.reduce(function(e,n){return Math.min(e,x(n))},40),s=t.reduce(function(e,n){return e+("number"==typeof n.width?n.width:150)},0),l=Math.max(Math.min(o+n,i),a)-s;t.forEach(function(e){var n="number"==typeof e.width?e.width:150,t=l*(n/s),o=Math.max(n+t,r);e.width=o})},Ee={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"},ke=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"]}},Ne=function(e){return!["between","notBetween","in","notIn","isEmpty","isNotEmpty"].includes(e)},He=function(e){return["between","notBetween","in","notIn"].includes(e)},Me=function(e){return["isEmpty","isNotEmpty"].includes(e)},Ae=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"})}))},We=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,f=void 0!==d&&d,h=n.useState(!1),v=h[0],p=h[1],g=n.useState(-1),m=g[0],w=g[1],x=n.useRef(null),y=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(),m>=0&&(i(a[m].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,m,a,i]);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=a.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:y?y.label:l})),e.jsx(Fe,{})]})),e.jsx(F,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===m?"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}),t)})}))}))]}))},Te=function(n){var t=n.value,r=n.onChange,i=n.operators.map(function(e){return{value:e,label:Ee[e]}});return e.jsx("div",o({className:"st-filter-section"},{children:e.jsx(We,{value:t,onChange:function(e){r(e)},options:i})}))},De=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,d=n.onEnterPress;return e.jsx("input",{type:r,value:o,onChange:function(e){return i(e.target.value)},onKeyDown:function(e){"Enter"===e.key&&d&&d()},placeholder:a,autoFocus:l,className:"st-filter-input ".concat(u).trim()})},Le=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}))},Be=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"}))]}))},Oe=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)||"")),f=d[0],h=d[1],v=ke("string");n.useEffect(function(){i?(u(i.operator),h(String(i.value||""))):(u("contains"),h(""))},[i]);var p=function(){var e=o({accessor:r.accessor,operator:c},Ne(c)&&{value:f});a(e)},g=Me(c)||f.trim();return e.jsxs(Ae,{children:[e.jsx(Te,{value:c,onChange:u,operators:v}),Ne(c)&&e.jsx(Le,{children:e.jsx(De,{type:"text",value:f,onChange:h,placeholder:"Filter...",autoFocus:!0,onEnterPress:p})}),e.jsx(Be,{onApply:p,onClear:s,canApply:!!g,showClear:!!i})]})},Pe=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],f=n.useState(String((null==a?void 0:a.value)||"")),h=f[0],v=f[1],p=n.useState(String((null===(r=null==a?void 0:a.values)||void 0===r?void 0:r[0])||"")),g=p[0],m=p[1],w=n.useState(String((null===(o=null==a?void 0:a.values)||void 0===o?void 0:o[1])||"")),x=w[0],y=w[1],b=ke("number");n.useEffect(function(){var e,n;a?(d(a.operator),v(String(a.value||"")),m(String((null===(e=a.values)||void 0===e?void 0:e[0])||"")),y(String((null===(n=a.values)||void 0===n?void 0:n[1])||""))):(d("equals"),v(""),m(""),y(""))},[a]);var C=function(){var e={accessor:i.accessor,operator:u};Ne(u)?e.value=parseFloat(h):He(u)&&(e.values=[parseFloat(g.toString()),parseFloat(x.toString())]),s(e)};return e.jsxs(Ae,{children:[e.jsx(Te,{value:u,onChange:d,operators:b}),Ne(u)&&e.jsx(Le,{children:e.jsx(De,{type:"number",value:h,onChange:v,placeholder:"Enter number...",autoFocus:!0,onEnterPress:C})}),He(u)&&e.jsxs(Le,{children:[e.jsx(De,{type:"number",value:g,onChange:m,placeholder:"From...",autoFocus:!0,className:"st-filter-input-range-from",onEnterPress:C}),e.jsx(De,{type:"number",value:x,onChange:y,placeholder:"To...",onEnterPress:C})]}),e.jsx(Be,{onApply:C,onClear:l,canApply:!!Me(u)||(Ne(u)?""!==h.trim():!!He(u)&&""!==String(g).trim()&&""!==String(x).trim()),showClear:!!a})]})},qe=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(We,{value:t,onChange:r,options:o,className:a,placeholder:s})},ze=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],f=u[1],h=ke("boolean");n.useEffect(function(){o?(c(o.operator),f(void 0!==o.value?String(o.value):"true")):(c("equals"),f("true"))},[o]);var v=Me(l)||""!==d;return e.jsxs(Ae,{children:[e.jsx(Te,{value:l,onChange:c,operators:h}),Ne(l)&&e.jsx(Le,{children:e.jsx(qe,{value:d,onChange:f,options:[{value:"true",label:"True"},{value:"false",label:"False"}]})}),e.jsx(Be,{onApply:function(){var e={accessor:r.accessor,operator:l};Ne(l)&&(e.value="true"===d),i(e)},onClear:a,canApply:v,showClear:!!o})]})},Ye=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],f=u[1],h=n.useState((null==s?void 0:s.value)?String(s.value):""),v=h[0],p=h[1],g=n.useState((null===(r=null==s?void 0:s.values)||void 0===r?void 0:r[0])?String(s.values[0]):""),m=g[0],w=g[1],x=n.useState(String((null===(i=null==s?void 0:s.values)||void 0===i?void 0:i[1])||"")),y=x[0],b=x[1],C=ke("date");n.useEffect(function(){var e,n;s?(f(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])||""))):(f("equals"),p(""),w(""),b(""))},[s]);var S=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],f=n.useState(""),h=f[0],v=f[1],p=n.useRef(null);n.useEffect(function(){if(r){var e=q(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 g=r?q(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: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(F,o({open:u,setOpen:d,onClose:function(){d(!1)},positioning:"absolute",overflow:"visible"},{children:e.jsx(B,{value:g,onChange:function(e){var n=e.toISOString().split("T")[0];i(n),d(!1)},onClose:function(){return d(!1)}})}))]}))};return e.jsxs(Ae,{children:[e.jsx(Te,{value:d,onChange:f,operators:C}),Ne(d)&&e.jsx(Le,{children:e.jsx(S,{value:v,onChange:p,placeholder:"Select date...",autoFocus:!0})}),He(d)&&e.jsxs(Le,{children:[e.jsx(S,{value:m,onChange:w,placeholder:"From date...",autoFocus:!0,className:"st-filter-input-range-from"}),e.jsx(S,{value:y,onChange:b,placeholder:"To date..."})]}),e.jsx(Be,{onApply:function(){var e={accessor:a.accessor,operator:d};Ne(d)?e.value=v:He(d)&&(e.values=[m,y]),l(e)},onClear:c,canApply:!!Me(d)||(Ne(d)?""!==v.trim():!!He(d)&&""!==m.trim()&&""!==y.trim()),showClear:!!s})]})},Ge=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),f=d[0],h=d[1],v=n.useState(""),p=v[0],g=v[1],m=n.useMemo(function(){if(!p)return c;var e=p.toLowerCase();return c.filter(function(n){return n.label.toLowerCase().includes(e)})},[c,p]);n.useEffect(function(){h(i?i.values?i.values.map(String):[]:u)},[i,u]);var w=f.length===u.length,x=c.length>10;return e.jsxs(Ae,{children:[e.jsx(Le,{children:e.jsxs("div",o({className:"st-enum-filter-options"},{children:[e.jsx("div",o({className:"st-enum-select-all"},{children:e.jsx(he,o({checked:w,onChange:function(e){h(e?u:[])}},{children:e.jsx("span",o({className:"st-enum-option-label st-enum-select-all-label"},{children:"Select All"}))}))})),x&&e.jsx("div",o({className:"st-enum-search"},{children:e.jsx(De,{type:"text",value:p,onChange:g,placeholder:"Search..."})})),m.map(function(n,t){return e.jsx(he,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}):s(s([],n,!0),[e],!1)});var e}},{children:e.jsx("span",o({className:"st-enum-option-label"},{children:n.label}))}),t)}),p&&0===m.length&&e.jsx("div",o({className:"st-enum-no-results"},{children:"No matching options"}))]}))}),e.jsx(Be,{onApply:function(){if(f.length!==u.length){var e={accessor:r.accessor,operator:"in",values:f};a(e)}else l()},onClear:l,canApply:0!==f.length&&f.length!==u.length,showClear:!!i})]})},Ue=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(Pe,{header:t,currentFilter:r,onApplyFilter:o,onClearFilter:i});case"boolean":return e.jsx(ze,{header:t,currentFilter:r,onApplyFilter:o,onClearFilter:i});case"date":return e.jsx(Ye,{header:t,currentFilter:r,onApplyFilter:o,onClearFilter:i});case"enum":return e.jsx(Ge,{header:t,currentFilter:r,onApplyFilter:o,onClearFilter:i});default:return e.jsx(Oe,{header:t,currentFilter:r,onApplyFilter:o,onClearFilter:i})}}()})},Ve=function(t){var r=t.content,i=t.children,a=t.delay,s=void 0===a?500:a,l=n.useState(!1),c=l[0],u=l[1],d=n.useState({top:0,left:0}),f=d[0],h=d[1],v=n.useRef(null),p=n.useRef(null);if(n.useEffect(function(){return function(){v.current&&clearTimeout(v.current)}},[]),!r||!n.isValidElement(i))return e.jsx(e.Fragment,{children:i});var g=n.cloneElement(i,{ref:p,onMouseEnter:function(){v.current=setTimeout(function(){if(p.current&&r.trim()){var e=p.current.getBoundingClientRect();if(e.width>0&&e.height>0){var n=e.left+e.width/2-100,t=e.bottom+8;n<8?n=8:n+200>window.innerWidth-8&&(n=window.innerWidth-200-8),t+40>window.innerHeight-8&&(t=e.top-40-8),h({top:t,left:n}),u(!0)}}},s)},onMouseLeave:function(){v.current&&(clearTimeout(v.current),v.current=null),u(!1)}});return e.jsxs(e.Fragment,{children:[g,c&&e.jsx("div",o({className:"st-tooltip",style:{position:"fixed",top:"".concat(f.top,"px"),left:"".concat(f.left,"px"),zIndex:1e4}},{children:r}))]})},Ke=function(t){var r,i,a=t.colIndex,l=t.gridColumnEnd,u=t.gridColumnStart,d=t.gridRowEnd,f=t.gridRowStart,v=t.header,p=t.reverse,g=t.sort,m=n.useState(!1),w=m[0],x=m[1],y=n.useState(!1),b=y[0],C=y[1],S=n.useState(v.label||""),R=S[0],I=S[1],E=j(),k=E.activeHeaderDropdown,N=E.areAllRowsSelected,H=E.collapsedHeaders,M=E.columnBorders,A=E.columnReordering,W=E.columnResizing,T=E.columnsWithSelectedCells,L=E.draggedHeaderRef,B=E.enableHeaderEditing,O=E.enableRowSelection,P=E.filterIcon,q=E.filters,z=E.handleApplyFilter,Y=E.handleClearFilter,G=E.handleSelectAll,U=E.headerCollapseIcon,V=E.headerDropdown,J=E.headerExpandIcon,X=E.headerRegistry,_=E.headers,$=E.hoveredHeaderRef,Q=E.onColumnOrderChange,Z=E.onColumnSelect,ee=E.onHeaderEdit,ne=E.onSort,re=E.onTableHeaderDragEnd,oe=E.headerHeight,ie=E.selectColumns,ae=E.selectableColumns,se=E.selectedColumns,le=E.setActiveHeaderDropdown,ce=E.setCollapsedHeaders,ue=E.setHeaders,fe=E.setInitialFocusedCell,ve=E.setIsResizing,pe=E.setSelectedCells,ge=E.setSelectedColumns,me=E.sortDownIcon,we=E.sortUpIcon,xe=Boolean(null==v?void 0:v.isSortable),ye=Boolean(null==v?void 0:v.filterable),be=q[v.accessor],Ce=(null==k?void 0:k.accessor)===v.accessor,Se=v.isSelectionColumn&&O,Re=function(e){var n;return Boolean((null===(n=e.children)||void 0===n?void 0:n.length)&&e.collapsible)}(v),je=H.has(v.accessor),Ee=function(e){var t=e.isOpen,r=e.estimatedHeight,o=void 0===r?200:r,i=e.estimatedWidth,a=void 0===i?250:i,s=e.margin,l=void 0===s?4:s,c=n.useRef(null),u=n.useState({}),d=u[0],f=u[1];return n.useEffect(function(){if(t&&c.current){var e=function(){if(c.current){var e=c.current.getBoundingClientRect(),n=window.innerHeight-e.bottom,t=e.top,r=window.innerWidth-e.right,i="bottom",s={};o>n&&o<=t&&(i="top");var u="left";a>r+e.width&&(u="right"),"bottom"===i?s.top=e.bottom+l:s.bottom=window.innerHeight-e.top+l,"left"===u?s.left=e.left:s.right=window.innerWidth-e.right,f(s)}};requestAnimationFrame(e);var n=function(){return requestAnimationFrame(e)},r=function(){return requestAnimationFrame(e)};return window.addEventListener("resize",n),window.addEventListener("scroll",r,!0),function(){window.removeEventListener("resize",n),window.removeEventListener("scroll",r,!0)}}f({})},[t,o,a,l]),{triggerRef:c,position:d}}({isOpen:Ce,estimatedHeight:200,estimatedWidth:250,margin:4}),ke=Ee.triggerRef,Ne=Ee.position,He=n.useMemo(function(){var e,n,t;if(!M)return!1;var r=_.filter(function(e){return"left"===e.pinned}),o=_.filter(function(e){return!e.pinned}),i=_.filter(function(e){return"right"===e.pinned});return"left"===v.pinned?(null===(e=r[r.length-1])||void 0===e?void 0:e.accessor)===v.accessor:"right"===v.pinned?(null===(n=i[i.length-1])||void 0===n?void 0:n.accessor)===v.accessor:(null===(t=o[o.length-1])||void 0===t?void 0:t.accessor)===v.accessor},[M,_,v.accessor,v.pinned]),Me=n.useMemo(function(){return!(!ae||Se)&&c(v,a).some(function(e){return se.has(e)})},[ae,Se,v,a,se]),Ae=n.useMemo(function(){return!Se&&c(v,a).some(function(e){return T.has(e)})},[Se,v,a,T]),Fe=n.useMemo(function(){return!(!v.children||0===v.children.length)&&(!je||v.children.some(function(e){return"parentCollapsed"===e.showWhen||"always"===e.showWhen}))},[v.children,je]),We="st-header-cell ".concat(v.accessor===(null===(r=$.current)||void 0===r?void 0:r.accessor)?"st-hovered":""," ").concat((null===(i=L.current)||void 0===i?void 0:i.accessor)===v.accessor?"st-dragging":""," ").concat(xe?"clickable":""," ").concat(A&&!xe?"columnReordering":""," ").concat(Fe?"parent":""," ").concat(He?"st-last-column":""," ").concat(B&&!Se?"st-header-editable":""," ").concat(Me?"st-header-selected":""," ").concat(Ae&&!Me?"st-header-has-highlighted-cell":""),Te=te({draggedHeaderRef:L,headers:_,hoveredHeaderRef:$,onColumnOrderChange:Q,onTableHeaderDragEnd:re}),De=Te.handleDragStart,Le=Te.handleDragEnd,Be=Te.handleDragOver,Oe=K();n.useEffect(function(){if(X&&!v.isSelectionColumn){var e=String(v.accessor);return X.set(e,{setEditing:function(e){C(e)}}),function(){X.delete(e)}}},[X,v.accessor,v.isSelectionColumn]),n.useEffect(function(){I(v.label||"")},[v.label]);var Pe=n.useCallback(function(e){I(e);var n=_.map(function(n){return n.accessor===v.accessor?o(o({},n),{label:e}):n});ue(n),ee&&ee(v,e)},[_,ue,ee,v]),qe=n.useCallback(function(){le&&le(null)},[le]),ze=n.useCallback(function(e){e.stopPropagation(),ce(function(e){var n=new Set(e);return je?n.delete(v.accessor):n.add(v.accessor),n})},[ce,je,v.accessor]),Ye=function(e){var n=e.event,t=e.header;if(!t.isSelectionColumn){if(ae){var r=c(t,a),o=r.some(function(e){return se.has(e)});if(B&&o&&!n.shiftKey)return V&&Ce&&qe(),void C(!0);n.shiftKey&&ie?ge(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))}):ie&&ie(r),pe(new Set),fe(null)}Z&&Z(t),!ae&&t.isSortable&&ne(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 Ge=W&&!Se&&e.jsx("div",o({className:"st-header-resize-handle-container",onMouseDown:function(e){var n,t=null===(n=document.getElementById(h({accessor:v.accessor,rowId:"header"})))||void 0===n?void 0:n.offsetWidth;Oe({callback:Ie,callbackProps:{event:e.nativeEvent,gridColumnEnd:l,gridColumnStart:u,header:v,headers:_,setHeaders:ue,setIsResizing:ve,startWidth:t,collapsedHeaders:H},limit:10})},onTouchStart:function(e){var n,t=null===(n=document.getElementById(h({accessor:v.accessor,rowId:"header"})))||void 0===n?void 0:n.offsetWidth;Oe({callback:Ie,callbackProps:{event:e,gridColumnEnd:l,gridColumnStart:u,header:v,headers:_,setHeaders:ue,setIsResizing:ve,startWidth:t,collapsedHeaders:H},limit:10})}},{children:e.jsx("div",{className:"st-header-resize-handle"})})),Ke=g&&g.key.accessor===v.accessor&&e.jsxs("div",o({className:"st-icon-container",onClick:function(e){return Ye({event:e,header:v})}},{children:["ascending"===g.direction&&we&&we,"descending"===g.direction&&me&&me]})),Je=ye&&P&&e.jsxs("div",o({className:"st-icon-container",onClick:function(e){e.stopPropagation(),x(!w)}},{children:[n.cloneElement(P,{style:{fill:be?"var(--st-button-active-background-color)":"var(--st-header-icon-color)"}}),e.jsx(F,o({open:w,overflow:"visible",setOpen:x,onClose:function(){return x(!1)}},{children:e.jsx(Ue,{header:v,currentFilter:be,onApplyFilter:function(e){z(e),x(!1)},onClearFilter:function(){Y(v.accessor),x(!1)}})}))]})),Xe=Re&&!Se&&e.jsx("div",o({className:"st-icon-container st-collapse-icon-container",onClick:ze},{children:je?U:J}));return e.jsxs(de,o({className:We,id:h({accessor:v.accessor,rowId:"header"}),onDragOver:function(e){Se||Oe({callback:Be,callbackProps:{event:e,hoveredHeader:v},limit:50})},style:o({gridRowStart:f,gridRowEnd:d,gridColumnStart:u,gridColumnEnd:l},d-f>1?{}:{height:oe})},{children:[p&&Ge,"right"===v.align&&Xe,"right"===v.align&&Je,"right"===v.align&&Ke,e.jsx("div",o({ref:ke,className:"st-header-label",draggable:A&&!v.disableReorder&&!Se,onClick:function(e){Se||Ye({event:e,header:v})},onDoubleClick:function(e){Se||function(e){e.event;var n=e.header;n.isSelectionColumn||ae&&n.isSortable&&ne(n.accessor)}({event:e,header:v})},onDragEnd:Se?void 0:function(e){e.preventDefault(),Le()},onDragStart:Se?void 0:function(e){A&&v&&function(e){De(e)}(v)}},{children:e.jsx(Ve,o({content:v.tooltip||""},{children:e.jsx("span",o({className:"st-header-label-text ".concat("right"===v.align?"right-aligned":"center"===v.align?"center-aligned":"left-aligned")},{children:Se?e.jsx(he,{checked:!!N&&N(),onChange:function(e){G&&G(e)}}):b?e.jsx(D,{defaultValue:R,onBlur:function(){return C(!1)},onChange:Pe}):v.headerRenderer?v.headerRenderer({accessor:v.accessor,colIndex:a,header:v}):R||(null==v?void 0:v.label)}))}))})),"right"!==v.align&&Ke,"right"!==v.align&&Je,"right"!==v.align&&Xe,!p&&Ge,V&&!Se&&e.jsx("div",o({className:"st-header-dropdown-container"},{children:V({accessor:v.accessor,colIndex:a,header:v,isOpen:Ce,onClose:qe,position:Ne})}))]}))},Je=function(t){var r=t.columnIndices,i=t.gridTemplateColumns,a=t.handleScroll,s=t.headers,l=t.maxDepth,c=t.pinned,u=t.sectionRef,d=t.sort,f=t.width,h=j().collapsedHeaders,p=n.useMemo(function(){var e=[],n=1,t=function(o,i,a){var u,d;if(void 0===a&&(a=!1),!v({header:o,pinned:c,headers:s,collapsedHeaders:h}))return 0;a||n++;var f=null!==(d=null===(u=o.children)||void 0===u?void 0:u.filter(function(e){return v({header:e,pinned:c,headers:s,collapsedHeaders:h})}).length)&&void 0!==d?d:0,p=n,g=f>0?p+f:p+1,m=i,w=f>0?i+1:l+1;if(e.push({header:o,gridColumnStart:p,gridColumnEnd:g,gridRowStart:m,gridRowEnd:w,colIndex:r[o.accessor]}),o.children&&o.children.length>0){var x=!0;o.children.forEach(function(e){v({header:e,pinned:c,headers:s,collapsedHeaders:h})&&(t(e,i+1,x),x=!1)})}return g-p},o=s.filter(function(e){return v({header:e,pinned:c,headers:s,collapsedHeaders:h})}),i=!0;return o.forEach(function(e){t(e,1,i),i=!1}),e},[s,l,c,r,h]),g=c?"pinned-".concat(c):"default";return e.jsx(be,o({childRef:u,group:g},{children:e.jsx("div",o({className:"st-header-".concat(c?"pinned-".concat(c):"main")},a&&{onScroll:a},{ref:u,style:{gridTemplateColumns:i,width:f,position:"relative"}},{children:e.jsx(e.Fragment,{children:p.map(function(n){return e.jsx(Ke,{colIndex:n.colIndex,gridColumnEnd:n.gridColumnEnd,gridColumnStart:n.gridColumnStart,gridRowEnd:n.gridRowEnd,gridRowStart:n.gridRowStart,header:n.header,reverse:"right"===c,sort:d},n.header.accessor)})})}))}))},Xe=function(e){var n;return(null===(n=e.children)||void 0===n?void 0:n.length)?1+Math.max.apply(Math,e.children.map(Xe)):1},_e=function(t){var r=t.centerHeaderRef,i=t.headers,a=t.mainTemplateColumns,l=t.pinnedLeftColumns,c=t.pinnedLeftTemplateColumns,u=t.pinnedRightColumns,d=t.pinnedRightTemplateColumns,f=t.sort,h=t.pinnedLeftWidth,p=t.pinnedRightWidth,g=j(),m=g.headerContainerRef,w=g.pinnedLeftRef,x=g.pinnedRightRef,y=g.collapsedHeaders,b=n.useMemo(function(){return Se({headers:i,pinnedLeftColumns:l,pinnedRightColumns:u,collapsedHeaders:y})},[i,l,u,y]),C=n.useMemo(function(){var e=0,n=s(s(s([],l,!0),i,!0),u,!0);return i.forEach(function(t){if(v({header:t,headers:n,collapsedHeaders:y})){var r=Xe(t);e=Math.max(e,r)}}),{maxDepth:e}},[i,l,u,y]).maxDepth;return e.jsxs("div",o({className:"st-header-container",ref:m},{children:[_(i,"left")&&e.jsx(Je,{columnIndices:b,gridTemplateColumns:c,handleScroll:void 0,headers:i,maxDepth:C,pinned:"left",sectionRef:w,sort:f,width:h}),e.jsx(Je,{columnIndices:b,gridTemplateColumns:a,handleScroll:void 0,headers:i,maxDepth:C,sectionRef:r,sort:f}),_(i,"right")&&e.jsx(Je,{columnIndices:b,gridTemplateColumns:d,handleScroll:void 0,headers:i,maxDepth:C,pinned:"right",sectionRef:x,sort:f,width:p})]}))},$e=function(e){var n=e.headers,t=e.collapsedHeaders,r=function(e){var n=e.headers,o=e.flattenedHeaders;return n.forEach(function(e){if(!e.hide)if(e.children&&e.children.length>0)if(t&&t.has(e.accessor)){var n=e.children.filter(function(e){return"parentCollapsed"===e.showWhen||"always"===e.showWhen});n.length>0?r({headers:n,flattenedHeaders:o}):o.push(e)}else{var i=e.children.filter(function(e){return"parentExpanded"===e.showWhen||"always"===e.showWhen||!e.showWhen});r({headers:i,flattenedHeaders:o})}else 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(" "))},Qe=function(t){var r=t.pinnedLeftWidth,i=t.pinnedRightWidth,a=t.setScrollTop,s=t.sort,l=t.tableRows,c=t.rowsToRender,u=j(),d=u.columnResizing,f=u.editColumns,h=u.headers,v=u.collapsedHeaders,p=n.useRef(null),g=h.filter(function(e){return!e.pinned}),m=h.filter(function(e){return"left"===e.pinned}),w=h.filter(function(e){return"right"===e.pinned}),x=n.useMemo(function(){return $e({headers:m,collapsedHeaders:v})},[m,v]),y=n.useMemo(function(){return $e({headers:g,collapsedHeaders:v})},[g,v]),b=n.useMemo(function(){return $e({headers:w,collapsedHeaders:v})},[w,v]),C={centerHeaderRef:p,headers:h,mainTemplateColumns:y,pinnedLeftColumns:m,pinnedLeftTemplateColumns:x,pinnedRightColumns:w,pinnedRightTemplateColumns:b,sort:s,pinnedLeftWidth:r,pinnedRightWidth:i},S={tableRows:l,mainTemplateColumns:y,pinnedLeftColumns:m,pinnedLeftTemplateColumns:x,pinnedLeftWidth:r,pinnedRightColumns:w,pinnedRightTemplateColumns:b,pinnedRightWidth:i,setScrollTop:a,rowsToRender: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(_e,o({},C)),e.jsx(Re,o({},S))]}))},Ze=function(t){var r=t.mainBodyWidth,i=t.mainBodyRef,a=t.pinnedLeftWidth,s=t.pinnedRightWidth,l=t.pinnedLeftContentWidth,c=t.pinnedRightContentWidth,u=t.tableBodyContainerRef,d=j().editColumns,f=n.useState(!1),h=f[0],v=f[1],p=n.useRef(null),g=n.useRef(null),m=n.useRef(null),w=u.current&&u.current.scrollHeight>u.current.clientHeight,x=d?28:0,y=(d?s+1:s)+(u.current&&w?u.current.offsetWidth-u.current.clientWidth:0);return n.useEffect(function(){setTimeout(function(){!function(){if(i.current){var e=i.current.clientWidth;v(r>e)}}()},1)},[i,r]),h?e.jsxs("div",o({className:"st-horizontal-scrollbar-container"},{children:[a>0&&e.jsx(be,o({childRef:g,group:"pinned-left"},{children:e.jsx("div",o({className:"st-horizontal-scrollbar-left",ref:g,style:{width:a}},{children:e.jsx("div",{style:{width:l}})}))})),r>0&&e.jsx(be,o({childRef:p},{children:e.jsx("div",o({className:"st-horizontal-scrollbar-middle",ref:p},{children:e.jsx("div",{style:{width:r}})}))})),s>0&&e.jsx(be,o({childRef:m,group:"pinned-right"},{children:e.jsx("div",o({className:"st-horizontal-scrollbar-right",ref:m,style:{width:y}},{children:e.jsx("div",{style:{width:c}})}))})),x>0&&e.jsx("div",{style:{width:x-1.5,height:"100%",flexShrink:0}})]})):null},en={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 en.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?en.string(e,n,t):"number"==typeof e&&"number"==typeof n?en.number(e,n,t):"boolean"==typeof e&&"boolean"==typeof n?en.boolean(e,n,t):en.string(String(e),String(n),t)}},nn=function(e){var n=e.rows,t=e.sortColumn,r=e.headers,o=function(e,n){for(var t=0,r=e;t<r.length;t++){var i=r[t];if(i.accessor===n)return i;if(i.children&&i.children.length>0){var a=o(i.children,n);if(a)return a}}},i=o(r,t.key.accessor),a=(null==i?void 0:i.type)||"string",l=t.direction;return s([],n,!0).sort(function(e,n){var r=t.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 en.number(i,a,r)}return"date"===t?en.date(String(e),String(n),r):"boolean"===t?en.boolean(Boolean(e),Boolean(n),r):"enum"===t?en.enum(String(e),String(n),r):en.string(String(e),String(n),r)}(e[r],n[r],a,l)})},tn=function(e){var n=e.headers,t=e.rows,r=e.sortColumn;return nn({rows:t,sortColumn:r,headers:n})},rn=function(e){var n=e.externalSortHandling,t=e.tableRows,r=e.sortColumn,o=e.rowGrouping,i=e.headers,a=e.sortNestedRows;return n?t:r?o&&o.length>0?a({groupingKeys:o,headers:i,rows:t,sortColumn:r}):tn({headers:i,rows:t,sortColumn:r}):t},on=function(e,n,t){void 0===t&&(t=new Set);for(var r=0,o=e;r<o.length;r++){var i=o[r];if(!t.has(i.accessor)&&(t.add(i.accessor),i.children&&i.children.length>0)){var a=i.children.some(function(e){return e.accessor===n}),s=!1;if(!a)for(var l=0,c=i.children;l<c.length;l++){var u=c[l];if(on([u],n,t),!1===u.hide){s=!0;break}}(a||s)&&(i.hide=!1)}}},an=function(e){return e.every(function(e){return e.hide})},sn=function(e){e.forEach(function(e){e.children&&e.children.length>0&&(sn(e.children),an(e.children)&&(e.hide=!0))})},ln=function(t){var r=t.allHeaders,i=t.depth,a=void 0===i?0:i,l=t.doesAnyHeaderHaveChildren,c=t.header,u=t.isCheckedOverride,d=n.useState(!0),f=d[0],h=d[1],v=j(),p=v.expandIcon,g=v.headers,m=v.setHeaders,w=l?"".concat(16*a,"px"):"8px",x=c.children&&c.children.length>0,y=null!=u?u:c.hide||x&&c.children&&an(c.children);return e.jsxs(e.Fragment,{children:[e.jsxs("div",o({className:"st-header-checkbox-item",style:{paddingLeft:w}},{children:[l&&e.jsx("div",o({className:"st-header-icon-container"},{children:x?e.jsx("div",o({className:"st-collapsible-header-icon st-expand-icon-container ".concat(f?"expanded":"collapsed"),onClick:function(e){e.stopPropagation(),h(!f)}},{children:p})):null})),e.jsx(he,o({checked:y,onChange:function(e){(c.hide=e,e)?sn(r):(on(r,c.accessor),x&&c.children&&c.children.length>0&&c.children.every(function(e){return!0===e.hide})&&c.children[0]&&(c.children[0].hide=!1,on(r,c.children[0].accessor)));m(s([],g,!0))}},{children:c.label}))]})),x&&f&&c.children&&e.jsx("div",o({className:"st-nested-headers"},{children:c.children.map(function(n,t){return e.jsx(ln,{allHeaders:r,depth:a+1,doesAnyHeaderHaveChildren:l,header:n,isCheckedOverride:!!y||void 0},"".concat(n.accessor,"-").concat(t))})}))]})},cn=function(t){var r=t.headers,i=t.open,a="left"===t.position?"left":"",s=n.useMemo(function(){return r.some(function(e){return e.children&&e.children.length>0})},[r]);return e.jsx("div",o({className:"st-column-editor-popout ".concat(i?"open":""," ").concat(a),onClick:function(e){return e.stopPropagation()}},{children:e.jsx("div",o({className:"st-column-editor-popout-content"},{children:r.map(function(n,t){return n.isSelectionColumn?null:e.jsx(ln,{doesAnyHeaderHaveChildren:s,header:n,allHeaders:r},"".concat(n.accessor,"-").concat(t))})}))}))},un=function(t){var r=t.columnEditorText,i=t.editColumns,a=t.editColumnsInitOpen,s=t.headers,l=t.position,c=void 0===l?"right":l,u=n.useState(a),d=u[0],f=u[1];return i?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(cn,{headers:s,open:d,position:c})]})):null},dn=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"})}))},fn=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"})}))},hn=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"})}))},vn=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]),f=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(ye.Provider,o({value:{registerPane:d,unregisterPane:f}},{children:r.default.Children.only(i)}))},pn=function(e,n){var t=n.find(function(n){return n.accessor===e.accessor}),r=(null==t?void 0:t.label)||e.accessor,o=Ee[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)},gn=function(){var n=j(),t=n.filters,r=n.handleClearFilter,i=n.headers,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:pn(n,i)})),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)})}))}))}))},mn=function(e){var n=e.externalFilterHandling,t=e.tableRows,r=e.filterState;return n?t:r&&0!==Object.keys(r).length?t.filter(function(e){return Object.values(r).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 f=o.map(Number);return u=f[0],d=f[1],s<u||s>d}return!0}}if(e instanceof Date||!isNaN(Date.parse(e))){var h=q(e),v=q(String(r||"")),p=P(h),g=P(v);switch(t){case"equals":return p.getTime()===g.getTime();case"notEquals":return p.getTime()!==g.getTime();case"before":return p<g;case"after":return p>g;case"between":if(o&&2===o.length){var m=o.map(function(e){return P(q(String(e||"")))}),w=m[0],x=m[1];return p>=w&&p<=x}return!1;case"notBetween":if(o&&2===o.length){var y=o.map(function(e){return P(q(String(e||"")))});return w=y[0],x=y[1],p<w||p>x}return!0}}if("boolean"==typeof e){var b=Boolean(r);if("equals"===t)return e===b}if(Array.isArray(e)){var C=e.map(function(e){return"object"==typeof e&&null!==e?JSON.stringify(e):String(e)}).join(", ");e=C}if("in"===t||"notIn"===t){if(o&&Array.isArray(o)){var S=String(e),R=o.includes(S);return"in"===t?R:!R}return!1}var I=String(e).toLowerCase(),j=r?String(r).toLowerCase():"";switch(t){case"equals":return I===j;case"notEquals":return I!==j;default:return!0}}(e[n.accessor],n)}catch(e){return console.warn("Filter error for accessor ".concat(n.accessor,":"),e),!0}})}):t},wn=function(e){var t=e.rows,r=e.headers,i=e.rowGrouping;return n.useMemo(function(){if(!i||0===i.length)return t;var e=function(e){return u(e).filter(function(e){return e.aggregation})}(r);if(0===e.length)return t;var n=JSON.parse(JSON.stringify(t)),a=function(n,t){return void 0===t&&(t=0),n.map(function(n){var r=i[t],s=i[t+1],l=n[r];if(l&&y(l)){var c=a(l,t+1),u=o({},n);return u[r]=c,e.forEach(function(e){var n=xn(c,e.accessor,e.aggregation,s);void 0!==n&&(u[e.accessor]=n)}),u}return n})};return a(n)},[t,r,i])},xn=function(e,n,t,r){var o=[],i=function(e){e.forEach(function(e){var t=r?e[r]:void 0;r&&t&&y(t)?i(t):void 0!==e[n]&&null!==e[n]&&o.push(e[n])})};if(i(e),0!==o.length){if("custom"===t.type&&t.customFn)return t.customFn(o);var a,s=t.parseValue?o.map(t.parseValue).filter(function(e){return!isNaN(e)}):o.map(function(e){return"number"==typeof e?e:"string"==typeof e?parseFloat(e):NaN}).filter(function(e){return!isNaN(e)});if(0===s.length)return"count"===t.type?o.length:void 0;switch(t.type){case"sum":a=s.reduce(function(e,n){return e+n},0);break;case"average":a=s.reduce(function(e,n){return e+n},0)/s.length;break;case"count":a=o.length;break;case"min":a=Math.min.apply(Math,s);break;case"max":a=Math.max.apply(Math,s);break;default:return}return t.formatResult?t.formatResult(a):a}},yn=function(e){if(null==e)return"";var n=String(e);if(n.includes(",")||n.includes('"')||n.includes("\n")||n.includes("\r")){var t=n.replace(/"/g,'""');return'"'.concat(t,'"')}return n},bn=function(e,n,t){var r=function(e,n){var t=function(e){var n=[],t=function(e){for(var r=0,o=e;r<o.length;r++){var i=o[r];i.hide||i.isSelectionColumn||(i.children&&i.children.length>0?t(i.children):n.push(i))}};return t(e),n}(n);return s([t.map(function(e){return yn(e.label)}).join(",")],e.map(function(e){var n=e.row;return t.map(function(e){var t=n[e.accessor];return yn(t)}).join(",")}),!0).join("\n")}(e,n);!function(e,n){void 0===n&&(n="table-export.csv");var t=new Blob([e],{type:"text/csv;charset=utf-8;"}),r=document.createElement("a"),o=URL.createObjectURL(t);r.setAttribute("href",o),r.setAttribute("download",n),r.style.visibility="hidden",document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(o)}(r,t)},Cn=function(e){var t=e.rows,r=e.rowIdAccessor,o=e.onRowSelectionChange,i=e.enableRowSelection,a=void 0!==i&&i,s=n.useState(new Set),l=s[0],c=s[1],u=n.useCallback(function(e){return!!a&&function(e,n){return n.has(e)}(e,l)},[l,a]),d=n.useCallback(function(){return!!a&&function(e,n,t){return 0!==e.length&&e.every(function(e){return t.has(String(e[n]))})}(t,r,l)},[t,r,l,a]),f=n.useMemo(function(){return a?function(e){return e.size}(l):0},[l,a]),h=n.useMemo(function(){return a?function(e,n,t){return e.filter(function(e){return t.has(String(e[n]))})}(t,r,l):[]},[t,r,l,a]),v=n.useCallback(function(e,n){if(a){var i=function(e,n){var t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}(e,l);if(c(i),o){var s=t.find(function(n){return String(n[r])===e});s&&o({row:s,isSelected:n,selectedRows:i})}}},[l,t,r,o,a]),p=n.useCallback(function(e){var n;a&&(e?(n=function(e,n){return new Set(e.map(function(e){return String(e[n])}))}(t,r),o&&t.forEach(function(e){return o({row:e,isSelected:!0,selectedRows:n})})):(n=new Set,o&&l.forEach(function(e){var i=t.find(function(n){return String(n[r])===e});i&&o({row:i,isSelected:!1,selectedRows:n})})),c(n))},[t,r,o,l,a]),g=n.useCallback(function(e){if(a){var n=u(e);v(e,!n)}},[u,v,a]),m=n.useCallback(function(){if(a){if(o){var e=new Set;l.forEach(function(n){var i=t.find(function(e){return String(e[r])===n});i&&o({row:i,isSelected:!1,selectedRows:e})})}c(new Set)}},[l,t,r,o,a]);return{selectedRows:l,setSelectedRows:c,isRowSelected:u,areAllRowsSelected:d,selectedRowCount:f,selectedRowsData:h,handleRowSelect:v,handleSelectAll:p,handleToggleRow:g,clearSelection:m}},Sn=function(t){var r=t.allowAnimations,c=void 0!==r&&r,u=t.cellUpdateFlash,f=void 0!==u&&u,h=t.className,v=t.columnBorders,w=void 0!==v&&v,x=t.columnEditorPosition,R=void 0===x?"right":x,j=t.columnEditorText,M=void 0===j?"Columns":j,A=t.columnReordering,F=void 0!==A&&A,W=t.columnResizing,T=void 0!==W&&W,D=t.defaultHeaders,L=t.editColumns,B=void 0!==L&&L,O=t.editColumnsInitOpen,P=void 0!==O&&O,q=t.enableHeaderEditing,z=void 0!==q&&q,Y=t.enableRowSelection,G=void 0!==Y&&Y,U=t.expandAll,V=void 0===U||U,K=t.expandIcon,X=void 0===K?e.jsx(N,{className:"st-expand-icon"}):K,_=t.externalFilterHandling,$=void 0!==_&&_,Q=t.externalSortHandling,Z=void 0!==Q&&Q,ee=t.filterIcon,ne=void 0===ee?e.jsx(hn,{className:"st-header-icon"}):ee,te=t.footerRenderer,re=t.headerCollapseIcon,oe=void 0===re?e.jsx(N,{className:"st-header-icon"}):re,ae=t.headerExpandIcon,se=void 0===ae?e.jsx(k,{className:"st-header-icon"}):ae,le=t.headerDropdown,ce=t.headerHeight,ue=t.height,de=t.hideFooter,fe=void 0!==de&&de,he=t.nextIcon,ve=void 0===he?e.jsx(N,{className:"st-next-prev-icon"}):he,pe=t.onCellEdit,ge=t.onCellClick,me=t.onColumnOrderChange,we=t.onColumnSelect,xe=t.onFilterChange,ye=t.onGridReady,be=t.onHeaderEdit,Ce=t.onLoadMore,Se=t.onNextPage,Re=t.onRowSelectionChange,Ie=t.onSortChange,je=t.prevIcon,Ee=void 0===je?e.jsx(k,{className:"st-next-prev-icon"}):je,ke=t.rowButtons,Ne=t.rowGrouping,He=t.rowHeight,Me=void 0===He?32:He,Ae=t.rowIdAccessor,Fe=t.rows,We=t.selectionColumnWidth,Te=void 0===We?42:We,De=t.rowsPerPage,Le=void 0===De?10:De,Be=t.selectableCells,Oe=void 0!==Be&&Be,Pe=t.selectableColumns,qe=void 0!==Pe&&Pe,ze=t.shouldPaginate,Ye=void 0!==ze&&ze,Ge=t.sortDownIcon,Ue=void 0===Ge?e.jsx(dn,{className:"st-header-icon"}):Ge,Ve=t.sortUpIcon,Ke=void 0===Ve?e.jsx(fn,{className:"st-header-icon"}):Ve,Je=t.tableRef,Xe=t.theme,_e=void 0===Xe?"light":Xe,$e=t.useHoverRowBackground,en=void 0===$e||$e,nn=t.useOddEvenRowBackground,on=void 0!==nn&&nn,an=t.useOddColumnBackground,sn=void 0!==an&&an;sn&&(on=!1),w&&(en=!1);var ln=n.useReducer(function(e){return e+1},0)[1],cn=n.useRef(null),pn=n.useRef(null),xn=n.useRef(null),yn=n.useRef(null),Sn=n.useRef(null),Rn=n.useRef(null),In=n.useRef(null),jn=n.useState(1),En=jn[0],kn=jn[1],Nn=n.useState(D),Hn=Nn[0],Mn=Nn[1],An=n.useState(!1),Fn=An[0],Wn=An[1],Tn=n.useState(!1),Dn=Tn[0],Ln=Tn[1],Bn=n.useState(null),On=Bn[0],Pn=Bn[1],qn=n.useState(new Set),zn=qn[0],Yn=qn[1];n.useEffect(function(){Mn(D)},[D]);var Gn=Cn({rows:Fe,rowIdAccessor:Ae,onRowSelectionChange:Re,enableRowSelection:G}),Un=Gn.selectedRows,Vn=Gn.setSelectedRows,Kn=Gn.isRowSelected,Jn=Gn.areAllRowsSelected,Xn=Gn.selectedRowCount,_n=Gn.selectedRowsData,$n=Gn.handleRowSelect,Qn=Gn.handleSelectAll,Zn=Gn.handleToggleRow,et=Gn.clearSelection,nt=n.useMemo(function(){var e,n=s([],Hn,!0);G&&!(null===(e=null==Hn?void 0:Hn[0])||void 0===e?void 0:e.isSelectionColumn)&&(n=s([{accessor:"__row_selection__",label:"",width:Te,isEditable:!1,type:"boolean",pinned:"left",isSelectionColumn:!0,isSortable:!1,filterable:!1,align:"center"}],n,!0));return n},[G,Hn,Te]),tt=n.useState(0),rt=tt[0],ot=tt[1],it=n.useState(new Set),at=it[0],st=it[1],lt=function(e){var t=e.tableBodyContainerRef,r=n.useState(0),o=r[0],i=r[1];return n.useLayoutEffect(function(){if(t.current){var e=t.current.offsetWidth-t.current.clientWidth;i(e)}},[t]),{setScrollbarWidth:i,scrollbarWidth:o,tableBodyContainerRef:t}}({tableBodyContainerRef:Rn}),ct=lt.scrollbarWidth,ut=lt.setScrollbarWidth,dt=n.useState(0),ft=dt[0],ht=dt[1];n.useLayoutEffect(function(){var e=function(){Rn.current&&ht(Rn.current.clientWidth)};e();var n=null;return Rn.current&&(n=new ResizeObserver(e)).observe(Rn.current),function(){n&&n.disconnect()}},[]);var vt=n.useMemo(function(){var e=l(window.innerWidth),n=function(e){var n=e.headers,t=e.containerWidth,r=e.maxPinnedWidthPercent,o=void 0===r?.8:r,i=e.collapsedHeaders,a=0,s=0,l=0;n.forEach(function(e){if(!e.hide){var n=g(e,i).reduce(function(e,n){return e+m(n)},0);"left"===e.pinned?a+=n:"right"===e.pinned?s+=n:l+=n}});var c=a,u=s;if(t&&t>0){var f=t*o;a>f&&(a=f),s>f&&(s=f)}return{leftWidth:d(a),rightWidth:d(s),mainWidth:l,leftContentWidth:c,rightContentWidth:u}}({headers:nt,containerWidth:ft,maxPinnedWidthPercent:e,collapsedHeaders:zn});return{mainBodyWidth:n.mainWidth,pinnedLeftWidth:n.leftWidth,pinnedRightWidth:n.rightWidth,pinnedLeftContentWidth:n.leftContentWidth,pinnedRightContentWidth:n.rightContentWidth}},[nt,ft,zn]),pt=vt.mainBodyWidth,gt=vt.pinnedLeftWidth,mt=vt.pinnedRightWidth,wt=vt.pinnedLeftContentWidth,xt=vt.pinnedRightContentWidth,yt=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("string"==typeof t)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;else o=t;return Math.max(0,o-r)},[t,r])}({height:ue,rowHeight:Me}),bt=wn({rows:Fe,headers:Hn,rowGrouping:Ne}),Ct=function(e){var t=e.rows,r=e.externalFilterHandling,i=e.onFilterChange,a=n.useState({}),s=a[0],l=a[1],c=n.useMemo(function(){return mn({externalFilterHandling:r,tableRows:t,filterState:s})},[t,s,r]),u=n.useCallback(function(e){var n,t=o(o({},s),((n={})[e.accessor]=e,n));l(t),null==i||i(t)},[s,i]),d=n.useCallback(function(e){var n=o({},s);delete n[e],l(n),null==i||i(n)},[s,i]),f=n.useCallback(function(){l({}),null==i||i({})},[i]),h=n.useCallback(function(e){var n,i=o(o({},s),((n={})[e.accessor]=e,n));return mn({externalFilterHandling:r,tableRows:t,filterState:i})},[s,t,r]);return{filteredRows:c,updateFilter:u,clearFilter:d,clearAllFilters:f,filters:s,computeFilteredRowsPreview:h}}({rows:bt,externalFilterHandling:$,onFilterChange:xe}),St=Ct.filters,Rt=Ct.filteredRows,It=Ct.updateFilter,jt=Ct.clearFilter,Et=Ct.clearAllFilters,kt=Ct.computeFilteredRowsPreview,Nt=function(e){var t=e.headers,r=e.tableRows,i=e.externalSortHandling,a=e.onSortChange,s=e.rowGrouping,l=n.useState(null),c=l[0],u=l[1],d=n.useCallback(function(e){var n=e.groupingKeys,t=e.headers,r=e.rows,i=e.sortColumn,a=tn({headers:t,rows:r,sortColumn:i});return n&&0!==n.length?a.map(function(e){var r,a=n[0],s=e[a];if(y(s)){var l=d({rows:s,sortColumn:i,headers:t,groupingKeys:n.slice(1)});return o(o({},e),((r={})[a]=l,r))}return e}):a},[]),f=n.useMemo(function(){return rn({externalSortHandling:i,tableRows:r,sortColumn:c,rowGrouping:s,headers:t,sortNestedRows:d})},[r,c,t,i,s,d]),h=n.useCallback(function(e){var n=function(t){for(var r=0,o=t;r<o.length;r++){var i=o[r];if(i.accessor===e)return i;if(i.children&&i.children.length>0){var a=n(i.children);if(a)return a}}},r=n(t);if(r){var o=null;c&&c.key.accessor===e?"ascending"===c.direction&&(o={key:r,direction:"descending"}):o={key:r,direction:"ascending"},u(o),null==a||a(o)}},[c,t,a]),v=n.useCallback(function(e){var n=function(t){for(var r=0,o=t;r<o.length;r++){var i=o[r];if(i.accessor===e)return i;if(i.children&&i.children.length>0){var a=n(i.children);if(a)return a}}},o=n(t);if(!o)return r;var a=null;return c&&c.key.accessor===e?"ascending"===c.direction&&(a={key:o,direction:"descending"}):a={key:o,direction:"ascending"},rn({externalSortHandling:i,tableRows:r,sortColumn:a,rowGrouping:s,headers:t,sortNestedRows:d})},[c,t,r,i,s,d]);return{sort:c,sortedRows:f,updateSort:h,computeSortedRowsPreview:v}}({headers:Hn,tableRows:Rt,externalSortHandling:Z,onSortChange:Ie,rowGrouping:Ne}),Ht=Nt.sort,Mt=Nt.sortedRows,At=Nt.updateSort,Ft=function(e){var t=e.allowAnimations,r=e.sortedRows,i=e.originalRows,a=e.currentPage,l=e.rowsPerPage,c=e.shouldPaginate,u=e.rowGrouping,d=e.rowIdAccessor,f=e.unexpandedRows,h=e.expandAll,v=e.contentHeight,p=e.rowHeight,g=e.scrollTop,m=e.computeFilteredRowsPreview,w=e.computeSortedRowsPreview,x=n.useState(!1),y=x[0],S=x[1],R=n.useState([]),I=R[0],j=R[1],E=n.useRef([]),k=n.useRef([]),N=n.useRef(new Map),M=n.useRef(null),A=n.useCallback(function(e){var n=c?e.slice((a-1)*l,a*l):e,t=c?(a-1)*l:0;return u&&0!==u.length?C({rows:n,rowGrouping:u,rowIdAccessor:d,unexpandedRows:f,expandAll:h,displayPositionOffset:t}):n.map(function(e,n){return{row:e,depth:0,displayPosition:t+n,groupingKey:void 0,position:n,isLastGroupRow:!1}})},[a,l,c,u,d,f,h]);n.useMemo(function(){if(0===N.current.size){var e=A(i),n=new Map;e.forEach(function(e){var t=String(b({row:e.row,rowIdAccessor:d}));n.set(t,e.position)}),N.current=n}},[i,A,d]);var F=n.useMemo(function(){return A(r)},[r,A]),W=n.useMemo(function(){return H({bufferRowCount:5,contentHeight:v,tableRows:F,rowHeight:p,scrollTop:g})},[F,v,p,g]),T=n.useCallback(function(e,n){var t=new Set(e.map(function(e){return String(b({row:e.row,rowIdAccessor:d}))})),r=new Set(n.map(function(e){return String(b({row:e.row,rowIdAccessor:d}))}));return{staying:n.filter(function(e){var n=String(b({row:e.row,rowIdAccessor:d}));return t.has(n)}),entering:n.filter(function(e){var n=String(b({row:e.row,rowIdAccessor:d}));return!t.has(n)}),leaving:e.filter(function(e){var n=String(b({row:e.row,rowIdAccessor:d}));return!r.has(n)})}},[d]),D=n.useMemo(function(){if(0===E.current.length)return!1;var e=F.map(function(e){return String(b({row:e.row,rowIdAccessor:d}))}),n=E.current.map(function(e){return String(b({row:e.row,rowIdAccessor:d}))});return e.length!==n.length||!e.every(function(e,t){return e===n[t]})},[F,d]);n.useLayoutEffect(function(){if(!y){if(!t||c)return j([]),E.current=F,void(k.current=W);if(0===E.current.length)return j([]),E.current=F,void(k.current=W);if(!D)return j([]),E.current=F,void(k.current=W);M.current={tableRows:F,visibleRows:W},S(!0)}},[t,F,D,y,c,W]),n.useLayoutEffect(function(){if(y&&M.current&&I.length>0){var e=setTimeout(function(){var e=M.current;S(!1),j([]),E.current=e.tableRows,k.current=e.visibleRows,M.current=null},ie.duration+100);return function(){return clearTimeout(e)}}},[y,I.length]);var L=n.useMemo(function(){if(!t||c)return W;if(I.length>0){var e=new Map,n=new Map;return F.forEach(function(t){var r=String(b({row:t.row,rowIdAccessor:d}));e.set(r,t.position),n.set(r,t.displayPosition)}),I.map(function(t){var r=String(b({row:t.row,rowIdAccessor:d})),i=e.get(r),a=n.get(r);return void 0!==i&&void 0!==a?o(o({},t),{position:i,displayPosition:a}):t})}return W},[W,I,F,t,c,d]),B=n.useCallback(function(e){if(t&&!c){var n=m(e),r=A(n),o=H({bufferRowCount:5,contentHeight:v,tableRows:r,rowHeight:p,scrollTop:g}),i=T(W,o).entering.map(function(e){var n=String(b({row:e.row,rowIdAccessor:d}));return F.find(function(e){return String(b({row:e.row,rowIdAccessor:d}))===n})||e}).filter(Boolean);i.length>0&&j(s(s([],W,!0),i,!0))}},[t,c,m,A,v,p,g,T,F,W,d]),O=n.useCallback(function(e){if(t&&!c){var n=w(e),r=A(n),o=H({bufferRowCount:5,contentHeight:v,tableRows:r,rowHeight:p,scrollTop:g}),i=T(W,o).entering.map(function(e){var n=String(b({row:e.row,rowIdAccessor:d}));return F.find(function(e){return String(b({row:e.row,rowIdAccessor:d}))===n})||e}).filter(Boolean);i.length>0&&j(s(s([],W,!0),i,!0))}},[t,c,w,A,v,p,g,T,F,W,d]);return{currentTableRows:F,currentVisibleRows:W,isAnimating:y,prepareForFilterChange:B,prepareForSortChange:O,rowsToRender:L}}({allowAnimations:c,sortedRows:Mt,originalRows:bt,currentPage:En,rowsPerPage:Le,shouldPaginate:Ye,rowGrouping:Ne,rowIdAccessor:Ae,unexpandedRows:at,expandAll:V,contentHeight:yt,rowHeight:Me,scrollTop:rt,computeFilteredRowsPreview:kt,computeSortedRowsPreview:Nt.computeSortedRowsPreview}),Wt=Ft.currentTableRows,Tt=Ft.rowsToRender,Dt=Ft.prepareForFilterChange,Lt=Ft.prepareForSortChange,Bt=Ft.isAnimating,Ot=n.useRef(new Map),Pt=n.useRef(new Map),qt=function(e){var t=e.selectableCells,r=e.headers,o=e.tableRows,s=e.rowIdAccessor,l=e.onCellEdit,c=e.cellRegistry,u=e.collapsedHeaders,d=n.useState(new Set),f=d[0],h=d[1],v=n.useState(new Set),p=v[0],m=v[1],w=n.useState(null),x=w[0],y=w[1],C=n.useState(null),R=C[0],I=C[1],j=n.useState(new Set),E=j[0],k=j[1],N=n.useState(new Set),H=N[0],M=N[1],A=n.useRef(!1),F=n.useRef(null),W=n.useMemo(function(){var e=new Set;return f.forEach(function(n){var t=n.split("-");if(t.length>=2){var r=parseInt(t[1],10);isNaN(r)||e.add(r)}}),p.forEach(function(n){e.add(n)}),e},[f,p]),T=n.useMemo(function(){var e=new Set;return f.forEach(function(n){var t=n.split("-");if(t.length>=3){var r=t.slice(2).join("-");e.add(r)}}),p.size>0&&o.forEach(function(n){var t=b({row:n.row,rowIdAccessor:s});e.add(String(t))}),e},[f,p,o,s]),D=n.useMemo(function(){return r.flatMap(function(e){return g(e,u)})},[r,u]),L=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(f).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");f.size>0&&(navigator.clipboard.writeText(r),k(new Set(f)),setTimeout(function(){k(new Set)},800))},[D,f,o]),B=n.useCallback(function(){return i(void 0,void 0,void 0,function(){var e,n,t,r,i,u,d,f;return a(this,function(a){switch(a.label){case 0:if(!R)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=R.rowIndex,d=R.colIndex,n.forEach(function(e,n){e.split("\t").forEach(function(e,a){var f=u+n,h=d+a;if(!(f>=o.length||h>=t.length)){var v=o[f],p=t[h],g=b({row:v.row,rowIdAccessor:s});if(null==p?void 0:p.isEditable){var m=e;if("number"===p.type){var w=Number(e);isNaN(w)||(m=w)}else if("boolean"===p.type)m="true"===e.toLowerCase()||"1"===e;else if("date"===p.type){var x=new Date(e);isNaN(x.getTime())||(m=x)}if(v.row[p.accessor]=m,c){var y="".concat(g,"-").concat(p.accessor),C=c.get(y);C&&C.updateContent(m)}null==l||l({accessor:p.accessor,newValue:m,row:v.row,rowIndex:f});var R=S({colIndex:h,rowIndex:f,rowId:g});r.add(R)}else{var I=S({colIndex:h,rowIndex:f,rowId:g});i.add(I)}}})}),r.size>0&&(k(r),setTimeout(function(){k(new Set)},800)),i.size>0&&(M(i),setTimeout(function(){M(new Set)},800)),[3,4]):[2];case 3:return f=a.sent(),console.warn("Failed to paste from clipboard:",f),[3,4];case 4:return[2]}})})},[R,D,o,s,l,c]),O=n.useCallback(function(){if(0!==f.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(f).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],f=e[u],h=b({row:d.row,rowIdAccessor:s});if(null==f?void 0:f.isEditable){var v=null;if(v="string"===f.type?"":"number"===f.type?null:"boolean"!==f.type&&("date"===f.type?null:Array.isArray(d.row[f.accessor])?[]:""),d.row[f.accessor]=v,c){var p="".concat(h,"-").concat(f.accessor),g=c.get(p);g&&g.updateContent(v)}null==l||l({accessor:f.accessor,newValue:v,row:d.row,rowIndex:a}),t.add(n)}else r.add(n)}}),t.size>0&&(k(t),setTimeout(function(){k(new Set)},800)),r.size>0&&(M(r),setTimeout(function(){M(new Set)},800))}},[f,D,o,s,l,c]),P=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=b({row:o[c].row,rowIdAccessor:s});t.add(S({colIndex:u,rowIndex:c,rowId:d}))}m(new Set),y(null),h(t)},[o,s,m,y,h]),q=n.useCallback(function(e){if(e.rowIndex>=0&&e.rowIndex<o.length&&e.colIndex>=0&&e.colIndex<D.length){var n=S(e);m(new Set),y(null),h(new Set([n])),I(e)}},[D.length,o.length,m,y,h,I]),z=n.useCallback(function(e,n){void 0===n&&(n=!1),h(new Set),I(null),m(function(t){var r=new Set(n?t:[]);return e.forEach(function(e){return r.add(e)}),r}),e.length>0&&y(e[e.length-1])},[h,I,m,y]);n.useEffect(function(){var e=function(e){var n;if(t&&R){var r=R.rowIndex,i=R.colIndex,a=R.rowId;if(!e.ctrlKey&&!e.metaKey||"c"!==e.key){if((e.ctrlKey||e.metaKey)&&"v"===e.key)return e.preventDefault(),void B();if("Delete"===e.key||"Backspace"===e.key)return e.preventDefault(),void O();if(b({row:null===(n=o[r])||void 0===n?void 0:n.row,rowIdAccessor:s})!==a){var l=o.findIndex(function(e,n){return b({row:e.row,rowIdAccessor:s})===a});if(-1===l)return;r=l}if("ArrowUp"===e.key){if(e.preventDefault(),r>0){var c=b({row:o[r-1].row,rowIdAccessor:s});q({rowIndex:r-1,colIndex:i,rowId:c})}}else"ArrowDown"===e.key?(e.preventDefault(),r<o.length-1&&(c=b({row:o[r+1].row,rowIdAccessor:s}),q({rowIndex:r+1,colIndex:i,rowId:c}))):"ArrowLeft"===e.key||"Tab"===e.key&&e.shiftKey?(e.preventDefault(),i>0&&(c=b({row:o[r].row,rowIdAccessor:s}),q({rowIndex:r,colIndex:i-1,rowId:c}))):"ArrowRight"===e.key||"Tab"===e.key?(e.preventDefault(),i<D.length-1&&(c=b({row:o[r].row,rowIdAccessor:s}),q({rowIndex:r,colIndex:i+1,rowId:c}))):"Escape"===e.key&&(h(new Set),m(new Set),y(null),F.current=null,I(null))}else L()}};return document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}},[L,D.length,R,s,P,q,t,o,B,O]);var Y=n.useCallback(function(e){var n=e.colIndex,t=e.rowIndex,r=e.rowId,o=S({colIndex:n,rowIndex:t,rowId:r}),i=f.has(o),a=p.has(n);return i||a},[f,p]),G=n.useCallback(function(e){var n=e.colIndex,t=e.rowIndex,r=e.rowId,i=[],a=o[t-1]?b({row:o[t-1].row,rowIdAccessor:s}):null,l=o[t+1]?b({row:o[t+1].row,rowIdAccessor: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},f={colIndex:n+1,rowIndex:t,rowId:r};return(!c||!Y(c)||p.has(n)&&0===t)&&i.push("st-selected-top-border"),(!u||!Y(u)||p.has(n)&&t===o.length-1)&&i.push("st-selected-bottom-border"),Y(d)||i.push("st-selected-left-border"),Y(f)||i.push("st-selected-right-border"),i.join(" ")},[Y,o,p,s]),U=n.useMemo(function(){return R?function(e){var n=e.rowIndex,t=e.colIndex,r=e.rowId;return n===R.rowIndex&&t===R.colIndex&&r===R.rowId}:function(){return!1}},[R]),V=n.useCallback(function(e){var n=e.colIndex,t=e.rowIndex,r=e.rowId,o=S({colIndex:n,rowIndex:t,rowId:r});return E.has(o)},[E]),K=n.useCallback(function(e){var n=e.colIndex,t=e.rowIndex,r=e.rowId,o=S({colIndex:n,rowIndex:t,rowId:r});return H.has(o)},[H]);return{getBorderClass:G,handleMouseDown:function(e){var n=e.colIndex,r=e.rowIndex,o=e.rowId;t&&(A.current=!0,F.current={rowIndex:r,colIndex:n,rowId:o},setTimeout(function(){m(new Set),y(null);var e=S({colIndex:n,rowIndex:r,rowId:o});h(new Set([e])),I({rowIndex:r,colIndex:n,rowId:o})},0))},handleMouseOver:function(e){var n=e.colIndex,r=e.rowIndex;if(e.rowId,t&&A.current&&F.current){for(var i=new Set,a=Math.min(F.current.rowIndex,r),l=Math.max(F.current.rowIndex,r),c=Math.min(F.current.colIndex,n),u=Math.max(F.current.colIndex,n),d=a;d<=l;d++)for(var f=c;f<=u;f++)if(d>=0&&d<o.length){var v=b({row:o[d].row,rowIdAccessor:s});i.add(S({colIndex:f,rowIndex:d,rowId:v}))}h(i)}},handleMouseUp:function(){A.current=!1},isCopyFlashing:V,isWarningFlashing:K,isInitialFocusedCell:U,isSelected:Y,lastSelectedColumnIndex:x,pasteFromClipboard:B,selectColumns:z,selectedCells:f,selectedColumns:p,setInitialFocusedCell:I,setSelectedCells:h,setSelectedColumns:m,deleteSelectedCells:O,columnsWithSelectedCells:W,rowsWithSelectedCells:T}}({selectableCells:Oe,headers:Hn,tableRows:Wt,rowIdAccessor:Ae,onCellEdit:pe,cellRegistry:Ot.current,collapsedHeaders:zn}),zt=qt.getBorderClass,Yt=qt.handleMouseDown,Gt=qt.handleMouseOver,Ut=qt.handleMouseUp,Vt=qt.isCopyFlashing,Kt=qt.isInitialFocusedCell,Jt=qt.isSelected,Xt=qt.isWarningFlashing,_t=qt.selectColumns,$t=qt.selectedCells,Qt=qt.selectedColumns,Zt=qt.setInitialFocusedCell,er=qt.setSelectedCells,nr=qt.setSelectedColumns,tr=qt.columnsWithSelectedCells,rr=qt.rowsWithSelectedCells,or=n.useCallback(function(e){Lt(e),setTimeout(function(){At(e)},0)},[Lt,At]),ir=n.useCallback(function(e){Mn(e)},[]);!function(e){var t=e.selectableColumns,r=e.selectedCells,o=e.selectedColumns,i=e.setSelectedCells,a=e.setSelectedColumns,s=e.activeHeaderDropdown,l=e.setActiveHeaderDropdown;n.useEffect(function(){var e=function(e){var n=e.target;n.closest(".editable-cell-input")&&n.closest(".st-header-cell")||(s&&l&&(n.closest(".st-header-cell")||n.closest(".dropdown-content")||l(null)),n.closest(".st-cell")||t&&(n.classList.contains("st-header-cell")||n.classList.contains("st-header-label")||n.classList.contains("st-header-label-text"))||(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,s,l])}({selectableColumns:qe,selectedCells:$t,selectedColumns:Qt,setSelectedCells:er,setSelectedColumns:nr,activeHeaderDropdown:On,setActiveHeaderDropdown:Pn}),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:ln,tableBodyContainerRef:Rn,setScrollbarWidth:ut}),function(e){var t=e.onGridReady;n.useEffect(function(){null==t||t()},[t])}({onGridReady:ye}),function(e){var t=e.cellRegistryRef,r=e.currentTableRows,o=e.headerRegistryRef,i=e.headers,a=e.rowIdAccessor,s=e.rows,l=e.tableRef,c=e.visibleRows;n.useEffect(function(){l&&(l.current={updateData:function(e){var n=e.accessor,r=e.rowIndex,o=e.newValue,i=null==s?void 0:s[r];if(i){var l=b({row:i,rowIdAccessor:a}),c=p({rowId:l,accessor:n}),u=t.current.get(c);u&&u.updateContent(o),void 0!==i[n]&&(i[n]=o)}},setHeaderRename:function(e){var n=e.accessor,t=o.current.get(String(n));t&&t.setEditing(!0)},getVisibleRows:function(){return c},exportToCSV:function(e){var n=(void 0===e?{}:e).filename;bn(r,i,n)}})},[t,r,o,i,a,s,l,c])}({cellRegistryRef:Ot,currentTableRows:Wt,headerRegistryRef:Pt,headers:nt,rowIdAccessor:Ae,rows:Fe,tableRef:Je,visibleRows:Tt}),function(e){var t=e.filters,r=e.onFilterChange;n.useEffect(function(){null==r||r(t)},[t,r])}({filters:St,onFilterChange:xe}),function(e){var t=e.sort,r=e.onSortChange,o=J(t);n.useEffect(function(){!t||(null==o?void 0:o.key.accessor)===t.key.accessor&&(null==o?void 0:o.direction)===t.direction?!t&&o&&(null==r||r(null)):null==r||r(t)},[t,o,r])}({sort:Ht,onSortChange:Ie});var ar=n.useCallback(function(e){Dt(e),setTimeout(function(){It(e)},0)},[Dt,It]);return e.jsx(I,o({value:{allowAnimations:c,areAllRowsSelected:Jn,cellRegistry:Ot.current,cellUpdateFlash:f,clearSelection:et,collapsedHeaders:zn,columnBorders:w,columnReordering:F,columnResizing:T,draggedHeaderRef:cn,editColumns:B,enableHeaderEditing:z,enableRowSelection:G,expandIcon:X,filterIcon:ne,filters:St,forceUpdate:ln,getBorderClass:zt,handleApplyFilter:ar,handleClearAllFilters:Et,handleClearFilter:jt,handleMouseDown:Yt,handleMouseOver:Gt,handleRowSelect:$n,handleSelectAll:Qn,handleToggleRow:Zn,headerCollapseIcon:oe,headerContainerRef:In,headerDropdown:le,headerExpandIcon:se,headerRegistry:Pt.current,headers:nt,hoveredHeaderRef:pn,isAnimating:Bt,isCopyFlashing:Vt,isInitialFocusedCell:Kt,isResizing:Fn,isRowSelected:Kn,isScrolling:Dn,isSelected:Jt,isWarningFlashing:Xt,mainBodyRef:xn,nextIcon:ve,onCellEdit:pe,onCellClick:ge,onColumnOrderChange:me,onColumnSelect:we,onLoadMore:Ce,onSort:or,onTableHeaderDragEnd:ir,pinnedLeftRef:yn,pinnedRightRef:Sn,prevIcon:Ee,rowButtons:ke,rowGrouping:Ne,rowHeight:Me,headerHeight:null!=ce?ce:Me,rowIdAccessor:Ae,scrollbarWidth:ct,selectColumns:_t,selectableColumns:qe,selectedColumns:Qt,columnsWithSelectedCells:tr,rowsWithSelectedCells:rr,selectedRows:Un,selectedRowCount:Xn,selectedRowsData:_n,setCollapsedHeaders:Yn,setHeaders:Mn,setInitialFocusedCell:Zt,setIsResizing:Wn,setIsScrolling:Ln,setSelectedCells:er,setSelectedColumns:nr,setSelectedRows:Vn,setUnexpandedRows:st,shouldPaginate:Ye,sortDownIcon:Ue,sortUpIcon:Ke,tableBodyContainerRef:Rn,tableRows:Wt,theme:_e,unexpandedRows:at,useHoverRowBackground:en,useOddColumnBackground:sn,useOddEvenRowBackground:on,activeHeaderDropdown:On,setActiveHeaderDropdown:Pn,onHeaderEdit:be}},{children:e.jsx("div",o({className:"simple-table-root st-wrapper theme-".concat(_e," ").concat(null!=h?h:""," ").concat(w?"st-column-borders":""),style:ue?{height:ue}:{}},{children:e.jsx(vn,{children:e.jsxs("div",o({className:"st-wrapper-container"},{children:[e.jsx(gn,{}),e.jsxs("div",o({className:"st-content-wrapper",onMouseUp:Ut,onMouseLeave:Ut},{children:[e.jsx(Qe,{pinnedLeftWidth:gt,pinnedRightWidth:mt,setScrollTop:ot,sort:Ht,tableRows:Wt,rowsToRender:Tt}),e.jsx(un,{columnEditorText:M,editColumns:B,editColumnsInitOpen:P,headers:Hn,position:R})]})),e.jsx(Ze,{mainBodyRef:xn,mainBodyWidth:pt,pinnedLeftWidth:gt,pinnedRightWidth:mt,pinnedLeftContentWidth:wt,pinnedRightContentWidth:xt,tableBodyContainerRef:Rn}),e.jsx(E,{currentPage:En,footerRenderer:te,hideFooter:fe,onPageChange:kn,onNextPage:Se,rowsPerPage:Le,shouldPaginate:Ye,totalPages:Math.ceil(Mt.length/Le),totalRows:Mt.length})]}))})}))}))};exports.SimpleTable=function(t){var r=n.useState(!1),i=r[0],a=r[1];return n.useEffect(function(){a(!0)},[]),i?e.jsx(Sn,o({},t)):null};
2
2
  //# sourceMappingURL=index.js.map