import * as _ from 'lodash-es';
import React from 'react';
import { useExamTranslation } from '../i18n';
function AnsweringInstructions({ maxAnswers, minAnswers, elementType, childQuestions }) {
    const childDisplayNumbers = childQuestions.map(question => _.isString(question) ? question : question.getAttribute('display-number'));
    const { t } = useExamTranslation();
    const possibleTranslationStrings = cartesian([childDisplayNumbers.length, '*'], [maxAnswers, '*'], [minAnswers != null ? minAnswers : maxAnswers, '*']).map(([childQuestionCount, maxAnswerCount, minAnswerCount]) => `answering-instructions.${elementType}_${childQuestionCount}_${minAnswerCount}_${maxAnswerCount}`);
    const answerCount = [minAnswers, maxAnswers];
    const questions = [_.first(childDisplayNumbers), _.last(childDisplayNumbers)];
    return React.createElement(React.Fragment, null, t(possibleTranslationStrings, { answerCount, questions }));
}
function cartesian(as, bs, cs) {
    const result = [];
    for (const a of as) {
        for (const b of bs) {
            for (const c of cs) {
                result.push([a, b, c]);
            }
        }
    }
    return result;
}
export default React.memo(AnsweringInstructions);
//# sourceMappingURL=AnsweringInstructions.js.map