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