26012602return fragment;2603}26042605function t_zeroForms__fromHEXtoRGBA(hex, opacityOption) {2606if (!hex) return '';2607if (!opacityOption) opacityOption = 1;26082609// Расширяет значение до 6 значений2610var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;2611hex = hex.replace(shorthandRegex, function (r, g, b) {2612return r + r + g + g + b + b;
}); var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); if (!result) return ''; return `rgba(${parseInt(result[1], 16)}, ${parseInt(result[2], 16)}, ${parseInt(result[3], 16)}, ${opacityOption})`;}function t_zeroForms__createCheckbox(elementObj, labelStyles, formObj, inputPreferences) { var labelElement = t_zeroForms__createLabel('checkbox', labelStyles, formObj); labelElement.classList.add('t-checkbox__control_flex'); var input = document.createElement('input'); t_zeroForms__appendMainSettingToField(input, inputPreferences, 'checkbox', 't-checkbox'); input.value = 'yes'; if (elementObj.li_checked) input.checked = true; if (inputPreferences.require) input.setAttribute('data-tilda-req', '1'); labelElement.insertAdjacentElement('beforeend', input); var indicator = t_zeroForms__createIndicator('checkbox', formObj.inputelscolor, { size: formObj.togglesize, borderSize: formObj.togglebordersize, checkboxBorderRadius: formObj.checkboxborderradius, }); labelElement.insertAdjacentElement('beforeend', indicator); var labelText = document.createElement('span'); labelText.classList.add('t-checkbox__labeltext'); const { label, calcValue } = t396_zeroForms__prepareCalcValue(elementObj, elementObj.li_label); if (calcValue) { t396_zeroForms__setCalcValue(input, calcValue); } labelText.innerHTML = label; labelElement.insertAdjacentElement('beforeend', labelText); return labelElement;}function t_zeroForms__createUploadField(recId, elementObj, inputPreferences, type, formObj, zeroForm) { var isUpldWidget = type === 'uw'; if (window.tildamode !== 'published') { var styles = 'color:#fff;background-color:#000; padding:10px 20px; display:inline-block;'; var editorFileInput = document.createElement('div'); editorFileInput.setAttribute('style', styles); var isNeedKey = isUpldWidget && elementObj.li_uwkey === ''; editorFileInput.textContent = isNeedKey ? 'Please set the key' : 'Upload button will be here'; return editorFileInput; } var selector = isUpldWidget ? 't-upwidget' : 't-uploadcare'; var wrapper = t_zeroForms__createWrapper(selector); var wrapperStyles = isUpldWidget ? 'margin-bottom:5px;min-height:38px;' : 'margin-bottom:10px;'; wrapper.setAttribute('style', wrapperStyles); var input = document.createElement('input'); t_zeroForms__appendMainSettingToField(input, inputPreferences, 'hidden', ''); input.setAttribute('role', isUpldWidget ? 'upwidget-uploader' : 'uploadcare-uploader'); if (inputPreferences.require) input.setAttribute('data-tilda-req', '1'); input.style.display = 'none'; if (isUpldWidget) { input.setAttribute('data-tilda-upwidget-key', elementObj.li_uwkey || ''); if (elementObj.li_multiupl === 'y') input.setAttribute('data-tilda-upwidget-multiple', '1'); } else { input.setAttribute('data-public-key', elementObj.li_uckey || 'demopublickey'); } wrapper.insertAdjacentElement('beforeend', input); var path = isUpldWidget ? 'tilda-upwidget-1.1.min.js' : 'uploadcare-3.x.min.js'; if (path === 'uploadcare-3.x.min.js' && !window.jQuery) path = 'uploadcare-3.x.full.min.js'; if (isUpldWidget || (!isUpldWidget && !document.querySelector('script[src*="uploadcare-3.x"]'))) { t_zeroForms__addResource({ recId, id: selector + '-zero-form', path, type: 'script' }); } const formId = zeroForm.getAttribute('data-elem-id'); const baseSelector = t_zeroForms__createSelector(recId, formId, ''); const uploadCareSelector = '.uploadcare--widget__button.uploadcare--widget__button_type_open'; const uploadWidget = '.t-upwidget-container__button'; const uploadBtnSelector = isUpldWidget ? uploadWidget : uploadCareSelector; let styleValue = ''; const uploadButtonFontStyles = t_zeroForms__getUploadButtonFontStyles(formObj, baseSelector + uploadBtnSelector); if (uploadButtonFontStyles) styleValue += uploadButtonFontStyles; const uploadButtonColorStyles = t_zeroForms__getUploadButtonColorStyles(formObj, baseSelector + uploadBtnSelector); if (uploadButtonColorStyles) styleValue += uploadButtonColorStyles;