import{d as k,u as v,a as D,c as m,e as $,r as b,g as t,o as x,f as F,w as p,k as i,ae as S,af as T,h as B,$ as d,ag as N,ah as P,t as f,a4 as _}from"./index.647f6a83.js";import{u as V}from"./useRouteParam.58df0b75.js";const M=k({__name:"FlowRunCreate",setup(A){const a=V("id"),n=v(),y=D(d.getDeployment,[a]),e=m(()=>y.response),w=async s=>{var r,o,c;try{const u=await d.createDeploymentFlowRun(a.value,s),l=(c=(o=(r=s.state)==null?void 0:r.stateDetails)==null?void 0:o.scheduledTime)!=null?c:void 0,g=!l,C=N(P,{flowRun:u,flowRunRoute:f.flowRun,router:n,immediate:g,startTime:l});_(C,"success"),n.push(f.deployment(a.value))}catch(u){_("Something went wrong trying to create a flow run","error"),console.error(u)}},h=()=>{n.back()},R=m(()=>e.value?`Create Flow Run for Deployment: ${e.value.name}`:"Create Flow Run for Deployment");return $(R),(s,r)=>{const o=b("p-layout-default");return t(e)?(x(),F(o,{key:0},{header:p(()=>[i(t(S),{deployment:t(e)},null,8,["deployment"])]),default:p(()=>[i(t(T),{deployment:t(e),onSubmit:w,onCancel:h},null,8,["deployment"])]),_:1})):B("",!0)}}});export{M as default};
