import{d as x,f as y,e as h,J as w,K as T,h as b,c as k,o as P,i as s,k as r,m as n,A as B,O as D,I as i,D as J,L as c,Y as N}from"./index-BRrm8IYN.js";import{_ as O}from"./AutomationWizard.vue_vue_type_script_setup_true_lang-BKawaUBD.js";import{u as V}from"./usePageTitle-D8ThwtpL.js";import{u as Y}from"./usePrefectApi-CPise1aa.js";import"./mapper-DJ53lQ_S.js";const S=x({__name:"AutomationCreate",async setup(j){let e,u;V("Create Automation");const l=Y(),m=y(),f=h(),p=[{text:"Automations",to:m.automations()},{text:"Create"}],{getActions:_,getTrigger:d}=w(),g=([e,u]=T(()=>A()),e=await e,u(),e);async function A(){const o={},[t,a]=await Promise.all([d(),_()]);return t&&(o.trigger=t),a&&(o.actions=a),o}async function C(o){try{await l.automations.createAutomation(o),c(i.success.automationCreate),f.push(m.automations())}catch(t){console.error(t);const a=N(t,i.error.automationCreate);c(a,"error",{timeout:!1})}}return(o,t)=>{const a=b("p-layout-default");return P(),k(a,{class:"automation-create"},{header:s(()=>[r(n(B),{crumbs:p},{actions:s(()=>[r(n(D),{to:n(i).docs.automations},{default:s(()=>[...t[0]||(t[0]=[J(" Documentation ",-1)])]),_:1},8,["to"])]),_:1})]),default:s(()=>[r(O,{automation:n(g),onSubmit:C},null,8,["automation"])]),_:1})}}});export{S as default};
//# sourceMappingURL=AutomationCreate-B9suteEb.js.map
