function t862_init(t){var e=document.getElementById("rec"+t),o;if(e&&e.querySelector(".t862")){var r=e.querySelector(".t-form");if(r){var n=e.querySelector(".t862__quiz-wrapper"),i=e.querySelectorAll(".t-input-group"),s=e.querySelector(".t862__btn_prev"),a=e.querySelector(".t862__btn_next"),c=e.querySelector(".t862__btn_result"),u=e.querySelector(".t-form__submit"),l=e.querySelector(".t-submit"),p=e.querySelector(".t-form__errorbox-middle");if(p)var d=p.querySelector(".t-form__errorbox-wrapper");var _='
';p.insertAdjacentHTML("beforebegin",_),r.classList.remove("js-form-proccess");var f=e.querySelector(".t862__capture-form"),y=e.querySelector(".t862__result-title"),v=y?y.textContent:"",m=Boolean(n.getAttribute("data-auto-step-change")),g=!1,S,h=300;t862_workWithAnswerCode(e),Array.prototype.forEach.call(i,(function(t,e){t.setAttribute("data-step-number",e)})),t862_wrapCaptureForm(e);var b=Boolean(f.innerHTML||v),w=0,L=null,q=r.classList.contains("t-conditional-form"),A=!1,E;t862_createSteps(i);var C=t862_createStepsArray(e),k=C.length,x=e.querySelectorAll(".t862__screen-wrapper"),H;C[w]&&(q?t_onFuncLoad("t_form__conditionals__initStepForm",(function(){var o;L=t_form__conditionals__initStepForm({recId:t,steps:x,activeStepIndex:w,ignoredSteps:[".t862__capture-form"],ignoredInputGroups:[".t862__t-input-group_capture"],onConditionalFieldChange:function t(o){k=o.totalActiveStepsCount-1,E=M(),t862_showCounter(e,E.counterCurrentStep,E.counterAllSteps),t862_setProgress(e,E.progressCurrentStep,E.progressAllSteps),K(),O()}}),k=L.getState().totalActiveStepsCount-1,T()})):T())}}function T(){N(w),E=M(),t862_showCounter(e,E.counterCurrentStep,E.counterAllSteps),t862_disabledPrevBtn(e,w),e.setAttribute("data-animationappear","off"),e.style.opacity=1,m&&V(),s.addEventListener("click",(function(t){z(t)})),a.addEventListener("click",(function(t){P(t)})),Array.prototype.forEach.call(i,(function(t){t.addEventListener("keypress",(function(t){var e=r.querySelector(".t-step-form__step_active");"Enter"!==t.code&&13!==t.keyCode||r.classList.contains("js-form-proccess")||e.querySelector(".t-input-group_ta")||P(t)}))})),c.addEventListener("click",(function(t){P(t)})),t862_openToHook(e,x,f),e.addEventListener("click",(function(t){var o=t.target,r;!!o.closest('[type="submit"]')&&o&&t862_adjustStepToHeight(e)})),t862_adjustHeightOnResize(e)}function z(t){A||(t.preventDefault(),G(),I()||(w=L?L.getState().prevStepIndex:j()-1,L&&L.onStepChange(w),E=M(),t862_setProgress(e,E.progressCurrentStep,E.progressAllSteps),t862_showCounter(e,E.counterCurrentStep,E.counterAllSteps),t862_awayFromResultScreen(e),t862_hideError(e,w),t862_disabledPrevBtn(e,w),N(w),r.classList.contains("js-form-proccess")&&r.classList.remove("js-form-proccess")))}function P(t){if(!A){t.preventDefault(),G();var o=t862_showError(e,n,w);if(o&&d&&(d.style.display="none"),!o){var r=F();w=L?L.getState().nextStepIndex:j()+1,L&&L.onStepChange(w),E=M(),t862_setProgress(e,E.progressCurrentStep,E.progressAllSteps),t862_showCounter(e,E.counterCurrentStep,E.counterAllSteps),t862_disabledPrevBtn(e,w),r&&b?W():N(w)}}}function j(){return L?L.getState().activePossibleStepIndex:w}function M(){return{counterCurrentStep:j()+1,counterAllSteps:k,progressCurrentStep:j(),progressAllSteps:b?k:k-1}}function F(){return j()===k-1}function I(){return 0===j()}function B(){return j()===k-2}function O(){if(!b){if(B())return a.style.display="none",c.style.display="block",void(u.style.display="none");if(F())return a.style.display="none",c.style.display="none",void(u.style.display="block")}if(F())return a.style.display="none",c.style.display="block",void(u.style.display="none");a.style.display="block",c.style.display="none",u.style.display="none"}function N(t){var o=r.querySelector(".t-step-form__step_active"),n=C[t];if(o)R(o,n,{onNewStepAnimationStart:function t(){t862_checkMode(),K(),O(),J(e);var o=e.querySelector(".t-range");o&&t_triggerEvent(o,"displayChanged"),A=!1,t862_adjustStepToHeight(e)},onAnimationStart:function t(){A=!0,D(e)}});else{n&&n.classList.add("t-step-form__step_active"),t862_checkMode(),K(),O();var i=e.querySelector(".t-range");i&&t_triggerEvent(i,"displayChanged"),t862_adjustStepToHeight(e)}}function W(){r.classList.add("js-form-proccess");var t=e.querySelector(".t862__quiz-description"),o;R(r.querySelector(".t-step-form__step_active"),f,{onAnimationStart:function o(){A=!0,t&&(t.style.display="none"),y&&(y.style.display="block"),c.style.display="none",u.style.display="block",D(e)},onNewStepAnimationStart:function t(){t862_checkMode(),J(e),A=!1,t862_adjustStepToHeight(e)}})}function R(t,e,o){function r(){e.classList.remove("t-step-form__step_fadeIn"),e.removeEventListener("animationend",r),e.removeEventListener("animationcancel",n),o.onAnimationComplete&&o.onAnimationComplete()}function n(){e.classList.remove("t-step-form__step_fadeIn"),e.removeEventListener("animationend",r),e.removeEventListener("animationcancel",n)}function i(){e.addEventListener("animationend",r),e.addEventListener("animationcancel",n),e.classList.add("t-step-form__step_active"),e.classList.add("t-step-form__step_fadeIn"),o.onNewStepAnimationStart&&o.onNewStepAnimationStart()}function s(){t.classList.remove("t-step-form__step_fadeOut"),t.classList.remove("t-step-form__step_active"),t.removeEventListener("animationend",s),e&&i()}function a(){t.addEventListener("animationend",s),t.classList.add("t-step-form__step_fadeOut")}return o.onAnimationStart&&o.onAnimationStart(),t?a():i()}function D(){s&&(s.disabled=!0),a&&(a.disabled=!0),c&&(c.disabled=!0),l&&(l.disabled=!0)}function J(){I()||s&&(s.disabled=!1),a&&(a.disabled=!1),c&&(c.disabled=!1),l&&(l.disabled=!1)}function V(){var t=["ri","rd","rs","sb","cb"],e;C.filter((function(e){var o=e.querySelector(".t-input-group");return-1!==t.indexOf(o.getAttribute("data-field-type"))})).forEach((function(t){var e=Array.prototype.slice.call(t.querySelectorAll(".js-tilda-rule"));(e=e.filter((function(t){return!t.classList.contains("t-radio-ownanswer")}))).forEach((function(t){t.addEventListener("change",Y)}))}))}function Y(t){var e;F()&&!b||Q(null==(e=t.target)?void 0:e.parentNode)||g||(g=!0,S=setTimeout((function(){P(t),G()}),h))}function G(){clearTimeout(S),g=!1}function K(){!b&&F()?r.classList.add("js-form-proccess"):r.classList.remove("js-form-proccess")}function Q(t){return t&&t.querySelectorAll('input[type="checkbox"]').length>0}}function t862_workWithAnswerCode(t){for(var e=t.querySelectorAll(".t-input-group_ri input"),o=t.querySelectorAll(".t-input-group_rd input"),r=t.querySelectorAll(".t-input-group_sb option"),n=0;n=o.length-4){var p=!0;if(r.classList.contains("t862__quiz-form-wrapper_newcapturecondition")){var d=t862_getNextAll(n);Array.prototype.forEach.call(d,(function(t){p=t.classList.contains("t-input-group_cb")||t.classList.contains("t-input-group_em")||t.classList.contains("t-input-group_nm")||t.classList.contains("t-input-group_ph")}))}p&&(i||s||a||c)&&(n.classList.add("t862__t-input-group_capture"),e.appendChild(n))}}))}function t862_showCounter(t,e,o){var r=t.querySelector(".t862__quiz-description-counter");r&&(r.innerHTML=e+"/"+o)}function t862_setProgress(t,e,o){var r=t.querySelector(".t862__progressbar"),n=parseFloat(getComputedStyle(r).width),i=t.querySelector(".t862__progress"),s=n/o,a=100*Math.abs(e*s/n)+"%";i&&(i.style.width=a)}function t862_createStepsArray(t){var e=t.querySelectorAll(".t862__screen-wrapper"),o=[];return Array.prototype.forEach.call(e,(function(t){t.classList.contains("t862__capture-form")||o.push(t)})),o}function t862_disabledPrevBtn(t,e){var o=t.querySelector(".t862__btn_prev");0===e?o.setAttribute("disabled",""):o.removeAttribute("disabled")}function t862_openToHook(t,e,o){var r=t.querySelector(".t-popup"),n=t.querySelector(".t-popup__close"),i=t.querySelectorAll('a[href*="#"]'),s=r.getAttribute("data-tooltip-hook"),a=r.getAttribute("data-track-popup"),c=r.querySelector(".t-form__submit .t-submit"),u=t862__escClosePopup.bind(r,t);s&&(t_onFuncLoad("t_popup__addAttributesForAccessibility",(function(){t_popup__addAttributesForAccessibility(s)})),document.addEventListener("click",(function(r){var n=r.target.closest('a[href="'+s+'"]');if(n&&(r.preventDefault(),window.isMobile||n.classList.add("t-popup__triggered-btn"),t862_showPopup(t,e,o,u),setTimeout((function(){t862_adjustStepToHeight(t,{initial:!0})}),50),t862__lazyLoad(),a)){var i=s;"#popup:"==i.substring(0,7)&&(i=i.substring(7)),Tilda.sendEventToStatistics(a,i)}}))),r.addEventListener("click",(function(e){e.target===this&&t862_closePopup(t,u)})),n.addEventListener("click",(function(){t862_closePopup(t,u)}));for(var l=0;l640&&c.classList.contains("t862__quiz_fixedheight")&&t862_setHeight(t,e,o),n>640&&c.classList.contains("t862__quiz_nofixedheight")&&(a.style.transition="height ease-in-out 0.3s"),n<=640&&t862_setMobileHeight(),t862__showJivo("1","1")}),50),t_triggerEvent(document.body,"popupShowed"),i.classList.add("t-body_popupshowed"),i.classList.add("t862__body_popupshowed"),/iPhone|iPad|iPod/i.test(navigator.userAgent)&&!window.MSStream&&setTimeout((function(){t862_lockScroll()}),500),document.addEventListener("keydown",r)}function t862__escClosePopup(t,e){"Escape"===arguments[1].key&&t862_closePopup(t,e)}var t862_debounceAdjustheight=t862_debounce(t862_adjustStepToHeight,200);function t862_adjustHeightOnResize(t){window.addEventListener("resize",(function(){t862_debounceAdjustheight(t)}))}function t862_debounce(t,e){var o;return function(){var r=Array.prototype.slice.call(arguments);clearTimeout(o),o=setTimeout((function(){t.apply(null,r)}),e)}}function t862_adjustStepToHeight(t,e){var o=30;e=e||{initial:!1};var r=t.querySelector(".t862__quiz_nofixedheight");if(r){var n=t.querySelector(".t862__quiz-description-wrapper"),i=t.querySelector(".t862__quiz-form-wrapper"),s=n?n.offsetHeight:0,a=i?i.offsetHeight:0;if(0!==a){var c=t.querySelector(".t862__wrapper"),u=getComputedStyle(c),l,p=s+a,d=p+(parseInt(u.paddingBottom,10)||0),_=parseInt(getComputedStyle(r).height,10),f=Math.abs(_-p);if(e.initial)return t862_resizePopup(t,d),void(r.style.height=p+"px");f_&&(r.style.overflow="hidden",setTimeout((function(){r.style.overflow=""}),300)),t862_resizePopup(t,d),r.style.height=p+"px")}}else t862_resizePopup(t)}function t862_setHeight(t,e){var o=t.querySelector(".t862__quiz-form-wrapper"),r=t.querySelector(".t862__result-title"),n=t.querySelector(".t862__quiz-description"),i=r?r.offsetHeight:0,s=n?n.offsetHeight:0,a=Array.prototype.slice.call(e),c=null;a.forEach((function(t){var e=t.classList.contains("t-step-form__step_active");e||t.classList.add("t-step-form__step_active"),c=Math.max(t.offsetHeight,c),e||t.classList.remove("t-step-form__step_active")})),a.forEach((function(t){t.style.minHeight=c+"px"})),o.style.minHeight=c+"px";var u=Math.max(s,i),l=o.offsetHeight,p=t.querySelector(".t862__btn-wrapper").offsetHeight;t.querySelector(".t862__wrapper").style.minHeight=u+l+p+"px"}function t862_setMobileHeight(){t862_calcVH(),window.addEventListener("resize",t862_calcVH)}function t862_calcVH(){var t=.01*window.innerHeight;document.documentElement.style.setProperty("--vh",t+"px")}function t862_closePopup(t,e){t="string"==typeof t?document.getElementById("rec"+t):t;var o=document.body,r=t.querySelector(".t-popup"),n=r.querySelector(".t-popup__container"),i;r===document.querySelector(".t-popup.t-popup_show")&&(t_triggerEvent(document.body,"popupHidden"),o.classList.remove("t-body_popupshowed"),o.classList.remove("t862__body_popupshowed")),/iPhone|iPad|iPod/i.test(navigator.userAgent)&&!window.MSStream&&t862_unlockScroll(),t_onFuncLoad("t_popup__addFocusOnTriggerButton",(function(){t_popup__addFocusOnTriggerButton()})),r.classList.remove("t-popup_show"),n.style.removeProperty("transition"),t862__showJivo("2147483647","2147483648"),setTimeout((function(){for(var t=document.querySelectorAll(".t-popup:not(.t-popup_show)"),e=0;eo?r.classList.add("t-popup__container-static"):r.classList.remove("t-popup__container-static")}function t862__showJivo(t,e){for(var o=document.querySelectorAll("._show_1e.wrap_mW.__jivoMobileButton"),r=document.querySelectorAll(".label_39#jvlabelWrap"),n=0;n