import{r as n,j as e,I as j}from"./vendor-tanstack-BpuysabX.js";import{U as y,V as b,S as v,a as S,b as A,c as C,e as N,I as x,B as T,g as k,h as E,D as h,E as I,t as M,v as V,w as L,x as B,aB as D,bE as p,bF as w,bG as g,bH as G}from"./index-CREafGO4.js";import{T as F,a as f,A as Q}from"./toggle-group-D2a-wPQL.js";import{u as R}from"./use-debounce-callback-Bybo1_Zg.js";import"./vendor-radix-DIu41Ss_.js";import"./vendor-recharts-C2XeLr4O.js";import"./vendor-forms-Buh7U8Ay.js";import"./vendor-date-C1t37jsh.js";import"./lazy-markdown-rmxkK4GI.js";const H=[{value:"all",label:"All Types"},{value:"markdown",label:"Markdown"},{value:"progress",label:"Progress"},{value:"image",label:"Image"},{value:"table",label:"Table"}],P=({filters:t,onFilterChange:s,totalCount:r,displayMode:d,setDisplayMode:i})=>{const l=n.useCallback(a=>{s([...t.filter(u=>u.id!=="name"),{id:"name",label:"Name",value:a}])},[t,s]),o=n.useCallback(a=>{s([...t.filter(u=>u.id!=="type"),{id:"type",label:"Type",value:a}])},[t,s]),m=n.useMemo(()=>t.find(a=>a.id==="type")?.value,[t]),c=n.useMemo(()=>t.find(a=>a.id==="name")?.value,[t]);return e.jsxs("div",{"data-testid":"artifact-filter",className:"flex justify-between items-center",children:[e.jsx("div",{children:e.jsxs("p",{className:"text-base text-sm text-muted-foreground",children:[r.toLocaleString()," ",y(r,"artifact")]})}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx(b,{"data-testid":"search-input",defaultValue:c,placeholder:"Search artifacts",onChange:a=>l(a.target.value)}),e.jsxs("div",{className:"flex gap-4",children:[e.jsxs(v,{"data-testid":"type-select",value:m,onValueChange:o,children:[e.jsx(S,{"aria-label":"Artifact type",children:e.jsx(A,{placeholder:"Type"})}),e.jsx(C,{children:H.map(({value:a,label:u})=>e.jsx(N,{value:a,children:u},a))})]}),e.jsx("div",{children:e.jsxs(F,{type:"single",defaultValue:d,onValueChange:a=>i(a),children:[e.jsx(f,{"data-testid":"grid-layout",value:"grid",children:e.jsx(x,{id:"LayoutGrid"})}),e.jsx(f,{"data-testid":"list-layout",value:"list",children:e.jsx(x,{id:"AlignJustify"})})]})})]})]})]})},q=()=>e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(T,{children:e.jsx(k,{children:e.jsx(E,{className:"text-xl font-semibold",children:"Artifacts"})})})}),e.jsx(h,{id:"artifacts-guide",label:"Documentation"})]}),z=()=>e.jsxs(I,{children:[e.jsx("div",{className:"flex items-center gap-3",children:e.jsx(M,{id:"Image"})}),e.jsx(V,{children:"Create an artifact to get started"}),e.jsx(L,{children:"Artifacts are byproducts of your runs; they can be anything from a markdown string to a table."}),e.jsx(B,{children:e.jsx(h,{id:"artifacts-guide"})})]}),J=({filters:t,onFilterChange:s,artifactsList:r,artifactsCount:d})=>{const[i,l]=D("artifacts-grid-style","grid"),o=n.useMemo(()=>i==="grid"?"grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 gap-4":"grid-cols-1",[i]),m=n.useMemo(()=>r.reduce((c,a)=>(c.find(u=>u.key===a.key)||c.push(a),c),[]),[r]);return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(q,{}),e.jsx(P,{filters:t,onFilterChange:s,totalCount:d,setDisplayMode:l,displayMode:i}),m.length===0?e.jsx(z,{}):e.jsx("div",{className:o,children:m.map(c=>e.jsx(Q,{artifact:c},c.id))})]})},O=()=>{const t=p.useSearch(),s=p.useNavigate(),r=n.useMemo(()=>[{id:"type",label:"Type",value:t.type??"all"},{id:"name",label:"Name",value:t.name}],[t.type,t.name]),d=R(n.useCallback(i=>{i&&s({to:".",search:()=>i.filter(l=>l.value).reduce((l,o)=>(o.value&&(l[o.id]=o.value),l),{}),replace:!0})},[s]),400);return{filters:r,onFilterChange:d}},ae=function(){const s=p.useSearch(),{filters:r,onFilterChange:d}=O(),[{data:i},{data:l}]=j({queries:[w(g(s)),G(g(s))]});return e.jsx(J,{filters:r,onFilterChange:d,artifactsCount:i,artifactsList:l})};export{ae as component};
//# sourceMappingURL=index-b9bGwHCf.js.map
