import{l as r}from"./fetch.5f113e8c.js";import{N as t}from"./vue-router.d9feb5a3.js";import{w as i}from"./metadata.12a669c4.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[e]="504ecada-77a9-41e0-97bf-48480b65b719",o._sentryDebugIdIdentifier="sentry-dbid-504ecada-77a9-41e0-97bf-48480b65b719")}catch{}})();const l=i.stages.flatMap(o=>o.transitions.flatMap(e=>e.typeName)),c=t.object({type:t.enum(["forms","hooks","jobs","scripts","conditions","iterators"]),id:t.string(),title:t.string(),position:t.object({x:t.number(),y:t.number()}),props:t.object({path:t.string().nullable(),filename:t.string().nullable(),variableName:t.string().nullable(),itemName:t.string().nullable()})}),d=t.object({id:t.string(),type:t.enum(l),sourceStageId:t.string(),targetStageId:t.string(),props:t.object({conditionValue:t.string().nullable()})}),s=t.object({stages:t.array(c),transitions:t.array(d)}),p={"Content-Type":"application/json"},h="abstra-run-id";class b{async load(){const e=await fetch("/_editor/api/workflows");if(e.ok){const a=await e.json();return s.parse(a)}else throw new Error("Failed to fetch initial data")}async update(e){const a=await fetch("/_editor/api/workflows",{method:"PUT",headers:p,body:JSON.stringify(e)});if(a.ok){const n=await a.json();return s.parse(n)}else throw new Error("Failed to update workflow")}}class y{constructor(e,a=r){this.authHeaders=e,this.fetch=a}get headers(){return{"Content-Type":"application/json",...this.authHeaders}}async load(){const e=await this.fetch("/_workflows",{headers:this.headers});if(e.ok){const a=await e.json();return s.parse(a)}else throw new Error("Failed to fetch initial data")}async update(e){const a=await this.fetch("/_workflows",{body:JSON.stringify(e),headers:this.headers,method:"PUT"});if(a.ok){const n=await a.json();return s.parse(n)}else throw new Error("Failed to update workflow")}}export{h as A,b as E,y as P};
//# sourceMappingURL=api.4e2ade5f.js.map
