var u=Object.defineProperty;var l=(s,t,e)=>t in s?u(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var o=(s,t,e)=>(l(s,typeof t!="symbol"?t+"":t,e),e);import{A as w}from"./record.685c8ba7.js";import"./outputWidgets.c4f3de67.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new Error().stack;t&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[t]="242f7346-c154-4845-94b3-91a58b1a3af4",s._sentryDebugIdIdentifier="sentry-dbid-242f7346-c154-4845-94b3-91a58b1a3af4")}catch{}})();class f{async list(){return await(await fetch("/_editor/api/hooks")).json()}async create(){return await(await fetch("/_editor/api/hooks",{method:"POST",headers:{"Content-Type":"application/json"}})).json()}async get(t){return await(await fetch(`/_editor/api/hooks/${t}`)).json()}async update(t,e){return await(await fetch(`/_editor/api/hooks/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json()}async delete(t){await fetch(`/_editor/api/hooks/${t}`,{method:"DELETE",headers:{"Content-Type":"application/json"}})}async test(t,e){const i=new URLSearchParams(e.query),n=await fetch(`/_editor/api/hooks/${t}/test?${i.toString()}`,{method:e.method,headers:{"Content-Type":"application/json",...e.headers},body:e.method==="GET"?void 0:e.body}),{status:c,headers:d,body:h,stderr:p,stdout:y}=await n.json();return{status:c,headers:d,body:h,stderr:p,stdout:y}}}const a=new f;class r{constructor(t){o(this,"record");this.record=w.create(a,t)}static async list(){return(await a.list()).map(e=>new r(e))}static async create(){const t=await a.create();return new r(t)}static async get(t){const e=await a.get(t);return new r(e)}async delete(){await a.delete(this.id)}async duplicate(){return this}async save(){await this.record.save()}onUpdate(t){this.record.pubsub.subscribe("update",t)}hasChanges(t){return this.record.hasChanges(t)}get id(){return this.record.get("id")}get path(){return this.record.get("path")}set path(t){this.record.set("path",t)}get title(){return this.record.get("title")}set title(t){this.record.set("title",t)}get file(){return this.record.get("file")}set file(t){this.record.set("file",t)}async test(t){return a.test(this.id,t)}get position(){const[t,e]=this.record.get("workflow_position");return{x:t,y:e,referential:"world"}}get isInitial(){return this.record.get("is_initial")}}export{r as H};
//# sourceMappingURL=hooks.12fdb61d.js.map
