import ServerDocumentMixin from"../backend/server-document.mjs";import BaseActorDelta from"../../../common/documents/actor-delta.mjs";import*as fields from"../../../common/data/fields.mjs";import Actor from"./actor.mjs";export default class ActorDelta extends(ServerDocumentMixin(BaseActorDelta)){static _migrationRegistry=Actor._migrationRegistry;static isDelta=!0;static _getTemplateFields(e){return e.Actor||{}}async loadRelatedDocuments(){return this.parent.loadRelatedDocuments()}async _preUpdate(e,t,r){if(t.restoreDelta){for(const t of Object.keys(e))delete e[t];for(const t of this.schema)t instanceof fields.DocumentIdField||(t instanceof fields.EmbeddedCollectionField?e[t.name]=[]:e[t.name]=t.initial);e._id=this.id}return super._preUpdate(e,t,r)}_onDelete(e,t){return super._onDelete(e,t),delete this.parent.delta,this.parent.recreateActorDelta()}}