import{j as S}from"./query-PJ0ZdjbV.js";import{a as P}from"./vendor-CWhr2lg4.js";import{a2 as Ie,s as De,t as Ee,v as He,w as ze,x as Ge,B as oe,z as Ae,ar as Le,ap as we,aT as je,ag as Oe,ah as Ne,ai as ke,cx as Te,ak as Be,cy as qe,G as Ue,H as Ke,J as U,K as Xe,O as Je,a1 as ie,aq as Qe,b as me}from"./index-BSPIaiZU.js";import{C as We}from"./chevron-left-DLFf1YD2.js";/**
 * @license lucide-react v0.469.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ye=Ie("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]);/**
   * table-core
   *
   * Copyright (c) TanStack
   *
   * This source code is licensed under the MIT license found in the
   * LICENSE.md file in the root directory of this source tree.
   *
   * @license MIT
   */function z(e,o){return typeof e=="function"?e(o):e}function V(e,o){return t=>{o.setState(n=>({...n,[e]:z(t,n[e])}))}}function K(e){return e instanceof Function}function Ze(e){return Array.isArray(e)&&e.every(o=>typeof o=="number")}function be(e,o){const t=[],n=i=>{i.forEach(r=>{t.push(r);const l=o(r);l!=null&&l.length&&n(l)})};return n(e),t}function h(e,o,t){let n=[],i;return r=>{let l;t.key&&t.debug&&(l=Date.now());const s=e(r);if(!(s.length!==n.length||s.some((c,m)=>n[m]!==c)))return i;n=s;let g;if(t.key&&t.debug&&(g=Date.now()),i=o(...s),t==null||t.onChange==null||t.onChange(i),t.key&&t.debug&&t!=null&&t.debug()){const c=Math.round((Date.now()-l)*100)/100,m=Math.round((Date.now()-g)*100)/100,d=m/16,u=(f,p)=>{for(f=String(f);f.length<p;)f=" "+f;return f};console.info(`%c⏱ ${u(m,5)} /${u(c,5)} ms`,`
            font-size: .6rem;
            font-weight: bold;
            color: hsl(${Math.max(0,Math.min(120-120*d,120))}deg 100% 31%);`,t==null?void 0:t.key)}return i}}function C(e,o,t,n){return{debug:()=>{var i;return(i=e==null?void 0:e.debugAll)!=null?i:e[o]},key:!1,onChange:n}}function et(e,o,t,n){const i=()=>{var l;return(l=r.getValue())!=null?l:e.options.renderFallbackValue},r={id:`${o.id}_${t.id}`,row:o,column:t,getValue:()=>o.getValue(n),renderValue:i,getContext:h(()=>[e,t,o,r],(l,s,a,g)=>({table:l,column:s,row:a,cell:g,getValue:g.getValue,renderValue:g.renderValue}),C(e.options,"debugCells"))};return e._features.forEach(l=>{l.createCell==null||l.createCell(r,t,o,e)},{}),r}function tt(e,o,t,n){var i,r;const s={...e._getDefaultColumnDef(),...o},a=s.accessorKey;let g=(i=(r=s.id)!=null?r:a?typeof String.prototype.replaceAll=="function"?a.replaceAll(".","_"):a.replace(/\./g,"_"):void 0)!=null?i:typeof s.header=="string"?s.header:void 0,c;if(s.accessorFn?c=s.accessorFn:a&&(a.includes(".")?c=d=>{let u=d;for(const p of a.split(".")){var f;u=(f=u)==null?void 0:f[p]}return u}:c=d=>d[s.accessorKey]),!g)throw new Error;let m={id:`${String(g)}`,accessorFn:c,parent:n,depth:t,columnDef:s,columns:[],getFlatColumns:h(()=>[!0],()=>{var d;return[m,...(d=m.columns)==null?void 0:d.flatMap(u=>u.getFlatColumns())]},C(e.options,"debugColumns")),getLeafColumns:h(()=>[e._getOrderColumnsFn()],d=>{var u;if((u=m.columns)!=null&&u.length){let f=m.columns.flatMap(p=>p.getLeafColumns());return d(f)}return[m]},C(e.options,"debugColumns"))};for(const d of e._features)d.createColumn==null||d.createColumn(m,e);return m}const F="debugHeaders";function Se(e,o,t){var n;let r={id:(n=t.id)!=null?n:o.id,column:o,index:t.index,isPlaceholder:!!t.isPlaceholder,placeholderId:t.placeholderId,depth:t.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const l=[],s=a=>{a.subHeaders&&a.subHeaders.length&&a.subHeaders.map(s),l.push(a)};return s(r),l},getContext:()=>({table:e,header:r,column:o})};return e._features.forEach(l=>{l.createHeader==null||l.createHeader(r,e)}),r}const nt={createTable:e=>{e.getHeaderGroups=h(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(o,t,n,i)=>{var r,l;const s=(r=n==null?void 0:n.map(m=>t.find(d=>d.id===m)).filter(Boolean))!=null?r:[],a=(l=i==null?void 0:i.map(m=>t.find(d=>d.id===m)).filter(Boolean))!=null?l:[],g=t.filter(m=>!(n!=null&&n.includes(m.id))&&!(i!=null&&i.includes(m.id)));return T(o,[...s,...g,...a],e)},C(e.options,F)),e.getCenterHeaderGroups=h(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(o,t,n,i)=>(t=t.filter(r=>!(n!=null&&n.includes(r.id))&&!(i!=null&&i.includes(r.id))),T(o,t,e,"center")),C(e.options,F)),e.getLeftHeaderGroups=h(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(o,t,n)=>{var i;const r=(i=n==null?void 0:n.map(l=>t.find(s=>s.id===l)).filter(Boolean))!=null?i:[];return T(o,r,e,"left")},C(e.options,F)),e.getRightHeaderGroups=h(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(o,t,n)=>{var i;const r=(i=n==null?void 0:n.map(l=>t.find(s=>s.id===l)).filter(Boolean))!=null?i:[];return T(o,r,e,"right")},C(e.options,F)),e.getFooterGroups=h(()=>[e.getHeaderGroups()],o=>[...o].reverse(),C(e.options,F)),e.getLeftFooterGroups=h(()=>[e.getLeftHeaderGroups()],o=>[...o].reverse(),C(e.options,F)),e.getCenterFooterGroups=h(()=>[e.getCenterHeaderGroups()],o=>[...o].reverse(),C(e.options,F)),e.getRightFooterGroups=h(()=>[e.getRightHeaderGroups()],o=>[...o].reverse(),C(e.options,F)),e.getFlatHeaders=h(()=>[e.getHeaderGroups()],o=>o.map(t=>t.headers).flat(),C(e.options,F)),e.getLeftFlatHeaders=h(()=>[e.getLeftHeaderGroups()],o=>o.map(t=>t.headers).flat(),C(e.options,F)),e.getCenterFlatHeaders=h(()=>[e.getCenterHeaderGroups()],o=>o.map(t=>t.headers).flat(),C(e.options,F)),e.getRightFlatHeaders=h(()=>[e.getRightHeaderGroups()],o=>o.map(t=>t.headers).flat(),C(e.options,F)),e.getCenterLeafHeaders=h(()=>[e.getCenterFlatHeaders()],o=>o.filter(t=>{var n;return!((n=t.subHeaders)!=null&&n.length)}),C(e.options,F)),e.getLeftLeafHeaders=h(()=>[e.getLeftFlatHeaders()],o=>o.filter(t=>{var n;return!((n=t.subHeaders)!=null&&n.length)}),C(e.options,F)),e.getRightLeafHeaders=h(()=>[e.getRightFlatHeaders()],o=>o.filter(t=>{var n;return!((n=t.subHeaders)!=null&&n.length)}),C(e.options,F)),e.getLeafHeaders=h(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(o,t,n)=>{var i,r,l,s,a,g;return[...(i=(r=o[0])==null?void 0:r.headers)!=null?i:[],...(l=(s=t[0])==null?void 0:s.headers)!=null?l:[],...(a=(g=n[0])==null?void 0:g.headers)!=null?a:[]].map(c=>c.getLeafHeaders()).flat()},C(e.options,F))}};function T(e,o,t,n){var i,r;let l=0;const s=function(d,u){u===void 0&&(u=1),l=Math.max(l,u),d.filter(f=>f.getIsVisible()).forEach(f=>{var p;(p=f.columns)!=null&&p.length&&s(f.columns,u+1)},0)};s(e);let a=[];const g=(d,u)=>{const f={depth:u,id:[n,`${u}`].filter(Boolean).join("_"),headers:[]},p=[];d.forEach(w=>{const R=[...p].reverse()[0],v=w.column.depth===f.depth;let x,M=!1;if(v&&w.column.parent?x=w.column.parent:(x=w.column,M=!0),R&&(R==null?void 0:R.column)===x)R.subHeaders.push(w);else{const $=Se(t,x,{id:[n,u,x.id,w==null?void 0:w.id].filter(Boolean).join("_"),isPlaceholder:M,placeholderId:M?`${p.filter(H=>H.column===x).length}`:void 0,depth:u,index:p.length});$.subHeaders.push(w),p.push($)}f.headers.push(w),w.headerGroup=f}),a.push(f),u>0&&g(p,u-1)},c=o.map((d,u)=>Se(t,d,{depth:l,index:u}));g(c,l-1),a.reverse();const m=d=>d.filter(f=>f.column.getIsVisible()).map(f=>{let p=0,w=0,R=[0];f.subHeaders&&f.subHeaders.length?(R=[],m(f.subHeaders).forEach(x=>{let{colSpan:M,rowSpan:$}=x;p+=M,R.push($)})):p=1;const v=Math.min(...R);return w=w+v,f.colSpan=p,f.rowSpan=w,{colSpan:p,rowSpan:w}});return m((i=(r=a[0])==null?void 0:r.headers)!=null?i:[]),a}const ge=(e,o,t,n,i,r,l)=>{let s={id:o,index:n,original:t,depth:i,parentId:l,_valuesCache:{},_uniqueValuesCache:{},getValue:a=>{if(s._valuesCache.hasOwnProperty(a))return s._valuesCache[a];const g=e.getColumn(a);if(g!=null&&g.accessorFn)return s._valuesCache[a]=g.accessorFn(s.original,n),s._valuesCache[a]},getUniqueValues:a=>{if(s._uniqueValuesCache.hasOwnProperty(a))return s._uniqueValuesCache[a];const g=e.getColumn(a);if(g!=null&&g.accessorFn)return g.columnDef.getUniqueValues?(s._uniqueValuesCache[a]=g.columnDef.getUniqueValues(s.original,n),s._uniqueValuesCache[a]):(s._uniqueValuesCache[a]=[s.getValue(a)],s._uniqueValuesCache[a])},renderValue:a=>{var g;return(g=s.getValue(a))!=null?g:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>be(s.subRows,a=>a.subRows),getParentRow:()=>s.parentId?e.getRow(s.parentId,!0):void 0,getParentRows:()=>{let a=[],g=s;for(;;){const c=g.getParentRow();if(!c)break;a.push(c),g=c}return a.reverse()},getAllCells:h(()=>[e.getAllLeafColumns()],a=>a.map(g=>et(e,s,g,g.id)),C(e.options,"debugRows")),_getAllCellsByColumnId:h(()=>[s.getAllCells()],a=>a.reduce((g,c)=>(g[c.column.id]=c,g),{}),C(e.options,"debugRows"))};for(let a=0;a<e._features.length;a++){const g=e._features[a];g==null||g.createRow==null||g.createRow(s,e)}return s},ot={createColumn:(e,o)=>{e._getFacetedRowModel=o.options.getFacetedRowModel&&o.options.getFacetedRowModel(o,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():o.getPreFilteredRowModel(),e._getFacetedUniqueValues=o.options.getFacetedUniqueValues&&o.options.getFacetedUniqueValues(o,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=o.options.getFacetedMinMaxValues&&o.options.getFacetedMinMaxValues(o,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},Re=(e,o,t)=>{var n,i;const r=t==null||(n=t.toString())==null?void 0:n.toLowerCase();return!!(!((i=e.getValue(o))==null||(i=i.toString())==null||(i=i.toLowerCase())==null)&&i.includes(r))};Re.autoRemove=e=>y(e);const ve=(e,o,t)=>{var n;return!!(!((n=e.getValue(o))==null||(n=n.toString())==null)&&n.includes(t))};ve.autoRemove=e=>y(e);const xe=(e,o,t)=>{var n;return((n=e.getValue(o))==null||(n=n.toString())==null?void 0:n.toLowerCase())===(t==null?void 0:t.toLowerCase())};xe.autoRemove=e=>y(e);const _e=(e,o,t)=>{var n;return(n=e.getValue(o))==null?void 0:n.includes(t)};_e.autoRemove=e=>y(e);const Fe=(e,o,t)=>!t.some(n=>{var i;return!((i=e.getValue(o))!=null&&i.includes(n))});Fe.autoRemove=e=>y(e)||!(e!=null&&e.length);const $e=(e,o,t)=>t.some(n=>{var i;return(i=e.getValue(o))==null?void 0:i.includes(n)});$e.autoRemove=e=>y(e)||!(e!=null&&e.length);const Me=(e,o,t)=>e.getValue(o)===t;Me.autoRemove=e=>y(e);const Ve=(e,o,t)=>e.getValue(o)==t;Ve.autoRemove=e=>y(e);const de=(e,o,t)=>{let[n,i]=t;const r=e.getValue(o);return r>=n&&r<=i};de.resolveFilterValue=e=>{let[o,t]=e,n=typeof o!="number"?parseFloat(o):o,i=typeof t!="number"?parseFloat(t):t,r=o===null||Number.isNaN(n)?-1/0:n,l=t===null||Number.isNaN(i)?1/0:i;if(r>l){const s=r;r=l,l=s}return[r,l]};de.autoRemove=e=>y(e)||y(e[0])&&y(e[1]);const E={includesString:Re,includesStringSensitive:ve,equalsString:xe,arrIncludes:_e,arrIncludesAll:Fe,arrIncludesSome:$e,equals:Me,weakEquals:Ve,inNumberRange:de};function y(e){return e==null||e===""}const it={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:V("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,o)=>{e.getAutoFilterFn=()=>{const t=o.getCoreRowModel().flatRows[0],n=t==null?void 0:t.getValue(e.id);return typeof n=="string"?E.includesString:typeof n=="number"?E.inNumberRange:typeof n=="boolean"||n!==null&&typeof n=="object"?E.equals:Array.isArray(n)?E.arrIncludes:E.weakEquals},e.getFilterFn=()=>{var t,n;return K(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(t=(n=o.options.filterFns)==null?void 0:n[e.columnDef.filterFn])!=null?t:E[e.columnDef.filterFn]},e.getCanFilter=()=>{var t,n,i;return((t=e.columnDef.enableColumnFilter)!=null?t:!0)&&((n=o.options.enableColumnFilters)!=null?n:!0)&&((i=o.options.enableFilters)!=null?i:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var t;return(t=o.getState().columnFilters)==null||(t=t.find(n=>n.id===e.id))==null?void 0:t.value},e.getFilterIndex=()=>{var t,n;return(t=(n=o.getState().columnFilters)==null?void 0:n.findIndex(i=>i.id===e.id))!=null?t:-1},e.setFilterValue=t=>{o.setColumnFilters(n=>{const i=e.getFilterFn(),r=n==null?void 0:n.find(c=>c.id===e.id),l=z(t,r?r.value:void 0);if(he(i,l,e)){var s;return(s=n==null?void 0:n.filter(c=>c.id!==e.id))!=null?s:[]}const a={id:e.id,value:l};if(r){var g;return(g=n==null?void 0:n.map(c=>c.id===e.id?a:c))!=null?g:[]}return n!=null&&n.length?[...n,a]:[a]})}},createRow:(e,o)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=o=>{const t=e.getAllLeafColumns(),n=i=>{var r;return(r=z(o,i))==null?void 0:r.filter(l=>{const s=t.find(a=>a.id===l.id);if(s){const a=s.getFilterFn();if(he(a,l.value,s))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(n)},e.resetColumnFilters=o=>{var t,n;e.setColumnFilters(o?[]:(t=(n=e.initialState)==null?void 0:n.columnFilters)!=null?t:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function he(e,o,t){return(e&&e.autoRemove?e.autoRemove(o,t):!1)||typeof o>"u"||typeof o=="string"&&!o}const rt=(e,o,t)=>t.reduce((n,i)=>{const r=i.getValue(e);return n+(typeof r=="number"?r:0)},0),lt=(e,o,t)=>{let n;return t.forEach(i=>{const r=i.getValue(e);r!=null&&(n>r||n===void 0&&r>=r)&&(n=r)}),n},st=(e,o,t)=>{let n;return t.forEach(i=>{const r=i.getValue(e);r!=null&&(n<r||n===void 0&&r>=r)&&(n=r)}),n},ut=(e,o,t)=>{let n,i;return t.forEach(r=>{const l=r.getValue(e);l!=null&&(n===void 0?l>=l&&(n=i=l):(n>l&&(n=l),i<l&&(i=l)))}),[n,i]},at=(e,o)=>{let t=0,n=0;if(o.forEach(i=>{let r=i.getValue(e);r!=null&&(r=+r)>=r&&(++t,n+=r)}),t)return n/t},gt=(e,o)=>{if(!o.length)return;const t=o.map(r=>r.getValue(e));if(!Ze(t))return;if(t.length===1)return t[0];const n=Math.floor(t.length/2),i=t.sort((r,l)=>r-l);return t.length%2!==0?i[n]:(i[n-1]+i[n])/2},dt=(e,o)=>Array.from(new Set(o.map(t=>t.getValue(e))).values()),ct=(e,o)=>new Set(o.map(t=>t.getValue(e))).size,ft=(e,o)=>o.length,W={sum:rt,min:lt,max:st,extent:ut,mean:at,median:gt,unique:dt,uniqueCount:ct,count:ft},pt={getDefaultColumnDef:()=>({aggregatedCell:e=>{var o,t;return(o=(t=e.getValue())==null||t.toString==null?void 0:t.toString())!=null?o:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:V("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,o)=>{e.toggleGrouping=()=>{o.setGrouping(t=>t!=null&&t.includes(e.id)?t.filter(n=>n!==e.id):[...t??[],e.id])},e.getCanGroup=()=>{var t,n;return((t=e.columnDef.enableGrouping)!=null?t:!0)&&((n=o.options.enableGrouping)!=null?n:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var t;return(t=o.getState().grouping)==null?void 0:t.includes(e.id)},e.getGroupedIndex=()=>{var t;return(t=o.getState().grouping)==null?void 0:t.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const t=o.getCoreRowModel().flatRows[0],n=t==null?void 0:t.getValue(e.id);if(typeof n=="number")return W.sum;if(Object.prototype.toString.call(n)==="[object Date]")return W.extent},e.getAggregationFn=()=>{var t,n;if(!e)throw new Error;return K(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(t=(n=o.options.aggregationFns)==null?void 0:n[e.columnDef.aggregationFn])!=null?t:W[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=o=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(o),e.resetGrouping=o=>{var t,n;e.setGrouping(o?[]:(t=(n=e.initialState)==null?void 0:n.grouping)!=null?t:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,o)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=t=>{if(e._groupingValuesCache.hasOwnProperty(t))return e._groupingValuesCache[t];const n=o.getColumn(t);return n!=null&&n.columnDef.getGroupingValue?(e._groupingValuesCache[t]=n.columnDef.getGroupingValue(e.original),e._groupingValuesCache[t]):e.getValue(t)},e._groupingValuesCache={}},createCell:(e,o,t,n)=>{e.getIsGrouped=()=>o.getIsGrouped()&&o.id===t.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&o.getIsGrouped(),e.getIsAggregated=()=>{var i;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((i=t.subRows)!=null&&i.length)}}};function mt(e,o,t){if(!(o!=null&&o.length)||!t)return e;const n=e.filter(r=>!o.includes(r.id));return t==="remove"?n:[...o.map(r=>e.find(l=>l.id===r)).filter(Boolean),...n]}const St={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:V("columnOrder",e)}),createColumn:(e,o)=>{e.getIndex=h(t=>[O(o,t)],t=>t.findIndex(n=>n.id===e.id),C(o.options,"debugColumns")),e.getIsFirstColumn=t=>{var n;return((n=O(o,t)[0])==null?void 0:n.id)===e.id},e.getIsLastColumn=t=>{var n;const i=O(o,t);return((n=i[i.length-1])==null?void 0:n.id)===e.id}},createTable:e=>{e.setColumnOrder=o=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(o),e.resetColumnOrder=o=>{var t;e.setColumnOrder(o?[]:(t=e.initialState.columnOrder)!=null?t:[])},e._getOrderColumnsFn=h(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(o,t,n)=>i=>{let r=[];if(!(o!=null&&o.length))r=i;else{const l=[...o],s=[...i];for(;s.length&&l.length;){const a=l.shift(),g=s.findIndex(c=>c.id===a);g>-1&&r.push(s.splice(g,1)[0])}r=[...r,...s]}return mt(r,t,n)},C(e.options,"debugTable"))}},Y=()=>({left:[],right:[]}),ht={getInitialState:e=>({columnPinning:Y(),...e}),getDefaultOptions:e=>({onColumnPinningChange:V("columnPinning",e)}),createColumn:(e,o)=>{e.pin=t=>{const n=e.getLeafColumns().map(i=>i.id).filter(Boolean);o.setColumnPinning(i=>{var r,l;if(t==="right"){var s,a;return{left:((s=i==null?void 0:i.left)!=null?s:[]).filter(m=>!(n!=null&&n.includes(m))),right:[...((a=i==null?void 0:i.right)!=null?a:[]).filter(m=>!(n!=null&&n.includes(m))),...n]}}if(t==="left"){var g,c;return{left:[...((g=i==null?void 0:i.left)!=null?g:[]).filter(m=>!(n!=null&&n.includes(m))),...n],right:((c=i==null?void 0:i.right)!=null?c:[]).filter(m=>!(n!=null&&n.includes(m)))}}return{left:((r=i==null?void 0:i.left)!=null?r:[]).filter(m=>!(n!=null&&n.includes(m))),right:((l=i==null?void 0:i.right)!=null?l:[]).filter(m=>!(n!=null&&n.includes(m)))}})},e.getCanPin=()=>e.getLeafColumns().some(n=>{var i,r,l;return((i=n.columnDef.enablePinning)!=null?i:!0)&&((r=(l=o.options.enableColumnPinning)!=null?l:o.options.enablePinning)!=null?r:!0)}),e.getIsPinned=()=>{const t=e.getLeafColumns().map(s=>s.id),{left:n,right:i}=o.getState().columnPinning,r=t.some(s=>n==null?void 0:n.includes(s)),l=t.some(s=>i==null?void 0:i.includes(s));return r?"left":l?"right":!1},e.getPinnedIndex=()=>{var t,n;const i=e.getIsPinned();return i?(t=(n=o.getState().columnPinning)==null||(n=n[i])==null?void 0:n.indexOf(e.id))!=null?t:-1:0}},createRow:(e,o)=>{e.getCenterVisibleCells=h(()=>[e._getAllVisibleCells(),o.getState().columnPinning.left,o.getState().columnPinning.right],(t,n,i)=>{const r=[...n??[],...i??[]];return t.filter(l=>!r.includes(l.column.id))},C(o.options,"debugRows")),e.getLeftVisibleCells=h(()=>[e._getAllVisibleCells(),o.getState().columnPinning.left],(t,n)=>(n??[]).map(r=>t.find(l=>l.column.id===r)).filter(Boolean).map(r=>({...r,position:"left"})),C(o.options,"debugRows")),e.getRightVisibleCells=h(()=>[e._getAllVisibleCells(),o.getState().columnPinning.right],(t,n)=>(n??[]).map(r=>t.find(l=>l.column.id===r)).filter(Boolean).map(r=>({...r,position:"right"})),C(o.options,"debugRows"))},createTable:e=>{e.setColumnPinning=o=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(o),e.resetColumnPinning=o=>{var t,n;return e.setColumnPinning(o?Y():(t=(n=e.initialState)==null?void 0:n.columnPinning)!=null?t:Y())},e.getIsSomeColumnsPinned=o=>{var t;const n=e.getState().columnPinning;if(!o){var i,r;return!!((i=n.left)!=null&&i.length||(r=n.right)!=null&&r.length)}return!!((t=n[o])!=null&&t.length)},e.getLeftLeafColumns=h(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(o,t)=>(t??[]).map(n=>o.find(i=>i.id===n)).filter(Boolean),C(e.options,"debugColumns")),e.getRightLeafColumns=h(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(o,t)=>(t??[]).map(n=>o.find(i=>i.id===n)).filter(Boolean),C(e.options,"debugColumns")),e.getCenterLeafColumns=h(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(o,t,n)=>{const i=[...t??[],...n??[]];return o.filter(r=>!i.includes(r.id))},C(e.options,"debugColumns"))}};function Ct(e){return e||(typeof document<"u"?document:null)}const B={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Z=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),wt={getDefaultColumnDef:()=>B,getInitialState:e=>({columnSizing:{},columnSizingInfo:Z(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:V("columnSizing",e),onColumnSizingInfoChange:V("columnSizingInfo",e)}),createColumn:(e,o)=>{e.getSize=()=>{var t,n,i;const r=o.getState().columnSizing[e.id];return Math.min(Math.max((t=e.columnDef.minSize)!=null?t:B.minSize,(n=r??e.columnDef.size)!=null?n:B.size),(i=e.columnDef.maxSize)!=null?i:B.maxSize)},e.getStart=h(t=>[t,O(o,t),o.getState().columnSizing],(t,n)=>n.slice(0,e.getIndex(t)).reduce((i,r)=>i+r.getSize(),0),C(o.options,"debugColumns")),e.getAfter=h(t=>[t,O(o,t),o.getState().columnSizing],(t,n)=>n.slice(e.getIndex(t)+1).reduce((i,r)=>i+r.getSize(),0),C(o.options,"debugColumns")),e.resetSize=()=>{o.setColumnSizing(t=>{let{[e.id]:n,...i}=t;return i})},e.getCanResize=()=>{var t,n;return((t=e.columnDef.enableResizing)!=null?t:!0)&&((n=o.options.enableColumnResizing)!=null?n:!0)},e.getIsResizing=()=>o.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,o)=>{e.getSize=()=>{let t=0;const n=i=>{if(i.subHeaders.length)i.subHeaders.forEach(n);else{var r;t+=(r=i.column.getSize())!=null?r:0}};return n(e),t},e.getStart=()=>{if(e.index>0){const t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=t=>{const n=o.getColumn(e.column.id),i=n==null?void 0:n.getCanResize();return r=>{if(!n||!i||(r.persist==null||r.persist(),b(r)&&r.touches&&r.touches.length>1))return;const l=e.getSize(),s=e?e.getLeafHeaders().map(R=>[R.column.id,R.column.getSize()]):[[n.id,n.getSize()]],a=b(r)?Math.round(r.touches[0].clientX):r.clientX,g={},c=(R,v)=>{typeof v=="number"&&(o.setColumnSizingInfo(x=>{var M,$;const H=o.options.columnResizeDirection==="rtl"?-1:1,A=(v-((M=x==null?void 0:x.startOffset)!=null?M:0))*H,N=Math.max(A/(($=x==null?void 0:x.startSize)!=null?$:0),-.999999);return x.columnSizingStart.forEach(X=>{let[J,k]=X;g[J]=Math.round(Math.max(k+k*N,0)*100)/100}),{...x,deltaOffset:A,deltaPercentage:N}}),(o.options.columnResizeMode==="onChange"||R==="end")&&o.setColumnSizing(x=>({...x,...g})))},m=R=>c("move",R),d=R=>{c("end",R),o.setColumnSizingInfo(v=>({...v,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},u=Ct(t),f={moveHandler:R=>m(R.clientX),upHandler:R=>{u==null||u.removeEventListener("mousemove",f.moveHandler),u==null||u.removeEventListener("mouseup",f.upHandler),d(R.clientX)}},p={moveHandler:R=>(R.cancelable&&(R.preventDefault(),R.stopPropagation()),m(R.touches[0].clientX),!1),upHandler:R=>{var v;u==null||u.removeEventListener("touchmove",p.moveHandler),u==null||u.removeEventListener("touchend",p.upHandler),R.cancelable&&(R.preventDefault(),R.stopPropagation()),d((v=R.touches[0])==null?void 0:v.clientX)}},w=Rt()?{passive:!1}:!1;b(r)?(u==null||u.addEventListener("touchmove",p.moveHandler,w),u==null||u.addEventListener("touchend",p.upHandler,w)):(u==null||u.addEventListener("mousemove",f.moveHandler,w),u==null||u.addEventListener("mouseup",f.upHandler,w)),o.setColumnSizingInfo(R=>({...R,startOffset:a,startSize:l,deltaOffset:0,deltaPercentage:0,columnSizingStart:s,isResizingColumn:n.id}))}}},createTable:e=>{e.setColumnSizing=o=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(o),e.setColumnSizingInfo=o=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(o),e.resetColumnSizing=o=>{var t;e.setColumnSizing(o?{}:(t=e.initialState.columnSizing)!=null?t:{})},e.resetHeaderSizeInfo=o=>{var t;e.setColumnSizingInfo(o?Z():(t=e.initialState.columnSizingInfo)!=null?t:Z())},e.getTotalSize=()=>{var o,t;return(o=(t=e.getHeaderGroups()[0])==null?void 0:t.headers.reduce((n,i)=>n+i.getSize(),0))!=null?o:0},e.getLeftTotalSize=()=>{var o,t;return(o=(t=e.getLeftHeaderGroups()[0])==null?void 0:t.headers.reduce((n,i)=>n+i.getSize(),0))!=null?o:0},e.getCenterTotalSize=()=>{var o,t;return(o=(t=e.getCenterHeaderGroups()[0])==null?void 0:t.headers.reduce((n,i)=>n+i.getSize(),0))!=null?o:0},e.getRightTotalSize=()=>{var o,t;return(o=(t=e.getRightHeaderGroups()[0])==null?void 0:t.headers.reduce((n,i)=>n+i.getSize(),0))!=null?o:0}}};let q=null;function Rt(){if(typeof q=="boolean")return q;let e=!1;try{const o={get passive(){return e=!0,!1}},t=()=>{};window.addEventListener("test",t,o),window.removeEventListener("test",t)}catch{e=!1}return q=e,q}function b(e){return e.type==="touchstart"}const vt={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:V("columnVisibility",e)}),createColumn:(e,o)=>{e.toggleVisibility=t=>{e.getCanHide()&&o.setColumnVisibility(n=>({...n,[e.id]:t??!e.getIsVisible()}))},e.getIsVisible=()=>{var t,n;const i=e.columns;return(t=i.length?i.some(r=>r.getIsVisible()):(n=o.getState().columnVisibility)==null?void 0:n[e.id])!=null?t:!0},e.getCanHide=()=>{var t,n;return((t=e.columnDef.enableHiding)!=null?t:!0)&&((n=o.options.enableHiding)!=null?n:!0)},e.getToggleVisibilityHandler=()=>t=>{e.toggleVisibility==null||e.toggleVisibility(t.target.checked)}},createRow:(e,o)=>{e._getAllVisibleCells=h(()=>[e.getAllCells(),o.getState().columnVisibility],t=>t.filter(n=>n.column.getIsVisible()),C(o.options,"debugRows")),e.getVisibleCells=h(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(t,n,i)=>[...t,...n,...i],C(o.options,"debugRows"))},createTable:e=>{const o=(t,n)=>h(()=>[n(),n().filter(i=>i.getIsVisible()).map(i=>i.id).join("_")],i=>i.filter(r=>r.getIsVisible==null?void 0:r.getIsVisible()),C(e.options,"debugColumns"));e.getVisibleFlatColumns=o("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=o("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=o("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=o("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=o("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=t=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{var n;e.setColumnVisibility(t?{}:(n=e.initialState.columnVisibility)!=null?n:{})},e.toggleAllColumnsVisible=t=>{var n;t=(n=t)!=null?n:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((i,r)=>({...i,[r.id]:t||!(r.getCanHide!=null&&r.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(t=>!(t.getIsVisible!=null&&t.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(t=>t.getIsVisible==null?void 0:t.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>t=>{var n;e.toggleAllColumnsVisible((n=t.target)==null?void 0:n.checked)}}};function O(e,o){return o?o==="center"?e.getCenterVisibleLeafColumns():o==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const xt={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},_t={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:V("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:o=>{var t;const n=(t=e.getCoreRowModel().flatRows[0])==null||(t=t._getAllCellsByColumnId()[o.id])==null?void 0:t.getValue();return typeof n=="string"||typeof n=="number"}}),createColumn:(e,o)=>{e.getCanGlobalFilter=()=>{var t,n,i,r;return((t=e.columnDef.enableGlobalFilter)!=null?t:!0)&&((n=o.options.enableGlobalFilter)!=null?n:!0)&&((i=o.options.enableFilters)!=null?i:!0)&&((r=o.options.getColumnCanGlobalFilter==null?void 0:o.options.getColumnCanGlobalFilter(e))!=null?r:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>E.includesString,e.getGlobalFilterFn=()=>{var o,t;const{globalFilterFn:n}=e.options;return K(n)?n:n==="auto"?e.getGlobalAutoFilterFn():(o=(t=e.options.filterFns)==null?void 0:t[n])!=null?o:E[n]},e.setGlobalFilter=o=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(o)},e.resetGlobalFilter=o=>{e.setGlobalFilter(o?void 0:e.initialState.globalFilter)}}},Ft={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:V("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let o=!1,t=!1;e._autoResetExpanded=()=>{var n,i;if(!o){e._queue(()=>{o=!0});return}if((n=(i=e.options.autoResetAll)!=null?i:e.options.autoResetExpanded)!=null?n:!e.options.manualExpanding){if(t)return;t=!0,e._queue(()=>{e.resetExpanded(),t=!1})}},e.setExpanded=n=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(n),e.toggleAllRowsExpanded=n=>{n??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=n=>{var i,r;e.setExpanded(n?{}:(i=(r=e.initialState)==null?void 0:r.expanded)!=null?i:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(n=>n.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>n=>{n.persist==null||n.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const n=e.getState().expanded;return n===!0||Object.values(n).some(Boolean)},e.getIsAllRowsExpanded=()=>{const n=e.getState().expanded;return typeof n=="boolean"?n===!0:!(!Object.keys(n).length||e.getRowModel().flatRows.some(i=>!i.getIsExpanded()))},e.getExpandedDepth=()=>{let n=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(r=>{const l=r.split(".");n=Math.max(n,l.length)}),n},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,o)=>{e.toggleExpanded=t=>{o.setExpanded(n=>{var i;const r=n===!0?!0:!!(n!=null&&n[e.id]);let l={};if(n===!0?Object.keys(o.getRowModel().rowsById).forEach(s=>{l[s]=!0}):l=n,t=(i=t)!=null?i:!r,!r&&t)return{...l,[e.id]:!0};if(r&&!t){const{[e.id]:s,...a}=l;return a}return n})},e.getIsExpanded=()=>{var t;const n=o.getState().expanded;return!!((t=o.options.getIsRowExpanded==null?void 0:o.options.getIsRowExpanded(e))!=null?t:n===!0||n!=null&&n[e.id])},e.getCanExpand=()=>{var t,n,i;return(t=o.options.getRowCanExpand==null?void 0:o.options.getRowCanExpand(e))!=null?t:((n=o.options.enableExpanding)!=null?n:!0)&&!!((i=e.subRows)!=null&&i.length)},e.getIsAllParentsExpanded=()=>{let t=!0,n=e;for(;t&&n.parentId;)n=o.getRow(n.parentId,!0),t=n.getIsExpanded();return t},e.getToggleExpandedHandler=()=>{const t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},re=0,le=10,ee=()=>({pageIndex:re,pageSize:le}),$t={getInitialState:e=>({...e,pagination:{...ee(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:V("pagination",e)}),createTable:e=>{let o=!1,t=!1;e._autoResetPageIndex=()=>{var n,i;if(!o){e._queue(()=>{o=!0});return}if((n=(i=e.options.autoResetAll)!=null?i:e.options.autoResetPageIndex)!=null?n:!e.options.manualPagination){if(t)return;t=!0,e._queue(()=>{e.resetPageIndex(),t=!1})}},e.setPagination=n=>{const i=r=>z(n,r);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(i)},e.resetPagination=n=>{var i;e.setPagination(n?ee():(i=e.initialState.pagination)!=null?i:ee())},e.setPageIndex=n=>{e.setPagination(i=>{let r=z(n,i.pageIndex);const l=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return r=Math.max(0,Math.min(r,l)),{...i,pageIndex:r}})},e.resetPageIndex=n=>{var i,r;e.setPageIndex(n?re:(i=(r=e.initialState)==null||(r=r.pagination)==null?void 0:r.pageIndex)!=null?i:re)},e.resetPageSize=n=>{var i,r;e.setPageSize(n?le:(i=(r=e.initialState)==null||(r=r.pagination)==null?void 0:r.pageSize)!=null?i:le)},e.setPageSize=n=>{e.setPagination(i=>{const r=Math.max(1,z(n,i.pageSize)),l=i.pageSize*i.pageIndex,s=Math.floor(l/r);return{...i,pageIndex:s,pageSize:r}})},e.setPageCount=n=>e.setPagination(i=>{var r;let l=z(n,(r=e.options.pageCount)!=null?r:-1);return typeof l=="number"&&(l=Math.max(-1,l)),{...i,pageCount:l}}),e.getPageOptions=h(()=>[e.getPageCount()],n=>{let i=[];return n&&n>0&&(i=[...new Array(n)].fill(null).map((r,l)=>l)),i},C(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:n}=e.getState().pagination,i=e.getPageCount();return i===-1?!0:i===0?!1:n<i-1},e.previousPage=()=>e.setPageIndex(n=>n-1),e.nextPage=()=>e.setPageIndex(n=>n+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var n;return(n=e.options.pageCount)!=null?n:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var n;return(n=e.options.rowCount)!=null?n:e.getPrePaginationRowModel().rows.length}}},te=()=>({top:[],bottom:[]}),Mt={getInitialState:e=>({rowPinning:te(),...e}),getDefaultOptions:e=>({onRowPinningChange:V("rowPinning",e)}),createRow:(e,o)=>{e.pin=(t,n,i)=>{const r=n?e.getLeafRows().map(a=>{let{id:g}=a;return g}):[],l=i?e.getParentRows().map(a=>{let{id:g}=a;return g}):[],s=new Set([...l,e.id,...r]);o.setRowPinning(a=>{var g,c;if(t==="bottom"){var m,d;return{top:((m=a==null?void 0:a.top)!=null?m:[]).filter(p=>!(s!=null&&s.has(p))),bottom:[...((d=a==null?void 0:a.bottom)!=null?d:[]).filter(p=>!(s!=null&&s.has(p))),...Array.from(s)]}}if(t==="top"){var u,f;return{top:[...((u=a==null?void 0:a.top)!=null?u:[]).filter(p=>!(s!=null&&s.has(p))),...Array.from(s)],bottom:((f=a==null?void 0:a.bottom)!=null?f:[]).filter(p=>!(s!=null&&s.has(p)))}}return{top:((g=a==null?void 0:a.top)!=null?g:[]).filter(p=>!(s!=null&&s.has(p))),bottom:((c=a==null?void 0:a.bottom)!=null?c:[]).filter(p=>!(s!=null&&s.has(p)))}})},e.getCanPin=()=>{var t;const{enableRowPinning:n,enablePinning:i}=o.options;return typeof n=="function"?n(e):(t=n??i)!=null?t:!0},e.getIsPinned=()=>{const t=[e.id],{top:n,bottom:i}=o.getState().rowPinning,r=t.some(s=>n==null?void 0:n.includes(s)),l=t.some(s=>i==null?void 0:i.includes(s));return r?"top":l?"bottom":!1},e.getPinnedIndex=()=>{var t,n;const i=e.getIsPinned();if(!i)return-1;const r=(t=i==="top"?o.getTopRows():o.getBottomRows())==null?void 0:t.map(l=>{let{id:s}=l;return s});return(n=r==null?void 0:r.indexOf(e.id))!=null?n:-1}},createTable:e=>{e.setRowPinning=o=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(o),e.resetRowPinning=o=>{var t,n;return e.setRowPinning(o?te():(t=(n=e.initialState)==null?void 0:n.rowPinning)!=null?t:te())},e.getIsSomeRowsPinned=o=>{var t;const n=e.getState().rowPinning;if(!o){var i,r;return!!((i=n.top)!=null&&i.length||(r=n.bottom)!=null&&r.length)}return!!((t=n[o])!=null&&t.length)},e._getPinnedRows=(o,t,n)=>{var i;return((i=e.options.keepPinnedRows)==null||i?(t??[]).map(l=>{const s=e.getRow(l,!0);return s.getIsAllParentsExpanded()?s:null}):(t??[]).map(l=>o.find(s=>s.id===l))).filter(Boolean).map(l=>({...l,position:n}))},e.getTopRows=h(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(o,t)=>e._getPinnedRows(o,t,"top"),C(e.options,"debugRows")),e.getBottomRows=h(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(o,t)=>e._getPinnedRows(o,t,"bottom"),C(e.options,"debugRows")),e.getCenterRows=h(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(o,t,n)=>{const i=new Set([...t??[],...n??[]]);return o.filter(r=>!i.has(r.id))},C(e.options,"debugRows"))}},Vt={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:V("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=o=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(o),e.resetRowSelection=o=>{var t;return e.setRowSelection(o?{}:(t=e.initialState.rowSelection)!=null?t:{})},e.toggleAllRowsSelected=o=>{e.setRowSelection(t=>{o=typeof o<"u"?o:!e.getIsAllRowsSelected();const n={...t},i=e.getPreGroupedRowModel().flatRows;return o?i.forEach(r=>{r.getCanSelect()&&(n[r.id]=!0)}):i.forEach(r=>{delete n[r.id]}),n})},e.toggleAllPageRowsSelected=o=>e.setRowSelection(t=>{const n=typeof o<"u"?o:!e.getIsAllPageRowsSelected(),i={...t};return e.getRowModel().rows.forEach(r=>{se(i,r.id,n,!0,e)}),i}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=h(()=>[e.getState().rowSelection,e.getCoreRowModel()],(o,t)=>Object.keys(o).length?ne(e,t):{rows:[],flatRows:[],rowsById:{}},C(e.options,"debugTable")),e.getFilteredSelectedRowModel=h(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(o,t)=>Object.keys(o).length?ne(e,t):{rows:[],flatRows:[],rowsById:{}},C(e.options,"debugTable")),e.getGroupedSelectedRowModel=h(()=>[e.getState().rowSelection,e.getSortedRowModel()],(o,t)=>Object.keys(o).length?ne(e,t):{rows:[],flatRows:[],rowsById:{}},C(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const o=e.getFilteredRowModel().flatRows,{rowSelection:t}=e.getState();let n=!!(o.length&&Object.keys(t).length);return n&&o.some(i=>i.getCanSelect()&&!t[i.id])&&(n=!1),n},e.getIsAllPageRowsSelected=()=>{const o=e.getPaginationRowModel().flatRows.filter(i=>i.getCanSelect()),{rowSelection:t}=e.getState();let n=!!o.length;return n&&o.some(i=>!t[i.id])&&(n=!1),n},e.getIsSomeRowsSelected=()=>{var o;const t=Object.keys((o=e.getState().rowSelection)!=null?o:{}).length;return t>0&&t<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{const o=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:o.filter(t=>t.getCanSelect()).some(t=>t.getIsSelected()||t.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>o=>{e.toggleAllRowsSelected(o.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>o=>{e.toggleAllPageRowsSelected(o.target.checked)}},createRow:(e,o)=>{e.toggleSelected=(t,n)=>{const i=e.getIsSelected();o.setRowSelection(r=>{var l;if(t=typeof t<"u"?t:!i,e.getCanSelect()&&i===t)return r;const s={...r};return se(s,e.id,t,(l=n==null?void 0:n.selectChildren)!=null?l:!0,o),s})},e.getIsSelected=()=>{const{rowSelection:t}=o.getState();return ce(e,t)},e.getIsSomeSelected=()=>{const{rowSelection:t}=o.getState();return ue(e,t)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:t}=o.getState();return ue(e,t)==="all"},e.getCanSelect=()=>{var t;return typeof o.options.enableRowSelection=="function"?o.options.enableRowSelection(e):(t=o.options.enableRowSelection)!=null?t:!0},e.getCanSelectSubRows=()=>{var t;return typeof o.options.enableSubRowSelection=="function"?o.options.enableSubRowSelection(e):(t=o.options.enableSubRowSelection)!=null?t:!0},e.getCanMultiSelect=()=>{var t;return typeof o.options.enableMultiRowSelection=="function"?o.options.enableMultiRowSelection(e):(t=o.options.enableMultiRowSelection)!=null?t:!0},e.getToggleSelectedHandler=()=>{const t=e.getCanSelect();return n=>{var i;t&&e.toggleSelected((i=n.target)==null?void 0:i.checked)}}}},se=(e,o,t,n,i)=>{var r;const l=i.getRow(o,!0);t?(l.getCanMultiSelect()||Object.keys(e).forEach(s=>delete e[s]),l.getCanSelect()&&(e[o]=!0)):delete e[o],n&&(r=l.subRows)!=null&&r.length&&l.getCanSelectSubRows()&&l.subRows.forEach(s=>se(e,s.id,t,n,i))};function ne(e,o){const t=e.getState().rowSelection,n=[],i={},r=function(l,s){return l.map(a=>{var g;const c=ce(a,t);if(c&&(n.push(a),i[a.id]=a),(g=a.subRows)!=null&&g.length&&(a={...a,subRows:r(a.subRows)}),c)return a}).filter(Boolean)};return{rows:r(o.rows),flatRows:n,rowsById:i}}function ce(e,o){var t;return(t=o[e.id])!=null?t:!1}function ue(e,o,t){var n;if(!((n=e.subRows)!=null&&n.length))return!1;let i=!0,r=!1;return e.subRows.forEach(l=>{if(!(r&&!i)&&(l.getCanSelect()&&(ce(l,o)?r=!0:i=!1),l.subRows&&l.subRows.length)){const s=ue(l,o);s==="all"?r=!0:(s==="some"&&(r=!0),i=!1)}}),i?"all":r?"some":!1}const ae=/([0-9]+)/gm,Pt=(e,o,t)=>Pe(G(e.getValue(t)).toLowerCase(),G(o.getValue(t)).toLowerCase()),yt=(e,o,t)=>Pe(G(e.getValue(t)),G(o.getValue(t))),It=(e,o,t)=>fe(G(e.getValue(t)).toLowerCase(),G(o.getValue(t)).toLowerCase()),Dt=(e,o,t)=>fe(G(e.getValue(t)),G(o.getValue(t))),Et=(e,o,t)=>{const n=e.getValue(t),i=o.getValue(t);return n>i?1:n<i?-1:0},Ht=(e,o,t)=>fe(e.getValue(t),o.getValue(t));function fe(e,o){return e===o?0:e>o?1:-1}function G(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function Pe(e,o){const t=e.split(ae).filter(Boolean),n=o.split(ae).filter(Boolean);for(;t.length&&n.length;){const i=t.shift(),r=n.shift(),l=parseInt(i,10),s=parseInt(r,10),a=[l,s].sort();if(isNaN(a[0])){if(i>r)return 1;if(r>i)return-1;continue}if(isNaN(a[1]))return isNaN(l)?-1:1;if(l>s)return 1;if(s>l)return-1}return t.length-n.length}const j={alphanumeric:Pt,alphanumericCaseSensitive:yt,text:It,textCaseSensitive:Dt,datetime:Et,basic:Ht},zt={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:V("sorting",e),isMultiSortEvent:o=>o.shiftKey}),createColumn:(e,o)=>{e.getAutoSortingFn=()=>{const t=o.getFilteredRowModel().flatRows.slice(10);let n=!1;for(const i of t){const r=i==null?void 0:i.getValue(e.id);if(Object.prototype.toString.call(r)==="[object Date]")return j.datetime;if(typeof r=="string"&&(n=!0,r.split(ae).length>1))return j.alphanumeric}return n?j.text:j.basic},e.getAutoSortDir=()=>{const t=o.getFilteredRowModel().flatRows[0];return typeof(t==null?void 0:t.getValue(e.id))=="string"?"asc":"desc"},e.getSortingFn=()=>{var t,n;if(!e)throw new Error;return K(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(t=(n=o.options.sortingFns)==null?void 0:n[e.columnDef.sortingFn])!=null?t:j[e.columnDef.sortingFn]},e.toggleSorting=(t,n)=>{const i=e.getNextSortingOrder(),r=typeof t<"u"&&t!==null;o.setSorting(l=>{const s=l==null?void 0:l.find(u=>u.id===e.id),a=l==null?void 0:l.findIndex(u=>u.id===e.id);let g=[],c,m=r?t:i==="desc";if(l!=null&&l.length&&e.getCanMultiSort()&&n?s?c="toggle":c="add":l!=null&&l.length&&a!==l.length-1?c="replace":s?c="toggle":c="replace",c==="toggle"&&(r||i||(c="remove")),c==="add"){var d;g=[...l,{id:e.id,desc:m}],g.splice(0,g.length-((d=o.options.maxMultiSortColCount)!=null?d:Number.MAX_SAFE_INTEGER))}else c==="toggle"?g=l.map(u=>u.id===e.id?{...u,desc:m}:u):c==="remove"?g=l.filter(u=>u.id!==e.id):g=[{id:e.id,desc:m}];return g})},e.getFirstSortDir=()=>{var t,n;return((t=(n=e.columnDef.sortDescFirst)!=null?n:o.options.sortDescFirst)!=null?t:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=t=>{var n,i;const r=e.getFirstSortDir(),l=e.getIsSorted();return l?l!==r&&((n=o.options.enableSortingRemoval)==null||n)&&(!(t&&(i=o.options.enableMultiRemove)!=null)||i)?!1:l==="desc"?"asc":"desc":r},e.getCanSort=()=>{var t,n;return((t=e.columnDef.enableSorting)!=null?t:!0)&&((n=o.options.enableSorting)!=null?n:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var t,n;return(t=(n=e.columnDef.enableMultiSort)!=null?n:o.options.enableMultiSort)!=null?t:!!e.accessorFn},e.getIsSorted=()=>{var t;const n=(t=o.getState().sorting)==null?void 0:t.find(i=>i.id===e.id);return n?n.desc?"desc":"asc":!1},e.getSortIndex=()=>{var t,n;return(t=(n=o.getState().sorting)==null?void 0:n.findIndex(i=>i.id===e.id))!=null?t:-1},e.clearSorting=()=>{o.setSorting(t=>t!=null&&t.length?t.filter(n=>n.id!==e.id):[])},e.getToggleSortingHandler=()=>{const t=e.getCanSort();return n=>{t&&(n.persist==null||n.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?o.options.isMultiSortEvent==null?void 0:o.options.isMultiSortEvent(n):!1))}}},createTable:e=>{e.setSorting=o=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(o),e.resetSorting=o=>{var t,n;e.setSorting(o?[]:(t=(n=e.initialState)==null?void 0:n.sorting)!=null?t:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},Gt=[nt,vt,St,ht,ot,it,xt,_t,zt,pt,Ft,$t,Mt,Vt,wt];function At(e){var o,t;const n=[...Gt,...(o=e._features)!=null?o:[]];let i={_features:n};const r=i._features.reduce((d,u)=>Object.assign(d,u.getDefaultOptions==null?void 0:u.getDefaultOptions(i)),{}),l=d=>i.options.mergeOptions?i.options.mergeOptions(r,d):{...r,...d};let a={...{},...(t=e.initialState)!=null?t:{}};i._features.forEach(d=>{var u;a=(u=d.getInitialState==null?void 0:d.getInitialState(a))!=null?u:a});const g=[];let c=!1;const m={_features:n,options:{...r,...e},initialState:a,_queue:d=>{g.push(d),c||(c=!0,Promise.resolve().then(()=>{for(;g.length;)g.shift()();c=!1}).catch(u=>setTimeout(()=>{throw u})))},reset:()=>{i.setState(i.initialState)},setOptions:d=>{const u=z(d,i.options);i.options=l(u)},getState:()=>i.options.state,setState:d=>{i.options.onStateChange==null||i.options.onStateChange(d)},_getRowId:(d,u,f)=>{var p;return(p=i.options.getRowId==null?void 0:i.options.getRowId(d,u,f))!=null?p:`${f?[f.id,u].join("."):u}`},getCoreRowModel:()=>(i._getCoreRowModel||(i._getCoreRowModel=i.options.getCoreRowModel(i)),i._getCoreRowModel()),getRowModel:()=>i.getPaginationRowModel(),getRow:(d,u)=>{let f=(u?i.getPrePaginationRowModel():i.getRowModel()).rowsById[d];if(!f&&(f=i.getCoreRowModel().rowsById[d],!f))throw new Error;return f},_getDefaultColumnDef:h(()=>[i.options.defaultColumn],d=>{var u;return d=(u=d)!=null?u:{},{header:f=>{const p=f.header.column.columnDef;return p.accessorKey?p.accessorKey:p.accessorFn?p.id:null},cell:f=>{var p,w;return(p=(w=f.renderValue())==null||w.toString==null?void 0:w.toString())!=null?p:null},...i._features.reduce((f,p)=>Object.assign(f,p.getDefaultColumnDef==null?void 0:p.getDefaultColumnDef()),{}),...d}},C(e,"debugColumns")),_getColumnDefs:()=>i.options.columns,getAllColumns:h(()=>[i._getColumnDefs()],d=>{const u=function(f,p,w){return w===void 0&&(w=0),f.map(R=>{const v=tt(i,R,w,p),x=R;return v.columns=x.columns?u(x.columns,v,w+1):[],v})};return u(d)},C(e,"debugColumns")),getAllFlatColumns:h(()=>[i.getAllColumns()],d=>d.flatMap(u=>u.getFlatColumns()),C(e,"debugColumns")),_getAllFlatColumnsById:h(()=>[i.getAllFlatColumns()],d=>d.reduce((u,f)=>(u[f.id]=f,u),{}),C(e,"debugColumns")),getAllLeafColumns:h(()=>[i.getAllColumns(),i._getOrderColumnsFn()],(d,u)=>{let f=d.flatMap(p=>p.getLeafColumns());return u(f)},C(e,"debugColumns")),getColumn:d=>i._getAllFlatColumnsById()[d]};Object.assign(i,m);for(let d=0;d<i._features.length;d++){const u=i._features[d];u==null||u.createTable==null||u.createTable(i)}return i}function Lt(){return e=>h(()=>[e.options.data],o=>{const t={rows:[],flatRows:[],rowsById:{}},n=function(i,r,l){r===void 0&&(r=0);const s=[];for(let g=0;g<i.length;g++){const c=ge(e,e._getRowId(i[g],g,l),i[g],g,r,void 0,l==null?void 0:l.id);if(t.flatRows.push(c),t.rowsById[c.id]=c,s.push(c),e.options.getSubRows){var a;c.originalSubRows=e.options.getSubRows(i[g],g),(a=c.originalSubRows)!=null&&a.length&&(c.subRows=n(c.originalSubRows,r+1,c))}}return s};return t.rows=n(o),t},C(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex()))}function jt(e){const o=[],t=n=>{var i;o.push(n),(i=n.subRows)!=null&&i.length&&n.getIsExpanded()&&n.subRows.forEach(t)};return e.rows.forEach(t),{rows:o,flatRows:e.flatRows,rowsById:e.rowsById}}function Ot(e,o,t){return t.options.filterFromLeafRows?Nt(e,o,t):kt(e,o,t)}function Nt(e,o,t){var n;const i=[],r={},l=(n=t.options.maxLeafRowFilterDepth)!=null?n:100,s=function(a,g){g===void 0&&(g=0);const c=[];for(let d=0;d<a.length;d++){var m;let u=a[d];const f=ge(t,u.id,u.original,u.index,u.depth,void 0,u.parentId);if(f.columnFilters=u.columnFilters,(m=u.subRows)!=null&&m.length&&g<l){if(f.subRows=s(u.subRows,g+1),u=f,o(u)&&!f.subRows.length){c.push(u),r[u.id]=u,i.push(u);continue}if(o(u)||f.subRows.length){c.push(u),r[u.id]=u,i.push(u);continue}}else u=f,o(u)&&(c.push(u),r[u.id]=u,i.push(u))}return c};return{rows:s(e),flatRows:i,rowsById:r}}function kt(e,o,t){var n;const i=[],r={},l=(n=t.options.maxLeafRowFilterDepth)!=null?n:100,s=function(a,g){g===void 0&&(g=0);const c=[];for(let d=0;d<a.length;d++){let u=a[d];if(o(u)){var m;if((m=u.subRows)!=null&&m.length&&g<l){const p=ge(t,u.id,u.original,u.index,u.depth,void 0,u.parentId);p.subRows=s(u.subRows,g+1),u=p}c.push(u),i.push(u),r[u.id]=u}}return c};return{rows:s(e),flatRows:i,rowsById:r}}function Tt(){return e=>h(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(o,t,n)=>{if(!o.rows.length||!(t!=null&&t.length)&&!n){for(let d=0;d<o.flatRows.length;d++)o.flatRows[d].columnFilters={},o.flatRows[d].columnFiltersMeta={};return o}const i=[],r=[];(t??[]).forEach(d=>{var u;const f=e.getColumn(d.id);if(!f)return;const p=f.getFilterFn();p&&i.push({id:d.id,filterFn:p,resolvedValue:(u=p.resolveFilterValue==null?void 0:p.resolveFilterValue(d.value))!=null?u:d.value})});const l=(t??[]).map(d=>d.id),s=e.getGlobalFilterFn(),a=e.getAllLeafColumns().filter(d=>d.getCanGlobalFilter());n&&s&&a.length&&(l.push("__global__"),a.forEach(d=>{var u;r.push({id:d.id,filterFn:s,resolvedValue:(u=s.resolveFilterValue==null?void 0:s.resolveFilterValue(n))!=null?u:n})}));let g,c;for(let d=0;d<o.flatRows.length;d++){const u=o.flatRows[d];if(u.columnFilters={},i.length)for(let f=0;f<i.length;f++){g=i[f];const p=g.id;u.columnFilters[p]=g.filterFn(u,p,g.resolvedValue,w=>{u.columnFiltersMeta[p]=w})}if(r.length){for(let f=0;f<r.length;f++){c=r[f];const p=c.id;if(c.filterFn(u,p,c.resolvedValue,w=>{u.columnFiltersMeta[p]=w})){u.columnFilters.__global__=!0;break}}u.columnFilters.__global__!==!0&&(u.columnFilters.__global__=!1)}}const m=d=>{for(let u=0;u<l.length;u++)if(d.columnFilters[l[u]]===!1)return!1;return!0};return Ot(o.rows,m,e)},C(e.options,"debugTable","getFilteredRowModel",()=>e._autoResetPageIndex()))}function Bt(e){return o=>h(()=>[o.getState().pagination,o.getPrePaginationRowModel(),o.options.paginateExpandedRows?void 0:o.getState().expanded],(t,n)=>{if(!n.rows.length)return n;const{pageSize:i,pageIndex:r}=t;let{rows:l,flatRows:s,rowsById:a}=n;const g=i*r,c=g+i;l=l.slice(g,c);let m;o.options.paginateExpandedRows?m={rows:l,flatRows:s,rowsById:a}:m=jt({rows:l,flatRows:s,rowsById:a}),m.flatRows=[];const d=u=>{m.flatRows.push(u),u.subRows.length&&u.subRows.forEach(d)};return m.rows.forEach(d),m},C(o.options,"debugTable"))}function qt(){return e=>h(()=>[e.getState().sorting,e.getPreSortedRowModel()],(o,t)=>{if(!t.rows.length||!(o!=null&&o.length))return t;const n=e.getState().sorting,i=[],r=n.filter(a=>{var g;return(g=e.getColumn(a.id))==null?void 0:g.getCanSort()}),l={};r.forEach(a=>{const g=e.getColumn(a.id);g&&(l[a.id]={sortUndefined:g.columnDef.sortUndefined,invertSorting:g.columnDef.invertSorting,sortingFn:g.getSortingFn()})});const s=a=>{const g=a.map(c=>({...c}));return g.sort((c,m)=>{for(let u=0;u<r.length;u+=1){var d;const f=r[u],p=l[f.id],w=p.sortUndefined,R=(d=f==null?void 0:f.desc)!=null?d:!1;let v=0;if(w){const x=c.getValue(f.id),M=m.getValue(f.id),$=x===void 0,H=M===void 0;if($||H){if(w==="first")return $?-1:1;if(w==="last")return $?1:-1;v=$&&H?0:$?w:-w}}if(v===0&&(v=p.sortingFn(c,m,f.id)),v!==0)return R&&(v*=-1),p.invertSorting&&(v*=-1),v}return c.index-m.index}),g.forEach(c=>{var m;i.push(c),(m=c.subRows)!=null&&m.length&&(c.subRows=s(c.subRows))}),g};return{rows:s(t.rows),flatRows:i,rowsById:t.rowsById}},C(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}/**
   * react-table
   *
   * Copyright (c) TanStack
   *
   * This source code is licensed under the MIT license found in the
   * LICENSE.md file in the root directory of this source tree.
   *
   * @license MIT
   */function Ce(e,o){return e?Ut(e)?P.createElement(e,o):e:null}function Ut(e){return Kt(e)||typeof e=="function"||Xt(e)}function Kt(e){return typeof e=="function"&&(()=>{const o=Object.getPrototypeOf(e);return o.prototype&&o.prototype.isReactComponent})()}function Xt(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function Jt(e){const o={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[t]=P.useState(()=>({current:At(o)})),[n,i]=P.useState(()=>t.current.initialState);return t.current.setOptions(r=>({...r,...e,state:{...n,...e.state},onStateChange:l=>{i(l),e.onStateChange==null||e.onStateChange(l)}})),t.current}function Qt({table:e,totalCount:o,pageSizeOptions:t=[10,25,50,100]}){const{pageIndex:n,pageSize:i}=e.getState().pagination,r=o??e.getFilteredRowModel().rows.length,l=r===0?0:n*i+1,s=Math.min((n+1)*i,r),a=e.getPageCount();return S.jsxs("div",{className:"flex items-center justify-between px-1 pt-3",children:[S.jsx("p",{className:"text-[12px] text-slate-400",children:r===0?"No results":`Showing ${l}–${s} of ${r.toLocaleString()}`}),S.jsxs("div",{className:"flex items-center gap-4",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"text-[12px] text-slate-400",children:"Rows"}),S.jsxs(De,{value:String(i),onValueChange:g=>e.setPageSize(Number(g)),children:[S.jsx(Ee,{className:"h-7 w-[62px] text-[12px]",children:S.jsx(He,{})}),S.jsx(ze,{children:t.map(g=>S.jsx(Ge,{value:String(g),children:g},g))})]})]}),S.jsxs("span",{className:"text-[12px] text-slate-500",children:["Page ",n+1," of ",Math.max(a,1)]}),S.jsxs("div",{className:"flex items-center gap-1",children:[S.jsx(oe,{variant:"outline",size:"icon-sm",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),children:S.jsx(We,{className:"h-3.5 w-3.5"})}),S.jsx(oe,{variant:"outline",size:"icon-sm",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),children:S.jsx(Ae,{className:"h-3.5 w-3.5"})})]})]})]})}function Wt({table:e,searchPlaceholder:o="Search...",globalFilter:t,onGlobalFilterChange:n,children:i,enableColumnVisibility:r=!0,hideSearch:l=!1}){const[s,a]=P.useState(t??"");P.useEffect(()=>{const c=setTimeout(()=>{n?n(s):e.setGlobalFilter(s)},300);return()=>clearTimeout(c)},[s,n,e]),P.useEffect(()=>{t!==void 0&&t!==s&&a(t)},[t]);const g=s.length>0;return S.jsxs("div",{className:"flex items-center justify-between gap-3 pb-4",children:[S.jsx("div",{className:"flex items-center gap-2 flex-1",children:!l&&S.jsxs("div",{className:"relative",children:[S.jsx(Le,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400"}),S.jsx("input",{type:"search",placeholder:o,value:s,onChange:c=>a(c.target.value),className:we("h-8 w-60 rounded-md border border-slate-200 bg-white pl-8 pr-3 text-[13px] text-slate-700","placeholder:text-slate-400","focus:outline-none focus:ring-2 focus:ring-blue-500/25 focus:border-blue-400","transition-all duration-150")}),g&&S.jsx("button",{onClick:()=>a(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-600",children:S.jsx(je,{className:"h-3.5 w-3.5"})})]})}),S.jsxs("div",{className:"flex items-center gap-2",children:[r&&S.jsxs(Oe,{children:[S.jsx(Ne,{asChild:!0,children:S.jsxs(oe,{variant:"outline",size:"sm",className:"h-8 gap-1.5 text-[12px]",children:[S.jsx(Ye,{className:"h-3.5 w-3.5"}),"Columns"]})}),S.jsxs(ke,{align:"end",className:"w-48",children:[S.jsx(Te,{className:"text-[12px]",children:"Toggle columns"}),S.jsx(Be,{}),e.getAllColumns().filter(c=>typeof c.accessorFn<"u"&&c.getCanHide()).map(c=>S.jsx(qe,{className:"text-[12px] capitalize",checked:c.getIsVisible(),onCheckedChange:m=>c.toggleVisibility(!!m),children:c.id.replace(/_/g," ")},c.id))]})]}),i]})]})}function Yt(e){return{id:e.key,accessorKey:e.key,header:e.header,cell:e.render?({row:o})=>e.render(o.original):({row:o})=>{const t=o.original[e.key];return t!=null?String(t):""},meta:{className:e.className}}}function Zt(e){return e.length>0&&"key"in e[0]&&"header"in e[0]}function bt({cols:e}){return S.jsx(U,{className:"hover:bg-transparent",children:Array.from({length:e}).map((o,t)=>S.jsx(ie,{children:S.jsx("div",{className:"skeleton-shimmer h-4 rounded",style:{width:`${55+t%4*12}%`}})},t))})}function rn({columns:e,data:o,totalCount:t,pagination:n,onPaginationChange:i,sorting:r,onSortingChange:l,globalFilter:s,onGlobalFilterChange:a,enableRowSelection:g=!1,enableColumnVisibility:c=!0,enablePagination:m=!0,searchPlaceholder:d,hideSearch:u=!1,actions:f,isLoading:p=!1,emptyMessage:w="No results found",emptyDescription:R,rowKey:v,searchKeys:x}){const M=P.useMemo(()=>Zt(e)?e.map(Yt):e,[e]),[$,H]=P.useState([]),[A,N]=P.useState({pageIndex:0,pageSize:25}),[X,J]=P.useState({}),[k,ye]=P.useState({}),pe=t!==void 0,Q=P.useMemo(()=>g?[{id:"select",header:({table:_})=>S.jsx(me,{checked:_.getIsAllPageRowsSelected()||_.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:D=>_.toggleAllPageRowsSelected(!!D),"aria-label":"Select all"}),cell:({row:_})=>S.jsx(me,{checked:_.getIsSelected(),onCheckedChange:D=>_.toggleSelected(!!D),"aria-label":"Select row"}),enableSorting:!1,enableHiding:!1,size:40},...M]:M,[M,g]),L=Jt({data:o,columns:Q,state:{sorting:r??$,pagination:n??A,columnVisibility:X,rowSelection:k,...s!==void 0?{globalFilter:s}:{}},onSortingChange:l??H,onPaginationChange:i??N,onColumnVisibilityChange:J,onRowSelectionChange:ye,getCoreRowModel:Lt(),...!pe&&{getSortedRowModel:qt(),getFilteredRowModel:Tt(),getPaginationRowModel:Bt()},...pe&&{manualPagination:!0,manualSorting:!0,manualFiltering:!0,pageCount:Math.ceil(t/((n==null?void 0:n.pageSize)??A.pageSize))},enableRowSelection:g});return S.jsxs(S.Fragment,{children:[S.jsx(Wt,{table:L,searchPlaceholder:d,globalFilter:s,onGlobalFilterChange:a,enableColumnVisibility:c,hideSearch:u,children:f}),S.jsx("div",{className:"overflow-hidden rounded-lg border border-slate-200 bg-white shadow-sm",children:S.jsxs(Ue,{children:[S.jsx(Ke,{children:L.getHeaderGroups().map(I=>S.jsx(U,{className:"hover:bg-transparent border-b border-slate-200",children:I.headers.map(_=>{var D;return S.jsx(Xe,{className:(D=_.column.columnDef.meta)==null?void 0:D.className,style:{width:_.getSize()!==150?_.getSize():void 0},children:_.isPlaceholder?null:Ce(_.column.columnDef.header,_.getContext())},_.id)})},I.id))}),S.jsx(Je,{children:p?Array.from({length:5}).map((I,_)=>S.jsx(bt,{cols:Q.length},_)):L.getRowModel().rows.length===0?S.jsx(U,{className:"hover:bg-transparent",children:S.jsx(ie,{colSpan:Q.length,className:"p-0",children:S.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[S.jsx("div",{className:"mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-slate-100",children:S.jsx(Qe,{className:"h-5 w-5 text-slate-400"})}),S.jsx("p",{className:"text-[13px] font-medium text-slate-600",children:w}),R&&S.jsx("p",{className:"mt-1 text-[12px] text-slate-400 max-w-xs",children:R})]})})}):L.getRowModel().rows.map(I=>S.jsx(U,{"data-state":I.getIsSelected()&&"selected",className:we(I.getIsSelected()&&"bg-primary-subtle/50"),children:I.getVisibleCells().map(_=>{var D;return S.jsx(ie,{className:(D=_.column.columnDef.meta)==null?void 0:D.className,children:Ce(_.column.columnDef.cell,_.getContext())},_.id)})},I.id))})]})}),m&&!p&&o.length>0&&S.jsx(Qt,{table:L,totalCount:t})]})}export{rn as D,Ye as S};
