"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MemoryUndo = void 0;
/**
 * A Memory-based undo manager.
 */
class MemoryUndo {
    constructor() {
        /** Undo stack. */
        this.uStack = [];
        /** Redo stack. */
        this.rStack = [];
    }
    // /** ------------------------------------------------------ {@link UndoRedo} */
    push(undo) {
        this.rStack = [];
        this.uStack.push(undo);
    }
    undo() {
        const undo = this.uStack.pop();
        if (undo) {
            const redo = undo[1](undo[0]);
            this.rStack.push(redo);
        }
    }
    redo() {
        const redo = this.rStack.pop();
        if (redo) {
            const undo = redo[1](redo[0]);
            this.uStack.push(undo);
        }
    }
    /** -------------------------------------------------- {@link UiLifeCycles} */
    start() {
        return () => { };
    }
}
exports.MemoryUndo = MemoryUndo;
//# sourceMappingURL=MemoryUndo.js.map