"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PositionStateDelayManager = void 0;
const const_1 = require("../../../../../../const");
class PositionStateDelayManager {
    /**
     * Check if delay should be propagated for after track state
     */
    static shouldPropagateAfterTrackDelay(context) {
        if (context && context.lastPositionState !== const_1.StatePositionEnum.AFTER_TRACK && context.lastPositionStateChange) {
            const nowTimestamp = new Date().getTime();
            const stateChangedTimestamp = new Date(context.lastPositionStateChange).getTime();
            // state was changed in the last 30 seconds, then it is allowed to propagate delay
            return context.lastPositionState === const_1.StatePositionEnum.AFTER_TRACK_DELAYED
                ? nowTimestamp - stateChangedTimestamp <= 30 * 1000
                : true;
        }
        return false;
    }
}
exports.PositionStateDelayManager = PositionStateDelayManager;
//# sourceMappingURL=PositionStateDelayManager.js.map