const e=require(`../../../constants/save-depths.cjs`),t=require(`./AbstractEventService.cjs`);var n=class extends t.AbstractEventService{savedLatestBlockNumber=0;constructor(e,t){super(e,t)}async init(){await this.loadSnapshot()}async retrieveEventsFromLatestBlock(){await this.blockchainEventEmitter.retrieveEvents(this.latestBlockNumber)}get isReady(){return this.blockchainEventEmitter.isReady}async loadSnapshot(){let e=await this.fetchSnapshot(),t=this.deserializeSnapshot(e);this.populateSnapshot(t),this.blockchainEventEmitter.syncFromAtMost(t.latestBlockNumber),this.savedLatestBlockNumber=t.latestBlockNumber}saveSnapshot(){return this.savedLatestBlockNumber=this.latestBlockNumber,this.persistSnapshot(this.serializeSnapshot({latestBlockNumber:this.latestBlockNumber,payload:this.getSnapshotPayload()}))}async afterEventsAccepted(t){(t>0||this.savedLatestBlockNumber+e.saveDepths[this.chainId]<this.latestBlockNumber)&&await this.saveSnapshot()}};exports.AbstractSnapshotService=n;