var p=Object.defineProperty;var u=(s,t,e)=>t in s?p(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var o=(s,t,e)=>(u(s,typeof t!="symbol"?t+"":t,e),e);import{A as h}from"./record.fe2d13ca.js";import"./outputWidgets.e33755f8.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]="6328cb22-bb3c-4931-8ac8-533b6995ce09",s._sentryDebugIdIdentifier="sentry-dbid-6328cb22-bb3c-4931-8ac8-533b6995ce09")}catch{}})();class l{async list(){return await(await fetch("/_editor/api/jobs")).json()}async create(t,e){return await(await fetch("/_editor/api/jobs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:t,file:e})})).json()}async get(t){return await(await fetch(`/_editor/api/jobs/${t}`)).json()}async update(t,e){return await(await fetch(`/_editor/api/jobs/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json()}async delete(t,e){const r=e?"?remove_file=true":"",n=`/_editor/api/jobs/${t}`+r;await fetch(n,{method:"DELETE",headers:{"Content-Type":"application/json"}})}async test(t){return(await fetch(`/_editor/api/jobs/${t}/test`,{method:"POST",headers:{"Content-Type":"application/json"}})).json()}}const a=new l;class c{constructor(t){o(this,"record");o(this,"isInitial",!0);this.record=h.create(a,t)}static async list(){return(await a.list()).map(e=>new c(e))}static async create(t,e){const r=await a.create(t,e);return new c(r)}static async get(t){const e=await a.get(t);return new c(e)}async delete(t){await a.delete(this.id,t)}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 schedule(){return this.record.get("schedule")}set schedule(t){this.record.set("schedule",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)}get id(){return this.record.get("id")}async test(){return a.test(this.id)}get position(){const[t,e]=this.record.get("workflow_position");return{x:t,y:e,referential:"world"}}}class y{async list(){return await(await fetch("/_editor/api/scripts")).json()}async create(t,e){return await(await fetch("/_editor/api/scripts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:t,file:e})})).json()}async get(t){return await(await fetch(`/_editor/api/scripts/${t}`)).json()}async update(t,e){return await(await fetch(`/_editor/api/scripts/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json()}async delete(t,e){const r=e?"?remove_file=true":"",n=`/_editor/api/scripts/${t}`+r;await fetch(n,{method:"DELETE",headers:{"Content-Type":"application/json"}})}async test(t){return(await fetch(`/_editor/api/scripts/${t}/test`,{method:"POST",headers:{"Content-Type":"application/json"}})).json()}}const i=new y;class d{constructor(t){o(this,"record");this.record=h.create(i,t)}static async list(){return(await i.list()).map(e=>new d(e))}static async create(t,e){const r=await i.create(t,e);return new d(r)}static async get(t){const e=await i.get(t);return new d(e)}async delete(t){await i.delete(this.id,t)}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 schedule(){return this.record.get("schedule")}set schedule(t){this.record.set("schedule",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)}get path(){return this.record.get("path")}set path(t){this.record.set("path",t)}async test(){return i.test(this.id)}get position(){const[t,e]=this.record.get("workflow_position");return{x:t,y:e,referential:"world"}}get isInitial(){return!1}}export{c as J,d as S};
//# sourceMappingURL=scripts.afde7ec5.js.map
