import{d as D,g as v,W as h,h as w,i as l,j as C,c as g,a as b,o as k,k as s,l as r,n as c,c5 as x,c6 as E,J as p,c7 as m,be as I,K as N}from"./index-DHPxdPUs.js";import{u as B}from"./usePageTitle-N_Vwn3MG.js";const j=D({__name:"DeploymentDuplicate",setup(S){const a=v(),u=h("deploymentId"),d=w(a.deployments.getDeployment,[u.value],{}),e=l(()=>d.response);function i(t){return"name"in t}async function y(t){try{if(!i(t))throw new Error("Invalid request");const n=await a.deployments.createDeployment(t);p("Deployment created","success"),m.push(I.deployment(n.id))}catch(n){const o=N(n,"Error creating deployment");p(o,"error"),console.warn(n)}}function f(){m.back()}const _=l(()=>e.value?`Duplicate Deployment: ${e.value.name}`:"Duplicate Deployment");return B(_),(t,n)=>{const o=C("p-layout-default");return e.value?(k(),g(o,{key:0,class:"deployment-edit"},{header:s(()=>[r(c(E),{deployment:e.value},null,8,["deployment"])]),default:s(()=>[r(c(x),{deployment:e.value,mode:"duplicate",onCancel:f,onSubmit:y},null,8,["deployment"])]),_:1})):b("",!0)}}});export{j as default};
//# sourceMappingURL=DeploymentDuplicate-CuH50YU7.js.map
