var h=Object.defineProperty;var n=(s,t,i)=>t in s?h(s,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[t]=i;var e=(s,t,i)=>(n(s,typeof t!="symbol"?t+"":t,i),i);import{P as c}from"./pubsub.a0411919.js";class r{constructor(t,i,a){e(this,"initialState");e(this,"changes");e(this,"api");e(this,"idKey");e(this,"pubsub");this.initialState=i,this.changes={},this.api=t,this.idKey=a,this.pubsub=new c}get(t){var i;return(i=this.changes[t])!=null?i:this.initialState[t]}set(t,i){this.changes[t]=i}async save(){Object.keys(this.changes).length!==0&&(this.initialState=await this.api.update(this.initialState[this.idKey],this.changes),this.changes={},this.pubsub.publish("update"))}hasChanges(){return Object.keys(this.changes).length>0}get state(){return{...this.initialState,...this.changes}}}export{r as A};
//# sourceMappingURL=utils.f91c500c.js.map
