import{b3 as h,d as g,D as k,b as v,B as D,aj as B,e as N,u as e,c as S,h as m,a as x,i as F,a1 as I,o as T,k as p,b4 as J,b5 as O,b6 as P,ae as d,b7 as U,b1 as i}from"./index-WCZ_4nWW.js";import{u as V}from"./usePageTitle-Y7n4a-YH.js";class $ extends h{parse(t){return JSON.parse(decodeURIComponent(t??""))}format(t){return encodeURIComponent(JSON.stringify(t))}}const K=g({__name:"FlowRunCreate",setup(f){const t=k(),n=v("deploymentId"),s=I(),y=D("parameters",$,void 0),{deployment:o}=B(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,b=U(P,{flowRun:u,flowRunRoute:d.flowRun,router:s,immediate:C,startTime:c});i(b,"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=N(()=>o.value?`Create Flow Run for Deployment: ${o.value.name}`:"Create Flow Run for Deployment");return V(R),(r,l)=>{const a=F("p-layout-default");return e(o)?(T(),S(a,{key:0},{header:m(()=>[p(e(J),{deployment:e(o)},null,8,["deployment"])]),default:m(()=>[p(e(O),{deployment:e(o),parameters:e(y),onSubmit:_,onCancel:w},null,8,["deployment","parameters"])]),_:1})):x("",!0)}}});export{K as default};
