var c=Object.defineProperty;var d=(s,e,t)=>e in s?c(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var i=(s,e,t)=>(d(s,typeof e!="symbol"?e+"":e,t),t);import{A as h}from"./record.7835c07e.js";import"./outputWidgets.6d6b4a37.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[e]="fb60b9ee-481b-4948-8500-b9e88deaff53",s._sentryDebugIdIdentifier="sentry-dbid-fb60b9ee-481b-4948-8500-b9e88deaff53")}catch{}})();class u{async list(){return await(await fetch("/_editor/api/jobs")).json()}async create(){return await(await fetch("/_editor/api/jobs",{method:"POST",headers:{"Content-Type":"application/json"}})).json()}async get(e){return await(await fetch(`/_editor/api/jobs/${e}`)).json()}async update(e,t){return await(await fetch(`/_editor/api/jobs/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json()}async delete(e,t){const n=t?"?remove_file=true":"",o=`/_editor/api/jobs/${e}`+n;await fetch(o,{method:"DELETE",headers:{"Content-Type":"application/json"}})}async test(e){return(await fetch(`/_editor/api/jobs/${e}/test`,{method:"POST",headers:{"Content-Type":"application/json"}})).json()}}const r=new u;class a{constructor(e){i(this,"record");i(this,"isInitial",!0);this.record=h.create(r,e)}static async list(){return(await r.list()).map(t=>new a(t))}static async create(){const e=await r.create();return new a(e)}static async get(e){const t=await r.get(e);return new a(t)}async delete(e){await r.delete(this.id,e)}async duplicate(){return this}async save(){await this.record.save()}onUpdate(e){this.record.pubsub.subscribe("update",e)}hasChanges(e){return this.record.hasChanges(e)}get schedule(){return this.record.get("schedule")}set schedule(e){this.record.set("schedule",e)}get title(){return this.record.get("title")}set title(e){this.record.set("title",e)}get file(){return this.record.get("file")}set file(e){this.record.set("file",e)}get id(){return this.record.get("id")}async test(){return r.test(this.id)}get position(){const[e,t]=this.record.get("workflow_position");return{x:e,y:t,referential:"world"}}}export{a as J};
//# sourceMappingURL=jobs.18f2760c.js.map
