import{bO as g,d as h,al as v,W as S,am as k,b4 as x,b as F,h as e,c as N,e as m,a as O,f as D,u as I,o as P,g as p,bP as B,bQ as J,bR as Q,bS as T,aX as d,_ as i,C as U}from"./index-BjFilUfY.js";import{u as V}from"./usePageTitle-J4-vayug.js";class W extends g{parse(t){return JSON.parse(decodeURIComponent(t??""))}format(t){return encodeURIComponent(JSON.stringify(t))}}const X=h({__name:"FlowRunCreate",setup(f){const t=v(),r=S("deploymentId"),l=I(),y=k("parameters",W,void 0),{deployment:o}=x(r),_=async c=>{var u,a;try{const n=await t.deployments.createDeploymentFlowRunV2(r.value,c),s=((a=(u=c.state)==null?void 0:u.stateDetails)==null?void 0:a.scheduledTime)??void 0,C=!s,b=Q(T,{flowRun:n,flowRunRoute:d.flowRun,router:l,immediate:C,startTime:s});i(b,"success"),l.push(d.deployment(r.value))}catch(n){const s=U(n,"Something went wrong trying to create a flow run");i(s,"error"),console.error(n)}},R=()=>{l.back()},w=F(()=>o.value?`Create Flow Run for Deployment: ${o.value.name}`:"Create Flow Run for Deployment");return V(w),(c,u)=>{const a=D("p-layout-default");return e(o)?(P(),N(a,{key:0},{header:m(()=>[p(e(B),{deployment:e(o)},null,8,["deployment"])]),default:m(()=>[p(e(J),{deployment:e(o),parameters:e(y),onSubmit:_,onCancel:R},null,8,["deployment","parameters"])]),_:1})):O("",!0)}}});export{X as default};
//# sourceMappingURL=FlowRunCreate-DH8lcM-u.js.map
