import{ce as h,d as b,e as k,W as D,ao as F,cf as N,af as S,i as x,n as e,c as B,j as d,a as I,k as J,g as O,o as P,l as p,cg as T,ch as j,ci as Q,cj as U,bo as i,N as f,Y as V}from"./index-BvWlZEEM.js";import{u as W}from"./usePageTitle-CKKzQl14.js";class Y extends h{parse(t){return JSON.parse(decodeURIComponent(t??""))}format(t){return encodeURIComponent(JSON.stringify(t))}}const $=b({__name:"FlowRunCreate",setup(y){const t=k(),l=D("deploymentId"),c=O(),w=F("parameters",Y,void 0),{deployment:a}=N(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,g=!r,C=Q(U,{flowRun:n,flowRunRoute:i.flowRun,router:c,immediate:g,startTime:r});f(C,"success"),c.push(i.deployment(l.value))}catch(n){const r=V(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 W(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{$ as default};
//# sourceMappingURL=FlowRunCreate-DCJ_z0Yd.js.map
