import{aH as g,d as h,v as k,E as F,B as I,aI as J,a1 as N,c as S,a as x,g as e,e as B,w as m,i as D,o as O,m as p,aJ as T,aK as b,aL as E,aM as M,Z as d,aF as i}from"./index-a91efef8.js";import{u as P}from"./usePageTitle-6b86fe3b.js";class U extends g{parse(t){return JSON.parse(decodeURIComponent(t??""))}format(t){return encodeURIComponent(JSON.stringify(t))}}const H=h({__name:"FlowRunCreate",setup(f){const t=k(),n=F("deploymentId"),s=I(),y=J("parameters",U,void 0),{deployment:a}=N(n),w=async r=>{var l,o;try{const c=await t.deployments.createDeploymentFlowRun(n.value,r),u=((o=(l=r.state)==null?void 0:l.stateDetails)==null?void 0:o.scheduledTime)??void 0,C=!u,v=E(M,{flowRun:c,flowRunRoute:d.flowRun,router:s,immediate:C,startTime:u});i(v,"success"),s.push(d.deployment(n.value))}catch(c){i("Something went wrong trying to create a flow run","error"),console.error(c)}},_=()=>{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=x("p-layout-default");return e(a)?(O(),B(o,{key:0},{header:m(()=>[p(e(T),{deployment:e(a)},null,8,["deployment"])]),default:m(()=>[p(e(b),{deployment:e(a),parameters:e(y),onSubmit:w,onCancel:_},null,8,["deployment","parameters"])]),_:1})):D("",!0)}}});export{H as default};
