var c=Object.defineProperty;var u=(s,e,t)=>e in s?c(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var a=(s,e,t)=>(u(s,typeof e!="symbol"?e+"":e,t),t);import{E as g,eG as h,eH as d}from"./outputWidgets.04a14374.js";import{P as l}from"./pubsub.bb759777.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]="e4960e77-d6d4-486d-be92-0690ec284cde",s._sentryDebugIdIdentifier="sentry-dbid-e4960e77-d6d4-486d-be92-0690ec284cde")}catch{}})();class n{constructor(e){a(this,"initialState");a(this,"pubsub");a(this,"_changes");this.initialState=e,this.pubsub=new l,this._changes=g({})}static from(e){return h(new n(e))}get changes(){return this._changes.value}get(e){var t;return(t=this.changes[e])!=null?t:this.initialState[e]}set(e,t){this._changes.value={...this.changes,[e]:t}}hasChanges(e){return e?e in this.changes:Object.keys(this.changes).length>0}hasChangesDeep(e){return e in this.changes&&!d.exports.isEqual(this.initialState[e],this.changes[e])}get state(){return{...this.initialState,...this.changes}}resetChanges(){const e={...this.changes};this._changes.value={},this.pubsub.publish("update",e)}}class r extends n{constructor(t,i){super(i);a(this,"api");this.api=t}static create(t,i){return h(new r(t,i))}async save(){if(Object.keys(this.changes).length===0)return;this.initialState=await this.api.update(this.initialState.id,this.changes);const t={...this.changes};this._changes.value={},this.pubsub.publish("update",t)}}export{r as A,n as E};
//# sourceMappingURL=record.b64a41e6.js.map
