import{aY as v,d as g,a as T,M as b,T as k,R as N,af as S,c as x,b as D,u as e,e as F,w as m,f as I,o as B,h as p,aZ as J,a_ as M,a$ as O,b0 as P,ab as d,aW as i}from"./index-562c8470.js";import{u as U}from"./usePageTitle-ad3dbf10.js";class V extends v{parse(t){return JSON.parse(decodeURIComponent(t??""))}format(t){return encodeURIComponent(JSON.stringify(t))}}const A=g({__name:"FlowRunCreate",setup(f){const t=T(),n=b("deploymentId"),s=k(),y=N("parameters",V,void 0),{deployment:a}=S(n),_=async r=>{var l,o;try{const u=await t.deployments.createDeploymentFlowRun(n.value,r),c=((o=(l=r.state)==null?void 0:l.stateDetails)==null?void 0:o.scheduledTime)??void 0,C=!c,h=O(P,{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=x(()=>a.value?`Create Flow Run for Deployment: ${a.value.name}`:"Create Flow Run for Deployment");return U(R),(r,l)=>{const o=D("p-layout-default");return e(a)?(B(),F(o,{key:0},{header:m(()=>[p(e(J),{deployment:e(a)},null,8,["deployment"])]),default:m(()=>[p(e(M),{deployment:e(a),parameters:e(y),onSubmit:_,onCancel:w},null,8,["deployment","parameters"])]),_:1})):I("",!0)}}});export{A as default};
