ai-station/.venv/lib/python3.12/site-packages/chainlit/frontend/dist/assets/Dataframe-uiKzdzgd.js

24 lines
53 KiB
JavaScript
Raw Normal View History

import{r as E,u as he,j as h,L as _e,A as Fe,a as $e,b as xe,P as j,c as ve,T as Pe,d as Me,e as B,f as Ve,g as Ie,h as re,i as ye,k as Ee,l as De,m as He}from"./index-D9fGsswH.js";/**
* table-core
*
* Copyright (c) TanStack
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/function I(e,o){return typeof e=="function"?e(o):e}function v(e,o){return n=>{o.setState(t=>({...t,[e]:I(n,t[e])}))}}function O(e){return e instanceof Function}function Ae(e){return Array.isArray(e)&&e.every(o=>typeof o=="number")}function Ge(e,o){const n=[],t=i=>{i.forEach(r=>{n.push(r);const l=o(r);l!=null&&l.length&&t(l)})};return t(e),n}function m(e,o,n){let t=[],i;return r=>{let l;n.key&&n.debug&&(l=Date.now());const u=e(r);if(!(u.length!==t.length||u.some((d,c)=>t[c]!==d)))return i;t=u;let a;if(n.key&&n.debug&&(a=Date.now()),i=o(...u),n==null||n.onChange==null||n.onChange(i),n.key&&n.debug&&n!=null&&n.debug()){const d=Math.round((Date.now()-l)*100)/100,c=Math.round((Date.now()-a)*100)/100,f=c/16,g=(p,S)=>{for(p=String(p);p.length<S;)p=" "+p;return p};console.info(`%c ${g(c,5)} /${g(d,5)} ms`,`
font-size: .6rem;
font-weight: bold;
color: hsl(${Math.max(0,Math.min(120-120*f,120))}deg 100% 31%);`,n==null?void 0:n.key)}return i}}function C(e,o,n,t){return{debug:()=>{var i;return(i=e==null?void 0:e.debugAll)!=null?i:e[o]},key:!1,onChange:t}}function ze(e,o,n,t){const i=()=>{var l;return(l=r.getValue())!=null?l:e.options.renderFallbackValue},r={id:`${o.id}_${n.id}`,row:o,column:n,getValue:()=>o.getValue(t),renderValue:i,getContext:m(()=>[e,n,o,r],(l,u,s,a)=>({table:l,column:u,row:s,cell:a,getValue:a.getValue,renderValue:a.renderValue}),C(e.options,"debugCells"))};return e._features.forEach(l=>{l.createCell==null||l.createCell(r,n,o,e)},{}),r}function Le(e,o,n,t){var i,r;const u={...e._getDefaultColumnDef(),...o},s=u.accessorKey;let a=(i=(r=u.id)!=null?r:s?typeof String.prototype.replaceAll=="function"?s.replaceAll(".","_"):s.replace(/\./g,"_"):void 0)!=null?i:typeof u.header=="string"?u.header:void 0,d;if(u.accessorFn?d=u.accessorFn:s&&(s.includes(".")?d=f=>{let g=f;for(const S of s.split(".")){var p;g=(p=g)==null?void 0:p[S]}return g}:d=f=>f[u.accessorKey]),!a)throw new Error;let c={id:`${String(a)}`,accessorFn:d,parent:t,depth:n,columnDef:u,columns:[],getFlatColumns:m(()=>[!0],()=>{var f;return[c,...(f=c.columns)==null?void 0:f.flatMap(g=>g.getFlatColumns())]},C(e.options,"debugColumns")),getLeafColumns:m(()=>[e._getOrderColumnsFn()],f=>{var g;if((g=c.columns)!=null&&g.length){let p=c.columns.flatMap(S=>S.getLeafColumns());return f(p)}return[c]},C(e.options,"debugColumns"))};for(const f of e._features)f.createColumn==null||f.createColumn(c,e);return c}const $="debugHeaders";function le(e,o,n){var t;let r={id:(t=n.id)!=null?t:o.id,column:o,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const l=[],u=s=>{s.subHeaders&&s.subHeaders.length&&s.subHeaders.map(u),l.push(s)};return u(r),l},getContext:()=>({table:e,header:r,column:o})};return e._features.forEach(l=>{l.createHeader==null||l.createHeader(r,e)}),r}const Oe={createTable:e=>{e.getHeaderGroups=m(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(o,n,t,i)=>{var r,l;const u=(r=t==null?void 0:t.map(c=>n.find(f=>f.id===c)).filter(Boolean))!=null?r:[],s=(l=i==null?void 0:i.map(c=>n.find(f=>f.id===c)).filter(Boolean))!=null?l:[],a=n.filter(c=>!(t!=null&&t.includes(c.id))&&!(i!=null&&i.includes(c.id)));return G(o,[...u,...a,...s],e)},C(e.options,$)),e.getCenterHeaderGroups=m(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(o,n,t,i)=>(n=n.filter(r=>!(t!=null&&t.includes(r.id))&&!(i!=null&&i.includes(r.id))),G(o,n,e,"center")),C(e.options,$)),e.getLeftHeaderGroups=m(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(o,n,t)=>{var i;const r=(i=t==null?void 0:t.map(l=>n.find(u=>u.id===l)).filter(Boolean))!=null?i:[];return G(o,r,e,"left")},C(e.options,$)),e.getRightHeaderGroups=m(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(o,n,t)=>{var i;const r=(i=t==null?void 0:t.map(l=>n.find(u=>u.id===l)).filter(Boolean))!=null?i:[];return G(o,r,e,"right")},C(e.options,$)),e.getFooterGroups=m(()=>[e.getHeaderGroups()],o=>[...o].reverse(),C(e.options,$)),e.getLeftFooterGroups=m(()=>[e.getLeftHeaderGroups()],o=>[...o].reverse(),C(e.options,$)),e.getCenterFooterGroups=m(()=>[e.getCenterHeaderGroups()],o=>[...o].reverse(),C(e.options,$)),e.getRightFooterGroups=m(()=>[e.getRightHeaderGroups()],o=>[...o].reverse(),C(e.options,$)),e.getFlatHeaders=m(()=>[e.getHeaderGroups()],o=>o.map(n=>n.headers).flat(),C(e.options,$)),e.getLeftFlatHeaders=m(()=>[e.getLeftHeaderGroups()],o=>o.map(n=>n.headers).flat(),C(e.options,$)),e.getCenterFlatHeaders=m(()=>[e.getCenterHeaderGroups()],o=>o.map(n=>n.headers).flat(),C(e.options,$)),e.getRightFlatHeaders=m(()=>[e.getRightHeaderGroups()],o=>o.map(n=>n.headers).flat(),C(e.options,$)),e.getCenterLeafHeaders=m(()=>[e.getCenterFlatHeaders()],o=>o.filter(n=>{var t;return!((t=n
* react-table
*
* Copyright (c) TanStack
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/function se(e,o){return e?xn(e)?E.createElement(e,o):e:null}function xn(e){return vn(e)||typeof e=="function"||Pn(e)}function vn(e){return typeof e=="function"&&(()=>{const o=Object.getPrototypeOf(e);return o.prototype&&o.prototype.isReactComponent})()}function Pn(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function Mn(e){const o={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=E.useState(()=>({current:wn(o)})),[t,i]=E.useState(()=>n.current.initialState);return n.current.setOptions(r=>({...r,...e,state:{...t,...e.state},onStateChange:l=>{i(l),e.onStateChange==null||e.onStateChange(l)}})),n.current}const Vn=({data:e})=>{var s;const{index:o,columns:n,data:t}=e,i=E.useMemo(()=>n.map(a=>({accessorKey:a,header:({column:d})=>{const c=d.getIsSorted();return h.jsxs("div",{className:"flex items-center cursor-pointer",onClick:()=>d.toggleSorting(),children:[a,c==="asc"&&h.jsx($e,{className:"ml-2 !size-3"}),c==="desc"&&h.jsx(xe,{className:"ml-2 !size-3"})]})}})),[n]),r=E.useMemo(()=>t.map((a,d)=>{const c={id:o[d]};return n.forEach((f,g)=>{c[f]=a[g]}),c}),[t,n,o]),l=Mn({data:r,columns:i,getCoreRowModel:hn(),getPaginationRowModel:Fn(),getSortedRowModel:$n(),initialState:{pagination:{pageSize:10}}}),u=E.useCallback(()=>Array.from({length:l.getPageCount()},(a,d)=>h.jsx(j,{children:h.jsx(ve,{onClick:()=>l.setPageIndex(d),isActive:l.getState().pagination.pageIndex===d,children:d+1})},d)),[l.getPageCount(),l.getState().pagination.pageIndex]);return h.jsxs("div",{className:"flex flex-col gap-2 h-full overflow-y-auto dataframe",children:[h.jsx("div",{className:"rounded-md border overflow-y-auto",children:h.jsxs(Pe,{children:[h.jsx(Me,{children:l.getHeaderGroups().map(a=>h.jsx(B,{children:a.headers.map(d=>h.jsx(Ve,{children:d.isPlaceholder?null:se(d.column.columnDef.header,d.getContext())},d.id))},a.id))}),h.jsx(Ie,{children:(s=l.getRowModel().rows)!=null&&s.length?l.getRowModel().rows.map(a=>h.jsx(B,{children:a.getVisibleCells().map(d=>h.jsx(re,{children:se(d.column.columnDef.cell,d.getContext())},d.id))},a.id)):h.jsx(B,{children:h.jsx(re,{colSpan:n.length,className:"h-24 text-center",children:"No results."})})})]})}),h.jsx(ye,{children:h.jsxs(Ee,{className:"ml-auto",children:[h.jsx(j,{children:h.jsx(De,{onClick:()=>l.previousPage(),className:l.getCanPreviousPage()?"cursor-pointer":"pointer-events-none opacity-50"})}),u(),h.jsx(j,{children:h.jsx(He,{onClick:()=>l.nextPage(),className:l.getCanNextPage()?"cursor-pointer":"pointer-events-none opacity-50"})})]})})]})};function yn({element:e}){const{data:o,isLoading:n,error:t}=he(e.url||null),i=E.useMemo(()=>{if(o)return JSON.parse(o)},[o]);return n?h.jsx("div",{className:"flex items-center justify-center h-full w-full bg-muted",children:h.jsx(_e,{})}):t?h.jsx(Fe,{variant:"error",children:t.message}):h.jsx(Vn,{data:i})}export{yn as default};
//# sourceMappingURL=Dataframe-uiKzdzgd.js.map