import{e as Me,j as v,r as w,$ as Ae,m as Ve,x as be,D as ae,_ as J,q as ie,k as Ie,an as Ee,f as _,ao as He,a1 as De,h as ke,C as Le,K as ge,L as de,M as ce,N as fe,ap as Ge,aq as ze,ar as Ne}from"./index-ck01-P-l.js";import{C as je,a as Oe}from"./loading-vsHIitu7.js";/**
 * @license lucide-react v0.319.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Te=Me("MoreHorizontal",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]),un=({content:e})=>v.jsxs("div",{className:"my-4 flex items-center",children:[v.jsx("hr",{className:"w-full border-t border-zinc-300"}),v.jsx("span",{className:"whitespace-nowrap px-2 text-zinc-600",children:e}),v.jsx("hr",{className:"w-full border-t border-zinc-300"})]});/**
   * 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 M(e,n){return typeof e=="function"?e(n):e}function F(e,n){return t=>{n.setState(o=>({...o,[e]:M(t,o[e])}))}}function k(e){return e instanceof Function}function Be(e){return Array.isArray(e)&&e.every(n=>typeof n=="number")}function qe(e,n){const t=[],o=r=>{r.forEach(i=>{t.push(i);const l=n(i);l!=null&&l.length&&o(l)})};return o(e),t}function S(e,n,t){let o=[],r;return()=>{let i;t.key&&t.debug&&(i=Date.now());const l=e();if(!(l.length!==o.length||l.some((d,g)=>o[g]!==d)))return r;o=l;let a;if(t.key&&t.debug&&(a=Date.now()),r=n(...l),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,g=Math.round((Date.now()-a)*100)/100,c=g/16,f=(u,p)=>{for(u=String(u);u.length<p;)u=" "+u;return u};console.info(`%c⏱ ${f(g,5)} /${f(d,5)} ms`,`
            font-size: .6rem;
            font-weight: bold;
            color: hsl(${Math.max(0,Math.min(120-120*c,120))}deg 100% 31%);`,t==null?void 0:t.key)}return r}}function Xe(e,n,t,o){var r,i;const s={...e._getDefaultColumnDef(),...n},a=s.accessorKey;let d=(r=(i=s.id)!=null?i:a?a.replace(".","_"):void 0)!=null?r:typeof s.header=="string"?s.header:void 0,g;if(s.accessorFn?g=s.accessorFn:a&&(a.includes(".")?g=f=>{let u=f;for(const h of a.split(".")){var p;u=(p=u)==null?void 0:p[h]}return u}:g=f=>f[s.accessorKey]),!d)throw new Error;let c={id:`${String(d)}`,accessorFn:g,parent:o,depth:t,columnDef:s,columns:[],getFlatColumns:S(()=>[!0],()=>{var f;return[c,...(f=c.columns)==null?void 0:f.flatMap(u=>u.getFlatColumns())]},{key:"column.getFlatColumns",debug:()=>{var f;return(f=e.options.debugAll)!=null?f:e.options.debugColumns}}),getLeafColumns:S(()=>[e._getOrderColumnsFn()],f=>{var u;if((u=c.columns)!=null&&u.length){let p=c.columns.flatMap(h=>h.getLeafColumns());return f(p)}return[c]},{key:"column.getLeafColumns",debug:()=>{var f;return(f=e.options.debugAll)!=null?f:e.options.debugColumns}})};for(const f of e._features)f.createColumn==null||f.createColumn(c,e);return c}function le(e,n,t){var o;let i={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 l=[],s=a=>{a.subHeaders&&a.subHeaders.length&&a.subHeaders.map(s),l.push(a)};return s(i),l},getContext:()=>({table:e,header:i,column:n})};return e._features.forEach(l=>{l.createHeader==null||l.createHeader(i,e)}),i}const Ke={createTable:e=>{e.getHeaderGroups=S(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,t,o,r)=>{var i,l;const s=(i=o==null?void 0:o.map(c=>t.find(f=>f.id===c)).filter(Boolean))!=null?i:[],a=(l=r==null?void 0:r.map(c=>t.find(f=>f.id===c)).filter(Boolean))!=null?l:[],d=t.filter(c=>!(o!=null&&o.includes(c.id))&&!(r!=null&&r.includes(c.id)));return E(n,[...s,...d,...a],e)},{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),e.getCenterHeaderGroups=S(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,t,o,r)=>(t=t.filter(i=>!(o!=null&&o.includes(i.id))&&!(r!=null&&r.includes(i.id))),E(n,t,e,"center")),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),e.getLeftHeaderGroups=S(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(n,t,o)=>{var r;const i=(r=o==null?void 0:o.map(l=>t.find(s=>s.id===l)).filter(Boolean))!=null?r:[];return E(n,i,e,"left")},{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),e.getRightHeaderGroups=S(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(n,t,o)=>{var r;const i=(r=o==null?void 0:o.map(l=>t.find(s=>s.id===l)).filter(Boolean))!=null?r:[];return E(n,i,e,"right")},{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),e.getFooterGroups=S(()=>[e.getHeaderGroups()],n=>[...n].reverse(),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),e.getLeftFooterGroups=S(()=>[e.getLeftHeaderGroups()],n=>[...n].reverse(),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),e.getCenterFooterGroups=S(()=>[e.getCenterHeaderGroups()],n=>[...n].reverse(),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),e.getRightFooterGroups=S(()=>[e.getRightHeaderGroups()],n=>[...n].reverse(),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),e.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}}),e.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}}),e.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}}),e.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}}),e.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}}),e.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}}),e.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}}),e.getLeafHeaders=S(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(n,t,o)=>{var r,i,l,s,a,d;return[...(r=(i=n[0])==null?void 0:i.headers)!=null?r:[],...(l=(s=t[0])==null?void 0:s.headers)!=null?l:[],...(a=(d=o[0])==null?void 0:d.headers)!=null?a:[]].map(g=>g.getLeafHeaders()).flat()},{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}})}};function E(e,n,t,o){var r,i;let l=0;const s=function(f,u){u===void 0&&(u=1),l=Math.max(l,u),f.filter(p=>p.getIsVisible()).forEach(p=>{var h;(h=p.columns)!=null&&h.length&&s(p.columns,u+1)},0)};s(e);let a=[];const d=(f,u)=>{const p={depth:u,id:[o,`${u}`].filter(Boolean).join("_"),headers:[]},h=[];f.forEach(C=>{const m=[...h].reverse()[0],$=C.column.depth===p.depth;let R,x=!1;if($&&C.column.parent?R=C.column.parent:(R=C.column,x=!0),m&&(m==null?void 0:m.column)===R)m.subHeaders.push(C);else{const V=le(t,R,{id:[o,u,R.id,C==null?void 0:C.id].filter(Boolean).join("_"),isPlaceholder:x,placeholderId:x?`${h.filter(L=>L.column===R).length}`:void 0,depth:u,index:h.length});V.subHeaders.push(C),h.push(V)}p.headers.push(C),C.headerGroup=p}),a.push(p),u>0&&d(h,u-1)},g=n.map((f,u)=>le(t,f,{depth:l,index:u}));d(g,l-1),a.reverse();const c=f=>f.filter(p=>p.column.getIsVisible()).map(p=>{let h=0,C=0,m=[0];p.subHeaders&&p.subHeaders.length?(m=[],c(p.subHeaders).forEach(R=>{let{colSpan:x,rowSpan:V}=R;h+=x,m.push(V)})):h=1;const $=Math.min(...m);return C=C+$,p.colSpan=h,p.rowSpan=C,{colSpan:h,rowSpan:C}});return c((r=(i=a[0])==null?void 0:i.headers)!=null?r:[]),a}const H={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},G=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),Ue={getDefaultColumnDef:()=>H,getInitialState:e=>({columnSizing:{},columnSizingInfo:G(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:F("columnSizing",e),onColumnSizingInfoChange:F("columnSizingInfo",e)}),createColumn:(e,n)=>{e.getSize=()=>{var t,o,r;const i=n.getState().columnSizing[e.id];return Math.min(Math.max((t=e.columnDef.minSize)!=null?t:H.minSize,(o=i??e.columnDef.size)!=null?o:H.size),(r=e.columnDef.maxSize)!=null?r:H.maxSize)},e.getStart=t=>{const o=t?t==="left"?n.getLeftVisibleLeafColumns():n.getRightVisibleLeafColumns():n.getVisibleLeafColumns(),r=o.findIndex(i=>i.id===e.id);if(r>0){const i=o[r-1];return i.getStart(t)+i.getSize()}return 0},e.resetSize=()=>{n.setColumnSizing(t=>{let{[e.id]:o,...r}=t;return r})},e.getCanResize=()=>{var t,o;return((t=e.columnDef.enableResizing)!=null?t:!0)&&((o=n.options.enableColumnResizing)!=null?o:!0)},e.getIsResizing=()=>n.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,n)=>{e.getSize=()=>{let t=0;const o=r=>{if(r.subHeaders.length)r.subHeaders.forEach(o);else{var i;t+=(i=r.column.getSize())!=null?i:0}};return o(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 o=n.getColumn(e.column.id),r=o==null?void 0:o.getCanResize();return i=>{if(!o||!r||(i.persist==null||i.persist(),z(i)&&i.touches&&i.touches.length>1))return;const l=e.getSize(),s=e?e.getLeafHeaders().map(m=>[m.column.id,m.column.getSize()]):[[o.id,o.getSize()]],a=z(i)?Math.round(i.touches[0].clientX):i.clientX,d={},g=(m,$)=>{typeof $=="number"&&(n.setColumnSizingInfo(R=>{var x,V;const L=n.options.columnResizeDirection==="rtl"?-1:1,ne=($-((x=R==null?void 0:R.startOffset)!=null?x:0))*L,oe=Math.max(ne/((V=R==null?void 0:R.startSize)!=null?V:0),-.999999);return R.columnSizingStart.forEach(ye=>{let[Pe,re]=ye;d[Pe]=Math.round(Math.max(re+re*oe,0)*100)/100}),{...R,deltaOffset:ne,deltaPercentage:oe}}),(n.options.columnResizeMode==="onChange"||m==="end")&&n.setColumnSizing(R=>({...R,...d})))},c=m=>g("move",m),f=m=>{g("end",m),n.setColumnSizingInfo($=>({...$,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},u=t||typeof document<"u"?document:null,p={moveHandler:m=>c(m.clientX),upHandler:m=>{u==null||u.removeEventListener("mousemove",p.moveHandler),u==null||u.removeEventListener("mouseup",p.upHandler),f(m.clientX)}},h={moveHandler:m=>(m.cancelable&&(m.preventDefault(),m.stopPropagation()),c(m.touches[0].clientX),!1),upHandler:m=>{var $;u==null||u.removeEventListener("touchmove",h.moveHandler),u==null||u.removeEventListener("touchend",h.upHandler),m.cancelable&&(m.preventDefault(),m.stopPropagation()),f(($=m.touches[0])==null?void 0:$.clientX)}},C=We()?{passive:!1}:!1;z(i)?(u==null||u.addEventListener("touchmove",h.moveHandler,C),u==null||u.addEventListener("touchend",h.upHandler,C)):(u==null||u.addEventListener("mousemove",p.moveHandler,C),u==null||u.addEventListener("mouseup",p.upHandler,C)),n.setColumnSizingInfo(m=>({...m,startOffset:a,startSize:l,deltaOffset:0,deltaPercentage:0,columnSizingStart:s,isResizingColumn:o.id}))}}},createTable:e=>{e.setColumnSizing=n=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(n),e.setColumnSizingInfo=n=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(n),e.resetColumnSizing=n=>{var t;e.setColumnSizing(n?{}:(t=e.initialState.columnSizing)!=null?t:{})},e.resetHeaderSizeInfo=n=>{var t;e.setColumnSizingInfo(n?G():(t=e.initialState.columnSizingInfo)!=null?t:G())},e.getTotalSize=()=>{var n,t;return(n=(t=e.getHeaderGroups()[0])==null?void 0:t.headers.reduce((o,r)=>o+r.getSize(),0))!=null?n:0},e.getLeftTotalSize=()=>{var n,t;return(n=(t=e.getLeftHeaderGroups()[0])==null?void 0:t.headers.reduce((o,r)=>o+r.getSize(),0))!=null?n:0},e.getCenterTotalSize=()=>{var n,t;return(n=(t=e.getCenterHeaderGroups()[0])==null?void 0:t.headers.reduce((o,r)=>o+r.getSize(),0))!=null?n:0},e.getRightTotalSize=()=>{var n,t;return(n=(t=e.getRightHeaderGroups()[0])==null?void 0:t.headers.reduce((o,r)=>o+r.getSize(),0))!=null?n:0}}};let D=null;function We(){if(typeof D=="boolean")return D;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 D=e,D}function z(e){return e.type==="touchstart"}const Je={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:F("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let n=!1,t=!1;e._autoResetExpanded=()=>{var o,r;if(!n){e._queue(()=>{n=!0});return}if((o=(r=e.options.autoResetAll)!=null?r:e.options.autoResetExpanded)!=null?o:!e.options.manualExpanding){if(t)return;t=!0,e._queue(()=>{e.resetExpanded(),t=!1})}},e.setExpanded=o=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(o),e.toggleAllRowsExpanded=o=>{o??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=o=>{var r,i;e.setExpanded(o?{}:(r=(i=e.initialState)==null?void 0:i.expanded)!=null?r:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(o=>o.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>o=>{o.persist==null||o.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const o=e.getState().expanded;return o===!0||Object.values(o).some(Boolean)},e.getIsAllRowsExpanded=()=>{const o=e.getState().expanded;return typeof o=="boolean"?o===!0:!(!Object.keys(o).length||e.getRowModel().flatRows.some(r=>!r.getIsExpanded()))},e.getExpandedDepth=()=>{let o=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(i=>{const l=i.split(".");o=Math.max(o,l.length)}),o},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,n)=>{e.toggleExpanded=t=>{n.setExpanded(o=>{var r;const i=o===!0?!0:!!(o!=null&&o[e.id]);let l={};if(o===!0?Object.keys(n.getRowModel().rowsById).forEach(s=>{l[s]=!0}):l=o,t=(r=t)!=null?r:!i,!i&&t)return{...l,[e.id]:!0};if(i&&!t){const{[e.id]:s,...a}=l;return a}return o})},e.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])},e.getCanExpand=()=>{var t,o,r;return(t=n.options.getRowCanExpand==null?void 0:n.options.getRowCanExpand(e))!=null?t:((o=n.options.enableExpanding)!=null?o:!0)&&!!((r=e.subRows)!=null&&r.length)},e.getIsAllParentsExpanded=()=>{let t=!0,o=e;for(;t&&o.parentId;)o=n.getRow(o.parentId,!0),t=o.getIsExpanded();return t},e.getToggleExpandedHandler=()=>{const t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},pe=(e,n,t)=>{var o;const r=t.toLowerCase();return!!(!((o=e.getValue(n))==null||(o=o.toString())==null||(o=o.toLowerCase())==null)&&o.includes(r))};pe.autoRemove=e=>y(e);const me=(e,n,t)=>{var o;return!!(!((o=e.getValue(n))==null||(o=o.toString())==null)&&o.includes(t))};me.autoRemove=e=>y(e);const he=(e,n,t)=>{var o;return((o=e.getValue(n))==null||(o=o.toString())==null?void 0:o.toLowerCase())===(t==null?void 0:t.toLowerCase())};he.autoRemove=e=>y(e);const ve=(e,n,t)=>{var o;return(o=e.getValue(n))==null?void 0:o.includes(t)};ve.autoRemove=e=>y(e)||!(e!=null&&e.length);const Se=(e,n,t)=>!t.some(o=>{var r;return!((r=e.getValue(n))!=null&&r.includes(o))});Se.autoRemove=e=>y(e)||!(e!=null&&e.length);const Ce=(e,n,t)=>t.some(o=>{var r;return(r=e.getValue(n))==null?void 0:r.includes(o)});Ce.autoRemove=e=>y(e)||!(e!=null&&e.length);const we=(e,n,t)=>e.getValue(n)===t;we.autoRemove=e=>y(e);const Re=(e,n,t)=>e.getValue(n)==t;Re.autoRemove=e=>y(e);const Q=(e,n,t)=>{let[o,r]=t;const i=e.getValue(n);return i>=o&&i<=r};Q.resolveFilterValue=e=>{let[n,t]=e,o=typeof n!="number"?parseFloat(n):n,r=typeof t!="number"?parseFloat(t):t,i=n===null||Number.isNaN(o)?-1/0:o,l=t===null||Number.isNaN(r)?1/0:r;if(i>l){const s=i;i=l,l=s}return[i,l]};Q.autoRemove=e=>y(e)||y(e[0])&&y(e[1]);const P={includesString:pe,includesStringSensitive:me,equalsString:he,arrIncludes:ve,arrIncludesAll:Se,arrIncludesSome:Ce,equals:we,weakEquals:Re,inNumberRange:Q};function y(e){return e==null||e===""}const Qe={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],globalFilter:void 0,...e}),getDefaultOptions:e=>({onColumnFiltersChange:F("columnFilters",e),onGlobalFilterChange:F("globalFilter",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100,globalFilterFn:"auto",getColumnCanGlobalFilter:n=>{var t;const o=(t=e.getCoreRowModel().flatRows[0])==null||(t=t._getAllCellsByColumnId()[n.id])==null?void 0:t.getValue();return typeof o=="string"||typeof o=="number"}}),createColumn:(e,n)=>{e.getAutoFilterFn=()=>{const t=n.getCoreRowModel().flatRows[0],o=t==null?void 0:t.getValue(e.id);return typeof o=="string"?P.includesString:typeof o=="number"?P.inNumberRange:typeof o=="boolean"||o!==null&&typeof o=="object"?P.equals:Array.isArray(o)?P.arrIncludes:P.weakEquals},e.getFilterFn=()=>{var t,o;return k(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:P[e.columnDef.filterFn]},e.getCanFilter=()=>{var t,o,r;return((t=e.columnDef.enableColumnFilter)!=null?t:!0)&&((o=n.options.enableColumnFilters)!=null?o:!0)&&((r=n.options.enableFilters)!=null?r:!0)&&!!e.accessorFn},e.getCanGlobalFilter=()=>{var t,o,r,i;return((t=e.columnDef.enableGlobalFilter)!=null?t:!0)&&((o=n.options.enableGlobalFilter)!=null?o:!0)&&((r=n.options.enableFilters)!=null?r:!0)&&((i=n.options.getColumnCanGlobalFilter==null?void 0:n.options.getColumnCanGlobalFilter(e))!=null?i:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var t;return(t=n.getState().columnFilters)==null||(t=t.find(o=>o.id===e.id))==null?void 0:t.value},e.getFilterIndex=()=>{var t,o;return(t=(o=n.getState().columnFilters)==null?void 0:o.findIndex(r=>r.id===e.id))!=null?t:-1},e.setFilterValue=t=>{n.setColumnFilters(o=>{const r=e.getFilterFn(),i=o==null?void 0:o.find(g=>g.id===e.id),l=M(t,i?i.value:void 0);if(se(r,l,e)){var s;return(s=o==null?void 0:o.filter(g=>g.id!==e.id))!=null?s:[]}const a={id:e.id,value:l};if(i){var d;return(d=o==null?void 0:o.map(g=>g.id===e.id?a:g))!=null?d:[]}return o!=null&&o.length?[...o,a]:[a]})},e._getFacetedRowModel=n.options.getFacetedRowModel&&n.options.getFacetedRowModel(n,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():n.getPreFilteredRowModel(),e._getFacetedUniqueValues=n.options.getFacetedUniqueValues&&n.options.getFacetedUniqueValues(n,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=n.options.getFacetedMinMaxValues&&n.options.getFacetedMinMaxValues(n,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}},createRow:(e,n)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.getGlobalAutoFilterFn=()=>P.includesString,e.getGlobalFilterFn=()=>{var n,t;const{globalFilterFn:o}=e.options;return k(o)?o:o==="auto"?e.getGlobalAutoFilterFn():(n=(t=e.options.filterFns)==null?void 0:t[o])!=null?n:P[o]},e.setColumnFilters=n=>{const t=e.getAllLeafColumns(),o=r=>{var i;return(i=M(n,r))==null?void 0:i.filter(l=>{const s=t.find(a=>a.id===l.id);if(s){const a=s.getFilterFn();if(se(a,l.value,s))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(o)},e.setGlobalFilter=n=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(n)},e.resetGlobalFilter=n=>{e.setGlobalFilter(n?void 0:e.initialState.globalFilter)},e.resetColumnFilters=n=>{var t,o;e.setColumnFilters(n?[]:(t=(o=e.initialState)==null?void 0:o.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()),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()}}};function se(e,n,t){return(e&&e.autoRemove?e.autoRemove(n,t):!1)||typeof n>"u"||typeof n=="string"&&!n}const Ye=(e,n,t)=>t.reduce((o,r)=>{const i=r.getValue(e);return o+(typeof i=="number"?i:0)},0),Ze=(e,n,t)=>{let o;return t.forEach(r=>{const i=r.getValue(e);i!=null&&(o>i||o===void 0&&i>=i)&&(o=i)}),o},et=(e,n,t)=>{let o;return t.forEach(r=>{const i=r.getValue(e);i!=null&&(o<i||o===void 0&&i>=i)&&(o=i)}),o},tt=(e,n,t)=>{let o,r;return t.forEach(i=>{const l=i.getValue(e);l!=null&&(o===void 0?l>=l&&(o=r=l):(o>l&&(o=l),r<l&&(r=l)))}),[o,r]},nt=(e,n)=>{let t=0,o=0;if(n.forEach(r=>{let i=r.getValue(e);i!=null&&(i=+i)>=i&&(++t,o+=i)}),t)return o/t},ot=(e,n)=>{if(!n.length)return;const t=n.map(i=>i.getValue(e));if(!Be(t))return;if(t.length===1)return t[0];const o=Math.floor(t.length/2),r=t.sort((i,l)=>i-l);return t.length%2!==0?r[o]:(r[o-1]+r[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,lt=(e,n)=>n.length,N={sum:Ye,min:Ze,max:et,extent:tt,mean:nt,median:ot,unique:rt,uniqueCount:it,count:lt},st={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:F("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,n)=>{e.toggleGrouping=()=>{n.setGrouping(t=>t!=null&&t.includes(e.id)?t.filter(o=>o!==e.id):[...t??[],e.id])},e.getCanGroup=()=>{var t,o,r,i;return(t=(o=(r=(i=e.columnDef.enableGrouping)!=null?i:!0)!=null?r:n.options.enableGrouping)!=null?o:!0)!=null?t:!!e.accessorFn},e.getIsGrouped=()=>{var t;return(t=n.getState().grouping)==null?void 0:t.includes(e.id)},e.getGroupedIndex=()=>{var t;return(t=n.getState().grouping)==null?void 0:t.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const t=n.getCoreRowModel().flatRows[0],o=t==null?void 0:t.getValue(e.id);if(typeof o=="number")return N.sum;if(Object.prototype.toString.call(o)==="[object Date]")return N.extent},e.getAggregationFn=()=>{var t,o;if(!e)throw new Error;return k(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:N[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=n=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(n),e.resetGrouping=n=>{var t,o;e.setGrouping(n?[]:(t=(o=e.initialState)==null?void 0:o.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,n)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=t=>{if(e._groupingValuesCache.hasOwnProperty(t))return e._groupingValuesCache[t];const o=n.getColumn(t);return o!=null&&o.columnDef.getGroupingValue?(e._groupingValuesCache[t]=o.columnDef.getGroupingValue(e.original),e._groupingValuesCache[t]):e.getValue(t)},e._groupingValuesCache={}},createCell:(e,n,t,o)=>{e.getIsGrouped=()=>n.getIsGrouped()&&n.id===t.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&n.getIsGrouped(),e.getIsAggregated=()=>{var r;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((r=t.subRows)!=null&&r.length)}}};function ut(e,n,t){if(!(n!=null&&n.length)||!t)return e;const o=e.filter(i=>!n.includes(i.id));return t==="remove"?o:[...n.map(i=>e.find(l=>l.id===i)).filter(Boolean),...o]}const at={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:F("columnOrder",e)}),createTable:e=>{e.setColumnOrder=n=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(n),e.resetColumnOrder=n=>{var t;e.setColumnOrder(n?[]:(t=e.initialState.columnOrder)!=null?t:[])},e._getOrderColumnsFn=S(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(n,t,o)=>r=>{let i=[];if(!(n!=null&&n.length))i=r;else{const l=[...n],s=[...r];for(;s.length&&l.length;){const a=l.shift(),d=s.findIndex(g=>g.id===a);d>-1&&i.push(s.splice(d,1)[0])}i=[...i,...s]}return ut(i,t,o)},{key:!1})}},q=0,X=10,j=()=>({pageIndex:q,pageSize:X}),gt={getInitialState:e=>({...e,pagination:{...j(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:F("pagination",e)}),createTable:e=>{let n=!1,t=!1;e._autoResetPageIndex=()=>{var o,r;if(!n){e._queue(()=>{n=!0});return}if((o=(r=e.options.autoResetAll)!=null?r:e.options.autoResetPageIndex)!=null?o:!e.options.manualPagination){if(t)return;t=!0,e._queue(()=>{e.resetPageIndex(),t=!1})}},e.setPagination=o=>{const r=i=>M(o,i);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(r)},e.resetPagination=o=>{var r;e.setPagination(o?j():(r=e.initialState.pagination)!=null?r:j())},e.setPageIndex=o=>{e.setPagination(r=>{let i=M(o,r.pageIndex);const l=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return i=Math.max(0,Math.min(i,l)),{...r,pageIndex:i}})},e.resetPageIndex=o=>{var r,i;e.setPageIndex(o?q:(r=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageIndex)!=null?r:q)},e.resetPageSize=o=>{var r,i;e.setPageSize(o?X:(r=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageSize)!=null?r:X)},e.setPageSize=o=>{e.setPagination(r=>{const i=Math.max(1,M(o,r.pageSize)),l=r.pageSize*r.pageIndex,s=Math.floor(l/i);return{...r,pageIndex:s,pageSize:i}})},e.setPageCount=o=>e.setPagination(r=>{var i;let l=M(o,(i=e.options.pageCount)!=null?i:-1);return typeof l=="number"&&(l=Math.max(-1,l)),{...r,pageCount:l}}),e.getPageOptions=S(()=>[e.getPageCount()],o=>{let r=[];return o&&o>0&&(r=[...new Array(o)].fill(null).map((i,l)=>l)),r},{key:!1,debug:()=>{var o;return(o=e.options.debugAll)!=null?o:e.options.debugTable}}),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:o}=e.getState().pagination,r=e.getPageCount();return r===-1?!0:r===0?!1:o<r-1},e.previousPage=()=>e.setPageIndex(o=>o-1),e.nextPage=()=>e.setPageIndex(o=>o+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 o;return(o=e.options.pageCount)!=null?o:Math.ceil(e.getPrePaginationRowModel().rows.length/e.getState().pagination.pageSize)}}},O=()=>({left:[],right:[]}),T=()=>({top:[],bottom:[]}),dt={getInitialState:e=>({columnPinning:O(),rowPinning:T(),...e}),getDefaultOptions:e=>({onColumnPinningChange:F("columnPinning",e),onRowPinningChange:F("rowPinning",e)}),createColumn:(e,n)=>{e.pin=t=>{const o=e.getLeafColumns().map(r=>r.id).filter(Boolean);n.setColumnPinning(r=>{var i,l;if(t==="right"){var s,a;return{left:((s=r==null?void 0:r.left)!=null?s:[]).filter(c=>!(o!=null&&o.includes(c))),right:[...((a=r==null?void 0:r.right)!=null?a:[]).filter(c=>!(o!=null&&o.includes(c))),...o]}}if(t==="left"){var d,g;return{left:[...((d=r==null?void 0:r.left)!=null?d:[]).filter(c=>!(o!=null&&o.includes(c))),...o],right:((g=r==null?void 0:r.right)!=null?g:[]).filter(c=>!(o!=null&&o.includes(c)))}}return{left:((i=r==null?void 0:r.left)!=null?i:[]).filter(c=>!(o!=null&&o.includes(c))),right:((l=r==null?void 0:r.right)!=null?l:[]).filter(c=>!(o!=null&&o.includes(c)))}})},e.getCanPin=()=>e.getLeafColumns().some(o=>{var r,i,l;return((r=o.columnDef.enablePinning)!=null?r:!0)&&((i=(l=n.options.enableColumnPinning)!=null?l:n.options.enablePinning)!=null?i:!0)}),e.getIsPinned=()=>{const t=e.getLeafColumns().map(s=>s.id),{left:o,right:r}=n.getState().columnPinning,i=t.some(s=>o==null?void 0:o.includes(s)),l=t.some(s=>r==null?void 0:r.includes(s));return i?"left":l?"right":!1},e.getPinnedIndex=()=>{var t,o;const r=e.getIsPinned();return r?(t=(o=n.getState().columnPinning)==null||(o=o[r])==null?void 0:o.indexOf(e.id))!=null?t:-1:0}},createRow:(e,n)=>{e.pin=(t,o,r)=>{const i=o?e.getLeafRows().map(a=>{let{id:d}=a;return d}):[],l=r?e.getParentRows().map(a=>{let{id:d}=a;return d}):[],s=new Set([...l,e.id,...i]);n.setRowPinning(a=>{var d,g;if(t==="bottom"){var c,f;return{top:((c=a==null?void 0:a.top)!=null?c:[]).filter(h=>!(s!=null&&s.has(h))),bottom:[...((f=a==null?void 0:a.bottom)!=null?f:[]).filter(h=>!(s!=null&&s.has(h))),...Array.from(s)]}}if(t==="top"){var u,p;return{top:[...((u=a==null?void 0:a.top)!=null?u:[]).filter(h=>!(s!=null&&s.has(h))),...Array.from(s)],bottom:((p=a==null?void 0:a.bottom)!=null?p:[]).filter(h=>!(s!=null&&s.has(h)))}}return{top:((d=a==null?void 0:a.top)!=null?d:[]).filter(h=>!(s!=null&&s.has(h))),bottom:((g=a==null?void 0:a.bottom)!=null?g:[]).filter(h=>!(s!=null&&s.has(h)))}})},e.getCanPin=()=>{var t;const{enableRowPinning:o,enablePinning:r}=n.options;return typeof o=="function"?o(e):(t=o??r)!=null?t:!0},e.getIsPinned=()=>{const t=[e.id],{top:o,bottom:r}=n.getState().rowPinning,i=t.some(s=>o==null?void 0:o.includes(s)),l=t.some(s=>r==null?void 0:r.includes(s));return i?"top":l?"bottom":!1},e.getPinnedIndex=()=>{var t,o;const r=e.getIsPinned();if(!r)return-1;const i=(t=n._getPinnedRows(r))==null?void 0:t.map(l=>{let{id:s}=l;return s});return(o=i==null?void 0:i.indexOf(e.id))!=null?o:-1},e.getCenterVisibleCells=S(()=>[e._getAllVisibleCells(),n.getState().columnPinning.left,n.getState().columnPinning.right],(t,o,r)=>{const i=[...o??[],...r??[]];return t.filter(l=>!i.includes(l.column.id))},{key:!1,debug:()=>{var t;return(t=n.options.debugAll)!=null?t:n.options.debugRows}}),e.getLeftVisibleCells=S(()=>[e._getAllVisibleCells(),n.getState().columnPinning.left,,],(t,o)=>(o??[]).map(i=>t.find(l=>l.column.id===i)).filter(Boolean).map(i=>({...i,position:"left"})),{key:!1,debug:()=>{var t;return(t=n.options.debugAll)!=null?t:n.options.debugRows}}),e.getRightVisibleCells=S(()=>[e._getAllVisibleCells(),n.getState().columnPinning.right],(t,o)=>(o??[]).map(i=>t.find(l=>l.column.id===i)).filter(Boolean).map(i=>({...i,position:"right"})),{key:!1,debug:()=>{var t;return(t=n.options.debugAll)!=null?t:n.options.debugRows}})},createTable:e=>{e.setColumnPinning=n=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(n),e.resetColumnPinning=n=>{var t,o;return e.setColumnPinning(n?O():(t=(o=e.initialState)==null?void 0:o.columnPinning)!=null?t:O())},e.getIsSomeColumnsPinned=n=>{var t;const o=e.getState().columnPinning;if(!n){var r,i;return!!((r=o.left)!=null&&r.length||(i=o.right)!=null&&i.length)}return!!((t=o[n])!=null&&t.length)},e.getLeftLeafColumns=S(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(n,t)=>(t??[]).map(o=>n.find(r=>r.id===o)).filter(Boolean),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugColumns}}),e.getRightLeafColumns=S(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(n,t)=>(t??[]).map(o=>n.find(r=>r.id===o)).filter(Boolean),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugColumns}}),e.getCenterLeafColumns=S(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,t,o)=>{const r=[...t??[],...o??[]];return n.filter(i=>!r.includes(i.id))},{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugColumns}}),e.setRowPinning=n=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(n),e.resetRowPinning=n=>{var t,o;return e.setRowPinning(n?T():(t=(o=e.initialState)==null?void 0:o.rowPinning)!=null?t:T())},e.getIsSomeRowsPinned=n=>{var t;const o=e.getState().rowPinning;if(!n){var r,i;return!!((r=o.top)!=null&&r.length||(i=o.bottom)!=null&&i.length)}return!!((t=o[n])!=null&&t.length)},e._getPinnedRows=n=>S(()=>[e.getRowModel().rows,e.getState().rowPinning[n]],(t,o)=>{var r;return((r=e.options.keepPinnedRows)==null||r?(o??[]).map(l=>{const s=e.getRow(l,!0);return s.getIsAllParentsExpanded()?s:null}):(o??[]).map(l=>t.find(s=>s.id===l))).filter(Boolean).map(l=>({...l,position:n}))},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugRows}})(),e.getTopRows=()=>e._getPinnedRows("top"),e.getBottomRows=()=>e._getPinnedRows("bottom"),e.getCenterRows=S(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(n,t,o)=>{const r=new Set([...t??[],...o??[]]);return n.filter(i=>!r.has(i.id))},{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugRows}})}},ct={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:F("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=n=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(n),e.resetRowSelection=n=>{var t;return e.setRowSelection(n?{}:(t=e.initialState.rowSelection)!=null?t:{})},e.toggleAllRowsSelected=n=>{e.setRowSelection(t=>{n=typeof n<"u"?n:!e.getIsAllRowsSelected();const o={...t},r=e.getPreGroupedRowModel().flatRows;return n?r.forEach(i=>{i.getCanSelect()&&(o[i.id]=!0)}):r.forEach(i=>{delete o[i.id]}),o})},e.toggleAllPageRowsSelected=n=>e.setRowSelection(t=>{const o=typeof n<"u"?n:!e.getIsAllPageRowsSelected(),r={...t};return e.getRowModel().rows.forEach(i=>{K(r,i.id,o,!0,e)}),r}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=S(()=>[e.getState().rowSelection,e.getCoreRowModel()],(n,t)=>Object.keys(n).length?B(e,t):{rows:[],flatRows:[],rowsById:{}},{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugTable}}),e.getFilteredSelectedRowModel=S(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(n,t)=>Object.keys(n).length?B(e,t):{rows:[],flatRows:[],rowsById:{}},{key:"getFilteredSelectedRowModel",debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugTable}}),e.getGroupedSelectedRowModel=S(()=>[e.getState().rowSelection,e.getSortedRowModel()],(n,t)=>Object.keys(n).length?B(e,t):{rows:[],flatRows:[],rowsById:{}},{key:"getGroupedSelectedRowModel",debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugTable}}),e.getIsAllRowsSelected=()=>{const n=e.getFilteredRowModel().flatRows,{rowSelection:t}=e.getState();let o=!!(n.length&&Object.keys(t).length);return o&&n.some(r=>r.getCanSelect()&&!t[r.id])&&(o=!1),o},e.getIsAllPageRowsSelected=()=>{const n=e.getPaginationRowModel().flatRows.filter(r=>r.getCanSelect()),{rowSelection:t}=e.getState();let o=!!n.length;return o&&n.some(r=>!t[r.id])&&(o=!1),o},e.getIsSomeRowsSelected=()=>{var n;const t=Object.keys((n=e.getState().rowSelection)!=null?n:{}).length;return t>0&&t<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{const n=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:n.filter(t=>t.getCanSelect()).some(t=>t.getIsSelected()||t.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>n=>{e.toggleAllRowsSelected(n.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>n=>{e.toggleAllPageRowsSelected(n.target.checked)}},createRow:(e,n)=>{e.toggleSelected=(t,o)=>{const r=e.getIsSelected();n.setRowSelection(i=>{var l;if(t=typeof t<"u"?t:!r,e.getCanSelect()&&r===t)return i;const s={...i};return K(s,e.id,t,(l=o==null?void 0:o.selectChildren)!=null?l:!0,n),s})},e.getIsSelected=()=>{const{rowSelection:t}=n.getState();return Y(e,t)},e.getIsSomeSelected=()=>{const{rowSelection:t}=n.getState();return U(e,t)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:t}=n.getState();return U(e,t)==="all"},e.getCanSelect=()=>{var t;return typeof n.options.enableRowSelection=="function"?n.options.enableRowSelection(e):(t=n.options.enableRowSelection)!=null?t:!0},e.getCanSelectSubRows=()=>{var t;return typeof n.options.enableSubRowSelection=="function"?n.options.enableSubRowSelection(e):(t=n.options.enableSubRowSelection)!=null?t:!0},e.getCanMultiSelect=()=>{var t;return typeof n.options.enableMultiRowSelection=="function"?n.options.enableMultiRowSelection(e):(t=n.options.enableMultiRowSelection)!=null?t:!0},e.getToggleSelectedHandler=()=>{const t=e.getCanSelect();return o=>{var r;t&&e.toggleSelected((r=o.target)==null?void 0:r.checked)}}}},K=(e,n,t,o,r)=>{var i;const l=r.getRow(n,!0);t?(l.getCanMultiSelect()||Object.keys(e).forEach(s=>delete e[s]),l.getCanSelect()&&(e[n]=!0)):delete e[n],o&&(i=l.subRows)!=null&&i.length&&l.getCanSelectSubRows()&&l.subRows.forEach(s=>K(e,s.id,t,o,r))};function B(e,n){const t=e.getState().rowSelection,o=[],r={},i=function(l,s){return l.map(a=>{var d;const g=Y(a,t);if(g&&(o.push(a),r[a.id]=a),(d=a.subRows)!=null&&d.length&&(a={...a,subRows:i(a.subRows)}),g)return a}).filter(Boolean)};return{rows:i(n.rows),flatRows:o,rowsById:r}}function Y(e,n){var t;return(t=n[e.id])!=null?t:!1}function U(e,n,t){var o;if(!((o=e.subRows)!=null&&o.length))return!1;let r=!0,i=!1;return e.subRows.forEach(l=>{if(!(i&&!r)&&(l.getCanSelect()&&(Y(l,n)?i=!0:r=!1),l.subRows&&l.subRows.length)){const s=U(l,n);s==="all"?i=!0:(s==="some"&&(i=!0),r=!1)}}),r?"all":i?"some":!1}const W=/([0-9]+)/gm,ft=(e,n,t)=>$e(A(e.getValue(t)).toLowerCase(),A(n.getValue(t)).toLowerCase()),pt=(e,n,t)=>$e(A(e.getValue(t)),A(n.getValue(t))),mt=(e,n,t)=>Z(A(e.getValue(t)).toLowerCase(),A(n.getValue(t)).toLowerCase()),ht=(e,n,t)=>Z(A(e.getValue(t)),A(n.getValue(t))),vt=(e,n,t)=>{const o=e.getValue(t),r=n.getValue(t);return o>r?1:o<r?-1:0},St=(e,n,t)=>Z(e.getValue(t),n.getValue(t));function Z(e,n){return e===n?0:e>n?1:-1}function A(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function $e(e,n){const t=e.split(W).filter(Boolean),o=n.split(W).filter(Boolean);for(;t.length&&o.length;){const r=t.shift(),i=o.shift(),l=parseInt(r,10),s=parseInt(i,10),a=[l,s].sort();if(isNaN(a[0])){if(r>i)return 1;if(i>r)return-1;continue}if(isNaN(a[1]))return isNaN(l)?-1:1;if(l>s)return 1;if(s>l)return-1}return t.length-o.length}const I={alphanumeric:ft,alphanumericCaseSensitive:pt,text:mt,textCaseSensitive:ht,datetime:vt,basic:St},Ct={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:F("sorting",e),isMultiSortEvent:n=>n.shiftKey}),createColumn:(e,n)=>{e.getAutoSortingFn=()=>{const t=n.getFilteredRowModel().flatRows.slice(10);let o=!1;for(const r of t){const i=r==null?void 0:r.getValue(e.id);if(Object.prototype.toString.call(i)==="[object Date]")return I.datetime;if(typeof i=="string"&&(o=!0,i.split(W).length>1))return I.alphanumeric}return o?I.text:I.basic},e.getAutoSortDir=()=>{const t=n.getFilteredRowModel().flatRows[0];return typeof(t==null?void 0:t.getValue(e.id))=="string"?"asc":"desc"},e.getSortingFn=()=>{var t,o;if(!e)throw new Error;return k(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:I[e.columnDef.sortingFn]},e.toggleSorting=(t,o)=>{const r=e.getNextSortingOrder(),i=typeof t<"u"&&t!==null;n.setSorting(l=>{const s=l==null?void 0:l.find(u=>u.id===e.id),a=l==null?void 0:l.findIndex(u=>u.id===e.id);let d=[],g,c=i?t:r==="desc";if(l!=null&&l.length&&e.getCanMultiSort()&&o?s?g="toggle":g="add":l!=null&&l.length&&a!==l.length-1?g="replace":s?g="toggle":g="replace",g==="toggle"&&(i||r||(g="remove")),g==="add"){var f;d=[...l,{id:e.id,desc:c}],d.splice(0,d.length-((f=n.options.maxMultiSortColCount)!=null?f:Number.MAX_SAFE_INTEGER))}else g==="toggle"?d=l.map(u=>u.id===e.id?{...u,desc:c}:u):g==="remove"?d=l.filter(u=>u.id!==e.id):d=[{id:e.id,desc:c}];return d})},e.getFirstSortDir=()=>{var t,o;return((t=(o=e.columnDef.sortDescFirst)!=null?o:n.options.sortDescFirst)!=null?t:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=t=>{var o,r;const i=e.getFirstSortDir(),l=e.getIsSorted();return l?l!==i&&((o=n.options.enableSortingRemoval)==null||o)&&(!(t&&(r=n.options.enableMultiRemove)!=null)||r)?!1:l==="desc"?"asc":"desc":i},e.getCanSort=()=>{var t,o;return((t=e.columnDef.enableSorting)!=null?t:!0)&&((o=n.options.enableSorting)!=null?o:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var t,o;return(t=(o=e.columnDef.enableMultiSort)!=null?o:n.options.enableMultiSort)!=null?t:!!e.accessorFn},e.getIsSorted=()=>{var t;const o=(t=n.getState().sorting)==null?void 0:t.find(r=>r.id===e.id);return o?o.desc?"desc":"asc":!1},e.getSortIndex=()=>{var t,o;return(t=(o=n.getState().sorting)==null?void 0:o.findIndex(r=>r.id===e.id))!=null?t:-1},e.clearSorting=()=>{n.setSorting(t=>t!=null&&t.length?t.filter(o=>o.id!==e.id):[])},e.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=>{e.setSorting=n=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(n),e.resetSorting=n=>{var t,o;e.setSorting(n?[]:(t=(o=e.initialState)==null?void 0:o.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())}},wt={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:F("columnVisibility",e)}),createColumn:(e,n)=>{e.toggleVisibility=t=>{e.getCanHide()&&n.setColumnVisibility(o=>({...o,[e.id]:t??!e.getIsVisible()}))},e.getIsVisible=()=>{var t,o;return(t=(o=n.getState().columnVisibility)==null?void 0:o[e.id])!=null?t:!0},e.getCanHide=()=>{var t,o;return((t=e.columnDef.enableHiding)!=null?t:!0)&&((o=n.options.enableHiding)!=null?o:!0)},e.getToggleVisibilityHandler=()=>t=>{e.toggleVisibility==null||e.toggleVisibility(t.target.checked)}},createRow:(e,n)=>{e._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}}),e.getVisibleCells=S(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(t,o,r)=>[...t,...o,...r],{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(r=>r.getIsVisible()).map(r=>r.id).join("_")],r=>r.filter(i=>i.getIsVisible==null?void 0:i.getIsVisible()),{key:t,debug:()=>{var r;return(r=e.options.debugAll)!=null?r:e.options.debugColumns}});e.getVisibleFlatColumns=n("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=n("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=n("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=n("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=n("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=t=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{var o;e.setColumnVisibility(t?{}:(o=e.initialState.columnVisibility)!=null?o:{})},e.toggleAllColumnsVisible=t=>{var o;t=(o=t)!=null?o:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((r,i)=>({...r,[i.id]:t||!(i.getCanHide!=null&&i.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 o;e.toggleAllColumnsVisible((o=t.target)==null?void 0:o.checked)}}},ue=[Ke,wt,at,dt,Qe,Ct,st,Je,gt,ct,Ue];function Rt(e){var n;(e.debugAll||e.debugTable)&&console.info("Creating Table Instance...");let t={_features:ue};const o=t._features.reduce((g,c)=>Object.assign(g,c.getDefaultOptions==null?void 0:c.getDefaultOptions(t)),{}),r=g=>t.options.mergeOptions?t.options.mergeOptions(o,g):{...o,...g};let l={...{},...(n=e.initialState)!=null?n:{}};t._features.forEach(g=>{var c;l=(c=g.getInitialState==null?void 0:g.getInitialState(l))!=null?c:l});const s=[];let a=!1;const d={_features:ue,options:{...o,...e},initialState:l,_queue:g=>{s.push(g),a||(a=!0,Promise.resolve().then(()=>{for(;s.length;)s.shift()();a=!1}).catch(c=>setTimeout(()=>{throw c})))},reset:()=>{t.setState(t.initialState)},setOptions:g=>{const c=M(g,t.options);t.options=r(c)},getState:()=>t.options.state,setState:g=>{t.options.onStateChange==null||t.options.onStateChange(g)},_getRowId:(g,c,f)=>{var u;return(u=t.options.getRowId==null?void 0:t.options.getRowId(g,c,f))!=null?u:`${f?[f.id,c].join("."):c}`},getCoreRowModel:()=>(t._getCoreRowModel||(t._getCoreRowModel=t.options.getCoreRowModel(t)),t._getCoreRowModel()),getRowModel:()=>t.getPaginationRowModel(),getRow:(g,c)=>{let f=(c?t.getPrePaginationRowModel():t.getRowModel()).rowsById[g];if(!f&&(f=t.getCoreRowModel().rowsById[g],!f))throw new Error;return f},_getDefaultColumnDef:S(()=>[t.options.defaultColumn],g=>{var c;return g=(c=g)!=null?c:{},{header:f=>{const u=f.header.column.columnDef;return u.accessorKey?u.accessorKey:u.accessorFn?u.id:null},cell:f=>{var u,p;return(u=(p=f.renderValue())==null||p.toString==null?void 0:p.toString())!=null?u:null},...t._features.reduce((f,u)=>Object.assign(f,u.getDefaultColumnDef==null?void 0:u.getDefaultColumnDef()),{}),...g}},{debug:()=>{var g;return(g=t.options.debugAll)!=null?g:t.options.debugColumns},key:!1}),_getColumnDefs:()=>t.options.columns,getAllColumns:S(()=>[t._getColumnDefs()],g=>{const c=function(f,u,p){return p===void 0&&(p=0),f.map(h=>{const C=Xe(t,h,p,u),m=h;return C.columns=m.columns?c(m.columns,C,p+1):[],C})};return c(g)},{key:!1,debug:()=>{var g;return(g=t.options.debugAll)!=null?g:t.options.debugColumns}}),getAllFlatColumns:S(()=>[t.getAllColumns()],g=>g.flatMap(c=>c.getFlatColumns()),{key:!1,debug:()=>{var g;return(g=t.options.debugAll)!=null?g:t.options.debugColumns}}),_getAllFlatColumnsById:S(()=>[t.getAllFlatColumns()],g=>g.reduce((c,f)=>(c[f.id]=f,c),{}),{key:!1,debug:()=>{var g;return(g=t.options.debugAll)!=null?g:t.options.debugColumns}}),getAllLeafColumns:S(()=>[t.getAllColumns(),t._getOrderColumnsFn()],(g,c)=>{let f=g.flatMap(u=>u.getLeafColumns());return c(f)},{key:!1,debug:()=>{var g;return(g=t.options.debugAll)!=null?g:t.options.debugColumns}}),getColumn:g=>t._getAllFlatColumnsById()[g]};Object.assign(t,d);for(let g=0;g<t._features.length;g++){const c=t._features[g];c==null||c.createTable==null||c.createTable(t)}return t}function $t(e,n,t,o){const r=()=>{var l;return(l=i.getValue())!=null?l:e.options.renderFallbackValue},i={id:`${n.id}_${t.id}`,row:n,column:t,getValue:()=>n.getValue(o),renderValue:r,getContext:S(()=>[e,t,n,i],(l,s,a,d)=>({table:l,column:s,row:a,cell:d,getValue:d.getValue,renderValue:d.renderValue}),{key:!1,debug:()=>e.options.debugAll})};return e._features.forEach(l=>{l.createCell==null||l.createCell(i,t,n,e)},{}),i}const ee=(e,n,t,o,r,i,l)=>{let s={id:n,index:o,original:t,depth:r,parentId:l,_valuesCache:{},_uniqueValuesCache:{},getValue:a=>{if(s._valuesCache.hasOwnProperty(a))return s._valuesCache[a];const d=e.getColumn(a);if(d!=null&&d.accessorFn)return s._valuesCache[a]=d.accessorFn(s.original,o),s._valuesCache[a]},getUniqueValues:a=>{if(s._uniqueValuesCache.hasOwnProperty(a))return s._uniqueValuesCache[a];const d=e.getColumn(a);if(d!=null&&d.accessorFn)return d.columnDef.getUniqueValues?(s._uniqueValuesCache[a]=d.columnDef.getUniqueValues(s.original,o),s._uniqueValuesCache[a]):(s._uniqueValuesCache[a]=[s.getValue(a)],s._uniqueValuesCache[a])},renderValue:a=>{var d;return(d=s.getValue(a))!=null?d:e.options.renderFallbackValue},subRows:i??[],getLeafRows:()=>qe(s.subRows,a=>a.subRows),getParentRow:()=>s.parentId?e.getRow(s.parentId,!0):void 0,getParentRows:()=>{let a=[],d=s;for(;;){const g=d.getParentRow();if(!g)break;a.push(g),d=g}return a.reverse()},getAllCells:S(()=>[e.getAllLeafColumns()],a=>a.map(d=>$t(e,s,d,d.id)),{key:!1,debug:()=>{var a;return(a=e.options.debugAll)!=null?a:e.options.debugRows}}),_getAllCellsByColumnId:S(()=>[s.getAllCells()],a=>a.reduce((d,g)=>(d[g.column.id]=g,d),{}),{key:"row.getAllCellsByColumnId",debug:()=>{var a;return(a=e.options.debugAll)!=null?a:e.options.debugRows}})};for(let a=0;a<e._features.length;a++){const d=e._features[a];d==null||d.createRow==null||d.createRow(s,e)}return s};function an(){return e=>S(()=>[e.options.data],n=>{const t={rows:[],flatRows:[],rowsById:{}},o=function(r,i,l){i===void 0&&(i=0);const s=[];for(let d=0;d<r.length;d++){const g=ee(e,e._getRowId(r[d],d,l),r[d],d,i,void 0,l==null?void 0:l.id);if(t.flatRows.push(g),t.rowsById[g.id]=g,s.push(g),e.options.getSubRows){var a;g.originalSubRows=e.options.getSubRows(r[d],d),(a=g.originalSubRows)!=null&&a.length&&(g.subRows=o(g.originalSubRows,i+1,g))}}return s};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 _t(e,n,t){return t.options.filterFromLeafRows?xt(e,n,t):Ft(e,n,t)}function xt(e,n,t){var o;const r=[],i={},l=(o=t.options.maxLeafRowFilterDepth)!=null?o:100,s=function(a,d){d===void 0&&(d=0);const g=[];for(let f=0;f<a.length;f++){var c;let u=a[f];const p=ee(t,u.id,u.original,u.index,u.depth,void 0,u.parentId);if(p.columnFilters=u.columnFilters,(c=u.subRows)!=null&&c.length&&d<l){if(p.subRows=s(u.subRows,d+1),u=p,n(u)&&!p.subRows.length){g.push(u),i[u.id]=u,r.push(u);continue}if(n(u)||p.subRows.length){g.push(u),i[u.id]=u,r.push(u);continue}}else u=p,n(u)&&(g.push(u),i[u.id]=u,r.push(u))}return g};return{rows:s(e),flatRows:r,rowsById:i}}function Ft(e,n,t){var o;const r=[],i={},l=(o=t.options.maxLeafRowFilterDepth)!=null?o:100,s=function(a,d){d===void 0&&(d=0);const g=[];for(let f=0;f<a.length;f++){let u=a[f];if(n(u)){var c;if((c=u.subRows)!=null&&c.length&&d<l){const h=ee(t,u.id,u.original,u.index,u.depth,void 0,u.parentId);h.subRows=s(u.subRows,d+1),u=h}g.push(u),r.push(u),i[u.id]=u}}return g};return{rows:s(e),flatRows:r,rowsById:i}}function gn(){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 f=0;f<n.flatRows.length;f++)n.flatRows[f].columnFilters={},n.flatRows[f].columnFiltersMeta={};return n}const r=[],i=[];(t??[]).forEach(f=>{var u;const p=e.getColumn(f.id);if(!p)return;const h=p.getFilterFn();h&&r.push({id:f.id,filterFn:h,resolvedValue:(u=h.resolveFilterValue==null?void 0:h.resolveFilterValue(f.value))!=null?u:f.value})});const l=t.map(f=>f.id),s=e.getGlobalFilterFn(),a=e.getAllLeafColumns().filter(f=>f.getCanGlobalFilter());o&&s&&a.length&&(l.push("__global__"),a.forEach(f=>{var u;i.push({id:f.id,filterFn:s,resolvedValue:(u=s.resolveFilterValue==null?void 0:s.resolveFilterValue(o))!=null?u:o})}));let d,g;for(let f=0;f<n.flatRows.length;f++){const u=n.flatRows[f];if(u.columnFilters={},r.length)for(let p=0;p<r.length;p++){d=r[p];const h=d.id;u.columnFilters[h]=d.filterFn(u,h,d.resolvedValue,C=>{u.columnFiltersMeta[h]=C})}if(i.length){for(let p=0;p<i.length;p++){g=i[p];const h=g.id;if(g.filterFn(u,h,g.resolvedValue,C=>{u.columnFiltersMeta[h]=C})){u.columnFilters.__global__=!0;break}}u.columnFilters.__global__!==!0&&(u.columnFilters.__global__=!1)}}const c=f=>{for(let u=0;u<l.length;u++)if(f.columnFilters[l[u]]===!1)return!1;return!0};return _t(n.rows,c,e)},{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugTable},onChange:()=>{e._autoResetPageIndex()}})}function yt(e){const n=[],t=o=>{var r;n.push(o),(r=o.subRows)!=null&&r.length&&o.getIsExpanded()&&o.subRows.forEach(t)};return e.rows.forEach(t),{rows:n,flatRows:e.flatRows,rowsById:e.rowsById}}function dn(e){return n=>S(()=>[n.getState().pagination,n.getPrePaginationRowModel(),n.options.paginateExpandedRows?void 0:n.getState().expanded],(t,o)=>{if(!o.rows.length)return o;const{pageSize:r,pageIndex:i}=t;let{rows:l,flatRows:s,rowsById:a}=o;const d=r*i,g=d+r;l=l.slice(d,g);let c;n.options.paginateExpandedRows?c={rows:l,flatRows:s,rowsById:a}:c=yt({rows:l,flatRows:s,rowsById:a}),c.flatRows=[];const f=u=>{c.flatRows.push(u),u.subRows.length&&u.subRows.forEach(f)};return c.rows.forEach(f),c},{key:!1,debug:()=>{var t;return(t=n.options.debugAll)!=null?t:n.options.debugTable}})}/**
   * react-table
   *
   * Copyright (c) TanStack
   *
   * This source code is licensed under the MIT license found in the
   * LICENSE.md file in the root directory of this source tree.
   *
   * @license MIT
   */function cn(e,n){return e?Pt(e)?w.createElement(e,n):e:null}function Pt(e){return Mt(e)||typeof e=="function"||At(e)}function Mt(e){return typeof e=="function"&&(()=>{const n=Object.getPrototypeOf(e);return n.prototype&&n.prototype.isReactComponent})()}function At(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function fn(e){const n={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[t]=w.useState(()=>({current:Rt(n)})),[o,r]=w.useState(()=>t.current.initialState);return t.current.setOptions(i=>({...i,...e,state:{...o,...e.state},onStateChange:l=>{r(l),e.onStateChange==null||e.onStateChange(l)}})),t.current}function Vt(e){const n=w.useRef({value:e,previous:e});return w.useMemo(()=>(n.current.value!==e&&(n.current.previous=n.current.value,n.current.value=e),n.current.previous),[e])}const _e="Checkbox",[bt,pn]=Ae(_e),[It,Et]=bt(_e),Ht=w.forwardRef((e,n)=>{const{__scopeCheckbox:t,name:o,checked:r,defaultChecked:i,required:l,disabled:s,value:a="on",onCheckedChange:d,...g}=e,[c,f]=w.useState(null),u=Ve(n,R=>f(R)),p=w.useRef(!1),h=c?!!c.closest("form"):!0,[C=!1,m]=be({prop:r,defaultProp:i,onChange:d}),$=w.useRef(C);return w.useEffect(()=>{const R=c==null?void 0:c.form;if(R){const x=()=>m($.current);return R.addEventListener("reset",x),()=>R.removeEventListener("reset",x)}},[c,m]),w.createElement(It,{scope:t,state:C,disabled:s},w.createElement(ae.button,J({type:"button",role:"checkbox","aria-checked":b(C)?"mixed":C,"aria-required":l,"data-state":xe(C),"data-disabled":s?"":void 0,disabled:s,value:a},g,{ref:u,onKeyDown:ie(e.onKeyDown,R=>{R.key==="Enter"&&R.preventDefault()}),onClick:ie(e.onClick,R=>{m(x=>b(x)?!0:!x),h&&(p.current=R.isPropagationStopped(),p.current||R.stopPropagation())})})),h&&w.createElement(Lt,{control:c,bubbles:!p.current,name:o,value:a,checked:C,required:l,disabled:s,style:{transform:"translateX(-100%)"}}))}),Dt="CheckboxIndicator",kt=w.forwardRef((e,n)=>{const{__scopeCheckbox:t,forceMount:o,...r}=e,i=Et(Dt,t);return w.createElement(Ie,{present:o||b(i.state)||i.state===!0},w.createElement(ae.span,J({"data-state":xe(i.state),"data-disabled":i.disabled?"":void 0},r,{ref:n,style:{pointerEvents:"none",...e.style}})))}),Lt=e=>{const{control:n,checked:t,bubbles:o=!0,...r}=e,i=w.useRef(null),l=Vt(t),s=Ee(n);return w.useEffect(()=>{const a=i.current,d=window.HTMLInputElement.prototype,c=Object.getOwnPropertyDescriptor(d,"checked").set;if(l!==t&&c){const f=new Event("click",{bubbles:o});a.indeterminate=b(t),c.call(a,b(t)?!1:t),a.dispatchEvent(f)}},[l,t,o]),w.createElement("input",J({type:"checkbox","aria-hidden":!0,defaultChecked:b(t)?!1:t},r,{tabIndex:-1,ref:i,style:{...e.style,...s,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function b(e){return e==="indeterminate"}function xe(e){return b(e)?"indeterminate":e?"checked":"unchecked"}const Fe=Ht,Gt=kt,zt=w.forwardRef(({className:e,...n},t)=>v.jsx(Fe,{ref:t,className:_("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",e),...n,children:v.jsx(Gt,{className:_("flex items-center justify-center text-current"),children:v.jsx(He,{className:"h-4 w-4"})})}));zt.displayName=Fe.displayName;const Nt=w.forwardRef(({className:e,...n},t)=>v.jsx("div",{className:"relative w-full overflow-auto",children:v.jsx("table",{ref:t,className:_("w-full caption-bottom text-sm",e),...n})}));Nt.displayName="Table";const jt=w.forwardRef(({className:e,...n},t)=>v.jsx("thead",{ref:t,className:_("[&_tr]:border-b",e),...n}));jt.displayName="TableHeader";const Ot=w.forwardRef(({className:e,...n},t)=>v.jsx("tbody",{ref:t,className:_("[&_tr:last-child]:border-0",e),...n}));Ot.displayName="TableBody";const Tt=w.forwardRef(({className:e,...n},t)=>v.jsx("tfoot",{ref:t,className:_("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...n}));Tt.displayName="TableFooter";const Bt=w.forwardRef(({className:e,...n},t)=>v.jsx("tr",{ref:t,className:_("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...n}));Bt.displayName="TableRow";const qt=w.forwardRef(({className:e,...n},t)=>v.jsx("th",{ref:t,className:_("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...n}));qt.displayName="TableHead";const Xt=w.forwardRef(({className:e,...n},t)=>v.jsx("td",{ref:t,className:_("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...n}));Xt.displayName="TableCell";const Kt=w.forwardRef(({className:e,...n},t)=>v.jsx("caption",{ref:t,className:_("mt-4 text-sm text-muted-foreground",e),...n}));Kt.displayName="TableCaption";const Ut=De("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function mn({className:e,variant:n,...t}){return v.jsx("div",{className:_(Ut({variant:n}),e),...t})}var Wt=(e=>(e[e.Failed=0]="Failed",e[e.Recorded=1]="Recorded",e[e.Crawling=2]="Crawling",e[e.Crawled=3]="Crawled",e[e.Trained=4]="Trained",e[e.Expired=5]="Expired",e))(Wt||{}),Jt=(e=>(e[e.Recorded=1]="Recorded",e[e.Parsing=2]="Parsing",e[e.Parsed=3]="Parsed",e[e.Trained=4]="Trained",e))(Jt||{});const Qt=({className:e,...n})=>v.jsx("nav",{role:"navigation","aria-label":"pagination",className:_("mx-auto flex w-full justify-center",e),...n});Qt.displayName="Pagination";const Yt=w.forwardRef(({className:e,...n},t)=>v.jsx("ul",{ref:t,className:_("flex flex-row items-center gap-1",e),...n}));Yt.displayName="PaginationContent";const Zt=w.forwardRef(({className:e,...n},t)=>v.jsx("li",{ref:t,className:_("",e),...n}));Zt.displayName="PaginationItem";const te=({className:e,isActive:n,isDisabled:t,size:o="icon",...r})=>v.jsx("a",{"aria-current":n?"page":void 0,className:_(ke({variant:n?"outline":"ghost",size:o}),e,{"cursor-pointer":!t,"pointer-events-none hover:bg-transparent hover:text-gray-500 text-gray-500":t}),...r});te.displayName="PaginationLink";const en=({className:e,...n})=>v.jsxs(te,{"aria-label":"Go to previous page",size:"default",className:_("gap-1 pl-2.5",e),...n,children:[v.jsx(je,{className:"h-4 w-4"}),v.jsx("span",{children:"Previous"})]});en.displayName="PaginationPrevious";const tn=({className:e,...n})=>v.jsxs(te,{"aria-label":"Go to next page",size:"default",className:_("gap-1 pr-2.5",e),...n,children:[v.jsx("span",{children:"Next"}),v.jsx(Le,{className:"h-4 w-4"})]});tn.displayName="PaginationNext";const nn=({className:e,...n})=>v.jsxs("span",{"aria-hidden":!0,className:_("flex h-9 w-9 items-center justify-center",e),...n,children:[v.jsx(Te,{className:"h-4 w-4"}),v.jsx("span",{className:"sr-only",children:"More pages"})]});nn.displayName="PaginationEllipsis";function on({open:e,title:n,selectedSplit:t,onOpenChange:o}){return v.jsx(ge,{open:e,onOpenChange:o,children:v.jsxs(de,{className:"sm:max-w-[800px]",onPointerDownOutside:r=>r.preventDefault(),children:[v.jsx(ce,{children:v.jsx(fe,{children:`${n}---Page No.${t==null?void 0:t.index}`})}),v.jsx("pre",{className:"max-h-[60vh] overflow-auto text-sm",children:t==null?void 0:t.content})]})})}const rn=(e,n)=>{let t=0;return function(...o){const r=Date.now();r-t>n&&(t=r,e(...o))}};function hn({open:e,selectFile:n,selectedUrl:t,selectedIsolatedUrl:o,onOpenChange:r}){const[i,l]=w.useState(),[s,a]=w.useState({loading:!0,hasMore:!0,page:1,data:[]}),d=w.useRef(s),[g,c]=w.useState(!1);d.current=s,w.useEffect(()=>{e&&f()},[e]);const f=()=>{let m;t?m=Ge:n?m=ze:o&&(m=Ne),m&&(a($=>({...$,loading:!0})),m({id:(t==null?void 0:t.id)??(n==null?void 0:n.id)??(o==null?void 0:o.id)??0,page:d.current.page,page_size:20}).then(({data:{sub_content_list:$}})=>a(R=>({data:[...R.data,...$],loading:!1,hasMore:$.length===20,page:R.page+1}))).catch(()=>a($=>({...$,loading:!1}))))},u=m=>{m||a({loading:!1,hasMore:!0,page:1,data:[]}),r(m)},p=m=>{l(m),c(!0)},h=(t==null?void 0:t.url)||(o==null?void 0:o.url)||(n==null?void 0:n.origin_file_name),C=rn(m=>{const $=m.target;$.scrollHeight-($.scrollTop+$.clientHeight)<100&&d.current.hasMore&&!d.current.loading&&f()},50);return v.jsxs(ge,{open:e,onOpenChange:u,children:[v.jsxs(de,{className:"sm:max-w-[800px]",children:[v.jsx(ce,{children:v.jsx(fe,{children:h})}),v.jsx("div",{className:"my-2 mb-4 flex flex-wrap gap-3 max-h-[60vh] overflow-auto",onScroll:C,children:s.data.length?s.data.map(m=>v.jsxs("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm w-[240px] p-2 text-sm hover:bg-slate-100",onClick:()=>p(m),children:[v.jsxs("div",{className:"flex justify-between items-center",children:[v.jsx("div",{children:`#${m.index}`}),v.jsx("div",{children:`${m.content_length} character`})]}),v.jsx("div",{className:"line-clamp-3",children:m.content})]},m.index)):v.jsx(Oe,{})})]}),v.jsx(on,{title:h,selectedSplit:i,open:g,onOpenChange:m=>c(m)})]})}const vn=(e,n)=>{if(e.some(o=>o.doc_status>0&&o.doc_status<4))return setTimeout(()=>n(),5e3)};export{mn as B,zt as C,Wt as D,Jt as F,Qt as P,un as S,Nt as T,hn as a,jt as b,vn as c,Bt as d,qt as e,cn as f,Ot as g,Xt as h,Yt as i,Zt as j,en as k,tn as l,nn as m,te as n,an as o,dn as p,gn as q,fn as u};
