import{r as d,j as e}from"./@radix-3bj3otF9.js";import{C as I}from"./CodeSnippet-LBT7JnAL.js";import{C as m}from"./collapsible-chevron-CRi1mieO.js";import{C as u,q as x,t as h,v as j,a0 as P,a5 as w,e as p,T as O,d as E}from"./index-1REJ-mbf.js";import{a as f}from"./@react-router-Ct_TgVUW.js";import{K as l,a as k}from"./KeyValue-ULVVsU7P.js";import{P as Q}from"./pipeline-link-f7nbs-No.js";import{R as _,C as D}from"./ComponentCollapsible-CiaChrOq.js";import{b as c}from"./@tanstack-CByuvRcg.js";import{s as T}from"./index-iuK9vGP1.js";import"./chevron-down-smmnLxYI.js";import"./@reactflow-CwWcBchH.js";import"./eye-vFb-iYpN.js";import"./CollapsibleCard-eUpjksBv.js";import"./ComponentBadge-CYC6mnh8.js";import"./ComponentIcon-ilWLl5Ys.js";import"./bar-chart-square-check-Diki0CFQ.js";import"./layout-zVxDzB0C.js";import"./transform-CRpCHU_K.js";import"./stack-detail-query-DK_ie4nm.js";function q(){const{snapshotId:t}=f(),[s,a]=d.useState(!0),o=`from zenml.client import Client

Client().trigger_pipeline(snapshot_name_or_id="${t}")`;return e.jsxs(u,{open:s,onOpenChange:a,children:[e.jsx(x,{className:"flex items-center gap-[10px]",children:e.jsxs(h,{className:"flex w-full gap-2",children:[e.jsx(m,{open:s}),e.jsx("span",{children:"Code"})]})}),e.jsxs(j,{className:"border-t border-theme-border-moderate bg-theme-surface-primary px-5 py-3",children:[e.jsx("p",{className:"mb-2",children:"Trigger the snapshot"}),e.jsx(I,{fullWidth:!0,highlightCode:!0,wrap:!0,code:o})]})]})}function B({snapshot:t}){var C,y,N,v,S;const[s,a]=d.useState(!0),o=t.id,n=(C=t.resources)==null?void 0:C.pipeline.name,i=(y=t.resources)==null?void 0:y.pipeline.id,r=(N=t.resources)==null?void 0:N.code_reference,g=(v=r==null?void 0:r.body)==null?void 0:v.code_repository.id,b=(S=r==null?void 0:r.body)==null?void 0:S.commit;return e.jsxs(u,{open:s,onOpenChange:a,children:[e.jsx(x,{className:"flex items-center gap-[10px]",children:e.jsxs(h,{className:"flex w-full gap-2",children:[e.jsx(m,{open:s}),"Details"]})}),e.jsx(j,{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(l,{label:"Id",value:e.jsxs("div",{className:"group/copybutton flex items-center gap-0.5",children:[o,e.jsx(P,{copyText:o})]})}),e.jsx(l,{label:"Pipeline",value:n&&i?e.jsx(Q,{pipelineId:i,pipelineName:n}):e.jsx(k,{})}),e.jsx(l,{label:"Repository/Commit",value:g&&b?e.jsx(_,{repositoryId:g,commit:b}):e.jsx(k,{})})]})})]})}function F(){const{snapshotId:t}=f(),s=c({...w.detail(t),throwOnError:!0});if(s.isPending)return e.jsx(p,{className:"h-[200px] w-full"});if(s.isError)return null;const a=s.data;return e.jsx(B,{snapshot:a})}function K({stack:t}){var i;const[s,a]=d.useState(!0),o=t.name,n=Object.values(((i=t.metadata)==null?void 0:i.components)??{}).flat();return e.jsxs(u,{open:s,onOpenChange:a,children:[e.jsxs(x,{className:"flex items-center justify-between",children:[e.jsxs(h,{className:"flex w-full gap-2",children:[e.jsx(m,{open:s}),"Stack"]}),e.jsx("div",{children:e.jsxs(O,{className:"flex w-fit items-center gap-1 whitespace-nowrap text-turquoise-600",color:"turquoise",emphasis:"subtle",rounded:!1,children:[e.jsx(E,{className:"h-4 w-4 fill-current"}),o]})})]}),e.jsx(j,{className:"border-t border-theme-border-moderate bg-theme-surface-primary px-5 py-3",children:e.jsx("ul",{className:"space-y-5",children:n.map(r=>e.jsx("li",{className:"w-full",children:e.jsx(D,{component:r,objectConfig:{}})},r.id))})})]})}function R(){var n,i,r;const{snapshotId:t}=f(),s=c({...w.detail(t)}),a=(r=(i=(n=s.data)==null?void 0:n.resources)==null?void 0:i.stack)==null?void 0:r.id,o=c({...T.stackDetail(a??""),enabled:!!a});return s.isPending?e.jsx(p,{className:"h-[300px] w-full"}):s.isError?e.jsx("div",{children:"Failed to load snapshot."}):a?o.isPending?e.jsx(p,{className:"h-[300px] w-full"}):o.isError?e.jsx("div",{children:"Failed to load stack."}):e.jsx(K,{stack:o.data}):e.jsx("div",{children:"Stack not available for this snapshot."})}function ie(){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(F,{}),e.jsx(q,{})]}),e.jsx("div",{children:e.jsx(R,{})})]})}export{ie as default};
