function t_contactMethod__init(t,e){var o=t_contactMethod__getRec(t);if(o){var n=o.querySelector('[data-input-lid="'+e+'"][data-field-type="contact_method"]');if(n){var a=n.querySelectorAll(".t-contact-method__type");if(a.length){var c=a[0];if(c){var r=n.querySelector(".t-contact-method__value-container"),_=n.querySelectorAll('.t-contact-method__type input[type="radio"]'),i=Array.from(_).map((function(t){return t.value})),d,u;if(i.some((function(t){return["phone","telegram","whatsapp","viber"].includes(t)})))t_contactMethod__loadPhoneMask().then((function(){var t=n.querySelectorAll('[data-phonemask-lid="'+e+'"]');window.t_form_phonemask__mulitple__load(t)})),r.classList.add("t-contact-method__loading"),_.forEach((function(t){return t_contactMethod__disable(t)})),"yes"===n.getAttribute("data-init-mask")?l():n.addEventListener("phoneMaskReady",(function(){l()}));else l()}}}}function l(){s(c.getAttribute("data-method-type")),r.classList.remove("t-contact-method__loading"),_.forEach((function(t){t_contactMethod__enable(t),t.addEventListener("change",(function(){s(t.value)}))})),n.dispatchEvent(new Event("inputReady")),n.setAttribute("data-input-ready","true"),t_contactMethod__applyTranslation(n),n.addEventListener("reset",(function(){f()}))}function s(t,e){var o,n=(e||{}).silent,a=void 0!==n&&n;i.forEach((function(e){e===t?h({contactMethod:e}):p({contactMethod:e,silent:a})}))}function h(t){var e=t.contactMethod,o=t_contactMethod__getValueGroup(n,e),a=t_contactMethod__getDefaultInputTypeForContactMethod(e);t_contactMethod__show(o),m({group:o,inputType:a}),t_contactMethod__isHybridValueGroup(o)&&M(o)}function p(t){var e=t.contactMethod,o=t.silent,a=t_contactMethod__getValueGroup(n,e),c=t_contactMethod__getPhoneInputElements(a),r=c.valueHolder,_=c.isoHolder,i=c.maskHolder,d=t_contactMethod__getInputElement(a,"text");t_contactMethod__isHidden(a)||(t_contactMethod__resetInputValue(a,"text",{silent:o}),t_contactMethod__resetInputValue(a,"phone",{silent:o}),t_contactMethod__hide(a)),t_contactMethod__disable(d),t_contactMethod__disable(r),t_contactMethod__disable(_),t_contactMethod__disable(i)}function m(t){var e=t.group,o=t.inputType,n=t.autoFocus,a=void 0!==n&&n,c=e.querySelector(".t-input-phonemask__wrap"),r=t_contactMethod__getPhoneInputElements(c),_=r.valueHolder,i=r.maskHolder,d=r.isoHolder,u=t_contactMethod__getInputElement(e,"phone"),l=t_contactMethod__getInputElement(e,"text"),s=u?u.closest(".t-input-block"):null,h=l?l.closest(".t-input-block"):null;return"phone"===o&&u?(t_contactMethod__hide(h),t_contactMethod__disable(l),t_contactMethod__show(s),t_contactMethod__enable(_),t_contactMethod__enable(d),t_contactMethod__enable(i),a&&u.focus(),{wrapper:c,input:u}):"text"===o&&l?(t_contactMethod__hide(s),t_contactMethod__disable(_),t_contactMethod__disable(d),t_contactMethod__disable(i),t_contactMethod__show(h),t_contactMethod__enable(l),a&&l.focus(),{input:l}):void 0}function f(){var t=c.getAttribute("data-method-type"),e,o;_.forEach((function(e){e.value===t&&(e.checked=!0,s(t,{silent:!0}))})),t_contactMethod__resetInputValue(t_contactMethod__getValueGroup(n,t),"text",{silent:!0}),n.querySelectorAll(".t-phonemask-input-group").forEach((function(t){return t.dispatchEvent(new CustomEvent("reset"))}))}function M(t){var e="hybrid-contact-method-initted";if("true"!==t.getAttribute(e)){var o=t_contactMethod__getInputElement(t,"text"),n=t_contactMethod__getInputElement(t,"phone");o&&(o.addEventListener("input",(function(e){v(t,e)})),n.addEventListener("input",(function(e){v(t,e)})),t.setAttribute(e,"true"))}}function v(t,e){var o=e.target.value,n,a=/^[+0-9]/.test(o),c=""===o,r=e.target.classList.contains("js-username-input");if(a&&r)return t_contactMethod__resetInputValue(t,"text"),void m({inputType:"phone",autoFocus:!0,group:t});c&&!r&&m({inputType:"text",autoFocus:!0,group:t})}}function t_contactMethod__getRec(t){var e=document.getElementById("rec"+t);return e||("zero"===window.tildamode?document.querySelector('.tn-artboard[data-record-id="'+t+'"]'):null)}function t_contactMethod__waitForFunc(t){return new Promise((function(e,o){if("function"!=typeof window.t_onFuncLoad)if("function"!=typeof window[t])var n=15e3,a=Date.now(),c=setInterval((function(){"function"==typeof window[t]?(clearInterval(c),e()):Date.now()-a>n&&(clearInterval(c),o(new Error(t+" is undefined")))}),100);else e();else t_onFuncLoad(t,e)}))}var t_contactMethod__loadPhoneMask=function t(){try{function e(){return Promise.resolve(t_contactMethod__waitForFunc("t_form_phonemask__mulitple__load")).then((function(){}))}var o=function(){if("function"==typeof window.t_onFuncLoad)return Promise.resolve(t_contactMethod__waitForFunc("t_loadJsFile")).then((function(){var t="https://static.tildacdn."+t_contactMethod__getRootZone()+"/js/tilda-phone-mask-1.1.min.js";return Promise.resolve(new Promise((function(e){return window.t_loadJsFile(t,e)}))).then((function(){}))}))}();return Promise.resolve(o&&o.then?o.then(e):e(o))}catch(n){return Promise.reject(n)}};function t_contactMethod__isHybridValueGroup(t){if(t)return t.classList.contains("t-contact-method__hybrid")}function t_contactMethod__resetInputValue(t,e,o){var n,a=(o||{}).silent,c=void 0!==a&&a,r=t_contactMethod__getInputElement(t,e);if(r){var _=r.value,i="";r.value=i,r.classList.remove("t-input_has-content"),_===i||c||r.dispatchEvent(new Event("change",{bubbles:!0}))}}function t_contactMethod__getInputElement(t,e){return"phone"===e?t.querySelector(".t-input-phonemask"):t.querySelector(".js-username-input")}function t_contactMethod__getPhoneInputElements(t){var e,o,n;return{valueHolder:t?t.querySelector(".js-phonemask-result"):null,maskHolder:t?t_contactMethod__getInputElement(t,"phone"):null,isoHolder:t?t.querySelector(".js-phonemask-result-iso"):null}}function t_contactMethod__getValueGroup(t,e){return t.querySelector(".t-contact-method__"+e+"-value")}function t_contactMethod__getDefaultInputTypeForContactMethod(t){return["phone","whatsapp","viber"].includes(t)?"phone":"text"}function t_contactMethod__isHidden(t){return t&&t.classList.contains("t-contact-method__hidden")}function t_contactMethod__hide(t){t&&t.classList.add("t-contact-method__hidden")}function t_contactMethod__show(t){t&&t.classList.remove("t-contact-method__hidden")}function t_contactMethod__disable(t){t&&(t.disabled=!0,t.classList.remove("js-tilda-rule"))}function t_contactMethod__enable(t){t&&(t.disabled=!1,t.classList.add("js-tilda-rule"))}function t_contactMethod__getRootZone(){var t=document.getElementById("allrecords"),e;return t&&t.getAttribute("data-tilda-root-zone")||"com"}function t_contactMethod__applyTranslation(t){var e=t.querySelector('.t-contact-method__title[data-contact-method="phone"]'),o;e&&(e.textContent=t_contactMethod__tranlsate("phone")),t.querySelectorAll(".js-username-input").forEach((function(t){var e=t.getAttribute("data-contact-method");if(e){var o,n=t.closest(".t-input-block").querySelector(".t-input__vis-ph");n?n.textContent=t_contactMethod__getPlaceholder(e):t.placeholder=t_contactMethod__getPlaceholder(e)}}))}function t_contactMethod__tranlsate(t){var e={phone:{RU:"Телефон",EN:"Phone",DE:"Telefon",ES:"Teléfono",PT:"Telefone"},username_email_or_phone:{RU:"Имя пользователя, почта или телефон",EN:"Username, email or phone number",DE:"Nutzername, E-Mail oder Telefonnummer",ES:"Nombre de usuario, e-mail o número de teléfono",PT:"Nome de utilizador, e-mail ou número de telefone"},username_or_phone:{RU:"Имя пользователя или телефон",EN:"Username or phone number",DE:"Nutzername oder Telefonnummer",ES:"Nombre de usuario o número de teléfono",PT:"Nome de utilizador ou número de telefone"},username_id_or_link:{RU:"Имя пользователя, ID или ссылка",EN:"Username, ID or link",DE:"Nutzername, ID oder Link",ES:"Nombre de usuario, ID o enlace",PT:"Nome de utilizador, ID ou ligação"},link_or_phone:{RU:"Cсылка или телефон",EN:"Link or phone number",DE:"Link oder Telefonnummer",ES:"Enlace o número de teléfono",PT:"Ligação ou número de telefone"},link:{RU:"Cсылка",EN:"Link",DE:"Link",ES:"Enlace",PT:"Ligação"}};if(!e[t])return t;var o=t_contactMethod__getLang()||"EN";return e[t][o]||e[t].EN}function t_contactMethod__getLang(){var t=t_contactMethod__getProjectLang(),e;return t?t.toUpperCase():(window.navigator.userLanguage||window.navigator.language).toUpperCase().slice(0,2)}function t_contactMethod__getProjectLang(){var t=document.getElementById("allrecords");return t?t.getAttribute("data-tilda-project-lang")||"":"zero"===window.tildamode&&window.site_lang||""}function t_contactMethod__getPlaceholder(t){return"telegram"===t?t_contactMethod__tranlsate("username_or_phone"):"vk"===t||"fb_messenger"===t?t_contactMethod__tranlsate("username_id_or_link"):"skype"===t?t_contactMethod__tranlsate("username_email_or_phone"):"max_messenger"===t?t_contactMethod__tranlsate("link_or_phone"):void 0}