"use strict";(self.webpackChunkgulp_template=self.webpackChunkgulp_template||[]).push([[5453],{3218:function(t,e,n){function o(){const t=document.body,e=window.innerWidth-t.clientWidth;if(t.style.transition="margin-right 0.3s easy-in-out",t.style.marginRight=`${e}px`,t.style.overflow="hidden",!window.matchMedia("(min-width: 996px)").matches){const e=window.pageYOffset;t.style.top=-e+"px",t.style.position="fixed",t.style.width="100%"}}function i(){const t=document.body;if(t.style.transition="margin-right 0s easy-in-out",t.style.marginRight="0",t.style.overflow="unset",!window.matchMedia("(min-width: 996px)").matches){const e=Math.abs(parseInt(t.style.top||0,10));t.style.position="static",t.style.width="auto",t.style.removeProperty("top"),window.scrollTo(0,e||0)}}n.d(e,{$:function(){return o},W:function(){return i}})},2585:function(t,e,n){n.r(e),n.d(e,{default:function(){return i}});var o=n(3218);function i(t,e=null,n=[]){const i=document.querySelector(".js-navigation");t&&(i.classList.contains("navigation__fixed--white")||i.classList.add("navigation__fixed--white"),t.on("show",(()=>{(0,o.$)(),e&&e(...n)})),t.on("hide",(()=>{(0,o.W)(),t.destroy()})),t.show())}},9399:function(t,e,n){function o(){const t=Number(localStorage.getItem("lastScrollPosition")),e="y"===localStorage.getItem("scrollToLastPosition");t&&e&&(window.scrollTo({top:t,behavior:"smooth"}),localStorage.setItem("scrollToLastPosition","n"),localStorage.setItem("lastScrollPosition",0))}n.d(e,{C:function(){return o}})},883:function(t,e,n){n.d(e,{A:function(){return r}});var o=n(3016);function i(t,e,n,o,i,s,r){try{var a=t[s](r),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(o,i)}function s(t){return function(){var e=this,n=arguments;return new Promise((function(o,s){var r=t.apply(e,n);function a(t){i(r,o,s,a,l,"next",t)}function l(t){i(r,o,s,a,l,"throw",t)}a(void 0)}))}}function r(t,e,n=!0){t&&t.addEventListener("submit",function(){var i=s((function*(i){i.preventDefault();const s=this.querySelectorAll(".js-input-base[data-validations]:not(.novalidate)"),r=this.querySelectorAll(".js-select[data-validations]:not(.novalidate)"),a=Array.from(r).map((t=>(t.selectedOptions[0].classList.add(".js-select-option"),t.selectedOptions[0].dataset.validations=t.dataset.validations,t.selectedOptions[0]))),l=(0,o.MG)([...s,...a]);if(n&&l)if(t.classList.contains("js-registration-form")){let n=new FormData(t),o=yield fetch("/local/templates/stenova/ajax/checkEmail.php",{method:"POST",body:JSON.stringify({EMAIL:n.get("REGISTER[EMAIL]")})}),i=yield o.json();if(i.success)"function"==typeof e&&e(),function(t){const e=t.querySelectorAll('[name="UF_INN"]');let n="";for(const t of e)t.value?n=t.value:t.value=n;t.submit()}(t);else{const e=t.querySelector('[name="REGISTER[EMAIL]"]').closest(".input-base");e.classList.add("error"),e.querySelector(".input-base__error").textContent=i.message,e.style.marginBottom="2.8rem",e.scrollIntoView({block:"center",behavior:"smooth"})}}else t.classList.contains("js-buy-cards-form")?(document.addEventListener("capchaVerified",(()=>{ym(25098083,"reachGoal","oplata_cards"),this.submit()})),window.smartCaptcha.reset(),window.smartCaptcha.execute()):("function"==typeof e&&e(),this.submit())}));return function(t){return i.apply(this,arguments)}}())}},3016:function(t,e,n){n.d(e,{LF:function(){return s},M2:function(){return l},MG:function(){return g},Nh:function(){return d},X5:function(){return u},bB:function(){return r},lZ:function(){return i},tJ:function(){return c}});const o=t=>!isNaN(Number(t.trim())),i=t=>11===String(t).replace(/[^\d]/g,"").substring(0,11).length,s=t=>new RegExp(/^(\+?\d)\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{2})[- ]?(\d{2})$/).test(t),r=t=>o(t)&&12===String(t.trim()).length,a=t=>new RegExp(/^[^@]+@[\w\-]+(\.\w+)+\w$/).test(t)||0===t.trim().length,l=t=>o(t)&&6===String(t).length,c=t=>{let e=!0;for(let n=0;n10){e=!1;break}return e},u=t=>t.files.length<=10,d=(t,e,n=".input-base",o="RU")=>{const i=t.closest(n);if(i){const t=i.querySelector(`${n}__error`);i.classList.add(h),t&&(t.innerText=m[e].text[o])}},f=t=>{const e=t.closest(".input-base-captcha")||t.closest(".input-base")||t.closest(".input-file-base")||t.closest(".js-select-wrapper"),n=document.querySelector(".js-navigation");if(e&&n){const t=e.getBoundingClientRect();document.querySelector('.dialog:not([aria-hidden="true"])')?document.querySelector('.dialog:not([aria-hidden="true"]) .dialog-wrapper').scrollTo({top:e.offsetTop-30,behavior:"smooth"}):window.scrollTo({top:t.top+window.pageYOffset-n.clientHeight-60,behavior:"smooth"})}},m={required:{text:{RU:"Поле должно быть заполнено",EN:"Field must be filled"},action:t=>0!==String(t).length},requiredFiles:{text:{RU:"Поле должно быть заполнено",EN:"Field must be filled"},action:t=>t.files&&t.files.length},phone:{text:{RU:"Номер телефона должен состоять из 11 цифр",EN:"Phone number must be 11 digits"},action:i},inn:{text:{RU:"ИНН должен состоять из 10 или 12 цифр",EN:"TIN must be 10 or 12 digits"},action:t=>o(t)&&(10===String(t.trim()).length||12===String(t.trim()).length)},innIP:{text:{RU:"ИНН должен состоять из 12 цифр",EN:"TIN must be 12 digits"},action:r},kpp:{text:{RU:"КПП должен состоять из 9 цифр",EN:"PPC must consist of 9 digits"},action:t=>o(t)&&9===String(t.trim()).length||0===String(t.trim()).length},email:{text:{RU:"Формат почты: name@domain.ru",EN:"Mail format: name@domain.ru"},action:a},onlyNumbers:{text:{RU:"Поле должно содержать только цифры",EN:"The field must contain only numbers"},action:o},cardNumber:{text:{RU:"Номер карты должен состоять из 15 цифр",EN:"Card number must be 15 digits"},action:t=>{const e=t.replace(/\s/g,"");return 15===e.length&&o(e)||0===e.length}},cost:{text:{RU:"Поле должно состоять только из цифр",EN:"The field must contain only numbers"},action:t=>{const e=t.replace(/\s/g,"");return o(e)||0===e.length}},password:{text:{RU:"Пароль должен содержать не менее 8 символов",EN:"Password must contain at least 8 characters"},action:t=>t.length>7||0===t.length},confirmPassword:{text:{RU:"Пароли должны совпадать",EN:"Passwords must match"},action:({oldPassword:t,newPassword:e})=>t===e},korCheck:{text:{RU:"Корреспондентский счет должен состоять из 11 цифр",EN:"Correspondent account must be 11 digits"},action:t=>o(t)&&11===String(t.trim()).length||0===String(t.trim()).length},payCheck:{text:{RU:"Расчетный счет должен состоять из 14 цифр",EN:"Account must be 14 digits long"},action:t=>o(t)&&14===String(t.trim()).length||0===String(t.trim()).length},bik:{text:{RU:"БИК должен состоять из 12 цифр",EN:"BIC must be 12 digits"},action:t=>o(t)&&12===String(t.trim()).length||0===String(t.trim()).length},phoneOrEmail:{text:{RU:"Не корректно заполнен email или телефон",EN:"Incorrectly filled email or phone"},action:t=>s(t)||a(t)||0===String(t.trim()).length},confirmCode:{text:{RU:"Код должен состоять из 6 цифр",EN:"Code must be 6 digits"},action:l},fileMaxWeight:{text:{RU:"Вес одного файла должен быть не более 10 Мбайт",EN:"The weight of one file should be no more than 10 MB"},action:c},filesMaxCount:{text:{RU:"Можно загрузить не более 10 файлов",EN:"You can upload a maximum of 10 files"},action:u},doNotConfirmPhone:{text:{RU:"Номер должен быть подтвержден",EN:"Number must be confirmed"},action:t=>!1},nominalMin1000:{text:{RU:"Номинал карты не может быть менее 1000",EN:"The denomination of the card cannot be less than 1000"},action:t=>t>=1e3}},h="error";function g(t){let e=!0,n=null;if(t.length){const o=document.querySelectorAll(".js-language-radio");let i="RU";if(0!==o.length){const t=Array.from(o).find((t=>t.checked));i=t.value}t.forEach((t=>{const o=t.dataset.validations.split(",");for(let n of o){let o=".input-base",r=t.classList.contains("js-file-input")?{files:t.files,maxWeight:10}:t.value;if(t.classList.contains("js-file-input")&&(o=".input-file-base"),t.classList.contains(".js-select-option")&&(o=".select-wrapper"),"confirmPassword"===n){const e=t.closest(".js-form-container");if(e){var s;const n=(null===(s=e.querySelector(".js-input-password"))||void 0===s?void 0:s.value)||null;n&&(r={oldPassword:n,newPassword:t.value})}}if(!m[n].action(r)){e&&(e=!1),d(t,n,o,i);break}}e||n||(n=t)}))}return n&&f(n),e}},3494:function(t,e,n){var o=n(883),i=n(3016),s=n(7083),r=n(2585),a=n(9399);function l(t,e,n,o,i,s,r){try{var a=t[s](r),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(o,i)}function c(t){return function(){var e=this,n=arguments;return new Promise((function(o,i){var s=t.apply(e,n);function r(t){l(s,o,i,r,a,"next",t)}function a(t){l(s,o,i,r,a,"throw",t)}r(void 0)}))}}function u(t){return d.apply(this,arguments)}function d(){return d=c((function*(t){try{const e=yield fetch("/api/cards/activate/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(e.ok)return e.json();throw new Error("Ошибка при выполнении запроса")}catch(t){console.error(t)}})),d.apply(this,arguments)}window.addEventListener("DOMContentLoaded",(()=>{const t=document.querySelector(".js-gift-form");(0,o.A)(t),null==t||t.addEventListener("submit",(function(){localStorage.setItem("lastScrollPosition",window.scrollY),localStorage.setItem("scrollToLastPosition","y")})),(0,a.C)();const e=document.querySelector(".js-gift-activation-form");if(e){const t=document.querySelector(".js-dialog-gift");if(!t)return;e.addEventListener("submit",(function(e){e.preventDefault();const n=this.querySelectorAll(".js-input-base[data-validations]:not(.novalidate)");(0,i.MG)([...n])&&(0,r.default)(new s.default(t))}));const n=t.querySelector(".dialog-gift__info"),o=e.querySelector("#card_number"),a=e.querySelector("#emailOrPhone"),l=t.querySelector(".js-input-activation-code"),d=t.querySelector(".dialog-gift__btn"),f=BX.message("bitrix_sessid");d.addEventListener("click",c((function*(){const t={cardNumber:null==o?void 0:o.value,activationCode:null==l?void 0:l.value,email:null==a?void 0:a.value,sessid:f},e=yield u(t),{status:i,data:s,errors:r}=e||{};if("success"===i){const{result:t}=s||{};if(null==t?void 0:t.redirect)return void window.location.replace(t.redirect);n.classList.remove("error"),n.classList.add("success"),n.textContent=t}else if("error"===i){const t=null==r?void 0:r.map((t=>t.message)).join("\n");n.classList.remove("success"),n.classList.add("error"),n.textContent=t}})))}}))}},function(t){t.O(0,[8096],(function(){return t(t.s=3494)})),t.O()}]);