"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.lastStatus = lastStatus;
function lastStatus(o) {
    return async function* (getInput) {
        let trigger = o.default(getInput);
        const triggers = {
            default: trigger,
        };
        while (true) {
            let currentValue = getInput();
            let prev = currentValue.lastResult;
            if (!prev) {
                yield;
                continue;
            }
            if (!(prev in o)) {
                prev = 'default';
            }
            if (!triggers[prev]) {
                triggers[prev] = o[prev](getInput);
            }
            await triggers[prev]?.next();
            yield;
        }
    };
}
//# sourceMappingURL=lastStatus.js.map