1import{h as L,u as C,aO as k,j as e,x as P,L as M,r as w,f as z,g as A}from"./index-CrefBu_C.js";import{B as j}from"./Button-BoOvYJ5w.js";import{C as B,a as V}from"./Card-BfkCMIEB.js";import{g as S,V as I,n as K}from"./verificationStatus-C_lK0NTr.js";import{C as D}from"./clock-BPQxJnfr.js";import{S as R}from"./search-GTmfR8FQ.js";import{D as T}from"./download-cMRkkbOZ.js";import{B as b}from"./Badge-DqOaUsqu.js";import{r as E}from"./referenceKind-D_JHjClD.js";import{R as F}from"./ReferenceIcon-ByMQNeiD.js";import{G}from"./git-branch-I0wnpGQF.js";import{F as O}from"./folder-kanban-DJiSL7bV.js";import{T as _}from"./timer-B43dBhPj.js";import{P as Y}from"./package-Dn5IGMt-.js";import{F as q,A as H}from"./folder-tree-C_Rab7oa.js";import{u as J}from"./useGetVerifications-2FGRRQnN.js";import{u as Q}from"./useRunVerificationForRepository-NJHfjM9l.js";import{u as U}from"./useGetProjectRepository-CuGOkVOX.js";import{u as W}from"./useSerialPolling-BMVgwbHN.js";import{A as X}from"./arrow-left-u9mPcDUq.js";import{C as Z}from"./circle-check-big-DYBfWmdC.js";import{C as ee}from"./circle-alert-DS4SwB0L.js";import{C as se}from"./calendar-BAT_aypW.js";import"./utils-D2jV1zSv.js";import"./circle-x-BnTuS0uZ.js";import"./tag-CeISBN44.js";import"./useQuery-Dvv3k0s4.js";import"./useApi-vafndU7C.js";import"./useMutation-CqLSLqCK.js";import"./error-DtpM3Nm5.js";import"./useGetProjects-DT8sn3RR.js";import"./useGetProjectDashboard-vI6a9ZMQ.js";/** 2 * @license lucide-react v0.543.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const te=[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],ae=L("circle-play",te),re=a=>{if(a==null)return"In progress";if(a<1e3)return`${a}ms`;const s=Math.floor(a/1e3),r=Math.floor(s/60),t=s%60;return r>0?`${r}min ${t}s`:`${t}s`},le=({name:a,stage:s})=>{const r=C(),{tenantId:t,projectId:l,repoId:c}=k.useParams(),x=(s==null?void 0:s.status)||"pending",m=S(x),i=re(s==null?void 0:s.scanDuration);return e.jsxs("div",{className:"flex items-center justify-between p-6 hover:bg-primary/2 transition-all duration-300 group",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx("div",{className:"relative",children:e.jsx(I,{status:x,className:"h-6 w-6"})}),e.jsxs("div",{children:[e.jsx("span",{className:"text-base font-medium text-foreground group-hover:text-primary transition-colors duration-300",children:a}),e.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-1 mt-1",children:[e.jsx(D,{className:"h-3 w-3"}),i," execution time"]})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Status"}),e.jsx("p",{className:"text-sm font-medium capitalize",children:m.label})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(j,{variant:"outline",size:"sm",className:"rounded-xl hover:bg-primary transition-all duration-300 hover:scale-105 border-primary/30",onClick:()=>{r({to:"/tenant/$tenantId/projects/$projectId/$repoId/results",params:{tenantId:t,projectId:l,repoId:c}})},children:[e.jsx(R,{className:"h-4 w-4 mr-2"}),"Results"]}),e.jsxs(j,{variant:"outline",size:"sm",className:"rounded-xl hover:bg-primary transition-all duration-300 hover:scale-105 border-primary/30",onClick:()=>{r({to:"/tenant/$tenantId/projects/$projectId/scorecard",params:{tenantId:t,projectId:l}})},children:[e.jsx(T,{className:"h-4 w-4 mr-2"}),"Download SBOM"]})]})]})]})},ne=a=>{if(a==null)return"In progress";if(a<1e3)return`${a}ms`;const s=Math.floor(a/1e3),r=Math.floor(s/60),t=s%60;return r>0?`${r}m ${t}s`:`${t}s`},$=({withStage:a=!1,verification:s,results:r,tenantId:t,projectId:l,repoId:c,position:x="left",onResultsClick:m})=>{const i=C(),h=(s==null?void 0:s.status)||"pending",N=S(h),y=ne(s==null?void 0:s.scanDuration),[g,p]=P.useState(!1),d=async()=>{if(!(!t||!l||!c)){p(!0);try{let o=s==null?void 0:s.id;if(m){const n=await m(c);n&&(o=n)}i({to:"/tenant/$tenantId/projects/$projectId/$repoId/results",params:{tenantId:t,projectId:l,repoId:c},search:{verificationId:o}})}finally{p(!1)}}};return e.jsxs(B,{className:` 7 relative overflow-visible 8 shadow-xl transition-all duration-500 9 animate-fade-in 10 `,children:[e.jsx("div",{className:`absolute top-0 ${x==="left"?"right-0":"left-0"} w-20 h-20 opacity-20`,children:e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-primary to-transparent roun
10ded-bl-full"})}),e.jsxs(V,{className:"p-5",children:[e.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-start lg:justify-between gap-3 mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"relative",children:e.jsx("div",{className:"w-12 h-12 rounded-xl bg-gradient-to-br from-primary to-primary/60 flex items-center justify-center shadow-lg shadow-primary/25",children:e.jsx(G,{className:"h-6 w-6 text-muted-foreground "})})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h3",{className:"text-base font-bold text-foreground",children:"Verification Run"}),e.jsxs("p",{className:"text-xs text-muted-foreground font-mono",children:[e.jsxs("span",{className:"hidden lg:inline",children:["#",s==null?void 0:s.id]}),e.jsxs("span",{className:"lg:hidden",children:["#",s!=null&&s.id?`${s.id.slice(0,8)}...`:""]})]})]})]}),e.jsxs(b,{variant:N.badgeVariant,className:"capitalize font-semibold self-start",children:[e.jsx("div",{className:"pr-[6px]",children:e.jsx(I,{status:h,className:"h-4 w-4"})}),N.label]})]}),e.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center gap-2 lg:gap-4 mb-4 p-3 rounded-lg bg-background/50 backdrop-blur-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(O,{className:"h-4 w-4 text-primary shrink-0"}),e.jsx("span",{className:"text-sm font-medium truncate",children:s.repository.name})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{kind:E(s.repository),className:"h-4 w-4 text-primary shrink-0"}),e.jsx("span",{className:"text-sm font-medium truncate",children:s.repository.branchName})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{className:"h-4 w-4 text-primary shrink-0"}),e.jsx("span",{className:"text-sm font-medium",children:y})]})]}),e.jsxs("div",{className:"flex flex-col gap-3",children:[r&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-full bg-success/15 text-success",children:[e.jsx("img",{src:"/images/severity/critical.svg",className:"h-6 w-6"}),e.jsx("span",{className:"text-sm font-semibold",children:r.critical})]}),e.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-full bg-destructive/15 text-destructive",children:[e.jsx("img",{src:"/images/severity/high.svg",className:"h-6 w-6"}),e.jsx("span",{className:"text-sm font-semibold",children:r.high})]}),e.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-full bg-muted text-muted-foreground",children:[e.jsx("img",{src:"/images/severity/medium.svg",className:"h-6 w-6"}),e.jsx("span",{className:"text-sm font-semibold",children:r.medium})]}),e.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-full bg-muted text-muted-foreground",children:[e.jsx("img",{src:"/images/severity/low.svg",className:"h-6 w-6"}),e.jsx("span",{className:"text-sm font-semibold",children:r.low})]})]}),!a&&t&&l&&c&&(s==null?void 0:s.id)&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(j,{variant:"ghost",size:"sm",className:"h-8 px-3 text-xs text-muted-foreground hover:text-foreground",onClick:()=>{i({to:"/tenant/$tenantId/projects/$projectId/$repoId/sbom",params:{tenantId:t,projectId:l,repoId:c},search:{verificationId:s.id}})},children:[e.jsx(Y,{className:"h-3.5 w-3.5 mr-1.5"}),"BOMs"]}),e.jsxs(j,{variant:"ghost",size:"sm",className:"h-8 px-4 text-xs",onClick:()=>{i({to:"/tenant/$tenantId/projects/$projectId/findings-explorer",params:{tenantId:t,projectId:l},search:{repoId:c,verificationId:s.id}})},children:[e.jsx(q,{className:"h-3.5 w-3.5 mr-1.5"}),"Findings Explorer"]}),e.jsxs(j,{variant:"default",size:"sm",className:"h-8 px-4 text-xs",disabled:g,onClick:()=>void d(),children:[g?e.jsx(M,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):e.jsx(R,{className:"h-3.5 w-3.5 mr-1.5"}),"Results"]})]})]})]}),a&&(s==null?void 0:s.stages)&&e.jsx("div",{className:"border-t border-border/50",children:s.stages.map((o,n)=>e.jsx(le,{name:o.name||`Stage ${n+1}`,stage:o},o.id||n))})]})},ie=a=>{const s={};return a.forEach(t=>{const l=t.verifications||t,c=t.results,x=t.repository,m=new Date(l.createdAt),i=`${m.getFullYear()}
10-${String(m.getMonth()+1).padStart(2,"0")}`,h=m.toLocaleDateString("en-EN",{year:"numeric",month:"long"});s[i]||(s[i]=[]),s[i].push({...l,results:c,repository:x||l.repository,monthLabel:h})}),Object.keys(s).sort((t,l)=>l.localeCompare(t)).map(t=>({monthKey:t,monthLabel:s[t][0].monthLabel,verifications:s[t]}))},oe=()=>{var g;const{tenantId:a,repoId:s,projectId:r}=k.useParams(),{data:t,isLoading:l,refetch:c}=J({tenantId:a,projectRepositoryId:s});W({enabled:!!(a&&s),intervalMs:2e3,task:async()=>{await c()}});const{data:x}=U({tenantId:a,repositoryId:s}),m=Q(),i=w.useMemo(()=>t||[],[t]),h=i.filter(p=>K(p.status)==="finished").length,N=w.useMemo(()=>ie(i),[i]),y=async p=>{var u;const o=(await c()).data,n=(o==null?void 0:o.filter(f=>f.status==="finished"))||[];return n.sort((f,v)=>new Date(v.createdAt).getTime()-new Date(f.createdAt).getTime()),(u=n[0])==null?void 0:u.id};return l?e.jsx(z,{}):e.jsxs("div",{className:"space-y-8 overflow-hidden",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs(A,{to:"/tenant/$tenantId/projects/$projectId",params:{tenantId:a,projectId:r},className:"inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors mb-2",children:[e.jsx(X,{className:"h-4 w-4"}),"Back to project"]}),e.jsx("h1",{className:"text-2xl md:text-3xl font-bold tracking-tight",children:"Project Item Timeline"}),e.jsxs("p",{className:"text-muted-foreground mt-1",children:[((g=x==null?void 0:x.data)==null?void 0:g.name)||"Repository"," · Recent scan runs"]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(b,{variant:"secondary",className:"flex items-center gap-1",children:[e.jsx(H,{className:"h-3 w-3"}),i.length>0?"Active":"No Runs"]}),h>0&&e.jsxs(b,{variant:"outline",className:"flex items-center gap-1",children:[e.jsx(Z,{className:"h-3 w-3 text-success"}),h," Successful"]}),e.jsxs(j,{variant:"action",onClick:()=>{m.mutate({projectRepositoryId:s,tenantId:a})},disabled:m.isPending,className:"w-full md:w-auto",children:[e.jsx(ae,{className:"h-4 w-4 mr-2"}),m.isPending?"Starting...":"Re-run Scan"]})]})]}),e.jsx("div",{className:"space-y-12",children:i.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(ee,{className:"h-12 w-12 text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-semibold text-foreground mb-2",children:"No Pipeline Runs Yet"}),e.jsx("p",{className:"text-sm text-muted-foreground max-w-md",children:"No verification runs have been executed for this repository. Start a scan to see pipeline information here."})]}):N.map(p=>e.jsxs("div",{className:"space-y-0",children:[e.jsx("div",{className:"flex items-center justify-center mb-8",children:e.jsxs("div",{className:"flex items-center gap-2 px-6 py-3 rounded-[10px] bg-primary text-white shadow-lg shadow-primary",children:[e.jsx(se,{className:"h-5 w-5"}),e.jsx("span",{className:"font-bold capitalize text-lg ",children:p.monthLabel}),e.jsxs(b,{variant:"secondary",className:"ml-2",children:[p.verifications.length," runs"]})]})}),e.jsxs("div",{className:"relative hidden md:block",children:[e.jsx("div",{className:"absolute left-1/2 top-0 bottom-0 w-1 -translate-x-1/2 bg-primary from-primary via-primary/50 to-primary/20 rounded-full"}),e.jsx("div",{className:"space-y-8 pb-[50px] pt-[50px] ",children:p.verifications.map((d,o)=>{const n=o%2===0,u=new Date(d.createdAt),f=u.toLocaleTimeString("en-EN",{hour:"2-digit",minute:"2-digit"}),v=u.toLocaleDateString("en-EN",{day:"numeric",month:"short"});return e.jsxs("div",{className:`relative flex items-center ${n?"justify-start":"justify-end"}`,children:[e.jsx("div",{className:"absolute left-1/2 -translate-x-1/2 z-10",children:e.jsx("div",{className:"w-5 h-5 rounded-full bg-primary flex items-center justify-center",children:e.jsx("div",{className:"w-2 h-2 rounded-full bg-white"})})}),e.jsxs("div",{className:`absolute top-1/2 -translate-y-1/2 ${n?"left-1/2 ml-8 text-left":"right-1/2 mr-8 text-right"}`,children:[e.jsx("div",{className:"text-sm font-semibold text-primary",children:f}),e.jsx("div",{className:"text-xs text-muted-foreground",children:v})]}),e.jsx("div",{className:`w-[45%] ${n?"pr-8":"pl-8"}`,children:e.jsx($,{verification:d,results:d.results,tenantId:a,projectId:r,repoId:s,position:n?"left":"right",onResultsClick:y}
10)})]},d.id||o)})})]}),e.jsxs("div",{className:"relative md:hidden overflow-hidden",children:[e.jsx("div",{className:"absolute left-3 top-0 bottom-0 w-1 bg-primary rounded-full"}),e.jsx("div",{className:"space-y-6",children:p.verifications.map((d,o)=>{const n=new Date(d.createdAt),u=n.toLocaleTimeString("sk-SK",{hour:"2-digit",minute:"2-digit"}),f=n.toLocaleDateString("sk-SK",{day:"numeric",month:"short"});return e.jsxs("div",{className:"relative flex items-start pl-10 pr-1",children:[e.jsx("div",{className:"absolute left-1 top-4 z-10",children:e.jsx("div",{className:"w-5 h-5 rounded-full bg-primary flex items-center justify-center",children:e.jsx("div",{className:"w-2 h-2 rounded-full bg-white"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2 text-sm",children:[e.jsx("span",{className:"font-semibold text-primary",children:u}),e.jsx("span",{className:"text-muted-foreground",children:f})]}),e.jsx($,{verification:d,results:d.results,tenantId:a,projectId:r,repoId:s,position:"left",onResultsClick:y})]})]},d.id||o)})})]})]},p.monthKey))})]})},Fe=oe;export{Fe as component};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.