import { action, makeObservable, observable } from 'mobx';
import { getCollectionComponentUniqueId } from '../utils/getCollectionComponentUniqueId';
export class WixPatternsRouterState {
    constructor(params) {
        this.stateRefs = new Map();
        this.currentState = null;
        this.isUsingCache = false;
        this.isCollectionStale = false;
        this.container = params.container;
        this._navigate = params.navigate;
        makeObservable(this, {
            currentState: observable.ref,
            setCurrentState: action,
            isCollectionStale: observable,
        });
    }
    setCurrentState(state) {
        this.currentState = state;
    }
    saveState(state) {
        const uniqueId = getCollectionComponentUniqueId(state);
        this.stateRefs.set(uniqueId, state);
    }
    navigate(to, options) {
        this.setCurrentState(options.state);
        this._navigate?.(to, options);
    }
}
//# sourceMappingURL=WixPatternsRouterState.js.map