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