import{j as e}from"./@radix-DGuLZ9Nd.js";import{C as I}from"./CodeSnippet-DWvTxFp3.js";import{b as j}from"./CollapsibleCard-Bpe4J0WI.js";import{ai as g,e as p,C as b,o as y,q as C,t as v,a1 as D,r as P}from"./index-DHfBZI1k.js";import{a as N}from"./@monaco-editor-CuNQBT0l.js";import{b as c}from"./@tanstack-B6Lqf40n.js";import{a as S,L as w}from"./@react-router-edahAHd8.js";import{D as R}from"./deployment-status-tag-CFG_a1MF.js";import{K as n,a as l}from"./KeyValue-pMy8DBFv.js";import{P as E}from"./pipeline-link-A-4bNAsN.js";import{R as Q}from"./RepoBadge-LvM-kMDK.js";import{S as _}from"./stack-info-full-C-7kO0b_.js";import{s as O}from"./index-DeaVGGBZ.js";import"./@elkjs-CmhuJAjY.js";import"./chevron-down-C9YWkVDM.js";import"./@reactflow-BVD3Tc7O.js";import"./@zod-2qqdh1cM.js";import"./eye-off-DGkKmlMW.js";import"./eye-CuzpINsY.js";import"./ComponentIcon-D2oU0Tt4.js";import"./bar-chart-square-check-BAWR96En.js";import"./layout-BBB8hotd.js";import"./transform-DsIiQtL0.js";import"./constants-Dj_C1ZPH.js";import"./stack-detail-query-B8BVRHRf.js";function k({Component:s}){const{snapshotId:t}=S(),r=c({...g.detail(t),throwOnError:!0});if(r.isPending)return e.jsx(p,{className:"h-[200px] w-full"});if(r.isError)return null;const o=r.data;return e.jsx(s,{snapshot:o})}function F(){return e.jsx(k,{Component:L})}function L({snapshot:s}){const[t,r]=N.useState(!0);if(!s.body?.runnable)return null;const a=`from zenml.client import Client

Client().trigger_pipeline(snapshot_name_or_id="${s.id}")`;return e.jsxs(b,{open:t,onOpenChange:r,children:[e.jsx(y,{className:"flex items-center gap-[10px]",children:e.jsxs(C,{className:"flex w-full gap-2",children:[e.jsx(j,{open:t}),e.jsx("span",{children:"Code"})]})}),e.jsxs(v,{className:"border-t border-theme-border-moderate bg-theme-surface-primary px-5 py-3",children:[e.jsx("p",{className:"mb-2",children:"Run the snapshot"}),e.jsx(I,{fullWidth:!0,highlightCode:!0,wrap:!0,code:a})]})]})}function T(){return e.jsx(k,{Component:z})}function z({snapshot:s}){const[t,r]=N.useState(!0),o=s.id,i=s.resources?.pipeline.name,a=s.resources?.pipeline.id,d=s.resources?.code_reference,m=d?.body?.code_repository.id,u=d?.body?.commit,x=s.resources?.deployment,h=x?.id,f=x?.body?.status;return e.jsxs(b,{open:t,onOpenChange:r,children:[e.jsx(y,{className:"flex h-9 items-center gap-[10px]",children:e.jsxs(C,{className:"flex w-full gap-2",children:[e.jsx(j,{open:t}),"Details"]})}),e.jsx(v,{className:"border-t border-theme-border-moderate bg-theme-surface-primary px-5 py-3",children:e.jsxs("dl",{className:"grid grid-cols-1 gap-x-[10px] gap-y-2 md:grid-cols-3 md:gap-y-4",children:[e.jsx(n,{label:"Id",value:e.jsxs("div",{className:"group/copybutton flex items-center gap-0.5",children:[o,e.jsx(D,{copyText:o})]})}),e.jsx(n,{label:"Pipeline",value:i&&a?e.jsx(E,{pipelineId:a,pipelineName:i}):e.jsx(l,{})}),e.jsx(n,{label:"Deployment",value:h&&f?e.jsx(w,{to:P.projects.deployments.detail.overview(h),children:e.jsx(R,{size:"sm",status:f})}):e.jsx(l,{})}),e.jsx(n,{label:"Repository/Commit",value:m&&u?e.jsx(Q,{repositoryId:m,commit:u}):e.jsx(l,{})})]})})]})}function B(){const{snapshotId:s}=S(),t=c({...g.detail(s)}),r=t.data?.resources?.stack?.id,o=c({...O.stackDetail(r??""),enabled:!!r});return t.isPending?e.jsx(p,{className:"h-[300px] w-full"}):t.isError?e.jsx("div",{children:"Failed to load snapshot."}):r?o.isPending?e.jsx(p,{className:"h-[300px] w-full"}):o.isError?e.jsx("div",{children:"Failed to load stack."}):e.jsx(_,{stack:o.data,objectConfig:{}}):e.jsx("div",{children:"Stack not available for this snapshot."})}function de(){return e.jsxs("div",{className:"grid grid-cols-1 gap-5 lg:grid-cols-2",children:[e.jsxs("div",{className:"space-y-5",children:[e.jsx(T,{}),e.jsx(F,{})]}),e.jsx("div",{children:e.jsx(B,{})})]})}export{de as default};
