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