import{b2 as g,d as h,M as v,b as k,g as x,aj as N,e as S,u as e,c as B,i as m,a as D,j as F,a1 as I,o as J,m as p,b3 as M,b4 as O,b5 as T,ae as d,b6 as j,b0 as i}from"./index-bD6G21oH.js";import{u as P}from"./usePageTitle-27XdpEbQ.js";class U extends g{parse(t){return JSON.parse(decodeURIComponent(t??""))}format(t){return encodeURIComponent(JSON.stringify(t))}}const E=h({__name:"FlowRunCreate",setup(f){const t=v(),n=k("deploymentId"),s=I(),y=x("parameters",U,void 0),{deployment:a}=N(n),_=async r=>{var l,o;try{const u=await t.deployments.createDeploymentFlowRun(n.value,r),c=((o=(l=r.state)==null?void 0:l.stateDetails)==null?void 0:o.scheduledTime)??void 0,C=!c,b=j(T,{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=S(()=>a.value?`Create Flow Run for Deployment: ${a.value.name}`:"Create Flow Run for Deployment");return P(R),(r,l)=>{const o=F("p-layout-default");return e(a)?(J(),B(o,{key:0},{header:m(()=>[p(e(M),{deployment:e(a)},null,8,["deployment"])]),default:m(()=>[p(e(O),{deployment:e(a),parameters:e(y),onSubmit:_,onCancel:w},null,8,["deployment","parameters"])]),_:1})):D("",!0)}}});export{E as default};
