import{E as Ze}from"./BoT2pWk3.js";import{_ as Qe}from"./Ce6neeyL.js";import{ab as Ae,e as H,aa as Le,a7 as et,x as k,m as M,o as _,w as $,X as L,C as ze,n as S,a6 as he,ad as tt,p as nt,ay as ke,ac as Oe,a8 as ot,b as I,aw as rt,c as D,a as ce,I as x,W as A,J as ee,L as fe,M as lt,cV as it,B as st,r as N,g as ut,F as b,y as W,ai as at,af as gt,cO as xe,A as dt,cZ as X}from"./BoB2h2qv.js";import{_ as ct}from"./_43AjLD4.js";import{i as Pe}from"./CHIgUVhi.js";import{i as Me}from"./uGUZpl0S.js";import{u as ft,V as pt,C as mt}from"./D3fadyjq.js";import{R as St}from"./DitP6xhH.js";const[vt]=Ae("CheckboxGroupRoot");function te(e){return e==="indeterminate"}function Be(e){return te(e)?"indeterminate":e?"checked":"unchecked"}const[Ct,ht]=Ae("CheckboxRoot");var wt=H({inheritAttrs:!1,__name:"CheckboxRoot",props:{defaultValue:{type:[Boolean,String],required:!1},modelValue:{type:[Boolean,String,null],required:!1,default:void 0},disabled:{type:Boolean,required:!1},value:{type:null,required:!1,default:"on"},id:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"button"},name:{type:String,required:!1},required:{type:Boolean,required:!1}},emits:["update:modelValue"],setup(e,{emit:o}){const t=e,n=o,{forwardRef:r,currentElement:l}=Le(),i=vt(null),u=et(t,"modelValue",n,{defaultValue:t.defaultValue,passive:t.modelValue===void 0}),a=k(()=>i?.disabled.value||t.disabled),g=k(()=>Pe(i?.modelValue.value)?u.value==="indeterminate"?"indeterminate":u.value:Me(i.modelValue.value,t.value));function d(){if(Pe(i?.modelValue.value))u.value=te(u.value)?!0:!u.value;else{const s=[...i.modelValue.value||[]];if(Me(s,t.value)){const f=s.findIndex(p=>ot(p,t.value));s.splice(f,1)}else s.push(t.value);i.modelValue.value=s}}const m=ft(l),c=k(()=>t.id&&l.value?document.querySelector(`[for="${t.id}"]`)?.innerText:void 0);return ht({disabled:a,state:g}),(s,f)=>(_(),M(ke(S(i)?.rovingFocus.value?S(St):S(Oe)),he(s.$attrs,{id:s.id,ref:S(r),role:"checkbox","as-child":s.asChild,as:s.as,type:s.as==="button"?"button":void 0,"aria-checked":S(te)(g.value)?"mixed":g.value,"aria-required":s.required,"aria-label":s.$attrs["aria-label"]||c.value,"data-state":S(Be)(g.value),"data-disabled":a.value?"":void 0,disabled:a.value,focusable:S(i)?.rovingFocus.value?!a.value:void 0,onKeydown:tt(nt(()=>{},["prevent"]),["enter"]),onClick:d}),{default:$(()=>[L(s.$slots,"default",{modelValue:S(u),state:g.value}),S(m)&&s.name&&!S(i)?(_(),M(S(pt),{key:0,type:"checkbox",checked:!!g.value,name:s.name,value:s.value,disabled:a.value,required:s.required},null,8,["checked","name","value","disabled","required"])):ze("v-if",!0)]),_:3},16,["id","as-child","as","type","aria-checked","aria-required","aria-label","data-state","data-disabled","disabled","focusable","onKeydown"]))}}),Rt=wt,_t=H({__name:"CheckboxIndicator",props:{forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"span"}},setup(e){const{forwardRef:o}=Le(),t=Ct();return(n,r)=>(_(),M(S(rt),{present:n.forceMount||S(te)(S(t).state.value)||S(t).state.value===!0},{default:$(()=>[I(S(Oe),he({ref:S(o),"data-state":S(Be)(S(t).state.value),"data-disabled":S(t).disabled.value?"":void 0,style:{pointerEvents:"none"},"as-child":n.asChild,as:n.as},n.$attrs),{default:$(()=>[L(n.$slots,"default")]),_:3},16,["data-state","data-disabled","as-child","as"])]),_:3},8,["present"]))}}),Ft=_t;const $t={class:"relative w-full overflow-auto"},yt=H({__name:"Table",props:{class:{}},setup(e){const o=e;return(t,n)=>(_(),D("div",$t,[ce("table",{class:x(S(A)("w-full caption-bottom text-sm",o.class))},[L(t.$slots,"default")],2)]))}}),Vt=H({__name:"TableBody",props:{class:{}},setup(e){const o=e;return(t,n)=>(_(),D("tbody",{class:x(S(A)("[&_tr:last-child]:border-0",o.class))},[L(t.$slots,"default")],2))}}),oe=H({__name:"TableCell",props:{class:{},style:{}},setup(e){const o=e;return(t,n)=>(_(),D("td",{class:x(S(A)("p-4 align-middle [&:has([role=checkbox])]:pr-0",o.class)),style:ee(o.style)},[L(t.$slots,"default")],6))}}),K=H({__name:"TableRow",props:{class:{}},setup(e){const o=e;return(t,n)=>(_(),D("tr",{class:x(S(A)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",o.class))},[L(t.$slots,"default")],2))}}),xt=H({__name:"TableHead",props:{class:{},style:{}},setup(e){const o=e;return(t,n)=>(_(),D("th",{class:x(S(A)("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",o.class)),style:ee(o.style)},[L(t.$slots,"default")],6))}}),Pt=H({__name:"TableHeader",props:{class:{}},setup(e){const o=e;return(t,n)=>(_(),D("thead",{class:x(S(A)("[&_tr]:border-b",o.class))},[L(t.$slots,"default")],2))}});/**
   * 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 O(e,o){return typeof e=="function"?e(o):e}function P(e,o){return t=>{o.setState(n=>({...n,[e]:O(t,n[e])}))}}function ne(e){return e instanceof Function}function Mt(e){return Array.isArray(e)&&e.every(o=>typeof o=="number")}function It(e,o){const t=[],n=r=>{r.forEach(l=>{t.push(l);const i=o(l);i!=null&&i.length&&n(i)})};return n(e),t}function v(e,o,t){let n=[],r;return l=>{let i;t.key&&t.debug&&(i=Date.now());const u=e(l);if(!(u.length!==n.length||u.some((d,m)=>n[m]!==d)))return r;n=u;let g;if(t.key&&t.debug&&(g=Date.now()),r=o(...u),t==null||t.onChange==null||t.onChange(r),t.key&&t.debug&&t!=null&&t.debug()){const d=Math.round((Date.now()-i)*100)/100,m=Math.round((Date.now()-g)*100)/100,c=m/16,s=(f,p)=>{for(f=String(f);f.length<p;)f=" "+f;return f};console.info(`%c⏱ ${s(m,5)} /${s(d,5)} ms`,`
            font-size: .6rem;
            font-weight: bold;
            color: hsl(${Math.max(0,Math.min(120-120*c,120))}deg 100% 31%);`,t?.key)}return r}}function C(e,o,t,n){return{debug:()=>{var r;return(r=e?.debugAll)!=null?r:e[o]},key:!1,onChange:n}}function Dt(e,o,t,n){const r=()=>{var i;return(i=l.getValue())!=null?i:e.options.renderFallbackValue},l={id:`${o.id}_${t.id}`,row:o,column:t,getValue:()=>o.getValue(n),renderValue:r,getContext:v(()=>[e,t,o,l],(i,u,a,g)=>({table:i,column:u,row:a,cell:g,getValue:g.getValue,renderValue:g.renderValue}),C(e.options,"debugCells"))};return e._features.forEach(i=>{i.createCell==null||i.createCell(l,t,o,e)},{}),l}function Et(e,o,t,n){var r,l;const u={...e._getDefaultColumnDef(),...o},a=u.accessorKey;let g=(r=(l=u.id)!=null?l:a?typeof String.prototype.replaceAll=="function"?a.replaceAll(".","_"):a.replace(/\./g,"_"):void 0)!=null?r:typeof u.header=="string"?u.header:void 0,d;if(u.accessorFn?d=u.accessorFn:a&&(a.includes(".")?d=c=>{let s=c;for(const p of a.split(".")){var f;s=(f=s)==null?void 0:f[p]}return s}:d=c=>c[u.accessorKey]),!g)throw new Error;let m={id:`${String(g)}`,accessorFn:d,parent:n,depth:t,columnDef:u,columns:[],getFlatColumns:v(()=>[!0],()=>{var c;return[m,...(c=m.columns)==null?void 0:c.flatMap(s=>s.getFlatColumns())]},C(e.options,"debugColumns")),getLeafColumns:v(()=>[e._getOrderColumnsFn()],c=>{var s;if((s=m.columns)!=null&&s.length){let f=m.columns.flatMap(p=>p.getLeafColumns());return c(f)}return[m]},C(e.options,"debugColumns"))};for(const c of e._features)c.createColumn==null||c.createColumn(m,e);return m}const y="debugHeaders";function Ie(e,o,t){var n;let l={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 i=[],u=a=>{a.subHeaders&&a.subHeaders.length&&a.subHeaders.map(u),i.push(a)};return u(l),i},getContext:()=>({table:e,header:l,column:o})};return e._features.forEach(i=>{i.createHeader==null||i.createHeader(l,e)}),l}const Ht={createTable:e=>{e.getHeaderGroups=v(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(o,t,n,r)=>{var l,i;const u=(l=n?.map(m=>t.find(c=>c.id===m)).filter(Boolean))!=null?l:[],a=(i=r?.map(m=>t.find(c=>c.id===m)).filter(Boolean))!=null?i:[],g=t.filter(m=>!(n!=null&&n.includes(m.id))&&!(r!=null&&r.includes(m.id)));return J(o,[...u,...g,...a],e)},C(e.options,y)),e.getCenterHeaderGroups=v(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(o,t,n,r)=>(t=t.filter(l=>!(n!=null&&n.includes(l.id))&&!(r!=null&&r.includes(l.id))),J(o,t,e,"center")),C(e.options,y)),e.getLeftHeaderGroups=v(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(o,t,n)=>{var r;const l=(r=n?.map(i=>t.find(u=>u.id===i)).filter(Boolean))!=null?r:[];return J(o,l,e,"left")},C(e.options,y)),e.getRightHeaderGroups=v(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(o,t,n)=>{var r;const l=(r=n?.map(i=>t.find(u=>u.id===i)).filter(Boolean))!=null?r:[];return J(o,l,e,"right")},C(e.options,y)),e.getFooterGroups=v(()=>[e.getHeaderGroups()],o=>[...o].reverse(),C(e.options,y)),e.getLeftFooterGroups=v(()=>[e.getLeftHeaderGroups()],o=>[...o].reverse(),C(e.options,y)),e.getCenterFooterGroups=v(()=>[e.getCenterHeaderGroups()],o=>[...o].reverse(),C(e.options,y)),e.getRightFooterGroups=v(()=>[e.getRightHeaderGroups()],o=>[...o].reverse(),C(e.options,y)),e.getFlatHeaders=v(()=>[e.getHeaderGroups()],o=>o.map(t=>t.headers).flat(),C(e.options,y)),e.getLeftFlatHeaders=v(()=>[e.getLeftHeaderGroups()],o=>o.map(t=>t.headers).flat(),C(e.options,y)),e.getCenterFlatHeaders=v(()=>[e.getCenterHeaderGroups()],o=>o.map(t=>t.headers).flat(),C(e.options,y)),e.getRightFlatHeaders=v(()=>[e.getRightHeaderGroups()],o=>o.map(t=>t.headers).flat(),C(e.options,y)),e.getCenterLeafHeaders=v(()=>[e.getCenterFlatHeaders()],o=>o.filter(t=>{var n;return!((n=t.subHeaders)!=null&&n.length)}),C(e.options,y)),e.getLeftLeafHeaders=v(()=>[e.getLeftFlatHeaders()],o=>o.filter(t=>{var n;return!((n=t.subHeaders)!=null&&n.length)}),C(e.options,y)),e.getRightLeafHeaders=v(()=>[e.getRightFlatHeaders()],o=>o.filter(t=>{var n;return!((n=t.subHeaders)!=null&&n.length)}),C(e.options,y)),e.getLeafHeaders=v(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(o,t,n)=>{var r,l,i,u,a,g;return[...(r=(l=o[0])==null?void 0:l.headers)!=null?r:[],...(i=(u=t[0])==null?void 0:u.headers)!=null?i:[],...(a=(g=n[0])==null?void 0:g.headers)!=null?a:[]].map(d=>d.getLeafHeaders()).flat()},C(e.options,y))}};function J(e,o,t,n){var r,l;let i=0;const u=function(c,s){s===void 0&&(s=1),i=Math.max(i,s),c.filter(f=>f.getIsVisible()).forEach(f=>{var p;(p=f.columns)!=null&&p.length&&u(f.columns,s+1)},0)};u(e);let a=[];const g=(c,s)=>{const f={depth:s,id:[n,`${s}`].filter(Boolean).join("_"),headers:[]},p=[];c.forEach(h=>{const w=[...p].reverse()[0],R=h.column.depth===f.depth;let F,G=!1;if(R&&h.column.parent?F=h.column.parent:(F=h.column,G=!0),w&&w?.column===F)w.subHeaders.push(h);else{const V=Ie(t,F,{id:[n,s,F.id,h?.id].filter(Boolean).join("_"),isPlaceholder:G,placeholderId:G?`${p.filter(q=>q.column===F).length}`:void 0,depth:s,index:p.length});V.subHeaders.push(h),p.push(V)}f.headers.push(h),h.headerGroup=f}),a.push(f),s>0&&g(p,s-1)},d=o.map((c,s)=>Ie(t,c,{depth:i,index:s}));g(d,i-1),a.reverse();const m=c=>c.filter(f=>f.column.getIsVisible()).map(f=>{let p=0,h=0,w=[0];f.subHeaders&&f.subHeaders.length?(w=[],m(f.subHeaders).forEach(F=>{let{colSpan:G,rowSpan:V}=F;p+=G,w.push(V)})):p=1;const R=Math.min(...w);return h=h+R,f.colSpan=p,f.rowSpan=h,{colSpan:p,rowSpan:h}});return m((r=(l=a[0])==null?void 0:l.headers)!=null?r:[]),a}const we=(e,o,t,n,r,l,i)=>{let u={id:o,index:n,original:t,depth:r,parentId:i,_valuesCache:{},_uniqueValuesCache:{},getValue:a=>{if(u._valuesCache.hasOwnProperty(a))return u._valuesCache[a];const g=e.getColumn(a);if(g!=null&&g.accessorFn)return u._valuesCache[a]=g.accessorFn(u.original,n),u._valuesCache[a]},getUniqueValues:a=>{if(u._uniqueValuesCache.hasOwnProperty(a))return u._uniqueValuesCache[a];const g=e.getColumn(a);if(g!=null&&g.accessorFn)return g.columnDef.getUniqueValues?(u._uniqueValuesCache[a]=g.columnDef.getUniqueValues(u.original,n),u._uniqueValuesCache[a]):(u._uniqueValuesCache[a]=[u.getValue(a)],u._uniqueValuesCache[a])},renderValue:a=>{var g;return(g=u.getValue(a))!=null?g:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>It(u.subRows,a=>a.subRows),getParentRow:()=>u.parentId?e.getRow(u.parentId,!0):void 0,getParentRows:()=>{let a=[],g=u;for(;;){const d=g.getParentRow();if(!d)break;a.push(d),g=d}return a.reverse()},getAllCells:v(()=>[e.getAllLeafColumns()],a=>a.map(g=>Dt(e,u,g,g.id)),C(e.options,"debugRows")),_getAllCellsByColumnId:v(()=>[u.getAllCells()],a=>a.reduce((g,d)=>(g[d.column.id]=d,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(u,e)}return u},Gt={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()}}},qe=(e,o,t)=>{var n,r;const l=t==null||(n=t.toString())==null?void 0:n.toLowerCase();return!!(!((r=e.getValue(o))==null||(r=r.toString())==null||(r=r.toLowerCase())==null)&&r.includes(l))};qe.autoRemove=e=>E(e);const Te=(e,o,t)=>{var n;return!!(!((n=e.getValue(o))==null||(n=n.toString())==null)&&n.includes(t))};Te.autoRemove=e=>E(e);const Ne=(e,o,t)=>{var n;return((n=e.getValue(o))==null||(n=n.toString())==null?void 0:n.toLowerCase())===t?.toLowerCase()};Ne.autoRemove=e=>E(e);const je=(e,o,t)=>{var n;return(n=e.getValue(o))==null?void 0:n.includes(t)};je.autoRemove=e=>E(e);const Ue=(e,o,t)=>!t.some(n=>{var r;return!((r=e.getValue(o))!=null&&r.includes(n))});Ue.autoRemove=e=>E(e)||!(e!=null&&e.length);const be=(e,o,t)=>t.some(n=>{var r;return(r=e.getValue(o))==null?void 0:r.includes(n)});be.autoRemove=e=>E(e)||!(e!=null&&e.length);const We=(e,o,t)=>e.getValue(o)===t;We.autoRemove=e=>E(e);const Xe=(e,o,t)=>e.getValue(o)==t;Xe.autoRemove=e=>E(e);const Re=(e,o,t)=>{let[n,r]=t;const l=e.getValue(o);return l>=n&&l<=r};Re.resolveFilterValue=e=>{let[o,t]=e,n=typeof o!="number"?parseFloat(o):o,r=typeof t!="number"?parseFloat(t):t,l=o===null||Number.isNaN(n)?-1/0:n,i=t===null||Number.isNaN(r)?1/0:r;if(l>i){const u=l;l=i,i=u}return[l,i]};Re.autoRemove=e=>E(e)||E(e[0])&&E(e[1]);const z={includesString:qe,includesStringSensitive:Te,equalsString:Ne,arrIncludes:je,arrIncludesAll:Ue,arrIncludesSome:be,equals:We,weakEquals:Xe,inNumberRange:Re};function E(e){return e==null||e===""}const At={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:P("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,o)=>{e.getAutoFilterFn=()=>{const t=o.getCoreRowModel().flatRows[0],n=t?.getValue(e.id);return typeof n=="string"?z.includesString:typeof n=="number"?z.inNumberRange:typeof n=="boolean"||n!==null&&typeof n=="object"?z.equals:Array.isArray(n)?z.arrIncludes:z.weakEquals},e.getFilterFn=()=>{var t,n;return ne(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:z[e.columnDef.filterFn]},e.getCanFilter=()=>{var t,n,r;return((t=e.columnDef.enableColumnFilter)!=null?t:!0)&&((n=o.options.enableColumnFilters)!=null?n:!0)&&((r=o.options.enableFilters)!=null?r:!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(r=>r.id===e.id))!=null?t:-1},e.setFilterValue=t=>{o.setColumnFilters(n=>{const r=e.getFilterFn(),l=n?.find(d=>d.id===e.id),i=O(t,l?l.value:void 0);if(De(r,i,e)){var u;return(u=n?.filter(d=>d.id!==e.id))!=null?u:[]}const a={id:e.id,value:i};if(l){var g;return(g=n?.map(d=>d.id===e.id?a:d))!=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=r=>{var l;return(l=O(o,r))==null?void 0:l.filter(i=>{const u=t.find(a=>a.id===i.id);if(u){const a=u.getFilterFn();if(De(a,i.value,u))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 De(e,o,t){return(e&&e.autoRemove?e.autoRemove(o,t):!1)||typeof o>"u"||typeof o=="string"&&!o}const Lt=(e,o,t)=>t.reduce((n,r)=>{const l=r.getValue(e);return n+(typeof l=="number"?l:0)},0),zt=(e,o,t)=>{let n;return t.forEach(r=>{const l=r.getValue(e);l!=null&&(n>l||n===void 0&&l>=l)&&(n=l)}),n},kt=(e,o,t)=>{let n;return t.forEach(r=>{const l=r.getValue(e);l!=null&&(n<l||n===void 0&&l>=l)&&(n=l)}),n},Ot=(e,o,t)=>{let n,r;return t.forEach(l=>{const i=l.getValue(e);i!=null&&(n===void 0?i>=i&&(n=r=i):(n>i&&(n=i),r<i&&(r=i)))}),[n,r]},Bt=(e,o)=>{let t=0,n=0;if(o.forEach(r=>{let l=r.getValue(e);l!=null&&(l=+l)>=l&&(++t,n+=l)}),t)return n/t},qt=(e,o)=>{if(!o.length)return;const t=o.map(l=>l.getValue(e));if(!Mt(t))return;if(t.length===1)return t[0];const n=Math.floor(t.length/2),r=t.sort((l,i)=>l-i);return t.length%2!==0?r[n]:(r[n-1]+r[n])/2},Tt=(e,o)=>Array.from(new Set(o.map(t=>t.getValue(e))).values()),Nt=(e,o)=>new Set(o.map(t=>t.getValue(e))).size,jt=(e,o)=>o.length,re={sum:Lt,min:zt,max:kt,extent:Ot,mean:Bt,median:qt,unique:Tt,uniqueCount:Nt,count:jt},Ut={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:P("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?.getValue(e.id);if(typeof n=="number")return re.sum;if(Object.prototype.toString.call(n)==="[object Date]")return re.extent},e.getAggregationFn=()=>{var t,n;if(!e)throw new Error;return ne(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:re[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 r;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((r=t.subRows)!=null&&r.length)}}};function bt(e,o,t){if(!(o!=null&&o.length)||!t)return e;const n=e.filter(l=>!o.includes(l.id));return t==="remove"?n:[...o.map(l=>e.find(i=>i.id===l)).filter(Boolean),...n]}const Wt={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:P("columnOrder",e)}),createColumn:(e,o)=>{e.getIndex=v(t=>[U(o,t)],t=>t.findIndex(n=>n.id===e.id),C(o.options,"debugColumns")),e.getIsFirstColumn=t=>{var n;return((n=U(o,t)[0])==null?void 0:n.id)===e.id},e.getIsLastColumn=t=>{var n;const r=U(o,t);return((n=r[r.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=v(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(o,t,n)=>r=>{let l=[];if(!(o!=null&&o.length))l=r;else{const i=[...o],u=[...r];for(;u.length&&i.length;){const a=i.shift(),g=u.findIndex(d=>d.id===a);g>-1&&l.push(u.splice(g,1)[0])}l=[...l,...u]}return bt(l,t,n)},C(e.options,"debugTable"))}},le=()=>({left:[],right:[]}),Xt={getInitialState:e=>({columnPinning:le(),...e}),getDefaultOptions:e=>({onColumnPinningChange:P("columnPinning",e)}),createColumn:(e,o)=>{e.pin=t=>{const n=e.getLeafColumns().map(r=>r.id).filter(Boolean);o.setColumnPinning(r=>{var l,i;if(t==="right"){var u,a;return{left:((u=r?.left)!=null?u:[]).filter(m=>!(n!=null&&n.includes(m))),right:[...((a=r?.right)!=null?a:[]).filter(m=>!(n!=null&&n.includes(m))),...n]}}if(t==="left"){var g,d;return{left:[...((g=r?.left)!=null?g:[]).filter(m=>!(n!=null&&n.includes(m))),...n],right:((d=r?.right)!=null?d:[]).filter(m=>!(n!=null&&n.includes(m)))}}return{left:((l=r?.left)!=null?l:[]).filter(m=>!(n!=null&&n.includes(m))),right:((i=r?.right)!=null?i:[]).filter(m=>!(n!=null&&n.includes(m)))}})},e.getCanPin=()=>e.getLeafColumns().some(n=>{var r,l,i;return((r=n.columnDef.enablePinning)!=null?r:!0)&&((l=(i=o.options.enableColumnPinning)!=null?i:o.options.enablePinning)!=null?l:!0)}),e.getIsPinned=()=>{const t=e.getLeafColumns().map(u=>u.id),{left:n,right:r}=o.getState().columnPinning,l=t.some(u=>n?.includes(u)),i=t.some(u=>r?.includes(u));return l?"left":i?"right":!1},e.getPinnedIndex=()=>{var t,n;const r=e.getIsPinned();return r?(t=(n=o.getState().columnPinning)==null||(n=n[r])==null?void 0:n.indexOf(e.id))!=null?t:-1:0}},createRow:(e,o)=>{e.getCenterVisibleCells=v(()=>[e._getAllVisibleCells(),o.getState().columnPinning.left,o.getState().columnPinning.right],(t,n,r)=>{const l=[...n??[],...r??[]];return t.filter(i=>!l.includes(i.column.id))},C(o.options,"debugRows")),e.getLeftVisibleCells=v(()=>[e._getAllVisibleCells(),o.getState().columnPinning.left],(t,n)=>(n??[]).map(l=>t.find(i=>i.column.id===l)).filter(Boolean).map(l=>({...l,position:"left"})),C(o.options,"debugRows")),e.getRightVisibleCells=v(()=>[e._getAllVisibleCells(),o.getState().columnPinning.right],(t,n)=>(n??[]).map(l=>t.find(i=>i.column.id===l)).filter(Boolean).map(l=>({...l,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?le():(t=(n=e.initialState)==null?void 0:n.columnPinning)!=null?t:le())},e.getIsSomeColumnsPinned=o=>{var t;const n=e.getState().columnPinning;if(!o){var r,l;return!!((r=n.left)!=null&&r.length||(l=n.right)!=null&&l.length)}return!!((t=n[o])!=null&&t.length)},e.getLeftLeafColumns=v(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(o,t)=>(t??[]).map(n=>o.find(r=>r.id===n)).filter(Boolean),C(e.options,"debugColumns")),e.getRightLeafColumns=v(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(o,t)=>(t??[]).map(n=>o.find(r=>r.id===n)).filter(Boolean),C(e.options,"debugColumns")),e.getCenterLeafColumns=v(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(o,t,n)=>{const r=[...t??[],...n??[]];return o.filter(l=>!r.includes(l.id))},C(e.options,"debugColumns"))}};function Kt(e){return e||(typeof document<"u"?document:null)}const Y={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},ie=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),Jt={getDefaultColumnDef:()=>Y,getInitialState:e=>({columnSizing:{},columnSizingInfo:ie(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:P("columnSizing",e),onColumnSizingInfoChange:P("columnSizingInfo",e)}),createColumn:(e,o)=>{e.getSize=()=>{var t,n,r;const l=o.getState().columnSizing[e.id];return Math.min(Math.max((t=e.columnDef.minSize)!=null?t:Y.minSize,(n=l??e.columnDef.size)!=null?n:Y.size),(r=e.columnDef.maxSize)!=null?r:Y.maxSize)},e.getStart=v(t=>[t,U(o,t),o.getState().columnSizing],(t,n)=>n.slice(0,e.getIndex(t)).reduce((r,l)=>r+l.getSize(),0),C(o.options,"debugColumns")),e.getAfter=v(t=>[t,U(o,t),o.getState().columnSizing],(t,n)=>n.slice(e.getIndex(t)+1).reduce((r,l)=>r+l.getSize(),0),C(o.options,"debugColumns")),e.resetSize=()=>{o.setColumnSizing(t=>{let{[e.id]:n,...r}=t;return r})},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=r=>{if(r.subHeaders.length)r.subHeaders.forEach(n);else{var l;t+=(l=r.column.getSize())!=null?l: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),r=n?.getCanResize();return l=>{if(!n||!r||(l.persist==null||l.persist(),se(l)&&l.touches&&l.touches.length>1))return;const i=e.getSize(),u=e?e.getLeafHeaders().map(w=>[w.column.id,w.column.getSize()]):[[n.id,n.getSize()]],a=se(l)?Math.round(l.touches[0].clientX):l.clientX,g={},d=(w,R)=>{typeof R=="number"&&(o.setColumnSizingInfo(F=>{var G,V;const q=o.options.columnResizeDirection==="rtl"?-1:1,$e=(R-((G=F?.startOffset)!=null?G:0))*q,ye=Math.max($e/((V=F?.startSize)!=null?V:0),-.999999);return F.columnSizingStart.forEach(Je=>{let[Ye,Ve]=Je;g[Ye]=Math.round(Math.max(Ve+Ve*ye,0)*100)/100}),{...F,deltaOffset:$e,deltaPercentage:ye}}),(o.options.columnResizeMode==="onChange"||w==="end")&&o.setColumnSizing(F=>({...F,...g})))},m=w=>d("move",w),c=w=>{d("end",w),o.setColumnSizingInfo(R=>({...R,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},s=Kt(t),f={moveHandler:w=>m(w.clientX),upHandler:w=>{s?.removeEventListener("mousemove",f.moveHandler),s?.removeEventListener("mouseup",f.upHandler),c(w.clientX)}},p={moveHandler:w=>(w.cancelable&&(w.preventDefault(),w.stopPropagation()),m(w.touches[0].clientX),!1),upHandler:w=>{var R;s?.removeEventListener("touchmove",p.moveHandler),s?.removeEventListener("touchend",p.upHandler),w.cancelable&&(w.preventDefault(),w.stopPropagation()),c((R=w.touches[0])==null?void 0:R.clientX)}},h=Yt()?{passive:!1}:!1;se(l)?(s?.addEventListener("touchmove",p.moveHandler,h),s?.addEventListener("touchend",p.upHandler,h)):(s?.addEventListener("mousemove",f.moveHandler,h),s?.addEventListener("mouseup",f.upHandler,h)),o.setColumnSizingInfo(w=>({...w,startOffset:a,startSize:i,deltaOffset:0,deltaPercentage:0,columnSizingStart:u,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?ie():(t=e.initialState.columnSizingInfo)!=null?t:ie())},e.getTotalSize=()=>{var o,t;return(o=(t=e.getHeaderGroups()[0])==null?void 0:t.headers.reduce((n,r)=>n+r.getSize(),0))!=null?o:0},e.getLeftTotalSize=()=>{var o,t;return(o=(t=e.getLeftHeaderGroups()[0])==null?void 0:t.headers.reduce((n,r)=>n+r.getSize(),0))!=null?o:0},e.getCenterTotalSize=()=>{var o,t;return(o=(t=e.getCenterHeaderGroups()[0])==null?void 0:t.headers.reduce((n,r)=>n+r.getSize(),0))!=null?o:0},e.getRightTotalSize=()=>{var o,t;return(o=(t=e.getRightHeaderGroups()[0])==null?void 0:t.headers.reduce((n,r)=>n+r.getSize(),0))!=null?o:0}}};let Z=null;function Yt(){if(typeof Z=="boolean")return Z;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 Z=e,Z}function se(e){return e.type==="touchstart"}const Zt={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:P("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 r=e.columns;return(t=r.length?r.some(l=>l.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=v(()=>[e.getAllCells(),o.getState().columnVisibility],t=>t.filter(n=>n.column.getIsVisible()),C(o.options,"debugRows")),e.getVisibleCells=v(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(t,n,r)=>[...t,...n,...r],C(o.options,"debugRows"))},createTable:e=>{const o=(t,n)=>v(()=>[n(),n().filter(r=>r.getIsVisible()).map(r=>r.id).join("_")],r=>r.filter(l=>l.getIsVisible==null?void 0:l.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((r,l)=>({...r,[l.id]:t||!(l.getCanHide!=null&&l.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 U(e,o){return o?o==="center"?e.getCenterVisibleLeafColumns():o==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const Qt={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()}}},en={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:P("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,r,l;return((t=e.columnDef.enableGlobalFilter)!=null?t:!0)&&((n=o.options.enableGlobalFilter)!=null?n:!0)&&((r=o.options.enableFilters)!=null?r:!0)&&((l=o.options.getColumnCanGlobalFilter==null?void 0:o.options.getColumnCanGlobalFilter(e))!=null?l:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>z.includesString,e.getGlobalFilterFn=()=>{var o,t;const{globalFilterFn:n}=e.options;return ne(n)?n:n==="auto"?e.getGlobalAutoFilterFn():(o=(t=e.options.filterFns)==null?void 0:t[n])!=null?o:z[n]},e.setGlobalFilter=o=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(o)},e.resetGlobalFilter=o=>{e.setGlobalFilter(o?void 0:e.initialState.globalFilter)}}},tn={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:P("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let o=!1,t=!1;e._autoResetExpanded=()=>{var n,r;if(!o){e._queue(()=>{o=!0});return}if((n=(r=e.options.autoResetAll)!=null?r: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 r,l;e.setExpanded(n?{}:(r=(l=e.initialState)==null?void 0:l.expanded)!=null?r:{})},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(r=>!r.getIsExpanded()))},e.getExpandedDepth=()=>{let n=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(l=>{const i=l.split(".");n=Math.max(n,i.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 r;const l=n===!0?!0:!!(n!=null&&n[e.id]);let i={};if(n===!0?Object.keys(o.getRowModel().rowsById).forEach(u=>{i[u]=!0}):i=n,t=(r=t)!=null?r:!l,!l&&t)return{...i,[e.id]:!0};if(l&&!t){const{[e.id]:u,...a}=i;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?.[e.id])},e.getCanExpand=()=>{var t,n,r;return(t=o.options.getRowCanExpand==null?void 0:o.options.getRowCanExpand(e))!=null?t:((n=o.options.enableExpanding)!=null?n:!0)&&!!((r=e.subRows)!=null&&r.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()}}}},pe=0,me=10,ue=()=>({pageIndex:pe,pageSize:me}),nn={getInitialState:e=>({...e,pagination:{...ue(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:P("pagination",e)}),createTable:e=>{let o=!1,t=!1;e._autoResetPageIndex=()=>{var n,r;if(!o){e._queue(()=>{o=!0});return}if((n=(r=e.options.autoResetAll)!=null?r:e.options.autoResetPageIndex)!=null?n:!e.options.manualPagination){if(t)return;t=!0,e._queue(()=>{e.resetPageIndex(),t=!1})}},e.setPagination=n=>{const r=l=>O(n,l);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(r)},e.resetPagination=n=>{var r;e.setPagination(n?ue():(r=e.initialState.pagination)!=null?r:ue())},e.setPageIndex=n=>{e.setPagination(r=>{let l=O(n,r.pageIndex);const i=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return l=Math.max(0,Math.min(l,i)),{...r,pageIndex:l}})},e.resetPageIndex=n=>{var r,l;e.setPageIndex(n?pe:(r=(l=e.initialState)==null||(l=l.pagination)==null?void 0:l.pageIndex)!=null?r:pe)},e.resetPageSize=n=>{var r,l;e.setPageSize(n?me:(r=(l=e.initialState)==null||(l=l.pagination)==null?void 0:l.pageSize)!=null?r:me)},e.setPageSize=n=>{e.setPagination(r=>{const l=Math.max(1,O(n,r.pageSize)),i=r.pageSize*r.pageIndex,u=Math.floor(i/l);return{...r,pageIndex:u,pageSize:l}})},e.setPageCount=n=>e.setPagination(r=>{var l;let i=O(n,(l=e.options.pageCount)!=null?l:-1);return typeof i=="number"&&(i=Math.max(-1,i)),{...r,pageCount:i}}),e.getPageOptions=v(()=>[e.getPageCount()],n=>{let r=[];return n&&n>0&&(r=[...new Array(n)].fill(null).map((l,i)=>i)),r},C(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:n}=e.getState().pagination,r=e.getPageCount();return r===-1?!0:r===0?!1:n<r-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}}},ae=()=>({top:[],bottom:[]}),on={getInitialState:e=>({rowPinning:ae(),...e}),getDefaultOptions:e=>({onRowPinningChange:P("rowPinning",e)}),createRow:(e,o)=>{e.pin=(t,n,r)=>{const l=n?e.getLeafRows().map(a=>{let{id:g}=a;return g}):[],i=r?e.getParentRows().map(a=>{let{id:g}=a;return g}):[],u=new Set([...i,e.id,...l]);o.setRowPinning(a=>{var g,d;if(t==="bottom"){var m,c;return{top:((m=a?.top)!=null?m:[]).filter(p=>!(u!=null&&u.has(p))),bottom:[...((c=a?.bottom)!=null?c:[]).filter(p=>!(u!=null&&u.has(p))),...Array.from(u)]}}if(t==="top"){var s,f;return{top:[...((s=a?.top)!=null?s:[]).filter(p=>!(u!=null&&u.has(p))),...Array.from(u)],bottom:((f=a?.bottom)!=null?f:[]).filter(p=>!(u!=null&&u.has(p)))}}return{top:((g=a?.top)!=null?g:[]).filter(p=>!(u!=null&&u.has(p))),bottom:((d=a?.bottom)!=null?d:[]).filter(p=>!(u!=null&&u.has(p)))}})},e.getCanPin=()=>{var t;const{enableRowPinning:n,enablePinning:r}=o.options;return typeof n=="function"?n(e):(t=n??r)!=null?t:!0},e.getIsPinned=()=>{const t=[e.id],{top:n,bottom:r}=o.getState().rowPinning,l=t.some(u=>n?.includes(u)),i=t.some(u=>r?.includes(u));return l?"top":i?"bottom":!1},e.getPinnedIndex=()=>{var t,n;const r=e.getIsPinned();if(!r)return-1;const l=(t=r==="top"?o.getTopRows():o.getBottomRows())==null?void 0:t.map(i=>{let{id:u}=i;return u});return(n=l?.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?ae():(t=(n=e.initialState)==null?void 0:n.rowPinning)!=null?t:ae())},e.getIsSomeRowsPinned=o=>{var t;const n=e.getState().rowPinning;if(!o){var r,l;return!!((r=n.top)!=null&&r.length||(l=n.bottom)!=null&&l.length)}return!!((t=n[o])!=null&&t.length)},e._getPinnedRows=(o,t,n)=>{var r;return((r=e.options.keepPinnedRows)==null||r?(t??[]).map(i=>{const u=e.getRow(i,!0);return u.getIsAllParentsExpanded()?u:null}):(t??[]).map(i=>o.find(u=>u.id===i))).filter(Boolean).map(i=>({...i,position:n}))},e.getTopRows=v(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(o,t)=>e._getPinnedRows(o,t,"top"),C(e.options,"debugRows")),e.getBottomRows=v(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(o,t)=>e._getPinnedRows(o,t,"bottom"),C(e.options,"debugRows")),e.getCenterRows=v(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(o,t,n)=>{const r=new Set([...t??[],...n??[]]);return o.filter(l=>!r.has(l.id))},C(e.options,"debugRows"))}},rn={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:P("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},r=e.getPreGroupedRowModel().flatRows;return o?r.forEach(l=>{l.getCanSelect()&&(n[l.id]=!0)}):r.forEach(l=>{delete n[l.id]}),n})},e.toggleAllPageRowsSelected=o=>e.setRowSelection(t=>{const n=typeof o<"u"?o:!e.getIsAllPageRowsSelected(),r={...t};return e.getRowModel().rows.forEach(l=>{Se(r,l.id,n,!0,e)}),r}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=v(()=>[e.getState().rowSelection,e.getCoreRowModel()],(o,t)=>Object.keys(o).length?ge(e,t):{rows:[],flatRows:[],rowsById:{}},C(e.options,"debugTable")),e.getFilteredSelectedRowModel=v(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(o,t)=>Object.keys(o).length?ge(e,t):{rows:[],flatRows:[],rowsById:{}},C(e.options,"debugTable")),e.getGroupedSelectedRowModel=v(()=>[e.getState().rowSelection,e.getSortedRowModel()],(o,t)=>Object.keys(o).length?ge(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(r=>r.getCanSelect()&&!t[r.id])&&(n=!1),n},e.getIsAllPageRowsSelected=()=>{const o=e.getPaginationRowModel().flatRows.filter(r=>r.getCanSelect()),{rowSelection:t}=e.getState();let n=!!o.length;return n&&o.some(r=>!t[r.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 r=e.getIsSelected();o.setRowSelection(l=>{var i;if(t=typeof t<"u"?t:!r,e.getCanSelect()&&r===t)return l;const u={...l};return Se(u,e.id,t,(i=n?.selectChildren)!=null?i:!0,o),u})},e.getIsSelected=()=>{const{rowSelection:t}=o.getState();return _e(e,t)},e.getIsSomeSelected=()=>{const{rowSelection:t}=o.getState();return ve(e,t)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:t}=o.getState();return ve(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 r;t&&e.toggleSelected((r=n.target)==null?void 0:r.checked)}}}},Se=(e,o,t,n,r)=>{var l;const i=r.getRow(o,!0);t?(i.getCanMultiSelect()||Object.keys(e).forEach(u=>delete e[u]),i.getCanSelect()&&(e[o]=!0)):delete e[o],n&&(l=i.subRows)!=null&&l.length&&i.getCanSelectSubRows()&&i.subRows.forEach(u=>Se(e,u.id,t,n,r))};function ge(e,o){const t=e.getState().rowSelection,n=[],r={},l=function(i,u){return i.map(a=>{var g;const d=_e(a,t);if(d&&(n.push(a),r[a.id]=a),(g=a.subRows)!=null&&g.length&&(a={...a,subRows:l(a.subRows)}),d)return a}).filter(Boolean)};return{rows:l(o.rows),flatRows:n,rowsById:r}}function _e(e,o){var t;return(t=o[e.id])!=null?t:!1}function ve(e,o,t){var n;if(!((n=e.subRows)!=null&&n.length))return!1;let r=!0,l=!1;return e.subRows.forEach(i=>{if(!(l&&!r)&&(i.getCanSelect()&&(_e(i,o)?l=!0:r=!1),i.subRows&&i.subRows.length)){const u=ve(i,o);u==="all"?l=!0:(u==="some"&&(l=!0),r=!1)}}),r?"all":l?"some":!1}const Ce=/([0-9]+)/gm,ln=(e,o,t)=>Ke(B(e.getValue(t)).toLowerCase(),B(o.getValue(t)).toLowerCase()),sn=(e,o,t)=>Ke(B(e.getValue(t)),B(o.getValue(t))),un=(e,o,t)=>Fe(B(e.getValue(t)).toLowerCase(),B(o.getValue(t)).toLowerCase()),an=(e,o,t)=>Fe(B(e.getValue(t)),B(o.getValue(t))),gn=(e,o,t)=>{const n=e.getValue(t),r=o.getValue(t);return n>r?1:n<r?-1:0},dn=(e,o,t)=>Fe(e.getValue(t),o.getValue(t));function Fe(e,o){return e===o?0:e>o?1:-1}function B(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function Ke(e,o){const t=e.split(Ce).filter(Boolean),n=o.split(Ce).filter(Boolean);for(;t.length&&n.length;){const r=t.shift(),l=n.shift(),i=parseInt(r,10),u=parseInt(l,10),a=[i,u].sort();if(isNaN(a[0])){if(r>l)return 1;if(l>r)return-1;continue}if(isNaN(a[1]))return isNaN(i)?-1:1;if(i>u)return 1;if(u>i)return-1}return t.length-n.length}const T={alphanumeric:ln,alphanumericCaseSensitive:sn,text:un,textCaseSensitive:an,datetime:gn,basic:dn},cn={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:P("sorting",e),isMultiSortEvent:o=>o.shiftKey}),createColumn:(e,o)=>{e.getAutoSortingFn=()=>{const t=o.getFilteredRowModel().flatRows.slice(10);let n=!1;for(const r of t){const l=r?.getValue(e.id);if(Object.prototype.toString.call(l)==="[object Date]")return T.datetime;if(typeof l=="string"&&(n=!0,l.split(Ce).length>1))return T.alphanumeric}return n?T.text:T.basic},e.getAutoSortDir=()=>{const t=o.getFilteredRowModel().flatRows[0];return typeof t?.getValue(e.id)=="string"?"asc":"desc"},e.getSortingFn=()=>{var t,n;if(!e)throw new Error;return ne(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:T[e.columnDef.sortingFn]},e.toggleSorting=(t,n)=>{const r=e.getNextSortingOrder(),l=typeof t<"u"&&t!==null;o.setSorting(i=>{const u=i?.find(s=>s.id===e.id),a=i?.findIndex(s=>s.id===e.id);let g=[],d,m=l?t:r==="desc";if(i!=null&&i.length&&e.getCanMultiSort()&&n?u?d="toggle":d="add":i!=null&&i.length&&a!==i.length-1?d="replace":u?d="toggle":d="replace",d==="toggle"&&(l||r||(d="remove")),d==="add"){var c;g=[...i,{id:e.id,desc:m}],g.splice(0,g.length-((c=o.options.maxMultiSortColCount)!=null?c:Number.MAX_SAFE_INTEGER))}else d==="toggle"?g=i.map(s=>s.id===e.id?{...s,desc:m}:s):d==="remove"?g=i.filter(s=>s.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,r;const l=e.getFirstSortDir(),i=e.getIsSorted();return i?i!==l&&((n=o.options.enableSortingRemoval)==null||n)&&(!(t&&(r=o.options.enableMultiRemove)!=null)||r)?!1:i==="desc"?"asc":"desc":l},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(r=>r.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(r=>r.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())}},fn=[Ht,Zt,Wt,Xt,Gt,At,Qt,en,cn,Ut,tn,nn,on,rn,Jt];function pn(e){var o,t;const n=[...fn,...(o=e._features)!=null?o:[]];let r={_features:n};const l=r._features.reduce((c,s)=>Object.assign(c,s.getDefaultOptions==null?void 0:s.getDefaultOptions(r)),{}),i=c=>r.options.mergeOptions?r.options.mergeOptions(l,c):{...l,...c};let a={...{},...(t=e.initialState)!=null?t:{}};r._features.forEach(c=>{var s;a=(s=c.getInitialState==null?void 0:c.getInitialState(a))!=null?s:a});const g=[];let d=!1;const m={_features:n,options:{...l,...e},initialState:a,_queue:c=>{g.push(c),d||(d=!0,Promise.resolve().then(()=>{for(;g.length;)g.shift()();d=!1}).catch(s=>setTimeout(()=>{throw s})))},reset:()=>{r.setState(r.initialState)},setOptions:c=>{const s=O(c,r.options);r.options=i(s)},getState:()=>r.options.state,setState:c=>{r.options.onStateChange==null||r.options.onStateChange(c)},_getRowId:(c,s,f)=>{var p;return(p=r.options.getRowId==null?void 0:r.options.getRowId(c,s,f))!=null?p:`${f?[f.id,s].join("."):s}`},getCoreRowModel:()=>(r._getCoreRowModel||(r._getCoreRowModel=r.options.getCoreRowModel(r)),r._getCoreRowModel()),getRowModel:()=>r.getPaginationRowModel(),getRow:(c,s)=>{let f=(s?r.getPrePaginationRowModel():r.getRowModel()).rowsById[c];if(!f&&(f=r.getCoreRowModel().rowsById[c],!f))throw new Error;return f},_getDefaultColumnDef:v(()=>[r.options.defaultColumn],c=>{var s;return c=(s=c)!=null?s:{},{header:f=>{const p=f.header.column.columnDef;return p.accessorKey?p.accessorKey:p.accessorFn?p.id:null},cell:f=>{var p,h;return(p=(h=f.renderValue())==null||h.toString==null?void 0:h.toString())!=null?p:null},...r._features.reduce((f,p)=>Object.assign(f,p.getDefaultColumnDef==null?void 0:p.getDefaultColumnDef()),{}),...c}},C(e,"debugColumns")),_getColumnDefs:()=>r.options.columns,getAllColumns:v(()=>[r._getColumnDefs()],c=>{const s=function(f,p,h){return h===void 0&&(h=0),f.map(w=>{const R=Et(r,w,h,p),F=w;return R.columns=F.columns?s(F.columns,R,h+1):[],R})};return s(c)},C(e,"debugColumns")),getAllFlatColumns:v(()=>[r.getAllColumns()],c=>c.flatMap(s=>s.getFlatColumns()),C(e,"debugColumns")),_getAllFlatColumnsById:v(()=>[r.getAllFlatColumns()],c=>c.reduce((s,f)=>(s[f.id]=f,s),{}),C(e,"debugColumns")),getAllLeafColumns:v(()=>[r.getAllColumns(),r._getOrderColumnsFn()],(c,s)=>{let f=c.flatMap(p=>p.getLeafColumns());return s(f)},C(e,"debugColumns")),getColumn:c=>r._getAllFlatColumnsById()[c]};Object.assign(r,m);for(let c=0;c<r._features.length;c++){const s=r._features[c];s==null||s.createTable==null||s.createTable(r)}return r}function mn(){return e=>v(()=>[e.options.data],o=>{const t={rows:[],flatRows:[],rowsById:{}},n=function(r,l,i){l===void 0&&(l=0);const u=[];for(let g=0;g<r.length;g++){const d=we(e,e._getRowId(r[g],g,i),r[g],g,l,void 0,i?.id);if(t.flatRows.push(d),t.rowsById[d.id]=d,u.push(d),e.options.getSubRows){var a;d.originalSubRows=e.options.getSubRows(r[g],g),(a=d.originalSubRows)!=null&&a.length&&(d.subRows=n(d.originalSubRows,l+1,d))}}return u};return t.rows=n(o),t},C(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex()))}function Sn(e){const o=[],t=n=>{var r;o.push(n),(r=n.subRows)!=null&&r.length&&n.getIsExpanded()&&n.subRows.forEach(t)};return e.rows.forEach(t),{rows:o,flatRows:e.flatRows,rowsById:e.rowsById}}function vn(e,o,t){return t.options.filterFromLeafRows?Cn(e,o,t):hn(e,o,t)}function Cn(e,o,t){var n;const r=[],l={},i=(n=t.options.maxLeafRowFilterDepth)!=null?n:100,u=function(a,g){g===void 0&&(g=0);const d=[];for(let c=0;c<a.length;c++){var m;let s=a[c];const f=we(t,s.id,s.original,s.index,s.depth,void 0,s.parentId);if(f.columnFilters=s.columnFilters,(m=s.subRows)!=null&&m.length&&g<i){if(f.subRows=u(s.subRows,g+1),s=f,o(s)&&!f.subRows.length){d.push(s),l[s.id]=s,r.push(s);continue}if(o(s)||f.subRows.length){d.push(s),l[s.id]=s,r.push(s);continue}}else s=f,o(s)&&(d.push(s),l[s.id]=s,r.push(s))}return d};return{rows:u(e),flatRows:r,rowsById:l}}function hn(e,o,t){var n;const r=[],l={},i=(n=t.options.maxLeafRowFilterDepth)!=null?n:100,u=function(a,g){g===void 0&&(g=0);const d=[];for(let c=0;c<a.length;c++){let s=a[c];if(o(s)){var m;if((m=s.subRows)!=null&&m.length&&g<i){const p=we(t,s.id,s.original,s.index,s.depth,void 0,s.parentId);p.subRows=u(s.subRows,g+1),s=p}d.push(s),r.push(s),l[s.id]=s}}return d};return{rows:u(e),flatRows:r,rowsById:l}}function wn(){return e=>v(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(o,t,n)=>{if(!o.rows.length||!(t!=null&&t.length)&&!n){for(let c=0;c<o.flatRows.length;c++)o.flatRows[c].columnFilters={},o.flatRows[c].columnFiltersMeta={};return o}const r=[],l=[];(t??[]).forEach(c=>{var s;const f=e.getColumn(c.id);if(!f)return;const p=f.getFilterFn();p&&r.push({id:c.id,filterFn:p,resolvedValue:(s=p.resolveFilterValue==null?void 0:p.resolveFilterValue(c.value))!=null?s:c.value})});const i=(t??[]).map(c=>c.id),u=e.getGlobalFilterFn(),a=e.getAllLeafColumns().filter(c=>c.getCanGlobalFilter());n&&u&&a.length&&(i.push("__global__"),a.forEach(c=>{var s;l.push({id:c.id,filterFn:u,resolvedValue:(s=u.resolveFilterValue==null?void 0:u.resolveFilterValue(n))!=null?s:n})}));let g,d;for(let c=0;c<o.flatRows.length;c++){const s=o.flatRows[c];if(s.columnFilters={},r.length)for(let f=0;f<r.length;f++){g=r[f];const p=g.id;s.columnFilters[p]=g.filterFn(s,p,g.resolvedValue,h=>{s.columnFiltersMeta[p]=h})}if(l.length){for(let f=0;f<l.length;f++){d=l[f];const p=d.id;if(d.filterFn(s,p,d.resolvedValue,h=>{s.columnFiltersMeta[p]=h})){s.columnFilters.__global__=!0;break}}s.columnFilters.__global__!==!0&&(s.columnFilters.__global__=!1)}}const m=c=>{for(let s=0;s<i.length;s++)if(c.columnFilters[i[s]]===!1)return!1;return!0};return vn(o.rows,m,e)},C(e.options,"debugTable","getFilteredRowModel",()=>e._autoResetPageIndex()))}function Rn(e){return o=>v(()=>[o.getState().pagination,o.getPrePaginationRowModel(),o.options.paginateExpandedRows?void 0:o.getState().expanded],(t,n)=>{if(!n.rows.length)return n;const{pageSize:r,pageIndex:l}=t;let{rows:i,flatRows:u,rowsById:a}=n;const g=r*l,d=g+r;i=i.slice(g,d);let m;o.options.paginateExpandedRows?m={rows:i,flatRows:u,rowsById:a}:m=Sn({rows:i,flatRows:u,rowsById:a}),m.flatRows=[];const c=s=>{m.flatRows.push(s),s.subRows.length&&s.subRows.forEach(c)};return m.rows.forEach(c),m},C(o.options,"debugTable"))}function _n(){return e=>v(()=>[e.getState().sorting,e.getPreSortedRowModel()],(o,t)=>{if(!t.rows.length||!(o!=null&&o.length))return t;const n=e.getState().sorting,r=[],l=n.filter(a=>{var g;return(g=e.getColumn(a.id))==null?void 0:g.getCanSort()}),i={};l.forEach(a=>{const g=e.getColumn(a.id);g&&(i[a.id]={sortUndefined:g.columnDef.sortUndefined,invertSorting:g.columnDef.invertSorting,sortingFn:g.getSortingFn()})});const u=a=>{const g=a.map(d=>({...d}));return g.sort((d,m)=>{for(let s=0;s<l.length;s+=1){var c;const f=l[s],p=i[f.id],h=p.sortUndefined,w=(c=f?.desc)!=null?c:!1;let R=0;if(h){const F=d.getValue(f.id),G=m.getValue(f.id),V=F===void 0,q=G===void 0;if(V||q){if(h==="first")return V?-1:1;if(h==="last")return V?1:-1;R=V&&q?0:V?h:-h}}if(R===0&&(R=p.sortingFn(d,m,f.id)),R!==0)return w&&(R*=-1),p.invertSorting&&(R*=-1),R}return d.index-m.index}),g.forEach(d=>{var m;r.push(d),(m=d.subRows)!=null&&m.length&&(d.subRows=u(d.subRows))}),g};return{rows:u(t.rows),flatRows:r,rowsById:t.rowsById}},C(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}/**
   * vue-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 Q(){return!0}const Fn=Symbol("merge-proxy"),$n={get(e,o,t){return o===Fn?t:e.get(o)},has(e,o){return e.has(o)},set:Q,deleteProperty:Q,getOwnPropertyDescriptor(e,o){return{configurable:!0,enumerable:!0,get(){return e.get(o)},set:Q,deleteProperty:Q}},ownKeys(e){return e.keys()}};function de(e){return"value"in e?e.value:e}function j(){for(var e=arguments.length,o=new Array(e),t=0;t<e;t++)o[t]=arguments[t];return new Proxy({get(n){for(let r=o.length-1;r>=0;r--){const l=de(o[r])[n];if(l!==void 0)return l}},has(n){for(let r=o.length-1;r>=0;r--)if(n in de(o[r]))return!0;return!1},keys(){const n=[];for(let r=0;r<o.length;r++)n.push(...Object.keys(de(o[r])));return[...Array.from(new Set(n))]}},$n)}const Ee=H({props:["render","props"],setup:e=>()=>typeof e.render=="function"||typeof e.render=="object"?fe(e.render,e.props):e.render});function He(e){return j(e,{data:S(e.data)})}function yn(e){const o=lt(e.data),t=j({state:{},onStateChange:()=>{},renderFallbackValue:null,mergeOptions(l,i){return o?{...l,...i}:j(l,i)}},o?He(e):e),n=pn(t);if(o){const l=it(e.data);st(l,()=>{n.setState(i=>({...i,data:l.value}))},{immediate:!0})}const r=N(n.initialState);return ut(()=>{n.setOptions(l=>{var i;const u=new Proxy({},{get:(a,g)=>r.value[g]});return j(l,o?He(e):e,{state:j(u,(i=e.state)!=null?i:{}),onStateChange:a=>{a instanceof Function?r.value=a(r.value):r.value=a,e.onStateChange==null||e.onStateChange(a)}})})}),n}const Vn={class:"flex flex-col items-center gap-2"},xn=H({__name:"data-table",props:{table:{},isLoading:{type:Boolean,default:!1},emptyTitle:{default:"No data"},emptyDescription:{default:"There is nothing to display yet."},class:{default:void 0},tableClass:{default:void 0},stickyHeader:{type:Boolean,default:!1},bodyHeight:{default:void 0}},setup(e){const o=e,t=k(()=>o.table.getVisibleLeafColumns().length),n=k(()=>o.table.getRowModel().rows.length>0),r=l=>{const i=l.columnDef.meta;if(!i)return;const u={};return i.width!=null&&(u.width=typeof i.width=="number"?`${i.width}px`:i.width),i.minWidth!=null&&(u.minWidth=typeof i.minWidth=="number"?`${i.minWidth}px`:i.minWidth),i.maxWidth!=null&&(u.maxWidth=typeof i.maxWidth=="number"?`${i.maxWidth}px`:i.maxWidth),Object.keys(u).length>0?u:void 0};return(l,i)=>(_(),D("div",{class:x(S(A)("flex flex-col gap-4",o.class))},[(_(),M(ke(e.bodyHeight?S(Qe):"div"),{class:x(e.bodyHeight?S(A)("rounded-md border",e.bodyHeight):void 0)},{default:$(()=>[I(S(yt),{class:x(e.bodyHeight?e.tableClass:S(A)("border rounded-md",e.tableClass))},{default:$(()=>[I(S(Pt),{class:x(e.stickyHeader?"sticky top-0 z-10 bg-muted/40 backdrop-blur":"")},{default:$(()=>[(_(!0),D(b,null,W(e.table.getHeaderGroups(),u=>(_(),M(S(K),{key:u.id,class:x(e.stickyHeader?"bg-muted/40 backdrop-blur":void 0)},{default:$(()=>[(_(!0),D(b,null,W(u.headers,a=>(_(),M(S(xt),{key:a.id,class:x(e.bodyHeight?void 0:"py-2"),style:ee(r(a.column))},{default:$(()=>[a.isPlaceholder?ze("",!0):(_(),M(S(Ee),{key:0,render:a.column.columnDef.header,props:a.getContext()},null,8,["render","props"]))]),_:2},1032,["class","style"]))),128))]),_:2},1032,["class"]))),128))]),_:1},8,["class"]),I(S(Vt),null,{default:$(()=>[e.isLoading?(_(),M(S(K),{key:0},{default:$(()=>[I(S(oe),{colspan:t.value,class:"h-48 text-center align-middle"},{default:$(()=>[ce("div",Vn,[I(S(ct),{class:"size-6"}),i[0]||(i[0]=ce("span",{class:"text-sm text-muted-foreground"},"Loading...",-1))])]),_:1},8,["colspan"])]),_:1})):n.value?(_(!0),D(b,{key:1},W(e.table.getRowModel().rows,u=>(_(),M(S(K),{key:u.id,"data-state":u.getIsSelected()?"selected":void 0,class:"transition-colors hover:bg-muted/40"},{default:$(()=>[(_(!0),D(b,null,W(u.getVisibleCells(),a=>(_(),M(S(oe),{key:a.id,class:x(e.bodyHeight?void 0:"py-2"),style:ee(r(a.column))},{default:$(()=>[I(S(Ee),{render:a.column.columnDef.cell,props:a.getContext()},null,8,["render","props"])]),_:2},1032,["class","style"]))),128))]),_:2},1032,["data-state"]))),128)):(_(),M(S(K),{key:2},{default:$(()=>[I(S(oe),{colspan:t.value,class:"h-48"},{default:$(()=>[I(Ze,{title:e.emptyTitle,description:e.emptyDescription},{default:$(()=>[L(l.$slots,"empty")]),_:3},8,["title","description"])]),_:3},8,["colspan"])]),_:3}))]),_:3})]),_:3},8,["class"])]),_:3},8,["class"]))],2))}}),zn=Object.assign(xn,{__name:"DataTable"}),Ge=H({__name:"Checkbox",props:{defaultValue:{type:[Boolean,String]},modelValue:{type:[Boolean,String,null]},disabled:{type:Boolean},value:{},id:{},asChild:{type:Boolean},as:{},name:{},required:{type:Boolean},class:{}},emits:["update:modelValue"],setup(e,{emit:o}){const t=e,n=o,r=at(t,"class"),l=gt(r,n);return(i,u)=>(_(),M(S(Rt),he(S(l),{class:S(A)("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t.class)}),{default:$(()=>[I(S(Ft),{class:"grid place-content-center text-current"},{default:$(()=>[L(i.$slots,"default",{},()=>[I(S(mt),{class:"h-4 w-4"})])]),_:3})]),_:3},16,["class"]))}});function Pn(){return{id:"select",enableSorting:!1,enableHiding:!1,header:({table:e})=>fe(Ge,{modelValue:e.getIsAllPageRowsSelected(),"onUpdate:modelValue":o=>e.toggleAllPageRowsSelected(!!o),ariaLabel:"Select all",class:"translate-y-0.5"}),cell:({row:e})=>fe(Ge,{modelValue:e.getIsSelected(),"onUpdate:modelValue":o=>e.toggleSelected(!!o),ariaLabel:"Select row",class:"translate-y-0.5"}),size:48}}function kn(e){const o=N([]),t=N([]),n=N({}),r=N({pageIndex:0,pageSize:e.pageSize??10}),l=k(()=>xe(e.data)),i=k(()=>{const d=xe(e.columns);return e.enableRowSelection?[Pn(),...d]:d}),u=yn({data:l,get columns(){return i.value},state:dt({get sorting(){return o.value},get columnFilters(){return t.value},get rowSelection(){return n.value},get pagination(){return r.value}}),enableSorting:!e.manualSorting,enableRowSelection:e.enableRowSelection??!1,manualSorting:e.manualSorting??!1,manualPagination:e.manualPagination??!1,getRowId:e.getRowId,onSortingChange:d=>X(d,o),onColumnFiltersChange:d=>X(d,t),onRowSelectionChange:d=>X(d,n),onPaginationChange:d=>X(d,r),getCoreRowModel:mn(),getSortedRowModel:_n(),getFilteredRowModel:wn(),getPaginationRowModel:e.manualPagination?void 0:Rn()}),a=k(()=>u.getSelectedRowModel().rows.map(d=>d.original)),g=k(()=>u.getSelectedRowModel().rows.map(d=>d.id));return{table:u,selectedRows:a,selectedRowIds:g}}export{zn as D,Ge as _,kn as u};
