import './async-D55cHugf.js';
import { d as bind_props, f as attr_class, a as attr, g as attr_style, i as stringify, e as ensure_array_like, c as spread_props, j as clsx } from './index-u8mz_F03.js';
import { t as tick } from './index-server-CQz6EZl_.js';
import { e as ee$1 } from './Upload2-CnUKERBu.js';
import './2-EyCg4N-O.js';
import { Q as Qt } from './MarkdownCode-DDNyIZgr.js';
import { x } from './Checkbox-9CgT1BqO.js';
import { e } from './Check-C7_ZsXgh.js';
import { h } from './Copy-B8YOhH7c.js';
import { w } from './IconButton-BRnu7KaR.js';
import { k } from './FullscreenButton-CLmU9xmD.js';
import { W } from './index3-Rp9AmCmX.js';
import { G } from './Block-DZmzQwnI.js';
import { $ as $$1 } from './utils.svelte-C798QV9b.js';
export { default as BaseExample } from './Example14-s-dCDI60.js';
import { e as escape_html } from './escaping-CBnpiEl5.js';
import { h as html } from './html-CfyvkLET.js';
import './context-CBkBucIx.js';
import './index5-BoOEKc6P.js';
import './dev-fallback-Bc5Ork7Y.js';
import './index-Cg-Pg6j3.js';
import './prism-python-B3bOO0dC.js';
import './index50-C1YEYclw.js';
import 'path';
import 'url';
import 'fs';
import './Maximize-CuHbK64j.js';
import './Clear-D7Yjckqz.js';
import './clone-Yk88IHKV.js';

function le(e,o){return typeof e=="function"?e(o):e}function X(e,o){return t=>{o.setState(n=>({...n,[e]:le(t,n[e])}));}}function be(e){return e instanceof Function}function yn(e){return Array.isArray(e)&&e.every(o=>typeof o=="number")}function Fn(e,o){const t=[],n=s=>{s.forEach(i=>{t.push(i);const l=o(i);l!=null&&l.length&&n(l);});};return n(e),t}function y(e,o,t){let n=[],s;return i=>{let l;t.key&&t.debug&&(l=Date.now());const r=e(i);if(!(r.length!==n.length||r.some((g,h)=>n[h]!==g)))return s;n=r;let c;if(t.key&&t.debug&&(c=Date.now()),s=o(...r),t==null||t.onChange==null||t.onChange(s),t.key&&t.debug&&t!=null&&t.debug()){const g=Math.round((Date.now()-l)*100)/100,h=Math.round((Date.now()-c)*100)/100,d=h/16,a=(f,m)=>{for(f=String(f);f.length<m;)f=" "+f;return f};console.info(`%c⏱ ${a(h,5)} /${a(g,5)} ms`,`
            font-size: .6rem;
            font-weight: bold;
            color: hsl(${Math.max(0,Math.min(120-120*d,120))}deg 100% 31%);`,t?.key);}return s}}function F(e,o,t,n){return {debug:()=>{var s;return (s=e?.debugAll)!=null?s:e[o]},key:process.env.NODE_ENV==="development"&&t,onChange:n}}function Mn(e,o,t,n){const s=()=>{var l;return (l=i.getValue())!=null?l:e.options.renderFallbackValue},i={id:`${o.id}_${t.id}`,row:o,column:t,getValue:()=>o.getValue(n),renderValue:s,getContext:y(()=>[e,t,o,i],(l,r,u,c)=>({table:l,column:r,row:u,cell:c,getValue:c.getValue,renderValue:c.renderValue}),F(e.options,"debugCells","cell.getContext"))};return e._features.forEach(l=>{l.createCell==null||l.createCell(i,t,o,e);},{}),i}function In(e,o,t,n){var s,i;const r={...e._getDefaultColumnDef(),...o},u=r.accessorKey;let c=(s=(i=r.id)!=null?i:u?typeof String.prototype.replaceAll=="function"?u.replaceAll(".","_"):u.replace(/\./g,"_"):void 0)!=null?s:typeof r.header=="string"?r.header:void 0,g;if(r.accessorFn?g=r.accessorFn:u&&(u.includes(".")?g=d=>{let a=d;for(const m of u.split(".")){var f;a=(f=a)==null?void 0:f[m],process.env.NODE_ENV!=="production"&&a===void 0&&console.warn(`"${m}" in deeply nested key "${u}" returned undefined.`);}return a}:g=d=>d[r.accessorKey]),!c)throw process.env.NODE_ENV!=="production"?new Error(r.accessorFn?"Columns require an id when using an accessorFn":"Columns require an id when using a non-string header"):new Error;let h={id:`${String(c)}`,accessorFn:g,parent:n,depth:t,columnDef:r,columns:[],getFlatColumns:y(()=>[true],()=>{var d;return [h,...(d=h.columns)==null?void 0:d.flatMap(a=>a.getFlatColumns())]},F(e.options,"debugColumns","column.getFlatColumns")),getLeafColumns:y(()=>[e._getOrderColumnsFn()],d=>{var a;if((a=h.columns)!=null&&a.length){let f=h.columns.flatMap(m=>m.getLeafColumns());return d(f)}return [h]},F(e.options,"debugColumns","column.getLeafColumns"))};for(const d of e._features)d.createColumn==null||d.createColumn(h,e);return h}const T="debugHeaders";function mt(e,o,t){var n;let i={id:(n=t.id)!=null?n:o.id,column:o,index:t.index,isPlaceholder:!!t.isPlaceholder,placeholderId:t.placeholderId,depth:t.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const l=[],r=u=>{u.subHeaders&&u.subHeaders.length&&u.subHeaders.map(r),l.push(u);};return r(i),l},getContext:()=>({table:e,header:i,column:o})};return e._features.forEach(l=>{l.createHeader==null||l.createHeader(i,e);}),i}const bn={createTable:e=>{e.getHeaderGroups=y(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(o,t,n,s)=>{var i,l;const r=(i=n?.map(h=>t.find(d=>d.id===h)).filter(Boolean))!=null?i:[],u=(l=s?.map(h=>t.find(d=>d.id===h)).filter(Boolean))!=null?l:[],c=t.filter(h=>!(n!=null&&n.includes(h.id))&&!(s!=null&&s.includes(h.id)));return Fe(o,[...r,...c,...u],e)},F(e.options,T,"getHeaderGroups")),e.getCenterHeaderGroups=y(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(o,t,n,s)=>(t=t.filter(i=>!(n!=null&&n.includes(i.id))&&!(s!=null&&s.includes(i.id))),Fe(o,t,e,"center")),F(e.options,T,"getCenterHeaderGroups")),e.getLeftHeaderGroups=y(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(o,t,n)=>{var s;const i=(s=n?.map(l=>t.find(r=>r.id===l)).filter(Boolean))!=null?s:[];return Fe(o,i,e,"left")},F(e.options,T,"getLeftHeaderGroups")),e.getRightHeaderGroups=y(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(o,t,n)=>{var s;const i=(s=n?.map(l=>t.find(r=>r.id===l)).filter(Boolean))!=null?s:[];return Fe(o,i,e,"right")},F(e.options,T,"getRightHeaderGroups")),e.getFooterGroups=y(()=>[e.getHeaderGroups()],o=>[...o].reverse(),F(e.options,T,"getFooterGroups")),e.getLeftFooterGroups=y(()=>[e.getLeftHeaderGroups()],o=>[...o].reverse(),F(e.options,T,"getLeftFooterGroups")),e.getCenterFooterGroups=y(()=>[e.getCenterHeaderGroups()],o=>[...o].reverse(),F(e.options,T,"getCenterFooterGroups")),e.getRightFooterGroups=y(()=>[e.getRightHeaderGroups()],o=>[...o].reverse(),F(e.options,T,"getRightFooterGroups")),e.getFlatHeaders=y(()=>[e.getHeaderGroups()],o=>o.map(t=>t.headers).flat(),F(e.options,T,"getFlatHeaders")),e.getLeftFlatHeaders=y(()=>[e.getLeftHeaderGroups()],o=>o.map(t=>t.headers).flat(),F(e.options,T,"getLeftFlatHeaders")),e.getCenterFlatHeaders=y(()=>[e.getCenterHeaderGroups()],o=>o.map(t=>t.headers).flat(),F(e.options,T,"getCenterFlatHeaders")),e.getRightFlatHeaders=y(()=>[e.getRightHeaderGroups()],o=>o.map(t=>t.headers).flat(),F(e.options,T,"getRightFlatHeaders")),e.getCenterLeafHeaders=y(()=>[e.getCenterFlatHeaders()],o=>o.filter(t=>{var n;return !((n=t.subHeaders)!=null&&n.length)}),F(e.options,T,"getCenterLeafHeaders")),e.getLeftLeafHeaders=y(()=>[e.getLeftFlatHeaders()],o=>o.filter(t=>{var n;return !((n=t.subHeaders)!=null&&n.length)}),F(e.options,T,"getLeftLeafHeaders")),e.getRightLeafHeaders=y(()=>[e.getRightFlatHeaders()],o=>o.filter(t=>{var n;return !((n=t.subHeaders)!=null&&n.length)}),F(e.options,T,"getRightLeafHeaders")),e.getLeafHeaders=y(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(o,t,n)=>{var s,i,l,r,u,c;return [...(s=(i=o[0])==null?void 0:i.headers)!=null?s:[],...(l=(r=t[0])==null?void 0:r.headers)!=null?l:[],...(u=(c=n[0])==null?void 0:c.headers)!=null?u:[]].map(g=>g.getLeafHeaders()).flat()},F(e.options,T,"getLeafHeaders"));}};function Fe(e,o,t,n){var s,i;let l=0;const r=function(d,a){a===void 0&&(a=1),l=Math.max(l,a),d.filter(f=>f.getIsVisible()).forEach(f=>{var m;(m=f.columns)!=null&&m.length&&r(f.columns,a+1);},0);};r(e);let u=[];const c=(d,a)=>{const f={depth:a,id:[n,`${a}`].filter(Boolean).join("_"),headers:[]},m=[];d.forEach(w=>{const S=[...m].reverse()[0],C=w.column.depth===f.depth;let R,P=false;if(C&&w.column.parent?R=w.column.parent:(R=w.column,P=true),S&&S?.column===R)S.subHeaders.push(w);else {const E=mt(t,R,{id:[n,a,R.id,w?.id].filter(Boolean).join("_"),isPlaceholder:P,placeholderId:P?`${m.filter(z=>z.column===R).length}`:void 0,depth:a,index:m.length});E.subHeaders.push(w),m.push(E);}f.headers.push(w),w.headerGroup=f;}),u.push(f),a>0&&c(m,a-1);},g=o.map((d,a)=>mt(t,d,{depth:l,index:a}));c(g,l-1),u.reverse();const h=d=>d.filter(f=>f.column.getIsVisible()).map(f=>{let m=0,w=0,S=[0];f.subHeaders&&f.subHeaders.length?(S=[],h(f.subHeaders).forEach(R=>{let{colSpan:P,rowSpan:E}=R;m+=P,S.push(E);})):m=1;const C=Math.min(...S);return w=w+C,f.colSpan=m,f.rowSpan=w,{colSpan:m,rowSpan:w}});return h((s=(i=u[0])==null?void 0:i.headers)!=null?s:[]),u}const $e=(e,o,t,n,s,i,l)=>{let r={id:o,index:n,original:t,depth:s,parentId:l,_valuesCache:{},_uniqueValuesCache:{},getValue:u=>{if(r._valuesCache.hasOwnProperty(u))return r._valuesCache[u];const c=e.getColumn(u);if(c!=null&&c.accessorFn)return r._valuesCache[u]=c.accessorFn(r.original,n),r._valuesCache[u]},getUniqueValues:u=>{if(r._uniqueValuesCache.hasOwnProperty(u))return r._uniqueValuesCache[u];const c=e.getColumn(u);if(c!=null&&c.accessorFn)return c.columnDef.getUniqueValues?(r._uniqueValuesCache[u]=c.columnDef.getUniqueValues(r.original,n),r._uniqueValuesCache[u]):(r._uniqueValuesCache[u]=[r.getValue(u)],r._uniqueValuesCache[u])},renderValue:u=>{var c;return (c=r.getValue(u))!=null?c:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>Fn(r.subRows,u=>u.subRows),getParentRow:()=>r.parentId?e.getRow(r.parentId,true):void 0,getParentRows:()=>{let u=[],c=r;for(;;){const g=c.getParentRow();if(!g)break;u.push(g),c=g;}return u.reverse()},getAllCells:y(()=>[e.getAllLeafColumns()],u=>u.map(c=>Mn(e,r,c,c.id)),F(e.options,"debugRows","getAllCells")),_getAllCellsByColumnId:y(()=>[r.getAllCells()],u=>u.reduce((c,g)=>(c[g.column.id]=g,c),{}),F(e.options,"debugRows","getAllCellsByColumnId"))};for(let u=0;u<e._features.length;u++){const c=e._features[u];c==null||c.createRow==null||c.createRow(r,e);}return r},En={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()};}},Mt=(e,o,t)=>{var n,s;const i=t==null||(n=t.toString())==null?void 0:n.toLowerCase();return !!(!((s=e.getValue(o))==null||(s=s.toString())==null||(s=s.toLowerCase())==null)&&s.includes(i))};Mt.autoRemove=e=>ee(e);const It=(e,o,t)=>{var n;return !!(!((n=e.getValue(o))==null||(n=n.toString())==null)&&n.includes(t))};It.autoRemove=e=>ee(e);const bt=(e,o,t)=>{var n;return ((n=e.getValue(o))==null||(n=n.toString())==null?void 0:n.toLowerCase())===t?.toLowerCase()};bt.autoRemove=e=>ee(e);const Et=(e,o,t)=>{var n;return (n=e.getValue(o))==null?void 0:n.includes(t)};Et.autoRemove=e=>ee(e);const Vt=(e,o,t)=>!t.some(n=>{var s;return !((s=e.getValue(o))!=null&&s.includes(n))});Vt.autoRemove=e=>ee(e)||!(e!=null&&e.length);const kt=(e,o,t)=>t.some(n=>{var s;return (s=e.getValue(o))==null?void 0:s.includes(n)});kt.autoRemove=e=>ee(e)||!(e!=null&&e.length);const Pt=(e,o,t)=>e.getValue(o)===t;Pt.autoRemove=e=>ee(e);const At=(e,o,t)=>e.getValue(o)==t;At.autoRemove=e=>ee(e);const et=(e,o,t)=>{let[n,s]=t;const i=e.getValue(o);return i>=n&&i<=s};et.resolveFilterValue=e=>{let[o,t]=e,n=typeof o!="number"?parseFloat(o):o,s=typeof t!="number"?parseFloat(t):t,i=o===null||Number.isNaN(n)?-1/0:n,l=t===null||Number.isNaN(s)?1/0:s;if(i>l){const r=i;i=l,l=r;}return [i,l]};et.autoRemove=e=>ee(e)||ee(e[0])&&ee(e[1]);const ie={includesString:Mt,includesStringSensitive:It,equalsString:bt,arrIncludes:Et,arrIncludesAll:Vt,arrIncludesSome:kt,equals:Pt,weakEquals:At,inNumberRange:et};function ee(e){return e==null||e===""}const Vn={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:X("columnFilters",e),filterFromLeafRows:false,maxLeafRowFilterDepth:100}),createColumn:(e,o)=>{e.getAutoFilterFn=()=>{const t=o.getCoreRowModel().flatRows[0],n=t?.getValue(e.id);return typeof n=="string"?ie.includesString:typeof n=="number"?ie.inNumberRange:typeof n=="boolean"||n!==null&&typeof n=="object"?ie.equals:Array.isArray(n)?ie.arrIncludes:ie.weakEquals},e.getFilterFn=()=>{var t,n;return be(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:ie[e.columnDef.filterFn]},e.getCanFilter=()=>{var t,n,s;return ((t=e.columnDef.enableColumnFilter)!=null?t:true)&&((n=o.options.enableColumnFilters)!=null?n:true)&&((s=o.options.enableFilters)!=null?s:true)&&!!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(s=>s.id===e.id))!=null?t:-1},e.setFilterValue=t=>{o.setColumnFilters(n=>{const s=e.getFilterFn(),i=n?.find(g=>g.id===e.id),l=le(t,i?i.value:void 0);if(_t(s,l,e)){var r;return (r=n?.filter(g=>g.id!==e.id))!=null?r:[]}const u={id:e.id,value:l};if(i){var c;return (c=n?.map(g=>g.id===e.id?u:g))!=null?c:[]}return n!=null&&n.length?[...n,u]:[u]});};},createRow:(e,o)=>{e.columnFilters={},e.columnFiltersMeta={};},createTable:e=>{e.setColumnFilters=o=>{const t=e.getAllLeafColumns(),n=s=>{var i;return (i=le(o,s))==null?void 0:i.filter(l=>{const r=t.find(u=>u.id===l.id);if(r){const u=r.getFilterFn();if(_t(u,l.value,r))return  false}return  true})};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 _t(e,o,t){return (e&&e.autoRemove?e.autoRemove(o,t):false)||typeof o>"u"||typeof o=="string"&&!o}const kn=(e,o,t)=>t.reduce((n,s)=>{const i=s.getValue(e);return n+(typeof i=="number"?i:0)},0),Pn=(e,o,t)=>{let n;return t.forEach(s=>{const i=s.getValue(e);i!=null&&(n>i||n===void 0&&i>=i)&&(n=i);}),n},An=(e,o,t)=>{let n;return t.forEach(s=>{const i=s.getValue(e);i!=null&&(n<i||n===void 0&&i>=i)&&(n=i);}),n},Dn=(e,o,t)=>{let n,s;return t.forEach(i=>{const l=i.getValue(e);l!=null&&(n===void 0?l>=l&&(n=s=l):(n>l&&(n=l),s<l&&(s=l)));}),[n,s]},zn=(e,o)=>{let t=0,n=0;if(o.forEach(s=>{let i=s.getValue(e);i!=null&&(i=+i)>=i&&(++t,n+=i);}),t)return n/t},On=(e,o)=>{if(!o.length)return;const t=o.map(i=>i.getValue(e));if(!yn(t))return;if(t.length===1)return t[0];const n=Math.floor(t.length/2),s=t.sort((i,l)=>i-l);return t.length%2!==0?s[n]:(s[n-1]+s[n])/2},Ln=(e,o)=>Array.from(new Set(o.map(t=>t.getValue(e))).values()),Hn=(e,o)=>new Set(o.map(t=>t.getValue(e))).size,jn=(e,o)=>o.length,He={sum:kn,min:Pn,max:An,extent:Dn,mean:zn,median:On,unique:Ln,uniqueCount:Hn,count:jn},Gn={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:X("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:true)&&((n=o.options.enableGrouping)!=null?n:true)&&(!!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 He.sum;if(Object.prototype.toString.call(n)==="[object Date]")return He.extent},e.getAggregationFn=()=>{var t,n;if(!e)throw new Error;return be(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:He[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 s;return !e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((s=t.subRows)!=null&&s.length)};}};function Bn(e,o,t){if(!(o!=null&&o.length)||!t)return e;const n=e.filter(i=>!o.includes(i.id));return t==="remove"?n:[...o.map(i=>e.find(l=>l.id===i)).filter(Boolean),...n]}const Tn={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:X("columnOrder",e)}),createColumn:(e,o)=>{e.getIndex=y(t=>[Ce(o,t)],t=>t.findIndex(n=>n.id===e.id),F(o.options,"debugColumns","getIndex")),e.getIsFirstColumn=t=>{var n;return ((n=Ce(o,t)[0])==null?void 0:n.id)===e.id},e.getIsLastColumn=t=>{var n;const s=Ce(o,t);return ((n=s[s.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=y(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(o,t,n)=>s=>{let i=[];if(!(o!=null&&o.length))i=s;else {const l=[...o],r=[...s];for(;r.length&&l.length;){const u=l.shift(),c=r.findIndex(g=>g.id===u);c>-1&&i.push(r.splice(c,1)[0]);}i=[...i,...r];}return Bn(i,t,n)},F(e.options,"debugTable","_getOrderColumnsFn"));}},je=()=>({left:[],right:[]}),Nn={getInitialState:e=>({columnPinning:je(),...e}),getDefaultOptions:e=>({onColumnPinningChange:X("columnPinning",e)}),createColumn:(e,o)=>{e.pin=t=>{const n=e.getLeafColumns().map(s=>s.id).filter(Boolean);o.setColumnPinning(s=>{var i,l;if(t==="right"){var r,u;return {left:((r=s?.left)!=null?r:[]).filter(h=>!(n!=null&&n.includes(h))),right:[...((u=s?.right)!=null?u:[]).filter(h=>!(n!=null&&n.includes(h))),...n]}}if(t==="left"){var c,g;return {left:[...((c=s?.left)!=null?c:[]).filter(h=>!(n!=null&&n.includes(h))),...n],right:((g=s?.right)!=null?g:[]).filter(h=>!(n!=null&&n.includes(h)))}}return {left:((i=s?.left)!=null?i:[]).filter(h=>!(n!=null&&n.includes(h))),right:((l=s?.right)!=null?l:[]).filter(h=>!(n!=null&&n.includes(h)))}});},e.getCanPin=()=>e.getLeafColumns().some(n=>{var s,i,l;return ((s=n.columnDef.enablePinning)!=null?s:true)&&((i=(l=o.options.enableColumnPinning)!=null?l:o.options.enablePinning)!=null?i:true)}),e.getIsPinned=()=>{const t=e.getLeafColumns().map(r=>r.id),{left:n,right:s}=o.getState().columnPinning,i=t.some(r=>n?.includes(r)),l=t.some(r=>s?.includes(r));return i?"left":l?"right":false},e.getPinnedIndex=()=>{var t,n;const s=e.getIsPinned();return s?(t=(n=o.getState().columnPinning)==null||(n=n[s])==null?void 0:n.indexOf(e.id))!=null?t:-1:0};},createRow:(e,o)=>{e.getCenterVisibleCells=y(()=>[e._getAllVisibleCells(),o.getState().columnPinning.left,o.getState().columnPinning.right],(t,n,s)=>{const i=[...n??[],...s??[]];return t.filter(l=>!i.includes(l.column.id))},F(o.options,"debugRows","getCenterVisibleCells")),e.getLeftVisibleCells=y(()=>[e._getAllVisibleCells(),o.getState().columnPinning.left],(t,n)=>(n??[]).map(i=>t.find(l=>l.column.id===i)).filter(Boolean).map(i=>({...i,position:"left"})),F(o.options,"debugRows","getLeftVisibleCells")),e.getRightVisibleCells=y(()=>[e._getAllVisibleCells(),o.getState().columnPinning.right],(t,n)=>(n??[]).map(i=>t.find(l=>l.column.id===i)).filter(Boolean).map(i=>({...i,position:"right"})),F(o.options,"debugRows","getRightVisibleCells"));},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?je():(t=(n=e.initialState)==null?void 0:n.columnPinning)!=null?t:je())},e.getIsSomeColumnsPinned=o=>{var t;const n=e.getState().columnPinning;if(!o){var s,i;return !!((s=n.left)!=null&&s.length||(i=n.right)!=null&&i.length)}return !!((t=n[o])!=null&&t.length)},e.getLeftLeafColumns=y(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(o,t)=>(t??[]).map(n=>o.find(s=>s.id===n)).filter(Boolean),F(e.options,"debugColumns","getLeftLeafColumns")),e.getRightLeafColumns=y(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(o,t)=>(t??[]).map(n=>o.find(s=>s.id===n)).filter(Boolean),F(e.options,"debugColumns","getRightLeafColumns")),e.getCenterLeafColumns=y(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(o,t,n)=>{const s=[...t??[],...n??[]];return o.filter(i=>!s.includes(i.id))},F(e.options,"debugColumns","getCenterLeafColumns"));}};function qn(e){return e||(typeof document<"u"?document:null)}const Me={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Ge=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:false,columnSizingStart:[]}),Un={getDefaultColumnDef:()=>Me,getInitialState:e=>({columnSizing:{},columnSizingInfo:Ge(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:X("columnSizing",e),onColumnSizingInfoChange:X("columnSizingInfo",e)}),createColumn:(e,o)=>{e.getSize=()=>{var t,n,s;const i=o.getState().columnSizing[e.id];return Math.min(Math.max((t=e.columnDef.minSize)!=null?t:Me.minSize,(n=i??e.columnDef.size)!=null?n:Me.size),(s=e.columnDef.maxSize)!=null?s:Me.maxSize)},e.getStart=y(t=>[t,Ce(o,t),o.getState().columnSizing],(t,n)=>n.slice(0,e.getIndex(t)).reduce((s,i)=>s+i.getSize(),0),F(o.options,"debugColumns","getStart")),e.getAfter=y(t=>[t,Ce(o,t),o.getState().columnSizing],(t,n)=>n.slice(e.getIndex(t)+1).reduce((s,i)=>s+i.getSize(),0),F(o.options,"debugColumns","getAfter")),e.resetSize=()=>{o.setColumnSizing(t=>{let{[e.id]:n,...s}=t;return s});},e.getCanResize=()=>{var t,n;return ((t=e.columnDef.enableResizing)!=null?t:true)&&((n=o.options.enableColumnResizing)!=null?n:true)},e.getIsResizing=()=>o.getState().columnSizingInfo.isResizingColumn===e.id;},createHeader:(e,o)=>{e.getSize=()=>{let t=0;const n=s=>{if(s.subHeaders.length)s.subHeaders.forEach(n);else {var i;t+=(i=s.column.getSize())!=null?i: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),s=n?.getCanResize();return i=>{if(!n||!s||(i.persist==null||i.persist(),Be(i)&&i.touches&&i.touches.length>1))return;const l=e.getSize(),r=e?e.getLeafHeaders().map(S=>[S.column.id,S.column.getSize()]):[[n.id,n.getSize()]],u=Be(i)?Math.round(i.touches[0].clientX):i.clientX,c={},g=(S,C)=>{typeof C=="number"&&(o.setColumnSizingInfo(R=>{var P,E;const z=o.options.columnResizeDirection==="rtl"?-1:1,G=(C-((P=R?.startOffset)!=null?P:0))*z,O=Math.max(G/((E=R?.startSize)!=null?E:0),-0.999999);return R.columnSizingStart.forEach(se=>{let[te,N]=se;c[te]=Math.round(Math.max(N+N*O,0)*100)/100;}),{...R,deltaOffset:G,deltaPercentage:O}}),(o.options.columnResizeMode==="onChange"||S==="end")&&o.setColumnSizing(R=>({...R,...c})));},h=S=>g("move",S),d=S=>{g("end",S),o.setColumnSizingInfo(C=>({...C,isResizingColumn:false,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}));},a=qn(t),f={moveHandler:S=>h(S.clientX),upHandler:S=>{a?.removeEventListener("mousemove",f.moveHandler),a?.removeEventListener("mouseup",f.upHandler),d(S.clientX);}},m={moveHandler:S=>(S.cancelable&&(S.preventDefault(),S.stopPropagation()),h(S.touches[0].clientX),false),upHandler:S=>{var C;a?.removeEventListener("touchmove",m.moveHandler),a?.removeEventListener("touchend",m.upHandler),S.cancelable&&(S.preventDefault(),S.stopPropagation()),d((C=S.touches[0])==null?void 0:C.clientX);}},w=Wn()?{passive:false}:false;Be(i)?(a?.addEventListener("touchmove",m.moveHandler,w),a?.addEventListener("touchend",m.upHandler,w)):(a?.addEventListener("mousemove",f.moveHandler,w),a?.addEventListener("mouseup",f.upHandler,w)),o.setColumnSizingInfo(S=>({...S,startOffset:u,startSize:l,deltaOffset:0,deltaPercentage:0,columnSizingStart:r,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?Ge():(t=e.initialState.columnSizingInfo)!=null?t:Ge());},e.getTotalSize=()=>{var o,t;return (o=(t=e.getHeaderGroups()[0])==null?void 0:t.headers.reduce((n,s)=>n+s.getSize(),0))!=null?o:0},e.getLeftTotalSize=()=>{var o,t;return (o=(t=e.getLeftHeaderGroups()[0])==null?void 0:t.headers.reduce((n,s)=>n+s.getSize(),0))!=null?o:0},e.getCenterTotalSize=()=>{var o,t;return (o=(t=e.getCenterHeaderGroups()[0])==null?void 0:t.headers.reduce((n,s)=>n+s.getSize(),0))!=null?o:0},e.getRightTotalSize=()=>{var o,t;return (o=(t=e.getRightHeaderGroups()[0])==null?void 0:t.headers.reduce((n,s)=>n+s.getSize(),0))!=null?o:0};}};let Ie=null;function Wn(){if(typeof Ie=="boolean")return Ie;let e=false;try{const o={get passive(){return e=!0,!1}},t=()=>{};window.addEventListener("test",t,o),window.removeEventListener("test",t);}catch{e=false;}return Ie=e,Ie}function Be(e){return e.type==="touchstart"}const Kn={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:X("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 s=e.columns;return (t=s.length?s.some(i=>i.getIsVisible()):(n=o.getState().columnVisibility)==null?void 0:n[e.id])!=null?t:true},e.getCanHide=()=>{var t,n;return ((t=e.columnDef.enableHiding)!=null?t:true)&&((n=o.options.enableHiding)!=null?n:true)},e.getToggleVisibilityHandler=()=>t=>{e.toggleVisibility==null||e.toggleVisibility(t.target.checked);};},createRow:(e,o)=>{e._getAllVisibleCells=y(()=>[e.getAllCells(),o.getState().columnVisibility],t=>t.filter(n=>n.column.getIsVisible()),F(o.options,"debugRows","_getAllVisibleCells")),e.getVisibleCells=y(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(t,n,s)=>[...t,...n,...s],F(o.options,"debugRows","getVisibleCells"));},createTable:e=>{const o=(t,n)=>y(()=>[n(),n().filter(s=>s.getIsVisible()).map(s=>s.id).join("_")],s=>s.filter(i=>i.getIsVisible==null?void 0:i.getIsVisible()),F(e.options,"debugColumns",t));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((s,i)=>({...s,[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 n;e.toggleAllColumnsVisible((n=t.target)==null?void 0:n.checked);};}};function Ce(e,o){return o?o==="center"?e.getCenterVisibleLeafColumns():o==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const Xn={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()};}},Jn={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:X("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,s,i;return ((t=e.columnDef.enableGlobalFilter)!=null?t:true)&&((n=o.options.enableGlobalFilter)!=null?n:true)&&((s=o.options.enableFilters)!=null?s:true)&&((i=o.options.getColumnCanGlobalFilter==null?void 0:o.options.getColumnCanGlobalFilter(e))!=null?i:true)&&!!e.accessorFn};},createTable:e=>{e.getGlobalAutoFilterFn=()=>ie.includesString,e.getGlobalFilterFn=()=>{var o,t;const{globalFilterFn:n}=e.options;return be(n)?n:n==="auto"?e.getGlobalAutoFilterFn():(o=(t=e.options.filterFns)==null?void 0:t[n])!=null?o:ie[n]},e.setGlobalFilter=o=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(o);},e.resetGlobalFilter=o=>{e.setGlobalFilter(o?void 0:e.initialState.globalFilter);};}},Yn={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:X("expanded",e),paginateExpandedRows:true}),createTable:e=>{let o=false,t=false;e._autoResetExpanded=()=>{var n,s;if(!o){e._queue(()=>{o=true;});return}if((n=(s=e.options.autoResetAll)!=null?s:e.options.autoResetExpanded)!=null?n:!e.options.manualExpanding){if(t)return;t=true,e._queue(()=>{e.resetExpanded(),t=false;});}},e.setExpanded=n=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(n),e.toggleAllRowsExpanded=n=>{n??!e.getIsAllRowsExpanded()?e.setExpanded(true):e.setExpanded({});},e.resetExpanded=n=>{var s,i;e.setExpanded(n?{}:(s=(i=e.initialState)==null?void 0:i.expanded)!=null?s:{});},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===true||Object.values(n).some(Boolean)},e.getIsAllRowsExpanded=()=>{const n=e.getState().expanded;return typeof n=="boolean"?n===true:!(!Object.keys(n).length||e.getRowModel().flatRows.some(s=>!s.getIsExpanded()))},e.getExpandedDepth=()=>{let n=0;return (e.getState().expanded===true?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(i=>{const l=i.split(".");n=Math.max(n,l.length);}),n},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel());},createRow:(e,o)=>{e.toggleExpanded=t=>{o.setExpanded(n=>{var s;const i=n===true?true:!!(n!=null&&n[e.id]);let l={};if(n===true?Object.keys(o.getRowModel().rowsById).forEach(r=>{l[r]=true;}):l=n,t=(s=t)!=null?s:!i,!i&&t)return {...l,[e.id]:true};if(i&&!t){const{[e.id]:r,...u}=l;return u}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===true||n?.[e.id])},e.getCanExpand=()=>{var t,n,s;return (t=o.options.getRowCanExpand==null?void 0:o.options.getRowCanExpand(e))!=null?t:((n=o.options.enableExpanding)!=null?n:true)&&!!((s=e.subRows)!=null&&s.length)},e.getIsAllParentsExpanded=()=>{let t=true,n=e;for(;t&&n.parentId;)n=o.getRow(n.parentId,true),t=n.getIsExpanded();return t},e.getToggleExpandedHandler=()=>{const t=e.getCanExpand();return ()=>{t&&e.toggleExpanded();}};}},Xe=0,Je=10,Te=()=>({pageIndex:Xe,pageSize:Je}),Zn={getInitialState:e=>({...e,pagination:{...Te(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:X("pagination",e)}),createTable:e=>{let o=false,t=false;e._autoResetPageIndex=()=>{var n,s;if(!o){e._queue(()=>{o=true;});return}if((n=(s=e.options.autoResetAll)!=null?s:e.options.autoResetPageIndex)!=null?n:!e.options.manualPagination){if(t)return;t=true,e._queue(()=>{e.resetPageIndex(),t=false;});}},e.setPagination=n=>{const s=i=>le(n,i);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(s)},e.resetPagination=n=>{var s;e.setPagination(n?Te():(s=e.initialState.pagination)!=null?s:Te());},e.setPageIndex=n=>{e.setPagination(s=>{let i=le(n,s.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)),{...s,pageIndex:i}});},e.resetPageIndex=n=>{var s,i;e.setPageIndex(n?Xe:(s=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageIndex)!=null?s:Xe);},e.resetPageSize=n=>{var s,i;e.setPageSize(n?Je:(s=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageSize)!=null?s:Je);},e.setPageSize=n=>{e.setPagination(s=>{const i=Math.max(1,le(n,s.pageSize)),l=s.pageSize*s.pageIndex,r=Math.floor(l/i);return {...s,pageIndex:r,pageSize:i}});},e.setPageCount=n=>e.setPagination(s=>{var i;let l=le(n,(i=e.options.pageCount)!=null?i:-1);return typeof l=="number"&&(l=Math.max(-1,l)),{...s,pageCount:l}}),e.getPageOptions=y(()=>[e.getPageCount()],n=>{let s=[];return n&&n>0&&(s=[...new Array(n)].fill(null).map((i,l)=>l)),s},F(e.options,"debugTable","getPageOptions")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:n}=e.getState().pagination,s=e.getPageCount();return s===-1?true:s===0?false:n<s-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};}},Ne=()=>({top:[],bottom:[]}),Qn={getInitialState:e=>({rowPinning:Ne(),...e}),getDefaultOptions:e=>({onRowPinningChange:X("rowPinning",e)}),createRow:(e,o)=>{e.pin=(t,n,s)=>{const i=n?e.getLeafRows().map(u=>{let{id:c}=u;return c}):[],l=s?e.getParentRows().map(u=>{let{id:c}=u;return c}):[],r=new Set([...l,e.id,...i]);o.setRowPinning(u=>{var c,g;if(t==="bottom"){var h,d;return {top:((h=u?.top)!=null?h:[]).filter(m=>!(r!=null&&r.has(m))),bottom:[...((d=u?.bottom)!=null?d:[]).filter(m=>!(r!=null&&r.has(m))),...Array.from(r)]}}if(t==="top"){var a,f;return {top:[...((a=u?.top)!=null?a:[]).filter(m=>!(r!=null&&r.has(m))),...Array.from(r)],bottom:((f=u?.bottom)!=null?f:[]).filter(m=>!(r!=null&&r.has(m)))}}return {top:((c=u?.top)!=null?c:[]).filter(m=>!(r!=null&&r.has(m))),bottom:((g=u?.bottom)!=null?g:[]).filter(m=>!(r!=null&&r.has(m)))}});},e.getCanPin=()=>{var t;const{enableRowPinning:n,enablePinning:s}=o.options;return typeof n=="function"?n(e):(t=n??s)!=null?t:true},e.getIsPinned=()=>{const t=[e.id],{top:n,bottom:s}=o.getState().rowPinning,i=t.some(r=>n?.includes(r)),l=t.some(r=>s?.includes(r));return i?"top":l?"bottom":false},e.getPinnedIndex=()=>{var t,n;const s=e.getIsPinned();if(!s)return  -1;const i=(t=s==="top"?o.getTopRows():o.getBottomRows())==null?void 0:t.map(l=>{let{id:r}=l;return r});return (n=i?.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?Ne():(t=(n=e.initialState)==null?void 0:n.rowPinning)!=null?t:Ne())},e.getIsSomeRowsPinned=o=>{var t;const n=e.getState().rowPinning;if(!o){var s,i;return !!((s=n.top)!=null&&s.length||(i=n.bottom)!=null&&i.length)}return !!((t=n[o])!=null&&t.length)},e._getPinnedRows=(o,t,n)=>{var s;return ((s=e.options.keepPinnedRows)==null||s?(t??[]).map(l=>{const r=e.getRow(l,true);return r.getIsAllParentsExpanded()?r:null}):(t??[]).map(l=>o.find(r=>r.id===l))).filter(Boolean).map(l=>({...l,position:n}))},e.getTopRows=y(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(o,t)=>e._getPinnedRows(o,t,"top"),F(e.options,"debugRows","getTopRows")),e.getBottomRows=y(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(o,t)=>e._getPinnedRows(o,t,"bottom"),F(e.options,"debugRows","getBottomRows")),e.getCenterRows=y(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(o,t,n)=>{const s=new Set([...t??[],...n??[]]);return o.filter(i=>!s.has(i.id))},F(e.options,"debugRows","getCenterRows"));}},$n={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:X("rowSelection",e),enableRowSelection:true,enableMultiRowSelection:true,enableSubRowSelection:true}),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},s=e.getPreGroupedRowModel().flatRows;return o?s.forEach(i=>{i.getCanSelect()&&(n[i.id]=true);}):s.forEach(i=>{delete n[i.id];}),n});},e.toggleAllPageRowsSelected=o=>e.setRowSelection(t=>{const n=typeof o<"u"?o:!e.getIsAllPageRowsSelected(),s={...t};return e.getRowModel().rows.forEach(i=>{Ye(s,i.id,n,true,e);}),s}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=y(()=>[e.getState().rowSelection,e.getCoreRowModel()],(o,t)=>Object.keys(o).length?qe(e,t):{rows:[],flatRows:[],rowsById:{}},F(e.options,"debugTable","getSelectedRowModel")),e.getFilteredSelectedRowModel=y(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(o,t)=>Object.keys(o).length?qe(e,t):{rows:[],flatRows:[],rowsById:{}},F(e.options,"debugTable","getFilteredSelectedRowModel")),e.getGroupedSelectedRowModel=y(()=>[e.getState().rowSelection,e.getSortedRowModel()],(o,t)=>Object.keys(o).length?qe(e,t):{rows:[],flatRows:[],rowsById:{}},F(e.options,"debugTable","getGroupedSelectedRowModel")),e.getIsAllRowsSelected=()=>{const o=e.getFilteredRowModel().flatRows,{rowSelection:t}=e.getState();let n=!!(o.length&&Object.keys(t).length);return n&&o.some(s=>s.getCanSelect()&&!t[s.id])&&(n=false),n},e.getIsAllPageRowsSelected=()=>{const o=e.getPaginationRowModel().flatRows.filter(s=>s.getCanSelect()),{rowSelection:t}=e.getState();let n=!!o.length;return n&&o.some(s=>!t[s.id])&&(n=false),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()?false: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 s=e.getIsSelected();o.setRowSelection(i=>{var l;if(t=typeof t<"u"?t:!s,e.getCanSelect()&&s===t)return i;const r={...i};return Ye(r,e.id,t,(l=n?.selectChildren)!=null?l:true,o),r});},e.getIsSelected=()=>{const{rowSelection:t}=o.getState();return tt(e,t)},e.getIsSomeSelected=()=>{const{rowSelection:t}=o.getState();return Ze(e,t)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:t}=o.getState();return Ze(e,t)==="all"},e.getCanSelect=()=>{var t;return typeof o.options.enableRowSelection=="function"?o.options.enableRowSelection(e):(t=o.options.enableRowSelection)!=null?t:true},e.getCanSelectSubRows=()=>{var t;return typeof o.options.enableSubRowSelection=="function"?o.options.enableSubRowSelection(e):(t=o.options.enableSubRowSelection)!=null?t:true},e.getCanMultiSelect=()=>{var t;return typeof o.options.enableMultiRowSelection=="function"?o.options.enableMultiRowSelection(e):(t=o.options.enableMultiRowSelection)!=null?t:true},e.getToggleSelectedHandler=()=>{const t=e.getCanSelect();return n=>{var s;t&&e.toggleSelected((s=n.target)==null?void 0:s.checked);}};}},Ye=(e,o,t,n,s)=>{var i;const l=s.getRow(o,true);t?(l.getCanMultiSelect()||Object.keys(e).forEach(r=>delete e[r]),l.getCanSelect()&&(e[o]=true)):delete e[o],n&&(i=l.subRows)!=null&&i.length&&l.getCanSelectSubRows()&&l.subRows.forEach(r=>Ye(e,r.id,t,n,s));};function qe(e,o){const t=e.getState().rowSelection,n=[],s={},i=function(l,r){return l.map(u=>{var c;const g=tt(u,t);if(g&&(n.push(u),s[u.id]=u),(c=u.subRows)!=null&&c.length&&(u={...u,subRows:i(u.subRows)}),g)return u}).filter(Boolean)};return {rows:i(o.rows),flatRows:n,rowsById:s}}function tt(e,o){var t;return (t=o[e.id])!=null?t:false}function Ze(e,o,t){var n;if(!((n=e.subRows)!=null&&n.length))return  false;let s=true,i=false;return e.subRows.forEach(l=>{if(!(i&&!s)&&(l.getCanSelect()&&(tt(l,o)?i=true:s=false),l.subRows&&l.subRows.length)){const r=Ze(l,o);r==="all"?i=true:(r==="some"&&(i=true),s=false);}}),s?"all":i?"some":false}const Qe=/([0-9]+)/gm,eo=(e,o,t)=>Dt(re(e.getValue(t)).toLowerCase(),re(o.getValue(t)).toLowerCase()),to=(e,o,t)=>Dt(re(e.getValue(t)),re(o.getValue(t))),no=(e,o,t)=>nt(re(e.getValue(t)).toLowerCase(),re(o.getValue(t)).toLowerCase()),oo=(e,o,t)=>nt(re(e.getValue(t)),re(o.getValue(t))),so=(e,o,t)=>{const n=e.getValue(t),s=o.getValue(t);return n>s?1:n<s?-1:0},io=(e,o,t)=>nt(e.getValue(t),o.getValue(t));function nt(e,o){return e===o?0:e>o?1:-1}function re(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function Dt(e,o){const t=e.split(Qe).filter(Boolean),n=o.split(Qe).filter(Boolean);for(;t.length&&n.length;){const s=t.shift(),i=n.shift(),l=parseInt(s,10),r=parseInt(i,10),u=[l,r].sort();if(isNaN(u[0])){if(s>i)return 1;if(i>s)return  -1;continue}if(isNaN(u[1]))return isNaN(l)?-1:1;if(l>r)return 1;if(r>l)return  -1}return t.length-n.length}const ve={alphanumeric:eo,alphanumericCaseSensitive:to,text:no,textCaseSensitive:oo,datetime:so,basic:io},lo={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:X("sorting",e),isMultiSortEvent:o=>o.shiftKey}),createColumn:(e,o)=>{e.getAutoSortingFn=()=>{const t=o.getFilteredRowModel().flatRows.slice(10);let n=false;for(const s of t){const i=s?.getValue(e.id);if(Object.prototype.toString.call(i)==="[object Date]")return ve.datetime;if(typeof i=="string"&&(n=true,i.split(Qe).length>1))return ve.alphanumeric}return n?ve.text:ve.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 be(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:ve[e.columnDef.sortingFn]},e.toggleSorting=(t,n)=>{const s=e.getNextSortingOrder(),i=typeof t<"u"&&t!==null;o.setSorting(l=>{const r=l?.find(a=>a.id===e.id),u=l?.findIndex(a=>a.id===e.id);let c=[],g,h=i?t:s==="desc";if(l!=null&&l.length&&e.getCanMultiSort()&&n?r?g="toggle":g="add":l!=null&&l.length&&u!==l.length-1?g="replace":r?g="toggle":g="replace",g==="toggle"&&(i||s||(g="remove")),g==="add"){var d;c=[...l,{id:e.id,desc:h}],c.splice(0,c.length-((d=o.options.maxMultiSortColCount)!=null?d:Number.MAX_SAFE_INTEGER));}else g==="toggle"?c=l.map(a=>a.id===e.id?{...a,desc:h}:a):g==="remove"?c=l.filter(a=>a.id!==e.id):c=[{id:e.id,desc:h}];return c});},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,s;const i=e.getFirstSortDir(),l=e.getIsSorted();return l?l!==i&&((n=o.options.enableSortingRemoval)==null||n)&&(!(t&&(s=o.options.enableMultiRemove)!=null)||s)?false:l==="desc"?"asc":"desc":i},e.getCanSort=()=>{var t,n;return ((t=e.columnDef.enableSorting)!=null?t:true)&&((n=o.options.enableSorting)!=null?n:true)&&!!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(s=>s.id===e.id);return n?n.desc?"desc":"asc":false},e.getSortIndex=()=>{var t,n;return (t=(n=o.getState().sorting)==null?void 0:n.findIndex(s=>s.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):false));}};},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());}},ro=[bn,Kn,Tn,Nn,En,Vn,Xn,Jn,lo,Gn,Yn,Zn,Qn,$n,Un];function uo(e){var o,t;process.env.NODE_ENV!=="production"&&(e.debugAll||e.debugTable)&&console.info("Creating Table Instance...");const n=[...ro,...(o=e._features)!=null?o:[]];let s={_features:n};const i=s._features.reduce((d,a)=>Object.assign(d,a.getDefaultOptions==null?void 0:a.getDefaultOptions(s)),{}),l=d=>s.options.mergeOptions?s.options.mergeOptions(i,d):{...i,...d};let u={...{},...(t=e.initialState)!=null?t:{}};s._features.forEach(d=>{var a;u=(a=d.getInitialState==null?void 0:d.getInitialState(u))!=null?a:u;});const c=[];let g=false;const h={_features:n,options:{...i,...e},initialState:u,_queue:d=>{c.push(d),g||(g=true,Promise.resolve().then(()=>{for(;c.length;)c.shift()();g=false;}).catch(a=>setTimeout(()=>{throw a})));},reset:()=>{s.setState(s.initialState);},setOptions:d=>{const a=le(d,s.options);s.options=l(a);},getState:()=>s.options.state,setState:d=>{s.options.onStateChange==null||s.options.onStateChange(d);},_getRowId:(d,a,f)=>{var m;return (m=s.options.getRowId==null?void 0:s.options.getRowId(d,a,f))!=null?m:`${f?[f.id,a].join("."):a}`},getCoreRowModel:()=>(s._getCoreRowModel||(s._getCoreRowModel=s.options.getCoreRowModel(s)),s._getCoreRowModel()),getRowModel:()=>s.getPaginationRowModel(),getRow:(d,a)=>{let f=(a?s.getPrePaginationRowModel():s.getRowModel()).rowsById[d];if(!f&&(f=s.getCoreRowModel().rowsById[d],!f))throw process.env.NODE_ENV!=="production"?new Error(`getRow could not find row with ID: ${d}`):new Error;return f},_getDefaultColumnDef:y(()=>[s.options.defaultColumn],d=>{var a;return d=(a=d)!=null?a:{},{header:f=>{const m=f.header.column.columnDef;return m.accessorKey?m.accessorKey:m.accessorFn?m.id:null},cell:f=>{var m,w;return (m=(w=f.renderValue())==null||w.toString==null?void 0:w.toString())!=null?m:null},...s._features.reduce((f,m)=>Object.assign(f,m.getDefaultColumnDef==null?void 0:m.getDefaultColumnDef()),{}),...d}},F(e,"debugColumns","_getDefaultColumnDef")),_getColumnDefs:()=>s.options.columns,getAllColumns:y(()=>[s._getColumnDefs()],d=>{const a=function(f,m,w){return w===void 0&&(w=0),f.map(S=>{const C=In(s,S,w,m),R=S;return C.columns=R.columns?a(R.columns,C,w+1):[],C})};return a(d)},F(e,"debugColumns","getAllColumns")),getAllFlatColumns:y(()=>[s.getAllColumns()],d=>d.flatMap(a=>a.getFlatColumns()),F(e,"debugColumns","getAllFlatColumns")),_getAllFlatColumnsById:y(()=>[s.getAllFlatColumns()],d=>d.reduce((a,f)=>(a[f.id]=f,a),{}),F(e,"debugColumns","getAllFlatColumnsById")),getAllLeafColumns:y(()=>[s.getAllColumns(),s._getOrderColumnsFn()],(d,a)=>{let f=d.flatMap(m=>m.getLeafColumns());return a(f)},F(e,"debugColumns","getAllLeafColumns")),getColumn:d=>{const a=s._getAllFlatColumnsById()[d];return process.env.NODE_ENV!=="production"&&!a&&console.error(`[Table] Column with id '${d}' does not exist.`),a}};Object.assign(s,h);for(let d=0;d<s._features.length;d++){const a=s._features[d];a==null||a.createTable==null||a.createTable(s);}return s}function ao(){return e=>y(()=>[e.options.data],o=>{const t={rows:[],flatRows:[],rowsById:{}},n=function(s,i,l){i===void 0&&(i=0);const r=[];for(let c=0;c<s.length;c++){const g=$e(e,e._getRowId(s[c],c,l),s[c],c,i,void 0,l?.id);if(t.flatRows.push(g),t.rowsById[g.id]=g,r.push(g),e.options.getSubRows){var u;g.originalSubRows=e.options.getSubRows(s[c],c),(u=g.originalSubRows)!=null&&u.length&&(g.subRows=n(g.originalSubRows,i+1,g));}}return r};return t.rows=n(o),t},F(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex()))}function co(e,o,t){return t.options.filterFromLeafRows?go(e,o,t):fo(e,o,t)}function go(e,o,t){var n;const s=[],i={},l=(n=t.options.maxLeafRowFilterDepth)!=null?n:100,r=function(u,c){c===void 0&&(c=0);const g=[];for(let d=0;d<u.length;d++){var h;let a=u[d];const f=$e(t,a.id,a.original,a.index,a.depth,void 0,a.parentId);if(f.columnFilters=a.columnFilters,(h=a.subRows)!=null&&h.length&&c<l){if(f.subRows=r(a.subRows,c+1),a=f,o(a)&&!f.subRows.length){g.push(a),i[a.id]=a,s.push(a);continue}if(o(a)||f.subRows.length){g.push(a),i[a.id]=a,s.push(a);continue}}else a=f,o(a)&&(g.push(a),i[a.id]=a,s.push(a));}return g};return {rows:r(e),flatRows:s,rowsById:i}}function fo(e,o,t){var n;const s=[],i={},l=(n=t.options.maxLeafRowFilterDepth)!=null?n:100,r=function(u,c){c===void 0&&(c=0);const g=[];for(let d=0;d<u.length;d++){let a=u[d];if(o(a)){var h;if((h=a.subRows)!=null&&h.length&&c<l){const m=$e(t,a.id,a.original,a.index,a.depth,void 0,a.parentId);m.subRows=r(a.subRows,c+1),a=m;}g.push(a),s.push(a),i[a.id]=a;}}return g};return {rows:r(e),flatRows:s,rowsById:i}}function ho(){return e=>y(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(o,t,n)=>{if(!o.rows.length||!(t!=null&&t.length)&&!n){for(let d=0;d<o.flatRows.length;d++)o.flatRows[d].columnFilters={},o.flatRows[d].columnFiltersMeta={};return o}const s=[],i=[];(t??[]).forEach(d=>{var a;const f=e.getColumn(d.id);if(!f)return;const m=f.getFilterFn();if(!m){process.env.NODE_ENV!=="production"&&console.warn(`Could not find a valid 'column.filterFn' for column with the ID: ${f.id}.`);return}s.push({id:d.id,filterFn:m,resolvedValue:(a=m.resolveFilterValue==null?void 0:m.resolveFilterValue(d.value))!=null?a:d.value});});const l=(t??[]).map(d=>d.id),r=e.getGlobalFilterFn(),u=e.getAllLeafColumns().filter(d=>d.getCanGlobalFilter());n&&r&&u.length&&(l.push("__global__"),u.forEach(d=>{var a;i.push({id:d.id,filterFn:r,resolvedValue:(a=r.resolveFilterValue==null?void 0:r.resolveFilterValue(n))!=null?a:n});}));let c,g;for(let d=0;d<o.flatRows.length;d++){const a=o.flatRows[d];if(a.columnFilters={},s.length)for(let f=0;f<s.length;f++){c=s[f];const m=c.id;a.columnFilters[m]=c.filterFn(a,m,c.resolvedValue,w=>{a.columnFiltersMeta[m]=w;});}if(i.length){for(let f=0;f<i.length;f++){g=i[f];const m=g.id;if(g.filterFn(a,m,g.resolvedValue,w=>{a.columnFiltersMeta[m]=w;})){a.columnFilters.__global__=true;break}}a.columnFilters.__global__!==true&&(a.columnFilters.__global__=false);}}const h=d=>{for(let a=0;a<l.length;a++)if(d.columnFilters[l[a]]===false)return  false;return  true};return co(o.rows,h,e)},F(e.options,"debugTable","getFilteredRowModel",()=>e._autoResetPageIndex()))}function po(){return e=>y(()=>[e.getState().sorting,e.getPreSortedRowModel()],(o,t)=>{if(!t.rows.length||!(o!=null&&o.length))return t;const n=e.getState().sorting,s=[],i=n.filter(u=>{var c;return (c=e.getColumn(u.id))==null?void 0:c.getCanSort()}),l={};i.forEach(u=>{const c=e.getColumn(u.id);c&&(l[u.id]={sortUndefined:c.columnDef.sortUndefined,invertSorting:c.columnDef.invertSorting,sortingFn:c.getSortingFn()});});const r=u=>{const c=u.map(g=>({...g}));return c.sort((g,h)=>{for(let a=0;a<i.length;a+=1){var d;const f=i[a],m=l[f.id],w=m.sortUndefined,S=(d=f?.desc)!=null?d:false;let C=0;if(w){const R=g.getValue(f.id),P=h.getValue(f.id),E=R===void 0,z=P===void 0;if(E||z){if(w==="first")return E?-1:1;if(w==="last")return E?1:-1;C=E&&z?0:E?w:-w;}}if(C===0&&(C=m.sortingFn(g,h,f.id)),C!==0)return S&&(C*=-1),m.invertSorting&&(C*=-1),C}return g.index-h.index}),c.forEach(g=>{var h;s.push(g),(h=g.subRows)!=null&&h.length&&(g.subRows=r(g.subRows));}),c};return {rows:r(t.rows),flatRows:s,rowsById:t.rowsById}},F(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}function we(...e){const o={};for(let t=0;t<e.length;t++){let n=e[t];if(typeof n=="function"&&(n=n()),n){const s=Object.getOwnPropertyDescriptors(n);for(const i in s)i in o||Object.defineProperty(o,i,{enumerable:true,get(){for(let l=e.length-1;l>=0;l--){let r=e[l];typeof r=="function"&&(r=r());const u=(r||{})[i];if(u!==void 0)return u}}});}}return o}function mo(e){const o=we({state:{},onStateChange(){},renderFallbackValue:null,mergeOptions:(i,l)=>we(i,l)},e),t=uo(o);let n=t.initialState;function s(){t.setOptions(i=>we(i,e,{state:we(n,e.state||{}),onStateChange:l=>{l instanceof Function?n=l(n):n=we(n,l),e.onStateChange?.(l);}}));}return s(),{getRowModel:()=>t.getRowModel(),getHeaderGroups:()=>t.getHeaderGroups(),getColumn:i=>t.getColumn(i)}}function he(e,o,t){let n=t.initialDeps??[],s,i=true;function l(){var r,u,c;let g;t.key&&((r=t.debug)!=null&&r.call(t))&&(g=Date.now());const h=e();if(!(h.length!==n.length||h.some((f,m)=>n[m]!==f)))return s;n=h;let a;if(t.key&&((u=t.debug)!=null&&u.call(t))&&(a=Date.now()),s=o(...h),t.key&&((c=t.debug)!=null&&c.call(t))){const f=Math.round((Date.now()-g)*100)/100,m=Math.round((Date.now()-a)*100)/100,w=m/16,S=(C,R)=>{for(C=String(C);C.length<R;)C=" "+C;return C};console.info(`%c⏱ ${S(m,5)} /${S(f,5)} ms`,`
            font-size: .6rem;
            font-weight: bold;
            color: hsl(${Math.max(0,Math.min(120-120*w,120))}deg 100% 31%);`,t?.key);}return t?.onChange&&!(i&&t.skipInitialOnChange)&&t.onChange(s),i=false,s}return l.updateDeps=r=>{n=r;},l}function vt(e,o){if(e===void 0)throw new Error("Unexpected undefined");return e}const _o=(e,o)=>Math.abs(e-o)<1.01,vo=(e,o,t)=>{let n;return function(...s){e.clearTimeout(n),n=e.setTimeout(()=>o.apply(this,s),t);}},wt=e=>{const{offsetWidth:o,offsetHeight:t}=e;return {width:o,height:t}},wo=e=>e,So=e=>{const o=Math.max(e.startIndex-e.overscan,0),t=Math.min(e.endIndex+e.overscan,e.count-1),n=[];for(let s=o;s<=t;s++)n.push(s);return n},Co=(e,o)=>{const t=e.scrollElement;if(!t)return;const n=e.targetWindow;if(!n)return;const s=l=>{const{width:r,height:u}=l;o({width:Math.round(r),height:Math.round(u)});};if(s(wt(t)),!n.ResizeObserver)return ()=>{};const i=new n.ResizeObserver(l=>{const r=()=>{const u=l[0];if(u?.borderBoxSize){const c=u.borderBoxSize[0];if(c){s({width:c.inlineSize,height:c.blockSize});return}}s(wt(t));};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r();});return i.observe(t,{box:"border-box"}),()=>{i.unobserve(t);}},St={passive:true},Ct=typeof window>"u"?true:"onscrollend"in window,Ro=(e,o)=>{const t=e.scrollElement;if(!t)return;const n=e.targetWindow;if(!n)return;let s=0;const i=e.options.useScrollendEvent&&Ct?()=>{}:vo(n,()=>{o(s,false);},e.options.isScrollingResetDelay),l=g=>()=>{const{horizontal:h,isRtl:d}=e.options;s=h?t.scrollLeft*(d&&-1||1):t.scrollTop,i(),o(s,g);},r=l(true),u=l(false);t.addEventListener("scroll",r,St);const c=e.options.useScrollendEvent&&Ct;return c&&t.addEventListener("scrollend",u,St),()=>{t.removeEventListener("scroll",r),c&&t.removeEventListener("scrollend",u);}},xo=(e,o,t)=>{if(o?.borderBoxSize){const n=o.borderBoxSize[0];if(n)return Math.round(n[t.options.horizontal?"inlineSize":"blockSize"])}return e[t.options.horizontal?"offsetWidth":"offsetHeight"]},yo=(e,{adjustments:o=0,behavior:t},n)=>{var s,i;const l=e+o;(i=(s=n.scrollElement)==null?void 0:s.scrollTo)==null||i.call(s,{[n.options.horizontal?"left":"top"]:l,behavior:t});};class Fo{constructor(o){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=false,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=false,this.lanesSettling=false,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var t,n,s;return ((s=(n=(t=this.targetWindow)==null?void 0:t.performance)==null?void 0:n.now)==null?void 0:s.call(n))??Date.now()},this.observer=(()=>{let t=null;const n=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(s=>{s.forEach(i=>{const l=()=>{const r=i.target,u=this.indexFromElement(r);if(!r.isConnected){this.observer.unobserve(r);return}this.shouldMeasureDuringScroll(u)&&this.resizeItem(u,this.options.measureElement(r,i,this));};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l();});}));return {disconnect:()=>{var s;(s=n())==null||s.disconnect(),t=null;},observe:s=>{var i;return (i=n())==null?void 0:i.observe(s,{box:"border-box"})},unobserve:s=>{var i;return (i=n())==null?void 0:i.unobserve(s)}}})(),this.range=null,this.setOptions=t=>{Object.entries(t).forEach(([n,s])=>{typeof s>"u"&&delete t[n];}),this.options={debug:false,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:false,getItemKey:wo,rangeExtractor:So,onChange:()=>{},measureElement:xo,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:true,isRtl:false,useScrollendEvent:false,useAnimationFrameWithResizeObserver:false,...t};},this.notify=t=>{var n,s;(s=(n=this.options).onChange)==null||s.call(n,this,t);},this.maybeNotify=he(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t);},{key:process.env.NODE_ENV!=="production"&&"maybeNotify",debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null;},this._didMount=()=>()=>{this.cleanup();},this._willUpdate=()=>{var t;const n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n){this.maybeNotify();return}this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s);}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify();})),this.unsubs.push(this.options.observeElementOffset(this,(s,i)=>{this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset()<s?"forward":"backward":null,this.scrollOffset=s,this.isScrolling=i,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify();})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0});}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(t,n)=>{const s=new Map,i=new Map;for(let l=n-1;l>=0;l--){const r=t[l];if(s.has(r.lane))continue;const u=i.get(r.lane);if(u==null||r.end>u.end?i.set(r.lane,r):r.end<u.end&&s.set(r.lane,true),s.size===this.options.lanes)break}return i.size===this.options.lanes?Array.from(i.values()).sort((l,r)=>l.end===r.end?l.index-r.index:l.end-r.end)[0]:void 0},this.getMeasurementOptions=he(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(t,n,s,i,l,r)=>(this.prevLanes!==void 0&&this.prevLanes!==r&&(this.lanesChangedFlag=true),this.prevLanes=r,this.pendingMeasuredCacheIndexes=[],{count:t,paddingStart:n,scrollMargin:s,getItemKey:i,enabled:l,lanes:r}),{key:false}),this.getMeasurements=he(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:t,paddingStart:n,scrollMargin:s,getItemKey:i,enabled:l,lanes:r},u)=>{if(!l)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const d of this.laneAssignments.keys())d>=t&&this.laneAssignments.delete(d);this.lanesChangedFlag&&(this.lanesChangedFlag=false,this.lanesSettling=true,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(d=>{this.itemSizeCache.set(d.key,d.size);}));const c=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=false);const g=this.measurementsCache.slice(0,c),h=new Array(r).fill(void 0);for(let d=0;d<c;d++){const a=g[d];a&&(h[a.lane]=d);}for(let d=c;d<t;d++){const a=i(d),f=this.laneAssignments.get(d);let m,w;if(f!==void 0&&this.options.lanes>1){m=f;const P=h[m],E=P!==void 0?g[P]:void 0;w=E?E.end+this.options.gap:n+s;}else {const P=this.options.lanes===1?g[d-1]:this.getFurthestMeasurement(g,d);w=P?P.end+this.options.gap:n+s,m=P?P.lane:d%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(d,m);}const S=u.get(a),C=typeof S=="number"?S:this.options.estimateSize(d),R=w+C;g[d]={index:d,start:w,size:C,end:R,key:a,lane:m},h[m]=d;}return this.measurementsCache=g,g},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=he(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,n,s,i)=>this.range=t.length>0&&n>0?Mo({measurements:t,outerSize:n,scrollOffset:s,lanes:i}):null,{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:()=>this.options.debug}),this.getVirtualIndexes=he(()=>{let t=null,n=null;const s=this.calculateRange();return s&&(t=s.startIndex,n=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,n]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,n]},(t,n,s,i,l)=>i===null||l===null?[]:t({startIndex:i,endIndex:l,overscan:n,count:s}),{key:process.env.NODE_ENV!=="production"&&"getVirtualIndexes",debug:()=>this.options.debug}),this.indexFromElement=t=>{const n=this.options.indexAttribute,s=t.getAttribute(n);return s?parseInt(s,10):(console.warn(`Missing attribute name '${n}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=t=>{var n;if(!this.scrollState||this.scrollState.behavior!=="smooth")return  true;const s=this.scrollState.index??((n=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:n.index);if(s!==void 0&&this.range){const i=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),l=Math.max(0,s-i),r=Math.min(this.options.count-1,s+i);return t>=l&&t<=r}return  true},this.measureElement=t=>{if(!t){this.elementsCache.forEach((l,r)=>{l.isConnected||(this.observer.unobserve(l),this.elementsCache.delete(r));});return}const n=this.indexFromElement(t),s=this.options.getItemKey(n),i=this.elementsCache.get(s);i!==t&&(i&&this.observer.unobserve(i),this.observer.observe(t),this.elementsCache.set(s,t)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,void 0,this));},this.resizeItem=(t,n)=>{var s;const i=this.measurementsCache[t];if(!i)return;const l=this.itemSizeCache.get(i.key)??i.size,r=n-l;r!==0&&(((s=this.scrollState)==null?void 0:s.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(i,r,this):i.start<this.getScrollOffset()+this.scrollAdjustments)&&(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("correction",r),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=r,behavior:void 0})),this.pendingMeasuredCacheIndexes.push(i.index),this.itemSizeCache=new Map(this.itemSizeCache.set(i.key,n)),this.notify(false));},this.getVirtualItems=he(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,n)=>{const s=[];for(let i=0,l=t.length;i<l;i++){const r=t[i],u=n[r];s.push(u);}return s},{key:process.env.NODE_ENV!=="production"&&"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const n=this.getMeasurements();if(n.length!==0)return vt(n[zt(0,n.length-1,s=>vt(n[s]).start,t)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(t,n,s=0)=>{if(!this.scrollElement)return 0;const i=this.getSize(),l=this.getScrollOffset();n==="auto"&&(n=t>=l+i?"end":"start"),n==="center"?t+=(s-i)/2:n==="end"&&(t-=i);const r=this.getMaxScrollOffset();return Math.max(Math.min(r,t),0)},this.getOffsetForIndex=(t,n="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const s=this.getSize(),i=this.getScrollOffset(),l=this.measurementsCache[t];if(!l)return;if(n==="auto")if(l.end>=i+s-this.options.scrollPaddingEnd)n="end";else if(l.start<=i+this.options.scrollPaddingStart)n="start";else return [i,n];if(n==="end"&&t===this.options.count-1)return [this.getMaxScrollOffset(),n];const r=n==="end"?l.end+this.options.scrollPaddingEnd:l.start-this.options.scrollPaddingStart;return [this.getOffsetForAlignment(r,n,l.size),n]},this.scrollToOffset=(t,{align:n="start",behavior:s="auto"}={})=>{const i=this.getOffsetForAlignment(t,n),l=this.now();this.scrollState={index:null,align:n,behavior:s,startedAt:l,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile();},this.scrollToIndex=(t,{align:n="auto",behavior:s="auto"}={})=>{t=Math.max(0,Math.min(t,this.options.count-1));const i=this.getOffsetForIndex(t,n);if(!i)return;const[l,r]=i,u=this.now();this.scrollState={index:t,align:r,behavior:s,startedAt:u,lastTargetOffset:l,stableFrames:0},this._scrollToOffset(l,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile();},this.scrollBy=(t,{behavior:n="auto"}={})=>{const s=this.getScrollOffset()+t,i=this.now();this.scrollState={index:null,align:"start",behavior:n,startedAt:i,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile();},this.getTotalSize=()=>{var t;const n=this.getMeasurements();let s;if(n.length===0)s=this.options.paddingStart;else if(this.options.lanes===1)s=((t=n[n.length-1])==null?void 0:t.end)??0;else {const i=Array(this.options.lanes).fill(null);let l=n.length-1;for(;l>=0&&i.some(r=>r===null);){const r=n[l];i[r.lane]===null&&(i[r.lane]=r.end),l--;}s=Math.max(...i.filter(r=>r!==null));}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(t,{adjustments:n,behavior:s})=>{this.options.scrollToFn(t,{behavior:s,adjustments:n},this);},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(false);},this.setOptions(o);}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll();}));}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const n=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,s=n?n[0]:this.scrollState.lastTargetOffset,i=1,l=s!==this.scrollState.lastTargetOffset;if(!l&&_o(s,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=i){this.scrollState=null;return}}else this.scrollState.stableFrames=0,l&&(this.scrollState.lastTargetOffset=s,this.scrollState.behavior="auto",this._scrollToOffset(s,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile();}}const zt=(e,o,t,n)=>{for(;e<=o;){const s=(e+o)/2|0,i=t(s);if(i<n)e=s+1;else if(i>n)o=s-1;else return s}return e>0?e-1:0};function Mo({measurements:e,outerSize:o,scrollOffset:t,lanes:n}){const s=e.length-1,i=u=>e[u].start;if(e.length<=n)return {startIndex:0,endIndex:s};let l=zt(0,s,i,t),r=l;if(n===1)for(;r<s&&e[r].end<t+o;)r++;else if(n>1){const u=Array(n).fill(0);for(;r<s&&u.some(g=>g<t+o);){const g=e[r];u[g.lane]=g.end,r++;}const c=Array(n).fill(t+o);for(;l>=0&&c.some(g=>g>=t);){const g=e[l];c[g.lane]=g.start,l--;}l=Math.max(0,l-l%n),r=Math.min(s,r+(n-1-r%n));}return {startIndex:l,endIndex:r}}function Io(e){const o=new Fo({observeElementRect:Co,observeElementOffset:Ro,scrollToFn:yo,...e,onChange:(t,n)=>{n||queueMicrotask(()=>{}),e.onChange?.(t,n);}});return {instance:o,virtualItems:()=>o.getVirtualItems(),totalSize:()=>o.getTotalSize()}}function Rt(e,o){e.component(t=>{let{position:n,coords:s,on_click:i=null}=o,l=n==="column"?s[0]===0:s[1]===0,r=n==="column"?l?"down":"up":l?"right":"left";t.push(`<button${attr_class(`selection-button selection-button-${stringify(n)} ${stringify(l?`move-${r}`:"")}`,"svelte-fit6p6")}${attr("aria-label",`Select ${n}`)}><span${attr_class(clsx(r),"svelte-fit6p6")}><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="svelte-fit6p6"><path d="m16.707 13.293-4-4a1 1 0 0 0-1.414 0l-4 4A1 1 0 0 0 8 15h8a1 1 0 0 0 .707-1.707z"${attr("data-name",r)}></path></svg></span></button>`);});}function bo(e,o){e.component(t=>{let{value:n=false,editable:s=true,on_change:i}=o;function l(g){s&&i(g);}let r=true,u;function c(g){g.push('<div class="bool-cell svelte-1d51ufy" role="button" tabindex="-1">'),x(g,{label:"",interactive:s,on_change:l,get value(){return n},set value(h){n=h,r=false;}}),g.push("<!----></div>");}do r=true,u=t.copy(),c(u);while(!r);t.subsume(u),bind_props(o,{value:n});});}function Ot(e,o){e.component(t=>{let{edit:n,value:s="",display_value:i=null,styling:l="",header:r=false,datatype:u="str",latex_delimiters:c,line_breaks:g=true,editable:h=true,is_static:d=false,max_chars:a=null,components:f={},i18n:m,is_dragging:w=false,wrap_text:S=false,show_selection_buttons:C=false,coords:R,on_select_column:P=null,on_select_row:E=null,el:z=null,onblur:G,onkeydown:O}=o;function se(I,J=null,Ve=false){if(Ve)return String(I);const ue=String(I);return !J||J<=0||ue.length<=J?ue:ue.slice(0,J)+"..."}let te=!n&&a!==null&&a>0,N=h?s:i!==null?i:s,Q=te?se(N,a,u==="image"):N;function ce(I){G?.({blur_event:I,coords:R});}function pe(I){ce({target:{value:s}});}let me=true,_e;function Ee(I){if(n&&u!=="bool"){I.push("<!--[-->"),I.push(`<textarea${attr("readonly",d,true)}${attr("aria-readonly",d)}${attr("aria-label",d?"Cell is read-only":"Edit cell")} tabindex="-1"${attr_class("svelte-odwpey",void 0,{header:r})}>`);const J=escape_html(s);J&&I.push(`${J}`),I.push("</textarea>");}else I.push("<!--[!-->");if(I.push("<!--]--> "),u==="bool"&&typeof s=="boolean")I.push("<!--[-->"),bo(I,{editable:h,on_change:pe,get value(){return s},set value(J){s=J,me=false;}});else {if(I.push("<!--[!-->"),I.push(`<span tabindex="0" role="button"${attr_style(l)}${attr("data-editable",h)}${attr("data-max-chars",a)}${attr("data-expanded",n)} placeholder=" "${attr_class("svelte-odwpey",void 0,{dragging:w,edit:n,expanded:n,multiline:r,text:u==="str",wrap:S})}>`),u==="image"&&f.image){I.push("<!--[-->");const J=f.image;I.push("<!---->"),J(I,{value:{url:Q},show_label:false,label:"cell-image",show_download_button:false,i18n:m,gradio:{dispatch:()=>{}}}),I.push("<!---->");}else I.push("<!--[!-->"),u==="html"?(I.push("<!--[-->"),I.push(`${html(Q)}`)):(I.push("<!--[!-->"),u==="markdown"?(I.push("<!--[-->"),Qt(I,{message:Q.toLocaleString(),latex_delimiters:c,line_breaks:g,chatbot:false})):(I.push("<!--[!-->"),I.push(`${escape_html(Q)}`)),I.push("<!--]-->")),I.push("<!--]-->");I.push("<!--]--></span>");}I.push("<!--]--> "),C&&R&&P&&E?(I.push("<!--[-->"),Rt(I,{position:"column",coords:R,on_click:()=>P(R[1])}),I.push("<!----> "),Rt(I,{position:"row",coords:R,on_click:()=>E(R[0])}),I.push("<!---->")):I.push("<!--[!-->"),I.push("<!--]-->");}do me=true,_e=t.copy(),Ee(_e);while(!me);t.subsume(_e),bind_props(o,{value:s,el:z});});}function Lt(e,o){e.component(t=>{let{on_click:n}=o;t.push('<button aria-label="Open cell menu" class="cell-menu-button svelte-j6wkfp" aria-haspopup="menu">⋮</button>');});}function Eo(e,o){let{size:t=16}=o;e.push(`<div class="wrapper svelte-4dxgzr" aria-label="Static column"><svg xmlns="http://www.w3.org/2000/svg"${attr("width",t)}${attr("height",t)} viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect><path d="M7 11V7a5 5 0 0 1 10 0v4"></path></svg></div>`);}function Vo(e){e.push('<svg viewBox="0 0 24 24" width="20" height="20"><path d="M5 5H19" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path><path d="M8 9H16" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path><path d="M11 13H13" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path></svg>');}function ko(e,o){let{size:t=16}=o;e.push(`<svg${attr("width",t)}${attr("height",t)} viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M4 8L8 4L12 8" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M8 4V12" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path></svg>`);}function Po(e,o){let{size:t=16}=o;e.push(`<svg${attr("width",t)}${attr("height",t)} viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M4 8L8 12L12 8" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M8 12V4" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path></svg>`);}function Ao(e,o){e.component(t=>{let{value:n,col_idx:s,is_editing:i=false,is_selected:l=false,is_static:r=false,sort_direction:u=null,sort_priority:c=null,multi_sort:g=false,is_filtered:h=false,show_menu_button:d=false,is_first_column:a=false,latex_delimiters:f,line_breaks:m=true,editable:w=true,max_chars:S=void 0,i18n:C,on_menu_click:R,on_end_edit:P}=o;t.push(`<th${attr_class("header-cell svelte-1d6xqpb",void 0,{focus:i||l,sorted:u!==null,filtered:h,"first-column":a})}${attr("title",n)}><div class="cell-wrap svelte-1d6xqpb"><div class="header-content svelte-1d6xqpb">`),Ot(t,{value:n,latex_delimiters:f,line_breaks:m,edit:i,onkeydown:E=>{["Enter","Escape","Tab"].includes(E.key)&&P(E.key);},header:true,editable:w,is_static:r,i18n:C,max_chars:S,coords:[s,0]}),t.push("<!----></div> "),u||h||r?(t.push("<!--[-->"),t.push('<span class="header-icons svelte-1d6xqpb">'),h?(t.push("<!--[-->"),t.push('<span class="filter-indicator svelte-1d6xqpb" aria-label="Filtered">'),Vo(t),t.push("<!----></span>")):t.push("<!--[!-->"),t.push("<!--]--> "),u?(t.push("<!--[-->"),t.push(`<span class="sort-indicator svelte-1d6xqpb"${attr("aria-label",`Sorted ${stringify(u)}ending`)}>`),u==="asc"?(t.push("<!--[-->"),ko(t,{size:13})):(t.push("<!--[!-->"),Po(t,{size:13})),t.push("<!--]--> "),g&&c!=null?(t.push("<!--[-->"),t.push(`<span class="sort-priority svelte-1d6xqpb">${escape_html(c)}</span>`)):t.push("<!--[!-->"),t.push("<!--]--></span>")):t.push("<!--[!-->"),t.push("<!--]--> "),r?(t.push("<!--[-->"),Eo(t,{size:11})):t.push("<!--[!-->"),t.push("<!--]--></span>")):t.push("<!--[!-->"),t.push("<!--]--> "),d?(t.push("<!--[-->"),Lt(t,{on_click:E=>R(E,s)})):t.push("<!--[!-->"),t.push("<!--]--></div></th>");});}function Do(e,o){let{value:t,display_value:n=null,datatype:s="str",row_idx:i,col_idx:l,col_style:r="",cell_style:u="",selection_classes:c="",is_editing:g=false,is_flash:h=false,is_static:d=false,show_menu_button:a=false,show_selection_buttons:f=false,is_first_column:m=false,latex_delimiters:w,line_breaks:S=true,editable:C=true,max_chars:R=void 0,i18n:P,components:E={},is_dragging:z=false,wrap_text:G=false,onmousedown:O,ondblclick:se,oncontextmenu:te,onblur:N,on_menu_click:Q,on_select_column:ce,on_select_row:pe}=o;e.push(`<div${attr_class(`body-cell ${stringify(c)}`,"svelte-183k2ki",{flash:h,"first-column":m})}${attr("data-row",i)}${attr("data-col",l)}${attr("data-testid",`cell-${i}-${l}`)}${attr_style(`${stringify(r)} ${stringify(u)}`)}><div class="cell-wrap svelte-183k2ki">`),Ot(e,{value:t,display_value:n,latex_delimiters:w,line_breaks:S,editable:C,is_static:d,edit:g,datatype:s,onblur:N,max_chars:R,i18n:P,components:E,show_selection_buttons:f,coords:[i,l],on_select_column:ce,on_select_row:pe,is_dragging:z,wrap_text:G}),e.push("<!----> "),a?(e.push("<!--[-->"),Lt(e,{on_click:Q})):e.push("<!--[!-->"),e.push("<!--]--></div></div>");}function zo(e,o){e.push('<button class="add-row-button svelte-1at77md" aria-label="Add row">+</button>');}function Oo(e,o){if(e==null)return e;if(o==="number"){const t=Number(e);return isNaN(t)?e:t}if(o==="bool"){if(typeof e=="boolean")return e;if(typeof e=="number")return e!==0;const t=String(e).toLowerCase();return t==="true"||t==="1"?true:t==="false"||t==="0"?false:e}if(o==="date"){const t=new Date(e);return isNaN(t.getTime())?e:t.toISOString()}return e}function $(e,o){let{icon:t}=o;t=="add-column-right"?(e.push("<!--[-->"),e.push('<svg viewBox="0 0 24 24" width="16" height="16"><rect x="4" y="6" width="4" height="12" stroke="currentColor" stroke-width="2" fill="none"></rect><path d="M12 12H19M16 8L19 12L16 16" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round"></path></svg>')):(e.push("<!--[!-->"),t=="add-column-left"?(e.push("<!--[-->"),e.push('<svg viewBox="0 0 24 24" width="16" height="16"><rect x="16" y="6" width="4" height="12" stroke="currentColor" stroke-width="2" fill="none"></rect><path d="M12 12H5M8 8L5 12L8 16" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round"></path></svg>')):(e.push("<!--[!-->"),t=="add-row-above"?(e.push("<!--[-->"),e.push('<svg viewBox="0 0 24 24" width="16" height="16"><rect x="6" y="16" width="12" height="4" stroke="currentColor" stroke-width="2"></rect><path d="M12 12V5M8 8L12 5L16 8" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round"></path></svg>')):(e.push("<!--[!-->"),t=="add-row-below"?(e.push("<!--[-->"),e.push('<svg viewBox="0 0 24 24" width="16" height="16"><rect x="6" y="4" width="12" height="4" stroke="currentColor" stroke-width="2"></rect><path d="M12 12V19M8 16L12 19L16 16" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round"></path></svg>')):(e.push("<!--[!-->"),t=="delete-row"?(e.push("<!--[-->"),e.push('<svg viewBox="0 0 24 24" width="16" height="16"><rect x="5" y="10" width="14" height="4" stroke="currentColor" stroke-width="2"></rect><path d="M8 7L16 17M16 7L8 17" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path></svg>')):(e.push("<!--[!-->"),t=="delete-column"?(e.push("<!--[-->"),e.push('<svg viewBox="0 0 24 24" width="16" height="16"><rect x="10" y="5" width="4" height="14" stroke="currentColor" stroke-width="2"></rect><path d="M7 8L17 16M17 8L7 16" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path></svg>')):(e.push("<!--[!-->"),t=="sort-asc"?(e.push("<!--[-->"),e.push('<svg viewBox="0 0 24 24" width="16" height="16"><path d="M8 16L12 12L16 16" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"></path><path d="M12 12V19" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path><path d="M5 7H19" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path></svg>')):(e.push("<!--[!-->"),t=="sort-desc"?(e.push("<!--[-->"),e.push('<svg viewBox="0 0 24 24" width="16" height="16"><path d="M8 12L12 16L16 12" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"></path><path d="M12 16V9" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path><path d="M5 5H19" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path></svg>')):(e.push("<!--[!-->"),t=="clear-sort"?(e.push("<!--[-->"),e.push('<svg viewBox="0 0 24 24" width="16" height="16"><path d="M5 5H19" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path><path d="M5 9H15" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path><path d="M5 13H11" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path><path d="M5 17H7" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path><path d="M17 17L21 21M21 17L17 21" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path></svg>')):(e.push("<!--[!-->"),t=="filter"?(e.push("<!--[-->"),e.push('<svg viewBox="0 0 24 24" width="16" height="16"><path d="M5 5H19" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path><path d="M8 9H16" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path><path d="M11 13H13" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path></svg>')):(e.push("<!--[!-->"),t=="clear-filter"?(e.push("<!--[-->"),e.push('<svg viewBox="0 0 24 24" width="16" height="16"><path d="M5 5H19" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path><path d="M8 9H16" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path><path d="M11 13H13" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path><path d="M17 17L21 21M21 17L17 21" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path></svg>')):e.push("<!--[!-->"),e.push("<!--]-->")),e.push("<!--]-->")),e.push("<!--]-->")),e.push("<!--]-->")),e.push("<!--]-->")),e.push("<!--]-->")),e.push("<!--]-->")),e.push("<!--]-->")),e.push("<!--]-->")),e.push("<!--]-->")),e.push("<!--]-->");}function Lo(e,o){e.component(t=>{let{x:n,y:s,on_add_row_above:i,on_add_row_below:l,on_add_column_left:r,on_add_column_right:u,row:c,col_count:g,row_count:h,on_delete_row:d,on_delete_col:a,can_delete_rows:f,can_delete_cols:m,on_sort:w=()=>{},on_clear_sort:S=()=>{},sort_direction:C=null,sort_priority:R=null,on_filter:P=()=>{},on_clear_filter:E=()=>{},filter_active:z=null,editable:G=true,i18n:O}=o,se=null,te=c===-1,N=G&&h[1]==="dynamic",Q=G&&g[1]==="dynamic";t.push('<div class="cell-menu svelte-1v4jjjx" role="menu">'),te?(t.push("<!--[-->"),t.push(`<button role="menuitem"${attr_class("svelte-1v4jjjx",void 0,{active:C==="asc"})}>`),$(t,{icon:"sort-asc"}),t.push(`<!----> ${escape_html(O("dataframe.sort_ascending"))} `),C==="asc"&&R!==null?(t.push("<!--[-->"),t.push(`<span class="priority svelte-1v4jjjx">${escape_html(R)}</span>`)):t.push("<!--[!-->"),t.push(`<!--]--></button> <button role="menuitem"${attr_class("svelte-1v4jjjx",void 0,{active:C==="desc"})}>`),$(t,{icon:"sort-desc"}),t.push(`<!----> ${escape_html(O("dataframe.sort_descending"))} `),C==="desc"&&R!==null?(t.push("<!--[-->"),t.push(`<span class="priority svelte-1v4jjjx">${escape_html(R)}</span>`)):t.push("<!--[!-->"),t.push('<!--]--></button> <button role="menuitem" class="svelte-1v4jjjx">'),$(t,{icon:"clear-sort"}),t.push(`<!----> ${escape_html(O("dataframe.clear_sort"))}</button> <button role="menuitem"${attr_class("svelte-1v4jjjx",void 0,{active:z||se})}>`),$(t,{icon:"filter"}),t.push(`<!----> ${escape_html(O("dataframe.filter"))} `),z?(t.push("<!--[-->"),t.push('<span class="priority svelte-1v4jjjx">1</span>')):t.push("<!--[!-->"),t.push('<!--]--></button> <button role="menuitem" class="svelte-1v4jjjx">'),$(t,{icon:"clear-filter"}),t.push(`<!----> ${escape_html(O("dataframe.clear_filter"))}</button>`)):t.push("<!--[!-->"),t.push("<!--]--> "),!te&&N?(t.push("<!--[-->"),t.push('<button role="menuitem" aria-label="Add row above" class="svelte-1v4jjjx">'),$(t,{icon:"add-row-above"}),t.push(`<!----> ${escape_html(O("dataframe.add_row_above"))}</button> <button role="menuitem" aria-label="Add row below" class="svelte-1v4jjjx">`),$(t,{icon:"add-row-below"}),t.push(`<!----> ${escape_html(O("dataframe.add_row_below"))}</button> `),f?(t.push("<!--[-->"),t.push('<button role="menuitem" class="delete svelte-1v4jjjx" aria-label="Delete row">'),$(t,{icon:"delete-row"}),t.push(`<!----> ${escape_html(O("dataframe.delete_row"))}</button>`)):t.push("<!--[!-->"),t.push("<!--]-->")):t.push("<!--[!-->"),t.push("<!--]--> "),Q?(t.push("<!--[-->"),t.push('<button role="menuitem" aria-label="Add column to the left" class="svelte-1v4jjjx">'),$(t,{icon:"add-column-left"}),t.push(`<!----> ${escape_html(O("dataframe.add_column_left"))}</button> <button role="menuitem" aria-label="Add column to the right" class="svelte-1v4jjjx">`),$(t,{icon:"add-column-right"}),t.push(`<!----> ${escape_html(O("dataframe.add_column_right"))}</button> `),m?(t.push("<!--[-->"),t.push('<button role="menuitem" class="delete svelte-1v4jjjx" aria-label="Delete column">'),$(t,{icon:"delete-column"}),t.push(`<!----> ${escape_html(O("dataframe.delete_column"))}</button>`)):t.push("<!--[!-->"),t.push("<!--]-->")):t.push("<!--[!-->"),t.push("<!--]--></div> "),t.push("<!--[!-->"),t.push("<!--]-->");});}function Ho(e$1,o){e$1.component(t=>{let{show_fullscreen_button:n=false,show_copy_button:s=false,show_search:i="none",fullscreen:l=false,on_copy:r,current_search_query:u=null,onfullscreen:c}=o,g=false,h$1;function d(){g=true,h$1&&clearTimeout(h$1),h$1=setTimeout(()=>{g=false;},2e3);}async function a(){await r(),d();}t.push('<div class="toolbar svelte-1rajnm3" role="toolbar" aria-label="Table actions"><div class="toolbar-buttons svelte-1rajnm3">'),i!=="none"?(t.push("<!--[-->"),t.push(`<div class="search-container svelte-1rajnm3"><input type="text"${attr("value",u||"")}${attr("placeholder",i==="filter"?"Filter...":"Search...")}${attr_class("search-input svelte-1rajnm3",void 0,{"filter-mode":i==="filter"})}${attr("title",`Enter text to ${i} the table`)}/> `),u&&i==="filter"?(t.push("<!--[-->"),t.push('<button class="toolbar-button check-button svelte-1rajnm3" aria-label="Apply filter and update dataframe values" title="Apply filter and update dataframe values">'),e(t),t.push("<!----></button>")):t.push("<!--[!-->"),t.push("<!--]--></div>")):t.push("<!--[!-->"),t.push("<!--]--> "),s?(t.push("<!--[-->"),w(t,{Icon:g?e:h,label:g?"Copied to clipboard":"Copy table data",onclick:a})):t.push("<!--[!-->"),t.push("<!--]--> "),n?(t.push("<!--[-->"),k(t,{fullscreen:l,onclick:f=>c?.()})):t.push("<!--[!-->"),t.push("<!--]--></div></div>");});}function jo(e,o){const[t,n]=e;return o.some(([s,i])=>s===t&&i===n)}function Go(e,o){const[t,n]=e;if(!o.some(([u,c])=>u===t&&c===n))return "";const s=o.some(([u,c])=>u===t-1&&c===n),i=o.some(([u,c])=>u===t+1&&c===n),l=o.some(([u,c])=>u===t&&c===n-1),r=o.some(([u,c])=>u===t&&c===n+1);return `cell-selected${s?" no-top":""}${i?" no-bottom":""}${l?" no-left":""}${r?" no-right":""}`}var xt={},Ue={},We=34,Se=10,Ke=13;function Ht(e){return new Function("d","return {"+e.map(function(o,t){return JSON.stringify(o)+": d["+t+'] || ""'}).join(",")+"}")}function To(e,o){var t=Ht(e);return function(n,s){return o(t(n),s,e)}}function yt(e){var o=Object.create(null),t=[];return e.forEach(function(n){for(var s in n)s in o||t.push(o[s]=s);}),t}function q(e,o){var t=e+"",n=t.length;return n<o?new Array(o-n+1).join(0)+t:t}function No(e){return e<0?"-"+q(-e,6):e>9999?"+"+q(e,6):q(e,4)}function qo(e){var o=e.getUTCHours(),t=e.getUTCMinutes(),n=e.getUTCSeconds(),s=e.getUTCMilliseconds();return isNaN(e)?"Invalid Date":No(e.getUTCFullYear())+"-"+q(e.getUTCMonth()+1,2)+"-"+q(e.getUTCDate(),2)+(s?"T"+q(o,2)+":"+q(t,2)+":"+q(n,2)+"."+q(s,3)+"Z":n?"T"+q(o,2)+":"+q(t,2)+":"+q(n,2)+"Z":t||o?"T"+q(o,2)+":"+q(t,2)+"Z":"")}function Uo(e){var o=new RegExp('["'+e+`
\r]`),t=e.charCodeAt(0);function n(h,d){var a,f,m=s(h,function(w,S){if(a)return a(w,S-1);f=w,a=d?To(w,d):Ht(w);});return m.columns=f||[],m}function s(h,d){var a=[],f=h.length,m=0,w=0,S,C=f<=0,R=false;h.charCodeAt(f-1)===Se&&--f,h.charCodeAt(f-1)===Ke&&--f;function P(){if(C)return Ue;if(R)return R=false,xt;var z,G=m,O;if(h.charCodeAt(G)===We){for(;m++<f&&h.charCodeAt(m)!==We||h.charCodeAt(++m)===We;);return (z=m)>=f?C=true:(O=h.charCodeAt(m++))===Se?R=true:O===Ke&&(R=true,h.charCodeAt(m)===Se&&++m),h.slice(G+1,z-1).replace(/""/g,'"')}for(;m<f;){if((O=h.charCodeAt(z=m++))===Se)R=true;else if(O===Ke)R=true,h.charCodeAt(m)===Se&&++m;else if(O!==t)continue;return h.slice(G,z)}return C=true,h.slice(G,f)}for(;(S=P())!==Ue;){for(var E=[];S!==xt&&S!==Ue;)E.push(S),S=P();d&&(E=d(E,w++))==null||a.push(E);}return a}function i(h,d){return h.map(function(a){return d.map(function(f){return g(a[f])}).join(e)})}function l(h,d){return d==null&&(d=yt(h)),[d.map(g).join(e)].concat(i(h,d)).join(`
`)}function r(h,d){return d==null&&(d=yt(h)),i(h,d).join(`
`)}function u(h){return h.map(c).join(`
`)}function c(h){return h.map(g).join(e)}function g(h){return h==null?"":h instanceof Date?qo(h):o.test(h+="")?'"'+h.replace(/"/g,'""')+'"':h}return {parse:n,parseRows:s,format:l,formatBody:r,formatRows:u,formatRow:c,formatValue:g}}async function Wo(e,o){if(!e||!e.length)return;const n=(o||e.flatMap((r,u)=>r.map((c,g)=>[u,g]))).reduce((r,[u,c])=>{r[u]=r[u]||{};const g=String(e[u][c].value);return r[u][c]=g.includes(",")||g.includes('"')||g.includes(`
`)?`"${g.replace(/"/g,'""')}"`:g,r},{}),s=Object.keys(n).sort((r,u)=>+r-+u);if(!s.length)return;const i=Object.keys(n[s[0]]).sort((r,u)=>+r-+u),l=s.map(r=>i.map(u=>n[r][u]||"").join(",")).join(`
`);try{await navigator.clipboard.writeText(l);}catch(r){throw new Error("Failed to copy to clipboard: "+r.message)}}function Ko(e,o){return o.filter(t);function t(n){var s=-1;return e.split(`
`).every(i);function i(l){if(!l)return  true;var r=l.split(n).length;return s<0&&(s=r),s===r&&r>1}}}function Xo(e){const o=atob(e.split(",")[1]),t=e.split(",")[0].split(":")[1].split(";")[0],n=new ArrayBuffer(o.length),s=new Uint8Array(n);for(let i=0;i<o.length;i++)s[i]=o.charCodeAt(i);return new Blob([n],{type:t})}function Jo(e,o,t){const n=Xo(e),s=new FileReader;s.addEventListener("loadend",i=>{if(!i?.target?.result||typeof i.target.result!="string")return;const[l]=Ko(i.target.result,[",","	"]),[r,...u]=Uo(l).parseRows(i.target.result);o(r),t(u);}),s.readAsText(n);}function Yo(e,o,t){const{dtype:n,filter:s,value:i}=t,l=String(e.getValue(o)??""),r=i??"";if(n==="number"){const g=parseFloat(l),h=parseFloat(r);if(isNaN(g)||isNaN(h))return s==="Is empty"?l.trim()==="":s==="Is not empty"?l.trim()!=="":true;switch(s){case "=":return g===h;case "≠":return g!==h;case ">":return g>h;case "<":return g<h;case "≥":return g>=h;case "≤":return g<=h;case "Is empty":return l.trim()==="";case "Is not empty":return l.trim()!=="";default:return  true}}const u=l.toLowerCase(),c=r.toLowerCase();switch(s){case "Contains":return u.includes(c);case "Does not contain":return !u.includes(c);case "Starts with":return u.startsWith(c);case "Ends with":return u.endsWith(c);case "Is":return u===c;case "Is not":return u!==c;case "Is empty":return l.trim()==="";case "Is not empty":return l.trim()!=="";default:return  true}}function Zo(e){let o=[],t=0,n=0,s=[],i=(()=>{if(!e.show_row_numbers())return 0;const r=e.header_row_el();return r?r.querySelector(".row-number-header")?.getBoundingClientRect().width??48:0})();function l(r){if(o[r]!==void 0)return `width: ${o[r]}px; flex: 0 0 ${o[r]}px;`;const u=e.column_widths();return u[r]?`width: ${u[r]};`:"width: 150px;"}return {get col_widths(){return o},get col_lefts(){return s},get total_header_width(){return t},get header_height(){return n},get row_num_width(){return i},get_col_style:l}}function Qo(e,o){e.component(t=>{let{datatype:n,label:s=null,show_label:i=true,headers:l=[],values:r=[],col_count:u,row_count:c,latex_delimiters:g,components:h={},editable:d=true,wrap:a=false,root:f,i18n:m,max_height:w=500,line_breaks:S=true,column_widths:C=[],show_row_numbers:R=false,upload:P,stream_handler:E,buttons:z=null,value_is_output:G=false,max_chars:O=void 0,show_search:se="none",pinned_columns:te=0,static_columns:N=[],fullscreen:Q=false,display_value:ce=null,styling:pe=null,onchange:me,oninput:_e,onselect:Ee,onedit:I,onsearch:J,onfullscreen:Ve}=o,ue=(r??[]).map((p,_)=>{const x={_index:_};return (p??[]).forEach((M,b)=>{const A=Array.isArray(n)?n[b]:n;x[`col_${b}`]=Oo(M,A);}),x}),de=(()=>{let p=l??[];return u[1]==="fixed"&&p.length<u[0]&&(p=[...p,...Array(u[0]-p.length).fill(null).map((_,x)=>`${x+p.length}`)]),p.length||(p=Array(u[0]).fill(null).map((_,x)=>`${x}`)),p.map(_=>_??"")})(),ot=de.map((p,_)=>({id:`col_${_}`,accessorKey:`col_${_}`,header:p,size:C[_]&&parseInt(C[_])||150,minSize:45,filterFn:Yo,meta:{colIndex:_,datatype:Array.isArray(n)?n[_]:n,isStatic:N.includes(_)||N.includes(p),isPinned:_<te}})),U=[],ne=[],Re="",jt={left:ot.filter((p,_)=>_<te).map(p=>p.id)};const st=mo({get data(){return ue},get columns(){return ot},state:{get sorting(){return U},get columnFilters(){return ne},get globalFilter(){return Re},get columnPinning(){return jt}},onSortingChange:p=>{U=typeof p=="function"?p(U):p;},onColumnFiltersChange:p=>{ne=typeof p=="function"?p(ne):p;},onGlobalFilterChange:p=>{Re=typeof p=="function"?p(Re):p;},getCoreRowModel:ao(),getSortedRowModel:po(),getFilteredRowModel:ho(),globalFilterFn:"includesString",enableSorting:true,enableMultiSort:true,maxMultiSortColCount:3});let ge=st.getRowModel().rows,Gt=st.getHeaderGroups(),Bt;const it=Io({get count(){return ge.length},getScrollElement:()=>Bt,estimateSize:()=>35,overscan:10,measureElement:(p,_,x)=>{const M=p.getBoundingClientRect().height;if(M>0)return M;const b=p.getAttribute("data-index");if(b!=null){const A=x.itemSizeCache?.get(Number(b));if(typeof A=="number")return A}return 35}});let Tt=it.virtualItems(),Nt=it.totalSize(),L=[],oe=false,ae=false,xe=false,ke=false,H=null,V=null,Pe=false,lt=false,rt=false,ut;function at(p){return Array.isArray(n)?n[p]??"str":n}function qt(p,_){return ce?.[p]?.[_]!==void 0?ce[p][_]:String(r?.[p]?.[_]??"")}function Ut(p,_){return pe?.[p]?.[_]??""}function fe(p,_){me?.({data:p??r,headers:_??de,metadata:null}),G||_e?.(),G=false;}function Wt(p,_,x){p.preventDefault(),p.stopPropagation();const M=[_,x];if(p.shiftKey&&oe){const[b,A]=oe,[k,B]=M,D=[];for(let W=Math.min(b,k);W<=Math.max(b,k);W++)for(let j=Math.min(A,B);j<=Math.max(A,B);j++)D.push([W,j]);L=D;}else p.metaKey||p.ctrlKey?L=L.some(([A,k])=>A===_&&k===x)?L.filter(([A,k])=>!(A===_&&k===x)):[...L,M]:L=[M];oe=M,xe=false,ke=false,H=null,V=null,ae=false,Ee?.({index:M,value:r?.[_]?.[x],row_value:r?.[_]??[],col_value:r?.map(b=>b[x])??[]}),tick().then(()=>ut?.focus());}function Kt(p,_,x){if(p.preventDefault(),p.stopPropagation(),!d)return;N.includes(x)||N.includes(de[x])||(ae=[_,x]);}function Xt(p){const{coords:_}=p,x=p.blur_event.target;if(!x||x.value===void 0)return;const[M,b]=_,A=r?.[M]?.[b],k=x.value;if(String(A)!==String(k)){const B=r.map(D=>[...D]);B[M][b]=k,r=B,I?.({index:[M,b],value:k,previous_value:String(A??"")}),fe(B);}}function Jt(p){["Escape","Enter","Tab"].includes(p)&&(xe=false);}function Yt(p,_){if(p.stopPropagation(),V?.col===_)V=null;else {const x=p.target.closest("th");if(x){const M=x.getBoundingClientRect();V={col:_,x:M.right,y:M.bottom};}}}function Zt(p,_){const x=`col_${p}`,M=_==="desc",b=U.findIndex(A=>A.id===x);b>=0&&U[b].desc===M?U=U.filter(A=>A.id!==x):U=[...U.filter(A=>A.id!==x),{id:x,desc:M}].slice(-3);}function Qt(){U=[];}function $t(p,_,x,M){const b=`col_${p}`;ne.findIndex(k=>k.id===b)>=0?ne=ne.filter(k=>k.id!==b):ne=[...ne,{id:b,value:{dtype:_,filter:x,value:M}}];}function en(){ne=[];}function tn(p){if(c[1]!=="dynamic")return;const _=r[0]?.length||de.length||1,x=Array(_).fill(""),M=[...r];p!==void 0?M.splice(p,0,x):M.push(x),r=M,fe(M),oe=[p??M.length-1,0];}function nn(p){if(u[1]!=="dynamic")return;const _=[...l??[],`Header ${(l?.length??0)+1}`],x=r.map(M=>[...M,""]);p!==void 0&&(_.splice(p,0,_.pop()),x.forEach(M=>M.splice(p,0,M.pop()))),r=x,l=_,fe(x,_);}function on(p){r.length<=1||(r=[...r.slice(0,p),...r.slice(p+1)],fe(r),H=null,V=null);}function sn(p){u[1]==="dynamic"&&((r[0]?.length??0)<=1||(r=r.map(_=>[..._.slice(0,p),..._.slice(p+1)]),l=[...(l??[]).slice(0,p),...(l??[]).slice(p+1)],fe(r,l),H=null,V=null,oe=false,L=[],ae=false));}function ct(p,_){tn(_==="above"?p:p+1),H=null;}function dt(p,_){nn(_==="left"?p:p+1),H=null;}async function ln(){const p=r.map(x=>x.map((M,b)=>({id:`${b}`,value:M}))),_=L.length>0?L:null;await Wo(p,_),Pe=true,setTimeout(()=>Pe=false,800);}function ft(p,_,x){if(p.stopPropagation(),H?.row===_&&H.col===x)H=null;else {const M=p.target.closest(".body-cell, td");if(M){const b=M.getBoundingClientRect();H={row:_,col:x,x:b.right,y:b.bottom};}}}function rn(p){Jo(typeof p=="string"?p:p?.data??"",_=>(l=_.map(x=>x??""),l.map((x,M)=>({id:`h_${M}`,value:x}))),_=>{r=_,fe(_,l);});}let un,an;const Ae=Zo({header_row_el:()=>un,header_table_el:()=>an,resolved_headers:()=>de,row_data:()=>ue,show_row_numbers:()=>R,column_widths:()=>C,on_resize:void 0});let cn=H!==null||V!==null;oe!==false&&oe[0];function ye(p){const _=`col_${p}`,x=U.findIndex(M=>M.id===_);return x===-1?{direction:null,priority:null}:{direction:U[x].desc?"desc":"asc",priority:x+1}}function ht(p){return ne.some(_=>_.id===`col_${p}`)}let De=true,ze;function dn(p){p.push(`<div${attr_class("table-container svelte-2balj6",void 0,{fullscreen:Q})}>`),s&&s.length!==0&&i||(z===null||z.includes("fullscreen"))||(z===null||z.includes("copy"))||se!=="none"?(p.push("<!--[-->"),p.push('<div class="header-row svelte-2balj6">'),s&&s.length!==0&&i?(p.push("<!--[-->"),p.push(`<div class="label svelte-2balj6"><p class="svelte-2balj6">${escape_html(s)}</p></div>`)):p.push("<!--[!-->"),p.push("<!--]--> "),Ho(p,{show_fullscreen_button:z===null?true:z.includes("fullscreen"),fullscreen:Q,on_copy:ln,show_copy_button:z===null?true:z.includes("copy"),show_search:se,onfullscreen:Ve,current_search_query:Re||null}),p.push("<!----></div>")):p.push("<!--[!-->"),p.push(`<!--]--> <div${attr_class("table-wrap svelte-2balj6",void 0,{dragging:lt,"no-wrap":!a,"menu-open":H||V})} role="grid" tabindex="0">`),ee$1(p,{upload:P,stream_handler:E,flex:false,center:false,boundedheight:false,disable_click:true,root:f,onload:rn,aria_label:m("dataframe.drop_to_upload"),get dragging(){return rt},set dragging(_){rt=_,De=false;},children:_=>{_.push(`<div${attr_class("virtual-table-viewport svelte-2balj6",void 0,{"disable-scroll":cn})}${attr_style(`max-height: ${stringify(w)}px;`)} role="grid">`),s&&s.length!==0?(_.push("<!--[-->"),_.push(`<span class="sr-only svelte-2balj6">${escape_html(s)}</span>`)):_.push("<!--[!-->"),_.push('<!--]--> <table class="header-table svelte-2balj6"><thead class="svelte-2balj6"><tr class="svelte-2balj6">'),R?(_.push("<!--[-->"),_.push('<th class="row-number-header svelte-2balj6"> </th>')):_.push("<!--[!-->"),_.push("<!--]--><!--[-->");const x=ensure_array_like(Gt);for(let b=0,A=x.length;b<A;b++){let k=x[b];_.push("<!--[-->");const B=ensure_array_like(k.headers);for(let D=0,W=B.length;D<W;D++){let j=B[D];const Y=j.column.columnDef.meta?.colIndex??0;Ao(_,{value:String(j.column.columnDef.header??""),col_idx:Y,is_editing:xe===Y,is_selected:ke===Y,is_static:!!j.column.columnDef.meta?.isStatic,sort_direction:ye(Y).direction,sort_priority:ye(Y).priority,multi_sort:U.length>1,is_filtered:ht(Y),show_menu_button:u[1]==="dynamic",is_first_column:Y===0&&!R,latex_delimiters:g,line_breaks:S,editable:d,max_chars:O,i18n:m,on_menu_click:Yt,on_end_edit:Jt});}_.push("<!--]-->");}if(_.push('<!--]--></tr></thead><tbody class="sizing-body svelte-2balj6" aria-hidden="true">'),ge.length>0){_.push("<!--[-->");const b=ge.reduce((k,B)=>(B.getVisibleCells().forEach((W,j)=>{const Y=String(W.getValue()??"");(!k[j]||Y.length>k[j].length)&&(k[j]=Y);}),k),[]);_.push('<tr class="svelte-2balj6">'),R?(_.push("<!--[-->"),_.push(`<td class="row-number-cell svelte-2balj6">${escape_html(ge.length)}</td>`)):_.push("<!--[!-->"),_.push("<!--]--><!--[-->");const A=ensure_array_like(b);for(let k=0,B=A.length;k<B;k++){let D=A[k];const W=at(k);_.push('<td class="svelte-2balj6"><div class="cell-wrap svelte-2balj6">'),W==="html"||W==="markdown"?(_.push("<!--[-->"),_.push(`${html(D)}`)):(_.push("<!--[!-->"),_.push(`${escape_html(D)}`)),_.push("<!--]--></div></td>");}_.push("<!--]--></tr>");}else _.push("<!--[!-->");_.push(`<!--]--></tbody></table> <div class="virtual-body svelte-2balj6"${attr_style(`height: ${stringify(Nt)}px; position: relative; flex-shrink: 0; width: ${stringify("100%")};`)}><!--[-->`);const M=ensure_array_like(Tt);for(let b=0,A=M.length;b<A;b++){let k=M[b];const B=ge[k.index],D=B?.original._index??k.index;if(B){_.push("<!--[-->"),_.push(`<div${attr_class("virtual-row svelte-2balj6",void 0,{"row-odd":k.index%2!==0})}${attr("data-index",k.index)}${attr_style(`position: absolute; top: 0; left: 0; width: 100%; transform: translateY(${stringify(k.start)}px);${stringify(L.some(([j])=>j===D)?" z-index: 3;":"")}`)}>`),R?(_.push("<!--[-->"),_.push(`<div class="row-number-cell svelte-2balj6"${attr("data-row",D)} data-col="row-number"${attr_style(`flex: 0 0 ${stringify(Ae.row_num_width)}px; width: ${stringify(Ae.row_num_width)}px;`)}>${escape_html(D+1)}</div>`)):_.push("<!--[!-->"),_.push("<!--]--> <!--[-->");const W=ensure_array_like(B.getVisibleCells());for(let j=0,Y=W.length;j<Y;j++){let Oe=W[j];const K=Oe.column.columnDef.meta?.colIndex??0,gn=jo([D,K],L);Do(_,{value:Oe.getValue(),display_value:qt(D,K),datatype:at(K),row_idx:D,col_idx:K,col_style:Ae.get_col_style(j),cell_style:Ut(D,K),selection_classes:Go([D,K],L),is_editing:!!(ae&&ae[0]===D&&ae[1]===K),is_flash:Pe&&gn,is_static:!!Oe.column.columnDef.meta?.isStatic,show_menu_button:d&&L.length===1&&L[0][0]===D&&L[0][1]===K,show_selection_buttons:L.length===1&&L[0][0]===D&&L[0][1]===K,is_first_column:j===0&&!R,latex_delimiters:g,line_breaks:S,editable:d,max_chars:O,i18n:m,components:h,is_dragging:lt,wrap_text:a,onmousedown:Z=>Wt(Z,D,K),ondblclick:Z=>Kt(Z,D,K),oncontextmenu:Z=>{Z.preventDefault(),ft(Z,D,K);},onblur:Xt,on_menu_click:Z=>ft(Z,D,K),on_select_column:Z=>{L=ge.map((fn,Le)=>[Le,Z]),oe=L[0];},on_select_row:Z=>{L=de.map((fn,Le)=>[Z,Le]),oe=L[0];}});}_.push("<!--]--></div>");}else _.push("<!--[!-->");_.push("<!--]-->");}_.push("<!--]--></div></div>");},$$slots:{default:true}}),p.push("<!----> "),p.push("<!--[!-->"),p.push("<!--]--></div></div> "),H||V?(p.push("<!--[-->"),Lo(p,{x:H?.x??V?.x??0,y:H?.y??V?.y??0,row:V?-1:H?.row??0,col_count:u,row_count:c,on_add_row_above:()=>ct(H?.row??-1,"above"),on_add_row_below:()=>ct(H?.row??-1,"below"),on_add_column_left:()=>dt(H?.col??V?.col??-1,"left"),on_add_column_right:()=>dt(H?.col??V?.col??-1,"right"),on_delete_row:()=>on(H?.row??-1),on_delete_col:()=>sn(H?.col??V?.col??-1),editable:d,can_delete_rows:!V&&r.length>1&&d,can_delete_cols:r.length>0&&(r[0]?.length??0)>1&&d,i18n:m,on_sort:V?_=>{Zt(V.col,_),V=null;}:void 0,on_clear_sort:V?()=>{Qt(),V=null;}:void 0,sort_direction:V?ye(V.col).direction:null,sort_priority:V?ye(V.col).priority:null,on_filter:V?(_,x,M)=>{$t(V.col,_,x,M),V=null;}:void 0,on_clear_filter:V?()=>{en(),V=null;}:void 0,filter_active:V?ht(V.col):null})):p.push("<!--[!-->"),p.push("<!--]--> "),r.length===0&&d&&c[1]==="dynamic"?(p.push("<!--[-->"),zo(p)):p.push("<!--[!-->"),p.push("<!--]-->");}do De=true,ze=t.copy(),dn(ze);while(!De);t.subsume(ze),bind_props(o,{headers:l,values:r,value_is_output:G});});}function _s(e,o){e.component(t=>{let{$$slots:n,$$events:s,...i}=o;const l=new $$1(i);let r=l.props.fullscreen??false,u=(()=>{const f=l.props.datatype;if(!Array.isArray(f))return f;const m=l.props.headers,w=l.props.value?.headers;if(!m||!w)return f;const S=new Map;for(let C=0;C<Math.min(m.length,f.length);C++)S.set(m[C],f[C]);return w.map((C,R)=>S.get(C)??f[R]??"str")})(),c=l.props.value?JSON.stringify(l.props.value):null;function g(f){l.props.value=f;const m=JSON.stringify(f);m!==c&&(c=m,l.dispatch("change",f));}function h(){l.dispatch("input");}function d(f){l.dispatch("select",f);}function a(f){l.dispatch("edit",f);}G(t,{visible:l.shared.visible,elem_id:l.shared.elem_id,elem_classes:l.shared.elem_classes,scale:l.shared.scale,min_width:l.shared.min_width,padding:false,container:false,overflow_behavior:"visible",fullscreen:r,children:f=>{W(f,spread_props([{autoscroll:l.shared.autoscroll,i18n:l.i18n},l.shared.loading_status])),f.push("<!----> "),Qo(f,{headers:l.props.value?.headers??[],values:l.props.value?.data??[],display_value:l.props.value?.metadata?.display_value??null,styling:l.props.value?.metadata?.styling??null,col_count:l.props.col_count,row_count:l.props.row_count,label:l.shared.label,show_label:l.shared.show_label,wrap:l.props.wrap,datatype:u,latex_delimiters:l.props.latex_delimiters,max_height:l.props.max_height,editable:l.shared.interactive??true,line_breaks:l.props.line_breaks,column_widths:l.props.column_widths??[],root:l.shared.root,i18n:l.i18n,upload:l.shared.client?.upload,stream_handler:l.shared.client?.stream,buttons:l.props.buttons,max_chars:l.props.max_chars,show_row_numbers:l.props.show_row_numbers,show_search:l.props.show_search,pinned_columns:l.props.pinned_columns,static_columns:l.props.static_columns??[],fullscreen:r,onfullscreen:()=>{r=!r;},onchange:g,oninput:h,onselect:d,onedit:a}),f.push("<!---->");},$$slots:{default:true}});});}

export { Qo as BaseDataFrame, _s as default };
//# sourceMappingURL=Index55-Dt0Om_Eh.js.map
