var i=Object.defineProperty;var r=(a,t,e)=>t in a?i(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e;var n=(a,t,e)=>(r(a,typeof t!="symbol"?t+"":t,e),e);class h{async get(){return await(await fetch("/_editor/api/workspace",{method:"GET",headers:{"Content-Type":"application/json"}})).json()}async update(t){return await(await fetch("/_editor/api/workspace",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json()}async openFile(t){await fetch("/_editor/api/workspace/open-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})})}async deploy(){await fetch("/_editor/api/workspace/deploy",{method:"POST",headers:{"Content-Type":"application/json"}})}}const s=new h;class o{constructor(t){n(this,"initialState");n(this,"changes");this.initialState=t,this.changes={}}static async get(){const t=await s.get();return new o(t)}get brandName(){return this.get("brand_name")}set brandName(t){this.set("brand_name",t)}get fontColor(){var t;return(t=this.get("font_color"))!=null?t:"#000000"}set fontColor(t){this.set("font_color",t)}get logoUrl(){return this.get("logo_url")}set logoUrl(t){this.set("logo_url",t)}get mainColor(){var t;return(t=this.get("main_color"))!=null?t:"#000000"}set mainColor(t){this.set("main_color",t)}get fontFamily(){return this.get("font_family")}set fontFamily(t){this.set("font_family",t)}get theme(){var t;return(t=this.get("theme"))!=null?t:"#ffffff"}set theme(t){this.set("theme",t)}get(t){var e;return(e=this.changes[t])!=null?e:this.initialState[t]}set(t,e){this.changes[t]=e}async save(){Object.keys(this.changes).length!==0&&(this.initialState=await s.update(this.changes),this.changes={})}hasChanges(){return Object.keys(this.changes).length>0}async openFile(t){await s.openFile(t)}static async deploy(){await s.deploy()}}export{o as W};
//# sourceMappingURL=workspaces.9076bb64.js.map
