import{d as D,e as v,W as w,t as h,i as l,c as b,j as s,a as C,k,o as g,l as c,n as r,ca as x,cb as B,N as p,cc as m,bo as I,Y as N}from"./index-BvWlZEEM.js";import{u as E}from"./usePageTitle-CKKzQl14.js";const W=D({__name:"DeploymentDuplicate",setup(P){const a=v(),u=w("deploymentId"),d=h(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 E(_),(t,n)=>{const o=k("p-layout-default");return e.value?(g(),b(o,{key:0,class:"deployment-edit"},{header:s(()=>[c(r(x),{deployment:e.value},null,8,["deployment"])]),default:s(()=>[c(r(B),{deployment:e.value,mode:"duplicate",onCancel:f,onSubmit:y},null,8,["deployment"])]),_:1})):C("",!0)}}});export{W as default};
//# sourceMappingURL=DeploymentDuplicate-5-YLR9BF.js.map
