import{r as ee,j as F,aD as Pe,R as v,aU as He,S as Ee,C as De,h as Ge}from"./vendor-ClLR6ncd.js";import{W as ze,T as Le}from"./WithMeasure-BDk9QPMF.js";import{W as ke}from"./index-OtVJl4GC.js";import{T as Ce,b as he,a as Oe,c as Te}from"./TableRow-CGDSOtFZ.js";import{T as je}from"./TableSortLabel-BJFq2axQ.js";import{d as Be,F as Ne}from"./lodash-ZyeDnt0e.js";import{B as qe}from"./Box-Co2WcNPC.js";/**
 * 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
 *//**
 * 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 E(e,n){return typeof e=="function"?e(n):e}function b(e,n){return t=>{n.setState(o=>({...o,[e]:E(t,o[e])}))}}function W(e){return e instanceof Function}function Ue(e,n){const t=[],o=l=>{l.forEach(r=>{t.push(r);const i=n(r);i!=null&&i.length&&o(i)})};return o(e),t}function S(e,n,t){let o=[],l;return()=>{let r;t.key&&t.debug&&(r=Date.now());const i=e();if(!(i.length!==o.length||i.some((f,s)=>o[s]!==f)))return l;o=i;let d;if(t.key&&t.debug&&(d=Date.now()),l=n(...i),t==null||t.onChange==null||t.onChange(l),t.key&&t.debug&&t!=null&&t.debug()){const f=Math.round((Date.now()-r)*100)/100,s=Math.round((Date.now()-d)*100)/100,u=s/16,c=(a,p)=>{for(a=String(a);a.length<p;)a=" "+a;return a};console.info("%c⏱ "+c(s,5)+" /"+c(f,5)+" ms",`
            font-size: .6rem;
            font-weight: bold;
            color: hsl(`+Math.max(0,Math.min(120-120*u,120))+"deg 100% 31%);",t==null?void 0:t.key)}return l}}function We(e,n,t,o){var l,r;const g={...e._getDefaultColumnDef(),...n},d=g.accessorKey;let f=(l=(r=g.id)!=null?r:d?d.replace(".","_"):void 0)!=null?l:typeof g.header=="string"?g.header:void 0,s;if(g.accessorFn?s=g.accessorFn:d&&(d.includes(".")?s=c=>{let a=c;for(const p of d.split("."))a=a[p];return a}:s=c=>c[g.accessorKey]),!f)throw new Error;let u={id:""+String(f),accessorFn:s,parent:o,depth:t,columnDef:g,columns:[],getFlatColumns:S(()=>[!0],()=>{var c;return[u,...(c=u.columns)==null?void 0:c.flatMap(a=>a.getFlatColumns())]},{key:"column.getFlatColumns",debug:()=>{var c;return(c=e.options.debugAll)!=null?c:e.options.debugColumns}}),getLeafColumns:S(()=>[e._getOrderColumnsFn()],c=>{var a;if((a=u.columns)!=null&&a.length){let p=u.columns.flatMap(m=>m.getLeafColumns());return c(p)}return[u]},{key:"column.getLeafColumns",debug:()=>{var c;return(c=e.options.debugAll)!=null?c:e.options.debugColumns}})};return u=e._features.reduce((c,a)=>Object.assign(c,a.createColumn==null?void 0:a.createColumn(u,e)),u),u}function ge(e,n,t){var o;let r={id:(o=t.id)!=null?o:n.id,column:n,index:t.index,isPlaceholder:!!t.isPlaceholder,placeholderId:t.placeholderId,depth:t.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const i=[],g=d=>{d.subHeaders&&d.subHeaders.length&&d.subHeaders.map(g),i.push(d)};return g(r),i},getContext:()=>({table:e,header:r,column:n})};return e._features.forEach(i=>{Object.assign(r,i.createHeader==null?void 0:i.createHeader(r,e))}),r}const Xe={createTable:e=>({getHeaderGroups:S(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,t,o,l)=>{var r,i;const g=(r=o==null?void 0:o.map(u=>t.find(c=>c.id===u)).filter(Boolean))!=null?r:[],d=(i=l==null?void 0:l.map(u=>t.find(c=>c.id===u)).filter(Boolean))!=null?i:[],f=t.filter(u=>!(o!=null&&o.includes(u.id))&&!(l!=null&&l.includes(u.id)));return N(n,[...g,...f,...d],e)},{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getCenterHeaderGroups:S(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,t,o,l)=>(t=t.filter(r=>!(o!=null&&o.includes(r.id))&&!(l!=null&&l.includes(r.id))),N(n,t,e,"center")),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getLeftHeaderGroups:S(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(n,t,o)=>{var l;const r=(l=o==null?void 0:o.map(i=>t.find(g=>g.id===i)).filter(Boolean))!=null?l:[];return N(n,r,e,"left")},{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getRightHeaderGroups:S(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(n,t,o)=>{var l;const r=(l=o==null?void 0:o.map(i=>t.find(g=>g.id===i)).filter(Boolean))!=null?l:[];return N(n,r,e,"right")},{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getFooterGroups:S(()=>[e.getHeaderGroups()],n=>[...n].reverse(),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getLeftFooterGroups:S(()=>[e.getLeftHeaderGroups()],n=>[...n].reverse(),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getCenterFooterGroups:S(()=>[e.getCenterHeaderGroups()],n=>[...n].reverse(),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getRightFooterGroups:S(()=>[e.getRightHeaderGroups()],n=>[...n].reverse(),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getFlatHeaders:S(()=>[e.getHeaderGroups()],n=>n.map(t=>t.headers).flat(),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getLeftFlatHeaders:S(()=>[e.getLeftHeaderGroups()],n=>n.map(t=>t.headers).flat(),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getCenterFlatHeaders:S(()=>[e.getCenterHeaderGroups()],n=>n.map(t=>t.headers).flat(),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getRightFlatHeaders:S(()=>[e.getRightHeaderGroups()],n=>n.map(t=>t.headers).flat(),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getCenterLeafHeaders:S(()=>[e.getCenterFlatHeaders()],n=>n.filter(t=>{var o;return!((o=t.subHeaders)!=null&&o.length)}),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getLeftLeafHeaders:S(()=>[e.getLeftFlatHeaders()],n=>n.filter(t=>{var o;return!((o=t.subHeaders)!=null&&o.length)}),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getRightLeafHeaders:S(()=>[e.getRightFlatHeaders()],n=>n.filter(t=>{var o;return!((o=t.subHeaders)!=null&&o.length)}),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getLeafHeaders:S(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(n,t,o)=>{var l,r,i,g,d,f;return[...(l=(r=n[0])==null?void 0:r.headers)!=null?l:[],...(i=(g=t[0])==null?void 0:g.headers)!=null?i:[],...(d=(f=o[0])==null?void 0:f.headers)!=null?d:[]].map(s=>s.getLeafHeaders()).flat()},{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}})})};function N(e,n,t,o){var l,r;let i=0;const g=function(c,a){a===void 0&&(a=1),i=Math.max(i,a),c.filter(p=>p.getIsVisible()).forEach(p=>{var m;(m=p.columns)!=null&&m.length&&g(p.columns,a+1)},0)};g(e);let d=[];const f=(c,a)=>{const p={depth:a,id:[o,""+a].filter(Boolean).join("_"),headers:[]},m=[];c.forEach(C=>{const R=[...m].reverse()[0],x=C.column.depth===p.depth;let w,h=!1;if(x&&C.column.parent?w=C.column.parent:(w=C.column,h=!0),R&&(R==null?void 0:R.column)===w)R.subHeaders.push(C);else{const $=ge(t,w,{id:[o,a,w.id,C==null?void 0:C.id].filter(Boolean).join("_"),isPlaceholder:h,placeholderId:h?""+m.filter(A=>A.column===w).length:void 0,depth:a,index:m.length});$.subHeaders.push(C),m.push($)}p.headers.push(C),C.headerGroup=p}),d.push(p),a>0&&f(m,a-1)},s=n.map((c,a)=>ge(t,c,{depth:i,index:a}));f(s,i-1),d.reverse();const u=c=>c.filter(p=>p.column.getIsVisible()).map(p=>{let m=0,C=0,R=[0];p.subHeaders&&p.subHeaders.length?(R=[],u(p.subHeaders).forEach(w=>{let{colSpan:h,rowSpan:$}=w;m+=h,R.push($)})):m=1;const x=Math.min(...R);return C=C+x,p.colSpan=m,p.rowSpan=C,{colSpan:m,rowSpan:C}});return u((l=(r=d[0])==null?void 0:r.headers)!=null?l:[]),d}const q={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},X=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),Ke={getDefaultColumnDef:()=>q,getInitialState:e=>({columnSizing:{},columnSizingInfo:X(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",onColumnSizingChange:b("columnSizing",e),onColumnSizingInfoChange:b("columnSizingInfo",e)}),createColumn:(e,n)=>({getSize:()=>{var t,o,l;const r=n.getState().columnSizing[e.id];return Math.min(Math.max((t=e.columnDef.minSize)!=null?t:q.minSize,(o=r??e.columnDef.size)!=null?o:q.size),(l=e.columnDef.maxSize)!=null?l:q.maxSize)},getStart:t=>{const o=t?t==="left"?n.getLeftVisibleLeafColumns():n.getRightVisibleLeafColumns():n.getVisibleLeafColumns(),l=o.findIndex(r=>r.id===e.id);if(l>0){const r=o[l-1];return r.getStart(t)+r.getSize()}return 0},resetSize:()=>{n.setColumnSizing(t=>{let{[e.id]:o,...l}=t;return l})},getCanResize:()=>{var t,o;return((t=e.columnDef.enableResizing)!=null?t:!0)&&((o=n.options.enableColumnResizing)!=null?o:!0)},getIsResizing:()=>n.getState().columnSizingInfo.isResizingColumn===e.id}),createHeader:(e,n)=>({getSize:()=>{let t=0;const o=l=>{if(l.subHeaders.length)l.subHeaders.forEach(o);else{var r;t+=(r=l.column.getSize())!=null?r:0}};return o(e),t},getStart:()=>{if(e.index>0){const t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},getResizeHandler:()=>{const t=n.getColumn(e.column.id),o=t.getCanResize();return l=>{if(!o||(l.persist==null||l.persist(),K(l)&&l.touches&&l.touches.length>1))return;const r=e.getSize(),i=e?e.getLeafHeaders().map(a=>[a.column.id,a.column.getSize()]):[[t.id,t.getSize()]],g=K(l)?Math.round(l.touches[0].clientX):l.clientX,d=(a,p)=>{if(typeof p!="number")return;let m={};n.setColumnSizingInfo(C=>{var R,x;const w=p-((R=C==null?void 0:C.startOffset)!=null?R:0),h=Math.max(w/((x=C==null?void 0:C.startSize)!=null?x:0),-.999999);return C.columnSizingStart.forEach($=>{let[A,L]=$;m[A]=Math.round(Math.max(L+L*h,0)*100)/100}),{...C,deltaOffset:w,deltaPercentage:h}}),(n.options.columnResizeMode==="onChange"||a==="end")&&n.setColumnSizing(C=>({...C,...m}))},f=a=>d("move",a),s=a=>{d("end",a),n.setColumnSizingInfo(p=>({...p,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},u={moveHandler:a=>f(a.clientX),upHandler:a=>{document.removeEventListener("mousemove",u.moveHandler),document.removeEventListener("mouseup",u.upHandler),s(a.clientX)}},c=Je()?{passive:!1}:!1;K(l)||(document.addEventListener("mousemove",u.moveHandler,c),document.addEventListener("mouseup",u.upHandler,c)),n.setColumnSizingInfo(a=>({...a,startOffset:g,startSize:r,deltaOffset:0,deltaPercentage:0,columnSizingStart:i,isResizingColumn:t.id}))}}}),createTable:e=>({setColumnSizing:n=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(n),setColumnSizingInfo:n=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(n),resetColumnSizing:n=>{var t;e.setColumnSizing(n?{}:(t=e.initialState.columnSizing)!=null?t:{})},resetHeaderSizeInfo:n=>{var t;e.setColumnSizingInfo(n?X():(t=e.initialState.columnSizingInfo)!=null?t:X())},getTotalSize:()=>{var n,t;return(n=(t=e.getHeaderGroups()[0])==null?void 0:t.headers.reduce((o,l)=>o+l.getSize(),0))!=null?n:0},getLeftTotalSize:()=>{var n,t;return(n=(t=e.getLeftHeaderGroups()[0])==null?void 0:t.headers.reduce((o,l)=>o+l.getSize(),0))!=null?n:0},getCenterTotalSize:()=>{var n,t;return(n=(t=e.getCenterHeaderGroups()[0])==null?void 0:t.headers.reduce((o,l)=>o+l.getSize(),0))!=null?n:0},getRightTotalSize:()=>{var n,t;return(n=(t=e.getRightHeaderGroups()[0])==null?void 0:t.headers.reduce((o,l)=>o+l.getSize(),0))!=null?n:0}})};let U=null;function Je(){if(typeof U=="boolean")return U;let e=!1;try{const n={get passive(){return e=!0,!1}},t=()=>{};window.addEventListener("test",t,n),window.removeEventListener("test",t)}catch{e=!1}return U=e,U}function K(e){return e.type==="touchstart"}const Qe={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:b("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let n=!1,t=!1;return{_autoResetExpanded:()=>{var o,l;if(!n){e._queue(()=>{n=!0});return}if((o=(l=e.options.autoResetAll)!=null?l:e.options.autoResetExpanded)!=null?o:!e.options.manualExpanding){if(t)return;t=!0,e._queue(()=>{e.resetExpanded(),t=!1})}},setExpanded:o=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(o),toggleAllRowsExpanded:o=>{o??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},resetExpanded:o=>{var l,r;e.setExpanded(o?{}:(l=(r=e.initialState)==null?void 0:r.expanded)!=null?l:{})},getCanSomeRowsExpand:()=>e.getRowModel().flatRows.some(o=>o.getCanExpand()),getToggleAllRowsExpandedHandler:()=>o=>{o.persist==null||o.persist(),e.toggleAllRowsExpanded()},getIsSomeRowsExpanded:()=>{const o=e.getState().expanded;return o===!0||Object.values(o).some(Boolean)},getIsAllRowsExpanded:()=>{const o=e.getState().expanded;return typeof o=="boolean"?o===!0:!(!Object.keys(o).length||e.getRowModel().flatRows.some(l=>l.getIsExpanded()))},getExpandedDepth:()=>{let o=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(r=>{const i=r.split(".");o=Math.max(o,i.length)}),o},getPreExpandedRowModel:()=>e.getSortedRowModel(),getExpandedRowModel:()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())}},createRow:(e,n)=>({toggleExpanded:t=>{n.setExpanded(o=>{var l;const r=o===!0?!0:!!(o!=null&&o[e.id]);let i={};if(o===!0?Object.keys(n.getRowModel().rowsById).forEach(g=>{i[g]=!0}):i=o,t=(l=t)!=null?l:!r,!r&&t)return{...i,[e.id]:!0};if(r&&!t){const{[e.id]:g,...d}=i;return d}return o})},getIsExpanded:()=>{var t;const o=n.getState().expanded;return!!((t=n.options.getIsRowExpanded==null?void 0:n.options.getIsRowExpanded(e))!=null?t:o===!0||o!=null&&o[e.id])},getCanExpand:()=>{var t,o,l;return(t=n.options.getRowCanExpand==null?void 0:n.options.getRowCanExpand(e))!=null?t:((o=n.options.enableExpanding)!=null?o:!0)&&!!((l=e.subRows)!=null&&l.length)},getToggleExpandedHandler:()=>{const t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}})},we=(e,n,t)=>{var o;const l=t.toLowerCase();return(o=e.getValue(n))==null?void 0:o.toLowerCase().includes(l)};we.autoRemove=e=>M(e);const ve=(e,n,t)=>{var o;return(o=e.getValue(n))==null?void 0:o.includes(t)};ve.autoRemove=e=>M(e);const Re=(e,n,t)=>{var o;return((o=e.getValue(n))==null?void 0:o.toLowerCase())===t.toLowerCase()};Re.autoRemove=e=>M(e);const _e=(e,n,t)=>{var o;return(o=e.getValue(n))==null?void 0:o.includes(t)};_e.autoRemove=e=>M(e)||!(e!=null&&e.length);const $e=(e,n,t)=>!t.some(o=>{var l;return!((l=e.getValue(n))!=null&&l.includes(o))});$e.autoRemove=e=>M(e)||!(e!=null&&e.length);const Fe=(e,n,t)=>t.some(o=>{var l;return(l=e.getValue(n))==null?void 0:l.includes(o)});Fe.autoRemove=e=>M(e)||!(e!=null&&e.length);const xe=(e,n,t)=>e.getValue(n)===t;xe.autoRemove=e=>M(e);const be=(e,n,t)=>e.getValue(n)==t;be.autoRemove=e=>M(e);const re=(e,n,t)=>{let[o,l]=t;const r=e.getValue(n);return r>=o&&r<=l};re.resolveFilterValue=e=>{let[n,t]=e,o=typeof n!="number"?parseFloat(n):n,l=typeof t!="number"?parseFloat(t):t,r=n===null||Number.isNaN(o)?-1/0:o,i=t===null||Number.isNaN(l)?1/0:l;if(r>i){const g=r;r=i,i=g}return[r,i]};re.autoRemove=e=>M(e)||M(e[0])&&M(e[1]);const I={includesString:we,includesStringSensitive:ve,equalsString:Re,arrIncludes:_e,arrIncludesAll:$e,arrIncludesSome:Fe,equals:xe,weakEquals:be,inNumberRange:re};function M(e){return e==null||e===""}const Ye={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],globalFilter:void 0,...e}),getDefaultOptions:e=>({onColumnFiltersChange:b("columnFilters",e),onGlobalFilterChange:b("globalFilter",e),filterFromLeafRows:!1,globalFilterFn:"auto",getColumnCanGlobalFilter:n=>{var t,o;const l=(t=e.getCoreRowModel().flatRows[0])==null||(o=t._getAllCellsByColumnId()[n.id])==null?void 0:o.getValue();return typeof l=="string"||typeof l=="number"}}),createColumn:(e,n)=>({getAutoFilterFn:()=>{const t=n.getCoreRowModel().flatRows[0],o=t==null?void 0:t.getValue(e.id);return typeof o=="string"?I.includesString:typeof o=="number"?I.inNumberRange:typeof o=="boolean"||o!==null&&typeof o=="object"?I.equals:Array.isArray(o)?I.arrIncludes:I.weakEquals},getFilterFn:()=>{var t,o;return W(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(t=(o=n.options.filterFns)==null?void 0:o[e.columnDef.filterFn])!=null?t:I[e.columnDef.filterFn]},getCanFilter:()=>{var t,o,l;return((t=e.columnDef.enableColumnFilter)!=null?t:!0)&&((o=n.options.enableColumnFilters)!=null?o:!0)&&((l=n.options.enableFilters)!=null?l:!0)&&!!e.accessorFn},getCanGlobalFilter:()=>{var t,o,l,r;return((t=e.columnDef.enableGlobalFilter)!=null?t:!0)&&((o=n.options.enableGlobalFilter)!=null?o:!0)&&((l=n.options.enableFilters)!=null?l:!0)&&((r=n.options.getColumnCanGlobalFilter==null?void 0:n.options.getColumnCanGlobalFilter(e))!=null?r:!0)&&!!e.accessorFn},getIsFiltered:()=>e.getFilterIndex()>-1,getFilterValue:()=>{var t,o;return(t=n.getState().columnFilters)==null||(o=t.find(l=>l.id===e.id))==null?void 0:o.value},getFilterIndex:()=>{var t,o;return(t=(o=n.getState().columnFilters)==null?void 0:o.findIndex(l=>l.id===e.id))!=null?t:-1},setFilterValue:t=>{n.setColumnFilters(o=>{const l=e.getFilterFn(),r=o==null?void 0:o.find(s=>s.id===e.id),i=E(t,r?r.value:void 0);if(de(l,i,e)){var g;return(g=o==null?void 0:o.filter(s=>s.id!==e.id))!=null?g:[]}const d={id:e.id,value:i};if(r){var f;return(f=o==null?void 0:o.map(s=>s.id===e.id?d:s))!=null?f:[]}return o!=null&&o.length?[...o,d]:[d]})},_getFacetedRowModel:n.options.getFacetedRowModel&&n.options.getFacetedRowModel(n,e.id),getFacetedRowModel:()=>e._getFacetedRowModel?e._getFacetedRowModel():n.getPreFilteredRowModel(),_getFacetedUniqueValues:n.options.getFacetedUniqueValues&&n.options.getFacetedUniqueValues(n,e.id),getFacetedUniqueValues:()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,_getFacetedMinMaxValues:n.options.getFacetedMinMaxValues&&n.options.getFacetedMinMaxValues(n,e.id),getFacetedMinMaxValues:()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}),createRow:(e,n)=>({columnFilters:{},columnFiltersMeta:{}}),createTable:e=>({getGlobalAutoFilterFn:()=>I.includesString,getGlobalFilterFn:()=>{var n,t;const{globalFilterFn:o}=e.options;return W(o)?o:o==="auto"?e.getGlobalAutoFilterFn():(n=(t=e.options.filterFns)==null?void 0:t[o])!=null?n:I[o]},setColumnFilters:n=>{const t=e.getAllLeafColumns(),o=l=>{var r;return(r=E(n,l))==null?void 0:r.filter(i=>{const g=t.find(d=>d.id===i.id);if(g){const d=g.getFilterFn();if(de(d,i.value,g))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(o)},setGlobalFilter:n=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(n)},resetGlobalFilter:n=>{e.setGlobalFilter(n?void 0:e.initialState.globalFilter)},resetColumnFilters:n=>{var t,o;e.setColumnFilters(n?[]:(t=(o=e.initialState)==null?void 0:o.columnFilters)!=null?t:[])},getPreFilteredRowModel:()=>e.getCoreRowModel(),getFilteredRowModel:()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel()),_getGlobalFacetedRowModel:e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),getGlobalFacetedRowModel:()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),_getGlobalFacetedUniqueValues:e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),getGlobalFacetedUniqueValues:()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,_getGlobalFacetedMinMaxValues:e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),getGlobalFacetedMinMaxValues:()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}})};function de(e,n,t){return(e&&e.autoRemove?e.autoRemove(n,t):!1)||typeof n>"u"||typeof n=="string"&&!n}const Ze=(e,n,t)=>t.reduce((o,l)=>{const r=l.getValue(e);return o+(typeof r=="number"?r:0)},0),et=(e,n,t)=>{let o;return t.forEach(l=>{const r=l.getValue(e);r!=null&&(o>r||o===void 0&&r>=r)&&(o=r)}),o},tt=(e,n,t)=>{let o;return t.forEach(l=>{const r=l.getValue(e);r!=null&&(o<r||o===void 0&&r>=r)&&(o=r)}),o},nt=(e,n,t)=>{let o,l;return t.forEach(r=>{const i=r.getValue(e);i!=null&&(o===void 0?i>=i&&(o=l=i):(o>i&&(o=i),l<i&&(l=i)))}),[o,l]},ot=(e,n)=>{let t=0,o=0;if(n.forEach(l=>{let r=l.getValue(e);r!=null&&(r=+r)>=r&&(++t,o+=r)}),t)return o/t},lt=(e,n)=>{if(!n.length)return;let t=0,o=0;return n.forEach(l=>{let r=l.getValue(e);typeof r=="number"&&(t=Math.min(t,r),o=Math.max(o,r))}),(t+o)/2},rt=(e,n)=>Array.from(new Set(n.map(t=>t.getValue(e))).values()),it=(e,n)=>new Set(n.map(t=>t.getValue(e))).size,st=(e,n)=>n.length,J={sum:Ze,min:et,max:tt,extent:nt,mean:ot,median:lt,unique:rt,uniqueCount:it,count:st},ut={getDefaultColumnDef:()=>({aggregatedCell:e=>{var n,t;return(n=(t=e.getValue())==null||t.toString==null?void 0:t.toString())!=null?n:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:b("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,n)=>({toggleGrouping:()=>{n.setGrouping(t=>t!=null&&t.includes(e.id)?t.filter(o=>o!==e.id):[...t??[],e.id])},getCanGroup:()=>{var t,o,l,r;return(t=(o=(l=(r=e.columnDef.enableGrouping)!=null?r:!0)!=null?l:n.options.enableGrouping)!=null?o:!0)!=null?t:!!e.accessorFn},getIsGrouped:()=>{var t;return(t=n.getState().grouping)==null?void 0:t.includes(e.id)},getGroupedIndex:()=>{var t;return(t=n.getState().grouping)==null?void 0:t.indexOf(e.id)},getToggleGroupingHandler:()=>{const t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},getAutoAggregationFn:()=>{const t=n.getCoreRowModel().flatRows[0],o=t==null?void 0:t.getValue(e.id);if(typeof o=="number")return J.sum;if(Object.prototype.toString.call(o)==="[object Date]")return J.extent},getAggregationFn:()=>{var t,o;if(!e)throw new Error;return W(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(t=(o=n.options.aggregationFns)==null?void 0:o[e.columnDef.aggregationFn])!=null?t:J[e.columnDef.aggregationFn]}}),createTable:e=>({setGrouping:n=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(n),resetGrouping:n=>{var t,o;e.setGrouping(n?[]:(t=(o=e.initialState)==null?void 0:o.grouping)!=null?t:[])},getPreGroupedRowModel:()=>e.getFilteredRowModel(),getGroupedRowModel:()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())}),createRow:e=>({getIsGrouped:()=>!!e.groupingColumnId,_groupingValuesCache:{}}),createCell:(e,n,t,o)=>({getIsGrouped:()=>n.getIsGrouped()&&n.id===t.groupingColumnId,getIsPlaceholder:()=>!e.getIsGrouped()&&n.getIsGrouped(),getIsAggregated:()=>{var l;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((l=t.subRows)!=null&&l.length)}})};function at(e,n,t){if(!(n!=null&&n.length)||!t)return e;const o=e.filter(r=>!n.includes(r.id));return t==="remove"?o:[...n.map(r=>e.find(i=>i.id===r)).filter(Boolean),...o]}const gt={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:b("columnOrder",e)}),createTable:e=>({setColumnOrder:n=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(n),resetColumnOrder:n=>{var t;e.setColumnOrder(n?[]:(t=e.initialState.columnOrder)!=null?t:[])},_getOrderColumnsFn:S(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(n,t,o)=>l=>{let r=[];if(!(n!=null&&n.length))r=l;else{const i=[...n],g=[...l];for(;g.length&&i.length;){const d=i.shift(),f=g.findIndex(s=>s.id===d);f>-1&&r.push(g.splice(f,1)[0])}r=[...r,...g]}return at(r,t,o)},{key:!1})})},te=0,ne=10,Q=()=>({pageIndex:te,pageSize:ne}),dt={getInitialState:e=>({...e,pagination:{...Q(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:b("pagination",e)}),createTable:e=>{let n=!1,t=!1;return{_autoResetPageIndex:()=>{var o,l;if(!n){e._queue(()=>{n=!0});return}if((o=(l=e.options.autoResetAll)!=null?l:e.options.autoResetPageIndex)!=null?o:!e.options.manualPagination){if(t)return;t=!0,e._queue(()=>{e.resetPageIndex(),t=!1})}},setPagination:o=>{const l=r=>E(o,r);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(l)},resetPagination:o=>{var l;e.setPagination(o?Q():(l=e.initialState.pagination)!=null?l:Q())},setPageIndex:o=>{e.setPagination(l=>{let r=E(o,l.pageIndex);const i=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return r=Math.min(Math.max(0,r),i),{...l,pageIndex:r}})},resetPageIndex:o=>{var l,r,i;e.setPageIndex(o?te:(l=(r=e.initialState)==null||(i=r.pagination)==null?void 0:i.pageIndex)!=null?l:te)},resetPageSize:o=>{var l,r,i;e.setPageSize(o?ne:(l=(r=e.initialState)==null||(i=r.pagination)==null?void 0:i.pageSize)!=null?l:ne)},setPageSize:o=>{e.setPagination(l=>{const r=Math.max(1,E(o,l.pageSize)),i=l.pageSize*l.pageIndex,g=Math.floor(i/r);return{...l,pageIndex:g,pageSize:r}})},setPageCount:o=>e.setPagination(l=>{var r;let i=E(o,(r=e.options.pageCount)!=null?r:-1);return typeof i=="number"&&(i=Math.max(-1,i)),{...l,pageCount:i}}),getPageOptions:S(()=>[e.getPageCount()],o=>{let l=[];return o&&o>0&&(l=[...new Array(o)].fill(null).map((r,i)=>i)),l},{key:!1,debug:()=>{var o;return(o=e.options.debugAll)!=null?o:e.options.debugTable}}),getCanPreviousPage:()=>e.getState().pagination.pageIndex>0,getCanNextPage:()=>{const{pageIndex:o}=e.getState().pagination,l=e.getPageCount();return l===-1?!0:l===0?!1:o<l-1},previousPage:()=>e.setPageIndex(o=>o-1),nextPage:()=>e.setPageIndex(o=>o+1),getPrePaginationRowModel:()=>e.getExpandedRowModel(),getPaginationRowModel:()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),getPageCount:()=>{var o;return(o=e.options.pageCount)!=null?o:Math.ceil(e.getPrePaginationRowModel().rows.length/e.getState().pagination.pageSize)}}}},Y=()=>({left:[],right:[]}),ct={getInitialState:e=>({columnPinning:Y(),...e}),getDefaultOptions:e=>({onColumnPinningChange:b("columnPinning",e)}),createColumn:(e,n)=>({pin:t=>{const o=e.getLeafColumns().map(l=>l.id).filter(Boolean);n.setColumnPinning(l=>{var r,i;if(t==="right"){var g,d;return{left:((g=l==null?void 0:l.left)!=null?g:[]).filter(u=>!(o!=null&&o.includes(u))),right:[...((d=l==null?void 0:l.right)!=null?d:[]).filter(u=>!(o!=null&&o.includes(u))),...o]}}if(t==="left"){var f,s;return{left:[...((f=l==null?void 0:l.left)!=null?f:[]).filter(u=>!(o!=null&&o.includes(u))),...o],right:((s=l==null?void 0:l.right)!=null?s:[]).filter(u=>!(o!=null&&o.includes(u)))}}return{left:((r=l==null?void 0:l.left)!=null?r:[]).filter(u=>!(o!=null&&o.includes(u))),right:((i=l==null?void 0:l.right)!=null?i:[]).filter(u=>!(o!=null&&o.includes(u)))}})},getCanPin:()=>e.getLeafColumns().some(o=>{var l,r;return((l=o.columnDef.enablePinning)!=null?l:!0)&&((r=n.options.enablePinning)!=null?r:!0)}),getIsPinned:()=>{const t=e.getLeafColumns().map(g=>g.id),{left:o,right:l}=n.getState().columnPinning,r=t.some(g=>o==null?void 0:o.includes(g)),i=t.some(g=>l==null?void 0:l.includes(g));return r?"left":i?"right":!1},getPinnedIndex:()=>{var t,o,l;const r=e.getIsPinned();return r?(t=(o=n.getState().columnPinning)==null||(l=o[r])==null?void 0:l.indexOf(e.id))!=null?t:-1:0}}),createRow:(e,n)=>({getCenterVisibleCells:S(()=>[e._getAllVisibleCells(),n.getState().columnPinning.left,n.getState().columnPinning.right],(t,o,l)=>{const r=[...o??[],...l??[]];return t.filter(i=>!r.includes(i.column.id))},{key:"row.getCenterVisibleCells",debug:()=>{var t;return(t=n.options.debugAll)!=null?t:n.options.debugRows}}),getLeftVisibleCells:S(()=>[e._getAllVisibleCells(),n.getState().columnPinning.left,,],(t,o)=>(o??[]).map(r=>t.find(i=>i.column.id===r)).filter(Boolean).map(r=>({...r,position:"left"})),{key:"row.getLeftVisibleCells",debug:()=>{var t;return(t=n.options.debugAll)!=null?t:n.options.debugRows}}),getRightVisibleCells:S(()=>[e._getAllVisibleCells(),n.getState().columnPinning.right],(t,o)=>(o??[]).map(r=>t.find(i=>i.column.id===r)).filter(Boolean).map(r=>({...r,position:"left"})),{key:"row.getRightVisibleCells",debug:()=>{var t;return(t=n.options.debugAll)!=null?t:n.options.debugRows}})}),createTable:e=>({setColumnPinning:n=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(n),resetColumnPinning:n=>{var t,o;return e.setColumnPinning(n?Y():(t=(o=e.initialState)==null?void 0:o.columnPinning)!=null?t:Y())},getIsSomeColumnsPinned:n=>{var t;const o=e.getState().columnPinning;if(!n){var l,r;return!!((l=o.left)!=null&&l.length||(r=o.right)!=null&&r.length)}return!!((t=o[n])!=null&&t.length)},getLeftLeafColumns:S(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(n,t)=>(t??[]).map(o=>n.find(l=>l.id===o)).filter(Boolean),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugColumns}}),getRightLeafColumns:S(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(n,t)=>(t??[]).map(o=>n.find(l=>l.id===o)).filter(Boolean),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugColumns}}),getCenterLeafColumns:S(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,t,o)=>{const l=[...t??[],...o??[]];return n.filter(r=>!l.includes(r.id))},{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugColumns}})})},ft={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:b("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>({setRowSelection:n=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(n),resetRowSelection:n=>{var t;return e.setRowSelection(n?{}:(t=e.initialState.rowSelection)!=null?t:{})},toggleAllRowsSelected:n=>{e.setRowSelection(t=>{n=typeof n<"u"?n:!e.getIsAllRowsSelected();const o={...t},l=e.getPreGroupedRowModel().flatRows;return n?l.forEach(r=>{r.getCanSelect()&&(o[r.id]=!0)}):l.forEach(r=>{delete o[r.id]}),o})},toggleAllPageRowsSelected:n=>e.setRowSelection(t=>{const o=typeof n<"u"?n:!e.getIsAllPageRowsSelected(),l={...t};return e.getRowModel().rows.forEach(r=>{oe(l,r.id,o,e)}),l}),getPreSelectedRowModel:()=>e.getCoreRowModel(),getSelectedRowModel:S(()=>[e.getState().rowSelection,e.getCoreRowModel()],(n,t)=>Object.keys(n).length?Z(e,t):{rows:[],flatRows:[],rowsById:{}},{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugTable}}),getFilteredSelectedRowModel:S(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(n,t)=>Object.keys(n).length?Z(e,t):{rows:[],flatRows:[],rowsById:{}},{key:"getFilteredSelectedRowModel",debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugTable}}),getGroupedSelectedRowModel:S(()=>[e.getState().rowSelection,e.getSortedRowModel()],(n,t)=>Object.keys(n).length?Z(e,t):{rows:[],flatRows:[],rowsById:{}},{key:"getGroupedSelectedRowModel",debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugTable}}),getIsAllRowsSelected:()=>{const n=e.getFilteredRowModel().flatRows,{rowSelection:t}=e.getState();let o=!!(n.length&&Object.keys(t).length);return o&&n.some(l=>l.getCanSelect()&&!t[l.id])&&(o=!1),o},getIsAllPageRowsSelected:()=>{const n=e.getPaginationRowModel().flatRows,{rowSelection:t}=e.getState();let o=!!n.length;return o&&n.some(l=>!t[l.id])&&(o=!1),o},getIsSomeRowsSelected:()=>{var n;const t=Object.keys((n=e.getState().rowSelection)!=null?n:{}).length;return t>0&&t<e.getFilteredRowModel().flatRows.length},getIsSomePageRowsSelected:()=>{const n=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:n.some(t=>t.getIsSelected()||t.getIsSomeSelected())},getToggleAllRowsSelectedHandler:()=>n=>{e.toggleAllRowsSelected(n.target.checked)},getToggleAllPageRowsSelectedHandler:()=>n=>{e.toggleAllPageRowsSelected(n.target.checked)}}),createRow:(e,n)=>({toggleSelected:t=>{const o=e.getIsSelected();n.setRowSelection(l=>{if(t=typeof t<"u"?t:!o,o===t)return l;const r={...l};return oe(r,e.id,t,n),r})},getIsSelected:()=>{const{rowSelection:t}=n.getState();return ie(e,t)},getIsSomeSelected:()=>{const{rowSelection:t}=n.getState();return ce(e,t)==="some"},getIsAllSubRowsSelected:()=>{const{rowSelection:t}=n.getState();return ce(e,t)==="all"},getCanSelect:()=>{var t;return typeof n.options.enableRowSelection=="function"?n.options.enableRowSelection(e):(t=n.options.enableRowSelection)!=null?t:!0},getCanSelectSubRows:()=>{var t;return typeof n.options.enableSubRowSelection=="function"?n.options.enableSubRowSelection(e):(t=n.options.enableSubRowSelection)!=null?t:!0},getCanMultiSelect:()=>{var t;return typeof n.options.enableMultiRowSelection=="function"?n.options.enableMultiRowSelection(e):(t=n.options.enableMultiRowSelection)!=null?t:!0},getToggleSelectedHandler:()=>{const t=e.getCanSelect();return o=>{var l;t&&e.toggleSelected((l=o.target)==null?void 0:l.checked)}}})},oe=(e,n,t,o)=>{var l;const r=o.getRow(n);t?(r.getCanMultiSelect()||Object.keys(e).forEach(i=>delete e[i]),r.getCanSelect()&&(e[n]=!0)):delete e[n],(l=r.subRows)!=null&&l.length&&r.getCanSelectSubRows()&&r.subRows.forEach(i=>oe(e,i.id,t,o))};function Z(e,n){const t=e.getState().rowSelection,o=[],l={},r=function(i,g){return i.map(d=>{var f;const s=ie(d,t);if(s&&(o.push(d),l[d.id]=d),(f=d.subRows)!=null&&f.length&&(d={...d,subRows:r(d.subRows)}),s)return d}).filter(Boolean)};return{rows:r(n.rows),flatRows:o,rowsById:l}}function ie(e,n){var t;return(t=n[e.id])!=null?t:!1}function ce(e,n,t){if(e.subRows&&e.subRows.length){let o=!0,l=!1;return e.subRows.forEach(r=>{l&&!o||(ie(r,n)?l=!0:o=!1)}),o?"all":l?"some":!1}return!1}const le=/([0-9]+)/gm,pt=(e,n,t)=>Me(D(e.getValue(t)).toLowerCase(),D(n.getValue(t)).toLowerCase()),mt=(e,n,t)=>Me(D(e.getValue(t)),D(n.getValue(t))),St=(e,n,t)=>se(D(e.getValue(t)).toLowerCase(),D(n.getValue(t)).toLowerCase()),Ct=(e,n,t)=>se(D(e.getValue(t)),D(n.getValue(t))),ht=(e,n,t)=>{const o=e.getValue(t),l=n.getValue(t);return o>l?1:o<l?-1:0},wt=(e,n,t)=>se(e.getValue(t),n.getValue(t));function se(e,n){return e===n?0:e>n?1:-1}function D(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function Me(e,n){const t=e.split(le).filter(Boolean),o=n.split(le).filter(Boolean);for(;t.length&&o.length;){const l=t.shift(),r=o.shift(),i=parseInt(l,10),g=parseInt(r,10),d=[i,g].sort();if(isNaN(d[0])){if(l>r)return 1;if(r>l)return-1;continue}if(isNaN(d[1]))return isNaN(i)?-1:1;if(i>g)return 1;if(g>i)return-1}return t.length-o.length}const T={alphanumeric:pt,alphanumericCaseSensitive:mt,text:St,textCaseSensitive:Ct,datetime:ht,basic:wt},vt={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto"}),getDefaultOptions:e=>({onSortingChange:b("sorting",e),isMultiSortEvent:n=>n.shiftKey}),createColumn:(e,n)=>({getAutoSortingFn:()=>{const t=n.getFilteredRowModel().flatRows.slice(10);let o=!1;for(const l of t){const r=l==null?void 0:l.getValue(e.id);if(Object.prototype.toString.call(r)==="[object Date]")return T.datetime;if(typeof r=="string"&&(o=!0,r.split(le).length>1))return T.alphanumeric}return o?T.text:T.basic},getAutoSortDir:()=>{const t=n.getFilteredRowModel().flatRows[0];return typeof(t==null?void 0:t.getValue(e.id))=="string"?"asc":"desc"},getSortingFn:()=>{var t,o;if(!e)throw new Error;return W(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(t=(o=n.options.sortingFns)==null?void 0:o[e.columnDef.sortingFn])!=null?t:T[e.columnDef.sortingFn]},toggleSorting:(t,o)=>{const l=e.getNextSortingOrder(),r=typeof t<"u"&&t!==null;n.setSorting(i=>{const g=i==null?void 0:i.find(a=>a.id===e.id),d=i==null?void 0:i.findIndex(a=>a.id===e.id);let f=[],s,u=r?t:l==="desc";if(i!=null&&i.length&&e.getCanMultiSort()&&o?g?s="toggle":s="add":i!=null&&i.length&&d!==i.length-1?s="replace":g?s="toggle":s="replace",s==="toggle"&&(r||l||(s="remove")),s==="add"){var c;f=[...i,{id:e.id,desc:u}],f.splice(0,f.length-((c=n.options.maxMultiSortColCount)!=null?c:Number.MAX_SAFE_INTEGER))}else s==="toggle"?f=i.map(a=>a.id===e.id?{...a,desc:u}:a):s==="remove"?f=i.filter(a=>a.id!==e.id):f=[{id:e.id,desc:u}];return f})},getFirstSortDir:()=>{var t,o;return((t=(o=e.columnDef.sortDescFirst)!=null?o:n.options.sortDescFirst)!=null?t:e.getAutoSortDir()==="desc")?"desc":"asc"},getNextSortingOrder:t=>{var o,l;const r=e.getFirstSortDir(),i=e.getIsSorted();return i?i!==r&&((o=n.options.enableSortingRemoval)==null||o)&&(!(t&&(l=n.options.enableMultiRemove)!=null)||l)?!1:i==="desc"?"asc":"desc":r},getCanSort:()=>{var t,o;return((t=e.columnDef.enableSorting)!=null?t:!0)&&((o=n.options.enableSorting)!=null?o:!0)&&!!e.accessorFn},getCanMultiSort:()=>{var t,o;return(t=(o=e.columnDef.enableMultiSort)!=null?o:n.options.enableMultiSort)!=null?t:!!e.accessorFn},getIsSorted:()=>{var t;const o=(t=n.getState().sorting)==null?void 0:t.find(l=>l.id===e.id);return o?o.desc?"desc":"asc":!1},getSortIndex:()=>{var t,o;return(t=(o=n.getState().sorting)==null?void 0:o.findIndex(l=>l.id===e.id))!=null?t:-1},clearSorting:()=>{n.setSorting(t=>t!=null&&t.length?t.filter(o=>o.id!==e.id):[])},getToggleSortingHandler:()=>{const t=e.getCanSort();return o=>{t&&(o.persist==null||o.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?n.options.isMultiSortEvent==null?void 0:n.options.isMultiSortEvent(o):!1))}}}),createTable:e=>({setSorting:n=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(n),resetSorting:n=>{var t,o;e.setSorting(n?[]:(t=(o=e.initialState)==null?void 0:o.sorting)!=null?t:[])},getPreSortedRowModel:()=>e.getGroupedRowModel(),getSortedRowModel:()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())})},Rt={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:b("columnVisibility",e)}),createColumn:(e,n)=>({toggleVisibility:t=>{e.getCanHide()&&n.setColumnVisibility(o=>({...o,[e.id]:t??!e.getIsVisible()}))},getIsVisible:()=>{var t,o;return(t=(o=n.getState().columnVisibility)==null?void 0:o[e.id])!=null?t:!0},getCanHide:()=>{var t,o;return((t=e.columnDef.enableHiding)!=null?t:!0)&&((o=n.options.enableHiding)!=null?o:!0)},getToggleVisibilityHandler:()=>t=>{e.toggleVisibility==null||e.toggleVisibility(t.target.checked)}}),createRow:(e,n)=>({_getAllVisibleCells:S(()=>[e.getAllCells(),n.getState().columnVisibility],t=>t.filter(o=>o.column.getIsVisible()),{key:"row._getAllVisibleCells",debug:()=>{var t;return(t=n.options.debugAll)!=null?t:n.options.debugRows}}),getVisibleCells:S(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(t,o,l)=>[...t,...o,...l],{key:!1,debug:()=>{var t;return(t=n.options.debugAll)!=null?t:n.options.debugRows}})}),createTable:e=>{const n=(t,o)=>S(()=>[o(),o().filter(l=>l.getIsVisible()).map(l=>l.id).join("_")],l=>l.filter(r=>r.getIsVisible==null?void 0:r.getIsVisible()),{key:t,debug:()=>{var l;return(l=e.options.debugAll)!=null?l:e.options.debugColumns}});return{getVisibleFlatColumns:n("getVisibleFlatColumns",()=>e.getAllFlatColumns()),getVisibleLeafColumns:n("getVisibleLeafColumns",()=>e.getAllLeafColumns()),getLeftVisibleLeafColumns:n("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),getRightVisibleLeafColumns:n("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),getCenterVisibleLeafColumns:n("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),setColumnVisibility:t=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(t),resetColumnVisibility:t=>{var o;e.setColumnVisibility(t?{}:(o=e.initialState.columnVisibility)!=null?o:{})},toggleAllColumnsVisible:t=>{var o;t=(o=t)!=null?o:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((l,r)=>({...l,[r.id]:t||!(r.getCanHide!=null&&r.getCanHide())}),{}))},getIsAllColumnsVisible:()=>!e.getAllLeafColumns().some(t=>!(t.getIsVisible!=null&&t.getIsVisible())),getIsSomeColumnsVisible:()=>e.getAllLeafColumns().some(t=>t.getIsVisible==null?void 0:t.getIsVisible()),getToggleAllColumnsVisibilityHandler:()=>t=>{var o;e.toggleAllColumnsVisible((o=t.target)==null?void 0:o.checked)}}}},fe=[Xe,Rt,gt,ct,Ye,vt,ut,Qe,dt,ft,Ke];function _t(e){var n;(e.debugAll||e.debugTable)&&console.info("Creating Table Instance...");let t={_features:fe};const o=t._features.reduce((s,u)=>Object.assign(s,u.getDefaultOptions==null?void 0:u.getDefaultOptions(t)),{}),l=s=>t.options.mergeOptions?t.options.mergeOptions(o,s):{...o,...s};let i={...{},...(n=e.initialState)!=null?n:{}};t._features.forEach(s=>{var u;i=(u=s.getInitialState==null?void 0:s.getInitialState(i))!=null?u:i});const g=[];let d=!1;const f={_features:fe,options:{...o,...e},initialState:i,_queue:s=>{g.push(s),d||(d=!0,Promise.resolve().then(()=>{for(;g.length;)g.shift()();d=!1}).catch(u=>setTimeout(()=>{throw u})))},reset:()=>{t.setState(t.initialState)},setOptions:s=>{const u=E(s,t.options);t.options=l(u)},getState:()=>t.options.state,setState:s=>{t.options.onStateChange==null||t.options.onStateChange(s)},_getRowId:(s,u,c)=>{var a;return(a=t.options.getRowId==null?void 0:t.options.getRowId(s,u,c))!=null?a:""+(c?[c.id,u].join("."):u)},getCoreRowModel:()=>(t._getCoreRowModel||(t._getCoreRowModel=t.options.getCoreRowModel(t)),t._getCoreRowModel()),getRowModel:()=>t.getPaginationRowModel(),getRow:s=>{const u=t.getRowModel().rowsById[s];if(!u)throw new Error;return u},_getDefaultColumnDef:S(()=>[t.options.defaultColumn],s=>{var u;return s=(u=s)!=null?u:{},{header:c=>{const a=c.header.column.columnDef;return a.accessorKey?a.accessorKey:a.accessorFn?a.id:null},cell:c=>{var a,p;return(a=(p=c.renderValue())==null||p.toString==null?void 0:p.toString())!=null?a:null},...t._features.reduce((c,a)=>Object.assign(c,a.getDefaultColumnDef==null?void 0:a.getDefaultColumnDef()),{}),...s}},{debug:()=>{var s;return(s=t.options.debugAll)!=null?s:t.options.debugColumns},key:!1}),_getColumnDefs:()=>t.options.columns,getAllColumns:S(()=>[t._getColumnDefs()],s=>{const u=function(c,a,p){return p===void 0&&(p=0),c.map(m=>{const C=We(t,m,p,a),R=m;return C.columns=R.columns?u(R.columns,C,p+1):[],C})};return u(s)},{key:!1,debug:()=>{var s;return(s=t.options.debugAll)!=null?s:t.options.debugColumns}}),getAllFlatColumns:S(()=>[t.getAllColumns()],s=>s.flatMap(u=>u.getFlatColumns()),{key:!1,debug:()=>{var s;return(s=t.options.debugAll)!=null?s:t.options.debugColumns}}),_getAllFlatColumnsById:S(()=>[t.getAllFlatColumns()],s=>s.reduce((u,c)=>(u[c.id]=c,u),{}),{key:!1,debug:()=>{var s;return(s=t.options.debugAll)!=null?s:t.options.debugColumns}}),getAllLeafColumns:S(()=>[t.getAllColumns(),t._getOrderColumnsFn()],(s,u)=>{let c=s.flatMap(a=>a.getLeafColumns());return u(c)},{key:!1,debug:()=>{var s;return(s=t.options.debugAll)!=null?s:t.options.debugColumns}}),getColumn:s=>{const u=t._getAllFlatColumnsById()[s];if(!u)throw new Error;return u}};return Object.assign(t,f),t._features.forEach(s=>Object.assign(t,s.createTable==null?void 0:s.createTable(t))),t}function $t(e,n,t,o){const l=()=>{var i;return(i=r.getValue())!=null?i:e.options.renderFallbackValue},r={id:n.id+"_"+t.id,row:n,column:t,getValue:()=>n.getValue(o),renderValue:l,getContext:()=>({table:e,column:t,row:n,cell:r,getValue:r.getValue,renderValue:r.renderValue})};return e._features.forEach(i=>{Object.assign(r,i.createCell==null?void 0:i.createCell(r,t,n,e))},{}),r}const ue=(e,n,t,o,l,r)=>{let i={id:n,index:o,original:t,depth:l,_valuesCache:{},getValue:g=>{if(i._valuesCache.hasOwnProperty(g))return i._valuesCache[g];const d=e.getColumn(g);if(d.accessorFn)return i._valuesCache[g]=d.accessorFn(i.original,o),i._valuesCache[g]},renderValue:g=>{var d;return(d=i.getValue(g))!=null?d:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>Ue(i.subRows,g=>g.subRows),getAllCells:S(()=>[e.getAllLeafColumns()],g=>g.map(d=>$t(e,i,d,d.id)),{key:!1,debug:()=>{var g;return(g=e.options.debugAll)!=null?g:e.options.debugRows}}),_getAllCellsByColumnId:S(()=>[i.getAllCells()],g=>g.reduce((d,f)=>(d[f.column.id]=f,d),{}),{key:"row.getAllCellsByColumnId",debug:()=>{var g;return(g=e.options.debugAll)!=null?g:e.options.debugRows}})};for(let g=0;g<e._features.length;g++){const d=e._features[g];Object.assign(i,d==null||d.createRow==null?void 0:d.createRow(i,e))}return i};function Ft(){return e=>S(()=>[e.options.data],n=>{const t={rows:[],flatRows:[],rowsById:{}},o=function(l,r,i){r===void 0&&(r=0);const g=[];for(let f=0;f<l.length;f++){const s=ue(e,e._getRowId(l[f],f,i),l[f],f,r);if(t.flatRows.push(s),t.rowsById[s.id]=s,g.push(s),e.options.getSubRows){var d;s.originalSubRows=e.options.getSubRows(l[f],f),(d=s.originalSubRows)!=null&&d.length&&(s.subRows=o(s.originalSubRows,r+1,s))}}return g};return t.rows=o(n),t},{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugTable},onChange:()=>{e._autoResetPageIndex()}})}function xt(e,n,t){return t.options.filterFromLeafRows?bt(e,n,t):Mt(e,n,t)}function bt(e,n,t){const o=[],l={},r=function(i,g){const d=[];for(let s=0;s<i.length;s++){var f;let u=i[s];if((f=u.subRows)!=null&&f.length){const c=ue(t,u.id,u.original,u.index,u.depth);if(c.columnFilters=u.columnFilters,c.subRows=r(u.subRows),!c.subRows.length)continue;u=c}n(u)&&(d.push(u),l[u.id]=u,l[s]=u)}return d};return{rows:r(e),flatRows:o,rowsById:l}}function Mt(e,n,t){const o=[],l={},r=function(i,g){const d=[];for(let s=0;s<i.length;s++){let u=i[s];if(n(u)){var f;if((f=u.subRows)!=null&&f.length){const a=ue(t,u.id,u.original,u.index,u.depth);a.subRows=r(u.subRows),u=a}d.push(u),o.push(u),l[u.id]=u}}return d};return{rows:r(e),flatRows:o,rowsById:l}}function yt(){return e=>S(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(n,t,o)=>{if(!n.rows.length||!(t!=null&&t.length)&&!o){for(let c=0;c<n.flatRows.length;c++)n.flatRows[c].columnFilters={},n.flatRows[c].columnFiltersMeta={};return n}const l=[],r=[];(t??[]).forEach(c=>{var a;const m=e.getColumn(c.id).getFilterFn();m&&l.push({id:c.id,filterFn:m,resolvedValue:(a=m.resolveFilterValue==null?void 0:m.resolveFilterValue(c.value))!=null?a:c.value})});const i=t.map(c=>c.id),g=e.getGlobalFilterFn(),d=e.getAllLeafColumns().filter(c=>c.getCanGlobalFilter());o&&g&&d.length&&(i.push("__global__"),d.forEach(c=>{var a;r.push({id:c.id,filterFn:g,resolvedValue:(a=g.resolveFilterValue==null?void 0:g.resolveFilterValue(o))!=null?a:o})}));let f,s;for(let c=0;c<n.flatRows.length;c++){const a=n.flatRows[c];if(a.columnFilters={},l.length)for(let p=0;p<l.length;p++){f=l[p];const m=f.id;a.columnFilters[m]=f.filterFn(a,m,f.resolvedValue,C=>{a.columnFiltersMeta[m]=C})}if(r.length){for(let p=0;p<r.length;p++){s=r[p];const m=s.id;if(s.filterFn(a,m,s.resolvedValue,C=>{a.columnFiltersMeta[m]=C})){a.columnFilters.__global__=!0;break}}a.columnFilters.__global__!==!0&&(a.columnFilters.__global__=!1)}}const u=c=>{for(let a=0;a<i.length;a++)if(c.columnFilters[i[a]]===!1)return!1;return!0};return xt(n.rows,u,e)},{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugTable},onChange:()=>{e._autoResetPageIndex()}})}function Vt(){return e=>S(()=>[e.getState().sorting,e.getPreSortedRowModel()],(n,t)=>{if(!t.rows.length||!(n!=null&&n.length))return t;const o=e.getState().sorting,l=[],r=o.filter(d=>e.getColumn(d.id).getCanSort()),i={};r.forEach(d=>{const f=e.getColumn(d.id);i[d.id]={sortUndefined:f.columnDef.sortUndefined,invertSorting:f.columnDef.invertSorting,sortingFn:f.getSortingFn()}});const g=d=>{const f=d.slice();return f.sort((s,u)=>{for(let a=0;a<r.length;a+=1){var c;const p=r[a],m=i[p.id],C=(c=p==null?void 0:p.desc)!=null?c:!1;if(m.sortUndefined){const x=s.getValue(p.id),w=u.getValue(p.id),h=typeof x>"u",$=typeof w>"u";if(h||$)return h&&$?0:h?m.sortUndefined:-m.sortUndefined}let R=m.sortingFn(s,u,p.id);if(R!==0)return C&&(R*=-1),m.invertSorting&&(R*=-1),R}return s.index-u.index}),f.forEach(s=>{l.push(s),!(!s.subRows||s.subRows.length<=1)&&(s.subRows=g(s.subRows))}),f};return{rows:g(t.rows),flatRows:l,rowsById:t.rowsById}},{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugTable},onChange:()=>{e._autoResetPageIndex()}})}function It(e,n){return e?At(e)?ee.createElement(e,n):e:null}function At(e){return Pt(e)||typeof e=="function"||Ht(e)}function Pt(e){return typeof e=="function"&&(()=>{const n=Object.getPrototypeOf(e);return n.prototype&&n.prototype.isReactComponent})()}function Ht(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function Et(e){const n={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[t]=ee.useState(()=>({current:_t(n)})),[o,l]=ee.useState(()=>t.current.initialState);return t.current.setOptions(r=>({...r,...e,state:{...o,...e.state},onStateChange:i=>{l(i),e.onStateChange==null||e.onStateChange(i)}})),t.current}function ye(e){return{flex:"1 0 auto",width:e}}function Dt({header:e}){const{palette:n}=Pe();return F.jsxs(he,{variant:"head",sx:{p:0,pl:1,display:"flex",flexDirection:"row",...ye(e.getSize())},children:[e.column.getCanSort()?F.jsx(je,{sx:{flexGrow:1},active:!!e.column.getIsSorted(),direction:e.column.getIsSorted()||"desc",onClick:e.column.getToggleSortingHandler(),children:e.column.columnDef.header}):F.jsx(ke,{sx:{flexGrow:1,alignSelf:"center",fontWeight:"inherit",fontSize:"inherit",lineHeight:"inherit",letterSpacing:"inherit"},variant:"body1",label:e.column.columnDef.header}),F.jsx("div",{onMouseDown:e.getResizeHandler(),style:{opacity:1,width:4,background:e.column.getIsResizing()?"blue":n.divider,cursor:"col-resize",userSelect:"none",touchAction:"none",flexShrink:0}})]})}function Gt({headers:e,height:n}){return F.jsx(Ce,{style:{display:"flex",flexDirection:"row",height:n},children:e.map(t=>F.jsx(Dt,{header:t},t.id))})}function zt({onCellClick:e,getCellHref:n,dense:t,rows:o}){return function(r){return o[r].getVisibleCells().map((i,g)=>F.jsx(he,{variant:"body",sx:Object.assign({padding:"0px 8px"},ye(i.column.getSize()),Be(i,"column.columnDef.meta.cellStyles",Ne)(i.getValue())),children:It(i.column.columnDef.cell,{key:i.id,onCellClick:e,getCellHref:n,dense:t,rowIndex:r,columnIndex:g,...i.getContext()})},i.id))}}function Lt({style:e,children:n,...t}){return F.jsx(Ce,{style:{...e,width:void 0,display:"flex",flexDirection:"row"},...t,children:n})}const pe=()=>{},kt=(e,n,t)=>e.getValue(t).value<n.getValue(t).value?1:-1,Ot=20,Tt=v.forwardRef(function(n,t){return F.jsx("tfoot",{...n,ref:t,style:{...n.style,position:"unset"}})}),jt=v.memo(function({query:n,tableRef:t,height:o,width:l,rows:r,columns:i,dense:g,onCellClick:d,getCellHref:f,sortingState:s,setSortingState:u,columnVisibility:c,setColumnVisibility:a,searchInput:p,setSearchInput:m,globalFilterFn:C}){const{setTable:R,setRows:x}=Bt()||{setTable:pe,setRows:pe},h=l-Ot-i.reduce((_,{size:V=0})=>_+V,0),$=i.reduce((_,{size:V})=>_-(Number.isInteger(V)?1:0),i.length),A=Math.trunc(h/$),L=v.useMemo(()=>i.map(_=>({..._,minSize:50,size:_.size||A,maxSize:_.maxSize})),[i,A]),G=Et({state:{columnVisibility:c,sorting:s,globalFilter:p},sortingFns:{queryResponseSortingByValue:kt},enableGlobalFilter:!0,enableFilters:!0,onSortingChange:u,onColumnVisibilityChange:a,onGlobalFilterChange:m,data:r,columns:L,columnResizeMode:"onChange",globalFilterFn:C,getColumnCanGlobalFilter:()=>!0,getCoreRowModel:Ft(),getFilteredRowModel:yt(),getSortedRowModel:Vt()});v.useEffect(()=>{R(G),x(G.getRowModel().rows)});const j=g?24:37,{rows:P}=G.getRowModel(),H=G.getHeaderGroups()[0].headers,O=H.reduce((_,V)=>_+V.getSize(),0),z=v.useCallback(()=>F.jsx(Gt,{headers:H,height:j}),[H,j]),y=v.useMemo(()=>({Table:_=>F.jsx(He,{..._,sx:{tableLayout:"fixed",width:O}}),TableHead:Oe,TableBody:v.forwardRef(function(V,B){return F.jsx(Te,{...V,ref:B})}),TableRow:Lt,TableFoot:Tt}),[O]);return F.jsx(Le,{ref:t,style:{height:o},fixedFooterContent:n?()=>n.isFetchingNextPage?F.jsx(qe,{component:"tr",sx:{height:"60px",bgcolor:"common.white"},children:F.jsxs(Ee,{component:"td",rowSpan:i.length,direction:"row",spacing:2,justifyContent:"center",alignItems:"center",sx:{height:"60px"},children:[F.jsx(De,{}),F.jsx(Ge,{children:"loading more rows..."})]})}):null:void 0,totalCount:P.length,components:y,fixedHeaderContent:z,itemContent:zt({onCellClick:d,getCellHref:f,dense:g,rows:P}),endReached:n==null?void 0:n.fetchNextPage})}),Ve=v.createContext(),Bt=()=>v.useContext(Ve);function Yt({children:e}){const[n,t]=v.useState(),[o,l]=v.useState(),r=v.useMemo(()=>({table:n,setTable:t,rows:o,setRows:l}),[n,t,o,l]);return F.jsx(Ve.Provider,{value:r,children:e})}function Zt(e){return F.jsx(ze,{Component:jt,...e})}const Ie=v.createContext(),Nt=()=>v.useContext(Ie);function en({children:e,visible:n}){const[t,o]=v.useState(!1),l=v.useCallback(()=>o(i=>!i),[]),r=v.useMemo(()=>({enabledSearch:n&&t,toggleEnabledSearch:l}),[n,t,l]);return F.jsx(Ie.Provider,{value:r,children:e})}const Ae=v.createContext(),tn=()=>v.useContext(Ae),me=[],Se={};function nn({children:e,rows:n,columns:t,tableRef:o}){const{enabledSearch:l}=Nt(),[r,i]=v.useState(""),[g,d]=v.useState(-1),[f,s]=v.useState(Se),[u,c]=v.useState(me),a=v.useCallback((w,h)=>{var $;($=o==null?void 0:o.current)==null||$.scrollToIndex({index:h[w].row,align:"center",behavior:"auto"})},[o]),p=v.useCallback(w=>{var B;if(!l||!w){d(-1),s(Se),c(me);return}const h={},$=[],A=n.length,L=(B=n==null?void 0:n[0])==null?void 0:B.length,G=w.length,j=w.toLowerCase();let P=[],H="",O="",z=0,y=0,_=0,V=0;for(_=0;_<A;_++)for(y=0;y<L;y++){for(H=t[y].accessorFn(n[_]).value,O=H.toLowerCase(),P=[],z=0;z<H.length;){const k=O.indexOf(j,z);k===-1?z=H.length:(z=k+G,P.push(k))}if(P.length){h[_]||(h[_]={}),h[_][y]||(h[_][y]={});const k=P.map(ae=>({row:_,column:y,start:ae,end:ae+G}));h[_][y]=k,$.push(...k),V=V+P.length}}s(h),c($),$.length===0?d(-1):(d(0),a(0,$))},[t,l,n,a]),m=v.useCallback(w=>{typeof w=="string"?(i(w),p(w)):i(h=>{const $=w(h);return p($),$})},[p]),C=v.useCallback(()=>d(w=>{const h=Math.min(w+1,(u==null?void 0:u.length)-1);return a(h,u),h}),[u,a]),R=v.useCallback(()=>d(w=>{const h=Math.max(0,w-1);return a(h,u),h}),[u,a]),x=v.useMemo(()=>({searchText:r,enabledSearch:l,setSearchText:m,matchesObj:f,matchesArr:u,highlightedIndex:g,incHighlightedIndex:C,decHighlightedIndex:R}),[r,l,m,f,u,g,C,R]);return F.jsx(Ae.Provider,{value:x,children:e})}export{en as E,nn as H,Yt as T,Zt as V,tn as a,Bt as b,Nt as u};
