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