import{ar as b,j as a,I as f,T as g,aq as j,at as w,as as y,b0 as d,x as S,l as C,b1 as P,b2 as I,B as p}from"./index-CHfgriyV.js";import{u as N}from"./useSuspenseQuery-Cya_zjFk.js";import{M}from"./main-D1eRPv4V.js";import{b as R,a as v,M as E}from"./breadcrumbs-for-path-Cey6UXI0.js";function Q({query:r,page:s,perPage:i,onPageChange:c}){const o=b(),l=[o.accessor("name",{header:()=>"Filename",meta:{cellClassName:"min-w-80 md:min-w-none md:w-1/3"},cell:({row:e})=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(f,{type:"exclamation-circle",className:"text-error",size:"md"}),a.jsx(g,{weight:"medium",size:"md",className:"text-primary select-text break-all leading-none",children:e.original.name})]})}),o.accessor("error",{header:()=>"Error",meta:{cellClassName:"min-w-80 md:min-w-none"},cell:({row:e})=>a.jsx(g,{weight:"normal",className:"text-secondary select-text break-all",children:e.original.error})})],n={pageIndex:s,pageSize:i},m=j({data:r.data?.items??[],rowCount:r.data?.total,columns:l,state:{pagination:n},getRowId:(e,t)=>`row-${t}`,enableMultiRowSelection:!1,onPaginationChange:e=>{const t=typeof e=="function"?e(n):e;c(t.pageIndex,t.pageSize)},manualPagination:!0,getCoreRowModel:w()});return a.jsx(y,{variant:"cards",query:r,table:m,ariaLabel:"Snapshot errors"})}function $(){const{snapshotId:r,source:s}=d.useParams(),{path:i,page:c,per_page:o}=d.useSearch(),l=d.useNavigate(),{api:n}=S(),m=C({...P(n,{repository:void 0,snapshot:r,source:s,path:i,pagination:{page:c,perPage:o}})}),e=N(I(n,{repository:void 0,snapshot:r})),t=(x,u)=>l({search:h=>({...h,page:h.per_page!==u?0:x,per_page:u})});return a.jsx(M,{title:a.jsx(E,{snapshot:e.data.item,source:s}),breadcrumb:a.jsx(p,{children:v(e.data.item.identifier,s,e.data.item.sources[s].importer.directory)}),children:a.jsxs("div",{className:"flex flex-col gap-4",children:[a.jsxs(p,{children:[R(e.data.item.identifier,s,e.data.item.sources[s].importer.directory,i),a.jsx(p.Crumb,{to:"/snapshots/$snapshotId/$source/errors",params:{snapshotId:r,source:s},children:"Errors"},"currentPath")]}),a.jsx(Q,{query:m,page:c,perPage:o,onPageChange:t})]})})}export{$ as component};
