var a=Object.defineProperty;var i=(t,e,r)=>e in t?a(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var n=(t,e,r)=>(i(t,typeof e!="symbol"?e+"":e,r),r);import{A as d}from"./activeRecord.a2b7d343.js";import{i as c}from"./url.d6a620b9.js";import"./outputWidgets.a4629ff8.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="a658407c-5b9f-4806-8471-ec67418569bf",t._sentryDebugIdIdentifier="sentry-dbid-a658407c-5b9f-4806-8471-ec67418569bf")}catch{}})();function l(t,e,r){return e?c(e)?e:r==="player"?`/_assets/${t}`:`/_editor/api/assets/${e}`:null}class h{async get(){return await(await fetch("/_editor/api/workspace",{method:"GET",headers:{"Content-Type":"application/json"}})).json()}async update(e,r){return await(await fetch("/_editor/api/workspace",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})).json()}async create(e){throw new Error("Not implemented")}async openFile(e){await fetch("/_editor/api/workspace/open-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})})}async deploy(){if(!(await fetch("/_editor/api/workspace/deploy",{method:"POST",headers:{"Content-Type":"application/json"}})).ok)throw new Error("Failed to deploy")}}const o=new h;class s{constructor(e){n(this,"record");this.record=d.create(o,e,null)}static async get(){const e=await o.get();return new s(e)}static from(e){return new s(e)}get brandName(){var e;return(e=this.record.get("brand_name"))!=null?e:""}set brandName(e){this.record.set("brand_name",e)}get fontColor(){var e;return(e=this.record.get("font_color"))!=null?e:"#000000"}set fontColor(e){this.record.set("font_color",e)}get logoUrl(){var e;return(e=this.record.get("logo_url"))!=null?e:""}set logoUrl(e){this.record.set("logo_url",e)}get mainColor(){var e;return(e=this.record.get("main_color"))!=null?e:"#000000"}set mainColor(e){this.record.set("main_color",e)}get fontFamily(){var e;return(e=this.record.get("font_family"))!=null?e:"Inter"}set fontFamily(e){this.record.set("font_family",e)}get theme(){var e;return(e=this.record.get("theme"))!=null?e:"#ffffff"}set theme(e){this.record.set("theme",e)}async save(){return this.record.save()}hasChanges(){return this.record.hasChanges()}async openFile(e){await o.openFile(e)}static async deploy(){return o.deploy()}get sidebar(){var e;return(e=this.record.get("sidebar"))!=null?e:[]}set sidebar(e){this.record.set("sidebar",e)}makeRunnerData(){return{sidebar:this.sidebar,brandName:this.brandName,fontFamily:this.fontFamily,logoUrl:l("logo",this.logoUrl,"player"),mainColor:this.mainColor,theme:this.theme}}}export{s as W,l as m};
//# sourceMappingURL=workspaces.6fdb4cab.js.map
