import{_ as N}from"./DM9QX0ua.js";import{d as P,x as V,u as B,r as c,s as D,c as u,e as s,f as _,w as m,t as o,h as e,C as f,j as S,D as h,J as T,H as v,b,g,_ as $}from"./tpFEFzWU.js";import{u as E}from"./jiBgvKN8.js";import{u as H}from"./BS2O5lAl.js";const I={class:"new-pipeline-page"},K={class:"page-header card"},R={class:"header-left"},U={class:"card form-card"},j={class:"form-group"},A={class:"form-label"},F=["placeholder"],J={key:0,class:"input-hint"},L={class:"form-group"},M={class:"form-label"},O=["placeholder"],q={class:"form-actions"},z=["disabled"],G=P({__name:"new",setup(Q){const y=V(),{t}=B(),{success:w,error:x}=E(),{generateSlug:k,loadPipeline:C}=H(),a=c(""),l=c(""),i=c(!1),p=async()=>{if(!(!a.value.trim()||i.value)){i.value=!0;try{await $fetch("/api/pipelines",{method:"POST",body:{name:a.value,description:l.value}}),w(t("pipeline.pipelineCreated")),await C(a.value),y.push("/settings/pipeline")}catch{x(t("error.createFailed"))}finally{i.value=!1}}};return D({title:`${t("pipeline.new")} - AutoCode`}),(W,n)=>{const d=N;return b(),u("div",I,[s("header",K,[s("div",R,[_(d,{to:"/settings/pipeline",class:"back-link"},{default:m(()=>[g("← "+o(e(t)("nav.back")),1)]),_:1}),n[2]||(n[2]=s("span",{class:"header-separator"},"/",-1)),s("h1",null,o(e(t)("pipeline.new")),1)])]),s("div",U,[s("div",j,[s("label",A,o(e(t)("pipeline.name")),1),f(s("input",{"onUpdate:modelValue":n[0]||(n[0]=r=>v(a)?a.value=r:null),type:"text",class:"form-input",placeholder:e(t)("pipeline.namePlaceholder"),onKeyup:T(p,["enter"])},null,40,F),[[h,e(a)]]),e(a)?(b(),u("span",J," key: "+o(e(k)(e(a))),1)):S("",!0)]),s("div",L,[s("label",M,o(e(t)("pipeline.description")),1),f(s("textarea",{"onUpdate:modelValue":n[1]||(n[1]=r=>v(l)?l.value=r:null),class:"form-input",rows:"4",placeholder:e(t)("pipeline.descriptionPlaceholder")},null,8,O),[[h,e(l)]])]),s("div",q,[_(d,{to:"/settings/pipeline",class:"btn btn-secondary"},{default:m(()=>[g(o(e(t)("modal.cancel")),1)]),_:1}),s("button",{class:"btn btn-primary",disabled:!e(a).trim()||e(i),onClick:p},o(e(i)?e(t)("form.saving"):e(t)("form.create")),9,z)])])])}}}),se=$(G,[["__scopeId","data-v-123b6ad2"]]);export{se as default};
