import{z as t}from"./outputWidgets.be3472c2.js";import{w as r}from"./metadata.1f80fb9b.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]="d5c4a7f8-9ab9-4418-b5e7-fa4335ac0684",o._sentryDebugIdIdentifier="sentry-dbid-d5c4a7f8-9ab9-4418-b5e7-fa4335ac0684")}catch{}})();const i=r.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()})}),l=t.object({id:t.string(),type:t.enum(i),sourceStageId:t.string(),targetStageId:t.string(),props:t.object({conditionValue:t.string().nullable()})}),n=t.object({stages:t.array(c),transitions:t.array(l)}),d={"Content-Type":"application/json"},b="abstra-run-id";class f{async load(){const e=await fetch("/_editor/api/workflows");if(e.ok){const a=await e.json();return n.parse(a)}else throw new Error("Failed to fetch initial data")}async getPath(e){const a=await fetch(`/_editor/api/workflows/path?n=${e}`);if(a.ok)return await a.json();throw new Error("Failed to fetch path")}async update(e){const a=await fetch("/_editor/api/workflows",{method:"PUT",headers:d,body:JSON.stringify(e)});if(a.ok){const s=await a.json();return n.parse(s)}else throw new Error("Failed to update workflow")}}const u=new f;export{b as A,f as W,u as w};
//# sourceMappingURL=api.3ae14449.js.map
