import{b8 as g,d as h,b as v,W as F,Q as N,an as k,e as x,j as e,c as S,g as m,a as D,h as I,a1 as J,o as T,n as p,b9 as B,ba as O,bb as Q,bc as V,ae as d,b5 as i,b7 as M}from"./index-CPxpbp4R.js";import{u as P}from"./usePageTitle-CcH2lmI6.js";class U extends g{parse(t){return JSON.parse(decodeURIComponent(t??""))}format(t){return encodeURIComponent(JSON.stringify(t))}}const Y=h({__name:"FlowRunCreate",setup(y){const t=v(),r=F("deploymentId"),l=J(),f=N("parameters",U,void 0),{deployment:o}=k(r),w=async c=>{var u,a;try{const n=await t.deployments.createDeploymentFlowRunV2(r.value,c),s=((a=(u=c.state)==null?void 0:u.stateDetails)==null?void 0:a.scheduledTime)??void 0,b=!s,C=Q(V,{flowRun:n,flowRunRoute:d.flowRun,router:l,immediate:b,startTime:s});i(C,"success"),l.push(d.deployment(r.value))}catch(n){const s=M(n,"Something went wrong trying to create a flow run");i(s,"error"),console.error(n)}},_=()=>{l.back()},R=x(()=>o.value?`Create Flow Run for Deployment: ${o.value.name}`:"Create Flow Run for Deployment");return P(R),(c,u)=>{const a=I("p-layout-default");return e(o)?(T(),S(a,{key:0},{header:m(()=>[p(e(B),{deployment:e(o)},null,8,["deployment"])]),default:m(()=>[p(e(O),{deployment:e(o),parameters:e(f),onSubmit:w,onCancel:_},null,8,["deployment","parameters"])]),_:1})):D("",!0)}}});export{Y as default};
//# sourceMappingURL=FlowRunCreate-DthqxkNO.js.map
