import{ca as h,d as b,g as k,W as F,al as I,cb as N,ae as S,i as x,m as e,c as D,j as d,a as J,k as P,u as B,o as O,l as p,cc as T,cd as V,ce as U,cf as W,bk as i,P as f,L as j}from"./index-Cq5Q7kWk.js";import{u as z}from"./usePageTitle-NgGMZFeo.js";class L extends h{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=F("deploymentId"),c=B(),_=I("parameters",L,void 0),{deployment:a}=N(l),o=S(!1),w=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,g=!r,C=U(W,{flowRun:n,flowRunRoute:i.flowRun,router:c,immediate:g,startTime:r});f(C,"success"),c.push(i.deployment(l.value))}catch(n){const r=j(n,"Something went wrong trying to create a flow run");f(r,"error"),console.error(n)}finally{o.value=!1}},R=()=>{c.back()},v=x(()=>a.value?`Create Flow Run for Deployment: ${a.value.name}`:"Create Flow Run for Deployment");return z(v),(u,m)=>{const s=P("p-layout-default");return e(a)?(O(),D(s,{key:0},{header:d(()=>[p(e(T),{deployment:e(a)},null,8,["deployment"])]),default:d(()=>[p(e(V),{deployment:e(a),parameters:e(_),disabled:o.value,onSubmit:w,onCancel:R},null,8,["deployment","parameters","disabled"])]),_:1})):J("",!0)}}});export{Z as default};
//# sourceMappingURL=FlowRunCreate-BrdwZD0K.js.map
