export function resolveWinner(input, pickWinner) {
    const primary = input.variantResults.primary;
    const refiner = input.variantResults.refiner;
    if (input.tournamentOutcome?.ranked?.length) {
        const top = input.tournamentOutcome.ranked[0];
        const winnerVariant = top.candidateId === 'refiner' && refiner ? 'refiner' : 'primary';
        if (winnerVariant === 'primary') {
            primary.humanAccuracy = top.humanAccuracy;
        }
        else if (refiner) {
            refiner.humanAccuracy = top.humanAccuracy;
        }
        const winner = winnerVariant === 'refiner' && refiner ? refiner : primary;
        return { winner, winnerVariant };
    }
    return pickWinner(input.modeDefinition, primary, refiner);
}
//# sourceMappingURL=winnerStrategy.js.map