1101group: group,1102type: type,1103};1104}11051106/**1107* Сравнивает условие на файловый инпут.1108* @param {element} fileInput1109* @param {ComparisonType} comparisonType1110* - Возможнные варианты группы: file_st1111* - Возможнные вараинты типа сравнения:1112* - uploaded | not_uploaded
*/function t_form__conditionals_compareFiles(fileInput, comparisonType) { var type = t_form__conditionals_prepareComparisonType(comparisonType).type; if (type === 'uploaded') { return Boolean(fileInput && fileInput.value); } if (type === 'not_uploaded') { // либо нет инпута, либо нет файла в нем return Boolean(!fileInput || !fileInput.value); } throw new Error('Unknown comparison type when comparing files: ' + comparisonType);}/** * @param {CalculatedCondition} calculatedCondition */function t_form__conditionals_canApplyCondition(calculatedCondition) { return calculatedCondition.status === 'valid' && Boolean(calculatedCondition.value);}/** * Фильтрует входящие элементы, исключая те, которые соответствуют одному из указанных селекторов * @param {Array<HTMLElement>} elements * @param {Array<string>} filterSelectors * @returns */function t_form__conditionals_filterOut(elements, filterSelectors) { return elements.filter(function (input) { return !input.matches(filterSelectors.join(',')); });}/** * Добавляет гонку между вызовами переданного события и нажатием на Enter. * Если вызывается событие нажатия на Enter, то событие по умолчанию блокируется. * * @param {Element} input - поле с для ввода. * @param {string} defaultEvent - событие по умолчанию. * @param {Function} handler - функция, которая должна вызваться. */function t_form__conditionals_listenToEventOrEnterPress(input, defaultEvent, handler) { if (!input) return; var hasBeenTriggered = false; input.addEventListener(defaultEvent, function () { if (!hasBeenTriggered) { handler(); } hasBeenTriggered = false; }); input.addEventListener('keydown', function (event) { if (event.key === 'Enter') { handler(); hasBeenTriggered = true; } });}function t_form__conditionals_prepareCalcValue(element) { var value = element.value; if (!value) return value; var calcValue = element.getAttribute('data-calc-value'); var ownVariantTitle = element.getAttribute('data-own-variant-title'); return ownVariantTitle ? [ownVariantTitle, calcValue].join('=') // для своего варианта ответа не учитываем значение, а берем заголовок : [value, calcValue].join('=');}/** * * @param {HTMLInputElement} field * @param {ConditionValue} condition */function t_form__conditionals_verifyCheckboxOrRadio(field, condition) { var isCheckbox = field.getAttribute('data-field-radcb') === 'cb'; var inputs = isCheckbox ? field.querySelectorAll('input[type="checkbox"]') : field.querySelectorAll('input[type="radio"]'); var checked = Array.from(inputs).filter(function (element) { return element.checked; }); return checked.some(function (element) {